@makeswift/runtime 0.7.16 → 0.7.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Box.cjs.js +1 -1
- package/dist/Box.es.js +1 -1
- package/dist/Button.cjs.js +2 -2
- package/dist/Button.es.js +2 -2
- package/dist/Carousel.cjs.js +3 -3
- package/dist/Carousel.es.js +3 -3
- package/dist/Countdown.cjs.js +3 -3
- package/dist/Countdown.es.js +3 -3
- package/dist/Divider.cjs.js +3 -3
- package/dist/Divider.es.js +3 -3
- package/dist/Embed.cjs.js +3 -3
- package/dist/Embed.es.js +3 -3
- package/dist/Form.cjs.js +1 -1
- package/dist/Form.es.js +1 -1
- package/dist/Image.cjs.js +3 -3
- package/dist/Image.es.js +3 -3
- package/dist/LiveProvider.cjs.js +3 -3
- package/dist/LiveProvider.es.js +4 -4
- package/dist/Navigation.cjs.js +3 -3
- package/dist/Navigation.es.js +3 -3
- package/dist/PreviewProvider.cjs.js +8 -8
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +2 -2
- package/dist/ReadOnlyText.cjs.js +55 -55
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +3 -3
- package/dist/Root.cjs.js +3 -3
- package/dist/Root.es.js +3 -3
- package/dist/SocialLinks.cjs.js +2 -2
- package/dist/SocialLinks.es.js +2 -2
- package/dist/Text.cjs.js +4 -4
- package/dist/Text.es.js +4 -4
- package/dist/Video.cjs.js +3 -3
- package/dist/Video.es.js +3 -3
- package/dist/builder.cjs.js +2 -2
- package/dist/builder.es.js +2 -2
- package/dist/components.cjs.js +1 -1
- package/dist/components.es.js +1 -1
- package/dist/constants.cjs.js +14 -14
- package/dist/constants.cjs.js.map +1 -1
- package/dist/constants.es.js +1 -1
- package/dist/control-serialization.cjs.js +41 -41
- package/dist/control-serialization.cjs.js.map +1 -1
- package/dist/control-serialization.es.js +1 -1
- package/dist/controls.cjs.js +46 -44
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +2 -2
- package/dist/{rich-text.cjs.js → descriptors.cjs.js} +476 -459
- package/dist/descriptors.cjs.js.map +1 -0
- package/dist/{rich-text.es.js → descriptors.es.js} +467 -452
- package/dist/descriptors.es.js.map +1 -0
- package/dist/index.cjs.js +242 -211
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs2.js +1 -1
- package/dist/index.cjs5.js +568 -37
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs6.js +17 -697
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +327 -0
- package/dist/index.cjs7.js.map +1 -0
- package/dist/index.es.js +46 -15
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js +1 -1
- package/dist/index.es5.js +558 -35
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es6.js +16 -692
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es7.js +320 -0
- package/dist/index.es7.js.map +1 -0
- package/dist/introspection.cjs.js +22 -22
- package/dist/introspection.cjs.js.map +1 -1
- package/dist/introspection.es.js +1 -1
- package/dist/leaf.cjs.js +1 -0
- package/dist/leaf.cjs.js.map +1 -1
- package/dist/leaf.es.js +2 -2
- package/dist/main.cjs.js +1 -1
- package/dist/main.es.js +1 -1
- package/dist/next.cjs.js +3 -3
- package/dist/next.es.js +3 -3
- package/dist/prop-controllers.cjs.js +5 -5
- package/dist/prop-controllers.es.js +2 -2
- package/dist/react.cjs.js +3 -3
- package/dist/react.es.js +3 -3
- package/dist/slate.cjs.js +48 -0
- package/dist/slate.cjs.js.map +1 -0
- package/dist/slate.es.js +39 -0
- package/dist/slate.es.js.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/controls/control.d.ts +3 -2
- package/dist/types/src/controls/control.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/dto-types.d.ts +1 -2
- package/dist/types/src/controls/rich-text/dto-types.d.ts.map +1 -1
- package/dist/types/src/controls/shape.d.ts +1 -1
- package/dist/types/src/controls/shape.d.ts.map +1 -1
- package/dist/types/src/controls/style.d.ts +17 -0
- package/dist/types/src/controls/style.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts +1 -2
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/instances.d.ts +3 -3
- package/dist/types/src/prop-controllers/instances.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts +3 -2
- package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/style.d.ts +2 -2
- package/dist/types/src/runtimes/react/controls/style.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
- package/package.json +5 -4
- package/slate.js +1 -0
- package/dist/rich-text.cjs.js.map +0 -1
- package/dist/rich-text.es.js.map +0 -1
package/dist/index.cjs6.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs6.js","sources":["../src/components/builtin/Text/components/Element/block.tsx","../src/components/builtin/Text/components/Element/inline.tsx","../src/components/builtin/Text/components/Element/element.tsx","../src/components/builtin/Text/EditableText/useSyncWithBuilder.tsx","../src/slate/ListPlugin/constants.ts","../src/slate/utils/element.ts","../src/slate/utils/editor.ts","../src/slate/ListPlugin/utils/filterForSubtreeRoots.ts","../src/slate/ListPlugin/utils/location.ts","../src/slate/ListPlugin/utils/getSelectedListItems.ts","../src/slate/ListPlugin/indent.ts","../src/slate/ListPlugin/dedent.ts","../src/slate/ListPlugin/unwrapList.ts","../src/slate/ListPlugin/wrapList.ts","../src/slate/ListPlugin/toggleList.ts","../src/slate/ListPlugin/index.ts","../src/slate/TypographyPlugin/index.ts","../src/slate/BlockPlugin/index.ts","../src/components/builtin/Text/EditableText/editable-text.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { RenderElementProps } from 'slate-react'\nimport { Block, BlockType } from '../../../../../controls'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { responsiveStyle } from '../../../../utils/responsive-style'\n\nexport interface InlineRenderElementProps extends RenderElementProps {\n element: Block\n}\n\nexport function BlockElement({ element, attributes, children }: InlineRenderElementProps) {\n const blockStyles = [\n useStyle({ margin: 0 }),\n useStyle(responsiveStyle([element.textAlign], ([textAlign = 'left']) => ({ textAlign }))),\n ]\n\n switch (element.type) {\n case BlockType.Paragraph:\n return (\n <p {...attributes} className={cx(...blockStyles)}>\n {children}\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote\n {...attributes}\n className={cx(\n ...blockStyles,\n useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n }),\n )}\n >\n {children}\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol {...attributes} className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n {children}\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul {...attributes} className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n {children}\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li {...attributes} className={cx(...blockStyles)}>\n {children}\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span {...attributes} className={cx(...blockStyles)}>\n {children}\n </span>\n )\n }\n}\n","import { cx } from '@emotion/css'\nimport { ComponentPropsWithoutRef } from 'react'\nimport { RenderElementProps } from 'slate-react'\nimport { Inline, InlineType } from '../../../../../controls'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { Link } from '../../../../shared/Link'\n\nfunction StyledLink({ className, ...restOfProps }: ComponentPropsWithoutRef<typeof Link>) {\n return <Link {...restOfProps} className={cx(useStyle({ textDecoration: 'none' }), className)} />\n}\n\nexport interface InlineRenderElementProps extends RenderElementProps {\n element: Inline\n}\n\nexport function InlineElement({ element, attributes, children }: InlineRenderElementProps) {\n switch (element.type) {\n case InlineType.Code:\n return <code {...attributes}>{children}</code>\n case InlineType.SuperScript:\n return <sup {...attributes}>{children}</sup>\n case InlineType.SubScript:\n return <sub {...attributes}>{children}</sub>\n case InlineType.Link:\n return (\n <StyledLink {...attributes} link={element.link}>\n {children}\n </StyledLink>\n )\n }\n}\n","import { RenderElementProps } from 'slate-react'\nimport { BlockType, InlineType } from '../../../../../controls'\nimport { BlockElement } from './block'\nimport { InlineElement } from './inline'\n\nexport function Element({ element, ...props }: RenderElementProps) {\n switch (element.type) {\n case InlineType.Code:\n case InlineType.SuperScript:\n case InlineType.SubScript:\n case InlineType.Link:\n return <InlineElement element={element} {...props} />\n case BlockType.Paragraph:\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement element={element} {...props} />\n default:\n return <span {...props.attributes}>{props.children}</span>\n }\n}\n","import { useState, useEffect, useCallback } from 'react'\nimport { Editor } from 'slate'\nimport { richTextDTOtoDAO, richTextDTOtoSelection } from '../../../../controls'\nimport { RichTextValue } from '../../../../prop-controllers'\nimport deepEqual from '../../../../utils/deepEqual'\n\nconst COMMIT_DEBOUNCE_DELAY = 500\n\n/**\n * Compare new prop value with current editor and update editor\n * if the values are not equal.\n */\nexport function useSyncWithBuilder(editor: Editor, text?: RichTextValue) {\n const [shouldCommit, setShouldCommit] = useState(true)\n\n useEffect(() => {\n if (shouldCommit && text) {\n const nextValue = richTextDTOtoDAO(text)\n const nextSelection = richTextDTOtoSelection(text)\n if (!deepEqual(editor.children, nextValue) || !deepEqual(editor.selection, nextSelection)) {\n editor.children = nextValue\n editor.selection = nextSelection\n editor.onChange()\n }\n }\n }, [editor, shouldCommit, text])\n\n useEffect(() => {\n if (shouldCommit) return\n\n const timeoutId = window.setTimeout(() => {\n setShouldCommit(true)\n }, COMMIT_DEBOUNCE_DELAY)\n\n return () => {\n window.clearTimeout(timeoutId)\n }\n }, [shouldCommit])\n\n return useCallback(() => setShouldCommit(false), [])\n}\n","export const LIST_ITEM_CHILD_POSITION = 0\nexport const LIST_ITEM_LIST_POSITION = 1\n","import { Node, Element } from 'slate'\nimport {\n BlockType,\n Block,\n ParagraphElement,\n OrderedListElement,\n UnorderedListElement,\n ListItemElement,\n ListItemChildElement,\n Inline,\n InlineType,\n} from '../../controls'\n\nexport const ElementUtils = {\n isBlock(node: Node): node is Block {\n return (\n Element.isElement(node) &&\n (Element.isElementType(node, BlockType.Paragraph) ||\n Element.isElementType(node, BlockType.Heading1) ||\n Element.isElementType(node, BlockType.Heading2) ||\n Element.isElementType(node, BlockType.Heading3) ||\n Element.isElementType(node, BlockType.Heading3) ||\n Element.isElementType(node, BlockType.Heading4) ||\n Element.isElementType(node, BlockType.Heading5) ||\n Element.isElementType(node, BlockType.Heading6) ||\n Element.isElementType(node, BlockType.BlockQuote) ||\n Element.isElementType(node, BlockType.UnorderedList) ||\n Element.isElementType(node, BlockType.OrderedList) ||\n Element.isElementType(node, BlockType.ListItem) ||\n Element.isElementType(node, BlockType.ListItemChild))\n )\n },\n isInline(node: Node): node is Inline {\n return (\n Element.isElement(node) &&\n (Element.isElementType(node, InlineType.Link) ||\n Element.isElementType(node, InlineType.Link) ||\n Element.isElementType(node, InlineType.SubScript) ||\n Element.isElementType(node, InlineType.SuperScript))\n )\n },\n isConvertibleToListTextNode(node: Node) {\n return !this.isList(node) && !this.isListItem(node) && !this.isListItemChild(node)\n },\n isParagraph(node: Node): node is ParagraphElement {\n return Element.isElementType(node, BlockType.Paragraph)\n },\n isList(node: Node): node is OrderedListElement | UnorderedListElement {\n return (\n Element.isElementType(node, BlockType.OrderedList) ||\n Element.isElementType(node, BlockType.UnorderedList)\n )\n },\n isListItem(node: Node): node is ListItemElement {\n return Element.isElementType(node, BlockType.ListItem)\n },\n isListItemChild(node: Node): node is ListItemChildElement {\n return Element.isElementType(node, BlockType.ListItemChild)\n },\n createText() {\n return { text: '' }\n },\n createParagraph() {\n return {\n children: [this.createText()],\n type: BlockType.Paragraph,\n }\n },\n createList(type: BlockType = BlockType.UnorderedList): Block {\n return { children: [this.createText()], type }\n },\n createListItem(): Block {\n return {\n children: [this.createListItemChild()],\n type: BlockType.ListItem,\n }\n },\n createListItemChild(): Block {\n return {\n children: [this.createText()],\n type: BlockType.ListItemChild,\n }\n },\n}\n","import { Path, Editor, NodeEntry } from 'slate'\nimport { ListElement, ListItemElement } from '../../controls'\nimport { ElementUtils } from './element'\n\nexport const EditorUtils = {\n getFirstAncestorList(editor: Editor, path: Path): NodeEntry<ListElement> | null {\n const parentList = Editor.above(editor, {\n at: path,\n match: (node): node is ListElement => ElementUtils.isList(node),\n })\n return parentList ?? null\n },\n getFirstAncestorListItem(editor: Editor, path: Path): NodeEntry<ListItemElement> | null {\n const parentListItem = Editor.above(editor, {\n at: path,\n match: (node): node is ListItemElement => ElementUtils.isListItem(node),\n })\n\n return parentListItem ?? null\n },\n}\n","import type { Node, NodeEntry } from 'slate'\nimport { Path } from 'slate'\n\nexport function filterForSubtreeRoots(entries: NodeEntry<Node>[]): NodeEntry<Node>[] {\n return entries.filter(\n ([, nodePath]) =>\n !Path.ancestors(nodePath).some(ancestor => {\n return entries.some(([, path]) => Path.equals(path, ancestor))\n }),\n )\n}\n","import { Range, Point, Path, Location } from 'slate'\n\nexport const LocationUtils = {\n getStartPath(location: Location): Path {\n if (Range.isRange(location)) return Range.start(location).path\n if (Point.isPoint(location)) return location.path\n return location\n },\n}\n","import type { Element, NodeEntry } from 'slate'\nimport { Editor, Path } from 'slate'\nimport { EditorUtils } from '../../utils/editor'\nimport { ElementUtils } from '../../utils/element'\nimport { LocationUtils } from './location'\n\nexport function getSelectedListItems(editor: Editor): NodeEntry<Element>[] {\n if (!editor.selection) return []\n\n const start = LocationUtils.getStartPath(editor.selection)\n const listItems = Editor.nodes(editor, {\n at: editor.selection,\n match: node => ElementUtils.isListItem(node),\n })\n const firstAncestorPath = EditorUtils.getFirstAncestorListItem(editor, start)?.[1] ?? []\n\n return Array.from(listItems).filter((node): node is NodeEntry<Element> =>\n Path.isDescendant(start, node[1])\n ? Path.equals(node[1], firstAncestorPath)\n : !Path.isAfter(start, node[1]),\n )\n}\n\nexport function getSelectedLists(editor: Editor): NodeEntry<Element>[] {\n if (!editor.selection) return []\n\n const start = LocationUtils.getStartPath(editor.selection)\n const lists = Editor.nodes(editor, {\n at: editor.selection,\n match: node => ElementUtils.isList(node),\n })\n const firstAncestorPath = EditorUtils.getFirstAncestorList(editor, start)?.[1] ?? []\n\n return Array.from(lists).filter((node): node is NodeEntry<Element> =>\n Path.isDescendant(start, node[1])\n ? Path.equals(node[1], firstAncestorPath)\n : !Path.isAfter(start, node[1]),\n )\n}\n","import { Editor, Node, Path, Transforms } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { LIST_ITEM_LIST_POSITION } from './constants'\nimport { filterForSubtreeRoots } from './utils/filterForSubtreeRoots'\nimport { getSelectedListItems } from './utils/getSelectedListItems'\n\nexport function indentPath(editor: Editor, path: Path) {\n const parent = Node.parent(editor, path)\n if (!path || !Path.hasPrevious(path) || !ElementUtils.isList(parent)) return\n\n const previosPath = Path.previous(path)\n\n const previousChildListPath = [...previosPath, LIST_ITEM_LIST_POSITION]\n const previousHasChildList = Node.has(editor, previousChildListPath)\n\n Editor.withoutNormalizing(editor, () => {\n if (!previousHasChildList) {\n Transforms.insertNodes(editor, ElementUtils.createList(parent.type), {\n at: previousChildListPath,\n })\n }\n\n const previousChildList = Node.get(editor, previousChildListPath)\n\n if (ElementUtils.isList(previousChildList)) {\n const index = previousHasChildList ? previousChildList.children.length : 0\n Transforms.moveNodes(editor, {\n at: path,\n to: [...previousChildListPath, index],\n })\n }\n })\n}\n\nexport function indent(editor: Editor) {\n if (!editor.selection) return\n\n const listItems = getSelectedListItems(editor)\n const subRoots = filterForSubtreeRoots(listItems)\n const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path))\n\n refs.forEach(ref => {\n if (ref.current) {\n indentPath(editor, ref.current)\n }\n ref.unref()\n })\n}\n","import { Editor, Path, Transforms } from 'slate'\nimport { indentPath } from './indent'\nimport { getSelectedListItems } from './utils/getSelectedListItems'\nimport { filterForSubtreeRoots } from './utils/filterForSubtreeRoots'\nimport { EditorUtils } from '../utils/editor'\n\nfunction dedentPath(editor: Editor, listItemPath: Path) {\n const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath)\n const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath)\n if (!parentList || !listItemContainingParentList) return\n\n const [parentListNode, parentListPath] = parentList\n const [_, listItemContainingParentListPath] = listItemContainingParentList\n\n const listItemPosition = listItemPath[listItemPath.length - 1]\n const previousSiblings = parentListNode.children.slice(0, listItemPosition)\n const nextSiblings = parentListNode.children.slice(listItemPosition + 1)\n\n Editor.withoutNormalizing(editor, () => {\n // put next siblings into list item\n nextSiblings.forEach(() => {\n const nextSiblingPath = [...parentListPath, listItemPosition + 1]\n indentPath(editor, nextSiblingPath)\n })\n // move list item to parent list\n Transforms.moveNodes(editor, {\n at: listItemPath,\n to: Path.next(listItemContainingParentListPath),\n })\n // delete old parent list if there are no other list items\n if (previousSiblings.length === 0) {\n Transforms.removeNodes(editor, { at: parentListPath })\n }\n })\n}\n\nexport function dedent(editor: Editor) {\n if (!editor.selection) return\n\n const listItems = getSelectedListItems(editor)\n const subRoots = filterForSubtreeRoots(listItems)\n const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path))\n\n refs.forEach(ref => {\n if (ref.current) {\n dedentPath(editor, ref.current)\n }\n ref.unref()\n })\n}\n","import { Editor, Transforms, Path, Node } from 'slate'\nimport { BlockType } from '../../controls'\nimport { EditorUtils } from '../utils/editor'\nimport { LIST_ITEM_CHILD_POSITION, LIST_ITEM_LIST_POSITION } from './constants'\nimport { filterForSubtreeRoots } from './utils/filterForSubtreeRoots'\nimport { getSelectedListItems } from './utils/getSelectedListItems'\n\nexport function unwrapPath(editor: Editor, listItemPath: Path) {\n const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath)\n const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath)\n //if this is a nested item we don't want to unwrap it\n if (!parentList || listItemContainingParentList) return\n\n Editor.withoutNormalizing(editor, () => {\n const listItemTextPath = [...listItemPath, LIST_ITEM_CHILD_POSITION]\n const listItemNestedListPath = [...listItemPath, LIST_ITEM_LIST_POSITION]\n\n if (Node.has(editor, listItemNestedListPath)) {\n Transforms.setNodes(editor, { type: parentList[0].type }, { at: listItemNestedListPath })\n Transforms.liftNodes(editor, { at: listItemNestedListPath })\n Transforms.liftNodes(editor, { at: Path.next(listItemPath) })\n }\n\n if (Node.has(editor, listItemTextPath)) {\n Transforms.setNodes(\n editor,\n { type: BlockType.Paragraph },\n {\n at: listItemTextPath,\n },\n )\n Transforms.liftNodes(editor, { at: listItemTextPath })\n Transforms.liftNodes(editor, { at: listItemPath })\n }\n })\n}\n\nexport function unwrapList(editor: Editor) {\n if (!editor.selection) return\n\n const listItems = getSelectedListItems(editor)\n const subRoots = filterForSubtreeRoots(listItems)\n const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path))\n\n refs.forEach(ref => {\n if (ref.current) {\n unwrapPath(editor, ref.current)\n }\n ref.unref()\n })\n}\n","import { Editor, Element, Transforms } from 'slate'\nimport { BlockType } from '../../controls'\nimport { ElementUtils } from '../utils/element'\n\ntype WrapListOptions = {\n type: typeof BlockType.UnorderedList | typeof BlockType.OrderedList\n}\n\nexport function wrapList(\n editor: Editor,\n options: WrapListOptions = { type: BlockType.UnorderedList },\n) {\n if (!editor.selection) return\n\n const nonListEntries = Array.from(\n Editor.nodes(editor, {\n at: editor.selection,\n match: node => {\n return Element.isElement(node) && ElementUtils.isConvertibleToListTextNode(node)\n },\n }),\n )\n\n const refs = nonListEntries.map(([_, path]) => Editor.pathRef(editor, path))\n\n refs.forEach(ref => {\n const path = ref.current\n if (path) {\n Editor.withoutNormalizing(editor, () => {\n Transforms.setNodes(\n editor,\n { type: BlockType.ListItemChild },\n {\n at: path,\n },\n )\n Transforms.wrapNodes(editor, ElementUtils.createListItem(), {\n at: path,\n })\n Transforms.wrapNodes(editor, ElementUtils.createList(options.type), {\n at: path,\n })\n })\n }\n ref.unref()\n })\n}\n","import { Editor, Node, Path, Transforms } from 'slate'\nimport { BlockType } from '../../controls'\nimport { ElementUtils } from '../utils/element'\nimport { unwrapList } from './unwrapList'\nimport { LocationUtils } from './utils/location'\nimport { wrapList } from './wrapList'\n\ntype ToggleListOptions = {\n type: typeof BlockType.UnorderedList | typeof BlockType.OrderedList\n}\n\nexport function toggleList(\n editor: Editor,\n options: ToggleListOptions = { type: BlockType.UnorderedList },\n) {\n if (!editor.selection) return\n const start = LocationUtils.getStartPath(editor.selection)\n const ancestorPath = Path.ancestors(start).at(1)\n if (!ancestorPath || !Node.has(editor, ancestorPath)) return\n const ancestor = Node.get(editor, ancestorPath)\n\n if (!ElementUtils.isList(ancestor)) {\n return wrapList(editor, { type: options.type })\n }\n\n if (ancestor.type === options.type) {\n unwrapList(editor)\n } else {\n Transforms.setNodes(editor, { type: options.type }, { at: ancestorPath })\n }\n}\n","import type { KeyboardEvent } from 'react'\nimport { Editor, Transforms, Range, Node, PathRef, Text } from 'slate'\nimport isHotkey from 'is-hotkey'\nimport { LIST_ITEM_CHILD_POSITION } from './constants'\nimport { EditorUtils } from '../utils/editor'\nimport { ElementUtils } from '../utils/element'\nimport { dedent } from './dedent'\nimport { indent } from './indent'\nimport { toggleList } from './toggleList'\nimport { unwrapList } from './unwrapList'\nimport { wrapList } from './wrapList'\nimport { BlockType } from '../../controls'\n\nexport const List = {\n unwrapList,\n wrapList,\n indent,\n dedent,\n toggleList,\n}\n\nexport function onKeyDown(e: KeyboardEvent, editor: Editor) {\n if (\n !editor.selection ||\n Array.from(Editor.nodes(editor, { match: node => ElementUtils.isListItem(node) })).length === 0\n )\n return\n\n if (isHotkey('shift+tab', e)) {\n e.preventDefault()\n List.dedent(editor)\n }\n\n if (isHotkey('tab', e)) {\n e.preventDefault()\n List.indent(editor)\n }\n\n if (isHotkey('backspace', e)) {\n if (!editor.selection) return\n if (Range.isExpanded(editor.selection)) return\n const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path)\n if (editor.selection.anchor.offset === 0 && listItem) {\n e.preventDefault()\n const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1])\n const list = EditorUtils.getFirstAncestorList(editor, listItem[1])\n\n if (parentListItem) {\n List.dedent(editor)\n } else if (list) {\n List.unwrapList(editor)\n }\n return\n }\n }\n\n if (isHotkey('enter', e)) {\n e.preventDefault()\n\n if (!editor.selection) return\n\n if (Range.isExpanded(editor.selection)) {\n Transforms.delete(editor)\n return\n }\n\n const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path)\n if (\n editor.selection.anchor.offset === 0 &&\n listItem &&\n Editor.string(editor, listItem[1]) === ''\n ) {\n const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1])\n\n if (parentListItem) {\n List.dedent(editor)\n } else {\n List.unwrapList(editor)\n }\n return\n }\n\n Transforms.splitNodes(editor, {\n at: editor.selection,\n always: true,\n match: node => ElementUtils.isListItem(node),\n })\n }\n\n if (isHotkey('shift+enter', e)) {\n e.preventDefault()\n editor.insertText('\\n')\n }\n}\n\nexport function withList(editor: Editor) {\n const { normalizeNode } = editor\n editor.normalizeNode = entry => {\n const [normalizationNode, normalizationPath] = entry\n\n // Normalization for converting children of list items to list item children\n // In the case of backspace from position 0 of node into a list this converts the node into a list item.\n if (ElementUtils.isListItem(normalizationNode)) {\n const pathToListItemText = [...normalizationPath, LIST_ITEM_CHILD_POSITION]\n\n if (Node.has(editor, pathToListItemText)) {\n const nodeInListItemTextPosition = Node.get(editor, pathToListItemText)\n if (ElementUtils.isParagraph(nodeInListItemTextPosition)) {\n Transforms.setNodes(\n editor,\n { type: BlockType.ListItemChild },\n {\n at: pathToListItemText,\n },\n )\n return\n }\n } else {\n Transforms.insertNodes(editor, ElementUtils.createListItem(), {\n at: pathToListItemText,\n })\n return\n }\n }\n\n // Normalization for merging adjacent lists of the same type\n if (!Text.isText(normalizationNode)) {\n const mergeableChildren = Array.from(Node.children(editor, normalizationPath))\n .map((child, index, children) => {\n const potentialNodeToBeMerged = children.at(index + 1)\n if (\n !potentialNodeToBeMerged ||\n !ElementUtils.isList(potentialNodeToBeMerged[0]) ||\n !ElementUtils.isList(child[0]) ||\n potentialNodeToBeMerged[0].type !== child[0].type\n ) {\n return null\n }\n return [\n Editor.pathRef(editor, child[1]),\n Editor.pathRef(editor, potentialNodeToBeMerged[1]),\n ]\n })\n .filter((mergeableNodes): mergeableNodes is PathRef[] => Boolean(mergeableNodes))\n\n if (mergeableChildren.length !== 0) {\n mergeableChildren.reverse().forEach(([nodePathRef, nodeToBeMergedPathRef]) => {\n const nodePath = nodePathRef.current\n const nodeToBeMergedPath = nodeToBeMergedPathRef.current\n if (nodePath == null || nodeToBeMergedPath == null) return\n const nodeChildren = Array.from(Node.children(editor, nodePath))\n const childrenToBeMerged = Array.from(Node.children(editor, nodeToBeMergedPath))\n Editor.withoutNormalizing(editor, () => {\n childrenToBeMerged.forEach(([_, childPath], index) => {\n Transforms.moveNodes(editor, {\n at: childPath,\n to: [...nodePath, nodeChildren.length + index],\n })\n })\n Transforms.removeNodes(editor, { at: nodeToBeMergedPath })\n })\n nodePathRef.unref()\n nodeToBeMergedPathRef.unref()\n })\n return\n }\n }\n\n normalizeNode(entry)\n }\n\n return editor\n}\n","import { Editor, Text, Transforms } from 'slate'\nimport { clearActiveTypographyStyle } from './clearActiveTypographyStyle'\nimport { clearDeviceActiveTypography } from './clearDeviceActiveTypography'\nimport { detachActiveTypography } from './detachActiveTypography'\nimport { setActiveTypographyId } from './setActiveTypographyId'\nimport { setActiveTypographyStyle } from './setActiveTypographyStyle'\n\nexport const Typography = {\n setActiveTypographyId,\n setActiveTypographyStyle,\n clearActiveTypographyStyle,\n clearDeviceActiveTypography,\n detachActiveTypography,\n}\n\nexport function withTypography(editor: Editor) {\n const { normalizeNode } = editor\n editor.normalizeNode = entry => {\n const [normalizationNode, normalizationPath] = entry\n // Normalization typography with empty style and id to be text\n if (\n Text.isText(normalizationNode) &&\n normalizationNode?.typography?.id == null &&\n normalizationNode?.typography?.style.length === 0\n ) {\n Transforms.unsetNodes(editor, 'typography', { at: normalizationPath })\n return\n }\n\n normalizeNode(entry)\n }\n\n return editor\n}\n","import { Editor, Transforms } from 'slate'\nimport { setBlockKeyForDevice } from './setBlockKeyForDevice'\nimport { clearBlockKeyForDevice } from './clearBlockKeyForDevice'\nimport { ElementUtils } from '../utils/element'\n\nexport const Block = {\n setBlockKeyForDevice: setBlockKeyForDevice,\n clearBlockKeyForDevice: clearBlockKeyForDevice,\n}\n\nexport function withBlock(editor: Editor) {\n const { normalizeNode } = editor\n editor.normalizeNode = entry => {\n const [normalizationNode, normalizationPath] = entry\n // Normalization textAlign with empty array of values\n if (ElementUtils.isBlock(normalizationNode) && normalizationNode?.textAlign?.length == 0) {\n Transforms.unsetNodes(editor, 'textAlign', { at: normalizationPath })\n return\n }\n\n normalizeNode(entry)\n }\n\n return editor\n}\n","import {\n forwardRef,\n KeyboardEvent,\n Ref,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n} from 'react'\n\nimport { createEditor } from 'slate'\nimport { Slate, Editable, withReact, ReactEditor } from 'slate-react'\n\nimport { ElementIDValue, RichTextValue } from '../../../../prop-controllers/descriptors'\nimport { cx } from '@emotion/css'\nimport { DescriptorsPropControllers } from '../../../../prop-controllers/instances'\nimport { Descriptors } from '../../../../runtimes/react/controls/rich-text'\nimport { getBox } from '../../../../box-model'\nimport { PropControllersHandle } from '../../../../state/modules/prop-controller-handles'\nimport { BlockType, RichTextDAO, richTextDTOtoDAO } from '../../../../controls'\nimport { Leaf } from '../components/Leaf'\nimport { Element } from '../components/Element'\nimport { useSyncWithBuilder } from './useSyncWithBuilder'\nimport isHotkey from 'is-hotkey'\nimport { useBuilderEditMode } from '../../../../runtimes/react'\nimport { BuilderEditMode } from '../../../../state/modules/builder-edit-mode'\nimport { onKeyDown, withBlock, withList, withTypography } from '../../../../slate'\nimport { pollBoxModel } from '../../../../runtimes/react/poll-box-model'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst defaultText: RichTextDAO = [{ type: BlockType.Paragraph, children: [{ text: '' }] }]\n\nexport const EditableText = forwardRef(function EditableText(\n { id, text, width, margin }: Props,\n ref: Ref<PropControllersHandle<Descriptors>>,\n) {\n const [editor] = useState(() => withBlock(withTypography(withList(withReact(createEditor())))))\n const delaySync = useSyncWithBuilder(editor, text)\n const editMode = useBuilderEditMode()\n\n const [propControllers, setPropControllers] =\n useState<DescriptorsPropControllers<Descriptors> | null>(null)\n const controller = propControllers?.text\n\n useEffect(() => {\n if (controller == null) return\n\n const element = ReactEditor.toDOMNode(editor, editor)\n\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => controller.changeBoxModel(boxModel),\n })\n }, [editor, controller])\n\n useImperativeHandle(\n ref,\n () => ({\n getDomNode() {\n return ReactEditor.toDOMNode(editor, editor)\n },\n getBoxModel() {\n return getBox(ReactEditor.toDOMNode(editor, editor))\n },\n setPropControllers,\n }),\n [editor, setPropControllers],\n )\n\n const initialValue = useMemo(() => (text ? richTextDTOtoDAO(text) : defaultText), [text])\n\n useEffect(() => {\n controller?.setSlateEditor(editor)\n }, [controller, editor])\n\n const handleFocus = useCallback(() => {\n controller?.focus()\n }, [controller])\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (isHotkey('mod+shift+z', e)) return controller?.redo()\n if (isHotkey('mod+z', e)) return controller?.undo()\n if (isHotkey('escape')(e)) return controller?.blur()\n onKeyDown(e, editor)\n },\n [controller, editor],\n )\n\n return (\n <Slate editor={editor} value={initialValue} onChange={delaySync}>\n <Editable\n id={id}\n renderLeaf={Leaf}\n renderElement={Element}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n className={cx(width, margin)}\n readOnly={editMode === BuilderEditMode.INTERACT}\n placeholder=\"Write some text...\"\n />\n </Slate>\n )\n})\n\nexport default EditableText\n"],"names":["element","attributes","children","blockStyles","useStyle","margin","responsiveStyle","textAlign","type","BlockType","Paragraph","cx","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","padding","fontSize","fontWeight","borderLeft","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","className","restOfProps","Link","textDecoration","InlineType","Code","SuperScript","SubScript","link","props","COMMIT_DEBOUNCE_DELAY","editor","text","shouldCommit","setShouldCommit","useState","useEffect","nextValue","richTextDTOtoDAO","nextSelection","richTextDTOtoSelection","deepEqual","selection","onChange","timeoutId","window","setTimeout","clearTimeout","useCallback","Element","Editor","Path","Range","Point","Node","Transforms","isHotkey","Text","defaultText","EditableText","forwardRef","id","width","ref","withBlock","withTypography","withList","withReact","createEditor","delaySync","useSyncWithBuilder","editMode","useBuilderEditMode","propControllers","setPropControllers","controller","ReactEditor","toDOMNode","pollBoxModel","onBoxModelChange","boxModel","changeBoxModel","useImperativeHandle","getDomNode","getBoxModel","getBox","initialValue","useMemo","setSlateEditor","handleFocus","focus","handleKeyDown","e","redo","undo","blur","onKeyDown","Slate","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AAA,EAAZ,GACC,CAACf,UAAD,CAF4B;AAIzBgB,QAAAA,gBAAgB3C,kBACpB,CAAC4C,MAAqB;AAChBpC,QAAAA,kBAAAA,WAAS,eAAeoC,CAAhB;AAAoB,aAAOjB,yCAAYkB;AAC/CrC,QAAAA,kBAAAA,WAAS,SAASoC,CAAV;AAAc,aAAOjB,yCAAYmB;AACzCtC,QAAAA,kBAAAA,WAAS,QAAD,EAAWoC,CAAnB;AAAuB,aAAOjB,yCAAYoB;AAC9CC,cAAUJ,GAAG7D,MAAJ;AAAA,EAAA,GAEX,CAAC4C,YAAY5C,MAAb,CAP+B;AAUjC,wCACGkE,WAAAA,OAAD;AAAA,IAAO;AAAA,IAAgB,OAAOX;AAAAA,IAAc,UAAUjB;AAAAA,IAAtD,yCACG6B,qBAAD;AAAA,MACE;AAAA,MACA,YAAYC,KAAAA;AAAAA,MACZ,eAAelD;AAAAA,MACf,WAAW0C;AAAAA,MACX,SAASF;AAAAA,MACT,WAAWtF,IAAAA,GAAG2D,OAAOjE,MAAR;AAAA,MACb,UAAU0E,aAAa6B,SAAAA,gBAAgBC;AAAAA,MACvC,aAAY;AAAA,IAAA,CARd;AAAA,EAAA,CAFJ;AAcD,CAvEqC;AAyEtC,IAAA,iBAAe1C;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,327 @@
|
|
|
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
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
34
|
+
var React = require("react");
|
|
35
|
+
var slate = require("slate");
|
|
36
|
+
var slateReact = require("slate-react");
|
|
37
|
+
var css = require("@emotion/css");
|
|
38
|
+
var boxModels = require("./box-models.cjs.js");
|
|
39
|
+
var descriptors = require("./descriptors.cjs.js");
|
|
40
|
+
var leaf = require("./leaf.cjs.js");
|
|
41
|
+
var next = require("./index.cjs.js");
|
|
42
|
+
var jsxRuntime = require("react/jsx-runtime");
|
|
43
|
+
var index = require("./index.cjs3.js");
|
|
44
|
+
var isHotkey = require("is-hotkey");
|
|
45
|
+
var index$1 = require("./index.cjs5.js");
|
|
46
|
+
require("css-box-model");
|
|
47
|
+
require("./actions.cjs.js");
|
|
48
|
+
require("./introspection.cjs.js");
|
|
49
|
+
require("use-sync-external-store/shim/with-selector");
|
|
50
|
+
require("next/dynamic");
|
|
51
|
+
require("./constants.cjs.js");
|
|
52
|
+
require("redux");
|
|
53
|
+
require("redux-thunk");
|
|
54
|
+
require("@emotion/serialize");
|
|
55
|
+
require("@emotion/utils");
|
|
56
|
+
require("./text-input.cjs.js");
|
|
57
|
+
require("./combobox.cjs.js");
|
|
58
|
+
require("use-sync-external-store/shim");
|
|
59
|
+
require("./types.cjs.js");
|
|
60
|
+
require("color");
|
|
61
|
+
require("scroll-into-view-if-needed");
|
|
62
|
+
require("react-dom");
|
|
63
|
+
require("html-react-parser");
|
|
64
|
+
require("next/head");
|
|
65
|
+
require("@emotion/server/create-instance");
|
|
66
|
+
require("next/document");
|
|
67
|
+
require("cookie");
|
|
68
|
+
require("cors");
|
|
69
|
+
require("http-proxy");
|
|
70
|
+
require("set-cookie-parser");
|
|
71
|
+
require("uuid");
|
|
72
|
+
require("corporate-ipsum");
|
|
73
|
+
require("next/link");
|
|
74
|
+
function _interopDefaultLegacy(e) {
|
|
75
|
+
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
76
|
+
}
|
|
77
|
+
var isHotkey__default = /* @__PURE__ */ _interopDefaultLegacy(isHotkey);
|
|
78
|
+
function BlockElement({
|
|
79
|
+
element,
|
|
80
|
+
attributes,
|
|
81
|
+
children
|
|
82
|
+
}) {
|
|
83
|
+
const blockStyles = [next.useStyle({
|
|
84
|
+
margin: 0
|
|
85
|
+
}), next.useStyle(next.responsiveStyle([element.textAlign], ([textAlign = "left"]) => ({
|
|
86
|
+
textAlign
|
|
87
|
+
})))];
|
|
88
|
+
switch (element.type) {
|
|
89
|
+
case descriptors.BlockType.Paragraph:
|
|
90
|
+
return /* @__PURE__ */ jsxRuntime.jsx("p", __spreadProps(__spreadValues({}, attributes), {
|
|
91
|
+
className: css.cx(...blockStyles),
|
|
92
|
+
children
|
|
93
|
+
}));
|
|
94
|
+
case descriptors.BlockType.Heading1:
|
|
95
|
+
return /* @__PURE__ */ jsxRuntime.jsx("h1", __spreadProps(__spreadValues({}, attributes), {
|
|
96
|
+
className: css.cx(...blockStyles),
|
|
97
|
+
children
|
|
98
|
+
}));
|
|
99
|
+
case descriptors.BlockType.Heading2:
|
|
100
|
+
return /* @__PURE__ */ jsxRuntime.jsx("h2", __spreadProps(__spreadValues({}, attributes), {
|
|
101
|
+
className: css.cx(...blockStyles),
|
|
102
|
+
children
|
|
103
|
+
}));
|
|
104
|
+
case descriptors.BlockType.Heading3:
|
|
105
|
+
return /* @__PURE__ */ jsxRuntime.jsx("h3", __spreadProps(__spreadValues({}, attributes), {
|
|
106
|
+
className: css.cx(...blockStyles),
|
|
107
|
+
children
|
|
108
|
+
}));
|
|
109
|
+
case descriptors.BlockType.Heading4:
|
|
110
|
+
return /* @__PURE__ */ jsxRuntime.jsx("h4", __spreadProps(__spreadValues({}, attributes), {
|
|
111
|
+
className: css.cx(...blockStyles),
|
|
112
|
+
children
|
|
113
|
+
}));
|
|
114
|
+
case descriptors.BlockType.Heading5:
|
|
115
|
+
return /* @__PURE__ */ jsxRuntime.jsx("h5", __spreadProps(__spreadValues({}, attributes), {
|
|
116
|
+
className: css.cx(...blockStyles),
|
|
117
|
+
children
|
|
118
|
+
}));
|
|
119
|
+
case descriptors.BlockType.Heading6:
|
|
120
|
+
return /* @__PURE__ */ jsxRuntime.jsx("h6", __spreadProps(__spreadValues({}, attributes), {
|
|
121
|
+
className: css.cx(...blockStyles),
|
|
122
|
+
children
|
|
123
|
+
}));
|
|
124
|
+
case descriptors.BlockType.BlockQuote:
|
|
125
|
+
return /* @__PURE__ */ jsxRuntime.jsx("blockquote", __spreadProps(__spreadValues({}, attributes), {
|
|
126
|
+
className: css.cx(...blockStyles, next.useStyle({
|
|
127
|
+
padding: "0.5em 10px",
|
|
128
|
+
fontSize: "1.25em",
|
|
129
|
+
fontWeight: "300",
|
|
130
|
+
borderLeft: "5px solid rgba(0, 0, 0, 0.1)"
|
|
131
|
+
})),
|
|
132
|
+
children
|
|
133
|
+
}));
|
|
134
|
+
case descriptors.BlockType.OrderedList:
|
|
135
|
+
return /* @__PURE__ */ jsxRuntime.jsx("ol", __spreadProps(__spreadValues({}, attributes), {
|
|
136
|
+
className: css.cx(...blockStyles),
|
|
137
|
+
style: {
|
|
138
|
+
listStylePosition: "inside"
|
|
139
|
+
},
|
|
140
|
+
children
|
|
141
|
+
}));
|
|
142
|
+
case descriptors.BlockType.UnorderedList:
|
|
143
|
+
return /* @__PURE__ */ jsxRuntime.jsx("ul", __spreadProps(__spreadValues({}, attributes), {
|
|
144
|
+
className: css.cx(...blockStyles),
|
|
145
|
+
style: {
|
|
146
|
+
listStylePosition: "inside"
|
|
147
|
+
},
|
|
148
|
+
children
|
|
149
|
+
}));
|
|
150
|
+
case descriptors.BlockType.ListItem:
|
|
151
|
+
return /* @__PURE__ */ jsxRuntime.jsx("li", __spreadProps(__spreadValues({}, attributes), {
|
|
152
|
+
className: css.cx(...blockStyles),
|
|
153
|
+
children
|
|
154
|
+
}));
|
|
155
|
+
case descriptors.BlockType.ListItemChild:
|
|
156
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", __spreadProps(__spreadValues({}, attributes), {
|
|
157
|
+
className: css.cx(...blockStyles),
|
|
158
|
+
children
|
|
159
|
+
}));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function StyledLink(_a) {
|
|
163
|
+
var _b = _a, {
|
|
164
|
+
className
|
|
165
|
+
} = _b, restOfProps = __objRest(_b, [
|
|
166
|
+
"className"
|
|
167
|
+
]);
|
|
168
|
+
return /* @__PURE__ */ jsxRuntime.jsx(index.Link, __spreadProps(__spreadValues({}, restOfProps), {
|
|
169
|
+
className: css.cx(next.useStyle({
|
|
170
|
+
textDecoration: "none"
|
|
171
|
+
}), className)
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
function InlineElement({
|
|
175
|
+
element,
|
|
176
|
+
attributes,
|
|
177
|
+
children
|
|
178
|
+
}) {
|
|
179
|
+
switch (element.type) {
|
|
180
|
+
case descriptors.InlineType.Code:
|
|
181
|
+
return /* @__PURE__ */ jsxRuntime.jsx("code", __spreadProps(__spreadValues({}, attributes), {
|
|
182
|
+
children
|
|
183
|
+
}));
|
|
184
|
+
case descriptors.InlineType.SuperScript:
|
|
185
|
+
return /* @__PURE__ */ jsxRuntime.jsx("sup", __spreadProps(__spreadValues({}, attributes), {
|
|
186
|
+
children
|
|
187
|
+
}));
|
|
188
|
+
case descriptors.InlineType.SubScript:
|
|
189
|
+
return /* @__PURE__ */ jsxRuntime.jsx("sub", __spreadProps(__spreadValues({}, attributes), {
|
|
190
|
+
children
|
|
191
|
+
}));
|
|
192
|
+
case descriptors.InlineType.Link:
|
|
193
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledLink, __spreadProps(__spreadValues({}, attributes), {
|
|
194
|
+
link: element.link,
|
|
195
|
+
children
|
|
196
|
+
}));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function Element(_c) {
|
|
200
|
+
var _d = _c, {
|
|
201
|
+
element
|
|
202
|
+
} = _d, props = __objRest(_d, [
|
|
203
|
+
"element"
|
|
204
|
+
]);
|
|
205
|
+
switch (element.type) {
|
|
206
|
+
case descriptors.InlineType.Code:
|
|
207
|
+
case descriptors.InlineType.SuperScript:
|
|
208
|
+
case descriptors.InlineType.SubScript:
|
|
209
|
+
case descriptors.InlineType.Link:
|
|
210
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InlineElement, __spreadValues({
|
|
211
|
+
element
|
|
212
|
+
}, props));
|
|
213
|
+
case descriptors.BlockType.Paragraph:
|
|
214
|
+
case descriptors.BlockType.Heading1:
|
|
215
|
+
case descriptors.BlockType.Heading2:
|
|
216
|
+
case descriptors.BlockType.Heading3:
|
|
217
|
+
case descriptors.BlockType.BlockQuote:
|
|
218
|
+
case descriptors.BlockType.OrderedList:
|
|
219
|
+
case descriptors.BlockType.UnorderedList:
|
|
220
|
+
case descriptors.BlockType.ListItem:
|
|
221
|
+
case descriptors.BlockType.ListItemChild:
|
|
222
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BlockElement, __spreadValues({
|
|
223
|
+
element
|
|
224
|
+
}, props));
|
|
225
|
+
default:
|
|
226
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", __spreadProps(__spreadValues({}, props.attributes), {
|
|
227
|
+
children: props.children
|
|
228
|
+
}));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
const COMMIT_DEBOUNCE_DELAY = 500;
|
|
232
|
+
function useSyncWithBuilder(editor, text) {
|
|
233
|
+
const [shouldCommit, setShouldCommit] = React.useState(true);
|
|
234
|
+
React.useEffect(() => {
|
|
235
|
+
if (shouldCommit && text) {
|
|
236
|
+
const nextValue = descriptors.richTextDTOtoDAO(text);
|
|
237
|
+
const nextSelection = descriptors.richTextDTOtoSelection(text);
|
|
238
|
+
if (!next.deepEqual(editor.children, nextValue) || !next.deepEqual(editor.selection, nextSelection)) {
|
|
239
|
+
editor.children = nextValue;
|
|
240
|
+
editor.selection = nextSelection;
|
|
241
|
+
editor.onChange();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}, [editor, shouldCommit, text]);
|
|
245
|
+
React.useEffect(() => {
|
|
246
|
+
if (shouldCommit)
|
|
247
|
+
return;
|
|
248
|
+
const timeoutId = window.setTimeout(() => {
|
|
249
|
+
setShouldCommit(true);
|
|
250
|
+
}, COMMIT_DEBOUNCE_DELAY);
|
|
251
|
+
return () => {
|
|
252
|
+
window.clearTimeout(timeoutId);
|
|
253
|
+
};
|
|
254
|
+
}, [shouldCommit]);
|
|
255
|
+
return React.useCallback(() => setShouldCommit(false), []);
|
|
256
|
+
}
|
|
257
|
+
const defaultText = [{
|
|
258
|
+
type: descriptors.BlockType.Paragraph,
|
|
259
|
+
children: [{
|
|
260
|
+
text: ""
|
|
261
|
+
}]
|
|
262
|
+
}];
|
|
263
|
+
const EditableText = React.forwardRef(function EditableText2({
|
|
264
|
+
id,
|
|
265
|
+
text,
|
|
266
|
+
width,
|
|
267
|
+
margin
|
|
268
|
+
}, ref) {
|
|
269
|
+
const [editor] = React.useState(() => index$1.withBlock(index$1.withTypography(index$1.withList(slateReact.withReact(slate.createEditor())))));
|
|
270
|
+
const delaySync = useSyncWithBuilder(editor, text);
|
|
271
|
+
const editMode = next.useBuilderEditMode();
|
|
272
|
+
const [propControllers, setPropControllers] = React.useState(null);
|
|
273
|
+
const controller = propControllers == null ? void 0 : propControllers.text;
|
|
274
|
+
React.useEffect(() => {
|
|
275
|
+
if (controller == null)
|
|
276
|
+
return;
|
|
277
|
+
const element = slateReact.ReactEditor.toDOMNode(editor, editor);
|
|
278
|
+
return next.pollBoxModel({
|
|
279
|
+
element,
|
|
280
|
+
onBoxModelChange: (boxModel) => controller.changeBoxModel(boxModel)
|
|
281
|
+
});
|
|
282
|
+
}, [editor, controller]);
|
|
283
|
+
React.useImperativeHandle(ref, () => ({
|
|
284
|
+
getDomNode() {
|
|
285
|
+
return slateReact.ReactEditor.toDOMNode(editor, editor);
|
|
286
|
+
},
|
|
287
|
+
getBoxModel() {
|
|
288
|
+
return boxModels.getBox(slateReact.ReactEditor.toDOMNode(editor, editor));
|
|
289
|
+
},
|
|
290
|
+
setPropControllers
|
|
291
|
+
}), [editor, setPropControllers]);
|
|
292
|
+
const initialValue = React.useMemo(() => text ? descriptors.richTextDTOtoDAO(text) : defaultText, [text]);
|
|
293
|
+
React.useEffect(() => {
|
|
294
|
+
controller == null ? void 0 : controller.setSlateEditor(editor);
|
|
295
|
+
}, [controller, editor]);
|
|
296
|
+
const handleFocus = React.useCallback(() => {
|
|
297
|
+
controller == null ? void 0 : controller.focus();
|
|
298
|
+
}, [controller]);
|
|
299
|
+
const handleKeyDown = React.useCallback((e) => {
|
|
300
|
+
if (isHotkey__default["default"]("mod+shift+z", e))
|
|
301
|
+
return controller == null ? void 0 : controller.redo();
|
|
302
|
+
if (isHotkey__default["default"]("mod+z", e))
|
|
303
|
+
return controller == null ? void 0 : controller.undo();
|
|
304
|
+
if (isHotkey__default["default"]("escape")(e))
|
|
305
|
+
return controller == null ? void 0 : controller.blur();
|
|
306
|
+
index$1.onKeyDown(e, editor);
|
|
307
|
+
}, [controller, editor]);
|
|
308
|
+
return /* @__PURE__ */ jsxRuntime.jsx(slateReact.Slate, {
|
|
309
|
+
editor,
|
|
310
|
+
value: initialValue,
|
|
311
|
+
onChange: delaySync,
|
|
312
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(slateReact.Editable, {
|
|
313
|
+
id,
|
|
314
|
+
renderLeaf: leaf.Leaf,
|
|
315
|
+
renderElement: Element,
|
|
316
|
+
onKeyDown: handleKeyDown,
|
|
317
|
+
onFocus: handleFocus,
|
|
318
|
+
className: css.cx(width, margin),
|
|
319
|
+
readOnly: editMode === descriptors.BuilderEditMode.INTERACT,
|
|
320
|
+
placeholder: "Write some text..."
|
|
321
|
+
})
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
var EditableText$1 = EditableText;
|
|
325
|
+
exports.EditableText = EditableText;
|
|
326
|
+
exports["default"] = EditableText$1;
|
|
327
|
+
//# sourceMappingURL=index.cjs7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs7.js","sources":["../src/components/builtin/Text/components/Element/block.tsx","../src/components/builtin/Text/components/Element/inline.tsx","../src/components/builtin/Text/components/Element/element.tsx","../src/components/builtin/Text/EditableText/useSyncWithBuilder.tsx","../src/components/builtin/Text/EditableText/editable-text.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { RenderElementProps } from 'slate-react'\nimport { Block, BlockType } from '../../../../../controls'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { responsiveStyle } from '../../../../utils/responsive-style'\n\nexport interface InlineRenderElementProps extends RenderElementProps {\n element: Block\n}\n\nexport function BlockElement({ element, attributes, children }: InlineRenderElementProps) {\n const blockStyles = [\n useStyle({ margin: 0 }),\n useStyle(responsiveStyle([element.textAlign], ([textAlign = 'left']) => ({ textAlign }))),\n ]\n\n switch (element.type) {\n case BlockType.Paragraph:\n return (\n <p {...attributes} className={cx(...blockStyles)}>\n {children}\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote\n {...attributes}\n className={cx(\n ...blockStyles,\n useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n }),\n )}\n >\n {children}\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol {...attributes} className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n {children}\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul {...attributes} className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n {children}\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li {...attributes} className={cx(...blockStyles)}>\n {children}\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span {...attributes} className={cx(...blockStyles)}>\n {children}\n </span>\n )\n }\n}\n","import { cx } from '@emotion/css'\nimport { ComponentPropsWithoutRef } from 'react'\nimport { RenderElementProps } from 'slate-react'\nimport { Inline, InlineType } from '../../../../../controls'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { Link } from '../../../../shared/Link'\n\nfunction StyledLink({ className, ...restOfProps }: ComponentPropsWithoutRef<typeof Link>) {\n return <Link {...restOfProps} className={cx(useStyle({ textDecoration: 'none' }), className)} />\n}\n\nexport interface InlineRenderElementProps extends RenderElementProps {\n element: Inline\n}\n\nexport function InlineElement({ element, attributes, children }: InlineRenderElementProps) {\n switch (element.type) {\n case InlineType.Code:\n return <code {...attributes}>{children}</code>\n case InlineType.SuperScript:\n return <sup {...attributes}>{children}</sup>\n case InlineType.SubScript:\n return <sub {...attributes}>{children}</sub>\n case InlineType.Link:\n return (\n <StyledLink {...attributes} link={element.link}>\n {children}\n </StyledLink>\n )\n }\n}\n","import { RenderElementProps } from 'slate-react'\nimport { BlockType, InlineType } from '../../../../../controls'\nimport { BlockElement } from './block'\nimport { InlineElement } from './inline'\n\nexport function Element({ element, ...props }: RenderElementProps) {\n switch (element.type) {\n case InlineType.Code:\n case InlineType.SuperScript:\n case InlineType.SubScript:\n case InlineType.Link:\n return <InlineElement element={element} {...props} />\n case BlockType.Paragraph:\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement element={element} {...props} />\n default:\n return <span {...props.attributes}>{props.children}</span>\n }\n}\n","import { useState, useEffect, useCallback } from 'react'\nimport { Editor } from 'slate'\nimport { richTextDTOtoDAO, richTextDTOtoSelection } from '../../../../controls'\nimport { RichTextValue } from '../../../../prop-controllers'\nimport deepEqual from '../../../../utils/deepEqual'\n\nconst COMMIT_DEBOUNCE_DELAY = 500\n\n/**\n * Compare new prop value with current editor and update editor\n * if the values are not equal.\n */\nexport function useSyncWithBuilder(editor: Editor, text?: RichTextValue) {\n const [shouldCommit, setShouldCommit] = useState(true)\n\n useEffect(() => {\n if (shouldCommit && text) {\n const nextValue = richTextDTOtoDAO(text)\n const nextSelection = richTextDTOtoSelection(text)\n if (!deepEqual(editor.children, nextValue) || !deepEqual(editor.selection, nextSelection)) {\n editor.children = nextValue\n editor.selection = nextSelection\n editor.onChange()\n }\n }\n }, [editor, shouldCommit, text])\n\n useEffect(() => {\n if (shouldCommit) return\n\n const timeoutId = window.setTimeout(() => {\n setShouldCommit(true)\n }, COMMIT_DEBOUNCE_DELAY)\n\n return () => {\n window.clearTimeout(timeoutId)\n }\n }, [shouldCommit])\n\n return useCallback(() => setShouldCommit(false), [])\n}\n","import {\n forwardRef,\n KeyboardEvent,\n Ref,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n} from 'react'\n\nimport { createEditor } from 'slate'\nimport { Slate, Editable, withReact, ReactEditor } from 'slate-react'\n\nimport { ElementIDValue, RichTextValue } from '../../../../prop-controllers/descriptors'\nimport { cx } from '@emotion/css'\nimport { DescriptorsPropControllers } from '../../../../prop-controllers/instances'\nimport { Descriptors } from '../../../../runtimes/react/controls/rich-text'\nimport { getBox } from '../../../../box-model'\nimport { PropControllersHandle } from '../../../../state/modules/prop-controller-handles'\nimport { BlockType, RichTextDAO, richTextDTOtoDAO } from '../../../../controls'\nimport { Leaf } from '../components/Leaf'\nimport { Element } from '../components/Element'\nimport { useSyncWithBuilder } from './useSyncWithBuilder'\nimport isHotkey from 'is-hotkey'\nimport { useBuilderEditMode } from '../../../../runtimes/react'\nimport { BuilderEditMode } from '../../../../state/modules/builder-edit-mode'\nimport { onKeyDown, withBlock, withList, withTypography } from '../../../../slate'\nimport { pollBoxModel } from '../../../../runtimes/react/poll-box-model'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst defaultText: RichTextDAO = [{ type: BlockType.Paragraph, children: [{ text: '' }] }]\n\nexport const EditableText = forwardRef(function EditableText(\n { id, text, width, margin }: Props,\n ref: Ref<PropControllersHandle<Descriptors>>,\n) {\n const [editor] = useState(() => withBlock(withTypography(withList(withReact(createEditor())))))\n const delaySync = useSyncWithBuilder(editor, text)\n const editMode = useBuilderEditMode()\n\n const [propControllers, setPropControllers] =\n useState<DescriptorsPropControllers<Descriptors> | null>(null)\n const controller = propControllers?.text\n\n useEffect(() => {\n if (controller == null) return\n\n const element = ReactEditor.toDOMNode(editor, editor)\n\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => controller.changeBoxModel(boxModel),\n })\n }, [editor, controller])\n\n useImperativeHandle(\n ref,\n () => ({\n getDomNode() {\n return ReactEditor.toDOMNode(editor, editor)\n },\n getBoxModel() {\n return getBox(ReactEditor.toDOMNode(editor, editor))\n },\n setPropControllers,\n }),\n [editor, setPropControllers],\n )\n\n const initialValue = useMemo(() => (text ? richTextDTOtoDAO(text) : defaultText), [text])\n\n useEffect(() => {\n controller?.setSlateEditor(editor)\n }, [controller, editor])\n\n const handleFocus = useCallback(() => {\n controller?.focus()\n }, [controller])\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (isHotkey('mod+shift+z', e)) return controller?.redo()\n if (isHotkey('mod+z', e)) return controller?.undo()\n if (isHotkey('escape')(e)) return controller?.blur()\n onKeyDown(e, editor)\n },\n [controller, editor],\n )\n\n return (\n <Slate editor={editor} value={initialValue} onChange={delaySync}>\n <Editable\n id={id}\n renderLeaf={Leaf}\n renderElement={Element}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n className={cx(width, margin)}\n readOnly={editMode === BuilderEditMode.INTERACT}\n placeholder=\"Write some text...\"\n />\n </Slate>\n )\n})\n\nexport default EditableText\n"],"names":["element","attributes","children","blockStyles","useStyle","margin","responsiveStyle","textAlign","type","BlockType","Paragraph","cx","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","padding","fontSize","fontWeight","borderLeft","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","className","restOfProps","Link","textDecoration","InlineType","Code","SuperScript","SubScript","link","props","COMMIT_DEBOUNCE_DELAY","editor","text","shouldCommit","setShouldCommit","useState","useEffect","nextValue","richTextDTOtoDAO","nextSelection","richTextDTOtoSelection","deepEqual","selection","onChange","timeoutId","window","setTimeout","clearTimeout","useCallback","defaultText","EditableText","forwardRef","id","width","ref","withBlock","withTypography","withList","withReact","createEditor","delaySync","useSyncWithBuilder","editMode","useBuilderEditMode","propControllers","setPropControllers","controller","ReactEditor","toDOMNode","pollBoxModel","onBoxModelChange","boxModel","changeBoxModel","useImperativeHandle","getDomNode","getBoxModel","getBox","initialValue","useMemo","setSlateEditor","handleFocus","focus","handleKeyDown","e","isHotkey","redo","undo","blur","onKeyDown","Slate","Editable","Leaf","Element","BuilderEditMode","INTERACT"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAU6B,sBAAA;AAAA,EAAEA;AAAAA,EAASC;AAAAA,EAAYC;AAAAA,GAAsC;AAClFC,QAAAA,cAAc,CAClBC,cAAS;AAAA,IAAEC,QAAQ;AAAA,EAAA,CAAX,GACRD,KAAAA,SAASE,KAAgB,gBAAA,CAACN,QAAQO,SAAT,GAAqB,CAAC,CAACA,YAAY,YAAa;AAAA,IAAEA;AAAAA,EAAAA,EAAnD,CAAhB,CAFU;AAKZP,UAAAA,QAAQQ;AAAAA,SACTC,YAAUC,UAAAA;AACb,kFACST;QAAY,WAAWU,IAAAA,GAAG,GAAGR,WAAJ;AAAA,QAC7BD;AAAAA,MAAAA,EAFL;AAAA,SAKGO,YAAUG,UAAAA;AACb,mFACUX;QAAY,WAAWU,IAAAA,GAAG,GAAGR,WAAJ;AAAA,QAC9BD;AAAAA,MAAAA,EAFL;AAAA,SAKGO,YAAUI,UAAAA;AACb,mFACUZ;QAAY,WAAWU,IAAAA,GAAG,GAAGR,WAAJ;AAAA,QAC9BD;AAAAA,MAAAA,EAFL;AAAA,SAKGO,YAAUK,UAAAA;AACb,mFACUb;QAAY,WAAWU,IAAAA,GAAG,GAAGR,WAAJ;AAAA,QAC9BD;AAAAA,MAAAA,EAFL;AAAA,SAKG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AAA,WAAS,SAASD,CAAV;AAAc,aAAOjB,yCAAYoB;AACzCF,QAAAA,kBAAAA,WAAS,QAAD,EAAWD,CAAnB;AAAuB,aAAOjB,yCAAYqB;AAC9CC,sBAAUL,GAAGpD,MAAJ;AAAA,EAAA,GAEX,CAACmC,YAAYnC,MAAb,CAP+B;AAUjC,wCACG0D,WAAAA,OAAD;AAAA,IAAO;AAAA,IAAgB,OAAOZ;AAAAA,IAAc,UAAUjB;AAAAA,IAAtD,yCACG8B,qBAAD;AAAA,MACE;AAAA,MACA,YAAYC,KAAAA;AAAAA,MACZ,eAAeC;AAAAA,MACf,WAAWV;AAAAA,MACX,SAASF;AAAAA,MACT,WAAW7E,IAAAA,GAAGkD,OAAOxD,MAAR;AAAA,MACb,UAAUiE,aAAa+B,YAAAA,gBAAgBC;AAAAA,MACvC,aAAY;AAAA,IAAA,CARd;AAAA,EAAA,CAFJ;AAcD,CAvEqC;AAyEtC,IAAA,iBAAe5C;;;"}
|
package/dist/index.es.js
CHANGED
|
@@ -36,7 +36,7 @@ var __publicField = (obj, key, value) => {
|
|
|
36
36
|
};
|
|
37
37
|
var _c;
|
|
38
38
|
import * as React from "react";
|
|
39
|
-
import { useEffect, createContext, useContext, useState, useMemo, useRef, Children, createElement, forwardRef, memo, useCallback, useImperativeHandle, Component, Suspense } from "react";
|
|
39
|
+
import { useEffect, createContext, useContext, useState, useMemo, useRef, Children, createElement, forwardRef, memo, useId, useCallback, useImperativeHandle, Component, Suspense } from "react";
|
|
40
40
|
import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector";
|
|
41
41
|
import dynamic from "next/dynamic";
|
|
42
42
|
import { g as getPropControllerDescriptors, i as isElementReference, a as createDocumentReference, M as MakeswiftComponentType, b as isPropControllersHandle, d as getComponentPropControllerDescriptors, e as getPropControllers, f as configureStore$1, h as getDocument, j as getElementId, k as getIsPreview, l as getIsInBuilder, m as copyElementTree, n as getReactComponent, o as getBuilderEditMode } from "./constants.es.js";
|
|
@@ -45,7 +45,7 @@ import { cache, cx } from "@emotion/css";
|
|
|
45
45
|
import { serializeStyles } from "@emotion/serialize";
|
|
46
46
|
import { registerStyles, insertStyles } from "@emotion/utils";
|
|
47
47
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
48
|
-
import { S as ShapeControlType, L as ListControlType, T as Types, E as ElementID, B as Backgrounds, W as Width, f as ResponsiveIconRadioGroup, M as Margin, P as Padding, g as Border, h as BorderRadius, i as Shadows, G as GapY, j as GapX, k as ResponsiveSelect, l as ResponsiveNumber, m as Checkbox, n as Grid, o as TextInput, p as Link, q as ResponsiveColor, s as TextStyle, t as Images, N as Number$1, D as Date$1, F as Font, u as ResponsiveLength, v as TextArea, w as Table, x as TableFormFields, y as Image, z as ResponsiveOpacity, A as NavigationLinks, H as SocialLinks, J as RichText, V as Video, K as StyleControlProperty, O as ImageControlValueFormat, Q as RichTextControlType, b as SlotControlType,
|
|
48
|
+
import { S as ShapeControlType, L as ListControlType, T as Types, E as ElementID, B as Backgrounds, W as Width, f as ResponsiveIconRadioGroup, M as Margin, P as Padding, g as Border, h as BorderRadius, i as Shadows, G as GapY, j as GapX, k as ResponsiveSelect, l as ResponsiveNumber, m as Checkbox, n as Grid, o as TextInput, p as Link, q as ResponsiveColor, s as TextStyle, t as Images, N as Number$1, D as Date$1, F as Font, u as ResponsiveLength, v as TextArea, w as Table, x as TableFormFields, y as Image, z as ResponsiveOpacity, A as NavigationLinks, H as SocialLinks, J as RichText, V as Video, K as StyleControlProperty, O as ImageControlValueFormat, Q as StyleControlType, U as RichTextControlType, b as SlotControlType, X as LinkControlType, I as ImageControlType, C as ColorControlType, Y as BorderPropControllerFormat, Z as ShadowsPropControllerFormat, _ as BorderRadiusPropControllerFormat, $ as MarginPropControllerFormat, a0 as PaddingPropControllerFormat, a1 as WidthPropControllerFormat } from "./descriptors.es.js";
|
|
49
49
|
import "slate";
|
|
50
50
|
import { S as SelectControlType, T as TextAreaControlType, a as TextInputControlType, N as NumberControlType, C as CheckboxControlType } from "./text-input.es.js";
|
|
51
51
|
import { C as ComboboxControlType } from "./combobox.es.js";
|
|
@@ -55,9 +55,9 @@ import { b as getElementSwatchIds, c as getFileIds, d as getTypographyIds, e as
|
|
|
55
55
|
import { createStore, applyMiddleware } from "redux";
|
|
56
56
|
import thunk from "redux-thunk";
|
|
57
57
|
import { A as APIResourceType } from "./types.es.js";
|
|
58
|
+
import { g as getBox, i as isMeasurable, m as measure } from "./box-models.es.js";
|
|
58
59
|
import ColorHelper from "color";
|
|
59
60
|
import scrollIntoView from "scroll-into-view-if-needed";
|
|
60
|
-
import { g as getBox, i as isMeasurable, m as measure } from "./box-models.es.js";
|
|
61
61
|
import { findDOMNode } from "react-dom";
|
|
62
62
|
import parse from "html-react-parser";
|
|
63
63
|
import Head from "next/head";
|
|
@@ -968,7 +968,7 @@ function useCachedSite(siteId) {
|
|
|
968
968
|
const site = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
969
969
|
return site;
|
|
970
970
|
}
|
|
971
|
-
const version = "0.7.
|
|
971
|
+
const version = "0.7.18";
|
|
972
972
|
class Makeswift {
|
|
973
973
|
constructor(apiKey, { apiOrigin = "https://api.makeswift.com" } = {}) {
|
|
974
974
|
__publicField(this, "apiKey");
|
|
@@ -3238,9 +3238,31 @@ function useStyleControlCssObject(style, controlDefinition) {
|
|
|
3238
3238
|
return `${fontSize.value}${fontSize.unit}`;
|
|
3239
3239
|
}
|
|
3240
3240
|
}
|
|
3241
|
-
function useFormattedStyle(styleControlData, controlDefinition) {
|
|
3241
|
+
function useFormattedStyle(styleControlData, controlDefinition, control) {
|
|
3242
3242
|
const style = useStyleControlCssObject(styleControlData, controlDefinition);
|
|
3243
|
-
|
|
3243
|
+
const guid = useId().replaceAll(":", "");
|
|
3244
|
+
const styleClassName = useStyle(style);
|
|
3245
|
+
const classNames = `${styleClassName} ${guid}`;
|
|
3246
|
+
useEffect(() => {
|
|
3247
|
+
let currentBoxModel = null;
|
|
3248
|
+
const handleAnimationFrameRequest = () => {
|
|
3249
|
+
if (control == null)
|
|
3250
|
+
return;
|
|
3251
|
+
const element = document.querySelector(`.${guid}`);
|
|
3252
|
+
const measuredBoxModel = element == null ? null : getBox(element);
|
|
3253
|
+
if (!deepEqual(currentBoxModel, measuredBoxModel)) {
|
|
3254
|
+
currentBoxModel = measuredBoxModel;
|
|
3255
|
+
control.changeBoxModel(currentBoxModel);
|
|
3256
|
+
}
|
|
3257
|
+
animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest);
|
|
3258
|
+
};
|
|
3259
|
+
let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest);
|
|
3260
|
+
return () => {
|
|
3261
|
+
cancelAnimationFrame(animationFrameHandle);
|
|
3262
|
+
control == null ? void 0 : control.changeBoxModel(null);
|
|
3263
|
+
};
|
|
3264
|
+
}, [guid, control]);
|
|
3265
|
+
return classNames;
|
|
3244
3266
|
}
|
|
3245
3267
|
function RenderHook({
|
|
3246
3268
|
hook: useHook,
|
|
@@ -3377,7 +3399,7 @@ function ListControlValue({
|
|
|
3377
3399
|
function useNumber(numberControlData, controlDefinition) {
|
|
3378
3400
|
return numberControlData != null ? numberControlData : controlDefinition.config.defaultValue;
|
|
3379
3401
|
}
|
|
3380
|
-
const Text = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.
|
|
3402
|
+
const Text = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es6.js"))));
|
|
3381
3403
|
function useRichText(data, control) {
|
|
3382
3404
|
const textCallbackRef = useCallback((handle) => {
|
|
3383
3405
|
var _a;
|
|
@@ -3664,6 +3686,12 @@ function ControlValue({
|
|
|
3664
3686
|
parameters: [data, control],
|
|
3665
3687
|
children: (value) => children(value)
|
|
3666
3688
|
}, definition.type);
|
|
3689
|
+
case StyleControlType:
|
|
3690
|
+
return /* @__PURE__ */ jsx(RenderHook, {
|
|
3691
|
+
hook: useFormattedStyle,
|
|
3692
|
+
parameters: [data, definition, control],
|
|
3693
|
+
children: (value) => children(value)
|
|
3694
|
+
}, definition.type);
|
|
3667
3695
|
default:
|
|
3668
3696
|
return children(data);
|
|
3669
3697
|
}
|
|
@@ -3703,7 +3731,7 @@ function PropsValue({
|
|
|
3703
3731
|
return getPropControllers(state, documentKey, element.key);
|
|
3704
3732
|
});
|
|
3705
3733
|
return Object.entries(propControllerDescriptorsRef.current).reduceRight((renderFn, [propName, descriptor]) => (propsValue) => {
|
|
3706
|
-
var _a2, _b;
|
|
3734
|
+
var _a2, _b, _c2;
|
|
3707
3735
|
switch (descriptor.type) {
|
|
3708
3736
|
case CheckboxControlType:
|
|
3709
3737
|
case NumberControlType:
|
|
@@ -3724,16 +3752,18 @@ function PropsValue({
|
|
|
3724
3752
|
[propName]: value
|
|
3725
3753
|
}))
|
|
3726
3754
|
});
|
|
3727
|
-
case StyleControlType:
|
|
3755
|
+
case StyleControlType: {
|
|
3756
|
+
const control = (_a2 = propControllers == null ? void 0 : propControllers[propName]) != null ? _a2 : null;
|
|
3728
3757
|
return /* @__PURE__ */ jsx(RenderHook, {
|
|
3729
3758
|
hook: useFormattedStyle,
|
|
3730
|
-
parameters: [props[propName], descriptor],
|
|
3759
|
+
parameters: [props[propName], descriptor, control],
|
|
3731
3760
|
children: (value) => renderFn(__spreadProps(__spreadValues({}, propsValue), {
|
|
3732
3761
|
[propName]: value
|
|
3733
3762
|
}))
|
|
3734
3763
|
}, descriptor.type);
|
|
3735
|
-
|
|
3736
|
-
|
|
3764
|
+
}
|
|
3765
|
+
case RichTextControlType: {
|
|
3766
|
+
const control = (_b = propControllers == null ? void 0 : propControllers[propName]) != null ? _b : null;
|
|
3737
3767
|
return /* @__PURE__ */ jsx(RenderHook, {
|
|
3738
3768
|
hook: useRichText,
|
|
3739
3769
|
parameters: [props[propName], control],
|
|
@@ -3741,11 +3771,12 @@ function PropsValue({
|
|
|
3741
3771
|
[propName]: value
|
|
3742
3772
|
}))
|
|
3743
3773
|
}, descriptor.type);
|
|
3774
|
+
}
|
|
3744
3775
|
case SlotControlType: {
|
|
3745
|
-
const
|
|
3776
|
+
const control = (_c2 = propControllers == null ? void 0 : propControllers[propName]) != null ? _c2 : null;
|
|
3746
3777
|
return /* @__PURE__ */ jsx(RenderHook, {
|
|
3747
3778
|
hook: useSlot,
|
|
3748
|
-
parameters: [props[propName],
|
|
3779
|
+
parameters: [props[propName], control],
|
|
3749
3780
|
children: (value) => renderFn(__spreadProps(__spreadValues({}, propsValue), {
|
|
3750
3781
|
[propName]: value
|
|
3751
3782
|
}))
|
|
@@ -4156,5 +4187,5 @@ const DocumentReference = memo(forwardRef(function DocumentReference2({
|
|
|
4156
4187
|
document: document2
|
|
4157
4188
|
});
|
|
4158
4189
|
}));
|
|
4159
|
-
export { getStaticProps as $, Alignments as A, useFile as B, Contrasts as C, DocumentReference as D, Element$1 as E, DEVICES as F, findDeviceOverride as G, forwardNextDynamicRef as H, useIsPreview as I, useFiles as J, useSwatches as K, usePagePathnameSlice as L, useElementId as M,
|
|
4190
|
+
export { getStaticProps as $, Alignments as A, useFile as B, Contrasts as C, DocumentReference as D, Element$1 as E, DEVICES as F, findDeviceOverride as G, forwardNextDynamicRef as H, useIsPreview as I, useFiles as J, useSwatches as K, usePagePathnameSlice as L, useElementId as M, useTypography as N, shallowMergeFallbacks as O, PageProvider as P, deepEqual as Q, RuntimeProvider as R, Shapes as S, ElementImperativeHandle as T, storeContextDefaultValue as U, StoreContext as V, MakeswiftProvider as W, useBuilderEditMode as X, pollBoxModel as Y, MakeswiftClient as Z, getStaticPaths as _, ReactRuntime as a, getServerSideProps as a0, Page as a1, Makeswift as a2, PreviewModeScript as a3, Document$1 as a4, MakeswiftApiHandler as a5, usePageId as b, DEFAULT_BOX_ANIMATE_TYPE as c, DEFAULT_BOX_ANIMATE_DELAY as d, DEFAULT_BOX_ANIMATE_DURATION as e, DEFAULT_ITEM_ANIMATE_TYPE as f, DEFAULT_ITEM_ANIMATE_DELAY as g, DEFAULT_ITEM_ANIMATE_DURATION as h, DEFAULT_ITEM_STAGGER_DURATION as i, useBorder as j, useBoxShadow as k, useResponsiveColor as l, useMediaQuery as m, Page$1 as n, useStyle as o, responsiveWidth as p, responsiveTextStyle as q, responsiveStyle as r, colorToString as s, Sizes as t, useIsInBuilder as u, useFormContext as v, responsiveGridItem as w, useTable as x, useMakeswiftClient as y, Provider as z };
|
|
4160
4191
|
//# sourceMappingURL=index.es.js.map
|