@makeswift/runtime 0.10.2 → 0.10.4

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 (180) hide show
  1. package/dist/Box.cjs.js +1 -3
  2. package/dist/Box.cjs.js.map +1 -1
  3. package/dist/Box.es.js +2 -4
  4. package/dist/Box.es.js.map +1 -1
  5. package/dist/Button.cjs.js +5 -5
  6. package/dist/Button.es.js +6 -6
  7. package/dist/Carousel.cjs.js +4 -4
  8. package/dist/Carousel.es.js +5 -5
  9. package/dist/Countdown.cjs.js +3 -5
  10. package/dist/Countdown.cjs.js.map +1 -1
  11. package/dist/Countdown.es.js +4 -6
  12. package/dist/Countdown.es.js.map +1 -1
  13. package/dist/Divider.cjs.js +2 -4
  14. package/dist/Divider.cjs.js.map +1 -1
  15. package/dist/Divider.es.js +3 -5
  16. package/dist/Divider.es.js.map +1 -1
  17. package/dist/Embed.cjs.js +3 -1
  18. package/dist/Embed.cjs.js.map +1 -1
  19. package/dist/Embed.es.js +4 -2
  20. package/dist/Embed.es.js.map +1 -1
  21. package/dist/Form.cjs.js +15 -15
  22. package/dist/Form.cjs.js.map +1 -1
  23. package/dist/Form.es.js +7 -7
  24. package/dist/Image.cjs.js +13 -13
  25. package/dist/Image.cjs.js.map +1 -1
  26. package/dist/Image.es.js +13 -13
  27. package/dist/LiveProvider.cjs.js +2 -4
  28. package/dist/LiveProvider.cjs.js.map +1 -1
  29. package/dist/LiveProvider.es.js +4 -6
  30. package/dist/LiveProvider.es.js.map +1 -1
  31. package/dist/Navigation.cjs.js +13 -13
  32. package/dist/Navigation.cjs.js.map +1 -1
  33. package/dist/Navigation.es.js +13 -13
  34. package/dist/PreviewProvider.cjs.js +2 -4
  35. package/dist/PreviewProvider.cjs.js.map +1 -1
  36. package/dist/PreviewProvider.es.js +4 -6
  37. package/dist/PreviewProvider.es.js.map +1 -1
  38. package/dist/ReadOnlyText.cjs.js +8 -7
  39. package/dist/ReadOnlyText.cjs.js.map +1 -1
  40. package/dist/ReadOnlyText.es.js +5 -4
  41. package/dist/ReadOnlyText.es.js.map +1 -1
  42. package/dist/ReadOnlyTextV2.cjs.js +8 -61
  43. package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
  44. package/dist/ReadOnlyTextV2.es.js +10 -63
  45. package/dist/ReadOnlyTextV2.es.js.map +1 -1
  46. package/dist/Root.cjs.js +2 -4
  47. package/dist/Root.cjs.js.map +1 -1
  48. package/dist/Root.es.js +3 -5
  49. package/dist/Root.es.js.map +1 -1
  50. package/dist/SocialLinks.cjs.js +7 -7
  51. package/dist/SocialLinks.cjs.js.map +1 -1
  52. package/dist/SocialLinks.es.js +8 -8
  53. package/dist/Video.cjs.js +3 -1
  54. package/dist/Video.cjs.js.map +1 -1
  55. package/dist/Video.es.js +4 -2
  56. package/dist/Video.es.js.map +1 -1
  57. package/dist/builder.cjs.js +3 -1
  58. package/dist/builder.cjs.js.map +1 -1
  59. package/dist/builder.es.js +3 -1
  60. package/dist/builder.es.js.map +1 -1
  61. package/dist/components.cjs.js +4 -4
  62. package/dist/components.es.js +4 -4
  63. package/dist/control-serialization.cjs.js +1 -0
  64. package/dist/control-serialization.cjs.js.map +1 -1
  65. package/dist/control-serialization.es.js +2 -1
  66. package/dist/control-serialization.es.js.map +1 -1
  67. package/dist/controls.cjs.js +5 -1
  68. package/dist/controls.cjs.js.map +1 -1
  69. package/dist/controls.es.js +4 -2
  70. package/dist/controls.es.js.map +1 -1
  71. package/dist/index.cjs.js +121 -257
  72. package/dist/index.cjs.js.map +1 -1
  73. package/dist/index.cjs2.js +1 -0
  74. package/dist/index.cjs2.js.map +1 -1
  75. package/dist/index.cjs3.js +107 -21
  76. package/dist/index.cjs3.js.map +1 -1
  77. package/dist/index.cjs4.js +57 -16
  78. package/dist/index.cjs4.js.map +1 -1
  79. package/dist/index.cjs5.js +42 -81
  80. package/dist/index.cjs5.js.map +1 -1
  81. package/dist/index.cjs6.js +82 -17
  82. package/dist/index.cjs6.js.map +1 -1
  83. package/dist/index.cjs7.js +18 -377
  84. package/dist/index.cjs7.js.map +1 -1
  85. package/dist/index.cjs8.js +258 -181
  86. package/dist/index.cjs8.js.map +1 -1
  87. package/dist/index.cjs9.js +343 -0
  88. package/dist/index.cjs9.js.map +1 -0
  89. package/dist/index.es.js +126 -261
  90. package/dist/index.es.js.map +1 -1
  91. package/dist/index.es2.js +2 -1
  92. package/dist/index.es2.js.map +1 -1
  93. package/dist/index.es3.js +103 -22
  94. package/dist/index.es3.js.map +1 -1
  95. package/dist/index.es4.js +57 -16
  96. package/dist/index.es4.js.map +1 -1
  97. package/dist/index.es5.js +42 -80
  98. package/dist/index.es5.js.map +1 -1
  99. package/dist/index.es6.js +81 -17
  100. package/dist/index.es6.js.map +1 -1
  101. package/dist/index.es7.js +18 -371
  102. package/dist/index.es7.js.map +1 -1
  103. package/dist/index.es8.js +259 -182
  104. package/dist/index.es8.js.map +1 -1
  105. package/dist/index.es9.js +336 -0
  106. package/dist/index.es9.js.map +1 -0
  107. package/dist/main.cjs.js +3 -1
  108. package/dist/main.cjs.js.map +1 -1
  109. package/dist/main.es.js +3 -1
  110. package/dist/main.es.js.map +1 -1
  111. package/dist/next.cjs.js +3 -5
  112. package/dist/next.cjs.js.map +1 -1
  113. package/dist/next.es.js +4 -6
  114. package/dist/next.es.js.map +1 -1
  115. package/dist/prop-controllers.cjs.js +3 -1
  116. package/dist/prop-controllers.cjs.js.map +1 -1
  117. package/dist/prop-controllers.es.js +3 -1
  118. package/dist/prop-controllers.es.js.map +1 -1
  119. package/dist/react-page.cjs.js +499 -314
  120. package/dist/react-page.cjs.js.map +1 -1
  121. package/dist/react-page.es.js +498 -315
  122. package/dist/react-page.es.js.map +1 -1
  123. package/dist/react.cjs.js +3 -5
  124. package/dist/react.cjs.js.map +1 -1
  125. package/dist/react.es.js +3 -5
  126. package/dist/react.es.js.map +1 -1
  127. package/dist/slate.cjs.js +11 -8
  128. package/dist/slate.cjs.js.map +1 -1
  129. package/dist/slate.es.js +11 -9
  130. package/dist/slate.es.js.map +1 -1
  131. package/dist/toText.cjs.js +67 -0
  132. package/dist/toText.cjs.js.map +1 -0
  133. package/dist/toText.es.js +66 -0
  134. package/dist/toText.es.js.map +1 -0
  135. package/dist/types/src/components/builtin/Text/register.d.ts.map +1 -1
  136. package/dist/types/src/controls/control.d.ts +1 -1
  137. package/dist/types/src/controls/control.d.ts.map +1 -1
  138. package/dist/types/src/controls/rich-text/__test__/copy.test.d.ts +2 -0
  139. package/dist/types/src/controls/rich-text/__test__/copy.test.d.ts.map +1 -0
  140. package/dist/types/src/controls/rich-text/__test__/introspection.test.d.ts.map +1 -0
  141. package/dist/types/src/controls/rich-text/__test__/translation.test.d.ts.map +1 -0
  142. package/dist/types/src/controls/rich-text/copy.d.ts +4 -0
  143. package/dist/types/src/controls/rich-text/copy.d.ts.map +1 -0
  144. package/dist/types/src/controls/rich-text/index.d.ts +1 -0
  145. package/dist/types/src/controls/rich-text/index.d.ts.map +1 -1
  146. package/dist/types/src/controls/rich-text-v2/__test__/copy.test.d.ts +2 -0
  147. package/dist/types/src/controls/rich-text-v2/__test__/copy.test.d.ts.map +1 -0
  148. package/dist/types/src/controls/rich-text-v2/__test__/introspection.test.d.ts.map +1 -0
  149. package/dist/types/src/controls/rich-text-v2/copy.d.ts +4 -0
  150. package/dist/types/src/controls/rich-text-v2/copy.d.ts.map +1 -0
  151. package/dist/types/src/controls/rich-text-v2/index.d.ts +1 -0
  152. package/dist/types/src/controls/rich-text-v2/index.d.ts.map +1 -1
  153. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +2 -4
  154. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
  155. package/dist/types/src/controls/rich-text-v2/translation.d.ts +1 -1
  156. package/dist/types/src/controls/rich-text-v2/translation.d.ts.map +1 -1
  157. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
  158. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts.map +1 -1
  159. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/usePresetValue.d.ts +10 -0
  160. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/usePresetValue.d.ts.map +1 -0
  161. package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
  162. package/dist/types/src/slate/BuilderPlugin/index.d.ts +2 -1
  163. package/dist/types/src/slate/BuilderPlugin/index.d.ts.map +1 -1
  164. package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
  165. package/dist/types/src/slate/InlinePlugin/index.d.ts +2 -2
  166. package/dist/types/src/slate/TextAlignPlugin/index.d.ts +3 -3
  167. package/dist/types/src/slate/TypographyPlugin/index.d.ts +3 -3
  168. package/dist/types/src/slate/index.d.ts +1 -0
  169. package/dist/types/src/slate/index.d.ts.map +1 -1
  170. package/dist/types/src/slate/utils/index.d.ts +2 -0
  171. package/dist/types/src/slate/utils/index.d.ts.map +1 -0
  172. package/dist/types/src/slate/utils/toText.d.ts +4 -0
  173. package/dist/types/src/slate/utils/toText.d.ts.map +1 -0
  174. package/package.json +1 -1
  175. package/dist/types/src/controls/rich-text/introspection.test.d.ts.map +0 -1
  176. package/dist/types/src/controls/rich-text/translation.test.d.ts.map +0 -1
  177. package/dist/types/src/controls/rich-text-v2/introspection.test.d.ts.map +0 -1
  178. /package/dist/types/src/controls/rich-text/{introspection.test.d.ts → __test__/introspection.test.d.ts} +0 -0
  179. /package/dist/types/src/controls/rich-text/{translation.test.d.ts → __test__/translation.test.d.ts} +0 -0
  180. /package/dist/types/src/controls/rich-text-v2/{introspection.test.d.ts → __test__/introspection.test.d.ts} +0 -0
package/dist/index.cjs.js CHANGED
@@ -43,6 +43,7 @@ var actions = require("./actions.cjs.js");
43
43
  var jsxRuntime = require("react/jsx-runtime");
44
44
  var textInput = require("./text-input.cjs.js");
45
45
  var combobox = require("./combobox.cjs.js");
46
+ var uuid = require("uuid");
46
47
  require("slate");
47
48
  var shim = require("use-sync-external-store/shim");
48
49
  var redux = require("redux");
@@ -65,11 +66,6 @@ var cookie = require("cookie");
65
66
  var httpProxy = require("http-proxy");
66
67
  var setCookieParser = require("set-cookie-parser");
67
68
  var constants = require("./constants.cjs.js");
68
- var uuid = require("uuid");
69
- var ipsum = require("corporate-ipsum");
70
- require("is-hotkey");
71
- require("slate-react");
72
- var NextLink = require("next/link");
73
69
  function _interopDefaultLegacy(e) {
74
70
  return e && typeof e === "object" && "default" in e ? e : { "default": e };
75
71
  }
@@ -103,8 +99,6 @@ var Head__default = /* @__PURE__ */ _interopDefaultLegacy(Head);
103
99
  var createEmotionServer__default = /* @__PURE__ */ _interopDefaultLegacy(createEmotionServer);
104
100
  var NextDocument__default = /* @__PURE__ */ _interopDefaultLegacy(NextDocument);
105
101
  var Cors__default = /* @__PURE__ */ _interopDefaultLegacy(Cors);
106
- var ipsum__default = /* @__PURE__ */ _interopDefaultLegacy(ipsum);
107
- var NextLink__default = /* @__PURE__ */ _interopDefaultLegacy(NextLink);
108
102
  const SCRIPT_TAG = "script";
109
103
  function BodySnippet({
110
104
  code,
@@ -1214,7 +1208,7 @@ async function fonts(_req, res, { getFonts } = {}) {
1214
1208
  const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
1215
1209
  return res.json(fonts2);
1216
1210
  }
1217
- const version = "0.10.2";
1211
+ const version = "0.10.4";
1218
1212
  async function handler(req, res, { apiKey, unstable_siteVersions }) {
1219
1213
  if (req.query.secret !== apiKey) {
1220
1214
  return res.status(401).json({ message: "Unauthorized" });
@@ -2391,211 +2385,6 @@ function registerComponent$2(runtime) {
2391
2385
  }
2392
2386
  });
2393
2387
  }
2394
- function useSwatch(swatchId) {
2395
- const client = useMakeswiftClient();
2396
- const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
2397
- const swatch = shim.useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
2398
- React.useEffect(() => {
2399
- if (swatchId != null)
2400
- client.fetchSwatch(swatchId).catch(console.error);
2401
- }, [client, swatchId]);
2402
- return swatch;
2403
- }
2404
- function useSwatches(swatchIds) {
2405
- const client = useMakeswiftClient();
2406
- const lastSnapshot = React.useRef();
2407
- function getSnapshot() {
2408
- const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
2409
- if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
2410
- return lastSnapshot.current;
2411
- }
2412
- return lastSnapshot.current = swatches2;
2413
- }
2414
- const swatches = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
2415
- React.useEffect(() => {
2416
- Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
2417
- }, [client, swatchIds]);
2418
- return swatches;
2419
- }
2420
- function useFile(fileId) {
2421
- const client = useMakeswiftClient();
2422
- const readFile = () => fileId == null ? null : client.readFile(fileId);
2423
- const file = shim.useSyncExternalStore(client.subscribe, readFile, readFile);
2424
- React.useEffect(() => {
2425
- if (fileId != null)
2426
- client.fetchFile(fileId);
2427
- }, [client, fileId]);
2428
- return file;
2429
- }
2430
- function useFiles(fileIds) {
2431
- const client = useMakeswiftClient();
2432
- const lastSnapshot = React.useRef();
2433
- function getSnapshot() {
2434
- const files2 = fileIds.map((fileId) => client.readFile(fileId));
2435
- if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
2436
- return lastSnapshot.current;
2437
- }
2438
- return lastSnapshot.current = files2;
2439
- }
2440
- const files = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
2441
- React.useEffect(() => {
2442
- Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
2443
- }, [client, fileIds]);
2444
- return files;
2445
- }
2446
- function useTypography(typographyId) {
2447
- const client = useMakeswiftClient();
2448
- const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
2449
- const typography = shim.useSyncExternalStore(client.subscribe, readTypography, readTypography);
2450
- React.useEffect(() => {
2451
- if (typographyId != null)
2452
- client.fetchTypography(typographyId).catch(console.error);
2453
- }, [client, typographyId]);
2454
- return typography;
2455
- }
2456
- function useGlobalElement(globalElementId) {
2457
- const client = useMakeswiftClient();
2458
- const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
2459
- const globalElement = shim.useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
2460
- React.useEffect(() => {
2461
- if (globalElementId != null)
2462
- client.fetchGlobalElement(globalElementId).catch(console.error);
2463
- }, [client, globalElementId]);
2464
- return globalElement;
2465
- }
2466
- function useLocalizedGlobalElement(globalElementId) {
2467
- const client = useMakeswiftClient();
2468
- const readLocalizedGlobalElement = () => globalElementId == null ? null : client.readLocalizedGlobalElement(globalElementId);
2469
- const localizedGlobalElement = shim.useSyncExternalStore(client.subscribe, readLocalizedGlobalElement, readLocalizedGlobalElement);
2470
- React.useEffect(() => {
2471
- if (globalElementId != null) {
2472
- client.fetchLocalizedGlobalElement(globalElementId).catch(console.error);
2473
- }
2474
- }, [client, globalElementId]);
2475
- return localizedGlobalElement;
2476
- }
2477
- function usePagePathnameSlice(pageId) {
2478
- const client = useMakeswiftClient();
2479
- const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
2480
- const pagePathnameSlice = shim.useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
2481
- React.useEffect(() => {
2482
- if (pageId != null)
2483
- client.fetchPagePathnameSlice(pageId).catch(console.error);
2484
- }, [client, pageId]);
2485
- return pagePathnameSlice;
2486
- }
2487
- function useTable(tableId) {
2488
- const client = useMakeswiftClient();
2489
- const readTable = () => tableId == null ? null : client.readTable(tableId);
2490
- const table = shim.useSyncExternalStore(client.subscribe, readTable, readTable);
2491
- React.useEffect(() => {
2492
- if (tableId != null)
2493
- client.fetchTable(tableId).catch(console.error);
2494
- }, [client, tableId]);
2495
- return table;
2496
- }
2497
- const Link = React.forwardRef(function Link2(_e, ref) {
2498
- var _f = _e, {
2499
- link,
2500
- onClick = () => {
2501
- }
2502
- } = _f, restOfProps = __objRest(_f, [
2503
- "link",
2504
- "onClick"
2505
- ]);
2506
- var _a;
2507
- const pageId = link && link.type === "OPEN_PAGE" ? link.payload.pageId : null;
2508
- const page = usePagePathnameSlice(pageId != null ? pageId : null);
2509
- const elementKey = (link == null ? void 0 : link.type) === "SCROLL_TO_ELEMENT" ? (_a = link.payload.elementIdConfig) == null ? void 0 : _a.elementKey : null;
2510
- const elementId = useElementId(elementKey);
2511
- let useNextLink;
2512
- let href;
2513
- let target;
2514
- let block;
2515
- if (link) {
2516
- switch (link.type) {
2517
- case "OPEN_PAGE": {
2518
- if (page) {
2519
- useNextLink = true;
2520
- href = `/${page.pathname}`;
2521
- }
2522
- target = link.payload.openInNewTab ? "_blank" : "_self";
2523
- break;
2524
- }
2525
- case "OPEN_URL": {
2526
- useNextLink = true;
2527
- href = link.payload.url;
2528
- target = link.payload.openInNewTab ? "_blank" : "_self";
2529
- break;
2530
- }
2531
- case "SEND_EMAIL": {
2532
- useNextLink = false;
2533
- const {
2534
- to,
2535
- subject = "",
2536
- body = ""
2537
- } = link.payload;
2538
- if (to != null)
2539
- href = `mailto:${to}?subject=${subject}&body=${body}`;
2540
- break;
2541
- }
2542
- case "CALL_PHONE": {
2543
- useNextLink = false;
2544
- href = `tel:${link.payload.phoneNumber}`;
2545
- break;
2546
- }
2547
- case "SCROLL_TO_ELEMENT": {
2548
- useNextLink = false;
2549
- href = `#${elementId != null ? elementId : ""}`;
2550
- block = link.payload.block;
2551
- break;
2552
- }
2553
- default:
2554
- throw new RangeError(`Invalid link type "${link.type}."`);
2555
- }
2556
- }
2557
- function handleClick(event) {
2558
- onClick(event);
2559
- if (event.defaultPrevented)
2560
- return;
2561
- if (event.currentTarget.isContentEditable)
2562
- return event.preventDefault();
2563
- if (link && link.type === "SCROLL_TO_ELEMENT") {
2564
- let hash;
2565
- try {
2566
- if (href != null)
2567
- hash = new URL(`http://www.example.com/${href}`).hash;
2568
- } catch (error) {
2569
- console.error(`Link received invalid href: ${href}`, error);
2570
- }
2571
- if (href != null && hash != null && href === hash) {
2572
- event.preventDefault();
2573
- const view = event.view;
2574
- scrollIntoView__default["default"](view.document.querySelector(hash), {
2575
- behavior: "smooth",
2576
- block
2577
- });
2578
- if (view.location.hash !== hash)
2579
- view.history.pushState({}, "", hash);
2580
- }
2581
- }
2582
- }
2583
- if (useNextLink && href != null) {
2584
- return /* @__PURE__ */ jsxRuntime.jsx(NextLink__default["default"], __spreadProps(__spreadValues({}, restOfProps), {
2585
- ref,
2586
- target,
2587
- onClick: handleClick,
2588
- href,
2589
- legacyBehavior: false
2590
- }));
2591
- }
2592
- return /* @__PURE__ */ jsxRuntime.jsx("a", __spreadProps(__spreadValues({}, restOfProps), {
2593
- ref,
2594
- href,
2595
- target,
2596
- onClick: handleClick
2597
- }));
2598
- });
2599
2388
  function registerComponent$1(runtime) {
2600
2389
  return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
2601
2390
  return require("./Text.cjs.js");
@@ -2604,36 +2393,7 @@ function registerComponent$1(runtime) {
2604
2393
  label: "Text",
2605
2394
  props: {
2606
2395
  id: reactPage.ElementID(),
2607
- text: reactPage.RichText({
2608
- unstable_defaultValue: [
2609
- {
2610
- type: reactPage.BlockType.Default,
2611
- children: [
2612
- {
2613
- text: ipsum__default["default"](3),
2614
- typography: {
2615
- style: [
2616
- {
2617
- deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
2618
- value: {
2619
- fontWeight: 400,
2620
- fontSize: { value: 18, unit: "px" },
2621
- lineHeight: 1.5
2622
- }
2623
- },
2624
- ...runtime.getBreakpoints().some(({ id }) => id === state_breakpoints.DefaultBreakpointID.Mobile) ? [
2625
- {
2626
- deviceId: state_breakpoints.DefaultBreakpointID.Mobile,
2627
- value: { fontSize: { value: 16, unit: "px" } }
2628
- }
2629
- ] : []
2630
- ]
2631
- }
2632
- }
2633
- ]
2634
- }
2635
- ]
2636
- }),
2396
+ text: reactPage.RichText(),
2637
2397
  width: reactPage.Width({
2638
2398
  format: reactPage.Width.Format.ClassName,
2639
2399
  preset: [
@@ -2764,8 +2524,111 @@ const FallbackComponent = React.forwardRef(function FallbackComponent2({
2764
2524
  function isNonNullable(value) {
2765
2525
  return value != null;
2766
2526
  }
2767
- function mapSideColor(swatches, _g) {
2768
- var _h = _g, { color } = _h, restOfSide = __objRest(_h, ["color"]);
2527
+ function useSwatch(swatchId) {
2528
+ const client = useMakeswiftClient();
2529
+ const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
2530
+ const swatch = shim.useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
2531
+ React.useEffect(() => {
2532
+ if (swatchId != null)
2533
+ client.fetchSwatch(swatchId).catch(console.error);
2534
+ }, [client, swatchId]);
2535
+ return swatch;
2536
+ }
2537
+ function useSwatches(swatchIds) {
2538
+ const client = useMakeswiftClient();
2539
+ const lastSnapshot = React.useRef();
2540
+ function getSnapshot() {
2541
+ const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
2542
+ if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
2543
+ return lastSnapshot.current;
2544
+ }
2545
+ return lastSnapshot.current = swatches2;
2546
+ }
2547
+ const swatches = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
2548
+ React.useEffect(() => {
2549
+ Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
2550
+ }, [client, swatchIds]);
2551
+ return swatches;
2552
+ }
2553
+ function useFile(fileId) {
2554
+ const client = useMakeswiftClient();
2555
+ const readFile = () => fileId == null ? null : client.readFile(fileId);
2556
+ const file = shim.useSyncExternalStore(client.subscribe, readFile, readFile);
2557
+ React.useEffect(() => {
2558
+ if (fileId != null)
2559
+ client.fetchFile(fileId);
2560
+ }, [client, fileId]);
2561
+ return file;
2562
+ }
2563
+ function useFiles(fileIds) {
2564
+ const client = useMakeswiftClient();
2565
+ const lastSnapshot = React.useRef();
2566
+ function getSnapshot() {
2567
+ const files2 = fileIds.map((fileId) => client.readFile(fileId));
2568
+ if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
2569
+ return lastSnapshot.current;
2570
+ }
2571
+ return lastSnapshot.current = files2;
2572
+ }
2573
+ const files = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
2574
+ React.useEffect(() => {
2575
+ Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
2576
+ }, [client, fileIds]);
2577
+ return files;
2578
+ }
2579
+ function useTypography(typographyId) {
2580
+ const client = useMakeswiftClient();
2581
+ const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
2582
+ const typography = shim.useSyncExternalStore(client.subscribe, readTypography, readTypography);
2583
+ React.useEffect(() => {
2584
+ if (typographyId != null)
2585
+ client.fetchTypography(typographyId).catch(console.error);
2586
+ }, [client, typographyId]);
2587
+ return typography;
2588
+ }
2589
+ function useGlobalElement(globalElementId) {
2590
+ const client = useMakeswiftClient();
2591
+ const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
2592
+ const globalElement = shim.useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
2593
+ React.useEffect(() => {
2594
+ if (globalElementId != null)
2595
+ client.fetchGlobalElement(globalElementId).catch(console.error);
2596
+ }, [client, globalElementId]);
2597
+ return globalElement;
2598
+ }
2599
+ function useLocalizedGlobalElement(globalElementId) {
2600
+ const client = useMakeswiftClient();
2601
+ const readLocalizedGlobalElement = () => globalElementId == null ? null : client.readLocalizedGlobalElement(globalElementId);
2602
+ const localizedGlobalElement = shim.useSyncExternalStore(client.subscribe, readLocalizedGlobalElement, readLocalizedGlobalElement);
2603
+ React.useEffect(() => {
2604
+ if (globalElementId != null) {
2605
+ client.fetchLocalizedGlobalElement(globalElementId).catch(console.error);
2606
+ }
2607
+ }, [client, globalElementId]);
2608
+ return localizedGlobalElement;
2609
+ }
2610
+ function usePagePathnameSlice(pageId) {
2611
+ const client = useMakeswiftClient();
2612
+ const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
2613
+ const pagePathnameSlice = shim.useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
2614
+ React.useEffect(() => {
2615
+ if (pageId != null)
2616
+ client.fetchPagePathnameSlice(pageId).catch(console.error);
2617
+ }, [client, pageId]);
2618
+ return pagePathnameSlice;
2619
+ }
2620
+ function useTable(tableId) {
2621
+ const client = useMakeswiftClient();
2622
+ const readTable = () => tableId == null ? null : client.readTable(tableId);
2623
+ const table = shim.useSyncExternalStore(client.subscribe, readTable, readTable);
2624
+ React.useEffect(() => {
2625
+ if (tableId != null)
2626
+ client.fetchTable(tableId).catch(console.error);
2627
+ }, [client, tableId]);
2628
+ return table;
2629
+ }
2630
+ function mapSideColor(swatches, _e) {
2631
+ var _f = _e, { color } = _f, restOfSide = __objRest(_f, ["color"]);
2769
2632
  return __spreadProps(__spreadValues({}, restOfSide), {
2770
2633
  color: color && {
2771
2634
  alpha: color.alpha,
@@ -3298,7 +3161,7 @@ function useNumber(numberControlData, controlDefinition) {
3298
3161
  return numberControlData != null ? numberControlData : controlDefinition.config.defaultValue;
3299
3162
  }
3300
3163
  const EditableText$1 = forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
3301
- return require("./index.cjs7.js");
3164
+ return require("./index.cjs8.js");
3302
3165
  }))));
3303
3166
  const ReadOnlyText$1 = forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
3304
3167
  return require("./ReadOnlyText.cjs.js");
@@ -3321,7 +3184,7 @@ function useRichText(data, control) {
3321
3184
  });
3322
3185
  }
3323
3186
  const EditableText = forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
3324
- return require("./index.cjs8.js");
3187
+ return require("./index.cjs9.js");
3325
3188
  }))));
3326
3189
  const ReadOnlyText = forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
3327
3190
  return require("./ReadOnlyTextV2.cjs.js");
@@ -3400,13 +3263,13 @@ function useSlot(data, control) {
3400
3263
  }, element.key))
3401
3264
  });
3402
3265
  }
3403
- function Slot(_i) {
3404
- var _j = _i, {
3266
+ function Slot(_g) {
3267
+ var _h = _g, {
3405
3268
  as,
3406
3269
  control,
3407
3270
  children,
3408
3271
  className
3409
- } = _j, restOfProps = __objRest(_j, [
3272
+ } = _h, restOfProps = __objRest(_h, [
3410
3273
  "as",
3411
3274
  "control",
3412
3275
  "children",
@@ -3435,15 +3298,15 @@ function Slot(_i) {
3435
3298
  }
3436
3299
  Slot.Placeholder = SlotPlaceholder;
3437
3300
  Slot.Item = SlotItem;
3438
- function SlotItem(_k) {
3439
- var _l = _k, {
3301
+ function SlotItem(_i) {
3302
+ var _j = _i, {
3440
3303
  as,
3441
3304
  control,
3442
3305
  grid,
3443
3306
  index,
3444
3307
  children,
3445
3308
  className
3446
- } = _l, restOfProps = __objRest(_l, [
3309
+ } = _j, restOfProps = __objRest(_j, [
3447
3310
  "as",
3448
3311
  "control",
3449
3312
  "grid",
@@ -4161,10 +4024,10 @@ const PreviewProvider = dynamic__default["default"](() => Promise.resolve().then
4161
4024
  const LiveProvider = dynamic__default["default"](() => Promise.resolve().then(function() {
4162
4025
  return require("./LiveProvider.cjs.js");
4163
4026
  }));
4164
- function RuntimeProvider(_m) {
4165
- var _n = _m, {
4027
+ function RuntimeProvider(_k) {
4028
+ var _l = _k, {
4166
4029
  preview
4167
- } = _n, props = __objRest(_n, [
4030
+ } = _l, props = __objRest(_l, [
4168
4031
  "preview"
4169
4032
  ]);
4170
4033
  return preview ? /* @__PURE__ */ jsxRuntime.jsx(PreviewProvider, __spreadValues({}, props)) : /* @__PURE__ */ jsxRuntime.jsx(LiveProvider, __spreadValues({}, props));
@@ -4381,7 +4244,6 @@ exports.Document = Document$1;
4381
4244
  exports.DocumentReference = DocumentReference;
4382
4245
  exports.Element = Element$1;
4383
4246
  exports.ElementImperativeHandle = ElementImperativeHandle;
4384
- exports.Link = Link;
4385
4247
  exports.Makeswift = Makeswift;
4386
4248
  exports.MakeswiftApiHandler = MakeswiftApiHandler;
4387
4249
  exports.MakeswiftProvider = MakeswiftProvider;
@@ -4406,6 +4268,7 @@ exports.useBorder = useBorder;
4406
4268
  exports.useBoxShadow = useBoxShadow;
4407
4269
  exports.useBreakpoints = useBreakpoints;
4408
4270
  exports.useBuilderEditMode = useBuilderEditMode;
4271
+ exports.useElementId = useElementId;
4409
4272
  exports.useEnhancedTypography = useEnhancedTypography;
4410
4273
  exports.useFile = useFile;
4411
4274
  exports.useFiles = useFiles;
@@ -4413,6 +4276,7 @@ exports.useFormContext = useFormContext;
4413
4276
  exports.useIsInBuilder = useIsInBuilder;
4414
4277
  exports.useMakeswiftClient = useMakeswiftClient;
4415
4278
  exports.usePageId = usePageId;
4279
+ exports.usePagePathnameSlice = usePagePathnameSlice;
4416
4280
  exports.useResponsiveColor = useResponsiveColor;
4417
4281
  exports.useResponsiveGridItem = useResponsiveGridItem;
4418
4282
  exports.useResponsiveStyle = useResponsiveStyle;