@makeswift/runtime 0.9.9 → 0.9.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/PreviewProvider.es.js +2 -2
  2. package/dist/ReadOnlyText.es.js +1 -1
  3. package/dist/ReadOnlyTextV2.cjs.js +3 -1
  4. package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
  5. package/dist/ReadOnlyTextV2.es.js +4 -2
  6. package/dist/ReadOnlyTextV2.es.js.map +1 -1
  7. package/dist/api.cjs.js +19 -0
  8. package/dist/api.cjs.js.map +1 -1
  9. package/dist/api.es.js +19 -0
  10. package/dist/api.es.js.map +1 -1
  11. package/dist/controls.cjs.js +2 -0
  12. package/dist/controls.cjs.js.map +1 -1
  13. package/dist/controls.es.js +1 -1
  14. package/dist/index.cjs.js +119 -28
  15. package/dist/index.cjs.js.map +1 -1
  16. package/dist/index.cjs10.js +6 -2
  17. package/dist/index.cjs10.js.map +1 -1
  18. package/dist/index.cjs5.js +30 -75
  19. package/dist/index.cjs5.js.map +1 -1
  20. package/dist/index.cjs9.js +4 -1
  21. package/dist/index.cjs9.js.map +1 -1
  22. package/dist/index.es.js +120 -29
  23. package/dist/index.es.js.map +1 -1
  24. package/dist/index.es10.js +8 -4
  25. package/dist/index.es10.js.map +1 -1
  26. package/dist/index.es5.js +31 -73
  27. package/dist/index.es5.js.map +1 -1
  28. package/dist/index.es6.js +1 -1
  29. package/dist/index.es9.js +5 -2
  30. package/dist/index.es9.js.map +1 -1
  31. package/dist/react-page.cjs.js +37 -17
  32. package/dist/react-page.cjs.js.map +1 -1
  33. package/dist/react-page.es.js +36 -18
  34. package/dist/react-page.es.js.map +1 -1
  35. package/dist/slate.cjs.js +69 -6
  36. package/dist/slate.cjs.js.map +1 -1
  37. package/dist/slate.es.js +69 -7
  38. package/dist/slate.es.js.map +1 -1
  39. package/dist/types/src/api/graphql/documents/fragments.d.ts +1 -0
  40. package/dist/types/src/api/graphql/documents/fragments.d.ts.map +1 -1
  41. package/dist/types/src/api/graphql/documents/queries.d.ts +1 -0
  42. package/dist/types/src/api/graphql/documents/queries.d.ts.map +1 -1
  43. package/dist/types/src/api/graphql/generated/fragment-document-nodes.d.ts +1 -0
  44. package/dist/types/src/api/graphql/generated/fragment-document-nodes.d.ts.map +1 -1
  45. package/dist/types/src/api/graphql/generated/types.d.ts +17 -0
  46. package/dist/types/src/api/graphql/generated/types.d.ts.map +1 -1
  47. package/dist/types/src/api/graphql/types.d.ts +3 -3
  48. package/dist/types/src/api/graphql/types.d.ts.map +1 -1
  49. package/dist/types/src/api/react.d.ts +13 -2
  50. package/dist/types/src/api/react.d.ts.map +1 -1
  51. package/dist/types/src/components/builtin/Text/components/Element/block.d.ts +1 -1
  52. package/dist/types/src/components/builtin/Text/components/Element/block.d.ts.map +1 -1
  53. package/dist/types/src/components/builtin/Text/components/Element/element.d.ts.map +1 -1
  54. package/dist/types/src/components/page/Page.d.ts.map +1 -1
  55. package/dist/types/src/controls/rich-text/fixtures/v2-data-types.d.ts +3 -0
  56. package/dist/types/src/controls/rich-text/fixtures/v2-data-types.d.ts.map +1 -0
  57. package/dist/types/src/controls/rich-text/translation.d.ts.map +1 -1
  58. package/dist/types/src/controls/rich-text-v2/index.d.ts +1 -0
  59. package/dist/types/src/controls/rich-text-v2/index.d.ts.map +1 -1
  60. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +15 -11
  61. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
  62. package/dist/types/src/controls/rich-text-v2/translation.d.ts +5 -0
  63. package/dist/types/src/controls/rich-text-v2/translation.d.ts.map +1 -0
  64. package/dist/types/src/controls/typography.d.ts +2 -2
  65. package/dist/types/src/controls/typography.d.ts.map +1 -1
  66. package/dist/types/src/next/api-handler/index.d.ts.map +1 -1
  67. package/dist/types/src/next/client.d.ts +7 -2
  68. package/dist/types/src/next/client.d.ts.map +1 -1
  69. package/dist/types/src/next/index.d.ts.map +1 -1
  70. package/dist/types/src/prop-controllers/introspection.d.ts.map +1 -1
  71. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts +1 -1
  72. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
  73. package/dist/types/src/runtimes/react/controls/typography.d.ts +5 -5
  74. package/dist/types/src/runtimes/react/controls/typography.d.ts.map +1 -1
  75. package/dist/types/src/runtimes/react/hooks/makeswift-api.d.ts +2 -1
  76. package/dist/types/src/runtimes/react/hooks/makeswift-api.d.ts.map +1 -1
  77. package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
  78. package/dist/types/src/slate/TypographyPlugin/getValue.d.ts +1 -1
  79. package/dist/types/src/slate/TypographyPlugin/getValue.d.ts.map +1 -1
  80. package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
  81. package/dist/types/src/state/makeswift-api-client.d.ts +1 -1
  82. package/dist/types/src/state/makeswift-api-client.d.ts.map +1 -1
  83. package/dist/types/src/state/modules/api-resources.d.ts.map +1 -1
  84. package/dist/types.cjs.js +1 -0
  85. package/dist/types.cjs.js.map +1 -1
  86. package/dist/types.cjs2.js +1 -5
  87. package/dist/types.cjs2.js.map +1 -1
  88. package/dist/types.es.js +1 -0
  89. package/dist/types.es.js.map +1 -1
  90. package/dist/types.es2.js +2 -6
  91. package/dist/types.es2.js.map +1 -1
  92. package/dist/typography.cjs.js.map +1 -1
  93. package/dist/typography.es.js.map +1 -1
  94. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types.es2.js","sources":["../src/slate/utils/element.ts","../src/slate/utils/unhangRange.ts","../src/slate/selectors.ts","../src/slate/BlockPlugin/setBlockKeyForDevice.ts","../src/slate/BlockPlugin/clearBlockKeyForDevice.ts","../src/slate/BlockPlugin/wrapInline.ts","../src/slate/BlockPlugin/unwrapInline.ts","../src/slate/utils/editor.ts","../src/slate/BlockPlugin/constants.ts","../src/slate/BlockPlugin/utils/filterForSubtreeRoots.ts","../src/slate/BlockPlugin/unwrapList.ts","../src/slate/BlockPlugin/wrapList.ts","../src/slate/BlockPlugin/utils/location.ts","../src/slate/BlockPlugin/utils/getSelectedListItems.ts","../src/slate/BlockPlugin/indent.ts","../src/slate/BlockPlugin/dedent.ts","../src/slate/BlockPlugin/toggleList.ts","../src/slate/BlockPlugin/index.tsx","../src/slate/InlinePlugin/types.ts"],"sourcesContent":["import { Node, Element } from 'slate'\nimport {\n RootBlock,\n BlockType,\n Block,\n Inline,\n InlineType,\n OrderedListElement,\n UnorderedListElement,\n ListItemElement,\n ListItemChildElement,\n} from '../types'\n\nexport const ElementUtils = {\n isRootBlock(node: Node): node is RootBlock {\n return (\n Element.isElement(node) &&\n (Element.isElementType(node, BlockType.Paragraph) ||\n Element.isElementType(node, BlockType.Heading1) ||\n Element.isElementType(node, BlockType.Heading2) ||\n Element.isElementType(node, BlockType.Heading3) ||\n Element.isElementType(node, BlockType.Heading3) ||\n Element.isElementType(node, BlockType.Heading4) ||\n Element.isElementType(node, BlockType.Heading5) ||\n Element.isElementType(node, BlockType.Heading6) ||\n Element.isElementType(node, BlockType.BlockQuote) ||\n Element.isElementType(node, BlockType.UnorderedList) ||\n Element.isElementType(node, BlockType.OrderedList) ||\n Element.isElementType(node, BlockType.Text) ||\n Element.isElementType(node, BlockType.Default))\n )\n },\n isBlock(node: Node): node is Block {\n return (\n Element.isElement(node) &&\n (this.isRootBlock(node) ||\n Element.isElementType(node, BlockType.ListItem) ||\n Element.isElementType(node, BlockType.ListItemChild))\n )\n },\n isInline(node: Node): node is Inline {\n return (\n Element.isElementType(node, InlineType.Code) ||\n Element.isElementType(node, InlineType.Link) ||\n Element.isElementType(node, InlineType.SubScript) ||\n Element.isElementType(node, InlineType.SuperScript)\n )\n },\n isConvertibleToListTextNode(node: Node) {\n return !this.isList(node) && !this.isListItem(node) && !this.isListItemChild(node)\n },\n isList(node: Node): node is OrderedListElement | UnorderedListElement {\n return (\n Element.isElementType(node, BlockType.OrderedList) ||\n Element.isElementType(node, BlockType.UnorderedList)\n )\n },\n isListItem(node: Node): node is ListItemElement {\n return Element.isElementType(node, BlockType.ListItem)\n },\n isListItemChild(node: Node): node is ListItemChildElement {\n return Element.isElementType(node, BlockType.ListItemChild)\n },\n createText() {\n return { text: '' }\n },\n createParagraph() {\n return {\n children: [this.createText()],\n type: BlockType.Paragraph,\n }\n },\n createList(type: BlockType = BlockType.UnorderedList): Block {\n return { children: [this.createText()], type }\n },\n createListItem(): Block {\n return {\n children: [this.createListItemChild()],\n type: BlockType.ListItem,\n }\n },\n createListItemChild(): Block {\n return {\n children: [this.createText()],\n type: BlockType.ListItemChild,\n }\n },\n}\n","import { Editor, Range, Element, Text, Path } from 'slate'\n\n/**\n * The `Editor.unhangeRange` within Slate early exits if `Path.hasPrevious(end.path)` ie if this isn't a root block.\n * Unfortunately when you `setNode(..., {split:true})` or `wrapNodes()` you also have a hanging selection, but not in the root position.\n *\n * This c/p removes the `Path.hasPrevious(end.path)` from the early exit but it the same otherwise\n */\nfunction unhangRange(editor: Editor, range: Range): Range {\n // eslint-disable-next-line prefer-const\n let [start, end] = Range.edges(range)\n // PERF: exit early if we can guarantee that the range isn't hanging.\n if (start.offset !== 0 || end.offset !== 0 || Range.isCollapsed(range)) {\n return range\n }\n\n const endBlock = Editor.above(editor, {\n at: end,\n match: n => Element.isElement(n) && Editor.isBlock(editor, n),\n })\n const blockPath = endBlock ? endBlock[1] : []\n const first = Editor.start(editor, start)\n const before = { anchor: first, focus: end }\n let skip = true\n\n for (const [node, path] of Editor.nodes(editor, {\n at: before,\n match: Text.isText,\n reverse: true,\n })) {\n if (skip) {\n skip = false\n continue\n }\n\n if (node.text !== '' || Path.isBefore(path, blockPath)) {\n end = { path, offset: node.text.length }\n break\n }\n }\n\n return { anchor: start, focus: end }\n}\n\nexport default unhangRange\n","import { Editor, NodeEntry, Range, Text } from 'slate'\nimport { EditableBlockKey } from './BlockPlugin/types'\nimport { ElementUtils } from './utils/element'\n\nimport unhangRange from './utils/unhangRange'\nimport shallowEqual from '../utils/shallowEqual'\nimport { isNonNullable } from '../utils/isNonNullable'\n\nimport { Breakpoints, BreakpointId, findBreakpointOverride } from '../state/modules/breakpoints'\nimport deepEqual from '../utils/deepEqual'\nimport keys from '../utils/keys'\nimport {\n RootBlock,\n Inline,\n RootBlockType,\n ResponsiveBlockTextAlignment,\n BlockTextAlignment,\n RichTextTypography,\n} from './types'\n\nexport function getSelection(editor: Editor): Range {\n if (editor.selection) return unhangRange(editor, editor.selection)\n return {\n anchor: Editor.start(editor, []),\n focus: Editor.end(editor, []),\n }\n}\n\nexport function getBlocksInSelection(editor: Editor): NodeEntry<RootBlock>[] {\n return Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => ElementUtils.isRootBlock(node),\n }),\n ).filter((entry): entry is NodeEntry<RootBlock> => ElementUtils.isRootBlock(entry[0]))\n}\n\nexport function getInlinesInSelection(editor: Editor): NodeEntry<Inline>[] {\n return Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => ElementUtils.isInline(node),\n }),\n ).filter((entry): entry is NodeEntry<Inline> => ElementUtils.isInline(entry[0]))\n}\n\nexport function getActiveBlockType(editor: Editor): RootBlockType | null {\n const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type)\n\n return rootBlocks.reduce<RootBlockType | null>(\n (a, b) => (a === b ? b : null),\n rootBlocks.at(0) ?? null,\n )\n}\n\nexport function getActiveBlockValue(editor: Editor, key: EditableBlockKey) {\n const blocks = getBlocksInSelection(editor)\n\n const active = blocks.map(\n ([block]) => block[key] ?? null,\n ) as (ResponsiveBlockTextAlignment | null)[]\n\n return active.length === 0 ? null : active.reduce((a, b) => (shallowEqual(a, b) ? b : null))\n}\n\nexport function getActiveBlockDeviceOverrideValue(\n editor: Editor,\n key: EditableBlockKey,\n breakpoints: Breakpoints,\n deviceId: BreakpointId,\n) {\n const active: (BlockTextAlignment | null)[] = []\n const blocks = getBlocksInSelection(editor)\n\n blocks.forEach(([block]) => {\n const deviceOverride =\n findBreakpointOverride<BlockTextAlignment>(breakpoints, block[key], deviceId) || null\n active.push(deviceOverride?.value ?? null)\n })\n\n return active.length === 0 ? null : active.reduce((a, b) => (shallowEqual(a, b) ? b : null))\n}\n\n// Typography\n\nconst concat = (a: unknown[], b: unknown[]) => a.concat(b)\n\n// TODO: This is more cruft from trying to remove null from the typography type. This optimization is not worth it.\n/**\n * This is a c/p of the intersection of the utils from the root utils folder.\n * The only change is defaulting to undefined instead of to null.\n */\nexport default function intersection<A extends Record<string, unknown>, B extends A>(\n a: A,\n b: B,\n isEqual: (a: unknown, b: unknown) => boolean = deepEqual,\n): { [K in keyof A]: A[K] | undefined } {\n const allKeys = [...new Set([...keys(a), ...keys(b)])] as (keyof A)[]\n\n return allKeys.reduce((acc, k) => {\n if (isEqual(a[k], b[k])) acc[k] = a[k]\n else acc[k] = undefined\n\n return acc\n }, {} as { [K in keyof A]: A[K] | undefined })\n}\n\nconst fuseTypographyMarks = (\n values: Array<RichTextTypography | null | undefined>,\n breakpoints: Breakpoints,\n): RichTextTypography => {\n const devices = [\n ...new Set(\n values\n .filter(isNonNullable)\n .map(({ style }) => style.map(({ deviceId }) => deviceId))\n .reduce(concat, []),\n ),\n ] as BreakpointId[]\n\n return {\n id: values.map(v => v && v.id).reduce((a, b) => (a === b ? a : undefined)) ?? undefined,\n style: devices.map(deviceId =>\n values\n .map(\n v =>\n (v && findBreakpointOverride(breakpoints, v.style, deviceId)) || {\n deviceId,\n value: {},\n },\n )\n .reduce((acc, { value }) => {\n const a = intersection(acc.value, value)\n return {\n deviceId,\n value: a,\n }\n }),\n ),\n }\n}\n\nexport function getActiveTypographyMark(\n editor: Editor,\n breakpoints: Breakpoints,\n): RichTextTypography {\n const active: RichTextTypography[] = []\n\n const textNodes = Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => Text.isText(node),\n })\n\n for (const [node] of textNodes) {\n if (Text.isText(node) && 'typography' in node && node.typography != undefined) {\n active.push(node.typography)\n }\n }\n return active.length === 0 ? { style: [] } : fuseTypographyMarks(active, breakpoints)\n}\n","import { Editor, Transforms, Location } from 'slate'\nimport { getBlocksInSelection } from '../selectors'\nimport { ElementUtils } from '../utils/element'\nimport { EditableBlockKey, EditableBlockValue } from './types'\nimport { Breakpoints, BreakpointId, findBreakpointOverride } from '../../state/modules/breakpoints'\n\ntype SetBlockKeyForDeviceOptions = {\n at?: Location\n}\n\nexport function setBlockKeyForDevice(\n editor: Editor,\n breakpoints: Breakpoints,\n deviceId: BreakpointId,\n key: EditableBlockKey,\n value: EditableBlockValue[number]['value'],\n options?: SetBlockKeyForDeviceOptions,\n) {\n const at = options?.at ?? editor.selection\n if (!at) return\n\n const rootElements = getBlocksInSelection(editor)\n\n for (const [node, path] of rootElements) {\n if (ElementUtils.isBlock(node)) {\n const deviceValues = node[key] ?? []\n const currentDeviceValue = findBreakpointOverride(breakpoints, deviceValues, deviceId, v => v)\n const nextDeviceValue = {\n ...currentDeviceValue,\n deviceId,\n value,\n }\n Transforms.setNodes(\n editor,\n {\n [key]: [...deviceValues.filter(v => v.deviceId !== deviceId), nextDeviceValue],\n },\n { at: path },\n )\n }\n }\n}\n","import { Editor, Transforms } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { EditableBlockKey } from './types'\nimport { getBlocksInSelection } from '../selectors'\nimport { BreakpointId } from '../../state/modules/breakpoints'\n\nexport function clearBlockKeyForDevice(\n editor: Editor,\n deviceId: BreakpointId,\n key: EditableBlockKey,\n) {\n const rootElements = getBlocksInSelection(editor)\n\n for (const [node, path] of rootElements) {\n if (ElementUtils.isBlock(node)) {\n const deviceOverrides = node[key] ?? []\n Transforms.setNodes(\n editor,\n {\n [key]: deviceOverrides.filter(v => v.deviceId !== deviceId),\n },\n { at: path },\n )\n }\n }\n}\n","import { Editor, Transforms } from 'slate'\nimport { getSelection } from '../selectors'\nimport { Inline } from '../types'\n\nexport function wrapInline(editor: Editor, inline: Inline) {\n Transforms.wrapNodes(editor, inline, {\n at: getSelection(editor),\n split: true,\n })\n}\n","import { Editor, Transforms } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { getSelection } from '../selectors'\nimport { InlineType } from '../types'\n\nexport function unwrapInline(editor: Editor, type: InlineType) {\n Transforms.unwrapNodes(editor, {\n match: node => ElementUtils.isInline(node) && node.type === type,\n at: getSelection(editor),\n })\n}\n","import { Path, Editor, NodeEntry } from 'slate'\n\nimport { ElementUtils } from './element'\nimport { ListElement, ListItemElement } from '../types'\n\nexport const EditorUtils = {\n getFirstAncestorList(editor: Editor, path: Path): NodeEntry<ListElement> | null {\n try {\n const parentList = Editor.above(editor, {\n at: path,\n match: (node): node is ListElement => ElementUtils.isList(node),\n })\n return parentList ?? null\n } catch (e) {\n return null\n }\n },\n getFirstAncestorListItem(editor: Editor, path: Path): NodeEntry<ListItemElement> | null {\n try {\n const parentListItem = Editor.above(editor, {\n at: path,\n match: (node): node is ListItemElement => ElementUtils.isListItem(node),\n })\n\n return parentListItem ?? null\n } catch (e) {\n return null\n }\n },\n}\n","export const LIST_ITEM_CHILD_POSITION = 0\nexport const LIST_ITEM_LIST_POSITION = 1\n","import type { Node, NodeEntry } from 'slate'\nimport { Path } from 'slate'\n\nexport function filterForSubtreeRoots(entries: NodeEntry<Node>[]): NodeEntry<Node>[] {\n return entries.filter(\n ([, nodePath]) =>\n !Path.ancestors(nodePath).some(ancestor => {\n return entries.some(([, path]) => Path.equals(path, ancestor))\n }),\n )\n}\n","import { Editor, Element, Transforms, Path, Node, Location, Span } from 'slate'\nimport { EditorUtils } from '../utils/editor'\nimport { LIST_ITEM_CHILD_POSITION, LIST_ITEM_LIST_POSITION } from './constants'\nimport { filterForSubtreeRoots } from './utils/filterForSubtreeRoots'\nimport { ElementUtils } from '../utils/element'\nimport { BlockType } from '../types'\n\nexport function unwrapPath(editor: Editor, listItemPath: Path) {\n const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath)\n const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath)\n //if this is a nested item we don't want to unwrap it\n if (!parentList || listItemContainingParentList) return\n\n Editor.withoutNormalizing(editor, () => {\n const listItemTextPath = [...listItemPath, LIST_ITEM_CHILD_POSITION]\n const listItemNestedListPath = [...listItemPath, LIST_ITEM_LIST_POSITION]\n\n if (Node.has(editor, listItemNestedListPath)) {\n Transforms.setNodes(editor, { type: parentList[0].type }, { at: listItemNestedListPath })\n Transforms.liftNodes(editor, { at: listItemNestedListPath })\n Transforms.liftNodes(editor, { at: Path.next(listItemPath) })\n }\n\n if (Node.has(editor, listItemTextPath)) {\n Transforms.setNodes(\n editor,\n { type: BlockType.Paragraph },\n {\n at: listItemTextPath,\n },\n )\n Transforms.liftNodes(editor, { at: listItemTextPath })\n Transforms.liftNodes(editor, { at: listItemPath })\n }\n })\n}\n\ntype UnwrapListOptions = {\n at?: Location | Span\n}\n\nexport function unwrapList(editor: Editor, options?: UnwrapListOptions) {\n const at = options?.at ?? editor.selection\n if (!at) return\n\n const listItems = Array.from(\n Editor.nodes(editor, {\n at,\n match: node => {\n return Element.isElement(node) && ElementUtils.isListItem(node)\n },\n }),\n )\n const subRoots = filterForSubtreeRoots(listItems)\n const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path))\n\n refs.forEach(ref => {\n if (ref.current) {\n unwrapPath(editor, ref.current)\n }\n ref.unref()\n })\n}\n","import { Editor, Element, Location, Span, Transforms } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { BlockType } from '../types'\n\ntype WrapListOptions = {\n type: typeof BlockType.UnorderedList | typeof BlockType.OrderedList\n at?: Location | Span\n}\n\nexport function wrapList(\n editor: Editor,\n options: WrapListOptions = { type: BlockType.UnorderedList },\n) {\n const at = options.at ?? editor.selection\n if (!at) return\n\n const nonListEntries = Array.from(\n Editor.nodes(editor, {\n at,\n match: node => {\n return Element.isElement(node) && ElementUtils.isConvertibleToListTextNode(node)\n },\n }),\n )\n\n const refs = nonListEntries.map(([_, path]) => Editor.pathRef(editor, path))\n\n refs.forEach(ref => {\n const path = ref.current\n if (path) {\n Editor.withoutNormalizing(editor, () => {\n Transforms.setNodes(\n editor,\n { type: BlockType.ListItemChild },\n {\n at: path,\n },\n )\n Transforms.wrapNodes(editor, ElementUtils.createListItem(), {\n match: node => ElementUtils.isListItemChild(node),\n at: path,\n })\n Transforms.wrapNodes(editor, ElementUtils.createList(options.type), {\n at: path,\n })\n })\n }\n ref.unref()\n })\n}\n","import { Range, Point, Path, Location } from 'slate'\n\nexport const LocationUtils = {\n getStartPath(location: Location): Path {\n if (Range.isRange(location)) return Range.start(location).path\n if (Point.isPoint(location)) return location.path\n return location\n },\n}\n","import type { Element, NodeEntry } from 'slate'\nimport { Editor, Path } from 'slate'\nimport { EditorUtils } from '../../utils/editor'\nimport { ElementUtils } from '../../utils/element'\nimport { LocationUtils } from './location'\n\nexport function getSelectedListItems(editor: Editor): NodeEntry<Element>[] {\n if (!editor.selection) return []\n\n const start = LocationUtils.getStartPath(editor.selection)\n const listItems = Editor.nodes(editor, {\n at: editor.selection,\n match: node => ElementUtils.isListItem(node),\n })\n const firstAncestorPath = EditorUtils.getFirstAncestorListItem(editor, start)?.[1] ?? []\n\n return Array.from(listItems).filter((node): node is NodeEntry<Element> =>\n Path.isDescendant(start, node[1])\n ? Path.equals(node[1], firstAncestorPath)\n : !Path.isAfter(start, node[1]),\n )\n}\n","import { Editor, Node, Path, Transforms } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { LIST_ITEM_LIST_POSITION } from './constants'\nimport { filterForSubtreeRoots } from './utils/filterForSubtreeRoots'\nimport { getSelectedListItems } from './utils/getSelectedListItems'\n\nexport function indentPath(editor: Editor, path: Path) {\n const parent = Node.parent(editor, path)\n if (!path || !Path.hasPrevious(path) || !ElementUtils.isList(parent)) return\n\n const previosPath = Path.previous(path)\n\n const previousChildListPath = [...previosPath, LIST_ITEM_LIST_POSITION]\n const previousHasChildList = Node.has(editor, previousChildListPath)\n\n Editor.withoutNormalizing(editor, () => {\n if (!previousHasChildList) {\n Transforms.insertNodes(editor, ElementUtils.createList(parent.type), {\n at: previousChildListPath,\n })\n }\n\n const previousChildList = Node.get(editor, previousChildListPath)\n\n if (ElementUtils.isList(previousChildList)) {\n const index = previousHasChildList ? previousChildList.children.length : 0\n Transforms.moveNodes(editor, {\n at: path,\n to: [...previousChildListPath, index],\n })\n }\n })\n}\n\nexport function indent(editor: Editor) {\n if (!editor.selection) return\n\n const listItems = getSelectedListItems(editor)\n const subRoots = filterForSubtreeRoots(listItems)\n const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path))\n\n refs.forEach(ref => {\n if (ref.current) {\n indentPath(editor, ref.current)\n }\n ref.unref()\n })\n}\n","import { Editor, Path, Transforms } from 'slate'\nimport { indentPath } from './indent'\nimport { getSelectedListItems } from './utils/getSelectedListItems'\nimport { filterForSubtreeRoots } from './utils/filterForSubtreeRoots'\nimport { EditorUtils } from '../utils/editor'\n\nfunction dedentPath(editor: Editor, listItemPath: Path) {\n const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath)\n const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath)\n if (!parentList || !listItemContainingParentList) return\n\n const [parentListNode, parentListPath] = parentList\n const [_, listItemContainingParentListPath] = listItemContainingParentList\n\n const listItemPosition = listItemPath[listItemPath.length - 1]\n const previousSiblings = parentListNode.children.slice(0, listItemPosition)\n const nextSiblings = parentListNode.children.slice(listItemPosition + 1)\n\n Editor.withoutNormalizing(editor, () => {\n // put next siblings into list item\n nextSiblings.forEach(() => {\n const nextSiblingPath = [...parentListPath, listItemPosition + 1]\n indentPath(editor, nextSiblingPath)\n })\n // move list item to parent list\n Transforms.moveNodes(editor, {\n at: listItemPath,\n to: Path.next(listItemContainingParentListPath),\n })\n // delete old parent list if there are no other list items\n if (previousSiblings.length === 0) {\n Transforms.removeNodes(editor, { at: parentListPath })\n }\n })\n}\n\nexport function dedent(editor: Editor) {\n if (!editor.selection) return\n\n const listItems = getSelectedListItems(editor)\n const subRoots = filterForSubtreeRoots(listItems)\n const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path))\n\n refs.forEach(ref => {\n if (ref.current) {\n dedentPath(editor, ref.current)\n }\n ref.unref()\n })\n}\n","import { Editor, Location, Node, Path, Transforms } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { unwrapList } from './unwrapList'\nimport { LocationUtils } from './utils/location'\nimport { wrapList } from './wrapList'\nimport { BlockType } from '../types'\n\ntype ToggleListOptions = {\n type: typeof BlockType.UnorderedList | typeof BlockType.OrderedList\n at?: Location\n}\n\nexport function toggleList(\n editor: Editor,\n options: ToggleListOptions = { type: BlockType.UnorderedList },\n) {\n const at = options.at ?? editor.selection\n if (at == null) return\n const start = LocationUtils.getStartPath(at)\n const ancestorPath = Path.ancestors(start).at(1)\n if (!ancestorPath || !Node.has(editor, ancestorPath)) return\n const ancestor = Node.get(editor, ancestorPath)\n\n if (!ElementUtils.isList(ancestor)) {\n return wrapList(editor, { type: options.type, at })\n }\n\n if (ancestor.type === options.type) {\n unwrapList(editor, { at })\n } else {\n Transforms.setNodes(editor, { type: options.type }, { at: ancestorPath })\n }\n}\n","import type { KeyboardEvent } from 'react'\nimport { Editor, Transforms, Range, Node, PathRef, Text } from 'slate'\nimport { setBlockKeyForDevice } from './setBlockKeyForDevice'\nimport { clearBlockKeyForDevice } from './clearBlockKeyForDevice'\nimport { wrapInline } from './wrapInline'\nimport { unwrapInline } from './unwrapInline'\nimport { getSelection } from '../selectors'\nimport { ElementUtils } from '../utils/element'\nimport { RenderElement, Select, createRichTextV2Plugin } from '../../controls'\nimport { getActiveBlockType } from '../selectors'\nimport { BlockType, RootBlockType } from '../types'\nimport { unwrapList } from './unwrapList'\nimport { wrapList } from './wrapList'\nimport { indent } from './indent'\nimport { dedent } from './dedent'\nimport { toggleList } from './toggleList'\nimport { EditorUtils } from '../utils/editor'\nimport isHotkey from 'is-hotkey'\nimport { LIST_ITEM_CHILD_POSITION } from './constants'\nimport { useStyle } from '../../runtimes/react/use-style'\nimport { cx } from '@emotion/css'\nimport { RenderElementProps } from 'slate-react'\n\nexport const BlockActions = {\n setBlockKeyForDevice,\n clearBlockKeyForDevice,\n wrapInline,\n unwrapInline,\n}\n\n// TODO: This API is still litered with artifacts from the list plugin being seperated out.\n// This plugin needs to be rewritten to be assumptionless.\nexport const ListActions = {\n unwrapList,\n wrapList,\n indent,\n dedent,\n toggleList,\n}\n\nexport function onKeyDown(e: KeyboardEvent, editor: Editor) {\n if (\n !editor.selection ||\n Array.from(Editor.nodes(editor, { match: node => ElementUtils.isListItem(node) })).length === 0\n )\n return\n\n if (isHotkey('shift+tab', e)) {\n e.preventDefault()\n ListActions.dedent(editor)\n }\n\n if (isHotkey('tab', e)) {\n e.preventDefault()\n ListActions.indent(editor)\n }\n\n if (isHotkey('backspace', e)) {\n if (!editor.selection) return\n if (Range.isExpanded(editor.selection)) return\n const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path)\n if (editor.selection.anchor.offset === 0 && listItem) {\n e.preventDefault()\n const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1])\n const list = EditorUtils.getFirstAncestorList(editor, listItem[1])\n\n if (parentListItem) {\n ListActions.dedent(editor)\n } else if (list) {\n ListActions.unwrapList(editor)\n }\n return\n }\n }\n\n if (isHotkey('enter', e)) {\n e.preventDefault()\n\n if (!editor.selection) return\n\n if (Range.isExpanded(editor.selection)) {\n Transforms.delete(editor)\n return\n }\n\n const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path)\n if (\n editor.selection.anchor.offset === 0 &&\n listItem &&\n Editor.string(editor, listItem[1]) === ''\n ) {\n const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1])\n\n if (parentListItem) {\n ListActions.dedent(editor)\n } else {\n ListActions.unwrapList(editor)\n }\n return\n }\n\n Transforms.splitNodes(editor, {\n at: editor.selection,\n always: true,\n match: node => ElementUtils.isListItem(node),\n })\n }\n\n if (isHotkey('shift+enter', e)) {\n e.preventDefault()\n editor.insertText('\\n')\n }\n}\n\nexport function withBlock(editor: Editor) {\n const { normalizeNode } = editor\n\n editor.isInline = entry => {\n return ElementUtils.isInline(entry)\n }\n\n editor.normalizeNode = entry => {\n const [normalizationNode, normalizationPath] = entry\n // Normalization textAlign with empty array of values\n if (ElementUtils.isBlock(normalizationNode) && normalizationNode?.textAlign?.length == 0) {\n Transforms.unsetNodes(editor, 'textAlign', { at: normalizationPath })\n return\n }\n\n // Normalization for converting children of list items to list item children\n // In the case of backspace from position 0 of node into a list this converts the node into a list item.\n if (ElementUtils.isListItem(normalizationNode)) {\n const pathToListItemText = [...normalizationPath, LIST_ITEM_CHILD_POSITION]\n\n if (Node.has(editor, pathToListItemText)) {\n const nodeInListItemTextPosition = Node.get(editor, pathToListItemText)\n if (ElementUtils.isRootBlock(nodeInListItemTextPosition)) {\n Transforms.setNodes(\n editor,\n { type: BlockType.ListItemChild },\n {\n at: pathToListItemText,\n },\n )\n return\n }\n } else {\n Transforms.insertNodes(editor, ElementUtils.createListItem(), {\n at: pathToListItemText,\n })\n return\n }\n }\n\n // Normalization for merging adjacent lists of the same type\n if (!Text.isText(normalizationNode)) {\n const mergeableChildren = Array.from(Node.children(editor, normalizationPath))\n .map((child, index, children) => {\n const potentialNodeToBeMerged = children.at(index + 1)\n if (\n !potentialNodeToBeMerged ||\n !ElementUtils.isList(potentialNodeToBeMerged[0]) ||\n !ElementUtils.isList(child[0]) ||\n potentialNodeToBeMerged[0].type !== child[0].type\n ) {\n return null\n }\n return [\n Editor.pathRef(editor, child[1]),\n Editor.pathRef(editor, potentialNodeToBeMerged[1]),\n ]\n })\n .filter((mergeableNodes): mergeableNodes is PathRef[] => Boolean(mergeableNodes))\n\n if (mergeableChildren.length !== 0) {\n mergeableChildren.reverse().forEach(([nodePathRef, nodeToBeMergedPathRef]) => {\n const nodePath = nodePathRef.current\n const nodeToBeMergedPath = nodeToBeMergedPathRef.current\n if (nodePath == null || nodeToBeMergedPath == null) return\n const nodeChildren = Array.from(Node.children(editor, nodePath))\n const childrenToBeMerged = Array.from(Node.children(editor, nodeToBeMergedPath))\n Editor.withoutNormalizing(editor, () => {\n childrenToBeMerged.reverse().forEach(([_, childPath]) => {\n Transforms.moveNodes(editor, {\n at: childPath,\n to: [...nodePath, nodeChildren.length],\n })\n })\n Transforms.removeNodes(editor, { at: nodeToBeMergedPath })\n })\n nodePathRef.unref()\n nodeToBeMergedPathRef.unref()\n })\n return\n }\n }\n\n normalizeNode(entry)\n }\n\n return editor\n}\n\nconst definition = Select({\n label: 'Block',\n labelOrientation: 'horizontal',\n options: [\n {\n value: BlockType.Paragraph,\n label: 'Paragraph',\n },\n {\n value: BlockType.Heading1,\n label: 'Heading 1',\n },\n {\n value: BlockType.Heading2,\n label: 'Heading 2',\n },\n {\n value: BlockType.Heading3,\n label: 'Heading 3',\n },\n {\n value: BlockType.Heading4,\n label: 'Heading 4',\n },\n {\n value: BlockType.Heading5,\n label: 'Heading 5',\n },\n {\n value: BlockType.Heading6,\n label: 'Heading 6',\n },\n {\n value: BlockType.UnorderedList,\n label: 'Bulleted list',\n },\n {\n value: BlockType.OrderedList,\n label: 'Numbered list',\n },\n {\n value: BlockType.BlockQuote,\n label: 'Quote',\n },\n ],\n defaultValue: BlockType.Paragraph,\n})\n\nexport function BlockPlugin() {\n return createRichTextV2Plugin({\n withPlugin: withBlock,\n onKeyDown: onKeyDown,\n control: {\n definition,\n onChange: (editor, value) => {\n // TODO: This onChange being so complex is an artifact of how the List plugin used to be seperated out from the block plugin.\n // Would be great to refactor and simplify here.\n\n const activeBlockType = getActiveBlockType(editor)\n if (value === BlockType.UnorderedList || value === BlockType.OrderedList) {\n ListActions.toggleList(editor, {\n type: value,\n at: getSelection(editor),\n })\n } else if (activeBlockType === value) {\n Transforms.setNodes(\n editor,\n {\n type: BlockType.Default,\n },\n { at: getSelection(editor) },\n )\n } else {\n ListActions.unwrapList(editor, {\n at: getSelection(editor),\n })\n Transforms.setNodes(\n editor,\n {\n type: value ?? BlockType.Default,\n },\n { at: getSelection(editor) },\n )\n }\n },\n getValue: editor => {\n const activeBlock = getActiveBlockType(editor)\n\n if (activeBlock === RootBlockType.Text || activeBlock === RootBlockType.Default)\n return undefined\n\n return activeBlock\n },\n },\n renderElement: renderElement => props =>\n <BlockPluginComponent {...props} renderElement={renderElement} />,\n })\n}\n\nfunction BlockPluginComponent({\n element,\n attributes,\n children,\n renderElement,\n}: RenderElementProps & { renderElement: RenderElement }) {\n const blockStyles = [useStyle({ margin: 0 }), element.className]\n const quoteStyles = useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n })\n\n const listStyles = useStyle({\n listStylePosition: 'inside',\n paddingInlineStart: '20px',\n listStyleType: 'disc',\n })\n\n switch (element.type) {\n case BlockType.Text:\n return (\n <span {...attributes} className={cx(...blockStyles)}>\n {children}\n </span>\n )\n case BlockType.Paragraph:\n return (\n <p {...attributes} className={cx(...blockStyles)}>\n {children}\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote {...attributes} className={cx(...blockStyles, quoteStyles)}>\n {children}\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol {...attributes} className={cx(...blockStyles, listStyles)}>\n {children}\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul {...attributes} className={cx(...blockStyles, listStyles)}>\n {children}\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li {...attributes} className={cx(...blockStyles)}>\n {children}\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span {...attributes} className={cx(...blockStyles)}>\n {children}\n </span>\n )\n case BlockType.Default:\n return (\n <p {...attributes} className={cx(...blockStyles)}>\n {children}\n </p>\n )\n\n default:\n return <>{renderElement({ element, attributes, children })}</>\n }\n}\n","import { Node, NodeEntry } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { Inline, InlineType, LinkElement } from '../types'\nimport { IconRadioGroupOption, unstable_IconRadioGroupIcon } from '../../controls'\n\nexport type SupportedInlineType = Exclude<InlineType, 'link'>\nexport type SupportedInline = Exclude<Inline, LinkElement>\n\nexport const supportedInlineOptions: IconRadioGroupOption<SupportedInlineType>[] = [\n {\n icon: unstable_IconRadioGroupIcon.Superscript,\n label: 'Superscript',\n value: 'superscript',\n },\n {\n icon: unstable_IconRadioGroupIcon.Subscript,\n label: 'Subscript',\n value: 'subscript',\n },\n {\n icon: unstable_IconRadioGroupIcon.Code,\n label: 'Code',\n value: 'code',\n },\n]\n\nexport function isSupportedInlineType(inline: InlineType): inline is SupportedInlineType {\n return supportedInlineOptions.findIndex(option => option.value === inline) !== -1\n}\n\nexport function isSupportedInlineEntry(\n entry: NodeEntry<Node>,\n): entry is NodeEntry<SupportedInline> {\n const node = entry[0]\n return (\n ElementUtils.isInline(node) &&\n supportedInlineOptions.findIndex(option => option.value === node.type) !== -1\n )\n}\n"],"names":["BlockActions","setBlockKeyForDevice","clearBlockKeyForDevice","wrapInline","unwrapInline","ListActions","unwrapList","wrapList","indent","dedent","toggleList","e","editor","selection","Array","from","Editor","nodes","match","node","ElementUtils","isListItem","length","isHotkey","preventDefault","Range","isExpanded","listItem","EditorUtils","getFirstAncestorListItem","anchor","path","offset","parentListItem","list","getFirstAncestorList","Transforms","delete","string","splitNodes","at","always","insertText","normalizeNode","isInline","entry","normalizationNode","normalizationPath","isBlock","textAlign","unsetNodes","pathToListItemText","LIST_ITEM_CHILD_POSITION","Node","has","nodeInListItemTextPosition","get","isRootBlock","setNodes","type","BlockType","ListItemChild","insertNodes","createListItem","Text","isText","mergeableChildren","children","map","child","index","potentialNodeToBeMerged","isList","pathRef","filter","mergeableNodes","Boolean","reverse","forEach","nodePathRef","nodeToBeMergedPathRef","nodePath","current","nodeToBeMergedPath","nodeChildren","childrenToBeMerged","withoutNormalizing","_","childPath","moveNodes","to","removeNodes","unref","definition","Select","label","labelOrientation","options","value","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","UnorderedList","OrderedList","BlockQuote","defaultValue","createRichTextV2Plugin","withPlugin","withBlock","onKeyDown","control","onChange","activeBlockType","getActiveBlockType","getSelection","Default","getValue","activeBlock","RootBlockType","undefined","renderElement","props","_jsx","element","attributes","blockStyles","useStyle","margin","className","quoteStyles","padding","fontSize","fontWeight","borderLeft","listStyles","listStylePosition","paddingInlineStart","listStyleType","cx","ListItem","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,MAAM,eAAe;AAAA,EAC1B,YAAY,MAA+B;AACzC,WACE,QAAQ,UAAU,IAAI,KACrB,SAAQ,cAAc,MAAM,UAAU,SAAS,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,UAAU,KAChD,QAAQ,cAAc,MAAM,UAAU,aAAa,KACnD,QAAQ,cAAc,MAAM,UAAU,WAAW,KACjD,QAAQ,cAAc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B9D;AAAAA,MAAAA,EAFL;AAAA,SAKGP,UAAUC;AACb,0EACYmE;QAAY,WAAWc,GAAG,GAAGb,WAAJ;AAAA,QAChC9D;AAAAA,MAAAA,EAFL;AAAA,SAKGP,UAAU2D;AACb,uEACSS;QAAY,WAAWc,GAAG,GAAGb,WAAJ;AAAA,QAC7B9D;AAAAA,MAAAA,EAFL;AAAA;AAOO,iCAAA6E,UAAA;AAAA,QAAA,UAAGpB,cAAc;AAAA,UAAEG;AAAAA,UAASC;AAAAA,UAAY7D;AAAAA,QAAAA,CAAxB;AAAA,MAAA,CAAvB;AAAA;AAEL;ACnZM,MAAM,yBAAsE;AAAA,EACjF;AAAA,IACE,MAAM,4BAA4B;AAAA,IAClC,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM,4BAA4B;AAAA,IAClC,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM,4BAA4B;AAAA,IAClC,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AACF;AAEO,+BAA+B,QAAmD;AACvF,SAAO,uBAAuB,UAAU,CAAA,WAAU,OAAO,UAAU,MAAM,MAAM;AACjF;AAEO,gCACL,OACqC;AACrC,QAAM,OAAO,MAAM;AAEjB,SAAA,aAAa,SAAS,IAAI,KAC1B,uBAAuB,UAAU,CAAA,WAAU,OAAO,UAAU,KAAK,IAAI,MAAM;AAE/E;;"}
1
+ {"version":3,"file":"types.es2.js","sources":["../src/slate/utils/element.ts","../src/slate/utils/unhangRange.ts","../src/slate/selectors.ts","../src/slate/BlockPlugin/setBlockKeyForDevice.ts","../src/slate/BlockPlugin/clearBlockKeyForDevice.ts","../src/slate/BlockPlugin/wrapInline.ts","../src/slate/BlockPlugin/unwrapInline.ts","../src/slate/utils/editor.ts","../src/slate/BlockPlugin/constants.ts","../src/slate/BlockPlugin/utils/filterForSubtreeRoots.ts","../src/slate/BlockPlugin/unwrapList.ts","../src/slate/BlockPlugin/wrapList.ts","../src/slate/BlockPlugin/utils/location.ts","../src/slate/BlockPlugin/utils/getSelectedListItems.ts","../src/slate/BlockPlugin/indent.ts","../src/slate/BlockPlugin/dedent.ts","../src/slate/BlockPlugin/toggleList.ts","../src/slate/BlockPlugin/index.tsx","../src/slate/InlinePlugin/types.ts"],"sourcesContent":["import { Node, Element } from 'slate'\nimport {\n RootBlock,\n BlockType,\n Block,\n Inline,\n InlineType,\n OrderedListElement,\n UnorderedListElement,\n ListItemElement,\n ListItemChildElement,\n} from '../types'\n\nexport const ElementUtils = {\n isRootBlock(node: Node): node is RootBlock {\n return (\n Element.isElement(node) &&\n (Element.isElementType(node, BlockType.Paragraph) ||\n Element.isElementType(node, BlockType.Heading1) ||\n Element.isElementType(node, BlockType.Heading2) ||\n Element.isElementType(node, BlockType.Heading3) ||\n Element.isElementType(node, BlockType.Heading3) ||\n Element.isElementType(node, BlockType.Heading4) ||\n Element.isElementType(node, BlockType.Heading5) ||\n Element.isElementType(node, BlockType.Heading6) ||\n Element.isElementType(node, BlockType.BlockQuote) ||\n Element.isElementType(node, BlockType.UnorderedList) ||\n Element.isElementType(node, BlockType.OrderedList) ||\n Element.isElementType(node, BlockType.Text) ||\n Element.isElementType(node, BlockType.Default))\n )\n },\n isBlock(node: Node): node is Block {\n return (\n Element.isElement(node) &&\n (this.isRootBlock(node) ||\n Element.isElementType(node, BlockType.ListItem) ||\n Element.isElementType(node, BlockType.ListItemChild))\n )\n },\n isInline(node: Node): node is Inline {\n return (\n Element.isElementType(node, InlineType.Code) ||\n Element.isElementType(node, InlineType.Link) ||\n Element.isElementType(node, InlineType.SubScript) ||\n Element.isElementType(node, InlineType.SuperScript)\n )\n },\n isConvertibleToListTextNode(node: Node) {\n return !this.isList(node) && !this.isListItem(node) && !this.isListItemChild(node)\n },\n isList(node: Node): node is OrderedListElement | UnorderedListElement {\n return (\n Element.isElementType(node, BlockType.OrderedList) ||\n Element.isElementType(node, BlockType.UnorderedList)\n )\n },\n isListItem(node: Node): node is ListItemElement {\n return Element.isElementType(node, BlockType.ListItem)\n },\n isListItemChild(node: Node): node is ListItemChildElement {\n return Element.isElementType(node, BlockType.ListItemChild)\n },\n createText() {\n return { text: '' }\n },\n createParagraph() {\n return {\n children: [this.createText()],\n type: BlockType.Paragraph,\n }\n },\n createList(type: BlockType = BlockType.UnorderedList): Block {\n return { children: [this.createText()], type }\n },\n createListItem(): Block {\n return {\n children: [this.createListItemChild()],\n type: BlockType.ListItem,\n }\n },\n createListItemChild(): Block {\n return {\n children: [this.createText()],\n type: BlockType.ListItemChild,\n }\n },\n}\n","import { Editor, Range, Element, Text, Path } from 'slate'\n\n/**\n * The `Editor.unhangeRange` within Slate early exits if `Path.hasPrevious(end.path)` ie if this isn't a root block.\n * Unfortunately when you `setNode(..., {split:true})` or `wrapNodes()` you also have a hanging selection, but not in the root position.\n *\n * This c/p removes the `Path.hasPrevious(end.path)` from the early exit but it the same otherwise\n */\nfunction unhangRange(editor: Editor, range: Range): Range {\n // eslint-disable-next-line prefer-const\n let [start, end] = Range.edges(range)\n // PERF: exit early if we can guarantee that the range isn't hanging.\n if (start.offset !== 0 || end.offset !== 0 || Range.isCollapsed(range)) {\n return range\n }\n\n const endBlock = Editor.above(editor, {\n at: end,\n match: n => Element.isElement(n) && Editor.isBlock(editor, n),\n })\n const blockPath = endBlock ? endBlock[1] : []\n const first = Editor.start(editor, start)\n const before = { anchor: first, focus: end }\n let skip = true\n\n for (const [node, path] of Editor.nodes(editor, {\n at: before,\n match: Text.isText,\n reverse: true,\n })) {\n if (skip) {\n skip = false\n continue\n }\n\n if (node.text !== '' || Path.isBefore(path, blockPath)) {\n end = { path, offset: node.text.length }\n break\n }\n }\n\n return { anchor: start, focus: end }\n}\n\nexport default unhangRange\n","import { Editor, NodeEntry, Range, Text } from 'slate'\nimport { EditableBlockKey } from './BlockPlugin/types'\nimport { ElementUtils } from './utils/element'\n\nimport unhangRange from './utils/unhangRange'\nimport shallowEqual from '../utils/shallowEqual'\nimport { isNonNullable } from '../utils/isNonNullable'\n\nimport { Breakpoints, BreakpointId, findBreakpointOverride } from '../state/modules/breakpoints'\nimport deepEqual from '../utils/deepEqual'\nimport keys from '../utils/keys'\nimport {\n RootBlock,\n Inline,\n RootBlockType,\n ResponsiveBlockTextAlignment,\n BlockTextAlignment,\n RichTextTypography,\n} from './types'\n\nexport function getSelection(editor: Editor): Range {\n if (editor.selection) return unhangRange(editor, editor.selection)\n return {\n anchor: Editor.start(editor, []),\n focus: Editor.end(editor, []),\n }\n}\n\nexport function getBlocksInSelection(editor: Editor): NodeEntry<RootBlock>[] {\n return Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => ElementUtils.isRootBlock(node),\n }),\n ).filter((entry): entry is NodeEntry<RootBlock> => ElementUtils.isRootBlock(entry[0]))\n}\n\nexport function getInlinesInSelection(editor: Editor): NodeEntry<Inline>[] {\n return Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => ElementUtils.isInline(node),\n }),\n ).filter((entry): entry is NodeEntry<Inline> => ElementUtils.isInline(entry[0]))\n}\n\nexport function getActiveBlockType(editor: Editor): RootBlockType | null {\n const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type)\n\n return rootBlocks.reduce<RootBlockType | null>(\n (a, b) => (a === b ? b : null),\n rootBlocks.at(0) ?? null,\n )\n}\n\nexport function getActiveBlockValue(editor: Editor, key: EditableBlockKey) {\n const blocks = getBlocksInSelection(editor)\n\n const active = blocks.map(\n ([block]) => block[key] ?? null,\n ) as (ResponsiveBlockTextAlignment | null)[]\n\n return active.length === 0 ? null : active.reduce((a, b) => (shallowEqual(a, b) ? b : null))\n}\n\nexport function getActiveBlockDeviceOverrideValue(\n editor: Editor,\n key: EditableBlockKey,\n breakpoints: Breakpoints,\n deviceId: BreakpointId,\n) {\n const active: (BlockTextAlignment | null)[] = []\n const blocks = getBlocksInSelection(editor)\n\n blocks.forEach(([block]) => {\n const deviceOverride =\n findBreakpointOverride<BlockTextAlignment>(breakpoints, block[key], deviceId) || null\n active.push(deviceOverride?.value ?? null)\n })\n\n return active.length === 0 ? null : active.reduce((a, b) => (shallowEqual(a, b) ? b : null))\n}\n\n// Typography\n\nconst concat = (a: unknown[], b: unknown[]) => a.concat(b)\n\n// TODO: This is more cruft from trying to remove null from the typography type. This optimization is not worth it.\n/**\n * This is a c/p of the intersection of the utils from the root utils folder.\n * The only change is defaulting to undefined instead of to null.\n */\nexport default function intersection<A extends Record<string, unknown>, B extends A>(\n a: A,\n b: B,\n isEqual: (a: unknown, b: unknown) => boolean = deepEqual,\n): { [K in keyof A]: A[K] | undefined } {\n const allKeys = [...new Set([...keys(a), ...keys(b)])] as (keyof A)[]\n\n return allKeys.reduce((acc, k) => {\n if (isEqual(a[k], b[k])) acc[k] = a[k]\n else acc[k] = undefined\n\n return acc\n }, {} as { [K in keyof A]: A[K] | undefined })\n}\n\nconst fuseTypographyMarks = (\n values: Array<RichTextTypography | null | undefined>,\n breakpoints: Breakpoints,\n): RichTextTypography => {\n const devices = [\n ...new Set(\n values\n .filter(isNonNullable)\n .map(({ style }) => style.map(({ deviceId }) => deviceId))\n .reduce(concat, []),\n ),\n ] as BreakpointId[]\n\n return {\n id: values.map(v => v && v.id).reduce((a, b) => (a === b ? a : undefined)) ?? undefined,\n style: devices.map(deviceId =>\n values\n .map(\n v =>\n (v && findBreakpointOverride(breakpoints, v.style, deviceId)) || {\n deviceId,\n value: {},\n },\n )\n .reduce((acc, { value }) => {\n const a = intersection(acc.value, value)\n return {\n deviceId,\n value: a,\n }\n }),\n ),\n }\n}\n\nexport function getActiveTypographyMark(\n editor: Editor,\n breakpoints: Breakpoints,\n): RichTextTypography {\n const active: RichTextTypography[] = []\n\n const textNodes = Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => Text.isText(node),\n })\n\n for (const [node] of textNodes) {\n if (Text.isText(node) && 'typography' in node && node.typography != undefined) {\n active.push(node.typography)\n }\n }\n return active.length === 0 ? { style: [] } : fuseTypographyMarks(active, breakpoints)\n}\n","import { Editor, Transforms, Location } from 'slate'\nimport { getBlocksInSelection } from '../selectors'\nimport { ElementUtils } from '../utils/element'\nimport { EditableBlockKey, EditableBlockValue } from './types'\nimport { Breakpoints, BreakpointId, findBreakpointOverride } from '../../state/modules/breakpoints'\n\ntype SetBlockKeyForDeviceOptions = {\n at?: Location\n}\n\nexport function setBlockKeyForDevice(\n editor: Editor,\n breakpoints: Breakpoints,\n deviceId: BreakpointId,\n key: EditableBlockKey,\n value: EditableBlockValue[number]['value'],\n options?: SetBlockKeyForDeviceOptions,\n) {\n const at = options?.at ?? editor.selection\n if (!at) return\n\n const rootElements = getBlocksInSelection(editor)\n\n for (const [node, path] of rootElements) {\n if (ElementUtils.isBlock(node)) {\n const deviceValues = node[key] ?? []\n const currentDeviceValue = findBreakpointOverride(breakpoints, deviceValues, deviceId, v => v)\n const nextDeviceValue = {\n ...currentDeviceValue,\n deviceId,\n value,\n }\n Transforms.setNodes(\n editor,\n {\n [key]: [...deviceValues.filter(v => v.deviceId !== deviceId), nextDeviceValue],\n },\n { at: path },\n )\n }\n }\n}\n","import { Editor, Transforms } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { EditableBlockKey } from './types'\nimport { getBlocksInSelection } from '../selectors'\nimport { BreakpointId } from '../../state/modules/breakpoints'\n\nexport function clearBlockKeyForDevice(\n editor: Editor,\n deviceId: BreakpointId,\n key: EditableBlockKey,\n) {\n const rootElements = getBlocksInSelection(editor)\n\n for (const [node, path] of rootElements) {\n if (ElementUtils.isBlock(node)) {\n const deviceOverrides = node[key] ?? []\n Transforms.setNodes(\n editor,\n {\n [key]: deviceOverrides.filter(v => v.deviceId !== deviceId),\n },\n { at: path },\n )\n }\n }\n}\n","import { Editor, Transforms } from 'slate'\nimport { getSelection } from '../selectors'\nimport { Inline } from '../types'\n\nexport function wrapInline(editor: Editor, inline: Inline) {\n Transforms.wrapNodes(editor, inline, {\n at: getSelection(editor),\n split: true,\n })\n}\n","import { Editor, Transforms } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { getSelection } from '../selectors'\nimport { InlineType } from '../types'\n\nexport function unwrapInline(editor: Editor, type: InlineType) {\n Transforms.unwrapNodes(editor, {\n match: node => ElementUtils.isInline(node) && node.type === type,\n at: getSelection(editor),\n })\n}\n","import { Path, Editor, NodeEntry } from 'slate'\n\nimport { ElementUtils } from './element'\nimport { ListElement, ListItemElement } from '../types'\n\nexport const EditorUtils = {\n getFirstAncestorList(editor: Editor, path: Path): NodeEntry<ListElement> | null {\n try {\n const parentList = Editor.above(editor, {\n at: path,\n match: (node): node is ListElement => ElementUtils.isList(node),\n })\n return parentList ?? null\n } catch (e) {\n return null\n }\n },\n getFirstAncestorListItem(editor: Editor, path: Path): NodeEntry<ListItemElement> | null {\n try {\n const parentListItem = Editor.above(editor, {\n at: path,\n match: (node): node is ListItemElement => ElementUtils.isListItem(node),\n })\n\n return parentListItem ?? null\n } catch (e) {\n return null\n }\n },\n}\n","export const LIST_ITEM_CHILD_POSITION = 0\nexport const LIST_ITEM_LIST_POSITION = 1\n","import type { Node, NodeEntry } from 'slate'\nimport { Path } from 'slate'\n\nexport function filterForSubtreeRoots(entries: NodeEntry<Node>[]): NodeEntry<Node>[] {\n return entries.filter(\n ([, nodePath]) =>\n !Path.ancestors(nodePath).some(ancestor => {\n return entries.some(([, path]) => Path.equals(path, ancestor))\n }),\n )\n}\n","import { Editor, Element, Transforms, Path, Node, Location, Span } from 'slate'\nimport { EditorUtils } from '../utils/editor'\nimport { LIST_ITEM_CHILD_POSITION, LIST_ITEM_LIST_POSITION } from './constants'\nimport { filterForSubtreeRoots } from './utils/filterForSubtreeRoots'\nimport { ElementUtils } from '../utils/element'\nimport { BlockType } from '../types'\n\nexport function unwrapPath(editor: Editor, listItemPath: Path) {\n const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath)\n const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath)\n //if this is a nested item we don't want to unwrap it\n if (!parentList || listItemContainingParentList) return\n\n Editor.withoutNormalizing(editor, () => {\n const listItemTextPath = [...listItemPath, LIST_ITEM_CHILD_POSITION]\n const listItemNestedListPath = [...listItemPath, LIST_ITEM_LIST_POSITION]\n\n if (Node.has(editor, listItemNestedListPath)) {\n Transforms.setNodes(editor, { type: parentList[0].type }, { at: listItemNestedListPath })\n Transforms.liftNodes(editor, { at: listItemNestedListPath })\n Transforms.liftNodes(editor, { at: Path.next(listItemPath) })\n }\n\n if (Node.has(editor, listItemTextPath)) {\n Transforms.setNodes(\n editor,\n { type: BlockType.Paragraph },\n {\n at: listItemTextPath,\n },\n )\n Transforms.liftNodes(editor, { at: listItemTextPath })\n Transforms.liftNodes(editor, { at: listItemPath })\n }\n })\n}\n\ntype UnwrapListOptions = {\n at?: Location | Span\n}\n\nexport function unwrapList(editor: Editor, options?: UnwrapListOptions) {\n const at = options?.at ?? editor.selection\n if (!at) return\n\n const listItems = Array.from(\n Editor.nodes(editor, {\n at,\n match: node => {\n return Element.isElement(node) && ElementUtils.isListItem(node)\n },\n }),\n )\n const subRoots = filterForSubtreeRoots(listItems)\n const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path))\n\n refs.forEach(ref => {\n if (ref.current) {\n unwrapPath(editor, ref.current)\n }\n ref.unref()\n })\n}\n","import { Editor, Element, Location, Span, Transforms } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { BlockType } from '../types'\n\ntype WrapListOptions = {\n type: typeof BlockType.UnorderedList | typeof BlockType.OrderedList\n at?: Location | Span\n}\n\nexport function wrapList(\n editor: Editor,\n options: WrapListOptions = { type: BlockType.UnorderedList },\n) {\n const at = options.at ?? editor.selection\n if (!at) return\n\n const nonListEntries = Array.from(\n Editor.nodes(editor, {\n at,\n match: node => {\n return Element.isElement(node) && ElementUtils.isConvertibleToListTextNode(node)\n },\n }),\n )\n\n const refs = nonListEntries.map(([_, path]) => Editor.pathRef(editor, path))\n\n refs.forEach(ref => {\n const path = ref.current\n if (path) {\n Editor.withoutNormalizing(editor, () => {\n Transforms.setNodes(\n editor,\n { type: BlockType.ListItemChild },\n {\n at: path,\n },\n )\n Transforms.wrapNodes(editor, ElementUtils.createListItem(), {\n match: node => ElementUtils.isListItemChild(node),\n at: path,\n })\n Transforms.wrapNodes(editor, ElementUtils.createList(options.type), {\n at: path,\n })\n })\n }\n ref.unref()\n })\n}\n","import { Range, Point, Path, Location } from 'slate'\n\nexport const LocationUtils = {\n getStartPath(location: Location): Path {\n if (Range.isRange(location)) return Range.start(location).path\n if (Point.isPoint(location)) return location.path\n return location\n },\n}\n","import type { Element, NodeEntry } from 'slate'\nimport { Editor, Path } from 'slate'\nimport { EditorUtils } from '../../utils/editor'\nimport { ElementUtils } from '../../utils/element'\nimport { LocationUtils } from './location'\n\nexport function getSelectedListItems(editor: Editor): NodeEntry<Element>[] {\n if (!editor.selection) return []\n\n const start = LocationUtils.getStartPath(editor.selection)\n const listItems = Editor.nodes(editor, {\n at: editor.selection,\n match: node => ElementUtils.isListItem(node),\n })\n const firstAncestorPath = EditorUtils.getFirstAncestorListItem(editor, start)?.[1] ?? []\n\n return Array.from(listItems).filter((node): node is NodeEntry<Element> =>\n Path.isDescendant(start, node[1])\n ? Path.equals(node[1], firstAncestorPath)\n : !Path.isAfter(start, node[1]),\n )\n}\n","import { Editor, Node, Path, Transforms } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { LIST_ITEM_LIST_POSITION } from './constants'\nimport { filterForSubtreeRoots } from './utils/filterForSubtreeRoots'\nimport { getSelectedListItems } from './utils/getSelectedListItems'\n\nexport function indentPath(editor: Editor, path: Path) {\n const parent = Node.parent(editor, path)\n if (!path || !Path.hasPrevious(path) || !ElementUtils.isList(parent)) return\n\n const previosPath = Path.previous(path)\n\n const previousChildListPath = [...previosPath, LIST_ITEM_LIST_POSITION]\n const previousHasChildList = Node.has(editor, previousChildListPath)\n\n Editor.withoutNormalizing(editor, () => {\n if (!previousHasChildList) {\n Transforms.insertNodes(editor, ElementUtils.createList(parent.type), {\n at: previousChildListPath,\n })\n }\n\n const previousChildList = Node.get(editor, previousChildListPath)\n\n if (ElementUtils.isList(previousChildList)) {\n const index = previousHasChildList ? previousChildList.children.length : 0\n Transforms.moveNodes(editor, {\n at: path,\n to: [...previousChildListPath, index],\n })\n }\n })\n}\n\nexport function indent(editor: Editor) {\n if (!editor.selection) return\n\n const listItems = getSelectedListItems(editor)\n const subRoots = filterForSubtreeRoots(listItems)\n const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path))\n\n refs.forEach(ref => {\n if (ref.current) {\n indentPath(editor, ref.current)\n }\n ref.unref()\n })\n}\n","import { Editor, Path, Transforms } from 'slate'\nimport { indentPath } from './indent'\nimport { getSelectedListItems } from './utils/getSelectedListItems'\nimport { filterForSubtreeRoots } from './utils/filterForSubtreeRoots'\nimport { EditorUtils } from '../utils/editor'\n\nfunction dedentPath(editor: Editor, listItemPath: Path) {\n const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath)\n const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath)\n if (!parentList || !listItemContainingParentList) return\n\n const [parentListNode, parentListPath] = parentList\n const [_, listItemContainingParentListPath] = listItemContainingParentList\n\n const listItemPosition = listItemPath[listItemPath.length - 1]\n const previousSiblings = parentListNode.children.slice(0, listItemPosition)\n const nextSiblings = parentListNode.children.slice(listItemPosition + 1)\n\n Editor.withoutNormalizing(editor, () => {\n // put next siblings into list item\n nextSiblings.forEach(() => {\n const nextSiblingPath = [...parentListPath, listItemPosition + 1]\n indentPath(editor, nextSiblingPath)\n })\n // move list item to parent list\n Transforms.moveNodes(editor, {\n at: listItemPath,\n to: Path.next(listItemContainingParentListPath),\n })\n // delete old parent list if there are no other list items\n if (previousSiblings.length === 0) {\n Transforms.removeNodes(editor, { at: parentListPath })\n }\n })\n}\n\nexport function dedent(editor: Editor) {\n if (!editor.selection) return\n\n const listItems = getSelectedListItems(editor)\n const subRoots = filterForSubtreeRoots(listItems)\n const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path))\n\n refs.forEach(ref => {\n if (ref.current) {\n dedentPath(editor, ref.current)\n }\n ref.unref()\n })\n}\n","import { Editor, Location, Node, Path, Transforms } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { unwrapList } from './unwrapList'\nimport { LocationUtils } from './utils/location'\nimport { wrapList } from './wrapList'\nimport { BlockType } from '../types'\n\ntype ToggleListOptions = {\n type: typeof BlockType.UnorderedList | typeof BlockType.OrderedList\n at?: Location\n}\n\nexport function toggleList(\n editor: Editor,\n options: ToggleListOptions = { type: BlockType.UnorderedList },\n) {\n const at = options.at ?? editor.selection\n if (at == null) return\n const start = LocationUtils.getStartPath(at)\n const ancestorPath = Path.ancestors(start).at(1)\n if (!ancestorPath || !Node.has(editor, ancestorPath)) return\n const ancestor = Node.get(editor, ancestorPath)\n\n if (!ElementUtils.isList(ancestor)) {\n return wrapList(editor, { type: options.type, at })\n }\n\n if (ancestor.type === options.type) {\n unwrapList(editor, { at })\n } else {\n Transforms.setNodes(editor, { type: options.type }, { at: ancestorPath })\n }\n}\n","import type { KeyboardEvent } from 'react'\nimport { Editor, Transforms, Range, Node, PathRef, Text } from 'slate'\nimport { setBlockKeyForDevice } from './setBlockKeyForDevice'\nimport { clearBlockKeyForDevice } from './clearBlockKeyForDevice'\nimport { wrapInline } from './wrapInline'\nimport { unwrapInline } from './unwrapInline'\nimport { getSelection } from '../selectors'\nimport { ElementUtils } from '../utils/element'\nimport { RenderElement, Select, createRichTextV2Plugin } from '../../controls'\nimport { getActiveBlockType } from '../selectors'\nimport { BlockType, RootBlockType } from '../types'\nimport { unwrapList } from './unwrapList'\nimport { wrapList } from './wrapList'\nimport { indent } from './indent'\nimport { dedent } from './dedent'\nimport { toggleList } from './toggleList'\nimport { EditorUtils } from '../utils/editor'\nimport isHotkey from 'is-hotkey'\nimport { LIST_ITEM_CHILD_POSITION } from './constants'\nimport { useStyle } from '../../runtimes/react/use-style'\nimport { cx } from '@emotion/css'\nimport { RenderElementProps } from 'slate-react'\n\nexport const BlockActions = {\n setBlockKeyForDevice,\n clearBlockKeyForDevice,\n wrapInline,\n unwrapInline,\n}\n\n// TODO: This API is still litered with artifacts from the list plugin being seperated out.\n// This plugin needs to be rewritten to be assumptionless.\nexport const ListActions = {\n unwrapList,\n wrapList,\n indent,\n dedent,\n toggleList,\n}\n\nexport function onKeyDown(e: KeyboardEvent, editor: Editor) {\n if (\n !editor.selection ||\n Array.from(Editor.nodes(editor, { match: node => ElementUtils.isListItem(node) })).length === 0\n )\n return\n\n if (isHotkey('shift+tab', e)) {\n e.preventDefault()\n ListActions.dedent(editor)\n }\n\n if (isHotkey('tab', e)) {\n e.preventDefault()\n ListActions.indent(editor)\n }\n\n if (isHotkey('backspace', e)) {\n if (!editor.selection) return\n if (Range.isExpanded(editor.selection)) return\n const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path)\n if (editor.selection.anchor.offset === 0 && listItem) {\n e.preventDefault()\n const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1])\n const list = EditorUtils.getFirstAncestorList(editor, listItem[1])\n\n if (parentListItem) {\n ListActions.dedent(editor)\n } else if (list) {\n ListActions.unwrapList(editor)\n }\n return\n }\n }\n\n if (isHotkey('enter', e)) {\n e.preventDefault()\n\n if (!editor.selection) return\n\n if (Range.isExpanded(editor.selection)) {\n Transforms.delete(editor)\n return\n }\n\n const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path)\n if (\n editor.selection.anchor.offset === 0 &&\n listItem &&\n Editor.string(editor, listItem[1]) === ''\n ) {\n const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1])\n\n if (parentListItem) {\n ListActions.dedent(editor)\n } else {\n ListActions.unwrapList(editor)\n }\n return\n }\n\n Transforms.splitNodes(editor, {\n at: editor.selection,\n always: true,\n match: node => ElementUtils.isListItem(node),\n })\n }\n\n if (isHotkey('shift+enter', e)) {\n e.preventDefault()\n editor.insertText('\\n')\n }\n}\n\nexport function withBlock(editor: Editor) {\n const { normalizeNode } = editor\n\n editor.isInline = entry => {\n return ElementUtils.isInline(entry)\n }\n\n editor.normalizeNode = entry => {\n const [normalizationNode, normalizationPath] = entry\n // Normalization textAlign with empty array of values\n if (ElementUtils.isBlock(normalizationNode) && normalizationNode?.textAlign?.length == 0) {\n Transforms.unsetNodes(editor, 'textAlign', { at: normalizationPath })\n return\n }\n\n // Normalization for converting children of list items to list item children\n // In the case of backspace from position 0 of node into a list this converts the node into a list item.\n if (ElementUtils.isListItem(normalizationNode)) {\n const pathToListItemText = [...normalizationPath, LIST_ITEM_CHILD_POSITION]\n\n if (Node.has(editor, pathToListItemText)) {\n const nodeInListItemTextPosition = Node.get(editor, pathToListItemText)\n if (ElementUtils.isRootBlock(nodeInListItemTextPosition)) {\n Transforms.setNodes(\n editor,\n { type: BlockType.ListItemChild },\n {\n at: pathToListItemText,\n },\n )\n return\n }\n } else {\n Transforms.insertNodes(editor, ElementUtils.createListItem(), {\n at: pathToListItemText,\n })\n return\n }\n }\n\n // Normalization for merging adjacent lists of the same type\n if (!Text.isText(normalizationNode)) {\n const mergeableChildren = Array.from(Node.children(editor, normalizationPath))\n .map((child, index, children) => {\n const potentialNodeToBeMerged = children.at(index + 1)\n if (\n !potentialNodeToBeMerged ||\n !ElementUtils.isList(potentialNodeToBeMerged[0]) ||\n !ElementUtils.isList(child[0]) ||\n potentialNodeToBeMerged[0].type !== child[0].type\n ) {\n return null\n }\n return [\n Editor.pathRef(editor, child[1]),\n Editor.pathRef(editor, potentialNodeToBeMerged[1]),\n ]\n })\n .filter((mergeableNodes): mergeableNodes is PathRef[] => Boolean(mergeableNodes))\n\n if (mergeableChildren.length !== 0) {\n mergeableChildren.reverse().forEach(([nodePathRef, nodeToBeMergedPathRef]) => {\n const nodePath = nodePathRef.current\n const nodeToBeMergedPath = nodeToBeMergedPathRef.current\n if (nodePath == null || nodeToBeMergedPath == null) return\n const nodeChildren = Array.from(Node.children(editor, nodePath))\n const childrenToBeMerged = Array.from(Node.children(editor, nodeToBeMergedPath))\n Editor.withoutNormalizing(editor, () => {\n childrenToBeMerged.reverse().forEach(([_, childPath]) => {\n Transforms.moveNodes(editor, {\n at: childPath,\n to: [...nodePath, nodeChildren.length],\n })\n })\n Transforms.removeNodes(editor, { at: nodeToBeMergedPath })\n })\n nodePathRef.unref()\n nodeToBeMergedPathRef.unref()\n })\n return\n }\n }\n\n normalizeNode(entry)\n }\n\n return editor\n}\n\nconst definition = Select({\n label: 'Block',\n labelOrientation: 'horizontal',\n options: [\n {\n value: BlockType.Paragraph,\n label: 'Paragraph',\n },\n {\n value: BlockType.Heading1,\n label: 'Heading 1',\n },\n {\n value: BlockType.Heading2,\n label: 'Heading 2',\n },\n {\n value: BlockType.Heading3,\n label: 'Heading 3',\n },\n {\n value: BlockType.Heading4,\n label: 'Heading 4',\n },\n {\n value: BlockType.Heading5,\n label: 'Heading 5',\n },\n {\n value: BlockType.Heading6,\n label: 'Heading 6',\n },\n {\n value: BlockType.UnorderedList,\n label: 'Bulleted list',\n },\n {\n value: BlockType.OrderedList,\n label: 'Numbered list',\n },\n {\n value: BlockType.BlockQuote,\n label: 'Quote',\n },\n ],\n defaultValue: BlockType.Paragraph,\n})\n\nexport function BlockPlugin() {\n return createRichTextV2Plugin({\n withPlugin: withBlock,\n onKeyDown: onKeyDown,\n control: {\n definition,\n onChange: (editor, value) => {\n // TODO: This onChange being so complex is an artifact of how the List plugin used to be seperated out from the block plugin.\n // Would be great to refactor and simplify here.\n\n const activeBlockType = getActiveBlockType(editor)\n if (value === BlockType.UnorderedList || value === BlockType.OrderedList) {\n ListActions.toggleList(editor, {\n type: value,\n at: getSelection(editor),\n })\n } else if (activeBlockType === value) {\n Transforms.setNodes(\n editor,\n {\n type: BlockType.Default,\n },\n { at: getSelection(editor) },\n )\n } else {\n ListActions.unwrapList(editor, {\n at: getSelection(editor),\n })\n Transforms.setNodes(\n editor,\n {\n type: value ?? BlockType.Default,\n },\n { at: getSelection(editor) },\n )\n }\n },\n getValue: editor => {\n const activeBlock = getActiveBlockType(editor)\n\n if (activeBlock === RootBlockType.Text || activeBlock === RootBlockType.Default)\n return undefined\n\n return activeBlock\n },\n },\n renderElement: renderElement => props =>\n <BlockPluginComponent {...props} renderElement={renderElement} />,\n })\n}\n\nfunction BlockPluginComponent({\n element,\n attributes,\n children,\n renderElement,\n}: RenderElementProps & { renderElement: RenderElement }) {\n const blockStyles = [useStyle({ margin: 0 }), element.className]\n const quoteStyles = useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n })\n\n const listStyles = useStyle({\n listStylePosition: 'inside',\n paddingInlineStart: '20px',\n listStyleType: 'disc',\n })\n\n switch (element.type) {\n case BlockType.Text:\n return (\n <span {...attributes} className={cx(...blockStyles)}>\n {children}\n </span>\n )\n case BlockType.Default:\n case BlockType.Paragraph:\n return (\n <p {...attributes} className={cx(...blockStyles)}>\n {children}\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 {...attributes} className={cx(...blockStyles)}>\n {children}\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote {...attributes} className={cx(...blockStyles, quoteStyles)}>\n {children}\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol {...attributes} className={cx(...blockStyles, listStyles)}>\n {children}\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul {...attributes} className={cx(...blockStyles, listStyles)}>\n {children}\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li {...attributes} className={cx(...blockStyles)}>\n {children}\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span {...attributes} className={cx(...blockStyles)}>\n {children}\n </span>\n )\n default:\n return <>{renderElement({ element, attributes, children })}</>\n }\n}\n","import { Node, NodeEntry } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { Inline, InlineType, LinkElement } from '../types'\nimport { IconRadioGroupOption, unstable_IconRadioGroupIcon } from '../../controls'\n\nexport type SupportedInlineType = Exclude<InlineType, 'link'>\nexport type SupportedInline = Exclude<Inline, LinkElement>\n\nexport const supportedInlineOptions: IconRadioGroupOption<SupportedInlineType>[] = [\n {\n icon: unstable_IconRadioGroupIcon.Superscript,\n label: 'Superscript',\n value: 'superscript',\n },\n {\n icon: unstable_IconRadioGroupIcon.Subscript,\n label: 'Subscript',\n value: 'subscript',\n },\n {\n icon: unstable_IconRadioGroupIcon.Code,\n label: 'Code',\n value: 'code',\n },\n]\n\nexport function isSupportedInlineType(inline: InlineType): inline is SupportedInlineType {\n return supportedInlineOptions.findIndex(option => option.value === inline) !== -1\n}\n\nexport function isSupportedInlineEntry(\n entry: NodeEntry<Node>,\n): entry is NodeEntry<SupportedInline> {\n const node = entry[0]\n return (\n ElementUtils.isInline(node) &&\n supportedInlineOptions.findIndex(option => option.value === node.type) !== -1\n )\n}\n"],"names":["BlockActions","setBlockKeyForDevice","clearBlockKeyForDevice","wrapInline","unwrapInline","ListActions","unwrapList","wrapList","indent","dedent","toggleList","e","editor","selection","Array","from","Editor","nodes","match","node","ElementUtils","isListItem","length","isHotkey","preventDefault","Range","isExpanded","listItem","EditorUtils","getFirstAncestorListItem","anchor","path","offset","parentListItem","list","getFirstAncestorList","Transforms","delete","string","splitNodes","at","always","insertText","normalizeNode","isInline","entry","normalizationNode","normalizationPath","isBlock","textAlign","unsetNodes","pathToListItemText","LIST_ITEM_CHILD_POSITION","Node","has","nodeInListItemTextPosition","get","isRootBlock","setNodes","type","BlockType","ListItemChild","insertNodes","createListItem","Text","isText","mergeableChildren","children","map","child","index","potentialNodeToBeMerged","isList","pathRef","filter","mergeableNodes","Boolean","reverse","forEach","nodePathRef","nodeToBeMergedPathRef","nodePath","current","nodeToBeMergedPath","nodeChildren","childrenToBeMerged","withoutNormalizing","_","childPath","moveNodes","to","removeNodes","unref","definition","Select","label","labelOrientation","options","value","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","UnorderedList","OrderedList","BlockQuote","defaultValue","createRichTextV2Plugin","withPlugin","withBlock","onKeyDown","control","onChange","activeBlockType","getActiveBlockType","getSelection","Default","getValue","activeBlock","RootBlockType","undefined","renderElement","props","_jsx","element","attributes","blockStyles","useStyle","margin","className","quoteStyles","padding","fontSize","fontWeight","borderLeft","listStyles","listStylePosition","paddingInlineStart","listStyleType","cx","ListItem","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,MAAM,eAAe;AAAA,EAC1B,YAAY,MAA+B;AACzC,WACE,QAAQ,UAAU,IAAI,KACrB,SAAQ,cAAc,MAAM,UAAU,SAAS,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,QAAQ,KAC9C,QAAQ,cAAc,MAAM,UAAU,UAAU,KAChD,QAAQ,cAAc,MAAM,UAAU,aAAa,KACnD,QAAQ,cAAc,MAAM,UAAU,WAAW,KACjD,QAAQ,cAAc,MAAM,UAAU,IAAI,KAC1C,QAAQ,cAAc,MAAM,UAAU,OAAO;AAAA,EAEnD;AAAA,EACA,QAAQ,MAA2B;AACjC,WACE,QAAQ,UAAU,IAAI,KAChB,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AAA,MAAAA,EAFL;AAAA;AAMO,iCAAA6E,UAAA;AAAA,QAAA,UAAGpB,cAAc;AAAA,UAAEG;AAAAA,UAASC;AAAAA,UAAY7D;AAAAA,QAAAA,CAAxB;AAAA,MAAA,CAAvB;AAAA;AAEL;AC7YM,MAAM,yBAAsE;AAAA,EACjF;AAAA,IACE,MAAM,4BAA4B;AAAA,IAClC,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM,4BAA4B;AAAA,IAClC,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM,4BAA4B;AAAA,IAClC,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AACF;AAEO,+BAA+B,QAAmD;AACvF,SAAO,uBAAuB,UAAU,CAAA,WAAU,OAAO,UAAU,MAAM,MAAM;AACjF;AAEO,gCACL,OACqC;AACrC,QAAM,OAAO,MAAM;AAEjB,SAAA,aAAa,SAAS,IAAI,KAC1B,uBAAuB,UAAU,CAAA,WAAU,OAAO,UAAU,KAAK,IAAI,MAAM;AAE/E;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"typography.cjs.js","sources":["../src/controls/checkbox.ts","../src/controls/icon-radio-group.ts","../src/controls/number.ts","../src/controls/select.ts","../src/controls/text-area.ts","../src/controls/text-input.ts","../src/controls/typography.ts"],"sourcesContent":["export type CheckboxControlData = boolean\n\nexport const CheckboxControlType = 'makeswift::controls::checkbox'\n\ntype CheckboxControlConfig = {\n label?: string\n defaultValue?: boolean\n}\n\nexport type CheckboxControlDefinition<C extends CheckboxControlConfig = CheckboxControlConfig> = {\n type: typeof CheckboxControlType\n config: C\n}\n\nexport function Checkbox<C extends CheckboxControlConfig>(\n config: C = {} as C,\n): CheckboxControlDefinition<C> {\n return { type: CheckboxControlType, config }\n}\n","export const unstable_IconRadioGroupIcon = {\n TextAlignCenter: 'TextAlignCenter',\n TextAlignJustify: 'TextAlignJustify',\n TextAlignLeft: 'TextAlignLeft',\n TextAlignRight: 'TextAlignRight',\n Superscript: 'Superscript16',\n Subscript: 'Subscript16',\n Code: 'Code16',\n} as const\n\nexport type IconRadioGroupIcon =\n typeof unstable_IconRadioGroupIcon[keyof typeof unstable_IconRadioGroupIcon]\n\nexport const IconRadioGroupControlType = 'makeswift::controls::icon-radio-group'\n\nexport type IconRadioGroupOption<T extends string> = {\n value: T\n icon: IconRadioGroupIcon\n label: string\n}\n\ntype IconRadioGroupControlConfig<T extends string = string> = {\n label?: string\n defaultValue?: T\n options: IconRadioGroupOption<T>[]\n}\n\nexport type IconRadioGroupControlDefinition<\n C extends IconRadioGroupControlConfig = IconRadioGroupControlConfig,\n> = {\n type: typeof IconRadioGroupControlType\n config: C\n}\n\nexport type IconRadioGroupControlDefinitionOption<\n T extends IconRadioGroupControlDefinition = IconRadioGroupControlDefinition,\n> = T['config'] extends IconRadioGroupControlConfig<infer U> ? U : never\n\nexport type IconRadioGroupControlData<\n T extends IconRadioGroupControlDefinition = IconRadioGroupControlDefinition,\n> = IconRadioGroupControlDefinitionOption<T> | null\n\nexport function unstable_IconRadioGroup<T extends string, C extends IconRadioGroupControlConfig<T>>(\n config: C & { options: IconRadioGroupOption<T>[] },\n): IconRadioGroupControlDefinition<C> {\n return { type: IconRadioGroupControlType, config }\n}\n","export type NumberControlData = number\n\nexport const NumberControlType = 'makeswift::controls::number'\n\ntype NumberControlConfig = {\n label?: string\n labelOrientation?: 'vertical' | 'horizontal'\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n}\n\nexport type NumberControlDefinition<C extends NumberControlConfig = NumberControlConfig> = {\n type: typeof NumberControlType\n config: C\n}\n\nexport function Number<C extends NumberControlConfig>(\n config: C = {} as C,\n): NumberControlDefinition<C> {\n return { type: NumberControlType, config }\n}\n","export const SelectControlType = 'makeswift::controls::select'\n\ntype SelectControlOption<T extends string> = { value: T; label: string }\n\ntype SelectControlConfig<T extends string = string> = {\n label?: string\n labelOrientation?: 'horizontal' | 'vertical'\n options: SelectControlOption<T>[]\n defaultValue?: T\n}\n\nexport type SelectControlDefinition<C extends SelectControlConfig = SelectControlConfig> = {\n type: typeof SelectControlType\n config: C\n}\n\nexport type SelectControlDefinitionOption<T extends SelectControlDefinition> =\n T['config'] extends SelectControlConfig<infer U> ? U : never\n\nexport type SelectControlData<T extends SelectControlDefinition = SelectControlDefinition> =\n SelectControlDefinitionOption<T> | null\n\nexport function Select<T extends string, C extends SelectControlConfig<T>>(\n config: C & { options: SelectControlOption<T>[] },\n): SelectControlDefinition<C> {\n return { type: SelectControlType, config }\n}\n","export type TextAreaControlData = string\n\nexport const TextAreaControlType = 'makeswift::controls::text-area'\n\ntype TextAreaControlConfig = {\n label?: string\n defaultValue?: string\n rows?: number\n}\n\nexport type TextAreaControlDefinition<C extends TextAreaControlConfig = TextAreaControlConfig> = {\n type: typeof TextAreaControlType\n config: C\n}\n\nexport function TextArea<C extends TextAreaControlConfig>(\n config: C = {} as C,\n): TextAreaControlDefinition<C> {\n return { type: TextAreaControlType, config }\n}\n","export type TextInputControlData = string\n\nexport const TextInputControlType = 'makeswift::controls::text-input'\n\ntype TextInputControlConfig = {\n label?: string\n defaultValue?: string\n}\n\nexport type TextInputControlDefinition<C extends TextInputControlConfig = TextInputControlConfig> =\n {\n type: typeof TextInputControlType\n config: C\n }\n\nexport function TextInput<C extends TextInputControlConfig>(\n config: C = {} as C,\n): TextInputControlDefinition<C> {\n return { type: TextInputControlType, config }\n}\n","export type TypographyControlData = {\n id?: string\n style: Array<{\n deviceId: string\n value: {\n fontFamily?: string | null\n lineHeight?: number | null\n letterSpacing?: number | null\n fontWeight?: number | null\n textAlign?: string | null\n uppercase?: boolean | null\n underline?: boolean | null\n strikethrough?: boolean | null\n italic?: boolean | null\n fontSize?: { value: number | null; unit: string | null } | null\n color?: { swatchId: string | null; alpha: number | null } | null\n }\n }>\n} | null\n\nexport const TypographyControlType = 'makeswift::controls::typography'\n\nexport type TypographyControlDefinition = {\n type: typeof TypographyControlType\n}\n\nexport function unstable_Typography(): TypographyControlDefinition {\n return {\n type: TypographyControlType,\n }\n}\n"],"names":[],"mappings":";AAEO,MAAM,sBAAsB;AAajC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;AClBO,MAAM,8BAA8B;AAAA,EACzC,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,MAAM;AACR;AAKO,MAAM,4BAA4B;AA6BlC,iCACL,QACoC;AAC7B,SAAA,EAAE,MAAM,2BAA2B;AAC5C;AC5CO,MAAM,oBAAoB;AAkB/B,gBAAA,SAAY,IACgB;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;ACvBO,MAAM,oBAAoB;AAsB1B,gBACL,QAC4B;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;ACxBO,MAAM,sBAAsB;AAcjC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;ACjBO,MAAM,uBAAuB;AAclC,mBAAA,SAAY,IACmB;AACxB,SAAA,EAAE,MAAM,sBAAsB;AACvC;ACCO,MAAM,wBAAwB;AAM8B,+BAAA;AAC1D,SAAA;AAAA,IACL,MAAM;AAAA,EAAA;AAEV;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"typography.cjs.js","sources":["../src/controls/checkbox.ts","../src/controls/icon-radio-group.ts","../src/controls/number.ts","../src/controls/select.ts","../src/controls/text-area.ts","../src/controls/text-input.ts","../src/controls/typography.ts"],"sourcesContent":["export type CheckboxControlData = boolean\n\nexport const CheckboxControlType = 'makeswift::controls::checkbox'\n\ntype CheckboxControlConfig = {\n label?: string\n defaultValue?: boolean\n}\n\nexport type CheckboxControlDefinition<C extends CheckboxControlConfig = CheckboxControlConfig> = {\n type: typeof CheckboxControlType\n config: C\n}\n\nexport function Checkbox<C extends CheckboxControlConfig>(\n config: C = {} as C,\n): CheckboxControlDefinition<C> {\n return { type: CheckboxControlType, config }\n}\n","export const unstable_IconRadioGroupIcon = {\n TextAlignCenter: 'TextAlignCenter',\n TextAlignJustify: 'TextAlignJustify',\n TextAlignLeft: 'TextAlignLeft',\n TextAlignRight: 'TextAlignRight',\n Superscript: 'Superscript16',\n Subscript: 'Subscript16',\n Code: 'Code16',\n} as const\n\nexport type IconRadioGroupIcon =\n typeof unstable_IconRadioGroupIcon[keyof typeof unstable_IconRadioGroupIcon]\n\nexport const IconRadioGroupControlType = 'makeswift::controls::icon-radio-group'\n\nexport type IconRadioGroupOption<T extends string> = {\n value: T\n icon: IconRadioGroupIcon\n label: string\n}\n\ntype IconRadioGroupControlConfig<T extends string = string> = {\n label?: string\n defaultValue?: T\n options: IconRadioGroupOption<T>[]\n}\n\nexport type IconRadioGroupControlDefinition<\n C extends IconRadioGroupControlConfig = IconRadioGroupControlConfig,\n> = {\n type: typeof IconRadioGroupControlType\n config: C\n}\n\nexport type IconRadioGroupControlDefinitionOption<\n T extends IconRadioGroupControlDefinition = IconRadioGroupControlDefinition,\n> = T['config'] extends IconRadioGroupControlConfig<infer U> ? U : never\n\nexport type IconRadioGroupControlData<\n T extends IconRadioGroupControlDefinition = IconRadioGroupControlDefinition,\n> = IconRadioGroupControlDefinitionOption<T> | null\n\nexport function unstable_IconRadioGroup<T extends string, C extends IconRadioGroupControlConfig<T>>(\n config: C & { options: IconRadioGroupOption<T>[] },\n): IconRadioGroupControlDefinition<C> {\n return { type: IconRadioGroupControlType, config }\n}\n","export type NumberControlData = number\n\nexport const NumberControlType = 'makeswift::controls::number'\n\ntype NumberControlConfig = {\n label?: string\n labelOrientation?: 'vertical' | 'horizontal'\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n}\n\nexport type NumberControlDefinition<C extends NumberControlConfig = NumberControlConfig> = {\n type: typeof NumberControlType\n config: C\n}\n\nexport function Number<C extends NumberControlConfig>(\n config: C = {} as C,\n): NumberControlDefinition<C> {\n return { type: NumberControlType, config }\n}\n","export const SelectControlType = 'makeswift::controls::select'\n\ntype SelectControlOption<T extends string> = { value: T; label: string }\n\ntype SelectControlConfig<T extends string = string> = {\n label?: string\n labelOrientation?: 'horizontal' | 'vertical'\n options: SelectControlOption<T>[]\n defaultValue?: T\n}\n\nexport type SelectControlDefinition<C extends SelectControlConfig = SelectControlConfig> = {\n type: typeof SelectControlType\n config: C\n}\n\nexport type SelectControlDefinitionOption<T extends SelectControlDefinition> =\n T['config'] extends SelectControlConfig<infer U> ? U : never\n\nexport type SelectControlData<T extends SelectControlDefinition = SelectControlDefinition> =\n SelectControlDefinitionOption<T> | null\n\nexport function Select<T extends string, C extends SelectControlConfig<T>>(\n config: C & { options: SelectControlOption<T>[] },\n): SelectControlDefinition<C> {\n return { type: SelectControlType, config }\n}\n","export type TextAreaControlData = string\n\nexport const TextAreaControlType = 'makeswift::controls::text-area'\n\ntype TextAreaControlConfig = {\n label?: string\n defaultValue?: string\n rows?: number\n}\n\nexport type TextAreaControlDefinition<C extends TextAreaControlConfig = TextAreaControlConfig> = {\n type: typeof TextAreaControlType\n config: C\n}\n\nexport function TextArea<C extends TextAreaControlConfig>(\n config: C = {} as C,\n): TextAreaControlDefinition<C> {\n return { type: TextAreaControlType, config }\n}\n","export type TextInputControlData = string\n\nexport const TextInputControlType = 'makeswift::controls::text-input'\n\ntype TextInputControlConfig = {\n label?: string\n defaultValue?: string\n}\n\nexport type TextInputControlDefinition<C extends TextInputControlConfig = TextInputControlConfig> =\n {\n type: typeof TextInputControlType\n config: C\n }\n\nexport function TextInput<C extends TextInputControlConfig>(\n config: C = {} as C,\n): TextInputControlDefinition<C> {\n return { type: TextInputControlType, config }\n}\n","export type TypographyControlData = (\n | {\n id?: string\n style: Array<{\n deviceId: string\n value: {\n fontFamily?: string | null\n lineHeight?: number | null\n letterSpacing?: number | null\n fontWeight?: number | null\n textAlign?: string | null\n uppercase?: boolean | null\n underline?: boolean | null\n strikethrough?: boolean | null\n italic?: boolean | null\n fontSize?: { value: number | null; unit: string | null } | null\n color?: { swatchId: string | null; alpha: number | null } | null\n }\n }>\n }\n | undefined\n)[]\n\nexport const TypographyControlType = 'makeswift::controls::typography'\n\nexport type TypographyControlDefinition = {\n type: typeof TypographyControlType\n}\n\nexport function unstable_Typography(): TypographyControlDefinition {\n return {\n type: TypographyControlType,\n }\n}\n"],"names":[],"mappings":";AAEO,MAAM,sBAAsB;AAajC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;AClBO,MAAM,8BAA8B;AAAA,EACzC,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,MAAM;AACR;AAKO,MAAM,4BAA4B;AA6BlC,iCACL,QACoC;AAC7B,SAAA,EAAE,MAAM,2BAA2B;AAC5C;AC5CO,MAAM,oBAAoB;AAkB/B,gBAAA,SAAY,IACgB;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;ACvBO,MAAM,oBAAoB;AAsB1B,gBACL,QAC4B;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;ACxBO,MAAM,sBAAsB;AAcjC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;ACjBO,MAAM,uBAAuB;AAclC,mBAAA,SAAY,IACmB;AACxB,SAAA,EAAE,MAAM,sBAAsB;AACvC;ACIO,MAAM,wBAAwB;AAM8B,+BAAA;AAC1D,SAAA;AAAA,IACL,MAAM;AAAA,EAAA;AAEV;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"typography.es.js","sources":["../src/controls/checkbox.ts","../src/controls/icon-radio-group.ts","../src/controls/number.ts","../src/controls/select.ts","../src/controls/text-area.ts","../src/controls/text-input.ts","../src/controls/typography.ts"],"sourcesContent":["export type CheckboxControlData = boolean\n\nexport const CheckboxControlType = 'makeswift::controls::checkbox'\n\ntype CheckboxControlConfig = {\n label?: string\n defaultValue?: boolean\n}\n\nexport type CheckboxControlDefinition<C extends CheckboxControlConfig = CheckboxControlConfig> = {\n type: typeof CheckboxControlType\n config: C\n}\n\nexport function Checkbox<C extends CheckboxControlConfig>(\n config: C = {} as C,\n): CheckboxControlDefinition<C> {\n return { type: CheckboxControlType, config }\n}\n","export const unstable_IconRadioGroupIcon = {\n TextAlignCenter: 'TextAlignCenter',\n TextAlignJustify: 'TextAlignJustify',\n TextAlignLeft: 'TextAlignLeft',\n TextAlignRight: 'TextAlignRight',\n Superscript: 'Superscript16',\n Subscript: 'Subscript16',\n Code: 'Code16',\n} as const\n\nexport type IconRadioGroupIcon =\n typeof unstable_IconRadioGroupIcon[keyof typeof unstable_IconRadioGroupIcon]\n\nexport const IconRadioGroupControlType = 'makeswift::controls::icon-radio-group'\n\nexport type IconRadioGroupOption<T extends string> = {\n value: T\n icon: IconRadioGroupIcon\n label: string\n}\n\ntype IconRadioGroupControlConfig<T extends string = string> = {\n label?: string\n defaultValue?: T\n options: IconRadioGroupOption<T>[]\n}\n\nexport type IconRadioGroupControlDefinition<\n C extends IconRadioGroupControlConfig = IconRadioGroupControlConfig,\n> = {\n type: typeof IconRadioGroupControlType\n config: C\n}\n\nexport type IconRadioGroupControlDefinitionOption<\n T extends IconRadioGroupControlDefinition = IconRadioGroupControlDefinition,\n> = T['config'] extends IconRadioGroupControlConfig<infer U> ? U : never\n\nexport type IconRadioGroupControlData<\n T extends IconRadioGroupControlDefinition = IconRadioGroupControlDefinition,\n> = IconRadioGroupControlDefinitionOption<T> | null\n\nexport function unstable_IconRadioGroup<T extends string, C extends IconRadioGroupControlConfig<T>>(\n config: C & { options: IconRadioGroupOption<T>[] },\n): IconRadioGroupControlDefinition<C> {\n return { type: IconRadioGroupControlType, config }\n}\n","export type NumberControlData = number\n\nexport const NumberControlType = 'makeswift::controls::number'\n\ntype NumberControlConfig = {\n label?: string\n labelOrientation?: 'vertical' | 'horizontal'\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n}\n\nexport type NumberControlDefinition<C extends NumberControlConfig = NumberControlConfig> = {\n type: typeof NumberControlType\n config: C\n}\n\nexport function Number<C extends NumberControlConfig>(\n config: C = {} as C,\n): NumberControlDefinition<C> {\n return { type: NumberControlType, config }\n}\n","export const SelectControlType = 'makeswift::controls::select'\n\ntype SelectControlOption<T extends string> = { value: T; label: string }\n\ntype SelectControlConfig<T extends string = string> = {\n label?: string\n labelOrientation?: 'horizontal' | 'vertical'\n options: SelectControlOption<T>[]\n defaultValue?: T\n}\n\nexport type SelectControlDefinition<C extends SelectControlConfig = SelectControlConfig> = {\n type: typeof SelectControlType\n config: C\n}\n\nexport type SelectControlDefinitionOption<T extends SelectControlDefinition> =\n T['config'] extends SelectControlConfig<infer U> ? U : never\n\nexport type SelectControlData<T extends SelectControlDefinition = SelectControlDefinition> =\n SelectControlDefinitionOption<T> | null\n\nexport function Select<T extends string, C extends SelectControlConfig<T>>(\n config: C & { options: SelectControlOption<T>[] },\n): SelectControlDefinition<C> {\n return { type: SelectControlType, config }\n}\n","export type TextAreaControlData = string\n\nexport const TextAreaControlType = 'makeswift::controls::text-area'\n\ntype TextAreaControlConfig = {\n label?: string\n defaultValue?: string\n rows?: number\n}\n\nexport type TextAreaControlDefinition<C extends TextAreaControlConfig = TextAreaControlConfig> = {\n type: typeof TextAreaControlType\n config: C\n}\n\nexport function TextArea<C extends TextAreaControlConfig>(\n config: C = {} as C,\n): TextAreaControlDefinition<C> {\n return { type: TextAreaControlType, config }\n}\n","export type TextInputControlData = string\n\nexport const TextInputControlType = 'makeswift::controls::text-input'\n\ntype TextInputControlConfig = {\n label?: string\n defaultValue?: string\n}\n\nexport type TextInputControlDefinition<C extends TextInputControlConfig = TextInputControlConfig> =\n {\n type: typeof TextInputControlType\n config: C\n }\n\nexport function TextInput<C extends TextInputControlConfig>(\n config: C = {} as C,\n): TextInputControlDefinition<C> {\n return { type: TextInputControlType, config }\n}\n","export type TypographyControlData = {\n id?: string\n style: Array<{\n deviceId: string\n value: {\n fontFamily?: string | null\n lineHeight?: number | null\n letterSpacing?: number | null\n fontWeight?: number | null\n textAlign?: string | null\n uppercase?: boolean | null\n underline?: boolean | null\n strikethrough?: boolean | null\n italic?: boolean | null\n fontSize?: { value: number | null; unit: string | null } | null\n color?: { swatchId: string | null; alpha: number | null } | null\n }\n }>\n} | null\n\nexport const TypographyControlType = 'makeswift::controls::typography'\n\nexport type TypographyControlDefinition = {\n type: typeof TypographyControlType\n}\n\nexport function unstable_Typography(): TypographyControlDefinition {\n return {\n type: TypographyControlType,\n }\n}\n"],"names":[],"mappings":"AAEO,MAAM,sBAAsB;AAajC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;AClBO,MAAM,8BAA8B;AAAA,EACzC,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,MAAM;AACR;AAKO,MAAM,4BAA4B;AA6BlC,iCACL,QACoC;AAC7B,SAAA,EAAE,MAAM,2BAA2B;AAC5C;AC5CO,MAAM,oBAAoB;AAkB/B,gBAAA,SAAY,IACgB;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;ACvBO,MAAM,oBAAoB;AAsB1B,gBACL,QAC4B;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;ACxBO,MAAM,sBAAsB;AAcjC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;ACjBO,MAAM,uBAAuB;AAclC,mBAAA,SAAY,IACmB;AACxB,SAAA,EAAE,MAAM,sBAAsB;AACvC;ACCO,MAAM,wBAAwB;AAM8B,+BAAA;AAC1D,SAAA;AAAA,IACL,MAAM;AAAA,EAAA;AAEV;;"}
1
+ {"version":3,"file":"typography.es.js","sources":["../src/controls/checkbox.ts","../src/controls/icon-radio-group.ts","../src/controls/number.ts","../src/controls/select.ts","../src/controls/text-area.ts","../src/controls/text-input.ts","../src/controls/typography.ts"],"sourcesContent":["export type CheckboxControlData = boolean\n\nexport const CheckboxControlType = 'makeswift::controls::checkbox'\n\ntype CheckboxControlConfig = {\n label?: string\n defaultValue?: boolean\n}\n\nexport type CheckboxControlDefinition<C extends CheckboxControlConfig = CheckboxControlConfig> = {\n type: typeof CheckboxControlType\n config: C\n}\n\nexport function Checkbox<C extends CheckboxControlConfig>(\n config: C = {} as C,\n): CheckboxControlDefinition<C> {\n return { type: CheckboxControlType, config }\n}\n","export const unstable_IconRadioGroupIcon = {\n TextAlignCenter: 'TextAlignCenter',\n TextAlignJustify: 'TextAlignJustify',\n TextAlignLeft: 'TextAlignLeft',\n TextAlignRight: 'TextAlignRight',\n Superscript: 'Superscript16',\n Subscript: 'Subscript16',\n Code: 'Code16',\n} as const\n\nexport type IconRadioGroupIcon =\n typeof unstable_IconRadioGroupIcon[keyof typeof unstable_IconRadioGroupIcon]\n\nexport const IconRadioGroupControlType = 'makeswift::controls::icon-radio-group'\n\nexport type IconRadioGroupOption<T extends string> = {\n value: T\n icon: IconRadioGroupIcon\n label: string\n}\n\ntype IconRadioGroupControlConfig<T extends string = string> = {\n label?: string\n defaultValue?: T\n options: IconRadioGroupOption<T>[]\n}\n\nexport type IconRadioGroupControlDefinition<\n C extends IconRadioGroupControlConfig = IconRadioGroupControlConfig,\n> = {\n type: typeof IconRadioGroupControlType\n config: C\n}\n\nexport type IconRadioGroupControlDefinitionOption<\n T extends IconRadioGroupControlDefinition = IconRadioGroupControlDefinition,\n> = T['config'] extends IconRadioGroupControlConfig<infer U> ? U : never\n\nexport type IconRadioGroupControlData<\n T extends IconRadioGroupControlDefinition = IconRadioGroupControlDefinition,\n> = IconRadioGroupControlDefinitionOption<T> | null\n\nexport function unstable_IconRadioGroup<T extends string, C extends IconRadioGroupControlConfig<T>>(\n config: C & { options: IconRadioGroupOption<T>[] },\n): IconRadioGroupControlDefinition<C> {\n return { type: IconRadioGroupControlType, config }\n}\n","export type NumberControlData = number\n\nexport const NumberControlType = 'makeswift::controls::number'\n\ntype NumberControlConfig = {\n label?: string\n labelOrientation?: 'vertical' | 'horizontal'\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n}\n\nexport type NumberControlDefinition<C extends NumberControlConfig = NumberControlConfig> = {\n type: typeof NumberControlType\n config: C\n}\n\nexport function Number<C extends NumberControlConfig>(\n config: C = {} as C,\n): NumberControlDefinition<C> {\n return { type: NumberControlType, config }\n}\n","export const SelectControlType = 'makeswift::controls::select'\n\ntype SelectControlOption<T extends string> = { value: T; label: string }\n\ntype SelectControlConfig<T extends string = string> = {\n label?: string\n labelOrientation?: 'horizontal' | 'vertical'\n options: SelectControlOption<T>[]\n defaultValue?: T\n}\n\nexport type SelectControlDefinition<C extends SelectControlConfig = SelectControlConfig> = {\n type: typeof SelectControlType\n config: C\n}\n\nexport type SelectControlDefinitionOption<T extends SelectControlDefinition> =\n T['config'] extends SelectControlConfig<infer U> ? U : never\n\nexport type SelectControlData<T extends SelectControlDefinition = SelectControlDefinition> =\n SelectControlDefinitionOption<T> | null\n\nexport function Select<T extends string, C extends SelectControlConfig<T>>(\n config: C & { options: SelectControlOption<T>[] },\n): SelectControlDefinition<C> {\n return { type: SelectControlType, config }\n}\n","export type TextAreaControlData = string\n\nexport const TextAreaControlType = 'makeswift::controls::text-area'\n\ntype TextAreaControlConfig = {\n label?: string\n defaultValue?: string\n rows?: number\n}\n\nexport type TextAreaControlDefinition<C extends TextAreaControlConfig = TextAreaControlConfig> = {\n type: typeof TextAreaControlType\n config: C\n}\n\nexport function TextArea<C extends TextAreaControlConfig>(\n config: C = {} as C,\n): TextAreaControlDefinition<C> {\n return { type: TextAreaControlType, config }\n}\n","export type TextInputControlData = string\n\nexport const TextInputControlType = 'makeswift::controls::text-input'\n\ntype TextInputControlConfig = {\n label?: string\n defaultValue?: string\n}\n\nexport type TextInputControlDefinition<C extends TextInputControlConfig = TextInputControlConfig> =\n {\n type: typeof TextInputControlType\n config: C\n }\n\nexport function TextInput<C extends TextInputControlConfig>(\n config: C = {} as C,\n): TextInputControlDefinition<C> {\n return { type: TextInputControlType, config }\n}\n","export type TypographyControlData = (\n | {\n id?: string\n style: Array<{\n deviceId: string\n value: {\n fontFamily?: string | null\n lineHeight?: number | null\n letterSpacing?: number | null\n fontWeight?: number | null\n textAlign?: string | null\n uppercase?: boolean | null\n underline?: boolean | null\n strikethrough?: boolean | null\n italic?: boolean | null\n fontSize?: { value: number | null; unit: string | null } | null\n color?: { swatchId: string | null; alpha: number | null } | null\n }\n }>\n }\n | undefined\n)[]\n\nexport const TypographyControlType = 'makeswift::controls::typography'\n\nexport type TypographyControlDefinition = {\n type: typeof TypographyControlType\n}\n\nexport function unstable_Typography(): TypographyControlDefinition {\n return {\n type: TypographyControlType,\n }\n}\n"],"names":[],"mappings":"AAEO,MAAM,sBAAsB;AAajC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;AClBO,MAAM,8BAA8B;AAAA,EACzC,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,MAAM;AACR;AAKO,MAAM,4BAA4B;AA6BlC,iCACL,QACoC;AAC7B,SAAA,EAAE,MAAM,2BAA2B;AAC5C;AC5CO,MAAM,oBAAoB;AAkB/B,gBAAA,SAAY,IACgB;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;ACvBO,MAAM,oBAAoB;AAsB1B,gBACL,QAC4B;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;ACxBO,MAAM,sBAAsB;AAcjC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;ACjBO,MAAM,uBAAuB;AAclC,mBAAA,SAAY,IACmB;AACxB,SAAA,EAAE,MAAM,sBAAsB;AACvC;ACIO,MAAM,wBAAwB;AAM8B,+BAAA;AAC1D,SAAA;AAAA,IACL,MAAM;AAAA,EAAA;AAEV;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makeswift/runtime",
3
- "version": "0.9.9",
3
+ "version": "0.9.10",
4
4
  "license": "MIT",
5
5
  "main": "dist/main.cjs",
6
6
  "module": "dist/main.es",