@makeswift/runtime 0.9.11 → 0.9.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/Box.cjs.js +1 -1
  2. package/dist/Box.es.js +1 -1
  3. package/dist/Button.cjs.js +1 -1
  4. package/dist/Button.es.js +1 -1
  5. package/dist/Carousel.cjs.js +1 -1
  6. package/dist/Carousel.es.js +1 -1
  7. package/dist/Countdown.cjs.js +1 -1
  8. package/dist/Countdown.es.js +1 -1
  9. package/dist/Divider.cjs.js +1 -1
  10. package/dist/Divider.es.js +1 -1
  11. package/dist/Form.cjs.js +1 -1
  12. package/dist/Form.es.js +1 -1
  13. package/dist/Image.cjs.js +1 -1
  14. package/dist/Image.es.js +1 -1
  15. package/dist/LiveProvider.cjs.js +1 -1
  16. package/dist/LiveProvider.es.js +3 -3
  17. package/dist/Navigation.cjs.js +1 -1
  18. package/dist/Navigation.es.js +1 -1
  19. package/dist/PreviewProvider.cjs.js +1 -1
  20. package/dist/PreviewProvider.es.js +3 -3
  21. package/dist/ReadOnlyText.cjs.js +18 -3
  22. package/dist/ReadOnlyText.cjs.js.map +1 -1
  23. package/dist/ReadOnlyText.es.js +20 -5
  24. package/dist/ReadOnlyText.es.js.map +1 -1
  25. package/dist/ReadOnlyTextV2.cjs.js +116 -240
  26. package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
  27. package/dist/ReadOnlyTextV2.es.js +115 -238
  28. package/dist/ReadOnlyTextV2.es.js.map +1 -1
  29. package/dist/Root.cjs.js +1 -1
  30. package/dist/Root.es.js +1 -1
  31. package/dist/SocialLinks.cjs.js +1 -1
  32. package/dist/SocialLinks.es.js +1 -1
  33. package/dist/Text.cjs.js +1 -1
  34. package/dist/Text.es.js +1 -1
  35. package/dist/components.cjs.js +1 -1
  36. package/dist/components.es.js +1 -1
  37. package/dist/control-serialization.es.js +1 -1
  38. package/dist/controls.cjs.js +28 -18
  39. package/dist/controls.cjs.js.map +1 -1
  40. package/dist/controls.es.js +2 -2
  41. package/dist/index.cjs.js +39 -38
  42. package/dist/index.cjs.js.map +1 -1
  43. package/dist/index.cjs10.js +2 -2
  44. package/dist/index.cjs2.js +3 -3
  45. package/dist/index.cjs2.js.map +1 -1
  46. package/dist/index.cjs5.js +5 -6
  47. package/dist/index.cjs5.js.map +1 -1
  48. package/dist/index.cjs6.js +20 -0
  49. package/dist/index.cjs6.js.map +1 -1
  50. package/dist/index.cjs8.js +1 -1
  51. package/dist/index.cjs9.js +27 -31
  52. package/dist/index.cjs9.js.map +1 -1
  53. package/dist/index.es.js +14 -14
  54. package/dist/index.es.js.map +1 -1
  55. package/dist/index.es10.js +4 -4
  56. package/dist/index.es2.js +2 -2
  57. package/dist/index.es3.js +1 -1
  58. package/dist/index.es5.js +1 -2
  59. package/dist/index.es5.js.map +1 -1
  60. package/dist/index.es6.js +21 -2
  61. package/dist/index.es6.js.map +1 -1
  62. package/dist/index.es8.js +1 -1
  63. package/dist/index.es9.js +31 -35
  64. package/dist/index.es9.js.map +1 -1
  65. package/dist/next.cjs.js +1 -1
  66. package/dist/next.es.js +2 -2
  67. package/dist/react-page.cjs.js +310 -147
  68. package/dist/react-page.cjs.js.map +1 -1
  69. package/dist/react-page.es.js +297 -146
  70. package/dist/react-page.es.js.map +1 -1
  71. package/dist/react.cjs.js +1 -1
  72. package/dist/react.es.js +1 -1
  73. package/dist/slate.cjs.js +40 -27
  74. package/dist/slate.cjs.js.map +1 -1
  75. package/dist/slate.es.js +49 -37
  76. package/dist/slate.es.js.map +1 -1
  77. package/dist/{typography.cjs.js → text-input.cjs.js} +1 -9
  78. package/dist/text-input.cjs.js.map +1 -0
  79. package/dist/{typography.es.js → text-input.es.js} +2 -8
  80. package/dist/text-input.es.js.map +1 -0
  81. package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +1 -1
  82. package/dist/types/src/controls/list.d.ts +5 -2
  83. package/dist/types/src/controls/list.d.ts.map +1 -1
  84. package/dist/types/src/controls/rich-text/introspection.d.ts +5 -0
  85. package/dist/types/src/controls/rich-text/introspection.d.ts.map +1 -0
  86. package/dist/types/src/controls/rich-text/introspection.test.d.ts +2 -0
  87. package/dist/types/src/controls/rich-text/introspection.test.d.ts.map +1 -0
  88. package/dist/types/src/controls/rich-text-v2/introspection.d.ts +5 -0
  89. package/dist/types/src/controls/rich-text-v2/introspection.d.ts.map +1 -0
  90. package/dist/types/src/controls/rich-text-v2/introspection.test.d.ts +2 -0
  91. package/dist/types/src/controls/rich-text-v2/introspection.test.d.ts.map +1 -0
  92. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +15 -3
  93. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
  94. package/dist/types/src/controls/rich-text-v2/translation.d.ts +1 -1
  95. package/dist/types/src/controls/rich-text-v2/translation.d.ts.map +1 -1
  96. package/dist/types/src/controls/shape.d.ts +5 -2
  97. package/dist/types/src/controls/shape.d.ts.map +1 -1
  98. package/dist/types/src/controls/typography.d.ts +2 -0
  99. package/dist/types/src/controls/typography.d.ts.map +1 -1
  100. package/dist/types/src/prop-controllers/descriptors.d.ts +10 -0
  101. package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
  102. package/dist/types/src/prop-controllers/introspection.d.ts +0 -2
  103. package/dist/types/src/prop-controllers/introspection.d.ts.map +1 -1
  104. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
  105. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts +1 -1
  106. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts.map +1 -1
  107. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/useRemoteChanges.d.ts +4 -0
  108. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/useRemoteChanges.d.ts.map +1 -0
  109. package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts +7 -16
  110. package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
  111. package/dist/types/src/slate/LinkPlugin/index.d.ts.map +1 -1
  112. package/dist/types/src/slate/LocalChangesPlugin/index.d.ts +16 -0
  113. package/dist/types/src/slate/LocalChangesPlugin/index.d.ts.map +1 -0
  114. package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -1
  115. package/dist/types/src/slate/index.d.ts +1 -0
  116. package/dist/types/src/slate/index.d.ts.map +1 -1
  117. package/dist/types/src/slate/types.d.ts +2 -2
  118. package/dist/types/src/slate/types.d.ts.map +1 -1
  119. package/dist/types.cjs2.js +67 -48
  120. package/dist/types.cjs2.js.map +1 -1
  121. package/dist/types.es2.js +64 -45
  122. package/dist/types.es2.js.map +1 -1
  123. package/package.json +1 -2
  124. package/dist/typography.cjs.js.map +0 -1
  125. package/dist/typography.es.js.map +0 -1
@@ -599,6 +599,21 @@ function introspectListPropControllerData(descriptor, value, func) {
599
599
  return [];
600
600
  return value.flatMap((item) => item.value ? func(descriptor.options.type, item.value) : []);
601
601
  }
602
+ function getListPropControllerElementChildren(descriptor, value) {
603
+ return introspectListPropControllerData(descriptor, value, getElementChildren);
604
+ }
605
+ function getListPropControllerSwatchIds(descriptor, value) {
606
+ return introspectListPropControllerData(descriptor, value, getSwatchIds);
607
+ }
608
+ function getListPropControllerFileIds(descriptor, value) {
609
+ return introspectListPropControllerData(descriptor, value, getFileIds);
610
+ }
611
+ function getListPropControllerTypographyIds(descriptor, value) {
612
+ return introspectListPropControllerData(descriptor, value, getTypographyIds);
613
+ }
614
+ function getListPropControllerPageIds(descriptor, value) {
615
+ return introspectListPropControllerData(descriptor, value, getPageIds);
616
+ }
602
617
  const MarginPropControllerFormat = {
603
618
  ClassName: "makeswift::prop-controllers::margin::format::class-name",
604
619
  ResponsiveValue: "makeswift::prop-controllers::margin::format::responsive-value"
@@ -658,6 +673,21 @@ function introspectShapePropControllerData(descriptor, value, func) {
658
673
  return [];
659
674
  return Object.entries(descriptor.options.type).flatMap(([key, definition]) => func(definition, value[key]));
660
675
  }
676
+ function getShapePropControllerElementChildren(descriptor, value) {
677
+ return introspectShapePropControllerData(descriptor, value, getElementChildren);
678
+ }
679
+ function getShapePropControllerFileIds(descriptor, value) {
680
+ return introspectShapePropControllerData(descriptor, value, getFileIds);
681
+ }
682
+ function getShapePropControllerTypographyIds(descriptor, value) {
683
+ return introspectShapePropControllerData(descriptor, value, getTypographyIds);
684
+ }
685
+ function getShapePropControllerPageIds(descriptor, value) {
686
+ return introspectShapePropControllerData(descriptor, value, getPageIds);
687
+ }
688
+ function getShapePropControllerSwatchIds(descriptor, value) {
689
+ return introspectShapePropControllerData(descriptor, value, getSwatchIds);
690
+ }
661
691
  function SocialLinks(options = {}) {
662
692
  return { type: Types.SocialLinks, options };
663
693
  }
@@ -710,6 +740,11 @@ var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
710
740
  Link: Link$1,
711
741
  List: List$1,
712
742
  introspectListPropControllerData,
743
+ getListPropControllerElementChildren,
744
+ getListPropControllerSwatchIds,
745
+ getListPropControllerFileIds,
746
+ getListPropControllerTypographyIds,
747
+ getListPropControllerPageIds,
713
748
  MarginPropControllerFormat,
714
749
  Margin,
715
750
  NavigationLinks,
@@ -727,6 +762,11 @@ var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
727
762
  Shadows,
728
763
  Shape: Shape$1,
729
764
  introspectShapePropControllerData,
765
+ getShapePropControllerElementChildren,
766
+ getShapePropControllerFileIds,
767
+ getShapePropControllerTypographyIds,
768
+ getShapePropControllerPageIds,
769
+ getShapePropControllerSwatchIds,
730
770
  SocialLinks,
731
771
  Table,
732
772
  TableFormFields,
@@ -1009,6 +1049,21 @@ function introspectListData(definition, value, func) {
1009
1049
  return [];
1010
1050
  return value.flatMap((item) => func(definition.config.type, item.value));
1011
1051
  }
1052
+ function getListElementChildren(definition, value) {
1053
+ return introspectListData(definition, value, getElementChildren);
1054
+ }
1055
+ function getListSwatchIds(definition, value) {
1056
+ return introspectListData(definition, value, getSwatchIds);
1057
+ }
1058
+ function getListFileIds(definition, value) {
1059
+ return introspectListData(definition, value, getFileIds);
1060
+ }
1061
+ function getListTypographyIds(definition, value) {
1062
+ return introspectListData(definition, value, getTypographyIds);
1063
+ }
1064
+ function getListPageIds(definition, value) {
1065
+ return introspectListData(definition, value, getPageIds);
1066
+ }
1012
1067
  const ShapeControlType = "makeswift::controls::shape";
1013
1068
  function Shape(config) {
1014
1069
  return { type: ShapeControlType, config };
@@ -1067,6 +1122,21 @@ function introspectShapeData(definition, value, func) {
1067
1122
  return [];
1068
1123
  return Object.entries(definition.config.type).flatMap(([key, definition2]) => func(definition2, value[key]));
1069
1124
  }
1125
+ function getShapeElementChildren(definition, data) {
1126
+ return introspectShapeData(definition, data, getElementChildren);
1127
+ }
1128
+ function getShapeSwatchIds(definition, data) {
1129
+ return introspectShapeData(definition, data, getSwatchIds);
1130
+ }
1131
+ function getShapeTypographyIds(definition, data) {
1132
+ return introspectShapeData(definition, data, getTypographyIds);
1133
+ }
1134
+ function getShapePageIds(definition, data) {
1135
+ return introspectShapeData(definition, data, getPageIds);
1136
+ }
1137
+ function getShapeFileIds(definition, data) {
1138
+ return introspectShapeData(definition, data, getFileIds);
1139
+ }
1070
1140
  const SlotControlType = "makeswift::controls::slot";
1071
1141
  function Slot() {
1072
1142
  return { type: SlotControlType };
@@ -2268,11 +2338,12 @@ class RichTextControl extends PropController {
2268
2338
  function richTextV2DataToDescendents(data) {
2269
2339
  return data.descendants;
2270
2340
  }
2271
- function richTextV2DescendentsToData(descendants) {
2341
+ function richTextV2DescendentsToData(descendants, key) {
2272
2342
  return {
2273
2343
  type: RichTextV2ControlType,
2274
2344
  version: 2,
2275
- descendants
2345
+ descendants,
2346
+ key
2276
2347
  };
2277
2348
  }
2278
2349
  const RichTextV2ControlType = "makeswift::controls::rich-text-v2";
@@ -2301,7 +2372,9 @@ const RichTextV2ControlMessageType = {
2301
2372
  ON_CHANGE: "makeswift::controls::rich-text-v2::control-message::on-change",
2302
2373
  SELECT: "makeswift::controls::rich-text-v2::control-message::select",
2303
2374
  SWITCH_TO_BUILD_MODE: "makeswift::controls::rich-text-v2::control-message::switch-to-build-mode",
2304
- CHANGE_BOX_MODEL: "makeswift::controls::rich-text-v2::control-message::change-box-model"
2375
+ CHANGE_BOX_MODEL: "makeswift::controls::rich-text-v2::control-message::change-box-model",
2376
+ REDO: "makeswift::controls::rich-text-v2::control-message::redo",
2377
+ UNDO: "makeswift::controls::rich-text-v2::control-message::undo"
2305
2378
  };
2306
2379
  class RichTextV2Control extends PropController {
2307
2380
  constructor(send, descriptor) {
@@ -2321,7 +2394,7 @@ class RichTextV2Control extends PropController {
2321
2394
  case RichTextV2ControlMessageType.RESET_VALUE: {
2322
2395
  if (this.defaultValue) {
2323
2396
  this.editor.selection = null;
2324
- this.editor.children = this.defaultValue.descendants;
2397
+ this.editor.children = this.defaultValue;
2325
2398
  this.editor.onChange();
2326
2399
  }
2327
2400
  break;
@@ -2345,29 +2418,35 @@ class RichTextV2Control extends PropController {
2345
2418
  return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
2346
2419
  })) != null ? _c : []
2347
2420
  });
2421
+ const _onChange = editor.onChange;
2422
+ this.editor.onChange = (options) => {
2423
+ _onChange(options);
2424
+ this.updatePluginValues();
2425
+ if (this.editor == null || (options == null ? void 0 : options.operation) == null)
2426
+ return;
2427
+ this.onLocalUserChange();
2428
+ };
2348
2429
  }
2349
2430
  setDefaultValue(defaultValue) {
2350
- this.defaultValue = richTextV2DescendentsToData(defaultValue);
2431
+ this.defaultValue = defaultValue;
2351
2432
  this.send({
2352
2433
  type: RichTextV2ControlMessageType.SET_DEFAULT_VALUE,
2353
- value: richTextV2DescendentsToData(defaultValue)
2434
+ value: defaultValue
2354
2435
  });
2355
2436
  }
2356
- select() {
2357
- this.send({ type: RichTextV2ControlMessageType.SELECT });
2358
- }
2359
- switchToBuildMode() {
2360
- this.send({ type: RichTextV2ControlMessageType.SWITCH_TO_BUILD_MODE });
2437
+ onLocalUserChange() {
2438
+ if (this.editor == null)
2439
+ return;
2440
+ this.send({
2441
+ type: RichTextV2ControlMessageType.ON_CHANGE,
2442
+ value: richTextV2DescendentsToData(this.editor.children, this.editor.currentKey)
2443
+ });
2361
2444
  }
2362
- onChange(value) {
2445
+ updatePluginValues() {
2363
2446
  var _a2, _b, _c;
2364
2447
  const editor = this.editor;
2365
2448
  if (editor == null)
2366
2449
  return;
2367
- this.send({
2368
- type: RichTextV2ControlMessageType.ON_CHANGE,
2369
- value: richTextV2DescendentsToData(value)
2370
- });
2371
2450
  this.send({
2372
2451
  type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
2373
2452
  value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
@@ -2376,6 +2455,18 @@ class RichTextV2Control extends PropController {
2376
2455
  })) != null ? _c : []
2377
2456
  });
2378
2457
  }
2458
+ select() {
2459
+ this.send({ type: RichTextV2ControlMessageType.SELECT });
2460
+ }
2461
+ switchToBuildMode() {
2462
+ this.send({ type: RichTextV2ControlMessageType.SWITCH_TO_BUILD_MODE });
2463
+ }
2464
+ undo() {
2465
+ this.send({ type: RichTextV2ControlMessageType.UNDO });
2466
+ }
2467
+ redo() {
2468
+ this.send({ type: RichTextV2ControlMessageType.REDO });
2469
+ }
2379
2470
  changeBoxModel(boxModel) {
2380
2471
  this.send({ type: RichTextV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
2381
2472
  }
@@ -2386,6 +2477,149 @@ function isRichTextV1Data(value) {
2386
2477
  function isNonNullable(value) {
2387
2478
  return value != null;
2388
2479
  }
2480
+ const TypographyControlType = "makeswift::controls::typography";
2481
+ function unstable_Typography() {
2482
+ return {
2483
+ type: TypographyControlType
2484
+ };
2485
+ }
2486
+ function getTypographySwatchIds(value) {
2487
+ var _a2;
2488
+ return (_a2 = value == null ? void 0 : value.style.flatMap((style) => {
2489
+ var _a3, _b;
2490
+ return (_b = (_a3 = style.value.color) == null ? void 0 : _a3.swatchId) != null ? _b : [];
2491
+ }).filter(isNonNullable)) != null ? _a2 : [];
2492
+ }
2493
+ function getTypographyTypographyIds(value) {
2494
+ return [value == null ? void 0 : value.id].filter(isNonNullable);
2495
+ }
2496
+ function getRichTextSwatchIds(value) {
2497
+ if (value == null || value.document == null)
2498
+ return [];
2499
+ return getNodeSwatchIds(value.document);
2500
+ function getNodeSwatchIds(node) {
2501
+ var _a2, _b, _c, _d;
2502
+ switch (node.object) {
2503
+ case "document":
2504
+ case "block":
2505
+ case "inline":
2506
+ return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodeSwatchIds)) != null ? _b : [];
2507
+ case "text":
2508
+ return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkSwatchIds)) != null ? _d : [];
2509
+ default:
2510
+ return [];
2511
+ }
2512
+ }
2513
+ function getTypographyStyleSwatchIds(style) {
2514
+ var _a2;
2515
+ return (_a2 = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
2516
+ var _a3;
2517
+ return (_a3 = typographyStyle.color) == null ? void 0 : _a3.swatchId;
2518
+ }).filter(isNonNullable)) != null ? _a2 : [];
2519
+ }
2520
+ function getMarkSwatchIds(mark) {
2521
+ var _a2, _b;
2522
+ return getTypographyStyleSwatchIds((_b = (_a2 = mark.data) == null ? void 0 : _a2.value) == null ? void 0 : _b.style);
2523
+ }
2524
+ }
2525
+ function getRichTextTypographyIds(value) {
2526
+ if (value == null || value.document == null)
2527
+ return [];
2528
+ return getNodeSwatchIds(value.document);
2529
+ function getNodeSwatchIds(node) {
2530
+ var _a2, _b, _c, _d;
2531
+ switch (node.object) {
2532
+ case "document":
2533
+ case "block":
2534
+ case "inline":
2535
+ return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodeSwatchIds)) != null ? _b : [];
2536
+ case "text":
2537
+ return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkSwatchIds)) != null ? _d : [];
2538
+ default:
2539
+ return [];
2540
+ }
2541
+ }
2542
+ function getMarkSwatchIds(mark) {
2543
+ var _a2, _b;
2544
+ return [(_b = (_a2 = mark.data) == null ? void 0 : _a2.value) == null ? void 0 : _b.id].filter(isNonNullable);
2545
+ }
2546
+ }
2547
+ function getRichTextPageIds(value) {
2548
+ if (value == null || value.document == null)
2549
+ return [];
2550
+ return getNodePageIds(value.document);
2551
+ function getNodePageIds(node) {
2552
+ var _a2, _b;
2553
+ switch (node.object) {
2554
+ case "document":
2555
+ case "block":
2556
+ return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodePageIds)) != null ? _b : [];
2557
+ case "inline":
2558
+ return getInlinePageIds(node);
2559
+ default:
2560
+ return [];
2561
+ }
2562
+ }
2563
+ function getInlinePageIds(inline) {
2564
+ var _a2, _b, _c, _d;
2565
+ switch (inline.type) {
2566
+ case "link": {
2567
+ const nodePageIds = (_b = (_a2 = inline.nodes) == null ? void 0 : _a2.flatMap(getNodePageIds)) != null ? _b : [];
2568
+ const dataPageIds = inline.data ? getLinkDataPageIds(inline.data) : [];
2569
+ return [...nodePageIds, ...dataPageIds];
2570
+ }
2571
+ default:
2572
+ return (_d = (_c = inline.nodes) == null ? void 0 : _c.flatMap(getNodePageIds)) != null ? _d : [];
2573
+ }
2574
+ }
2575
+ function getLinkDataPageIds(link) {
2576
+ switch (link.type) {
2577
+ case "OPEN_PAGE":
2578
+ return link.payload.pageId == null ? [] : [link.payload.pageId];
2579
+ default:
2580
+ return [];
2581
+ }
2582
+ }
2583
+ }
2584
+ function introspectRichTextV2Data(definition, data, func) {
2585
+ const plugins = definition.config.plugins;
2586
+ return data.descendants.flatMap((d) => getDescendantTypographyIds(d));
2587
+ function getDescendantTypographyIds(descendant) {
2588
+ if (Element.isElement(descendant)) {
2589
+ return [
2590
+ ...getElementTypographyIds(descendant),
2591
+ ...descendant.children.flatMap((d) => getDescendantTypographyIds(d))
2592
+ ];
2593
+ }
2594
+ if (Text.isText(descendant)) {
2595
+ return getTextTypographyIds(descendant);
2596
+ }
2597
+ return [];
2598
+ }
2599
+ function getElementTypographyIds(descendant) {
2600
+ var _a2;
2601
+ return (_a2 = plugins == null ? void 0 : plugins.flatMap((plugin) => {
2602
+ var _a3;
2603
+ return ((_a3 = plugin.control) == null ? void 0 : _a3.definition) && plugin.control.getElementValue ? func(plugin.control.definition, plugin.control.getElementValue(descendant)) : [];
2604
+ })) != null ? _a2 : [];
2605
+ }
2606
+ function getTextTypographyIds(text) {
2607
+ var _a2;
2608
+ return (_a2 = plugins == null ? void 0 : plugins.flatMap((plugin) => {
2609
+ var _a3;
2610
+ return ((_a3 = plugin.control) == null ? void 0 : _a3.definition) && plugin.control.getLeafValue ? func(plugin.control.definition, plugin.control.getLeafValue(text)) : [];
2611
+ })) != null ? _a2 : [];
2612
+ }
2613
+ }
2614
+ function getRichTextV2SwatchIds(definition, data) {
2615
+ return introspectRichTextV2Data(definition, data, getSwatchIds);
2616
+ }
2617
+ function getRichTextV2TypographyIds(definition, data) {
2618
+ return introspectRichTextV2Data(definition, data, getTypographyIds);
2619
+ }
2620
+ function getRichTextV2PageIds(definition, data) {
2621
+ return introspectRichTextV2Data(definition, data, getPageIds);
2622
+ }
2389
2623
  function getElementChildren(descriptor, prop) {
2390
2624
  if (prop == null)
2391
2625
  return [];
@@ -2397,16 +2631,16 @@ function getElementChildren(descriptor, prop) {
2397
2631
  case ListControlType:
2398
2632
  return prop.flatMap(({ value }) => getElementChildren(descriptor.config.type, value));
2399
2633
  case ShapeControlType: {
2400
- return introspectShapeData(descriptor, prop, getElementChildren);
2634
+ return getShapeElementChildren(descriptor, prop);
2401
2635
  }
2402
2636
  case ListControlType: {
2403
- return introspectListData(descriptor, prop, getElementChildren);
2637
+ return getListElementChildren(descriptor, prop);
2404
2638
  }
2405
2639
  case Types.Shape: {
2406
- return introspectShapePropControllerData(descriptor, prop, getElementChildren);
2640
+ return getShapePropControllerElementChildren(descriptor, prop);
2407
2641
  }
2408
2642
  case Types.List: {
2409
- return introspectListPropControllerData(descriptor, prop, getElementChildren);
2643
+ return getListPropControllerElementChildren(descriptor, prop);
2410
2644
  }
2411
2645
  default:
2412
2646
  return [];
@@ -2459,13 +2693,6 @@ function getResponsiveColorSwatchIds(value) {
2459
2693
  var _a2;
2460
2694
  return (_a2 = value == null ? void 0 : value.map((override) => override.value).map((color) => color.swatchId)) != null ? _a2 : [];
2461
2695
  }
2462
- function getTypographyStyleSwatchIds(style) {
2463
- var _a2;
2464
- return (_a2 = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
2465
- var _a3;
2466
- return (_a3 = typographyStyle.color) == null ? void 0 : _a3.swatchId;
2467
- }).filter(isNonNullable)) != null ? _a2 : [];
2468
- }
2469
2696
  function getSwatchIds(descriptor, prop) {
2470
2697
  var _a2, _b;
2471
2698
  if (prop == null)
@@ -2493,78 +2720,38 @@ function getSwatchIds(descriptor, prop) {
2493
2720
  return getResponsiveColorSwatchIds(prop);
2494
2721
  case Types.Shadows:
2495
2722
  return getBoxShadowsSwatchIds(prop);
2723
+ case RichTextControlType:
2496
2724
  case Types.RichText: {
2497
- let getNodeSwatchIds = function(node) {
2498
- var _a3, _b2, _c, _d;
2499
- switch (node.object) {
2500
- case "document":
2501
- case "block":
2502
- case "inline":
2503
- return (_b2 = (_a3 = node.nodes) == null ? void 0 : _a3.flatMap(getNodeSwatchIds)) != null ? _b2 : [];
2504
- case "text":
2505
- return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkSwatchIds)) != null ? _d : [];
2506
- default:
2507
- return [];
2508
- }
2509
- }, getMarkSwatchIds = function(mark) {
2510
- var _a3, _b2;
2511
- return getTypographyStyleSwatchIds((_b2 = (_a3 = mark.data) == null ? void 0 : _a3.value) == null ? void 0 : _b2.style);
2512
- };
2513
- const value = prop;
2514
- if (value == null || value.document == null)
2515
- return [];
2516
- return getNodeSwatchIds(value.document);
2725
+ return getRichTextSwatchIds(prop);
2517
2726
  }
2518
2727
  case ColorControlType: {
2519
2728
  const value = prop;
2520
2729
  return (value == null ? void 0 : value.swatchId) == null ? [] : [value.swatchId];
2521
2730
  }
2731
+ case TypographyControlType: {
2732
+ return getTypographySwatchIds(prop);
2733
+ }
2522
2734
  case StyleV2ControlType: {
2523
2735
  const value = prop;
2524
2736
  return (_b = value == null ? void 0 : value.flatMap((value2) => getSwatchIds(descriptor.config.type, value2.value))) != null ? _b : [];
2525
2737
  }
2526
2738
  case RichTextV2ControlType: {
2527
- let getDescendantSwatchIds = function(descendant) {
2528
- if (Element.isElement(descendant)) {
2529
- return [
2530
- ...getSlateElementSwatchIds(descendant),
2531
- ...descendant.children.flatMap((d) => getDescendantSwatchIds(d))
2532
- ];
2533
- }
2534
- if (Text.isText(descendant)) {
2535
- return getTextSwatchIds(descendant);
2536
- }
2537
- return [];
2538
- }, getSlateElementSwatchIds = function(descendant) {
2539
- var _a3;
2540
- return (_a3 = plugins == null ? void 0 : plugins.flatMap((plugin) => {
2541
- var _a4;
2542
- return ((_a4 = plugin.control) == null ? void 0 : _a4.definition) && plugin.control.getElementValue ? getSwatchIds(plugin.control.definition, plugin.control.getElementValue(descendant)) : [];
2543
- })) != null ? _a3 : [];
2544
- }, getTextSwatchIds = function(text) {
2545
- var _a3;
2546
- return (_a3 = plugins == null ? void 0 : plugins.flatMap((plugin) => {
2547
- var _a4;
2548
- return ((_a4 = plugin.control) == null ? void 0 : _a4.definition) && plugin.control.getLeafValue ? getSwatchIds(plugin.control.definition, plugin.control.getLeafValue(text)) : [];
2549
- })) != null ? _a3 : [];
2550
- };
2551
2739
  const data = prop;
2552
- const plugins = descriptor.config.plugins;
2553
2740
  if (isRichTextV1Data(data))
2554
- return [];
2555
- return data.descendants.flatMap((d) => getDescendantSwatchIds(d));
2741
+ return getRichTextSwatchIds(data);
2742
+ return getRichTextV2SwatchIds(descriptor, data);
2556
2743
  }
2557
2744
  case ShapeControlType: {
2558
- return introspectShapeData(descriptor, prop, getSwatchIds);
2745
+ return getShapeSwatchIds(descriptor, prop);
2559
2746
  }
2560
2747
  case ListControlType: {
2561
- return introspectListData(descriptor, prop, getSwatchIds);
2748
+ return getListSwatchIds(descriptor, prop);
2562
2749
  }
2563
2750
  case Types.Shape: {
2564
- return introspectShapePropControllerData(descriptor, prop, getSwatchIds);
2751
+ return getShapePropControllerSwatchIds(descriptor, prop);
2565
2752
  }
2566
2753
  case Types.List: {
2567
- return introspectListPropControllerData(descriptor, prop, getSwatchIds);
2754
+ return getListPropControllerSwatchIds(descriptor, prop);
2568
2755
  }
2569
2756
  default:
2570
2757
  return [];
@@ -2601,16 +2788,16 @@ function getFileIds(descriptor, prop) {
2601
2788
  return value == null ? [] : [value];
2602
2789
  }
2603
2790
  case ShapeControlType: {
2604
- return introspectShapeData(descriptor, prop, getFileIds);
2791
+ return getShapeFileIds(descriptor, prop);
2605
2792
  }
2606
2793
  case ListControlType: {
2607
- return introspectListData(descriptor, prop, getFileIds);
2794
+ return getListFileIds(descriptor, prop);
2608
2795
  }
2609
2796
  case Types.Shape: {
2610
- return introspectShapePropControllerData(descriptor, prop, getFileIds);
2797
+ return getShapePropControllerFileIds(descriptor, prop);
2611
2798
  }
2612
2799
  case Types.List: {
2613
- return introspectListPropControllerData(descriptor, prop, getFileIds);
2800
+ return getListPropControllerFileIds(descriptor, prop);
2614
2801
  }
2615
2802
  default:
2616
2803
  return [];
@@ -2620,39 +2807,30 @@ function getTypographyIds(descriptor, prop) {
2620
2807
  if (prop == null)
2621
2808
  return [];
2622
2809
  switch (descriptor.type) {
2810
+ case TypographyControlType: {
2811
+ return getTypographyTypographyIds(prop);
2812
+ }
2813
+ case RichTextControlType:
2623
2814
  case Types.RichText: {
2624
- let getNodeTypographyIds = function(node) {
2625
- var _a2, _b, _c, _d;
2626
- switch (node.object) {
2627
- case "document":
2628
- case "block":
2629
- case "inline":
2630
- return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodeTypographyIds)) != null ? _b : [];
2631
- case "text":
2632
- return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkTypographyIds)) != null ? _d : [];
2633
- default:
2634
- return [];
2635
- }
2636
- }, getMarkTypographyIds = function(mark) {
2637
- var _a2, _b;
2638
- return [(_b = (_a2 = mark.data) == null ? void 0 : _a2.value) == null ? void 0 : _b.id].filter((id) => id != null);
2639
- };
2640
- const value = prop;
2641
- if (value == null || value.document == null)
2642
- return [];
2643
- return getNodeTypographyIds(value.document);
2815
+ return getRichTextTypographyIds(prop);
2816
+ }
2817
+ case RichTextV2ControlType: {
2818
+ const data = prop;
2819
+ if (isRichTextV1Data(data))
2820
+ return getRichTextTypographyIds(data);
2821
+ return getRichTextV2TypographyIds(descriptor, data);
2644
2822
  }
2645
2823
  case ShapeControlType: {
2646
- return introspectShapeData(descriptor, prop, getTypographyIds);
2824
+ return getShapeTypographyIds(descriptor, prop);
2647
2825
  }
2648
2826
  case ListControlType: {
2649
- return introspectListData(descriptor, prop, getTypographyIds);
2827
+ return getListTypographyIds(descriptor, prop);
2650
2828
  }
2651
2829
  case Types.Shape: {
2652
- return introspectShapePropControllerData(descriptor, prop, getTypographyIds);
2830
+ return getShapePropControllerTypographyIds(descriptor, prop);
2653
2831
  }
2654
2832
  case Types.List: {
2655
- return introspectListPropControllerData(descriptor, prop, getTypographyIds);
2833
+ return getListPropControllerTypographyIds(descriptor, prop);
2656
2834
  }
2657
2835
  default:
2658
2836
  return [];
@@ -2729,53 +2907,27 @@ function getPageIds(descriptor, prop) {
2729
2907
  }
2730
2908
  })) != null ? _a2 : [];
2731
2909
  }
2910
+ case RichTextControlType:
2732
2911
  case Types.RichText: {
2733
- let getNodePageIds = function(node) {
2734
- var _a3, _b;
2735
- switch (node.object) {
2736
- case "document":
2737
- case "block":
2738
- return (_b = (_a3 = node.nodes) == null ? void 0 : _a3.flatMap(getNodePageIds)) != null ? _b : [];
2739
- case "inline":
2740
- return getInlinePageIds(node);
2741
- default:
2742
- return [];
2743
- }
2744
- }, getInlinePageIds = function(inline) {
2745
- var _a3, _b, _c, _d;
2746
- switch (inline.type) {
2747
- case "link": {
2748
- const nodePageIds = (_b = (_a3 = inline.nodes) == null ? void 0 : _a3.flatMap(getNodePageIds)) != null ? _b : [];
2749
- const dataPageIds = inline.data ? getLinkDataPageIds(inline.data) : [];
2750
- return [...nodePageIds, ...dataPageIds];
2751
- }
2752
- default:
2753
- return (_d = (_c = inline.nodes) == null ? void 0 : _c.flatMap(getNodePageIds)) != null ? _d : [];
2754
- }
2755
- }, getLinkDataPageIds = function(link) {
2756
- switch (link.type) {
2757
- case "OPEN_PAGE":
2758
- return link.payload.pageId == null ? [] : [link.payload.pageId];
2759
- default:
2760
- return [];
2761
- }
2762
- };
2763
- const value = prop;
2764
- if (value == null || value.document == null)
2765
- return [];
2766
- return getNodePageIds(value.document);
2912
+ return getRichTextPageIds(prop);
2913
+ }
2914
+ case RichTextV2ControlType: {
2915
+ const data = prop;
2916
+ if (isRichTextV1Data(data))
2917
+ return getRichTextPageIds(data);
2918
+ return getRichTextV2PageIds(descriptor, data);
2767
2919
  }
2768
2920
  case ShapeControlType: {
2769
- return introspectShapeData(descriptor, prop, getPageIds);
2921
+ return getShapePageIds(descriptor, prop);
2770
2922
  }
2771
2923
  case ListControlType: {
2772
- return introspectListData(descriptor, prop, getPageIds);
2924
+ return getListPageIds(descriptor, prop);
2773
2925
  }
2774
2926
  case Types.Shape: {
2775
- return introspectShapePropControllerData(descriptor, prop, getPageIds);
2927
+ return getShapePropControllerPageIds(descriptor, prop);
2776
2928
  }
2777
2929
  case Types.List: {
2778
- return introspectListPropControllerData(descriptor, prop, getPageIds);
2930
+ return getListPropControllerPageIds(descriptor, prop);
2779
2931
  }
2780
2932
  default:
2781
2933
  return [];
@@ -2789,7 +2941,6 @@ var introspection = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2789
2941
  getBorderSwatchIds,
2790
2942
  getBoxShadowsSwatchIds,
2791
2943
  getResponsiveColorSwatchIds,
2792
- getTypographyStyleSwatchIds,
2793
2944
  getSwatchIds,
2794
2945
  getBackgroundsFileIds,
2795
2946
  getFileIds,
@@ -2968,5 +3119,5 @@ function configureStore({
2968
3119
  locales: getInitialState(locales != null ? locales : preloadedState == null ? void 0 : preloadedState.locales)
2969
3120
  }), applyMiddleware(thunk));
2970
3121
  }
2971
- export { StyleControlProperty as $, TableFormFields as A, Backgrounds as B, ComponentIcon as C, Date as D, ElementID as E, Font as F, GapY as G, Image$1 as H, Images as I, ResponsiveOpacity as J, NavigationLinks as K, Link$1 as L, Margin as M, Number as N, SocialLinks as O, Padding as P, RichText$1 as Q, RichTextPropControllerMessageType as R, Shadows as S, TableFormFieldsMessageType as T, useStyle as U, Video as V, Width as W, getBorderSwatchIds as X, isNonNullable as Y, getBoxShadowsSwatchIds as Z, getResponsiveColorSwatchIds as _, createDocumentReference as a, StyleV2ControlMessageType as a$, ImageControlValueFormat as a0, isPropControllersHandle as a1, isRichTextV1Data as a2, StyleControlType as a3, RichTextV2ControlType as a4, RichTextControlType as a5, SlotControlType as a6, StyleV2ControlType as a7, ListControlType as a8, ShapeControlType as a9, copy as aA, merge as aB, Image as aC, copyImageData as aD, Link as aE, copyLinkData as aF, List as aG, ListControlMessageType as aH, ListControl as aI, copyListData as aJ, introspectListData as aK, Shape as aL, ShapeControlMessageType as aM, ShapeControl as aN, copyShapeData as aO, introspectShapeData as aP, Slot as aQ, SlotControlMessageType as aR, SlotControl as aS, copySlotData as aT, mergeSlotData as aU, Style as aV, StyleControlMessageType as aW, StyleControl as aX, copyStyleData as aY, unstable_useStyleV2ClassName as aZ, unstable_StyleV2 as a_, LinkControlType as aa, ImageControlType as ab, ColorControlType as ac, getComponentPropControllerDescriptors as ad, getPropControllers as ae, Types as af, BorderPropControllerFormat as ag, ShadowsPropControllerFormat as ah, BorderRadiusPropControllerFormat as ai, MarginPropControllerFormat as aj, PaddingPropControllerFormat as ak, WidthPropControllerFormat as al, configureStore as am, copyElementTree as an, getBreakpoints as ao, parseLocalesInput as ap, getDocument as aq, getElementId as ar, getIsPreview as as, getIsInBuilder as at, getReactComponent as au, getBuilderEditMode as av, getBackgroundsFileIds as aw, getBackgroundsSwatchIds as ax, Color as ay, copyColorData as az, isElementReference as b, StyleV2Control as b0, ObjectType as b1, RichText as b2, RichTextControlMessageType as b3, RichTextControl as b4, richTextDTOtoSelection as b5, richTextDTOtoDAO as b6, toSelectionDTO as b7, richTextDAOToDTO as b8, RichTextV2Mode as b9, reducer$6 as bA, reducer$5 as bB, reducer$4 as bC, reducer$3 as bD, reducer$2 as bE, reducer$1 as bF, getInitialState$2 as bG, createRichTextV2Plugin as ba, unstable_RichTextV2 as bb, RichTextV2ControlMessageType as bc, RichTextV2Control as bd, richTextV2DataToDescendents as be, richTextV2DescendentsToData as bf, InlineType as bg, RootBlockType as bh, BlockType as bi, BlockTextAlignment as bj, getInitialState$7 as bk, reducer$8 as bl, getDocument$1 as bm, getComponentsMeta as bn, getComponentPropControllerDescriptors$1 as bo, getLocales as bp, getDefaultLocale as bq, BuilderEditMode as br, getDocumentKeysSortedByDepth as bs, getPropController as bt, getPropControllersHandle as bu, getElement as bv, getElementPropControllerDescriptors as bw, createPropController as bx, reducer$7 as by, reducer$9 as bz, createDocument as c, descriptors as d, getSwatchIds as e, getFileIds as f, getPropControllerDescriptors as g, getTypographyIds as h, introspection as i, getTableIds as j, getPageIds as k, getElementChildren as l, ResponsiveIconRadioGroup as m, Border as n, BorderRadius as o, GapX as p, ResponsiveSelect as q, ResponsiveNumber as r, Checkbox as s, Grid as t, TextInput as u, ResponsiveColor as v, TextStyle as w, ResponsiveLength as x, TextArea as y, Table as z };
3122
+ export { ImageControlValueFormat as $, TableFormFields as A, Backgrounds as B, ComponentIcon as C, Date as D, ElementID as E, Font as F, GapY as G, Image$1 as H, Images as I, ResponsiveOpacity as J, NavigationLinks as K, Link$1 as L, Margin as M, Number as N, SocialLinks as O, Padding as P, RichText$1 as Q, RichTextPropControllerMessageType as R, Shadows as S, TableFormFieldsMessageType as T, useStyle as U, Video as V, Width as W, getBorderSwatchIds as X, getBoxShadowsSwatchIds as Y, getResponsiveColorSwatchIds as Z, StyleControlProperty as _, createDocumentReference as a, SlotControl as a$, isPropControllersHandle as a0, isRichTextV1Data as a1, isNonNullable as a2, TypographyControlType as a3, StyleControlType as a4, RichTextV2ControlType as a5, RichTextControlType as a6, SlotControlType as a7, StyleV2ControlType as a8, ListControlType as a9, copyColorData as aA, copy as aB, merge as aC, Image as aD, copyImageData as aE, Link as aF, copyLinkData as aG, List as aH, ListControlMessageType as aI, ListControl as aJ, copyListData as aK, getListElementChildren as aL, getListSwatchIds as aM, getListFileIds as aN, getListTypographyIds as aO, getListPageIds as aP, Shape as aQ, ShapeControlMessageType as aR, ShapeControl as aS, copyShapeData as aT, getShapeElementChildren as aU, getShapeSwatchIds as aV, getShapeTypographyIds as aW, getShapePageIds as aX, getShapeFileIds as aY, Slot as aZ, SlotControlMessageType as a_, ShapeControlType as aa, LinkControlType as ab, ImageControlType as ac, ColorControlType as ad, getComponentPropControllerDescriptors as ae, getPropControllers as af, Types as ag, BorderPropControllerFormat as ah, ShadowsPropControllerFormat as ai, BorderRadiusPropControllerFormat as aj, MarginPropControllerFormat as ak, PaddingPropControllerFormat as al, WidthPropControllerFormat as am, configureStore as an, copyElementTree as ao, getBreakpoints as ap, parseLocalesInput as aq, getDocument as ar, getElementId as as, getIsPreview as at, getIsInBuilder as au, getReactComponent as av, getBuilderEditMode as aw, getBackgroundsFileIds as ax, getBackgroundsSwatchIds as ay, Color as az, isElementReference as b, copySlotData as b0, mergeSlotData as b1, Style as b2, StyleControlMessageType as b3, StyleControl as b4, copyStyleData as b5, unstable_useStyleV2ClassName as b6, unstable_StyleV2 as b7, StyleV2ControlMessageType as b8, StyleV2Control as b9, getComponentPropControllerDescriptors$1 as bA, getLocales as bB, getDefaultLocale as bC, BuilderEditMode as bD, getDocumentKeysSortedByDepth as bE, getPropController as bF, getPropControllersHandle as bG, getElement as bH, getElementPropControllerDescriptors as bI, createPropController as bJ, reducer$7 as bK, reducer$9 as bL, reducer$6 as bM, reducer$5 as bN, reducer$4 as bO, reducer$3 as bP, reducer$2 as bQ, reducer$1 as bR, getInitialState$2 as bS, ObjectType as ba, RichText as bb, RichTextControlMessageType as bc, RichTextControl as bd, richTextDTOtoSelection as be, richTextDTOtoDAO as bf, toSelectionDTO as bg, richTextDAOToDTO as bh, RichTextV2Mode as bi, createRichTextV2Plugin as bj, unstable_RichTextV2 as bk, RichTextV2ControlMessageType as bl, RichTextV2Control as bm, richTextV2DataToDescendents as bn, richTextV2DescendentsToData as bo, unstable_Typography as bp, getTypographySwatchIds as bq, getTypographyTypographyIds as br, InlineType as bs, RootBlockType as bt, BlockType as bu, BlockTextAlignment as bv, getInitialState$7 as bw, reducer$8 as bx, getDocument$1 as by, getComponentsMeta as bz, createDocument as c, descriptors as d, getSwatchIds as e, getFileIds as f, getPropControllerDescriptors as g, getTypographyIds as h, introspection as i, getTableIds as j, getPageIds as k, getElementChildren as l, ResponsiveIconRadioGroup as m, Border as n, BorderRadius as o, GapX as p, ResponsiveSelect as q, ResponsiveNumber as r, Checkbox as s, Grid as t, TextInput as u, ResponsiveColor as v, TextStyle as w, ResponsiveLength as x, TextArea as y, Table as z };
2972
3123
  //# sourceMappingURL=react-page.es.js.map