@makeswift/runtime 0.9.12 → 0.10.1

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 (244) hide show
  1. package/dist/Box.cjs.js +3 -0
  2. package/dist/Box.cjs.js.map +1 -1
  3. package/dist/Box.es.js +4 -1
  4. package/dist/Box.es.js.map +1 -1
  5. package/dist/Button.cjs.js +3 -2
  6. package/dist/Button.cjs.js.map +1 -1
  7. package/dist/Button.es.js +4 -3
  8. package/dist/Button.es.js.map +1 -1
  9. package/dist/Carousel.cjs.js +3 -2
  10. package/dist/Carousel.cjs.js.map +1 -1
  11. package/dist/Carousel.es.js +4 -3
  12. package/dist/Carousel.es.js.map +1 -1
  13. package/dist/Countdown.cjs.js +3 -0
  14. package/dist/Countdown.cjs.js.map +1 -1
  15. package/dist/Countdown.es.js +4 -1
  16. package/dist/Countdown.es.js.map +1 -1
  17. package/dist/Divider.cjs.js +3 -0
  18. package/dist/Divider.cjs.js.map +1 -1
  19. package/dist/Divider.es.js +4 -1
  20. package/dist/Divider.es.js.map +1 -1
  21. package/dist/Embed.cjs.js +1 -0
  22. package/dist/Embed.cjs.js.map +1 -1
  23. package/dist/Embed.es.js +2 -1
  24. package/dist/Embed.es.js.map +1 -1
  25. package/dist/Form.cjs.js +13 -12
  26. package/dist/Form.cjs.js.map +1 -1
  27. package/dist/Form.es.js +5 -4
  28. package/dist/Form.es.js.map +1 -1
  29. package/dist/Image.cjs.js +11 -10
  30. package/dist/Image.cjs.js.map +1 -1
  31. package/dist/Image.es.js +11 -10
  32. package/dist/Image.es.js.map +1 -1
  33. package/dist/LiveProvider.cjs.js +3 -0
  34. package/dist/LiveProvider.cjs.js.map +1 -1
  35. package/dist/LiveProvider.es.js +5 -2
  36. package/dist/LiveProvider.es.js.map +1 -1
  37. package/dist/Navigation.cjs.js +11 -10
  38. package/dist/Navigation.cjs.js.map +1 -1
  39. package/dist/Navigation.es.js +11 -10
  40. package/dist/Navigation.es.js.map +1 -1
  41. package/dist/PreviewProvider.cjs.js +10 -6
  42. package/dist/PreviewProvider.cjs.js.map +1 -1
  43. package/dist/PreviewProvider.es.js +9 -5
  44. package/dist/PreviewProvider.es.js.map +1 -1
  45. package/dist/ReadOnlyText.cjs.js +19 -26
  46. package/dist/ReadOnlyText.cjs.js.map +1 -1
  47. package/dist/ReadOnlyText.es.js +15 -22
  48. package/dist/ReadOnlyText.es.js.map +1 -1
  49. package/dist/ReadOnlyTextV2.cjs.js +29 -26
  50. package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
  51. package/dist/ReadOnlyTextV2.es.js +28 -25
  52. package/dist/ReadOnlyTextV2.es.js.map +1 -1
  53. package/dist/Root.cjs.js +3 -0
  54. package/dist/Root.cjs.js.map +1 -1
  55. package/dist/Root.es.js +4 -1
  56. package/dist/Root.es.js.map +1 -1
  57. package/dist/SocialLinks.cjs.js +6 -5
  58. package/dist/SocialLinks.cjs.js.map +1 -1
  59. package/dist/SocialLinks.es.js +7 -6
  60. package/dist/SocialLinks.es.js.map +1 -1
  61. package/dist/Text.cjs.js +12 -71
  62. package/dist/Text.cjs.js.map +1 -1
  63. package/dist/Text.es.js +13 -64
  64. package/dist/Text.es.js.map +1 -1
  65. package/dist/Video.cjs.js +1 -0
  66. package/dist/Video.cjs.js.map +1 -1
  67. package/dist/Video.es.js +2 -1
  68. package/dist/Video.es.js.map +1 -1
  69. package/dist/actions.cjs.js +2 -2
  70. package/dist/actions.cjs.js.map +1 -1
  71. package/dist/actions.es.js +2 -2
  72. package/dist/actions.es.js.map +1 -1
  73. package/dist/builder.cjs.js +2 -0
  74. package/dist/builder.cjs.js.map +1 -1
  75. package/dist/builder.es.js +2 -0
  76. package/dist/builder.es.js.map +1 -1
  77. package/dist/components.cjs.js +3 -2
  78. package/dist/components.cjs.js.map +1 -1
  79. package/dist/components.es.js +3 -2
  80. package/dist/components.es.js.map +1 -1
  81. package/dist/control-serialization.es.js +1 -1
  82. package/dist/controls.cjs.js +8 -8
  83. package/dist/controls.es.js +4 -2
  84. package/dist/controls.es.js.map +1 -1
  85. package/dist/index.cjs.js +280 -216
  86. package/dist/index.cjs.js.map +1 -1
  87. package/dist/index.cjs3.js +21 -107
  88. package/dist/index.cjs3.js.map +1 -1
  89. package/dist/index.cjs4.js +16 -57
  90. package/dist/index.cjs4.js.map +1 -1
  91. package/dist/index.cjs5.js +53 -242
  92. package/dist/index.cjs5.js.map +1 -1
  93. package/dist/index.cjs6.js +0 -41
  94. package/dist/index.cjs6.js.map +1 -1
  95. package/dist/index.cjs7.js +376 -14
  96. package/dist/index.cjs7.js.map +1 -1
  97. package/dist/index.cjs8.js +275 -11
  98. package/dist/index.cjs8.js.map +1 -1
  99. package/dist/index.es.js +274 -209
  100. package/dist/index.es.js.map +1 -1
  101. package/dist/index.es2.js +2 -2
  102. package/dist/index.es3.js +22 -103
  103. package/dist/index.es3.js.map +1 -1
  104. package/dist/index.es4.js +16 -57
  105. package/dist/index.es4.js.map +1 -1
  106. package/dist/index.es5.js +53 -240
  107. package/dist/index.es5.js.map +1 -1
  108. package/dist/index.es6.js +1 -36
  109. package/dist/index.es6.js.map +1 -1
  110. package/dist/index.es7.js +372 -16
  111. package/dist/index.es7.js.map +1 -1
  112. package/dist/index.es8.js +270 -10
  113. package/dist/index.es8.js.map +1 -1
  114. package/dist/main.cjs.js +2 -0
  115. package/dist/main.cjs.js.map +1 -1
  116. package/dist/main.es.js +2 -0
  117. package/dist/main.es.js.map +1 -1
  118. package/dist/next.cjs.js +3 -0
  119. package/dist/next.cjs.js.map +1 -1
  120. package/dist/next.es.js +4 -1
  121. package/dist/next.es.js.map +1 -1
  122. package/dist/prop-controllers.cjs.js +2 -0
  123. package/dist/prop-controllers.cjs.js.map +1 -1
  124. package/dist/prop-controllers.es.js +2 -0
  125. package/dist/prop-controllers.es.js.map +1 -1
  126. package/dist/react-page.cjs.js +1450 -65
  127. package/dist/react-page.cjs.js.map +1 -1
  128. package/dist/react-page.es.js +1427 -66
  129. package/dist/react-page.es.js.map +1 -1
  130. package/dist/react.cjs.js +3 -0
  131. package/dist/react.cjs.js.map +1 -1
  132. package/dist/react.es.js +3 -0
  133. package/dist/react.es.js.map +1 -1
  134. package/dist/slate.cjs.js +33 -391
  135. package/dist/slate.cjs.js.map +1 -1
  136. package/dist/slate.es.js +15 -376
  137. package/dist/slate.es.js.map +1 -1
  138. package/dist/text-input.cjs.js +0 -22
  139. package/dist/text-input.cjs.js.map +1 -1
  140. package/dist/text-input.es.js +1 -18
  141. package/dist/text-input.es.js.map +1 -1
  142. package/dist/types/src/components/builtin/Text/Text.d.ts +3 -4
  143. package/dist/types/src/components/builtin/Text/Text.d.ts.map +1 -1
  144. package/dist/types/src/components/builtin/Text/register.d.ts.map +1 -1
  145. package/dist/types/src/controls/rich-text/fixtures/v2-data-types.d.ts.map +1 -1
  146. package/dist/types/src/controls/rich-text/rich-text.d.ts +0 -1
  147. package/dist/types/src/controls/rich-text/rich-text.d.ts.map +1 -1
  148. package/dist/types/src/controls/rich-text/translation.d.ts.map +1 -1
  149. package/dist/types/src/controls/rich-text-v2/plugin.d.ts +29 -0
  150. package/dist/types/src/controls/rich-text-v2/plugin.d.ts.map +1 -0
  151. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +17 -31
  152. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
  153. package/dist/types/src/next/api-handler/index.d.ts.map +1 -1
  154. package/dist/types/src/next/client.d.ts.map +1 -1
  155. package/dist/types/src/next/index.d.ts.map +1 -1
  156. package/dist/types/src/prop-controllers/descriptors.d.ts +1 -1
  157. package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
  158. package/dist/types/src/prop-controllers/introspection.d.ts.map +1 -1
  159. package/dist/types/src/runtimes/react/controls/control.d.ts +1 -1
  160. package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
  161. package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/editable-text.d.ts +4 -3
  162. package/dist/types/src/runtimes/react/controls/rich-text/EditableText/editable-text.d.ts.map +1 -0
  163. package/dist/types/src/runtimes/react/controls/rich-text/EditableText/index.d.ts.map +1 -0
  164. package/dist/types/src/runtimes/react/controls/rich-text/EditableText/useSyncDOMSelection.d.ts.map +1 -0
  165. package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/useSyncWithBuilder.d.ts +1 -1
  166. package/dist/types/src/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.d.ts.map +1 -0
  167. package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/ReadOnlyText.d.ts +2 -2
  168. package/dist/types/src/runtimes/react/controls/rich-text/ReadOnlyText.d.ts.map +1 -0
  169. package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/block.d.ts +1 -1
  170. package/dist/types/src/runtimes/react/controls/rich-text/components/Element/block.d.ts.map +1 -0
  171. package/dist/types/src/runtimes/react/controls/rich-text/components/Element/element.d.ts.map +1 -0
  172. package/dist/types/src/runtimes/react/controls/rich-text/components/Element/index.d.ts.map +1 -0
  173. package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/inline.d.ts +1 -1
  174. package/dist/types/src/runtimes/react/controls/rich-text/components/Element/inline.d.ts.map +1 -0
  175. package/dist/types/src/runtimes/react/controls/rich-text/components/Leaf/index.d.ts.map +1 -0
  176. package/dist/types/src/runtimes/react/controls/rich-text/components/Leaf/leaf.d.ts.map +1 -0
  177. package/dist/types/src/runtimes/react/controls/rich-text/components/index.d.ts.map +1 -0
  178. package/dist/types/src/runtimes/react/controls/rich-text/index.d.ts +2 -0
  179. package/dist/types/src/runtimes/react/controls/rich-text/index.d.ts.map +1 -0
  180. package/dist/types/src/runtimes/react/controls/{rich-text.d.ts → rich-text/rich-text.d.ts} +1 -1
  181. package/dist/types/src/runtimes/react/controls/rich-text/rich-text.d.ts.map +1 -0
  182. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
  183. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts +2 -1
  184. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts.map +1 -1
  185. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts +2 -1
  186. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts.map +1 -1
  187. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/useRemoteChanges.d.ts.map +1 -1
  188. package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts +2 -1
  189. package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
  190. package/dist/types/src/slate/BlockPlugin/index.d.ts +3 -3
  191. package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
  192. package/dist/types/src/slate/InlineModePlugin/index.d.ts +6 -4
  193. package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
  194. package/dist/types/src/slate/InlinePlugin/index.d.ts +3 -3
  195. package/dist/types/src/slate/InlinePlugin/index.d.ts.map +1 -1
  196. package/dist/types/src/slate/InlinePlugin/types.d.ts +1 -1
  197. package/dist/types/src/slate/InlinePlugin/types.d.ts.map +1 -1
  198. package/dist/types/src/slate/LinkPlugin/index.d.ts +3 -3
  199. package/dist/types/src/slate/LinkPlugin/index.d.ts.map +1 -1
  200. package/dist/types/src/slate/LinkPlugin/linkPluginWithoutRenderElement.d.ts +16 -0
  201. package/dist/types/src/slate/LinkPlugin/linkPluginWithoutRenderElement.d.ts.map +1 -0
  202. package/dist/types/src/slate/TextAlignPlugin/index.d.ts +3 -3
  203. package/dist/types/src/slate/TypographyPlugin/index.d.ts +3 -3
  204. package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
  205. package/dist/types/src/slate/types.d.ts +1 -10
  206. package/dist/types/src/slate/types.d.ts.map +1 -1
  207. package/dist/types/src/slate/utils/element.d.ts.map +1 -1
  208. package/dist/types/src/state/actions.d.ts +2 -1
  209. package/dist/types/src/state/actions.d.ts.map +1 -1
  210. package/dist/types/src/state/modules/locales.d.ts.map +1 -1
  211. package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
  212. package/package.json +1 -1
  213. package/dist/index.cjs10.js +0 -390
  214. package/dist/index.cjs10.js.map +0 -1
  215. package/dist/index.cjs9.js +0 -295
  216. package/dist/index.cjs9.js.map +0 -1
  217. package/dist/index.es10.js +0 -383
  218. package/dist/index.es10.js.map +0 -1
  219. package/dist/index.es9.js +0 -288
  220. package/dist/index.es9.js.map +0 -1
  221. package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts.map +0 -1
  222. package/dist/types/src/components/builtin/Text/EditableText/index.d.ts.map +0 -1
  223. package/dist/types/src/components/builtin/Text/EditableText/useSyncDOMSelection.d.ts.map +0 -1
  224. package/dist/types/src/components/builtin/Text/EditableText/useSyncWithBuilder.d.ts.map +0 -1
  225. package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +0 -1
  226. package/dist/types/src/components/builtin/Text/components/Element/block.d.ts.map +0 -1
  227. package/dist/types/src/components/builtin/Text/components/Element/element.d.ts.map +0 -1
  228. package/dist/types/src/components/builtin/Text/components/Element/index.d.ts.map +0 -1
  229. package/dist/types/src/components/builtin/Text/components/Element/inline.d.ts.map +0 -1
  230. package/dist/types/src/components/builtin/Text/components/Leaf/index.d.ts.map +0 -1
  231. package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts.map +0 -1
  232. package/dist/types/src/components/builtin/Text/components/index.d.ts.map +0 -1
  233. package/dist/types/src/runtimes/react/controls/rich-text.d.ts.map +0 -1
  234. package/dist/types.cjs2.js +0 -765
  235. package/dist/types.cjs2.js.map +0 -1
  236. package/dist/types.es2.js +0 -748
  237. package/dist/types.es2.js.map +0 -1
  238. /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/index.d.ts +0 -0
  239. /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/useSyncDOMSelection.d.ts +0 -0
  240. /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/element.d.ts +0 -0
  241. /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/index.d.ts +0 -0
  242. /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Leaf/index.d.ts +0 -0
  243. /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Leaf/leaf.d.ts +0 -0
  244. /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/index.d.ts +0 -0
package/dist/index.es.js CHANGED
@@ -38,10 +38,10 @@ import * as React from "react";
38
38
  import { useEffect, createContext, useContext, useState, useMemo, useRef, Children, createElement, forwardRef, memo, useId, useCallback, useImperativeHandle, Component, Suspense } from "react";
39
39
  import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector";
40
40
  import dynamic from "next/dynamic";
41
- import { a as createDocumentReference, g as getPropControllerDescriptors, b as isElementReference, e as getSwatchIds, f as getFileIds, h as getTypographyIds, j as getTableIds, k as getPageIds, l as getElementChildren, E as ElementID, B as Backgrounds, W as Width, m as ResponsiveIconRadioGroup, M as Margin, P as Padding, n as Border, o as BorderRadius, S as Shadows, G as GapY, p as GapX, q as ResponsiveSelect, r as ResponsiveNumber, s as Checkbox, t as Grid, u as TextInput, L as Link, v as ResponsiveColor, w as TextStyle, C as ComponentIcon, I as Images, N as Number$1, D as Date$1, F as Font, x as ResponsiveLength, y as TextArea, z as Table, A as TableFormFields, H as Image, J as ResponsiveOpacity, K as NavigationLinks, O as SocialLinks, Q as RichText, V as Video, U as useStyle, X as getBorderSwatchIds, Y as getBoxShadowsSwatchIds, Z as getResponsiveColorSwatchIds, _ as StyleControlProperty, $ as ImageControlValueFormat, a0 as isPropControllersHandle, a1 as isRichTextV1Data, a2 as isNonNullable$1, a3 as TypographyControlType, a4 as StyleControlType, a5 as RichTextV2ControlType, a6 as RichTextControlType, a7 as SlotControlType, a8 as StyleV2ControlType, a9 as ListControlType, aa as ShapeControlType, ab as LinkControlType, ac as ImageControlType, ad as ColorControlType, ae as getComponentPropControllerDescriptors, af as getPropControllers, ag as Types, ah as BorderPropControllerFormat, ai as ShadowsPropControllerFormat, aj as BorderRadiusPropControllerFormat, ak as MarginPropControllerFormat, al as PaddingPropControllerFormat, am as WidthPropControllerFormat, an as configureStore$1, ao as copyElementTree, ap as getBreakpoints, aq as parseLocalesInput, ar as getDocument, as as getElementId, at as getIsPreview, au as getIsInBuilder, av as getReactComponent, aw as getBuilderEditMode } from "./react-page.es.js";
41
+ import { a as deepEqual, b as createDocumentReference, g as getPropControllerDescriptors, e as isElementReference, f as getDefaultLocale, h as getLocales, j as getSwatchIds, k as getFileIds, l as getTypographyIds, m as getTableIds, n as getPageIds, o as getElementChildren, E as ElementID, B as Backgrounds, W as Width, p as ResponsiveIconRadioGroup, M as Margin, P as Padding, q as Border, r as BorderRadius, S as Shadows, G as GapY, s as GapX, t as ResponsiveSelect, u as ResponsiveNumber, v as Checkbox, w as Grid, x as TextInput, L as Link$1, y as ResponsiveColor, z as TextStyle, C as ComponentIcon, I as Images, N as Number$1, D as Date$1, F as Font, A as ResponsiveLength, H as TextArea, J as Table, K as TableFormFields, O as Image, Q as ResponsiveOpacity, U as NavigationLinks, V as SocialLinks, X as RichText, Y as BlockType, Z as Video, _ as useStyle, $ as getBorderSwatchIds, a0 as getBoxShadowsSwatchIds, a1 as getResponsiveColorSwatchIds, a2 as StyleControlProperty, a3 as ImageControlValueFormat, a4 as isPropControllersHandle, a5 as isRichTextV1Data, a6 as isNonNullable$1, a7 as TypographyControlType, a8 as StyleControlType, a9 as RichTextV2ControlType, aa as RichTextControlType, ab as SlotControlType, ac as StyleV2ControlType, ad as ListControlType, ae as ShapeControlType, af as LinkControlType, ag as ImageControlType, ah as IconRadioGroupControlType, ai as ColorControlType, aj as SelectControlType, ak as getComponentPropControllerDescriptors, al as getPropControllers, am as Types, an as BorderPropControllerFormat, ao as ShadowsPropControllerFormat, ap as BorderRadiusPropControllerFormat, aq as MarginPropControllerFormat, ar as PaddingPropControllerFormat, as as WidthPropControllerFormat, at as configureStore$1, au as copyElementTree, av as getBreakpoints, aw as parseLocalesInput, ax as getElementId, ay as getReactComponent, az as getDocument, aA as getIsInBuilder, aB as getBuilderEditMode, aC as getIsPreview } from "./react-page.es.js";
42
42
  import { A as ActionTypes, o as apiResourceFulfilled, p as registerComponentEffect, q as registerReactComponentEffect, t as registerComponentHandleEffect, v as mountComponentEffect } from "./actions.es.js";
43
43
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
44
- import { I as IconRadioGroupControlType, S as SelectControlType, T as TextAreaControlType, a as TextInputControlType, N as NumberControlType, C as CheckboxControlType } from "./text-input.es.js";
44
+ import { T as TextAreaControlType, a as TextInputControlType, N as NumberControlType, C as CheckboxControlType } from "./text-input.es.js";
45
45
  import { C as ComboboxControlType } from "./combobox.es.js";
46
46
  import "slate";
47
47
  import { useSyncExternalStore } from "use-sync-external-store/shim";
@@ -67,6 +67,9 @@ import { parse as parse$1 } from "set-cookie-parser";
67
67
  import { M as MakeswiftComponentType } from "./constants.es.js";
68
68
  import { v4 } from "uuid";
69
69
  import ipsum from "corporate-ipsum";
70
+ import "is-hotkey";
71
+ import "slate-react";
72
+ import NextLink from "next/link";
70
73
  const SCRIPT_TAG = "script";
71
74
  function BodySnippet({
72
75
  code,
@@ -111,43 +114,6 @@ function BodySnippet({
111
114
  }, [code, cleanup]);
112
115
  return null;
113
116
  }
114
- function is(x, y) {
115
- if (x === y)
116
- return x !== 0 || y !== 0 || 1 / x === 1 / y;
117
- return x !== x && y !== y;
118
- }
119
- const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
120
- const shallowEqual = (a, b) => {
121
- if (is(a, b))
122
- return true;
123
- if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
124
- return false;
125
- const keysA = Object.keys(a);
126
- const keysB = Object.keys(b);
127
- if (keysA.length !== keysB.length)
128
- return false;
129
- for (let i = 0; i < keysA.length; i += 1) {
130
- if (!hasOwnProperty$1.call(b, keysA[i]) || !is(a[keysA[i]], b[keysA[i]]))
131
- return false;
132
- }
133
- return true;
134
- };
135
- const { hasOwnProperty } = Object.prototype;
136
- const deepEqual = (a, b) => {
137
- if (shallowEqual(a, b))
138
- return true;
139
- if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
140
- return false;
141
- const keysA = Object.keys(a);
142
- const keysB = Object.keys(b);
143
- if (keysA.length !== keysB.length)
144
- return false;
145
- for (let i = 0; i < keysA.length; i += 1) {
146
- if (!hasOwnProperty.call(b, keysA[i]) || !deepEqual(a[keysA[i]], b[keysA[i]]))
147
- return false;
148
- }
149
- return true;
150
- };
151
117
  function getInitialState(serializedState = {
152
118
  Swatch: [],
153
119
  File: [],
@@ -1087,12 +1053,19 @@ Received "${apiKey}" instead.`);
1087
1053
  preview: previewOverride = false,
1088
1054
  unstable_locale
1089
1055
  } = {}) {
1090
- var _a;
1056
+ var _a, _b;
1091
1057
  const isUsingVersioning = this.siteVersion != null;
1092
1058
  const siteVersion = (_a = this.siteVersion) != null ? _a : previewOverride ? MakeswiftSiteVersion.Working : MakeswiftSiteVersion.Live;
1059
+ const defaultLocale = (_b = getDefaultLocale(this.runtime.store.getState())) == null ? void 0 : _b.toString();
1060
+ const locale = unstable_locale === defaultLocale ? null : unstable_locale;
1093
1061
  const searchParams = new URLSearchParams();
1094
- if (unstable_locale)
1095
- searchParams.set("locale", unstable_locale);
1062
+ if (locale) {
1063
+ const locales = getLocales(this.runtime.store.getState()).map((locale2) => locale2.toString());
1064
+ if (!locales.includes(locale)) {
1065
+ throw new Error(`Locale "${locale}" is not included in the locales: ${locales}. Please add the locale to the locales on the ReactRuntime.`);
1066
+ }
1067
+ searchParams.set("locale", locale);
1068
+ }
1096
1069
  const response = await this.fetch(`/${isUsingVersioning ? "v3" : "v2"}/pages/${encodeURIComponent(pathname)}/document?${searchParams.toString()}`, {
1097
1070
  headers: { "Makeswift-Site-Version": siteVersion }
1098
1071
  });
@@ -1103,7 +1076,7 @@ Received "${apiKey}" instead.`);
1103
1076
  throw new Error(`Failed to get page snapshot with error: "${response.statusText}"`);
1104
1077
  }
1105
1078
  const document2 = await response.json();
1106
- const { cacheData, localizedResourcesMap } = await this.introspect(document2.data, previewOverride, unstable_locale);
1079
+ const { cacheData, localizedResourcesMap } = await this.introspect(document2.data, previewOverride, locale != null ? locale : void 0);
1107
1080
  const apiOrigin = this.apiOrigin.href;
1108
1081
  const preview = siteVersion === MakeswiftSiteVersion.Working;
1109
1082
  return {
@@ -1112,7 +1085,7 @@ Received "${apiKey}" instead.`);
1112
1085
  apiOrigin,
1113
1086
  preview,
1114
1087
  localizedResourcesMap,
1115
- locale: unstable_locale != null ? unstable_locale : null
1088
+ locale: locale != null ? locale : null
1116
1089
  };
1117
1090
  }
1118
1091
  async getSwatch(swatchId) {
@@ -1206,7 +1179,7 @@ async function fonts(_req, res, { getFonts } = {}) {
1206
1179
  const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
1207
1180
  return res.json(fonts2);
1208
1181
  }
1209
- const version = "0.9.12";
1182
+ const version = "0.10.1";
1210
1183
  async function handler(req, res, { apiKey, unstable_siteVersions }) {
1211
1184
  if (req.query.secret !== apiKey) {
1212
1185
  return res.status(401).json({ message: "Unauthorized" });
@@ -1346,7 +1319,7 @@ Read more about dynamic catch-all routes here: https://nextjs.org/docs/routing/d
1346
1319
  return client.getGlobalElement(m.params.id).then(handleResource);
1347
1320
  }
1348
1321
  if (m = matches("/localized-global-elements/:globalElementId/:locale")) {
1349
- return client.getLocalizedGlobalElement(m.params.globalElementId, m.params.locale).then(handleResource);
1322
+ return client.getLocalizedGlobalElement(m.params.globalElementId, m.params.locale).then((resource) => resource === null ? res.json({ message: "Not Found" }) : res.json(resource));
1350
1323
  }
1351
1324
  if (m = matches("/page-pathname-slices/:id")) {
1352
1325
  return client.getPagePathnameSlice(m.params.id).then(handleResource);
@@ -1479,7 +1452,8 @@ const Page = memo(({
1479
1452
  const client = useMemo(() => new MakeswiftClient({
1480
1453
  uri: new URL("graphql", snapshot.apiOrigin).href,
1481
1454
  cacheData: snapshot.cacheData,
1482
- localizedResourcesMap: snapshot.localizedResourcesMap
1455
+ localizedResourcesMap: snapshot.localizedResourcesMap,
1456
+ locale: snapshot.locale ? new Intl.Locale(snapshot.locale) : void 0
1483
1457
  }), [snapshot]);
1484
1458
  const rootElements = /* @__PURE__ */ new Map([[snapshot.document.id, snapshot.document.data]]);
1485
1459
  snapshot.document.localizedPages.forEach((localizedPage) => {
@@ -1653,7 +1627,7 @@ function registerComponent$b(runtime) {
1653
1627
  props: {
1654
1628
  id: ElementID(),
1655
1629
  children: TextInput({ placeholder: "Button text" }),
1656
- link: Link({
1630
+ link: Link$1({
1657
1631
  defaultValue: {
1658
1632
  type: "OPEN_PAGE",
1659
1633
  payload: {
@@ -1978,7 +1952,7 @@ function registerComponent$6(runtime) {
1978
1952
  id: ElementID(),
1979
1953
  tableId: Table(),
1980
1954
  fields: TableFormFields(),
1981
- submitLink: Link((props) => ({
1955
+ submitLink: Link$1((props) => ({
1982
1956
  label: "Redirect to",
1983
1957
  options: [
1984
1958
  { value: "OPEN_PAGE", label: "Open page" },
@@ -2103,7 +2077,7 @@ function registerComponent$5(runtime) {
2103
2077
  id: ElementID(),
2104
2078
  file: Image(),
2105
2079
  altText: TextInput({ label: "Alt text" }),
2106
- link: Link({ label: "On click" }),
2080
+ link: Link$1({ label: "On click" }),
2107
2081
  width: Width(),
2108
2082
  margin: Margin({ format: Margin.Format.ClassName }),
2109
2083
  padding: Padding({ format: Padding.Format.ClassName }),
@@ -2151,7 +2125,7 @@ function registerComponent$4(runtime) {
2151
2125
  label: "Logo alt text",
2152
2126
  hidden: props.showLogo === false
2153
2127
  })),
2154
- logoLink: Link((props) => ({
2128
+ logoLink: Link$1((props) => ({
2155
2129
  label: "Logo on click",
2156
2130
  hidden: props.showLogo === false
2157
2131
  })),
@@ -2360,58 +2334,247 @@ function registerComponent$2(runtime) {
2360
2334
  }
2361
2335
  });
2362
2336
  }
2337
+ function useSwatch(swatchId) {
2338
+ const client = useMakeswiftClient();
2339
+ const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
2340
+ const swatch = useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
2341
+ useEffect(() => {
2342
+ if (swatchId != null)
2343
+ client.fetchSwatch(swatchId).catch(console.error);
2344
+ }, [client, swatchId]);
2345
+ return swatch;
2346
+ }
2347
+ function useSwatches(swatchIds) {
2348
+ const client = useMakeswiftClient();
2349
+ const lastSnapshot = useRef();
2350
+ function getSnapshot() {
2351
+ const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
2352
+ if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
2353
+ return lastSnapshot.current;
2354
+ }
2355
+ return lastSnapshot.current = swatches2;
2356
+ }
2357
+ const swatches = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
2358
+ useEffect(() => {
2359
+ Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
2360
+ }, [client, swatchIds]);
2361
+ return swatches;
2362
+ }
2363
+ function useFile(fileId) {
2364
+ const client = useMakeswiftClient();
2365
+ const readFile = () => fileId == null ? null : client.readFile(fileId);
2366
+ const file = useSyncExternalStore(client.subscribe, readFile, readFile);
2367
+ useEffect(() => {
2368
+ if (fileId != null)
2369
+ client.fetchFile(fileId);
2370
+ }, [client, fileId]);
2371
+ return file;
2372
+ }
2373
+ function useFiles(fileIds) {
2374
+ const client = useMakeswiftClient();
2375
+ const lastSnapshot = useRef();
2376
+ function getSnapshot() {
2377
+ const files2 = fileIds.map((fileId) => client.readFile(fileId));
2378
+ if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
2379
+ return lastSnapshot.current;
2380
+ }
2381
+ return lastSnapshot.current = files2;
2382
+ }
2383
+ const files = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
2384
+ useEffect(() => {
2385
+ Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
2386
+ }, [client, fileIds]);
2387
+ return files;
2388
+ }
2389
+ function useTypography(typographyId) {
2390
+ const client = useMakeswiftClient();
2391
+ const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
2392
+ const typography = useSyncExternalStore(client.subscribe, readTypography, readTypography);
2393
+ useEffect(() => {
2394
+ if (typographyId != null)
2395
+ client.fetchTypography(typographyId).catch(console.error);
2396
+ }, [client, typographyId]);
2397
+ return typography;
2398
+ }
2399
+ function useGlobalElement(globalElementId) {
2400
+ const client = useMakeswiftClient();
2401
+ const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
2402
+ const globalElement = useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
2403
+ useEffect(() => {
2404
+ if (globalElementId != null)
2405
+ client.fetchGlobalElement(globalElementId).catch(console.error);
2406
+ }, [client, globalElementId]);
2407
+ return globalElement;
2408
+ }
2409
+ function useLocalizedGlobalElement(globalElementId) {
2410
+ const client = useMakeswiftClient();
2411
+ const readLocalizedGlobalElement = () => globalElementId == null ? null : client.readLocalizedGlobalElement(globalElementId);
2412
+ const localizedGlobalElement = useSyncExternalStore(client.subscribe, readLocalizedGlobalElement, readLocalizedGlobalElement);
2413
+ useEffect(() => {
2414
+ if (globalElementId != null) {
2415
+ client.fetchLocalizedGlobalElement(globalElementId).catch(console.error);
2416
+ }
2417
+ }, [client, globalElementId]);
2418
+ return localizedGlobalElement;
2419
+ }
2420
+ function usePagePathnameSlice(pageId) {
2421
+ const client = useMakeswiftClient();
2422
+ const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
2423
+ const pagePathnameSlice = useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
2424
+ useEffect(() => {
2425
+ if (pageId != null)
2426
+ client.fetchPagePathnameSlice(pageId).catch(console.error);
2427
+ }, [client, pageId]);
2428
+ return pagePathnameSlice;
2429
+ }
2430
+ function useTable(tableId) {
2431
+ const client = useMakeswiftClient();
2432
+ const readTable = () => tableId == null ? null : client.readTable(tableId);
2433
+ const table = useSyncExternalStore(client.subscribe, readTable, readTable);
2434
+ useEffect(() => {
2435
+ if (tableId != null)
2436
+ client.fetchTable(tableId).catch(console.error);
2437
+ }, [client, tableId]);
2438
+ return table;
2439
+ }
2440
+ const Link = forwardRef(function Link2(_e, ref) {
2441
+ var _f = _e, {
2442
+ link,
2443
+ onClick = () => {
2444
+ }
2445
+ } = _f, restOfProps = __objRest(_f, [
2446
+ "link",
2447
+ "onClick"
2448
+ ]);
2449
+ var _a;
2450
+ const pageId = link && link.type === "OPEN_PAGE" ? link.payload.pageId : null;
2451
+ const page = usePagePathnameSlice(pageId != null ? pageId : null);
2452
+ const elementKey = (link == null ? void 0 : link.type) === "SCROLL_TO_ELEMENT" ? (_a = link.payload.elementIdConfig) == null ? void 0 : _a.elementKey : null;
2453
+ const elementId = useElementId(elementKey);
2454
+ let useNextLink;
2455
+ let href;
2456
+ let target;
2457
+ let block;
2458
+ if (link) {
2459
+ switch (link.type) {
2460
+ case "OPEN_PAGE": {
2461
+ if (page) {
2462
+ useNextLink = true;
2463
+ href = `/${page.pathname}`;
2464
+ }
2465
+ target = link.payload.openInNewTab ? "_blank" : "_self";
2466
+ break;
2467
+ }
2468
+ case "OPEN_URL": {
2469
+ useNextLink = true;
2470
+ href = link.payload.url;
2471
+ target = link.payload.openInNewTab ? "_blank" : "_self";
2472
+ break;
2473
+ }
2474
+ case "SEND_EMAIL": {
2475
+ useNextLink = false;
2476
+ const {
2477
+ to,
2478
+ subject = "",
2479
+ body = ""
2480
+ } = link.payload;
2481
+ if (to != null)
2482
+ href = `mailto:${to}?subject=${subject}&body=${body}`;
2483
+ break;
2484
+ }
2485
+ case "CALL_PHONE": {
2486
+ useNextLink = false;
2487
+ href = `tel:${link.payload.phoneNumber}`;
2488
+ break;
2489
+ }
2490
+ case "SCROLL_TO_ELEMENT": {
2491
+ useNextLink = false;
2492
+ href = `#${elementId != null ? elementId : ""}`;
2493
+ block = link.payload.block;
2494
+ break;
2495
+ }
2496
+ default:
2497
+ throw new RangeError(`Invalid link type "${link.type}."`);
2498
+ }
2499
+ }
2500
+ function handleClick(event) {
2501
+ onClick(event);
2502
+ if (event.defaultPrevented)
2503
+ return;
2504
+ if (event.currentTarget.isContentEditable)
2505
+ return event.preventDefault();
2506
+ if (link && link.type === "SCROLL_TO_ELEMENT") {
2507
+ let hash;
2508
+ try {
2509
+ if (href != null)
2510
+ hash = new URL(`http://www.example.com/${href}`).hash;
2511
+ } catch (error) {
2512
+ console.error(`Link received invalid href: ${href}`, error);
2513
+ }
2514
+ if (href != null && hash != null && href === hash) {
2515
+ event.preventDefault();
2516
+ const view = event.view;
2517
+ scrollIntoView(view.document.querySelector(hash), {
2518
+ behavior: "smooth",
2519
+ block
2520
+ });
2521
+ if (view.location.hash !== hash)
2522
+ view.history.pushState({}, "", hash);
2523
+ }
2524
+ }
2525
+ }
2526
+ if (useNextLink && href != null) {
2527
+ return /* @__PURE__ */ jsx(NextLink, __spreadProps(__spreadValues({}, restOfProps), {
2528
+ ref,
2529
+ target,
2530
+ onClick: handleClick,
2531
+ href,
2532
+ legacyBehavior: false
2533
+ }));
2534
+ }
2535
+ return /* @__PURE__ */ jsx("a", __spreadProps(__spreadValues({}, restOfProps), {
2536
+ ref,
2537
+ href,
2538
+ target,
2539
+ onClick: handleClick
2540
+ }));
2541
+ });
2363
2542
  function registerComponent$1(runtime) {
2364
2543
  return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic(() => patch(import("./Text.es.js")))), {
2365
2544
  type: MakeswiftComponentType.Text,
2366
2545
  label: "Text",
2367
2546
  props: {
2368
2547
  id: ElementID(),
2369
- text: RichText(() => ({
2370
- preset: {
2371
- document: {
2372
- object: "document",
2373
- nodes: [
2548
+ text: RichText({
2549
+ unstable_defaultValue: [
2550
+ {
2551
+ type: BlockType.Default,
2552
+ children: [
2374
2553
  {
2375
- object: "block",
2376
- type: "paragraph",
2377
- nodes: [
2378
- {
2379
- object: "text",
2380
- text: ipsum(3),
2381
- marks: [
2554
+ text: ipsum(3),
2555
+ typography: {
2556
+ style: [
2557
+ {
2558
+ deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
2559
+ value: {
2560
+ fontWeight: 400,
2561
+ fontSize: { value: 18, unit: "px" },
2562
+ lineHeight: 1.5
2563
+ }
2564
+ },
2565
+ ...runtime.getBreakpoints().some(({ id }) => id === DefaultBreakpointID.Mobile) ? [
2382
2566
  {
2383
- object: "mark",
2384
- type: "typography",
2385
- data: {
2386
- value: {
2387
- id: null,
2388
- style: [
2389
- {
2390
- deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
2391
- value: {
2392
- fontWeight: 400,
2393
- fontSize: { value: 18, unit: "px" },
2394
- lineHeight: 1.5
2395
- }
2396
- },
2397
- ...runtime.getBreakpoints().some(({ id }) => id === DefaultBreakpointID.Mobile) ? [
2398
- {
2399
- deviceId: DefaultBreakpointID.Mobile,
2400
- value: { fontSize: { value: 16, unit: "px" } }
2401
- }
2402
- ] : []
2403
- ]
2404
- }
2405
- }
2567
+ deviceId: DefaultBreakpointID.Mobile,
2568
+ value: { fontSize: { value: 16, unit: "px" } }
2406
2569
  }
2407
- ]
2408
- }
2409
- ]
2570
+ ] : []
2571
+ ]
2572
+ }
2410
2573
  }
2411
2574
  ]
2412
2575
  }
2413
- }
2414
- })),
2576
+ ]
2577
+ }),
2415
2578
  width: Width({
2416
2579
  format: Width.Format.ClassName,
2417
2580
  preset: [
@@ -2540,111 +2703,8 @@ const FallbackComponent = forwardRef(function FallbackComponent2({
2540
2703
  function isNonNullable(value) {
2541
2704
  return value != null;
2542
2705
  }
2543
- function useSwatch(swatchId) {
2544
- const client = useMakeswiftClient();
2545
- const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
2546
- const swatch = useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
2547
- useEffect(() => {
2548
- if (swatchId != null)
2549
- client.fetchSwatch(swatchId).catch(console.error);
2550
- }, [client, swatchId]);
2551
- return swatch;
2552
- }
2553
- function useSwatches(swatchIds) {
2554
- const client = useMakeswiftClient();
2555
- const lastSnapshot = useRef();
2556
- function getSnapshot() {
2557
- const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
2558
- if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
2559
- return lastSnapshot.current;
2560
- }
2561
- return lastSnapshot.current = swatches2;
2562
- }
2563
- const swatches = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
2564
- useEffect(() => {
2565
- Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
2566
- }, [client, swatchIds]);
2567
- return swatches;
2568
- }
2569
- function useFile(fileId) {
2570
- const client = useMakeswiftClient();
2571
- const readFile = () => fileId == null ? null : client.readFile(fileId);
2572
- const file = useSyncExternalStore(client.subscribe, readFile, readFile);
2573
- useEffect(() => {
2574
- if (fileId != null)
2575
- client.fetchFile(fileId);
2576
- }, [client, fileId]);
2577
- return file;
2578
- }
2579
- function useFiles(fileIds) {
2580
- const client = useMakeswiftClient();
2581
- const lastSnapshot = useRef();
2582
- function getSnapshot() {
2583
- const files2 = fileIds.map((fileId) => client.readFile(fileId));
2584
- if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
2585
- return lastSnapshot.current;
2586
- }
2587
- return lastSnapshot.current = files2;
2588
- }
2589
- const files = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
2590
- useEffect(() => {
2591
- Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
2592
- }, [client, fileIds]);
2593
- return files;
2594
- }
2595
- function useTypography(typographyId) {
2596
- const client = useMakeswiftClient();
2597
- const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
2598
- const typography = useSyncExternalStore(client.subscribe, readTypography, readTypography);
2599
- useEffect(() => {
2600
- if (typographyId != null)
2601
- client.fetchTypography(typographyId).catch(console.error);
2602
- }, [client, typographyId]);
2603
- return typography;
2604
- }
2605
- function useGlobalElement(globalElementId) {
2606
- const client = useMakeswiftClient();
2607
- const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
2608
- const globalElement = useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
2609
- useEffect(() => {
2610
- if (globalElementId != null)
2611
- client.fetchGlobalElement(globalElementId).catch(console.error);
2612
- }, [client, globalElementId]);
2613
- return globalElement;
2614
- }
2615
- function useLocalizedGlobalElement(globalElementId) {
2616
- const client = useMakeswiftClient();
2617
- const readLocalizedGlobalElement = () => globalElementId == null ? null : client.readLocalizedGlobalElement(globalElementId);
2618
- const localizedGlobalElement = useSyncExternalStore(client.subscribe, readLocalizedGlobalElement, readLocalizedGlobalElement);
2619
- useEffect(() => {
2620
- if (globalElementId != null) {
2621
- client.fetchLocalizedGlobalElement(globalElementId).catch(console.error);
2622
- }
2623
- }, [client, globalElementId]);
2624
- return localizedGlobalElement;
2625
- }
2626
- function usePagePathnameSlice(pageId) {
2627
- const client = useMakeswiftClient();
2628
- const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
2629
- const pagePathnameSlice = useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
2630
- useEffect(() => {
2631
- if (pageId != null)
2632
- client.fetchPagePathnameSlice(pageId).catch(console.error);
2633
- }, [client, pageId]);
2634
- return pagePathnameSlice;
2635
- }
2636
- function useTable(tableId) {
2637
- const client = useMakeswiftClient();
2638
- const readTable = () => tableId == null ? null : client.readTable(tableId);
2639
- const table = useSyncExternalStore(client.subscribe, readTable, readTable);
2640
- useEffect(() => {
2641
- if (tableId != null)
2642
- client.fetchTable(tableId).catch(console.error);
2643
- }, [client, tableId]);
2644
- return table;
2645
- }
2646
- function mapSideColor(swatches, _e) {
2647
- var _f = _e, { color } = _f, restOfSide = __objRest(_f, ["color"]);
2706
+ function mapSideColor(swatches, _g) {
2707
+ var _h = _g, { color } = _h, restOfSide = __objRest(_h, ["color"]);
2648
2708
  return __spreadProps(__spreadValues({}, restOfSide), {
2649
2709
  color: color && {
2650
2710
  alpha: color.alpha,
@@ -3176,7 +3236,8 @@ function ListControlValue({
3176
3236
  function useNumber(numberControlData, controlDefinition) {
3177
3237
  return numberControlData != null ? numberControlData : controlDefinition.config.defaultValue;
3178
3238
  }
3179
- const Text = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es8.js"))));
3239
+ const EditableText$1 = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es7.js"))));
3240
+ const ReadOnlyText$1 = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyText.es.js"))));
3180
3241
  function useRichText(data, control) {
3181
3242
  const textCallbackRef = useCallback((handle) => {
3182
3243
  var _a;
@@ -3185,12 +3246,16 @@ function useRichText(data, control) {
3185
3246
  text: control
3186
3247
  });
3187
3248
  }, [control]);
3188
- return /* @__PURE__ */ jsx(Text, {
3249
+ const isPreview = useIsPreview();
3250
+ return isPreview ? /* @__PURE__ */ jsx(EditableText$1, {
3251
+ text: data,
3252
+ ref: textCallbackRef
3253
+ }) : /* @__PURE__ */ jsx(ReadOnlyText$1, {
3189
3254
  text: data,
3190
3255
  ref: textCallbackRef
3191
3256
  });
3192
3257
  }
3193
- const EditableText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es9.js"))));
3258
+ const EditableText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es8.js"))));
3194
3259
  const ReadOnlyText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyTextV2.es.js"))));
3195
3260
  const ReadOnlyTextV1 = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyText.es.js"))));
3196
3261
  function useRichTextV2(data, definition, control) {
@@ -3264,13 +3329,13 @@ function useSlot(data, control) {
3264
3329
  }, element.key))
3265
3330
  });
3266
3331
  }
3267
- function Slot(_g) {
3268
- var _h = _g, {
3332
+ function Slot(_i) {
3333
+ var _j = _i, {
3269
3334
  as,
3270
3335
  control,
3271
3336
  children,
3272
3337
  className
3273
- } = _h, restOfProps = __objRest(_h, [
3338
+ } = _j, restOfProps = __objRest(_j, [
3274
3339
  "as",
3275
3340
  "control",
3276
3341
  "children",
@@ -3299,15 +3364,15 @@ function Slot(_g) {
3299
3364
  }
3300
3365
  Slot.Placeholder = SlotPlaceholder;
3301
3366
  Slot.Item = SlotItem;
3302
- function SlotItem(_i) {
3303
- var _j = _i, {
3367
+ function SlotItem(_k) {
3368
+ var _l = _k, {
3304
3369
  as,
3305
3370
  control,
3306
3371
  grid,
3307
3372
  index,
3308
3373
  children,
3309
3374
  className
3310
- } = _j, restOfProps = __objRest(_j, [
3375
+ } = _l, restOfProps = __objRest(_l, [
3311
3376
  "as",
3312
3377
  "control",
3313
3378
  "grid",
@@ -4021,10 +4086,10 @@ registerBuiltinComponents(ReactRuntime);
4021
4086
  const StoreContext = createContext(ReactRuntime.store);
4022
4087
  const PreviewProvider = dynamic(() => import("./PreviewProvider.es.js"));
4023
4088
  const LiveProvider = dynamic(() => import("./LiveProvider.es.js"));
4024
- function RuntimeProvider(_k) {
4025
- var _l = _k, {
4089
+ function RuntimeProvider(_m) {
4090
+ var _n = _m, {
4026
4091
  preview
4027
- } = _l, props = __objRest(_l, [
4092
+ } = _n, props = __objRest(_n, [
4028
4093
  "preview"
4029
4094
  ]);
4030
4095
  return preview ? /* @__PURE__ */ jsx(PreviewProvider, __spreadValues({}, props)) : /* @__PURE__ */ jsx(LiveProvider, __spreadValues({}, props));
@@ -4227,5 +4292,5 @@ const DocumentReference = memo(forwardRef(function DocumentReference2({
4227
4292
  document: document2
4228
4293
  });
4229
4294
  }));
4230
- export { Page as $, Alignments as A, forwardNextDynamicRef as B, Contrasts as C, DocumentReference as D, Element$1 as E, useIsPreview as F, isNonNullable as G, useFiles as H, useSwatches as I, usePagePathnameSlice as J, useElementId as K, shallowEqual as L, deepEqual as M, ElementImperativeHandle as N, StoreContext as O, PageProvider as P, MakeswiftProvider as Q, RuntimeProvider as R, Shapes as S, ControlValue as T, useBuilderEditMode as U, pollBoxModel as V, useEnhancedTypography as W, useTypographyClassName as X, getStaticPaths as Y, getStaticProps as Z, getServerSideProps as _, ReactRuntime as a, Makeswift as a0, PreviewModeScript as a1, Document$1 as a2, MakeswiftApiHandler as a3, usePageId as b, DEFAULT_BOX_ANIMATE_TYPE as c, DEFAULT_BOX_ANIMATE_DELAY as d, DEFAULT_BOX_ANIMATE_DURATION as e, DEFAULT_ITEM_ANIMATE_TYPE as f, DEFAULT_ITEM_ANIMATE_DELAY as g, DEFAULT_ITEM_ANIMATE_DURATION as h, DEFAULT_ITEM_STAGGER_DURATION as i, useBorder as j, useBoxShadow as k, useResponsiveColor as l, Page$1 as m, useResponsiveStyle as n, useResponsiveWidth as o, useResponsiveTextStyle as p, colorToString as q, useBreakpoints as r, Sizes as s, useFormContext as t, useIsInBuilder as u, useResponsiveGridItem as v, useTable as w, useMakeswiftClient as x, Provider as y, useFile as z };
4295
+ export { forwardNextDynamicRef as $, Alignments as A, isNonNullable as B, Contrasts as C, DocumentReference as D, Element$1 as E, useFiles as F, useSwatches as G, ElementImperativeHandle as H, StoreContext as I, useEnhancedTypography as J, useTypographyClassName as K, Link as L, MakeswiftProvider as M, useBuilderEditMode as N, pollBoxModel as O, PageProvider as P, ControlValue as Q, RuntimeProvider as R, Shapes as S, getStaticPaths as T, getStaticProps as U, getServerSideProps as V, Page as W, Makeswift as X, PreviewModeScript as Y, Document$1 as Z, MakeswiftApiHandler as _, ReactRuntime as a, usePageId as b, DEFAULT_BOX_ANIMATE_TYPE as c, DEFAULT_BOX_ANIMATE_DELAY as d, DEFAULT_BOX_ANIMATE_DURATION as e, DEFAULT_ITEM_ANIMATE_TYPE as f, DEFAULT_ITEM_ANIMATE_DELAY as g, DEFAULT_ITEM_ANIMATE_DURATION as h, DEFAULT_ITEM_STAGGER_DURATION as i, useBorder as j, useBoxShadow as k, useResponsiveColor as l, Page$1 as m, useResponsiveStyle as n, useResponsiveWidth as o, useResponsiveTextStyle as p, colorToString as q, useBreakpoints as r, Sizes as s, useFormContext as t, useIsInBuilder as u, useResponsiveGridItem as v, useTable as w, useMakeswiftClient as x, Provider as y, useFile as z };
4231
4296
  //# sourceMappingURL=index.es.js.map