@makeswift/runtime 0.9.11 → 0.9.12

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 (125) hide show
  1. package/dist/Box.cjs.js +1 -1
  2. package/dist/Box.es.js +1 -1
  3. package/dist/Button.cjs.js +1 -1
  4. package/dist/Button.es.js +1 -1
  5. package/dist/Carousel.cjs.js +1 -1
  6. package/dist/Carousel.es.js +1 -1
  7. package/dist/Countdown.cjs.js +1 -1
  8. package/dist/Countdown.es.js +1 -1
  9. package/dist/Divider.cjs.js +1 -1
  10. package/dist/Divider.es.js +1 -1
  11. package/dist/Form.cjs.js +1 -1
  12. package/dist/Form.es.js +1 -1
  13. package/dist/Image.cjs.js +1 -1
  14. package/dist/Image.es.js +1 -1
  15. package/dist/LiveProvider.cjs.js +1 -1
  16. package/dist/LiveProvider.es.js +3 -3
  17. package/dist/Navigation.cjs.js +1 -1
  18. package/dist/Navigation.es.js +1 -1
  19. package/dist/PreviewProvider.cjs.js +1 -1
  20. package/dist/PreviewProvider.es.js +3 -3
  21. package/dist/ReadOnlyText.cjs.js +18 -3
  22. package/dist/ReadOnlyText.cjs.js.map +1 -1
  23. package/dist/ReadOnlyText.es.js +20 -5
  24. package/dist/ReadOnlyText.es.js.map +1 -1
  25. package/dist/ReadOnlyTextV2.cjs.js +116 -240
  26. package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
  27. package/dist/ReadOnlyTextV2.es.js +115 -238
  28. package/dist/ReadOnlyTextV2.es.js.map +1 -1
  29. package/dist/Root.cjs.js +1 -1
  30. package/dist/Root.es.js +1 -1
  31. package/dist/SocialLinks.cjs.js +1 -1
  32. package/dist/SocialLinks.es.js +1 -1
  33. package/dist/Text.cjs.js +1 -1
  34. package/dist/Text.es.js +1 -1
  35. package/dist/components.cjs.js +1 -1
  36. package/dist/components.es.js +1 -1
  37. package/dist/control-serialization.es.js +1 -1
  38. package/dist/controls.cjs.js +28 -18
  39. package/dist/controls.cjs.js.map +1 -1
  40. package/dist/controls.es.js +2 -2
  41. package/dist/index.cjs.js +39 -38
  42. package/dist/index.cjs.js.map +1 -1
  43. package/dist/index.cjs10.js +2 -2
  44. package/dist/index.cjs2.js +3 -3
  45. package/dist/index.cjs2.js.map +1 -1
  46. package/dist/index.cjs5.js +5 -6
  47. package/dist/index.cjs5.js.map +1 -1
  48. package/dist/index.cjs6.js +20 -0
  49. package/dist/index.cjs6.js.map +1 -1
  50. package/dist/index.cjs8.js +1 -1
  51. package/dist/index.cjs9.js +27 -31
  52. package/dist/index.cjs9.js.map +1 -1
  53. package/dist/index.es.js +14 -14
  54. package/dist/index.es.js.map +1 -1
  55. package/dist/index.es10.js +4 -4
  56. package/dist/index.es2.js +2 -2
  57. package/dist/index.es3.js +1 -1
  58. package/dist/index.es5.js +1 -2
  59. package/dist/index.es5.js.map +1 -1
  60. package/dist/index.es6.js +21 -2
  61. package/dist/index.es6.js.map +1 -1
  62. package/dist/index.es8.js +1 -1
  63. package/dist/index.es9.js +31 -35
  64. package/dist/index.es9.js.map +1 -1
  65. package/dist/next.cjs.js +1 -1
  66. package/dist/next.es.js +2 -2
  67. package/dist/react-page.cjs.js +310 -147
  68. package/dist/react-page.cjs.js.map +1 -1
  69. package/dist/react-page.es.js +297 -146
  70. package/dist/react-page.es.js.map +1 -1
  71. package/dist/react.cjs.js +1 -1
  72. package/dist/react.es.js +1 -1
  73. package/dist/slate.cjs.js +40 -27
  74. package/dist/slate.cjs.js.map +1 -1
  75. package/dist/slate.es.js +49 -37
  76. package/dist/slate.es.js.map +1 -1
  77. package/dist/{typography.cjs.js → text-input.cjs.js} +1 -9
  78. package/dist/text-input.cjs.js.map +1 -0
  79. package/dist/{typography.es.js → text-input.es.js} +2 -8
  80. package/dist/text-input.es.js.map +1 -0
  81. package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +1 -1
  82. package/dist/types/src/controls/list.d.ts +5 -2
  83. package/dist/types/src/controls/list.d.ts.map +1 -1
  84. package/dist/types/src/controls/rich-text/introspection.d.ts +5 -0
  85. package/dist/types/src/controls/rich-text/introspection.d.ts.map +1 -0
  86. package/dist/types/src/controls/rich-text/introspection.test.d.ts +2 -0
  87. package/dist/types/src/controls/rich-text/introspection.test.d.ts.map +1 -0
  88. package/dist/types/src/controls/rich-text-v2/introspection.d.ts +5 -0
  89. package/dist/types/src/controls/rich-text-v2/introspection.d.ts.map +1 -0
  90. package/dist/types/src/controls/rich-text-v2/introspection.test.d.ts +2 -0
  91. package/dist/types/src/controls/rich-text-v2/introspection.test.d.ts.map +1 -0
  92. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +15 -3
  93. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
  94. package/dist/types/src/controls/rich-text-v2/translation.d.ts +1 -1
  95. package/dist/types/src/controls/rich-text-v2/translation.d.ts.map +1 -1
  96. package/dist/types/src/controls/shape.d.ts +5 -2
  97. package/dist/types/src/controls/shape.d.ts.map +1 -1
  98. package/dist/types/src/controls/typography.d.ts +2 -0
  99. package/dist/types/src/controls/typography.d.ts.map +1 -1
  100. package/dist/types/src/prop-controllers/descriptors.d.ts +10 -0
  101. package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
  102. package/dist/types/src/prop-controllers/introspection.d.ts +0 -2
  103. package/dist/types/src/prop-controllers/introspection.d.ts.map +1 -1
  104. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
  105. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts +1 -1
  106. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts.map +1 -1
  107. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/useRemoteChanges.d.ts +4 -0
  108. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/useRemoteChanges.d.ts.map +1 -0
  109. package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts +7 -16
  110. package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
  111. package/dist/types/src/slate/LinkPlugin/index.d.ts.map +1 -1
  112. package/dist/types/src/slate/LocalChangesPlugin/index.d.ts +16 -0
  113. package/dist/types/src/slate/LocalChangesPlugin/index.d.ts.map +1 -0
  114. package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -1
  115. package/dist/types/src/slate/index.d.ts +1 -0
  116. package/dist/types/src/slate/index.d.ts.map +1 -1
  117. package/dist/types/src/slate/types.d.ts +2 -2
  118. package/dist/types/src/slate/types.d.ts.map +1 -1
  119. package/dist/types.cjs2.js +67 -48
  120. package/dist/types.cjs2.js.map +1 -1
  121. package/dist/types.es2.js +64 -45
  122. package/dist/types.es2.js.map +1 -1
  123. package/package.json +1 -2
  124. package/dist/typography.cjs.js.map +0 -1
  125. package/dist/typography.es.js.map +0 -1
@@ -34,14 +34,15 @@ import { Range, createEditor } from "slate";
34
34
  import { ReactEditor, withReact, Slate, Editable } from "slate-react";
35
35
  import { cx } from "@emotion/css";
36
36
  import { g as getBox } from "./box-models.es.js";
37
- import { U as useStyle, bi as BlockType, bg as InlineType, b6 as richTextDTOtoDAO, b5 as richTextDTOtoSelection, br as BuilderEditMode } from "./react-page.es.js";
38
- import { V as useEnhancedTypography, W as useTypographyClassName, n as useResponsiveStyle, u as useIsInBuilder, L as deepEqual, T as useBuilderEditMode, U as pollBoxModel } from "./index.es.js";
37
+ import { U as useStyle, bu as BlockType, bs as InlineType, bf as richTextDTOtoDAO, be as richTextDTOtoSelection, bD as BuilderEditMode } from "./react-page.es.js";
38
+ import { W as useEnhancedTypography, X as useTypographyClassName, n as useResponsiveStyle, u as useIsInBuilder, M as deepEqual, U as useBuilderEditMode, V as pollBoxModel } from "./index.es.js";
39
39
  import { jsx } from "react/jsx-runtime";
40
40
  import "./state/breakpoints.es.js";
41
41
  import "./actions.es.js";
42
42
  import { b as withBlock, o as onKeyDown } from "./types.es2.js";
43
43
  import isHotkey from "is-hotkey";
44
44
  import { L as Link } from "./index.es3.js";
45
+ import "uuid";
45
46
  import { w as withTypography } from "./index.es5.js";
46
47
  import { w as withBuilder } from "./index.es7.js";
47
48
  import { u as useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.es.js";
@@ -52,7 +53,7 @@ import "@emotion/serialize";
52
53
  import "@emotion/utils";
53
54
  import "use-sync-external-store/shim/with-selector";
54
55
  import "next/dynamic";
55
- import "./typography.es.js";
56
+ import "./text-input.es.js";
56
57
  import "./combobox.es.js";
57
58
  import "use-sync-external-store/shim";
58
59
  import "./types.es.js";
@@ -70,7 +71,6 @@ import "cookie";
70
71
  import "http-proxy";
71
72
  import "set-cookie-parser";
72
73
  import "./constants.es.js";
73
- import "uuid";
74
74
  import "corporate-ipsum";
75
75
  import "next/link";
76
76
  function Leaf(_a) {
package/dist/index.es2.js CHANGED
@@ -30,9 +30,9 @@ var __objRest = (source, exclude) => {
30
30
  return target;
31
31
  };
32
32
  import { useMemo, useState, useEffect, useCallback, useRef, forwardRef, createElement, Children } from "react";
33
- import { Y as isNonNullable, aw as getBackgroundsFileIds, ax as getBackgroundsSwatchIds, U as useStyle } from "./react-page.es.js";
33
+ import { ax as getBackgroundsFileIds, ay as getBackgroundsSwatchIds, U as useStyle } from "./react-page.es.js";
34
34
  import "use-sync-external-store/shim";
35
- import { G as useFiles, H as useSwatches, v as useResponsiveGridItem, c as DEFAULT_BOX_ANIMATE_TYPE, f as DEFAULT_ITEM_ANIMATE_TYPE, e as DEFAULT_BOX_ANIMATE_DURATION, d as DEFAULT_BOX_ANIMATE_DELAY, i as DEFAULT_ITEM_STAGGER_DURATION, n as useResponsiveStyle, q as colorToString } from "./index.es.js";
35
+ import { G as isNonNullable, H as useFiles, I as useSwatches, v as useResponsiveGridItem, c as DEFAULT_BOX_ANIMATE_TYPE, f as DEFAULT_ITEM_ANIMATE_TYPE, e as DEFAULT_BOX_ANIMATE_DURATION, d as DEFAULT_BOX_ANIMATE_DELAY, i as DEFAULT_ITEM_STAGGER_DURATION, n as useResponsiveStyle, q as colorToString } from "./index.es.js";
36
36
  import "./actions.es.js";
37
37
  import "slate";
38
38
  import { u as useMediaQuery } from "./useMediaQuery.es.js";
package/dist/index.es3.js CHANGED
@@ -32,7 +32,7 @@ var __objRest = (source, exclude) => {
32
32
  import { forwardRef } from "react";
33
33
  import scrollIntoView from "scroll-into-view-if-needed";
34
34
  import NextLink from "next/link";
35
- import { I as usePagePathnameSlice, J as useElementId } from "./index.es.js";
35
+ import { J as usePagePathnameSlice, K as useElementId } from "./index.es.js";
36
36
  import { jsx } from "react/jsx-runtime";
37
37
  const Link = forwardRef(function Link2(_a, ref) {
38
38
  var _b = _a, {
package/dist/index.es5.js CHANGED
@@ -19,9 +19,8 @@ var __spreadValues = (a, b) => {
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import { Editor, Transforms, Text, Range } from "slate";
21
21
  import { findBreakpointOverride } from "./state/breakpoints.es.js";
22
- import { ba as createRichTextV2Plugin } from "./react-page.es.js";
22
+ import { bj as createRichTextV2Plugin, bp as unstable_Typography } from "./react-page.es.js";
23
23
  import "./actions.es.js";
24
- import { i as unstable_Typography } from "./typography.es.js";
25
24
  import { g as getSelection } from "./types.es2.js";
26
25
  function clearActiveTypographyStyle(editor, options) {
27
26
  Editor.withoutNormalizing(editor, () => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.es5.js","sources":["../src/slate/TypographyPlugin/clearActiveTypographyStyle.ts","../src/slate/TypographyPlugin/clearDeviceActiveTypography.ts","../src/slate/TypographyPlugin/detachActiveTypography.ts","../src/slate/TypographyPlugin/setActiveTypographyId.ts","../src/slate/TypographyPlugin/setActiveTypographyStyle.ts","../src/slate/TypographyPlugin/getValue.tsx","../src/slate/TypographyPlugin/index.ts"],"sourcesContent":["import { Editor, Transforms, Text, Range } from 'slate'\nimport { RichTextTypography } from '../types'\n\ntype ClearActiveTypographyStyleOptions = {\n at?: Range\n}\n\nexport function clearActiveTypographyStyle(\n editor: Editor,\n options?: ClearActiveTypographyStyleOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const typography: RichTextTypography = {\n ...node.typography,\n style: [],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography,\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\nimport { RichTextTypography } from '../types'\n\ntype ClearDeviceActiveTypographyOptions = {\n at?: Range\n}\n\nexport function clearDeviceActiveTypography(\n editor: Editor,\n currentDeviceId: string,\n options?: ClearDeviceActiveTypographyOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const typography: RichTextTypography = {\n ...node.typography,\n style:\n node?.typography?.style.filter(({ deviceId }) => deviceId !== currentDeviceId) ?? [],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography,\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\nimport { RichTextTypography } from '../types'\n\ntype SetActiveTypographyIdOptions = {\n at?: Range\n}\n\nexport function detachActiveTypography(\n editor: Editor,\n value: RichTextTypography['style'],\n options?: SetActiveTypographyIdOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n Transforms.setNodes(\n editor,\n {\n typography: {\n style: value,\n },\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\n\ntype SetActiveTypographyIdOptions = {\n at?: Range\n}\n\nexport function setActiveTypographyId(\n editor: Editor,\n id?: string,\n options?: SetActiveTypographyIdOptions,\n) {\n const at = options?.at ?? editor.selection\n if (!at) return\n Transforms.setNodes(\n editor,\n {\n typography: {\n id,\n style: [],\n },\n },\n {\n at,\n match: node => Text.isText(node),\n split: Range.isExpanded(at),\n },\n )\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\nimport { Breakpoints, findBreakpointOverride, BreakpointId } from '../../state/modules/breakpoints'\nimport { RichTextTypography } from '../types'\n\ntype SetActiveTypographyStyleOptions = {\n at?: Range\n}\n\nexport function setActiveTypographyStyle(\n editor: Editor,\n breakpoints: Breakpoints,\n deviceId: string,\n prop: string,\n value?: unknown,\n options?: SetActiveTypographyStyleOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const deviceOverrides = node?.typography?.style ?? []\n const deviceStyle = findBreakpointOverride(\n breakpoints,\n deviceOverrides,\n deviceId as BreakpointId,\n v => v,\n ) || {\n value: {},\n }\n const nextDeviceStyle = {\n deviceId,\n value: { ...deviceStyle.value, [prop]: value },\n }\n\n const nextTypography: RichTextTypography = {\n ...node.typography,\n style: [...deviceOverrides.filter(v => v.deviceId !== deviceId), nextDeviceStyle],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography: nextTypography,\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Text } from 'slate'\nimport { RichTextTypography } from '../types'\nimport { getSelection } from '../selectors'\n\nexport function getValue(editor: Editor) {\n const matchingValues = Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: Text.isText,\n }),\n ).map(([node]) => node['typography']) as (RichTextTypography | undefined)[]\n\n return matchingValues\n}\n","import { Descendant, Editor, NodeEntry, Text, Transforms } from 'slate'\nimport { clearActiveTypographyStyle } from './clearActiveTypographyStyle'\nimport { clearDeviceActiveTypography } from './clearDeviceActiveTypography'\nimport { detachActiveTypography } from './detachActiveTypography'\nimport { setActiveTypographyId } from './setActiveTypographyId'\nimport { setActiveTypographyStyle } from './setActiveTypographyStyle'\nimport { createRichTextV2Plugin, unstable_Typography } from '../../controls'\nimport { getValue } from './getValue'\nimport { getSelection } from '../selectors'\n\nexport const TypographyActions = {\n setActiveTypographyId,\n setActiveTypographyStyle,\n clearActiveTypographyStyle,\n clearDeviceActiveTypography,\n detachActiveTypography,\n}\n\nexport const TYPOGRAPHY_KEY = 'typography'\n\nexport function withTypography(editor: Editor) {\n const { normalizeNode } = editor\n editor.normalizeNode = entry => {\n const [normalizationNode, normalizationPath] = entry\n if (\n Text.isText(normalizationNode) &&\n normalizationNode?.typography?.id == null &&\n normalizationNode?.typography?.style.length === 0\n ) {\n Transforms.unsetNodes(editor, TYPOGRAPHY_KEY, { at: normalizationPath })\n return\n }\n\n if (Text.isText(normalizationNode) && normalizationNode?.slice != null) {\n Transforms.unsetNodes(editor, 'slice', { at: normalizationPath })\n return\n }\n\n normalizeNode(entry)\n }\n\n return editor\n}\n\nexport function TypographyPlugin() {\n return createRichTextV2Plugin({\n withPlugin: withTypography,\n control: {\n definition: unstable_Typography(),\n onChange: (editor, value) => {\n Editor.withoutNormalizing(editor, () => {\n const at = getSelection(editor)\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n if (atRef.current) {\n Transforms.setNodes<Descendant>(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: Text.isText,\n split: true,\n },\n )\n }\n\n if (atRef.current) {\n const nodesToUpdate = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n ) as NodeEntry<Text>[]\n\n if (nodesToUpdate.length !== value?.length)\n return console.error(\n `TypographyControl.onChange received the wrong number of arguments.\nCalled with ${value?.length} values mapping to ${nodesToUpdate.length} nodes.`,\n )\n\n for (const [index, [, path]] of nodesToUpdate.entries()) {\n Transforms.setNodes(\n editor,\n {\n typography: value?.at(index),\n },\n { at: path, match: Text.isText },\n )\n }\n }\n\n atRef.unref()\n })\n },\n getValue: editor => getValue(editor),\n getLeafValue: (text: Text) => {\n return Text.isText(text) ? text.typography : undefined\n },\n },\n renderLeaf: (renderLeaf, className) => props => {\n return renderLeaf({\n ...props,\n leaf: {\n ...props.leaf,\n className: `${props.leaf.className} ${className}`,\n },\n })\n },\n })\n}\n"],"names":["editor","matchingValues","Array","from","Editor","nodes","at","getSelection","match","Text","isText","map","node"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAOO,oCACL,QACA,S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cAAc,CAAS,UAAA;AAC9C,aAAO,WAAW,iCACb,QADa;AAAA,QAEhB,MAAM,iCACD,MAAM,OADL;AAAA,UAEJ,WAAW,GAAG,MAAM,KAAK,aAAa;AAAA,QACxC;AAAA,MAAA,EACD;AAAA,IACH;AAAA,EAAA,CACD;AACH;;"}
1
+ {"version":3,"file":"index.es5.js","sources":["../src/slate/TypographyPlugin/clearActiveTypographyStyle.ts","../src/slate/TypographyPlugin/clearDeviceActiveTypography.ts","../src/slate/TypographyPlugin/detachActiveTypography.ts","../src/slate/TypographyPlugin/setActiveTypographyId.ts","../src/slate/TypographyPlugin/setActiveTypographyStyle.ts","../src/slate/TypographyPlugin/getValue.tsx","../src/slate/TypographyPlugin/index.ts"],"sourcesContent":["import { Editor, Transforms, Text, Range } from 'slate'\nimport { RichTextTypography } from '../types'\n\ntype ClearActiveTypographyStyleOptions = {\n at?: Range\n}\n\nexport function clearActiveTypographyStyle(\n editor: Editor,\n options?: ClearActiveTypographyStyleOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const typography: RichTextTypography = {\n ...node.typography,\n style: [],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography,\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\nimport { RichTextTypography } from '../types'\n\ntype ClearDeviceActiveTypographyOptions = {\n at?: Range\n}\n\nexport function clearDeviceActiveTypography(\n editor: Editor,\n currentDeviceId: string,\n options?: ClearDeviceActiveTypographyOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const typography: RichTextTypography = {\n ...node.typography,\n style:\n node?.typography?.style.filter(({ deviceId }) => deviceId !== currentDeviceId) ?? [],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography,\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\nimport { RichTextTypography } from '../types'\n\ntype SetActiveTypographyIdOptions = {\n at?: Range\n}\n\nexport function detachActiveTypography(\n editor: Editor,\n value: RichTextTypography['style'],\n options?: SetActiveTypographyIdOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n Transforms.setNodes(\n editor,\n {\n typography: {\n style: value,\n },\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\n\ntype SetActiveTypographyIdOptions = {\n at?: Range\n}\n\nexport function setActiveTypographyId(\n editor: Editor,\n id?: string,\n options?: SetActiveTypographyIdOptions,\n) {\n const at = options?.at ?? editor.selection\n if (!at) return\n Transforms.setNodes(\n editor,\n {\n typography: {\n id,\n style: [],\n },\n },\n {\n at,\n match: node => Text.isText(node),\n split: Range.isExpanded(at),\n },\n )\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\nimport { Breakpoints, findBreakpointOverride, BreakpointId } from '../../state/modules/breakpoints'\nimport { RichTextTypography } from '../types'\n\ntype SetActiveTypographyStyleOptions = {\n at?: Range\n}\n\nexport function setActiveTypographyStyle(\n editor: Editor,\n breakpoints: Breakpoints,\n deviceId: string,\n prop: string,\n value?: unknown,\n options?: SetActiveTypographyStyleOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const deviceOverrides = node?.typography?.style ?? []\n const deviceStyle = findBreakpointOverride(\n breakpoints,\n deviceOverrides,\n deviceId as BreakpointId,\n v => v,\n ) || {\n value: {},\n }\n const nextDeviceStyle = {\n deviceId,\n value: { ...deviceStyle.value, [prop]: value },\n }\n\n const nextTypography: RichTextTypography = {\n ...node.typography,\n style: [...deviceOverrides.filter(v => v.deviceId !== deviceId), nextDeviceStyle],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography: nextTypography,\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Text } from 'slate'\nimport { RichTextTypography } from '../types'\nimport { getSelection } from '../selectors'\n\nexport function getValue(editor: Editor) {\n const matchingValues = Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: Text.isText,\n }),\n ).map(([node]) => node['typography']) as (RichTextTypography | undefined)[]\n\n return matchingValues\n}\n","import { Descendant, Editor, NodeEntry, Text, Transforms } from 'slate'\nimport { clearActiveTypographyStyle } from './clearActiveTypographyStyle'\nimport { clearDeviceActiveTypography } from './clearDeviceActiveTypography'\nimport { detachActiveTypography } from './detachActiveTypography'\nimport { setActiveTypographyId } from './setActiveTypographyId'\nimport { setActiveTypographyStyle } from './setActiveTypographyStyle'\nimport { createRichTextV2Plugin, unstable_Typography } from '../../controls'\nimport { getValue } from './getValue'\nimport { getSelection } from '../selectors'\n\nexport const TypographyActions = {\n setActiveTypographyId,\n setActiveTypographyStyle,\n clearActiveTypographyStyle,\n clearDeviceActiveTypography,\n detachActiveTypography,\n}\n\nexport const TYPOGRAPHY_KEY = 'typography'\n\nexport function withTypography(editor: Editor) {\n const { normalizeNode } = editor\n editor.normalizeNode = entry => {\n const [normalizationNode, normalizationPath] = entry\n if (\n Text.isText(normalizationNode) &&\n normalizationNode?.typography?.id == null &&\n normalizationNode?.typography?.style.length === 0\n ) {\n Transforms.unsetNodes(editor, TYPOGRAPHY_KEY, { at: normalizationPath })\n return\n }\n\n if (Text.isText(normalizationNode) && normalizationNode?.slice != null) {\n Transforms.unsetNodes(editor, 'slice', { at: normalizationPath })\n return\n }\n\n normalizeNode(entry)\n }\n\n return editor\n}\n\nexport function TypographyPlugin() {\n return createRichTextV2Plugin({\n withPlugin: withTypography,\n control: {\n definition: unstable_Typography(),\n onChange: (editor, value) => {\n Editor.withoutNormalizing(editor, () => {\n const at = getSelection(editor)\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n if (atRef.current) {\n Transforms.setNodes<Descendant>(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: Text.isText,\n split: true,\n },\n )\n }\n\n if (atRef.current) {\n const nodesToUpdate = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n ) as NodeEntry<Text>[]\n\n if (nodesToUpdate.length !== value?.length)\n return console.error(\n `TypographyControl.onChange received the wrong number of arguments.\nCalled with ${value?.length} values mapping to ${nodesToUpdate.length} nodes.`,\n )\n\n for (const [index, [, path]] of nodesToUpdate.entries()) {\n Transforms.setNodes(\n editor,\n {\n typography: value?.at(index),\n },\n { at: path, match: Text.isText },\n )\n }\n }\n\n atRef.unref()\n })\n },\n getValue: editor => getValue(editor),\n getLeafValue: (text: Text) => {\n return Text.isText(text) ? text.typography : undefined\n },\n },\n renderLeaf: (renderLeaf, className) => props => {\n return renderLeaf({\n ...props,\n leaf: {\n ...props.leaf,\n className: `${props.leaf.className} ${className}`,\n },\n })\n },\n })\n}\n"],"names":["editor","matchingValues","Array","from","Editor","nodes","at","getSelection","match","Text","isText","map","node"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAOO,oCACL,QACA,SACA;AACO,SAAA,mBAAmB,QAAQ,MAAM;;AAChC,UAAA,KAAK,yCAAS,OAAT,YAAe,OAAO;AACjC,QAAI,CAAC;AAAI;AACT,UAAM,QAAQ,OAAO,SAAS,QAAQ,EAAE;AAExC,QAAI,MAAM,SAAS;AACjB,iBAAW,SACT,QACA;AAAA,QACE,OAAO;AAAA,MAAA,GAET;AAAA,QACE,IAAI,MAAM;AAAA,QACV,OAAO,CAAA,SAAQ,KAAK,OAAO,IAAI;AAAA,QAC/B,OAAO,MAAM,WAAW,MAAM,OAAO;AAAA,MAAA,CAEzC;AAAA,IACF;AAEA,QAAI,MAAM,SAAS;AACjB,YAAM,YAAY,MAAM,KACtB,OAAO,MAAM,QAAQ;AAAA,QACnB,IAAI,MAAM;AAAA,QACV,OAAO,CAAQ,SAAA,KAAK,OAAO,IAAI,KAAK,KAAK,UAAU;AAAA,MACpD,CAAA,CACH;AAEW,iBAAA,CAAC,MAAM,SAAS,WAAW;AAChC,YAAA,KAAK,OAAO,IAAI,GAAG;AACrB,gBAAM,aAAiC,iCAClC,KAAK,aAD6B;AAAA,YAErC,OAAO,CAAC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K,UAAU;AAAA,YACpD,CAAA,CACH;AAEI,gBAAA,cAAc,WAAW,gCAAO;AAClC,qBAAO,QAAQ,MACb;AAAA,cACF,+BAAO,4BAA4B,cAAc,eACjD;AAEF,uBAAW,CAAC,OAAO,CAAG,EAAA,UAAU,cAAc,WAAW;AACvD,yBAAW,SACT,QACA;AAAA,gBACE,YAAY,+BAAO,GAAG;AAAA,cAAK,GAE7B,EAAE,IAAI,MAAM,OAAO,KAAK,QAC1B;AAAA,YACF;AAAA,UACF;AAEA,gBAAM,MAAM;AAAA,QAAA,CACb;AAAA,MACH;AAAA,MACA,UAAU,CAAU,WAAA,SAAS,MAAM;AAAA,MACnC,cAAc,CAAC,SAAe;AAC5B,eAAO,KAAK,OAAO,IAAI,IAAI,KAAK,aAAa;AAAA,MAC/C;AAAA,IACF;AAAA,IACA,YAAY,CAAC,YAAY,cAAc,CAAS,UAAA;AAC9C,aAAO,WAAW,iCACb,QADa;AAAA,QAEhB,MAAM,iCACD,MAAM,OADL;AAAA,UAEJ,WAAW,GAAG,MAAM,KAAK,aAAa;AAAA,QACxC;AAAA,MAAA,EACD;AAAA,IACH;AAAA,EAAA,CACD;AACH;;"}
package/dist/index.es6.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { Path, Transforms } from "slate";
2
2
  import isHotkey from "is-hotkey";
3
- import { bi as BlockType, ba as createRichTextV2Plugin } from "./react-page.es.js";
3
+ import { bu as BlockType, bj as createRichTextV2Plugin } from "./react-page.es.js";
4
4
  import { E as ElementUtils } from "./types.es2.js";
5
+ import { v4 } from "uuid";
5
6
  const BLOCK_ONE_PATH = [0];
6
7
  const BLOCK_TWO_PATH = [1];
7
8
  function withInlineMode(editor) {
@@ -33,5 +34,23 @@ const InlineModePlugin = createRichTextV2Plugin({
33
34
  },
34
35
  withPlugin: withInlineMode
35
36
  });
36
- export { InlineModePlugin as I, withInlineMode as w };
37
+ function withLocalChanges(editor) {
38
+ editor.localChanges = /* @__PURE__ */ new Map();
39
+ editor.recentLocalChanges = [];
40
+ editor.currentKey = "";
41
+ const _onChange = editor.onChange;
42
+ editor.onChange = (options) => {
43
+ _onChange(options);
44
+ if (editor == null || (options == null ? void 0 : options.operation) == null)
45
+ return;
46
+ const key = v4();
47
+ editor.localChanges.set(key, {
48
+ selection: editor.selection,
49
+ time: performance.now()
50
+ });
51
+ editor.currentKey = key;
52
+ };
53
+ return editor;
54
+ }
55
+ export { InlineModePlugin as I, withLocalChanges as a, withInlineMode as w };
37
56
  //# sourceMappingURL=index.es6.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es6.js","sources":["../src/slate/InlineModePlugin/index.ts"],"sourcesContent":["import { Editor, Path, Transforms } from 'slate'\nimport { KeyboardEvent } from 'react'\nimport isHotkey from 'is-hotkey'\nimport { createRichTextV2Plugin } from '../../controls/rich-text-v2'\nimport { ElementUtils } from '../utils/element'\nimport { BlockType } from '../types'\n\nconst BLOCK_ONE_PATH = [0]\nconst BLOCK_TWO_PATH = [1]\n\nexport function withInlineMode(editor: Editor): Editor {\n const { normalizeNode } = editor\n editor.normalizeNode = entry => {\n const [normalizationNode, normalizationPath] = entry\n\n /**\n * Merge root nodes past the first one\n */\n if (Path.equals(BLOCK_TWO_PATH, normalizationPath)) {\n Transforms.mergeNodes(editor, { at: BLOCK_TWO_PATH })\n return\n }\n /**\n * Unwrap non text nodes of first root node\n */\n if (\n Path.isAncestor(BLOCK_ONE_PATH, normalizationPath) &&\n ElementUtils.isBlock(normalizationNode)\n ) {\n Transforms.unwrapNodes(editor, {\n at: normalizationPath,\n })\n return\n }\n /**\n * Update type of root nodes to be `text-block`\n */\n if (Path.equals(BLOCK_ONE_PATH, normalizationPath)) {\n Transforms.setNodes(editor, { type: BlockType.Text }, { at: normalizationPath })\n return\n }\n\n normalizeNode(entry)\n }\n\n return editor\n}\n\nexport const InlineModePlugin = createRichTextV2Plugin({\n onKeyDown: (e: KeyboardEvent) => {\n if (isHotkey('enter', e)) e.preventDefault()\n },\n withPlugin: withInlineMode,\n})\n"],"names":[],"mappings":";;;;AAOA,MAAM,iBAAiB,CAAC,CAAC;AACzB,MAAM,iBAAiB,CAAC,CAAC;AAElB,wBAAwB,QAAwB;AACrD,QAAM,EAAE,kBAAkB;AAC1B,SAAO,gBAAgB,CAAS,UAAA;AACxB,UAAA,CAAC,mBAAmB,qBAAqB;AAK/C,QAAI,KAAK,OAAO,gBAAgB,iBAAiB,GAAG;AAClD,iBAAW,WAAW,QAAQ,EAAE,IAAI,eAAgB,CAAA;AACpD;AAAA,IACF;AAKE,QAAA,KAAK,WAAW,gBAAgB,iBAAiB,KACjD,aAAa,QAAQ,iBAAiB,GACtC;AACA,iBAAW,YAAY,QAAQ;AAAA,QAC7B,IAAI;AAAA,MAAA,CACL;AACD;AAAA,IACF;AAIA,QAAI,KAAK,OAAO,gBAAgB,iBAAiB,GAAG;AACvC,iBAAA,SAAS,QAAQ,EAAE,MAAM,UAAU,QAAQ,EAAE,IAAI,kBAAA,CAAmB;AAC/E;AAAA,IACF;AAEA,kBAAc,KAAK;AAAA,EAAA;AAGd,SAAA;AACT;AAEO,MAAM,mBAAmB,uBAAuB;AAAA,EACrD,WAAW,CAAC,MAAqB;AAC3B,QAAA,SAAS,SAAS,CAAC;AAAG,QAAE,eAAe;AAAA,EAC7C;AAAA,EACA,YAAY;AACd,CAAC;;"}
1
+ {"version":3,"file":"index.es6.js","sources":["../src/slate/InlineModePlugin/index.ts","../src/slate/LocalChangesPlugin/index.tsx"],"sourcesContent":["import { Editor, Path, Transforms } from 'slate'\nimport { KeyboardEvent } from 'react'\nimport isHotkey from 'is-hotkey'\nimport { createRichTextV2Plugin } from '../../controls/rich-text-v2'\nimport { ElementUtils } from '../utils/element'\nimport { BlockType } from '../types'\n\nconst BLOCK_ONE_PATH = [0]\nconst BLOCK_TWO_PATH = [1]\n\nexport function withInlineMode(editor: Editor): Editor {\n const { normalizeNode } = editor\n editor.normalizeNode = entry => {\n const [normalizationNode, normalizationPath] = entry\n\n /**\n * Merge root nodes past the first one\n */\n if (Path.equals(BLOCK_TWO_PATH, normalizationPath)) {\n Transforms.mergeNodes(editor, { at: BLOCK_TWO_PATH })\n return\n }\n /**\n * Unwrap non text nodes of first root node\n */\n if (\n Path.isAncestor(BLOCK_ONE_PATH, normalizationPath) &&\n ElementUtils.isBlock(normalizationNode)\n ) {\n Transforms.unwrapNodes(editor, {\n at: normalizationPath,\n })\n return\n }\n /**\n * Update type of root nodes to be `text-block`\n */\n if (Path.equals(BLOCK_ONE_PATH, normalizationPath)) {\n Transforms.setNodes(editor, { type: BlockType.Text }, { at: normalizationPath })\n return\n }\n\n normalizeNode(entry)\n }\n\n return editor\n}\n\nexport const InlineModePlugin = createRichTextV2Plugin({\n onKeyDown: (e: KeyboardEvent) => {\n if (isHotkey('enter', e)) e.preventDefault()\n },\n withPlugin: withInlineMode,\n})\n","import { BaseEditor, Editor, Selection } from 'slate'\nimport { v4 as uuid } from 'uuid'\n\nexport type LocalChange = { selection: Selection; time: number }\n\nexport interface LocalChangesEditor extends BaseEditor {\n localChanges: Map<string, LocalChange>\n recentKeys: Map<string, number>\n recentLocalChanges: { time: number; key: string }[]\n currentKey: string\n}\n\nexport function withLocalChanges(editor: Editor): Editor {\n editor.localChanges = new Map<string, LocalChange>()\n editor.recentLocalChanges = []\n editor.currentKey = ''\n\n const _onChange = editor.onChange\n editor.onChange = options => {\n _onChange(options)\n if (editor == null || options?.operation == null) return\n\n const key = uuid()\n editor.localChanges.set(key, { selection: editor.selection, time: performance.now() })\n editor.currentKey = key\n }\n\n return editor\n}\n"],"names":["editor","localChanges","Map","recentLocalChanges","currentKey","_onChange","onChange","options","operation","key","uuid","set","selection","time","performance","now"],"mappings":";;;;;AAOA,MAAM,iBAAiB,CAAC,CAAC;AACzB,MAAM,iBAAiB,CAAC,CAAC;AAElB,wBAAwB,QAAwB;AACrD,QAAM,EAAE,kBAAkB;AAC1B,SAAO,gBAAgB,CAAS,UAAA;AACxB,UAAA,CAAC,mBAAmB,qBAAqB;AAK/C,QAAI,KAAK,OAAO,gBAAgB,iBAAiB,GAAG;AAClD,iBAAW,WAAW,QAAQ,EAAE,IAAI,eAAgB,CAAA;AACpD;AAAA,IACF;AAKE,QAAA,KAAK,WAAW,gBAAgB,iBAAiB,KACjD,aAAa,QAAQ,iBAAiB,GACtC;AACA,iBAAW,YAAY,QAAQ;AAAA,QAC7B,IAAI;AAAA,MAAA,CACL;AACD;AAAA,IACF;AAIA,QAAI,KAAK,OAAO,gBAAgB,iBAAiB,GAAG;AACvC,iBAAA,SAAS,QAAQ,EAAE,MAAM,UAAU,QAAQ,EAAE,IAAI,kBAAA,CAAmB;AAC/E;AAAA,IACF;AAEA,kBAAc,KAAK;AAAA,EAAA;AAGd,SAAA;AACT;AAEO,MAAM,mBAAmB,uBAAuB;AAAA,EACrD,WAAW,CAAC,MAAqB;AAC3B,QAAA,SAAS,SAAS,CAAC;AAAG,QAAE,eAAe;AAAA,EAC7C;AAAA,EACA,YAAY;AACd,CAAC;ACzCM,0BAA0BA,QAAwB;AAChDC,SAAAA,mCAAmBC;AAC1BF,SAAOG,qBAAqB;AAC5BH,SAAOI,aAAa;AAEpB,QAAMC,YAAYL,OAAOM;AACzBN,SAAOM,WAAWC,CAAW,YAAA;AAC3BF,cAAUE,OAAD;AACLP,QAAAA,UAAU,QAAQO,oCAASC,cAAa;AAAM;AAE5CC,UAAAA,MAAMC;AACLT,WAAAA,aAAaU,IAAIF,KAAK;AAAA,MAAEG,WAAWZ,OAAOY;AAAAA,MAAWC,MAAMC,YAAYC,IAAZ;AAAA,IAAA,CAAlE;AACAf,WAAOI,aAAaK;AAAAA,EAAAA;AAGfT,SAAAA;AACR;;"}
package/dist/index.es8.js CHANGED
@@ -14,7 +14,7 @@ import "@emotion/serialize";
14
14
  import "@emotion/utils";
15
15
  import "slate";
16
16
  import "react/jsx-runtime";
17
- import "./typography.es.js";
17
+ import "./text-input.es.js";
18
18
  import "./combobox.es.js";
19
19
  import "use-sync-external-store/shim";
20
20
  import "./types.es.js";
package/dist/index.es9.js CHANGED
@@ -29,20 +29,19 @@ var __objRest = (source, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
- import { useMemo, useState, useRef, useEffect, useCallback } from "react";
32
+ import { useEffect, useMemo, useState, useRef, useCallback } from "react";
33
33
  import { Range, createEditor } from "slate";
34
34
  import isHotkey from "is-hotkey";
35
- import { withHistory, HistoryEditor } from "slate-history";
36
35
  import { ReactEditor, withReact, Slate, Editable } from "slate-react";
37
- import { U as useStyle, b9 as RichTextV2Mode, bi as BlockType, be as richTextV2DataToDescendents, br as BuilderEditMode } from "./react-page.es.js";
38
- import { Q as ControlValue, T as useBuilderEditMode, U as pollBoxModel } from "./index.es.js";
36
+ import { bn as richTextV2DataToDescendents, bu as BlockType, bi as RichTextV2Mode, bD as BuilderEditMode } from "./react-page.es.js";
37
+ import { T as ControlValue, u as useIsInBuilder, U as useBuilderEditMode, V as pollBoxModel } from "./index.es.js";
39
38
  import "./state/breakpoints.es.js";
40
39
  import "./types.es2.js";
41
- import { I as InlineModePlugin } from "./index.es6.js";
40
+ import { I as InlineModePlugin, a as withLocalChanges } from "./index.es6.js";
42
41
  import { w as withBuilder } from "./index.es7.js";
43
42
  import { jsx } from "react/jsx-runtime";
44
43
  import "./index.es3.js";
45
- import { cx } from "@emotion/css";
44
+ import "@emotion/css";
46
45
  import { u as useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.es.js";
47
46
  import "./actions.es.js";
48
47
  import "redux";
@@ -51,7 +50,7 @@ import "@emotion/serialize";
51
50
  import "@emotion/utils";
52
51
  import "use-sync-external-store/shim/with-selector";
53
52
  import "next/dynamic";
54
- import "./typography.es.js";
53
+ import "./text-input.es.js";
55
54
  import "./combobox.es.js";
56
55
  import "use-sync-external-store/shim";
57
56
  import "./types.es.js";
@@ -104,24 +103,8 @@ function RichTextV2Element(_a) {
104
103
  "definition",
105
104
  "plugins"
106
105
  ]);
107
- const blockStyles = [useStyle({
108
- margin: 0
109
- })];
110
106
  function initialRenderElement(props2) {
111
- switch (props2.element.type) {
112
- case BlockType.Default:
113
- default:
114
- if (definition.config.mode === RichTextV2Mode.Inline) {
115
- return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({}, props2.attributes), {
116
- className: cx(...blockStyles),
117
- children: props2.children
118
- }));
119
- }
120
- return /* @__PURE__ */ jsx("p", __spreadProps(__spreadValues({}, props2.attributes), {
121
- className: cx(...blockStyles),
122
- children: props2.children
123
- }));
124
- }
107
+ return props2.children;
125
108
  }
126
109
  const renderElement = plugins.reduce((renderFn, plugin) => (props2) => {
127
110
  const {
@@ -176,6 +159,21 @@ function RichTextV2Leaf(_c) {
176
159
  }, initialRenderLeaf);
177
160
  return renderLeaf(props);
178
161
  }
162
+ function isChangeWithinPreviousSec(change) {
163
+ var _a;
164
+ return performance.now() - ((_a = change == null ? void 0 : change.time) != null ? _a : 0) < 1e3;
165
+ }
166
+ function useSyncRemoteChanges(editor, data) {
167
+ const isInBuilder = useIsInBuilder();
168
+ useEffect(() => {
169
+ var _a, _b, _c;
170
+ if (!isChangeWithinPreviousSec(editor.localChanges.get((_a = data == null ? void 0 : data.key) != null ? _a : "")) && data && isInBuilder) {
171
+ editor.children = richTextV2DataToDescendents(data);
172
+ editor.selection = (_c = (_b = editor == null ? void 0 : editor.localChanges.get(data.key)) == null ? void 0 : _b.selection) != null ? _c : null;
173
+ editor.onChange();
174
+ }
175
+ }, [editor, data]);
176
+ }
179
177
  const defaultText = [{
180
178
  type: BlockType.Default,
181
179
  children: [{
@@ -195,10 +193,11 @@ function EditableTextV2({
195
193
  const [editor] = useState(() => plugins.reduceRight((editor2, plugin) => {
196
194
  var _a, _b;
197
195
  return (_b = (_a = plugin == null ? void 0 : plugin.withPlugin) == null ? void 0 : _a.call(plugin, editor2)) != null ? _b : editor2;
198
- }, withBuilder(withHistory(withReact(createEditor())))));
196
+ }, withLocalChanges(withBuilder(withReact(createEditor())))));
199
197
  const isPreservingFocus = useRef(false);
200
198
  useSyncDOMSelection(editor, isPreservingFocus);
201
199
  const editMode = useBuilderEditMode();
200
+ useSyncRemoteChanges(editor, text);
202
201
  useEffect(() => {
203
202
  if (control == null)
204
203
  return;
@@ -239,23 +238,24 @@ function EditableTextV2({
239
238
  control == null ? void 0 : control.select();
240
239
  }, [control]);
241
240
  const handleKeyDown = useCallback((e) => {
242
- if (isHotkey("mod+shift+z", e))
243
- return HistoryEditor.redo(editor);
244
- if (isHotkey("mod+z", e))
245
- return HistoryEditor.undo(editor);
246
241
  if (isHotkey("escape")(e)) {
247
242
  isPreservingFocus.current = false;
248
243
  ReactEditor.blur(editor);
249
244
  control == null ? void 0 : control.switchToBuildMode();
250
245
  }
246
+ if (editMode === BuilderEditMode.CONTENT) {
247
+ e.stopPropagation();
248
+ }
251
249
  plugins.forEach((plugin) => {
252
250
  var _a;
253
251
  return (_a = plugin == null ? void 0 : plugin.onKeyDown) == null ? void 0 : _a.call(plugin, e, editor);
254
252
  });
255
- }, [control, plugins, editor]);
253
+ }, [control, plugins, editor, editMode]);
256
254
  const handleKeyUp = useCallback((e) => {
257
- if (editMode === BuilderEditMode.CONTENT)
255
+ if (editMode === BuilderEditMode.CONTENT) {
256
+ e.stopPropagation();
258
257
  e.preventDefault();
258
+ }
259
259
  }, [control, editor, editMode]);
260
260
  const handleClick = useCallback((e) => {
261
261
  if (editMode === BuilderEditMode.CONTENT)
@@ -268,12 +268,8 @@ function EditableTextV2({
268
268
  if (((_a = e.relatedTarget) == null ? void 0 : _a.getAttribute("contenteditable")) === "true")
269
269
  isPreservingFocus.current = false;
270
270
  }, []);
271
- const handleOnChange = useCallback((value) => {
272
- control == null ? void 0 : control.onChange(value);
273
- }, [control]);
274
271
  return /* @__PURE__ */ jsx(Slate, {
275
272
  editor,
276
- onChange: handleOnChange,
277
273
  value: initialValue,
278
274
  children: /* @__PURE__ */ jsx(Editable, {
279
275
  renderLeaf,
@@ -1 +1 @@
1
- {"version":3,"file":"index.es9.js","sources":["../src/runtimes/react/controls/rich-text-v2/EditableTextV2/useSyncDOMSelection.tsx","../src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.tsx","../src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.tsx","../src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.tsx"],"sourcesContent":["import { Editor, Range as SlateRange } from 'slate'\nimport { useIsomorphicLayoutEffect } from '../../../../../components/hooks/useIsomorphicLayoutEffect'\nimport { MutableRefObject } from 'react'\nimport { ReactEditor } from 'slate-react'\n\n/**\n * Clicking outside of the host blurs our `<Editable />`.\n * `<Editable />` only updates the DOM's selection to match slate when it is focused.\n * In the case of a panel being clicked this hook updates the DOM selection to match slate.\n */\nexport function useSyncDOMSelection(editor: Editor, isEnabled: MutableRefObject<boolean>) {\n useIsomorphicLayoutEffect(() => {\n if (!isEnabled.current || editor.selection == null || ReactEditor.isFocused(editor)) return\n try {\n const root = ReactEditor.findDocumentOrShadowRoot(editor) as Document\n const domSelection = root.getSelection()\n const newDomRange: Range | null = ReactEditor.toDOMRange(editor, editor.selection)\n\n if (newDomRange) {\n if (SlateRange.isBackward(editor.selection!)) {\n domSelection?.setBaseAndExtent(\n newDomRange.endContainer,\n newDomRange.endOffset,\n newDomRange.startContainer,\n newDomRange.startOffset,\n )\n } else {\n domSelection?.setBaseAndExtent(\n newDomRange.startContainer,\n newDomRange.startOffset,\n newDomRange.endContainer,\n newDomRange.endOffset,\n )\n }\n } else {\n domSelection?.removeAllRanges()\n }\n } catch (e) {\n console.error(e)\n }\n })\n}\n","import { cx } from '@emotion/css'\nimport { RenderElementProps } from 'slate-react'\nimport {\n RichTextV2ControlDefinition,\n RichTextV2Plugin,\n RichTextV2Mode,\n} from '../../../../../controls'\nimport { BlockType } from '../../../../../slate'\nimport { useStyle } from '../../../use-style'\nimport { ControlValue } from '../../control'\n\ntype RichTextV2ElementProps = RenderElementProps & {\n definition: RichTextV2ControlDefinition\n plugins: RichTextV2Plugin[]\n}\n\nexport function RichTextV2Element({ definition, plugins, ...props }: RichTextV2ElementProps) {\n const blockStyles = [useStyle({ margin: 0 })]\n\n function initialRenderElement(props: RenderElementProps) {\n switch (props.element.type) {\n case BlockType.Default:\n default:\n if (definition.config.mode === RichTextV2Mode.Inline) {\n return (\n <span {...props.attributes} className={cx(...blockStyles)}>\n {props.children}\n </span>\n )\n }\n\n return (\n <p {...props.attributes} className={cx(...blockStyles)}>\n {props.children}\n </p>\n )\n }\n }\n\n const renderElement = plugins.reduce(\n (renderFn, plugin) => (props: RenderElementProps) => {\n const { control, renderElement } = plugin\n\n if (control?.definition == null || renderElement == null) return renderFn(props)\n\n if (control.getElementValue == null) return renderElement(renderFn, undefined)(props)\n\n return (\n <ControlValue definition={control.definition} data={control.getElementValue(props.element)}>\n {value => renderElement(renderFn, value)(props)}\n </ControlValue>\n )\n },\n initialRenderElement,\n )\n\n return renderElement(props)\n}\n","import { RenderLeafProps } from 'slate-react'\nimport { RichTextV2ControlDefinition, RichTextV2Plugin } from '../../../../../controls'\nimport { ControlValue } from '../../control'\n\ntype RichTextV2LeafProps = RenderLeafProps & {\n definition: RichTextV2ControlDefinition\n plugins: RichTextV2Plugin[]\n}\n\nexport function RichTextV2Leaf({ definition, plugins, ...props }: RichTextV2LeafProps) {\n function initialRenderLeaf({ attributes, children, leaf }: RenderLeafProps) {\n return (\n <span className={leaf.className} {...attributes}>\n {children}\n </span>\n )\n }\n\n const renderLeaf = plugins.reduce(\n (renderFn, plugin) => (props: RenderLeafProps) => {\n const { control, renderLeaf } = plugin\n\n if (control?.definition == null || renderLeaf == null) return renderFn(props)\n\n if (control.getLeafValue == null) return renderLeaf(renderFn, undefined)(props)\n\n return (\n <ControlValue definition={control.definition} data={control.getLeafValue(props.leaf)}>\n {value => renderLeaf(renderFn, value)(props)}\n </ControlValue>\n )\n },\n initialRenderLeaf,\n )\n\n return renderLeaf(props)\n}\n","import {\n FocusEvent,\n KeyboardEvent,\n MouseEvent,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport { Descendant, createEditor } from 'slate'\nimport isHotkey from 'is-hotkey'\nimport { withHistory, HistoryEditor } from 'slate-history'\nimport {\n withReact,\n ReactEditor,\n RenderElementProps,\n RenderLeafProps,\n Slate,\n Editable,\n} from 'slate-react'\n\nimport {\n RichTextV2Control,\n RichTextV2ControlData,\n RichTextV2ControlDefinition,\n RichTextV2Mode,\n} from '../../../../../controls'\nimport { useBuilderEditMode } from '../../..'\nimport { BuilderEditMode } from '../../../../../state/modules/builder-edit-mode'\nimport { pollBoxModel } from '../../../poll-box-model'\nimport { InlineModePlugin, withBuilder } from '../../../../../slate'\nimport { useSyncDOMSelection } from './useSyncDOMSelection'\nimport { BlockType } from '../../../../../slate'\nimport { RichTextV2Element } from './render-element'\nimport { RichTextV2Leaf } from './render-leaf'\nimport { richTextV2DataToDescendents } from '../../../../../controls/rich-text-v2/translation'\n\nexport type RichTextV2ControlValue = ReactNode\n\nexport type Descriptors = { text?: RichTextV2ControlDefinition }\n\nconst defaultText: Descendant[] = [{ type: BlockType.Default, children: [{ text: '' }] }]\n\ntype Props = {\n text?: RichTextV2ControlData\n definition: RichTextV2ControlDefinition\n control: RichTextV2Control | null\n}\n\nexport function EditableTextV2({ text, definition, control }: Props) {\n const plugins = useMemo(() => {\n const plugins = [\n ...(definition?.config?.plugins ?? []),\n ...(definition?.config?.mode === RichTextV2Mode.Inline ? [InlineModePlugin] : []),\n ]\n return plugins\n }, [definition])\n\n const [editor] = useState(() =>\n plugins.reduceRight(\n (editor, plugin) => plugin?.withPlugin?.(editor) ?? editor,\n withBuilder(withHistory(withReact(createEditor()))),\n ),\n )\n\n const isPreservingFocus = useRef(false)\n useSyncDOMSelection(editor, isPreservingFocus)\n\n const editMode = useBuilderEditMode()\n\n useEffect(() => {\n if (control == null) return\n\n const element = ReactEditor.toDOMNode(editor, editor)\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => control.changeBoxModel(boxModel),\n })\n }, [editor, control])\n\n const renderElement = useCallback(\n (props: RenderElementProps) => {\n return <RichTextV2Element {...props} definition={definition} plugins={plugins} />\n },\n [plugins, definition],\n )\n\n const renderLeaf = useCallback(\n (props: RenderLeafProps) => {\n return <RichTextV2Leaf {...props} definition={definition} plugins={plugins} />\n },\n [plugins, definition],\n )\n\n const initialValue = useMemo(\n () => (text && richTextV2DataToDescendents(text)) ?? defaultText,\n [text],\n )\n\n useEffect(() => {\n /**\n * This is required because clicking on the overlay has `relatedTarget` null just like the sidebar, but\n * - in the case of the overlay we switch to BUILD mode\n * - in the case of the sidebar we preserve the selection\n */\n if (editMode !== BuilderEditMode.CONTENT) {\n isPreservingFocus.current = false\n ReactEditor.deselect(editor)\n }\n }, [editMode])\n\n useEffect(() => {\n control?.setEditor(editor)\n control?.setDefaultValue(defaultText)\n }, [control, editor, defaultText])\n\n const handleFocus = useCallback(() => {\n isPreservingFocus.current = true\n control?.select()\n }, [control])\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (isHotkey('mod+shift+z', e)) return HistoryEditor.redo(editor)\n if (isHotkey('mod+z', e)) return HistoryEditor.undo(editor)\n if (isHotkey('escape')(e)) {\n isPreservingFocus.current = false\n ReactEditor.blur(editor)\n control?.switchToBuildMode()\n }\n\n plugins.forEach(plugin => plugin?.onKeyDown?.(e, editor))\n },\n [control, plugins, editor],\n )\n\n const handleKeyUp = useCallback(\n (e: KeyboardEvent) => {\n if (editMode === BuilderEditMode.CONTENT) e.preventDefault()\n },\n [control, editor, editMode],\n )\n\n const handleClick = useCallback(\n (e: MouseEvent) => {\n if (editMode === BuilderEditMode.CONTENT) e.stopPropagation()\n },\n [editMode],\n )\n\n const handleBlur = useCallback((e: FocusEvent) => {\n // outside of iframe (overlay, sidebar, etc)\n if (e.relatedTarget == null) return\n // another text\n if (e.relatedTarget?.getAttribute('contenteditable') === 'true')\n isPreservingFocus.current = false\n }, [])\n\n const handleOnChange = useCallback(\n (value: Descendant[]) => {\n control?.onChange(value)\n },\n [control],\n )\n\n return (\n <Slate editor={editor} onChange={handleOnChange} value={initialValue}>\n <Editable\n renderLeaf={renderLeaf}\n renderElement={renderElement}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n onKeyUp={handleKeyUp}\n onClick={handleClick}\n onBlur={handleBlur}\n readOnly={editMode !== BuilderEditMode.CONTENT}\n placeholder=\"Write some text...\"\n />\n </Slate>\n )\n}\n\nexport default EditableTextV2\n"],"names":["editor","isEnabled","useIsomorphicLayoutEffect","current","selection","ReactEditor","isFocused","root","findDocumentOrShadowRoot","domSelection","getSelection","newDomRange","toDOMRange","SlateRange","isBackward","setBaseAndExtent","endContainer","endOffset","startContainer","startOffset","removeAllRanges","e","console","error","definition","plugins","props","blockStyles","useStyle","margin","element","type","BlockType","Default","config","mode","RichTextV2Mode","Inline","attributes","cx","children","renderElement","reduce","renderFn","plugin","control","getElementValue","undefined","value","initialRenderElement","leaf","className","renderLeaf","getLeafValue","initialRenderLeaf","defaultText","text","useMemo","InlineModePlugin","useState","reduceRight","withPlugin","withBuilder","withHistory","withReact","createEditor","isPreservingFocus","useRef","useSyncDOMSelection","editMode","useBuilderEditMode","useEffect","toDOMNode","pollBoxModel","onBoxModelChange","boxModel","changeBoxModel","useCallback","initialValue","richTextV2DataToDescendents","BuilderEditMode","CONTENT","deselect","setEditor","setDefaultValue","handleFocus","select","handleKeyDown","isHotkey","HistoryEditor","redo","undo","blur","switchToBuildMode","forEach","onKeyDown","handleKeyUp","preventDefault","handleClick","stopPropagation","handleBlur","relatedTarget","getAttribute","handleOnChange","onChange"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUO,6BAA6BA,QAAgBC,WAAsC;AACxFC,4BAA0B,MAAM;AAC1B,QAAA,CAACD,UAAUE,WAAWH,OAAOI,aAAa,QAAQC,YAAYC,UAAUN,MAAtB;AAA+B;AACjF,QAAA;AACIO,YAAAA,OAAOF,YAAYG,yBAAyBR,MAArC;A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aW,gBAAgBC;AAAS5D,QAAE4E,eAAF;AAAA,EAE5C,GAAA,CAACpD,SAAS7C,QAAQqE,QAAlB,CAJ6B;AAOzB6B,QAAAA,cAAcrB,YAClB,CAACxD,MAAkB;AACbgD,QAAAA,aAAaW,gBAAgBC;AAAS5D,QAAE8E,gBAAF;AAAA,EAAA,GAE5C,CAAC9B,QAAD,CAJ6B;AAOzB+B,QAAAA,aAAavB,YAAY,CAACxD,MAAkB;;AAEhD,QAAIA,EAAEgF,iBAAiB;AAAM;AAE7B,QAAIhF,SAAEgF,kBAAFhF,mBAAiBiF,aAAa,wBAAuB;AACvDpC,wBAAkB/D,UAAU;AAAA,EALF,GAM3B,CAN2B,CAAA;AAQxBoG,QAAAA,iBAAiB1B,YACrB,CAAC7B,UAAwB;AACvBH,uCAAS2D,SAASxD;AAAAA,EAAlB,GAEF,CAACH,OAAD,CAJgC;AAOlC,6BACG,OAAD;AAAA,IAAO;AAAA,IAAgB,UAAU0D;AAAAA,IAAgB,OAAOzB;AAAAA,IAAxD,8BACG,UAAD;AAAA,MACE;AAAA,MACA;AAAA,MACA,SAASO;AAAAA,MACT,WAAWE;AAAAA,MACX,SAASS;AAAAA,MACT,SAASE;AAAAA,MACT,QAAQE;AAAAA,MACR,UAAU/B,aAAaW,gBAAgBC;AAAAA,MACvC,aAAY;AAAA,IAAA,CATd;AAAA,EAAA,CAFJ;AAeD;;"}
1
+ {"version":3,"file":"index.es9.js","sources":["../src/runtimes/react/controls/rich-text-v2/EditableTextV2/useSyncDOMSelection.tsx","../src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.tsx","../src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.tsx","../src/runtimes/react/controls/rich-text-v2/EditableTextV2/useRemoteChanges.tsx","../src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.tsx"],"sourcesContent":["import { Editor, Range as SlateRange } from 'slate'\nimport { useIsomorphicLayoutEffect } from '../../../../../components/hooks/useIsomorphicLayoutEffect'\nimport { MutableRefObject } from 'react'\nimport { ReactEditor } from 'slate-react'\n\n/**\n * Clicking outside of the host blurs our `<Editable />`.\n * `<Editable />` only updates the DOM's selection to match slate when it is focused.\n * In the case of a panel being clicked this hook updates the DOM selection to match slate.\n */\nexport function useSyncDOMSelection(editor: Editor, isEnabled: MutableRefObject<boolean>) {\n useIsomorphicLayoutEffect(() => {\n if (!isEnabled.current || editor.selection == null || ReactEditor.isFocused(editor)) return\n try {\n const root = ReactEditor.findDocumentOrShadowRoot(editor) as Document\n const domSelection = root.getSelection()\n const newDomRange: Range | null = ReactEditor.toDOMRange(editor, editor.selection)\n\n if (newDomRange) {\n if (SlateRange.isBackward(editor.selection!)) {\n domSelection?.setBaseAndExtent(\n newDomRange.endContainer,\n newDomRange.endOffset,\n newDomRange.startContainer,\n newDomRange.startOffset,\n )\n } else {\n domSelection?.setBaseAndExtent(\n newDomRange.startContainer,\n newDomRange.startOffset,\n newDomRange.endContainer,\n newDomRange.endOffset,\n )\n }\n } else {\n domSelection?.removeAllRanges()\n }\n } catch (e) {\n console.error(e)\n }\n })\n}\n","import { RenderElementProps } from 'slate-react'\nimport { RichTextV2ControlDefinition, RichTextV2Plugin } from '../../../../../controls'\nimport { ControlValue } from '../../control'\n\ntype RichTextV2ElementProps = RenderElementProps & {\n definition: RichTextV2ControlDefinition\n plugins: RichTextV2Plugin[]\n}\n\nexport function RichTextV2Element({ definition, plugins, ...props }: RichTextV2ElementProps) {\n function initialRenderElement(props: RenderElementProps) {\n return props.children\n }\n\n const renderElement = plugins.reduce(\n (renderFn, plugin) => (props: RenderElementProps) => {\n const { control, renderElement } = plugin\n\n if (control?.definition == null || renderElement == null) return renderFn(props)\n\n if (control.getElementValue == null) return renderElement(renderFn, undefined)(props)\n\n return (\n <ControlValue definition={control.definition} data={control.getElementValue(props.element)}>\n {value => renderElement(renderFn, value)(props)}\n </ControlValue>\n )\n },\n initialRenderElement,\n )\n\n return renderElement(props)\n}\n","import { RenderLeafProps } from 'slate-react'\nimport { RichTextV2ControlDefinition, RichTextV2Plugin } from '../../../../../controls'\nimport { ControlValue } from '../../control'\n\ntype RichTextV2LeafProps = RenderLeafProps & {\n definition: RichTextV2ControlDefinition\n plugins: RichTextV2Plugin[]\n}\n\nexport function RichTextV2Leaf({ definition, plugins, ...props }: RichTextV2LeafProps) {\n function initialRenderLeaf({ attributes, children, leaf }: RenderLeafProps) {\n return (\n <span className={leaf.className} {...attributes}>\n {children}\n </span>\n )\n }\n\n const renderLeaf = plugins.reduce(\n (renderFn, plugin) => (props: RenderLeafProps) => {\n const { control, renderLeaf } = plugin\n\n if (control?.definition == null || renderLeaf == null) return renderFn(props)\n\n if (control.getLeafValue == null) return renderLeaf(renderFn, undefined)(props)\n\n return (\n <ControlValue definition={control.definition} data={control.getLeafValue(props.leaf)}>\n {value => renderLeaf(renderFn, value)(props)}\n </ControlValue>\n )\n },\n initialRenderLeaf,\n )\n\n return renderLeaf(props)\n}\n","import { useEffect } from 'react'\nimport { Editor } from 'slate'\nimport { useIsInBuilder } from '../../../../../react'\nimport { RichTextV2ControlData, richTextV2DataToDescendents } from '../../../../../controls'\nimport { LocalChange } from '../../../../../slate'\n\n// From the component point of view we can't know if the change came from an action or a undo/redo\n// So we diff the time and force updates on actions that occured over a second ago.\nfunction isChangeWithinPreviousSec(change?: LocalChange) {\n return performance.now() - (change?.time ?? 0) < 1000\n}\n\nexport function useSyncRemoteChanges(editor: Editor, data?: RichTextV2ControlData) {\n const isInBuilder = useIsInBuilder()\n\n useEffect(() => {\n if (\n !isChangeWithinPreviousSec(editor.localChanges.get(data?.key ?? '')) &&\n data &&\n isInBuilder\n ) {\n editor.children = richTextV2DataToDescendents(data)\n editor.selection = editor?.localChanges.get(data.key)?.selection ?? null\n editor.onChange()\n }\n }, [editor, data])\n}\n","import {\n FocusEvent,\n KeyboardEvent,\n MouseEvent,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport { Descendant, createEditor } from 'slate'\nimport isHotkey from 'is-hotkey'\nimport {\n withReact,\n ReactEditor,\n RenderElementProps,\n RenderLeafProps,\n Slate,\n Editable,\n} from 'slate-react'\n\nimport {\n RichTextV2Control,\n RichTextV2ControlData,\n RichTextV2ControlDefinition,\n RichTextV2Mode,\n} from '../../../../../controls'\nimport { useBuilderEditMode } from '../../..'\nimport { BuilderEditMode } from '../../../../../state/modules/builder-edit-mode'\nimport { pollBoxModel } from '../../../poll-box-model'\nimport { InlineModePlugin, withBuilder, withLocalChanges } from '../../../../../slate'\nimport { useSyncDOMSelection } from './useSyncDOMSelection'\nimport { BlockType } from '../../../../../slate'\nimport { RichTextV2Element } from './render-element'\nimport { RichTextV2Leaf } from './render-leaf'\nimport { richTextV2DataToDescendents } from '../../../../../controls/rich-text-v2/translation'\nimport { useSyncRemoteChanges } from './useRemoteChanges'\n\nexport type RichTextV2ControlValue = ReactNode\n\nexport type Descriptors = { text?: RichTextV2ControlDefinition }\n\nconst defaultText: Descendant[] = [{ type: BlockType.Default, children: [{ text: '' }] }]\n\ntype Props = {\n text?: RichTextV2ControlData\n definition: RichTextV2ControlDefinition\n control: RichTextV2Control | null\n}\n\nexport function EditableTextV2({ text, definition, control }: Props) {\n const plugins = useMemo(() => {\n const plugins = [\n ...(definition?.config?.plugins ?? []),\n ...(definition?.config?.mode === RichTextV2Mode.Inline ? [InlineModePlugin] : []),\n ]\n return plugins\n }, [definition])\n\n const [editor] = useState(() =>\n plugins.reduceRight(\n (editor, plugin) => plugin?.withPlugin?.(editor) ?? editor,\n withLocalChanges(withBuilder(withReact(createEditor()))),\n ),\n )\n\n const isPreservingFocus = useRef(false)\n useSyncDOMSelection(editor, isPreservingFocus)\n\n const editMode = useBuilderEditMode()\n\n useSyncRemoteChanges(editor, text)\n\n useEffect(() => {\n if (control == null) return\n\n const element = ReactEditor.toDOMNode(editor, editor)\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => control.changeBoxModel(boxModel),\n })\n }, [editor, control])\n\n const renderElement = useCallback(\n (props: RenderElementProps) => {\n return <RichTextV2Element {...props} definition={definition} plugins={plugins} />\n },\n [plugins, definition],\n )\n\n const renderLeaf = useCallback(\n (props: RenderLeafProps) => {\n return <RichTextV2Leaf {...props} definition={definition} plugins={plugins} />\n },\n [plugins, definition],\n )\n\n const initialValue = useMemo(\n () => (text && richTextV2DataToDescendents(text)) ?? defaultText,\n [text],\n )\n\n useEffect(() => {\n /**\n * This is required because clicking on the overlay has `relatedTarget` null just like the sidebar, but\n * - in the case of the overlay we switch to BUILD mode\n * - in the case of the sidebar we preserve the selection\n */\n if (editMode !== BuilderEditMode.CONTENT) {\n isPreservingFocus.current = false\n ReactEditor.deselect(editor)\n }\n }, [editMode])\n\n useEffect(() => {\n control?.setEditor(editor)\n control?.setDefaultValue(defaultText)\n }, [control, editor, defaultText])\n\n const handleFocus = useCallback(() => {\n isPreservingFocus.current = true\n control?.select()\n }, [control])\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (isHotkey('escape')(e)) {\n isPreservingFocus.current = false\n ReactEditor.blur(editor)\n control?.switchToBuildMode()\n }\n\n if (editMode === BuilderEditMode.CONTENT) {\n e.stopPropagation()\n }\n\n plugins.forEach(plugin => plugin?.onKeyDown?.(e, editor))\n },\n [control, plugins, editor, editMode],\n )\n\n const handleKeyUp = useCallback(\n (e: KeyboardEvent) => {\n if (editMode === BuilderEditMode.CONTENT) {\n e.stopPropagation()\n e.preventDefault()\n }\n },\n [control, editor, editMode],\n )\n\n const handleClick = useCallback(\n (e: MouseEvent) => {\n if (editMode === BuilderEditMode.CONTENT) e.stopPropagation()\n },\n [editMode],\n )\n\n const handleBlur = useCallback((e: FocusEvent) => {\n // outside of iframe (overlay, sidebar, etc)\n if (e.relatedTarget == null) return\n // another text\n if (e.relatedTarget?.getAttribute('contenteditable') === 'true')\n isPreservingFocus.current = false\n }, [])\n\n return (\n <Slate editor={editor} value={initialValue}>\n <Editable\n renderLeaf={renderLeaf}\n renderElement={renderElement}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n onKeyUp={handleKeyUp}\n onClick={handleClick}\n onBlur={handleBlur}\n readOnly={editMode !== BuilderEditMode.CONTENT}\n placeholder=\"Write some text...\"\n />\n </Slate>\n )\n}\n\nexport default EditableTextV2\n"],"names":["editor","isEnabled","useIsomorphicLayoutEffect","current","selection","ReactEditor","isFocused","root","findDocumentOrShadowRoot","domSelection","getSelection","newDomRange","toDOMRange","SlateRange","isBackward","setBaseAndExtent","endContainer","endOffset","startContainer","startOffset","removeAllRanges","e","console","error","definition","plugins","props","children","renderElement","reduce","renderFn","plugin","control","getElementValue","undefined","element","value","initialRenderElement","attributes","leaf","className","renderLeaf","getLeafValue","initialRenderLeaf","change","performance","now","time","data","isInBuilder","useIsInBuilder","useEffect","isChangeWithinPreviousSec","localChanges","get","key","richTextV2DataToDescendents","onChange","defaultText","type","BlockType","Default","text","useMemo","config","mode","RichTextV2Mode","Inline","InlineModePlugin","useState","reduceRight","withPlugin","withLocalChanges","withBuilder","withReact","createEditor","isPreservingFocus","useRef","useSyncDOMSelection","editMode","useBuilderEditMode","useSyncRemoteChanges","toDOMNode","pollBoxModel","onBoxModelChange","boxModel","changeBoxModel","useCallback","initialValue","BuilderEditMode","CONTENT","deselect","setEditor","setDefaultValue","handleFocus","select","handleKeyDown","isHotkey","blur","switchToBuildMode","stopPropagation","forEach","onKeyDown","handleKeyUp","preventDefault","handleClick","handleBlur","relatedTarget","getAttribute"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUO,6BAA6BA,QAAgBC,WAAsC;AACxFC,4BAA0B,MAAM;AAC1B,QAAA,CAACD,UAAUE,WAAWH,OAAOI,aAAa,QAAQC,YAAYC,UAAUN,MAAtB;AAA+B;AACjF,QAAA;AACIO,YAAAA,OAAOF,YAAYG,yBAAyBR,MAArC;AACPS,YAAAA,eAAeF,KAAKG;AAC1B,YAAMC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AAEmF,eAAF;AAAA,IACD;AAAA,EAEH,GAAA,CAACxE,SAAShC,QAAQ+E,QAAlB,CAP6B;AAUzB0B,QAAAA,cAAclB,YAClB,CAAClE,MAAkB;AACb0D,QAAAA,aAAaU,gBAAgBC;AAASrE,QAAE+E,gBAAF;AAAA,EAAA,GAE5C,CAACrB,QAAD,CAJ6B;AAOzB2B,QAAAA,aAAanB,YAAY,CAAClE,MAAkB;;AAEhD,QAAIA,EAAEsF,iBAAiB;AAAM;AAE7B,QAAItF,SAAEsF,kBAAFtF,mBAAiBuF,aAAa,wBAAuB;AACvDhC,wBAAkBzE,UAAU;AAAA,EALF,GAM3B,CAN2B,CAAA;AAQ9B,6BACG,OAAD;AAAA,IAAO;AAAA,IAAgB,OAAOqF;AAAAA,IAA9B,8BACG,UAAD;AAAA,MACE;AAAA,MACA;AAAA,MACA,SAASM;AAAAA,MACT,WAAWE;AAAAA,MACX,SAASO;AAAAA,MACT,SAASE;AAAAA,MACT,QAAQC;AAAAA,MACR,UAAU3B,aAAaU,gBAAgBC;AAAAA,MACvC,aAAY;AAAA,IAAA,CATd;AAAA,EAAA,CAFJ;AAeD;;"}
package/dist/next.cjs.js CHANGED
@@ -15,7 +15,7 @@ require("@emotion/css");
15
15
  require("@emotion/serialize");
16
16
  require("@emotion/utils");
17
17
  require("slate");
18
- require("./typography.cjs.js");
18
+ require("./text-input.cjs.js");
19
19
  require("./combobox.cjs.js");
20
20
  require("use-sync-external-store/shim");
21
21
  require("./types.cjs.js");
package/dist/next.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "react";
2
- export { a1 as Document, $ as Makeswift, a2 as MakeswiftApiHandler, _ as Page, a0 as PreviewModeScript, B as forwardNextDynamicRef, Z as getServerSideProps, X as getStaticPaths, Y as getStaticProps } from "./index.es.js";
2
+ export { a2 as Document, a0 as Makeswift, a3 as MakeswiftApiHandler, $ as Page, a1 as PreviewModeScript, B as forwardNextDynamicRef, _ as getServerSideProps, Y as getStaticPaths, Z as getStaticProps } from "./index.es.js";
3
3
  import "react/jsx-runtime";
4
4
  import "use-sync-external-store/shim/with-selector";
5
5
  import "next/dynamic";
@@ -13,7 +13,7 @@ import "@emotion/css";
13
13
  import "@emotion/serialize";
14
14
  import "@emotion/utils";
15
15
  import "slate";
16
- import "./typography.es.js";
16
+ import "./text-input.es.js";
17
17
  import "./combobox.es.js";
18
18
  import "use-sync-external-store/shim";
19
19
  import "./types.es.js";