@makeswift/runtime 0.2.19 → 0.3.1
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 +35 -70
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +34 -65
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +176 -208
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +177 -208
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +227 -249
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +229 -247
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +270 -203
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +273 -202
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +50 -71
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +51 -68
- package/dist/Divider.es.js.map +1 -1
- package/dist/Embed.cjs.js +6 -17
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +7 -14
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +723 -553
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +723 -552
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +16 -38
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +17 -38
- package/dist/Image.es.js.map +1 -1
- package/dist/Navigation.cjs.js +318 -224
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +318 -220
- package/dist/Navigation.es.js.map +1 -1
- package/dist/Root.cjs.js +116 -78
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +99 -77
- package/dist/Root.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +119 -86
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +120 -83
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Text.cjs.js +83 -99
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +84 -99
- package/dist/Text.es.js.map +1 -1
- package/dist/Video.cjs.js +8 -19
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +8 -18
- package/dist/Video.es.js.map +1 -1
- package/dist/components.cjs.js +6 -18
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +5 -8
- package/dist/components.es.js.map +1 -1
- package/dist/controls.es.js +1 -1
- package/dist/grid-item.cjs.js +612 -0
- package/dist/grid-item.cjs.js.map +1 -0
- package/dist/grid-item.es.js +604 -0
- package/dist/grid-item.es.js.map +1 -0
- package/dist/index.cjs.js +594 -275
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs2.js +98 -474
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs3.js +20 -107
- package/dist/index.cjs3.js.map +1 -1
- package/dist/index.es.js +589 -274
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js +99 -473
- package/dist/index.es2.js.map +1 -1
- package/dist/index.es3.js +21 -103
- package/dist/index.es3.js.map +1 -1
- package/dist/next.cjs.js +1 -2
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +2 -3
- package/dist/next.es.js.map +1 -1
- package/dist/react-builder-preview.cjs.js +1 -2
- package/dist/react-builder-preview.cjs.js.map +1 -1
- package/dist/react-builder-preview.es.js +3 -4
- package/dist/react-builder-preview.es.js.map +1 -1
- package/dist/react.cjs.js +1 -2
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +1 -2
- package/dist/react.es.js.map +1 -1
- package/dist/slot.cjs.js +41 -6
- package/dist/slot.cjs.js.map +1 -1
- package/dist/slot.es.js +36 -6
- package/dist/slot.es.js.map +1 -1
- package/dist/types/src/components/builtin/Box/Box.d.ts +7 -7
- package/dist/types/src/components/builtin/Box/Box.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Box/components/Placeholder/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Box/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Button/Button.d.ts +46 -34
- package/dist/types/src/components/builtin/Button/Button.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Carousel/Carousel.d.ts +5 -5
- package/dist/types/src/components/builtin/Carousel/Carousel.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Carousel/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Countdown/Countdown.d.ts +3 -3
- package/dist/types/src/components/builtin/Countdown/Countdown.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Countdown/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Divider/Divider.d.ts +3 -3
- package/dist/types/src/components/builtin/Divider/Divider.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Divider/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Embed/Embed.d.ts +3 -3
- package/dist/types/src/components/builtin/Embed/Embed.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/Form.d.ts +3 -3
- 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 +4 -6
- 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 +3 -0
- 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 +2 -0
- 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 +3 -7
- 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 +7 -13
- 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 +2 -0
- 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.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/NumberTableField/index.d.ts +2 -0
- 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 +2 -0
- 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/PlaceholderTableField/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/RadioButton/index.d.ts +4 -8
- 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 +2 -0
- 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.map +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/TextArea/index.d.ts +2 -7
- 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 +2 -0
- 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/services/{cssField.d.ts → responsiveField.d.ts} +5 -4
- package/dist/types/src/components/builtin/Form/components/Field/services/responsiveField.d.ts.map +1 -0
- package/dist/types/src/components/builtin/Form/components/Placeholder/index.d.ts +2 -3
- package/dist/types/src/components/builtin/Form/components/Placeholder/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Spinner/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Image/Image.d.ts +7 -7
- package/dist/types/src/components/builtin/Image/Image.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Navigation/Navigation.d.ts +3 -3
- 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 +8 -81
- 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.map +1 -1
- package/dist/types/src/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts +8 -81
- 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.map +1 -1
- package/dist/types/src/components/builtin/Navigation/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Root/Root.d.ts +1 -2
- package/dist/types/src/components/builtin/Root/Root.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Root/components/Placeholder/index.d.ts +1 -2
- package/dist/types/src/components/builtin/Root/components/Placeholder/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/SocialLinks/SocialLinks.d.ts +3 -3
- 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.map +1 -1
- package/dist/types/src/components/builtin/SocialLinks/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/Text.d.ts +3 -3
- package/dist/types/src/components/builtin/Text/Text.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/components/RichTextEditor/components/Block/index.d.ts +8 -11
- package/dist/types/src/components/builtin/Text/components/RichTextEditor/components/Block/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/components/RichTextEditor/components/Mark/index.d.ts +3 -6
- package/dist/types/src/components/builtin/Text/components/RichTextEditor/components/Mark/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/components/RichTextEditor/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Text/components/RichTextEditor/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/components/RichTextEditor/plugins/Link.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Video/Video.d.ts +4 -4
- package/dist/types/src/components/builtin/Video/Video.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Video/register.d.ts.map +1 -1
- package/dist/types/src/components/hooks/useBackgrounds.d.ts +1 -1
- package/dist/types/src/components/hooks/useBackgrounds.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +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.map +1 -1
- package/dist/types/src/components/shared/BackgroundsContainer/index.d.ts +255 -4
- package/dist/types/src/components/shared/BackgroundsContainer/index.d.ts.map +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 +8 -4
- package/dist/types/src/components/shared/GutterContainer/index.d.ts.map +1 -1
- package/dist/types/src/components/shared/grid-item.d.ts +17 -0
- package/dist/types/src/components/shared/grid-item.d.ts.map +1 -0
- package/dist/types/src/components/utils/responsive-style.d.ts +22 -1
- package/dist/types/src/components/utils/responsive-style.d.ts.map +1 -1
- package/dist/types/src/controls/style.d.ts +5 -65
- package/dist/types/src/controls/style.d.ts.map +1 -1
- package/dist/types/src/css/border-radius.d.ts +20 -0
- package/dist/types/src/css/border-radius.d.ts.map +1 -0
- package/dist/types/src/css/border.d.ts +31 -0
- package/dist/types/src/css/border.d.ts.map +1 -0
- package/dist/types/src/css/length-percentage.d.ts +10 -0
- package/dist/types/src/css/length-percentage.d.ts.map +1 -0
- package/dist/types/src/css/length.d.ts +14 -0
- package/dist/types/src/css/length.d.ts.map +1 -0
- package/dist/types/src/css/margin.d.ts +20 -0
- package/dist/types/src/css/margin.d.ts.map +1 -0
- package/dist/types/src/css/padding.d.ts +20 -0
- package/dist/types/src/css/padding.d.ts.map +1 -0
- package/dist/types/src/next/document.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts +96 -33
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/style.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls.d.ts +10 -2
- package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/use-global-style.d.ts +3 -0
- package/dist/types/src/runtimes/react/use-global-style.d.ts.map +1 -0
- package/dist/useMediaQuery.es.js +1 -1
- package/package.json +2 -4
- package/dist/cssMediaRules.cjs.js +0 -210
- package/dist/cssMediaRules.cjs.js.map +0 -1
- package/dist/cssMediaRules.es.js +0 -201
- package/dist/cssMediaRules.es.js.map +0 -1
- package/dist/index.cjs4.js +0 -18
- package/dist/index.cjs4.js.map +0 -1
- package/dist/index.es4.js +0 -13
- package/dist/index.es4.js.map +0 -1
- package/dist/types/src/components/builtin/Form/components/Field/services/cssField.d.ts.map +0 -1
- package/dist/types/src/components/utils/cssMediaRules.d.ts +0 -69
- package/dist/types/src/components/utils/cssMediaRules.d.ts.map +0 -1
- package/dist/useBoxShadow.cjs.js +0 -78
- package/dist/useBoxShadow.cjs.js.map +0 -1
- package/dist/useBoxShadow.es.js +0 -77
- package/dist/useBoxShadow.es.js.map +0 -1
package/dist/slot.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot.cjs.js","sources":["../src/controls/color.ts","../src/controls/style.ts","../src/prop-controllers/descriptors.ts","../src/controls/image.ts","../src/utils/constants.ts","../src/prop-controllers/instances.ts","../src/controls/slot.ts"],"sourcesContent":["import { CopyContext } from '../state/react-page'\nimport { ColorData } from './types'\n\nexport type ColorControlData = ColorData\n\nexport const ColorControlType = 'makeswift::controls::color'\n\ntype ColorControlConfig = {\n label?: string\n labelOrientation?: 'horizontal' | 'vertical'\n defaultValue?: string\n hideAlpha?: boolean\n}\n\nexport type ColorControlDefinition<C extends ColorControlConfig = ColorControlConfig> = {\n type: typeof ColorControlType\n config: C\n}\n\nexport function Color<C extends ColorControlConfig>(config = {} as C): ColorControlDefinition<C> {\n return { type: ColorControlType, config }\n}\n\nexport function copyColorData(\n value: ColorData | undefined,\n context: CopyContext,\n): ColorData | undefined {\n if (value == null) return value\n\n return {\n ...value,\n swatchId: context.replacementContext.swatchIds.get(value.swatchId) ?? value.swatchId,\n }\n}\n","import { CopyContext, ReplacementContext } from '../state/react-page'\nimport { ColorData, ResponsiveValue } from './types'\n\nimport { copyColorData } from './color'\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/length\n *\n * @todos\n * - Add additional units\n * - Rename `value` field to `amount` or a more descriptive name representative of the \"distance\"\n * represented by a CSS length\n */\nexport type LengthData = { value: number; unit: 'px' }\n\n/** @see https://developer.mozilla.org/en-US/docs/Web/CSS/percentage */\nexport type PercentageData = { value: number; unit: '%' }\n\n/** @see https://developer.mozilla.org/en-US/docs/Web/CSS/length-percentage */\nexport type LengthPercentageData = LengthData | PercentageData\n\n/** @see https://developer.mozilla.org/en-US/docs/Web/CSS/width */\nexport type WidthPropertyData = LengthPercentageData\n\n/** @see https://developer.mozilla.org/en-US/docs/Web/CSS/margin#constituent_properties */\nexport type MarginLonghandPropertyData = LengthData | 'auto'\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/margin\n *\n * @todos\n * - Remove `null` from possible values\n * - Remove `undefined` from possible values and make fields optional\n */\nexport type MarginPropertyData = {\n marginTop: MarginLonghandPropertyData | null | undefined\n marginRight: MarginLonghandPropertyData | null | undefined\n marginBottom: MarginLonghandPropertyData | null | undefined\n marginLeft: MarginLonghandPropertyData | null | undefined\n}\n\n/** @see https://developer.mozilla.org/en-US/docs/Web/CSS/padding#constituent_properties */\nexport type PaddingLonghandPropertyData = LengthData\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/padding\n *\n * @todos\n * - Remove `null` from possible values\n * - Remove `undefined` from possible values and make fields optional\n */\nexport type PaddingPropertyData = {\n paddingTop: PaddingLonghandPropertyData | null | undefined\n paddingRight: PaddingLonghandPropertyData | null | undefined\n paddingBottom: PaddingLonghandPropertyData | null | undefined\n paddingLeft: PaddingLonghandPropertyData | null | undefined\n}\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/border-style\n */\ntype BorderStyle = 'dotted' | 'dashed' | 'solid'\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/border-top#constituent_properties\n *\n * @todos\n * - Change `width` to be a `Length`\n * - Remove `null` from possible values\n * - Remove `undefined` from possible values and make fields optional\n */\nexport type BorderSideShorthandPropertyData = {\n width: number | null | undefined\n style: BorderStyle\n color?: ColorData | null\n}\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/border\n *\n * @todos\n * - Remove `null` from possible values\n * - Remove `undefined` from possible values and make fields optional\n */\nexport type BorderPropertyData = {\n borderTop: BorderSideShorthandPropertyData | null | undefined\n borderRight: BorderSideShorthandPropertyData | null | undefined\n borderBottom: BorderSideShorthandPropertyData | null | undefined\n borderLeft: BorderSideShorthandPropertyData | null | undefined\n}\n\n/** @see https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius#constituent_properties */\nexport type BorderRadiusLonghandPropertyData = LengthPercentageData\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius\n *\n * @todos\n * - Remove `null` from possible values of longhand properties\n * - Remove `undefined` from possible values and make fields optional\n */\nexport type BorderRadiusPropertyData = {\n borderTopLeftRadius: LengthPercentageData | null | undefined\n borderTopRightRadius: LengthPercentageData | null | undefined\n borderBottomRightRadius: LengthPercentageData | null | undefined\n borderBottomLeftRadius: LengthPercentageData | null | undefined\n}\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/CSS/font-family\n *\n * @todos\n * - Remove `null` from possible values of longhand properties\n * - Remove `undefined` from possible values and make fields optional\n */\nexport type FontFamilyPropertyData = string | null | undefined\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/CSS/letter-spacing\n *\n * @todos\n * - Remove `null` from possible values of longhand properties\n * - Remove `undefined` from possible values and make fields optional\n */\nexport type LetterSpacingPropertyData = number | null | undefined\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/CSS/font-size\n *\n * @todos\n * - Remove `null` from possible values of longhand properties\n * - Remove `undefined` from possible values and make fields optional\n */\nexport type FontSizePropertyData =\n | {\n value: number\n unit: 'px'\n }\n | null\n | undefined\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight\n *\n * @todos\n * - Remove `null` from possible values of longhand properties\n * - Remove `undefined` from possible values and make fields optional\n */\nexport type FontWeightPropertyData = number | null | undefined\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform\n *\n * @todos\n * - Match the type with specification\n */\nexport type TextTransformPropertyData = 'uppercase'[]\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/CSS/font-style\n *\n * @todos\n * - Match the type with specification\n */\nexport type FontStylePropertyData = 'italic'[]\n\n/**\n * @todos\n * - Remove `null` from possible values of longhand properties\n * - Remove `undefined` from possible values and make fields optional\n */\nexport type TextStylePropertyData = {\n fontFamily?: FontFamilyPropertyData | null | undefined\n letterSpacing: LetterSpacingPropertyData | null | undefined\n fontSize: FontSizePropertyData | null | undefined\n fontWeight: FontWeightPropertyData | null | undefined\n textTransform: TextTransformPropertyData\n fontStyle: FontStylePropertyData\n}\n\nexport type StyleControlData = {\n width?: ResponsiveValue<WidthPropertyData>\n margin?: ResponsiveValue<MarginPropertyData>\n padding?: ResponsiveValue<PaddingPropertyData>\n border?: ResponsiveValue<BorderPropertyData>\n borderRadius?: ResponsiveValue<BorderRadiusPropertyData>\n textStyle?: ResponsiveValue<TextStylePropertyData>\n}\n\nexport const StyleControlType = 'makeswift::controls::style'\n\nexport const StyleControlProperty = {\n Width: 'makeswift::controls::style::property::width',\n Margin: 'makeswift::controls::style::property::margin',\n Padding: 'makeswift::controls::style::property::padding',\n Border: 'makeswift::controls::style::property::border',\n BorderRadius: 'makeswift::controls::style::property::border-radius',\n TextStyle: 'makeswift::controls::style::property::text-style',\n} as const\n\nexport type StyleControlProperty = typeof StyleControlProperty[keyof typeof StyleControlProperty]\n\ntype StyleControlParams = { properties?: StyleControlProperty[] }\n\nexport type StyleControlConfig = { properties: StyleControlProperty[] }\n\nconst StyleControlDefaultProperties: StyleControlProperty[] = [\n StyleControlProperty.Width,\n StyleControlProperty.Margin,\n]\n\nconst AllStyleControlProperties: StyleControlProperty[] = [\n StyleControlProperty.Width,\n StyleControlProperty.Margin,\n StyleControlProperty.Padding,\n StyleControlProperty.Border,\n StyleControlProperty.BorderRadius,\n StyleControlProperty.TextStyle,\n]\n\nexport type StyleControlDefinition = {\n type: typeof StyleControlType\n config: StyleControlConfig\n}\n\n/**\n * @todos\n * - Add support for custom panel labels.\n * - Add support for default values. Internally, default values must be represented with the same\n * format as the underlying data so that controls can show these values.\n */\nexport function Style(params?: StyleControlParams): StyleControlDefinition {\n return {\n type: StyleControlType,\n config: { properties: params?.properties ?? StyleControlDefaultProperties },\n }\n}\n\nStyle.Default = StyleControlDefaultProperties\nStyle.All = AllStyleControlProperties\n\nStyle.Width = StyleControlProperty.Width\nStyle.Margin = StyleControlProperty.Margin\nStyle.Padding = StyleControlProperty.Padding\nStyle.Border = StyleControlProperty.Border\nStyle.BorderRadius = StyleControlProperty.BorderRadius\nStyle.TextStyle = StyleControlProperty.TextStyle\n\nexport function copyStyleData(\n value: StyleControlData | undefined,\n context: CopyContext,\n): StyleControlData | undefined {\n if (value == null) return value\n\n function copyResponsiveBorder(\n responsiveBorder: ResponsiveValue<BorderPropertyData> | undefined,\n ): ResponsiveValue<BorderPropertyData> | undefined {\n if (responsiveBorder == null) return undefined\n return responsiveBorder.map(deviceBorder => ({\n ...deviceBorder,\n value: copyBorder(deviceBorder.value),\n }))\n }\n\n function copyBorder(border: BorderPropertyData): BorderPropertyData {\n function copyBorderSide(side: BorderSideShorthandPropertyData | null | undefined) {\n if (side == null) return null\n\n if (side.color == null) return side\n\n return {\n ...side,\n color: copyColorData(side.color, context),\n }\n }\n\n return {\n borderTop: copyBorderSide(border.borderTop),\n borderBottom: copyBorderSide(border.borderBottom),\n borderRight: copyBorderSide(border.borderRight),\n borderLeft: copyBorderSide(border.borderLeft),\n }\n }\n\n return { ...value, border: copyResponsiveBorder(value.border) }\n}\n\nif (import.meta.vitest) {\n const { describe, test, expect } = import.meta.vitest\n\n describe.concurrent('style copy', () => {\n test('colors are replaced', () => {\n // Arrange\n const value: StyleControlData = {\n width: [\n {\n value: {\n unit: 'px',\n value: 100,\n },\n deviceId: 'desktop',\n },\n ],\n border: [\n {\n value: {\n borderTop: {\n color: {\n alpha: 1,\n swatchId: 'U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==',\n },\n style: 'solid',\n width: 9,\n },\n borderLeft: {\n color: {\n alpha: 1,\n swatchId: 'U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==',\n },\n style: 'solid',\n width: 9,\n },\n borderRight: {\n color: {\n alpha: 1,\n swatchId: 'U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==',\n },\n style: 'solid',\n width: 9,\n },\n borderBottom: {\n color: {\n alpha: 1,\n swatchId: 'U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==',\n },\n style: 'solid',\n width: 9,\n },\n },\n deviceId: 'desktop',\n },\n ],\n textStyle: [\n {\n value: {\n fontSize: {\n unit: 'px',\n value: 46,\n },\n fontStyle: [],\n fontFamily: 'Oswald',\n fontWeight: 400,\n letterSpacing: 5.2,\n textTransform: [],\n },\n deviceId: 'desktop',\n },\n ],\n borderRadius: [\n {\n value: {\n borderTopLeftRadius: {\n unit: 'px',\n value: 4,\n },\n borderTopRightRadius: {\n unit: 'px',\n value: 4,\n },\n borderBottomLeftRadius: {\n unit: 'px',\n value: 4,\n },\n borderBottomRightRadius: {\n unit: 'px',\n value: 4,\n },\n },\n deviceId: 'desktop',\n },\n ],\n }\n const expected = JSON.parse(\n JSON.stringify(value).replaceAll(\n 'U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==',\n 'testing',\n ),\n )\n\n const replacementContext = {\n elementHtmlIds: new Set(),\n elementKeys: new Map(),\n swatchIds: new Map([\n ['U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==', 'testing'],\n ]),\n fileIds: new Map(),\n typographyIds: new Map(),\n tableIds: new Map(),\n tableColumnIds: new Map(),\n pageIds: new Map(),\n globalElementIds: new Map(),\n globalElementData: new Map(),\n }\n\n // Act\n const result = copyStyleData(value, {\n replacementContext: replacementContext as ReplacementContext,\n copyElement: node => node,\n })\n\n // Assert\n expect(result).toMatchObject(expected)\n })\n })\n}\n","import type * as Slate from 'slate'\nimport { StyleControlDefinition, StyleControlType } from '../controls/style'\nimport { ResolveWidthControlValue } from '../runtimes/react/controls'\nimport { StyleControlFormattedValue } from '../runtimes/react/controls/style'\nimport type { Element, Data } from '../state/react-page'\nimport type { ResponsiveColor } from '../runtimes/react/controls'\nimport { NumberControlDefinition } from '../controls/number'\nimport { NumberControlValue } from '../runtimes/react/controls/number'\nimport {\n CheckboxControlDefinition,\n ColorControlDefinition,\n ComboboxControlDefinition,\n ImageControlDefinition,\n LinkControlDefinition,\n ListControlDefinition,\n SelectControlDefinition,\n ShapeControlDefinition,\n SlotControlDefinition,\n TextAreaControlDefinition,\n TextInputControlDefinition,\n} from '../controls'\nimport { TextInputControlValue } from '../runtimes/react/controls/text-input'\nimport { TextAreaControlValue } from '../runtimes/react/controls/text-area'\nimport { ColorControlValue } from '../runtimes/react/controls/color'\nimport { SelectControlValue } from '../runtimes/react/controls/select'\nimport { CheckboxControlValue } from '../runtimes/react/controls/checkbox'\nimport { ResolveImageControlValue } from '../runtimes/react/controls/image'\nimport { ShapeControlValue } from '../runtimes/react/controls/shape'\nimport { ListControlValue } from '../runtimes/react/controls/list'\nimport { ComboboxControlValue } from '../runtimes/react/controls/combobox'\nimport { LinkControlValue } from '../runtimes/react/controls/link'\nimport { SlotControlValue } from '../runtimes/react/controls/slot'\n\nexport type { Data }\n\n// See https://github.com/microsoft/TypeScript/issues/15300\nexport type IndexSignatureHack<T> = T extends Record<string, any>\n ? { [K in keyof T]: IndexSignatureHack<T[K]> }\n : T\n\nexport type Device = 'desktop' | 'tablet' | 'mobile'\n\nexport type DeviceOverride<T> = { deviceId: Device; value: T }\n\nexport type ResponsiveValue<T> = DeviceOverride<T>[]\n\nexport type ResponsiveValueType<T> = T extends ResponsiveValue<infer U> ? U : never\n\ntype Color = { swatchId: string; alpha: number }\n\ntype IconName =\n | 'HeightAuto16'\n | 'HeightMatch16'\n | 'VerticalAlignStart16'\n | 'VerticalAlignMiddle16'\n | 'VerticalAlignEnd16'\n | 'VerticalAlignSpaceBetween16'\n | 'ButtonPill16'\n | 'ButtonRounded16'\n | 'ButtonSquare16'\n | 'SizeSmall16'\n | 'SizeMedium16'\n | 'SizeLarge16'\n | 'ArrowInside16'\n | 'ArrowCenter16'\n | 'ArrowOutside16'\n | 'CountdownSolid16'\n | 'CountdownSolidSplit16'\n | 'CountdownOutline16'\n | 'CountdownOutlineSplit16'\n | 'CountdownNaked16'\n | 'Sun16'\n | 'Moon16'\n | 'AlignLeft16'\n | 'AlignCenter16'\n | 'AlignRight16'\n | 'Star16'\n | 'StarCircle16'\n | 'StarRoundedSquare16'\n | 'StarSquare16'\n\nexport type Gap = { value: number; unit: 'px' }\n\nexport type Length = { value: number; unit: 'px' | '%' }\n\ntype OpenPageLink = {\n type: 'OPEN_PAGE'\n payload: { pageId: string | null | undefined; openInNewTab: boolean }\n}\n\ntype OpenURLLink = { type: 'OPEN_URL'; payload: { url: string; openInNewTab: boolean } }\n\ntype SendEmailLink = {\n type: 'SEND_EMAIL'\n payload: { to: string; subject?: string; body?: string }\n}\n\ntype CallPhoneLink = { type: 'CALL_PHONE'; payload: { phoneNumber: string } }\n\ntype ScrollToElementLink = {\n type: 'SCROLL_TO_ELEMENT'\n payload: {\n elementIdConfig: { elementKey: string; propName: string } | null | undefined\n block: 'start' | 'center' | 'end'\n }\n}\n\ntype Link = OpenPageLink | OpenURLLink | SendEmailLink | CallPhoneLink | ScrollToElementLink\n\ntype TextStyle = {\n fontFamily?: string | null | undefined\n letterSpacing: number | null | undefined\n fontSize: { value: number; unit: 'px' } | null | undefined\n fontWeight: number | null | undefined\n textTransform: 'uppercase'[]\n fontStyle: 'italic'[]\n}\n\nexport const Types = {\n Backgrounds: 'Backgrounds',\n Border: 'Border',\n BorderRadius: 'BorderRadius',\n Checkbox: 'Checkbox',\n Date: 'Date',\n ElementID: 'ElementID',\n Font: 'Font',\n GapX: 'GapX',\n GapY: 'GapY',\n Grid: 'Grid',\n Image: 'Image',\n Images: 'Images',\n Link: 'Link',\n List: 'List',\n Margin: 'Margin',\n NavigationLinks: 'NavigationLinks',\n Number: 'Number',\n Padding: 'Padding',\n ResponsiveColor: 'ResponsiveColor',\n ResponsiveIconRadioGroup: 'ResponsiveIconRadioGroup',\n ResponsiveLength: 'ResponsiveLength',\n ResponsiveNumber: 'ResponsiveNumber',\n ResponsiveOpacity: 'ResponsiveOpacity',\n ResponsiveSelect: 'ResponsiveSelect',\n RichText: 'RichText',\n Shadows: 'Shadows',\n Shape: 'Shape',\n SocialLinks: 'SocialLinks',\n Table: 'Table',\n TableFormFields: 'TableFormFields',\n Typeahead: 'Typeahead',\n TextArea: 'TextArea',\n TextInput: 'TextInput',\n TextStyle: 'TextStyle',\n Video: 'Video',\n Width: 'Width',\n Style: StyleControlType,\n} as const\n\ntype Options<T> = T | ((props: Record<string, unknown>, deviceMode: Device) => T)\n\nexport type ResolveOptions<T extends Options<unknown>> = T extends Options<infer U> ? U : never\n\ntype ColorBackground = { type: 'color'; id: string; payload: Color | null }\n\ntype GradientStop = { id: string; location: number; color: Color | null }\n\ntype Gradient = { angle?: number; isRadial?: boolean; stops: GradientStop[] }\n\ntype GradientBackground = { type: 'gradient'; id: string; payload: Gradient }\n\ntype BackgroundImagePosition = { x: number; y: number }\n\ntype BackgroundImageSize = 'cover' | 'contain' | 'auto'\n\ntype BackgroundImageRepeat = 'no-repeat' | 'repeat-x' | 'repeat-y' | 'repeat'\n\ntype BackgroundImage = {\n imageId: string\n position: BackgroundImagePosition\n size?: BackgroundImageSize\n repeat?: BackgroundImageRepeat\n opacity?: number\n parallax?: number\n}\n\ntype ImageBackground = { type: 'image'; id: string; payload: BackgroundImage }\n\ntype BackgroundVideoAspectRatio = 'wide' | 'standard'\n\ntype BackgroundVideo = {\n url?: string\n maskColor?: Color | null\n opacity?: number\n zoom?: number\n aspectRatio?: BackgroundVideoAspectRatio\n parallax?: number\n}\n\ntype VideoBackground = { type: 'video'; id: string; payload: BackgroundVideo }\n\ntype Background = ColorBackground | GradientBackground | ImageBackground | VideoBackground\n\nexport type BackgroundsValue = ResponsiveValue<Background[]>\n\ntype BackgroundsOptions = Options<Record<string, never>>\n\ntype BackgroundsDescriptor<_T = BackgroundsValue> = {\n type: typeof Types.Backgrounds\n options: BackgroundsOptions\n}\n\nexport function Backgrounds(options: BackgroundsOptions = {}): BackgroundsDescriptor {\n return { type: Types.Backgrounds, options }\n}\n\ntype BorderSideStyle = 'dashed' | 'dotted' | 'solid'\n\ntype BorderSide = { width: number | null | undefined; style: BorderSideStyle; color?: Color | null }\n\ntype Border = {\n [K in 'top' | 'right' | 'bottom' | 'left' as `border${Capitalize<K>}`]:\n | BorderSide\n | null\n | undefined\n}\n\nexport type BorderValue = ResponsiveValue<Border>\n\ntype BorderOptions = Options<Record<string, never>>\n\ntype BorderDescriptor<_T = BorderValue> = { type: typeof Types.Border; options: BorderOptions }\n\nexport function Border(options: BorderOptions = {}): BorderDescriptor {\n return { type: Types.Border, options }\n}\n\ntype BorderRadius = {\n [K in 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' as `border${Capitalize<K>}Radius`]:\n | Length\n | null\n | undefined\n}\n\nexport type BorderRadiusValue = ResponsiveValue<BorderRadius>\n\ntype BorderRadiusOptions = Options<Record<string, never>>\n\ntype BorderRadiusDescriptor<_T = BorderRadiusValue> = {\n type: typeof Types.BorderRadius\n options: BorderRadiusOptions\n}\n\nexport function BorderRadius(options: BorderRadiusOptions = {}): BorderRadiusDescriptor {\n return { type: Types.BorderRadius, options }\n}\n\nexport type CheckboxValue = boolean\n\nexport type CheckboxOptions = Options<{\n preset?: CheckboxValue\n label: string\n hidden?: boolean\n}>\n\nexport type CheckboxDescriptor<_T = CheckboxValue> = {\n type: typeof Types.Checkbox\n options: CheckboxOptions\n}\n\nexport function Checkbox(options: CheckboxOptions): CheckboxDescriptor {\n return { type: Types.Checkbox, options }\n}\n\nexport type DateValue = string\n\nexport type DateOptions = Options<{ preset?: DateValue }>\n\nexport type DateDescriptor<_T = DateValue> = { type: typeof Types.Date; options: DateOptions }\n\nexport function Date(options: DateOptions = {}): DateDescriptor {\n return { type: Types.Date, options }\n}\n\nexport type ElementIDValue = string\n\ntype ElementIDOptions = Options<Record<string, never>>\n\ntype ElementIDDescriptor<_T = ElementIDValue> = {\n type: typeof Types.ElementID\n options: ElementIDOptions\n}\n\nexport function ElementID(options: ElementIDOptions = {}): ElementIDDescriptor {\n return { type: Types.ElementID, options }\n}\n\nexport type FontValue = ResponsiveValue<string>\n\ntype FontOptions = Options<{ preset?: FontValue; label?: string }>\n\ntype FontDescriptor<_T = FontValue> = { type: typeof Types.Font; options: FontOptions }\n\nexport function Font(options: FontOptions = {}): FontDescriptor {\n return { type: Types.Font, options }\n}\n\nexport type GapXValue = ResponsiveValue<Gap>\n\nexport type GapXOptions = Options<{\n preset?: GapXValue\n label?: string\n defaultValue?: Gap\n min?: number\n max?: number\n step?: number\n hidden?: boolean\n}>\n\nexport type GapXDescriptor<_T = GapXValue> = { type: typeof Types.GapX; options: GapXOptions }\n\nexport function GapX(options: GapXOptions = {}): GapXDescriptor {\n return { type: Types.GapX, options }\n}\n\nexport type GapYValue = ResponsiveValue<Gap>\n\nexport type GapYOptions = Options<{\n preset?: GapYValue\n label?: string\n defaultValue?: Gap\n step?: number\n min?: number\n max?: number\n hidden?: boolean\n}>\n\nexport type GapYDescriptor<_T = GapYValue> = { type: typeof Types.GapY; options: GapYOptions }\n\nexport function GapY(options: GapYOptions = {}): GapYDescriptor {\n return { type: Types.GapY, options }\n}\n\ntype GridColumn = { count: number; spans: number[][] }\n\nexport type GridValue = { elements: Element[]; columns: ResponsiveValue<GridColumn> }\n\ntype GridOptions = Options<Record<string, never>>\n\ntype GridDescriptor<_T = GridValue> = { type: typeof Types.Grid; options: GridOptions }\n\nexport function Grid(options: GridOptions = {}): GridDescriptor {\n return { type: Types.Grid, options }\n}\n\nexport type ImageValue = string\n\nexport type ImageOptions = Options<{ label?: string; hidden?: boolean }>\n\nexport type ImageDescriptor<_T = ImageValue> = { type: typeof Types.Image; options: ImageOptions }\n\nexport function Image(options: ImageOptions = {}): ImageDescriptor {\n return { type: Types.Image, options }\n}\n\nexport type ImagesValue = { key: string; props: { link?: Link; file?: string; altText?: string } }[]\n\ntype ImagesOptions = Options<{ preset?: ImagesValue }>\n\ntype ImagesDescriptor<_T = ImagesValue> = { type: typeof Types.Images; options: ImagesOptions }\n\nexport function Images(options: ImagesOptions = {}): ImagesDescriptor {\n return { type: Types.Images, options }\n}\n\nexport type LinkValue = Link\n\nexport type LinkOptions = Options<{\n preset?: LinkValue\n label?: string\n defaultValue?: Link\n options?: { value: Link['type']; label: string }[]\n hidden?: boolean\n}>\n\nexport type LinkDescriptor<_T = LinkValue> = { type: typeof Types.Link; options: LinkOptions }\n\nexport function Link(options: LinkOptions = {}): LinkDescriptor {\n return { type: Types.Link, options }\n}\n\ntype ListValueItem<T extends Data> = { id: string; value?: T }\n\nexport type ListValue<T extends Data = Data> = ListValueItem<T>[]\n\nexport type ListOptions<T extends Data> = {\n type: PanelDescriptor<T>\n label?: string\n getItemLabel?: ((value: T | undefined) => string) | ((value: T | undefined) => Promise<string>)\n preset?: ListValue<T>\n defaultValue?: ListValue<T>\n}\n\nexport type ListDescriptor<T extends ListValue = ListValue> = {\n type: typeof Types.List\n options: ListOptions<T extends ListValue<infer U> ? U : never>\n}\n\nexport function List<T extends Data>(options: ListOptions<T>): ListDescriptor<ListValue<T>> {\n return { type: Types.List, options }\n}\n\ntype MarginSide = { value: number; unit: 'px' } | 'auto'\n\ntype Margin = {\n [K in 'top' | 'right' | 'bottom' | 'left' as `margin${Capitalize<K>}`]:\n | MarginSide\n | null\n | undefined\n}\n\nexport type MarginValue = ResponsiveValue<Margin>\n\ntype MarginOptions = Options<{ preset?: MarginValue }>\n\ntype MarginDescriptor<_T = MarginValue> = { type: typeof Types.Margin; options: MarginOptions }\n\nexport function Margin(options: MarginOptions = {}): MarginDescriptor {\n return { type: Types.Margin, options }\n}\n\ntype ButtonVariant = 'flat' | 'outline' | 'shadow' | 'clear' | 'blocky' | 'bubbly' | 'skewed'\n\ntype ButtonShape = 'pill' | 'rounded' | 'square'\n\ntype ButtonSize = 'small' | 'medium' | 'large'\n\nexport type NavigationButton = {\n id: string\n type: 'button'\n payload: {\n label: string\n link?: Link\n variant?: ResponsiveValue<ButtonVariant>\n shape?: ResponsiveValue<ButtonShape>\n size?: ResponsiveValue<ButtonSize>\n textColor?: ResponsiveValue<Color>\n color?: ResponsiveValue<Color>\n textStyle?: ResponsiveValue<TextStyle>\n }\n}\n\ntype NavigationDropdownCaretType = 'caret' | 'plus' | 'arrow-down' | 'chevron-down'\n\ntype NavigationDropdownLink = {\n id: string\n payload: {\n label: string\n link?: Link\n color?: ResponsiveValue<Color>\n textStyle?: ResponsiveValue<TextStyle>\n }\n}\n\ntype NavigationDropdown = {\n id: string\n type: 'dropdown'\n payload: {\n label: string\n caret?: NavigationDropdownCaretType\n links?: NavigationDropdownLink[]\n variant?: ResponsiveValue<ButtonVariant>\n shape?: ResponsiveValue<ButtonShape>\n size?: ResponsiveValue<ButtonSize>\n textColor?: ResponsiveValue<Color>\n color?: ResponsiveValue<Color>\n textStyle?: ResponsiveValue<TextStyle>\n }\n}\n\nexport type NavigationLinksValue = (NavigationButton | NavigationDropdown)[]\n\ntype NavigationLinksOptions = Options<Record<string, never>>\n\ntype NavigationLinksDescriptor<_T = NavigationLinksValue> = {\n type: typeof Types.NavigationLinks\n options: NavigationLinksOptions\n}\n\nexport function NavigationLinks(options: NavigationLinksOptions = {}): NavigationLinksDescriptor {\n return { type: Types.NavigationLinks, options }\n}\n\nexport type NumberValue = number\n\nexport type NumberOptions = Options<{\n preset?: NumberValue\n label?: string\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n hidden?: boolean\n}>\n\nexport type NumberDescriptor<_T = NumberValue> = {\n type: typeof Types.Number\n options: NumberOptions\n}\n\nexport function Number(options: NumberOptions = {}): NumberDescriptor {\n return { type: Types.Number, options }\n}\n\ntype PaddingSide = { value: number; unit: 'px' }\n\ntype Padding = {\n [K in 'top' | 'right' | 'bottom' | 'left' as `padding${Capitalize<K>}`]:\n | PaddingSide\n | null\n | undefined\n}\n\nexport type PaddingValue = ResponsiveValue<Padding>\n\ntype PaddingOptions = Options<{ preset?: PaddingValue }>\n\ntype PaddingDescriptor<_T = PaddingValue> = { type: typeof Types.Padding; options: PaddingOptions }\n\nexport function Padding(options: PaddingOptions = {}): PaddingDescriptor {\n return { type: Types.Padding, options }\n}\n\nexport type ResponsiveColorValue = ResponsiveValue<Color>\n\ntype ResponsiveColorOptions = Options<{ label?: string; placeholder?: string; hidden?: boolean }>\n\nexport type ResponsiveColorDescriptor<_T = ResponsiveColorValue> = {\n type: typeof Types.ResponsiveColor\n options: ResponsiveColorOptions\n}\n\nexport function ResponsiveColor(options: ResponsiveColorOptions = {}): ResponsiveColorDescriptor {\n return { type: Types.ResponsiveColor, options }\n}\n\nexport type IconRadioGroupOption<T extends string> = { value: T; label: string; icon: IconName }\n\nexport type ResponsiveIconRadioGroupValue<T extends string = string> = ResponsiveValue<T>\n\nexport type ResponsiveIconRadioGroupOptions<T extends string = string, U extends T = T> = Options<{\n label?: string\n options: IconRadioGroupOption<T>[]\n defaultValue?: U\n hidden?: boolean\n}>\n\nexport type ResponsiveIconRadioGroupDescriptor<\n T extends ResponsiveIconRadioGroupValue<string> = ResponsiveIconRadioGroupValue<string>,\n> = {\n type: typeof Types.ResponsiveIconRadioGroup\n options: ResponsiveIconRadioGroupOptions<ResponsiveValueType<T>>\n}\n\n// HACK(miguel): We have to use a layer of indirection with `_T` and `T` because otherwise the\n// values provided would undergo type widening. For some reason, the extra layer of indirection\n// reuslts in TypeScript not widening types. Note, this only happens when the returned value of this\n// function is passed to another as an argument, which is common with the `registerComponent` API.\nexport function ResponsiveIconRadioGroup<_T extends string, T extends _T, U extends T>(\n options: ResponsiveIconRadioGroupOptions<T, U>,\n): ResponsiveIconRadioGroupDescriptor<ResponsiveIconRadioGroupValue<T>> {\n return { type: Types.ResponsiveIconRadioGroup, options }\n}\n\nexport type ResponsiveLengthValue = ResponsiveValue<Length>\n\nexport type LengthOption =\n | { value: 'px'; label: 'Pixels'; icon: 'Px16' }\n | { value: '%'; label: 'Percentage'; icon: 'Percent16' }\n\nexport type ResponsiveLengthOptions = Options<{\n label?: string\n options?: LengthOption[]\n defaultValue?: Length\n hidden?: boolean\n}>\n\nexport type ResponsiveLengthDescriptor<_T = ResponsiveLengthValue> = {\n type: typeof Types.ResponsiveLength\n options: ResponsiveLengthOptions\n}\n\nexport function ResponsiveLength(\n options: ResponsiveLengthOptions = {},\n): ResponsiveLengthDescriptor {\n return { type: Types.ResponsiveLength, options }\n}\n\nexport type ResponsiveNumberValue = ResponsiveValue<number>\n\nexport type ResponsiveNumberOptions = Options<{\n label?: string\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n hidden?: boolean\n}>\n\nexport type ResponsiveNumberDescriptor<_T = ResponsiveNumberValue> = {\n type: typeof Types.ResponsiveNumber\n options: ResponsiveNumberOptions\n}\n\nexport function ResponsiveNumber(\n options: ResponsiveNumberOptions = {},\n): ResponsiveNumberDescriptor {\n return { type: Types.ResponsiveNumber, options }\n}\n\nexport type ResponsiveOpacityValue = ResponsiveValue<number>\n\ntype ResponsiveOpacityOptions = Options<Record<string, never>>\n\ntype ResponsiveOpacityDescriptor<_T = ResponsiveOpacityValue> = {\n type: typeof Types.ResponsiveOpacity\n options: ResponsiveOpacityOptions\n}\n\nexport function ResponsiveOpacity(\n options: ResponsiveOpacityOptions = {},\n): ResponsiveOpacityDescriptor {\n return { type: Types.ResponsiveOpacity, options }\n}\n\nexport type ResponsiveSelectValue<T extends string = string> = ResponsiveValue<T>\n\nexport type SelectLabelOrientation = 'vertical' | 'horizontal'\n\nexport type SelectOption<T extends string> = { value: T; label: string }\n\nexport type ResponsiveSelectOptions<T extends string = string, U extends T = T> = Options<{\n label?: string\n labelOrientation?: SelectLabelOrientation\n options: SelectOption<T>[]\n defaultValue?: U\n hidden?: boolean\n}>\n\nexport type ResponsiveSelectDescriptor<\n T extends ResponsiveSelectValue<string> = ResponsiveSelectValue<string>,\n> = {\n type: typeof Types.ResponsiveSelect\n options: ResponsiveSelectOptions<ResponsiveValueType<T>>\n}\n\n// HACK(miguel): We have to use a layer of indirection with `_T` and `T` because otherwise the\n// values provided would undergo type widening. For some reason, the extra layer of indirection\n// reuslts in TypeScript not widening types. Note, this only happens when the returned value of this\n// function is passed to another as an argument, which is common with the `registerComponent` API.\nexport function ResponsiveSelect<_T extends string, T extends _T, U extends T>(\n options: ResponsiveSelectOptions<T, U>,\n): ResponsiveSelectDescriptor<ResponsiveSelectValue<T>> {\n return { type: Types.ResponsiveSelect, options }\n}\n\nexport type RichTextValue = IndexSignatureHack<Slate.ValueJSON>\n\nexport type RichTextOptions = Options<{ preset?: RichTextValue }>\n\nexport type RichTextDescriptor<_T extends Data = RichTextValue> = {\n type: typeof Types.RichText\n options: RichTextOptions\n}\n\nexport function RichText(options: RichTextOptions = {}): RichTextDescriptor {\n return { type: Types.RichText, options }\n}\n\ntype Shadow = {\n color?: Color | null\n blurRadius?: number\n spreadRadius?: number\n offsetX?: number\n offsetY?: number\n inset?: boolean\n}\n\ntype Shadows = { id: string; payload: Shadow }[]\n\nexport type ShadowsValue = ResponsiveValue<Shadows>\n\ntype ShadowsOptions = Options<Record<string, never>>\n\ntype ShadowsDescriptor<_T = ShadowsValue> = { type: typeof Types.Shadows; options: ShadowsOptions }\n\nexport function Shadows(options: ShadowsOptions = {}): ShadowsDescriptor {\n return { type: Types.Shadows, options }\n}\n\nexport type ShapeValue<T extends Data = Data> = Record<string, T>\n\ntype ShapeOptions<T extends Record<string, PanelDescriptor>> = {\n type: T\n preset?: { [K in keyof T]?: DescriptorValueType<T[K]> }\n}\n\nexport type ShapeDescriptor<\n _T extends Record<string, Data>,\n U extends Record<string, PanelDescriptor>,\n> = {\n type: typeof Types.Shape\n options: ShapeOptions<U>\n}\n\nexport function Shape<T extends Record<string, PanelDescriptor>>(\n options: ShapeOptions<T>,\n): ShapeDescriptor<{ [K in keyof T]?: DescriptorValueType<T[K]> }, T> {\n return { type: Types.Shape, options }\n}\n\ntype SocialLinkType =\n | 'angellist'\n | 'codepen'\n | 'dribbble'\n | 'facebook'\n | 'github'\n | 'instagram'\n | 'linkedin'\n | 'medium'\n | 'pinterest'\n | 'reddit'\n | 'rss'\n | 'snapchat'\n | 'soundcloud'\n | 'spotify'\n | 'telegram'\n | 'tumblr'\n | 'twitch'\n | 'twitter'\n | 'vimeo'\n | 'whatsapp'\n | 'yelp'\n | 'youtube'\n\ntype SocialLink = { type: SocialLinkType; url: string }\n\ntype SocialLinksLink = { id: string; payload: SocialLink }\n\nexport type SocialLinksValue = { links: SocialLinksLink[]; openInNewTab: boolean }\n\ntype SocialLinksOptions = Options<{ preset?: SocialLinksValue }>\n\ntype SocialLinksDescriptor<_T = SocialLinksValue> = {\n type: typeof Types.SocialLinks\n options: SocialLinksOptions\n}\n\nexport function SocialLinks(options: SocialLinksOptions = {}): SocialLinksDescriptor {\n return { type: Types.SocialLinks, options }\n}\n\nexport type TableValue = string\n\ntype TableOptions = Options<{ preset?: TableValue }>\n\ntype TableDescriptor<_T = TableValue> = { type: typeof Types.Table; options: TableOptions }\n\nexport function Table(options: TableOptions = {}): TableDescriptor {\n return { type: Types.Table, options }\n}\n\ntype TableFormField = {\n id: string\n tableColumnId: string\n label?: string\n placeholder?: string\n defaultValue?: string | boolean | string[]\n required?: boolean\n hidden?: boolean\n type?: 'select' | 'radio'\n hideLabel?: boolean\n autofill?: boolean\n}\n\ntype Grid = { count: number; spans: number[][] }\n\nexport type TableFormFieldsValue = { fields: TableFormField[]; grid: ResponsiveValue<Grid> }\n\ntype TableFormFieldsOptions = Options<{ preset?: TableFormFieldsValue }>\n\nexport type TableFormFieldsDescriptor<_T = TableFormFieldsValue> = {\n type: typeof Types.TableFormFields\n options: TableFormFieldsOptions\n}\n\nexport function TableFormFields(options: TableFormFieldsOptions = {}): TableFormFieldsDescriptor {\n return { type: Types.TableFormFields, options }\n}\n\nexport type TypeaheadValue<T extends Data = Data> = {\n id: string\n label: string\n value: T\n}\n\nexport type TypeaheadOptions<T extends Data> = {\n getItems: (query: string) => Promise<TypeaheadValue<T>[]>\n label?: string\n preset?: TypeaheadValue<T>\n defaultValue?: TypeaheadValue<T>\n}\n\nexport type TypeaheadDescriptor<T extends TypeaheadValue = TypeaheadValue> = {\n type: typeof Types.Typeahead\n options: TypeaheadOptions<T extends TypeaheadValue<infer U> ? U : never>\n}\n\nexport function Typeahead<T extends Data>(\n options: TypeaheadOptions<T>,\n): TypeaheadDescriptor<TypeaheadValue<T>> {\n return { type: Types.Typeahead, options }\n}\n\nexport type TextAreaValue = string\n\ntype TextAreaOptions = Options<{ preset?: TextAreaValue; label?: string; rows?: number }>\n\ntype TextAreaDescriptor<_T = TextAreaValue> = {\n type: typeof Types.TextArea\n options: TextAreaOptions\n}\n\nexport function TextArea(options: TextAreaOptions = {}): TextAreaDescriptor {\n return { type: Types.TextArea, options }\n}\n\nexport type TextInputValue = string\n\nexport type TextInputOptions = Options<{ label?: string; placeholder?: string; hidden?: boolean }>\n\nexport type TextInputDescriptor<_T = TextInputValue> = {\n type: typeof Types.TextInput\n options: TextInputOptions\n}\n\nexport function TextInput(options: TextInputOptions = {}): TextInputDescriptor {\n return { type: Types.TextInput, options }\n}\n\nexport type TextStyleValue = ResponsiveValue<TextStyle>\n\nexport type TextStyleOptions = Options<{\n preset?: TextStyleValue\n label?: string\n hidden?: boolean\n}>\n\nexport type TextStyleDescriptor<_T = TextStyleValue> = {\n type: typeof Types.TextStyle\n options: TextStyleOptions\n}\n\nexport function TextStyle(options: TextStyleOptions = {}): TextStyleDescriptor {\n return { type: Types.TextStyle, options }\n}\n\ntype Video = {\n url?: string\n muted?: boolean\n playing?: boolean\n loop?: boolean\n controls?: boolean\n}\n\nexport type VideoValue = Video\n\ntype VideoOptions = Options<{ preset?: VideoValue }>\n\ntype VideoDescriptor<_T = VideoValue> = { type: typeof Types.Video; options: VideoOptions }\n\nexport function Video(options: VideoOptions = {}): VideoDescriptor {\n return { type: Types.Video, options }\n}\n\nexport type WidthValue = ResponsiveValue<Length>\n\nexport const WidthControlValueFormats = {\n ClassName: 'ClassName',\n ResponsiveValue: 'ResponsiveValue',\n} as const\n\ntype WidthControlValueFormat =\n typeof WidthControlValueFormats[keyof typeof WidthControlValueFormats]\n\ntype WidthOptions = Options<{\n preset?: WidthValue\n defaultValue?: Length\n format?: WidthControlValueFormat\n}>\n\nexport type WidthDescriptor<_T = WidthValue, U extends WidthOptions = WidthOptions> = {\n type: typeof Types.Width\n options: U\n}\n\nexport function Width<T extends WidthOptions>(\n options: T & WidthOptions = {} as T,\n): WidthDescriptor<WidthValue, T> {\n return { type: Types.Width, options }\n}\n\nWidth.Formats = WidthControlValueFormats\n\nexport type Descriptor<T extends Data = Data> =\n | BackgroundsDescriptor<T>\n | BorderDescriptor<T>\n | BorderRadiusDescriptor<T>\n | CheckboxDescriptor<T>\n | DateDescriptor<T>\n | ElementIDDescriptor<T>\n | FontDescriptor<T>\n | GapXDescriptor<T>\n | GapYDescriptor<T>\n | GridDescriptor<T>\n | ImageDescriptor<T>\n | ImagesDescriptor<T>\n | LinkDescriptor<T>\n | ListDescriptor<T extends ListValue ? T : ListValue>\n | MarginDescriptor<T>\n | NavigationLinksDescriptor<T>\n | NumberDescriptor<T>\n | PaddingDescriptor<T>\n | ResponsiveColorDescriptor<T>\n | ResponsiveIconRadioGroupDescriptor<\n T extends ResponsiveIconRadioGroupValue<string> ? T : ResponsiveIconRadioGroupValue<string>\n >\n | ResponsiveLengthDescriptor<T>\n | ResponsiveNumberDescriptor<T>\n | ResponsiveOpacityDescriptor<T>\n | ResponsiveSelectDescriptor<\n T extends ResponsiveSelectValue<string> ? T : ResponsiveSelectValue<string>\n >\n | RichTextDescriptor<T>\n | ShadowsDescriptor<T>\n | ShapeDescriptor<T extends ShapeValue ? T : ShapeValue, any>\n | SocialLinksDescriptor<T>\n | TableDescriptor<T>\n | TableFormFieldsDescriptor<T>\n | TypeaheadDescriptor<T extends TypeaheadValue ? T : TypeaheadValue>\n | TextAreaDescriptor<T>\n | TextInputDescriptor<T>\n | TextStyleDescriptor<T>\n | VideoDescriptor<T>\n | WidthDescriptor<T>\n | StyleControlDefinition\n | NumberControlDefinition\n | CheckboxControlDefinition\n | TextInputControlDefinition\n | TextAreaControlDefinition\n | SelectControlDefinition\n | ColorControlDefinition\n | ImageControlDefinition\n | ComboboxControlDefinition\n | ShapeControlDefinition\n | ListControlDefinition\n | LinkControlDefinition\n | SlotControlDefinition\n\nexport type PanelDescriptorType =\n | typeof Types.Backgrounds\n | typeof Types.ResponsiveIconRadioGroup\n | typeof Types.Margin\n | typeof Types.Padding\n | typeof Types.Border\n | typeof Types.Shadows\n | typeof Types.GapY\n | typeof Types.GapX\n | typeof Types.BorderRadius\n | typeof Types.Checkbox\n | typeof Types.TextInput\n | typeof Types.Link\n | typeof Types.List\n | typeof Types.Shape\n | typeof Types.ResponsiveSelect\n | typeof Types.ResponsiveColor\n | typeof Types.TextStyle\n | typeof Types.Images\n | typeof Types.ResponsiveNumber\n | typeof Types.Number\n | typeof Types.Date\n | typeof Types.Font\n | typeof Types.TextArea\n | typeof Types.Table\n | typeof Types.Typeahead\n | typeof Types.RichText\n | typeof Types.Image\n | typeof Types.ResponsiveOpacity\n | typeof Types.SocialLinks\n | typeof Types.Video\n | typeof Types.NavigationLinks\n\nexport type PanelDescriptor<T extends Data = Data> = Extract<\n Descriptor<T>,\n { type: PanelDescriptorType }\n>\n\nexport type DescriptorValueType<T extends Descriptor> = T extends NumberControlDefinition\n ? NumberControlValue<T>\n : T extends CheckboxControlDefinition\n ? CheckboxControlValue<T>\n : T extends TextInputControlDefinition\n ? TextInputControlValue<T>\n : T extends TextAreaControlDefinition\n ? TextAreaControlValue<T>\n : T extends SelectControlDefinition\n ? SelectControlValue<T>\n : T extends ColorControlDefinition\n ? ColorControlValue<T>\n : T extends StyleControlDefinition\n ? StyleControlFormattedValue\n : T extends ImageControlDefinition\n ? ResolveImageControlValue<T>\n : T extends ComboboxControlDefinition\n ? ComboboxControlValue<T>\n : T extends ShapeControlDefinition\n ? ShapeControlValue<T>\n : T extends ListControlDefinition\n ? ListControlValue<T>\n : T extends LinkControlDefinition\n ? LinkControlValue<T>\n : T extends SlotControlDefinition\n ? SlotControlValue\n : T['type'] extends typeof Types.ResponsiveColor\n ? ResponsiveColor | null | undefined\n : T['type'] extends typeof Types.Width\n ? ResolveWidthControlValue<T>\n : T extends Descriptor<infer U>\n ? U | undefined\n : never\n\nexport type PanelDescriptorValueType<T extends PanelDescriptor> = T extends PanelDescriptor<infer U>\n ? U\n : never\n","import { CopyContext, ReplacementContext } from '../state/react-page'\n\nexport type ImageControlData = string\n\nexport const ImageControlType = 'makeswift::controls::image'\n\nexport const ImageControlValueFormat = {\n URL: 'makeswift::controls::image::format::url',\n WithDimensions: 'makeswift::controls::image::format::with-dimensions',\n} as const\n\ntype ImageControlValueFormat = typeof ImageControlValueFormat[keyof typeof ImageControlValueFormat]\n\ntype ImageControlConfig = { label?: string; format?: ImageControlValueFormat }\n\nexport type ImageControlDefinition<T extends ImageControlConfig = ImageControlConfig> = {\n type: typeof ImageControlType\n config: T\n}\n\nexport function Image<T extends ImageControlConfig>(\n config: T = {} as T,\n): ImageControlDefinition<T> {\n return { type: ImageControlType, config }\n}\n\nImage.Format = ImageControlValueFormat\n\nexport function copyImageData(\n value: ImageControlData | undefined,\n context: CopyContext,\n): ImageControlData | undefined {\n if (value == null) return value\n\n return context.replacementContext.fileIds.get(value) ?? value\n}\n\nif (import.meta.vitest) {\n const { describe, test, expect } = import.meta.vitest\n\n describe.concurrent('image copy', () => {\n test('image is replaced by a one in replacement context', () => {\n // Arrange\n const data: ImageControlData = 'file-id'\n const expected = 'testing'\n\n const replacementContext = {\n elementHtmlIds: new Set(),\n elementKeys: new Map(),\n swatchIds: new Map(),\n fileIds: new Map([['file-id', 'testing']]),\n typographyIds: new Map(),\n tableIds: new Map(),\n tableColumnIds: new Map(),\n pageIds: new Map(),\n globalElementIds: new Map(),\n globalElementData: new Map(),\n }\n\n // Act\n const result = copyImageData(data, {\n replacementContext: replacementContext as ReplacementContext,\n copyElement: node => node,\n })\n\n // Assert\n expect(result).toMatchObject(expected)\n })\n })\n}\n","export const BuilderEditMode = {\n BUILD: 'build',\n CONTENT: 'content',\n} as const\n\nexport type BuilderEditMode = typeof BuilderEditMode[keyof typeof BuilderEditMode]\n","import { Editor } from 'slate-react'\nimport { ValueJSON } from 'slate'\nimport { OnChangeParam } from 'slate-react'\nimport { Descriptor, RichTextDescriptor, TableFormFieldsDescriptor, Types } from './descriptors'\nimport { BuilderEditMode } from '../utils/constants'\nimport { BoxModel } from '../state/modules/box-models'\nimport { SlotControl, SlotControlMessage, SlotControlType } from '../controls'\n\nexport const RichTextPropControllerMessageType = {\n CHANGE_BUILDER_EDIT_MODE: 'CHANGE_BUILDER_EDIT_MODE',\n INITIALIZE_EDITOR: 'INITIALIZE_EDITOR',\n CHANGE_EDITOR_VALUE: 'CHANGE_EDITOR_VALUE',\n FOCUS: 'FOCUS',\n BLUR: 'BLUR',\n UNDO: 'UNDO',\n REDO: 'REDO',\n} as const\n\ntype ChangeBuilderEditModeRichTextPropControllerMessage = {\n type: typeof RichTextPropControllerMessageType.CHANGE_BUILDER_EDIT_MODE\n editMode: BuilderEditMode\n}\n\ntype InitializeEditorRichTextPropControllerMessage = {\n type: typeof RichTextPropControllerMessageType.INITIALIZE_EDITOR\n value: ValueJSON\n}\n\ntype ChangeEditorValueRichTextPropControllerMessage = {\n type: typeof RichTextPropControllerMessageType.CHANGE_EDITOR_VALUE\n value: ValueJSON\n}\n\ntype FocusRichTextPropControllerMessage = { type: typeof RichTextPropControllerMessageType.FOCUS }\n\ntype BlurRichTextPropControllerMessage = { type: typeof RichTextPropControllerMessageType.BLUR }\n\ntype UndoRichTextPropControllerMessage = { type: typeof RichTextPropControllerMessageType.UNDO }\n\ntype RedoRichTextPropControllerMessage = { type: typeof RichTextPropControllerMessageType.REDO }\n\nexport type RichTextPropControllerMessage =\n | ChangeBuilderEditModeRichTextPropControllerMessage\n | InitializeEditorRichTextPropControllerMessage\n | ChangeEditorValueRichTextPropControllerMessage\n | FocusRichTextPropControllerMessage\n | BlurRichTextPropControllerMessage\n | UndoRichTextPropControllerMessage\n | RedoRichTextPropControllerMessage\n\nexport type PropControllerMessage =\n | RichTextPropControllerMessage\n | TableFormFieldsMessage\n | SlotControlMessage\n\nexport type Send<T = PropControllerMessage> = (message: T) => void\n\nexport abstract class PropController<T = PropControllerMessage> {\n protected send: Send<T>\n\n constructor(send: Send<T>) {\n this.send = send\n }\n\n abstract recv(message: T): void\n}\n\nclass DefaultPropController extends PropController {\n recv(_message: PropControllerMessage): void {\n // Do nothing.\n }\n}\n\nclass RichTextPropController extends PropController<RichTextPropControllerMessage> {\n private editor: Editor | null = null\n\n recv(message: RichTextPropControllerMessage): void {\n switch (message.type) {\n case RichTextPropControllerMessageType.CHANGE_BUILDER_EDIT_MODE: {\n switch (message.editMode) {\n case BuilderEditMode.BUILD:\n this.editor?.deselect().blur()\n break\n\n case BuilderEditMode.CONTENT:\n this.editor?.focus().moveToRangeOfDocument()\n break\n }\n\n break\n }\n }\n }\n\n setSlateEditor(editor: Editor) {\n this.editor = editor\n\n this.send({\n type: RichTextPropControllerMessageType.INITIALIZE_EDITOR,\n value: editor.value.toJSON({ preserveSelection: false }),\n })\n }\n\n onChange(change: OnChangeParam) {\n this.send({\n type: RichTextPropControllerMessageType.CHANGE_EDITOR_VALUE,\n value: change.value.toJSON({ preserveSelection: true }),\n })\n }\n\n focus() {\n this.send({ type: RichTextPropControllerMessageType.FOCUS })\n }\n\n blur() {\n this.send({ type: RichTextPropControllerMessageType.BLUR })\n }\n\n undo() {\n this.send({ type: RichTextPropControllerMessageType.UNDO })\n }\n\n redo() {\n this.send({ type: RichTextPropControllerMessageType.REDO })\n }\n}\n\nexport const TableFormFieldsMessageType = {\n TABLE_FORM_LAYOUT_CHANGE: 'TABLE_FORM_LAYOUT_CHANGE',\n TABLE_FORM_FIELD_LAYOUT_CHANGE: 'TABLE_FORM_FIELD_LAYOUT_CHANGE',\n} as const\n\ntype TableLayoutTableFormFieldsMessage = {\n type: typeof TableFormFieldsMessageType.TABLE_FORM_LAYOUT_CHANGE\n payload: { layout: BoxModel }\n}\n\ntype TableFieldLayoutTableFormFieldsMessage = {\n type: typeof TableFormFieldsMessageType.TABLE_FORM_FIELD_LAYOUT_CHANGE\n payload: { layout: BoxModel; index: number }\n}\n\nexport type TableFormFieldsMessage =\n | TableLayoutTableFormFieldsMessage\n | TableFieldLayoutTableFormFieldsMessage\n\nexport class TableFormFieldsPropController extends PropController<TableFormFieldsMessage> {\n recv(): void {}\n\n tableFormLayoutChange(payload: { layout: BoxModel }) {\n this.send({ type: TableFormFieldsMessageType.TABLE_FORM_LAYOUT_CHANGE, payload })\n }\n\n tableFormFieldLayoutChange(payload: { layout: BoxModel; index: number }) {\n this.send({ type: TableFormFieldsMessageType.TABLE_FORM_FIELD_LAYOUT_CHANGE, payload })\n }\n}\n\ntype DescriptorPropController<T extends Descriptor> = T extends { type: typeof Types.RichText }\n ? RichTextPropController\n : T extends { type: typeof Types.TableFormFields }\n ? TableFormFieldsPropController\n : DefaultPropController\n\nexport type DescriptorsPropControllers<T extends Record<string, Descriptor>> = {\n [K in keyof T]: undefined extends T[K]\n ? DescriptorPropController<Exclude<T[K], undefined>>\n : DescriptorPropController<T[K]>\n}\n\ntype AnyPropController =\n | DefaultPropController\n | RichTextPropController\n | TableFormFieldsPropController\n | SlotControl\n\nexport function createPropController(\n descriptor: RichTextDescriptor,\n send: Send<RichTextPropControllerMessage>,\n): RichTextPropController\nexport function createPropController(\n descriptor: TableFormFieldsDescriptor,\n send: Send<TableFormFieldsMessage>,\n): TableFormFieldsPropController\nexport function createPropController(descriptor: Descriptor, send: Send): DefaultPropController\nexport function createPropController<T extends PropControllerMessage>(\n descriptor: Descriptor,\n send: Send<T>,\n): AnyPropController {\n switch (descriptor.type) {\n case Types.RichText:\n return new RichTextPropController(send as Send<RichTextPropControllerMessage>)\n\n case Types.TableFormFields:\n return new TableFormFieldsPropController(send as Send<TableFormFieldsMessage>)\n\n case SlotControlType:\n return new SlotControl(send as Send<SlotControlMessage>)\n\n default:\n return new DefaultPropController(send as Send)\n }\n}\n","import { PropController } from '../prop-controllers/instances'\nimport { BoxModel } from '../state/modules/box-models'\nimport { CopyContext, Element } from '../state/react-page'\nimport { ResponsiveValue } from './types'\n\ntype SlotControlColumnData = { count: number; spans: number[][] }\n\nexport type SlotControlData = {\n elements: Element[]\n columns: ResponsiveValue<SlotControlColumnData>\n}\n\nexport const SlotControlType = 'makeswift::controls::slot'\n\nexport type SlotControlDefinition = {\n type: typeof SlotControlType\n}\n\nexport function Slot(): SlotControlDefinition {\n return { type: SlotControlType }\n}\n\nexport const SlotControlMessageType = {\n CONTAINER_BOX_MODEL_CHANGE: 'makeswift::controls::slot::message::container-box-model-change',\n ITEM_BOX_MODEL_CHANGE: 'makeswift::controls::slot::message::item-box-model-change',\n} as const\n\ntype SlotControlContainerBoxModelChangeMessage = {\n type: typeof SlotControlMessageType.CONTAINER_BOX_MODEL_CHANGE\n payload: { boxModel: BoxModel | null }\n}\n\ntype SlotControlItemBoxModelChangeMessage = {\n type: typeof SlotControlMessageType.ITEM_BOX_MODEL_CHANGE\n payload: { index: number; boxModel: BoxModel | null }\n}\n\nexport type SlotControlMessage =\n | SlotControlContainerBoxModelChangeMessage\n | SlotControlItemBoxModelChangeMessage\n\nexport class SlotControl extends PropController<SlotControlMessage> {\n recv(): void {}\n\n changeContainerBoxModel(boxModel: BoxModel | null): void {\n this.send({ type: SlotControlMessageType.CONTAINER_BOX_MODEL_CHANGE, payload: { boxModel } })\n }\n\n changeItemBoxModel(index: number, boxModel: BoxModel | null): void {\n this.send({ type: SlotControlMessageType.ITEM_BOX_MODEL_CHANGE, payload: { index, boxModel } })\n }\n}\n\nexport function copySlotData(\n value: SlotControlData | undefined,\n context: CopyContext,\n): SlotControlData | undefined {\n if (value == null) return value\n\n return {\n ...value,\n elements: value.elements.map(element => context.copyElement(element)),\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,mBAAmB;AAcoB,eAAA,SAAS,IAAoC;AACxF,SAAA,EAAE,MAAM,kBAAkB;AACnC;AAEO,uBACL,OACA,SACuB;;AACvB,MAAI,SAAS;AAAa,WAAA;AAE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AM;AACjB;AAEO,MAAM,yBAAyB;AAAA,EACpC,4BAA4B;AAAA,EAC5B,uBAAuB;AACzB;AAgBO,MAAM,oBAAoB,eAAmC;AAAA,EAClE,OAAa;AAAA,EAAC;AAAA,EAEd,wBAAwB,UAAiC;AAClD,SAAA,KAAK,EAAE,MAAM,uBAAuB,4BAA4B,SAAS,EAAE,SAAS,EAAA,CAAG;AAAA,EAC9F;AAAA,EAEA,mBAAmB,OAAe,UAAiC;AAC5D,SAAA,KAAK,EAAE,MAAM,uBAAuB,uBAAuB,SAAS,EAAE,OAAO,SAAS,EAAA,CAAG;AAAA,EAChG;AACF;AAEO,sBACL,OACA,SAC6B;AAC7B,MAAI,SAAS;AAAa,WAAA;AAEnB,SAAA,iCACF,QADE;AAAA,IAEL,UAAU,MAAM,SAAS,IAAI,aAAW,QAAQ,YAAY,OAAO,CAAC;AAAA,EAAA;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"slot.cjs.js","sources":["../src/controls/color.ts","../src/controls/style.ts","../src/prop-controllers/descriptors.ts","../src/controls/image.ts","../src/utils/constants.ts","../src/prop-controllers/instances.ts","../src/controls/slot.ts"],"sourcesContent":["import { CopyContext } from '../state/react-page'\nimport { ColorData } from './types'\n\nexport type ColorControlData = ColorData\n\nexport const ColorControlType = 'makeswift::controls::color'\n\ntype ColorControlConfig = {\n label?: string\n labelOrientation?: 'horizontal' | 'vertical'\n defaultValue?: string\n hideAlpha?: boolean\n}\n\nexport type ColorControlDefinition<C extends ColorControlConfig = ColorControlConfig> = {\n type: typeof ColorControlType\n config: C\n}\n\nexport function Color<C extends ColorControlConfig>(config = {} as C): ColorControlDefinition<C> {\n return { type: ColorControlType, config }\n}\n\nexport function copyColorData(\n value: ColorData | undefined,\n context: CopyContext,\n): ColorData | undefined {\n if (value == null) return value\n\n return {\n ...value,\n swatchId: context.replacementContext.swatchIds.get(value.swatchId) ?? value.swatchId,\n }\n}\n","import { BorderRadiusPropertyData } from '../css/border-radius'\nimport type { LengthPercentageData } from '../css/length-percentage'\nimport { MarginPropertyData } from '../css/margin'\nimport { PaddingPropertyData } from '../css/padding'\nimport { ColorData, ResponsiveValue } from './types'\nimport { CopyContext, ReplacementContext } from '../state/react-page'\nimport { copyColorData } from './color'\n\n/** @see https://developer.mozilla.org/en-US/docs/Web/CSS/width */\nexport type WidthPropertyData = LengthPercentageData\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/border-style\n */\ntype BorderStyle = 'dotted' | 'dashed' | 'solid'\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/border-top#constituent_properties\n *\n * @todos\n * - Change `width` to be a `Length`\n * - Remove `null` from possible values\n * - Remove `undefined` from possible values and make fields optional\n */\nexport type BorderSideShorthandPropertyData = {\n width: number | null | undefined\n style: BorderStyle\n color?: ColorData | null\n}\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/border\n *\n * @todos\n * - Remove `null` from possible values\n * - Remove `undefined` from possible values and make fields optional\n */\nexport type BorderPropertyData = {\n borderTop: BorderSideShorthandPropertyData | null | undefined\n borderRight: BorderSideShorthandPropertyData | null | undefined\n borderBottom: BorderSideShorthandPropertyData | null | undefined\n borderLeft: BorderSideShorthandPropertyData | null | undefined\n}\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/CSS/font-family\n *\n * @todos\n * - Remove `null` from possible values of longhand properties\n * - Remove `undefined` from possible values and make fields optional\n */\nexport type FontFamilyPropertyData = string | null | undefined\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/CSS/letter-spacing\n *\n * @todos\n * - Remove `null` from possible values of longhand properties\n * - Remove `undefined` from possible values and make fields optional\n */\nexport type LetterSpacingPropertyData = number | null | undefined\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/CSS/font-size\n *\n * @todos\n * - Remove `null` from possible values of longhand properties\n * - Remove `undefined` from possible values and make fields optional\n */\nexport type FontSizePropertyData =\n | {\n value: number\n unit: 'px'\n }\n | null\n | undefined\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight\n *\n * @todos\n * - Remove `null` from possible values of longhand properties\n * - Remove `undefined` from possible values and make fields optional\n */\nexport type FontWeightPropertyData = number | null | undefined\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform\n *\n * @todos\n * - Match the type with specification\n */\nexport type TextTransformPropertyData = 'uppercase'[]\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/CSS/font-style\n *\n * @todos\n * - Match the type with specification\n */\nexport type FontStylePropertyData = 'italic'[]\n\n/**\n * @todos\n * - Remove `null` from possible values of longhand properties\n * - Remove `undefined` from possible values and make fields optional\n */\nexport type TextStylePropertyData = {\n fontFamily?: FontFamilyPropertyData | null | undefined\n letterSpacing: LetterSpacingPropertyData | null | undefined\n fontSize: FontSizePropertyData | null | undefined\n fontWeight: FontWeightPropertyData | null | undefined\n textTransform: TextTransformPropertyData\n fontStyle: FontStylePropertyData\n}\n\nexport type StyleControlData = {\n width?: ResponsiveValue<WidthPropertyData>\n margin?: ResponsiveValue<MarginPropertyData>\n padding?: ResponsiveValue<PaddingPropertyData>\n border?: ResponsiveValue<BorderPropertyData>\n borderRadius?: ResponsiveValue<BorderRadiusPropertyData>\n textStyle?: ResponsiveValue<TextStylePropertyData>\n}\n\nexport const StyleControlType = 'makeswift::controls::style'\n\nexport const StyleControlProperty = {\n Width: 'makeswift::controls::style::property::width',\n Margin: 'makeswift::controls::style::property::margin',\n Padding: 'makeswift::controls::style::property::padding',\n Border: 'makeswift::controls::style::property::border',\n BorderRadius: 'makeswift::controls::style::property::border-radius',\n TextStyle: 'makeswift::controls::style::property::text-style',\n} as const\n\nexport type StyleControlProperty = typeof StyleControlProperty[keyof typeof StyleControlProperty]\n\ntype StyleControlParams = { properties?: StyleControlProperty[] }\n\nexport type StyleControlConfig = { properties: StyleControlProperty[] }\n\nconst StyleControlDefaultProperties: StyleControlProperty[] = [\n StyleControlProperty.Width,\n StyleControlProperty.Margin,\n]\n\nconst AllStyleControlProperties: StyleControlProperty[] = [\n StyleControlProperty.Width,\n StyleControlProperty.Margin,\n StyleControlProperty.Padding,\n StyleControlProperty.Border,\n StyleControlProperty.BorderRadius,\n StyleControlProperty.TextStyle,\n]\n\nexport type StyleControlDefinition = {\n type: typeof StyleControlType\n config: StyleControlConfig\n}\n\n/**\n * @todos\n * - Add support for custom panel labels.\n * - Add support for default values. Internally, default values must be represented with the same\n * format as the underlying data so that controls can show these values.\n */\nexport function Style(params?: StyleControlParams): StyleControlDefinition {\n return {\n type: StyleControlType,\n config: { properties: params?.properties ?? StyleControlDefaultProperties },\n }\n}\n\nStyle.Default = StyleControlDefaultProperties\nStyle.All = AllStyleControlProperties\n\nStyle.Width = StyleControlProperty.Width\nStyle.Margin = StyleControlProperty.Margin\nStyle.Padding = StyleControlProperty.Padding\nStyle.Border = StyleControlProperty.Border\nStyle.BorderRadius = StyleControlProperty.BorderRadius\nStyle.TextStyle = StyleControlProperty.TextStyle\n\nexport function copyStyleData(\n value: StyleControlData | undefined,\n context: CopyContext,\n): StyleControlData | undefined {\n if (value == null) return value\n\n function copyResponsiveBorder(\n responsiveBorder: ResponsiveValue<BorderPropertyData> | undefined,\n ): ResponsiveValue<BorderPropertyData> | undefined {\n if (responsiveBorder == null) return undefined\n return responsiveBorder.map(deviceBorder => ({\n ...deviceBorder,\n value: copyBorder(deviceBorder.value),\n }))\n }\n\n function copyBorder(border: BorderPropertyData): BorderPropertyData {\n function copyBorderSide(side: BorderSideShorthandPropertyData | null | undefined) {\n if (side == null) return null\n\n if (side.color == null) return side\n\n return {\n ...side,\n color: copyColorData(side.color, context),\n }\n }\n\n return {\n borderTop: copyBorderSide(border.borderTop),\n borderBottom: copyBorderSide(border.borderBottom),\n borderRight: copyBorderSide(border.borderRight),\n borderLeft: copyBorderSide(border.borderLeft),\n }\n }\n\n return { ...value, border: copyResponsiveBorder(value.border) }\n}\n\nif (import.meta.vitest) {\n const { describe, test, expect } = import.meta.vitest\n\n describe.concurrent('style copy', () => {\n test('colors are replaced', () => {\n // Arrange\n const value: StyleControlData = {\n width: [\n {\n value: {\n unit: 'px',\n value: 100,\n },\n deviceId: 'desktop',\n },\n ],\n border: [\n {\n value: {\n borderTop: {\n color: {\n alpha: 1,\n swatchId: 'U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==',\n },\n style: 'solid',\n width: 9,\n },\n borderLeft: {\n color: {\n alpha: 1,\n swatchId: 'U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==',\n },\n style: 'solid',\n width: 9,\n },\n borderRight: {\n color: {\n alpha: 1,\n swatchId: 'U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==',\n },\n style: 'solid',\n width: 9,\n },\n borderBottom: {\n color: {\n alpha: 1,\n swatchId: 'U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==',\n },\n style: 'solid',\n width: 9,\n },\n },\n deviceId: 'desktop',\n },\n ],\n textStyle: [\n {\n value: {\n fontSize: {\n unit: 'px',\n value: 46,\n },\n fontStyle: [],\n fontFamily: 'Oswald',\n fontWeight: 400,\n letterSpacing: 5.2,\n textTransform: [],\n },\n deviceId: 'desktop',\n },\n ],\n borderRadius: [\n {\n value: {\n borderTopLeftRadius: {\n unit: 'px',\n value: 4,\n },\n borderTopRightRadius: {\n unit: 'px',\n value: 4,\n },\n borderBottomLeftRadius: {\n unit: 'px',\n value: 4,\n },\n borderBottomRightRadius: {\n unit: 'px',\n value: 4,\n },\n },\n deviceId: 'desktop',\n },\n ],\n }\n const expected = JSON.parse(\n JSON.stringify(value).replaceAll(\n 'U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==',\n 'testing',\n ),\n )\n\n const replacementContext = {\n elementHtmlIds: new Set(),\n elementKeys: new Map(),\n swatchIds: new Map([\n ['U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==', 'testing'],\n ]),\n fileIds: new Map(),\n typographyIds: new Map(),\n tableIds: new Map(),\n tableColumnIds: new Map(),\n pageIds: new Map(),\n globalElementIds: new Map(),\n globalElementData: new Map(),\n }\n\n // Act\n const result = copyStyleData(value, {\n replacementContext: replacementContext as ReplacementContext,\n copyElement: node => node,\n })\n\n // Assert\n expect(result).toMatchObject(expected)\n })\n })\n}\n","import type * as Slate from 'slate'\nimport { StyleControlDefinition, StyleControlType } from '../controls/style'\nimport {\n ResolveBorderControlValue,\n ResolveBorderRadiusControlValue,\n ResolveMarginControlValue,\n ResolvePaddingControlValue,\n ResolveShadowsControlValue,\n ResolveWidthControlValue,\n} from '../runtimes/react/controls'\nimport { StyleControlFormattedValue } from '../runtimes/react/controls/style'\nimport type { Element, Data } from '../state/react-page'\nimport type { ResponsiveColor } from '../runtimes/react/controls'\nimport { NumberControlDefinition } from '../controls/number'\nimport { NumberControlValue } from '../runtimes/react/controls/number'\nimport {\n CheckboxControlDefinition,\n ColorControlDefinition,\n ComboboxControlDefinition,\n ImageControlDefinition,\n LinkControlDefinition,\n ListControlDefinition,\n SelectControlDefinition,\n ShapeControlDefinition,\n SlotControlDefinition,\n TextAreaControlDefinition,\n TextInputControlDefinition,\n} from '../controls'\nimport { TextInputControlValue } from '../runtimes/react/controls/text-input'\nimport { TextAreaControlValue } from '../runtimes/react/controls/text-area'\nimport { ColorControlValue } from '../runtimes/react/controls/color'\nimport { SelectControlValue } from '../runtimes/react/controls/select'\nimport { CheckboxControlValue } from '../runtimes/react/controls/checkbox'\nimport { ResolveImageControlValue } from '../runtimes/react/controls/image'\nimport { ShapeControlValue } from '../runtimes/react/controls/shape'\nimport { ListControlValue } from '../runtimes/react/controls/list'\nimport { ComboboxControlValue } from '../runtimes/react/controls/combobox'\nimport { LinkControlValue } from '../runtimes/react/controls/link'\nimport { SlotControlValue } from '../runtimes/react/controls/slot'\n\nexport type { Data }\n\n// See https://github.com/microsoft/TypeScript/issues/15300\nexport type IndexSignatureHack<T> = T extends Record<string, any>\n ? { [K in keyof T]: IndexSignatureHack<T[K]> }\n : T\n\nexport type Device = 'desktop' | 'tablet' | 'mobile'\n\nexport type DeviceOverride<T> = { deviceId: Device; value: T }\n\nexport type ResponsiveValue<T> = DeviceOverride<T>[]\n\nexport type ResponsiveValueType<T> = T extends ResponsiveValue<infer U> ? U : never\n\ntype Color = { swatchId: string; alpha: number }\n\ntype IconName =\n | 'HeightAuto16'\n | 'HeightMatch16'\n | 'VerticalAlignStart16'\n | 'VerticalAlignMiddle16'\n | 'VerticalAlignEnd16'\n | 'VerticalAlignSpaceBetween16'\n | 'ButtonPill16'\n | 'ButtonRounded16'\n | 'ButtonSquare16'\n | 'SizeSmall16'\n | 'SizeMedium16'\n | 'SizeLarge16'\n | 'ArrowInside16'\n | 'ArrowCenter16'\n | 'ArrowOutside16'\n | 'CountdownSolid16'\n | 'CountdownSolidSplit16'\n | 'CountdownOutline16'\n | 'CountdownOutlineSplit16'\n | 'CountdownNaked16'\n | 'Sun16'\n | 'Moon16'\n | 'AlignLeft16'\n | 'AlignCenter16'\n | 'AlignRight16'\n | 'Star16'\n | 'StarCircle16'\n | 'StarRoundedSquare16'\n | 'StarSquare16'\n\nexport type Gap = { value: number; unit: 'px' }\n\nexport type Length = { value: number; unit: 'px' | '%' }\n\ntype OpenPageLink = {\n type: 'OPEN_PAGE'\n payload: { pageId: string | null | undefined; openInNewTab: boolean }\n}\n\ntype OpenURLLink = { type: 'OPEN_URL'; payload: { url: string; openInNewTab: boolean } }\n\ntype SendEmailLink = {\n type: 'SEND_EMAIL'\n payload: { to: string; subject?: string; body?: string }\n}\n\ntype CallPhoneLink = { type: 'CALL_PHONE'; payload: { phoneNumber: string } }\n\ntype ScrollToElementLink = {\n type: 'SCROLL_TO_ELEMENT'\n payload: {\n elementIdConfig: { elementKey: string; propName: string } | null | undefined\n block: 'start' | 'center' | 'end'\n }\n}\n\ntype Link = OpenPageLink | OpenURLLink | SendEmailLink | CallPhoneLink | ScrollToElementLink\n\ntype TextStyle = {\n fontFamily?: string | null | undefined\n letterSpacing: number | null | undefined\n fontSize: { value: number; unit: 'px' } | null | undefined\n fontWeight: number | null | undefined\n textTransform: 'uppercase'[]\n fontStyle: 'italic'[]\n}\n\nexport const Types = {\n Backgrounds: 'Backgrounds',\n Border: 'Border',\n BorderRadius: 'BorderRadius',\n Checkbox: 'Checkbox',\n Date: 'Date',\n ElementID: 'ElementID',\n Font: 'Font',\n GapX: 'GapX',\n GapY: 'GapY',\n Grid: 'Grid',\n Image: 'Image',\n Images: 'Images',\n Link: 'Link',\n List: 'List',\n Margin: 'Margin',\n NavigationLinks: 'NavigationLinks',\n Number: 'Number',\n Padding: 'Padding',\n ResponsiveColor: 'ResponsiveColor',\n ResponsiveIconRadioGroup: 'ResponsiveIconRadioGroup',\n ResponsiveLength: 'ResponsiveLength',\n ResponsiveNumber: 'ResponsiveNumber',\n ResponsiveOpacity: 'ResponsiveOpacity',\n ResponsiveSelect: 'ResponsiveSelect',\n RichText: 'RichText',\n Shadows: 'Shadows',\n Shape: 'Shape',\n SocialLinks: 'SocialLinks',\n Table: 'Table',\n TableFormFields: 'TableFormFields',\n Typeahead: 'Typeahead',\n TextArea: 'TextArea',\n TextInput: 'TextInput',\n TextStyle: 'TextStyle',\n Video: 'Video',\n Width: 'Width',\n Style: StyleControlType,\n} as const\n\ntype Options<T> = T | ((props: Record<string, unknown>, deviceMode: Device) => T)\n\nexport type ResolveOptions<T extends Options<unknown>> = T extends Options<infer U> ? U : never\n\ntype ColorBackground = { type: 'color'; id: string; payload: Color | null }\n\ntype GradientStop = { id: string; location: number; color: Color | null }\n\ntype Gradient = { angle?: number; isRadial?: boolean; stops: GradientStop[] }\n\ntype GradientBackground = { type: 'gradient'; id: string; payload: Gradient }\n\ntype BackgroundImagePosition = { x: number; y: number }\n\ntype BackgroundImageSize = 'cover' | 'contain' | 'auto'\n\ntype BackgroundImageRepeat = 'no-repeat' | 'repeat-x' | 'repeat-y' | 'repeat'\n\ntype BackgroundImage = {\n imageId: string\n position: BackgroundImagePosition\n size?: BackgroundImageSize\n repeat?: BackgroundImageRepeat\n opacity?: number\n parallax?: number\n}\n\ntype ImageBackground = { type: 'image'; id: string; payload: BackgroundImage }\n\ntype BackgroundVideoAspectRatio = 'wide' | 'standard'\n\ntype BackgroundVideo = {\n url?: string\n maskColor?: Color | null\n opacity?: number\n zoom?: number\n aspectRatio?: BackgroundVideoAspectRatio\n parallax?: number\n}\n\ntype VideoBackground = { type: 'video'; id: string; payload: BackgroundVideo }\n\ntype Background = ColorBackground | GradientBackground | ImageBackground | VideoBackground\n\nexport type BackgroundsValue = ResponsiveValue<Background[]>\n\ntype BackgroundsOptions = Options<Record<string, never>>\n\ntype BackgroundsDescriptor<_T = BackgroundsValue> = {\n type: typeof Types.Backgrounds\n options: BackgroundsOptions\n}\n\nexport function Backgrounds(options: BackgroundsOptions = {}): BackgroundsDescriptor {\n return { type: Types.Backgrounds, options }\n}\n\ntype BorderSideStyle = 'dashed' | 'dotted' | 'solid'\n\ntype BorderSide = { width: number | null | undefined; style: BorderSideStyle; color?: Color | null }\n\ntype Border = {\n [K in 'top' | 'right' | 'bottom' | 'left' as `border${Capitalize<K>}`]:\n | BorderSide\n | null\n | undefined\n}\n\nexport type BorderValue = ResponsiveValue<Border>\n\nexport const BorderPropControllerFormat = {\n ClassName: 'makeswift::prop-controllers::border::format::class-name',\n ResponsiveValue: 'makeswift::prop-controllers:border::format::responsive-value',\n} as const\n\nexport type BorderPropControllerFormat =\n typeof BorderPropControllerFormat[keyof typeof BorderPropControllerFormat]\n\ntype BorderOptions = { format?: BorderPropControllerFormat }\n\nexport type BorderDescriptor<_T = BorderValue, U extends BorderOptions = BorderOptions> = {\n type: typeof Types.Border\n options: U\n}\n\nexport function Border<T extends BorderOptions>(\n options: T & BorderOptions = {} as T,\n): BorderDescriptor<BorderValue, T> {\n return { type: Types.Border, options }\n}\n\nBorder.Format = BorderPropControllerFormat\n\ntype BorderRadius = {\n [K in 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' as `border${Capitalize<K>}Radius`]:\n | Length\n | null\n | undefined\n}\n\nexport type BorderRadiusValue = ResponsiveValue<BorderRadius>\n\nexport const BorderRadiusPropControllerFormat = {\n ClassName: 'makeswift::prop-controllers::border-radius::format::class-name',\n ResponsiveValue: 'makeswift::prop-controllers::border-radius::format::responsive-value',\n} as const\n\nexport type BorderRadiusPropControllerFormat =\n typeof BorderRadiusPropControllerFormat[keyof typeof BorderRadiusPropControllerFormat]\n\ntype BorderRadiusOptions = { format?: BorderRadiusPropControllerFormat }\n\nexport type BorderRadiusDescriptor<\n _T = BorderRadiusValue,\n U extends BorderRadiusOptions = BorderRadiusOptions,\n> = {\n type: typeof Types.BorderRadius\n options: U\n}\n\nexport function BorderRadius<T extends BorderRadiusOptions>(\n options: T & BorderRadiusOptions = {} as T,\n): BorderRadiusDescriptor<BorderRadiusValue, T> {\n return { type: Types.BorderRadius, options }\n}\n\nBorderRadius.Format = BorderRadiusPropControllerFormat\n\nexport type CheckboxValue = boolean\n\nexport type CheckboxOptions = Options<{\n preset?: CheckboxValue\n label: string\n hidden?: boolean\n}>\n\nexport type CheckboxDescriptor<_T = CheckboxValue> = {\n type: typeof Types.Checkbox\n options: CheckboxOptions\n}\n\nexport function Checkbox(options: CheckboxOptions): CheckboxDescriptor {\n return { type: Types.Checkbox, options }\n}\n\nexport type DateValue = string\n\nexport type DateOptions = Options<{ preset?: DateValue }>\n\nexport type DateDescriptor<_T = DateValue> = { type: typeof Types.Date; options: DateOptions }\n\nexport function Date(options: DateOptions = {}): DateDescriptor {\n return { type: Types.Date, options }\n}\n\nexport type ElementIDValue = string\n\ntype ElementIDOptions = Options<Record<string, never>>\n\ntype ElementIDDescriptor<_T = ElementIDValue> = {\n type: typeof Types.ElementID\n options: ElementIDOptions\n}\n\nexport function ElementID(options: ElementIDOptions = {}): ElementIDDescriptor {\n return { type: Types.ElementID, options }\n}\n\nexport type FontValue = ResponsiveValue<string>\n\ntype FontOptions = Options<{ preset?: FontValue; label?: string }>\n\ntype FontDescriptor<_T = FontValue> = { type: typeof Types.Font; options: FontOptions }\n\nexport function Font(options: FontOptions = {}): FontDescriptor {\n return { type: Types.Font, options }\n}\n\nexport type GapXValue = ResponsiveValue<Gap>\n\nexport type GapXOptions = Options<{\n preset?: GapXValue\n label?: string\n defaultValue?: Gap\n min?: number\n max?: number\n step?: number\n hidden?: boolean\n}>\n\nexport type GapXDescriptor<_T = GapXValue> = { type: typeof Types.GapX; options: GapXOptions }\n\nexport function GapX(options: GapXOptions = {}): GapXDescriptor {\n return { type: Types.GapX, options }\n}\n\nexport type GapYValue = ResponsiveValue<Gap>\n\nexport type GapYOptions = Options<{\n preset?: GapYValue\n label?: string\n defaultValue?: Gap\n step?: number\n min?: number\n max?: number\n hidden?: boolean\n}>\n\nexport type GapYDescriptor<_T = GapYValue> = { type: typeof Types.GapY; options: GapYOptions }\n\nexport function GapY(options: GapYOptions = {}): GapYDescriptor {\n return { type: Types.GapY, options }\n}\n\ntype GridColumn = { count: number; spans: number[][] }\n\nexport type GridValue = { elements: Element[]; columns: ResponsiveValue<GridColumn> }\n\ntype GridOptions = Options<Record<string, never>>\n\ntype GridDescriptor<_T = GridValue> = { type: typeof Types.Grid; options: GridOptions }\n\nexport function Grid(options: GridOptions = {}): GridDescriptor {\n return { type: Types.Grid, options }\n}\n\nexport type ImageValue = string\n\nexport type ImageOptions = Options<{ label?: string; hidden?: boolean }>\n\nexport type ImageDescriptor<_T = ImageValue> = { type: typeof Types.Image; options: ImageOptions }\n\nexport function Image(options: ImageOptions = {}): ImageDescriptor {\n return { type: Types.Image, options }\n}\n\nexport type ImagesValue = { key: string; props: { link?: Link; file?: string; altText?: string } }[]\n\ntype ImagesOptions = Options<{ preset?: ImagesValue }>\n\ntype ImagesDescriptor<_T = ImagesValue> = { type: typeof Types.Images; options: ImagesOptions }\n\nexport function Images(options: ImagesOptions = {}): ImagesDescriptor {\n return { type: Types.Images, options }\n}\n\nexport type LinkValue = Link\n\nexport type LinkOptions = Options<{\n preset?: LinkValue\n label?: string\n defaultValue?: Link\n options?: { value: Link['type']; label: string }[]\n hidden?: boolean\n}>\n\nexport type LinkDescriptor<_T = LinkValue> = { type: typeof Types.Link; options: LinkOptions }\n\nexport function Link(options: LinkOptions = {}): LinkDescriptor {\n return { type: Types.Link, options }\n}\n\ntype ListValueItem<T extends Data> = { id: string; value?: T }\n\nexport type ListValue<T extends Data = Data> = ListValueItem<T>[]\n\nexport type ListOptions<T extends Data> = {\n type: PanelDescriptor<T>\n label?: string\n getItemLabel?: ((value: T | undefined) => string) | ((value: T | undefined) => Promise<string>)\n preset?: ListValue<T>\n defaultValue?: ListValue<T>\n}\n\nexport type ListDescriptor<T extends ListValue = ListValue> = {\n type: typeof Types.List\n options: ListOptions<T extends ListValue<infer U> ? U : never>\n}\n\nexport function List<T extends Data>(options: ListOptions<T>): ListDescriptor<ListValue<T>> {\n return { type: Types.List, options }\n}\n\ntype MarginSide = { value: number; unit: 'px' } | 'auto'\n\ntype Margin = {\n [K in 'top' | 'right' | 'bottom' | 'left' as `margin${Capitalize<K>}`]:\n | MarginSide\n | null\n | undefined\n}\n\nexport type MarginValue = ResponsiveValue<Margin>\n\nexport const MarginPropControllerFormat = {\n ClassName: 'makeswift::prop-controllers::margin::format::class-name',\n ResponsiveValue: 'makeswift::prop-controllers::margin::format::responsive-value',\n} as const\n\nexport type MarginPropControllerFormat =\n typeof MarginPropControllerFormat[keyof typeof MarginPropControllerFormat]\n\ntype MarginOptions = { preset?: MarginValue; format?: MarginPropControllerFormat }\n\nexport type MarginDescriptor<_T = MarginValue, U extends MarginOptions = MarginOptions> = {\n type: typeof Types.Margin\n options: U\n}\n\nexport function Margin<T extends MarginOptions>(\n options: T & MarginOptions = {} as T,\n): MarginDescriptor<MarginValue, T> {\n return { type: Types.Margin, options }\n}\n\nMargin.Format = MarginPropControllerFormat\n\ntype ButtonVariant = 'flat' | 'outline' | 'shadow' | 'clear' | 'blocky' | 'bubbly' | 'skewed'\n\ntype ButtonShape = 'pill' | 'rounded' | 'square'\n\ntype ButtonSize = 'small' | 'medium' | 'large'\n\nexport type NavigationButton = {\n id: string\n type: 'button'\n payload: {\n label: string\n link?: Link\n variant?: ResponsiveValue<ButtonVariant>\n shape?: ResponsiveValue<ButtonShape>\n size?: ResponsiveValue<ButtonSize>\n textColor?: ResponsiveValue<Color>\n color?: ResponsiveValue<Color>\n textStyle?: ResponsiveValue<TextStyle>\n }\n}\n\ntype NavigationDropdownCaretType = 'caret' | 'plus' | 'arrow-down' | 'chevron-down'\n\ntype NavigationDropdownLink = {\n id: string\n payload: {\n label: string\n link?: Link\n color?: ResponsiveValue<Color>\n textStyle?: ResponsiveValue<TextStyle>\n }\n}\n\ntype NavigationDropdown = {\n id: string\n type: 'dropdown'\n payload: {\n label: string\n caret?: NavigationDropdownCaretType\n links?: NavigationDropdownLink[]\n variant?: ResponsiveValue<ButtonVariant>\n shape?: ResponsiveValue<ButtonShape>\n size?: ResponsiveValue<ButtonSize>\n textColor?: ResponsiveValue<Color>\n color?: ResponsiveValue<Color>\n textStyle?: ResponsiveValue<TextStyle>\n }\n}\n\nexport type NavigationLinksValue = (NavigationButton | NavigationDropdown)[]\n\ntype NavigationLinksOptions = Options<Record<string, never>>\n\ntype NavigationLinksDescriptor<_T = NavigationLinksValue> = {\n type: typeof Types.NavigationLinks\n options: NavigationLinksOptions\n}\n\nexport function NavigationLinks(options: NavigationLinksOptions = {}): NavigationLinksDescriptor {\n return { type: Types.NavigationLinks, options }\n}\n\nexport type NumberValue = number\n\nexport type NumberOptions = Options<{\n preset?: NumberValue\n label?: string\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n hidden?: boolean\n}>\n\nexport type NumberDescriptor<_T = NumberValue> = {\n type: typeof Types.Number\n options: NumberOptions\n}\n\nexport function Number(options: NumberOptions = {}): NumberDescriptor {\n return { type: Types.Number, options }\n}\n\ntype PaddingSide = { value: number; unit: 'px' }\n\ntype Padding = {\n [K in 'top' | 'right' | 'bottom' | 'left' as `padding${Capitalize<K>}`]:\n | PaddingSide\n | null\n | undefined\n}\n\nexport type PaddingValue = ResponsiveValue<Padding>\n\nexport const PaddingPropControllerFormat = {\n ClassName: 'makeswift::prop-controllers::padding::format::class-name',\n ResponsiveValue: 'makeswift::prop-controllers::padding::format::responsive-value',\n} as const\n\nexport type PaddingPropControllerFormat =\n typeof PaddingPropControllerFormat[keyof typeof PaddingPropControllerFormat]\n\ntype PaddingOptions = { preset?: PaddingValue; format?: PaddingPropControllerFormat }\n\nexport type PaddingDescriptor<_T = PaddingValue, U extends PaddingOptions = PaddingOptions> = {\n type: typeof Types.Padding\n options: U\n}\n\nexport function Padding<T extends PaddingOptions>(\n options: T & PaddingOptions = {} as T,\n): PaddingDescriptor<PaddingValue, T> {\n return { type: Types.Padding, options }\n}\n\nPadding.Format = PaddingPropControllerFormat\n\nexport type ResponsiveColorValue = ResponsiveValue<Color>\n\ntype ResponsiveColorOptions = Options<{ label?: string; placeholder?: string; hidden?: boolean }>\n\nexport type ResponsiveColorDescriptor<_T = ResponsiveColorValue> = {\n type: typeof Types.ResponsiveColor\n options: ResponsiveColorOptions\n}\n\nexport function ResponsiveColor(options: ResponsiveColorOptions = {}): ResponsiveColorDescriptor {\n return { type: Types.ResponsiveColor, options }\n}\n\nexport type IconRadioGroupOption<T extends string> = { value: T; label: string; icon: IconName }\n\nexport type ResponsiveIconRadioGroupValue<T extends string = string> = ResponsiveValue<T>\n\nexport type ResponsiveIconRadioGroupOptions<T extends string = string, U extends T = T> = Options<{\n label?: string\n options: IconRadioGroupOption<T>[]\n defaultValue?: U\n hidden?: boolean\n}>\n\nexport type ResponsiveIconRadioGroupDescriptor<\n T extends ResponsiveIconRadioGroupValue<string> = ResponsiveIconRadioGroupValue<string>,\n> = {\n type: typeof Types.ResponsiveIconRadioGroup\n options: ResponsiveIconRadioGroupOptions<ResponsiveValueType<T>>\n}\n\n// HACK(miguel): We have to use a layer of indirection with `_T` and `T` because otherwise the\n// values provided would undergo type widening. For some reason, the extra layer of indirection\n// reuslts in TypeScript not widening types. Note, this only happens when the returned value of this\n// function is passed to another as an argument, which is common with the `registerComponent` API.\nexport function ResponsiveIconRadioGroup<_T extends string, T extends _T, U extends T>(\n options: ResponsiveIconRadioGroupOptions<T, U>,\n): ResponsiveIconRadioGroupDescriptor<ResponsiveIconRadioGroupValue<T>> {\n return { type: Types.ResponsiveIconRadioGroup, options }\n}\n\nexport type ResponsiveLengthValue = ResponsiveValue<Length>\n\nexport type LengthOption =\n | { value: 'px'; label: 'Pixels'; icon: 'Px16' }\n | { value: '%'; label: 'Percentage'; icon: 'Percent16' }\n\nexport type ResponsiveLengthOptions = Options<{\n label?: string\n options?: LengthOption[]\n defaultValue?: Length\n hidden?: boolean\n}>\n\nexport type ResponsiveLengthDescriptor<_T = ResponsiveLengthValue> = {\n type: typeof Types.ResponsiveLength\n options: ResponsiveLengthOptions\n}\n\nexport function ResponsiveLength(\n options: ResponsiveLengthOptions = {},\n): ResponsiveLengthDescriptor {\n return { type: Types.ResponsiveLength, options }\n}\n\nexport type ResponsiveNumberValue = ResponsiveValue<number>\n\nexport type ResponsiveNumberOptions = Options<{\n label?: string\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n hidden?: boolean\n}>\n\nexport type ResponsiveNumberDescriptor<_T = ResponsiveNumberValue> = {\n type: typeof Types.ResponsiveNumber\n options: ResponsiveNumberOptions\n}\n\nexport function ResponsiveNumber(\n options: ResponsiveNumberOptions = {},\n): ResponsiveNumberDescriptor {\n return { type: Types.ResponsiveNumber, options }\n}\n\nexport type ResponsiveOpacityValue = ResponsiveValue<number>\n\ntype ResponsiveOpacityOptions = Options<Record<string, never>>\n\ntype ResponsiveOpacityDescriptor<_T = ResponsiveOpacityValue> = {\n type: typeof Types.ResponsiveOpacity\n options: ResponsiveOpacityOptions\n}\n\nexport function ResponsiveOpacity(\n options: ResponsiveOpacityOptions = {},\n): ResponsiveOpacityDescriptor {\n return { type: Types.ResponsiveOpacity, options }\n}\n\nexport type ResponsiveSelectValue<T extends string = string> = ResponsiveValue<T>\n\nexport type SelectLabelOrientation = 'vertical' | 'horizontal'\n\nexport type SelectOption<T extends string> = { value: T; label: string }\n\nexport type ResponsiveSelectOptions<T extends string = string, U extends T = T> = Options<{\n label?: string\n labelOrientation?: SelectLabelOrientation\n options: SelectOption<T>[]\n defaultValue?: U\n hidden?: boolean\n}>\n\nexport type ResponsiveSelectDescriptor<\n T extends ResponsiveSelectValue<string> = ResponsiveSelectValue<string>,\n> = {\n type: typeof Types.ResponsiveSelect\n options: ResponsiveSelectOptions<ResponsiveValueType<T>>\n}\n\n// HACK(miguel): We have to use a layer of indirection with `_T` and `T` because otherwise the\n// values provided would undergo type widening. For some reason, the extra layer of indirection\n// reuslts in TypeScript not widening types. Note, this only happens when the returned value of this\n// function is passed to another as an argument, which is common with the `registerComponent` API.\nexport function ResponsiveSelect<_T extends string, T extends _T, U extends T>(\n options: ResponsiveSelectOptions<T, U>,\n): ResponsiveSelectDescriptor<ResponsiveSelectValue<T>> {\n return { type: Types.ResponsiveSelect, options }\n}\n\nexport type RichTextValue = IndexSignatureHack<Slate.ValueJSON>\n\nexport type RichTextOptions = Options<{ preset?: RichTextValue }>\n\nexport type RichTextDescriptor<_T extends Data = RichTextValue> = {\n type: typeof Types.RichText\n options: RichTextOptions\n}\n\nexport function RichText(options: RichTextOptions = {}): RichTextDescriptor {\n return { type: Types.RichText, options }\n}\n\ntype Shadow = {\n color?: Color | null\n blurRadius?: number\n spreadRadius?: number\n offsetX?: number\n offsetY?: number\n inset?: boolean\n}\n\ntype Shadows = { id: string; payload: Shadow }[]\n\nexport type ShadowsValue = ResponsiveValue<Shadows>\n\nexport const ShadowsPropControllerFormat = {\n ClassName: 'makeswift::prop-controllers::shadows::format::class-name',\n ResponsiveValue: 'makeswift::prop-controllers::shadows::format::responsive-value',\n} as const\n\nexport type ShadowsPropControllerFormat =\n typeof ShadowsPropControllerFormat[keyof typeof ShadowsPropControllerFormat]\n\ntype ShadowsOptions = { format?: ShadowsPropControllerFormat }\n\nexport type ShadowsDescriptor<_T = ShadowsValue, U extends ShadowsOptions = ShadowsOptions> = {\n type: typeof Types.Shadows\n options: U\n}\n\nexport function Shadows<T extends ShadowsOptions>(\n options: T & ShadowsOptions = {} as T,\n): ShadowsDescriptor<ShadowsValue, T> {\n return { type: Types.Shadows, options }\n}\n\nShadows.Format = ShadowsPropControllerFormat\n\nexport type ShapeValue<T extends Data = Data> = Record<string, T>\n\ntype ShapeOptions<T extends Record<string, PanelDescriptor>> = {\n type: T\n preset?: { [K in keyof T]?: DescriptorValueType<T[K]> }\n}\n\nexport type ShapeDescriptor<\n _T extends Record<string, Data>,\n U extends Record<string, PanelDescriptor>,\n> = {\n type: typeof Types.Shape\n options: ShapeOptions<U>\n}\n\nexport function Shape<T extends Record<string, PanelDescriptor>>(\n options: ShapeOptions<T>,\n): ShapeDescriptor<{ [K in keyof T]?: DescriptorValueType<T[K]> }, T> {\n return { type: Types.Shape, options }\n}\n\ntype SocialLinkType =\n | 'angellist'\n | 'codepen'\n | 'dribbble'\n | 'facebook'\n | 'github'\n | 'instagram'\n | 'linkedin'\n | 'medium'\n | 'pinterest'\n | 'reddit'\n | 'rss'\n | 'snapchat'\n | 'soundcloud'\n | 'spotify'\n | 'telegram'\n | 'tumblr'\n | 'twitch'\n | 'twitter'\n | 'vimeo'\n | 'whatsapp'\n | 'yelp'\n | 'youtube'\n\ntype SocialLink = { type: SocialLinkType; url: string }\n\ntype SocialLinksLink = { id: string; payload: SocialLink }\n\nexport type SocialLinksValue = { links: SocialLinksLink[]; openInNewTab: boolean }\n\ntype SocialLinksOptions = Options<{ preset?: SocialLinksValue }>\n\ntype SocialLinksDescriptor<_T = SocialLinksValue> = {\n type: typeof Types.SocialLinks\n options: SocialLinksOptions\n}\n\nexport function SocialLinks(options: SocialLinksOptions = {}): SocialLinksDescriptor {\n return { type: Types.SocialLinks, options }\n}\n\nexport type TableValue = string\n\ntype TableOptions = Options<{ preset?: TableValue }>\n\ntype TableDescriptor<_T = TableValue> = { type: typeof Types.Table; options: TableOptions }\n\nexport function Table(options: TableOptions = {}): TableDescriptor {\n return { type: Types.Table, options }\n}\n\ntype TableFormField = {\n id: string\n tableColumnId: string\n label?: string\n placeholder?: string\n defaultValue?: string | boolean | string[]\n required?: boolean\n hidden?: boolean\n type?: 'select' | 'radio'\n hideLabel?: boolean\n autofill?: boolean\n}\n\ntype Grid = { count: number; spans: number[][] }\n\nexport type TableFormFieldsValue = { fields: TableFormField[]; grid: ResponsiveValue<Grid> }\n\ntype TableFormFieldsOptions = Options<{ preset?: TableFormFieldsValue }>\n\nexport type TableFormFieldsDescriptor<_T = TableFormFieldsValue> = {\n type: typeof Types.TableFormFields\n options: TableFormFieldsOptions\n}\n\nexport function TableFormFields(options: TableFormFieldsOptions = {}): TableFormFieldsDescriptor {\n return { type: Types.TableFormFields, options }\n}\n\nexport type TypeaheadValue<T extends Data = Data> = {\n id: string\n label: string\n value: T\n}\n\nexport type TypeaheadOptions<T extends Data> = {\n getItems: (query: string) => Promise<TypeaheadValue<T>[]>\n label?: string\n preset?: TypeaheadValue<T>\n defaultValue?: TypeaheadValue<T>\n}\n\nexport type TypeaheadDescriptor<T extends TypeaheadValue = TypeaheadValue> = {\n type: typeof Types.Typeahead\n options: TypeaheadOptions<T extends TypeaheadValue<infer U> ? U : never>\n}\n\nexport function Typeahead<T extends Data>(\n options: TypeaheadOptions<T>,\n): TypeaheadDescriptor<TypeaheadValue<T>> {\n return { type: Types.Typeahead, options }\n}\n\nexport type TextAreaValue = string\n\ntype TextAreaOptions = Options<{ preset?: TextAreaValue; label?: string; rows?: number }>\n\ntype TextAreaDescriptor<_T = TextAreaValue> = {\n type: typeof Types.TextArea\n options: TextAreaOptions\n}\n\nexport function TextArea(options: TextAreaOptions = {}): TextAreaDescriptor {\n return { type: Types.TextArea, options }\n}\n\nexport type TextInputValue = string\n\nexport type TextInputOptions = Options<{ label?: string; placeholder?: string; hidden?: boolean }>\n\nexport type TextInputDescriptor<_T = TextInputValue> = {\n type: typeof Types.TextInput\n options: TextInputOptions\n}\n\nexport function TextInput(options: TextInputOptions = {}): TextInputDescriptor {\n return { type: Types.TextInput, options }\n}\n\nexport type TextStyleValue = ResponsiveValue<TextStyle>\n\nexport type TextStyleOptions = Options<{\n preset?: TextStyleValue\n label?: string\n hidden?: boolean\n}>\n\nexport type TextStyleDescriptor<_T = TextStyleValue> = {\n type: typeof Types.TextStyle\n options: TextStyleOptions\n}\n\nexport function TextStyle(options: TextStyleOptions = {}): TextStyleDescriptor {\n return { type: Types.TextStyle, options }\n}\n\ntype Video = {\n url?: string\n muted?: boolean\n playing?: boolean\n loop?: boolean\n controls?: boolean\n}\n\nexport type VideoValue = Video\n\ntype VideoOptions = Options<{ preset?: VideoValue }>\n\ntype VideoDescriptor<_T = VideoValue> = { type: typeof Types.Video; options: VideoOptions }\n\nexport function Video(options: VideoOptions = {}): VideoDescriptor {\n return { type: Types.Video, options }\n}\n\nexport type WidthValue = ResponsiveValue<Length>\n\nexport const WidthPropControllerFormat = {\n ClassName: 'makeswift::prop-controllers::width::format::class-name',\n ResponsiveValue: 'makeswift::prop-controllers::width::format::responsive-value',\n} as const\n\ntype WidthControlValueFormat =\n typeof WidthPropControllerFormat[keyof typeof WidthPropControllerFormat]\n\ntype WidthOptions = {\n preset?: WidthValue\n defaultValue?: Length\n format?: WidthControlValueFormat\n}\n\nexport type WidthDescriptor<_T = WidthValue, U extends WidthOptions = WidthOptions> = {\n type: typeof Types.Width\n options: U\n}\n\nexport function Width<T extends WidthOptions>(\n options: T & WidthOptions = {} as T,\n): WidthDescriptor<WidthValue, T> {\n return { type: Types.Width, options }\n}\n\nWidth.Format = WidthPropControllerFormat\n\nexport type Descriptor<T extends Data = Data> =\n | BackgroundsDescriptor<T>\n | BorderDescriptor<T>\n | BorderRadiusDescriptor<T>\n | CheckboxDescriptor<T>\n | DateDescriptor<T>\n | ElementIDDescriptor<T>\n | FontDescriptor<T>\n | GapXDescriptor<T>\n | GapYDescriptor<T>\n | GridDescriptor<T>\n | ImageDescriptor<T>\n | ImagesDescriptor<T>\n | LinkDescriptor<T>\n | ListDescriptor<T extends ListValue ? T : ListValue>\n | MarginDescriptor<T>\n | NavigationLinksDescriptor<T>\n | NumberDescriptor<T>\n | PaddingDescriptor<T>\n | ResponsiveColorDescriptor<T>\n | ResponsiveIconRadioGroupDescriptor<\n T extends ResponsiveIconRadioGroupValue<string> ? T : ResponsiveIconRadioGroupValue<string>\n >\n | ResponsiveLengthDescriptor<T>\n | ResponsiveNumberDescriptor<T>\n | ResponsiveOpacityDescriptor<T>\n | ResponsiveSelectDescriptor<\n T extends ResponsiveSelectValue<string> ? T : ResponsiveSelectValue<string>\n >\n | RichTextDescriptor<T>\n | ShadowsDescriptor<T>\n | ShapeDescriptor<T extends ShapeValue ? T : ShapeValue, any>\n | SocialLinksDescriptor<T>\n | TableDescriptor<T>\n | TableFormFieldsDescriptor<T>\n | TypeaheadDescriptor<T extends TypeaheadValue ? T : TypeaheadValue>\n | TextAreaDescriptor<T>\n | TextInputDescriptor<T>\n | TextStyleDescriptor<T>\n | VideoDescriptor<T>\n | WidthDescriptor<T>\n | StyleControlDefinition\n | NumberControlDefinition\n | CheckboxControlDefinition\n | TextInputControlDefinition\n | TextAreaControlDefinition\n | SelectControlDefinition\n | ColorControlDefinition\n | ImageControlDefinition\n | ComboboxControlDefinition\n | ShapeControlDefinition\n | ListControlDefinition\n | LinkControlDefinition\n | SlotControlDefinition\n\nexport type PanelDescriptorType =\n | typeof Types.Backgrounds\n | typeof Types.ResponsiveIconRadioGroup\n | typeof Types.Margin\n | typeof Types.Padding\n | typeof Types.Border\n | typeof Types.Shadows\n | typeof Types.GapY\n | typeof Types.GapX\n | typeof Types.BorderRadius\n | typeof Types.Checkbox\n | typeof Types.TextInput\n | typeof Types.Link\n | typeof Types.List\n | typeof Types.Shape\n | typeof Types.ResponsiveSelect\n | typeof Types.ResponsiveColor\n | typeof Types.TextStyle\n | typeof Types.Images\n | typeof Types.ResponsiveNumber\n | typeof Types.Number\n | typeof Types.Date\n | typeof Types.Font\n | typeof Types.TextArea\n | typeof Types.Table\n | typeof Types.Typeahead\n | typeof Types.RichText\n | typeof Types.Image\n | typeof Types.ResponsiveOpacity\n | typeof Types.SocialLinks\n | typeof Types.Video\n | typeof Types.NavigationLinks\n\nexport type PanelDescriptor<T extends Data = Data> = Extract<\n Descriptor<T>,\n { type: PanelDescriptorType }\n>\n\nexport type DescriptorValueType<T extends Descriptor> = T extends NumberControlDefinition\n ? NumberControlValue<T>\n : T extends CheckboxControlDefinition\n ? CheckboxControlValue<T>\n : T extends TextInputControlDefinition\n ? TextInputControlValue<T>\n : T extends TextAreaControlDefinition\n ? TextAreaControlValue<T>\n : T extends SelectControlDefinition\n ? SelectControlValue<T>\n : T extends ColorControlDefinition\n ? ColorControlValue<T>\n : T extends StyleControlDefinition\n ? StyleControlFormattedValue\n : T extends ImageControlDefinition\n ? ResolveImageControlValue<T>\n : T extends ComboboxControlDefinition\n ? ComboboxControlValue<T>\n : T extends ShapeControlDefinition\n ? ShapeControlValue<T>\n : T extends ListControlDefinition\n ? ListControlValue<T>\n : T extends LinkControlDefinition\n ? LinkControlValue<T>\n : T extends SlotControlDefinition\n ? SlotControlValue\n : T['type'] extends typeof Types.ResponsiveColor\n ? ResponsiveColor | null | undefined\n : T['type'] extends typeof Types.Width\n ? ResolveWidthControlValue<T>\n : T['type'] extends typeof Types.Padding\n ? ResolvePaddingControlValue<T>\n : T['type'] extends typeof Types.Margin\n ? ResolveMarginControlValue<T>\n : T['type'] extends typeof Types.BorderRadius\n ? ResolveBorderRadiusControlValue<T>\n : T['type'] extends typeof Types.Shadows\n ? ResolveShadowsControlValue<T>\n : T['type'] extends typeof Types.Border\n ? ResolveBorderControlValue<T>\n : T extends Descriptor<infer U>\n ? U | undefined\n : never\n\nexport type PanelDescriptorValueType<T extends PanelDescriptor> = T extends PanelDescriptor<infer U>\n ? U\n : never\n","import { CopyContext, ReplacementContext } from '../state/react-page'\n\nexport type ImageControlData = string\n\nexport const ImageControlType = 'makeswift::controls::image'\n\nexport const ImageControlValueFormat = {\n URL: 'makeswift::controls::image::format::url',\n WithDimensions: 'makeswift::controls::image::format::with-dimensions',\n} as const\n\ntype ImageControlValueFormat = typeof ImageControlValueFormat[keyof typeof ImageControlValueFormat]\n\ntype ImageControlConfig = { label?: string; format?: ImageControlValueFormat }\n\nexport type ImageControlDefinition<T extends ImageControlConfig = ImageControlConfig> = {\n type: typeof ImageControlType\n config: T\n}\n\nexport function Image<T extends ImageControlConfig>(\n config: T = {} as T,\n): ImageControlDefinition<T> {\n return { type: ImageControlType, config }\n}\n\nImage.Format = ImageControlValueFormat\n\nexport function copyImageData(\n value: ImageControlData | undefined,\n context: CopyContext,\n): ImageControlData | undefined {\n if (value == null) return value\n\n return context.replacementContext.fileIds.get(value) ?? value\n}\n\nif (import.meta.vitest) {\n const { describe, test, expect } = import.meta.vitest\n\n describe.concurrent('image copy', () => {\n test('image is replaced by a one in replacement context', () => {\n // Arrange\n const data: ImageControlData = 'file-id'\n const expected = 'testing'\n\n const replacementContext = {\n elementHtmlIds: new Set(),\n elementKeys: new Map(),\n swatchIds: new Map(),\n fileIds: new Map([['file-id', 'testing']]),\n typographyIds: new Map(),\n tableIds: new Map(),\n tableColumnIds: new Map(),\n pageIds: new Map(),\n globalElementIds: new Map(),\n globalElementData: new Map(),\n }\n\n // Act\n const result = copyImageData(data, {\n replacementContext: replacementContext as ReplacementContext,\n copyElement: node => node,\n })\n\n // Assert\n expect(result).toMatchObject(expected)\n })\n })\n}\n","export const BuilderEditMode = {\n BUILD: 'build',\n CONTENT: 'content',\n} as const\n\nexport type BuilderEditMode = typeof BuilderEditMode[keyof typeof BuilderEditMode]\n","import { Editor } from 'slate-react'\nimport { ValueJSON } from 'slate'\nimport { OnChangeParam } from 'slate-react'\nimport { Descriptor, RichTextDescriptor, TableFormFieldsDescriptor, Types } from './descriptors'\nimport { BuilderEditMode } from '../utils/constants'\nimport { BoxModel } from '../state/modules/box-models'\nimport { SlotControl, SlotControlMessage, SlotControlType } from '../controls'\n\nexport const RichTextPropControllerMessageType = {\n CHANGE_BUILDER_EDIT_MODE: 'CHANGE_BUILDER_EDIT_MODE',\n INITIALIZE_EDITOR: 'INITIALIZE_EDITOR',\n CHANGE_EDITOR_VALUE: 'CHANGE_EDITOR_VALUE',\n FOCUS: 'FOCUS',\n BLUR: 'BLUR',\n UNDO: 'UNDO',\n REDO: 'REDO',\n} as const\n\ntype ChangeBuilderEditModeRichTextPropControllerMessage = {\n type: typeof RichTextPropControllerMessageType.CHANGE_BUILDER_EDIT_MODE\n editMode: BuilderEditMode\n}\n\ntype InitializeEditorRichTextPropControllerMessage = {\n type: typeof RichTextPropControllerMessageType.INITIALIZE_EDITOR\n value: ValueJSON\n}\n\ntype ChangeEditorValueRichTextPropControllerMessage = {\n type: typeof RichTextPropControllerMessageType.CHANGE_EDITOR_VALUE\n value: ValueJSON\n}\n\ntype FocusRichTextPropControllerMessage = { type: typeof RichTextPropControllerMessageType.FOCUS }\n\ntype BlurRichTextPropControllerMessage = { type: typeof RichTextPropControllerMessageType.BLUR }\n\ntype UndoRichTextPropControllerMessage = { type: typeof RichTextPropControllerMessageType.UNDO }\n\ntype RedoRichTextPropControllerMessage = { type: typeof RichTextPropControllerMessageType.REDO }\n\nexport type RichTextPropControllerMessage =\n | ChangeBuilderEditModeRichTextPropControllerMessage\n | InitializeEditorRichTextPropControllerMessage\n | ChangeEditorValueRichTextPropControllerMessage\n | FocusRichTextPropControllerMessage\n | BlurRichTextPropControllerMessage\n | UndoRichTextPropControllerMessage\n | RedoRichTextPropControllerMessage\n\nexport type PropControllerMessage =\n | RichTextPropControllerMessage\n | TableFormFieldsMessage\n | SlotControlMessage\n\nexport type Send<T = PropControllerMessage> = (message: T) => void\n\nexport abstract class PropController<T = PropControllerMessage> {\n protected send: Send<T>\n\n constructor(send: Send<T>) {\n this.send = send\n }\n\n abstract recv(message: T): void\n}\n\nclass DefaultPropController extends PropController {\n recv(_message: PropControllerMessage): void {\n // Do nothing.\n }\n}\n\nclass RichTextPropController extends PropController<RichTextPropControllerMessage> {\n private editor: Editor | null = null\n\n recv(message: RichTextPropControllerMessage): void {\n switch (message.type) {\n case RichTextPropControllerMessageType.CHANGE_BUILDER_EDIT_MODE: {\n switch (message.editMode) {\n case BuilderEditMode.BUILD:\n this.editor?.deselect().blur()\n break\n\n case BuilderEditMode.CONTENT:\n this.editor?.focus().moveToRangeOfDocument()\n break\n }\n\n break\n }\n }\n }\n\n setSlateEditor(editor: Editor) {\n this.editor = editor\n\n this.send({\n type: RichTextPropControllerMessageType.INITIALIZE_EDITOR,\n value: editor.value.toJSON({ preserveSelection: false }),\n })\n }\n\n onChange(change: OnChangeParam) {\n this.send({\n type: RichTextPropControllerMessageType.CHANGE_EDITOR_VALUE,\n value: change.value.toJSON({ preserveSelection: true }),\n })\n }\n\n focus() {\n this.send({ type: RichTextPropControllerMessageType.FOCUS })\n }\n\n blur() {\n this.send({ type: RichTextPropControllerMessageType.BLUR })\n }\n\n undo() {\n this.send({ type: RichTextPropControllerMessageType.UNDO })\n }\n\n redo() {\n this.send({ type: RichTextPropControllerMessageType.REDO })\n }\n}\n\nexport const TableFormFieldsMessageType = {\n TABLE_FORM_LAYOUT_CHANGE: 'TABLE_FORM_LAYOUT_CHANGE',\n TABLE_FORM_FIELD_LAYOUT_CHANGE: 'TABLE_FORM_FIELD_LAYOUT_CHANGE',\n} as const\n\ntype TableLayoutTableFormFieldsMessage = {\n type: typeof TableFormFieldsMessageType.TABLE_FORM_LAYOUT_CHANGE\n payload: { layout: BoxModel }\n}\n\ntype TableFieldLayoutTableFormFieldsMessage = {\n type: typeof TableFormFieldsMessageType.TABLE_FORM_FIELD_LAYOUT_CHANGE\n payload: { layout: BoxModel; index: number }\n}\n\nexport type TableFormFieldsMessage =\n | TableLayoutTableFormFieldsMessage\n | TableFieldLayoutTableFormFieldsMessage\n\nexport class TableFormFieldsPropController extends PropController<TableFormFieldsMessage> {\n recv(): void {}\n\n tableFormLayoutChange(payload: { layout: BoxModel }) {\n this.send({ type: TableFormFieldsMessageType.TABLE_FORM_LAYOUT_CHANGE, payload })\n }\n\n tableFormFieldLayoutChange(payload: { layout: BoxModel; index: number }) {\n this.send({ type: TableFormFieldsMessageType.TABLE_FORM_FIELD_LAYOUT_CHANGE, payload })\n }\n}\n\ntype DescriptorPropController<T extends Descriptor> = T extends { type: typeof Types.RichText }\n ? RichTextPropController\n : T extends { type: typeof Types.TableFormFields }\n ? TableFormFieldsPropController\n : DefaultPropController\n\nexport type DescriptorsPropControllers<T extends Record<string, Descriptor>> = {\n [K in keyof T]: undefined extends T[K]\n ? DescriptorPropController<Exclude<T[K], undefined>>\n : DescriptorPropController<T[K]>\n}\n\ntype AnyPropController =\n | DefaultPropController\n | RichTextPropController\n | TableFormFieldsPropController\n | SlotControl\n\nexport function createPropController(\n descriptor: RichTextDescriptor,\n send: Send<RichTextPropControllerMessage>,\n): RichTextPropController\nexport function createPropController(\n descriptor: TableFormFieldsDescriptor,\n send: Send<TableFormFieldsMessage>,\n): TableFormFieldsPropController\nexport function createPropController(descriptor: Descriptor, send: Send): DefaultPropController\nexport function createPropController<T extends PropControllerMessage>(\n descriptor: Descriptor,\n send: Send<T>,\n): AnyPropController {\n switch (descriptor.type) {\n case Types.RichText:\n return new RichTextPropController(send as Send<RichTextPropControllerMessage>)\n\n case Types.TableFormFields:\n return new TableFormFieldsPropController(send as Send<TableFormFieldsMessage>)\n\n case SlotControlType:\n return new SlotControl(send as Send<SlotControlMessage>)\n\n default:\n return new DefaultPropController(send as Send)\n }\n}\n","import { PropController } from '../prop-controllers/instances'\nimport { BoxModel } from '../state/modules/box-models'\nimport { CopyContext, Element } from '../state/react-page'\nimport { ResponsiveValue } from './types'\n\ntype SlotControlColumnData = { count: number; spans: number[][] }\n\nexport type SlotControlData = {\n elements: Element[]\n columns: ResponsiveValue<SlotControlColumnData>\n}\n\nexport const SlotControlType = 'makeswift::controls::slot'\n\nexport type SlotControlDefinition = {\n type: typeof SlotControlType\n}\n\nexport function Slot(): SlotControlDefinition {\n return { type: SlotControlType }\n}\n\nexport const SlotControlMessageType = {\n CONTAINER_BOX_MODEL_CHANGE: 'makeswift::controls::slot::message::container-box-model-change',\n ITEM_BOX_MODEL_CHANGE: 'makeswift::controls::slot::message::item-box-model-change',\n} as const\n\ntype SlotControlContainerBoxModelChangeMessage = {\n type: typeof SlotControlMessageType.CONTAINER_BOX_MODEL_CHANGE\n payload: { boxModel: BoxModel | null }\n}\n\ntype SlotControlItemBoxModelChangeMessage = {\n type: typeof SlotControlMessageType.ITEM_BOX_MODEL_CHANGE\n payload: { index: number; boxModel: BoxModel | null }\n}\n\nexport type SlotControlMessage =\n | SlotControlContainerBoxModelChangeMessage\n | SlotControlItemBoxModelChangeMessage\n\nexport class SlotControl extends PropController<SlotControlMessage> {\n recv(): void {}\n\n changeContainerBoxModel(boxModel: BoxModel | null): void {\n this.send({ type: SlotControlMessageType.CONTAINER_BOX_MODEL_CHANGE, payload: { boxModel } })\n }\n\n changeItemBoxModel(index: number, boxModel: BoxModel | null): void {\n this.send({ type: SlotControlMessageType.ITEM_BOX_MODEL_CHANGE, payload: { index, boxModel } })\n }\n}\n\nexport function copySlotData(\n value: SlotControlData | undefined,\n context: CopyContext,\n): SlotControlData | undefined {\n if (value == null) return value\n\n return {\n ...value,\n elements: value.elements.map(element => context.copyElement(element)),\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,mBAAmB;AAcoB,eAAA,SAAS,IAAoC;AACxF,SAAA,EAAE,MAAM,kBAAkB;AACnC;AAEO,uBACL,OACA,SACuB;;AAC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A2B,0BAA0B,SAAS;AAAA,EAClF;AAAA,EAEA,2BAA2B,SAA8C;AACvE,SAAK,KAAK,EAAE,MAAM,2BAA2B,gCAAgC,SAAS;AAAA,EACxF;AACF;AA6BO,8BACL,YACA,MACmB;AACnB,UAAQ,WAAW;AAAA,SACZ,MAAM;AACF,aAAA,IAAI,uBAAuB,IAA2C;AAAA,SAE1E,MAAM;AACF,aAAA,IAAI,8BAA8B,IAAoC;AAAA,SAE1E;AACI,aAAA,IAAI,YAAY,IAAgC;AAAA;AAGhD,aAAA,IAAI,sBAAsB,IAAY;AAAA;AAEnD;AC9LO,MAAM,kBAAkB;AAMe,gBAAA;AACrC,SAAA,EAAE,MAAM;AACjB;AAEO,MAAM,yBAAyB;AAAA,EACpC,4BAA4B;AAAA,EAC5B,uBAAuB;AACzB;AAgBO,MAAM,oBAAoB,eAAmC;AAAA,EAClE,OAAa;AAAA,EAAC;AAAA,EAEd,wBAAwB,UAAiC;AAClD,SAAA,KAAK,EAAE,MAAM,uBAAuB,4BAA4B,SAAS,EAAE,SAAS,EAAA,CAAG;AAAA,EAC9F;AAAA,EAEA,mBAAmB,OAAe,UAAiC;AAC5D,SAAA,KAAK,EAAE,MAAM,uBAAuB,uBAAuB,SAAS,EAAE,OAAO,SAAS,EAAA,CAAG;AAAA,EAChG;AACF;AAEO,sBACL,OACA,SAC6B;AAC7B,MAAI,SAAS;AAAa,WAAA;AAEnB,SAAA,iCACF,QADE;AAAA,IAEL,UAAU,MAAM,SAAS,IAAI,aAAW,QAAQ,YAAY,OAAO,CAAC;AAAA,EAAA;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/slot.es.js
CHANGED
|
@@ -140,12 +140,22 @@ const Types = {
|
|
|
140
140
|
function Backgrounds(options = {}) {
|
|
141
141
|
return { type: Types.Backgrounds, options };
|
|
142
142
|
}
|
|
143
|
+
const BorderPropControllerFormat = {
|
|
144
|
+
ClassName: "makeswift::prop-controllers::border::format::class-name",
|
|
145
|
+
ResponsiveValue: "makeswift::prop-controllers:border::format::responsive-value"
|
|
146
|
+
};
|
|
143
147
|
function Border(options = {}) {
|
|
144
148
|
return { type: Types.Border, options };
|
|
145
149
|
}
|
|
150
|
+
Border.Format = BorderPropControllerFormat;
|
|
151
|
+
const BorderRadiusPropControllerFormat = {
|
|
152
|
+
ClassName: "makeswift::prop-controllers::border-radius::format::class-name",
|
|
153
|
+
ResponsiveValue: "makeswift::prop-controllers::border-radius::format::responsive-value"
|
|
154
|
+
};
|
|
146
155
|
function BorderRadius(options = {}) {
|
|
147
156
|
return { type: Types.BorderRadius, options };
|
|
148
157
|
}
|
|
158
|
+
BorderRadius.Format = BorderRadiusPropControllerFormat;
|
|
149
159
|
function Checkbox(options) {
|
|
150
160
|
return { type: Types.Checkbox, options };
|
|
151
161
|
}
|
|
@@ -179,18 +189,28 @@ function Link(options = {}) {
|
|
|
179
189
|
function List(options) {
|
|
180
190
|
return { type: Types.List, options };
|
|
181
191
|
}
|
|
192
|
+
const MarginPropControllerFormat = {
|
|
193
|
+
ClassName: "makeswift::prop-controllers::margin::format::class-name",
|
|
194
|
+
ResponsiveValue: "makeswift::prop-controllers::margin::format::responsive-value"
|
|
195
|
+
};
|
|
182
196
|
function Margin(options = {}) {
|
|
183
197
|
return { type: Types.Margin, options };
|
|
184
198
|
}
|
|
199
|
+
Margin.Format = MarginPropControllerFormat;
|
|
185
200
|
function NavigationLinks(options = {}) {
|
|
186
201
|
return { type: Types.NavigationLinks, options };
|
|
187
202
|
}
|
|
188
203
|
function Number(options = {}) {
|
|
189
204
|
return { type: Types.Number, options };
|
|
190
205
|
}
|
|
206
|
+
const PaddingPropControllerFormat = {
|
|
207
|
+
ClassName: "makeswift::prop-controllers::padding::format::class-name",
|
|
208
|
+
ResponsiveValue: "makeswift::prop-controllers::padding::format::responsive-value"
|
|
209
|
+
};
|
|
191
210
|
function Padding(options = {}) {
|
|
192
211
|
return { type: Types.Padding, options };
|
|
193
212
|
}
|
|
213
|
+
Padding.Format = PaddingPropControllerFormat;
|
|
194
214
|
function ResponsiveColor(options = {}) {
|
|
195
215
|
return { type: Types.ResponsiveColor, options };
|
|
196
216
|
}
|
|
@@ -212,9 +232,14 @@ function ResponsiveSelect(options) {
|
|
|
212
232
|
function RichText(options = {}) {
|
|
213
233
|
return { type: Types.RichText, options };
|
|
214
234
|
}
|
|
235
|
+
const ShadowsPropControllerFormat = {
|
|
236
|
+
ClassName: "makeswift::prop-controllers::shadows::format::class-name",
|
|
237
|
+
ResponsiveValue: "makeswift::prop-controllers::shadows::format::responsive-value"
|
|
238
|
+
};
|
|
215
239
|
function Shadows(options = {}) {
|
|
216
240
|
return { type: Types.Shadows, options };
|
|
217
241
|
}
|
|
242
|
+
Shadows.Format = ShadowsPropControllerFormat;
|
|
218
243
|
function Shape(options) {
|
|
219
244
|
return { type: Types.Shape, options };
|
|
220
245
|
}
|
|
@@ -242,19 +267,21 @@ function TextStyle(options = {}) {
|
|
|
242
267
|
function Video(options = {}) {
|
|
243
268
|
return { type: Types.Video, options };
|
|
244
269
|
}
|
|
245
|
-
const
|
|
246
|
-
ClassName: "
|
|
247
|
-
ResponsiveValue: "
|
|
270
|
+
const WidthPropControllerFormat = {
|
|
271
|
+
ClassName: "makeswift::prop-controllers::width::format::class-name",
|
|
272
|
+
ResponsiveValue: "makeswift::prop-controllers::width::format::responsive-value"
|
|
248
273
|
};
|
|
249
274
|
function Width(options = {}) {
|
|
250
275
|
return { type: Types.Width, options };
|
|
251
276
|
}
|
|
252
|
-
Width.
|
|
277
|
+
Width.Format = WidthPropControllerFormat;
|
|
253
278
|
var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
254
279
|
__proto__: null,
|
|
255
280
|
Types,
|
|
256
281
|
Backgrounds,
|
|
282
|
+
BorderPropControllerFormat,
|
|
257
283
|
Border,
|
|
284
|
+
BorderRadiusPropControllerFormat,
|
|
258
285
|
BorderRadius,
|
|
259
286
|
Checkbox,
|
|
260
287
|
Date,
|
|
@@ -267,9 +294,11 @@ var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
267
294
|
Images,
|
|
268
295
|
Link,
|
|
269
296
|
List,
|
|
297
|
+
MarginPropControllerFormat,
|
|
270
298
|
Margin,
|
|
271
299
|
NavigationLinks,
|
|
272
300
|
Number,
|
|
301
|
+
PaddingPropControllerFormat,
|
|
273
302
|
Padding,
|
|
274
303
|
ResponsiveColor,
|
|
275
304
|
ResponsiveIconRadioGroup,
|
|
@@ -278,6 +307,7 @@ var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
278
307
|
ResponsiveOpacity,
|
|
279
308
|
ResponsiveSelect,
|
|
280
309
|
RichText,
|
|
310
|
+
ShadowsPropControllerFormat,
|
|
281
311
|
Shadows,
|
|
282
312
|
Shape,
|
|
283
313
|
SocialLinks,
|
|
@@ -288,7 +318,7 @@ var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
288
318
|
TextInput,
|
|
289
319
|
TextStyle,
|
|
290
320
|
Video,
|
|
291
|
-
|
|
321
|
+
WidthPropControllerFormat,
|
|
292
322
|
Width
|
|
293
323
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
294
324
|
const ImageControlType = "makeswift::controls::image";
|
|
@@ -427,5 +457,5 @@ function copySlotData(value, context) {
|
|
|
427
457
|
elements: value.elements.map((element) => context.copyElement(element))
|
|
428
458
|
});
|
|
429
459
|
}
|
|
430
|
-
export {
|
|
460
|
+
export { Color as $, NavigationLinks as A, Backgrounds as B, ColorControlType as C, Date as D, ElementID as E, Font as F, GapY as G, SocialLinks as H, ImageControlType as I, RichText as J, StyleControlProperty as K, Link as L, Margin as M, Number as N, ImageControlValueFormat as O, Padding as P, BorderPropControllerFormat as Q, RichTextPropControllerMessageType as R, SlotControlType as S, Types as T, ShadowsPropControllerFormat as U, Video as V, Width as W, BorderRadiusPropControllerFormat as X, MarginPropControllerFormat as Y, PaddingPropControllerFormat as Z, WidthPropControllerFormat as _, StyleControlType as a, Image as a0, Slot as a1, SlotControlMessageType as a2, SlotControl as a3, Style as a4, createPropController as a5, copyStyleData as b, copySlotData as c, copyImageData as d, copyColorData as e, descriptors as f, TableFormFieldsMessageType as g, ResponsiveIconRadioGroup as h, Border as i, BorderRadius as j, Shadows as k, GapX as l, ResponsiveSelect as m, ResponsiveNumber as n, Checkbox as o, Grid as p, TextInput as q, ResponsiveColor as r, TextStyle as s, Images as t, ResponsiveLength as u, TextArea as v, Table as w, TableFormFields as x, Image$1 as y, ResponsiveOpacity as z };
|
|
431
461
|
//# sourceMappingURL=slot.es.js.map
|