@makeswift/runtime 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Box.cjs.js +15 -15
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +10 -10
- package/dist/Button.cjs.js +12 -12
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +10 -10
- package/dist/Carousel.cjs.js +28 -28
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +7 -7
- package/dist/Countdown.cjs.js +15 -15
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +7 -7
- package/dist/Divider.cjs.js +12 -12
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +10 -10
- package/dist/Embed.cjs.js +3 -30
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +2 -29
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +51 -51
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +7 -7
- package/dist/Image.cjs.js +8 -8
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +7 -7
- package/dist/LiveProvider.cjs.js +6 -6
- package/dist/LiveProvider.es.js +8 -8
- package/dist/Navigation.cjs.js +27 -27
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +6 -6
- package/dist/PreviewProvider.cjs.js +7 -7
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +7 -7
- package/dist/ReadOnlyText.cjs.js +16 -13
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +11 -8
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +13 -10
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +9 -6
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +8 -8
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +6 -6
- package/dist/SocialLinks.cjs.js +14 -14
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +10 -10
- package/dist/Text.cjs.js +4 -4
- package/dist/Text.es.js +5 -5
- package/dist/Video.cjs.js +3 -30
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +2 -29
- package/dist/Video.es.js.map +1 -1
- package/dist/builder.cjs.js +4 -2
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +4 -2
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +9 -9
- package/dist/components.es.js +9 -9
- package/dist/control-serialization.cjs.js +88 -12
- package/dist/control-serialization.cjs.js.map +1 -1
- package/dist/control-serialization.es.js +89 -13
- package/dist/control-serialization.es.js.map +1 -1
- package/dist/controls.cjs.js +15 -4
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +6 -3
- package/dist/controls.es.js.map +1 -1
- package/dist/deepEqual.cjs.js +40 -0
- package/dist/deepEqual.cjs.js.map +1 -0
- package/dist/deepEqual.es.js +39 -0
- package/dist/deepEqual.es.js.map +1 -0
- package/dist/index.cjs.js +102 -98
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs10.js +173 -249
- package/dist/index.cjs10.js.map +1 -1
- package/dist/index.cjs11.js +375 -0
- package/dist/index.cjs11.js.map +1 -0
- package/dist/index.cjs2.js +14 -16
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs4.js +2 -1
- package/dist/index.cjs4.js.map +1 -1
- package/dist/index.cjs6.js +700 -22
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +37 -13
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.cjs8.js +17 -41
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.cjs9.js +13 -266
- package/dist/index.cjs9.js.map +1 -1
- package/dist/index.es.js +85 -80
- package/dist/index.es.js.map +1 -1
- package/dist/index.es10.js +174 -250
- package/dist/index.es10.js.map +1 -1
- package/dist/index.es11.js +368 -0
- package/dist/index.es11.js.map +1 -0
- package/dist/index.es2.js +3 -5
- package/dist/index.es2.js.map +1 -1
- package/dist/index.es3.js +1 -1
- package/dist/index.es4.js +2 -1
- package/dist/index.es4.js.map +1 -1
- package/dist/index.es6.js +695 -22
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es7.js +33 -14
- package/dist/index.es7.js.map +1 -1
- package/dist/index.es8.js +17 -39
- package/dist/index.es8.js.map +1 -1
- package/dist/index.es9.js +12 -261
- package/dist/index.es9.js.map +1 -1
- package/dist/leaf.cjs.js +1 -1
- package/dist/leaf.cjs.js.map +1 -1
- package/dist/leaf.es.js +2 -2
- package/dist/main.cjs.js +4 -2
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +4 -2
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +3 -3
- package/dist/next.es.js +4 -4
- package/dist/prop-controllers.cjs.js +4 -2
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +4 -2
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/react-page.cjs.js +958 -1431
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +852 -1343
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +3 -3
- package/dist/react.es.js +3 -3
- package/dist/select.cjs.js +21 -0
- package/dist/select.cjs.js.map +1 -0
- package/dist/select.es.js +16 -0
- package/dist/select.es.js.map +1 -0
- package/dist/slate.cjs.js +213 -12
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +207 -6
- package/dist/slate.es.js.map +1 -1
- package/dist/types/src/api/react.d.ts.map +1 -1
- package/dist/types/src/builder/serialization/control-serialization.d.ts +3 -3
- package/dist/types/src/builder/serialization/control-serialization.d.ts.map +1 -1
- package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts +2 -2
- package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/builder/serialization/controls/style-v2.d.ts +5 -0
- package/dist/types/src/builder/serialization/controls/style-v2.d.ts.map +1 -0
- package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
- package/dist/types/src/components/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
- package/dist/types/src/components/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -1
- package/dist/types/src/components/page/Page.d.ts.map +1 -1
- package/dist/types/src/controls/control.d.ts +4 -2
- package/dist/types/src/controls/control.d.ts.map +1 -1
- package/dist/types/src/controls/icon-radio-group.d.ts +29 -0
- package/dist/types/src/controls/icon-radio-group.d.ts.map +1 -0
- package/dist/types/src/controls/index.d.ts +2 -0
- package/dist/types/src/controls/index.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/translation.d.ts +1 -1
- package/dist/types/src/controls/rich-text/translation.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +12 -3
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/controls/shape.d.ts +1 -2
- package/dist/types/src/controls/shape.d.ts.map +1 -1
- package/dist/types/src/controls/style-v2.d.ts +64 -0
- package/dist/types/src/controls/style-v2.d.ts.map +1 -0
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/next/document.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts +6 -3
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/instances.d.ts +2 -2
- package/dist/types/src/prop-controllers/instances.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/introspection.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts +5 -2
- package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/icon-radio-group.d.ts +4 -0
- package/dist/types/src/runtimes/react/controls/icon-radio-group.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts +2 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts +10 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts +10 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/style-v2.d.ts +13 -0
- package/dist/types/src/runtimes/react/controls/style-v2.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/index.d.ts +4 -0
- package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/ColorPlugin/index.d.ts +10 -0
- package/dist/types/src/slate/ColorPlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/InlineModePlugin/index.d.ts +2 -0
- package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts +9 -0
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/index.d.ts +2 -0
- package/dist/types/src/slate/index.d.ts.map +1 -1
- package/dist/types/src/slate/types.d.ts +39 -0
- package/dist/types/src/slate/types.d.ts.map +1 -1
- package/dist/types/src/slate/utils/responsive.d.ts +16 -0
- package/dist/types/src/slate/utils/responsive.d.ts.map +1 -0
- package/dist/useMediaQuery.es.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs6.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs6.js","sources":["../src/slate/InlineModePlugin/index.ts"],"sourcesContent":["import { Editor, Path, Transforms } from 'slate'\nimport { KeyboardEvent } from 'react'\nimport isHotkey from 'is-hotkey'\nimport { createRichTextV2Plugin } from '../../controls/rich-text-v2'\nimport { ElementUtils } from '../utils/element'\nimport { BlockType } from '../types'\n\nconst BLOCK_ONE_PATH = [0]\nconst BLOCK_TWO_PATH = [1]\n\nexport function withInlineMode(editor: Editor): Editor {\n const { normalizeNode } = editor\n editor.normalizeNode = entry => {\n const [normalizationNode, normalizationPath] = entry\n\n /**\n * Merge root nodes past the first one\n */\n if (Path.equals(BLOCK_TWO_PATH, normalizationPath)) {\n Transforms.mergeNodes(editor, { at: BLOCK_TWO_PATH })\n return\n }\n /**\n * Unwrap non text nodes of first root node\n */\n if (\n Path.isAncestor(BLOCK_ONE_PATH, normalizationPath) &&\n ElementUtils.isBlock(normalizationNode)\n ) {\n Transforms.unwrapNodes(editor, {\n at: normalizationPath,\n })\n return\n }\n /**\n * Update type of root nodes to be `text-block`\n */\n if (Path.equals(BLOCK_ONE_PATH, normalizationPath)) {\n Transforms.setNodes(editor, { type: BlockType.Text }, { at: normalizationPath })\n return\n }\n\n normalizeNode(entry)\n }\n\n return editor\n}\n\nexport const InlineModePlugin = createRichTextV2Plugin({\n onKeyDown: (e: KeyboardEvent) => {\n if (isHotkey('enter', e)) e.preventDefault()\n },\n withPlugin: withInlineMode,\n})\n"],"names":["Path","Transforms","ElementUtils","BlockType","createRichTextV2Plugin","isHotkey"],"mappings":";;;;;;;;AAOA,MAAM,iBAAiB,CAAC,CAAC;AACzB,MAAM,iBAAiB,CAAC,CAAC;AAElB,wBAAwB,QAAwB;AACrD,QAAM,EAAE,kBAAkB;AAC1B,SAAO,gBAAgB,CAAS,UAAA;AACxB,UAAA,CAAC,mBAAmB,qBAAqB;AAK/C,QAAIA,WAAK,OAAO,gBAAgB,iBAAiB,GAAG;AAClDC,YAAA,WAAW,WAAW,QAAQ,EAAE,IAAI,eAAgB,CAAA;AACpD;AAAA,IACF;AAKE,QAAAD,MAAA,KAAK,WAAW,gBAAgB,iBAAiB,KACjDE,uBAAa,QAAQ,iBAAiB,GACtC;AACAD,YAAA,WAAW,YAAY,QAAQ;AAAA,QAC7B,IAAI;AAAA,MAAA,CACL;AACD;AAAA,IACF;AAIA,QAAID,WAAK,OAAO,gBAAgB,iBAAiB,GAAG;AACvCC,YAAAA,WAAA,SAAS,QAAQ,EAAE,MAAME,UAAAA,UAAU,QAAQ,EAAE,IAAI,kBAAA,CAAmB;AAC/E;AAAA,IACF;AAEA,kBAAc,KAAK;AAAA,EAAA;AAGd,SAAA;AACT;AAEO,MAAM,mBAAmBC,UAAAA,uBAAuB;AAAA,EACrD,WAAW,CAAC,MAAqB;AAC3B,QAAAC,kBAAA,WAAS,SAAS,CAAC;AAAG,QAAE,eAAe;AAAA,EAC7C;AAAA,EACA,YAAY;AACd,CAAC;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs6.js","sources":["../src/slate/utils/element.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/utils/editor.ts","../src/slate/BlockPlugin/constants.ts","../src/slate/BlockPlugin/utils/filterForSubtreeRoots.ts","../src/slate/BlockPlugin/unwrapList.ts","../src/slate/BlockPlugin/wrapList.ts","../src/slate/BlockPlugin/utils/location.ts","../src/slate/BlockPlugin/utils/getSelectedListItems.ts","../src/slate/BlockPlugin/indent.ts","../src/slate/BlockPlugin/dedent.ts","../src/slate/BlockPlugin/toggleList.ts","../src/slate/BlockPlugin/index.tsx"],"sourcesContent":["import { Node, Element } from 'slate'\nimport {\n RootBlock,\n BlockType,\n Block,\n Inline,\n InlineType,\n OrderedListElement,\n UnorderedListElement,\n ListItemElement,\n ListItemChildElement,\n} from '../types'\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 Element.isElementType(node, BlockType.Text) ||\n Element.isElementType(node, BlockType.Default))\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 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 { 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 { Breakpoints, BreakpointId, findBreakpointOverride } from '../state/modules/breakpoints'\nimport deepEqual from '../utils/deepEqual'\nimport keys from '../utils/keys'\nimport {\n RootBlock,\n Inline,\n RootBlockType,\n ResponsiveBlockTextAlignment,\n BlockTextAlignment,\n RichTextTypography,\n} from './types'\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 '../types'\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 '../types'\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 { Path, Editor, NodeEntry } from 'slate'\n\nimport { ElementUtils } from './element'\nimport { ListElement, ListItemElement } from '../types'\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","export const LIST_ITEM_CHILD_POSITION = 0\nexport const LIST_ITEM_LIST_POSITION = 1\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 { 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 '../types'\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 '../types'\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 { 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, 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 '../types'\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 { setBlockKeyForDevice } from './setBlockKeyForDevice'\nimport { clearBlockKeyForDevice } from './clearBlockKeyForDevice'\nimport { wrapInline } from './wrapInline'\nimport { unwrapInline } from './unwrapInline'\nimport { getSelection } from '../selectors'\nimport { ElementUtils } from '../utils/element'\nimport { RenderElement, Select, createRichTextV2Plugin } from '../../controls'\nimport { getActiveBlockType } from '../selectors'\nimport { BlockType, RootBlockType } from '../types'\nimport { unwrapList } from './unwrapList'\nimport { wrapList } from './wrapList'\nimport { indent } from './indent'\nimport { dedent } from './dedent'\nimport { toggleList } from './toggleList'\nimport { EditorUtils } from '../utils/editor'\nimport isHotkey from 'is-hotkey'\nimport { LIST_ITEM_CHILD_POSITION } from './constants'\nimport { useStyle } from '../../runtimes/react/use-style'\nimport { cx } from '@emotion/css'\nimport { RenderElementProps } from 'slate-react'\n\nexport const BlockActions = {\n setBlockKeyForDevice,\n clearBlockKeyForDevice,\n wrapInline,\n unwrapInline,\n}\n\n// TODO: This API is still litered with artifacts from the list plugin being seperated out.\n// This plugin needs to be rewritten to be assumptionless.\nexport const ListActions = {\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 ListActions.dedent(editor)\n }\n\n if (isHotkey('tab', e)) {\n e.preventDefault()\n ListActions.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 ListActions.dedent(editor)\n } else if (list) {\n ListActions.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 ListActions.dedent(editor)\n } else {\n ListActions.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 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 // 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.isRootBlock(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\nconst definition = Select({\n label: 'Block',\n labelOrientation: 'horizontal',\n options: [\n {\n value: BlockType.Paragraph,\n label: 'Paragraph',\n },\n {\n value: BlockType.Heading1,\n label: 'Heading 1',\n },\n {\n value: BlockType.Heading2,\n label: 'Heading 2',\n },\n {\n value: BlockType.Heading3,\n label: 'Heading 3',\n },\n {\n value: BlockType.Heading4,\n label: 'Heading 4',\n },\n {\n value: BlockType.Heading5,\n label: 'Heading 5',\n },\n {\n value: BlockType.Heading6,\n label: 'Heading 6',\n },\n {\n value: BlockType.UnorderedList,\n label: 'Bulleted list',\n },\n {\n value: BlockType.OrderedList,\n label: 'Numbered list',\n },\n {\n value: BlockType.BlockQuote,\n label: 'Quote',\n },\n ],\n defaultValue: BlockType.Paragraph,\n})\n\nexport function BlockPlugin() {\n return createRichTextV2Plugin({\n withPlugin: withBlock,\n onKeyDown: onKeyDown,\n control: {\n definition,\n onChange: (editor, value) => {\n // TODO: This onChange being so complex is an artifact of how the List plugin used to be seperated out from the block plugin.\n // Would be great to refactor and simplify here.\n\n const activeBlockType = getActiveBlockType(editor)\n if (value === BlockType.UnorderedList || value === BlockType.OrderedList) {\n ListActions.toggleList(editor, {\n type: value,\n at: getSelection(editor),\n })\n } else if (activeBlockType === value) {\n Transforms.setNodes(\n editor,\n {\n type: BlockType.Default,\n },\n { at: getSelection(editor) },\n )\n } else {\n ListActions.unwrapList(editor, {\n at: getSelection(editor),\n })\n Transforms.setNodes(\n editor,\n {\n type: value ?? BlockType.Default,\n },\n { at: getSelection(editor) },\n )\n }\n },\n getValue: editor => {\n const activeBlock = getActiveBlockType(editor)\n\n if (activeBlock === RootBlockType.Text || activeBlock === RootBlockType.Default)\n return undefined\n\n // Casting here because `getActiveBlockType` can return `null` when multiple blocks of different types are selected.\n // This is an edgecase of our block plugin, that didn't warrant expanding the type of `RichTextV2PluginControlValue`.\n return activeBlock as typeof definition['config']['options'][number]['value'] | undefined\n },\n },\n renderElement: renderElement => props =>\n <BlockPluginComponent {...props} renderElement={renderElement} />,\n })\n}\n\nfunction BlockPluginComponent({\n element,\n attributes,\n children,\n renderElement,\n}: RenderElementProps & { renderElement: RenderElement }) {\n const blockStyles = [useStyle({ margin: 0 }), element.className]\n const quoteStyles = 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 switch (element.type) {\n case BlockType.Text:\n return (\n <span {...attributes} className={cx(...blockStyles)}>\n {children}\n </span>\n )\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 {...attributes} className={cx(...blockStyles, quoteStyles)}>\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 case BlockType.Default:\n return (\n <p {...attributes} className={cx(...blockStyles)}>\n {children}\n </p>\n )\n\n default:\n return <>{renderElement({ element, attributes, children })}</>\n }\n}\n"],"names":["Element","BlockType","InlineType","Range","Editor","Text","Path","findBreakpointOverride","Transforms","Node","Point","BlockActions","setBlockKeyForDevice","clearBlockKeyForDevice","wrapInline","unwrapInline","ListActions","unwrapList","wrapList","indent","dedent","toggleList","e","editor","selection","Array","from","nodes","match","node","ElementUtils","isListItem","length","isHotkey","preventDefault","isExpanded","listItem","EditorUtils","getFirstAncestorListItem","anchor","path","offset","parentListItem","list","getFirstAncestorList","delete","string","splitNodes","at","always","insertText","normalizeNode","isInline","entry","normalizationNode","normalizationPath","isBlock","textAlign","unsetNodes","pathToListItemText","LIST_ITEM_CHILD_POSITION","has","nodeInListItemTextPosition","get","isRootBlock","setNodes","type","ListItemChild","insertNodes","createListItem","isText","mergeableChildren","children","map","child","index","potentialNodeToBeMerged","isList","pathRef","filter","mergeableNodes","Boolean","reverse","forEach","nodePathRef","nodeToBeMergedPathRef","nodePath","current","nodeToBeMergedPath","nodeChildren","childrenToBeMerged","withoutNormalizing","_","childPath","moveNodes","to","removeNodes","unref","definition","Select","label","labelOrientation","options","value","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","UnorderedList","OrderedList","BlockQuote","defaultValue","createRichTextV2Plugin","withPlugin","withBlock","onKeyDown","control","onChange","activeBlockType","getActiveBlockType","getSelection","Default","getValue","activeBlock","RootBlockType","undefined","renderElement","props","_jsx","element","attributes","blockStyles","useStyle","margin","className","quoteStyles","padding","fontSize","fontWeight","borderLeft","cx","listStylePosition","ListItem","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,MAAM,eAAe;AAAA,EAC1B,YAAY,MAA+B;AACzC,WACEA,MAAAA,QAAQ,UAAU,IAAI,KACrBA,OAAAA,QAAQ,cAAc,MAAMC,oBAAU,SAAS,KAC9CD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B;AAAA,QAA/E;AAAA,QACGxE;AAAAA,MAAAA,EAFL;AAAA,SAKGvE,UAAU8G,UAAAA;AACb,mFACUsB;QAAY,WAAWU,IAAAA,GAAG,GAAGT,WAAJ;AAAA,QAAkB,OAAO;AAAA,UAAEU,mBAAmB;AAAA,QAA/E;AAAA,QACGxE;AAAAA,MAAAA,EAFL;AAAA,SAKGvE,UAAUgJ,UAAAA;AACb,mFACUZ;QAAY,WAAWU,IAAAA,GAAG,GAAGT,WAAJ;AAAA,QAC9B9D;AAAAA,MAAAA,EAFL;AAAA,SAKGvE,UAAUkE,UAAAA;AACb,qFACYkE;QAAY,WAAWU,IAAAA,GAAG,GAAGT,WAAJ;AAAA,QAChC9D;AAAAA,MAAAA,EAFL;AAAA,SAKGvE,UAAU2H,UAAAA;AACb,kFACSS;QAAY,WAAWU,IAAAA,GAAG,GAAGT,WAAJ;AAAA,QAC7B9D;AAAAA,MAAAA,EAFL;AAAA;AAOO,4CAAA0E,WAAAA,UAAA;AAAA,QAAA,UAAGjB,cAAc;AAAA,UAAEG;AAAAA,UAASC;AAAAA,UAAY7D;AAAAA,QAAAA,CAAxB;AAAA,MAAA,CAAvB;AAAA;AAEL;;;;;;;;"}
|
package/dist/index.cjs7.js
CHANGED
|
@@ -1,19 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var slate = require("slate");
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
var isHotkey = require("is-hotkey");
|
|
4
|
+
var reactPage = require("./react-page.cjs.js");
|
|
5
|
+
var index = require("./index.cjs6.js");
|
|
6
|
+
function _interopDefaultLegacy(e) {
|
|
7
|
+
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
8
|
+
}
|
|
9
|
+
var isHotkey__default = /* @__PURE__ */ _interopDefaultLegacy(isHotkey);
|
|
10
|
+
const BLOCK_ONE_PATH = [0];
|
|
11
|
+
const BLOCK_TWO_PATH = [1];
|
|
12
|
+
function withInlineMode(editor) {
|
|
13
|
+
const { normalizeNode } = editor;
|
|
14
|
+
editor.normalizeNode = (entry) => {
|
|
15
|
+
const [normalizationNode, normalizationPath] = entry;
|
|
16
|
+
if (slate.Path.equals(BLOCK_TWO_PATH, normalizationPath)) {
|
|
17
|
+
slate.Transforms.mergeNodes(editor, { at: BLOCK_TWO_PATH });
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (slate.Path.isAncestor(BLOCK_ONE_PATH, normalizationPath) && index.ElementUtils.isBlock(normalizationNode)) {
|
|
21
|
+
slate.Transforms.unwrapNodes(editor, {
|
|
22
|
+
at: normalizationPath
|
|
23
|
+
});
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (slate.Path.equals(BLOCK_ONE_PATH, normalizationPath)) {
|
|
27
|
+
slate.Transforms.setNodes(editor, { type: reactPage.BlockType.Text }, { at: normalizationPath });
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
normalizeNode(entry);
|
|
15
31
|
};
|
|
16
32
|
return editor;
|
|
17
33
|
}
|
|
18
|
-
|
|
34
|
+
const InlineModePlugin = reactPage.createRichTextV2Plugin({
|
|
35
|
+
onKeyDown: (e) => {
|
|
36
|
+
if (isHotkey__default["default"]("enter", e))
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
},
|
|
39
|
+
withPlugin: withInlineMode
|
|
40
|
+
});
|
|
41
|
+
exports.InlineModePlugin = InlineModePlugin;
|
|
42
|
+
exports.withInlineMode = withInlineMode;
|
|
19
43
|
//# sourceMappingURL=index.cjs7.js.map
|
package/dist/index.cjs7.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs7.js","sources":["../src/slate/
|
|
1
|
+
{"version":3,"file":"index.cjs7.js","sources":["../src/slate/InlineModePlugin/index.ts"],"sourcesContent":["import { Editor, Path, Transforms } from 'slate'\nimport { KeyboardEvent } from 'react'\nimport isHotkey from 'is-hotkey'\nimport { createRichTextV2Plugin } from '../../controls/rich-text-v2'\nimport { ElementUtils } from '../utils/element'\nimport { BlockType } from '../types'\n\nconst BLOCK_ONE_PATH = [0]\nconst BLOCK_TWO_PATH = [1]\n\nexport function withInlineMode(editor: Editor): Editor {\n const { normalizeNode } = editor\n editor.normalizeNode = entry => {\n const [normalizationNode, normalizationPath] = entry\n\n /**\n * Merge root nodes past the first one\n */\n if (Path.equals(BLOCK_TWO_PATH, normalizationPath)) {\n Transforms.mergeNodes(editor, { at: BLOCK_TWO_PATH })\n return\n }\n /**\n * Unwrap non text nodes of first root node\n */\n if (\n Path.isAncestor(BLOCK_ONE_PATH, normalizationPath) &&\n ElementUtils.isBlock(normalizationNode)\n ) {\n Transforms.unwrapNodes(editor, {\n at: normalizationPath,\n })\n return\n }\n /**\n * Update type of root nodes to be `text-block`\n */\n if (Path.equals(BLOCK_ONE_PATH, normalizationPath)) {\n Transforms.setNodes(editor, { type: BlockType.Text }, { at: normalizationPath })\n return\n }\n\n normalizeNode(entry)\n }\n\n return editor\n}\n\nexport const InlineModePlugin = createRichTextV2Plugin({\n onKeyDown: (e: KeyboardEvent) => {\n if (isHotkey('enter', e)) e.preventDefault()\n },\n withPlugin: withInlineMode,\n})\n"],"names":["Path","Transforms","ElementUtils","BlockType","createRichTextV2Plugin","isHotkey"],"mappings":";;;;;;;;;AAOA,MAAM,iBAAiB,CAAC,CAAC;AACzB,MAAM,iBAAiB,CAAC,CAAC;AAElB,wBAAwB,QAAwB;AACrD,QAAM,EAAE,kBAAkB;AAC1B,SAAO,gBAAgB,CAAS,UAAA;AACxB,UAAA,CAAC,mBAAmB,qBAAqB;AAK/C,QAAIA,WAAK,OAAO,gBAAgB,iBAAiB,GAAG;AAClDC,YAAA,WAAW,WAAW,QAAQ,EAAE,IAAI,eAAgB,CAAA;AACpD;AAAA,IACF;AAKE,QAAAD,MAAA,KAAK,WAAW,gBAAgB,iBAAiB,KACjDE,mBAAa,QAAQ,iBAAiB,GACtC;AACAD,YAAA,WAAW,YAAY,QAAQ;AAAA,QAC7B,IAAI;AAAA,MAAA,CACL;AACD;AAAA,IACF;AAIA,QAAID,WAAK,OAAO,gBAAgB,iBAAiB,GAAG;AACvCC,YAAAA,WAAA,SAAS,QAAQ,EAAE,MAAME,UAAAA,UAAU,QAAQ,EAAE,IAAI,kBAAA,CAAmB;AAC/E;AAAA,IACF;AAEA,kBAAc,KAAK;AAAA,EAAA;AAGd,SAAA;AACT;AAEO,MAAM,mBAAmBC,UAAAA,uBAAuB;AAAA,EACrD,WAAW,CAAC,MAAqB;AAC3B,QAAAC,kBAAA,WAAS,SAAS,CAAC;AAAG,QAAE,eAAe;AAAA,EAC7C;AAAA,EACA,YAAY;AACd,CAAC;;;"}
|
package/dist/index.cjs8.js
CHANGED
|
@@ -1,43 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
require("react/jsx-runtime");
|
|
20
|
-
require("./text-input.cjs.js");
|
|
21
|
-
require("./combobox.cjs.js");
|
|
22
|
-
require("use-sync-external-store/shim");
|
|
23
|
-
require("./types.cjs.js");
|
|
24
|
-
require("./box-models.cjs.js");
|
|
25
|
-
require("css-box-model");
|
|
26
|
-
require("color");
|
|
27
|
-
require("scroll-into-view-if-needed");
|
|
28
|
-
require("react-dom");
|
|
29
|
-
require("html-react-parser");
|
|
30
|
-
require("next/head");
|
|
31
|
-
require("zod");
|
|
32
|
-
require("@emotion/server/create-instance");
|
|
33
|
-
require("next/document");
|
|
34
|
-
require("cors");
|
|
35
|
-
require("path-to-regexp");
|
|
36
|
-
require("cookie");
|
|
37
|
-
require("http-proxy");
|
|
38
|
-
require("set-cookie-parser");
|
|
39
|
-
require("./constants.cjs.js");
|
|
40
|
-
require("uuid");
|
|
41
|
-
require("corporate-ipsum");
|
|
42
|
-
exports["default"] = Text["default"];
|
|
2
|
+
var slate = require("slate");
|
|
3
|
+
var slateReact = require("slate-react");
|
|
4
|
+
function withBuilder(editor) {
|
|
5
|
+
editor.deselectAndBlur = function() {
|
|
6
|
+
slateReact.ReactEditor.deselect(editor);
|
|
7
|
+
slateReact.ReactEditor.blur(editor);
|
|
8
|
+
};
|
|
9
|
+
editor.focusAndSelectAll = function() {
|
|
10
|
+
slateReact.ReactEditor.focus(editor);
|
|
11
|
+
slate.Transforms.select(editor, {
|
|
12
|
+
anchor: slate.Editor.start(editor, []),
|
|
13
|
+
focus: slate.Editor.end(editor, [])
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
return editor;
|
|
17
|
+
}
|
|
18
|
+
exports.withBuilder = withBuilder;
|
|
43
19
|
//# sourceMappingURL=index.cjs8.js.map
|
package/dist/index.cjs8.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs8.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs8.js","sources":["../src/slate/BuilderPlugin/index.ts"],"sourcesContent":["import { BaseEditor, Editor, Transforms } from 'slate'\nimport { ReactEditor } from 'slate-react'\n\nexport interface BuilderEditor extends BaseEditor {\n focusAndSelectAll: () => void\n deselectAndBlur: () => void\n}\n\nexport function withBuilder(editor: Editor) {\n editor.deselectAndBlur = function () {\n ReactEditor.deselect(editor)\n ReactEditor.blur(editor)\n }\n\n editor.focusAndSelectAll = function () {\n ReactEditor.focus(editor)\n Transforms.select(editor, {\n anchor: Editor.start(editor, []),\n focus: Editor.end(editor, []),\n })\n }\n\n return editor\n}\n"],"names":["ReactEditor","Transforms","Editor"],"mappings":";;;AAQO,qBAAqB,QAAgB;AAC1C,SAAO,kBAAkB,WAAY;AACnCA,2BAAY,SAAS,MAAM;AAC3BA,2BAAY,KAAK,MAAM;AAAA,EAAA;AAGzB,SAAO,oBAAoB,WAAY;AACrCA,2BAAY,MAAM,MAAM;AACxBC,UAAA,WAAW,OAAO,QAAQ;AAAA,MACxB,QAAQC,MAAA,OAAO,MAAM,QAAQ,CAAA,CAAE;AAAA,MAC/B,OAAOA,MAAA,OAAO,IAAI,QAAQ,CAAA,CAAE;AAAA,IAAA,CAC7B;AAAA,EAAA;AAGI,SAAA;AACT;;"}
|
package/dist/index.cjs9.js
CHANGED
|
@@ -1,48 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
require("./state/breakpoints.cjs.js");
|
|
29
|
-
var index = require("./index.cjs6.js");
|
|
30
|
-
var index$1 = require("./index.cjs7.js");
|
|
31
|
-
var next = require("./index.cjs.js");
|
|
32
|
-
var useIsomorphicLayoutEffect = require("./useIsomorphicLayoutEffect.cjs.js");
|
|
33
|
-
var css = require("@emotion/css");
|
|
34
|
-
var jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
var Text = require("./Text.cjs.js");
|
|
4
|
+
require("next/dynamic");
|
|
5
|
+
require("react");
|
|
6
|
+
require("./index.cjs.js");
|
|
7
|
+
require("use-sync-external-store/shim/with-selector");
|
|
8
|
+
require("./react-page.cjs.js");
|
|
35
9
|
require("redux");
|
|
36
10
|
require("redux-thunk");
|
|
37
11
|
require("./actions.cjs.js");
|
|
38
|
-
require("
|
|
39
|
-
require("
|
|
12
|
+
require("./state/breakpoints.cjs.js");
|
|
13
|
+
require("@emotion/css");
|
|
40
14
|
require("@emotion/serialize");
|
|
41
15
|
require("@emotion/utils");
|
|
16
|
+
require("slate");
|
|
17
|
+
require("react/jsx-runtime");
|
|
42
18
|
require("./text-input.cjs.js");
|
|
43
19
|
require("./combobox.cjs.js");
|
|
20
|
+
require("./select.cjs.js");
|
|
44
21
|
require("use-sync-external-store/shim");
|
|
45
22
|
require("./types.cjs.js");
|
|
23
|
+
require("./deepEqual.cjs.js");
|
|
46
24
|
require("./box-models.cjs.js");
|
|
47
25
|
require("css-box-model");
|
|
48
26
|
require("color");
|
|
@@ -61,236 +39,5 @@ require("set-cookie-parser");
|
|
|
61
39
|
require("./constants.cjs.js");
|
|
62
40
|
require("uuid");
|
|
63
41
|
require("corporate-ipsum");
|
|
64
|
-
|
|
65
|
-
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
66
|
-
}
|
|
67
|
-
var isHotkey__default = /* @__PURE__ */ _interopDefaultLegacy(isHotkey);
|
|
68
|
-
function useSyncDOMSelection(editor, isEnabled) {
|
|
69
|
-
useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(() => {
|
|
70
|
-
if (!isEnabled.current || editor.selection == null || slateReact.ReactEditor.isFocused(editor))
|
|
71
|
-
return;
|
|
72
|
-
try {
|
|
73
|
-
const root = slateReact.ReactEditor.findDocumentOrShadowRoot(editor);
|
|
74
|
-
const domSelection = root.getSelection();
|
|
75
|
-
const newDomRange = slateReact.ReactEditor.toDOMRange(editor, editor.selection);
|
|
76
|
-
if (newDomRange) {
|
|
77
|
-
if (slate.Range.isBackward(editor.selection)) {
|
|
78
|
-
domSelection == null ? void 0 : domSelection.setBaseAndExtent(newDomRange.endContainer, newDomRange.endOffset, newDomRange.startContainer, newDomRange.startOffset);
|
|
79
|
-
} else {
|
|
80
|
-
domSelection == null ? void 0 : domSelection.setBaseAndExtent(newDomRange.startContainer, newDomRange.startOffset, newDomRange.endContainer, newDomRange.endOffset);
|
|
81
|
-
}
|
|
82
|
-
} else {
|
|
83
|
-
domSelection == null ? void 0 : domSelection.removeAllRanges();
|
|
84
|
-
}
|
|
85
|
-
} catch (e) {
|
|
86
|
-
console.error(e);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
const defaultText = [{
|
|
91
|
-
type: reactPage.BlockType.Default,
|
|
92
|
-
children: [{
|
|
93
|
-
text: ""
|
|
94
|
-
}]
|
|
95
|
-
}];
|
|
96
|
-
function EditableTextV2({
|
|
97
|
-
text,
|
|
98
|
-
control
|
|
99
|
-
}) {
|
|
100
|
-
const plugins = React.useMemo(() => {
|
|
101
|
-
var _a, _b, _c, _d, _e;
|
|
102
|
-
const plugins2 = [...(_c = (_b = (_a = control == null ? void 0 : control.descriptor) == null ? void 0 : _a.config) == null ? void 0 : _b.plugins) != null ? _c : [], ...((_e = (_d = control == null ? void 0 : control.descriptor) == null ? void 0 : _d.config) == null ? void 0 : _e.mode) === reactPage.RichTextV2Mode.Inline ? [index.InlineModePlugin] : []];
|
|
103
|
-
return plugins2;
|
|
104
|
-
}, [control == null ? void 0 : control.descriptor.config]);
|
|
105
|
-
const [editor] = React.useState(() => plugins.reduceRight((editor2, plugin) => {
|
|
106
|
-
var _a, _b;
|
|
107
|
-
return (_b = (_a = plugin == null ? void 0 : plugin.withPlugin) == null ? void 0 : _a.call(plugin, editor2)) != null ? _b : editor2;
|
|
108
|
-
}, index$1.withBuilder(slateHistory.withHistory(slateReact.withReact(slate.createEditor())))));
|
|
109
|
-
const isPreservingFocus = React.useRef(false);
|
|
110
|
-
useSyncDOMSelection(editor, isPreservingFocus);
|
|
111
|
-
const editMode = next.useBuilderEditMode();
|
|
112
|
-
React.useEffect(() => {
|
|
113
|
-
if (control == null)
|
|
114
|
-
return;
|
|
115
|
-
const element = slateReact.ReactEditor.toDOMNode(editor, editor);
|
|
116
|
-
return next.pollBoxModel({
|
|
117
|
-
element,
|
|
118
|
-
onBoxModelChange: (boxModel) => control.changeBoxModel(boxModel)
|
|
119
|
-
});
|
|
120
|
-
}, [editor, control]);
|
|
121
|
-
const renderElement = React.useCallback(({
|
|
122
|
-
attributes,
|
|
123
|
-
children,
|
|
124
|
-
element
|
|
125
|
-
}) => {
|
|
126
|
-
const blockStyles = [next.useStyle({
|
|
127
|
-
margin: 0
|
|
128
|
-
})];
|
|
129
|
-
const quoteStyles = next.useStyle({
|
|
130
|
-
padding: "0.5em 10px",
|
|
131
|
-
fontSize: "1.25em",
|
|
132
|
-
fontWeight: "300",
|
|
133
|
-
borderLeft: "5px solid rgba(0, 0, 0, 0.1)"
|
|
134
|
-
});
|
|
135
|
-
switch (element.type) {
|
|
136
|
-
case reactPage.BlockType.Text:
|
|
137
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", __spreadProps(__spreadValues({}, attributes), {
|
|
138
|
-
className: css.cx(...blockStyles),
|
|
139
|
-
children
|
|
140
|
-
}));
|
|
141
|
-
case reactPage.BlockType.Paragraph:
|
|
142
|
-
return /* @__PURE__ */ jsxRuntime.jsx("p", __spreadProps(__spreadValues({}, attributes), {
|
|
143
|
-
className: css.cx(...blockStyles),
|
|
144
|
-
children
|
|
145
|
-
}));
|
|
146
|
-
case reactPage.BlockType.Heading1:
|
|
147
|
-
return /* @__PURE__ */ jsxRuntime.jsx("h1", __spreadProps(__spreadValues({}, attributes), {
|
|
148
|
-
className: css.cx(...blockStyles),
|
|
149
|
-
children
|
|
150
|
-
}));
|
|
151
|
-
case reactPage.BlockType.Heading2:
|
|
152
|
-
return /* @__PURE__ */ jsxRuntime.jsx("h2", __spreadProps(__spreadValues({}, attributes), {
|
|
153
|
-
className: css.cx(...blockStyles),
|
|
154
|
-
children
|
|
155
|
-
}));
|
|
156
|
-
case reactPage.BlockType.Heading3:
|
|
157
|
-
return /* @__PURE__ */ jsxRuntime.jsx("h3", __spreadProps(__spreadValues({}, attributes), {
|
|
158
|
-
className: css.cx(...blockStyles),
|
|
159
|
-
children
|
|
160
|
-
}));
|
|
161
|
-
case reactPage.BlockType.Heading4:
|
|
162
|
-
return /* @__PURE__ */ jsxRuntime.jsx("h4", __spreadProps(__spreadValues({}, attributes), {
|
|
163
|
-
className: css.cx(...blockStyles),
|
|
164
|
-
children
|
|
165
|
-
}));
|
|
166
|
-
case reactPage.BlockType.Heading5:
|
|
167
|
-
return /* @__PURE__ */ jsxRuntime.jsx("h5", __spreadProps(__spreadValues({}, attributes), {
|
|
168
|
-
className: css.cx(...blockStyles),
|
|
169
|
-
children
|
|
170
|
-
}));
|
|
171
|
-
case reactPage.BlockType.Heading6:
|
|
172
|
-
return /* @__PURE__ */ jsxRuntime.jsx("h6", __spreadProps(__spreadValues({}, attributes), {
|
|
173
|
-
className: css.cx(...blockStyles),
|
|
174
|
-
children
|
|
175
|
-
}));
|
|
176
|
-
case reactPage.BlockType.BlockQuote:
|
|
177
|
-
return /* @__PURE__ */ jsxRuntime.jsx("blockquote", __spreadProps(__spreadValues({}, attributes), {
|
|
178
|
-
className: css.cx(...blockStyles, quoteStyles),
|
|
179
|
-
children
|
|
180
|
-
}));
|
|
181
|
-
case reactPage.BlockType.OrderedList:
|
|
182
|
-
return /* @__PURE__ */ jsxRuntime.jsx("ol", __spreadProps(__spreadValues({}, attributes), {
|
|
183
|
-
className: css.cx(...blockStyles),
|
|
184
|
-
style: {
|
|
185
|
-
listStylePosition: "inside"
|
|
186
|
-
},
|
|
187
|
-
children
|
|
188
|
-
}));
|
|
189
|
-
case reactPage.BlockType.UnorderedList:
|
|
190
|
-
return /* @__PURE__ */ jsxRuntime.jsx("ul", __spreadProps(__spreadValues({}, attributes), {
|
|
191
|
-
className: css.cx(...blockStyles),
|
|
192
|
-
style: {
|
|
193
|
-
listStylePosition: "inside"
|
|
194
|
-
},
|
|
195
|
-
children
|
|
196
|
-
}));
|
|
197
|
-
case reactPage.BlockType.ListItem:
|
|
198
|
-
return /* @__PURE__ */ jsxRuntime.jsx("li", __spreadProps(__spreadValues({}, attributes), {
|
|
199
|
-
className: css.cx(...blockStyles),
|
|
200
|
-
children
|
|
201
|
-
}));
|
|
202
|
-
case reactPage.BlockType.ListItemChild:
|
|
203
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", __spreadProps(__spreadValues({}, attributes), {
|
|
204
|
-
className: css.cx(...blockStyles),
|
|
205
|
-
children
|
|
206
|
-
}));
|
|
207
|
-
case reactPage.BlockType.Default:
|
|
208
|
-
default:
|
|
209
|
-
if ((control == null ? void 0 : control.descriptor.config.mode) === reactPage.RichTextV2Mode.Inline) {
|
|
210
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", __spreadProps(__spreadValues({}, attributes), {
|
|
211
|
-
className: css.cx(...blockStyles),
|
|
212
|
-
children
|
|
213
|
-
}));
|
|
214
|
-
}
|
|
215
|
-
return /* @__PURE__ */ jsxRuntime.jsx("p", __spreadProps(__spreadValues({}, attributes), {
|
|
216
|
-
className: css.cx(...blockStyles),
|
|
217
|
-
children
|
|
218
|
-
}));
|
|
219
|
-
}
|
|
220
|
-
}, []);
|
|
221
|
-
const renderLeaf = React.useCallback(({
|
|
222
|
-
attributes,
|
|
223
|
-
children
|
|
224
|
-
}) => {
|
|
225
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", __spreadProps(__spreadValues({}, attributes), {
|
|
226
|
-
children
|
|
227
|
-
}));
|
|
228
|
-
}, []);
|
|
229
|
-
const initialValue = React.useMemo(() => text != null ? text : defaultText, [text]);
|
|
230
|
-
React.useEffect(() => {
|
|
231
|
-
if (editMode !== reactPage.BuilderEditMode.CONTENT) {
|
|
232
|
-
isPreservingFocus.current = false;
|
|
233
|
-
slateReact.ReactEditor.deselect(editor);
|
|
234
|
-
}
|
|
235
|
-
}, [editMode]);
|
|
236
|
-
React.useEffect(() => {
|
|
237
|
-
control == null ? void 0 : control.setEditor(editor);
|
|
238
|
-
control == null ? void 0 : control.setDefaultValue(defaultText);
|
|
239
|
-
}, [control, editor, defaultText]);
|
|
240
|
-
const handleFocus = React.useCallback(() => {
|
|
241
|
-
isPreservingFocus.current = true;
|
|
242
|
-
control == null ? void 0 : control.select();
|
|
243
|
-
}, [control]);
|
|
244
|
-
const handleKeyDown = React.useCallback((e) => {
|
|
245
|
-
if (isHotkey__default["default"]("mod+shift+z", e))
|
|
246
|
-
return slateHistory.HistoryEditor.redo(editor);
|
|
247
|
-
if (isHotkey__default["default"]("mod+z", e))
|
|
248
|
-
return slateHistory.HistoryEditor.undo(editor);
|
|
249
|
-
if (isHotkey__default["default"]("escape")(e)) {
|
|
250
|
-
isPreservingFocus.current = false;
|
|
251
|
-
slateReact.ReactEditor.blur(editor);
|
|
252
|
-
control == null ? void 0 : control.switchToBuildMode();
|
|
253
|
-
}
|
|
254
|
-
plugins.forEach((plugin) => {
|
|
255
|
-
var _a;
|
|
256
|
-
return (_a = plugin == null ? void 0 : plugin.onKeyDown) == null ? void 0 : _a.call(plugin, e, editor);
|
|
257
|
-
});
|
|
258
|
-
}, [control, plugins, editor]);
|
|
259
|
-
const handleKeyUp = React.useCallback((e) => {
|
|
260
|
-
if (editMode === reactPage.BuilderEditMode.CONTENT)
|
|
261
|
-
e.preventDefault();
|
|
262
|
-
}, [control, editor, editMode]);
|
|
263
|
-
const handleClick = React.useCallback((e) => {
|
|
264
|
-
if (editMode === reactPage.BuilderEditMode.CONTENT)
|
|
265
|
-
e.stopPropagation();
|
|
266
|
-
}, [editMode]);
|
|
267
|
-
const handleBlur = React.useCallback((e) => {
|
|
268
|
-
var _a;
|
|
269
|
-
if (e.relatedTarget == null)
|
|
270
|
-
return;
|
|
271
|
-
if (((_a = e.relatedTarget) == null ? void 0 : _a.getAttribute("contenteditable")) === "true")
|
|
272
|
-
isPreservingFocus.current = false;
|
|
273
|
-
}, []);
|
|
274
|
-
const handleOnChange = React.useCallback((value) => {
|
|
275
|
-
control == null ? void 0 : control.onChange(value);
|
|
276
|
-
}, [control]);
|
|
277
|
-
return /* @__PURE__ */ jsxRuntime.jsx(slateReact.Slate, {
|
|
278
|
-
editor,
|
|
279
|
-
onChange: handleOnChange,
|
|
280
|
-
value: initialValue,
|
|
281
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(slateReact.Editable, {
|
|
282
|
-
renderLeaf,
|
|
283
|
-
renderElement,
|
|
284
|
-
onFocus: handleFocus,
|
|
285
|
-
onKeyDown: handleKeyDown,
|
|
286
|
-
onKeyUp: handleKeyUp,
|
|
287
|
-
onClick: handleClick,
|
|
288
|
-
onBlur: handleBlur,
|
|
289
|
-
readOnly: editMode !== reactPage.BuilderEditMode.CONTENT,
|
|
290
|
-
placeholder: "Write some text..."
|
|
291
|
-
})
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
exports.EditableTextV2 = EditableTextV2;
|
|
295
|
-
exports["default"] = EditableTextV2;
|
|
42
|
+
exports["default"] = Text["default"];
|
|
296
43
|
//# sourceMappingURL=index.cjs9.js.map
|
package/dist/index.cjs9.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs9.js","sources":["../src/runtimes/react/controls/rich-text-v2/EditableTextV2/useSyncDOMSelection.tsx","../src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.tsx"],"sourcesContent":["import { Editor, Range as SlateRange } from 'slate'\nimport { useIsomorphicLayoutEffect } from '../../../../../components/hooks/useIsomorphicLayoutEffect'\nimport { MutableRefObject } from 'react'\nimport { ReactEditor } from 'slate-react'\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: MutableRefObject<boolean>) {\n useIsomorphicLayoutEffect(() => {\n if (!isEnabled.current || 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 KeyboardEvent,\n MouseEvent,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport { Descendant, createEditor } from 'slate'\nimport isHotkey from 'is-hotkey'\nimport { withHistory, HistoryEditor } from 'slate-history'\nimport {\n withReact,\n ReactEditor,\n RenderElementProps,\n RenderLeafProps,\n Slate,\n Editable,\n} from 'slate-react'\n\nimport {\n RichTextV2Control,\n RichTextV2ControlData,\n RichTextV2ControlDefinition,\n RichTextV2Mode,\n} from '../../../../../controls'\nimport { useBuilderEditMode } from '../../..'\nimport { BuilderEditMode } from '../../../../../state/modules/builder-edit-mode'\nimport { pollBoxModel } from '../../../poll-box-model'\nimport { InlineModePlugin, withBuilder } from '../../../../../slate'\nimport { useSyncDOMSelection } from './useSyncDOMSelection'\nimport { BlockType } from '../../../../../slate'\nimport { useStyle } from '../../../use-style'\nimport { cx } from '@emotion/css'\n\nexport type RichTextV2ControlValue = ReactNode\n\nexport type Descriptors = { text?: RichTextV2ControlDefinition }\n\nconst defaultText: Descendant[] = [{ type: BlockType.Default, children: [{ text: '' }] }]\n\ntype Props = {\n text: RichTextV2ControlData\n control: RichTextV2Control | null\n}\n\nexport function EditableTextV2({ text, control }: Props) {\n const plugins = useMemo(() => {\n const plugins = [\n ...(control?.descriptor?.config?.plugins ?? []),\n ...(control?.descriptor?.config?.mode === RichTextV2Mode.Inline ? [InlineModePlugin] : []),\n ]\n return plugins\n }, [control?.descriptor.config])\n\n const [editor] = useState(() =>\n plugins.reduceRight(\n (editor, plugin) => plugin?.withPlugin?.(editor) ?? editor,\n withBuilder(withHistory(withReact(createEditor()))),\n ),\n )\n\n const isPreservingFocus = useRef(false)\n useSyncDOMSelection(editor, isPreservingFocus)\n\n const editMode = useBuilderEditMode()\n\n useEffect(() => {\n if (control == null) return\n\n const element = ReactEditor.toDOMNode(editor, editor)\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => control.changeBoxModel(boxModel),\n })\n }, [editor, control])\n\n const renderElement = useCallback(({ attributes, children, element }: RenderElementProps) => {\n // TODO: move this markup into the block plugin once we have a way of composing render functionality.\n const blockStyles = [useStyle({ margin: 0 })]\n const quoteStyles = 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 switch (element.type) {\n case BlockType.Text:\n return (\n <span {...attributes} className={cx(...blockStyles)}>\n {children}\n </span>\n )\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 {...attributes} className={cx(...blockStyles, quoteStyles)}>\n {children}\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol\n {...attributes}\n className={cx(...blockStyles)}\n style={{ listStylePosition: 'inside' }}\n >\n {children}\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul\n {...attributes}\n className={cx(...blockStyles)}\n style={{ listStylePosition: 'inside' }}\n >\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 case BlockType.Default:\n default:\n if (control?.descriptor.config.mode === RichTextV2Mode.Inline) {\n return (\n <span {...attributes} className={cx(...blockStyles)}>\n {children}\n </span>\n )\n }\n\n return (\n <p {...attributes} className={cx(...blockStyles)}>\n {children}\n </p>\n )\n }\n }, [])\n\n const renderLeaf = useCallback(({ attributes, children }: RenderLeafProps) => {\n return <span {...attributes}>{children}</span>\n }, [])\n\n const initialValue = useMemo(() => text ?? defaultText, [text])\n\n useEffect(() => {\n /**\n * This is required because clicking on the overlay has `relatedTarget` null just like the sidebar, but\n * - in the case of the overlay we switch to BUILD mode\n * - in the case of the sidebar we preserve the selection\n */\n if (editMode !== BuilderEditMode.CONTENT) {\n isPreservingFocus.current = false\n ReactEditor.deselect(editor)\n }\n }, [editMode])\n\n useEffect(() => {\n control?.setEditor(editor)\n control?.setDefaultValue(defaultText)\n }, [control, editor, defaultText])\n\n const handleFocus = useCallback(() => {\n isPreservingFocus.current = true\n control?.select()\n }, [control])\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (isHotkey('mod+shift+z', e)) return HistoryEditor.redo(editor)\n if (isHotkey('mod+z', e)) return HistoryEditor.undo(editor)\n if (isHotkey('escape')(e)) {\n isPreservingFocus.current = false\n ReactEditor.blur(editor)\n control?.switchToBuildMode()\n }\n\n plugins.forEach(plugin => plugin?.onKeyDown?.(e, editor))\n },\n [control, plugins, editor],\n )\n\n const handleKeyUp = useCallback(\n (e: KeyboardEvent) => {\n if (editMode === BuilderEditMode.CONTENT) e.preventDefault()\n },\n [control, editor, editMode],\n )\n\n const handleClick = useCallback(\n (e: MouseEvent) => {\n if (editMode === BuilderEditMode.CONTENT) e.stopPropagation()\n },\n [editMode],\n )\n\n const handleBlur = useCallback((e: FocusEvent) => {\n // outside of iframe (overlay, sidebar, etc)\n if (e.relatedTarget == null) return\n // another text\n if (e.relatedTarget?.getAttribute('contenteditable') === 'true')\n isPreservingFocus.current = false\n }, [])\n\n const handleOnChange = useCallback(\n (value: Descendant[]) => {\n control?.onChange(value)\n },\n [control],\n )\n\n return (\n <Slate editor={editor} onChange={handleOnChange} value={initialValue}>\n <Editable\n renderLeaf={renderLeaf}\n renderElement={renderElement}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n onKeyUp={handleKeyUp}\n onClick={handleClick}\n onBlur={handleBlur}\n readOnly={editMode !== BuilderEditMode.CONTENT}\n placeholder=\"Write some text...\"\n />\n </Slate>\n )\n}\n\nexport default EditableTextV2\n"],"names":["editor","isEnabled","useIsomorphicLayoutEffect","current","selection","ReactEditor","isFocused","root","findDocumentOrShadowRoot","domSelection","getSelection","newDomRange","toDOMRange","SlateRange","isBackward","setBaseAndExtent","endContainer","endOffset","startContainer","startOffset","removeAllRanges","e","console","error","defaultText","type","BlockType","Default","children","text","control","plugins","useMemo","descriptor","config","mode","RichTextV2Mode","Inline","InlineModePlugin","useState","reduceRight","plugin","withPlugin","withBuilder","withHistory","withReact","createEditor","isPreservingFocus","useRef","useSyncDOMSelection","editMode","useBuilderEditMode","useEffect","element","toDOMNode","pollBoxModel","onBoxModelChange","boxModel","changeBoxModel","renderElement","useCallback","attributes","blockStyles","useStyle","margin","quoteStyles","padding","fontSize","fontWeight","borderLeft","Text","cx","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","renderLeaf","initialValue","BuilderEditMode","CONTENT","deselect","setEditor","setDefaultValue","handleFocus","select","handleKeyDown","isHotkey","HistoryEditor","redo","undo","blur","switchToBuildMode","forEach","onKeyDown","handleKeyUp","preventDefault","handleClick","stopPropagation","handleBlur","relatedTarget","getAttribute","handleOnChange","value","onChange","Slate","Editable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUO,6BAA6BA,QAAgBC,WAAsC;AACxFC,4BAAAA,0BAA0B,MAAM;AAC1B,QAAA,CAACD,UAAUE,WAAWH,OAAOI,aAAa,QAAQC,WAAAA,YAAYC,UAAUN,MAAtB;AAA+B;AACjF,QAAA;AACIO,YAAAA,OAAOF,WAAAA,YAAYG,yBAAyBR,MAArC;AACPS,YAAAA,eAAeF,KAAKG;AAC1B,YAAMC,cAA4BN,WAAAA,YAAYO,WAAWZ,QAAQA,OAAOI,SAAtC;AAElC,UAAIO,aAAa;AACXE,YAAAA,YAAWC,WAAWd,OAAOI,SAA7B,GAA0C;AAC9BW,uDAAAA,iBACZJ,YAAYK,cACZL,YAAYM,WACZN,YAAYO,gBACZP,YAAYQ;AAAAA,QAJd,OAMK;AACSJ,uDAAAA,iBACZJ,YAAYO,gBACZP,YAAYQ,aACZR,YAAYK,cACZL,YA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