@makeswift/runtime 0.7.13 → 0.7.15

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 (136) hide show
  1. package/dist/ReadOnlyText.cjs.js +64 -28
  2. package/dist/ReadOnlyText.cjs.js.map +1 -1
  3. package/dist/ReadOnlyText.es.js +64 -27
  4. package/dist/ReadOnlyText.es.js.map +1 -1
  5. package/dist/controls.cjs.js +1 -4
  6. package/dist/controls.cjs.js.map +1 -1
  7. package/dist/controls.es.js +1 -2
  8. package/dist/controls.es.js.map +1 -1
  9. package/dist/index.cjs.js +2 -1
  10. package/dist/index.cjs.js.map +1 -1
  11. package/dist/index.cjs6.js +143 -132
  12. package/dist/index.cjs6.js.map +1 -1
  13. package/dist/index.es.js +2 -2
  14. package/dist/index.es6.js +144 -133
  15. package/dist/index.es6.js.map +1 -1
  16. package/dist/introspection.cjs.js +0 -1
  17. package/dist/introspection.cjs.js.map +1 -1
  18. package/dist/introspection.es.js +1 -1
  19. package/dist/{typography.cjs.js → leaf.cjs.js} +49 -12
  20. package/dist/leaf.cjs.js.map +1 -0
  21. package/dist/{typography.es.js → leaf.es.js} +49 -12
  22. package/dist/leaf.es.js.map +1 -0
  23. package/dist/next.es.js +1 -1
  24. package/dist/rich-text.cjs.js +29 -43
  25. package/dist/rich-text.cjs.js.map +1 -1
  26. package/dist/rich-text.es.js +30 -44
  27. package/dist/rich-text.es.js.map +1 -1
  28. package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
  29. package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts.map +1 -1
  30. package/dist/types/src/components/builtin/Text/EditableText/useSyncWithBuilder.d.ts.map +1 -1
  31. package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts +1 -5
  32. package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +1 -1
  33. package/dist/types/src/components/builtin/Text/components/Leaf/index.d.ts +0 -1
  34. package/dist/types/src/components/builtin/Text/components/Leaf/index.d.ts.map +1 -1
  35. package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts +21 -0
  36. package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts.map +1 -1
  37. package/dist/types/src/controls/rich-text/index.d.ts +0 -1
  38. package/dist/types/src/controls/rich-text/index.d.ts.map +1 -1
  39. package/dist/types/src/controls/rich-text/translation.d.ts.map +1 -1
  40. package/dist/types/src/controls/rich-text/types.d.ts +47 -27
  41. package/dist/types/src/controls/rich-text/types.d.ts.map +1 -1
  42. package/dist/types/src/slate/BlockPlugin/clearBlockKeyForDevice.d.ts +5 -0
  43. package/dist/types/src/slate/BlockPlugin/clearBlockKeyForDevice.d.ts.map +1 -0
  44. package/dist/types/src/slate/BlockPlugin/index.d.ts +9 -0
  45. package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -0
  46. package/dist/types/src/slate/BlockPlugin/setBlockKeyForDevice.d.ts +5 -0
  47. package/dist/types/src/slate/BlockPlugin/setBlockKeyForDevice.d.ts.map +1 -0
  48. package/dist/types/src/slate/BlockPlugin/types.d.ts +4 -0
  49. package/dist/types/src/slate/BlockPlugin/types.d.ts.map +1 -0
  50. package/dist/types/src/slate/ListPlugin/constants.d.ts.map +1 -0
  51. package/dist/types/src/slate/ListPlugin/dedent.d.ts.map +1 -0
  52. package/dist/types/src/slate/ListPlugin/indent.d.ts.map +1 -0
  53. package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/ListPlugin.d.ts → slate/ListPlugin/index.d.ts} +6 -2
  54. package/dist/types/src/slate/ListPlugin/index.d.ts.map +1 -0
  55. package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate/ListPlugin}/toggleList.d.ts +1 -1
  56. package/dist/types/src/slate/ListPlugin/toggleList.d.ts.map +1 -0
  57. package/dist/types/src/slate/ListPlugin/unwrapList.d.ts.map +1 -0
  58. package/dist/types/src/slate/ListPlugin/utils/filterForSubtreeRoots.d.ts.map +1 -0
  59. package/dist/types/src/slate/ListPlugin/utils/getSelectedListItems.d.ts.map +1 -0
  60. package/dist/types/src/slate/ListPlugin/utils/location.d.ts.map +1 -0
  61. package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate/ListPlugin}/wrapList.d.ts +1 -1
  62. package/dist/types/src/slate/ListPlugin/wrapList.d.ts.map +1 -0
  63. package/dist/types/src/slate/TypographyPlugin/clearActiveTypographyStyle.d.ts +3 -0
  64. package/dist/types/src/slate/TypographyPlugin/clearActiveTypographyStyle.d.ts.map +1 -0
  65. package/dist/types/src/slate/TypographyPlugin/clearDeviceActiveTypography.d.ts +3 -0
  66. package/dist/types/src/slate/TypographyPlugin/clearDeviceActiveTypography.d.ts.map +1 -0
  67. package/dist/types/src/slate/TypographyPlugin/detachActiveTypography.d.ts +4 -0
  68. package/dist/types/src/slate/TypographyPlugin/detachActiveTypography.d.ts.map +1 -0
  69. package/dist/types/src/slate/TypographyPlugin/index.d.ts +15 -0
  70. package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -0
  71. package/dist/types/src/slate/TypographyPlugin/setActiveTypographyId.d.ts +3 -0
  72. package/dist/types/src/slate/TypographyPlugin/setActiveTypographyId.d.ts.map +1 -0
  73. package/dist/types/src/slate/TypographyPlugin/setActiveTypographyStyle.d.ts +3 -0
  74. package/dist/types/src/slate/TypographyPlugin/setActiveTypographyStyle.d.ts.map +1 -0
  75. package/dist/types/src/slate/index.d.ts +4 -0
  76. package/dist/types/src/slate/index.d.ts.map +1 -0
  77. package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate}/utils/editor.d.ts +1 -1
  78. package/dist/types/src/slate/utils/editor.d.ts.map +1 -0
  79. package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate}/utils/element.d.ts +3 -5
  80. package/dist/types/src/slate/utils/element.d.ts.map +1 -0
  81. package/package.json +8 -1
  82. package/dist/compare.cjs.js +0 -126
  83. package/dist/compare.cjs.js.map +0 -1
  84. package/dist/compare.es.js +0 -124
  85. package/dist/compare.es.js.map +0 -1
  86. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/ListPlugin.d.ts.map +0 -1
  87. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/constants.d.ts.map +0 -1
  88. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/index.d.ts +0 -2
  89. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/index.d.ts.map +0 -1
  90. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/dedent.d.ts.map +0 -1
  91. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/indent.d.ts.map +0 -1
  92. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/index.d.ts +0 -6
  93. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/index.d.ts.map +0 -1
  94. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/toggleList.d.ts.map +0 -1
  95. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/unwrapList.d.ts.map +0 -1
  96. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/editor.d.ts.map +0 -1
  97. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/element.d.ts.map +0 -1
  98. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/filterForSubtreeRoots.d.ts.map +0 -1
  99. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/getSelectedListItems.d.ts.map +0 -1
  100. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/location.d.ts.map +0 -1
  101. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/wrapList.d.ts.map +0 -1
  102. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/dedent.test.d.ts +0 -3
  103. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/dedent.test.d.ts.map +0 -1
  104. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/indent.test.d.ts +0 -3
  105. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/indent.test.d.ts.map +0 -1
  106. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/normalization.test.d.ts +0 -3
  107. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/normalization.test.d.ts.map +0 -1
  108. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/slate-test-helper.d.ts +0 -48
  109. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/slate-test-helper.d.ts.map +0 -1
  110. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/toggleList.test.d.ts +0 -3
  111. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/toggleList.test.d.ts.map +0 -1
  112. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/types.d.ts +0 -21
  113. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/types.d.ts.map +0 -1
  114. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/unwrapList.test.d.ts +0 -3
  115. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/unwrapList.test.d.ts.map +0 -1
  116. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/utils/filterForSubtreeRoots.test.d.ts +0 -2
  117. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/utils/filterForSubtreeRoots.test.d.ts.map +0 -1
  118. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/utils/getSelectedListItems.test.d.ts +0 -3
  119. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/utils/getSelectedListItems.test.d.ts.map +0 -1
  120. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/wrapList.test.d.ts +0 -3
  121. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/wrapList.test.d.ts.map +0 -1
  122. package/dist/types/src/components/builtin/Text/components/Leaf/typography.d.ts +0 -27
  123. package/dist/types/src/components/builtin/Text/components/Leaf/typography.d.ts.map +0 -1
  124. package/dist/types/src/controls/rich-text/compare.d.ts +0 -5
  125. package/dist/types/src/controls/rich-text/compare.d.ts.map +0 -1
  126. package/dist/types/src/controls/rich-text/compare.test.d.ts +0 -2
  127. package/dist/types/src/controls/rich-text/compare.test.d.ts.map +0 -1
  128. package/dist/typography.cjs.js.map +0 -1
  129. package/dist/typography.es.js.map +0 -1
  130. /package/dist/types/src/{components/builtin/Text/EditableText → slate}/ListPlugin/constants.d.ts +0 -0
  131. /package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate/ListPlugin}/dedent.d.ts +0 -0
  132. /package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate/ListPlugin}/indent.d.ts +0 -0
  133. /package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate/ListPlugin}/unwrapList.d.ts +0 -0
  134. /package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate/ListPlugin}/utils/filterForSubtreeRoots.d.ts +0 -0
  135. /package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate/ListPlugin}/utils/getSelectedListItems.d.ts +0 -0
  136. /package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate/ListPlugin}/utils/location.d.ts +0 -0
@@ -7,8 +7,8 @@ require("slate");
7
7
  require("slate-react");
8
8
  var next = require("./index.cjs.js");
9
9
  var index = require("./index.cjs3.js");
10
- var typography = require("./typography.cjs.js");
11
10
  var jsxRuntime = require("react/jsx-runtime");
11
+ var leaf = require("./leaf.cjs.js");
12
12
  require("./actions.cjs.js");
13
13
  require("use-sync-external-store/shim/with-selector");
14
14
  require("next/dynamic");
@@ -44,12 +44,13 @@ const ReadOnlyText = React.forwardRef(function ReadOnlyText2({
44
44
  width,
45
45
  margin
46
46
  }, ref) {
47
- const descendants = text == null ? "" : richText.richTextDTOtoDAO(text);
47
+ const descendants = text == null ? [] : richText.richTextDTOtoDAO(text);
48
+ const descendantsAsString = getText(descendants);
48
49
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
49
50
  ref,
50
51
  id,
51
52
  className: css.cx(width, margin),
52
- children: descendants === "" ? /* @__PURE__ */ jsxRuntime.jsx(Placeholder, {}) : /* @__PURE__ */ jsxRuntime.jsx(Descendants, {
53
+ children: descendantsAsString === "" ? /* @__PURE__ */ jsxRuntime.jsx(Placeholder, {}) : /* @__PURE__ */ jsxRuntime.jsx(Descendants, {
53
54
  descendants
54
55
  })
55
56
  });
@@ -72,18 +73,11 @@ function Placeholder({
72
73
  function TextElement({
73
74
  descendant
74
75
  }) {
75
- return /* @__PURE__ */ jsxRuntime.jsx("span", {
76
- children: descendant.text
77
- });
78
- }
79
- function TypographyElement({
80
- descendant
81
- }) {
82
- const enhancedTypography = typography.useEnhancedTypography(descendant.typography);
83
- const typographyClassName = typography.useTypographyClassName(enhancedTypography);
76
+ const enhancedTypography = leaf.useEnhancedTypography(descendant.typography);
77
+ const typographyClassName = leaf.useTypographyClassName(enhancedTypography);
84
78
  return /* @__PURE__ */ jsxRuntime.jsx("span", {
85
79
  className: typographyClassName,
86
- children: descendant.text
80
+ children: descendant.text === "" ? "\uFEFF" : descendant.text
87
81
  });
88
82
  }
89
83
  function InlineElement({
@@ -231,23 +225,20 @@ function Descendants({
231
225
  descendants
232
226
  }) {
233
227
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
234
- children: descendants.map((d) => {
235
- switch (d.type) {
236
- case richText.TextType.Typography:
237
- return /* @__PURE__ */ jsxRuntime.jsx(TypographyElement, {
238
- descendant: d
239
- });
240
- case richText.TextType.Text:
241
- return /* @__PURE__ */ jsxRuntime.jsx(TextElement, {
242
- descendant: d
243
- });
228
+ children: descendants.map((descendant, index2) => {
229
+ if ("text" in descendant) {
230
+ return /* @__PURE__ */ jsxRuntime.jsx(TextElement, {
231
+ descendant
232
+ }, index2);
233
+ }
234
+ switch (descendant.type) {
244
235
  case richText.InlineType.Link:
245
236
  case richText.InlineType.Code:
246
237
  case richText.InlineType.SubScript:
247
238
  case richText.InlineType.SuperScript:
248
239
  return /* @__PURE__ */ jsxRuntime.jsx(InlineElement, {
249
- descendant: d
250
- });
240
+ descendant
241
+ }, index2);
251
242
  case richText.BlockType.Heading1:
252
243
  case richText.BlockType.Heading2:
253
244
  case richText.BlockType.Heading3:
@@ -258,16 +249,61 @@ function Descendants({
258
249
  case richText.BlockType.ListItem:
259
250
  case richText.BlockType.ListItemChild:
260
251
  return /* @__PURE__ */ jsxRuntime.jsx(BlockElement, {
261
- descendant: d
262
- });
252
+ descendant
253
+ }, index2);
263
254
  default:
264
255
  return null;
265
256
  }
266
257
  })
267
258
  });
268
259
  }
260
+ function isBlock(descendant) {
261
+ if ("text" in descendant)
262
+ return false;
263
+ switch (descendant.type) {
264
+ case richText.BlockType.Heading1:
265
+ case richText.BlockType.Heading2:
266
+ case richText.BlockType.Heading3:
267
+ case richText.BlockType.BlockQuote:
268
+ case richText.BlockType.Paragraph:
269
+ case richText.BlockType.OrderedList:
270
+ case richText.BlockType.UnorderedList:
271
+ case richText.BlockType.ListItem:
272
+ case richText.BlockType.ListItemChild:
273
+ return true;
274
+ default:
275
+ return false;
276
+ }
277
+ }
278
+ function getTextByDescendant(descendant) {
279
+ var _a, _b, _c;
280
+ if ("text" in descendant) {
281
+ return (_a = descendant.text) != null ? _a : "";
282
+ }
283
+ switch (descendant.type) {
284
+ case richText.InlineType.Link:
285
+ case richText.InlineType.Code:
286
+ case richText.InlineType.SubScript:
287
+ case richText.InlineType.SuperScript:
288
+ return (_b = descendant.children.map((descendant2) => getTextByDescendant(descendant2)).join("")) != null ? _b : "";
289
+ case richText.BlockType.Heading1:
290
+ case richText.BlockType.Heading2:
291
+ case richText.BlockType.Heading3:
292
+ case richText.BlockType.BlockQuote:
293
+ case richText.BlockType.Paragraph:
294
+ case richText.BlockType.OrderedList:
295
+ case richText.BlockType.UnorderedList:
296
+ case richText.BlockType.ListItem:
297
+ case richText.BlockType.ListItemChild:
298
+ return (_c = descendant.children.map((descendant2) => getTextByDescendant(descendant2)).join(descendant.children.every(isBlock) ? "\n" : "")) != null ? _c : "";
299
+ default:
300
+ return "";
301
+ }
302
+ }
303
+ function getText(descendant) {
304
+ return descendant.map(getTextByDescendant).join("\n");
305
+ }
269
306
  exports.BlockElement = BlockElement;
270
307
  exports.TextElement = TextElement;
271
- exports.TypographyElement = TypographyElement;
272
308
  exports["default"] = ReadOnlyText;
273
309
  //# sourceMappingURL=ReadOnlyText.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReadOnlyText.cjs.js","sources":["../src/components/builtin/Text/ReadOnlyText.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { Descendant } from 'slate'\nimport {\n Block,\n BlockType,\n Inline,\n InlineType,\n richTextDTOtoDAO,\n Text,\n TextType,\n TypographyText,\n} from '../../../controls'\nimport type { ElementIDValue, RichTextValue } from '../../../prop-controllers/descriptors'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { Link } from '../../shared/Link'\nimport { responsiveStyle } from '../../utils/responsive-style'\nimport useEnhancedTypography, { useTypographyClassName } from './components/Leaf/typography'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst ReadOnlyText = forwardRef(function ReadOnlyText(\n { id, text, width, margin }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendants = text == null ? '' : richTextDTOtoDAO(text)\n return (\n <div ref={ref} id={id} className={cx(width, margin)}>\n {descendants === '' ? <Placeholder /> : <Descendants descendants={descendants} />}\n </div>\n )\n})\n\nexport default ReadOnlyText\n\nfunction Placeholder({ text = 'Write some text...' }: { text?: string }) {\n return (\n <span\n className={useStyle({\n display: 'inline-block',\n width: 0,\n maxWidth: '100%',\n whiteSpace: 'nowrap',\n opacity: 0.333,\n verticalAlign: 'text-top',\n })}\n >\n {text}\n </span>\n )\n}\n\nexport interface TextProps {\n descendant: Text\n}\n\nexport function TextElement({ descendant }: TextProps) {\n return <span>{descendant.text}</span>\n}\n\nexport interface TypographyProps {\n descendant: TypographyText\n}\n\nexport function TypographyElement({ descendant }: TypographyProps) {\n const enhancedTypography = useEnhancedTypography(descendant.typography)\n const typographyClassName = useTypographyClassName(enhancedTypography)\n\n return <span className={typographyClassName}>{descendant.text}</span>\n}\n\nexport interface InlineProps {\n descendant: Inline\n}\n\nfunction InlineElement({ descendant }: InlineProps) {\n const linkClassName = useStyle({ textDecoration: 'none' })\n\n switch (descendant.type) {\n case InlineType.Code:\n return (\n <code>\n <Descendants descendants={descendant.children} />\n </code>\n )\n\n case InlineType.SuperScript:\n return (\n <sup>\n <Descendants descendants={descendant.children} />\n </sup>\n )\n\n case InlineType.SubScript:\n return (\n <sub>\n <Descendants descendants={descendant.children} />\n </sub>\n )\n\n case InlineType.Link:\n return (\n <Link className={linkClassName} link={descendant.link}>\n <Descendants descendants={descendant.children} />\n </Link>\n )\n }\n}\n\nexport interface BlockProps {\n descendant: Block\n}\n\nexport function BlockElement({ descendant }: BlockProps) {\n const blockStyles = [\n useStyle({ margin: 0 }),\n useStyle(responsiveStyle([descendant.textAlign], ([textAlign = 'left']) => ({ textAlign }))),\n ]\n\n switch (descendant.type) {\n case BlockType.Paragraph:\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote\n className={cx(\n ...blockStyles,\n useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n }),\n )}\n >\n <Descendants descendants={descendant.children} />\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} />\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} />\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </span>\n )\n }\n}\n\nfunction Descendants({ descendants }: { descendants: Descendant[] }) {\n return (\n <>\n {descendants.map(d => {\n switch (d.type) {\n case TextType.Typography:\n return <TypographyElement descendant={d} />\n case TextType.Text:\n return <TextElement descendant={d} />\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return <InlineElement descendant={d} />\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement descendant={d} />\n default:\n return null\n }\n })}\n </>\n )\n}\n"],"names":["ReadOnlyText","forwardRef","id","text","width","margin","ref","descendants","richTextDTOtoDAO","cx","_jsx","useStyle","display","maxWidth","whiteSpace","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","blockStyles","responsiveStyle","textAlign","BlockType","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","padding","fontSize","fontWeight","borderLeft","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","_Fragment","map","d","TextType","Typography","Text"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BMA,MAAAA,eAAeC,MAAAA,WAAW,uBAC9B;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAMC;AAAAA,EAAOC;AAAAA,GACnBC,KACA;AACMC,QAAAA,cAAcJ,QAAQ,OAAO,KAAKK,SAAAA,iBAAiBL,IAAD;AAEtD,wCAAA,OAAA;AAAA,IAAK;AAAA,IAAU;AAAA,IAAQ,WAAWM,IAAAA,GAAGL,OAAOC,MAAR;AAAA,IACjCE,UAAAA,gBAAgB,KAAKG,2BAAA,IAAC,aAAD,EAAA,IAAkBA,2BAAA,IAAC,aAAD;AAAA,MAAa;AAAA,IAAA,CAAb;AAAA,EAAA,CAF5C;AAKD,CAV8B;AAc/B,qBAAqB;AAAA,EAAEP,OAAO;AAAA,GAA2C;AAErE,wCAAA,QAAA;AAAA,IACE,WAAWQ,KAAAA,SAAS;AAAA,MAClBC,SAAS;AAAA,MACTR,OAAO;AAAA,MACPS,UAAU;AAAA,MACVC,YAAY;AAAA,MACZC,SAAS;AAAA,MACTC,eAAe;AAAA,IAAA,CANE;AAAA,IASlBb,UAAAA;AAAAA,EAAAA,CAXL;AAcD;AAM2B,qBAAA;AAAA,EAAEc;AAAAA,GAAyB;AAC9C,wCAAA,QAAA;AAAA,IAAA,UAAOA,WAAWd;AAAAA,EAAAA,CAAzB;AACD;AAMiC,2BAAA;AAAA,EAAEc;AAAAA,GAA+B;AAC3DC,QAAAA,qBAAqBC,WAAAA,sBAAsBF,WAAWG,UAAZ;AAC1CC,QAAAA,sBAAsBC,kCAAuBJ,kBAAD;AAE3C,wCAAA,QAAA;AAAA,IAAM,WAAWG;AAAAA,IAAjB,UAAuCJ,WAAWd;AAAAA,EAAAA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gC,SAASC,SAAAA;AACZ,gDAAQ,mBAAD;AAAA,YAAmB,YAAYF;AAAAA,UAAAA,CAAtC;AAAA,aACGC,SAASE,SAAAA;AACZ,gDAAQ,aAAD;AAAA,YAAa,YAAYH;AAAAA,UAAAA,CAAhC;AAAA,aACG9B,SAAAA,WAAWK;AAAAA,aACXL,SAAAA,WAAWC;AAAAA,aACXD,SAAAA,WAAWI;AAAAA,aACXJ,SAAWG,WAAAA;AACd,gDAAQ,eAAD;AAAA,YAAe,YAAY2B;AAAAA,UAAAA,CAAlC;AAAA,aACGpB,SAAAA,UAAUE;AAAAA,aACVF,SAAAA,UAAUG;AAAAA,aACVH,SAAAA,UAAUI;AAAAA,aACVJ,SAAAA,UAAUQ;AAAAA,aACVR,SAAAA,UAAUC;AAAAA,aACVD,SAAAA,UAAUa;AAAAA,aACVb,SAAAA,UAAUe;AAAAA,aACVf,SAAAA,UAAUgB;AAAAA,aACVhB,SAAUiB,UAAAA;AACb,gDAAQ,cAAD;AAAA,YAAc,YAAYG;AAAAA,UAAAA,CAAjC;AAAA;AAEO,iBAAA;AAAA;AAAA,IAAA,CAtBZ;AAAA,EAAA,CAFL;AA6BD;;;;;"}
1
+ {"version":3,"file":"ReadOnlyText.cjs.js","sources":["../src/components/builtin/Text/ReadOnlyText.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport {\n Block,\n BlockType,\n Inline,\n InlineType,\n richTextDTOtoDAO,\n Text,\n Element,\n} from '../../../controls'\nimport type { ElementIDValue, RichTextValue } from '../../../prop-controllers/descriptors'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { Link } from '../../shared/Link'\nimport { responsiveStyle } from '../../utils/responsive-style'\nimport { useTypographyClassName } from './components'\nimport useEnhancedTypography from './components/Leaf/leaf'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst ReadOnlyText = forwardRef(function ReadOnlyText(\n { id, text, width, margin }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendants = text == null ? [] : richTextDTOtoDAO(text)\n const descendantsAsString = getText(descendants)\n\n return (\n <div ref={ref} id={id} className={cx(width, margin)}>\n {descendantsAsString === '' ? <Placeholder /> : <Descendants descendants={descendants} />}\n </div>\n )\n})\n\nexport default ReadOnlyText\n\nfunction Placeholder({ text = 'Write some text...' }: { text?: string }) {\n return (\n <span\n className={useStyle({\n display: 'inline-block',\n width: 0,\n maxWidth: '100%',\n whiteSpace: 'nowrap',\n opacity: 0.333,\n verticalAlign: 'text-top',\n })}\n >\n {text}\n </span>\n )\n}\n\nexport interface TextProps {\n descendant: Text\n}\n\nexport function TextElement({ descendant }: TextProps) {\n const enhancedTypography = useEnhancedTypography(descendant.typography)\n const typographyClassName = useTypographyClassName(enhancedTypography)\n\n return (\n <span className={typographyClassName}>\n {descendant.text === '' ? '\\uFEFF' : descendant.text}\n </span>\n )\n}\n\nexport interface InlineProps {\n descendant: Inline\n}\n\nfunction InlineElement({ descendant }: InlineProps) {\n const linkClassName = useStyle({ textDecoration: 'none' })\n\n switch (descendant.type) {\n case InlineType.Code:\n return (\n <code>\n <Descendants descendants={descendant.children} />\n </code>\n )\n\n case InlineType.SuperScript:\n return (\n <sup>\n <Descendants descendants={descendant.children} />\n </sup>\n )\n\n case InlineType.SubScript:\n return (\n <sub>\n <Descendants descendants={descendant.children} />\n </sub>\n )\n\n case InlineType.Link:\n return (\n <Link className={linkClassName} link={descendant.link}>\n <Descendants descendants={descendant.children} />\n </Link>\n )\n }\n}\n\nexport interface BlockProps {\n descendant: Block\n}\n\nexport function BlockElement({ descendant }: BlockProps) {\n const blockStyles = [\n useStyle({ margin: 0 }),\n useStyle(responsiveStyle([descendant.textAlign], ([textAlign = 'left']) => ({ textAlign }))),\n ]\n\n switch (descendant.type) {\n case BlockType.Paragraph:\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote\n className={cx(\n ...blockStyles,\n useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n }),\n )}\n >\n <Descendants descendants={descendant.children} />\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} />\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} />\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </span>\n )\n }\n}\n\nfunction Descendants({ descendants }: { descendants: (Element | Text)[] }) {\n return (\n <>\n {descendants.map((descendant, index) => {\n if ('text' in descendant) {\n return <TextElement key={index} descendant={descendant} />\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return <InlineElement key={index} descendant={descendant} />\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement key={index} descendant={descendant} />\n default:\n return null\n }\n })}\n </>\n )\n}\n\nfunction isBlock(descendant: Element | Text): descendant is Block {\n if ('text' in descendant) return false\n\n switch (descendant.type) {\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return true\n\n default:\n return false\n }\n}\n\n/**\n * I am using `Element | Text` here to ensure that nothing from Slate \n * is imported so that the RichText maintains it's slim bundle size \n */\nfunction getTextByDescendant(descendant: Element | Text): string {\n if ('text' in descendant) {\n return descendant.text ?? ''\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return descendant.children.map(descendant => getTextByDescendant(descendant)).join('') ?? ''\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return (\n descendant.children\n .map(descendant => getTextByDescendant(descendant))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n )\n default:\n return ''\n }\n}\n\nfunction getText(descendant: (Element | Text)[]): string {\n return descendant.map(getTextByDescendant).join('\\n')\n}\n"],"names":["ReadOnlyText","forwardRef","id","text","width","margin","ref","descendants","richTextDTOtoDAO","descendantsAsString","getText","cx","_jsx","useStyle","display","maxWidth","whiteSpace","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","blockStyles","responsiveStyle","textAlign","BlockType","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","padding","fontSize","fontWeight","borderLeft","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","_Fragment","map","index","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBMA,MAAAA,eAAeC,MAAAA,WAAW,uBAC9B;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAMC;AAAAA,EAAOC;AAAAA,GACnBC,KACA;AACMC,QAAAA,cAAcJ,QAAQ,OAAO,CAAA,IAAKK,SAAAA,iBAAiBL,IAAD;AAClDM,QAAAA,sBAAsBC,QAAQH,WAAD;AAGjC,wCAAA,OAAA;AAAA,IAAK;AAAA,IAAU;AAAA,IAAQ,WAAWI,IAAAA,GAAGP,OAAOC,MAAR;AAAA,IACjCI,UAAAA,wBAAwB,KAAKG,2BAAA,IAAC,aAAD,EAAA,IAAkBA,2BAAA,IAAC,aAAD;AAAA,MAAa;AAAA,IAAA,CAAb;AAAA,EAAA,CAFpD;AAKD,CAZ8B;AAgB/B,qBAAqB;AAAA,EAAET,OAAO;AAAA,GAA2C;AAErE,wCAAA,QAAA;AAAA,IACE,WAAWU,KAAAA,SAAS;AAAA,MAClBC,SAAS;AAAA,MACTV,OAAO;AAAA,MACPW,UAAU;AAAA,MACVC,YAAY;AAAA,MACZC,SAAS;AAAA,MACTC,eAAe;AAAA,IAAA,CANE;AAAA,IASlBf,UAAAA;AAAAA,EAAAA,CAXL;AAcD;AAM2B,qBAAA;AAAA,EAAEgB;AAAAA,GAAyB;AAC/CC,QAAAA,qBAAqBC,KAAAA,sBAAsBF,WAAWG,UAAZ;AAC1CC,QAAAA,sBAAsBC,4BAAuBJ,kBAAD;AAGhD,wCAAA,QAAA;AAAA,IAAM,WAAWG;AAAAA,IACdJ,UAAAA,WAAWhB,SAAS,KAAK,WAAWgB,WAAWhB;AAAAA,EAAAA,CAFpD;AAKD;AAM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AAAA;AACPZ,aAAAA,iBAAWW,SAAS2B,IAAItC,CAAcwC,gBAAAA,oBAAoBxC,WAAD,CAAzD,EAAuEyC,KAAK,EAA5E,MAAAzC,YAAmF;AAAA,SACvFmB,SAAAA,UAAUE;AAAAA,SACVF,SAAAA,UAAUG;AAAAA,SACVH,SAAAA,UAAUI;AAAAA,SACVJ,SAAAA,UAAUQ;AAAAA,SACVR,SAAAA,UAAUC;AAAAA,SACVD,SAAAA,UAAUa;AAAAA,SACVb,SAAAA,UAAUe;AAAAA,SACVf,SAAAA,UAAUgB;AAAAA,SACVhB,SAAUiB,UAAAA;AAEXpC,aAAAA,iBAAWW,SACR2B,IAAItC,CAAcwC,gBAAAA,oBAAoBxC,WAAD,CADxC,EAEGyC,KAAKzC,WAAWW,SAAS+B,MAAMC,OAA1B,IAAqC,OAAO,EAFpD,MAAA3C,YAE2D;AAAA;AAGtD,aAAA;AAAA;AAEZ;AAED,iBAAiBA,YAAwC;AAChDA,SAAAA,WAAWsC,IAAIE,mBAAf,EAAoCC,KAAK,IAAzC;AACR;;;;"}
@@ -1,12 +1,12 @@
1
1
  import { cx } from "@emotion/css";
2
2
  import { forwardRef } from "react";
3
- import { ar as richTextDTOtoDAO, av as BlockType, aw as InlineType, au as TextType } from "./rich-text.es.js";
3
+ import { ar as richTextDTOtoDAO, au as BlockType, av as InlineType } from "./rich-text.es.js";
4
4
  import "slate";
5
5
  import "slate-react";
6
6
  import { o as useStyle, r as responsiveStyle } from "./index.es.js";
7
7
  import { L as Link } from "./index.es3.js";
8
- import { u as useEnhancedTypography, a as useTypographyClassName } from "./typography.es.js";
9
8
  import { jsx, Fragment } from "react/jsx-runtime";
9
+ import { u as useEnhancedTypography, a as useTypographyClassName } from "./leaf.es.js";
10
10
  import "./actions.es.js";
11
11
  import "use-sync-external-store/shim/with-selector";
12
12
  import "next/dynamic";
@@ -42,12 +42,13 @@ const ReadOnlyText = forwardRef(function ReadOnlyText2({
42
42
  width,
43
43
  margin
44
44
  }, ref) {
45
- const descendants = text == null ? "" : richTextDTOtoDAO(text);
45
+ const descendants = text == null ? [] : richTextDTOtoDAO(text);
46
+ const descendantsAsString = getText(descendants);
46
47
  return /* @__PURE__ */ jsx("div", {
47
48
  ref,
48
49
  id,
49
50
  className: cx(width, margin),
50
- children: descendants === "" ? /* @__PURE__ */ jsx(Placeholder, {}) : /* @__PURE__ */ jsx(Descendants, {
51
+ children: descendantsAsString === "" ? /* @__PURE__ */ jsx(Placeholder, {}) : /* @__PURE__ */ jsx(Descendants, {
51
52
  descendants
52
53
  })
53
54
  });
@@ -69,19 +70,12 @@ function Placeholder({
69
70
  }
70
71
  function TextElement({
71
72
  descendant
72
- }) {
73
- return /* @__PURE__ */ jsx("span", {
74
- children: descendant.text
75
- });
76
- }
77
- function TypographyElement({
78
- descendant
79
73
  }) {
80
74
  const enhancedTypography = useEnhancedTypography(descendant.typography);
81
75
  const typographyClassName = useTypographyClassName(enhancedTypography);
82
76
  return /* @__PURE__ */ jsx("span", {
83
77
  className: typographyClassName,
84
- children: descendant.text
78
+ children: descendant.text === "" ? "\uFEFF" : descendant.text
85
79
  });
86
80
  }
87
81
  function InlineElement({
@@ -229,23 +223,20 @@ function Descendants({
229
223
  descendants
230
224
  }) {
231
225
  return /* @__PURE__ */ jsx(Fragment, {
232
- children: descendants.map((d) => {
233
- switch (d.type) {
234
- case TextType.Typography:
235
- return /* @__PURE__ */ jsx(TypographyElement, {
236
- descendant: d
237
- });
238
- case TextType.Text:
239
- return /* @__PURE__ */ jsx(TextElement, {
240
- descendant: d
241
- });
226
+ children: descendants.map((descendant, index) => {
227
+ if ("text" in descendant) {
228
+ return /* @__PURE__ */ jsx(TextElement, {
229
+ descendant
230
+ }, index);
231
+ }
232
+ switch (descendant.type) {
242
233
  case InlineType.Link:
243
234
  case InlineType.Code:
244
235
  case InlineType.SubScript:
245
236
  case InlineType.SuperScript:
246
237
  return /* @__PURE__ */ jsx(InlineElement, {
247
- descendant: d
248
- });
238
+ descendant
239
+ }, index);
249
240
  case BlockType.Heading1:
250
241
  case BlockType.Heading2:
251
242
  case BlockType.Heading3:
@@ -256,13 +247,59 @@ function Descendants({
256
247
  case BlockType.ListItem:
257
248
  case BlockType.ListItemChild:
258
249
  return /* @__PURE__ */ jsx(BlockElement, {
259
- descendant: d
260
- });
250
+ descendant
251
+ }, index);
261
252
  default:
262
253
  return null;
263
254
  }
264
255
  })
265
256
  });
266
257
  }
267
- export { BlockElement, TextElement, TypographyElement, ReadOnlyText as default };
258
+ function isBlock(descendant) {
259
+ if ("text" in descendant)
260
+ return false;
261
+ switch (descendant.type) {
262
+ case BlockType.Heading1:
263
+ case BlockType.Heading2:
264
+ case BlockType.Heading3:
265
+ case BlockType.BlockQuote:
266
+ case BlockType.Paragraph:
267
+ case BlockType.OrderedList:
268
+ case BlockType.UnorderedList:
269
+ case BlockType.ListItem:
270
+ case BlockType.ListItemChild:
271
+ return true;
272
+ default:
273
+ return false;
274
+ }
275
+ }
276
+ function getTextByDescendant(descendant) {
277
+ var _a, _b, _c;
278
+ if ("text" in descendant) {
279
+ return (_a = descendant.text) != null ? _a : "";
280
+ }
281
+ switch (descendant.type) {
282
+ case InlineType.Link:
283
+ case InlineType.Code:
284
+ case InlineType.SubScript:
285
+ case InlineType.SuperScript:
286
+ return (_b = descendant.children.map((descendant2) => getTextByDescendant(descendant2)).join("")) != null ? _b : "";
287
+ case BlockType.Heading1:
288
+ case BlockType.Heading2:
289
+ case BlockType.Heading3:
290
+ case BlockType.BlockQuote:
291
+ case BlockType.Paragraph:
292
+ case BlockType.OrderedList:
293
+ case BlockType.UnorderedList:
294
+ case BlockType.ListItem:
295
+ case BlockType.ListItemChild:
296
+ return (_c = descendant.children.map((descendant2) => getTextByDescendant(descendant2)).join(descendant.children.every(isBlock) ? "\n" : "")) != null ? _c : "";
297
+ default:
298
+ return "";
299
+ }
300
+ }
301
+ function getText(descendant) {
302
+ return descendant.map(getTextByDescendant).join("\n");
303
+ }
304
+ export { BlockElement, TextElement, ReadOnlyText as default };
268
305
  //# sourceMappingURL=ReadOnlyText.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReadOnlyText.es.js","sources":["../src/components/builtin/Text/ReadOnlyText.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { Descendant } from 'slate'\nimport {\n Block,\n BlockType,\n Inline,\n InlineType,\n richTextDTOtoDAO,\n Text,\n TextType,\n TypographyText,\n} from '../../../controls'\nimport type { ElementIDValue, RichTextValue } from '../../../prop-controllers/descriptors'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { Link } from '../../shared/Link'\nimport { responsiveStyle } from '../../utils/responsive-style'\nimport useEnhancedTypography, { useTypographyClassName } from './components/Leaf/typography'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst ReadOnlyText = forwardRef(function ReadOnlyText(\n { id, text, width, margin }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendants = text == null ? '' : richTextDTOtoDAO(text)\n return (\n <div ref={ref} id={id} className={cx(width, margin)}>\n {descendants === '' ? <Placeholder /> : <Descendants descendants={descendants} />}\n </div>\n )\n})\n\nexport default ReadOnlyText\n\nfunction Placeholder({ text = 'Write some text...' }: { text?: string }) {\n return (\n <span\n className={useStyle({\n display: 'inline-block',\n width: 0,\n maxWidth: '100%',\n whiteSpace: 'nowrap',\n opacity: 0.333,\n verticalAlign: 'text-top',\n })}\n >\n {text}\n </span>\n )\n}\n\nexport interface TextProps {\n descendant: Text\n}\n\nexport function TextElement({ descendant }: TextProps) {\n return <span>{descendant.text}</span>\n}\n\nexport interface TypographyProps {\n descendant: TypographyText\n}\n\nexport function TypographyElement({ descendant }: TypographyProps) {\n const enhancedTypography = useEnhancedTypography(descendant.typography)\n const typographyClassName = useTypographyClassName(enhancedTypography)\n\n return <span className={typographyClassName}>{descendant.text}</span>\n}\n\nexport interface InlineProps {\n descendant: Inline\n}\n\nfunction InlineElement({ descendant }: InlineProps) {\n const linkClassName = useStyle({ textDecoration: 'none' })\n\n switch (descendant.type) {\n case InlineType.Code:\n return (\n <code>\n <Descendants descendants={descendant.children} />\n </code>\n )\n\n case InlineType.SuperScript:\n return (\n <sup>\n <Descendants descendants={descendant.children} />\n </sup>\n )\n\n case InlineType.SubScript:\n return (\n <sub>\n <Descendants descendants={descendant.children} />\n </sub>\n )\n\n case InlineType.Link:\n return (\n <Link className={linkClassName} link={descendant.link}>\n <Descendants descendants={descendant.children} />\n </Link>\n )\n }\n}\n\nexport interface BlockProps {\n descendant: Block\n}\n\nexport function BlockElement({ descendant }: BlockProps) {\n const blockStyles = [\n useStyle({ margin: 0 }),\n useStyle(responsiveStyle([descendant.textAlign], ([textAlign = 'left']) => ({ textAlign }))),\n ]\n\n switch (descendant.type) {\n case BlockType.Paragraph:\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote\n className={cx(\n ...blockStyles,\n useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n }),\n )}\n >\n <Descendants descendants={descendant.children} />\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} />\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} />\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </span>\n )\n }\n}\n\nfunction Descendants({ descendants }: { descendants: Descendant[] }) {\n return (\n <>\n {descendants.map(d => {\n switch (d.type) {\n case TextType.Typography:\n return <TypographyElement descendant={d} />\n case TextType.Text:\n return <TextElement descendant={d} />\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return <InlineElement descendant={d} />\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement descendant={d} />\n default:\n return null\n }\n })}\n </>\n )\n}\n"],"names":["ReadOnlyText","forwardRef","id","text","width","margin","ref","descendants","richTextDTOtoDAO","cx","_jsx","useStyle","display","maxWidth","whiteSpace","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","blockStyles","responsiveStyle","textAlign","BlockType","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","padding","fontSize","fontWeight","borderLeft","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","_Fragment","map","d","TextType","Typography","Text"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BMA,MAAAA,eAAeC,WAAW,uBAC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AAA,YAAc,YAAYG;AAAAA,UAAAA,CAAjC;AAAA;AAEO,iBAAA;AAAA;AAAA,IAAA,CAtBZ;AAAA,EAAA,CAFL;AA6BD;;"}
1
+ {"version":3,"file":"ReadOnlyText.es.js","sources":["../src/components/builtin/Text/ReadOnlyText.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport {\n Block,\n BlockType,\n Inline,\n InlineType,\n richTextDTOtoDAO,\n Text,\n Element,\n} from '../../../controls'\nimport type { ElementIDValue, RichTextValue } from '../../../prop-controllers/descriptors'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { Link } from '../../shared/Link'\nimport { responsiveStyle } from '../../utils/responsive-style'\nimport { useTypographyClassName } from './components'\nimport useEnhancedTypography from './components/Leaf/leaf'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst ReadOnlyText = forwardRef(function ReadOnlyText(\n { id, text, width, margin }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendants = text == null ? [] : richTextDTOtoDAO(text)\n const descendantsAsString = getText(descendants)\n\n return (\n <div ref={ref} id={id} className={cx(width, margin)}>\n {descendantsAsString === '' ? <Placeholder /> : <Descendants descendants={descendants} />}\n </div>\n )\n})\n\nexport default ReadOnlyText\n\nfunction Placeholder({ text = 'Write some text...' }: { text?: string }) {\n return (\n <span\n className={useStyle({\n display: 'inline-block',\n width: 0,\n maxWidth: '100%',\n whiteSpace: 'nowrap',\n opacity: 0.333,\n verticalAlign: 'text-top',\n })}\n >\n {text}\n </span>\n )\n}\n\nexport interface TextProps {\n descendant: Text\n}\n\nexport function TextElement({ descendant }: TextProps) {\n const enhancedTypography = useEnhancedTypography(descendant.typography)\n const typographyClassName = useTypographyClassName(enhancedTypography)\n\n return (\n <span className={typographyClassName}>\n {descendant.text === '' ? '\\uFEFF' : descendant.text}\n </span>\n )\n}\n\nexport interface InlineProps {\n descendant: Inline\n}\n\nfunction InlineElement({ descendant }: InlineProps) {\n const linkClassName = useStyle({ textDecoration: 'none' })\n\n switch (descendant.type) {\n case InlineType.Code:\n return (\n <code>\n <Descendants descendants={descendant.children} />\n </code>\n )\n\n case InlineType.SuperScript:\n return (\n <sup>\n <Descendants descendants={descendant.children} />\n </sup>\n )\n\n case InlineType.SubScript:\n return (\n <sub>\n <Descendants descendants={descendant.children} />\n </sub>\n )\n\n case InlineType.Link:\n return (\n <Link className={linkClassName} link={descendant.link}>\n <Descendants descendants={descendant.children} />\n </Link>\n )\n }\n}\n\nexport interface BlockProps {\n descendant: Block\n}\n\nexport function BlockElement({ descendant }: BlockProps) {\n const blockStyles = [\n useStyle({ margin: 0 }),\n useStyle(responsiveStyle([descendant.textAlign], ([textAlign = 'left']) => ({ textAlign }))),\n ]\n\n switch (descendant.type) {\n case BlockType.Paragraph:\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote\n className={cx(\n ...blockStyles,\n useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n }),\n )}\n >\n <Descendants descendants={descendant.children} />\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} />\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} />\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </span>\n )\n }\n}\n\nfunction Descendants({ descendants }: { descendants: (Element | Text)[] }) {\n return (\n <>\n {descendants.map((descendant, index) => {\n if ('text' in descendant) {\n return <TextElement key={index} descendant={descendant} />\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return <InlineElement key={index} descendant={descendant} />\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement key={index} descendant={descendant} />\n default:\n return null\n }\n })}\n </>\n )\n}\n\nfunction isBlock(descendant: Element | Text): descendant is Block {\n if ('text' in descendant) return false\n\n switch (descendant.type) {\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return true\n\n default:\n return false\n }\n}\n\n/**\n * I am using `Element | Text` here to ensure that nothing from Slate \n * is imported so that the RichText maintains it's slim bundle size \n */\nfunction getTextByDescendant(descendant: Element | Text): string {\n if ('text' in descendant) {\n return descendant.text ?? ''\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return descendant.children.map(descendant => getTextByDescendant(descendant)).join('') ?? ''\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return (\n descendant.children\n .map(descendant => getTextByDescendant(descendant))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n )\n default:\n return ''\n }\n}\n\nfunction getText(descendant: (Element | Text)[]): string {\n return descendant.map(getTextByDescendant).join('\\n')\n}\n"],"names":["ReadOnlyText","forwardRef","id","text","width","margin","ref","descendants","richTextDTOtoDAO","descendantsAsString","getText","cx","_jsx","useStyle","display","maxWidth","whiteSpace","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","blockStyles","responsiveStyle","textAlign","BlockType","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","padding","fontSize","fontWeight","borderLeft","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","_Fragment","map","index","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBMA,MAAAA,eAAeC,WAAW,uBAC9B;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAMC;AAAAA,EAAOC;AAAAA,GACnBC,KACA;AACMC,QAAAA,cAAcJ,QAAQ,OAAO,CAAA,IAAKK,iBAAiBL,IAAD;AAClDM,QAAAA,sBAAsBC,QAAQH,WAAD;AAGjC,6BAAA,OAAA;AAAA,IAAK;AAAA,IAAU;AAAA,IAAQ,WAAWI,GAAGP,OAAOC,MAAR;AAAA,IACjCI,UAAAA,wBAAwB,KAAKG,oBAAC,aAAD,EAAA,IAAkBA,oBAAC,aAAD;AAAA,MAAa;AAAA,IAAA,CAAb;AAAA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WhB,SAAXgB,YAAmB;AAAA,EAC3B;AAEOA,UAAAA,WAAWQ;AAAAA,SACZC,WAAWK;AAAAA,SACXL,WAAWC;AAAAA,SACXD,WAAWI;AAAAA,SACXJ,WAAWG;AACPZ,aAAAA,iBAAWW,SAAS2B,IAAItC,CAAcwC,gBAAAA,oBAAoBxC,WAAD,CAAzD,EAAuEyC,KAAK,EAA5E,MAAAzC,YAAmF;AAAA,SACvFmB,UAAUE;AAAAA,SACVF,UAAUG;AAAAA,SACVH,UAAUI;AAAAA,SACVJ,UAAUQ;AAAAA,SACVR,UAAUC;AAAAA,SACVD,UAAUa;AAAAA,SACVb,UAAUe;AAAAA,SACVf,UAAUgB;AAAAA,SACVhB,UAAUiB;AAEXpC,aAAAA,iBAAWW,SACR2B,IAAItC,CAAcwC,gBAAAA,oBAAoBxC,WAAD,CADxC,EAEGyC,KAAKzC,WAAWW,SAAS+B,MAAMC,OAA1B,IAAqC,OAAO,EAFpD,MAAA3C,YAE2D;AAAA;AAGtD,aAAA;AAAA;AAEZ;AAED,iBAAiBA,YAAwC;AAChDA,SAAAA,WAAWsC,IAAIE,mBAAf,EAAoCC,KAAK,IAAzC;AACR;;"}
@@ -3,7 +3,6 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
3
3
  var textInput = require("./text-input.cjs.js");
4
4
  var richText = require("./rich-text.cjs.js");
5
5
  var combobox = require("./combobox.cjs.js");
6
- var compare = require("./compare.cjs.js");
7
6
  require("./actions.cjs.js");
8
7
  require("slate");
9
8
  require("slate-react");
@@ -17,6 +16,7 @@ exports.TextArea = textInput.TextArea;
17
16
  exports.TextAreaControlType = textInput.TextAreaControlType;
18
17
  exports.TextInput = textInput.TextInput;
19
18
  exports.TextInputControlType = textInput.TextInputControlType;
19
+ exports.BlockTextAlignment = richText.BlockTextAlignment;
20
20
  exports.BlockType = richText.BlockType;
21
21
  exports.Color = richText.Color;
22
22
  exports.ColorControlType = richText.ColorControlType;
@@ -46,7 +46,6 @@ exports.SlotControlType = richText.SlotControlType;
46
46
  exports.Style = richText.Style;
47
47
  exports.StyleControlProperty = richText.StyleControlProperty;
48
48
  exports.StyleControlType = richText.StyleControlType;
49
- exports.TextType = richText.TextType;
50
49
  exports.copy = richText.copy;
51
50
  exports.copyColorData = richText.copyColorData;
52
51
  exports.copyImageData = richText.copyImageData;
@@ -61,6 +60,4 @@ exports.richTextDTOtoSelection = richText.richTextDTOtoSelection;
61
60
  exports.toSelectionDTO = richText.toSelectionDTO;
62
61
  exports.Combobox = combobox.Combobox;
63
62
  exports.ComboboxControlType = combobox.ComboboxControlType;
64
- exports.compareRichTextDAO = compare.compareRichTextDAO;
65
- exports.compareRichTextSelection = compare.compareRichTextSelection;
66
63
  //# sourceMappingURL=controls.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"controls.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"controls.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,6 @@
1
1
  export { b as Checkbox, C as CheckboxControlType, c as Number, N as NumberControlType, d as Select, S as SelectControlType, e as TextArea, T as TextAreaControlType, f as TextInput, a as TextInputControlType } from "./text-input.es.js";
2
- export { av as BlockType, a2 as Color, C as ColorControlType, a4 as Image, I as ImageControlType, O as ImageControlValueFormat, aw as InlineType, a6 as Link, Q as LinkControlType, a8 as List, aa as ListControl, a9 as ListControlMessageType, L as ListControlType, am as ObjectType, an as RichText, ap as RichTextControl, ao as RichTextControlMessageType, a0 as RichTextControlType, ac as Shape, ae as ShapeControl, ad as ShapeControlMessageType, S as ShapeControlType, ag as Slot, ai as SlotControl, ah as SlotControlMessageType, b as SlotControlType, ak as Style, K as StyleControlProperty, a1 as StyleControlType, au as TextType, a as copy, a3 as copyColorData, a5 as copyImageData, a7 as copyLinkData, ab as copyListData, af as copyShapeData, aj as copySlotData, al as copyStyleData, at as richTextDAOToDTO, ar as richTextDTOtoDAO, aq as richTextDTOtoSelection, as as toSelectionDTO } from "./rich-text.es.js";
2
+ export { aw as BlockTextAlignment, au as BlockType, a2 as Color, C as ColorControlType, a4 as Image, I as ImageControlType, O as ImageControlValueFormat, av as InlineType, a6 as Link, Q as LinkControlType, a8 as List, aa as ListControl, a9 as ListControlMessageType, L as ListControlType, am as ObjectType, an as RichText, ap as RichTextControl, ao as RichTextControlMessageType, a0 as RichTextControlType, ac as Shape, ae as ShapeControl, ad as ShapeControlMessageType, S as ShapeControlType, ag as Slot, ai as SlotControl, ah as SlotControlMessageType, b as SlotControlType, ak as Style, K as StyleControlProperty, a1 as StyleControlType, a as copy, a3 as copyColorData, a5 as copyImageData, a7 as copyLinkData, ab as copyListData, af as copyShapeData, aj as copySlotData, al as copyStyleData, at as richTextDAOToDTO, ar as richTextDTOtoDAO, aq as richTextDTOtoSelection, as as toSelectionDTO } from "./rich-text.es.js";
3
3
  export { a as Combobox, C as ComboboxControlType } from "./combobox.es.js";
4
- export { c as compareRichTextDAO, a as compareRichTextSelection } from "./compare.es.js";
5
4
  import "./actions.es.js";
6
5
  import "slate";
7
6
  import "slate-react";
@@ -1 +1 @@
1
- {"version":3,"file":"controls.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
1
+ {"version":3,"file":"controls.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
package/dist/index.cjs.js CHANGED
@@ -1002,7 +1002,7 @@ function useCachedSite(siteId) {
1002
1002
  const site = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
1003
1003
  return site;
1004
1004
  }
1005
- const version = "0.7.13";
1005
+ const version = "0.7.15";
1006
1006
  class Makeswift {
1007
1007
  constructor(apiKey, { apiOrigin = "https://api.makeswift.com" } = {}) {
1008
1008
  __publicField(this, "apiKey");
@@ -4251,6 +4251,7 @@ exports.forwardNextDynamicRef = forwardNextDynamicRef;
4251
4251
  exports.getServerSideProps = getServerSideProps;
4252
4252
  exports.getStaticPaths = getStaticPaths;
4253
4253
  exports.getStaticProps = getStaticProps;
4254
+ exports.pollBoxModel = pollBoxModel;
4254
4255
  exports.responsiveGridItem = responsiveGridItem;
4255
4256
  exports.responsiveStyle = responsiveStyle;
4256
4257
  exports.responsiveTextStyle = responsiveTextStyle;