@makeswift/runtime 0.0.0-20230322192527 → 0.0.0-20230322204534
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/Text.cjs.js +11 -2
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +11 -2
- package/dist/Text.es.js.map +1 -1
- package/dist/compare.cjs.js +4 -0
- package/dist/compare.cjs.js.map +1 -1
- package/dist/compare.es.js +4 -0
- package/dist/compare.es.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/types/src/components/builtin/Text/EditableText/Leaf/typography.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/compare.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/Text.cjs.js
CHANGED
|
@@ -115,7 +115,6 @@ function useEnhancedTypography(value) {
|
|
|
115
115
|
const typography = next.useTypography((_a = value == null ? void 0 : value.id) != null ? _a : null);
|
|
116
116
|
const source = (_b = typography == null ? void 0 : typography.style.filter(isDeviceOverride)) != null ? _b : [];
|
|
117
117
|
const override = (_c = value == null ? void 0 : value.style.filter(isDeviceOverride)) != null ? _c : [];
|
|
118
|
-
console.log(source, override);
|
|
119
118
|
const swatchIds = [...constants.getTypographyStyleSwatchIds(value == null ? void 0 : value.style), ...constants.getTypographyStyleSwatchIds(typography == null ? void 0 : typography.style)];
|
|
120
119
|
const swatches = next.useSwatches(swatchIds).filter(constants.isNonNullable);
|
|
121
120
|
const enhancedSource = source.map(withColor(swatches));
|
|
@@ -778,9 +777,14 @@ const EditableText = React.forwardRef(function EditableText2({
|
|
|
778
777
|
return boxModels.getBox(slateReact.ReactEditor.toDOMNode(editor, editor));
|
|
779
778
|
},
|
|
780
779
|
setPropControllers
|
|
781
|
-
}), [setPropControllers]);
|
|
780
|
+
}), [editor, setPropControllers]);
|
|
782
781
|
const initialValue = React.useMemo(() => text ? richText.richTextDTOtoDAO(text) : defaultText, [text]);
|
|
783
782
|
React.useEffect(() => {
|
|
783
|
+
console.log("initialize setSlateEditor with", {
|
|
784
|
+
propControllers,
|
|
785
|
+
controller,
|
|
786
|
+
editor
|
|
787
|
+
});
|
|
784
788
|
controller == null ? void 0 : controller.setSlateEditor(editor);
|
|
785
789
|
}, [controller, editor]);
|
|
786
790
|
const handleFocus = React.useCallback(() => {
|
|
@@ -795,6 +799,11 @@ const EditableText = React.forwardRef(function EditableText2({
|
|
|
795
799
|
return controller == null ? void 0 : controller.blur();
|
|
796
800
|
onKeyDown(e, editor);
|
|
797
801
|
}, [controller, editor]);
|
|
802
|
+
console.log("render", {
|
|
803
|
+
propControllers,
|
|
804
|
+
controller,
|
|
805
|
+
editor
|
|
806
|
+
});
|
|
798
807
|
return /* @__PURE__ */ jsxRuntime.jsx(slateReact.Slate, {
|
|
799
808
|
editor,
|
|
800
809
|
value: initialValue,
|
package/dist/Text.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.cjs.js","sources":["../src/components/builtin/Text/EditableText/Leaf/typography.tsx","../src/components/builtin/Text/EditableText/Leaf/leaf.tsx","../src/components/builtin/Text/EditableText/Element/block.tsx","../src/components/builtin/Text/EditableText/Element/inline.tsx","../src/components/builtin/Text/EditableText/Element/element.tsx","../src/components/builtin/Text/EditableText/useSyncWithBuilder.tsx","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/element.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/wrapList.ts","../src/components/builtin/Text/EditableText/ListPlugin/constants.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/editor.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/filterForSubtreeRoots.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/location.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/getSelectedListItems.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/unwrapList.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/toggleList.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/indent.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/dedent.ts","../src/components/builtin/Text/EditableText/ListPlugin/ListPlugin.ts","../src/components/builtin/Text/EditableText/editable-text.tsx","../src/components/builtin/Text/Text.tsx"],"sourcesContent":["import { CSSObject } from '@emotion/serialize'\nimport { RenderLeafProps } from 'slate-react'\nimport { Swatch, Typography } from '../../../../../api'\nimport { TypographyText } from '../../../../../controls'\nimport { DeviceOverride, ResponsiveValue } from '../../../../../prop-controllers'\nimport { getTypographyStyleSwatchIds } from '../../../../../prop-controllers/introspection'\nimport { useTypography, useSwatches } from '../../../../../runtimes/react/hooks/makeswift-api'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { colorToString } from '../../../../utils/colorToString'\nimport { findDeviceOverride, shallowMergeFallbacks } from '../../../../utils/devices'\nimport { isNonNullable } from '../../../../utils/isNonNullable'\nimport { responsiveStyle } from '../../../../utils/responsive-style'\nimport { ColorValue } from '../../../../utils/types'\n\nexport type TypographyValue = Typography['style'][number]['value']\n\ntype EnhancedColor = {\n color?: ColorValue\n}\n\ntype EnhancedTypographyValue = Omit<TypographyValue, keyof EnhancedColor> & EnhancedColor\n\nexport type EnhancedTypography = Array<DeviceOverride<EnhancedTypographyValue>>\n\nexport function isDeviceOverride(value: {\n deviceId: string\n value: TypographyValue\n}): value is DeviceOverride<TypographyValue> {\n return value.deviceId === 'desktop' || value.deviceId === 'tablet' || value.deviceId === 'mobile'\n}\n\nconst withColor =\n (swatches: Swatch[]) =>\n (\n deviceRawTypographyValue: DeviceOverride<TypographyValue>,\n ): DeviceOverride<EnhancedTypographyValue> => {\n const { value, deviceId } = deviceRawTypographyValue\n\n if (value.color == null) {\n const { color, ...nextValue } = value\n return {\n deviceId,\n value: nextValue,\n }\n }\n return {\n deviceId,\n value: {\n ...value,\n color: {\n swatch: swatches.find(s => s && s.id === value.color?.swatchId),\n alpha: value.color?.alpha ?? undefined,\n },\n },\n }\n }\n\nconst getDeviceId = ({ deviceId }: DeviceOverride<unknown>) => deviceId\n\nexport default function useEnhancedTypography(value: Typography): EnhancedTypography {\n const typography = useTypography(value?.id ?? null)\n const source = typography?.style.filter(isDeviceOverride) ?? []\n const override = value?.style.filter(isDeviceOverride) ?? []\n\n console.log(source, override)\n\n const swatchIds = [\n ...getTypographyStyleSwatchIds(value?.style),\n ...getTypographyStyleSwatchIds(typography?.style),\n ]\n const swatches = useSwatches(swatchIds).filter(isNonNullable)\n\n const enhancedSource = source.map(withColor(swatches))\n const enhancedOverride = override.map(withColor(swatches))\n\n const devices = [\n ...new Set(enhancedSource.map(getDeviceId).concat(enhancedOverride.map(getDeviceId))),\n ]\n\n return devices\n .map(deviceId => {\n const deviceSource = findDeviceOverride(enhancedSource, deviceId)?.value\n const deviceOverride = findDeviceOverride(enhancedOverride, deviceId)?.value\n\n if (deviceSource && deviceOverride) {\n return {\n deviceId,\n value: { ...deviceSource, ...deviceOverride },\n }\n } else if (deviceOverride) {\n return {\n deviceId,\n value: deviceOverride,\n }\n } else if (deviceSource) {\n return {\n deviceId,\n value: deviceSource,\n }\n }\n return null\n })\n .filter(isNonNullable)\n}\n\nexport function useTypographyClassName(value: EnhancedTypography): string {\n return useStyle(\n responsiveStyle<\n EnhancedTypographyValue,\n [ResponsiveValue<EnhancedTypographyValue> | null | undefined]\n >(\n [value],\n ([value]) => {\n if (value === undefined) return {}\n\n let styles: CSSObject = {}\n if (value.color != null) styles.color = colorToString(value.color)\n if (value.fontFamily != null) styles.fontFamily = value.fontFamily\n if (value.fontSize != null && value.fontSize.value != null && value.fontSize.unit != null)\n styles.fontSize = `${value.fontSize.value}${value.fontSize.unit}`\n if (value.fontWeight != null) styles.fontWeight = value.fontWeight\n if (value.lineHeight != null) styles.lineHeight = value.lineHeight\n if (value.letterSpacing != null) styles.letterSpacing = `${value.letterSpacing / 10}em`\n if (value.uppercase != null)\n styles.textTransform = value.uppercase === true ? 'uppercase' : 'initial'\n if (value.underline != null || value.strikethrough != null)\n styles.textDecoration = [\n Boolean(value.underline) && 'underline',\n Boolean(value.strikethrough) && 'line-through',\n ]\n .filter(Boolean)\n .join(' ')\n if (value.italic != null) styles.fontStyle = value.italic === true ? 'italic' : 'initial'\n\n return styles\n },\n shallowMergeFallbacks,\n ),\n )\n}\n\nexport interface TypographyRenderLeafProps extends RenderLeafProps {\n leaf: TypographyText\n}\n\nexport function TypographyLeaf({ leaf, children, attributes }: TypographyRenderLeafProps) {\n const enhancedTypography = useEnhancedTypography(leaf.typography)\n const typographyClassName = useTypographyClassName(enhancedTypography)\n return (\n <span {...attributes} className={typographyClassName}>\n {children}\n </span>\n )\n}\n","import { RenderLeafProps } from 'slate-react'\nimport { TextType } from '../../../../../controls'\nimport { TypographyLeaf } from './typography'\n\nexport function Leaf({ leaf, ...props }: RenderLeafProps) {\n switch (leaf.type) {\n case TextType.Typography:\n return <TypographyLeaf leaf={leaf} {...props} />\n\n default:\n return <span {...props.attributes}>{props.children}</span>\n }\n}\n","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\n {...attributes}\n className={cx(...blockStyles, `${element.type}`)}\n style={{ listStylePosition: 'inside' }}\n >\n {children}\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul\n {...attributes}\n className={cx(...blockStyles, `${element.type}`)}\n style={{ listStylePosition: 'inside' }}\n >\n {children}\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li {...attributes} className={cx(...blockStyles, `${element.type}`)}>\n {children}\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span {...attributes} className={cx(...blockStyles, `${element.type}`)}>\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 {\n compareRichTextDAO,\n compareRichTextSelection,\n richTextDTOtoDAO,\n richTextDTOtoSelection,\n} from '../../../../controls'\nimport { RichTextValue } from '../../../../prop-controllers'\n\nconst COMMIT_DEBOUNCE_DELAY = 500\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 (\n !compareRichTextDAO(editor.children, nextValue) ||\n !compareRichTextSelection(editor.selection, nextSelection)\n ) {\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 { Node, Element, Text } from 'slate'\nimport {\n TextType,\n BlockType,\n Block,\n ParagraphElement,\n OrderedListElement,\n UnorderedListElement,\n ListItemElement,\n ListItemChildElement,\n} from '../../../../../../../controls'\n\nexport const ElementUtils = {\n isConvertibleToListTextNode(node: Node) {\n return (\n !this.isList(node) &&\n !this.isListItem(node) &&\n !this.isListItemChild(node) &&\n !this.isText(node) &&\n !this.isTypography(node)\n )\n },\n isText(node: Node) {\n return Element.isElementType(node, TextType.Text) || Text.isText(node)\n },\n isTypography(node: Node) {\n return Element.isElementType(node, TextType.Typography)\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: '', type: TextType.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, 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","export const LIST_ITEM_CHILD_POSITION = 0\nexport const LIST_ITEM_LIST_POSITION = 1\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 './editor'\nimport { ElementUtils } from './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, Transforms, Path, Node } from 'slate'\nimport { BlockType } from '../../../../../../controls'\nimport { LIST_ITEM_CHILD_POSITION, LIST_ITEM_LIST_POSITION } from '../constants'\nimport { EditorUtils } from './utils/editor'\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, Node, Path, Transforms } from 'slate'\nimport { BlockType } from '../../../../../../controls'\nimport { unwrapList } from './unwrapList'\nimport { ElementUtils } from './utils/element'\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 { Editor, Node, Path, Transforms } from 'slate'\nimport { LIST_ITEM_LIST_POSITION } from '../constants'\nimport { ElementUtils } from './utils/element'\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 \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 type { KeyboardEvent } from 'react'\nimport { Editor, Transforms, Range, Node, PathRef } from 'slate'\nimport isHotkey from 'is-hotkey'\nimport { ElementUtils } from './lib/utils/element'\nimport { unwrapList, wrapList, indent, dedent, toggleList } from './lib'\nimport { EditorUtils } from './lib/utils/editor'\nimport { LIST_ITEM_CHILD_POSITION } from './constants'\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 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 removing stray text elements from lists\n if (ElementUtils.isList(normalizationNode)) {\n Array.from(Node.children(editor, normalizationPath)).forEach(([node, path]) => {\n if (ElementUtils.isText(node)) {\n Transforms.removeNodes(editor, { at: path })\n return\n }\n })\n }\n\n // Normalization for merging adjacent lists of the same type\n if (!ElementUtils.isText(normalizationNode) && !ElementUtils.isTypography(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 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\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, TextType } from '../../../../controls'\nimport { Leaf } from './Leaf'\nimport { Element } from './Element'\nimport { useSyncWithBuilder } from './useSyncWithBuilder'\nimport { onKeyDown, withList } from './ListPlugin'\nimport isHotkey from 'is-hotkey'\nimport { useBuilderEditMode } from '../../../../runtimes/react'\nimport { BuilderEditMode } from '../../../../state/modules/builder-edit-mode'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst defaultText: RichTextDAO = [\n { type: BlockType.Paragraph, children: [{ type: TextType.Text, text: '' }] },\n]\n\nexport const EditableText = forwardRef(function EditableText(\n { id, text, width, margin }: Props,\n ref: Ref<PropControllersHandle<Descriptors>>,\n) {\n const [editor] = useState(() => 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 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 [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 />\n </Slate>\n )\n})\n","import { ForwardedRef, forwardRef } from 'react'\nimport { RichTextValue } from '../../../prop-controllers'\nimport { ElementIDValue } from '../../../prop-controllers/descriptors'\nimport { EditableText } from './EditableText'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst Text = forwardRef(function Text(props: Props, ref: ForwardedRef<any>) {\n return <EditableText {...props} ref={ref} />\n})\n\nexport default Text\n"],"names":["value","deviceId","withColor","swatches","deviceRawTypographyValue","color","nextValue","swatch","find","s","id","swatchId","alpha","undefined","getDeviceId","typography","useTypography","source","style","filter","isDeviceOverride","override","log","swatchIds","getTypographyStyleSwatchIds","useSwatches","isNonNullable","enhancedSource","map","enhancedOverride","devices","Set","concat","deviceSource","findDeviceOverride","deviceOverride","useStyle","responsiveStyle","styles","colorToString","fontFamily","fontSize","unit","fontWeight","lineHeight","letterSpacing","uppercase","textTransform","underline","strikethrough","textDecoration","Boolean","join","italic","fontStyle","shallowMergeFallbacks","leaf","children","attributes","enhancedTypography","useEnhancedTypography","typographyClassName","useTypographyClassName","props","type","TextType","Typography","element","blockStyles","margin","textAlign","BlockType","Paragraph","cx","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","padding","borderLeft","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","className","restOfProps","Link","InlineType","Code","SuperScript","SubScript","link","COMMIT_DEBOUNCE_DELAY","editor","text","shouldCommit","setShouldCommit","useState","useEffect","richTextDTOtoDAO","nextSelection","richTextDTOtoSelection","compareRichTextDAO","compareRichTextSelection","selection","onChange","timeoutId","window","setTimeout","clearTimeout","useCallback","Element","Text","Editor","Transforms","Path","Range","Point","Node","isHotkey","defaultText","EditableText","forwardRef","width","ref","withList","withReact","createEditor","delaySync","useSyncWithBuilder","editMode","useBuilderEditMode","propControllers","setPropControllers","controller","useImperativeHandle","getDomNode","ReactEditor","toDOMNode","getBoxModel","getBox","initialValue","useMemo","setSlateEditor","handleFocus","focus","handleKeyDown","e","redo","undo","blur","onKeyDown","Slate","Editable","Leaf","BuilderEditMode","INTERACT"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,0BAA0BA,OAGY;AAC3C,SAAOA,MAAMC,aAAa,aAAaD,MAAMC,aAAa,YAAYD,MAAMC,aAAa;AAC1F;AAED,MAAMC,YACJ,CAACC,aACD,CACEC,6BAC4C;;AACtC,QAAA;AAAA,IAAEJ;AAAAA,IAAOC;A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AAAA,MACX,SAASF;AAAAA,MACT,WAAW3E,IAAAA,GAAGsD,OAAO1D,MAAR;AAAA,MACb,UAAUiE,aAAayB,SAAAA,gBAAgBC;AAAAA,IAAAA,CAPzC;AAAA,EAAA,CAFJ;AAaD,CA3DqC;AC5BtC,MAAM5C,OAAOU,MAAAA,WAAW,eAAc/D,OAAciE,KAAwB;AACnE,wCAAC,cAAD,iCAAkBjE,QAAlB;AAAA,IAAyB;AAAA,EAAA,EAAhC;AACD,CAFsB;;"}
|
|
1
|
+
{"version":3,"file":"Text.cjs.js","sources":["../src/components/builtin/Text/EditableText/Leaf/typography.tsx","../src/components/builtin/Text/EditableText/Leaf/leaf.tsx","../src/components/builtin/Text/EditableText/Element/block.tsx","../src/components/builtin/Text/EditableText/Element/inline.tsx","../src/components/builtin/Text/EditableText/Element/element.tsx","../src/components/builtin/Text/EditableText/useSyncWithBuilder.tsx","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/element.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/wrapList.ts","../src/components/builtin/Text/EditableText/ListPlugin/constants.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/editor.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/filterForSubtreeRoots.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/location.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/getSelectedListItems.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/unwrapList.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/toggleList.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/indent.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/dedent.ts","../src/components/builtin/Text/EditableText/ListPlugin/ListPlugin.ts","../src/components/builtin/Text/EditableText/editable-text.tsx","../src/components/builtin/Text/Text.tsx"],"sourcesContent":["import { CSSObject } from '@emotion/serialize'\nimport { RenderLeafProps } from 'slate-react'\nimport { Swatch, Typography } from '../../../../../api'\nimport { TypographyText } from '../../../../../controls'\nimport { DeviceOverride, ResponsiveValue } from '../../../../../prop-controllers'\nimport { getTypographyStyleSwatchIds } from '../../../../../prop-controllers/introspection'\nimport { useTypography, useSwatches } from '../../../../../runtimes/react/hooks/makeswift-api'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { colorToString } from '../../../../utils/colorToString'\nimport { findDeviceOverride, shallowMergeFallbacks } from '../../../../utils/devices'\nimport { isNonNullable } from '../../../../utils/isNonNullable'\nimport { responsiveStyle } from '../../../../utils/responsive-style'\nimport { ColorValue } from '../../../../utils/types'\n\nexport type TypographyValue = Typography['style'][number]['value']\n\ntype EnhancedColor = {\n color?: ColorValue\n}\n\ntype EnhancedTypographyValue = Omit<TypographyValue, keyof EnhancedColor> & EnhancedColor\n\nexport type EnhancedTypography = Array<DeviceOverride<EnhancedTypographyValue>>\n\nexport function isDeviceOverride(value: {\n deviceId: string\n value: TypographyValue\n}): value is DeviceOverride<TypographyValue> {\n return value.deviceId === 'desktop' || value.deviceId === 'tablet' || value.deviceId === 'mobile'\n}\n\nconst withColor =\n (swatches: Swatch[]) =>\n (\n deviceRawTypographyValue: DeviceOverride<TypographyValue>,\n ): DeviceOverride<EnhancedTypographyValue> => {\n const { value, deviceId } = deviceRawTypographyValue\n\n if (value.color == null) {\n const { color, ...nextValue } = value\n return {\n deviceId,\n value: nextValue,\n }\n }\n return {\n deviceId,\n value: {\n ...value,\n color: {\n swatch: swatches.find(s => s && s.id === value.color?.swatchId),\n alpha: value.color?.alpha ?? undefined,\n },\n },\n }\n }\n\nconst getDeviceId = ({ deviceId }: DeviceOverride<unknown>) => deviceId\n\nexport default function useEnhancedTypography(value: Typography): EnhancedTypography {\n const typography = useTypography(value?.id ?? null)\n const source = typography?.style.filter(isDeviceOverride) ?? []\n const override = value?.style.filter(isDeviceOverride) ?? []\n\n const swatchIds = [\n ...getTypographyStyleSwatchIds(value?.style),\n ...getTypographyStyleSwatchIds(typography?.style),\n ]\n const swatches = useSwatches(swatchIds).filter(isNonNullable)\n\n const enhancedSource = source.map(withColor(swatches))\n const enhancedOverride = override.map(withColor(swatches))\n\n const devices = [\n ...new Set(enhancedSource.map(getDeviceId).concat(enhancedOverride.map(getDeviceId))),\n ]\n\n return devices\n .map(deviceId => {\n const deviceSource = findDeviceOverride(enhancedSource, deviceId)?.value\n const deviceOverride = findDeviceOverride(enhancedOverride, deviceId)?.value\n\n if (deviceSource && deviceOverride) {\n return {\n deviceId,\n value: { ...deviceSource, ...deviceOverride },\n }\n } else if (deviceOverride) {\n return {\n deviceId,\n value: deviceOverride,\n }\n } else if (deviceSource) {\n return {\n deviceId,\n value: deviceSource,\n }\n }\n return null\n })\n .filter(isNonNullable)\n}\n\nexport function useTypographyClassName(value: EnhancedTypography): string {\n return useStyle(\n responsiveStyle<\n EnhancedTypographyValue,\n [ResponsiveValue<EnhancedTypographyValue> | null | undefined]\n >(\n [value],\n ([value]) => {\n if (value === undefined) return {}\n\n let styles: CSSObject = {}\n if (value.color != null) styles.color = colorToString(value.color)\n if (value.fontFamily != null) styles.fontFamily = value.fontFamily\n if (value.fontSize != null && value.fontSize.value != null && value.fontSize.unit != null)\n styles.fontSize = `${value.fontSize.value}${value.fontSize.unit}`\n if (value.fontWeight != null) styles.fontWeight = value.fontWeight\n if (value.lineHeight != null) styles.lineHeight = value.lineHeight\n if (value.letterSpacing != null) styles.letterSpacing = `${value.letterSpacing / 10}em`\n if (value.uppercase != null)\n styles.textTransform = value.uppercase === true ? 'uppercase' : 'initial'\n if (value.underline != null || value.strikethrough != null)\n styles.textDecoration = [\n Boolean(value.underline) && 'underline',\n Boolean(value.strikethrough) && 'line-through',\n ]\n .filter(Boolean)\n .join(' ')\n if (value.italic != null) styles.fontStyle = value.italic === true ? 'italic' : 'initial'\n\n return styles\n },\n shallowMergeFallbacks,\n ),\n )\n}\n\nexport interface TypographyRenderLeafProps extends RenderLeafProps {\n leaf: TypographyText\n}\n\nexport function TypographyLeaf({ leaf, children, attributes }: TypographyRenderLeafProps) {\n const enhancedTypography = useEnhancedTypography(leaf.typography)\n const typographyClassName = useTypographyClassName(enhancedTypography)\n return (\n <span {...attributes} className={typographyClassName}>\n {children}\n </span>\n )\n}\n","import { RenderLeafProps } from 'slate-react'\nimport { TextType } from '../../../../../controls'\nimport { TypographyLeaf } from './typography'\n\nexport function Leaf({ leaf, ...props }: RenderLeafProps) {\n switch (leaf.type) {\n case TextType.Typography:\n return <TypographyLeaf leaf={leaf} {...props} />\n\n default:\n return <span {...props.attributes}>{props.children}</span>\n }\n}\n","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\n {...attributes}\n className={cx(...blockStyles, `${element.type}`)}\n style={{ listStylePosition: 'inside' }}\n >\n {children}\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul\n {...attributes}\n className={cx(...blockStyles, `${element.type}`)}\n style={{ listStylePosition: 'inside' }}\n >\n {children}\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li {...attributes} className={cx(...blockStyles, `${element.type}`)}>\n {children}\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span {...attributes} className={cx(...blockStyles, `${element.type}`)}>\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 {\n compareRichTextDAO,\n compareRichTextSelection,\n richTextDTOtoDAO,\n richTextDTOtoSelection,\n} from '../../../../controls'\nimport { RichTextValue } from '../../../../prop-controllers'\n\nconst COMMIT_DEBOUNCE_DELAY = 500\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 (\n !compareRichTextDAO(editor.children, nextValue) ||\n !compareRichTextSelection(editor.selection, nextSelection)\n ) {\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 { Node, Element, Text } from 'slate'\nimport {\n TextType,\n BlockType,\n Block,\n ParagraphElement,\n OrderedListElement,\n UnorderedListElement,\n ListItemElement,\n ListItemChildElement,\n} from '../../../../../../../controls'\n\nexport const ElementUtils = {\n isConvertibleToListTextNode(node: Node) {\n return (\n !this.isList(node) &&\n !this.isListItem(node) &&\n !this.isListItemChild(node) &&\n !this.isText(node) &&\n !this.isTypography(node)\n )\n },\n isText(node: Node) {\n return Element.isElementType(node, TextType.Text) || Text.isText(node)\n },\n isTypography(node: Node) {\n return Element.isElementType(node, TextType.Typography)\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: '', type: TextType.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, 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","export const LIST_ITEM_CHILD_POSITION = 0\nexport const LIST_ITEM_LIST_POSITION = 1\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 './editor'\nimport { ElementUtils } from './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, Transforms, Path, Node } from 'slate'\nimport { BlockType } from '../../../../../../controls'\nimport { LIST_ITEM_CHILD_POSITION, LIST_ITEM_LIST_POSITION } from '../constants'\nimport { EditorUtils } from './utils/editor'\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, Node, Path, Transforms } from 'slate'\nimport { BlockType } from '../../../../../../controls'\nimport { unwrapList } from './unwrapList'\nimport { ElementUtils } from './utils/element'\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 { Editor, Node, Path, Transforms } from 'slate'\nimport { LIST_ITEM_LIST_POSITION } from '../constants'\nimport { ElementUtils } from './utils/element'\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 \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 type { KeyboardEvent } from 'react'\nimport { Editor, Transforms, Range, Node, PathRef } from 'slate'\nimport isHotkey from 'is-hotkey'\nimport { ElementUtils } from './lib/utils/element'\nimport { unwrapList, wrapList, indent, dedent, toggleList } from './lib'\nimport { EditorUtils } from './lib/utils/editor'\nimport { LIST_ITEM_CHILD_POSITION } from './constants'\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 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 removing stray text elements from lists\n if (ElementUtils.isList(normalizationNode)) {\n Array.from(Node.children(editor, normalizationPath)).forEach(([node, path]) => {\n if (ElementUtils.isText(node)) {\n Transforms.removeNodes(editor, { at: path })\n return\n }\n })\n }\n\n // Normalization for merging adjacent lists of the same type\n if (!ElementUtils.isText(normalizationNode) && !ElementUtils.isTypography(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 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\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, TextType } from '../../../../controls'\nimport { Leaf } from './Leaf'\nimport { Element } from './Element'\nimport { useSyncWithBuilder } from './useSyncWithBuilder'\nimport { onKeyDown, withList } from './ListPlugin'\nimport isHotkey from 'is-hotkey'\nimport { useBuilderEditMode } from '../../../../runtimes/react'\nimport { BuilderEditMode } from '../../../../state/modules/builder-edit-mode'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst defaultText: RichTextDAO = [\n { type: BlockType.Paragraph, children: [{ type: TextType.Text, text: '' }] },\n]\n\nexport const EditableText = forwardRef(function EditableText(\n { id, text, width, margin }: Props,\n ref: Ref<PropControllersHandle<Descriptors>>,\n) {\n const [editor] = useState(() => 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 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 console.log('initialize setSlateEditor with', { propControllers, controller, editor })\n\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 console.log('render', { propControllers, controller, editor })\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 />\n </Slate>\n )\n})\n","import { ForwardedRef, forwardRef } from 'react'\nimport { RichTextValue } from '../../../prop-controllers'\nimport { ElementIDValue } from '../../../prop-controllers/descriptors'\nimport { EditableText } from './EditableText'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst Text = forwardRef(function Text(props: Props, ref: ForwardedRef<any>) {\n return <EditableText {...props} ref={ref} />\n})\n\nexport default Text\n"],"names":["value","deviceId","withColor","swatches","deviceRawTypographyValue","color","nextValue","swatch","find","s","id","swatchId","alpha","undefined","getDeviceId","typography","useTypography","source","style","filter","isDeviceOverride","override","swatchIds","getTypographyStyleSwatchIds","useSwatches","isNonNullable","enhancedSource","map","enhancedOverride","devices","Set","concat","deviceSource","findDeviceOverride","deviceOverride","useStyle","responsiveStyle","styles","colorToString","fontFamily","fontSize","unit","fontWeight","lineHeight","letterSpacing","uppercase","textTransform","underline","strikethrough","textDecoration","Boolean","join","italic","fontStyle","shallowMergeFallbacks","leaf","children","attributes","enhancedTypography","useEnhancedTypography","typographyClassName","useTypographyClassName","props","type","TextType","Typography","element","blockStyles","margin","textAlign","BlockType","Paragraph","cx","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","padding","borderLeft","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","className","restOfProps","Link","InlineType","Code","SuperScript","SubScript","link","COMMIT_DEBOUNCE_DELAY","editor","text","shouldCommit","setShouldCommit","useState","useEffect","richTextDTOtoDAO","nextSelection","richTextDTOtoSelection","compareRichTextDAO","compareRichTextSelection","selection","onChange","timeoutId","window","setTimeout","clearTimeout","useCallback","Element","Text","Editor","Transforms","Path","Range","Point","Node","isHotkey","defaultText","EditableText","forwardRef","width","ref","withList","withReact","createEditor","delaySync","useSyncWithBuilder","editMode","useBuilderEditMode","propControllers","setPropControllers","controller","useImperativeHandle","getDomNode","ReactEditor","toDOMNode","getBoxModel","getBox","initialValue","useMemo","console","log","setSlateEditor","handleFocus","focus","handleKeyDown","e","redo","undo","blur","onKeyDown","Slate","Editable","Leaf","BuilderEditMode","INTERACT"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,0BAA0BA,OAGY;AAC3C,SAAOA,MAAMC,aAAa,aAAaD,MAAMC,aAAa,YAAYD,MAAMC,aAAa;AAC1F;AAED,MAAMC,YACJ,CAACC,aACD,CACEC,6BAC4C;;AACtC,QAAA;AAAA,IAAEJ;AAAAA,IAAOC;AAAAA,MAAaG;AAExBJ,MAAAA,MAAMK,SAAS,MAAM;AACjB,UAA0BL,YAAxBK;AAAAA;AAAAA,QAAwBL,IAAdM,sBAAcN,IAAdM;AAAAA,MAAVD;AAAAA;AACD,WAAA;AAAA,MACLJ;AAAAA,MACAD,OAAOM;AAAAA,IAAAA;AAAAA,EAEV;AACM,SAAA;AAAA,IACLL;AAAAA,IACAD,OAAO,iCAC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2B,SAAAA,gBAAgBC;AAAAA,IAAAA,CAPzC;AAAA,EAAA,CAFJ;AAaD,CA/DqC;AC5BtC,MAAM9C,OAAOU,MAAAA,WAAW,eAAc/D,OAAciE,KAAwB;AACnE,wCAAC,cAAD,iCAAkBjE,QAAlB;AAAA,IAAyB;AAAA,EAAA,EAAhC;AACD,CAFsB;;"}
|
package/dist/Text.es.js
CHANGED
|
@@ -109,7 +109,6 @@ function useEnhancedTypography(value) {
|
|
|
109
109
|
const typography = useTypography((_a = value == null ? void 0 : value.id) != null ? _a : null);
|
|
110
110
|
const source = (_b = typography == null ? void 0 : typography.style.filter(isDeviceOverride)) != null ? _b : [];
|
|
111
111
|
const override = (_c = value == null ? void 0 : value.style.filter(isDeviceOverride)) != null ? _c : [];
|
|
112
|
-
console.log(source, override);
|
|
113
112
|
const swatchIds = [...getTypographyStyleSwatchIds(value == null ? void 0 : value.style), ...getTypographyStyleSwatchIds(typography == null ? void 0 : typography.style)];
|
|
114
113
|
const swatches = useSwatches(swatchIds).filter(isNonNullable);
|
|
115
114
|
const enhancedSource = source.map(withColor(swatches));
|
|
@@ -772,9 +771,14 @@ const EditableText = forwardRef(function EditableText2({
|
|
|
772
771
|
return getBox(ReactEditor.toDOMNode(editor, editor));
|
|
773
772
|
},
|
|
774
773
|
setPropControllers
|
|
775
|
-
}), [setPropControllers]);
|
|
774
|
+
}), [editor, setPropControllers]);
|
|
776
775
|
const initialValue = useMemo(() => text ? richTextDTOtoDAO(text) : defaultText, [text]);
|
|
777
776
|
useEffect(() => {
|
|
777
|
+
console.log("initialize setSlateEditor with", {
|
|
778
|
+
propControllers,
|
|
779
|
+
controller,
|
|
780
|
+
editor
|
|
781
|
+
});
|
|
778
782
|
controller == null ? void 0 : controller.setSlateEditor(editor);
|
|
779
783
|
}, [controller, editor]);
|
|
780
784
|
const handleFocus = useCallback(() => {
|
|
@@ -789,6 +793,11 @@ const EditableText = forwardRef(function EditableText2({
|
|
|
789
793
|
return controller == null ? void 0 : controller.blur();
|
|
790
794
|
onKeyDown(e, editor);
|
|
791
795
|
}, [controller, editor]);
|
|
796
|
+
console.log("render", {
|
|
797
|
+
propControllers,
|
|
798
|
+
controller,
|
|
799
|
+
editor
|
|
800
|
+
});
|
|
792
801
|
return /* @__PURE__ */ jsx(Slate, {
|
|
793
802
|
editor,
|
|
794
803
|
value: initialValue,
|
package/dist/Text.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.es.js","sources":["../src/components/builtin/Text/EditableText/Leaf/typography.tsx","../src/components/builtin/Text/EditableText/Leaf/leaf.tsx","../src/components/builtin/Text/EditableText/Element/block.tsx","../src/components/builtin/Text/EditableText/Element/inline.tsx","../src/components/builtin/Text/EditableText/Element/element.tsx","../src/components/builtin/Text/EditableText/useSyncWithBuilder.tsx","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/element.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/wrapList.ts","../src/components/builtin/Text/EditableText/ListPlugin/constants.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/editor.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/filterForSubtreeRoots.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/location.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/getSelectedListItems.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/unwrapList.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/toggleList.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/indent.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/dedent.ts","../src/components/builtin/Text/EditableText/ListPlugin/ListPlugin.ts","../src/components/builtin/Text/EditableText/editable-text.tsx","../src/components/builtin/Text/Text.tsx"],"sourcesContent":["import { CSSObject } from '@emotion/serialize'\nimport { RenderLeafProps } from 'slate-react'\nimport { Swatch, Typography } from '../../../../../api'\nimport { TypographyText } from '../../../../../controls'\nimport { DeviceOverride, ResponsiveValue } from '../../../../../prop-controllers'\nimport { getTypographyStyleSwatchIds } from '../../../../../prop-controllers/introspection'\nimport { useTypography, useSwatches } from '../../../../../runtimes/react/hooks/makeswift-api'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { colorToString } from '../../../../utils/colorToString'\nimport { findDeviceOverride, shallowMergeFallbacks } from '../../../../utils/devices'\nimport { isNonNullable } from '../../../../utils/isNonNullable'\nimport { responsiveStyle } from '../../../../utils/responsive-style'\nimport { ColorValue } from '../../../../utils/types'\n\nexport type TypographyValue = Typography['style'][number]['value']\n\ntype EnhancedColor = {\n color?: ColorValue\n}\n\ntype EnhancedTypographyValue = Omit<TypographyValue, keyof EnhancedColor> & EnhancedColor\n\nexport type EnhancedTypography = Array<DeviceOverride<EnhancedTypographyValue>>\n\nexport function isDeviceOverride(value: {\n deviceId: string\n value: TypographyValue\n}): value is DeviceOverride<TypographyValue> {\n return value.deviceId === 'desktop' || value.deviceId === 'tablet' || value.deviceId === 'mobile'\n}\n\nconst withColor =\n (swatches: Swatch[]) =>\n (\n deviceRawTypographyValue: DeviceOverride<TypographyValue>,\n ): DeviceOverride<EnhancedTypographyValue> => {\n const { value, deviceId } = deviceRawTypographyValue\n\n if (value.color == null) {\n const { color, ...nextValue } = value\n return {\n deviceId,\n value: nextValue,\n }\n }\n return {\n deviceId,\n value: {\n ...value,\n color: {\n swatch: swatches.find(s => s && s.id === value.color?.swatchId),\n alpha: value.color?.alpha ?? undefined,\n },\n },\n }\n }\n\nconst getDeviceId = ({ deviceId }: DeviceOverride<unknown>) => deviceId\n\nexport default function useEnhancedTypography(value: Typography): EnhancedTypography {\n const typography = useTypography(value?.id ?? null)\n const source = typography?.style.filter(isDeviceOverride) ?? []\n const override = value?.style.filter(isDeviceOverride) ?? []\n\n console.log(source, override)\n\n const swatchIds = [\n ...getTypographyStyleSwatchIds(value?.style),\n ...getTypographyStyleSwatchIds(typography?.style),\n ]\n const swatches = useSwatches(swatchIds).filter(isNonNullable)\n\n const enhancedSource = source.map(withColor(swatches))\n const enhancedOverride = override.map(withColor(swatches))\n\n const devices = [\n ...new Set(enhancedSource.map(getDeviceId).concat(enhancedOverride.map(getDeviceId))),\n ]\n\n return devices\n .map(deviceId => {\n const deviceSource = findDeviceOverride(enhancedSource, deviceId)?.value\n const deviceOverride = findDeviceOverride(enhancedOverride, deviceId)?.value\n\n if (deviceSource && deviceOverride) {\n return {\n deviceId,\n value: { ...deviceSource, ...deviceOverride },\n }\n } else if (deviceOverride) {\n return {\n deviceId,\n value: deviceOverride,\n }\n } else if (deviceSource) {\n return {\n deviceId,\n value: deviceSource,\n }\n }\n return null\n })\n .filter(isNonNullable)\n}\n\nexport function useTypographyClassName(value: EnhancedTypography): string {\n return useStyle(\n responsiveStyle<\n EnhancedTypographyValue,\n [ResponsiveValue<EnhancedTypographyValue> | null | undefined]\n >(\n [value],\n ([value]) => {\n if (value === undefined) return {}\n\n let styles: CSSObject = {}\n if (value.color != null) styles.color = colorToString(value.color)\n if (value.fontFamily != null) styles.fontFamily = value.fontFamily\n if (value.fontSize != null && value.fontSize.value != null && value.fontSize.unit != null)\n styles.fontSize = `${value.fontSize.value}${value.fontSize.unit}`\n if (value.fontWeight != null) styles.fontWeight = value.fontWeight\n if (value.lineHeight != null) styles.lineHeight = value.lineHeight\n if (value.letterSpacing != null) styles.letterSpacing = `${value.letterSpacing / 10}em`\n if (value.uppercase != null)\n styles.textTransform = value.uppercase === true ? 'uppercase' : 'initial'\n if (value.underline != null || value.strikethrough != null)\n styles.textDecoration = [\n Boolean(value.underline) && 'underline',\n Boolean(value.strikethrough) && 'line-through',\n ]\n .filter(Boolean)\n .join(' ')\n if (value.italic != null) styles.fontStyle = value.italic === true ? 'italic' : 'initial'\n\n return styles\n },\n shallowMergeFallbacks,\n ),\n )\n}\n\nexport interface TypographyRenderLeafProps extends RenderLeafProps {\n leaf: TypographyText\n}\n\nexport function TypographyLeaf({ leaf, children, attributes }: TypographyRenderLeafProps) {\n const enhancedTypography = useEnhancedTypography(leaf.typography)\n const typographyClassName = useTypographyClassName(enhancedTypography)\n return (\n <span {...attributes} className={typographyClassName}>\n {children}\n </span>\n )\n}\n","import { RenderLeafProps } from 'slate-react'\nimport { TextType } from '../../../../../controls'\nimport { TypographyLeaf } from './typography'\n\nexport function Leaf({ leaf, ...props }: RenderLeafProps) {\n switch (leaf.type) {\n case TextType.Typography:\n return <TypographyLeaf leaf={leaf} {...props} />\n\n default:\n return <span {...props.attributes}>{props.children}</span>\n }\n}\n","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\n {...attributes}\n className={cx(...blockStyles, `${element.type}`)}\n style={{ listStylePosition: 'inside' }}\n >\n {children}\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul\n {...attributes}\n className={cx(...blockStyles, `${element.type}`)}\n style={{ listStylePosition: 'inside' }}\n >\n {children}\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li {...attributes} className={cx(...blockStyles, `${element.type}`)}>\n {children}\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span {...attributes} className={cx(...blockStyles, `${element.type}`)}>\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 {\n compareRichTextDAO,\n compareRichTextSelection,\n richTextDTOtoDAO,\n richTextDTOtoSelection,\n} from '../../../../controls'\nimport { RichTextValue } from '../../../../prop-controllers'\n\nconst COMMIT_DEBOUNCE_DELAY = 500\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 (\n !compareRichTextDAO(editor.children, nextValue) ||\n !compareRichTextSelection(editor.selection, nextSelection)\n ) {\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 { Node, Element, Text } from 'slate'\nimport {\n TextType,\n BlockType,\n Block,\n ParagraphElement,\n OrderedListElement,\n UnorderedListElement,\n ListItemElement,\n ListItemChildElement,\n} from '../../../../../../../controls'\n\nexport const ElementUtils = {\n isConvertibleToListTextNode(node: Node) {\n return (\n !this.isList(node) &&\n !this.isListItem(node) &&\n !this.isListItemChild(node) &&\n !this.isText(node) &&\n !this.isTypography(node)\n )\n },\n isText(node: Node) {\n return Element.isElementType(node, TextType.Text) || Text.isText(node)\n },\n isTypography(node: Node) {\n return Element.isElementType(node, TextType.Typography)\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: '', type: TextType.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, 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","export const LIST_ITEM_CHILD_POSITION = 0\nexport const LIST_ITEM_LIST_POSITION = 1\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 './editor'\nimport { ElementUtils } from './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, Transforms, Path, Node } from 'slate'\nimport { BlockType } from '../../../../../../controls'\nimport { LIST_ITEM_CHILD_POSITION, LIST_ITEM_LIST_POSITION } from '../constants'\nimport { EditorUtils } from './utils/editor'\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, Node, Path, Transforms } from 'slate'\nimport { BlockType } from '../../../../../../controls'\nimport { unwrapList } from './unwrapList'\nimport { ElementUtils } from './utils/element'\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 { Editor, Node, Path, Transforms } from 'slate'\nimport { LIST_ITEM_LIST_POSITION } from '../constants'\nimport { ElementUtils } from './utils/element'\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 \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 type { KeyboardEvent } from 'react'\nimport { Editor, Transforms, Range, Node, PathRef } from 'slate'\nimport isHotkey from 'is-hotkey'\nimport { ElementUtils } from './lib/utils/element'\nimport { unwrapList, wrapList, indent, dedent, toggleList } from './lib'\nimport { EditorUtils } from './lib/utils/editor'\nimport { LIST_ITEM_CHILD_POSITION } from './constants'\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 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 removing stray text elements from lists\n if (ElementUtils.isList(normalizationNode)) {\n Array.from(Node.children(editor, normalizationPath)).forEach(([node, path]) => {\n if (ElementUtils.isText(node)) {\n Transforms.removeNodes(editor, { at: path })\n return\n }\n })\n }\n\n // Normalization for merging adjacent lists of the same type\n if (!ElementUtils.isText(normalizationNode) && !ElementUtils.isTypography(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 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\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, TextType } from '../../../../controls'\nimport { Leaf } from './Leaf'\nimport { Element } from './Element'\nimport { useSyncWithBuilder } from './useSyncWithBuilder'\nimport { onKeyDown, withList } from './ListPlugin'\nimport isHotkey from 'is-hotkey'\nimport { useBuilderEditMode } from '../../../../runtimes/react'\nimport { BuilderEditMode } from '../../../../state/modules/builder-edit-mode'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst defaultText: RichTextDAO = [\n { type: BlockType.Paragraph, children: [{ type: TextType.Text, text: '' }] },\n]\n\nexport const EditableText = forwardRef(function EditableText(\n { id, text, width, margin }: Props,\n ref: Ref<PropControllersHandle<Descriptors>>,\n) {\n const [editor] = useState(() => 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 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 [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 />\n </Slate>\n )\n})\n","import { ForwardedRef, forwardRef } from 'react'\nimport { RichTextValue } from '../../../prop-controllers'\nimport { ElementIDValue } from '../../../prop-controllers/descriptors'\nimport { EditableText } from './EditableText'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst Text = forwardRef(function Text(props: Props, ref: ForwardedRef<any>) {\n return <EditableText {...props} ref={ref} />\n})\n\nexport default Text\n"],"names":["value","deviceId","withColor","swatches","deviceRawTypographyValue","color","nextValue","swatch","find","s","id","swatchId","alpha","undefined","getDeviceId","typography","useTypography","source","style","filter","isDeviceOverride","override","log","swatchIds","getTypographyStyleSwatchIds","useSwatches","isNonNullable","enhancedSource","map","enhancedOverride","devices","Set","concat","deviceSource","findDeviceOverride","deviceOverride","useStyle","responsiveStyle","styles","colorToString","fontFamily","fontSize","unit","fontWeight","lineHeight","letterSpacing","uppercase","textTransform","underline","strikethrough","textDecoration","Boolean","join","italic","fontStyle","shallowMergeFallbacks","leaf","children","attributes","enhancedTypography","useEnhancedTypography","typographyClassName","useTypographyClassName","props","type","TextType","Typography","element","blockStyles","margin","textAlign","BlockType","Paragraph","cx","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","padding","borderLeft","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","className","restOfProps","InlineType","Code","SuperScript","SubScript","Link","link","COMMIT_DEBOUNCE_DELAY","editor","text","shouldCommit","setShouldCommit","useState","useEffect","richTextDTOtoDAO","nextSelection","richTextDTOtoSelection","compareRichTextDAO","compareRichTextSelection","selection","onChange","timeoutId","window","setTimeout","clearTimeout","useCallback","Element","Text","defaultText","EditableText","forwardRef","width","ref","withList","withReact","createEditor","delaySync","useSyncWithBuilder","editMode","useBuilderEditMode","propControllers","setPropControllers","controller","useImperativeHandle","getDomNode","ReactEditor","toDOMNode","getBoxModel","getBox","initialValue","useMemo","setSlateEditor","handleFocus","focus","handleKeyDown","e","isHotkey","redo","undo","blur","onKeyDown","Leaf","BuilderEditMode","INTERACT"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,0BAA0BA,OAGY;AAC3C,SAAOA,MAAMC,aAAa,aAAaD,MAAMC,aAAa,YAAYD,MAAMC,aAAa;AAC1F;AAED,MAAMC,YACJ,CAACC,aACD,CACEC,6BAC4C;;AACtC,QAAA;AAAA,IAAEJ;AAAAA,IAAOC;AAAAA,MAAaG;AAExBJ,MAAAA,MAAMK,SAAS,MAAM;AACjB,UAA0BL,YAAxBK;AAAAA;AAAAA,QAAwBL,IAAdM,sBAAcN,IAAdM;AAAAA,MAAVD;AAAAA;AACD,WAAA;AAAA,MACLJ;AAAAA,MACAD,OAAOM;AAAAA,IAAAA;AAAAA,EAEV;AACM,SAAA;AAAA,IACLL;AAAAA,IACAD,OAAO,iCACFA,QADE;AAAA,MAELK,OAAO;AAAA,QACLE,QAAQJ,SAASK,KAAKC,CAAAA,MAAKA;;AAAAA,sBAAKA,EAAEC,OAAOV,cAAMK,UAANL,oBAAaW;AAAAA,SAA9C;AAA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src/components/builtin/Text/EditableText/Leaf/leaf.tsx","../src/components/builtin/Text/EditableText/Element/block.tsx","../src/components/builtin/Text/EditableText/Element/inline.tsx","../src/components/builtin/Text/EditableText/Element/element.tsx","../src/components/builtin/Text/EditableText/useSyncWithBuilder.tsx","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/element.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/wrapList.ts","../src/components/builtin/Text/EditableText/ListPlugin/constants.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/editor.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/filterForSubtreeRoots.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/location.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/getSelectedListItems.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/unwrapList.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/toggleList.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/indent.ts","../src/components/builtin/Text/EditableText/ListPlugin/lib/dedent.ts","../src/components/builtin/Text/EditableText/ListPlugin/ListPlugin.ts","../src/components/builtin/Text/EditableText/editable-text.tsx","../src/components/builtin/Text/Text.tsx"],"sourcesContent":["import { CSSObject } from '@emotion/serialize'\nimport { RenderLeafProps } from 'slate-react'\nimport { Swatch, Typography } from '../../../../../api'\nimport { TypographyText } from '../../../../../controls'\nimport { DeviceOverride, ResponsiveValue } from '../../../../../prop-controllers'\nimport { getTypographyStyleSwatchIds } from '../../../../../prop-controllers/introspection'\nimport { useTypography, useSwatches } from '../../../../../runtimes/react/hooks/makeswift-api'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { colorToString } from '../../../../utils/colorToString'\nimport { findDeviceOverride, shallowMergeFallbacks } from '../../../../utils/devices'\nimport { isNonNullable } from '../../../../utils/isNonNullable'\nimport { responsiveStyle } from '../../../../utils/responsive-style'\nimport { ColorValue } from '../../../../utils/types'\n\nexport type TypographyValue = Typography['style'][number]['value']\n\ntype EnhancedColor = {\n color?: ColorValue\n}\n\ntype EnhancedTypographyValue = Omit<TypographyValue, keyof EnhancedColor> & EnhancedColor\n\nexport type EnhancedTypography = Array<DeviceOverride<EnhancedTypographyValue>>\n\nexport function isDeviceOverride(value: {\n deviceId: string\n value: TypographyValue\n}): value is DeviceOverride<TypographyValue> {\n return value.deviceId === 'desktop' || value.deviceId === 'tablet' || value.deviceId === 'mobile'\n}\n\nconst withColor =\n (swatches: Swatch[]) =>\n (\n deviceRawTypographyValue: DeviceOverride<TypographyValue>,\n ): DeviceOverride<EnhancedTypographyValue> => {\n const { value, deviceId } = deviceRawTypographyValue\n\n if (value.color == null) {\n const { color, ...nextValue } = value\n return {\n deviceId,\n value: nextValue,\n }\n }\n return {\n deviceId,\n value: {\n ...value,\n color: {\n swatch: swatches.find(s => s && s.id === value.color?.swatchId),\n alpha: value.color?.alpha ?? undefined,\n },\n },\n }\n }\n\nconst getDeviceId = ({ deviceId }: DeviceOverride<unknown>) => deviceId\n\nexport default function useEnhancedTypography(value: Typography): EnhancedTypography {\n const typography = useTypography(value?.id ?? null)\n const source = typography?.style.filter(isDeviceOverride) ?? []\n const override = value?.style.filter(isDeviceOverride) ?? []\n\n const swatchIds = [\n ...getTypographyStyleSwatchIds(value?.style),\n ...getTypographyStyleSwatchIds(typography?.style),\n ]\n const swatches = useSwatches(swatchIds).filter(isNonNullable)\n\n const enhancedSource = source.map(withColor(swatches))\n const enhancedOverride = override.map(withColor(swatches))\n\n const devices = [\n ...new Set(enhancedSource.map(getDeviceId).concat(enhancedOverride.map(getDeviceId))),\n ]\n\n return devices\n .map(deviceId => {\n const deviceSource = findDeviceOverride(enhancedSource, deviceId)?.value\n const deviceOverride = findDeviceOverride(enhancedOverride, deviceId)?.value\n\n if (deviceSource && deviceOverride) {\n return {\n deviceId,\n value: { ...deviceSource, ...deviceOverride },\n }\n } else if (deviceOverride) {\n return {\n deviceId,\n value: deviceOverride,\n }\n } else if (deviceSource) {\n return {\n deviceId,\n value: deviceSource,\n }\n }\n return null\n })\n .filter(isNonNullable)\n}\n\nexport function useTypographyClassName(value: EnhancedTypography): string {\n return useStyle(\n responsiveStyle<\n EnhancedTypographyValue,\n [ResponsiveValue<EnhancedTypographyValue> | null | undefined]\n >(\n [value],\n ([value]) => {\n if (value === undefined) return {}\n\n let styles: CSSObject = {}\n if (value.color != null) styles.color = colorToString(value.color)\n if (value.fontFamily != null) styles.fontFamily = value.fontFamily\n if (value.fontSize != null && value.fontSize.value != null && value.fontSize.unit != null)\n styles.fontSize = `${value.fontSize.value}${value.fontSize.unit}`\n if (value.fontWeight != null) styles.fontWeight = value.fontWeight\n if (value.lineHeight != null) styles.lineHeight = value.lineHeight\n if (value.letterSpacing != null) styles.letterSpacing = `${value.letterSpacing / 10}em`\n if (value.uppercase != null)\n styles.textTransform = value.uppercase === true ? 'uppercase' : 'initial'\n if (value.underline != null || value.strikethrough != null)\n styles.textDecoration = [\n Boolean(value.underline) && 'underline',\n Boolean(value.strikethrough) && 'line-through',\n ]\n .filter(Boolean)\n .join(' ')\n if (value.italic != null) styles.fontStyle = value.italic === true ? 'italic' : 'initial'\n\n return styles\n },\n shallowMergeFallbacks,\n ),\n )\n}\n\nexport interface TypographyRenderLeafProps extends RenderLeafProps {\n leaf: TypographyText\n}\n\nexport function TypographyLeaf({ leaf, children, attributes }: TypographyRenderLeafProps) {\n const enhancedTypography = useEnhancedTypography(leaf.typography)\n const typographyClassName = useTypographyClassName(enhancedTypography)\n return (\n <span {...attributes} className={typographyClassName}>\n {children}\n </span>\n )\n}\n","import { RenderLeafProps } from 'slate-react'\nimport { TextType } from '../../../../../controls'\nimport { TypographyLeaf } from './typography'\n\nexport function Leaf({ leaf, ...props }: RenderLeafProps) {\n switch (leaf.type) {\n case TextType.Typography:\n return <TypographyLeaf leaf={leaf} {...props} />\n\n default:\n return <span {...props.attributes}>{props.children}</span>\n }\n}\n","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\n {...attributes}\n className={cx(...blockStyles, `${element.type}`)}\n style={{ listStylePosition: 'inside' }}\n >\n {children}\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul\n {...attributes}\n className={cx(...blockStyles, `${element.type}`)}\n style={{ listStylePosition: 'inside' }}\n >\n {children}\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li {...attributes} className={cx(...blockStyles, `${element.type}`)}>\n {children}\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span {...attributes} className={cx(...blockStyles, `${element.type}`)}>\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 {\n compareRichTextDAO,\n compareRichTextSelection,\n richTextDTOtoDAO,\n richTextDTOtoSelection,\n} from '../../../../controls'\nimport { RichTextValue } from '../../../../prop-controllers'\n\nconst COMMIT_DEBOUNCE_DELAY = 500\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 (\n !compareRichTextDAO(editor.children, nextValue) ||\n !compareRichTextSelection(editor.selection, nextSelection)\n ) {\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 { Node, Element, Text } from 'slate'\nimport {\n TextType,\n BlockType,\n Block,\n ParagraphElement,\n OrderedListElement,\n UnorderedListElement,\n ListItemElement,\n ListItemChildElement,\n} from '../../../../../../../controls'\n\nexport const ElementUtils = {\n isConvertibleToListTextNode(node: Node) {\n return (\n !this.isList(node) &&\n !this.isListItem(node) &&\n !this.isListItemChild(node) &&\n !this.isText(node) &&\n !this.isTypography(node)\n )\n },\n isText(node: Node) {\n return Element.isElementType(node, TextType.Text) || Text.isText(node)\n },\n isTypography(node: Node) {\n return Element.isElementType(node, TextType.Typography)\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: '', type: TextType.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, 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","export const LIST_ITEM_CHILD_POSITION = 0\nexport const LIST_ITEM_LIST_POSITION = 1\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 './editor'\nimport { ElementUtils } from './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, Transforms, Path, Node } from 'slate'\nimport { BlockType } from '../../../../../../controls'\nimport { LIST_ITEM_CHILD_POSITION, LIST_ITEM_LIST_POSITION } from '../constants'\nimport { EditorUtils } from './utils/editor'\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, Node, Path, Transforms } from 'slate'\nimport { BlockType } from '../../../../../../controls'\nimport { unwrapList } from './unwrapList'\nimport { ElementUtils } from './utils/element'\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 { Editor, Node, Path, Transforms } from 'slate'\nimport { LIST_ITEM_LIST_POSITION } from '../constants'\nimport { ElementUtils } from './utils/element'\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 \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 type { KeyboardEvent } from 'react'\nimport { Editor, Transforms, Range, Node, PathRef } from 'slate'\nimport isHotkey from 'is-hotkey'\nimport { ElementUtils } from './lib/utils/element'\nimport { unwrapList, wrapList, indent, dedent, toggleList } from './lib'\nimport { EditorUtils } from './lib/utils/editor'\nimport { LIST_ITEM_CHILD_POSITION } from './constants'\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 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 removing stray text elements from lists\n if (ElementUtils.isList(normalizationNode)) {\n Array.from(Node.children(editor, normalizationPath)).forEach(([node, path]) => {\n if (ElementUtils.isText(node)) {\n Transforms.removeNodes(editor, { at: path })\n return\n }\n })\n }\n\n // Normalization for merging adjacent lists of the same type\n if (!ElementUtils.isText(normalizationNode) && !ElementUtils.isTypography(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 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\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, TextType } from '../../../../controls'\nimport { Leaf } from './Leaf'\nimport { Element } from './Element'\nimport { useSyncWithBuilder } from './useSyncWithBuilder'\nimport { onKeyDown, withList } from './ListPlugin'\nimport isHotkey from 'is-hotkey'\nimport { useBuilderEditMode } from '../../../../runtimes/react'\nimport { BuilderEditMode } from '../../../../state/modules/builder-edit-mode'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst defaultText: RichTextDAO = [\n { type: BlockType.Paragraph, children: [{ type: TextType.Text, text: '' }] },\n]\n\nexport const EditableText = forwardRef(function EditableText(\n { id, text, width, margin }: Props,\n ref: Ref<PropControllersHandle<Descriptors>>,\n) {\n const [editor] = useState(() => 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 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 console.log('initialize setSlateEditor with', { propControllers, controller, editor })\n\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 console.log('render', { propControllers, controller, editor })\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 />\n </Slate>\n )\n})\n","import { ForwardedRef, forwardRef } from 'react'\nimport { RichTextValue } from '../../../prop-controllers'\nimport { ElementIDValue } from '../../../prop-controllers/descriptors'\nimport { EditableText } from './EditableText'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst Text = forwardRef(function Text(props: Props, ref: ForwardedRef<any>) {\n return <EditableText {...props} ref={ref} />\n})\n\nexport default Text\n"],"names":["value","deviceId","withColor","swatches","deviceRawTypographyValue","color","nextValue","swatch","find","s","id","swatchId","alpha","undefined","getDeviceId","typography","useTypography","source","style","filter","isDeviceOverride","override","swatchIds","getTypographyStyleSwatchIds","useSwatches","isNonNullable","enhancedSource","map","enhancedOverride","devices","Set","concat","deviceSource","findDeviceOverride","deviceOverride","useStyle","responsiveStyle","styles","colorToString","fontFamily","fontSize","unit","fontWeight","lineHeight","letterSpacing","uppercase","textTransform","underline","strikethrough","textDecoration","Boolean","join","italic","fontStyle","shallowMergeFallbacks","leaf","children","attributes","enhancedTypography","useEnhancedTypography","typographyClassName","useTypographyClassName","props","type","TextType","Typography","element","blockStyles","margin","textAlign","BlockType","Paragraph","cx","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","padding","borderLeft","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","className","restOfProps","InlineType","Code","SuperScript","SubScript","Link","link","COMMIT_DEBOUNCE_DELAY","editor","text","shouldCommit","setShouldCommit","useState","useEffect","richTextDTOtoDAO","nextSelection","richTextDTOtoSelection","compareRichTextDAO","compareRichTextSelection","selection","onChange","timeoutId","window","setTimeout","clearTimeout","useCallback","Element","Text","defaultText","EditableText","forwardRef","width","ref","withList","withReact","createEditor","delaySync","useSyncWithBuilder","editMode","useBuilderEditMode","propControllers","setPropControllers","controller","useImperativeHandle","getDomNode","ReactEditor","toDOMNode","getBoxModel","getBox","initialValue","useMemo","console","log","setSlateEditor","handleFocus","focus","handleKeyDown","e","isHotkey","redo","undo","blur","onKeyDown","Leaf","BuilderEditMode","INTERACT"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,0BAA0BA,OAGY;AAC3C,SAAOA,MAAMC,aAAa,aAAaD,MAAMC,aAAa,YAAYD,MAAMC,aAAa;AAC1F;AAED,MAAMC,YACJ,CAACC,aACD,CACEC,6BAC4C;;AACtC,QAAA;AAAA,IAAEJ;AAAAA,IAAOC;AAAAA,MAAaG;AAExBJ,MAAAA,MAAMK,SAAS,MAAM;AACjB,UAA0BL,YAAxBK;AAAAA;AAAAA,QAAwBL,IAAdM,sBAAcN,IAAdM;AAAAA,MAAVD;AAAAA;AACD,WAAA;AAAA,MACLJ;AAAAA,MACAD,OAAOM;AAAAA,IAAAA;AAAAA,EAEV;AACM,SAAA;AAAA,IACLL;AAAAA,IACAD,OAAO,iCACFA,QADE;AAAA,MAELK,OAAO;AAAA,QACLE,QAAQJ,SAASK,KAAKC,CAAAA,MAAKA;;AAAAA,sBAAKA,EAAEC,OAAOV,cAAMK,UAANL,oBAAaW;AAAAA,SAA9C;AAAA,QACRC,OAAOZ,kBAAMK,UAANL,mBAAaY,UAAbZ,YAAsBa;AAAAA,MAFxB;AAAA,IAFF;AAAA,EAAA;AAQV;AAEH,MAAMC,cAAc,CAAC;AAAA,EAAEb;AAAAA,MAAwCA;AAE/D,+BAA8CD,OAAuC;;AAC7Ee,QAAAA,aAAaC,cAAchB,qCAAOU,OAAPV,YAAa,IAAd;AAC1BiB,QAAAA,SAASF,+CAAYG,MAAMC,OAAOC,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,CAA7E;AAEAkC,6CAAYW,eAAe7C;AAAAA,EAA3B,GACC,CAACkC,YAAYlC,MAAb,CAJM;AAMH8C,QAAAA,cAAc7B,YAAY,MAAM;AACpCiB,6CAAYa;AAAAA,EAAZ,GACC,CAACb,UAAD,CAF4B;AAIzBc,QAAAA,gBAAgB/B,YACpB,CAACgC,MAAqB;AAChBC,QAAAA,SAAS,eAAeD,CAAhB;AAAoB,aAAOf,yCAAYiB;AAC/CD,QAAAA,SAAS,SAASD,CAAV;AAAc,aAAOf,yCAAYkB;AACzCF,QAAAA,SAAS,QAAD,EAAWD,CAAnB;AAAuB,aAAOf,yCAAYmB;AAC9CC,cAAUL,GAAGjD,MAAJ;AAAA,EAAA,GAEX,CAACkC,YAAYlC,MAAb,CAP+B;AAUjC2C,UAAQC,IAAI,UAAU;AAAA,IAAEZ;AAAAA,IAAiBE;AAAAA,IAAYlC;AAAAA,EAAAA,CAArD;AAEA,6BACG,OAAD;AAAA,IAAO;AAAA,IAAgB,OAAOyC;AAAAA,IAAc,UAAUb;AAAAA,IAAtD,8BACG,UAAD;AAAA,MACE;AAAA,MACA,YAAY2B;AAAAA,MACZ,eAAerC;AAAAA,MACf,WAAW8B;AAAAA,MACX,SAASF;AAAAA,MACT,WAAWtE,GAAG+C,OAAOnD,MAAR;AAAA,MACb,UAAU0D,aAAa0B,gBAAgBC;AAAAA,IAAAA,CAPzC;AAAA,EAAA,CAFJ;AAaD,CA/DqC;AC5BtC,MAAMtC,OAAOG,WAAW,eAAcxD,OAAc0D,KAAwB;AACnE,6BAAC,cAAD,iCAAkB1D,QAAlB;AAAA,IAAyB;AAAA,EAAA,EAAhC;AACD,CAFsB;;"}
|
package/dist/compare.cjs.js
CHANGED
|
@@ -14,11 +14,15 @@ function compareLists(compareFunc, a, b) {
|
|
|
14
14
|
function compareRichTextTypography(a, b) {
|
|
15
15
|
if (a.id !== b.id)
|
|
16
16
|
return false;
|
|
17
|
+
if (a.style.length !== b.style.length)
|
|
18
|
+
return false;
|
|
17
19
|
return a.style.reduce((acc, curra, index) => {
|
|
18
20
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
19
21
|
if (acc == false)
|
|
20
22
|
return false;
|
|
21
23
|
const currb = b.style.at(index);
|
|
24
|
+
if (currb == null)
|
|
25
|
+
return false;
|
|
22
26
|
if (curra.deviceId !== (currb == null ? void 0 : currb.deviceId))
|
|
23
27
|
return false;
|
|
24
28
|
if (((_a = curra.value.color) == null ? void 0 : _a.alpha) !== ((_b = currb.value.color) == null ? void 0 : _b.alpha))
|
package/dist/compare.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compare.cjs.js","sources":["../src/controls/rich-text/compare.ts"],"sourcesContent":["import { Descendant, Selection } from 'slate'\nimport { Typography } from '../../api'\nimport { LinkControlData } from '../link'\nimport {\n Text,\n Inline,\n TextType,\n InlineType,\n BlockType,\n RichTextDAO,\n BlockTextAlignment,\n} from './types'\n\nfunction compareLists<T>(compareFunc: (a: T, b: T) => boolean, a?: T[], b?: T[]): boolean {\n if (typeof a === 'undefined' || typeof b === 'undefined') {\n return Object.is(a, b)\n }\n return (\n a.length === b.length &&\n a.reduce((acc, curra, index) => {\n const currb = b.at(index)\n if (acc == false || currb == null) return false\n\n return compareFunc(curra, currb)\n }, true as boolean)\n )\n}\n\nfunction compareRichTextTypography(a: Typography, b: Typography) {\n if (a.id !== b.id) return false\n\n return a.style.reduce((acc, curra, index) => {\n if (acc == false) return false\n const currb = b.style.at(index)\n\n if (curra.deviceId !== currb?.deviceId) return false\n if (curra.value.color?.alpha !== currb.value.color?.alpha) return false\n if (curra.value.color?.swatchId !== currb.value.color?.swatchId) return false\n if (curra.value.fontFamily !== currb.value.fontFamily) return false\n if (\n curra.value.fontSize?.unit !== currb.value.fontSize?.unit ||\n curra.value.fontSize?.value !== currb.value.fontSize?.value\n )\n return false\n if (curra.value.fontWeight !== currb.value.fontWeight) return false\n if (curra.value.italic !== currb.value.italic) return false\n if (curra.value.letterSpacing !== currb.value.letterSpacing) return false\n if (curra.value.lineHeight !== currb.value.lineHeight) return false\n if (curra.value.strikethrough !== currb.value.strikethrough) return false\n if (curra.value.underline !== currb.value.underline) return false\n if (curra.value.uppercase !== currb.value.uppercase) return false\n\n return true\n }, true)\n}\n\nfunction compareBlockTextAlignment(a?: BlockTextAlignment, b?: BlockTextAlignment) {\n if (typeof a === 'undefined' || typeof b === 'undefined') {\n return Object.is(a, b)\n }\n return a.reduce((acc, curra, index) => {\n if (acc == false) return false\n const currb = b.at(index)\n if (curra.deviceId !== currb?.deviceId) return false\n if (curra.value !== currb.value) return false\n return true\n }, true)\n}\n\nfunction compareLinkControlData(a: LinkControlData, b: LinkControlData) {\n if (a.type !== b.type) return false\n\n if (a.type === 'OPEN_PAGE' && b.type === 'OPEN_PAGE') {\n return (\n a.payload.pageId === b.payload.pageId && a.payload.openInNewTab === b.payload.openInNewTab\n )\n }\n\n if (a.type === 'OPEN_URL' && b.type === 'OPEN_URL') {\n return a.payload.openInNewTab === b.payload.openInNewTab && a.payload.url === b.payload.url\n }\n\n if (a.type === 'SEND_EMAIL' && b.type === 'SEND_EMAIL') {\n return (\n a.payload.body === b.payload.body &&\n a.payload.subject === b.payload.subject &&\n a.payload.to === b.payload.to\n )\n }\n\n if (a.type === 'CALL_PHONE' && b.type === 'CALL_PHONE') {\n return a.payload.phoneNumber === b.payload.phoneNumber\n }\n\n if (a.type === 'SCROLL_TO_ELEMENT' && b.type === 'SCROLL_TO_ELEMENT') {\n return (\n a.payload.block === b.payload.block &&\n a.payload.elementIdConfig?.elementKey === b.payload.elementIdConfig?.elementKey &&\n a.payload.elementIdConfig?.propName === b.payload.elementIdConfig?.propName\n )\n }\n\n return true\n}\n\nfunction compareInlineAndText(a: Text | Inline, b: Text | Inline): boolean {\n if (a.type !== b.type) return false\n if (a.type === TextType.Text && b.type === TextType.Text) {\n return a.text === b.text\n }\n\n if (a.type === TextType.Typography && b.type === TextType.Typography) {\n return a.text === b.text && compareRichTextTypography(a.typography, b.typography)\n }\n\n if (a.type === InlineType.Link && b.type === InlineType.Link) {\n return (\n compareLinkControlData(a.link, b.link) &&\n compareLists(compareInlineAndText, a.children, b.children)\n )\n }\n\n if (\n (a.type === InlineType.Code && b.type === InlineType.Code) ||\n (a.type === InlineType.SubScript && b.type === InlineType.SubScript) ||\n (a.type === InlineType.SuperScript && b.type === InlineType.SuperScript)\n ) {\n return compareLists(compareInlineAndText, a.children, b.children)\n }\n\n return true\n}\n\nfunction compareRichTextDescendant(a: Descendant, b: Descendant): boolean {\n if (a.type !== b.type) {\n return false\n }\n\n if (\n (a.type === TextType.Text && b.type === TextType.Text) ||\n (a.type === TextType.Typography && b.type === TextType.Typography) ||\n (a.type === InlineType.Link && b.type === InlineType.Link) ||\n (a.type === InlineType.Code && b.type === InlineType.Code) ||\n (a.type === InlineType.SubScript && b.type === InlineType.SubScript) ||\n (a.type === InlineType.SuperScript && b.type === InlineType.SuperScript)\n ) {\n return compareInlineAndText(a, b)\n }\n\n if (\n (a.type === BlockType.BlockQuote && b.type === BlockType.BlockQuote) ||\n (a.type === BlockType.Heading1 && b.type === BlockType.Heading1) ||\n (a.type === BlockType.Heading2 && b.type === BlockType.Heading2) ||\n (a.type === BlockType.Heading3 && b.type === BlockType.Heading3) ||\n (a.type === BlockType.Heading4 && b.type === BlockType.Heading4) ||\n (a.type === BlockType.Heading5 && b.type === BlockType.Heading5) ||\n (a.type === BlockType.Heading6 && b.type === BlockType.Heading6) ||\n (a.type === BlockType.Paragraph && b.type === BlockType.Paragraph) ||\n (a.type === BlockType.OrderedList && b.type === BlockType.OrderedList) ||\n (a.type === BlockType.UnorderedList && b.type === BlockType.UnorderedList) ||\n (a.type === BlockType.ListItem && b.type === BlockType.ListItem) ||\n (a.type === BlockType.ListItemChild && b.type === BlockType.ListItemChild)\n ) {\n return (\n compareBlockTextAlignment(a.textAlign, b.textAlign) &&\n compareLists(compareRichTextDescendant, a.children, b.children)\n )\n }\n\n return true\n}\n\nexport function compareRichTextDAO(a: RichTextDAO, b: RichTextDAO) {\n return compareLists(compareRichTextDescendant, a, b)\n}\n\nexport function compareRichTextSelection(a: Selection, b: Selection) {\n return (\n a?.anchor.offset === b?.anchor.offset &&\n a?.focus.offset === b?.focus.offset &&\n compareLists(Object.is, a?.focus.path, b?.focus.path)\n )\n}\n"],"names":["TextType","InlineType","BlockType"],"mappings":";;AAaA,sBAAyB,aAAsC,GAAS,GAAkB;AACxF,MAAI,OAAO,MAAM,eAAe,OAAO,MAAM,aAAa;AACjD,WAAA,OAAO,GAAG,GAAG,CAAC;AAAA,EACvB;AAEE,SAAA,EAAE,WAAW,EAAE,UACf,EAAE,OAAO,CAAC,KAAK,OAAO,UAAU;AACxB,UAAA,QAAQ,EAAE,GAAG,KAAK;AACpB,QAAA,OAAO,SAAS,SAAS;AAAa,aAAA;AAEnC,WAAA,YAAY,OAAO,KAAK;AAAA,KAC9B,IAAe;AAEtB;AAEA,mCAAmC,GAAe,GAAe;AAC3D,MAAA,EAAE,OAAO,EAAE;AAAW,WAAA;AAE1B,SAAO,EAAE,MAAM,OAAO,CAAC,KAAK,OAAO,UAAU;;AAC3C,QAAI,OAAO;AAAc,aAAA;AACzB,UAAM,QAAQ,EAAE,MAAM,GAAG,KAAK;AAE1B,QAAA,MAAM,aAAa,gCAAO;AAAiB,aAAA;AAC/C,QAAI,aAAM,MAAM,UAAZ,mBAAmB,WAAU,aAAM,MAAM,UAAZ,mBAAmB;AAAc,aAAA;AAClE,QAAI,aAAM,MAAM,UAAZ,mBAAmB,cAAa,aAAM,MAAM,UAAZ,mBAAmB;AAAiB,aAAA;AACxE,QAAI,MAAM,MAAM,eAAe,MAAM,MAAM;AAAmB,aAAA;AAC9D,QACE,aAAM,MAAM,aAAZ,mBAAsB,UAAS,aAAM,MAAM,aAAZ,mBAAsB,SACrD,aAAM,MAAM,aAAZ,mBAAsB,WAAU,aAAM,MAAM,aAAZ,mBAAsB;AAE/C,aAAA;AACT,QAAI,MAAM,MAAM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WAAW,EAAE,SAAS,KAClD,aAAa,2BAA2B,EAAE,UAAU,EAAE,QAAQ;AAAA,EAElE;AAEO,SAAA;AACT;AAEO,4BAA4B,GAAgB,GAAgB;AAC1D,SAAA,aAAa,2BAA2B,GAAG,CAAC;AACrD;AAEO,kCAAkC,GAAc,GAAc;AAEjE,SAAA,wBAAG,OAAO,YAAW,wBAAG,OAAO,WAC/B,wBAAG,MAAM,YAAW,wBAAG,MAAM,WAC7B,aAAa,OAAO,IAAI,uBAAG,MAAM,MAAM,uBAAG,MAAM,IAAI;AAExD;;;"}
|
|
1
|
+
{"version":3,"file":"compare.cjs.js","sources":["../src/controls/rich-text/compare.ts"],"sourcesContent":["import { Descendant, Selection } from 'slate'\nimport { Typography } from '../../api'\nimport { LinkControlData } from '../link'\nimport {\n Text,\n Inline,\n TextType,\n InlineType,\n BlockType,\n RichTextDAO,\n BlockTextAlignment,\n} from './types'\n\nfunction compareLists<T>(compareFunc: (a: T, b: T) => boolean, a?: T[], b?: T[]): boolean {\n if (typeof a === 'undefined' || typeof b === 'undefined') {\n return Object.is(a, b)\n }\n return (\n a.length === b.length &&\n a.reduce((acc, curra, index) => {\n const currb = b.at(index)\n if (acc == false || currb == null) return false\n\n return compareFunc(curra, currb)\n }, true as boolean)\n )\n}\n\nfunction compareRichTextTypography(a: Typography, b: Typography) {\n if (a.id !== b.id) return false\n if (a.style.length !== b.style.length) return false\n\n return a.style.reduce((acc, curra, index) => {\n if (acc == false) return false\n const currb = b.style.at(index)\n\n if (currb == null) return false\n if (curra.deviceId !== currb?.deviceId) return false\n if (curra.value.color?.alpha !== currb.value.color?.alpha) return false\n if (curra.value.color?.swatchId !== currb.value.color?.swatchId) return false\n if (curra.value.fontFamily !== currb.value.fontFamily) return false\n if (\n curra.value.fontSize?.unit !== currb.value.fontSize?.unit ||\n curra.value.fontSize?.value !== currb.value.fontSize?.value\n )\n return false\n if (curra.value.fontWeight !== currb.value.fontWeight) return false\n if (curra.value.italic !== currb.value.italic) return false\n if (curra.value.letterSpacing !== currb.value.letterSpacing) return false\n if (curra.value.lineHeight !== currb.value.lineHeight) return false\n if (curra.value.strikethrough !== currb.value.strikethrough) return false\n if (curra.value.underline !== currb.value.underline) return false\n if (curra.value.uppercase !== currb.value.uppercase) return false\n\n return true\n }, true)\n}\n\nfunction compareBlockTextAlignment(a?: BlockTextAlignment, b?: BlockTextAlignment) {\n if (typeof a === 'undefined' || typeof b === 'undefined') {\n return Object.is(a, b)\n }\n return a.reduce((acc, curra, index) => {\n if (acc == false) return false\n const currb = b.at(index)\n if (curra.deviceId !== currb?.deviceId) return false\n if (curra.value !== currb.value) return false\n return true\n }, true)\n}\n\nfunction compareLinkControlData(a: LinkControlData, b: LinkControlData) {\n if (a.type !== b.type) return false\n\n if (a.type === 'OPEN_PAGE' && b.type === 'OPEN_PAGE') {\n return (\n a.payload.pageId === b.payload.pageId && a.payload.openInNewTab === b.payload.openInNewTab\n )\n }\n\n if (a.type === 'OPEN_URL' && b.type === 'OPEN_URL') {\n return a.payload.openInNewTab === b.payload.openInNewTab && a.payload.url === b.payload.url\n }\n\n if (a.type === 'SEND_EMAIL' && b.type === 'SEND_EMAIL') {\n return (\n a.payload.body === b.payload.body &&\n a.payload.subject === b.payload.subject &&\n a.payload.to === b.payload.to\n )\n }\n\n if (a.type === 'CALL_PHONE' && b.type === 'CALL_PHONE') {\n return a.payload.phoneNumber === b.payload.phoneNumber\n }\n\n if (a.type === 'SCROLL_TO_ELEMENT' && b.type === 'SCROLL_TO_ELEMENT') {\n return (\n a.payload.block === b.payload.block &&\n a.payload.elementIdConfig?.elementKey === b.payload.elementIdConfig?.elementKey &&\n a.payload.elementIdConfig?.propName === b.payload.elementIdConfig?.propName\n )\n }\n\n return true\n}\n\nfunction compareInlineAndText(a: Text | Inline, b: Text | Inline): boolean {\n if (a.type !== b.type) return false\n if (a.type === TextType.Text && b.type === TextType.Text) {\n return a.text === b.text\n }\n\n if (a.type === TextType.Typography && b.type === TextType.Typography) {\n return a.text === b.text && compareRichTextTypography(a.typography, b.typography)\n }\n\n if (a.type === InlineType.Link && b.type === InlineType.Link) {\n return (\n compareLinkControlData(a.link, b.link) &&\n compareLists(compareInlineAndText, a.children, b.children)\n )\n }\n\n if (\n (a.type === InlineType.Code && b.type === InlineType.Code) ||\n (a.type === InlineType.SubScript && b.type === InlineType.SubScript) ||\n (a.type === InlineType.SuperScript && b.type === InlineType.SuperScript)\n ) {\n return compareLists(compareInlineAndText, a.children, b.children)\n }\n\n return true\n}\n\nfunction compareRichTextDescendant(a: Descendant, b: Descendant): boolean {\n if (a.type !== b.type) {\n return false\n }\n\n if (\n (a.type === TextType.Text && b.type === TextType.Text) ||\n (a.type === TextType.Typography && b.type === TextType.Typography) ||\n (a.type === InlineType.Link && b.type === InlineType.Link) ||\n (a.type === InlineType.Code && b.type === InlineType.Code) ||\n (a.type === InlineType.SubScript && b.type === InlineType.SubScript) ||\n (a.type === InlineType.SuperScript && b.type === InlineType.SuperScript)\n ) {\n return compareInlineAndText(a, b)\n }\n\n if (\n (a.type === BlockType.BlockQuote && b.type === BlockType.BlockQuote) ||\n (a.type === BlockType.Heading1 && b.type === BlockType.Heading1) ||\n (a.type === BlockType.Heading2 && b.type === BlockType.Heading2) ||\n (a.type === BlockType.Heading3 && b.type === BlockType.Heading3) ||\n (a.type === BlockType.Heading4 && b.type === BlockType.Heading4) ||\n (a.type === BlockType.Heading5 && b.type === BlockType.Heading5) ||\n (a.type === BlockType.Heading6 && b.type === BlockType.Heading6) ||\n (a.type === BlockType.Paragraph && b.type === BlockType.Paragraph) ||\n (a.type === BlockType.OrderedList && b.type === BlockType.OrderedList) ||\n (a.type === BlockType.UnorderedList && b.type === BlockType.UnorderedList) ||\n (a.type === BlockType.ListItem && b.type === BlockType.ListItem) ||\n (a.type === BlockType.ListItemChild && b.type === BlockType.ListItemChild)\n ) {\n return (\n compareBlockTextAlignment(a.textAlign, b.textAlign) &&\n compareLists(compareRichTextDescendant, a.children, b.children)\n )\n }\n\n return true\n}\n\nexport function compareRichTextDAO(a: RichTextDAO, b: RichTextDAO) {\n return compareLists(compareRichTextDescendant, a, b)\n}\n\nexport function compareRichTextSelection(a: Selection, b: Selection) {\n return (\n a?.anchor.offset === b?.anchor.offset &&\n a?.focus.offset === b?.focus.offset &&\n compareLists(Object.is, a?.focus.path, b?.focus.path)\n )\n}\n"],"names":["TextType","InlineType","BlockType"],"mappings":";;AAaA,sBAAyB,aAAsC,GAAS,GAAkB;AACxF,MAAI,OAAO,MAAM,eAAe,OAAO,MAAM,aAAa;AACjD,WAAA,OAAO,GAAG,GAAG,CAAC;AAAA,EACvB;AAEE,SAAA,EAAE,WAAW,EAAE,UACf,EAAE,OAAO,CAAC,KAAK,OAAO,UAAU;AACxB,UAAA,QAAQ,EAAE,GAAG,KAAK;AACpB,QAAA,OAAO,SAAS,SAAS;AAAa,aAAA;AAEnC,WAAA,YAAY,OAAO,KAAK;AAAA,KAC9B,IAAe;AAEtB;AAEA,mCAAmC,GAAe,GAAe;AAC3D,MAAA,EAAE,OAAO,EAAE;AAAW,WAAA;AAC1B,MAAI,EAAE,MAAM,WAAW,EAAE,MAAM;AAAe,WAAA;AAE9C,SAAO,EAAE,MAAM,OAAO,CAAC,KAAK,OAAO,UAAU;;AAC3C,QAAI,OAAO;AAAc,aAAA;AACzB,UAAM,QAAQ,EAAE,MAAM,GAAG,KAAK;AAE9B,QAAI,SAAS;AAAa,aAAA;AACtB,QAAA,MAAM,aAAa,gCAAO;AAAiB,aAAA;AAC/C,QAAI,aAAM,MAAM,UAAZ,mBAAmB,WAAU,aAAM,MAAM,UAAZ,mBAAmB;AAAc,aAAA;AAClE,QAAI,aAAM,MAAM,UAAZ,mBAAmB,cAAa,aAAM,MAAM,UAAZ,mBAAmB;AAAiB,aAAA;AACxE,QAAI,MAAM,MAAM,eAAe,MAAM,MAAM;AAAmB,aAAA;AAC9D,QACE,aAAM,MAAM,aAAZ,mBAAsB,UAAS,aAAM,MAAM,aAAZ,mBAAsB,SACrD,aAAM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ACtD,EAAE,SAASA,mBAAU,iBAAiB,EAAE,SAASA,SAAAA,UAAU,eAC5D;AAEE,WAAA,0BAA0B,EAAE,WAAW,EAAE,SAAS,KAClD,aAAa,2BAA2B,EAAE,UAAU,EAAE,QAAQ;AAAA,EAElE;AAEO,SAAA;AACT;AAEO,4BAA4B,GAAgB,GAAgB;AAC1D,SAAA,aAAa,2BAA2B,GAAG,CAAC;AACrD;AAEO,kCAAkC,GAAc,GAAc;AAEjE,SAAA,wBAAG,OAAO,YAAW,wBAAG,OAAO,WAC/B,wBAAG,MAAM,YAAW,wBAAG,MAAM,WAC7B,aAAa,OAAO,IAAI,uBAAG,MAAM,MAAM,uBAAG,MAAM,IAAI;AAExD;;;"}
|
package/dist/compare.es.js
CHANGED
|
@@ -13,11 +13,15 @@ function compareLists(compareFunc, a, b) {
|
|
|
13
13
|
function compareRichTextTypography(a, b) {
|
|
14
14
|
if (a.id !== b.id)
|
|
15
15
|
return false;
|
|
16
|
+
if (a.style.length !== b.style.length)
|
|
17
|
+
return false;
|
|
16
18
|
return a.style.reduce((acc, curra, index) => {
|
|
17
19
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
18
20
|
if (acc == false)
|
|
19
21
|
return false;
|
|
20
22
|
const currb = b.style.at(index);
|
|
23
|
+
if (currb == null)
|
|
24
|
+
return false;
|
|
21
25
|
if (curra.deviceId !== (currb == null ? void 0 : currb.deviceId))
|
|
22
26
|
return false;
|
|
23
27
|
if (((_a = curra.value.color) == null ? void 0 : _a.alpha) !== ((_b = currb.value.color) == null ? void 0 : _b.alpha))
|
package/dist/compare.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compare.es.js","sources":["../src/controls/rich-text/compare.ts"],"sourcesContent":["import { Descendant, Selection } from 'slate'\nimport { Typography } from '../../api'\nimport { LinkControlData } from '../link'\nimport {\n Text,\n Inline,\n TextType,\n InlineType,\n BlockType,\n RichTextDAO,\n BlockTextAlignment,\n} from './types'\n\nfunction compareLists<T>(compareFunc: (a: T, b: T) => boolean, a?: T[], b?: T[]): boolean {\n if (typeof a === 'undefined' || typeof b === 'undefined') {\n return Object.is(a, b)\n }\n return (\n a.length === b.length &&\n a.reduce((acc, curra, index) => {\n const currb = b.at(index)\n if (acc == false || currb == null) return false\n\n return compareFunc(curra, currb)\n }, true as boolean)\n )\n}\n\nfunction compareRichTextTypography(a: Typography, b: Typography) {\n if (a.id !== b.id) return false\n\n return a.style.reduce((acc, curra, index) => {\n if (acc == false) return false\n const currb = b.style.at(index)\n\n if (curra.deviceId !== currb?.deviceId) return false\n if (curra.value.color?.alpha !== currb.value.color?.alpha) return false\n if (curra.value.color?.swatchId !== currb.value.color?.swatchId) return false\n if (curra.value.fontFamily !== currb.value.fontFamily) return false\n if (\n curra.value.fontSize?.unit !== currb.value.fontSize?.unit ||\n curra.value.fontSize?.value !== currb.value.fontSize?.value\n )\n return false\n if (curra.value.fontWeight !== currb.value.fontWeight) return false\n if (curra.value.italic !== currb.value.italic) return false\n if (curra.value.letterSpacing !== currb.value.letterSpacing) return false\n if (curra.value.lineHeight !== currb.value.lineHeight) return false\n if (curra.value.strikethrough !== currb.value.strikethrough) return false\n if (curra.value.underline !== currb.value.underline) return false\n if (curra.value.uppercase !== currb.value.uppercase) return false\n\n return true\n }, true)\n}\n\nfunction compareBlockTextAlignment(a?: BlockTextAlignment, b?: BlockTextAlignment) {\n if (typeof a === 'undefined' || typeof b === 'undefined') {\n return Object.is(a, b)\n }\n return a.reduce((acc, curra, index) => {\n if (acc == false) return false\n const currb = b.at(index)\n if (curra.deviceId !== currb?.deviceId) return false\n if (curra.value !== currb.value) return false\n return true\n }, true)\n}\n\nfunction compareLinkControlData(a: LinkControlData, b: LinkControlData) {\n if (a.type !== b.type) return false\n\n if (a.type === 'OPEN_PAGE' && b.type === 'OPEN_PAGE') {\n return (\n a.payload.pageId === b.payload.pageId && a.payload.openInNewTab === b.payload.openInNewTab\n )\n }\n\n if (a.type === 'OPEN_URL' && b.type === 'OPEN_URL') {\n return a.payload.openInNewTab === b.payload.openInNewTab && a.payload.url === b.payload.url\n }\n\n if (a.type === 'SEND_EMAIL' && b.type === 'SEND_EMAIL') {\n return (\n a.payload.body === b.payload.body &&\n a.payload.subject === b.payload.subject &&\n a.payload.to === b.payload.to\n )\n }\n\n if (a.type === 'CALL_PHONE' && b.type === 'CALL_PHONE') {\n return a.payload.phoneNumber === b.payload.phoneNumber\n }\n\n if (a.type === 'SCROLL_TO_ELEMENT' && b.type === 'SCROLL_TO_ELEMENT') {\n return (\n a.payload.block === b.payload.block &&\n a.payload.elementIdConfig?.elementKey === b.payload.elementIdConfig?.elementKey &&\n a.payload.elementIdConfig?.propName === b.payload.elementIdConfig?.propName\n )\n }\n\n return true\n}\n\nfunction compareInlineAndText(a: Text | Inline, b: Text | Inline): boolean {\n if (a.type !== b.type) return false\n if (a.type === TextType.Text && b.type === TextType.Text) {\n return a.text === b.text\n }\n\n if (a.type === TextType.Typography && b.type === TextType.Typography) {\n return a.text === b.text && compareRichTextTypography(a.typography, b.typography)\n }\n\n if (a.type === InlineType.Link && b.type === InlineType.Link) {\n return (\n compareLinkControlData(a.link, b.link) &&\n compareLists(compareInlineAndText, a.children, b.children)\n )\n }\n\n if (\n (a.type === InlineType.Code && b.type === InlineType.Code) ||\n (a.type === InlineType.SubScript && b.type === InlineType.SubScript) ||\n (a.type === InlineType.SuperScript && b.type === InlineType.SuperScript)\n ) {\n return compareLists(compareInlineAndText, a.children, b.children)\n }\n\n return true\n}\n\nfunction compareRichTextDescendant(a: Descendant, b: Descendant): boolean {\n if (a.type !== b.type) {\n return false\n }\n\n if (\n (a.type === TextType.Text && b.type === TextType.Text) ||\n (a.type === TextType.Typography && b.type === TextType.Typography) ||\n (a.type === InlineType.Link && b.type === InlineType.Link) ||\n (a.type === InlineType.Code && b.type === InlineType.Code) ||\n (a.type === InlineType.SubScript && b.type === InlineType.SubScript) ||\n (a.type === InlineType.SuperScript && b.type === InlineType.SuperScript)\n ) {\n return compareInlineAndText(a, b)\n }\n\n if (\n (a.type === BlockType.BlockQuote && b.type === BlockType.BlockQuote) ||\n (a.type === BlockType.Heading1 && b.type === BlockType.Heading1) ||\n (a.type === BlockType.Heading2 && b.type === BlockType.Heading2) ||\n (a.type === BlockType.Heading3 && b.type === BlockType.Heading3) ||\n (a.type === BlockType.Heading4 && b.type === BlockType.Heading4) ||\n (a.type === BlockType.Heading5 && b.type === BlockType.Heading5) ||\n (a.type === BlockType.Heading6 && b.type === BlockType.Heading6) ||\n (a.type === BlockType.Paragraph && b.type === BlockType.Paragraph) ||\n (a.type === BlockType.OrderedList && b.type === BlockType.OrderedList) ||\n (a.type === BlockType.UnorderedList && b.type === BlockType.UnorderedList) ||\n (a.type === BlockType.ListItem && b.type === BlockType.ListItem) ||\n (a.type === BlockType.ListItemChild && b.type === BlockType.ListItemChild)\n ) {\n return (\n compareBlockTextAlignment(a.textAlign, b.textAlign) &&\n compareLists(compareRichTextDescendant, a.children, b.children)\n )\n }\n\n return true\n}\n\nexport function compareRichTextDAO(a: RichTextDAO, b: RichTextDAO) {\n return compareLists(compareRichTextDescendant, a, b)\n}\n\nexport function compareRichTextSelection(a: Selection, b: Selection) {\n return (\n a?.anchor.offset === b?.anchor.offset &&\n a?.focus.offset === b?.focus.offset &&\n compareLists(Object.is, a?.focus.path, b?.focus.path)\n )\n}\n"],"names":[],"mappings":";AAaA,sBAAyB,aAAsC,GAAS,GAAkB;AACxF,MAAI,OAAO,MAAM,eAAe,OAAO,MAAM,aAAa;AACjD,WAAA,OAAO,GAAG,GAAG,CAAC;AAAA,EACvB;AAEE,SAAA,EAAE,WAAW,EAAE,UACf,EAAE,OAAO,CAAC,KAAK,OAAO,UAAU;AACxB,UAAA,QAAQ,EAAE,GAAG,KAAK;AACpB,QAAA,OAAO,SAAS,SAAS;AAAa,aAAA;AAEnC,WAAA,YAAY,OAAO,KAAK;AAAA,KAC9B,IAAe;AAEtB;AAEA,mCAAmC,GAAe,GAAe;AAC3D,M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U,YAAY,EAAE,SAAS,UAAU,YACtD,EAAE,SAAS,UAAU,YAAY,EAAE,SAAS,UAAU,YACtD,EAAE,SAAS,UAAU,YAAY,EAAE,SAAS,UAAU,YACtD,EAAE,SAAS,UAAU,aAAa,EAAE,SAAS,UAAU,aACvD,EAAE,SAAS,UAAU,eAAe,EAAE,SAAS,UAAU,eACzD,EAAE,SAAS,UAAU,iBAAiB,EAAE,SAAS,UAAU,iBAC3D,EAAE,SAAS,UAAU,YAAY,EAAE,SAAS,UAAU,YACtD,EAAE,SAAS,UAAU,iBAAiB,EAAE,SAAS,UAAU,eAC5D;AAEE,WAAA,0BAA0B,EAAE,WAAW,EAAE,SAAS,KAClD,aAAa,2BAA2B,EAAE,UAAU,EAAE,QAAQ;AAAA,EAElE;AAEO,SAAA;AACT;AAEO,4BAA4B,GAAgB,GAAgB;AAC1D,SAAA,aAAa,2BAA2B,GAAG,CAAC;AACrD;AAEO,kCAAkC,GAAc,GAAc;AAEjE,SAAA,wBAAG,OAAO,YAAW,wBAAG,OAAO,WAC/B,wBAAG,MAAM,YAAW,wBAAG,MAAM,WAC7B,aAAa,OAAO,IAAI,uBAAG,MAAM,MAAM,uBAAG,MAAM,IAAI;AAExD;;"}
|
|
1
|
+
{"version":3,"file":"compare.es.js","sources":["../src/controls/rich-text/compare.ts"],"sourcesContent":["import { Descendant, Selection } from 'slate'\nimport { Typography } from '../../api'\nimport { LinkControlData } from '../link'\nimport {\n Text,\n Inline,\n TextType,\n InlineType,\n BlockType,\n RichTextDAO,\n BlockTextAlignment,\n} from './types'\n\nfunction compareLists<T>(compareFunc: (a: T, b: T) => boolean, a?: T[], b?: T[]): boolean {\n if (typeof a === 'undefined' || typeof b === 'undefined') {\n return Object.is(a, b)\n }\n return (\n a.length === b.length &&\n a.reduce((acc, curra, index) => {\n const currb = b.at(index)\n if (acc == false || currb == null) return false\n\n return compareFunc(curra, currb)\n }, true as boolean)\n )\n}\n\nfunction compareRichTextTypography(a: Typography, b: Typography) {\n if (a.id !== b.id) return false\n if (a.style.length !== b.style.length) return false\n\n return a.style.reduce((acc, curra, index) => {\n if (acc == false) return false\n const currb = b.style.at(index)\n\n if (currb == null) return false\n if (curra.deviceId !== currb?.deviceId) return false\n if (curra.value.color?.alpha !== currb.value.color?.alpha) return false\n if (curra.value.color?.swatchId !== currb.value.color?.swatchId) return false\n if (curra.value.fontFamily !== currb.value.fontFamily) return false\n if (\n curra.value.fontSize?.unit !== currb.value.fontSize?.unit ||\n curra.value.fontSize?.value !== currb.value.fontSize?.value\n )\n return false\n if (curra.value.fontWeight !== currb.value.fontWeight) return false\n if (curra.value.italic !== currb.value.italic) return false\n if (curra.value.letterSpacing !== currb.value.letterSpacing) return false\n if (curra.value.lineHeight !== currb.value.lineHeight) return false\n if (curra.value.strikethrough !== currb.value.strikethrough) return false\n if (curra.value.underline !== currb.value.underline) return false\n if (curra.value.uppercase !== currb.value.uppercase) return false\n\n return true\n }, true)\n}\n\nfunction compareBlockTextAlignment(a?: BlockTextAlignment, b?: BlockTextAlignment) {\n if (typeof a === 'undefined' || typeof b === 'undefined') {\n return Object.is(a, b)\n }\n return a.reduce((acc, curra, index) => {\n if (acc == false) return false\n const currb = b.at(index)\n if (curra.deviceId !== currb?.deviceId) return false\n if (curra.value !== currb.value) return false\n return true\n }, true)\n}\n\nfunction compareLinkControlData(a: LinkControlData, b: LinkControlData) {\n if (a.type !== b.type) return false\n\n if (a.type === 'OPEN_PAGE' && b.type === 'OPEN_PAGE') {\n return (\n a.payload.pageId === b.payload.pageId && a.payload.openInNewTab === b.payload.openInNewTab\n )\n }\n\n if (a.type === 'OPEN_URL' && b.type === 'OPEN_URL') {\n return a.payload.openInNewTab === b.payload.openInNewTab && a.payload.url === b.payload.url\n }\n\n if (a.type === 'SEND_EMAIL' && b.type === 'SEND_EMAIL') {\n return (\n a.payload.body === b.payload.body &&\n a.payload.subject === b.payload.subject &&\n a.payload.to === b.payload.to\n )\n }\n\n if (a.type === 'CALL_PHONE' && b.type === 'CALL_PHONE') {\n return a.payload.phoneNumber === b.payload.phoneNumber\n }\n\n if (a.type === 'SCROLL_TO_ELEMENT' && b.type === 'SCROLL_TO_ELEMENT') {\n return (\n a.payload.block === b.payload.block &&\n a.payload.elementIdConfig?.elementKey === b.payload.elementIdConfig?.elementKey &&\n a.payload.elementIdConfig?.propName === b.payload.elementIdConfig?.propName\n )\n }\n\n return true\n}\n\nfunction compareInlineAndText(a: Text | Inline, b: Text | Inline): boolean {\n if (a.type !== b.type) return false\n if (a.type === TextType.Text && b.type === TextType.Text) {\n return a.text === b.text\n }\n\n if (a.type === TextType.Typography && b.type === TextType.Typography) {\n return a.text === b.text && compareRichTextTypography(a.typography, b.typography)\n }\n\n if (a.type === InlineType.Link && b.type === InlineType.Link) {\n return (\n compareLinkControlData(a.link, b.link) &&\n compareLists(compareInlineAndText, a.children, b.children)\n )\n }\n\n if (\n (a.type === InlineType.Code && b.type === InlineType.Code) ||\n (a.type === InlineType.SubScript && b.type === InlineType.SubScript) ||\n (a.type === InlineType.SuperScript && b.type === InlineType.SuperScript)\n ) {\n return compareLists(compareInlineAndText, a.children, b.children)\n }\n\n return true\n}\n\nfunction compareRichTextDescendant(a: Descendant, b: Descendant): boolean {\n if (a.type !== b.type) {\n return false\n }\n\n if (\n (a.type === TextType.Text && b.type === TextType.Text) ||\n (a.type === TextType.Typography && b.type === TextType.Typography) ||\n (a.type === InlineType.Link && b.type === InlineType.Link) ||\n (a.type === InlineType.Code && b.type === InlineType.Code) ||\n (a.type === InlineType.SubScript && b.type === InlineType.SubScript) ||\n (a.type === InlineType.SuperScript && b.type === InlineType.SuperScript)\n ) {\n return compareInlineAndText(a, b)\n }\n\n if (\n (a.type === BlockType.BlockQuote && b.type === BlockType.BlockQuote) ||\n (a.type === BlockType.Heading1 && b.type === BlockType.Heading1) ||\n (a.type === BlockType.Heading2 && b.type === BlockType.Heading2) ||\n (a.type === BlockType.Heading3 && b.type === BlockType.Heading3) ||\n (a.type === BlockType.Heading4 && b.type === BlockType.Heading4) ||\n (a.type === BlockType.Heading5 && b.type === BlockType.Heading5) ||\n (a.type === BlockType.Heading6 && b.type === BlockType.Heading6) ||\n (a.type === BlockType.Paragraph && b.type === BlockType.Paragraph) ||\n (a.type === BlockType.OrderedList && b.type === BlockType.OrderedList) ||\n (a.type === BlockType.UnorderedList && b.type === BlockType.UnorderedList) ||\n (a.type === BlockType.ListItem && b.type === BlockType.ListItem) ||\n (a.type === BlockType.ListItemChild && b.type === BlockType.ListItemChild)\n ) {\n return (\n compareBlockTextAlignment(a.textAlign, b.textAlign) &&\n compareLists(compareRichTextDescendant, a.children, b.children)\n )\n }\n\n return true\n}\n\nexport function compareRichTextDAO(a: RichTextDAO, b: RichTextDAO) {\n return compareLists(compareRichTextDescendant, a, b)\n}\n\nexport function compareRichTextSelection(a: Selection, b: Selection) {\n return (\n a?.anchor.offset === b?.anchor.offset &&\n a?.focus.offset === b?.focus.offset &&\n compareLists(Object.is, a?.focus.path, b?.focus.path)\n )\n}\n"],"names":[],"mappings":";AAaA,sBAAyB,aAAsC,GAAS,GAAkB;AACxF,MAAI,OAAO,MAAM,eAAe,OAAO,MAAM,aAAa;AACjD,WAAA,OAAO,GAAG,GAAG,CAAC;AAAA,EACvB;AAEE,SAAA,EAAE,WAAW,EAAE,UACf,EAAE,OAAO,CAAC,KAAK,OAAO,UAAU;AACxB,UAAA,QAAQ,EAAE,GAAG,KAAK;AACpB,QAAA,OAAO,SAAS,SAAS;AAAa,aAAA;AAEnC,WAAA,YAAY,OAAO,KAAK;AAAA,KAC9B,IAAe;AAEtB;AAEA,mCAAmC,GAAe,GAAe;AAC3D,MAAA,EAAE,OAAO,EAAE;AAAW,WAAA;AAC1B,MAAI,EAAE,MAAM,WAAW,EAAE,MAAM;AAAe,WAAA;AAE9C,SAAO,EAAE,MAAM,OAAO,CAAC,KAAK,OAAO,UAAU;;AAC3C,QAAI,OAAO;AAAc,aAAA;AACzB,UAAM,QAAQ,EAAE,MAAM,GAAG,KAAK;AAE9B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AAU,aAAa,EAAE,SAAS,UAAU,aACvD,EAAE,SAAS,UAAU,eAAe,EAAE,SAAS,UAAU,eACzD,EAAE,SAAS,UAAU,iBAAiB,EAAE,SAAS,UAAU,iBAC3D,EAAE,SAAS,UAAU,YAAY,EAAE,SAAS,UAAU,YACtD,EAAE,SAAS,UAAU,iBAAiB,EAAE,SAAS,UAAU,eAC5D;AAEE,WAAA,0BAA0B,EAAE,WAAW,EAAE,SAAS,KAClD,aAAa,2BAA2B,EAAE,UAAU,EAAE,QAAQ;AAAA,EAElE;AAEO,SAAA;AACT;AAEO,4BAA4B,GAAgB,GAAgB;AAC1D,SAAA,aAAa,2BAA2B,GAAG,CAAC;AACrD;AAEO,kCAAkC,GAAc,GAAc;AAEjE,SAAA,wBAAG,OAAO,YAAW,wBAAG,OAAO,WAC/B,wBAAG,MAAM,YAAW,wBAAG,MAAM,WAC7B,aAAa,OAAO,IAAI,uBAAG,MAAM,MAAM,uBAAG,MAAM,IAAI;AAExD;;"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1003,7 +1003,7 @@ function useCachedSite(siteId) {
|
|
|
1003
1003
|
const site = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
1004
1004
|
return site;
|
|
1005
1005
|
}
|
|
1006
|
-
const version = "0.0.0-
|
|
1006
|
+
const version = "0.0.0-20230322204534";
|
|
1007
1007
|
class Makeswift {
|
|
1008
1008
|
constructor(apiKey, { apiOrigin = "https://api.makeswift.com" } = {}) {
|
|
1009
1009
|
__publicField(this, "apiKey");
|
package/dist/index.es.js
CHANGED
|
@@ -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.0.0-
|
|
971
|
+
const version = "0.0.0-20230322204534";
|
|
972
972
|
class Makeswift {
|
|
973
973
|
constructor(apiKey, { apiOrigin = "https://api.makeswift.com" } = {}) {
|
|
974
974
|
__publicField(this, "apiKey");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../../../../../../../src/components/builtin/Text/EditableText/Leaf/typography.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAU,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAmB,MAAM,iCAAiC,CAAA;AAQjF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEpD,oBAAY,eAAe,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAElE,aAAK,aAAa,GAAG;IACnB,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB,CAAA;AAED,aAAK,uBAAuB,GAAG,IAAI,CAAC,eAAe,EAAE,MAAM,aAAa,CAAC,GAAG,aAAa,CAAA;AAEzF,oBAAY,kBAAkB,GAAG,KAAK,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC,CAAA;AAE/E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,eAAe,CAAA;CACvB,GAAG,KAAK,IAAI,cAAc,CAAC,eAAe,CAAC,CAE3C;AA8BD,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,kBAAkB,
|
|
1
|
+
{"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../../../../../../../src/components/builtin/Text/EditableText/Leaf/typography.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAU,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAmB,MAAM,iCAAiC,CAAA;AAQjF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEpD,oBAAY,eAAe,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAElE,aAAK,aAAa,GAAG;IACnB,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB,CAAA;AAED,aAAK,uBAAuB,GAAG,IAAI,CAAC,eAAe,EAAE,MAAM,aAAa,CAAC,GAAG,aAAa,CAAA;AAEzF,oBAAY,kBAAkB,GAAG,KAAK,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC,CAAA;AAE/E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,eAAe,CAAA;CACvB,GAAG,KAAK,IAAI,cAAc,CAAC,eAAe,CAAC,CAE3C;AA8BD,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,kBAAkB,CA0CnF;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAkCxE;AAED,MAAM,WAAW,yBAA0B,SAAQ,eAAe;IAChE,IAAI,EAAE,cAAc,CAAA;CACrB;AAED,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,yBAAyB,eAQvF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editable-text.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/builtin/Text/EditableText/editable-text.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAA;AAGxF,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAA;AAE3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAA;AAUzF,aAAK,KAAK,GAAG;IACX,EAAE,CAAC,EAAE,cAAc,CAAA;IACnB,IAAI,CAAC,EAAE,aAAa,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAMD,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"editable-text.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/builtin/Text/EditableText/editable-text.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAA;AAGxF,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAA;AAE3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAA;AAUzF,aAAK,KAAK,GAAG;IACX,EAAE,CAAC,EAAE,cAAc,CAAA;IACnB,IAAI,CAAC,EAAE,aAAa,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAMD,eAAO,MAAM,YAAY,sHA+DvB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../../../../src/controls/rich-text/compare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAE,MAAM,OAAO,CAAA;AAG7C,OAAO,EAML,WAAW,EAEZ,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../../../../src/controls/rich-text/compare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAE,MAAM,OAAO,CAAA;AAG7C,OAAO,EAML,WAAW,EAEZ,MAAM,SAAS,CAAA;AAmKhB,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,WAEhE;AAED,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,WAMlE"}
|