@makeswift/runtime 0.1.9 → 0.1.10

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.
Files changed (146) hide show
  1. package/dist/Box.cjs.js +2 -3
  2. package/dist/Box.cjs.js.map +1 -1
  3. package/dist/Box.es.js +2 -3
  4. package/dist/Box.es.js.map +1 -1
  5. package/dist/Button.cjs.js +4 -3
  6. package/dist/Button.cjs.js.map +1 -1
  7. package/dist/Button.es.js +4 -3
  8. package/dist/Button.es.js.map +1 -1
  9. package/dist/Carousel.cjs.js +4 -3
  10. package/dist/Carousel.cjs.js.map +1 -1
  11. package/dist/Carousel.es.js +4 -3
  12. package/dist/Carousel.es.js.map +1 -1
  13. package/dist/Countdown.cjs.js +4 -3
  14. package/dist/Countdown.cjs.js.map +1 -1
  15. package/dist/Countdown.es.js +4 -3
  16. package/dist/Countdown.es.js.map +1 -1
  17. package/dist/Divider.cjs.js +4 -3
  18. package/dist/Divider.cjs.js.map +1 -1
  19. package/dist/Divider.es.js +4 -3
  20. package/dist/Divider.es.js.map +1 -1
  21. package/dist/Embed.cjs.js +4 -3
  22. package/dist/Embed.cjs.js.map +1 -1
  23. package/dist/Embed.es.js +4 -3
  24. package/dist/Embed.es.js.map +1 -1
  25. package/dist/Form.cjs.js +3 -4
  26. package/dist/Form.cjs.js.map +1 -1
  27. package/dist/Form.es.js +3 -4
  28. package/dist/Form.es.js.map +1 -1
  29. package/dist/Image.cjs2.js +4 -3
  30. package/dist/Image.cjs2.js.map +1 -1
  31. package/dist/Image.es2.js +4 -3
  32. package/dist/Image.es2.js.map +1 -1
  33. package/dist/Navigation.cjs.js +4 -3
  34. package/dist/Navigation.cjs.js.map +1 -1
  35. package/dist/Navigation.es.js +4 -3
  36. package/dist/Navigation.es.js.map +1 -1
  37. package/dist/Root.cjs.js +4 -3
  38. package/dist/Root.cjs.js.map +1 -1
  39. package/dist/Root.es.js +4 -3
  40. package/dist/Root.es.js.map +1 -1
  41. package/dist/SocialLinks.cjs.js +4 -3
  42. package/dist/SocialLinks.cjs.js.map +1 -1
  43. package/dist/SocialLinks.es.js +4 -3
  44. package/dist/SocialLinks.es.js.map +1 -1
  45. package/dist/Text.cjs.js +2 -3
  46. package/dist/Text.cjs.js.map +1 -1
  47. package/dist/Text.es.js +2 -3
  48. package/dist/Text.es.js.map +1 -1
  49. package/dist/Video.cjs.js +4 -3
  50. package/dist/Video.cjs.js.map +1 -1
  51. package/dist/Video.es.js +4 -3
  52. package/dist/Video.es.js.map +1 -1
  53. package/dist/actions.es.js +1 -1
  54. package/dist/builder.cjs.js +0 -2
  55. package/dist/builder.cjs.js.map +1 -1
  56. package/dist/builder.es.js +0 -2
  57. package/dist/builder.es.js.map +1 -1
  58. package/dist/components.cjs.js +2 -3
  59. package/dist/components.cjs.js.map +1 -1
  60. package/dist/components.es.js +2 -3
  61. package/dist/components.es.js.map +1 -1
  62. package/dist/control-serialization.cjs.js +37 -39
  63. package/dist/control-serialization.cjs.js.map +1 -1
  64. package/dist/control-serialization.es.js +1 -3
  65. package/dist/control-serialization.es.js.map +1 -1
  66. package/dist/controls.cjs.js +9 -5
  67. package/dist/controls.cjs.js.map +1 -1
  68. package/dist/controls.es.js +2 -2
  69. package/dist/cssMediaRules.cjs.js +1 -13
  70. package/dist/cssMediaRules.cjs.js.map +1 -1
  71. package/dist/cssMediaRules.es.js +1 -13
  72. package/dist/cssMediaRules.es.js.map +1 -1
  73. package/dist/image.cjs.js +269 -1
  74. package/dist/image.cjs.js.map +1 -1
  75. package/dist/image.es.js +230 -1
  76. package/dist/image.es.js.map +1 -1
  77. package/dist/index.cjs.js +382 -187
  78. package/dist/index.cjs.js.map +1 -1
  79. package/dist/index.es.js +212 -18
  80. package/dist/index.es.js.map +1 -1
  81. package/dist/index.es2.js +1 -1
  82. package/dist/index.es3.js +1 -1
  83. package/dist/main.cjs.js +2 -3
  84. package/dist/main.cjs.js.map +1 -1
  85. package/dist/main.es.js +2 -3
  86. package/dist/main.es.js.map +1 -1
  87. package/dist/next.cjs.js +4 -3
  88. package/dist/next.cjs.js.map +1 -1
  89. package/dist/next.es.js +5 -4
  90. package/dist/next.es.js.map +1 -1
  91. package/dist/prop-controllers.cjs.js +5 -6
  92. package/dist/prop-controllers.cjs.js.map +1 -1
  93. package/dist/prop-controllers.es.js +2 -3
  94. package/dist/prop-controllers.es.js.map +1 -1
  95. package/dist/react-builder-preview.cjs.js +21 -78
  96. package/dist/react-builder-preview.cjs.js.map +1 -1
  97. package/dist/react-builder-preview.es.js +28 -85
  98. package/dist/react-builder-preview.es.js.map +1 -1
  99. package/dist/react-page.cjs.js +110 -45
  100. package/dist/react-page.cjs.js.map +1 -1
  101. package/dist/react-page.es.js +77 -17
  102. package/dist/react-page.es.js.map +1 -1
  103. package/dist/react.cjs.js +4 -3
  104. package/dist/react.cjs.js.map +1 -1
  105. package/dist/react.es.js +4 -3
  106. package/dist/react.es.js.map +1 -1
  107. package/dist/{instances.cjs.js → slot.cjs.js} +28 -4
  108. package/dist/slot.cjs.js.map +1 -0
  109. package/dist/{instances.es.js → slot.es.js} +23 -3
  110. package/dist/slot.es.js.map +1 -0
  111. package/dist/types/box-model.d.ts +1 -1
  112. package/dist/types/box-model.d.ts.map +1 -1
  113. package/dist/types/controls/index.d.ts +1 -0
  114. package/dist/types/controls/index.d.ts.map +1 -1
  115. package/dist/types/controls/slot.d.ts +42 -0
  116. package/dist/types/controls/slot.d.ts.map +1 -0
  117. package/dist/types/prop-controllers/descriptors.d.ts +2 -2
  118. package/dist/types/prop-controllers/descriptors.d.ts.map +1 -1
  119. package/dist/types/prop-controllers/instances.d.ts +3 -2
  120. package/dist/types/prop-controllers/instances.d.ts.map +1 -1
  121. package/dist/types/prop-controllers/introspection.d.ts.map +1 -1
  122. package/dist/types/runtimes/react/controls/slot.d.ts +30 -0
  123. package/dist/types/runtimes/react/controls/slot.d.ts.map +1 -0
  124. package/dist/types/runtimes/react/controls/style.d.ts.map +1 -1
  125. package/dist/types/runtimes/react/controls.d.ts.map +1 -1
  126. package/dist/types/runtimes/react/index.d.ts +4 -0
  127. package/dist/types/runtimes/react/index.d.ts.map +1 -1
  128. package/dist/types/runtimes/react/use-style.d.ts +3 -0
  129. package/dist/types/runtimes/react/use-style.d.ts.map +1 -0
  130. package/dist/types/state/modules/prop-controller-handles.d.ts +1 -0
  131. package/dist/types/state/modules/prop-controller-handles.d.ts.map +1 -1
  132. package/dist/types/state/react-builder-preview.d.ts.map +1 -1
  133. package/dist/types/state/react-page.d.ts +3 -0
  134. package/dist/types/state/react-page.d.ts.map +1 -1
  135. package/dist/useBoxShadow.es.js +1 -1
  136. package/package.json +2 -2
  137. package/dist/descriptors.cjs.js +0 -232
  138. package/dist/descriptors.cjs.js.map +0 -1
  139. package/dist/descriptors.es.js +0 -196
  140. package/dist/descriptors.es.js.map +0 -1
  141. package/dist/instances.cjs.js.map +0 -1
  142. package/dist/instances.es.js.map +0 -1
  143. package/dist/style.cjs.js +0 -41
  144. package/dist/style.cjs.js.map +0 -1
  145. package/dist/style.es.js +0 -38
  146. package/dist/style.es.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Text.es.js","sources":["../src/components/hooks/useTypography.ts","../src/components/builtin/Text/components/RichTextEditor/components/Mark/hooks/useTypographyMark.ts","../src/components/builtin/Text/components/RichTextEditor/components/Mark/index.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesMarks.tsx","../src/components/builtin/Text/components/RichTextEditor/components/Block/index.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesBlocks.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/Link.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/Inlines.tsx","../src/components/builtin/Text/components/RichTextEditor/index.tsx","../src/components/builtin/Text/Text.tsx"],"sourcesContent":["import type { ColorValue } from '../utils/types'\nimport type { Length as LengthValue } from '../../prop-controllers'\nimport { DeviceOverride } from '../../prop-controllers'\nimport { TYPOGRAPHIES_BY_ID } from '../utils/queries'\nimport { useQuery } from '../../api/react'\n\nexport type TypographyStyleValue = {\n fontFamily?: string\n fontWeight?: number\n fontSize?: LengthValue\n color?: ColorValue\n textAlign?: string\n lineHeight?: number\n letterSpacing?: number\n uppercase?: boolean\n underline?: boolean\n strikethrough?: boolean\n italic?: boolean\n}\n\nexport type TypographyStyle = Array<DeviceOverride<TypographyStyleValue>>\n\nexport type Typography = {\n id: string\n name: string\n style: TypographyStyle\n}\n\nexport function useTypography(\n typographyId: string | null | undefined,\n): Typography | null | undefined {\n const { error, data } = useQuery(TYPOGRAPHIES_BY_ID, {\n skip: typographyId == null,\n variables: { ids: typographyId != null ? [typographyId] : [] },\n })\n\n if (typographyId == null || error != null) return null\n\n return data?.typographies[0] as Typography | null\n}\n","import { Length as LengthValue } from '../../../../../../../../prop-controllers'\nimport { ColorValue as Color } from '../../../../../../../utils/types'\nimport { findDeviceOverride } from '../../../../../../../utils/devices'\nimport type { DeviceOverride } from '../../../../../../../../prop-controllers'\nimport { SWATCHES_BY_ID } from '../../../../../../../utils/queries'\nimport { useTypography, TypographyStyle } from '../../../../../../../hooks/useTypography'\nimport { useQuery } from '../../../../../../../../api/react'\n\nexport type TypographyMarkDataValue = {\n fontWeight?: number\n fontSize?: LengthValue\n fontFamily?: string\n color?: Color\n textAlign?: string\n lineHeight?: number\n letterSpacing?: number\n uppercase?: boolean\n italic?: boolean\n underline?: boolean\n strikethrough?: boolean\n}\n\nexport type TypographyMarkValue = {\n id: string | null | undefined\n style: TypographyStyle\n}\n\nexport type TypographyMarkData = Array<DeviceOverride<TypographyMarkDataValue>>\n\nconst concat = <A extends unknown[], B extends unknown[]>(a: A, b: B) => a.concat(b)\nconst getSwatchId = ({ value: { color } }: any) => color && color.swatchId\nconst getDeviceId = ({ deviceId }: any) => deviceId\n\nconst withColor =\n (swatches: any) =>\n ({ value: { color, ...restOfValue }, ...rest }: any) => ({\n ...rest,\n value: {\n ...restOfValue,\n ...(color\n ? {\n color: {\n swatch: swatches.find((s: any) => s && s.id === color.swatchId),\n alpha: color.alpha,\n },\n }\n : {}),\n },\n })\n\nexport const overrideTypographyStyle = <A>(\n source: Array<DeviceOverride<A>>,\n override: Array<DeviceOverride<A>>,\n): Array<DeviceOverride<A>> => {\n const devices = [...new Set(source.map(getDeviceId).concat(override.map(getDeviceId)))]\n\n return devices.map((deviceId: any) => ({\n deviceId,\n value: {\n ...(findDeviceOverride(source, deviceId) || { value: {} }).value,\n ...(findDeviceOverride(override, deviceId, v => v) || { value: {} }).value,\n },\n })) as DeviceOverride<A>[]\n}\n\nexport default function useTypographyMark(\n value: TypographyMarkValue | null | undefined,\n): TypographyMarkData | null | undefined {\n const typography = useTypography(value && value.id)\n\n const swatchIds = [\n (typography && typography.style.map(getSwatchId)) || [],\n (value && value.style.map(getSwatchId)) || [],\n ]\n .reduce(concat)\n .filter(Boolean)\n\n const { error: colorError, data: colorData = {} } = useQuery(SWATCHES_BY_ID, {\n skip: swatchIds == null || swatchIds.length === 0,\n variables: { ids: swatchIds },\n })\n\n const { swatches = [] } = colorData\n\n if (colorError != null) return null\n\n return overrideTypographyStyle(\n (typography && typography.style.map(withColor(swatches))) || [],\n (value && value.style.map(withColor(swatches))) || [],\n )\n}\n","import { ComponentPropsWithoutRef } from 'react'\nimport styled, { css } from 'styled-components'\n\nimport useTypographyMark, {\n TypographyMarkValue,\n TypographyMarkData,\n overrideTypographyStyle,\n TypographyMarkDataValue,\n} from './hooks/useTypographyMark'\nimport { cssMediaRules } from '../../../../../../utils/cssMediaRules'\nimport { colorToString } from '../../../../../../utils/colorToString'\nimport { shallowMergeFallbacks } from '../../../../../../utils/devices'\n\nexport type { TypographyMarkValue }\nexport { overrideTypographyStyle }\n\nconst Span = styled.span<{ typographyStyle: TypographyMarkData | null | undefined }>`\n ${p =>\n cssMediaRules(\n [p.typographyStyle] as const,\n ([\n {\n color,\n fontFamily,\n fontSize,\n fontWeight,\n lineHeight,\n letterSpacing,\n uppercase,\n underline,\n strikethrough,\n italic,\n } = {} as TypographyMarkDataValue,\n ]) => css`\n ${color == null\n ? ''\n : css`\n color: ${colorToString(color)};\n `}\n\n ${fontFamily == null\n ? ''\n : css`\n font-family: '${fontFamily}';\n `}\n\n ${fontSize == null || fontSize.value == null || fontSize.unit == null\n ? ''\n : css`\n font-size: ${`${fontSize.value}${fontSize.unit}`};\n `}\n\n ${fontWeight == null\n ? ''\n : css`\n font-weight: ${fontWeight};\n `}\n\n ${lineHeight == null\n ? ''\n : css`\n line-height: ${lineHeight};\n `}\n\n ${letterSpacing == null\n ? ''\n : css`\n letter-spacing: ${letterSpacing / 10}em;\n `}\n\n ${underline == null && strikethrough == null\n ? ''\n : css`\n text-decoration: ${[\n Boolean(underline) && 'underline',\n Boolean(strikethrough) && 'line-through',\n ]\n .filter(Boolean)\n .join(' ')};\n `}\n\n ${uppercase == null\n ? ''\n : css`\n text-transform: ${uppercase === true ? 'uppercase' : 'initial'};\n `}\n\n ${italic == null\n ? ''\n : css`\n font-style: ${italic === true ? 'italic' : 'initial'};\n `}\n `,\n shallowMergeFallbacks,\n )}\n`\n\ntype BaseProps = { value: TypographyMarkValue }\n\ntype Props = BaseProps & Omit<ComponentPropsWithoutRef<typeof Span>, keyof BaseProps>\n\nexport default function Mark({ value, ...restOfProps }: Props): JSX.Element {\n const typographyStyle = useTypographyMark(value)\n\n return <Span {...restOfProps} typographyStyle={typographyStyle} />\n}\n","import type { Plugin } from 'slate-react'\n\nimport Mark from '../components/Mark'\n\nconst TYPOGRAPHY_TYPE = 'typography'\n\nexport default function DeviceOverridesMarksPlugin(): Plugin {\n return {\n renderMark({ mark, children }, _editor, next) {\n if (mark.type === TYPOGRAPHY_TYPE) {\n return <Mark value={mark.data.get('value')}>{children}</Mark>\n }\n\n return next()\n },\n }\n}\n","import { forwardRef, ElementType, ComponentPropsWithoutRef } from 'react'\nimport styled, { css } from 'styled-components'\n\nimport { cssMediaRules } from '../../../../../../utils/cssMediaRules'\nimport type { ResponsiveValue } from '../../../../../../../prop-controllers'\n\ntype StyledBlockProps = {\n textAlign?: ResponsiveValue<'left' | 'center' | 'right' | 'justify'>\n as?: ElementType\n}\n\nconst StyledBlock = styled.div<StyledBlockProps>`\n margin: 0;\n ${p =>\n cssMediaRules([p.textAlign] as const, ([textAlign]) =>\n textAlign == null\n ? css``\n : css`\n text-align: ${textAlign};\n `,\n )}\n\n ${p =>\n p.as === 'blockquote'\n ? css`\n padding: 0.5em 10px;\n font-size: 1.25em;\n font-weight: 300;\n border-left: 5px solid rgba(0, 0, 0, 0.1);\n `\n : ''}\n`\n\ntype Props = ComponentPropsWithoutRef<typeof StyledBlock>\n\nexport default forwardRef<HTMLDivElement, Props>(function Block(\n { textAlign, ...restOfProps }: Props,\n ref,\n) {\n return <StyledBlock {...restOfProps} ref={ref} textAlign={textAlign} />\n})\n","import { Plugin } from 'slate-react'\n\nimport Block from '../components/Block'\n\nexport default function DeviceOverridesBlockPlugin(): Plugin {\n return {\n renderBlock(props, _editor, next): JSX.Element {\n const { node, attributes, children } = props\n const blockProps = { textAlign: node.data.get('textAlign') }\n\n switch (node.type) {\n case 'paragraph':\n return (\n <Block {...attributes} {...blockProps} as=\"p\">\n {children}\n </Block>\n )\n\n case 'heading-one':\n return (\n <Block {...attributes} {...blockProps} as=\"h1\">\n {children}\n </Block>\n )\n\n case 'heading-two':\n return (\n <Block {...attributes} {...blockProps} as=\"h2\">\n {children}\n </Block>\n )\n\n case 'heading-three':\n return (\n <Block {...attributes} {...blockProps} as=\"h3\">\n {children}\n </Block>\n )\n\n case 'heading-four':\n return (\n <Block {...attributes} {...blockProps} as=\"h4\">\n {children}\n </Block>\n )\n\n case 'heading-five':\n return (\n <Block {...attributes} {...blockProps} as=\"h5\">\n {children}\n </Block>\n )\n\n case 'heading-six':\n return (\n <Block {...attributes} {...blockProps} as=\"h6\">\n {children}\n </Block>\n )\n\n case 'blockquote':\n return (\n <Block {...attributes} {...blockProps} as=\"blockquote\">\n {children}\n </Block>\n )\n\n default:\n return next()\n }\n },\n }\n}\n","import { Plugin } from 'slate-react'\nimport styled from 'styled-components'\n\nimport { Link } from '../../../../../shared/Link'\n\nconst StyledLink = styled(Link)`\n text-decoration: none;\n`\n\nexport default function LinkPlugin(): Plugin {\n return {\n renderInline(props, _editor, next) {\n const { attributes, children, node } = props\n\n switch (node.type) {\n case 'link': {\n const { data } = node\n\n return (\n <StyledLink {...attributes} link={data.toJS()}>\n {children}\n </StyledLink>\n )\n }\n\n default: {\n return next()\n }\n }\n },\n }\n}\n","import { Plugin } from 'slate-react'\n\nexport default function Inlines(): Plugin {\n return {\n renderInline(props, _editor, next) {\n const { attributes, children, node } = props\n\n switch (node.type) {\n case 'code': {\n return <code {...attributes}>{children}</code>\n }\n\n case 'superscript': {\n return <sup {...attributes}>{children}</sup>\n }\n\n case 'subscript': {\n return <sub {...attributes}>{children}</sub>\n }\n\n default: {\n return next()\n }\n }\n },\n }\n}\n","import { ComponentPropsWithoutRef, forwardRef, useMemo } from 'react'\n\nimport { Editor as SlateEditor } from 'slate-react'\n\n// @ts-expect-error: no types for '@convertkit/slate-lists'\nimport Lists from '@convertkit/slate-lists'\nimport styled from 'styled-components'\n\nimport DeviceOverridesMarks from './plugins/DeviceOverridesMarks'\nimport DeviceOverridesBlocks from './plugins/DeviceOverridesBlocks'\nimport Link from './plugins/Link'\nimport Inlines from './plugins/Inlines'\n\nexport { overrideTypographyStyle } from './components/Mark'\n\ntype Props = ComponentPropsWithoutRef<typeof SlateEditor>\n\nexport const RichTextEditor = styled(\n forwardRef<SlateEditor, Props>(function RichTextEditor(\n { placeholder = 'Write some text...', ...restOfProps }: Props,\n ref,\n ) {\n const plugins = useMemo(\n () => [Lists(), Link(), Inlines(), DeviceOverridesBlocks(), DeviceOverridesMarks()],\n [],\n )\n\n return (\n <SlateEditor\n {...restOfProps}\n // Workaround because our Slate editor is broken on Chrome 105\n // Problem: https://linear.app/makeswift/issue/PRD-434/our-rich-text-component-breaks-in-the-latest-version-of-chrome\n // Workaround: https://github.com/ianstormtaylor/slate/issues/5110#issuecomment-1234951122\n style={{ WebkitUserModify: undefined }}\n ref={ref}\n autoFocus={false}\n plugins={plugins}\n placeholder={placeholder}\n />\n )\n }),\n)`\n ul,\n ol {\n margin: 0;\n }\n`\n","import {\n useState,\n Ref,\n useImperativeHandle,\n forwardRef,\n useEffect,\n useCallback,\n useRef,\n KeyboardEvent as ReactKeyboardEvent,\n FocusEvent as ReactFocusEvent,\n} from 'react'\nimport styled from 'styled-components'\nimport { Editor, OnChangeParam } from 'slate-react'\nimport { Value, ValueJSON } from 'slate'\n// @ts-expect-error: no types for 'slate-hotkeys'\nimport Hotkeys from 'slate-hotkeys'\nimport { isHotkey } from 'is-hotkey'\n\nimport {\n ElementIDValue,\n MarginValue,\n RichTextDescriptor,\n RichTextValue,\n WidthValue,\n} from '../../../prop-controllers/descriptors'\nimport { cssMargin, cssWidth } from '../../utils/cssMediaRules'\nimport { BoxModelHandle, getBox } from '../../../box-model'\nimport { PropControllersHandle } from '../../../state/modules/prop-controller-handles'\nimport { RichTextEditor } from './components/RichTextEditor'\nimport { useIsInBuilder } from '../../../runtimes/react'\nimport { DescriptorsPropControllers } from '../../../prop-controllers/instances'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: WidthValue\n margin?: MarginValue\n}\n\nconst StyledRichTextEditor = styled(RichTextEditor).withConfig({\n shouldForwardProp: prop => !['width', 'margin'].includes(prop.toString()),\n})<{ width: Props['width']; margin: Props['margin'] }>`\n ${cssWidth()}\n ${cssMargin()}\n`\n\nconst defaultText: ValueJSON = {\n document: { nodes: [{ object: 'block' as const, type: 'paragraph' as const, nodes: [] }] },\n data: {},\n}\n\nconst COMMIT_DEBOUNCE_DELAY = 500\n\ntype Descriptors = { text?: RichTextDescriptor }\n\nconst Text = forwardRef(function Text(\n { id, text, width, margin }: Props,\n ref: Ref<BoxModelHandle & PropControllersHandle<Descriptors>>,\n) {\n const [editor, setEditor] = useState<Editor | null>(null)\n const [propControllers, setPropControllers] =\n useState<DescriptorsPropControllers<Descriptors> | null>(null)\n const controller = propControllers?.text\n\n useImperativeHandle(\n ref,\n () => ({\n getBoxModel() {\n const el = editor?.findDOMNode([])\n\n return el instanceof Element ? getBox(el) : null\n },\n setPropControllers,\n }),\n [editor, setPropControllers],\n )\n\n useEffect(() => {\n if (editor) controller?.setSlateEditor(editor)\n }, [controller, editor])\n\n /**\n * We must keep local state so that we can reflect the user's typed changes immediately. At the\n * same time, though, the source of truth for the data is the prop data. This presents a\n * challenge: how do we keep local state in sync with the prop data without mangling user input as\n * data comes in?\n *\n * Consider, for example, that the user types \"Hello\". If at a later time, when the user is trying\n * to type \", world\" the component re-renders with prop data \"H\", \"He\", \"Hel\", \"Hell\", \"Hello\", it\n * will disrupt the user's typing. This could also happen as a result of the prop data changing\n * for other reasons, like collaborators changing the prop data concurrently. We want to avoid to\n * disrupt the user's typing, while at the same time display the \"true\" value as quickly as\n * possible.\n *\n * The approach we take here is to commit the prop data at an opportune time: as the user is\n * typing we avoid to commit prop data. But once they've stopped typing, we commit it as soon as\n * possible. This is known as a debounce.\n */\n const [value, setValue] = useState(() => {\n const { selection, ...textWithoutSelection } = text ?? defaultText\n\n return Value.fromJSON(textWithoutSelection)\n })\n const [shouldCommit, setShouldCommit] = useState(true)\n\n useEffect(() => {\n if (shouldCommit) {\n const nextValue = Value.fromJSON(text ?? defaultText)\n\n setValue(currentValue =>\n currentValue.selection.isBlurred\n ? Value.fromJSON(nextValue.toJSON({ preserveSelection: false }))\n : nextValue,\n )\n }\n }, [shouldCommit, text])\n\n useEffect(() => {\n if (shouldCommit) return\n\n const timeoutId = window.setTimeout(() => {\n setShouldCommit(true)\n }, COMMIT_DEBOUNCE_DELAY)\n\n return () => {\n window.clearTimeout(timeoutId)\n }\n }, [shouldCommit])\n\n function handleChange(change: OnChangeParam) {\n setValue(change.value as Value)\n\n if (change.value !== value) {\n setShouldCommit(false)\n\n controller?.onChange(change)\n }\n }\n\n // HACK: Slate holds on to the very first DOM event handlers passed in and doesn't update them\n // even if they change. Since `controller` is first `undefined` then we must use a ref.\n const lastController = useRef(controller)\n if (lastController.current !== controller) lastController.current = controller\n const handleFocus = useCallback(() => {\n lastController.current?.focus()\n }, [])\n const handleKeyDown = useCallback(\n (event: ReactKeyboardEvent, _editor: Editor, next: () => any) => {\n if (Hotkeys.isUndo(event)) {\n lastController.current?.undo()\n\n return true\n }\n\n if (Hotkeys.isRedo(event)) {\n lastController.current?.redo()\n\n return true\n }\n\n if (isHotkey('escape')(event)) {\n lastController.current?.blur()\n\n return true\n }\n\n return next()\n },\n [],\n )\n const handleBlur = useCallback((event: ReactFocusEvent, _editor: Editor, next: () => any) => {\n // Normally, after a user highlight a text, clicking on the panel will remove the text selection.\n // This line is a workaround for that. Because the panel is not in the iframe, relatedTarget\n // would be null, and we return early so we don't remove the selection.\n if (event.relatedTarget == null) return true\n\n // Blur the selection if the user is clicking on other text.\n return next()\n }, [])\n\n const isInBuilder = useIsInBuilder()\n\n return (\n <StyledRichTextEditor\n // @ts-expect-error: types don't allow for 'id' prop even though it's used.\n id={id}\n ref={setEditor}\n width={width}\n readOnly={!isInBuilder}\n margin={margin}\n value={value}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n />\n )\n})\n\nexport default Text\n"],"names":["Span","styled","span","p","cssMediaRules","typographyStyle","color","fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","uppercase","underline","strikethrough","italic","css","colorToString","value","unit","Boolean","filter","join","shallowMergeFallbacks","restOfProps","useTypographyMark","TYPOGRAPHY_TYPE","renderMark","mark","children","_editor","next","type","data","get","StyledBlock","div","textAlign","as","forwardRef","ref","renderBlock","props","node","attributes","blockProps","StyledLink","Link","renderInline","toJS","RichTextEditor","placeholder","plugins","useMemo","Lists","Inlines","DeviceOverridesBlocks","DeviceOverridesMarks","SlateEditor","WebkitUserModify","undefined","StyledRichTextEditor","withConfig","shouldForwardProp","prop","includes","toString","cssWidth","cssMargin","defaultText","document","nodes","object","COMMIT_DEBOUNCE_DELAY","Text","id","text","width","margin","editor","setEditor","useState","propControllers","setPropControllers","controller","useImperativeHandle","getBoxModel","el","findDOMNode","Element","getBox","useEffect","setSlateEditor","setValue","selection","textWithoutSelection","Value","fromJSON","shouldCommit","setShouldCommit","nextValue","currentValue","isBlurred","toJSON","preserveSelection","timeoutId","window","setTimeout","clearTimeout","change","onChange","lastController","useRef","current","handleFocus","useCallback","focus","handleKeyDown","event","Hotkeys","isUndo","undo","isRedo","redo","isHotkey","blur","handleBlur","relatedTarget","isInBuilder","useIsInBuilder","handleChange"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BO,uBACL,cAC+B;AAC/B,QAAM,EAAE,OAAO,SAAS,SAAS,oBAAoB;AAAA,IACnD,MAAM,gBAAgB;AAAA,IACtB,WAAW,EAAE,KAAK,gBAAgB,OAAO,CAAC,YAAY,IAAI,GAAG;AAAA,EAAA,CAC9D;AAEG,MAAA,gBAAgB,QAAQ,SAAS;AAAa,WAAA;AAElD,SAAO,6BAAM,aAAa;AAC5B;ACVA,MAAM,SAAS,CAA2C,GAAM,MAAS,EAAE,OAAO,CAAC;AACnF,MAAM,cAAc,CAAC,EAAE,OAAO,EAAE,cAAmB,SAAS,MAAM;AAClE,MAAM,cAAc,CAAC,EAAE,eAAoB;AAE3C,MAAM,YACJ,CAAC,aACD,CAAC,OAAwD;AAAxD,eAAS,EAAP,OAAO,OAAT,IAAS,SAAE,YAAF,IAAY,wBAAZ,IAAY,CAAV,WAA4B,iBAAvC,IAAuC,CAArC;AAAsD,0CACpD,OADoD;AAAA,IAEvD,OAAO,kCACF,cACC,QACA;AAAA,MACE,OAAO;AAAA,QACL,QAAQ,SAAS,KAAK,CAAC,MAAW,KAAK,EAAE,OAAO,MAAM,QAAQ;AAAA,QAC9D,OAAO,MAAM;AAAA,MACf;AAAA,IAAA,IAEF,CAAC;AAAA,EAET;A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/components/RichTextEditor/components/Mark/hooks/useTypographyMark.ts","../src/components/builtin/Text/components/RichTextEditor/components/Mark/index.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesMarks.tsx","../src/components/builtin/Text/components/RichTextEditor/components/Block/index.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesBlocks.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/Link.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/Inlines.tsx","../src/components/builtin/Text/components/RichTextEditor/index.tsx","../src/components/builtin/Text/Text.tsx"],"sourcesContent":["import type { ColorValue } from '../utils/types'\nimport type { Length as LengthValue } from '../../prop-controllers'\nimport { DeviceOverride } from '../../prop-controllers'\nimport { TYPOGRAPHIES_BY_ID } from '../utils/queries'\nimport { useQuery } from '../../api/react'\n\nexport type TypographyStyleValue = {\n fontFamily?: string\n fontWeight?: number\n fontSize?: LengthValue\n color?: ColorValue\n textAlign?: string\n lineHeight?: number\n letterSpacing?: number\n uppercase?: boolean\n underline?: boolean\n strikethrough?: boolean\n italic?: boolean\n}\n\nexport type TypographyStyle = Array<DeviceOverride<TypographyStyleValue>>\n\nexport type Typography = {\n id: string\n name: string\n style: TypographyStyle\n}\n\nexport function useTypography(\n typographyId: string | null | undefined,\n): Typography | null | undefined {\n const { error, data } = useQuery(TYPOGRAPHIES_BY_ID, {\n skip: typographyId == null,\n variables: { ids: typographyId != null ? [typographyId] : [] },\n })\n\n if (typographyId == null || error != null) return null\n\n return data?.typographies[0] as Typography | null\n}\n","import { Length as LengthValue } from '../../../../../../../../prop-controllers'\nimport { ColorValue as Color } from '../../../../../../../utils/types'\nimport { findDeviceOverride } from '../../../../../../../utils/devices'\nimport type { DeviceOverride } from '../../../../../../../../prop-controllers'\nimport { SWATCHES_BY_ID } from '../../../../../../../utils/queries'\nimport { useTypography, TypographyStyle } from '../../../../../../../hooks/useTypography'\nimport { useQuery } from '../../../../../../../../api/react'\n\nexport type TypographyMarkDataValue = {\n fontWeight?: number\n fontSize?: LengthValue\n fontFamily?: string\n color?: Color\n textAlign?: string\n lineHeight?: number\n letterSpacing?: number\n uppercase?: boolean\n italic?: boolean\n underline?: boolean\n strikethrough?: boolean\n}\n\nexport type TypographyMarkValue = {\n id: string | null | undefined\n style: TypographyStyle\n}\n\nexport type TypographyMarkData = Array<DeviceOverride<TypographyMarkDataValue>>\n\nconst concat = <A extends unknown[], B extends unknown[]>(a: A, b: B) => a.concat(b)\nconst getSwatchId = ({ value: { color } }: any) => color && color.swatchId\nconst getDeviceId = ({ deviceId }: any) => deviceId\n\nconst withColor =\n (swatches: any) =>\n ({ value: { color, ...restOfValue }, ...rest }: any) => ({\n ...rest,\n value: {\n ...restOfValue,\n ...(color\n ? {\n color: {\n swatch: swatches.find((s: any) => s && s.id === color.swatchId),\n alpha: color.alpha,\n },\n }\n : {}),\n },\n })\n\nexport const overrideTypographyStyle = <A>(\n source: Array<DeviceOverride<A>>,\n override: Array<DeviceOverride<A>>,\n): Array<DeviceOverride<A>> => {\n const devices = [...new Set(source.map(getDeviceId).concat(override.map(getDeviceId)))]\n\n return devices.map((deviceId: any) => ({\n deviceId,\n value: {\n ...(findDeviceOverride(source, deviceId) || { value: {} }).value,\n ...(findDeviceOverride(override, deviceId, v => v) || { value: {} }).value,\n },\n })) as DeviceOverride<A>[]\n}\n\nexport default function useTypographyMark(\n value: TypographyMarkValue | null | undefined,\n): TypographyMarkData | null | undefined {\n const typography = useTypography(value && value.id)\n\n const swatchIds = [\n (typography && typography.style.map(getSwatchId)) || [],\n (value && value.style.map(getSwatchId)) || [],\n ]\n .reduce(concat)\n .filter(Boolean)\n\n const { error: colorError, data: colorData = {} } = useQuery(SWATCHES_BY_ID, {\n skip: swatchIds == null || swatchIds.length === 0,\n variables: { ids: swatchIds },\n })\n\n const { swatches = [] } = colorData\n\n if (colorError != null) return null\n\n return overrideTypographyStyle(\n (typography && typography.style.map(withColor(swatches))) || [],\n (value && value.style.map(withColor(swatches))) || [],\n )\n}\n","import { ComponentPropsWithoutRef } from 'react'\nimport styled, { css } from 'styled-components'\n\nimport useTypographyMark, {\n TypographyMarkValue,\n TypographyMarkData,\n overrideTypographyStyle,\n TypographyMarkDataValue,\n} from './hooks/useTypographyMark'\nimport { cssMediaRules } from '../../../../../../utils/cssMediaRules'\nimport { colorToString } from '../../../../../../utils/colorToString'\nimport { shallowMergeFallbacks } from '../../../../../../utils/devices'\n\nexport type { TypographyMarkValue }\nexport { overrideTypographyStyle }\n\nconst Span = styled.span<{ typographyStyle: TypographyMarkData | null | undefined }>`\n ${p =>\n cssMediaRules(\n [p.typographyStyle] as const,\n ([\n {\n color,\n fontFamily,\n fontSize,\n fontWeight,\n lineHeight,\n letterSpacing,\n uppercase,\n underline,\n strikethrough,\n italic,\n } = {} as TypographyMarkDataValue,\n ]) => css`\n ${color == null\n ? ''\n : css`\n color: ${colorToString(color)};\n `}\n\n ${fontFamily == null\n ? ''\n : css`\n font-family: '${fontFamily}';\n `}\n\n ${fontSize == null || fontSize.value == null || fontSize.unit == null\n ? ''\n : css`\n font-size: ${`${fontSize.value}${fontSize.unit}`};\n `}\n\n ${fontWeight == null\n ? ''\n : css`\n font-weight: ${fontWeight};\n `}\n\n ${lineHeight == null\n ? ''\n : css`\n line-height: ${lineHeight};\n `}\n\n ${letterSpacing == null\n ? ''\n : css`\n letter-spacing: ${letterSpacing / 10}em;\n `}\n\n ${underline == null && strikethrough == null\n ? ''\n : css`\n text-decoration: ${[\n Boolean(underline) && 'underline',\n Boolean(strikethrough) && 'line-through',\n ]\n .filter(Boolean)\n .join(' ')};\n `}\n\n ${uppercase == null\n ? ''\n : css`\n text-transform: ${uppercase === true ? 'uppercase' : 'initial'};\n `}\n\n ${italic == null\n ? ''\n : css`\n font-style: ${italic === true ? 'italic' : 'initial'};\n `}\n `,\n shallowMergeFallbacks,\n )}\n`\n\ntype BaseProps = { value: TypographyMarkValue }\n\ntype Props = BaseProps & Omit<ComponentPropsWithoutRef<typeof Span>, keyof BaseProps>\n\nexport default function Mark({ value, ...restOfProps }: Props): JSX.Element {\n const typographyStyle = useTypographyMark(value)\n\n return <Span {...restOfProps} typographyStyle={typographyStyle} />\n}\n","import type { Plugin } from 'slate-react'\n\nimport Mark from '../components/Mark'\n\nconst TYPOGRAPHY_TYPE = 'typography'\n\nexport default function DeviceOverridesMarksPlugin(): Plugin {\n return {\n renderMark({ mark, children }, _editor, next) {\n if (mark.type === TYPOGRAPHY_TYPE) {\n return <Mark value={mark.data.get('value')}>{children}</Mark>\n }\n\n return next()\n },\n }\n}\n","import { forwardRef, ElementType, ComponentPropsWithoutRef } from 'react'\nimport styled, { css } from 'styled-components'\n\nimport { cssMediaRules } from '../../../../../../utils/cssMediaRules'\nimport type { ResponsiveValue } from '../../../../../../../prop-controllers'\n\ntype StyledBlockProps = {\n textAlign?: ResponsiveValue<'left' | 'center' | 'right' | 'justify'>\n as?: ElementType\n}\n\nconst StyledBlock = styled.div<StyledBlockProps>`\n margin: 0;\n ${p =>\n cssMediaRules([p.textAlign] as const, ([textAlign]) =>\n textAlign == null\n ? css``\n : css`\n text-align: ${textAlign};\n `,\n )}\n\n ${p =>\n p.as === 'blockquote'\n ? css`\n padding: 0.5em 10px;\n font-size: 1.25em;\n font-weight: 300;\n border-left: 5px solid rgba(0, 0, 0, 0.1);\n `\n : ''}\n`\n\ntype Props = ComponentPropsWithoutRef<typeof StyledBlock>\n\nexport default forwardRef<HTMLDivElement, Props>(function Block(\n { textAlign, ...restOfProps }: Props,\n ref,\n) {\n return <StyledBlock {...restOfProps} ref={ref} textAlign={textAlign} />\n})\n","import { Plugin } from 'slate-react'\n\nimport Block from '../components/Block'\n\nexport default function DeviceOverridesBlockPlugin(): Plugin {\n return {\n renderBlock(props, _editor, next): JSX.Element {\n const { node, attributes, children } = props\n const blockProps = { textAlign: node.data.get('textAlign') }\n\n switch (node.type) {\n case 'paragraph':\n return (\n <Block {...attributes} {...blockProps} as=\"p\">\n {children}\n </Block>\n )\n\n case 'heading-one':\n return (\n <Block {...attributes} {...blockProps} as=\"h1\">\n {children}\n </Block>\n )\n\n case 'heading-two':\n return (\n <Block {...attributes} {...blockProps} as=\"h2\">\n {children}\n </Block>\n )\n\n case 'heading-three':\n return (\n <Block {...attributes} {...blockProps} as=\"h3\">\n {children}\n </Block>\n )\n\n case 'heading-four':\n return (\n <Block {...attributes} {...blockProps} as=\"h4\">\n {children}\n </Block>\n )\n\n case 'heading-five':\n return (\n <Block {...attributes} {...blockProps} as=\"h5\">\n {children}\n </Block>\n )\n\n case 'heading-six':\n return (\n <Block {...attributes} {...blockProps} as=\"h6\">\n {children}\n </Block>\n )\n\n case 'blockquote':\n return (\n <Block {...attributes} {...blockProps} as=\"blockquote\">\n {children}\n </Block>\n )\n\n default:\n return next()\n }\n },\n }\n}\n","import { Plugin } from 'slate-react'\nimport styled from 'styled-components'\n\nimport { Link } from '../../../../../shared/Link'\n\nconst StyledLink = styled(Link)`\n text-decoration: none;\n`\n\nexport default function LinkPlugin(): Plugin {\n return {\n renderInline(props, _editor, next) {\n const { attributes, children, node } = props\n\n switch (node.type) {\n case 'link': {\n const { data } = node\n\n return (\n <StyledLink {...attributes} link={data.toJS()}>\n {children}\n </StyledLink>\n )\n }\n\n default: {\n return next()\n }\n }\n },\n }\n}\n","import { Plugin } from 'slate-react'\n\nexport default function Inlines(): Plugin {\n return {\n renderInline(props, _editor, next) {\n const { attributes, children, node } = props\n\n switch (node.type) {\n case 'code': {\n return <code {...attributes}>{children}</code>\n }\n\n case 'superscript': {\n return <sup {...attributes}>{children}</sup>\n }\n\n case 'subscript': {\n return <sub {...attributes}>{children}</sub>\n }\n\n default: {\n return next()\n }\n }\n },\n }\n}\n","import { ComponentPropsWithoutRef, forwardRef, useMemo } from 'react'\n\nimport { Editor as SlateEditor } from 'slate-react'\n\n// @ts-expect-error: no types for '@convertkit/slate-lists'\nimport Lists from '@convertkit/slate-lists'\nimport styled from 'styled-components'\n\nimport DeviceOverridesMarks from './plugins/DeviceOverridesMarks'\nimport DeviceOverridesBlocks from './plugins/DeviceOverridesBlocks'\nimport Link from './plugins/Link'\nimport Inlines from './plugins/Inlines'\n\nexport { overrideTypographyStyle } from './components/Mark'\n\ntype Props = ComponentPropsWithoutRef<typeof SlateEditor>\n\nexport const RichTextEditor = styled(\n forwardRef<SlateEditor, Props>(function RichTextEditor(\n { placeholder = 'Write some text...', ...restOfProps }: Props,\n ref,\n ) {\n const plugins = useMemo(\n () => [Lists(), Link(), Inlines(), DeviceOverridesBlocks(), DeviceOverridesMarks()],\n [],\n )\n\n return (\n <SlateEditor\n {...restOfProps}\n // Workaround because our Slate editor is broken on Chrome 105\n // Problem: https://linear.app/makeswift/issue/PRD-434/our-rich-text-component-breaks-in-the-latest-version-of-chrome\n // Workaround: https://github.com/ianstormtaylor/slate/issues/5110#issuecomment-1234951122\n style={{ WebkitUserModify: undefined }}\n ref={ref}\n autoFocus={false}\n plugins={plugins}\n placeholder={placeholder}\n />\n )\n }),\n)`\n ul,\n ol {\n margin: 0;\n }\n`\n","import {\n useState,\n Ref,\n useImperativeHandle,\n forwardRef,\n useEffect,\n useCallback,\n useRef,\n KeyboardEvent as ReactKeyboardEvent,\n FocusEvent as ReactFocusEvent,\n} from 'react'\nimport styled from 'styled-components'\nimport { Editor, OnChangeParam } from 'slate-react'\nimport { Value, ValueJSON } from 'slate'\n// @ts-expect-error: no types for 'slate-hotkeys'\nimport Hotkeys from 'slate-hotkeys'\nimport { isHotkey } from 'is-hotkey'\n\nimport {\n ElementIDValue,\n MarginValue,\n RichTextDescriptor,\n RichTextValue,\n WidthValue,\n} from '../../../prop-controllers/descriptors'\nimport { cssMargin, cssWidth } from '../../utils/cssMediaRules'\nimport { BoxModelHandle, getBox } from '../../../box-model'\nimport { PropControllersHandle } from '../../../state/modules/prop-controller-handles'\nimport { RichTextEditor } from './components/RichTextEditor'\nimport { useIsInBuilder } from '../../../runtimes/react'\nimport { DescriptorsPropControllers } from '../../../prop-controllers/instances'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: WidthValue\n margin?: MarginValue\n}\n\nconst StyledRichTextEditor = styled(RichTextEditor).withConfig({\n shouldForwardProp: prop => !['width', 'margin'].includes(prop.toString()),\n})<{ width: Props['width']; margin: Props['margin'] }>`\n ${cssWidth()}\n ${cssMargin()}\n`\n\nconst defaultText: ValueJSON = {\n document: { nodes: [{ object: 'block' as const, type: 'paragraph' as const, nodes: [] }] },\n data: {},\n}\n\nconst COMMIT_DEBOUNCE_DELAY = 500\n\ntype Descriptors = { text?: RichTextDescriptor }\n\nconst Text = forwardRef(function Text(\n { id, text, width, margin }: Props,\n ref: Ref<BoxModelHandle & PropControllersHandle<Descriptors>>,\n) {\n const [editor, setEditor] = useState<Editor | null>(null)\n const [propControllers, setPropControllers] =\n useState<DescriptorsPropControllers<Descriptors> | null>(null)\n const controller = propControllers?.text\n\n useImperativeHandle(\n ref,\n () => ({\n getBoxModel() {\n const el = editor?.findDOMNode([])\n\n return el instanceof Element ? getBox(el) : null\n },\n setPropControllers,\n }),\n [editor, setPropControllers],\n )\n\n useEffect(() => {\n if (editor) controller?.setSlateEditor(editor)\n }, [controller, editor])\n\n /**\n * We must keep local state so that we can reflect the user's typed changes immediately. At the\n * same time, though, the source of truth for the data is the prop data. This presents a\n * challenge: how do we keep local state in sync with the prop data without mangling user input as\n * data comes in?\n *\n * Consider, for example, that the user types \"Hello\". If at a later time, when the user is trying\n * to type \", world\" the component re-renders with prop data \"H\", \"He\", \"Hel\", \"Hell\", \"Hello\", it\n * will disrupt the user's typing. This could also happen as a result of the prop data changing\n * for other reasons, like collaborators changing the prop data concurrently. We want to avoid to\n * disrupt the user's typing, while at the same time display the \"true\" value as quickly as\n * possible.\n *\n * The approach we take here is to commit the prop data at an opportune time: as the user is\n * typing we avoid to commit prop data. But once they've stopped typing, we commit it as soon as\n * possible. This is known as a debounce.\n */\n const [value, setValue] = useState(() => {\n const { selection, ...textWithoutSelection } = text ?? defaultText\n\n return Value.fromJSON(textWithoutSelection)\n })\n const [shouldCommit, setShouldCommit] = useState(true)\n\n useEffect(() => {\n if (shouldCommit) {\n const nextValue = Value.fromJSON(text ?? defaultText)\n\n setValue(currentValue =>\n currentValue.selection.isBlurred\n ? Value.fromJSON(nextValue.toJSON({ preserveSelection: false }))\n : nextValue,\n )\n }\n }, [shouldCommit, text])\n\n useEffect(() => {\n if (shouldCommit) return\n\n const timeoutId = window.setTimeout(() => {\n setShouldCommit(true)\n }, COMMIT_DEBOUNCE_DELAY)\n\n return () => {\n window.clearTimeout(timeoutId)\n }\n }, [shouldCommit])\n\n function handleChange(change: OnChangeParam) {\n setValue(change.value as Value)\n\n if (change.value !== value) {\n setShouldCommit(false)\n\n controller?.onChange(change)\n }\n }\n\n // HACK: Slate holds on to the very first DOM event handlers passed in and doesn't update them\n // even if they change. Since `controller` is first `undefined` then we must use a ref.\n const lastController = useRef(controller)\n if (lastController.current !== controller) lastController.current = controller\n const handleFocus = useCallback(() => {\n lastController.current?.focus()\n }, [])\n const handleKeyDown = useCallback(\n (event: ReactKeyboardEvent, _editor: Editor, next: () => any) => {\n if (Hotkeys.isUndo(event)) {\n lastController.current?.undo()\n\n return true\n }\n\n if (Hotkeys.isRedo(event)) {\n lastController.current?.redo()\n\n return true\n }\n\n if (isHotkey('escape')(event)) {\n lastController.current?.blur()\n\n return true\n }\n\n return next()\n },\n [],\n )\n const handleBlur = useCallback((event: ReactFocusEvent, _editor: Editor, next: () => any) => {\n // Normally, after a user highlight a text, clicking on the panel will remove the text selection.\n // This line is a workaround for that. Because the panel is not in the iframe, relatedTarget\n // would be null, and we return early so we don't remove the selection.\n if (event.relatedTarget == null) return true\n\n // Blur the selection if the user is clicking on other text.\n return next()\n }, [])\n\n const isInBuilder = useIsInBuilder()\n\n return (\n <StyledRichTextEditor\n // @ts-expect-error: types don't allow for 'id' prop even though it's used.\n id={id}\n ref={setEditor}\n width={width}\n readOnly={!isInBuilder}\n margin={margin}\n value={value}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n />\n )\n})\n\nexport default Text\n"],"names":["Span","styled","span","p","cssMediaRules","typographyStyle","color","fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","uppercase","underline","strikethrough","italic","css","colorToString","value","unit","Boolean","filter","join","shallowMergeFallbacks","restOfProps","useTypographyMark","TYPOGRAPHY_TYPE","renderMark","mark","children","_editor","next","type","data","get","StyledBlock","div","textAlign","as","forwardRef","ref","renderBlock","props","node","attributes","blockProps","StyledLink","Link","renderInline","toJS","RichTextEditor","placeholder","plugins","useMemo","Lists","Inlines","DeviceOverridesBlocks","DeviceOverridesMarks","SlateEditor","WebkitUserModify","undefined","StyledRichTextEditor","withConfig","shouldForwardProp","prop","includes","toString","cssWidth","cssMargin","defaultText","document","nodes","object","COMMIT_DEBOUNCE_DELAY","Text","id","text","width","margin","editor","setEditor","useState","propControllers","setPropControllers","controller","useImperativeHandle","getBoxModel","el","findDOMNode","Element","getBox","useEffect","setSlateEditor","setValue","selection","textWithoutSelection","Value","fromJSON","shouldCommit","setShouldCommit","nextValue","currentValue","isBlurred","toJSON","preserveSelection","timeoutId","window","setTimeout","clearTimeout","change","onChange","lastController","useRef","current","handleFocus","useCallback","focus","handleKeyDown","event","Hotkeys","isUndo","undo","isRedo","redo","isHotkey","blur","handleBlur","relatedTarget","isInBuilder","useIsInBuilder","handleChange"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BO,uBACL,cAC+B;AAC/B,QAAM,EAAE,OAAO,SAAS,SAAS,oBAAoB;AAAA,IACnD,MAAM,gBAAgB;AAAA,IACtB,WAAW,EAAE,KAAK,gBAAgB,OAAO,CAAC,YAAY,IAAI,GAAG;AAAA,EAAA,CAC9D;AAEG,MAAA,gBAAgB,QAAQ,SAAS;AAAa,WAAA;AAElD,SAAO,6BAAM,aAAa;AAC5B;ACVA,MAAM,SAAS,CAA2C,GAAM,MAAS,EAAE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AwBjC,QAAM+F,aAAaX,YAAY,CAACG,OAAwBxF,SAAiBC,SAAoB;AAIvFuF,QAAAA,MAAMS,iBAAiB;AAAa,aAAA;AAGxC,WAAOhG,KAAP;AAAA,EAP4B,GAQ3B,CAR2B,CAAA;AAUxBiG,QAAAA,cAAcC;AAGlB,6BAAC,sBAAD;AAAA,IAEE;AAAA,IACA,KAAKjD;AAAAA,IACL;AAAA,IACA,UAAU,CAACgD;AAAAA,IACX;AAAA,IACA;AAAA,IACA,UAAUE;AAAAA,IACV,SAAShB;AAAAA,IACT,WAAWG;AAAAA,IACX,QAAQS;AAAAA,EAAAA,CAZZ;AAeD,CA9IsB;;"}
package/dist/Video.cjs.js CHANGED
@@ -31,10 +31,9 @@ require("./react-page.cjs.js");
31
31
  require("redux");
32
32
  require("redux-thunk");
33
33
  require("./actions.cjs.js");
34
- require("./descriptors.cjs.js");
35
- require("./style.cjs.js");
36
- require("./color.cjs.js");
37
34
  require("./image.cjs.js");
35
+ require("./color.cjs.js");
36
+ require("./slot.cjs.js");
38
37
  require("next/dynamic");
39
38
  require("next/document");
40
39
  require("slate");
@@ -47,6 +46,8 @@ require("./text-input.cjs.js");
47
46
  require("./shape.cjs.js");
48
47
  require("color");
49
48
  require("scroll-into-view-if-needed");
49
+ require("./box-models.cjs.js");
50
+ require("css-box-model");
50
51
  require("react-dom");
51
52
  require("html-react-parser");
52
53
  require("next/head");
@@ -1 +1 @@
1
- {"version":3,"file":"Video.cjs.js","sources":["../src/components/builtin/Video/Video.tsx"],"sourcesContent":["import { forwardRef, Ref } from 'react'\nimport styled from 'styled-components'\nimport ReactPlayer from 'react-player'\n\nimport {\n BorderRadiusValue,\n ElementIDValue,\n MarginValue,\n VideoValue,\n WidthValue,\n} from '../../../prop-controllers/descriptors'\nimport { cssBorderRadius, cssMargin, cssWidth } from '../../utils/cssMediaRules'\nimport { placeholders } from '../../utils/placeholders'\n\ntype Props = {\n id?: ElementIDValue\n video?: VideoValue\n width?: WidthValue\n margin?: MarginValue\n borderRadius?: BorderRadiusValue\n}\n\nconst Container = styled.div.withConfig({\n shouldForwardProp: prop => !['width', 'margin', 'borderRadius'].includes(prop.toString()),\n})<{ width: Props['width']; margin: Props['margin']; borderRadius: Props['borderRadius'] }>`\n display: flex;\n flex-direction: column;\n overflow: hidden;\n ${cssWidth('560px')}\n ${cssMargin()}\n ${cssBorderRadius()}\n`\n\nconst ASPECT_RATIO = 16 / 9\n\nconst Video = forwardRef(function Video(\n { id, video, width, margin, borderRadius }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const canPlayUrl = video && video.url != null && ReactPlayer.canPlay(video.url)\n\n return (\n <Container ref={ref} id={id} width={width} margin={margin} borderRadius={borderRadius}>\n <div style={{ position: 'relative', paddingTop: `${100 / ASPECT_RATIO}%` }}>\n <div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>\n {canPlayUrl === true ? (\n <ReactPlayer\n {...video}\n width=\"100%\"\n height=\"100%\"\n config={{\n vimeo: { playerOptions: { background: video != null && !video.controls } },\n wistia: {\n options: {\n endVideoBehavior: video != null && video.loop === true ? 'loop' : 'default',\n },\n },\n }}\n />\n ) : (\n <img width=\"100%\" src={placeholders.video.src} alt=\"Video Placeholder\" />\n )}\n </div>\n </div>\n </Container>\n )\n})\n\nexport default Video\n"],"names":["Container","styled","div","withConfig","shouldForwardProp","prop","includes","toString","cssWidth","cssMargin","cssBorderRadius","ASPECT_RATIO","Video","forwardRef","id","video","width","margin","borderRadius","ref","canPlayUrl","url","ReactPlayer","canPlay","position","paddingTop","top","left","right","bottom","_jsx","vimeo","playerOptions","background","controls","wistia","options","endVideoBehavior","loop","placeholders","src"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,YAAYC,gBAAAA,WAAOC,IAAIC,WAAW;AAAA,EACtCC,mBAAmBC,CAAQ,SAAA,CAAC,CAAC,SAAS,UAAU,cAApB,EAAoCC,S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AAAA,MAAA,CAhBJ;AAAA,IAAA,CADF;AAAA,EAAA,CAFJ;AAyBD,CA/BuB;;"}
1
+ {"version":3,"file":"Video.cjs.js","sources":["../src/components/builtin/Video/Video.tsx"],"sourcesContent":["import { forwardRef, Ref } from 'react'\nimport styled from 'styled-components'\nimport ReactPlayer from 'react-player'\n\nimport {\n BorderRadiusValue,\n ElementIDValue,\n MarginValue,\n VideoValue,\n WidthValue,\n} from '../../../prop-controllers/descriptors'\nimport { cssBorderRadius, cssMargin, cssWidth } from '../../utils/cssMediaRules'\nimport { placeholders } from '../../utils/placeholders'\n\ntype Props = {\n id?: ElementIDValue\n video?: VideoValue\n width?: WidthValue\n margin?: MarginValue\n borderRadius?: BorderRadiusValue\n}\n\nconst Container = styled.div.withConfig({\n shouldForwardProp: prop => !['width', 'margin', 'borderRadius'].includes(prop.toString()),\n})<{ width: Props['width']; margin: Props['margin']; borderRadius: Props['borderRadius'] }>`\n display: flex;\n flex-direction: column;\n overflow: hidden;\n ${cssWidth('560px')}\n ${cssMargin()}\n ${cssBorderRadius()}\n`\n\nconst ASPECT_RATIO = 16 / 9\n\nconst Video = forwardRef(function Video(\n { id, video, width, margin, borderRadius }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const canPlayUrl = video && video.url != null && ReactPlayer.canPlay(video.url)\n\n return (\n <Container ref={ref} id={id} width={width} margin={margin} borderRadius={borderRadius}>\n <div style={{ position: 'relative', paddingTop: `${100 / ASPECT_RATIO}%` }}>\n <div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>\n {canPlayUrl === true ? (\n <ReactPlayer\n {...video}\n width=\"100%\"\n height=\"100%\"\n config={{\n vimeo: { playerOptions: { background: video != null && !video.controls } },\n wistia: {\n options: {\n endVideoBehavior: video != null && video.loop === true ? 'loop' : 'default',\n },\n },\n }}\n />\n ) : (\n <img width=\"100%\" src={placeholders.video.src} alt=\"Video Placeholder\" />\n )}\n </div>\n </div>\n </Container>\n )\n})\n\nexport default Video\n"],"names":["Container","styled","div","withConfig","shouldForwardProp","prop","includes","toString","cssWidth","cssMargin","cssBorderRadius","ASPECT_RATIO","Video","forwardRef","id","video","width","margin","borderRadius","ref","canPlayUrl","url","ReactPlayer","canPlay","position","paddingTop","top","left","right","bottom","_jsx","vimeo","playerOptions","background","controls","wistia","options","endVideoBehavior","loop","placeholders","src"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,YAAYC,gBAAAA,WAAOC,IAAIC,WAAW;AAAA,EACtCC,mBAAmBC,CAAQ,SAAA,CAAC,CAAC,SAAS,UAAU,cAApB,EAAoCC,SAASD,KAAKE,UAAlD;AADU,CAAtB;AAAA;AAAA;AAAA;AAAA,IAMdC,cAAAA,SAAS,OAAD;AAAA,IACRC,cAAY,UAAA;AAAA,IACZC,cAAkB,gBAAA;AAAA;AAGtB,MAAMC,eAAe,KAAK;AAEpBC,MAAAA,QAAQC,MAAAA,WAAW,gBACvB;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAOC;AAAAA,EAAOC;AAAAA,EAAQC;AAAAA,GAC5BC,KACA;AACMC,QAAAA,aAAaL,SAASA,MAAMM,OAAO,QAAQC,qBAAAA,WAAYC,QAAQR,MAAMM,GAA1B;AAEjD,wCACG,WAAD;AAAA,IAAW;AAAA,IAAU;AAAA,IAAQ;AAAA,IAAc;AAAA,IAAgB;AAAA,IACzD,yCAAA,OAAA;AAAA,MAAK,OAAO;AAAA,QAAEG,UAAU;AAAA,QAAYC,YAAa,GAAE,MAAMd;AAAAA,MAAzD;AAAA,MACE,yCAAA,OAAA;AAAA,QAAK,OAAO;AAAA,UAAEa,UAAU;AAAA,UAAYE,KAAK;AAAA,UAAGC,MAAM;AAAA,UAAGC,OAAO;AAAA,UAAGC,QAAQ;AAAA,QAAvE;AAAA,QAAA,UACGT,eAAe,OACdU,2BAAAA,IAACR,qBAAAA,6CACKP;UACJ,OAAM;AAAA,UACN,QAAO;AAAA,UACP,QAAQ;AAAA,YACNgB,OAAO;AAAA,cAAEC,eAAe;AAAA,gBAAEC,YAAYlB,SAAS,QAAQ,CAACA,MAAMmB;AAAAA,cAAtC;AAAA,YADlB;AAAA,YAENC,QAAQ;AAAA,cACNC,SAAS;AAAA,gBACPC,kBAAkBtB,SAAS,QAAQA,MAAMuB,SAAS,OAAO,SAAS;AAAA,cAD3D;AAAA,YADH;AAAA,UAFF;AAAA,QAAA,EAJV,IAcAR,2BAAA,IAAA,OAAA;AAAA,UAAK,OAAM;AAAA,UAAO,KAAKS,aAAAA,aAAaxB,MAAMyB;AAAAA,UAAK,KAAI;AAAA,QAAA,CAAnD;AAAA,MAAA,CAhBJ;AAAA,IAAA,CADF;AAAA,EAAA,CAFJ;AAyBD,CA/BuB;;"}
package/dist/Video.es.js CHANGED
@@ -29,10 +29,9 @@ import "./react-page.es.js";
29
29
  import "redux";
30
30
  import "redux-thunk";
31
31
  import "./actions.es.js";
32
- import "./descriptors.es.js";
33
- import "./style.es.js";
34
- import "./color.es.js";
35
32
  import "./image.es.js";
33
+ import "./color.es.js";
34
+ import "./slot.es.js";
36
35
  import "next/dynamic";
37
36
  import "next/document";
38
37
  import "slate";
@@ -45,6 +44,8 @@ import "./text-input.es.js";
45
44
  import "./shape.es.js";
46
45
  import "color";
47
46
  import "scroll-into-view-if-needed";
47
+ import "./box-models.es.js";
48
+ import "css-box-model";
48
49
  import "react-dom";
49
50
  import "html-react-parser";
50
51
  import "next/head";
@@ -1 +1 @@
1
- {"version":3,"file":"Video.es.js","sources":["../src/components/builtin/Video/Video.tsx"],"sourcesContent":["import { forwardRef, Ref } from 'react'\nimport styled from 'styled-components'\nimport ReactPlayer from 'react-player'\n\nimport {\n BorderRadiusValue,\n ElementIDValue,\n MarginValue,\n VideoValue,\n WidthValue,\n} from '../../../prop-controllers/descriptors'\nimport { cssBorderRadius, cssMargin, cssWidth } from '../../utils/cssMediaRules'\nimport { placeholders } from '../../utils/placeholders'\n\ntype Props = {\n id?: ElementIDValue\n video?: VideoValue\n width?: WidthValue\n margin?: MarginValue\n borderRadius?: BorderRadiusValue\n}\n\nconst Container = styled.div.withConfig({\n shouldForwardProp: prop => !['width', 'margin', 'borderRadius'].includes(prop.toString()),\n})<{ width: Props['width']; margin: Props['margin']; borderRadius: Props['borderRadius'] }>`\n display: flex;\n flex-direction: column;\n overflow: hidden;\n ${cssWidth('560px')}\n ${cssMargin()}\n ${cssBorderRadius()}\n`\n\nconst ASPECT_RATIO = 16 / 9\n\nconst Video = forwardRef(function Video(\n { id, video, width, margin, borderRadius }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const canPlayUrl = video && video.url != null && ReactPlayer.canPlay(video.url)\n\n return (\n <Container ref={ref} id={id} width={width} margin={margin} borderRadius={borderRadius}>\n <div style={{ position: 'relative', paddingTop: `${100 / ASPECT_RATIO}%` }}>\n <div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>\n {canPlayUrl === true ? (\n <ReactPlayer\n {...video}\n width=\"100%\"\n height=\"100%\"\n config={{\n vimeo: { playerOptions: { background: video != null && !video.controls } },\n wistia: {\n options: {\n endVideoBehavior: video != null && video.loop === true ? 'loop' : 'default',\n },\n },\n }}\n />\n ) : (\n <img width=\"100%\" src={placeholders.video.src} alt=\"Video Placeholder\" />\n )}\n </div>\n </div>\n </Container>\n )\n})\n\nexport default Video\n"],"names":["Container","styled","div","withConfig","shouldForwardProp","prop","includes","toString","cssWidth","cssMargin","cssBorderRadius","ASPECT_RATIO","Video","forwardRef","id","video","width","margin","borderRadius","ref","canPlayUrl","url","ReactPlayer","canPlay","position","paddingTop","top","left","right","bottom","_jsx","vimeo","playerOptions","background","controls","wistia","options","endVideoBehavior","loop","placeholders","src"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,YAAYC,OAAOC,IAAIC,WAAW;AAAA,EACtCC,mBAAmBC,CAAQ,SAA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AAA,IAAA,CADF;AAAA,EAAA,CAFJ;AAyBD,CA/BuB;;"}
1
+ {"version":3,"file":"Video.es.js","sources":["../src/components/builtin/Video/Video.tsx"],"sourcesContent":["import { forwardRef, Ref } from 'react'\nimport styled from 'styled-components'\nimport ReactPlayer from 'react-player'\n\nimport {\n BorderRadiusValue,\n ElementIDValue,\n MarginValue,\n VideoValue,\n WidthValue,\n} from '../../../prop-controllers/descriptors'\nimport { cssBorderRadius, cssMargin, cssWidth } from '../../utils/cssMediaRules'\nimport { placeholders } from '../../utils/placeholders'\n\ntype Props = {\n id?: ElementIDValue\n video?: VideoValue\n width?: WidthValue\n margin?: MarginValue\n borderRadius?: BorderRadiusValue\n}\n\nconst Container = styled.div.withConfig({\n shouldForwardProp: prop => !['width', 'margin', 'borderRadius'].includes(prop.toString()),\n})<{ width: Props['width']; margin: Props['margin']; borderRadius: Props['borderRadius'] }>`\n display: flex;\n flex-direction: column;\n overflow: hidden;\n ${cssWidth('560px')}\n ${cssMargin()}\n ${cssBorderRadius()}\n`\n\nconst ASPECT_RATIO = 16 / 9\n\nconst Video = forwardRef(function Video(\n { id, video, width, margin, borderRadius }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const canPlayUrl = video && video.url != null && ReactPlayer.canPlay(video.url)\n\n return (\n <Container ref={ref} id={id} width={width} margin={margin} borderRadius={borderRadius}>\n <div style={{ position: 'relative', paddingTop: `${100 / ASPECT_RATIO}%` }}>\n <div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>\n {canPlayUrl === true ? (\n <ReactPlayer\n {...video}\n width=\"100%\"\n height=\"100%\"\n config={{\n vimeo: { playerOptions: { background: video != null && !video.controls } },\n wistia: {\n options: {\n endVideoBehavior: video != null && video.loop === true ? 'loop' : 'default',\n },\n },\n }}\n />\n ) : (\n <img width=\"100%\" src={placeholders.video.src} alt=\"Video Placeholder\" />\n )}\n </div>\n </div>\n </Container>\n )\n})\n\nexport default Video\n"],"names":["Container","styled","div","withConfig","shouldForwardProp","prop","includes","toString","cssWidth","cssMargin","cssBorderRadius","ASPECT_RATIO","Video","forwardRef","id","video","width","margin","borderRadius","ref","canPlayUrl","url","ReactPlayer","canPlay","position","paddingTop","top","left","right","bottom","_jsx","vimeo","playerOptions","background","controls","wistia","options","endVideoBehavior","loop","placeholders","src"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,YAAYC,OAAOC,IAAIC,WAAW;AAAA,EACtCC,mBAAmBC,CAAQ,SAAA,CAAC,CAAC,SAAS,UAAU,cAApB,EAAoCC,SAASD,KAAKE,UAAlD;AADU,CAAtB;AAAA;AAAA;AAAA;AAAA,IAMdC,SAAS,OAAD;AAAA,IACRC,UAAY;AAAA,IACZC,gBAAkB;AAAA;AAGtB,MAAMC,eAAe,KAAK;AAEpBC,MAAAA,QAAQC,WAAW,gBACvB;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAOC;AAAAA,EAAOC;AAAAA,EAAQC;AAAAA,GAC5BC,KACA;AACMC,QAAAA,aAAaL,SAASA,MAAMM,OAAO,QAAQC,YAAYC,QAAQR,MAAMM,GAA1B;AAEjD,6BACG,WAAD;AAAA,IAAW;AAAA,IAAU;AAAA,IAAQ;AAAA,IAAc;AAAA,IAAgB;AAAA,IACzD,8BAAA,OAAA;AAAA,MAAK,OAAO;AAAA,QAAEG,UAAU;AAAA,QAAYC,YAAa,GAAE,MAAMd;AAAAA,MAAzD;AAAA,MACE,8BAAA,OAAA;AAAA,QAAK,OAAO;AAAA,UAAEa,UAAU;AAAA,UAAYE,KAAK;AAAA,UAAGC,MAAM;AAAA,UAAGC,OAAO;AAAA,UAAGC,QAAQ;AAAA,QAAvE;AAAA,QAAA,UACGT,eAAe,OACdU,oBAAC,8CACKf;UACJ,OAAM;AAAA,UACN,QAAO;AAAA,UACP,QAAQ;AAAA,YACNgB,OAAO;AAAA,cAAEC,eAAe;AAAA,gBAAEC,YAAYlB,SAAS,QAAQ,CAACA,MAAMmB;AAAAA,cAAtC;AAAA,YADlB;AAAA,YAENC,QAAQ;AAAA,cACNC,SAAS;AAAA,gBACPC,kBAAkBtB,SAAS,QAAQA,MAAMuB,SAAS,OAAO,SAAS;AAAA,cAD3D;AAAA,YADH;AAAA,UAFF;AAAA,QAAA,EAJV,IAcAR,oBAAA,OAAA;AAAA,UAAK,OAAM;AAAA,UAAO,KAAKS,aAAaxB,MAAMyB;AAAAA,UAAK,KAAI;AAAA,QAAA,CAAnD;AAAA,MAAA,CAhBJ;AAAA,IAAA,CADF;AAAA,EAAA,CAFJ;AAyBD,CA/BuB;;"}
@@ -182,5 +182,5 @@ function setIsInBuilder(isInBuilder) {
182
182
  function handleWheel(payload) {
183
183
  return { type: ActionTypes.HANDLE_WHEEL, payload };
184
184
  }
185
- export { ActionTypes as A, messageBuilderPropController as B, changeDocumentElementScrollTop as a, cleanUp as b, changeDocument as c, changeApiResource as d, evictApiResource as e, registerComponentHandleEffect as f, mountComponentEffect as g, registerComponentEffect as h, init as i, registerReactComponentEffect as j, registerDocumentEffect as k, changeElementBoxModels as l, messageHostPropController as m, changeDocumentElementSize as n, handleWheel as o, setIsInBuilder as p, registerBuilderComponent as q, registerDocument as r, scrollDocumentElement as s, unregisterBuilderComponent as t, unregisterDocument as u, unregisterMeasurable as v, registerMeasurable as w, unregisterPropControllers as x, registerPropControllersHandle as y, registerPropControllers as z };
185
+ export { ActionTypes as A, messageBuilderPropController as B, changeDocumentElementScrollTop as a, cleanUp as b, changeDocument as c, changeApiResource as d, evictApiResource as e, registerComponentHandleEffect as f, mountComponentEffect as g, registerComponentEffect as h, init as i, registerReactComponentEffect as j, registerDocumentEffect as k, changeElementBoxModels as l, messageHostPropController as m, changeDocumentElementSize as n, handleWheel as o, setIsInBuilder as p, registerBuilderComponent as q, registerDocument as r, scrollDocumentElement as s, unregisterBuilderComponent as t, unregisterDocument as u, unregisterMeasurable as v, registerMeasurable as w, unregisterPropControllers as x, registerPropControllers as y, registerPropControllersHandle as z };
186
186
  //# sourceMappingURL=actions.es.js.map
@@ -3,8 +3,6 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
3
3
  var controlSerialization = require("./control-serialization.cjs.js");
4
4
  require("./shape.cjs.js");
5
5
  require("./image.cjs.js");
6
- require("./style.cjs.js");
7
- require("./descriptors.cjs.js");
8
6
  exports.deserializeControl = controlSerialization.deserializeControl;
9
7
  exports.deserializeControls = controlSerialization.deserializeControls;
10
8
  exports.deserializeFunction = controlSerialization.deserializeFunction;
@@ -1 +1 @@
1
- {"version":3,"file":"builder.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"builder.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
@@ -1,6 +1,4 @@
1
1
  export { d as deserializeControl, b as deserializeControls, e as deserializeFunction, i as isSerializedFunction, s as serializeControl, a as serializeControls, c as serializeFunction } from "./control-serialization.es.js";
2
2
  import "./shape.es.js";
3
3
  import "./image.es.js";
4
- import "./style.es.js";
5
- import "./descriptors.es.js";
6
4
  //# sourceMappingURL=builder.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"builder.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
1
+ {"version":3,"file":"builder.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -29,10 +29,9 @@ require("use-sync-external-store/shim/with-selector");
29
29
  require("./react-page.cjs.js");
30
30
  require("redux");
31
31
  require("redux-thunk");
32
- require("./descriptors.cjs.js");
33
- require("./style.cjs.js");
34
- require("./color.cjs.js");
35
32
  require("./image.cjs.js");
33
+ require("./color.cjs.js");
34
+ require("./slot.cjs.js");
36
35
  require("next/dynamic");
37
36
  require("next/document");
38
37
  require("slate");
@@ -1 +1 @@
1
- {"version":3,"file":"components.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"components.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -27,10 +27,9 @@ import "use-sync-external-store/shim/with-selector";
27
27
  import "./react-page.es.js";
28
28
  import "redux";
29
29
  import "redux-thunk";
30
- import "./descriptors.es.js";
31
- import "./style.es.js";
32
- import "./color.es.js";
33
30
  import "./image.es.js";
31
+ import "./color.es.js";
32
+ import "./slot.es.js";
34
33
  import "next/dynamic";
35
34
  import "next/document";
36
35
  import "slate";
@@ -1 +1 @@
1
- {"version":3,"file":"components.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"components.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -19,9 +19,7 @@ var __spreadValues = (a, b) => {
19
19
  };
20
20
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
21
  var shape = require("./shape.cjs.js");
22
- require("./image.cjs.js");
23
- require("./style.cjs.js");
24
- var descriptors = require("./descriptors.cjs.js");
22
+ var image = require("./image.cjs.js");
25
23
  function isSerializedFunction(value) {
26
24
  return value instanceof MessagePort;
27
25
  }
@@ -372,41 +370,41 @@ function deserializeRichTextControl(serializedControl) {
372
370
  }
373
371
  function serializeControl(control) {
374
372
  switch (control.type) {
375
- case descriptors.Types.Checkbox:
373
+ case image.Types.Checkbox:
376
374
  return serializeCheckboxControl(control);
377
- case descriptors.Types.List:
375
+ case image.Types.List:
378
376
  return serializeListControl(control);
379
- case descriptors.Types.Shape:
377
+ case image.Types.Shape:
380
378
  return serializeShapeControl(control);
381
- case descriptors.Types.Typeahead:
379
+ case image.Types.Typeahead:
382
380
  return serializeTypeaheadControl(control);
383
- case descriptors.Types.GapX:
381
+ case image.Types.GapX:
384
382
  return serializeGapXControl(control);
385
- case descriptors.Types.GapY:
383
+ case image.Types.GapY:
386
384
  return serializeGapYControl(control);
387
- case descriptors.Types.ResponsiveColor:
385
+ case image.Types.ResponsiveColor:
388
386
  return serializeResponsiveColorControl(control);
389
- case descriptors.Types.ResponsiveNumber:
387
+ case image.Types.ResponsiveNumber:
390
388
  return serializeResponsiveNumberControl(control);
391
- case descriptors.Types.Number:
389
+ case image.Types.Number:
392
390
  return serializeNumberControl(control);
393
- case descriptors.Types.ResponsiveIconRadioGroup:
391
+ case image.Types.ResponsiveIconRadioGroup:
394
392
  return serializeResponsiveIconRadioGroupControl(control);
395
- case descriptors.Types.ResponsiveSelect:
393
+ case image.Types.ResponsiveSelect:
396
394
  return serializeResponsiveSelectControl(control);
397
- case descriptors.Types.ResponsiveLength:
395
+ case image.Types.ResponsiveLength:
398
396
  return serializeResponsiveLengthControl(control);
399
- case descriptors.Types.Date:
397
+ case image.Types.Date:
400
398
  return serializeDateControl(control);
401
- case descriptors.Types.Link:
399
+ case image.Types.Link:
402
400
  return serializeLinkControl(control);
403
- case descriptors.Types.TextInput:
401
+ case image.Types.TextInput:
404
402
  return serializeTextInputControl(control);
405
- case descriptors.Types.TextStyle:
403
+ case image.Types.TextStyle:
406
404
  return serializeTextStyleControl(control);
407
- case descriptors.Types.Image:
405
+ case image.Types.Image:
408
406
  return serializeImageControl(control);
409
- case descriptors.Types.RichText:
407
+ case image.Types.RichText:
410
408
  return serializeRichTextControl(control);
411
409
  case shape.ComboboxControlType:
412
410
  return serializeComboboxControlDefinition(control);
@@ -420,41 +418,41 @@ function serializeControl(control) {
420
418
  }
421
419
  function deserializeControl(serializedControl) {
422
420
  switch (serializedControl.type) {
423
- case descriptors.Types.Checkbox:
421
+ case image.Types.Checkbox:
424
422
  return deserializeCheckboxControl(serializedControl);
425
- case descriptors.Types.List:
423
+ case image.Types.List:
426
424
  return deserializeListControl(serializedControl);
427
- case descriptors.Types.Shape:
425
+ case image.Types.Shape:
428
426
  return deserializeShapeControl(serializedControl);
429
- case descriptors.Types.Typeahead:
427
+ case image.Types.Typeahead:
430
428
  return deserializeTypeaheadControl(serializedControl);
431
- case descriptors.Types.GapX:
429
+ case image.Types.GapX:
432
430
  return deserializeGapXControl(serializedControl);
433
- case descriptors.Types.GapY:
431
+ case image.Types.GapY:
434
432
  return deserializeGapYControl(serializedControl);
435
- case descriptors.Types.ResponsiveColor:
433
+ case image.Types.ResponsiveColor:
436
434
  return deserializeResponsiveColorControl(serializedControl);
437
- case descriptors.Types.ResponsiveNumber:
435
+ case image.Types.ResponsiveNumber:
438
436
  return deserializeResponsiveNumberControl(serializedControl);
439
- case descriptors.Types.Number:
437
+ case image.Types.Number:
440
438
  return deserializeNumberControl(serializedControl);
441
- case descriptors.Types.ResponsiveIconRadioGroup:
439
+ case image.Types.ResponsiveIconRadioGroup:
442
440
  return deserializeResponsiveIconRadioGroupControl(serializedControl);
443
- case descriptors.Types.ResponsiveSelect:
441
+ case image.Types.ResponsiveSelect:
444
442
  return deserializeResponsiveSelectControl(serializedControl);
445
- case descriptors.Types.ResponsiveLength:
443
+ case image.Types.ResponsiveLength:
446
444
  return deserializeResponsiveLengthControl(serializedControl);
447
- case descriptors.Types.Date:
445
+ case image.Types.Date:
448
446
  return deserializeDateControl(serializedControl);
449
- case descriptors.Types.Link:
447
+ case image.Types.Link:
450
448
  return deserializeLinkControl(serializedControl);
451
- case descriptors.Types.TextInput:
449
+ case image.Types.TextInput:
452
450
  return deserializeTextInputControl(serializedControl);
453
- case descriptors.Types.TextStyle:
451
+ case image.Types.TextStyle:
454
452
  return deserializeTextStyleControl(serializedControl);
455
- case descriptors.Types.Image:
453
+ case image.Types.Image:
456
454
  return deserializeImageControl(serializedControl);
457
- case descriptors.Types.RichText:
455
+ case image.Types.RichText:
458
456
  return deserializeRichTextControl(serializedControl);
459
457
  case shape.ComboboxControlType:
460
458
  return deserializeComboboxControlDefinition(serializedControl);