@makeswift/runtime 0.8.5 → 0.8.7

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 (239) hide show
  1. package/dist/Box.cjs.js +11 -11
  2. package/dist/Box.cjs.js.map +1 -1
  3. package/dist/Box.es.js +9 -9
  4. package/dist/Box.es.js.map +1 -1
  5. package/dist/Button.cjs.js +36 -37
  6. package/dist/Button.cjs.js.map +1 -1
  7. package/dist/Button.es.js +13 -14
  8. package/dist/Button.es.js.map +1 -1
  9. package/dist/Carousel.cjs.js +38 -37
  10. package/dist/Carousel.cjs.js.map +1 -1
  11. package/dist/Carousel.es.js +19 -18
  12. package/dist/Carousel.es.js.map +1 -1
  13. package/dist/Countdown.cjs.js +55 -29
  14. package/dist/Countdown.cjs.js.map +1 -1
  15. package/dist/Countdown.es.js +35 -9
  16. package/dist/Countdown.es.js.map +1 -1
  17. package/dist/Divider.cjs.js +36 -10
  18. package/dist/Divider.cjs.js.map +1 -1
  19. package/dist/Divider.es.js +31 -5
  20. package/dist/Divider.es.js.map +1 -1
  21. package/dist/Embed.cjs.js +31 -5
  22. package/dist/Embed.cjs.js.map +1 -1
  23. package/dist/Embed.es.js +30 -4
  24. package/dist/Embed.es.js.map +1 -1
  25. package/dist/Form.cjs.js +72 -73
  26. package/dist/Form.cjs.js.map +1 -1
  27. package/dist/Form.es.js +32 -33
  28. package/dist/Form.es.js.map +1 -1
  29. package/dist/Image.cjs.js +22 -21
  30. package/dist/Image.cjs.js.map +1 -1
  31. package/dist/Image.es.js +20 -19
  32. package/dist/Image.es.js.map +1 -1
  33. package/dist/LiveProvider.cjs.js +12 -12
  34. package/dist/LiveProvider.cjs.js.map +1 -1
  35. package/dist/LiveProvider.es.js +12 -12
  36. package/dist/LiveProvider.es.js.map +1 -1
  37. package/dist/Navigation.cjs.js +33 -34
  38. package/dist/Navigation.cjs.js.map +1 -1
  39. package/dist/Navigation.es.js +14 -15
  40. package/dist/Navigation.es.js.map +1 -1
  41. package/dist/PreviewProvider.cjs.js +16 -13
  42. package/dist/PreviewProvider.cjs.js.map +1 -1
  43. package/dist/PreviewProvider.es.js +16 -13
  44. package/dist/PreviewProvider.es.js.map +1 -1
  45. package/dist/ReadOnlyText.cjs.js +15 -16
  46. package/dist/ReadOnlyText.cjs.js.map +1 -1
  47. package/dist/ReadOnlyText.es.js +11 -12
  48. package/dist/ReadOnlyText.es.js.map +1 -1
  49. package/dist/Root.cjs.js +10 -10
  50. package/dist/Root.cjs.js.map +1 -1
  51. package/dist/Root.es.js +8 -8
  52. package/dist/SocialLinks.cjs.js +12 -13
  53. package/dist/SocialLinks.cjs.js.map +1 -1
  54. package/dist/SocialLinks.es.js +7 -8
  55. package/dist/SocialLinks.es.js.map +1 -1
  56. package/dist/Text.cjs.js +3 -4
  57. package/dist/Text.cjs.js.map +1 -1
  58. package/dist/Text.es.js +4 -5
  59. package/dist/Text.es.js.map +1 -1
  60. package/dist/Video.cjs.js +31 -5
  61. package/dist/Video.cjs.js.map +1 -1
  62. package/dist/Video.es.js +30 -4
  63. package/dist/Video.es.js.map +1 -1
  64. package/dist/actions.cjs.js +6 -1
  65. package/dist/actions.cjs.js.map +1 -1
  66. package/dist/actions.es.js +6 -2
  67. package/dist/actions.es.js.map +1 -1
  68. package/dist/components.cjs.js +10 -10
  69. package/dist/components.es.js +10 -10
  70. package/dist/constants.cjs.js +13 -3
  71. package/dist/constants.cjs.js.map +1 -1
  72. package/dist/constants.es.js +13 -4
  73. package/dist/constants.es.js.map +1 -1
  74. package/dist/descriptors.cjs.js.map +1 -1
  75. package/dist/descriptors.es.js.map +1 -1
  76. package/dist/index.cjs.js +1010 -163
  77. package/dist/index.cjs.js.map +1 -1
  78. package/dist/index.cjs2.js +29 -29
  79. package/dist/index.cjs2.js.map +1 -1
  80. package/dist/index.cjs3.js +1 -2
  81. package/dist/index.cjs3.js.map +1 -1
  82. package/dist/index.cjs4.js +2 -2
  83. package/dist/index.cjs4.js.map +1 -1
  84. package/dist/index.cjs5.js +262 -109
  85. package/dist/index.cjs5.js.map +1 -1
  86. package/dist/index.cjs6.js +3 -4
  87. package/dist/index.cjs6.js.map +1 -1
  88. package/dist/index.cjs7.js +16 -17
  89. package/dist/index.cjs7.js.map +1 -1
  90. package/dist/index.es.js +965 -133
  91. package/dist/index.es.js.map +1 -1
  92. package/dist/index.es2.js +6 -6
  93. package/dist/index.es2.js.map +1 -1
  94. package/dist/index.es3.js +1 -2
  95. package/dist/index.es3.js.map +1 -1
  96. package/dist/index.es4.js +2 -2
  97. package/dist/index.es4.js.map +1 -1
  98. package/dist/index.es5.js +262 -109
  99. package/dist/index.es5.js.map +1 -1
  100. package/dist/index.es6.js +3 -4
  101. package/dist/index.es6.js.map +1 -1
  102. package/dist/index.es7.js +12 -13
  103. package/dist/index.es7.js.map +1 -1
  104. package/dist/introspection.cjs.js +5 -2
  105. package/dist/introspection.cjs.js.map +1 -1
  106. package/dist/introspection.es.js +4 -2
  107. package/dist/introspection.es.js.map +1 -1
  108. package/dist/leaf.cjs.js +15 -17
  109. package/dist/leaf.cjs.js.map +1 -1
  110. package/dist/leaf.es.js +10 -11
  111. package/dist/leaf.es.js.map +1 -1
  112. package/dist/main.cjs.js +2 -1
  113. package/dist/main.cjs.js.map +1 -1
  114. package/dist/main.es.js +2 -2
  115. package/dist/next.cjs.js +5 -6
  116. package/dist/next.cjs.js.map +1 -1
  117. package/dist/next.es.js +6 -7
  118. package/dist/next.es.js.map +1 -1
  119. package/dist/prop-controllers.cjs.js +0 -1
  120. package/dist/prop-controllers.cjs.js.map +1 -1
  121. package/dist/prop-controllers.es.js +0 -1
  122. package/dist/prop-controllers.es.js.map +1 -1
  123. package/dist/react.cjs.js +3 -4
  124. package/dist/react.cjs.js.map +1 -1
  125. package/dist/react.es.js +3 -4
  126. package/dist/react.es.js.map +1 -1
  127. package/dist/slate.cjs.js +1 -12
  128. package/dist/slate.cjs.js.map +1 -1
  129. package/dist/slate.es.js +1 -12
  130. package/dist/slate.es.js.map +1 -1
  131. package/dist/state/breakpoints.cjs.js +175 -0
  132. package/dist/state/breakpoints.cjs.js.map +1 -0
  133. package/dist/state/breakpoints.es.js +160 -0
  134. package/dist/state/breakpoints.es.js.map +1 -0
  135. package/dist/types/src/components/builtin/Box/Box.d.ts.map +1 -1
  136. package/dist/types/src/components/builtin/Box/register.d.ts.map +1 -1
  137. package/dist/types/src/components/builtin/Button/Button.d.ts.map +1 -1
  138. package/dist/types/src/components/builtin/Button/register.d.ts.map +1 -1
  139. package/dist/types/src/components/builtin/Carousel/Carousel.d.ts.map +1 -1
  140. package/dist/types/src/components/builtin/Carousel/register.d.ts.map +1 -1
  141. package/dist/types/src/components/builtin/Countdown/register.d.ts.map +1 -1
  142. package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
  143. package/dist/types/src/components/builtin/Form/components/Field/components/Label/index.d.ts.map +1 -1
  144. package/dist/types/src/components/builtin/Form/register.d.ts.map +1 -1
  145. package/dist/types/src/components/builtin/Image/Image.d.ts.map +1 -1
  146. package/dist/types/src/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts.map +1 -1
  147. package/dist/types/src/components/builtin/Navigation/components/MobileMenu/index.d.ts.map +1 -1
  148. package/dist/types/src/components/builtin/Navigation/register.d.ts.map +1 -1
  149. package/dist/types/src/components/builtin/SocialLinks/register.d.ts.map +1 -1
  150. package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts +0 -4
  151. package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts.map +1 -1
  152. package/dist/types/src/components/builtin/Text/register.d.ts.map +1 -1
  153. package/dist/types/src/components/hooks/useMediaQuery.d.ts.map +1 -1
  154. package/dist/types/src/components/utils/drop-first.d.ts +2 -0
  155. package/dist/types/src/components/utils/drop-first.d.ts.map +1 -0
  156. package/dist/types/src/components/utils/responsive-style.d.ts +21 -10
  157. package/dist/types/src/components/utils/responsive-style.d.ts.map +1 -1
  158. package/dist/types/src/controls/types.d.ts +1 -1
  159. package/dist/types/src/controls/types.d.ts.map +1 -1
  160. package/dist/types/src/index.d.ts +2 -2
  161. package/dist/types/src/index.d.ts.map +1 -1
  162. package/dist/types/src/next/api-handler/handlers/manifest.d.ts +1 -0
  163. package/dist/types/src/next/api-handler/handlers/manifest.d.ts.map +1 -1
  164. package/dist/types/src/next/client.d.ts +4 -1
  165. package/dist/types/src/next/client.d.ts.map +1 -1
  166. package/dist/types/src/next/index.d.ts +3 -1
  167. package/dist/types/src/next/index.d.ts.map +1 -1
  168. package/dist/types/src/prop-controllers/descriptors.d.ts +1 -1
  169. package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
  170. package/dist/types/src/runtimes/react/components/LiveProvider.d.ts +3 -1
  171. package/dist/types/src/runtimes/react/components/LiveProvider.d.ts.map +1 -1
  172. package/dist/types/src/runtimes/react/components/PreviewProvider.d.ts +3 -1
  173. package/dist/types/src/runtimes/react/components/PreviewProvider.d.ts.map +1 -1
  174. package/dist/types/src/runtimes/react/index.d.ts +22 -4
  175. package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
  176. package/dist/types/src/slate/BlockPlugin/clearBlockKeyForDevice.d.ts +2 -2
  177. package/dist/types/src/slate/BlockPlugin/clearBlockKeyForDevice.d.ts.map +1 -1
  178. package/dist/types/src/slate/BlockPlugin/index.d.ts +4 -0
  179. package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
  180. package/dist/types/src/slate/BlockPlugin/setBlockKeyForDevice.d.ts +7 -3
  181. package/dist/types/src/slate/BlockPlugin/setBlockKeyForDevice.d.ts.map +1 -1
  182. package/dist/types/src/slate/BlockPlugin/types.d.ts +2 -2
  183. package/dist/types/src/slate/BlockPlugin/types.d.ts.map +1 -1
  184. package/dist/types/src/slate/BlockPlugin/unwrapInline.d.ts +4 -0
  185. package/dist/types/src/slate/BlockPlugin/unwrapInline.d.ts.map +1 -0
  186. package/dist/types/src/slate/BlockPlugin/wrapInline.d.ts +4 -0
  187. package/dist/types/src/slate/BlockPlugin/wrapInline.d.ts.map +1 -0
  188. package/dist/types/src/slate/ListPlugin/toggleList.d.ts +2 -1
  189. package/dist/types/src/slate/ListPlugin/toggleList.d.ts.map +1 -1
  190. package/dist/types/src/slate/ListPlugin/unwrapList.d.ts +6 -2
  191. package/dist/types/src/slate/ListPlugin/unwrapList.d.ts.map +1 -1
  192. package/dist/types/src/slate/ListPlugin/utils/getSelectedListItems.d.ts +0 -1
  193. package/dist/types/src/slate/ListPlugin/utils/getSelectedListItems.d.ts.map +1 -1
  194. package/dist/types/src/slate/ListPlugin/wrapList.d.ts +2 -1
  195. package/dist/types/src/slate/ListPlugin/wrapList.d.ts.map +1 -1
  196. package/dist/types/src/slate/TypographyPlugin/clearActiveTypographyStyle.d.ts +6 -2
  197. package/dist/types/src/slate/TypographyPlugin/clearActiveTypographyStyle.d.ts.map +1 -1
  198. package/dist/types/src/slate/TypographyPlugin/clearDeviceActiveTypography.d.ts +6 -2
  199. package/dist/types/src/slate/TypographyPlugin/clearDeviceActiveTypography.d.ts.map +1 -1
  200. package/dist/types/src/slate/TypographyPlugin/detachActiveTypography.d.ts +6 -2
  201. package/dist/types/src/slate/TypographyPlugin/detachActiveTypography.d.ts.map +1 -1
  202. package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
  203. package/dist/types/src/slate/TypographyPlugin/setActiveTypographyId.d.ts +6 -2
  204. package/dist/types/src/slate/TypographyPlugin/setActiveTypographyId.d.ts.map +1 -1
  205. package/dist/types/src/slate/TypographyPlugin/setActiveTypographyStyle.d.ts +7 -2
  206. package/dist/types/src/slate/TypographyPlugin/setActiveTypographyStyle.d.ts.map +1 -1
  207. package/dist/types/src/slate/selectors.d.ts +19 -0
  208. package/dist/types/src/slate/selectors.d.ts.map +1 -0
  209. package/dist/types/src/slate/utils/editor.d.ts.map +1 -1
  210. package/dist/types/src/slate/utils/element.d.ts +2 -1
  211. package/dist/types/src/slate/utils/element.d.ts.map +1 -1
  212. package/dist/types/src/slate/utils/unhangRange.d.ts +10 -0
  213. package/dist/types/src/slate/utils/unhangRange.d.ts.map +1 -0
  214. package/dist/types/src/state/actions.d.ts +10 -1
  215. package/dist/types/src/state/actions.d.ts.map +1 -1
  216. package/dist/types/src/state/modules/breakpoints.d.ts +44 -0
  217. package/dist/types/src/state/modules/breakpoints.d.ts.map +1 -0
  218. package/dist/types/src/state/react-builder-preview.d.ts +2 -0
  219. package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
  220. package/dist/types/src/state/react-page.d.ts +5 -1
  221. package/dist/types/src/state/react-page.d.ts.map +1 -1
  222. package/dist/types/src/utils/isNonNullable.d.ts +2 -0
  223. package/dist/types/src/utils/isNonNullable.d.ts.map +1 -0
  224. package/dist/useMediaQuery.cjs.js +38 -0
  225. package/dist/useMediaQuery.cjs.js.map +1 -0
  226. package/dist/useMediaQuery.es.js +37 -0
  227. package/dist/useMediaQuery.es.js.map +1 -0
  228. package/package.json +10 -2
  229. package/state/breakpoints.js +1 -0
  230. package/dist/isNonNullable.cjs.js +0 -6
  231. package/dist/isNonNullable.cjs.js.map +0 -1
  232. package/dist/isNonNullable.es.js +0 -5
  233. package/dist/isNonNullable.es.js.map +0 -1
  234. package/dist/responsive-style.cjs.js +0 -917
  235. package/dist/responsive-style.cjs.js.map +0 -1
  236. package/dist/responsive-style.es.js +0 -853
  237. package/dist/responsive-style.es.js.map +0 -1
  238. package/dist/types/src/components/utils/devices.d.ts +0 -17
  239. package/dist/types/src/components/utils/devices.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.es5.js","sources":["../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/clearActiveTypographyStyle.ts","../src/slate/TypographyPlugin/clearDeviceActiveTypography.ts","../src/slate/TypographyPlugin/detachActiveTypography.ts","../src/slate/TypographyPlugin/setActiveTypographyId.ts","../src/slate/TypographyPlugin/setActiveTypographyStyle.ts","../src/slate/TypographyPlugin/index.ts","../src/slate/BlockPlugin/setBlockKeyForDevice.ts","../src/slate/BlockPlugin/clearBlockKeyForDevice.ts","../src/slate/BlockPlugin/index.ts"],"sourcesContent":["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.createText()],\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, Transforms, Text } from 'slate'\nimport { RichTextTypography } from '../../controls'\n\nexport function clearActiveTypographyStyle(editor: Editor) {\n if (!editor.selection) return\n\n // Due to the nested nature of `typography` I can't just call a single `Transforms.setNodes` on our selection\n const textNodes = Editor.nodes(editor, {\n at: editor.selection,\n match: node => Text.isText(node),\n })\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const typography: RichTextTypography = {\n ...node.typography,\n style: [],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography,\n },\n { at: path },\n )\n }\n }\n}\n","import { Editor, Transforms, Text } from 'slate'\nimport { RichTextTypography } from '../../controls'\n\nexport function clearDeviceActiveTypography(editor: Editor, currentDeviceId: string) {\n if (!editor.selection) return\n\n const textNodes = Editor.nodes(editor, {\n at: editor.selection,\n match: node => Text.isText(node),\n })\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const typography: RichTextTypography = {\n ...node.typography,\n style: node?.typography?.style.filter(({ deviceId }) => deviceId !== currentDeviceId) ?? [],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography,\n },\n { at: path },\n )\n }\n }\n}\n","import { Editor, Transforms, Text } from 'slate'\nimport { RichTextTypography } from '../../controls'\n\nexport function detachActiveTypography(editor: Editor, value: RichTextTypography['style']) {\n if (!editor.selection) return\n\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: editor.selection,\n match: node => Text.isText(node),\n }),\n )\n\n textNodes.forEach(([node, path]) => {\n if (Text.isText(node)) {\n Transforms.setNodes(\n editor,\n {\n typography: {\n style: value,\n },\n },\n { at: path },\n )\n }\n })\n}\n","import { Editor, Transforms, Text } from 'slate'\n\nexport function setActiveTypographyId(editor: Editor, id: string) {\n Transforms.setNodes(\n editor,\n {\n typography: {\n id,\n style: [],\n },\n },\n {\n match: node => Text.isText(node),\n },\n )\n}\n","import { Editor, Transforms, Text } from 'slate'\nimport { isDeviceOverride } from '../../components/builtin/Text/components/Leaf'\nimport { findDeviceOverride } from '../../components/utils/devices'\nimport { RichTextTypography } from '../../controls'\n\nexport function setActiveTypographyStyle(\n editor: Editor,\n deviceId: string,\n prop: string,\n value?: unknown,\n) {\n if (!editor.selection) return\n\n const textNodes = Editor.nodes(editor, {\n at: editor.selection,\n match: node => Text.isText(node),\n })\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const deviceOverrides = node?.typography?.style.filter(isDeviceOverride) ?? []\n const deviceStyle = findDeviceOverride(deviceOverrides, deviceId, v => v) || { value: {} }\n const nextDeviceStyle = {\n deviceId,\n value: { ...deviceStyle.value, [prop]: value },\n }\n const nextTypography: RichTextTypography = {\n ...node.typography,\n style: [...deviceOverrides.filter(v => v.deviceId !== deviceId), nextDeviceStyle],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography: nextTypography,\n },\n { at: path },\n )\n }\n }\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 { findDeviceOverride } from '../../components/utils/devices'\nimport { Device } from '../../controls/types'\nimport { ElementUtils } from '../utils/element'\nimport { EditableBlockKey, EditableBlockValue } from './types'\n\nexport function setBlockKeyForDevice(\n editor: Editor,\n deviceId: Device,\n key: EditableBlockKey,\n value: EditableBlockValue,\n) {\n if (!editor.selection) return\n\n const rootElements = Editor.nodes(editor, {\n match: (_, path) => path.length === 1,\n at: Editor.unhangRange(editor, editor.selection),\n })\n\n for (const [node, path] of rootElements) {\n if (ElementUtils.isBlock(node)) {\n const deviceValues = node[key] ?? []\n const currentDeviceValue = findDeviceOverride(deviceValues, deviceId, v => v)\n const nextDeviceValue = {\n ...currentDeviceValue,\n deviceId,\n value,\n }\n Transforms.setNodes(\n editor,\n {\n [key]: [...deviceValues.filter(v => v.deviceId !== deviceId), nextDeviceValue],\n },\n { at: path },\n )\n }\n }\n}\n","import { Editor, Transforms } from 'slate'\nimport { Device } from '../../controls/types'\nimport { ElementUtils } from '../utils/element'\nimport { EditableBlockKey } from './types'\n\nexport function clearBlockKeyForDevice(editor: Editor, deviceId: Device, key: EditableBlockKey) {\n if (!editor.selection) return\n\n const rootElements = Editor.nodes(editor, {\n match: (_, path) => path.length === 1,\n at: Editor.unhangRange(editor, editor.selection),\n })\n\n for (const [node, path] of rootElements) {\n if (ElementUtils.isBlock(node)) {\n const deviceOverrides = node[key] ?? []\n Transforms.setNodes(\n editor,\n {\n [key]: deviceOverrides.filter(v => v.deviceId !== deviceId),\n },\n { at: path },\n )\n }\n }\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 normalizeN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ACF;AACF;AChCuC,gCAAA,QAAgB,UAAkB,KAAuB;;AAC9F,MAAI,CAAC,OAAO;AAAW;AAEjB,QAAA,eAAe,OAAO,MAAM,QAAQ;AAAA,IACxC,OAAO,CAAC,GAAG,SAAS,KAAK,WAAW;AAAA,IACpC,IAAI,OAAO,YAAY,QAAQ,OAAO,SAAS;AAAA,EAAA,CAChD;AAEU,aAAA,CAAC,MAAM,SAAS,cAAc;AACnC,QAAA,aAAa,QAAQ,IAAI,GAAG;AACxB,YAAA,kBAAkB,WAAK,SAAL,YAAa,CAAA;AACrC,iBAAW,SACT,QACA;AAAA,SACG,MAAM,gBAAgB,OAAO,CAAK,MAAA,EAAE,aAAa,QAAQ;AAAA,MAAA,GAE5D,EAAE,IAAI,KAAA,CACR;AAAA,IACF;AAAA,EACF;AACF;ACpBO,MAAM,QAAQ;AAAA,EACnB;AAAA,EACA;AACF;AAEO,mBAAmB,QAAgB;AACxC,QAAM,EAAE,kBAAkB;AAC1B,SAAO,gBAAgB,CAAS,UAAA;;AACxB,UAAA,CAAC,mBAAmB,qBAAqB;AAE/C,QAAI,aAAa,QAAQ,iBAAiB,KAAK,8DAAmB,cAAnB,mBAA8B,WAAU,GAAG;AACxF,iBAAW,WAAW,QAAQ,aAAa,EAAE,IAAI,mBAAmB;AACpE;AAAA,IACF;AAEA,kBAAc,KAAK;AAAA,EAAA;AAGd,SAAA;AACT;;"}
1
+ {"version":3,"file":"index.es5.js","sources":["../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/clearActiveTypographyStyle.ts","../src/slate/TypographyPlugin/clearDeviceActiveTypography.ts","../src/slate/TypographyPlugin/detachActiveTypography.ts","../src/slate/TypographyPlugin/setActiveTypographyId.ts","../src/slate/TypographyPlugin/setActiveTypographyStyle.ts","../src/slate/TypographyPlugin/index.ts","../src/slate/utils/unhangRange.ts","../src/slate/selectors.ts","../src/slate/BlockPlugin/setBlockKeyForDevice.ts","../src/slate/BlockPlugin/clearBlockKeyForDevice.ts","../src/slate/BlockPlugin/wrapInline.ts","../src/slate/BlockPlugin/unwrapInline.ts","../src/slate/BlockPlugin/index.ts"],"sourcesContent":["export const LIST_ITEM_CHILD_POSITION = 0\nexport const LIST_ITEM_LIST_POSITION = 1\n","import { Node, Element } from 'slate'\nimport {\n RootBlock,\n BlockType,\n Block,\n Inline,\n InlineType,\n ParagraphElement,\n OrderedListElement,\n UnorderedListElement,\n ListItemElement,\n ListItemChildElement,\n} from '../../controls'\n\nexport const ElementUtils = {\n isRootBlock(node: Node): node is RootBlock {\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 )\n },\n isBlock(node: Node): node is Block {\n return (\n Element.isElement(node) &&\n (this.isRootBlock(node) ||\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.isElementType(node, InlineType.Code) ||\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'\n\nimport { ElementUtils } from './element'\nimport { ListElement, ListItemElement } from '../../controls'\n\nexport const EditorUtils = {\n getFirstAncestorList(editor: Editor, path: Path): NodeEntry<ListElement> | null {\n try {\n const parentList = Editor.above(editor, {\n at: path,\n match: (node): node is ListElement => ElementUtils.isList(node),\n })\n return parentList ?? null\n } catch (e) {\n return null\n }\n },\n getFirstAncestorListItem(editor: Editor, path: Path): NodeEntry<ListItemElement> | null {\n try {\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 } catch (e) {\n return null\n }\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","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, Element, Transforms, Path, Node, Location, Span } from 'slate'\nimport { EditorUtils } from '../utils/editor'\nimport { LIST_ITEM_CHILD_POSITION, LIST_ITEM_LIST_POSITION } from './constants'\nimport { filterForSubtreeRoots } from './utils/filterForSubtreeRoots'\nimport { ElementUtils } from '../utils/element'\nimport { BlockType } from '../../controls'\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\ntype UnwrapListOptions = {\n at?: Location | Span\n}\n\nexport function unwrapList(editor: Editor, options?: UnwrapListOptions) {\n const at = options?.at ?? editor.selection\n if (!at) return\n\n const listItems = Array.from(\n Editor.nodes(editor, {\n at,\n match: node => {\n return Element.isElement(node) && ElementUtils.isListItem(node)\n },\n }),\n )\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, Location, Span, Transforms } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { BlockType } from '../../controls'\n\ntype WrapListOptions = {\n type: typeof BlockType.UnorderedList | typeof BlockType.OrderedList\n at?: Location | Span\n}\n\nexport function wrapList(\n editor: Editor,\n options: WrapListOptions = { type: BlockType.UnorderedList },\n) {\n const at = options.at ?? editor.selection\n if (!at) return\n\n const nonListEntries = Array.from(\n Editor.nodes(editor, {\n at,\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 match: node => ElementUtils.isListItemChild(node),\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, Location, Node, Path, Transforms } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { unwrapList } from './unwrapList'\nimport { LocationUtils } from './utils/location'\nimport { wrapList } from './wrapList'\nimport { BlockType } from '../../controls'\n\ntype ToggleListOptions = {\n type: typeof BlockType.UnorderedList | typeof BlockType.OrderedList\n at?: Location\n}\n\nexport function toggleList(\n editor: Editor,\n options: ToggleListOptions = { type: BlockType.UnorderedList },\n) {\n const at = options.at ?? editor.selection\n if (at == null) return\n const start = LocationUtils.getStartPath(at)\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, at })\n }\n\n if (ancestor.type === options.type) {\n unwrapList(editor, { at })\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.reverse().forEach(([_, childPath]) => {\n Transforms.moveNodes(editor, {\n at: childPath,\n to: [...nodePath, nodeChildren.length],\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, Transforms, Text, Range } from 'slate'\nimport { RichTextTypography } from '../../controls'\n\ntype ClearActiveTypographyStyleOptions = {\n at?: Range\n}\n\nexport function clearActiveTypographyStyle(\n editor: Editor,\n options?: ClearActiveTypographyStyleOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const typography: RichTextTypography = {\n ...node.typography,\n style: [],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography,\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\nimport { RichTextTypography } from '../../controls'\n\ntype ClearDeviceActiveTypographyOptions = {\n at?: Range\n}\n\nexport function clearDeviceActiveTypography(\n editor: Editor,\n currentDeviceId: string,\n options?: ClearDeviceActiveTypographyOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const typography: RichTextTypography = {\n ...node.typography,\n style:\n node?.typography?.style.filter(({ deviceId }) => deviceId !== currentDeviceId) ?? [],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography,\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\nimport { RichTextTypography } from '../../controls'\n\ntype SetActiveTypographyIdOptions = {\n at?: Range\n}\n\nexport function detachActiveTypography(\n editor: Editor,\n value: RichTextTypography['style'],\n options?: SetActiveTypographyIdOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n Transforms.setNodes(\n editor,\n {\n typography: {\n style: value,\n },\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\n\ntype SetActiveTypographyIdOptions = {\n at?: Range\n}\n\nexport function setActiveTypographyId(\n editor: Editor,\n id?: string,\n options?: SetActiveTypographyIdOptions,\n) {\n const at = options?.at ?? editor.selection\n if (!at) return\n Transforms.setNodes(\n editor,\n {\n typography: {\n id,\n style: [],\n },\n },\n {\n at,\n match: node => Text.isText(node),\n split: Range.isExpanded(at),\n },\n )\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\nimport { RichTextTypography } from '../../controls'\nimport { Breakpoints, findBreakpointOverride, BreakpointId } from '../../state/modules/breakpoints'\n\ntype SetActiveTypographyStyleOptions = {\n at?: Range\n}\n\nexport function setActiveTypographyStyle(\n editor: Editor,\n breakpoints: Breakpoints,\n deviceId: string,\n prop: string,\n value?: unknown,\n options?: SetActiveTypographyStyleOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const deviceOverrides = node?.typography?.style ?? []\n const deviceStyle = findBreakpointOverride(\n breakpoints,\n deviceOverrides,\n deviceId as BreakpointId,\n v => v,\n ) || {\n value: {},\n }\n const nextDeviceStyle = {\n deviceId,\n value: { ...deviceStyle.value, [prop]: value },\n }\n\n const nextTypography: RichTextTypography = {\n ...node.typography,\n style: [...deviceOverrides.filter(v => v.deviceId !== deviceId), nextDeviceStyle],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography: nextTypography,\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\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 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 if (Text.isText(normalizationNode) && normalizationNode?.slice != null) {\n Transforms.unsetNodes(editor, 'slice', { at: normalizationPath })\n return\n }\n\n normalizeNode(entry)\n }\n\n return editor\n}\n","import { Editor, Range, Element, Text, Path } from 'slate'\n\n/**\n * The `Editor.unhangeRange` within Slate early exits if `Path.hasPrevious(end.path)` ie if this isn't a root block.\n * Unfortunately when you `setNode(..., {split:true})` or `wrapNodes()` you also have a hanging selection, but not in the root position.\n *\n * This c/p removes the `Path.hasPrevious(end.path)` from the early exit but it the same otherwise\n */\nfunction unhangRange(editor: Editor, range: Range): Range {\n // eslint-disable-next-line prefer-const\n let [start, end] = Range.edges(range)\n // PERF: exit early if we can guarantee that the range isn't hanging.\n if (start.offset !== 0 || end.offset !== 0 || Range.isCollapsed(range)) {\n return range\n }\n\n const endBlock = Editor.above(editor, {\n at: end,\n match: n => Element.isElement(n) && Editor.isBlock(editor, n),\n })\n const blockPath = endBlock ? endBlock[1] : []\n const first = Editor.start(editor, start)\n const before = { anchor: first, focus: end }\n let skip = true\n\n for (const [node, path] of Editor.nodes(editor, {\n at: before,\n match: Text.isText,\n reverse: true,\n })) {\n if (skip) {\n skip = false\n continue\n }\n\n if (node.text !== '' || Path.isBefore(path, blockPath)) {\n end = { path, offset: node.text.length }\n break\n }\n }\n\n return { anchor: start, focus: end }\n}\n\nexport default unhangRange\n","import { Editor, NodeEntry, Range, Text } from 'slate'\nimport { EditableBlockKey } from './BlockPlugin/types'\nimport { ElementUtils } from './utils/element'\n\nimport unhangRange from './utils/unhangRange'\nimport shallowEqual from '../utils/shallowEqual'\nimport { isNonNullable } from '../utils/isNonNullable'\n\nimport {\n RootBlock,\n Inline,\n RootBlockType,\n ResponsiveBlockTextAlignment,\n BlockTextAlignment,\n RichTextTypography,\n} from '../controls'\nimport { Breakpoints, BreakpointId, findBreakpointOverride } from '../state/modules/breakpoints'\nimport deepEqual from '../utils/deepEqual'\nimport keys from '../utils/keys'\n\nexport function getSelection(editor: Editor): Range {\n if (editor.selection) return unhangRange(editor, editor.selection)\n return {\n anchor: Editor.start(editor, []),\n focus: Editor.end(editor, []),\n }\n}\n\nexport function getBlocksInSelection(editor: Editor): NodeEntry<RootBlock>[] {\n return Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => ElementUtils.isRootBlock(node),\n }),\n ).filter((entry): entry is NodeEntry<RootBlock> => ElementUtils.isRootBlock(entry[0]))\n}\n\nexport function getInlinesInSelection(editor: Editor): NodeEntry<Inline>[] {\n return Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => ElementUtils.isInline(node),\n }),\n ).filter((entry): entry is NodeEntry<Inline> => ElementUtils.isInline(entry[0]))\n}\n\nexport function getActiveBlockType(editor: Editor): RootBlockType | null {\n const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type)\n\n return rootBlocks.reduce<RootBlockType | null>(\n (a, b) => (a === b ? b : null),\n rootBlocks.at(0) ?? null,\n )\n}\n\nexport function getActiveBlockValue(editor: Editor, key: EditableBlockKey) {\n const blocks = getBlocksInSelection(editor)\n\n const active = blocks.map(\n ([block]) => block[key] ?? null,\n ) as (ResponsiveBlockTextAlignment | null)[]\n\n return active.length === 0 ? null : active.reduce((a, b) => (shallowEqual(a, b) ? b : null))\n}\n\nexport function getActiveBlockDeviceOverrideValue(\n editor: Editor,\n key: EditableBlockKey,\n breakpoints: Breakpoints,\n deviceId: BreakpointId,\n) {\n const active: (BlockTextAlignment | null)[] = []\n const blocks = getBlocksInSelection(editor)\n\n blocks.forEach(([block]) => {\n const deviceOverride =\n findBreakpointOverride<BlockTextAlignment>(breakpoints, block[key], deviceId) || null\n active.push(deviceOverride?.value ?? null)\n })\n\n return active.length === 0 ? null : active.reduce((a, b) => (shallowEqual(a, b) ? b : null))\n}\n\n// Typography\n\nconst concat = (a: unknown[], b: unknown[]) => a.concat(b)\n\n// TODO: This is more cruft from trying to remove null from the typography type. This optimization is not worth it.\n/**\n * This is a c/p of the intersection of the utils from the root utils folder.\n * The only change is defaulting to undefined instead of to null.\n */\nexport default function intersection<A extends Record<string, unknown>, B extends A>(\n a: A,\n b: B,\n isEqual: (a: unknown, b: unknown) => boolean = deepEqual,\n): { [K in keyof A]: A[K] | undefined } {\n const allKeys = [...new Set([...keys(a), ...keys(b)])] as (keyof A)[]\n\n return allKeys.reduce((acc, k) => {\n if (isEqual(a[k], b[k])) acc[k] = a[k]\n else acc[k] = undefined\n\n return acc\n }, {} as { [K in keyof A]: A[K] | undefined })\n}\n\nconst fuseTypographyMarks = (\n values: Array<RichTextTypography | null | undefined>,\n breakpoints: Breakpoints,\n): RichTextTypography => {\n const devices = [\n ...new Set(\n values\n .filter(isNonNullable)\n .map(({ style }) => style.map(({ deviceId }) => deviceId))\n .reduce(concat, []),\n ),\n ] as BreakpointId[]\n\n return {\n id: values.map(v => v && v.id).reduce((a, b) => (a === b ? a : undefined)) ?? undefined,\n style: devices.map(deviceId =>\n values\n .map(\n v =>\n (v && findBreakpointOverride(breakpoints, v.style, deviceId)) || {\n deviceId,\n value: {},\n },\n )\n .reduce((acc, { value }) => {\n const a = intersection(acc.value, value)\n return {\n deviceId,\n value: a,\n }\n }),\n ),\n }\n}\n\nexport function getActiveTypographyMark(\n editor: Editor,\n breakpoints: Breakpoints,\n): RichTextTypography {\n const active: RichTextTypography[] = []\n\n const textNodes = Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => Text.isText(node),\n })\n\n for (const [node] of textNodes) {\n if (Text.isText(node) && 'typography' in node && node.typography != undefined) {\n active.push(node.typography)\n }\n }\n return active.length === 0 ? { style: [] } : fuseTypographyMarks(active, breakpoints)\n}\n","import { Editor, Transforms, Location } from 'slate'\nimport { getBlocksInSelection } from '../selectors'\nimport { ElementUtils } from '../utils/element'\nimport { EditableBlockKey, EditableBlockValue } from './types'\nimport { Breakpoints, BreakpointId, findBreakpointOverride } from '../../state/modules/breakpoints'\n\ntype SetBlockKeyForDeviceOptions = {\n at?: Location\n}\n\nexport function setBlockKeyForDevice(\n editor: Editor,\n breakpoints: Breakpoints,\n deviceId: BreakpointId,\n key: EditableBlockKey,\n value: EditableBlockValue[number]['value'],\n options?: SetBlockKeyForDeviceOptions,\n) {\n const at = options?.at ?? editor.selection\n if (!at) return\n\n const rootElements = getBlocksInSelection(editor)\n\n for (const [node, path] of rootElements) {\n if (ElementUtils.isBlock(node)) {\n const deviceValues = node[key] ?? []\n const currentDeviceValue = findBreakpointOverride(breakpoints, deviceValues, deviceId, v => v)\n const nextDeviceValue = {\n ...currentDeviceValue,\n deviceId,\n value,\n }\n Transforms.setNodes(\n editor,\n {\n [key]: [...deviceValues.filter(v => v.deviceId !== deviceId), nextDeviceValue],\n },\n { at: path },\n )\n }\n }\n}\n","import { Editor, Transforms } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { EditableBlockKey } from './types'\nimport { getBlocksInSelection } from '../selectors'\nimport { BreakpointId } from '../../state/modules/breakpoints'\n\nexport function clearBlockKeyForDevice(\n editor: Editor,\n deviceId: BreakpointId,\n key: EditableBlockKey,\n) {\n const rootElements = getBlocksInSelection(editor)\n\n for (const [node, path] of rootElements) {\n if (ElementUtils.isBlock(node)) {\n const deviceOverrides = node[key] ?? []\n Transforms.setNodes(\n editor,\n {\n [key]: deviceOverrides.filter(v => v.deviceId !== deviceId),\n },\n { at: path },\n )\n }\n }\n}\n","import { Editor, Transforms } from 'slate'\nimport { getSelection } from '../selectors'\nimport { Inline } from '../../controls'\n\nexport function wrapInline(editor: Editor, inline: Inline) {\n Transforms.wrapNodes(editor, inline, {\n at: getSelection(editor),\n split: true,\n })\n}\n","import { Editor, Transforms } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { getSelection } from '../selectors'\nimport { InlineType } from '../../controls'\n\nexport function unwrapInline(editor: Editor, type: InlineType) {\n Transforms.unwrapNodes(editor, {\n match: node => ElementUtils.isInline(node) && node.type === type,\n at: getSelection(editor),\n })\n}\n","import { Editor, Transforms } from 'slate'\nimport { setBlockKeyForDevice } from './setBlockKeyForDevice'\nimport { clearBlockKeyForDevice } from './clearBlockKeyForDevice'\nimport { wrapInline } from './wrapInline'\nimport { unwrapInline } from './unwrapInline'\nimport { ElementUtils } from '../utils/element'\n\nexport const Block = {\n setBlockKeyForDevice,\n clearBlockKeyForDevice,\n wrapInline,\n unwrapInline,\n}\n\nexport function withBlock(editor: Editor) {\n const { normalizeNode } = editor\n\n editor.isInline = entry => {\n return ElementUtils.isInline(entry)\n }\n\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"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAM,2BAA2B;AACjC,MAAM,0BAA0B;ACahC,MAAM,eAAe;AAAA,EAC1B,YAAY,MAA+B;AACzC,WACE,QAAQ,UAAU,IAAI,cACb,cAAc,MAAM,UAAU,SAAS,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,UAAU,KAChD,QAAQ,cAAc,MAAM,UAAU,aAAa,KACnD,QAAQ,cAAc,MAAM,UAAU,WAAW;AAAA,EAEvD;AAAA,EACA,QAAQ,MAA2B;AACjC,WACE,QAAQ,UAAU,IAAI,KAChB,MAAA,YAAY,IAAI,KACpB,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,aAAa;AAAA,EAEzD;AAAA,EACA,SAAS,MAA4B;AAEjC,WAAA,QAAQ,cAAc,MAAM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B,CAAS,UAAA;;AACxB,UAAA,CAAC,mBAAmB,qBAAqB;AAE/C,QAAI,aAAa,QAAQ,iBAAiB,KAAK,8DAAmB,cAAnB,mBAA8B,WAAU,GAAG;AACxF,iBAAW,WAAW,QAAQ,aAAa,EAAE,IAAI,mBAAmB;AACpE;AAAA,IACF;AAEA,kBAAc,KAAK;AAAA,EAAA;AAGd,SAAA;AACT;;"}
package/dist/index.es6.js CHANGED
@@ -10,17 +10,16 @@ import "./actions.es.js";
10
10
  import "./descriptors.es.js";
11
11
  import "slate";
12
12
  import "slate-react";
13
+ import "./state/breakpoints.es.js";
13
14
  import "./introspection.es.js";
14
- import "./isNonNullable.es.js";
15
- import "./responsive-style.es.js";
16
15
  import "@emotion/css";
17
16
  import "@emotion/serialize";
18
17
  import "@emotion/utils";
19
- import "use-sync-external-store/shim";
20
- import "./types.es.js";
21
18
  import "react/jsx-runtime";
22
19
  import "./text-input.es.js";
23
20
  import "./combobox.es.js";
21
+ import "use-sync-external-store/shim";
22
+ import "./types.es.js";
24
23
  import "./box-models.es.js";
25
24
  import "css-box-model";
26
25
  import "color";
@@ -1 +1 @@
1
- {"version":3,"file":"index.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.es7.js CHANGED
@@ -36,31 +36,29 @@ import { cx } from "@emotion/css";
36
36
  import { g as getBox } from "./box-models.es.js";
37
37
  import { ax as BlockType, ay as InlineType, at as richTextDTOtoDAO, as as richTextDTOtoSelection, aA as BuilderEditMode } from "./descriptors.es.js";
38
38
  import { L as Leaf } from "./leaf.es.js";
39
- import { e as useStyle, r as responsiveStyle, d as deepEqual } from "./responsive-style.es.js";
39
+ import { n as useStyle, o as useResponsiveStyle, u as useIsInBuilder, L as deepEqual, Q as useBuilderEditMode, T as pollBoxModel } from "./index.es.js";
40
40
  import { jsx } from "react/jsx-runtime";
41
41
  import { L as Link } from "./index.es3.js";
42
- import { u as useIsInBuilder, y as useBuilderEditMode, z as pollBoxModel } from "./index.es.js";
43
42
  import isHotkey from "is-hotkey";
44
43
  import { b as withBlock, a as withTypography, w as withList, o as onKeyDown } from "./index.es5.js";
45
44
  import { u as useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.es.js";
46
45
  import "css-box-model";
47
46
  import "./actions.es.js";
48
- import "./isNonNullable.es.js";
49
- import "@emotion/serialize";
50
- import "@emotion/utils";
51
- import "use-sync-external-store/shim";
52
- import "redux";
53
- import "redux-thunk";
54
- import "./types.es.js";
55
- import "scroll-into-view-if-needed";
56
- import "next/link";
47
+ import "./introspection.es.js";
48
+ import "./state/breakpoints.es.js";
57
49
  import "use-sync-external-store/shim/with-selector";
58
50
  import "next/dynamic";
59
51
  import "./constants.es.js";
60
- import "./introspection.es.js";
52
+ import "redux";
53
+ import "redux-thunk";
54
+ import "@emotion/serialize";
55
+ import "@emotion/utils";
61
56
  import "./text-input.es.js";
62
57
  import "./combobox.es.js";
58
+ import "use-sync-external-store/shim";
59
+ import "./types.es.js";
63
60
  import "color";
61
+ import "scroll-into-view-if-needed";
64
62
  import "react-dom";
65
63
  import "html-react-parser";
66
64
  import "next/head";
@@ -73,6 +71,7 @@ import "http-proxy";
73
71
  import "set-cookie-parser";
74
72
  import "uuid";
75
73
  import "corporate-ipsum";
74
+ import "next/link";
76
75
  function BlockElement({
77
76
  element,
78
77
  attributes,
@@ -80,7 +79,7 @@ function BlockElement({
80
79
  }) {
81
80
  const blockStyles = [useStyle({
82
81
  margin: 0
83
- }), useStyle(responsiveStyle([element.textAlign], ([textAlign = "left"]) => ({
82
+ }), useStyle(useResponsiveStyle([element.textAlign], ([textAlign = "left"]) => ({
84
83
  textAlign
85
84
  })))];
86
85
  switch (element.type) {
@@ -1 +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/useSyncDOMSelection.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'\nimport { useIsInBuilder } from '../../../../react'\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 const isInBuilder = useIsInBuilder()\n\n useEffect(() => {\n if (shouldCommit && text && isInBuilder) {\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 { ReactEditor } from 'slate-react'\nimport { useIsomorphicLayoutEffect } from '../../../hooks/useIsomorphicLayoutEffect'\nimport { Editor, Range as SlateRange } from 'slate'\n\n/**\n * Clicking outside of the host blurs our `<Editable />`.\n * `<Editable />` only updates the DOM's selection to match slate when it is focused.\n * In the case of a panel being clicked this hook updates the DOM selection to match slate.\n */\nexport function useSyncDOMSelection(editor: Editor, isEnabled: boolean) {\n useIsomorphicLayoutEffect(() => {\n if (!isEnabled || editor.selection == null || ReactEditor.isFocused(editor)) return\n try {\n const root = ReactEditor.findDocumentOrShadowRoot(editor) as Document\n const domSelection = root.getSelection()\n const newDomRange: Range | null = ReactEditor.toDOMRange(editor, editor.selection)\n\n if (newDomRange) {\n if (SlateRange.isBackward(editor.selection!)) {\n domSelection?.setBaseAndExtent(\n newDomRange.endContainer,\n newDomRange.endOffset,\n newDomRange.startContainer,\n newDomRange.startOffset,\n )\n } else {\n domSelection?.setBaseAndExtent(\n newDomRange.startContainer,\n newDomRange.startOffset,\n newDomRange.endContainer,\n newDomRange.endOffset,\n )\n }\n } else {\n domSelection?.removeAllRanges()\n }\n } catch (e) {\n console.error(e)\n }\n })\n}\n","import {\n FocusEvent,\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'\nimport { useSyncDOMSelection } from './useSyncDOMSelection'\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 [isPreservingDOMSElection, setIsPreservingDOMSelection] = useState(false)\n useSyncDOMSelection(editor, isPreservingDOMSElection)\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 setIsPreservingDOMSelection(true)\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 const handleBlur = useCallback((e: FocusEvent) => {\n // When clicking outside of the iframe (`relatedTarget` is null) we want to preserve the DOM selection.\n if (e.relatedTarget == null) return\n // Otherwise we want to deselect on blur and stop preserving selection.\n setIsPreservingDOMSelection(false)\n ReactEditor.deselect(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 onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n className={cx(width, margin)}\n readOnly={editMode !== BuilderEditMode.CONTENT}\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","isInBuilder","useIsInBuilder","useEffect","nextValue","richTextDTOtoDAO","nextSelection","richTextDTOtoSelection","deepEqual","selection","onChange","timeoutId","window","setTimeout","clearTimeout","useCallback","isEnabled","useIsomorphicLayoutEffect","ReactEditor","isFocused","root","findDocumentOrShadowRoot","domSelection","getSelection","newDomRange","toDOMRange","SlateRange","isBackward","setBaseAndExtent","endContainer","endOffset","startContainer","startOffset","removeAllRanges","e","console","error","defaultText","EditableText","forwardRef","id","width","ref","withBlock","withTypography","withList","withReact","createEditor","isPreservingDOMSElection","setIsPreservingDOMSelection","useSyncDOMSelection","delaySync","useSyncWithBuilder","editMode","useBuilderEditMode","propControllers","setPropControllers","controller","toDOMNode","pollBoxModel","onBoxModelChange","boxModel","changeBoxModel","useImperativeHandle","getDomNode","getBoxModel","getBox","initialValue","useMemo","setSlateEditor","handleFocus","focus","handleKeyDown","isHotkey","redo","undo","blur","onKeyDown","handleBlur","relatedTarget","deselect","Leaf","Element","BuilderEditMode","CONTENT"],"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,EAAA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AAO;AAAA,IAAgB,OAAOuE;AAAAA,IAAc,UAAUhB;AAAAA,IAAtD,8BACG,UAAD;AAAA,MACE;AAAA,MACA,YAAY8B;AAAAA,MACZ,eAAeC;AAAAA,MACf,SAASZ;AAAAA,MACT,WAAWE;AAAAA,MACX,QAAQM;AAAAA,MACR,WAAW9G,GAAGyE,OAAO/E,MAAR;AAAA,MACb,UAAU2F,aAAa8B,gBAAgBC;AAAAA,MACvC,aAAY;AAAA,IAAA,CATd;AAAA,EAAA,CAFJ;AAeD,CAnFqC;AAqFtC,IAAA,iBAAe9C;;"}
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/useSyncDOMSelection.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 { useResponsiveStyle } 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(useResponsiveStyle([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'\nimport { useIsInBuilder } from '../../../../runtimes/react'\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 const isInBuilder = useIsInBuilder()\n\n useEffect(() => {\n if (shouldCommit && text && isInBuilder) {\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 { ReactEditor } from 'slate-react'\nimport { useIsomorphicLayoutEffect } from '../../../hooks/useIsomorphicLayoutEffect'\nimport { Editor, Range as SlateRange } from 'slate'\n\n/**\n * Clicking outside of the host blurs our `<Editable />`.\n * `<Editable />` only updates the DOM's selection to match slate when it is focused.\n * In the case of a panel being clicked this hook updates the DOM selection to match slate.\n */\nexport function useSyncDOMSelection(editor: Editor, isEnabled: boolean) {\n useIsomorphicLayoutEffect(() => {\n if (!isEnabled || editor.selection == null || ReactEditor.isFocused(editor)) return\n try {\n const root = ReactEditor.findDocumentOrShadowRoot(editor) as Document\n const domSelection = root.getSelection()\n const newDomRange: Range | null = ReactEditor.toDOMRange(editor, editor.selection)\n\n if (newDomRange) {\n if (SlateRange.isBackward(editor.selection!)) {\n domSelection?.setBaseAndExtent(\n newDomRange.endContainer,\n newDomRange.endOffset,\n newDomRange.startContainer,\n newDomRange.startOffset,\n )\n } else {\n domSelection?.setBaseAndExtent(\n newDomRange.startContainer,\n newDomRange.startOffset,\n newDomRange.endContainer,\n newDomRange.endOffset,\n )\n }\n } else {\n domSelection?.removeAllRanges()\n }\n } catch (e) {\n console.error(e)\n }\n })\n}\n","import {\n FocusEvent,\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'\nimport { useSyncDOMSelection } from './useSyncDOMSelection'\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 [isPreservingDOMSElection, setIsPreservingDOMSelection] = useState(false)\n useSyncDOMSelection(editor, isPreservingDOMSElection)\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 setIsPreservingDOMSelection(true)\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 const handleBlur = useCallback((e: FocusEvent) => {\n // When clicking outside of the iframe (`relatedTarget` is null) we want to preserve the DOM selection.\n if (e.relatedTarget == null) return\n // Otherwise we want to deselect on blur and stop preserving selection.\n setIsPreservingDOMSelection(false)\n ReactEditor.deselect(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 onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n className={cx(width, margin)}\n readOnly={editMode !== BuilderEditMode.CONTENT}\n placeholder=\"Write some text...\"\n />\n </Slate>\n )\n})\n\nexport default EditableText\n"],"names":["element","attributes","children","blockStyles","useStyle","margin","useResponsiveStyle","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","isInBuilder","useIsInBuilder","useEffect","nextValue","richTextDTOtoDAO","nextSelection","richTextDTOtoSelection","deepEqual","selection","onChange","timeoutId","window","setTimeout","clearTimeout","useCallback","isEnabled","useIsomorphicLayoutEffect","ReactEditor","isFocused","root","findDocumentOrShadowRoot","domSelection","getSelection","newDomRange","toDOMRange","SlateRange","isBackward","setBaseAndExtent","endContainer","endOffset","startContainer","startOffset","removeAllRanges","e","console","error","defaultText","EditableText","forwardRef","id","width","ref","withBlock","withTypography","withList","withReact","createEditor","isPreservingDOMSElection","setIsPreservingDOMSelection","useSyncDOMSelection","delaySync","useSyncWithBuilder","editMode","useBuilderEditMode","propControllers","setPropControllers","controller","toDOMNode","pollBoxModel","onBoxModelChange","boxModel","changeBoxModel","useImperativeHandle","getDomNode","getBoxModel","getBox","initialValue","useMemo","setSlateEditor","handleFocus","focus","handleKeyDown","isHotkey","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D,QAAAA,SAAS,SAASvC,CAAV;AAAc,aAAOuB,yCAAYkB;AACzCF,QAAAA,SAAS,QAAD,EAAWvC,CAAnB;AAAuB,aAAOuB,yCAAYmB;AAC9CC,cAAU3C,GAAGtC,MAAJ;AAAA,EAAA,GAEX,CAAC6D,YAAY7D,MAAb,CAP+B;AAU3BkF,QAAAA,aAAa/D,YAAY,CAACmB,MAAkB;AAEhD,QAAIA,EAAE6C,iBAAiB;AAAM;AAE7B9B,gCAA4B,KAAD;AAC3B/B,gBAAY8D,SAASpF,MAArB;AAAA,EAL4B,GAM3B,CAN2B,CAAA;AAQ9B,6BACG,OAAD;AAAA,IAAO;AAAA,IAAgB,OAAOuE;AAAAA,IAAc,UAAUhB;AAAAA,IAAtD,8BACG,UAAD;AAAA,MACE;AAAA,MACA,YAAY8B;AAAAA,MACZ,eAAeC;AAAAA,MACf,SAASZ;AAAAA,MACT,WAAWE;AAAAA,MACX,QAAQM;AAAAA,MACR,WAAW9G,GAAGyE,OAAO/E,MAAR;AAAA,MACb,UAAU2F,aAAa8B,gBAAgBC;AAAAA,MACvC,aAAY;AAAA,IAAA,CATd;AAAA,EAAA,CAFJ;AAeD,CAnFqC;AAqFtC,IAAA,iBAAe9C;;"}
@@ -2,7 +2,9 @@
2
2
  var descriptors = require("./descriptors.cjs.js");
3
3
  require("slate");
4
4
  require("slate-react");
5
- var isNonNullable = require("./isNonNullable.cjs.js");
5
+ function isNonNullable(value) {
6
+ return value != null;
7
+ }
6
8
  function getElementChildren(descriptor, prop) {
7
9
  if (prop == null)
8
10
  return [];
@@ -73,7 +75,7 @@ function getTypographyStyleSwatchIds(style) {
73
75
  return (_a = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
74
76
  var _a2;
75
77
  return (_a2 = typographyStyle.color) == null ? void 0 : _a2.swatchId;
76
- }).filter(isNonNullable.isNonNullable)) != null ? _a : [];
78
+ }).filter(isNonNullable)) != null ? _a : [];
77
79
  }
78
80
  function getElementSwatchIds(descriptor, prop) {
79
81
  var _a;
@@ -325,4 +327,5 @@ exports.getResponsiveColorSwatchIds = getResponsiveColorSwatchIds;
325
327
  exports.getTableIds = getTableIds;
326
328
  exports.getTypographyIds = getTypographyIds;
327
329
  exports.introspection = introspection;
330
+ exports.isNonNullable = isNonNullable;
328
331
  //# sourceMappingURL=introspection.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"introspection.cjs.js","sources":["../src/prop-controllers/introspection.ts"],"sourcesContent":["import {\n BackgroundsValue,\n BorderValue,\n Descriptor,\n ElementIDValue,\n GridValue,\n ImagesValue,\n ImageValue,\n LinkValue,\n NavigationLinksValue,\n ResponsiveColorValue,\n RichTextValue,\n ShadowsValue,\n TableValue,\n Types,\n} from './descriptors'\nimport { Data, Element } from '../state/react-page'\nimport {\n ColorControlData,\n ColorControlType,\n ImageControlData,\n ImageControlType,\n InlineJSON,\n ListControlData,\n ListControlType,\n MarkJSON,\n NodeJSON,\n ShapeControlData,\n ShapeControlType,\n SlotControlData,\n SlotControlType,\n} from '../controls'\nimport { Typography } from '../api'\nimport { isNonNullable } from '../components/utils/isNonNullable'\n\nexport function getElementChildren<T extends Data>(\n descriptor: Descriptor<T>,\n prop: T | undefined,\n): Element[] {\n if (prop == null) return []\n\n switch (descriptor.type) {\n case Types.Grid:\n return (prop as GridValue).elements\n\n case SlotControlType:\n return (prop as SlotControlData).elements\n\n case ListControlType:\n return (prop as ListControlData).flatMap(({ value }) =>\n getElementChildren(descriptor.config.type, value),\n )\n\n case ShapeControlType: {\n const shapeControlData = prop as ShapeControlData\n\n return Object.keys(shapeControlData).flatMap(key =>\n getElementChildren(descriptor.config.type[key], shapeControlData[key]),\n )\n }\n\n default:\n return []\n }\n}\n\nexport function getElementId<T extends Data>(\n descriptor: Descriptor<T>,\n prop: T | undefined,\n): string | null {\n if (prop == null) return null\n\n switch (descriptor.type) {\n case Types.ElementID:\n return prop as ElementIDValue\n\n default:\n return null\n }\n}\n\nexport function getBackgroundsSwatchIds(value: BackgroundsValue | null | undefined): string[] {\n return (\n value\n ?.flatMap(override => override.value)\n .flatMap(backgroundItem => {\n switch (backgroundItem.type) {\n case 'color':\n return backgroundItem.payload?.swatchId == null ? [] : [backgroundItem.payload.swatchId]\n\n case 'gradient':\n return backgroundItem.payload.stops.flatMap(stop =>\n stop.color == null ? [] : stop.color.swatchId,\n )\n\n default:\n return []\n }\n }) ?? []\n )\n}\n\nexport function getBorderSwatchIds(value: BorderValue | null | undefined): string[] {\n return (\n value\n ?.flatMap(override => override.value)\n .flatMap(borderValue => {\n return [\n borderValue.borderTop?.color?.swatchId,\n borderValue.borderRight?.color?.swatchId,\n borderValue.borderBottom?.color?.swatchId,\n borderValue.borderLeft?.color?.swatchId,\n ].filter((swatchId): swatchId is NonNullable<typeof swatchId> => swatchId != null)\n }) ?? []\n )\n}\n\nexport function getBoxShadowsSwatchIds(value: ShadowsValue | null | undefined): string[] {\n return (\n value\n ?.flatMap(override => override.value)\n .map(item => item.payload.color?.swatchId)\n .filter((swatchId): swatchId is NonNullable<typeof swatchId> => swatchId != null) ?? []\n )\n}\n\nexport function getResponsiveColorSwatchIds(\n value: ResponsiveColorValue | null | undefined,\n): string[] {\n return value?.map(override => override.value).map(color => color.swatchId) ?? []\n}\n\nexport function getTypographyStyleSwatchIds(\n style: Typography['style'] | null | undefined,\n): string[] {\n return (\n style\n ?.map(override => override.value)\n .flatMap(typographyStyle => typographyStyle.color?.swatchId)\n .filter(isNonNullable) ?? []\n )\n}\n\nexport function getElementSwatchIds<T extends Data>(\n descriptor: Descriptor<T>,\n prop: T | undefined,\n): string[] {\n if (prop == null) return []\n\n switch (descriptor.type) {\n case Types.Backgrounds:\n return getBackgroundsSwatchIds(prop as BackgroundsValue)\n\n case Types.Border:\n return getBorderSwatchIds(prop as BorderValue)\n\n case Types.NavigationLinks: {\n const value = prop as NavigationLinksValue\n return (\n value?.flatMap(item => {\n switch (item.type) {\n case 'button':\n case 'dropdown':\n return [\n ...(item.payload.color\n ?.map(override => override.value)\n .map(color => color.swatchId) ?? []),\n ...(item.payload.textColor\n ?.map(override => override.value)\n .map(color => color.swatchId) ?? []),\n ]\n }\n }) ?? []\n )\n }\n\n case Types.ResponsiveColor:\n return getResponsiveColorSwatchIds(prop as ResponsiveColorValue)\n\n case Types.Shadows:\n return getBoxShadowsSwatchIds(prop as ShadowsValue)\n\n case Types.RichText: {\n const value = prop as RichTextValue\n\n if (value == null || value.document == null) return []\n\n return getNodeSwatchIds(value.document)\n\n function getNodeSwatchIds(node: NodeJSON): string[] {\n switch (node.object) {\n case 'document':\n case 'block':\n case 'inline':\n return node.nodes?.flatMap(getNodeSwatchIds) ?? []\n\n case 'text':\n return node.marks?.flatMap(getMarkSwatchIds) ?? []\n\n default:\n return []\n }\n }\n\n function getMarkSwatchIds(mark: MarkJSON): string[] {\n return getTypographyStyleSwatchIds(mark.data?.value?.style)\n }\n }\n\n case ColorControlType: {\n const value = prop as ColorControlData\n return value?.swatchId == null ? [] : [value.swatchId]\n }\n\n default:\n return []\n }\n}\n\nexport function getBackgroundsFileIds(value: BackgroundsValue | null | undefined): string[] {\n return (\n value\n ?.flatMap(override => override.value)\n .flatMap(backgroundItem => {\n switch (backgroundItem.type) {\n case 'image':\n return [backgroundItem.payload.imageId]\n\n default:\n return []\n }\n }) ?? []\n )\n}\n\nexport function getFileIds<T extends Data>(\n descriptor: Descriptor<T>,\n prop: T | undefined,\n): string[] {\n if (prop == null) return []\n\n switch (descriptor.type) {\n case Types.Backgrounds:\n return getBackgroundsFileIds(prop as BackgroundsValue)\n\n case Types.Image: {\n const value = prop as ImageValue\n return value == null ? [] : [value]\n }\n\n case Types.Images: {\n const value = prop as ImagesValue\n return value?.flatMap(item => (item.props.file == null ? [] : [item.props.file])) ?? []\n }\n\n case ImageControlType: {\n const value = prop as ImageControlData\n return value == null ? [] : [value]\n }\n\n default:\n return []\n }\n}\n\nexport function getTypographyIds<T extends Data>(\n descriptor: Descriptor<T>,\n prop: T | undefined,\n): string[] {\n if (prop == null) return []\n\n switch (descriptor.type) {\n case Types.RichText: {\n const value = prop as RichTextValue\n if (value == null || value.document == null) return []\n\n return getNodeTypographyIds(value.document)\n\n function getNodeTypographyIds(node: NodeJSON): string[] {\n switch (node.object) {\n case 'document':\n case 'block':\n case 'inline':\n return node.nodes?.flatMap(getNodeTypographyIds) ?? []\n\n case 'text':\n return node.marks?.flatMap(getMarkTypographyIds) ?? []\n\n default:\n return []\n }\n }\n\n function getMarkTypographyIds(mark: MarkJSON): string[] {\n return [mark.data?.value?.id].filter(id => id != null)\n }\n }\n\n default:\n return []\n }\n}\n\nexport function getTableIds<T extends Data>(\n descriptor: Descriptor<T>,\n prop: T | undefined,\n): string[] {\n if (prop == null) return []\n\n switch (descriptor.type) {\n case Types.Table: {\n const value = prop as TableValue\n return value == null ? [] : [value]\n }\n\n default:\n return []\n }\n}\n\nexport function getPageIds<T extends Data>(\n descriptor: Descriptor<T>,\n prop: T | undefined,\n): string[] {\n if (prop == null) return []\n\n switch (descriptor.type) {\n case Types.Link: {\n const value = prop as LinkValue\n if (value == null) return []\n\n switch (value.type) {\n case 'OPEN_PAGE':\n return value.payload.pageId == null ? [] : [value.payload.pageId]\n\n default:\n return []\n }\n }\n\n case Types.NavigationLinks: {\n const value = prop as NavigationLinksValue\n if (value == null) return []\n\n return (\n value?.flatMap(item => {\n switch (item.type) {\n case 'button': {\n if (item.payload.link == null) return []\n\n switch (item.payload.link.type) {\n case 'OPEN_PAGE':\n return item.payload.link.payload.pageId == null\n ? []\n : [item.payload.link.payload.pageId]\n\n default:\n return []\n }\n }\n\n case 'dropdown': {\n return (\n item.payload.links?.flatMap(link => {\n if (link.payload.link == null) return []\n\n switch (link.payload.link.type) {\n case 'OPEN_PAGE':\n return link.payload.link.payload.pageId == null\n ? []\n : [link.payload.link.payload.pageId]\n\n default:\n return []\n }\n }) ?? []\n )\n }\n }\n }) ?? []\n )\n }\n\n case Types.RichText: {\n const value = prop as RichTextValue\n if (value == null || value.document == null) return []\n\n return getNodePageIds(value.document)\n\n function getNodePageIds(node: NodeJSON): string[] {\n switch (node.object) {\n case 'document':\n case 'block':\n return node.nodes?.flatMap(getNodePageIds) ?? []\n\n case 'inline':\n return getInlinePageIds(node)\n\n default:\n return []\n }\n }\n\n function getInlinePageIds(inline: InlineJSON): string[] {\n switch (inline.type) {\n case 'link': {\n const nodePageIds = inline.nodes?.flatMap(getNodePageIds) ?? []\n const dataPageIds = inline.data ? getLinkDataPageIds(inline.data as LinkValue) : []\n\n return [...nodePageIds, ...dataPageIds]\n }\n\n default:\n return inline.nodes?.flatMap(getNodePageIds) ?? []\n }\n }\n\n function getLinkDataPageIds(link: LinkValue): string[] {\n switch (link.type) {\n case 'OPEN_PAGE':\n return link.payload.pageId == null ? [] : [link.payload.pageId]\n\n default:\n return []\n }\n }\n }\n\n default:\n return []\n }\n}\n"],"names":["Types","SlotControlType","ListControlType","ShapeControlType","isNonNullable","ColorControlType","ImageControlType"],"mappings":";;;;;AAmCO,4BACL,YACA,MACW;AACX,MAAI,QAAQ;AAAM,WAAO;AAEzB,UAAQ,WAAW;AAAA,SACZA,YAAM,MAAA;AACT,aAAQ,KAAmB;AAAA,SAExBC,YAAA;AACH,aAAQ,KAAyB;AAAA,SAE9BC,YAAA;AACK,aAAA,KAAyB,QAAQ,CAAC,EAAE,YAC1C,mBAAmB,WAAW,OAAO,MAAM,KAAK,CAClD;AAAA,SAEGC,8BAAkB;AACrB,YAAM,mBAAmB;AAEzB,aAAO,OAAO,KAAK,gBAAgB,EAAE,QAAQ,CAAA,QAC3C,mBAAmB,WAAW,OAAO,KAAK,MAAM,iBAAiB,IAAI,CACvE;AAAA,IACF;AAAA;AAGE,aAAO;;AAEb;AAEO,sBACL,YACA,MACe;AACf,MAAI,QAAQ;AAAa,WAAA;AAEzB,UAAQ,WAAW;AAAA,SACZH,YAAM,MAAA;AACF,aAAA;AAAA;AAGA,aAAA;AAAA;AAEb;AAEO,iCAAiC,OAAsD;;AAC5F,SACE,qCACI,QAAQ,CAAA,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op-controllers/introspection.ts"],"sourcesContent":["export function isNonNullable<T>(value: T): value is NonNullable<T> {\n return value != null\n}\n","import {\n BackgroundsValue,\n BorderValue,\n Descriptor,\n ElementIDValue,\n GridValue,\n ImagesValue,\n ImageValue,\n LinkValue,\n NavigationLinksValue,\n ResponsiveColorValue,\n RichTextValue,\n ShadowsValue,\n TableValue,\n Types,\n} from './descriptors'\nimport { Data, Element } from '../state/react-page'\nimport {\n ColorControlData,\n ColorControlType,\n ImageControlData,\n ImageControlType,\n InlineJSON,\n ListControlData,\n ListControlType,\n MarkJSON,\n NodeJSON,\n ShapeControlData,\n ShapeControlType,\n SlotControlData,\n SlotControlType,\n} from '../controls'\nimport { Typography } from '../api'\nimport { isNonNullable } from '../components/utils/isNonNullable'\n\nexport function getElementChildren<T extends Data>(\n descriptor: Descriptor<T>,\n prop: T | undefined,\n): Element[] {\n if (prop == null) return []\n\n switch (descriptor.type) {\n case Types.Grid:\n return (prop as GridValue).elements\n\n case SlotControlType:\n return (prop as SlotControlData).elements\n\n case ListControlType:\n return (prop as ListControlData).flatMap(({ value }) =>\n getElementChildren(descriptor.config.type, value),\n )\n\n case ShapeControlType: {\n const shapeControlData = prop as ShapeControlData\n\n return Object.keys(shapeControlData).flatMap(key =>\n getElementChildren(descriptor.config.type[key], shapeControlData[key]),\n )\n }\n\n default:\n return []\n }\n}\n\nexport function getElementId<T extends Data>(\n descriptor: Descriptor<T>,\n prop: T | undefined,\n): string | null {\n if (prop == null) return null\n\n switch (descriptor.type) {\n case Types.ElementID:\n return prop as ElementIDValue\n\n default:\n return null\n }\n}\n\nexport function getBackgroundsSwatchIds(value: BackgroundsValue | null | undefined): string[] {\n return (\n value\n ?.flatMap(override => override.value)\n .flatMap(backgroundItem => {\n switch (backgroundItem.type) {\n case 'color':\n return backgroundItem.payload?.swatchId == null ? [] : [backgroundItem.payload.swatchId]\n\n case 'gradient':\n return backgroundItem.payload.stops.flatMap(stop =>\n stop.color == null ? [] : stop.color.swatchId,\n )\n\n default:\n return []\n }\n }) ?? []\n )\n}\n\nexport function getBorderSwatchIds(value: BorderValue | null | undefined): string[] {\n return (\n value\n ?.flatMap(override => override.value)\n .flatMap(borderValue => {\n return [\n borderValue.borderTop?.color?.swatchId,\n borderValue.borderRight?.color?.swatchId,\n borderValue.borderBottom?.color?.swatchId,\n borderValue.borderLeft?.color?.swatchId,\n ].filter((swatchId): swatchId is NonNullable<typeof swatchId> => swatchId != null)\n }) ?? []\n )\n}\n\nexport function getBoxShadowsSwatchIds(value: ShadowsValue | null | undefined): string[] {\n return (\n value\n ?.flatMap(override => override.value)\n .map(item => item.payload.color?.swatchId)\n .filter((swatchId): swatchId is NonNullable<typeof swatchId> => swatchId != null) ?? []\n )\n}\n\nexport function getResponsiveColorSwatchIds(\n value: ResponsiveColorValue | null | undefined,\n): string[] {\n return value?.map(override => override.value).map(color => color.swatchId) ?? []\n}\n\nexport function getTypographyStyleSwatchIds(\n style: Typography['style'] | null | undefined,\n): string[] {\n return (\n style\n ?.map(override => override.value)\n .flatMap(typographyStyle => typographyStyle.color?.swatchId)\n .filter(isNonNullable) ?? []\n )\n}\n\nexport function getElementSwatchIds<T extends Data>(\n descriptor: Descriptor<T>,\n prop: T | undefined,\n): string[] {\n if (prop == null) return []\n\n switch (descriptor.type) {\n case Types.Backgrounds:\n return getBackgroundsSwatchIds(prop as BackgroundsValue)\n\n case Types.Border:\n return getBorderSwatchIds(prop as BorderValue)\n\n case Types.NavigationLinks: {\n const value = prop as NavigationLinksValue\n return (\n value?.flatMap(item => {\n switch (item.type) {\n case 'button':\n case 'dropdown':\n return [\n ...(item.payload.color\n ?.map(override => override.value)\n .map(color => color.swatchId) ?? []),\n ...(item.payload.textColor\n ?.map(override => override.value)\n .map(color => color.swatchId) ?? []),\n ]\n }\n }) ?? []\n )\n }\n\n case Types.ResponsiveColor:\n return getResponsiveColorSwatchIds(prop as ResponsiveColorValue)\n\n case Types.Shadows:\n return getBoxShadowsSwatchIds(prop as ShadowsValue)\n\n case Types.RichText: {\n const value = prop as RichTextValue\n\n if (value == null || value.document == null) return []\n\n return getNodeSwatchIds(value.document)\n\n function getNodeSwatchIds(node: NodeJSON): string[] {\n switch (node.object) {\n case 'document':\n case 'block':\n case 'inline':\n return node.nodes?.flatMap(getNodeSwatchIds) ?? []\n\n case 'text':\n return node.marks?.flatMap(getMarkSwatchIds) ?? []\n\n default:\n return []\n }\n }\n\n function getMarkSwatchIds(mark: MarkJSON): string[] {\n return getTypographyStyleSwatchIds(mark.data?.value?.style)\n }\n }\n\n case ColorControlType: {\n const value = prop as ColorControlData\n return value?.swatchId == null ? [] : [value.swatchId]\n }\n\n default:\n return []\n }\n}\n\nexport function getBackgroundsFileIds(value: BackgroundsValue | null | undefined): string[] {\n return (\n value\n ?.flatMap(override => override.value)\n .flatMap(backgroundItem => {\n switch (backgroundItem.type) {\n case 'image':\n return [backgroundItem.payload.imageId]\n\n default:\n return []\n }\n }) ?? []\n )\n}\n\nexport function getFileIds<T extends Data>(\n descriptor: Descriptor<T>,\n prop: T | undefined,\n): string[] {\n if (prop == null) return []\n\n switch (descriptor.type) {\n case Types.Backgrounds:\n return getBackgroundsFileIds(prop as BackgroundsValue)\n\n case Types.Image: {\n const value = prop as ImageValue\n return value == null ? [] : [value]\n }\n\n case Types.Images: {\n const value = prop as ImagesValue\n return value?.flatMap(item => (item.props.file == null ? [] : [item.props.file])) ?? []\n }\n\n case ImageControlType: {\n const value = prop as ImageControlData\n return value == null ? [] : [value]\n }\n\n default:\n return []\n }\n}\n\nexport function getTypographyIds<T extends Data>(\n descriptor: Descriptor<T>,\n prop: T | undefined,\n): string[] {\n if (prop == null) return []\n\n switch (descriptor.type) {\n case Types.RichText: {\n const value = prop as RichTextValue\n if (value == null || value.document == null) return []\n\n return getNodeTypographyIds(value.document)\n\n function getNodeTypographyIds(node: NodeJSON): string[] {\n switch (node.object) {\n case 'document':\n case 'block':\n case 'inline':\n return node.nodes?.flatMap(getNodeTypographyIds) ?? []\n\n case 'text':\n return node.marks?.flatMap(getMarkTypographyIds) ?? []\n\n default:\n return []\n }\n }\n\n function getMarkTypographyIds(mark: MarkJSON): string[] {\n return [mark.data?.value?.id].filter(id => id != null)\n }\n }\n\n default:\n return []\n }\n}\n\nexport function getTableIds<T extends Data>(\n descriptor: Descriptor<T>,\n prop: T | undefined,\n): string[] {\n if (prop == null) return []\n\n switch (descriptor.type) {\n case Types.Table: {\n const value = prop as TableValue\n return value == null ? [] : [value]\n }\n\n default:\n return []\n }\n}\n\nexport function getPageIds<T extends Data>(\n descriptor: Descriptor<T>,\n prop: T | undefined,\n): string[] {\n if (prop == null) return []\n\n switch (descriptor.type) {\n case Types.Link: {\n const value = prop as LinkValue\n if (value == null) return []\n\n switch (value.type) {\n case 'OPEN_PAGE':\n return value.payload.pageId == null ? [] : [value.payload.pageId]\n\n default:\n return []\n }\n }\n\n case Types.NavigationLinks: {\n const value = prop as NavigationLinksValue\n if (value == null) return []\n\n return (\n value?.flatMap(item => {\n switch (item.type) {\n case 'button': {\n if (item.payload.link == null) return []\n\n switch (item.payload.link.type) {\n case 'OPEN_PAGE':\n return item.payload.link.payload.pageId == null\n ? []\n : [item.payload.link.payload.pageId]\n\n default:\n return []\n }\n }\n\n case 'dropdown': {\n return (\n item.payload.links?.flatMap(link => {\n if (link.payload.link == null) return []\n\n switch (link.payload.link.type) {\n case 'OPEN_PAGE':\n return link.payload.link.payload.pageId == null\n ? []\n : [link.payload.link.payload.pageId]\n\n default:\n return []\n }\n }) ?? []\n )\n }\n }\n }) ?? []\n )\n }\n\n case Types.RichText: {\n const value = prop as RichTextValue\n if (value == null || value.document == null) return []\n\n return getNodePageIds(value.document)\n\n function getNodePageIds(node: NodeJSON): string[] {\n switch (node.object) {\n case 'document':\n case 'block':\n return node.nodes?.flatMap(getNodePageIds) ?? []\n\n case 'inline':\n return getInlinePageIds(node)\n\n default:\n return []\n }\n }\n\n function getInlinePageIds(inline: InlineJSON): string[] {\n switch (inline.type) {\n case 'link': {\n const nodePageIds = inline.nodes?.flatMap(getNodePageIds) ?? []\n const dataPageIds = inline.data ? getLinkDataPageIds(inline.data as LinkValue) : []\n\n return [...nodePageIds, ...dataPageIds]\n }\n\n default:\n return inline.nodes?.flatMap(getNodePageIds) ?? []\n }\n }\n\n function getLinkDataPageIds(link: LinkValue): string[] {\n switch (link.type) {\n case 'OPEN_PAGE':\n return link.payload.pageId == null ? [] : [link.payload.pageId]\n\n default:\n return []\n }\n }\n }\n\n default:\n return []\n }\n}\n"],"names":["Types","SlotControlType","ListControlType","ShapeControlType","ColorControlType","ImageControlType"],"mappings":";;;;AAAO,uBAA0B,OAAmC;AAClE,SAAO,SAAS;AAClB;ACiCO,4BACL,YACA,MACW;AACX,MAAI,QAAQ;AAAM,WAAO;AAEzB,UAAQ,WAAW;AAAA,SACZA,YAAM,MAAA;AACT,aAAQ,KAAmB;AAAA,SAExBC,YAAA;AACH,aAAQ,KAAyB;AAAA,SAE9BC,YAAA;AACK,aAAA,KAAyB,QAAQ,CAAC,EAAE,YAC1C,mBAAmB,WAAW,OAAO,MAAM,KAAK,CAClD;AAAA,SAEGC,8BAAkB;AACrB,YAAM,mBAAmB;AAEzB,aAAO,OAAO,KAAK,gBAAgB,EAAE,QAAQ,CAAA,QAC3C,mBAAmB,WAAW,OAAO,KAAK,MAAM,iBAAiB,IAAI,CACvE;AAAA,IACF;AAAA;AAGE,aAAO;;AAEb;AAEO,sBACL,YACA,MACe;AACf,MAAI,QAAQ;AAAa,WAAA;AAEzB,UAAQ,WAAW;AAAA,SACZH,YAAM,MAAA;AACF,aAAA;AAAA;AAGA,aAAA;AAAA;AAEb;AAEO,iCAAiC,OAAsD;;AAC5F,SACE,qCACI,QAAQ,CAAA,aAAY,SAAS,OAC9B,QAAQ,CAAkB,mBAAA;;AACzB,YAAQ,eAAe;AAAA,WAChB;AACI,eAAA,uBAAe,YAAf,oBAAwB,aAAY,OAAO,CAAK,IAAA,CAAC,eAAe,QAAQ,QAAQ;AAAA,WAEpF;AACH,eAAO,eAAe,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AA;AAAA,UAEV;AAAA;AAAA,MAEH,OAlCD,YAkCM,CAAA;AAAA,IAEV;AAAA,SAEKA,YAAAA,MAAM,UAAU;AAMV,UAAA,iBAAT,SAAwB,MAA0B;;AAChD,gBAAQ,KAAK;AAAA,eACN;AAAA,eACA;AACH,mBAAO,kBAAK,UAAL,oBAAY,QAAQ,oBAApB,YAAuC,CAAA;AAAA,eAE3C;AACH,mBAAO,iBAAiB,IAAI;AAAA;AAG5B,mBAAO;;MAAC,GAIL,mBAAT,SAA0B,QAA8B;;AACtD,gBAAQ,OAAO;AAAA,eACR,QAAQ;AACX,kBAAM,cAAc,oBAAO,UAAP,oBAAc,QAAQ,oBAAtB,YAAyC;AAC7D,kBAAM,cAAc,OAAO,OAAO,mBAAmB,OAAO,IAAiB,IAAI;AAEjF,mBAAO,CAAC,GAAG,aAAa,GAAG,WAAW;AAAA,UACxC;AAAA;AAGE,mBAAO,mBAAO,UAAP,mBAAc,QAAQ,oBAAtB,YAAyC,CAAA;AAAA;AAAA,MAAC,GAI9C,qBAAT,SAA4B,MAA2B;AACrD,gBAAQ,KAAK;AAAA,eACN;AACI,mBAAA,KAAK,QAAQ,UAAU,OAAO,CAAK,IAAA,CAAC,KAAK,QAAQ,MAAM;AAAA;AAG9D,mBAAO;;MAAC;AAvCd,YAAM,QAAQ;AACV,UAAA,SAAS,QAAQ,MAAM,YAAY;AAAM,eAAO;AAE7C,aAAA,eAAe,MAAM,QAAQ;AAAA,IAuCtC;AAAA;AAGE,aAAO;;AAEb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,9 @@
1
1
  import { S as ShapeControlType, L as ListControlType, b as SlotControlType, T as Types, C as ColorControlType, I as ImageControlType } from "./descriptors.es.js";
2
2
  import "slate";
3
3
  import "slate-react";
4
- import { i as isNonNullable } from "./isNonNullable.es.js";
4
+ function isNonNullable(value) {
5
+ return value != null;
6
+ }
5
7
  function getElementChildren(descriptor, prop) {
6
8
  if (prop == null)
7
9
  return [];
@@ -311,5 +313,5 @@ var introspection = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
311
313
  getTableIds,
312
314
  getPageIds
313
315
  }, Symbol.toStringTag, { value: "Module" }));
314
- export { getElementChildren as a, getElementSwatchIds as b, getFileIds as c, getTypographyIds as d, getTableIds as e, getPageIds as f, getElementId as g, getBorderSwatchIds as h, introspection as i, getBoxShadowsSwatchIds as j, getResponsiveColorSwatchIds as k, getBackgroundsFileIds as l, getBackgroundsSwatchIds as m };
316
+ export { getElementChildren as a, getElementSwatchIds as b, getFileIds as c, getTypographyIds as d, getTableIds as e, getPageIds as f, getElementId as g, getBorderSwatchIds as h, introspection as i, isNonNullable as j, getBoxShadowsSwatchIds as k, getResponsiveColorSwatchIds as l, getBackgroundsFileIds as m, getBackgroundsSwatchIds as n };
315
317
  //# sourceMappingURL=introspection.es.js.map