@makeswift/runtime 0.8.9 → 0.8.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Box.cjs.js +6 -6
- package/dist/Box.es.js +6 -6
- package/dist/Button.cjs.js +5 -6
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +5 -6
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +7 -8
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +7 -8
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +5 -6
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +5 -6
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +5 -6
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +5 -6
- package/dist/Divider.es.js.map +1 -1
- package/dist/Embed.cjs.js +7 -7
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +7 -7
- package/dist/Form.cjs.js +5 -6
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +6 -7
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +4 -5
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +5 -6
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +8 -9
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +8 -9
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +7 -7
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +7 -7
- package/dist/PreviewProvider.cjs.js +34 -35
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +6 -7
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +72 -66
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +18 -12
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +362 -0
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -0
- package/dist/ReadOnlyTextV2.es.js +358 -0
- package/dist/ReadOnlyTextV2.es.js.map +1 -0
- package/dist/Root.cjs.js +6 -6
- package/dist/Root.es.js +6 -6
- package/dist/SocialLinks.cjs.js +5 -6
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +5 -6
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Text.cjs.js +6 -7
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +7 -8
- package/dist/Text.es.js.map +1 -1
- package/dist/Video.cjs.js +5 -6
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +5 -6
- package/dist/Video.es.js.map +1 -1
- package/dist/actions.cjs.js.map +1 -1
- package/dist/actions.es.js.map +1 -1
- package/dist/builder.cjs.js +6 -2
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +6 -2
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +9 -9
- package/dist/components.es.js +9 -9
- package/dist/constants.cjs.js +0 -408
- package/dist/constants.cjs.js.map +1 -1
- package/dist/constants.es.js +1 -372
- package/dist/constants.es.js.map +1 -1
- package/dist/control-serialization.cjs.js +82 -41
- package/dist/control-serialization.cjs.js.map +1 -1
- package/dist/control-serialization.es.js +42 -1
- package/dist/control-serialization.es.js.map +1 -1
- package/dist/controls.cjs.js +58 -53
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +8 -3
- package/dist/controls.es.js.map +1 -1
- package/dist/index.cjs.js +315 -394
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs10.js +371 -0
- package/dist/index.cjs10.js.map +1 -0
- package/dist/index.cjs2.js +11 -10
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs5.js +108 -98
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs6.js +41 -42
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +65 -362
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.cjs8.js +43 -0
- package/dist/index.cjs8.js.map +1 -0
- package/dist/index.cjs9.js +257 -0
- package/dist/index.cjs9.js.map +1 -0
- package/dist/index.es.js +77 -158
- package/dist/index.es.js.map +1 -1
- package/dist/index.es10.js +364 -0
- package/dist/index.es10.js.map +1 -0
- package/dist/index.es2.js +5 -4
- package/dist/index.es2.js.map +1 -1
- package/dist/index.es3.js +1 -1
- package/dist/index.es5.js +72 -63
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es6.js +36 -40
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es7.js +66 -358
- package/dist/index.es7.js.map +1 -1
- package/dist/index.es8.js +40 -0
- package/dist/index.es8.js.map +1 -0
- package/dist/index.es9.js +250 -0
- package/dist/index.es9.js.map +1 -0
- package/dist/leaf.cjs.js +4 -4
- package/dist/leaf.cjs.js.map +1 -1
- package/dist/leaf.es.js +2 -2
- package/dist/leaf.es.js.map +1 -1
- package/dist/main.cjs.js +4 -4
- package/dist/main.es.js +4 -4
- package/dist/next.cjs.js +5 -6
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +6 -7
- package/dist/next.es.js.map +1 -1
- package/dist/prop-controllers.cjs.js +10 -7
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +6 -3
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/{descriptors.cjs.js → react-page.cjs.js} +865 -93
- package/dist/react-page.cjs.js.map +1 -0
- package/dist/{descriptors.es.js → react-page.es.js} +811 -92
- package/dist/react-page.es.js.map +1 -0
- package/dist/react.cjs.js +5 -6
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +5 -6
- package/dist/react.es.js.map +1 -1
- package/dist/select.cjs.js +8 -0
- package/dist/select.cjs.js.map +1 -0
- package/dist/select.es.js +6 -0
- package/dist/select.es.js.map +1 -0
- package/dist/slate.cjs.js +19 -6
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +9 -4
- package/dist/slate.es.js.map +1 -1
- package/dist/state/breakpoints.cjs.js.map +1 -1
- package/dist/state/breakpoints.es.js.map +1 -1
- package/dist/text-input.cjs.js +0 -6
- package/dist/text-input.cjs.js.map +1 -1
- package/dist/text-input.es.js +1 -5
- package/dist/text-input.es.js.map +1 -1
- package/dist/types/src/api/graphql/generated/types.d.ts +36 -36
- package/dist/types/src/api/graphql/generated/types.d.ts.map +1 -1
- package/dist/types/src/api/graphql/types.d.ts +2 -2
- package/dist/types/src/api/graphql/types.d.ts.map +1 -1
- package/dist/types/src/api/react.d.ts +3 -3
- package/dist/types/src/api/react.d.ts.map +1 -1
- package/dist/types/src/builder/serialization/control-serialization.d.ts +66 -66
- package/dist/types/src/builder/serialization/control-serialization.d.ts.map +1 -1
- package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts +5 -0
- package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts.map +1 -0
- package/dist/types/src/builder/serialization/controls/types.d.ts +3 -3
- package/dist/types/src/builder/serialization/controls/types.d.ts.map +1 -1
- package/dist/types/src/builder/serialization/function-serialization.d.ts +4 -4
- package/dist/types/src/builder/serialization/function-serialization.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Box/animations.d.ts +1 -1
- package/dist/types/src/components/builtin/Box/animations.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Box/components/Placeholder/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Box/components/Placeholder/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Box/constants.d.ts +1 -1
- package/dist/types/src/components/builtin/Box/constants.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Button/Button.d.ts +3 -3
- package/dist/types/src/components/builtin/Button/Button.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Button/contants.d.ts +1 -1
- package/dist/types/src/components/builtin/Button/contants.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Carousel/Carousel.d.ts +1 -1
- package/dist/types/src/components/builtin/Carousel/Carousel.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Countdown/Countdown.d.ts +1 -1
- package/dist/types/src/components/builtin/Countdown/Countdown.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Divider/Divider.d.ts +2 -2
- package/dist/types/src/components/builtin/Divider/Divider.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Embed/Embed.d.ts +1 -1
- package/dist/types/src/components/builtin/Embed/Embed.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/Form.d.ts +2 -2
- package/dist/types/src/components/builtin/Form/Form.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +2 -2
- package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/CheckboxTableField/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/CheckboxTableField/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/EmailTableField/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/EmailTableField/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/Input/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/Input/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/Label/index.d.ts +2 -2
- package/dist/types/src/components/builtin/Form/components/Field/components/Label/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/LongTextTableField/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/LongTextTableField/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/MultipleSelectTableField/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/MultipleSelectTableField/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/NumberTableField/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/NumberTableField/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/PhoneNumberTableField/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/PhoneNumberTableField/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/RadioButton/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/RadioButton/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/SingleLineTextTableField/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/SingleLineTextTableField/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/SingleSelectTableField/components/TableColumnRadioButtonGroup/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/SingleSelectTableField/components/TableColumnRadioButtonGroup/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/SingleSelectTableField/components/TableColumnSingleSelect/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/SingleSelectTableField/components/TableColumnSingleSelect/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/SingleSelectTableField/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/SingleSelectTableField/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/TextArea/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/TextArea/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/URLTableField/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/URLTableField/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/index.d.ts +2 -2
- package/dist/types/src/components/builtin/Form/components/Field/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Placeholder/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Placeholder/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/context/FormContext.d.ts +5 -5
- package/dist/types/src/components/builtin/Form/context/FormContext.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/types.d.ts +13 -13
- package/dist/types/src/components/builtin/Form/types.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Image/Image.d.ts +1 -1
- package/dist/types/src/components/builtin/Image/Image.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Navigation/Navigation.d.ts +1 -1
- package/dist/types/src/components/builtin/Navigation/Navigation.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Navigation/components/DropDownButton/index.d.ts +3 -3
- package/dist/types/src/components/builtin/Navigation/components/DropDownButton/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Navigation/components/LinksPlaceholder/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Navigation/components/LinksPlaceholder/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts +3 -3
- package/dist/types/src/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Navigation/components/MobileMenu/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Navigation/components/MobileMenu/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Root/Root.d.ts +1 -1
- package/dist/types/src/components/builtin/Root/Root.d.ts.map +1 -1
- package/dist/types/src/components/builtin/SocialLinks/SocialLinks.d.ts +1 -1
- package/dist/types/src/components/builtin/SocialLinks/SocialLinks.d.ts.map +1 -1
- package/dist/types/src/components/builtin/SocialLinks/components/SocialLinksPlaceholder/index.d.ts +1 -1
- package/dist/types/src/components/builtin/SocialLinks/components/SocialLinksPlaceholder/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts +1 -1
- package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts +4 -3
- package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/Text.d.ts +1 -1
- package/dist/types/src/components/builtin/Text/Text.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/components/Element/block.d.ts +2 -2
- package/dist/types/src/components/builtin/Text/components/Element/block.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/components/Element/inline.d.ts +1 -1
- package/dist/types/src/components/builtin/Text/components/Element/inline.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts +5 -5
- package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Video/Video.d.ts +1 -1
- package/dist/types/src/components/builtin/Video/Video.d.ts.map +1 -1
- package/dist/types/src/components/hooks/useBackgrounds.d.ts +8 -8
- package/dist/types/src/components/hooks/useBackgrounds.d.ts.map +1 -1
- package/dist/types/src/components/hooks/useBorder.d.ts +3 -3
- package/dist/types/src/components/hooks/useBorder.d.ts.map +1 -1
- package/dist/types/src/components/hooks/useBoxShadow.d.ts +3 -3
- package/dist/types/src/components/hooks/useBoxShadow.d.ts.map +1 -1
- package/dist/types/src/components/page/BodySnippet.d.ts +1 -1
- package/dist/types/src/components/page/BodySnippet.d.ts.map +1 -1
- package/dist/types/src/components/page/Page.d.ts +1 -1
- package/dist/types/src/components/page/Page.d.ts.map +1 -1
- package/dist/types/src/components/shared/BackgroundsContainer/components/BackgroundVideo/index.d.ts +1 -1
- package/dist/types/src/components/shared/BackgroundsContainer/components/BackgroundVideo/index.d.ts.map +1 -1
- package/dist/types/src/components/shared/BackgroundsContainer/components/Backgrounds/index.d.ts +1 -1
- package/dist/types/src/components/shared/BackgroundsContainer/components/Backgrounds/index.d.ts.map +1 -1
- package/dist/types/src/components/shared/BackgroundsContainer/components/Parallax/index.d.ts +1 -1
- package/dist/types/src/components/shared/BackgroundsContainer/components/Parallax/index.d.ts.map +1 -1
- package/dist/types/src/components/shared/BackgroundsContainer/index.d.ts +1 -1
- package/dist/types/src/components/shared/BackgroundsContainer/index.d.ts.map +1 -1
- package/dist/types/src/components/shared/FallbackComponent/FallbackComponent.d.ts +1 -1
- package/dist/types/src/components/shared/FallbackComponent/FallbackComponent.d.ts.map +1 -1
- package/dist/types/src/components/shared/GutterContainer/index.d.ts +2 -2
- package/dist/types/src/components/shared/GutterContainer/index.d.ts.map +1 -1
- package/dist/types/src/components/shared/Link/index.d.ts +1 -1
- package/dist/types/src/components/shared/Link/index.d.ts.map +1 -1
- package/dist/types/src/components/shared/grid-item.d.ts +2 -2
- package/dist/types/src/components/shared/grid-item.d.ts.map +1 -1
- package/dist/types/src/components/utils/drop-first.d.ts +1 -1
- package/dist/types/src/components/utils/drop-first.d.ts.map +1 -1
- package/dist/types/src/components/utils/types.d.ts +2 -2
- package/dist/types/src/components/utils/types.d.ts.map +1 -1
- package/dist/types/src/controls/checkbox.d.ts +3 -3
- package/dist/types/src/controls/checkbox.d.ts.map +1 -1
- package/dist/types/src/controls/color.d.ts +3 -3
- package/dist/types/src/controls/color.d.ts.map +1 -1
- package/dist/types/src/controls/combobox.d.ts +5 -5
- package/dist/types/src/controls/combobox.d.ts.map +1 -1
- package/dist/types/src/controls/control.d.ts +6 -4
- package/dist/types/src/controls/control.d.ts.map +1 -1
- package/dist/types/src/controls/image.d.ts +4 -4
- package/dist/types/src/controls/image.d.ts.map +1 -1
- package/dist/types/src/controls/link.d.ts +8 -8
- package/dist/types/src/controls/link.d.ts.map +1 -1
- package/dist/types/src/controls/list.d.ts +8 -7
- package/dist/types/src/controls/list.d.ts.map +1 -1
- package/dist/types/src/controls/number.d.ts +3 -3
- package/dist/types/src/controls/number.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/dto-types.d.ts +4 -4
- package/dist/types/src/controls/rich-text/dto-types.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/index.d.ts +0 -1
- package/dist/types/src/controls/rich-text/index.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/rich-text.d.ts +12 -12
- package/dist/types/src/controls/rich-text/rich-text.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/translation.d.ts +1 -1
- package/dist/types/src/controls/rich-text/translation.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +55 -13
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/controls/select.d.ts +5 -5
- package/dist/types/src/controls/select.d.ts.map +1 -1
- package/dist/types/src/controls/shape.d.ts +7 -6
- package/dist/types/src/controls/shape.d.ts.map +1 -1
- package/dist/types/src/controls/slot.d.ts +18 -9
- package/dist/types/src/controls/slot.d.ts.map +1 -1
- package/dist/types/src/controls/style.d.ts +20 -19
- package/dist/types/src/controls/style.d.ts.map +1 -1
- package/dist/types/src/controls/text-area.d.ts +3 -3
- package/dist/types/src/controls/text-area.d.ts.map +1 -1
- package/dist/types/src/controls/text-input.d.ts +3 -3
- package/dist/types/src/controls/text-input.d.ts.map +1 -1
- package/dist/types/src/controls/types.d.ts +5 -5
- package/dist/types/src/controls/types.d.ts.map +1 -1
- package/dist/types/src/css/border-radius.d.ts +2 -2
- package/dist/types/src/css/border-radius.d.ts.map +1 -1
- package/dist/types/src/css/border.d.ts +2 -2
- package/dist/types/src/css/border.d.ts.map +1 -1
- package/dist/types/src/css/length-percentage.d.ts +2 -2
- package/dist/types/src/css/length-percentage.d.ts.map +1 -1
- package/dist/types/src/css/length.d.ts +1 -1
- package/dist/types/src/css/length.d.ts.map +1 -1
- package/dist/types/src/css/margin.d.ts +2 -2
- package/dist/types/src/css/margin.d.ts.map +1 -1
- package/dist/types/src/css/padding.d.ts +2 -2
- package/dist/types/src/css/padding.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/handlers/element-tree.d.ts +3 -3
- package/dist/types/src/next/api-handler/handlers/element-tree.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/handlers/fonts.d.ts +5 -5
- package/dist/types/src/next/api-handler/handlers/fonts.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/handlers/manifest.d.ts +3 -3
- package/dist/types/src/next/api-handler/handlers/manifest.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/handlers/proxy-preview-mode.d.ts +2 -2
- package/dist/types/src/next/api-handler/handlers/proxy-preview-mode.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/handlers/revalidate.d.ts +3 -3
- package/dist/types/src/next/api-handler/handlers/revalidate.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/index.d.ts +3 -3
- package/dist/types/src/next/api-handler/index.d.ts.map +1 -1
- package/dist/types/src/next/client.d.ts +8 -8
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/next/dynamic.d.ts +4 -4
- package/dist/types/src/next/dynamic.d.ts.map +1 -1
- package/dist/types/src/next/index.d.ts +2 -2
- package/dist/types/src/next/index.d.ts.map +1 -1
- package/dist/types/src/next/preview-mode.d.ts +2 -2
- package/dist/types/src/next/preview-mode.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/base.d.ts +7 -0
- package/dist/types/src/prop-controllers/base.d.ts.map +1 -0
- package/dist/types/src/prop-controllers/descriptors.d.ts +179 -179
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/instances.d.ts +18 -22
- package/dist/types/src/prop-controllers/instances.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/components/LiveProvider.d.ts +1 -1
- package/dist/types/src/runtimes/react/components/LiveProvider.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/components/PreviewProvider.d.ts +1 -1
- package/dist/types/src/runtimes/react/components/PreviewProvider.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/components/render-hook.d.ts +1 -1
- package/dist/types/src/runtimes/react/components/render-hook.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/checkbox.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/checkbox.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/color.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/color.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/combobox.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/combobox.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts +2 -2
- package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/image.d.ts +3 -3
- package/dist/types/src/runtimes/react/controls/image.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/link.d.ts +2 -2
- package/dist/types/src/runtimes/react/controls/link.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/list.d.ts +3 -3
- package/dist/types/src/runtimes/react/controls/list.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/number.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/number.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts +13 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/index.d.ts +4 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/useSyncDOMSelection.d.ts +9 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/useSyncDOMSelection.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts +24 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/index.d.ts +2 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts +8 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text.d.ts +2 -2
- package/dist/types/src/runtimes/react/controls/rich-text.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/select.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/select.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/shape.d.ts +2 -2
- package/dist/types/src/runtimes/react/controls/shape.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/slot.d.ts +4 -4
- package/dist/types/src/runtimes/react/controls/slot.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/style.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/style.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/text-area.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/text-area.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/text-input.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/text-input.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls.d.ts +8 -8
- package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/element-imperative-handle.d.ts +1 -1
- package/dist/types/src/runtimes/react/element-imperative-handle.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/find-dom-node.d.ts +1 -1
- package/dist/types/src/runtimes/react/find-dom-node.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/index.d.ts +7 -7
- package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/index.d.ts +33 -2
- package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/setBlockKeyForDevice.d.ts +1 -1
- package/dist/types/src/slate/BlockPlugin/setBlockKeyForDevice.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/types.d.ts +3 -3
- package/dist/types/src/slate/BlockPlugin/types.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/unwrapInline.d.ts +1 -1
- package/dist/types/src/slate/BlockPlugin/unwrapInline.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/wrapInline.d.ts +1 -1
- package/dist/types/src/slate/BlockPlugin/wrapInline.d.ts.map +1 -1
- package/dist/types/src/slate/BuilderPlugin/index.d.ts +7 -0
- package/dist/types/src/slate/BuilderPlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/InlineModePlugin/index.d.ts +9 -0
- package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/ListPlugin/index.d.ts +2 -2
- package/dist/types/src/slate/ListPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/ListPlugin/toggleList.d.ts +2 -2
- package/dist/types/src/slate/ListPlugin/toggleList.d.ts.map +1 -1
- package/dist/types/src/slate/ListPlugin/unwrapList.d.ts +1 -1
- package/dist/types/src/slate/ListPlugin/unwrapList.d.ts.map +1 -1
- package/dist/types/src/slate/ListPlugin/wrapList.d.ts +2 -2
- package/dist/types/src/slate/ListPlugin/wrapList.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/clearActiveTypographyStyle.d.ts +1 -1
- package/dist/types/src/slate/TypographyPlugin/clearActiveTypographyStyle.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/clearDeviceActiveTypography.d.ts +1 -1
- package/dist/types/src/slate/TypographyPlugin/clearDeviceActiveTypography.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/detachActiveTypography.d.ts +2 -2
- package/dist/types/src/slate/TypographyPlugin/detachActiveTypography.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/index.d.ts +2 -2
- package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/setActiveTypographyId.d.ts +1 -1
- package/dist/types/src/slate/TypographyPlugin/setActiveTypographyId.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/setActiveTypographyStyle.d.ts +1 -1
- package/dist/types/src/slate/TypographyPlugin/setActiveTypographyStyle.d.ts.map +1 -1
- package/dist/types/src/slate/index.d.ts +3 -0
- package/dist/types/src/slate/index.d.ts.map +1 -1
- package/dist/types/src/slate/selectors.d.ts +1 -1
- package/dist/types/src/slate/selectors.d.ts.map +1 -1
- package/dist/types/src/{controls/rich-text → slate}/types.d.ts +56 -46
- package/dist/types/src/slate/types.d.ts.map +1 -0
- package/dist/types/src/slate/utils/editor.d.ts +1 -1
- package/dist/types/src/slate/utils/editor.d.ts.map +1 -1
- package/dist/types/src/slate/utils/element.d.ts +1 -1
- package/dist/types/src/slate/utils/element.d.ts.map +1 -1
- package/dist/types/src/state/actions.d.ts +43 -42
- package/dist/types/src/state/actions.d.ts.map +1 -1
- package/dist/types/src/state/makeswift-api-client.d.ts +5 -5
- package/dist/types/src/state/makeswift-api-client.d.ts.map +1 -1
- package/dist/types/src/state/modules/api-resources.d.ts +2 -2
- package/dist/types/src/state/modules/api-resources.d.ts.map +1 -1
- package/dist/types/src/state/modules/box-models.d.ts +2 -2
- package/dist/types/src/state/modules/box-models.d.ts.map +1 -1
- package/dist/types/src/state/modules/breakpoints.d.ts +9 -9
- package/dist/types/src/state/modules/breakpoints.d.ts.map +1 -1
- package/dist/types/src/state/modules/builder-edit-mode.d.ts +2 -2
- package/dist/types/src/state/modules/builder-edit-mode.d.ts.map +1 -1
- package/dist/types/src/state/modules/components-meta.d.ts +3 -3
- package/dist/types/src/state/modules/components-meta.d.ts.map +1 -1
- package/dist/types/src/state/modules/element-imperative-handles.d.ts +1 -1
- package/dist/types/src/state/modules/element-imperative-handles.d.ts.map +1 -1
- package/dist/types/src/state/modules/is-in-builder.d.ts +1 -1
- package/dist/types/src/state/modules/is-in-builder.d.ts.map +1 -1
- package/dist/types/src/state/modules/is-preview.d.ts +1 -1
- package/dist/types/src/state/modules/is-preview.d.ts.map +1 -1
- package/dist/types/src/state/modules/pointer.d.ts +2 -2
- package/dist/types/src/state/modules/pointer.d.ts.map +1 -1
- package/dist/types/src/state/modules/prop-controller-handles.d.ts +3 -2
- package/dist/types/src/state/modules/prop-controller-handles.d.ts.map +1 -1
- package/dist/types/src/state/modules/prop-controllers.d.ts +1 -1
- package/dist/types/src/state/modules/prop-controllers.d.ts.map +1 -1
- package/dist/types/src/state/modules/react-components.d.ts +2 -2
- package/dist/types/src/state/modules/react-components.d.ts.map +1 -1
- package/dist/types/src/state/modules/read-only-documents.d.ts +7 -7
- package/dist/types/src/state/modules/read-only-documents.d.ts.map +1 -1
- package/dist/types/src/state/modules/read-write-documents.d.ts +1 -1
- package/dist/types/src/state/modules/read-write-documents.d.ts.map +1 -1
- package/dist/types/src/state/react-builder-preview.d.ts +5 -6
- package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
- package/dist/types/src/state/react-page.d.ts +11 -7
- package/dist/types/src/state/react-page.d.ts.map +1 -1
- package/dist/types/src/state/react-page.test.d.ts +3 -0
- package/dist/types/src/state/react-page.test.d.ts.map +1 -0
- package/dist/types/src/utils/isErrorWithMessage.d.ts +1 -1
- package/dist/types/src/utils/isErrorWithMessage.d.ts.map +1 -1
- package/dist/useIsomorphicLayoutEffect.cjs.js +6 -0
- package/dist/useIsomorphicLayoutEffect.cjs.js.map +1 -0
- package/dist/useIsomorphicLayoutEffect.es.js +5 -0
- package/dist/useIsomorphicLayoutEffect.es.js.map +1 -0
- package/package.json +4 -3
- package/dist/descriptors.cjs.js.map +0 -1
- package/dist/descriptors.es.js.map +0 -1
- package/dist/introspection.cjs.js +0 -331
- package/dist/introspection.cjs.js.map +0 -1
- package/dist/introspection.es.js +0 -317
- package/dist/introspection.es.js.map +0 -1
- package/dist/types/src/controls/rich-text/types.d.ts.map +0 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2.d.ts +0 -15
- package/dist/types/src/runtimes/react/controls/rich-text-v2.d.ts.map +0 -1
package/dist/react.es.js
CHANGED
|
@@ -3,28 +3,26 @@ export { D as DocumentReference, E as Element, P as PageProvider, a as ReactRunt
|
|
|
3
3
|
import "react";
|
|
4
4
|
import "use-sync-external-store/shim/with-selector";
|
|
5
5
|
import "next/dynamic";
|
|
6
|
-
import "./
|
|
6
|
+
import "./react-page.es.js";
|
|
7
7
|
import "redux";
|
|
8
8
|
import "redux-thunk";
|
|
9
|
-
import "./
|
|
9
|
+
import "./state/breakpoints.es.js";
|
|
10
10
|
import "slate";
|
|
11
|
+
import "is-hotkey";
|
|
11
12
|
import "slate-react";
|
|
12
|
-
import "./state/breakpoints.es.js";
|
|
13
|
-
import "./introspection.es.js";
|
|
14
13
|
import "@emotion/css";
|
|
15
14
|
import "@emotion/serialize";
|
|
16
15
|
import "@emotion/utils";
|
|
17
16
|
import "react/jsx-runtime";
|
|
18
17
|
import "./text-input.es.js";
|
|
19
18
|
import "./combobox.es.js";
|
|
19
|
+
import "./select.es.js";
|
|
20
20
|
import "use-sync-external-store/shim";
|
|
21
21
|
import "./types.es.js";
|
|
22
22
|
import "./box-models.es.js";
|
|
23
23
|
import "css-box-model";
|
|
24
24
|
import "color";
|
|
25
25
|
import "scroll-into-view-if-needed";
|
|
26
|
-
import "is-hotkey";
|
|
27
|
-
import "slate-history";
|
|
28
26
|
import "react-dom";
|
|
29
27
|
import "html-react-parser";
|
|
30
28
|
import "next/head";
|
|
@@ -35,6 +33,7 @@ import "path-to-regexp";
|
|
|
35
33
|
import "cookie";
|
|
36
34
|
import "http-proxy";
|
|
37
35
|
import "set-cookie-parser";
|
|
36
|
+
import "./constants.es.js";
|
|
38
37
|
import "uuid";
|
|
39
38
|
import "corporate-ipsum";
|
|
40
39
|
//# sourceMappingURL=react.es.js.map
|
package/dist/react.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"react.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const SelectControlType = "makeswift::controls::select";
|
|
3
|
+
function Select(config) {
|
|
4
|
+
return { type: SelectControlType, config };
|
|
5
|
+
}
|
|
6
|
+
exports.Select = Select;
|
|
7
|
+
exports.SelectControlType = SelectControlType;
|
|
8
|
+
//# sourceMappingURL=select.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.cjs.js","sources":["../src/controls/select.ts"],"sourcesContent":["export const SelectControlType = 'makeswift::controls::select'\n\ntype SelectControlOption<T extends string> = { value: T; label: string }\n\ntype SelectControlConfig<T extends string = string> = {\n label?: string\n labelOrientation?: 'horizontal' | 'vertical'\n options: SelectControlOption<T>[]\n defaultValue?: T\n}\n\nexport type SelectControlDefinition<C extends SelectControlConfig = SelectControlConfig> = {\n type: typeof SelectControlType\n config: C\n}\n\nexport type SelectControlDefinitionOption<T extends SelectControlDefinition> =\n T['config'] extends SelectControlConfig<infer U> ? U : never\n\nexport type SelectControlData<T extends SelectControlDefinition = SelectControlDefinition> =\n SelectControlDefinitionOption<T>\n\nexport function Select<T extends string, C extends SelectControlConfig<T>>(\n config: C & { options: SelectControlOption<T>[] },\n): SelectControlDefinition<C> {\n return { type: SelectControlType, config }\n}\n"],"names":[],"mappings":";AAAO,MAAM,oBAAoB;AAsB1B,gBACL,QAC4B;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.es.js","sources":["../src/controls/select.ts"],"sourcesContent":["export const SelectControlType = 'makeswift::controls::select'\n\ntype SelectControlOption<T extends string> = { value: T; label: string }\n\ntype SelectControlConfig<T extends string = string> = {\n label?: string\n labelOrientation?: 'horizontal' | 'vertical'\n options: SelectControlOption<T>[]\n defaultValue?: T\n}\n\nexport type SelectControlDefinition<C extends SelectControlConfig = SelectControlConfig> = {\n type: typeof SelectControlType\n config: C\n}\n\nexport type SelectControlDefinitionOption<T extends SelectControlDefinition> =\n T['config'] extends SelectControlConfig<infer U> ? U : never\n\nexport type SelectControlData<T extends SelectControlDefinition = SelectControlDefinition> =\n SelectControlDefinitionOption<T>\n\nexport function Select<T extends string, C extends SelectControlConfig<T>>(\n config: C & { options: SelectControlOption<T>[] },\n): SelectControlDefinition<C> {\n return { type: SelectControlType, config }\n}\n"],"names":[],"mappings":"AAAO,MAAM,oBAAoB;AAsB1B,gBACL,QAC4B;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;;"}
|
package/dist/slate.cjs.js
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
var index = require("./index.cjs5.js");
|
|
4
|
+
var index$1 = require("./index.cjs6.js");
|
|
5
|
+
var index$2 = require("./index.cjs7.js");
|
|
6
|
+
var reactPage = require("./react-page.cjs.js");
|
|
4
7
|
require("slate");
|
|
5
8
|
require("is-hotkey");
|
|
6
|
-
require("./descriptors.cjs.js");
|
|
7
|
-
require("slate-react");
|
|
8
|
-
require("./actions.cjs.js");
|
|
9
9
|
require("./state/breakpoints.cjs.js");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
require("./actions.cjs.js");
|
|
11
|
+
require("./select.cjs.js");
|
|
12
|
+
require("slate-react");
|
|
13
|
+
require("redux");
|
|
14
|
+
require("redux-thunk");
|
|
15
|
+
exports.BlockActions = index.BlockActions;
|
|
16
|
+
exports.BlockPlugin = index.BlockPlugin;
|
|
17
|
+
exports.ListActions = index.ListActions;
|
|
18
|
+
exports.TypographyActions = index.TypographyActions;
|
|
13
19
|
exports.onKeyDown = index.onKeyDown;
|
|
14
20
|
exports.withBlock = index.withBlock;
|
|
15
21
|
exports.withList = index.withList;
|
|
16
22
|
exports.withTypography = index.withTypography;
|
|
23
|
+
exports.InlineModePlugin = index$1.InlineModePlugin;
|
|
24
|
+
exports.withInlineMode = index$1.withInlineMode;
|
|
25
|
+
exports.withBuilder = index$2.withBuilder;
|
|
26
|
+
exports.BlockTextAlignment = reactPage.BlockTextAlignment;
|
|
27
|
+
exports.BlockType = reactPage.BlockType;
|
|
28
|
+
exports.InlineType = reactPage.InlineType;
|
|
29
|
+
exports.RootBlockType = reactPage.RootBlockType;
|
|
17
30
|
//# sourceMappingURL=slate.cjs.js.map
|
package/dist/slate.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slate.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"slate.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/slate.es.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
export { B as
|
|
1
|
+
export { B as BlockActions, c as BlockPlugin, L as ListActions, T as TypographyActions, o as onKeyDown, b as withBlock, w as withList, a as withTypography } from "./index.es5.js";
|
|
2
|
+
export { I as InlineModePlugin, w as withInlineMode } from "./index.es6.js";
|
|
3
|
+
export { w as withBuilder } from "./index.es7.js";
|
|
4
|
+
export { b6 as BlockTextAlignment, b4 as BlockType, b5 as InlineType, b3 as RootBlockType } from "./react-page.es.js";
|
|
2
5
|
import "slate";
|
|
3
6
|
import "is-hotkey";
|
|
4
|
-
import "./descriptors.es.js";
|
|
5
|
-
import "slate-react";
|
|
6
|
-
import "./actions.es.js";
|
|
7
7
|
import "./state/breakpoints.es.js";
|
|
8
|
+
import "./actions.es.js";
|
|
9
|
+
import "./select.es.js";
|
|
10
|
+
import "slate-react";
|
|
11
|
+
import "redux";
|
|
12
|
+
import "redux-thunk";
|
|
8
13
|
//# sourceMappingURL=slate.es.js.map
|
package/dist/slate.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slate.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"slate.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breakpoints.cjs.js","sources":["../../src/utils/keys.ts","../../src/utils/coalesce.ts","../../src/utils/shallowMerge.ts","../../src/state/modules/breakpoints.ts"],"sourcesContent":["const keys = <O extends { [key: string]: unknown }>(o: O): (keyof O)[] => Object.keys(o)\n\nexport default keys\n","const coalesce = <T>(...args: Array<T>): T => {\n let i: number\n\n for (i = 0; i < args.length - 1; i += 1) {\n if (args[i] != null) return args[i]\n }\n\n return args[i]\n}\n\nexport default coalesce\n","import keys from './keys'\nimport coalesce from './coalesce'\n\nexport default function shallowMerge<\n A extends Record<string, unknown>,\n B extends Record<string, unknown>,\n>(a: A, b: B): A & B {\n const bKeys = keys(b)\n const merged = { ...a } as A & B\n\n bKeys.forEach(key => {\n // @ts-expect-error: `coalesce` returns `null | undefined` regardless of input guarantees.\n merged[key] = coalesce(merged[key], b[key])\n })\n\n return merged\n}\n","import { Viewport } from 'csstype'\n\nimport {\n ResponsiveValue as PropControllerResponsiveValue,\n DeviceOverride as PropControllerDeviceOverride,\n Device as DeviceId,\n} from '../../prop-controllers'\nimport shallowMerge from '../../utils/shallowMerge'\nimport { Action, ActionTypes } from '../actions'\n\nexport type DeviceOverride<T> = PropControllerDeviceOverride<T>\nexport type ResponsiveValue<T> = PropControllerResponsiveValue<T>\nexport type BreakpointId = DeviceId\n\nexport type Breakpoint = {\n id: BreakpointId\n label?: string\n viewportWidth?: number\n minWidth?: number\n maxWidth?: number\n}\n\nexport type Breakpoints = Breakpoint[]\n\nexport type State = Breakpoints\n\nexport const DefaultBreakpointID = {\n Desktop: 'desktop',\n Tablet: 'tablet',\n Mobile: 'mobile',\n} as const\n\ntype DefaultBreakpointID = typeof DefaultBreakpointID[keyof typeof DefaultBreakpointID]\n\nexport const DEFAULT_BREAKPOINTS: Breakpoints = [\n {\n id: DefaultBreakpointID.Desktop,\n label: 'Desktop',\n minWidth: 769,\n },\n {\n id: DefaultBreakpointID.Tablet,\n label: 'Tablet',\n minWidth: 576,\n maxWidth: 768,\n viewportWidth: 760,\n },\n {\n id: DefaultBreakpointID.Mobile,\n label: 'Mobile',\n maxWidth: 575,\n viewportWidth: 390,\n },\n]\n\nexport function getInitialState(breakpoints = DEFAULT_BREAKPOINTS): State {\n return breakpoints\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n switch (action.type) {\n case ActionTypes.SET_BREAKPOINTS: {\n const breakpoints = action.payload.breakpoints\n\n if (breakpoints.length === 0) throw new Error('Breakpoints cannot be empty.')\n\n return breakpoints\n }\n\n default:\n return state\n }\n}\n\nexport type BreakpointsInput = Record<string, { width: number; label?: string; viewport?: number }>\n\nexport function parseBreakpointsInput(input: BreakpointsInput): Breakpoints {\n validateBreakpointsInput(input)\n\n const sorted = Object.entries(input)\n .map(([id, value]) => ({ ...value, id }))\n .sort((a, b) => b.width - a.width) // Sort by width in descending order\n\n const transformed = sorted.reduce(\n (prev, curr, index, array) => {\n const { width, viewport, id, label } = curr\n const next = array[index + 1]\n\n const breakpoint: Breakpoint = {\n id,\n ...(label && { label }),\n ...(next && { minWidth: next.width + 1 }),\n maxWidth: width,\n viewportWidth: viewport ?? width,\n }\n\n return [...prev, breakpoint]\n },\n [\n { id: DefaultBreakpointID.Desktop, label: 'Desktop', minWidth: sorted[0].width + 1 },\n ] as Breakpoints,\n )\n\n return transformed\n}\n\nfunction validateBreakpointsInput(input: BreakpointsInput) {\n if (DefaultBreakpointID.Desktop in input) {\n throw new Error(\n `Cannot change the base breakpoint. \"${DefaultBreakpointID.Desktop}\" is reserved as the base breakpoint.`,\n )\n }\n\n if (Object.keys(input).length === 0) {\n throw new Error(`Breakpoints cannot be empty. You must provide at least one breakpoint.`)\n }\n\n const sorted = Object.entries(input)\n .map(([id, value]) => ({ ...value, id }))\n .sort((a, b) => b.width - a.width) // Sort by width in descending order\n\n sorted.forEach(({ id, width, viewport }, index, array) => {\n // This is only valid for desktop-first. We need to check the inverse for mobile-first.\n if (viewport && viewport > width) {\n throw new Error(\n `Error on breakpoint \"${id}\". Viewport cannot be greater than its width.\n \"${id}\" has a viewport of ${viewport}px and a width of ${width}px.`,\n )\n }\n\n const next = array[index + 1]\n\n if (viewport && next && viewport < next.width) {\n throw new Error(\n `Error on breakpoint \"${id}\". Viewport cannot be smaller than the next breakpoint's width. \n \"${id}\" has a viewport of ${viewport}px and the next breakpoint \"${next.id}\" has a width of ${next.width}px.`,\n )\n }\n\n if (next && width === next.width) {\n throw new Error(\n `Breakpoints cannot have the same width. \"${id}\" and \"${next.id}\" have the same width`,\n )\n }\n })\n}\n\n// Sort breakpoints by minWidth in descending order\nfunction sortBreakpoints(breakpoints: Breakpoints): Breakpoints {\n return breakpoints.sort((a, b) => (b?.minWidth ?? 0) - (a?.minWidth ?? 0))\n}\n\nexport const getBreakpoint = (state: State, breakpointId: Breakpoint['id']): Breakpoint => {\n const breakpoint = state.find(({ id }) => id === breakpointId)\n\n if (breakpoint == null) throw new Error(`Unrecognized breakpoint ID: \"${breakpointId}\".`)\n\n return breakpoint\n}\n\nexport const getBaseBreakpoint = (breakpoints: Breakpoints): Breakpoint => {\n const breakpoint = sortBreakpoints(breakpoints)[0]\n\n if (breakpoint == null) throw new Error(`Cannot get base breakpoint.`)\n\n return breakpoint\n}\n\nexport function findBreakpointOverride<S>(\n breakpoints: Breakpoints,\n values: ResponsiveValue<S> = [],\n deviceId: string,\n strategy: FallbackStrategy<S> = defaultStrategy,\n): DeviceOverride<S> | undefined {\n const value = values.find(({ deviceId: d }) => d === deviceId)\n const fallbacks = breakpoints\n .slice(0, breakpoints.findIndex(d => d.id === deviceId) + 1)\n .reverse()\n .map(d => values.find(v => v.deviceId === d.id))\n .filter((override): override is DeviceOverride<S> => Boolean(override))\n\n return value != null || fallbacks.length > 0 ? strategy(value, fallbacks) : undefined\n}\n\nexport type FallbackStrategy<V> = (\n arg0: DeviceOverride<V> | undefined,\n arg1: ResponsiveValue<V>,\n) => DeviceOverride<V> | undefined\n\nfunction defaultStrategy<V>(\n value: DeviceOverride<V> | undefined,\n fallbacks: ResponsiveValue<V>,\n): DeviceOverride<V> | undefined {\n return value || fallbacks[0]\n}\n\nexport function shallowMergeFallbacks<V extends Record<string, unknown>>(\n value: DeviceOverride<V> | undefined,\n fallbacks: ResponsiveValue<V>,\n): DeviceOverride<V> | undefined {\n return [value, ...fallbacks]\n .filter((override): override is DeviceOverride<V> => Boolean(override))\n .reduce((a, b) => ({\n deviceId: a.deviceId || b.deviceId,\n value: shallowMerge(a.value, b.value),\n }))\n}\n\nexport type ExtractResponsiveValue<T> = T extends ResponsiveValue<infer V> ? V : never\n\nexport function join<V, A extends ReadonlyArray<ResponsiveValue<V> | null | undefined>, R>(\n breakpoints: Breakpoints,\n responsiveValues: A,\n joinFn: (values: { [I in keyof A]: ExtractResponsiveValue<A[I]> | undefined }) => R,\n strategy?: FallbackStrategy<V>,\n): ResponsiveValue<R> {\n return breakpoints\n .map(({ id }) => id)\n .map(deviceId => {\n const value = joinFn(\n responsiveValues.map(responsiveValue => {\n const deviceValue =\n responsiveValue &&\n findBreakpointOverride(breakpoints, responsiveValue, deviceId, strategy)\n\n return deviceValue == null ? undefined : deviceValue.value\n }) as unknown as { [I in keyof A]: ExtractResponsiveValue<A[I] | undefined> },\n )\n\n if (value == null) return null\n\n return { deviceId, value }\n })\n .filter((override): override is DeviceOverride<R> => Boolean(override))\n}\n\nexport const getBreakpointMediaQuery = (breakpoint: Breakpoint): string => {\n const parts = ['@media only screen']\n\n if (breakpoint.minWidth != null) {\n parts.push(`(min-width: ${breakpoint.minWidth}px)`)\n }\n\n if (breakpoint.maxWidth != null) {\n parts.push(`(max-width: ${breakpoint.maxWidth}px)`)\n }\n\n return parts.join(' and ')\n}\n\nexport const getViewportStyle = (\n state: State,\n deviceId: string,\n): Viewport<string | number> | null | undefined => {\n const device = getBreakpoint(state, deviceId)\n\n return (\n device && {\n width: device.viewportWidth != null ? device.viewportWidth : '100%',\n minWidth: device.minWidth,\n }\n )\n}\n\nexport function findNextFallback<V>(\n breakpoints: Breakpoints,\n value: ResponsiveValue<V>,\n deviceId: BreakpointId,\n activeDeviceId: BreakpointId,\n fallbackStrategy?: FallbackStrategy<V>,\n): Breakpoint | null {\n const deviceOverride = findBreakpointOverride(\n breakpoints,\n value.filter(v => v.deviceId !== activeDeviceId),\n deviceId,\n fallbackStrategy,\n )\n\n return (deviceOverride && getBreakpoint(breakpoints, deviceOverride.deviceId)) ?? null\n}\n\nexport const mergeResponsiveValues = <A>(\n breakpoints: Breakpoints,\n source: DeviceOverride<A>[],\n override: DeviceOverride<A>[],\n): DeviceOverride<A>[] => {\n const devices = [\n ...new Set(\n source.map(({ deviceId }) => deviceId).concat(override.map(({ deviceId }) => deviceId)),\n ),\n ]\n\n return devices.map(deviceId => ({\n deviceId,\n value: {\n ...(findBreakpointOverride(breakpoints, source, deviceId) || { value: {} }).value,\n ...(findBreakpointOverride(breakpoints, override, deviceId, v => v) || { value: {} }).value,\n },\n })) as DeviceOverride<A>[]\n}\n"],"names":["ActionTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,OAAO,CAAuC,MAAsB,OAAO,KAAK,CAAC;ACAvF,MAAM,WAAW,IAAO,SAAsB;AACxC,MAAA;AAEJ,OAAK,IAAI,GAAG,IAAI,KAAK,SAAS,GAAG,KAAK,GAAG;AACvC,QAAI,KAAK,MAAM;AAAM,aAAO,KAAK;AAAA,EACnC;AAEA,SAAO,KAAK;AACd;ACLA,sBAGE,GAAM,GAAa;AACb,QAAA,QAAQ,KAAK,CAAC;AACd,QAAA,SAAS,mBAAK;AAEpB,QAAM,QAAQ,CAAO,QAAA;AAEnB,WAAO,OAAO,SAAS,OAAO,MAAM,EAAE,IAAI;AAAA,EAAA,CAC3C;AAEM,SAAA;AACT;ACUO,MAAM,sBAAsB;AAAA,EACjC,SAAS;AAAA,EACT,QAAQ;AAA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ts","../../src/state/modules/breakpoints.ts"],"sourcesContent":["const keys = <O extends { [key: string]: unknown }>(o: O): (keyof O)[] => Object.keys(o)\n\nexport default keys\n","const coalesce = <T>(...args: Array<T>): T => {\n let i: number\n\n for (i = 0; i < args.length - 1; i += 1) {\n if (args[i] != null) return args[i]\n }\n\n return args[i]\n}\n\nexport default coalesce\n","import keys from './keys'\nimport coalesce from './coalesce'\n\nexport default function shallowMerge<\n A extends Record<string, unknown>,\n B extends Record<string, unknown>,\n>(a: A, b: B): A & B {\n const bKeys = keys(b)\n const merged = { ...a } as A & B\n\n bKeys.forEach(key => {\n // @ts-expect-error: `coalesce` returns `null | undefined` regardless of input guarantees.\n merged[key] = coalesce(merged[key], b[key])\n })\n\n return merged\n}\n","import { Viewport } from 'csstype'\n\nimport {\n ResponsiveValue as PropControllerResponsiveValue,\n DeviceOverride as PropControllerDeviceOverride,\n Device as DeviceId,\n} from '../../prop-controllers'\nimport shallowMerge from '../../utils/shallowMerge'\nimport { Action, ActionTypes } from '../actions'\n\nexport type DeviceOverride<T> = PropControllerDeviceOverride<T>\nexport type ResponsiveValue<T> = PropControllerResponsiveValue<T>\nexport type BreakpointId = DeviceId\n\nexport type Breakpoint = {\n id: BreakpointId\n label?: string\n viewportWidth?: number\n minWidth?: number\n maxWidth?: number\n}\n\nexport type Breakpoints = Breakpoint[]\n\nexport type State = Breakpoints\n\nexport const DefaultBreakpointID = {\n Desktop: 'desktop',\n Tablet: 'tablet',\n Mobile: 'mobile',\n} as const\n\ntype DefaultBreakpointID = typeof DefaultBreakpointID[keyof typeof DefaultBreakpointID]\n\nexport const DEFAULT_BREAKPOINTS: Breakpoints = [\n {\n id: DefaultBreakpointID.Desktop,\n label: 'Desktop',\n minWidth: 769,\n },\n {\n id: DefaultBreakpointID.Tablet,\n label: 'Tablet',\n minWidth: 576,\n maxWidth: 768,\n viewportWidth: 760,\n },\n {\n id: DefaultBreakpointID.Mobile,\n label: 'Mobile',\n maxWidth: 575,\n viewportWidth: 390,\n },\n]\n\nexport function getInitialState(breakpoints = DEFAULT_BREAKPOINTS): State {\n return breakpoints\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n switch (action.type) {\n case ActionTypes.SET_BREAKPOINTS: {\n const breakpoints = action.payload.breakpoints\n\n if (breakpoints.length === 0) throw new Error('Breakpoints cannot be empty.')\n\n return breakpoints\n }\n\n default:\n return state\n }\n}\n\nexport type BreakpointsInput = Record<string, { width: number; label?: string; viewport?: number }>\n\nexport function parseBreakpointsInput(input: BreakpointsInput): Breakpoints {\n validateBreakpointsInput(input)\n\n const sorted = Object.entries(input)\n .map(([id, value]) => ({ ...value, id }))\n .sort((a, b) => b.width - a.width) // Sort by width in descending order\n\n const transformed = sorted.reduce(\n (prev, curr, index, array) => {\n const { width, viewport, id, label } = curr\n const next = array[index + 1]\n\n const breakpoint: Breakpoint = {\n id,\n ...(label && { label }),\n ...(next && { minWidth: next.width + 1 }),\n maxWidth: width,\n viewportWidth: viewport ?? width,\n }\n\n return [...prev, breakpoint]\n },\n [\n { id: DefaultBreakpointID.Desktop, label: 'Desktop', minWidth: sorted[0].width + 1 },\n ] as Breakpoints,\n )\n\n return transformed\n}\n\nfunction validateBreakpointsInput(input: BreakpointsInput) {\n if (DefaultBreakpointID.Desktop in input) {\n throw new Error(\n `Cannot change the base breakpoint. \"${DefaultBreakpointID.Desktop}\" is reserved as the base breakpoint.`,\n )\n }\n\n if (Object.keys(input).length === 0) {\n throw new Error(`Breakpoints cannot be empty. You must provide at least one breakpoint.`)\n }\n\n const sorted = Object.entries(input)\n .map(([id, value]) => ({ ...value, id }))\n .sort((a, b) => b.width - a.width) // Sort by width in descending order\n\n sorted.forEach(({ id, width, viewport }, index, array) => {\n // This is only valid for desktop-first. We need to check the inverse for mobile-first.\n if (viewport && viewport > width) {\n throw new Error(\n `Error on breakpoint \"${id}\". Viewport cannot be greater than its width.\n \"${id}\" has a viewport of ${viewport}px and a width of ${width}px.`,\n )\n }\n\n const next = array[index + 1]\n\n if (viewport && next && viewport < next.width) {\n throw new Error(\n `Error on breakpoint \"${id}\". Viewport cannot be smaller than the next breakpoint's width. \n \"${id}\" has a viewport of ${viewport}px and the next breakpoint \"${next.id}\" has a width of ${next.width}px.`,\n )\n }\n\n if (next && width === next.width) {\n throw new Error(\n `Breakpoints cannot have the same width. \"${id}\" and \"${next.id}\" have the same width`,\n )\n }\n })\n}\n\n// Sort breakpoints by minWidth in descending order\nfunction sortBreakpoints(breakpoints: Breakpoints): Breakpoints {\n return breakpoints.sort((a, b) => (b?.minWidth ?? 0) - (a?.minWidth ?? 0))\n}\n\nexport const getBreakpoint = (state: State, breakpointId: Breakpoint['id']): Breakpoint => {\n const breakpoint = state.find(({ id }) => id === breakpointId)\n\n if (breakpoint == null) throw new Error(`Unrecognized breakpoint ID: \"${breakpointId}\".`)\n\n return breakpoint\n}\n\nexport const getBaseBreakpoint = (breakpoints: Breakpoints): Breakpoint => {\n const breakpoint = sortBreakpoints(breakpoints)[0]\n\n if (breakpoint == null) throw new Error(`Cannot get base breakpoint.`)\n\n return breakpoint\n}\n\nexport function findBreakpointOverride<S>(\n breakpoints: Breakpoints,\n values: ResponsiveValue<S> = [],\n deviceId: string,\n strategy: FallbackStrategy<S> = defaultStrategy,\n): DeviceOverride<S> | undefined {\n const value = values.find(({ deviceId: d }) => d === deviceId)\n const fallbacks = breakpoints\n .slice(0, breakpoints.findIndex(d => d.id === deviceId) + 1)\n .reverse()\n .map(d => values.find(v => v.deviceId === d.id))\n .filter((override): override is DeviceOverride<S> => Boolean(override))\n\n return value != null || fallbacks.length > 0 ? strategy(value, fallbacks) : undefined\n}\n\nexport type FallbackStrategy<V> = (\n arg0: DeviceOverride<V> | undefined,\n arg1: ResponsiveValue<V>,\n) => DeviceOverride<V> | undefined\n\nfunction defaultStrategy<V>(\n value: DeviceOverride<V> | undefined,\n fallbacks: ResponsiveValue<V>,\n): DeviceOverride<V> | undefined {\n return value || fallbacks[0]\n}\n\nexport function shallowMergeFallbacks<V extends Record<string, unknown>>(\n value: DeviceOverride<V> | undefined,\n fallbacks: ResponsiveValue<V>,\n): DeviceOverride<V> | undefined {\n return [value, ...fallbacks]\n .filter((override): override is DeviceOverride<V> => Boolean(override))\n .reduce((a, b) => ({\n deviceId: a.deviceId || b.deviceId,\n value: shallowMerge(a.value, b.value),\n }))\n}\n\nexport type ExtractResponsiveValue<T> = T extends ResponsiveValue<infer V> ? V : never\n\nexport function join<V, A extends ReadonlyArray<ResponsiveValue<V> | null | undefined>, R>(\n breakpoints: Breakpoints,\n responsiveValues: A,\n joinFn: (values: { [I in keyof A]: ExtractResponsiveValue<A[I]> | undefined }) => R,\n strategy?: FallbackStrategy<V>,\n): ResponsiveValue<R> {\n return breakpoints\n .map(({ id }) => id)\n .map(deviceId => {\n const value = joinFn(\n responsiveValues.map(responsiveValue => {\n const deviceValue =\n responsiveValue &&\n findBreakpointOverride(breakpoints, responsiveValue, deviceId, strategy)\n\n return deviceValue == null ? undefined : deviceValue.value\n }) as unknown as { [I in keyof A]: ExtractResponsiveValue<A[I] | undefined> },\n )\n\n if (value == null) return null\n\n return { deviceId, value }\n })\n .filter((override): override is NonNullable<typeof override> => Boolean(override))\n}\n\nexport const getBreakpointMediaQuery = (breakpoint: Breakpoint): string => {\n const parts = ['@media only screen']\n\n if (breakpoint.minWidth != null) {\n parts.push(`(min-width: ${breakpoint.minWidth}px)`)\n }\n\n if (breakpoint.maxWidth != null) {\n parts.push(`(max-width: ${breakpoint.maxWidth}px)`)\n }\n\n return parts.join(' and ')\n}\n\nexport const getViewportStyle = (\n state: State,\n deviceId: string,\n): Viewport<string | number> | null | undefined => {\n const device = getBreakpoint(state, deviceId)\n\n return (\n device && {\n width: device.viewportWidth != null ? device.viewportWidth : '100%',\n minWidth: device.minWidth,\n }\n )\n}\n\nexport function findNextFallback<V>(\n breakpoints: Breakpoints,\n value: ResponsiveValue<V>,\n deviceId: BreakpointId,\n activeDeviceId: BreakpointId,\n fallbackStrategy?: FallbackStrategy<V>,\n): Breakpoint | null {\n const deviceOverride = findBreakpointOverride(\n breakpoints,\n value.filter(v => v.deviceId !== activeDeviceId),\n deviceId,\n fallbackStrategy,\n )\n\n return (deviceOverride && getBreakpoint(breakpoints, deviceOverride.deviceId)) ?? null\n}\n\nexport const mergeResponsiveValues = <A>(\n breakpoints: Breakpoints,\n source: DeviceOverride<A>[],\n override: DeviceOverride<A>[],\n): DeviceOverride<A>[] => {\n const devices = [\n ...new Set(\n source.map(({ deviceId }) => deviceId).concat(override.map(({ deviceId }) => deviceId)),\n ),\n ]\n\n return devices.map(deviceId => ({\n deviceId,\n value: {\n ...(findBreakpointOverride(breakpoints, source, deviceId) || { value: {} }).value,\n ...(findBreakpointOverride(breakpoints, override, deviceId, v => v) || { value: {} }).value,\n },\n })) as DeviceOverride<A>[]\n}\n"],"names":["ActionTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,OAAO,CAAuC,MAAsB,OAAO,KAAK,CAAC;ACAvF,MAAM,WAAW,IAAO,SAAsB;AACxC,MAAA;AAEJ,OAAK,IAAI,GAAG,IAAI,KAAK,SAAS,GAAG,KAAK,GAAG;AACvC,QAAI,KAAK,MAAM;AAAM,aAAO,KAAK;AAAA,EACnC;AAEA,SAAO,KAAK;AACd;ACLA,sBAGE,GAAM,GAAa;AACb,QAAA,QAAQ,KAAK,CAAC;AACd,QAAA,SAAS,mBAAK;AAEpB,QAAM,QAAQ,CAAO,QAAA;AAEnB,WAAO,OAAO,SAAS,OAAO,MAAM,EAAE,IAAI;AAAA,EAAA,CAC3C;AAEM,SAAA;AACT;ACUO,MAAM,sBAAsB;AAAA,EACjC,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AACV;AAIO,MAAM,sBAAmC;AAAA,EAC9C;AAAA,IACE,IAAI,oBAAoB;AAAA,IACxB,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,IAAI,oBAAoB;AAAA,IACxB,OAAO;AAAA,IACP,UAAU;A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,UAAA,KAAK,eAAe,WAAW,aAAa;AAAA,EACpD;AAEO,SAAA,MAAM,KAAK,OAAO;AAC3B;AAEa,MAAA,mBAAmB,CAC9B,OACA,aACiD;AAC3C,QAAA,SAAS,cAAc,OAAO,QAAQ;AAE5C,SACE,UAAU;AAAA,IACR,OAAO,OAAO,iBAAiB,OAAO,OAAO,gBAAgB;AAAA,IAC7D,UAAU,OAAO;AAAA,EAAA;AAGvB;AAEO,0BACL,aACA,OACA,UACA,gBACA,kBACmB;;AACb,QAAA,iBAAiB,uBACrB,aACA,MAAM,OAAO,CAAK,MAAA,EAAE,aAAa,cAAc,GAC/C,UACA,gBACF;AAEA,SAA0B,wBAAA,cAAc,aAAa,eAAe,QAAQ,MAAlD,YAAwD;AACpF;AAEO,MAAM,wBAAwB,CACnC,aACA,QACA,aACwB;AACxB,QAAM,UAAU;AAAA,IACd,GAAG,IAAI,IACL,OAAO,IAAI,CAAC,EAAE,eAAe,QAAQ,EAAE,OAAO,SAAS,IAAI,CAAC,EAAE,eAAe,QAAQ,CAAC,CACxF;AAAA,EAAA;AAGK,SAAA,QAAQ,IAAI,CAAa,aAAA;AAAA,IAC9B;AAAA,IACA,OAAO,kCACD,wBAAuB,aAAa,QAAQ,QAAQ,KAAK,EAAE,OAAO,CAAC,EAAA,GAAK,QACxE,wBAAuB,aAAa,UAAU,UAAU,CAAA,MAAK,CAAC,KAAK,EAAE,OAAO,CAAA,EAAM,GAAA;AAAA,EAExF,EAAA;AACJ;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breakpoints.es.js","sources":["../../src/utils/keys.ts","../../src/utils/coalesce.ts","../../src/utils/shallowMerge.ts","../../src/state/modules/breakpoints.ts"],"sourcesContent":["const keys = <O extends { [key: string]: unknown }>(o: O): (keyof O)[] => Object.keys(o)\n\nexport default keys\n","const coalesce = <T>(...args: Array<T>): T => {\n let i: number\n\n for (i = 0; i < args.length - 1; i += 1) {\n if (args[i] != null) return args[i]\n }\n\n return args[i]\n}\n\nexport default coalesce\n","import keys from './keys'\nimport coalesce from './coalesce'\n\nexport default function shallowMerge<\n A extends Record<string, unknown>,\n B extends Record<string, unknown>,\n>(a: A, b: B): A & B {\n const bKeys = keys(b)\n const merged = { ...a } as A & B\n\n bKeys.forEach(key => {\n // @ts-expect-error: `coalesce` returns `null | undefined` regardless of input guarantees.\n merged[key] = coalesce(merged[key], b[key])\n })\n\n return merged\n}\n","import { Viewport } from 'csstype'\n\nimport {\n ResponsiveValue as PropControllerResponsiveValue,\n DeviceOverride as PropControllerDeviceOverride,\n Device as DeviceId,\n} from '../../prop-controllers'\nimport shallowMerge from '../../utils/shallowMerge'\nimport { Action, ActionTypes } from '../actions'\n\nexport type DeviceOverride<T> = PropControllerDeviceOverride<T>\nexport type ResponsiveValue<T> = PropControllerResponsiveValue<T>\nexport type BreakpointId = DeviceId\n\nexport type Breakpoint = {\n id: BreakpointId\n label?: string\n viewportWidth?: number\n minWidth?: number\n maxWidth?: number\n}\n\nexport type Breakpoints = Breakpoint[]\n\nexport type State = Breakpoints\n\nexport const DefaultBreakpointID = {\n Desktop: 'desktop',\n Tablet: 'tablet',\n Mobile: 'mobile',\n} as const\n\ntype DefaultBreakpointID = typeof DefaultBreakpointID[keyof typeof DefaultBreakpointID]\n\nexport const DEFAULT_BREAKPOINTS: Breakpoints = [\n {\n id: DefaultBreakpointID.Desktop,\n label: 'Desktop',\n minWidth: 769,\n },\n {\n id: DefaultBreakpointID.Tablet,\n label: 'Tablet',\n minWidth: 576,\n maxWidth: 768,\n viewportWidth: 760,\n },\n {\n id: DefaultBreakpointID.Mobile,\n label: 'Mobile',\n maxWidth: 575,\n viewportWidth: 390,\n },\n]\n\nexport function getInitialState(breakpoints = DEFAULT_BREAKPOINTS): State {\n return breakpoints\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n switch (action.type) {\n case ActionTypes.SET_BREAKPOINTS: {\n const breakpoints = action.payload.breakpoints\n\n if (breakpoints.length === 0) throw new Error('Breakpoints cannot be empty.')\n\n return breakpoints\n }\n\n default:\n return state\n }\n}\n\nexport type BreakpointsInput = Record<string, { width: number; label?: string; viewport?: number }>\n\nexport function parseBreakpointsInput(input: BreakpointsInput): Breakpoints {\n validateBreakpointsInput(input)\n\n const sorted = Object.entries(input)\n .map(([id, value]) => ({ ...value, id }))\n .sort((a, b) => b.width - a.width) // Sort by width in descending order\n\n const transformed = sorted.reduce(\n (prev, curr, index, array) => {\n const { width, viewport, id, label } = curr\n const next = array[index + 1]\n\n const breakpoint: Breakpoint = {\n id,\n ...(label && { label }),\n ...(next && { minWidth: next.width + 1 }),\n maxWidth: width,\n viewportWidth: viewport ?? width,\n }\n\n return [...prev, breakpoint]\n },\n [\n { id: DefaultBreakpointID.Desktop, label: 'Desktop', minWidth: sorted[0].width + 1 },\n ] as Breakpoints,\n )\n\n return transformed\n}\n\nfunction validateBreakpointsInput(input: BreakpointsInput) {\n if (DefaultBreakpointID.Desktop in input) {\n throw new Error(\n `Cannot change the base breakpoint. \"${DefaultBreakpointID.Desktop}\" is reserved as the base breakpoint.`,\n )\n }\n\n if (Object.keys(input).length === 0) {\n throw new Error(`Breakpoints cannot be empty. You must provide at least one breakpoint.`)\n }\n\n const sorted = Object.entries(input)\n .map(([id, value]) => ({ ...value, id }))\n .sort((a, b) => b.width - a.width) // Sort by width in descending order\n\n sorted.forEach(({ id, width, viewport }, index, array) => {\n // This is only valid for desktop-first. We need to check the inverse for mobile-first.\n if (viewport && viewport > width) {\n throw new Error(\n `Error on breakpoint \"${id}\". Viewport cannot be greater than its width.\n \"${id}\" has a viewport of ${viewport}px and a width of ${width}px.`,\n )\n }\n\n const next = array[index + 1]\n\n if (viewport && next && viewport < next.width) {\n throw new Error(\n `Error on breakpoint \"${id}\". Viewport cannot be smaller than the next breakpoint's width. \n \"${id}\" has a viewport of ${viewport}px and the next breakpoint \"${next.id}\" has a width of ${next.width}px.`,\n )\n }\n\n if (next && width === next.width) {\n throw new Error(\n `Breakpoints cannot have the same width. \"${id}\" and \"${next.id}\" have the same width`,\n )\n }\n })\n}\n\n// Sort breakpoints by minWidth in descending order\nfunction sortBreakpoints(breakpoints: Breakpoints): Breakpoints {\n return breakpoints.sort((a, b) => (b?.minWidth ?? 0) - (a?.minWidth ?? 0))\n}\n\nexport const getBreakpoint = (state: State, breakpointId: Breakpoint['id']): Breakpoint => {\n const breakpoint = state.find(({ id }) => id === breakpointId)\n\n if (breakpoint == null) throw new Error(`Unrecognized breakpoint ID: \"${breakpointId}\".`)\n\n return breakpoint\n}\n\nexport const getBaseBreakpoint = (breakpoints: Breakpoints): Breakpoint => {\n const breakpoint = sortBreakpoints(breakpoints)[0]\n\n if (breakpoint == null) throw new Error(`Cannot get base breakpoint.`)\n\n return breakpoint\n}\n\nexport function findBreakpointOverride<S>(\n breakpoints: Breakpoints,\n values: ResponsiveValue<S> = [],\n deviceId: string,\n strategy: FallbackStrategy<S> = defaultStrategy,\n): DeviceOverride<S> | undefined {\n const value = values.find(({ deviceId: d }) => d === deviceId)\n const fallbacks = breakpoints\n .slice(0, breakpoints.findIndex(d => d.id === deviceId) + 1)\n .reverse()\n .map(d => values.find(v => v.deviceId === d.id))\n .filter((override): override is DeviceOverride<S> => Boolean(override))\n\n return value != null || fallbacks.length > 0 ? strategy(value, fallbacks) : undefined\n}\n\nexport type FallbackStrategy<V> = (\n arg0: DeviceOverride<V> | undefined,\n arg1: ResponsiveValue<V>,\n) => DeviceOverride<V> | undefined\n\nfunction defaultStrategy<V>(\n value: DeviceOverride<V> | undefined,\n fallbacks: ResponsiveValue<V>,\n): DeviceOverride<V> | undefined {\n return value || fallbacks[0]\n}\n\nexport function shallowMergeFallbacks<V extends Record<string, unknown>>(\n value: DeviceOverride<V> | undefined,\n fallbacks: ResponsiveValue<V>,\n): DeviceOverride<V> | undefined {\n return [value, ...fallbacks]\n .filter((override): override is DeviceOverride<V> => Boolean(override))\n .reduce((a, b) => ({\n deviceId: a.deviceId || b.deviceId,\n value: shallowMerge(a.value, b.value),\n }))\n}\n\nexport type ExtractResponsiveValue<T> = T extends ResponsiveValue<infer V> ? V : never\n\nexport function join<V, A extends ReadonlyArray<ResponsiveValue<V> | null | undefined>, R>(\n breakpoints: Breakpoints,\n responsiveValues: A,\n joinFn: (values: { [I in keyof A]: ExtractResponsiveValue<A[I]> | undefined }) => R,\n strategy?: FallbackStrategy<V>,\n): ResponsiveValue<R> {\n return breakpoints\n .map(({ id }) => id)\n .map(deviceId => {\n const value = joinFn(\n responsiveValues.map(responsiveValue => {\n const deviceValue =\n responsiveValue &&\n findBreakpointOverride(breakpoints, responsiveValue, deviceId, strategy)\n\n return deviceValue == null ? undefined : deviceValue.value\n }) as unknown as { [I in keyof A]: ExtractResponsiveValue<A[I] | undefined> },\n )\n\n if (value == null) return null\n\n return { deviceId, value }\n })\n .filter((override): override is DeviceOverride<R> => Boolean(override))\n}\n\nexport const getBreakpointMediaQuery = (breakpoint: Breakpoint): string => {\n const parts = ['@media only screen']\n\n if (breakpoint.minWidth != null) {\n parts.push(`(min-width: ${breakpoint.minWidth}px)`)\n }\n\n if (breakpoint.maxWidth != null) {\n parts.push(`(max-width: ${breakpoint.maxWidth}px)`)\n }\n\n return parts.join(' and ')\n}\n\nexport const getViewportStyle = (\n state: State,\n deviceId: string,\n): Viewport<string | number> | null | undefined => {\n const device = getBreakpoint(state, deviceId)\n\n return (\n device && {\n width: device.viewportWidth != null ? device.viewportWidth : '100%',\n minWidth: device.minWidth,\n }\n )\n}\n\nexport function findNextFallback<V>(\n breakpoints: Breakpoints,\n value: ResponsiveValue<V>,\n deviceId: BreakpointId,\n activeDeviceId: BreakpointId,\n fallbackStrategy?: FallbackStrategy<V>,\n): Breakpoint | null {\n const deviceOverride = findBreakpointOverride(\n breakpoints,\n value.filter(v => v.deviceId !== activeDeviceId),\n deviceId,\n fallbackStrategy,\n )\n\n return (deviceOverride && getBreakpoint(breakpoints, deviceOverride.deviceId)) ?? null\n}\n\nexport const mergeResponsiveValues = <A>(\n breakpoints: Breakpoints,\n source: DeviceOverride<A>[],\n override: DeviceOverride<A>[],\n): DeviceOverride<A>[] => {\n const devices = [\n ...new Set(\n source.map(({ deviceId }) => deviceId).concat(override.map(({ deviceId }) => deviceId)),\n ),\n ]\n\n return devices.map(deviceId => ({\n deviceId,\n value: {\n ...(findBreakpointOverride(breakpoints, source, deviceId) || { value: {} }).value,\n ...(findBreakpointOverride(breakpoints, override, deviceId, v => v) || { value: {} }).value,\n },\n })) as DeviceOverride<A>[]\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,MAAM,OAAO,CAAuC,MAAsB,OAAO,KAAK,CAAC;ACAvF,MAAM,WAAW,IAAO,SAAsB;AACxC,MAAA;AAEJ,OAAK,IAAI,GAAG,IAAI,KAAK,SAAS,GAAG,KAAK,GAAG;AACvC,QAAI,KAAK,MAAM;AAAM,aAAO,KAAK;AAAA,EACnC;AAEA,SAAO,KAAK;AACd;ACLA,sBAGE,GAAM,GAAa;AACb,QAAA,QAAQ,KAAK,CAAC;AACd,QAAA,SAAS,mBAAK;AAEpB,QAAM,QAAQ,CAAO,QAAA;AAEnB,WAAO,OAAO,SAAS,OAAO,MAAM,EAAE,IAAI;AAAA,EAAA,CAC3C;AAEM,SAAA;AACT;ACUO,MAAM,sBAAsB;AAAA,EACjC,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AACV;AAIO,MAAM,sBAAmC;AAAA,EAC9C;AAAA,IACE,IAAI,oBAAoB;AAAA,IACxB,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,IAAI,oBAAoB;AAAA,IACxB,OAAO;AAAA,IACP,UAAU;AAAA,IACV,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,IAAI,oBAAoB;AAAA,IACxB,OAAO;AAAA,IACP,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AACF;AAEO,yBAAyB,cAAc,qBAA4B;AACjE,SAAA;A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iBAAiB,OAAO,OAAO,gBAAgB;AAAA,IAC7D,UAAU,OAAO;AAAA,EAAA;AAGvB;AAEO,0BACL,aACA,OACA,UACA,gBACA,kBACmB;;AACb,QAAA,iBAAiB,uBACrB,aACA,MAAM,OAAO,CAAK,MAAA,EAAE,aAAa,cAAc,GAC/C,UACA,gBACF;AAEA,SAA0B,wBAAA,cAAc,aAAa,eAAe,QAAQ,MAAlD,YAAwD;AACpF;AAEO,MAAM,wBAAwB,CACnC,aACA,QACA,aACwB;AACxB,QAAM,UAAU;AAAA,IACd,GAAG,IAAI,IACL,OAAO,IAAI,CAAC,EAAE,eAAe,QAAQ,EAAE,OAAO,SAAS,IAAI,CAAC,EAAE,eAAe,QAAQ,CAAC,CACxF;AAAA,EAAA;AAGK,SAAA,QAAQ,IAAI,CAAa,aAAA;AAAA,IAC9B;AAAA,IACA,OAAO,kCACD,wBAAuB,aAAa,QAAQ,QAAQ,KAAK,EAAE,OAAO,CAAC,EAAA,GAAK,QACxE,wBAAuB,aAAa,UAAU,UAAU,CAAA,MAAK,CAAC,KAAK,EAAE,OAAO,CAAA,EAAM,GAAA;AAAA,EAExF,EAAA;AACJ;;"}
|
|
1
|
+
{"version":3,"file":"breakpoints.es.js","sources":["../../src/utils/keys.ts","../../src/utils/coalesce.ts","../../src/utils/shallowMerge.ts","../../src/state/modules/breakpoints.ts"],"sourcesContent":["const keys = <O extends { [key: string]: unknown }>(o: O): (keyof O)[] => Object.keys(o)\n\nexport default keys\n","const coalesce = <T>(...args: Array<T>): T => {\n let i: number\n\n for (i = 0; i < args.length - 1; i += 1) {\n if (args[i] != null) return args[i]\n }\n\n return args[i]\n}\n\nexport default coalesce\n","import keys from './keys'\nimport coalesce from './coalesce'\n\nexport default function shallowMerge<\n A extends Record<string, unknown>,\n B extends Record<string, unknown>,\n>(a: A, b: B): A & B {\n const bKeys = keys(b)\n const merged = { ...a } as A & B\n\n bKeys.forEach(key => {\n // @ts-expect-error: `coalesce` returns `null | undefined` regardless of input guarantees.\n merged[key] = coalesce(merged[key], b[key])\n })\n\n return merged\n}\n","import { Viewport } from 'csstype'\n\nimport {\n ResponsiveValue as PropControllerResponsiveValue,\n DeviceOverride as PropControllerDeviceOverride,\n Device as DeviceId,\n} from '../../prop-controllers'\nimport shallowMerge from '../../utils/shallowMerge'\nimport { Action, ActionTypes } from '../actions'\n\nexport type DeviceOverride<T> = PropControllerDeviceOverride<T>\nexport type ResponsiveValue<T> = PropControllerResponsiveValue<T>\nexport type BreakpointId = DeviceId\n\nexport type Breakpoint = {\n id: BreakpointId\n label?: string\n viewportWidth?: number\n minWidth?: number\n maxWidth?: number\n}\n\nexport type Breakpoints = Breakpoint[]\n\nexport type State = Breakpoints\n\nexport const DefaultBreakpointID = {\n Desktop: 'desktop',\n Tablet: 'tablet',\n Mobile: 'mobile',\n} as const\n\ntype DefaultBreakpointID = typeof DefaultBreakpointID[keyof typeof DefaultBreakpointID]\n\nexport const DEFAULT_BREAKPOINTS: Breakpoints = [\n {\n id: DefaultBreakpointID.Desktop,\n label: 'Desktop',\n minWidth: 769,\n },\n {\n id: DefaultBreakpointID.Tablet,\n label: 'Tablet',\n minWidth: 576,\n maxWidth: 768,\n viewportWidth: 760,\n },\n {\n id: DefaultBreakpointID.Mobile,\n label: 'Mobile',\n maxWidth: 575,\n viewportWidth: 390,\n },\n]\n\nexport function getInitialState(breakpoints = DEFAULT_BREAKPOINTS): State {\n return breakpoints\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n switch (action.type) {\n case ActionTypes.SET_BREAKPOINTS: {\n const breakpoints = action.payload.breakpoints\n\n if (breakpoints.length === 0) throw new Error('Breakpoints cannot be empty.')\n\n return breakpoints\n }\n\n default:\n return state\n }\n}\n\nexport type BreakpointsInput = Record<string, { width: number; label?: string; viewport?: number }>\n\nexport function parseBreakpointsInput(input: BreakpointsInput): Breakpoints {\n validateBreakpointsInput(input)\n\n const sorted = Object.entries(input)\n .map(([id, value]) => ({ ...value, id }))\n .sort((a, b) => b.width - a.width) // Sort by width in descending order\n\n const transformed = sorted.reduce(\n (prev, curr, index, array) => {\n const { width, viewport, id, label } = curr\n const next = array[index + 1]\n\n const breakpoint: Breakpoint = {\n id,\n ...(label && { label }),\n ...(next && { minWidth: next.width + 1 }),\n maxWidth: width,\n viewportWidth: viewport ?? width,\n }\n\n return [...prev, breakpoint]\n },\n [\n { id: DefaultBreakpointID.Desktop, label: 'Desktop', minWidth: sorted[0].width + 1 },\n ] as Breakpoints,\n )\n\n return transformed\n}\n\nfunction validateBreakpointsInput(input: BreakpointsInput) {\n if (DefaultBreakpointID.Desktop in input) {\n throw new Error(\n `Cannot change the base breakpoint. \"${DefaultBreakpointID.Desktop}\" is reserved as the base breakpoint.`,\n )\n }\n\n if (Object.keys(input).length === 0) {\n throw new Error(`Breakpoints cannot be empty. You must provide at least one breakpoint.`)\n }\n\n const sorted = Object.entries(input)\n .map(([id, value]) => ({ ...value, id }))\n .sort((a, b) => b.width - a.width) // Sort by width in descending order\n\n sorted.forEach(({ id, width, viewport }, index, array) => {\n // This is only valid for desktop-first. We need to check the inverse for mobile-first.\n if (viewport && viewport > width) {\n throw new Error(\n `Error on breakpoint \"${id}\". Viewport cannot be greater than its width.\n \"${id}\" has a viewport of ${viewport}px and a width of ${width}px.`,\n )\n }\n\n const next = array[index + 1]\n\n if (viewport && next && viewport < next.width) {\n throw new Error(\n `Error on breakpoint \"${id}\". Viewport cannot be smaller than the next breakpoint's width. \n \"${id}\" has a viewport of ${viewport}px and the next breakpoint \"${next.id}\" has a width of ${next.width}px.`,\n )\n }\n\n if (next && width === next.width) {\n throw new Error(\n `Breakpoints cannot have the same width. \"${id}\" and \"${next.id}\" have the same width`,\n )\n }\n })\n}\n\n// Sort breakpoints by minWidth in descending order\nfunction sortBreakpoints(breakpoints: Breakpoints): Breakpoints {\n return breakpoints.sort((a, b) => (b?.minWidth ?? 0) - (a?.minWidth ?? 0))\n}\n\nexport const getBreakpoint = (state: State, breakpointId: Breakpoint['id']): Breakpoint => {\n const breakpoint = state.find(({ id }) => id === breakpointId)\n\n if (breakpoint == null) throw new Error(`Unrecognized breakpoint ID: \"${breakpointId}\".`)\n\n return breakpoint\n}\n\nexport const getBaseBreakpoint = (breakpoints: Breakpoints): Breakpoint => {\n const breakpoint = sortBreakpoints(breakpoints)[0]\n\n if (breakpoint == null) throw new Error(`Cannot get base breakpoint.`)\n\n return breakpoint\n}\n\nexport function findBreakpointOverride<S>(\n breakpoints: Breakpoints,\n values: ResponsiveValue<S> = [],\n deviceId: string,\n strategy: FallbackStrategy<S> = defaultStrategy,\n): DeviceOverride<S> | undefined {\n const value = values.find(({ deviceId: d }) => d === deviceId)\n const fallbacks = breakpoints\n .slice(0, breakpoints.findIndex(d => d.id === deviceId) + 1)\n .reverse()\n .map(d => values.find(v => v.deviceId === d.id))\n .filter((override): override is DeviceOverride<S> => Boolean(override))\n\n return value != null || fallbacks.length > 0 ? strategy(value, fallbacks) : undefined\n}\n\nexport type FallbackStrategy<V> = (\n arg0: DeviceOverride<V> | undefined,\n arg1: ResponsiveValue<V>,\n) => DeviceOverride<V> | undefined\n\nfunction defaultStrategy<V>(\n value: DeviceOverride<V> | undefined,\n fallbacks: ResponsiveValue<V>,\n): DeviceOverride<V> | undefined {\n return value || fallbacks[0]\n}\n\nexport function shallowMergeFallbacks<V extends Record<string, unknown>>(\n value: DeviceOverride<V> | undefined,\n fallbacks: ResponsiveValue<V>,\n): DeviceOverride<V> | undefined {\n return [value, ...fallbacks]\n .filter((override): override is DeviceOverride<V> => Boolean(override))\n .reduce((a, b) => ({\n deviceId: a.deviceId || b.deviceId,\n value: shallowMerge(a.value, b.value),\n }))\n}\n\nexport type ExtractResponsiveValue<T> = T extends ResponsiveValue<infer V> ? V : never\n\nexport function join<V, A extends ReadonlyArray<ResponsiveValue<V> | null | undefined>, R>(\n breakpoints: Breakpoints,\n responsiveValues: A,\n joinFn: (values: { [I in keyof A]: ExtractResponsiveValue<A[I]> | undefined }) => R,\n strategy?: FallbackStrategy<V>,\n): ResponsiveValue<R> {\n return breakpoints\n .map(({ id }) => id)\n .map(deviceId => {\n const value = joinFn(\n responsiveValues.map(responsiveValue => {\n const deviceValue =\n responsiveValue &&\n findBreakpointOverride(breakpoints, responsiveValue, deviceId, strategy)\n\n return deviceValue == null ? undefined : deviceValue.value\n }) as unknown as { [I in keyof A]: ExtractResponsiveValue<A[I] | undefined> },\n )\n\n if (value == null) return null\n\n return { deviceId, value }\n })\n .filter((override): override is NonNullable<typeof override> => Boolean(override))\n}\n\nexport const getBreakpointMediaQuery = (breakpoint: Breakpoint): string => {\n const parts = ['@media only screen']\n\n if (breakpoint.minWidth != null) {\n parts.push(`(min-width: ${breakpoint.minWidth}px)`)\n }\n\n if (breakpoint.maxWidth != null) {\n parts.push(`(max-width: ${breakpoint.maxWidth}px)`)\n }\n\n return parts.join(' and ')\n}\n\nexport const getViewportStyle = (\n state: State,\n deviceId: string,\n): Viewport<string | number> | null | undefined => {\n const device = getBreakpoint(state, deviceId)\n\n return (\n device && {\n width: device.viewportWidth != null ? device.viewportWidth : '100%',\n minWidth: device.minWidth,\n }\n )\n}\n\nexport function findNextFallback<V>(\n breakpoints: Breakpoints,\n value: ResponsiveValue<V>,\n deviceId: BreakpointId,\n activeDeviceId: BreakpointId,\n fallbackStrategy?: FallbackStrategy<V>,\n): Breakpoint | null {\n const deviceOverride = findBreakpointOverride(\n breakpoints,\n value.filter(v => v.deviceId !== activeDeviceId),\n deviceId,\n fallbackStrategy,\n )\n\n return (deviceOverride && getBreakpoint(breakpoints, deviceOverride.deviceId)) ?? null\n}\n\nexport const mergeResponsiveValues = <A>(\n breakpoints: Breakpoints,\n source: DeviceOverride<A>[],\n override: DeviceOverride<A>[],\n): DeviceOverride<A>[] => {\n const devices = [\n ...new Set(\n source.map(({ deviceId }) => deviceId).concat(override.map(({ deviceId }) => deviceId)),\n ),\n ]\n\n return devices.map(deviceId => ({\n deviceId,\n value: {\n ...(findBreakpointOverride(breakpoints, source, deviceId) || { value: {} }).value,\n ...(findBreakpointOverride(breakpoints, override, deviceId, v => v) || { value: {} }).value,\n },\n })) as DeviceOverride<A>[]\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,MAAM,OAAO,CAAuC,MAAsB,OAAO,KAAK,CAAC;ACAvF,MAAM,WAAW,IAAO,SAAsB;AACxC,MAAA;AAEJ,OAAK,IAAI,GAAG,IAAI,KAAK,SAAS,GAAG,KAAK,GAAG;AACvC,QAAI,KAAK,MAAM;AAAM,aAAO,KAAK;AAAA,EACnC;AAEA,SAAO,KAAK;AACd;ACLA,sBAGE,GAAM,GAAa;AACb,QAAA,QAAQ,KAAK,CAAC;AACd,QAAA,SAAS,mBAAK;AAEpB,QAAM,QAAQ,CAAO,QAAA;AAEnB,WAAO,OAAO,SAAS,OAAO,MAAM,EAAE,IAAI;AAAA,EAAA,CAC3C;AAEM,SAAA;AACT;ACUO,MAAM,sBAAsB;AAAA,EACjC,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AACV;AAIO,MAAM,sBAAmC;AAAA,EAC9C;AAAA,IACE,IAAI,oBAAoB;AAAA,IACxB,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,IAAI,oBAAoB;AAAA,IACxB,OAAO;AAAA,IACP,UAAU;AAAA,IACV,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,IAAI,oBAAoB;AAAA,IACxB,OAAO;AAAA,IACP,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AACF;AAEO,yBAAyB,cAAc,qBAA4B;AACjE,SAAA;AACT;AAEwB,iBAAA,QAAe,gBAAgB,GAAG,QAAuB;AAC/E,UAAQ,OAAO;AAAA,SACR,YAAY,iBAAiB;AAC1B,YAAA,cAAc,OAAO,QAAQ;AAEnC,UAAI,YAAY,WAAW;AAAS,cAAA,IAAI,MAAM,8BAA8B;AAErE,aAAA;AAAA,IACT;AAAA;AAGS,aAAA;AAAA;AAEb;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a,eAAe,QAAQ,MAAlD,YAAwD;AACpF;AAEO,MAAM,wBAAwB,CACnC,aACA,QACA,aACwB;AACxB,QAAM,UAAU;AAAA,IACd,GAAG,IAAI,IACL,OAAO,IAAI,CAAC,EAAE,eAAe,QAAQ,EAAE,OAAO,SAAS,IAAI,CAAC,EAAE,eAAe,QAAQ,CAAC,CACxF;AAAA,EAAA;AAGK,SAAA,QAAQ,IAAI,CAAa,aAAA;AAAA,IAC9B;AAAA,IACA,OAAO,kCACD,wBAAuB,aAAa,QAAQ,QAAQ,KAAK,EAAE,OAAO,CAAC,EAAA,GAAK,QACxE,wBAAuB,aAAa,UAAU,UAAU,CAAA,MAAK,CAAC,KAAK,EAAE,OAAO,CAAA,EAAM,GAAA;AAAA,EAExF,EAAA;AACJ;;"}
|
package/dist/text-input.cjs.js
CHANGED
|
@@ -7,10 +7,6 @@ const NumberControlType = "makeswift::controls::number";
|
|
|
7
7
|
function Number(config = {}) {
|
|
8
8
|
return { type: NumberControlType, config };
|
|
9
9
|
}
|
|
10
|
-
const SelectControlType = "makeswift::controls::select";
|
|
11
|
-
function Select(config) {
|
|
12
|
-
return { type: SelectControlType, config };
|
|
13
|
-
}
|
|
14
10
|
const TextAreaControlType = "makeswift::controls::text-area";
|
|
15
11
|
function TextArea(config = {}) {
|
|
16
12
|
return { type: TextAreaControlType, config };
|
|
@@ -23,8 +19,6 @@ exports.Checkbox = Checkbox;
|
|
|
23
19
|
exports.CheckboxControlType = CheckboxControlType;
|
|
24
20
|
exports.Number = Number;
|
|
25
21
|
exports.NumberControlType = NumberControlType;
|
|
26
|
-
exports.Select = Select;
|
|
27
|
-
exports.SelectControlType = SelectControlType;
|
|
28
22
|
exports.TextArea = TextArea;
|
|
29
23
|
exports.TextAreaControlType = TextAreaControlType;
|
|
30
24
|
exports.TextInput = TextInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input.cjs.js","sources":["../src/controls/checkbox.ts","../src/controls/number.ts","../src/controls/
|
|
1
|
+
{"version":3,"file":"text-input.cjs.js","sources":["../src/controls/checkbox.ts","../src/controls/number.ts","../src/controls/text-area.ts","../src/controls/text-input.ts"],"sourcesContent":["export type CheckboxControlData = boolean\n\nexport const CheckboxControlType = 'makeswift::controls::checkbox'\n\ntype CheckboxControlConfig = {\n label?: string\n defaultValue?: boolean\n}\n\nexport type CheckboxControlDefinition<C extends CheckboxControlConfig = CheckboxControlConfig> = {\n type: typeof CheckboxControlType\n config: C\n}\n\nexport function Checkbox<C extends CheckboxControlConfig>(\n config: C = {} as C,\n): CheckboxControlDefinition<C> {\n return { type: CheckboxControlType, config }\n}\n","export type NumberControlData = number\n\nexport const NumberControlType = 'makeswift::controls::number'\n\ntype NumberControlConfig = {\n label?: string\n labelOrientation?: 'vertical' | 'horizontal'\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n}\n\nexport type NumberControlDefinition<C extends NumberControlConfig = NumberControlConfig> = {\n type: typeof NumberControlType\n config: C\n}\n\nexport function Number<C extends NumberControlConfig>(\n config: C = {} as C,\n): NumberControlDefinition<C> {\n return { type: NumberControlType, config }\n}\n","export type TextAreaControlData = string\n\nexport const TextAreaControlType = 'makeswift::controls::text-area'\n\ntype TextAreaControlConfig = {\n label?: string\n defaultValue?: string\n rows?: number\n}\n\nexport type TextAreaControlDefinition<C extends TextAreaControlConfig = TextAreaControlConfig> = {\n type: typeof TextAreaControlType\n config: C\n}\n\nexport function TextArea<C extends TextAreaControlConfig>(\n config: C = {} as C,\n): TextAreaControlDefinition<C> {\n return { type: TextAreaControlType, config }\n}\n","export type TextInputControlData = string\n\nexport const TextInputControlType = 'makeswift::controls::text-input'\n\ntype TextInputControlConfig = {\n label?: string\n defaultValue?: string\n}\n\nexport type TextInputControlDefinition<C extends TextInputControlConfig = TextInputControlConfig> =\n {\n type: typeof TextInputControlType\n config: C\n }\n\nexport function TextInput<C extends TextInputControlConfig>(\n config: C = {} as C,\n): TextInputControlDefinition<C> {\n return { type: TextInputControlType, config }\n}\n"],"names":[],"mappings":";AAEO,MAAM,sBAAsB;AAajC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;AChBO,MAAM,oBAAoB;AAkB/B,gBAAA,SAAY,IACgB;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;ACrBO,MAAM,sBAAsB;AAcjC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;ACjBO,MAAM,uBAAuB;AAclC,mBAAA,SAAY,IACmB;AACxB,SAAA,EAAE,MAAM,sBAAsB;AACvC;;;;;;;;;"}
|
package/dist/text-input.es.js
CHANGED
|
@@ -6,10 +6,6 @@ const NumberControlType = "makeswift::controls::number";
|
|
|
6
6
|
function Number(config = {}) {
|
|
7
7
|
return { type: NumberControlType, config };
|
|
8
8
|
}
|
|
9
|
-
const SelectControlType = "makeswift::controls::select";
|
|
10
|
-
function Select(config) {
|
|
11
|
-
return { type: SelectControlType, config };
|
|
12
|
-
}
|
|
13
9
|
const TextAreaControlType = "makeswift::controls::text-area";
|
|
14
10
|
function TextArea(config = {}) {
|
|
15
11
|
return { type: TextAreaControlType, config };
|
|
@@ -18,5 +14,5 @@ const TextInputControlType = "makeswift::controls::text-input";
|
|
|
18
14
|
function TextInput(config = {}) {
|
|
19
15
|
return { type: TextInputControlType, config };
|
|
20
16
|
}
|
|
21
|
-
export { CheckboxControlType as C, NumberControlType as N,
|
|
17
|
+
export { CheckboxControlType as C, NumberControlType as N, TextAreaControlType as T, TextInputControlType as a, Checkbox as b, Number as c, TextArea as d, TextInput as e };
|
|
22
18
|
//# sourceMappingURL=text-input.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input.es.js","sources":["../src/controls/checkbox.ts","../src/controls/number.ts","../src/controls/
|
|
1
|
+
{"version":3,"file":"text-input.es.js","sources":["../src/controls/checkbox.ts","../src/controls/number.ts","../src/controls/text-area.ts","../src/controls/text-input.ts"],"sourcesContent":["export type CheckboxControlData = boolean\n\nexport const CheckboxControlType = 'makeswift::controls::checkbox'\n\ntype CheckboxControlConfig = {\n label?: string\n defaultValue?: boolean\n}\n\nexport type CheckboxControlDefinition<C extends CheckboxControlConfig = CheckboxControlConfig> = {\n type: typeof CheckboxControlType\n config: C\n}\n\nexport function Checkbox<C extends CheckboxControlConfig>(\n config: C = {} as C,\n): CheckboxControlDefinition<C> {\n return { type: CheckboxControlType, config }\n}\n","export type NumberControlData = number\n\nexport const NumberControlType = 'makeswift::controls::number'\n\ntype NumberControlConfig = {\n label?: string\n labelOrientation?: 'vertical' | 'horizontal'\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n}\n\nexport type NumberControlDefinition<C extends NumberControlConfig = NumberControlConfig> = {\n type: typeof NumberControlType\n config: C\n}\n\nexport function Number<C extends NumberControlConfig>(\n config: C = {} as C,\n): NumberControlDefinition<C> {\n return { type: NumberControlType, config }\n}\n","export type TextAreaControlData = string\n\nexport const TextAreaControlType = 'makeswift::controls::text-area'\n\ntype TextAreaControlConfig = {\n label?: string\n defaultValue?: string\n rows?: number\n}\n\nexport type TextAreaControlDefinition<C extends TextAreaControlConfig = TextAreaControlConfig> = {\n type: typeof TextAreaControlType\n config: C\n}\n\nexport function TextArea<C extends TextAreaControlConfig>(\n config: C = {} as C,\n): TextAreaControlDefinition<C> {\n return { type: TextAreaControlType, config }\n}\n","export type TextInputControlData = string\n\nexport const TextInputControlType = 'makeswift::controls::text-input'\n\ntype TextInputControlConfig = {\n label?: string\n defaultValue?: string\n}\n\nexport type TextInputControlDefinition<C extends TextInputControlConfig = TextInputControlConfig> =\n {\n type: typeof TextInputControlType\n config: C\n }\n\nexport function TextInput<C extends TextInputControlConfig>(\n config: C = {} as C,\n): TextInputControlDefinition<C> {\n return { type: TextInputControlType, config }\n}\n"],"names":[],"mappings":"AAEO,MAAM,sBAAsB;AAajC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;AChBO,MAAM,oBAAoB;AAkB/B,gBAAA,SAAY,IACgB;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;ACrBO,MAAM,sBAAsB;AAcjC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;ACjBO,MAAM,uBAAuB;AAclC,mBAAA,SAAY,IACmB;AACxB,SAAA,EAAE,MAAM,sBAAsB;AACvC;;"}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export type Maybe<T> = T | null;
|
|
2
|
+
export type InputMaybe<T> = Maybe<T>;
|
|
3
|
+
export type Exact<T extends {
|
|
4
4
|
[key: string]: unknown;
|
|
5
5
|
}> = {
|
|
6
6
|
[K in keyof T]: T[K];
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
type Json = null | boolean | number | string | Json[] | {
|
|
9
9
|
[key: string]: Json;
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
type Scalars = {
|
|
12
12
|
ID: string;
|
|
13
13
|
JSON: Json;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export type CreateTableRecordInput = {
|
|
16
16
|
data: CreateTableRecordInputData;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type CreateTableRecordInputData = {
|
|
19
19
|
columns: Array<CreateTableRecordInputDataColumn>;
|
|
20
20
|
tableId?: InputMaybe<Scalars['ID']>;
|
|
21
21
|
};
|
|
22
|
-
export
|
|
22
|
+
export type CreateTableRecordInputDataColumn = {
|
|
23
23
|
columnId: Scalars['ID'];
|
|
24
24
|
data: Scalars['JSON'];
|
|
25
25
|
};
|
|
@@ -27,15 +27,15 @@ export declare const SnippetLocation: {
|
|
|
27
27
|
readonly Body: "BODY";
|
|
28
28
|
readonly Head: "HEAD";
|
|
29
29
|
};
|
|
30
|
-
export
|
|
31
|
-
export
|
|
30
|
+
export type SnippetLocation = typeof SnippetLocation[keyof typeof SnippetLocation];
|
|
31
|
+
export type SwatchFragment = {
|
|
32
32
|
__typename: 'Swatch';
|
|
33
33
|
id: string;
|
|
34
34
|
hue: number;
|
|
35
35
|
saturation: number;
|
|
36
36
|
lightness: number;
|
|
37
37
|
};
|
|
38
|
-
export
|
|
38
|
+
export type FileFragment = {
|
|
39
39
|
__typename: 'File';
|
|
40
40
|
id: string;
|
|
41
41
|
name: string;
|
|
@@ -46,7 +46,7 @@ export declare type FileFragment = {
|
|
|
46
46
|
height: number;
|
|
47
47
|
} | null;
|
|
48
48
|
};
|
|
49
|
-
export
|
|
49
|
+
export type TypographyFragment = {
|
|
50
50
|
__typename: 'Typography';
|
|
51
51
|
id: string;
|
|
52
52
|
name: string;
|
|
@@ -73,17 +73,17 @@ export declare type TypographyFragment = {
|
|
|
73
73
|
};
|
|
74
74
|
}>;
|
|
75
75
|
};
|
|
76
|
-
export
|
|
76
|
+
export type PagePathnameSliceFragment = {
|
|
77
77
|
__typename: 'PagePathnameSlice';
|
|
78
78
|
id: string;
|
|
79
79
|
pathname: string;
|
|
80
80
|
};
|
|
81
|
-
export
|
|
81
|
+
export type GlobalElementFragment = {
|
|
82
82
|
__typename: 'GlobalElement';
|
|
83
83
|
id: string;
|
|
84
84
|
data: Json;
|
|
85
85
|
};
|
|
86
|
-
export
|
|
86
|
+
export type TableFragment = {
|
|
87
87
|
__typename: 'Table';
|
|
88
88
|
id: string;
|
|
89
89
|
name: string;
|
|
@@ -133,7 +133,7 @@ export declare type TableFragment = {
|
|
|
133
133
|
name: string;
|
|
134
134
|
}>;
|
|
135
135
|
};
|
|
136
|
-
export
|
|
136
|
+
export type SnippetFragment = {
|
|
137
137
|
__typename: 'Snippet';
|
|
138
138
|
id: string;
|
|
139
139
|
name: string;
|
|
@@ -144,7 +144,7 @@ export declare type SnippetFragment = {
|
|
|
144
144
|
liveEnabled: boolean;
|
|
145
145
|
builderEnabled: boolean;
|
|
146
146
|
};
|
|
147
|
-
export
|
|
147
|
+
export type PageFragment = {
|
|
148
148
|
__typename: 'Page';
|
|
149
149
|
id: string;
|
|
150
150
|
snippets: Array<{
|
|
@@ -159,7 +159,7 @@ export declare type PageFragment = {
|
|
|
159
159
|
builderEnabled: boolean;
|
|
160
160
|
}>;
|
|
161
161
|
};
|
|
162
|
-
export
|
|
162
|
+
export type SiteFragment = {
|
|
163
163
|
__typename: 'Site';
|
|
164
164
|
id: string;
|
|
165
165
|
googleFonts: {
|
|
@@ -176,13 +176,13 @@ export declare type SiteFragment = {
|
|
|
176
176
|
} | null>;
|
|
177
177
|
};
|
|
178
178
|
};
|
|
179
|
-
export
|
|
179
|
+
export type IntrospectedResourcesQueryVariables = Exact<{
|
|
180
180
|
swatchIds: Array<Scalars['ID']> | Scalars['ID'];
|
|
181
181
|
fileIds: Array<Scalars['ID']> | Scalars['ID'];
|
|
182
182
|
pageIds: Array<Scalars['ID']> | Scalars['ID'];
|
|
183
183
|
tableIds: Array<Scalars['ID']> | Scalars['ID'];
|
|
184
184
|
}>;
|
|
185
|
-
export
|
|
185
|
+
export type IntrospectedResourcesQueryResult = {
|
|
186
186
|
swatches: Array<{
|
|
187
187
|
__typename: 'Swatch';
|
|
188
188
|
id: string;
|
|
@@ -257,10 +257,10 @@ export declare type IntrospectedResourcesQueryResult = {
|
|
|
257
257
|
}>;
|
|
258
258
|
} | null>;
|
|
259
259
|
};
|
|
260
|
-
export
|
|
260
|
+
export type SwatchQueryVariables = Exact<{
|
|
261
261
|
swatchId: Scalars['ID'];
|
|
262
262
|
}>;
|
|
263
|
-
export
|
|
263
|
+
export type SwatchQueryResult = {
|
|
264
264
|
swatch: {
|
|
265
265
|
__typename: 'Swatch';
|
|
266
266
|
id: string;
|
|
@@ -269,10 +269,10 @@ export declare type SwatchQueryResult = {
|
|
|
269
269
|
lightness: number;
|
|
270
270
|
} | null;
|
|
271
271
|
};
|
|
272
|
-
export
|
|
272
|
+
export type FileQueryVariables = Exact<{
|
|
273
273
|
fileId: Scalars['ID'];
|
|
274
274
|
}>;
|
|
275
|
-
export
|
|
275
|
+
export type FileQueryResult = {
|
|
276
276
|
file: {
|
|
277
277
|
__typename: 'File';
|
|
278
278
|
id: string;
|
|
@@ -285,10 +285,10 @@ export declare type FileQueryResult = {
|
|
|
285
285
|
} | null;
|
|
286
286
|
} | null;
|
|
287
287
|
};
|
|
288
|
-
export
|
|
288
|
+
export type TypographyQueryVariables = Exact<{
|
|
289
289
|
typographyId: Scalars['ID'];
|
|
290
290
|
}>;
|
|
291
|
-
export
|
|
291
|
+
export type TypographyQueryResult = {
|
|
292
292
|
typography: {
|
|
293
293
|
__typename: 'Typography';
|
|
294
294
|
id: string;
|
|
@@ -317,20 +317,20 @@ export declare type TypographyQueryResult = {
|
|
|
317
317
|
}>;
|
|
318
318
|
} | null;
|
|
319
319
|
};
|
|
320
|
-
export
|
|
320
|
+
export type PagePathnamesByIdQueryVariables = Exact<{
|
|
321
321
|
pageIds: Array<Scalars['ID']> | Scalars['ID'];
|
|
322
322
|
}>;
|
|
323
|
-
export
|
|
323
|
+
export type PagePathnamesByIdQueryResult = {
|
|
324
324
|
pagePathnamesById: Array<{
|
|
325
325
|
__typename: 'PagePathnameSlice';
|
|
326
326
|
id: string;
|
|
327
327
|
pathname: string;
|
|
328
328
|
} | null>;
|
|
329
329
|
};
|
|
330
|
-
export
|
|
330
|
+
export type TableQueryVariables = Exact<{
|
|
331
331
|
tableId: Scalars['ID'];
|
|
332
332
|
}>;
|
|
333
|
-
export
|
|
333
|
+
export type TableQueryResult = {
|
|
334
334
|
table: {
|
|
335
335
|
__typename: 'Table';
|
|
336
336
|
id: string;
|
|
@@ -382,10 +382,10 @@ export declare type TableQueryResult = {
|
|
|
382
382
|
}>;
|
|
383
383
|
} | null;
|
|
384
384
|
};
|
|
385
|
-
export
|
|
385
|
+
export type TypographiesQueryVariables = Exact<{
|
|
386
386
|
typographyIds: Array<Scalars['ID']> | Scalars['ID'];
|
|
387
387
|
}>;
|
|
388
|
-
export
|
|
388
|
+
export type TypographiesQueryResult = {
|
|
389
389
|
typographies: Array<{
|
|
390
390
|
__typename: 'Typography';
|
|
391
391
|
id: string;
|
|
@@ -414,20 +414,20 @@ export declare type TypographiesQueryResult = {
|
|
|
414
414
|
}>;
|
|
415
415
|
} | null>;
|
|
416
416
|
};
|
|
417
|
-
export
|
|
417
|
+
export type GlobalElementQueryVariables = Exact<{
|
|
418
418
|
globalElementId: Scalars['ID'];
|
|
419
419
|
}>;
|
|
420
|
-
export
|
|
420
|
+
export type GlobalElementQueryResult = {
|
|
421
421
|
globalElement: {
|
|
422
422
|
__typename: 'GlobalElement';
|
|
423
423
|
id: string;
|
|
424
424
|
data: Json;
|
|
425
425
|
} | null;
|
|
426
426
|
};
|
|
427
|
-
export
|
|
427
|
+
export type CreateTableRecordMutationVariables = Exact<{
|
|
428
428
|
input: CreateTableRecordInput;
|
|
429
429
|
}>;
|
|
430
|
-
export
|
|
430
|
+
export type CreateTableRecordMutationResult = {
|
|
431
431
|
createTableRecord: {
|
|
432
432
|
tableRecord: {
|
|
433
433
|
id: string;
|