@makeswift/runtime 0.7.16 → 0.7.18

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 (110) hide show
  1. package/dist/Box.cjs.js +1 -1
  2. package/dist/Box.es.js +1 -1
  3. package/dist/Button.cjs.js +2 -2
  4. package/dist/Button.es.js +2 -2
  5. package/dist/Carousel.cjs.js +3 -3
  6. package/dist/Carousel.es.js +3 -3
  7. package/dist/Countdown.cjs.js +3 -3
  8. package/dist/Countdown.es.js +3 -3
  9. package/dist/Divider.cjs.js +3 -3
  10. package/dist/Divider.es.js +3 -3
  11. package/dist/Embed.cjs.js +3 -3
  12. package/dist/Embed.es.js +3 -3
  13. package/dist/Form.cjs.js +1 -1
  14. package/dist/Form.es.js +1 -1
  15. package/dist/Image.cjs.js +3 -3
  16. package/dist/Image.es.js +3 -3
  17. package/dist/LiveProvider.cjs.js +3 -3
  18. package/dist/LiveProvider.es.js +4 -4
  19. package/dist/Navigation.cjs.js +3 -3
  20. package/dist/Navigation.es.js +3 -3
  21. package/dist/PreviewProvider.cjs.js +8 -8
  22. package/dist/PreviewProvider.cjs.js.map +1 -1
  23. package/dist/PreviewProvider.es.js +2 -2
  24. package/dist/ReadOnlyText.cjs.js +55 -55
  25. package/dist/ReadOnlyText.cjs.js.map +1 -1
  26. package/dist/ReadOnlyText.es.js +3 -3
  27. package/dist/Root.cjs.js +3 -3
  28. package/dist/Root.es.js +3 -3
  29. package/dist/SocialLinks.cjs.js +2 -2
  30. package/dist/SocialLinks.es.js +2 -2
  31. package/dist/Text.cjs.js +4 -4
  32. package/dist/Text.es.js +4 -4
  33. package/dist/Video.cjs.js +3 -3
  34. package/dist/Video.es.js +3 -3
  35. package/dist/builder.cjs.js +2 -2
  36. package/dist/builder.es.js +2 -2
  37. package/dist/components.cjs.js +1 -1
  38. package/dist/components.es.js +1 -1
  39. package/dist/constants.cjs.js +14 -14
  40. package/dist/constants.cjs.js.map +1 -1
  41. package/dist/constants.es.js +1 -1
  42. package/dist/control-serialization.cjs.js +41 -41
  43. package/dist/control-serialization.cjs.js.map +1 -1
  44. package/dist/control-serialization.es.js +1 -1
  45. package/dist/controls.cjs.js +46 -44
  46. package/dist/controls.cjs.js.map +1 -1
  47. package/dist/controls.es.js +2 -2
  48. package/dist/{rich-text.cjs.js → descriptors.cjs.js} +476 -459
  49. package/dist/descriptors.cjs.js.map +1 -0
  50. package/dist/{rich-text.es.js → descriptors.es.js} +467 -452
  51. package/dist/descriptors.es.js.map +1 -0
  52. package/dist/index.cjs.js +242 -211
  53. package/dist/index.cjs.js.map +1 -1
  54. package/dist/index.cjs2.js +1 -1
  55. package/dist/index.cjs5.js +568 -37
  56. package/dist/index.cjs5.js.map +1 -1
  57. package/dist/index.cjs6.js +17 -697
  58. package/dist/index.cjs6.js.map +1 -1
  59. package/dist/index.cjs7.js +327 -0
  60. package/dist/index.cjs7.js.map +1 -0
  61. package/dist/index.es.js +46 -15
  62. package/dist/index.es.js.map +1 -1
  63. package/dist/index.es2.js +1 -1
  64. package/dist/index.es5.js +558 -35
  65. package/dist/index.es5.js.map +1 -1
  66. package/dist/index.es6.js +16 -692
  67. package/dist/index.es6.js.map +1 -1
  68. package/dist/index.es7.js +320 -0
  69. package/dist/index.es7.js.map +1 -0
  70. package/dist/introspection.cjs.js +22 -22
  71. package/dist/introspection.cjs.js.map +1 -1
  72. package/dist/introspection.es.js +1 -1
  73. package/dist/leaf.cjs.js +1 -0
  74. package/dist/leaf.cjs.js.map +1 -1
  75. package/dist/leaf.es.js +2 -2
  76. package/dist/main.cjs.js +1 -1
  77. package/dist/main.es.js +1 -1
  78. package/dist/next.cjs.js +3 -3
  79. package/dist/next.es.js +3 -3
  80. package/dist/prop-controllers.cjs.js +5 -5
  81. package/dist/prop-controllers.es.js +2 -2
  82. package/dist/react.cjs.js +3 -3
  83. package/dist/react.es.js +3 -3
  84. package/dist/slate.cjs.js +48 -0
  85. package/dist/slate.cjs.js.map +1 -0
  86. package/dist/slate.es.js +39 -0
  87. package/dist/slate.es.js.map +1 -0
  88. package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
  89. package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
  90. package/dist/types/src/controls/control.d.ts +3 -2
  91. package/dist/types/src/controls/control.d.ts.map +1 -1
  92. package/dist/types/src/controls/rich-text/dto-types.d.ts +1 -2
  93. package/dist/types/src/controls/rich-text/dto-types.d.ts.map +1 -1
  94. package/dist/types/src/controls/shape.d.ts +1 -1
  95. package/dist/types/src/controls/shape.d.ts.map +1 -1
  96. package/dist/types/src/controls/style.d.ts +17 -0
  97. package/dist/types/src/controls/style.d.ts.map +1 -1
  98. package/dist/types/src/prop-controllers/descriptors.d.ts +1 -2
  99. package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
  100. package/dist/types/src/prop-controllers/instances.d.ts +3 -3
  101. package/dist/types/src/prop-controllers/instances.d.ts.map +1 -1
  102. package/dist/types/src/runtimes/react/controls/control.d.ts +3 -2
  103. package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
  104. package/dist/types/src/runtimes/react/controls/style.d.ts +2 -2
  105. package/dist/types/src/runtimes/react/controls/style.d.ts.map +1 -1
  106. package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
  107. package/package.json +5 -4
  108. package/slate.js +1 -0
  109. package/dist/rich-text.cjs.js.map +0 -1
  110. package/dist/rich-text.es.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.es6.js","sources":["../src/components/builtin/Text/components/Element/block.tsx","../src/components/builtin/Text/components/Element/inline.tsx","../src/components/builtin/Text/components/Element/element.tsx","../src/components/builtin/Text/EditableText/useSyncWithBuilder.tsx","../src/slate/ListPlugin/constants.ts","../src/slate/utils/element.ts","../src/slate/utils/editor.ts","../src/slate/ListPlugin/utils/filterForSubtreeRoots.ts","../src/slate/ListPlugin/utils/location.ts","../src/slate/ListPlugin/utils/getSelectedListItems.ts","../src/slate/ListPlugin/indent.ts","../src/slate/ListPlugin/dedent.ts","../src/slate/ListPlugin/unwrapList.ts","../src/slate/ListPlugin/wrapList.ts","../src/slate/ListPlugin/toggleList.ts","../src/slate/ListPlugin/index.ts","../src/slate/TypographyPlugin/index.ts","../src/slate/BlockPlugin/index.ts","../src/components/builtin/Text/EditableText/editable-text.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { RenderElementProps } from 'slate-react'\nimport { Block, BlockType } from '../../../../../controls'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { responsiveStyle } from '../../../../utils/responsive-style'\n\nexport interface InlineRenderElementProps extends RenderElementProps {\n element: Block\n}\n\nexport function BlockElement({ element, attributes, children }: InlineRenderElementProps) {\n const blockStyles = [\n useStyle({ margin: 0 }),\n useStyle(responsiveStyle([element.textAlign], ([textAlign = 'left']) => ({ textAlign }))),\n ]\n\n switch (element.type) {\n case BlockType.Paragraph:\n return (\n <p {...attributes} className={cx(...blockStyles)}>\n {children}\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote\n {...attributes}\n className={cx(\n ...blockStyles,\n useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n }),\n )}\n >\n {children}\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol {...attributes} className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n {children}\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul {...attributes} className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n {children}\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li {...attributes} className={cx(...blockStyles)}>\n {children}\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span {...attributes} className={cx(...blockStyles)}>\n {children}\n </span>\n )\n }\n}\n","import { cx } from '@emotion/css'\nimport { ComponentPropsWithoutRef } from 'react'\nimport { RenderElementProps } from 'slate-react'\nimport { Inline, InlineType } from '../../../../../controls'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { Link } from '../../../../shared/Link'\n\nfunction StyledLink({ className, ...restOfProps }: ComponentPropsWithoutRef<typeof Link>) {\n return <Link {...restOfProps} className={cx(useStyle({ textDecoration: 'none' }), className)} />\n}\n\nexport interface InlineRenderElementProps extends RenderElementProps {\n element: Inline\n}\n\nexport function InlineElement({ element, attributes, children }: InlineRenderElementProps) {\n switch (element.type) {\n case InlineType.Code:\n return <code {...attributes}>{children}</code>\n case InlineType.SuperScript:\n return <sup {...attributes}>{children}</sup>\n case InlineType.SubScript:\n return <sub {...attributes}>{children}</sub>\n case InlineType.Link:\n return (\n <StyledLink {...attributes} link={element.link}>\n {children}\n </StyledLink>\n )\n }\n}\n","import { RenderElementProps } from 'slate-react'\nimport { BlockType, InlineType } from '../../../../../controls'\nimport { BlockElement } from './block'\nimport { InlineElement } from './inline'\n\nexport function Element({ element, ...props }: RenderElementProps) {\n switch (element.type) {\n case InlineType.Code:\n case InlineType.SuperScript:\n case InlineType.SubScript:\n case InlineType.Link:\n return <InlineElement element={element} {...props} />\n case BlockType.Paragraph:\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement element={element} {...props} />\n default:\n return <span {...props.attributes}>{props.children}</span>\n }\n}\n","import { useState, useEffect, useCallback } from 'react'\nimport { Editor } from 'slate'\nimport { richTextDTOtoDAO, richTextDTOtoSelection } from '../../../../controls'\nimport { RichTextValue } from '../../../../prop-controllers'\nimport deepEqual from '../../../../utils/deepEqual'\n\nconst COMMIT_DEBOUNCE_DELAY = 500\n\n/**\n * Compare new prop value with current editor and update editor\n * if the values are not equal.\n */\nexport function useSyncWithBuilder(editor: Editor, text?: RichTextValue) {\n const [shouldCommit, setShouldCommit] = useState(true)\n\n useEffect(() => {\n if (shouldCommit && text) {\n const nextValue = richTextDTOtoDAO(text)\n const nextSelection = richTextDTOtoSelection(text)\n if (!deepEqual(editor.children, nextValue) || !deepEqual(editor.selection, nextSelection)) {\n editor.children = nextValue\n editor.selection = nextSelection\n editor.onChange()\n }\n }\n }, [editor, 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 return useCallback(() => setShouldCommit(false), [])\n}\n","export const LIST_ITEM_CHILD_POSITION = 0\nexport const LIST_ITEM_LIST_POSITION = 1\n","import { Node, Element } from 'slate'\nimport {\n BlockType,\n Block,\n ParagraphElement,\n OrderedListElement,\n UnorderedListElement,\n ListItemElement,\n ListItemChildElement,\n Inline,\n InlineType,\n} from '../../controls'\n\nexport const ElementUtils = {\n isBlock(node: Node): node is Block {\n return (\n Element.isElement(node) &&\n (Element.isElementType(node, BlockType.Paragraph) ||\n Element.isElementType(node, BlockType.Heading1) ||\n Element.isElementType(node, BlockType.Heading2) ||\n Element.isElementType(node, BlockType.Heading3) ||\n Element.isElementType(node, BlockType.Heading3) ||\n Element.isElementType(node, BlockType.Heading4) ||\n Element.isElementType(node, BlockType.Heading5) ||\n Element.isElementType(node, BlockType.Heading6) ||\n Element.isElementType(node, BlockType.BlockQuote) ||\n Element.isElementType(node, BlockType.UnorderedList) ||\n Element.isElementType(node, BlockType.OrderedList) ||\n Element.isElementType(node, BlockType.ListItem) ||\n Element.isElementType(node, BlockType.ListItemChild))\n )\n },\n isInline(node: Node): node is Inline {\n return (\n Element.isElement(node) &&\n (Element.isElementType(node, InlineType.Link) ||\n Element.isElementType(node, InlineType.Link) ||\n Element.isElementType(node, InlineType.SubScript) ||\n Element.isElementType(node, InlineType.SuperScript))\n )\n },\n isConvertibleToListTextNode(node: Node) {\n return !this.isList(node) && !this.isListItem(node) && !this.isListItemChild(node)\n },\n isParagraph(node: Node): node is ParagraphElement {\n return Element.isElementType(node, BlockType.Paragraph)\n },\n isList(node: Node): node is OrderedListElement | UnorderedListElement {\n return (\n Element.isElementType(node, BlockType.OrderedList) ||\n Element.isElementType(node, BlockType.UnorderedList)\n )\n },\n isListItem(node: Node): node is ListItemElement {\n return Element.isElementType(node, BlockType.ListItem)\n },\n isListItemChild(node: Node): node is ListItemChildElement {\n return Element.isElementType(node, BlockType.ListItemChild)\n },\n createText() {\n return { text: '' }\n },\n createParagraph() {\n return {\n children: [this.createText()],\n type: BlockType.Paragraph,\n }\n },\n createList(type: BlockType = BlockType.UnorderedList): Block {\n return { children: [this.createText()], type }\n },\n createListItem(): Block {\n return {\n children: [this.createListItemChild()],\n type: BlockType.ListItem,\n }\n },\n createListItemChild(): Block {\n return {\n children: [this.createText()],\n type: BlockType.ListItemChild,\n }\n },\n}\n","import { Path, Editor, NodeEntry } from 'slate'\nimport { ListElement, ListItemElement } from '../../controls'\nimport { ElementUtils } from './element'\n\nexport const EditorUtils = {\n getFirstAncestorList(editor: Editor, path: Path): NodeEntry<ListElement> | null {\n const parentList = Editor.above(editor, {\n at: path,\n match: (node): node is ListElement => ElementUtils.isList(node),\n })\n return parentList ?? null\n },\n getFirstAncestorListItem(editor: Editor, path: Path): NodeEntry<ListItemElement> | null {\n const parentListItem = Editor.above(editor, {\n at: path,\n match: (node): node is ListItemElement => ElementUtils.isListItem(node),\n })\n\n return parentListItem ?? null\n },\n}\n","import type { Node, NodeEntry } from 'slate'\nimport { Path } from 'slate'\n\nexport function filterForSubtreeRoots(entries: NodeEntry<Node>[]): NodeEntry<Node>[] {\n return entries.filter(\n ([, nodePath]) =>\n !Path.ancestors(nodePath).some(ancestor => {\n return entries.some(([, path]) => Path.equals(path, ancestor))\n }),\n )\n}\n","import { Range, Point, Path, Location } from 'slate'\n\nexport const LocationUtils = {\n getStartPath(location: Location): Path {\n if (Range.isRange(location)) return Range.start(location).path\n if (Point.isPoint(location)) return location.path\n return location\n },\n}\n","import type { Element, NodeEntry } from 'slate'\nimport { Editor, Path } from 'slate'\nimport { EditorUtils } from '../../utils/editor'\nimport { ElementUtils } from '../../utils/element'\nimport { LocationUtils } from './location'\n\nexport function getSelectedListItems(editor: Editor): NodeEntry<Element>[] {\n if (!editor.selection) return []\n\n const start = LocationUtils.getStartPath(editor.selection)\n const listItems = Editor.nodes(editor, {\n at: editor.selection,\n match: node => ElementUtils.isListItem(node),\n })\n const firstAncestorPath = EditorUtils.getFirstAncestorListItem(editor, start)?.[1] ?? []\n\n return Array.from(listItems).filter((node): node is NodeEntry<Element> =>\n Path.isDescendant(start, node[1])\n ? Path.equals(node[1], firstAncestorPath)\n : !Path.isAfter(start, node[1]),\n )\n}\n\nexport function getSelectedLists(editor: Editor): NodeEntry<Element>[] {\n if (!editor.selection) return []\n\n const start = LocationUtils.getStartPath(editor.selection)\n const lists = Editor.nodes(editor, {\n at: editor.selection,\n match: node => ElementUtils.isList(node),\n })\n const firstAncestorPath = EditorUtils.getFirstAncestorList(editor, start)?.[1] ?? []\n\n return Array.from(lists).filter((node): node is NodeEntry<Element> =>\n Path.isDescendant(start, node[1])\n ? Path.equals(node[1], firstAncestorPath)\n : !Path.isAfter(start, node[1]),\n )\n}\n","import { Editor, Node, Path, Transforms } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { LIST_ITEM_LIST_POSITION } from './constants'\nimport { filterForSubtreeRoots } from './utils/filterForSubtreeRoots'\nimport { getSelectedListItems } from './utils/getSelectedListItems'\n\nexport function indentPath(editor: Editor, path: Path) {\n const parent = Node.parent(editor, path)\n if (!path || !Path.hasPrevious(path) || !ElementUtils.isList(parent)) return\n\n const previosPath = Path.previous(path)\n\n const previousChildListPath = [...previosPath, LIST_ITEM_LIST_POSITION]\n const previousHasChildList = Node.has(editor, previousChildListPath)\n\n Editor.withoutNormalizing(editor, () => {\n if (!previousHasChildList) {\n Transforms.insertNodes(editor, ElementUtils.createList(parent.type), {\n at: previousChildListPath,\n })\n }\n\n const previousChildList = Node.get(editor, previousChildListPath)\n\n if (ElementUtils.isList(previousChildList)) {\n const index = previousHasChildList ? previousChildList.children.length : 0\n Transforms.moveNodes(editor, {\n at: path,\n to: [...previousChildListPath, index],\n })\n }\n })\n}\n\nexport function indent(editor: Editor) {\n if (!editor.selection) return\n\n const listItems = getSelectedListItems(editor)\n const subRoots = filterForSubtreeRoots(listItems)\n const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path))\n\n refs.forEach(ref => {\n if (ref.current) {\n indentPath(editor, ref.current)\n }\n ref.unref()\n })\n}\n","import { Editor, Path, Transforms } from 'slate'\nimport { indentPath } from './indent'\nimport { getSelectedListItems } from './utils/getSelectedListItems'\nimport { filterForSubtreeRoots } from './utils/filterForSubtreeRoots'\nimport { EditorUtils } from '../utils/editor'\n\nfunction dedentPath(editor: Editor, listItemPath: Path) {\n const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath)\n const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath)\n if (!parentList || !listItemContainingParentList) return\n\n const [parentListNode, parentListPath] = parentList\n const [_, listItemContainingParentListPath] = listItemContainingParentList\n\n const listItemPosition = listItemPath[listItemPath.length - 1]\n const previousSiblings = parentListNode.children.slice(0, listItemPosition)\n const nextSiblings = parentListNode.children.slice(listItemPosition + 1)\n\n Editor.withoutNormalizing(editor, () => {\n // put next siblings into list item\n nextSiblings.forEach(() => {\n const nextSiblingPath = [...parentListPath, listItemPosition + 1]\n indentPath(editor, nextSiblingPath)\n })\n // move list item to parent list\n Transforms.moveNodes(editor, {\n at: listItemPath,\n to: Path.next(listItemContainingParentListPath),\n })\n // delete old parent list if there are no other list items\n if (previousSiblings.length === 0) {\n Transforms.removeNodes(editor, { at: parentListPath })\n }\n })\n}\n\nexport function dedent(editor: Editor) {\n if (!editor.selection) return\n\n const listItems = getSelectedListItems(editor)\n const subRoots = filterForSubtreeRoots(listItems)\n const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path))\n\n refs.forEach(ref => {\n if (ref.current) {\n dedentPath(editor, ref.current)\n }\n ref.unref()\n })\n}\n","import { Editor, Transforms, Path, Node } from 'slate'\nimport { BlockType } from '../../controls'\nimport { EditorUtils } from '../utils/editor'\nimport { LIST_ITEM_CHILD_POSITION, LIST_ITEM_LIST_POSITION } from './constants'\nimport { filterForSubtreeRoots } from './utils/filterForSubtreeRoots'\nimport { getSelectedListItems } from './utils/getSelectedListItems'\n\nexport function unwrapPath(editor: Editor, listItemPath: Path) {\n const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath)\n const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath)\n //if this is a nested item we don't want to unwrap it\n if (!parentList || listItemContainingParentList) return\n\n Editor.withoutNormalizing(editor, () => {\n const listItemTextPath = [...listItemPath, LIST_ITEM_CHILD_POSITION]\n const listItemNestedListPath = [...listItemPath, LIST_ITEM_LIST_POSITION]\n\n if (Node.has(editor, listItemNestedListPath)) {\n Transforms.setNodes(editor, { type: parentList[0].type }, { at: listItemNestedListPath })\n Transforms.liftNodes(editor, { at: listItemNestedListPath })\n Transforms.liftNodes(editor, { at: Path.next(listItemPath) })\n }\n\n if (Node.has(editor, listItemTextPath)) {\n Transforms.setNodes(\n editor,\n { type: BlockType.Paragraph },\n {\n at: listItemTextPath,\n },\n )\n Transforms.liftNodes(editor, { at: listItemTextPath })\n Transforms.liftNodes(editor, { at: listItemPath })\n }\n })\n}\n\nexport function unwrapList(editor: Editor) {\n if (!editor.selection) return\n\n const listItems = getSelectedListItems(editor)\n const subRoots = filterForSubtreeRoots(listItems)\n const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path))\n\n refs.forEach(ref => {\n if (ref.current) {\n unwrapPath(editor, ref.current)\n }\n ref.unref()\n })\n}\n","import { Editor, Element, Transforms } from 'slate'\nimport { BlockType } from '../../controls'\nimport { ElementUtils } from '../utils/element'\n\ntype WrapListOptions = {\n type: typeof BlockType.UnorderedList | typeof BlockType.OrderedList\n}\n\nexport function wrapList(\n editor: Editor,\n options: WrapListOptions = { type: BlockType.UnorderedList },\n) {\n if (!editor.selection) return\n\n const nonListEntries = Array.from(\n Editor.nodes(editor, {\n at: editor.selection,\n match: node => {\n return Element.isElement(node) && ElementUtils.isConvertibleToListTextNode(node)\n },\n }),\n )\n\n const refs = nonListEntries.map(([_, path]) => Editor.pathRef(editor, path))\n\n refs.forEach(ref => {\n const path = ref.current\n if (path) {\n Editor.withoutNormalizing(editor, () => {\n Transforms.setNodes(\n editor,\n { type: BlockType.ListItemChild },\n {\n at: path,\n },\n )\n Transforms.wrapNodes(editor, ElementUtils.createListItem(), {\n at: path,\n })\n Transforms.wrapNodes(editor, ElementUtils.createList(options.type), {\n at: path,\n })\n })\n }\n ref.unref()\n })\n}\n","import { Editor, Node, Path, Transforms } from 'slate'\nimport { BlockType } from '../../controls'\nimport { ElementUtils } from '../utils/element'\nimport { unwrapList } from './unwrapList'\nimport { LocationUtils } from './utils/location'\nimport { wrapList } from './wrapList'\n\ntype ToggleListOptions = {\n type: typeof BlockType.UnorderedList | typeof BlockType.OrderedList\n}\n\nexport function toggleList(\n editor: Editor,\n options: ToggleListOptions = { type: BlockType.UnorderedList },\n) {\n if (!editor.selection) return\n const start = LocationUtils.getStartPath(editor.selection)\n const ancestorPath = Path.ancestors(start).at(1)\n if (!ancestorPath || !Node.has(editor, ancestorPath)) return\n const ancestor = Node.get(editor, ancestorPath)\n\n if (!ElementUtils.isList(ancestor)) {\n return wrapList(editor, { type: options.type })\n }\n\n if (ancestor.type === options.type) {\n unwrapList(editor)\n } else {\n Transforms.setNodes(editor, { type: options.type }, { at: ancestorPath })\n }\n}\n","import type { KeyboardEvent } from 'react'\nimport { Editor, Transforms, Range, Node, PathRef, Text } from 'slate'\nimport isHotkey from 'is-hotkey'\nimport { LIST_ITEM_CHILD_POSITION } from './constants'\nimport { EditorUtils } from '../utils/editor'\nimport { ElementUtils } from '../utils/element'\nimport { dedent } from './dedent'\nimport { indent } from './indent'\nimport { toggleList } from './toggleList'\nimport { unwrapList } from './unwrapList'\nimport { wrapList } from './wrapList'\nimport { BlockType } from '../../controls'\n\nexport const List = {\n unwrapList,\n wrapList,\n indent,\n dedent,\n toggleList,\n}\n\nexport function onKeyDown(e: KeyboardEvent, editor: Editor) {\n if (\n !editor.selection ||\n Array.from(Editor.nodes(editor, { match: node => ElementUtils.isListItem(node) })).length === 0\n )\n return\n\n if (isHotkey('shift+tab', e)) {\n e.preventDefault()\n List.dedent(editor)\n }\n\n if (isHotkey('tab', e)) {\n e.preventDefault()\n List.indent(editor)\n }\n\n if (isHotkey('backspace', e)) {\n if (!editor.selection) return\n if (Range.isExpanded(editor.selection)) return\n const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path)\n if (editor.selection.anchor.offset === 0 && listItem) {\n e.preventDefault()\n const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1])\n const list = EditorUtils.getFirstAncestorList(editor, listItem[1])\n\n if (parentListItem) {\n List.dedent(editor)\n } else if (list) {\n List.unwrapList(editor)\n }\n return\n }\n }\n\n if (isHotkey('enter', e)) {\n e.preventDefault()\n\n if (!editor.selection) return\n\n if (Range.isExpanded(editor.selection)) {\n Transforms.delete(editor)\n return\n }\n\n const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path)\n if (\n editor.selection.anchor.offset === 0 &&\n listItem &&\n Editor.string(editor, listItem[1]) === ''\n ) {\n const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1])\n\n if (parentListItem) {\n List.dedent(editor)\n } else {\n List.unwrapList(editor)\n }\n return\n }\n\n Transforms.splitNodes(editor, {\n at: editor.selection,\n always: true,\n match: node => ElementUtils.isListItem(node),\n })\n }\n\n if (isHotkey('shift+enter', e)) {\n e.preventDefault()\n editor.insertText('\\n')\n }\n}\n\nexport function withList(editor: Editor) {\n const { normalizeNode } = editor\n editor.normalizeNode = entry => {\n const [normalizationNode, normalizationPath] = entry\n\n // Normalization for converting children of list items to list item children\n // In the case of backspace from position 0 of node into a list this converts the node into a list item.\n if (ElementUtils.isListItem(normalizationNode)) {\n const pathToListItemText = [...normalizationPath, LIST_ITEM_CHILD_POSITION]\n\n if (Node.has(editor, pathToListItemText)) {\n const nodeInListItemTextPosition = Node.get(editor, pathToListItemText)\n if (ElementUtils.isParagraph(nodeInListItemTextPosition)) {\n Transforms.setNodes(\n editor,\n { type: BlockType.ListItemChild },\n {\n at: pathToListItemText,\n },\n )\n return\n }\n } else {\n Transforms.insertNodes(editor, ElementUtils.createListItem(), {\n at: pathToListItemText,\n })\n return\n }\n }\n\n // Normalization for merging adjacent lists of the same type\n if (!Text.isText(normalizationNode)) {\n const mergeableChildren = Array.from(Node.children(editor, normalizationPath))\n .map((child, index, children) => {\n const potentialNodeToBeMerged = children.at(index + 1)\n if (\n !potentialNodeToBeMerged ||\n !ElementUtils.isList(potentialNodeToBeMerged[0]) ||\n !ElementUtils.isList(child[0]) ||\n potentialNodeToBeMerged[0].type !== child[0].type\n ) {\n return null\n }\n return [\n Editor.pathRef(editor, child[1]),\n Editor.pathRef(editor, potentialNodeToBeMerged[1]),\n ]\n })\n .filter((mergeableNodes): mergeableNodes is PathRef[] => Boolean(mergeableNodes))\n\n if (mergeableChildren.length !== 0) {\n mergeableChildren.reverse().forEach(([nodePathRef, nodeToBeMergedPathRef]) => {\n const nodePath = nodePathRef.current\n const nodeToBeMergedPath = nodeToBeMergedPathRef.current\n if (nodePath == null || nodeToBeMergedPath == null) return\n const nodeChildren = Array.from(Node.children(editor, nodePath))\n const childrenToBeMerged = Array.from(Node.children(editor, nodeToBeMergedPath))\n Editor.withoutNormalizing(editor, () => {\n childrenToBeMerged.forEach(([_, childPath], index) => {\n Transforms.moveNodes(editor, {\n at: childPath,\n to: [...nodePath, nodeChildren.length + index],\n })\n })\n Transforms.removeNodes(editor, { at: nodeToBeMergedPath })\n })\n nodePathRef.unref()\n nodeToBeMergedPathRef.unref()\n })\n return\n }\n }\n\n normalizeNode(entry)\n }\n\n return editor\n}\n","import { Editor, Text, Transforms } from 'slate'\nimport { clearActiveTypographyStyle } from './clearActiveTypographyStyle'\nimport { clearDeviceActiveTypography } from './clearDeviceActiveTypography'\nimport { detachActiveTypography } from './detachActiveTypography'\nimport { setActiveTypographyId } from './setActiveTypographyId'\nimport { setActiveTypographyStyle } from './setActiveTypographyStyle'\n\nexport const Typography = {\n setActiveTypographyId,\n setActiveTypographyStyle,\n clearActiveTypographyStyle,\n clearDeviceActiveTypography,\n detachActiveTypography,\n}\n\nexport function withTypography(editor: Editor) {\n const { normalizeNode } = editor\n editor.normalizeNode = entry => {\n const [normalizationNode, normalizationPath] = entry\n // Normalization typography with empty style and id to be text\n if (\n Text.isText(normalizationNode) &&\n normalizationNode?.typography?.id == null &&\n normalizationNode?.typography?.style.length === 0\n ) {\n Transforms.unsetNodes(editor, 'typography', { at: normalizationPath })\n return\n }\n\n normalizeNode(entry)\n }\n\n return editor\n}\n","import { Editor, Transforms } from 'slate'\nimport { setBlockKeyForDevice } from './setBlockKeyForDevice'\nimport { clearBlockKeyForDevice } from './clearBlockKeyForDevice'\nimport { ElementUtils } from '../utils/element'\n\nexport const Block = {\n setBlockKeyForDevice: setBlockKeyForDevice,\n clearBlockKeyForDevice: clearBlockKeyForDevice,\n}\n\nexport function withBlock(editor: Editor) {\n const { normalizeNode } = editor\n editor.normalizeNode = entry => {\n const [normalizationNode, normalizationPath] = entry\n // Normalization textAlign with empty array of values\n if (ElementUtils.isBlock(normalizationNode) && normalizationNode?.textAlign?.length == 0) {\n Transforms.unsetNodes(editor, 'textAlign', { at: normalizationPath })\n return\n }\n\n normalizeNode(entry)\n }\n\n return editor\n}\n","import {\n forwardRef,\n KeyboardEvent,\n Ref,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n} from 'react'\n\nimport { createEditor } from 'slate'\nimport { Slate, Editable, withReact, ReactEditor } from 'slate-react'\n\nimport { ElementIDValue, RichTextValue } from '../../../../prop-controllers/descriptors'\nimport { cx } from '@emotion/css'\nimport { DescriptorsPropControllers } from '../../../../prop-controllers/instances'\nimport { Descriptors } from '../../../../runtimes/react/controls/rich-text'\nimport { getBox } from '../../../../box-model'\nimport { PropControllersHandle } from '../../../../state/modules/prop-controller-handles'\nimport { BlockType, RichTextDAO, richTextDTOtoDAO } from '../../../../controls'\nimport { Leaf } from '../components/Leaf'\nimport { Element } from '../components/Element'\nimport { useSyncWithBuilder } from './useSyncWithBuilder'\nimport isHotkey from 'is-hotkey'\nimport { useBuilderEditMode } from '../../../../runtimes/react'\nimport { BuilderEditMode } from '../../../../state/modules/builder-edit-mode'\nimport { onKeyDown, withBlock, withList, withTypography } from '../../../../slate'\nimport { pollBoxModel } from '../../../../runtimes/react/poll-box-model'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst defaultText: RichTextDAO = [{ type: BlockType.Paragraph, children: [{ text: '' }] }]\n\nexport const EditableText = forwardRef(function EditableText(\n { id, text, width, margin }: Props,\n ref: Ref<PropControllersHandle<Descriptors>>,\n) {\n const [editor] = useState(() => withBlock(withTypography(withList(withReact(createEditor())))))\n const delaySync = useSyncWithBuilder(editor, text)\n const editMode = useBuilderEditMode()\n\n const [propControllers, setPropControllers] =\n useState<DescriptorsPropControllers<Descriptors> | null>(null)\n const controller = propControllers?.text\n\n useEffect(() => {\n if (controller == null) return\n\n const element = ReactEditor.toDOMNode(editor, editor)\n\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => controller.changeBoxModel(boxModel),\n })\n }, [editor, controller])\n\n useImperativeHandle(\n ref,\n () => ({\n getDomNode() {\n return ReactEditor.toDOMNode(editor, editor)\n },\n getBoxModel() {\n return getBox(ReactEditor.toDOMNode(editor, editor))\n },\n setPropControllers,\n }),\n [editor, setPropControllers],\n )\n\n const initialValue = useMemo(() => (text ? richTextDTOtoDAO(text) : defaultText), [text])\n\n useEffect(() => {\n controller?.setSlateEditor(editor)\n }, [controller, editor])\n\n const handleFocus = useCallback(() => {\n controller?.focus()\n }, [controller])\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (isHotkey('mod+shift+z', e)) return controller?.redo()\n if (isHotkey('mod+z', e)) return controller?.undo()\n if (isHotkey('escape')(e)) return controller?.blur()\n onKeyDown(e, editor)\n },\n [controller, editor],\n )\n\n return (\n <Slate editor={editor} value={initialValue} onChange={delaySync}>\n <Editable\n id={id}\n renderLeaf={Leaf}\n renderElement={Element}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n className={cx(width, margin)}\n readOnly={editMode === BuilderEditMode.INTERACT}\n placeholder=\"Write some text...\"\n />\n </Slate>\n )\n})\n\nexport default EditableText\n"],"names":["element","attributes","children","blockStyles","useStyle","margin","responsiveStyle","textAlign","type","BlockType","Paragraph","cx","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","padding","fontSize","fontWeight","borderLeft","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","className","restOfProps","textDecoration","InlineType","Code","SuperScript","SubScript","Link","link","props","COMMIT_DEBOUNCE_DELAY","editor","text","shouldCommit","setShouldCommit","useState","useEffect","nextValue","richTextDTOtoDAO","nextSelection","richTextDTOtoSelection","deepEqual","selection","onChange","timeoutId","window","setTimeout","clearTimeout","useCallback","Element","defaultText","EditableText","forwardRef","id","width","ref","withBlock","withTypography","withList","withReact","createEditor","delaySync","useSyncWithBuilder","editMode","useBuilderEditMode","propControllers","setPropControllers","controller","ReactEditor","toDOMNode","pollBoxModel","onBoxModelChange","boxModel","changeBoxModel","useImperativeHandle","getDomNode","getBoxModel","getBox","initialValue","useMemo","setSlateEditor","handleFocus","focus","handleKeyDown","e","isHotkey","redo","undo","blur","onKeyDown","Leaf","BuilderEditMode","INTERACT"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAU6B,sBAAA;AAAA,EAAEA;AAAAA,EAASC;AAAAA,EAAYC;AAAAA,GAAsC;AAClFC,QAAAA,cAAc,CAClBC,SAAS;AAAA,IAAEC,QAAQ;AAAA,EAAA,CAAX,GACRD,SAASE,gBAAgB,CAACN,QAAQO,SAAT,GAAqB,CAAC,CAACA,YAAY,YAAa;AAAA,IAAEA;AAAAA,EAAAA,EAAnD,CAAhB,CAFU;AAKZP,UAAAA,QAAQQ;AAAAA,SACTC,UAAUC;AACb,uEACST;QAAY,WAAWU,GAAG,GAAGR,WAAJ;AAAA,QAC7BD;AAAAA,MAAAA,EAFL;AAAA,SAKGO,UAAUG;AACb,wEACUX;QAAY,WAAWU,GAAG,GAAGR,WAAJ;AAAA,QAC9BD;AAAAA,MAAAA,EAFL;AAAA,SAKGO,UAAUI;AACb,wEACUZ;QAAY,WAAWU,GAAG,GAAGR,WAAJ;AAAA,QAC9BD;AAAAA,MAAAA,EAFL;AAAA,SAKGO,UAAUK;AACb,wEACUb;QAAY,WAAWU,GAAG,GAAGR,WAAJ;AAAA,QAC9BD;AAAAA,MAAAA,EAFL;AAAA,SAKGO,UAAUM;AACb,wEACUd;QAAY,WAAWU,GAAG,GAAGR,WAAJ;AAAA,QAC9BD;AAAAA,MAAAA,EAFL;AAAA,SAKGO,UAAUO;AACb,wEACUf;QAAY,WAAWU,GAAG,GAAGR,WAAJ;AAAA,QAC9BD;AAAAA,MAAAA,EAFL;AAAA,SAKGO,UAAUQ;AACb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,YAAU,MAAM;AACd+B,6CAAYa,eAAejD;AAAAA,EAA3B,GACC,CAACoC,YAAYpC,MAAb,CAFM;AAIHkD,QAAAA,cAAcjC,YAAY,MAAM;AACpCmB,6CAAYe;AAAAA,EAAZ,GACC,CAACf,UAAD,CAF4B;AAIzBgB,QAAAA,gBAAgBnC,YACpB,CAACoC,MAAqB;AAChBC,QAAAA,SAAS,eAAeD,CAAhB;AAAoB,aAAOjB,yCAAYmB;AAC/CD,QAAAA,SAAS,SAASD,CAAV;AAAc,aAAOjB,yCAAYoB;AACzCF,QAAAA,SAAS,QAAD,EAAWD,CAAnB;AAAuB,aAAOjB,yCAAYqB;AAC9CC,cAAUL,GAAGrD,MAAJ;AAAA,EAAA,GAEX,CAACoC,YAAYpC,MAAb,CAP+B;AAUjC,6BACG,OAAD;AAAA,IAAO;AAAA,IAAgB,OAAO+C;AAAAA,IAAc,UAAUjB;AAAAA,IAAtD,8BACG,UAAD;AAAA,MACE;AAAA,MACA,YAAY6B;AAAAA,MACZ,eAAezC;AAAAA,MACf,WAAWkC;AAAAA,MACX,SAASF;AAAAA,MACT,WAAW9E,GAAGmD,OAAOzD,MAAR;AAAA,MACb,UAAUkE,aAAa4B,gBAAgBC;AAAAA,MACvC,aAAY;AAAA,IAAA,CARd;AAAA,EAAA,CAFJ;AAcD,CAvEqC;AAyEtC,IAAA,iBAAezC;;"}
1
+ {"version":3,"file":"index.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,320 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ import { useCallback, useState, useEffect, forwardRef, useImperativeHandle, useMemo } from "react";
33
+ import { createEditor } from "slate";
34
+ import { withReact, ReactEditor, Slate, Editable } from "slate-react";
35
+ import { cx } from "@emotion/css";
36
+ import { g as getBox } from "./box-models.es.js";
37
+ import { aw as BlockType, ax as InlineType, at as richTextDTOtoDAO, as as richTextDTOtoSelection, az as BuilderEditMode } from "./descriptors.es.js";
38
+ import { L as Leaf } from "./leaf.es.js";
39
+ import { o as useStyle, r as responsiveStyle, Q as deepEqual, X as useBuilderEditMode, Y as pollBoxModel } from "./index.es.js";
40
+ import { jsx } from "react/jsx-runtime";
41
+ import { L as Link } from "./index.es3.js";
42
+ import isHotkey from "is-hotkey";
43
+ import { b as withBlock, a as withTypography, w as withList, o as onKeyDown } from "./index.es5.js";
44
+ import "css-box-model";
45
+ import "./actions.es.js";
46
+ import "./introspection.es.js";
47
+ import "use-sync-external-store/shim/with-selector";
48
+ import "next/dynamic";
49
+ import "./constants.es.js";
50
+ import "redux";
51
+ import "redux-thunk";
52
+ import "@emotion/serialize";
53
+ import "@emotion/utils";
54
+ import "./text-input.es.js";
55
+ import "./combobox.es.js";
56
+ import "use-sync-external-store/shim";
57
+ import "./types.es.js";
58
+ import "color";
59
+ import "scroll-into-view-if-needed";
60
+ import "react-dom";
61
+ import "html-react-parser";
62
+ import "next/head";
63
+ import "@emotion/server/create-instance";
64
+ import "next/document";
65
+ import "cookie";
66
+ import "cors";
67
+ import "http-proxy";
68
+ import "set-cookie-parser";
69
+ import "uuid";
70
+ import "corporate-ipsum";
71
+ import "next/link";
72
+ function BlockElement({
73
+ element,
74
+ attributes,
75
+ children
76
+ }) {
77
+ const blockStyles = [useStyle({
78
+ margin: 0
79
+ }), useStyle(responsiveStyle([element.textAlign], ([textAlign = "left"]) => ({
80
+ textAlign
81
+ })))];
82
+ switch (element.type) {
83
+ case BlockType.Paragraph:
84
+ return /* @__PURE__ */ jsx("p", __spreadProps(__spreadValues({}, attributes), {
85
+ className: cx(...blockStyles),
86
+ children
87
+ }));
88
+ case BlockType.Heading1:
89
+ return /* @__PURE__ */ jsx("h1", __spreadProps(__spreadValues({}, attributes), {
90
+ className: cx(...blockStyles),
91
+ children
92
+ }));
93
+ case BlockType.Heading2:
94
+ return /* @__PURE__ */ jsx("h2", __spreadProps(__spreadValues({}, attributes), {
95
+ className: cx(...blockStyles),
96
+ children
97
+ }));
98
+ case BlockType.Heading3:
99
+ return /* @__PURE__ */ jsx("h3", __spreadProps(__spreadValues({}, attributes), {
100
+ className: cx(...blockStyles),
101
+ children
102
+ }));
103
+ case BlockType.Heading4:
104
+ return /* @__PURE__ */ jsx("h4", __spreadProps(__spreadValues({}, attributes), {
105
+ className: cx(...blockStyles),
106
+ children
107
+ }));
108
+ case BlockType.Heading5:
109
+ return /* @__PURE__ */ jsx("h5", __spreadProps(__spreadValues({}, attributes), {
110
+ className: cx(...blockStyles),
111
+ children
112
+ }));
113
+ case BlockType.Heading6:
114
+ return /* @__PURE__ */ jsx("h6", __spreadProps(__spreadValues({}, attributes), {
115
+ className: cx(...blockStyles),
116
+ children
117
+ }));
118
+ case BlockType.BlockQuote:
119
+ return /* @__PURE__ */ jsx("blockquote", __spreadProps(__spreadValues({}, attributes), {
120
+ className: cx(...blockStyles, useStyle({
121
+ padding: "0.5em 10px",
122
+ fontSize: "1.25em",
123
+ fontWeight: "300",
124
+ borderLeft: "5px solid rgba(0, 0, 0, 0.1)"
125
+ })),
126
+ children
127
+ }));
128
+ case BlockType.OrderedList:
129
+ return /* @__PURE__ */ jsx("ol", __spreadProps(__spreadValues({}, attributes), {
130
+ className: cx(...blockStyles),
131
+ style: {
132
+ listStylePosition: "inside"
133
+ },
134
+ children
135
+ }));
136
+ case BlockType.UnorderedList:
137
+ return /* @__PURE__ */ jsx("ul", __spreadProps(__spreadValues({}, attributes), {
138
+ className: cx(...blockStyles),
139
+ style: {
140
+ listStylePosition: "inside"
141
+ },
142
+ children
143
+ }));
144
+ case BlockType.ListItem:
145
+ return /* @__PURE__ */ jsx("li", __spreadProps(__spreadValues({}, attributes), {
146
+ className: cx(...blockStyles),
147
+ children
148
+ }));
149
+ case BlockType.ListItemChild:
150
+ return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({}, attributes), {
151
+ className: cx(...blockStyles),
152
+ children
153
+ }));
154
+ }
155
+ }
156
+ function StyledLink(_a) {
157
+ var _b = _a, {
158
+ className
159
+ } = _b, restOfProps = __objRest(_b, [
160
+ "className"
161
+ ]);
162
+ return /* @__PURE__ */ jsx(Link, __spreadProps(__spreadValues({}, restOfProps), {
163
+ className: cx(useStyle({
164
+ textDecoration: "none"
165
+ }), className)
166
+ }));
167
+ }
168
+ function InlineElement({
169
+ element,
170
+ attributes,
171
+ children
172
+ }) {
173
+ switch (element.type) {
174
+ case InlineType.Code:
175
+ return /* @__PURE__ */ jsx("code", __spreadProps(__spreadValues({}, attributes), {
176
+ children
177
+ }));
178
+ case InlineType.SuperScript:
179
+ return /* @__PURE__ */ jsx("sup", __spreadProps(__spreadValues({}, attributes), {
180
+ children
181
+ }));
182
+ case InlineType.SubScript:
183
+ return /* @__PURE__ */ jsx("sub", __spreadProps(__spreadValues({}, attributes), {
184
+ children
185
+ }));
186
+ case InlineType.Link:
187
+ return /* @__PURE__ */ jsx(StyledLink, __spreadProps(__spreadValues({}, attributes), {
188
+ link: element.link,
189
+ children
190
+ }));
191
+ }
192
+ }
193
+ function Element(_c) {
194
+ var _d = _c, {
195
+ element
196
+ } = _d, props = __objRest(_d, [
197
+ "element"
198
+ ]);
199
+ switch (element.type) {
200
+ case InlineType.Code:
201
+ case InlineType.SuperScript:
202
+ case InlineType.SubScript:
203
+ case InlineType.Link:
204
+ return /* @__PURE__ */ jsx(InlineElement, __spreadValues({
205
+ element
206
+ }, props));
207
+ case BlockType.Paragraph:
208
+ case BlockType.Heading1:
209
+ case BlockType.Heading2:
210
+ case BlockType.Heading3:
211
+ case BlockType.BlockQuote:
212
+ case BlockType.OrderedList:
213
+ case BlockType.UnorderedList:
214
+ case BlockType.ListItem:
215
+ case BlockType.ListItemChild:
216
+ return /* @__PURE__ */ jsx(BlockElement, __spreadValues({
217
+ element
218
+ }, props));
219
+ default:
220
+ return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({}, props.attributes), {
221
+ children: props.children
222
+ }));
223
+ }
224
+ }
225
+ const COMMIT_DEBOUNCE_DELAY = 500;
226
+ function useSyncWithBuilder(editor, text) {
227
+ const [shouldCommit, setShouldCommit] = useState(true);
228
+ useEffect(() => {
229
+ if (shouldCommit && text) {
230
+ const nextValue = richTextDTOtoDAO(text);
231
+ const nextSelection = richTextDTOtoSelection(text);
232
+ if (!deepEqual(editor.children, nextValue) || !deepEqual(editor.selection, nextSelection)) {
233
+ editor.children = nextValue;
234
+ editor.selection = nextSelection;
235
+ editor.onChange();
236
+ }
237
+ }
238
+ }, [editor, shouldCommit, text]);
239
+ useEffect(() => {
240
+ if (shouldCommit)
241
+ return;
242
+ const timeoutId = window.setTimeout(() => {
243
+ setShouldCommit(true);
244
+ }, COMMIT_DEBOUNCE_DELAY);
245
+ return () => {
246
+ window.clearTimeout(timeoutId);
247
+ };
248
+ }, [shouldCommit]);
249
+ return useCallback(() => setShouldCommit(false), []);
250
+ }
251
+ const defaultText = [{
252
+ type: BlockType.Paragraph,
253
+ children: [{
254
+ text: ""
255
+ }]
256
+ }];
257
+ const EditableText = forwardRef(function EditableText2({
258
+ id,
259
+ text,
260
+ width,
261
+ margin
262
+ }, ref) {
263
+ const [editor] = useState(() => withBlock(withTypography(withList(withReact(createEditor())))));
264
+ const delaySync = useSyncWithBuilder(editor, text);
265
+ const editMode = useBuilderEditMode();
266
+ const [propControllers, setPropControllers] = useState(null);
267
+ const controller = propControllers == null ? void 0 : propControllers.text;
268
+ useEffect(() => {
269
+ if (controller == null)
270
+ return;
271
+ const element = ReactEditor.toDOMNode(editor, editor);
272
+ return pollBoxModel({
273
+ element,
274
+ onBoxModelChange: (boxModel) => controller.changeBoxModel(boxModel)
275
+ });
276
+ }, [editor, controller]);
277
+ useImperativeHandle(ref, () => ({
278
+ getDomNode() {
279
+ return ReactEditor.toDOMNode(editor, editor);
280
+ },
281
+ getBoxModel() {
282
+ return getBox(ReactEditor.toDOMNode(editor, editor));
283
+ },
284
+ setPropControllers
285
+ }), [editor, setPropControllers]);
286
+ const initialValue = useMemo(() => text ? richTextDTOtoDAO(text) : defaultText, [text]);
287
+ useEffect(() => {
288
+ controller == null ? void 0 : controller.setSlateEditor(editor);
289
+ }, [controller, editor]);
290
+ const handleFocus = useCallback(() => {
291
+ controller == null ? void 0 : controller.focus();
292
+ }, [controller]);
293
+ const handleKeyDown = useCallback((e) => {
294
+ if (isHotkey("mod+shift+z", e))
295
+ return controller == null ? void 0 : controller.redo();
296
+ if (isHotkey("mod+z", e))
297
+ return controller == null ? void 0 : controller.undo();
298
+ if (isHotkey("escape")(e))
299
+ return controller == null ? void 0 : controller.blur();
300
+ onKeyDown(e, editor);
301
+ }, [controller, editor]);
302
+ return /* @__PURE__ */ jsx(Slate, {
303
+ editor,
304
+ value: initialValue,
305
+ onChange: delaySync,
306
+ children: /* @__PURE__ */ jsx(Editable, {
307
+ id,
308
+ renderLeaf: Leaf,
309
+ renderElement: Element,
310
+ onKeyDown: handleKeyDown,
311
+ onFocus: handleFocus,
312
+ className: cx(width, margin),
313
+ readOnly: editMode === BuilderEditMode.INTERACT,
314
+ placeholder: "Write some text..."
315
+ })
316
+ });
317
+ });
318
+ var EditableText$1 = EditableText;
319
+ export { EditableText, EditableText$1 as default };
320
+ //# sourceMappingURL=index.es7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es7.js","sources":["../src/components/builtin/Text/components/Element/block.tsx","../src/components/builtin/Text/components/Element/inline.tsx","../src/components/builtin/Text/components/Element/element.tsx","../src/components/builtin/Text/EditableText/useSyncWithBuilder.tsx","../src/components/builtin/Text/EditableText/editable-text.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { RenderElementProps } from 'slate-react'\nimport { Block, BlockType } from '../../../../../controls'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { responsiveStyle } from '../../../../utils/responsive-style'\n\nexport interface InlineRenderElementProps extends RenderElementProps {\n element: Block\n}\n\nexport function BlockElement({ element, attributes, children }: InlineRenderElementProps) {\n const blockStyles = [\n useStyle({ margin: 0 }),\n useStyle(responsiveStyle([element.textAlign], ([textAlign = 'left']) => ({ textAlign }))),\n ]\n\n switch (element.type) {\n case BlockType.Paragraph:\n return (\n <p {...attributes} className={cx(...blockStyles)}>\n {children}\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote\n {...attributes}\n className={cx(\n ...blockStyles,\n useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n }),\n )}\n >\n {children}\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol {...attributes} className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n {children}\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul {...attributes} className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n {children}\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li {...attributes} className={cx(...blockStyles)}>\n {children}\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span {...attributes} className={cx(...blockStyles)}>\n {children}\n </span>\n )\n }\n}\n","import { cx } from '@emotion/css'\nimport { ComponentPropsWithoutRef } from 'react'\nimport { RenderElementProps } from 'slate-react'\nimport { Inline, InlineType } from '../../../../../controls'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { Link } from '../../../../shared/Link'\n\nfunction StyledLink({ className, ...restOfProps }: ComponentPropsWithoutRef<typeof Link>) {\n return <Link {...restOfProps} className={cx(useStyle({ textDecoration: 'none' }), className)} />\n}\n\nexport interface InlineRenderElementProps extends RenderElementProps {\n element: Inline\n}\n\nexport function InlineElement({ element, attributes, children }: InlineRenderElementProps) {\n switch (element.type) {\n case InlineType.Code:\n return <code {...attributes}>{children}</code>\n case InlineType.SuperScript:\n return <sup {...attributes}>{children}</sup>\n case InlineType.SubScript:\n return <sub {...attributes}>{children}</sub>\n case InlineType.Link:\n return (\n <StyledLink {...attributes} link={element.link}>\n {children}\n </StyledLink>\n )\n }\n}\n","import { RenderElementProps } from 'slate-react'\nimport { BlockType, InlineType } from '../../../../../controls'\nimport { BlockElement } from './block'\nimport { InlineElement } from './inline'\n\nexport function Element({ element, ...props }: RenderElementProps) {\n switch (element.type) {\n case InlineType.Code:\n case InlineType.SuperScript:\n case InlineType.SubScript:\n case InlineType.Link:\n return <InlineElement element={element} {...props} />\n case BlockType.Paragraph:\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement element={element} {...props} />\n default:\n return <span {...props.attributes}>{props.children}</span>\n }\n}\n","import { useState, useEffect, useCallback } from 'react'\nimport { Editor } from 'slate'\nimport { richTextDTOtoDAO, richTextDTOtoSelection } from '../../../../controls'\nimport { RichTextValue } from '../../../../prop-controllers'\nimport deepEqual from '../../../../utils/deepEqual'\n\nconst COMMIT_DEBOUNCE_DELAY = 500\n\n/**\n * Compare new prop value with current editor and update editor\n * if the values are not equal.\n */\nexport function useSyncWithBuilder(editor: Editor, text?: RichTextValue) {\n const [shouldCommit, setShouldCommit] = useState(true)\n\n useEffect(() => {\n if (shouldCommit && text) {\n const nextValue = richTextDTOtoDAO(text)\n const nextSelection = richTextDTOtoSelection(text)\n if (!deepEqual(editor.children, nextValue) || !deepEqual(editor.selection, nextSelection)) {\n editor.children = nextValue\n editor.selection = nextSelection\n editor.onChange()\n }\n }\n }, [editor, 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 return useCallback(() => setShouldCommit(false), [])\n}\n","import {\n forwardRef,\n KeyboardEvent,\n Ref,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n} from 'react'\n\nimport { createEditor } from 'slate'\nimport { Slate, Editable, withReact, ReactEditor } from 'slate-react'\n\nimport { ElementIDValue, RichTextValue } from '../../../../prop-controllers/descriptors'\nimport { cx } from '@emotion/css'\nimport { DescriptorsPropControllers } from '../../../../prop-controllers/instances'\nimport { Descriptors } from '../../../../runtimes/react/controls/rich-text'\nimport { getBox } from '../../../../box-model'\nimport { PropControllersHandle } from '../../../../state/modules/prop-controller-handles'\nimport { BlockType, RichTextDAO, richTextDTOtoDAO } from '../../../../controls'\nimport { Leaf } from '../components/Leaf'\nimport { Element } from '../components/Element'\nimport { useSyncWithBuilder } from './useSyncWithBuilder'\nimport isHotkey from 'is-hotkey'\nimport { useBuilderEditMode } from '../../../../runtimes/react'\nimport { BuilderEditMode } from '../../../../state/modules/builder-edit-mode'\nimport { onKeyDown, withBlock, withList, withTypography } from '../../../../slate'\nimport { pollBoxModel } from '../../../../runtimes/react/poll-box-model'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst defaultText: RichTextDAO = [{ type: BlockType.Paragraph, children: [{ text: '' }] }]\n\nexport const EditableText = forwardRef(function EditableText(\n { id, text, width, margin }: Props,\n ref: Ref<PropControllersHandle<Descriptors>>,\n) {\n const [editor] = useState(() => withBlock(withTypography(withList(withReact(createEditor())))))\n const delaySync = useSyncWithBuilder(editor, text)\n const editMode = useBuilderEditMode()\n\n const [propControllers, setPropControllers] =\n useState<DescriptorsPropControllers<Descriptors> | null>(null)\n const controller = propControllers?.text\n\n useEffect(() => {\n if (controller == null) return\n\n const element = ReactEditor.toDOMNode(editor, editor)\n\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => controller.changeBoxModel(boxModel),\n })\n }, [editor, controller])\n\n useImperativeHandle(\n ref,\n () => ({\n getDomNode() {\n return ReactEditor.toDOMNode(editor, editor)\n },\n getBoxModel() {\n return getBox(ReactEditor.toDOMNode(editor, editor))\n },\n setPropControllers,\n }),\n [editor, setPropControllers],\n )\n\n const initialValue = useMemo(() => (text ? richTextDTOtoDAO(text) : defaultText), [text])\n\n useEffect(() => {\n controller?.setSlateEditor(editor)\n }, [controller, editor])\n\n const handleFocus = useCallback(() => {\n controller?.focus()\n }, [controller])\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (isHotkey('mod+shift+z', e)) return controller?.redo()\n if (isHotkey('mod+z', e)) return controller?.undo()\n if (isHotkey('escape')(e)) return controller?.blur()\n onKeyDown(e, editor)\n },\n [controller, editor],\n )\n\n return (\n <Slate editor={editor} value={initialValue} onChange={delaySync}>\n <Editable\n id={id}\n renderLeaf={Leaf}\n renderElement={Element}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n className={cx(width, margin)}\n readOnly={editMode === BuilderEditMode.INTERACT}\n placeholder=\"Write some text...\"\n />\n </Slate>\n )\n})\n\nexport default EditableText\n"],"names":["element","attributes","children","blockStyles","useStyle","margin","responsiveStyle","textAlign","type","BlockType","Paragraph","cx","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","padding","fontSize","fontWeight","borderLeft","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","className","restOfProps","textDecoration","InlineType","Code","SuperScript","SubScript","Link","link","props","COMMIT_DEBOUNCE_DELAY","editor","text","shouldCommit","setShouldCommit","useState","useEffect","nextValue","richTextDTOtoDAO","nextSelection","richTextDTOtoSelection","deepEqual","selection","onChange","timeoutId","window","setTimeout","clearTimeout","useCallback","defaultText","EditableText","forwardRef","id","width","ref","withBlock","withTypography","withList","withReact","createEditor","delaySync","useSyncWithBuilder","editMode","useBuilderEditMode","propControllers","setPropControllers","controller","ReactEditor","toDOMNode","pollBoxModel","onBoxModelChange","boxModel","changeBoxModel","useImperativeHandle","getDomNode","getBoxModel","getBox","initialValue","useMemo","setSlateEditor","handleFocus","focus","handleKeyDown","e","isHotkey","redo","undo","blur","onKeyDown","Leaf","Element","BuilderEditMode","INTERACT"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAU6B,sBAAA;AAAA,EAAEA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GACC,CAACmC,YAAYnC,MAAb,CAFM;AAIHiD,QAAAA,cAAchC,YAAY,MAAM;AACpCkB,6CAAYe;AAAAA,EAAZ,GACC,CAACf,UAAD,CAF4B;AAIzBgB,QAAAA,gBAAgBlC,YACpB,CAACmC,MAAqB;AAChBC,QAAAA,SAAS,eAAeD,CAAhB;AAAoB,aAAOjB,yCAAYmB;AAC/CD,QAAAA,SAAS,SAASD,CAAV;AAAc,aAAOjB,yCAAYoB;AACzCF,QAAAA,SAAS,QAAD,EAAWD,CAAnB;AAAuB,aAAOjB,yCAAYqB;AAC9CC,cAAUL,GAAGpD,MAAJ;AAAA,EAAA,GAEX,CAACmC,YAAYnC,MAAb,CAP+B;AAUjC,6BACG,OAAD;AAAA,IAAO;AAAA,IAAgB,OAAO8C;AAAAA,IAAc,UAAUjB;AAAAA,IAAtD,8BACG,UAAD;AAAA,MACE;AAAA,MACA,YAAY6B;AAAAA,MACZ,eAAeC;AAAAA,MACf,WAAWR;AAAAA,MACX,SAASF;AAAAA,MACT,WAAW7E,GAAGkD,OAAOxD,MAAR;AAAA,MACb,UAAUiE,aAAa6B,gBAAgBC;AAAAA,MACvC,aAAY;AAAA,IAAA,CARd;AAAA,EAAA,CAFJ;AAcD,CAvEqC;AAyEtC,IAAA,iBAAe1C;;"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- var richText = require("./rich-text.cjs.js");
2
+ var descriptors = require("./descriptors.cjs.js");
3
3
  require("slate");
4
4
  require("slate-react");
5
5
  function isNonNullable(value) {
@@ -9,13 +9,13 @@ function getElementChildren(descriptor, prop) {
9
9
  if (prop == null)
10
10
  return [];
11
11
  switch (descriptor.type) {
12
- case richText.Types.Grid:
12
+ case descriptors.Types.Grid:
13
13
  return prop.elements;
14
- case richText.SlotControlType:
14
+ case descriptors.SlotControlType:
15
15
  return prop.elements;
16
- case richText.ListControlType:
16
+ case descriptors.ListControlType:
17
17
  return prop.flatMap(({ value }) => getElementChildren(descriptor.config.type, value));
18
- case richText.ShapeControlType: {
18
+ case descriptors.ShapeControlType: {
19
19
  const shapeControlData = prop;
20
20
  return Object.keys(shapeControlData).flatMap((key) => getElementChildren(descriptor.config.type[key], shapeControlData[key]));
21
21
  }
@@ -27,7 +27,7 @@ function getElementId(descriptor, prop) {
27
27
  if (prop == null)
28
28
  return null;
29
29
  switch (descriptor.type) {
30
- case richText.Types.ElementID:
30
+ case descriptors.Types.ElementID:
31
31
  return prop;
32
32
  default:
33
33
  return null;
@@ -82,11 +82,11 @@ function getElementSwatchIds(descriptor, prop) {
82
82
  if (prop == null)
83
83
  return [];
84
84
  switch (descriptor.type) {
85
- case richText.Types.Backgrounds:
85
+ case descriptors.Types.Backgrounds:
86
86
  return getBackgroundsSwatchIds(prop);
87
- case richText.Types.Border:
87
+ case descriptors.Types.Border:
88
88
  return getBorderSwatchIds(prop);
89
- case richText.Types.NavigationLinks: {
89
+ case descriptors.Types.NavigationLinks: {
90
90
  const value = prop;
91
91
  return (_a = value == null ? void 0 : value.flatMap((item) => {
92
92
  var _a2, _b, _c, _d;
@@ -100,11 +100,11 @@ function getElementSwatchIds(descriptor, prop) {
100
100
  }
101
101
  })) != null ? _a : [];
102
102
  }
103
- case richText.Types.ResponsiveColor:
103
+ case descriptors.Types.ResponsiveColor:
104
104
  return getResponsiveColorSwatchIds(prop);
105
- case richText.Types.Shadows:
105
+ case descriptors.Types.Shadows:
106
106
  return getBoxShadowsSwatchIds(prop);
107
- case richText.Types.RichText: {
107
+ case descriptors.Types.RichText: {
108
108
  let getNodeSwatchIds = function(node) {
109
109
  var _a2, _b, _c, _d;
110
110
  switch (node.object) {
@@ -126,7 +126,7 @@ function getElementSwatchIds(descriptor, prop) {
126
126
  return [];
127
127
  return getNodeSwatchIds(value.document);
128
128
  }
129
- case richText.ColorControlType: {
129
+ case descriptors.ColorControlType: {
130
130
  const value = prop;
131
131
  return (value == null ? void 0 : value.swatchId) == null ? [] : [value.swatchId];
132
132
  }
@@ -150,17 +150,17 @@ function getFileIds(descriptor, prop) {
150
150
  if (prop == null)
151
151
  return [];
152
152
  switch (descriptor.type) {
153
- case richText.Types.Backgrounds:
153
+ case descriptors.Types.Backgrounds:
154
154
  return getBackgroundsFileIds(prop);
155
- case richText.Types.Image: {
155
+ case descriptors.Types.Image: {
156
156
  const value = prop;
157
157
  return value == null ? [] : [value];
158
158
  }
159
- case richText.Types.Images: {
159
+ case descriptors.Types.Images: {
160
160
  const value = prop;
161
161
  return (_a = value == null ? void 0 : value.flatMap((item) => item.props.file == null ? [] : [item.props.file])) != null ? _a : [];
162
162
  }
163
- case richText.ImageControlType: {
163
+ case descriptors.ImageControlType: {
164
164
  const value = prop;
165
165
  return value == null ? [] : [value];
166
166
  }
@@ -172,7 +172,7 @@ function getTypographyIds(descriptor, prop) {
172
172
  if (prop == null)
173
173
  return [];
174
174
  switch (descriptor.type) {
175
- case richText.Types.RichText: {
175
+ case descriptors.Types.RichText: {
176
176
  let getNodeTypographyIds = function(node) {
177
177
  var _a, _b, _c, _d;
178
178
  switch (node.object) {
@@ -202,7 +202,7 @@ function getTableIds(descriptor, prop) {
202
202
  if (prop == null)
203
203
  return [];
204
204
  switch (descriptor.type) {
205
- case richText.Types.Table: {
205
+ case descriptors.Types.Table: {
206
206
  const value = prop;
207
207
  return value == null ? [] : [value];
208
208
  }
@@ -215,7 +215,7 @@ function getPageIds(descriptor, prop) {
215
215
  if (prop == null)
216
216
  return [];
217
217
  switch (descriptor.type) {
218
- case richText.Types.Link: {
218
+ case descriptors.Types.Link: {
219
219
  const value = prop;
220
220
  if (value == null)
221
221
  return [];
@@ -226,7 +226,7 @@ function getPageIds(descriptor, prop) {
226
226
  return [];
227
227
  }
228
228
  }
229
- case richText.Types.NavigationLinks: {
229
+ case descriptors.Types.NavigationLinks: {
230
230
  const value = prop;
231
231
  if (value == null)
232
232
  return [];
@@ -258,7 +258,7 @@ function getPageIds(descriptor, prop) {
258
258
  }
259
259
  })) != null ? _a : [];
260
260
  }
261
- case richText.Types.RichText: {
261
+ case descriptors.Types.RichText: {
262
262
  let getNodePageIds = function(node) {
263
263
  var _a2, _b;
264
264
  switch (node.object) {