@makeswift/runtime 0.9.1 → 0.9.3

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 (206) hide show
  1. package/dist/Box.cjs.js +1 -4
  2. package/dist/Box.cjs.js.map +1 -1
  3. package/dist/Box.es.js +1 -4
  4. package/dist/Box.es.js.map +1 -1
  5. package/dist/Button.cjs.js +1 -4
  6. package/dist/Button.cjs.js.map +1 -1
  7. package/dist/Button.es.js +1 -4
  8. package/dist/Button.es.js.map +1 -1
  9. package/dist/Carousel.cjs.js +1 -4
  10. package/dist/Carousel.cjs.js.map +1 -1
  11. package/dist/Carousel.es.js +1 -4
  12. package/dist/Carousel.es.js.map +1 -1
  13. package/dist/Countdown.cjs.js +0 -3
  14. package/dist/Countdown.cjs.js.map +1 -1
  15. package/dist/Countdown.es.js +0 -3
  16. package/dist/Countdown.es.js.map +1 -1
  17. package/dist/Divider.cjs.js +1 -4
  18. package/dist/Divider.cjs.js.map +1 -1
  19. package/dist/Divider.es.js +1 -4
  20. package/dist/Divider.es.js.map +1 -1
  21. package/dist/Embed.cjs.js +0 -2
  22. package/dist/Embed.cjs.js.map +1 -1
  23. package/dist/Embed.es.js +0 -2
  24. package/dist/Embed.es.js.map +1 -1
  25. package/dist/Form.cjs.js +0 -3
  26. package/dist/Form.cjs.js.map +1 -1
  27. package/dist/Form.es.js +0 -3
  28. package/dist/Form.es.js.map +1 -1
  29. package/dist/Image.cjs.js +0 -3
  30. package/dist/Image.cjs.js.map +1 -1
  31. package/dist/Image.es.js +0 -3
  32. package/dist/Image.es.js.map +1 -1
  33. package/dist/LiveProvider.cjs.js +1 -4
  34. package/dist/LiveProvider.cjs.js.map +1 -1
  35. package/dist/LiveProvider.es.js +3 -6
  36. package/dist/LiveProvider.es.js.map +1 -1
  37. package/dist/Navigation.cjs.js +0 -3
  38. package/dist/Navigation.cjs.js.map +1 -1
  39. package/dist/Navigation.es.js +0 -3
  40. package/dist/Navigation.es.js.map +1 -1
  41. package/dist/PreviewProvider.cjs.js +2 -5
  42. package/dist/PreviewProvider.cjs.js.map +1 -1
  43. package/dist/PreviewProvider.es.js +2 -5
  44. package/dist/PreviewProvider.es.js.map +1 -1
  45. package/dist/ReadOnlyText.cjs.js +1 -1
  46. package/dist/ReadOnlyText.es.js +2 -2
  47. package/dist/ReadOnlyTextV2.cjs.js +1 -1
  48. package/dist/ReadOnlyTextV2.es.js +2 -2
  49. package/dist/Root.cjs.js +0 -3
  50. package/dist/Root.cjs.js.map +1 -1
  51. package/dist/Root.es.js +0 -3
  52. package/dist/Root.es.js.map +1 -1
  53. package/dist/SocialLinks.cjs.js +1 -4
  54. package/dist/SocialLinks.cjs.js.map +1 -1
  55. package/dist/SocialLinks.es.js +1 -4
  56. package/dist/SocialLinks.es.js.map +1 -1
  57. package/dist/Text.cjs.js +0 -3
  58. package/dist/Text.cjs.js.map +1 -1
  59. package/dist/Text.es.js +0 -3
  60. package/dist/Text.es.js.map +1 -1
  61. package/dist/Video.cjs.js +0 -2
  62. package/dist/Video.cjs.js.map +1 -1
  63. package/dist/Video.es.js +0 -2
  64. package/dist/Video.es.js.map +1 -1
  65. package/dist/builder.cjs.js +0 -3
  66. package/dist/builder.cjs.js.map +1 -1
  67. package/dist/builder.es.js +0 -3
  68. package/dist/builder.es.js.map +1 -1
  69. package/dist/components.cjs.js +0 -3
  70. package/dist/components.cjs.js.map +1 -1
  71. package/dist/components.es.js +0 -3
  72. package/dist/components.es.js.map +1 -1
  73. package/dist/control-serialization.cjs.js +0 -3
  74. package/dist/control-serialization.cjs.js.map +1 -1
  75. package/dist/control-serialization.es.js +1 -4
  76. package/dist/control-serialization.es.js.map +1 -1
  77. package/dist/controls.cjs.js +5 -5
  78. package/dist/controls.es.js +2 -5
  79. package/dist/controls.es.js.map +1 -1
  80. package/dist/index.cjs.js +86 -17
  81. package/dist/index.cjs.js.map +1 -1
  82. package/dist/index.cjs10.js +4 -4
  83. package/dist/index.cjs10.js.map +1 -1
  84. package/dist/index.cjs2.js +1 -3
  85. package/dist/index.cjs2.js.map +1 -1
  86. package/dist/index.cjs6.js +2 -1
  87. package/dist/index.cjs6.js.map +1 -1
  88. package/dist/index.cjs8.js +0 -3
  89. package/dist/index.cjs8.js.map +1 -1
  90. package/dist/index.cjs9.js +49 -13
  91. package/dist/index.cjs9.js.map +1 -1
  92. package/dist/index.es.js +82 -14
  93. package/dist/index.es.js.map +1 -1
  94. package/dist/index.es10.js +3 -3
  95. package/dist/index.es2.js +2 -4
  96. package/dist/index.es2.js.map +1 -1
  97. package/dist/index.es6.js +2 -1
  98. package/dist/index.es6.js.map +1 -1
  99. package/dist/index.es8.js +0 -3
  100. package/dist/index.es8.js.map +1 -1
  101. package/dist/index.es9.js +50 -14
  102. package/dist/index.es9.js.map +1 -1
  103. package/dist/leaf.es.js +1 -1
  104. package/dist/main.cjs.js +0 -3
  105. package/dist/main.cjs.js.map +1 -1
  106. package/dist/main.es.js +0 -3
  107. package/dist/main.es.js.map +1 -1
  108. package/dist/next.cjs.js +0 -3
  109. package/dist/next.cjs.js.map +1 -1
  110. package/dist/next.es.js +1 -4
  111. package/dist/next.es.js.map +1 -1
  112. package/dist/prop-controllers.cjs.js +0 -3
  113. package/dist/prop-controllers.cjs.js.map +1 -1
  114. package/dist/prop-controllers.es.js +0 -3
  115. package/dist/prop-controllers.es.js.map +1 -1
  116. package/dist/react-page.cjs.js +926 -1573
  117. package/dist/react-page.cjs.js.map +1 -1
  118. package/dist/react-page.es.js +922 -1559
  119. package/dist/react-page.es.js.map +1 -1
  120. package/dist/react.cjs.js +0 -3
  121. package/dist/react.cjs.js.map +1 -1
  122. package/dist/react.es.js +0 -3
  123. package/dist/react.es.js.map +1 -1
  124. package/dist/slate.cjs.js +391 -58
  125. package/dist/slate.cjs.js.map +1 -1
  126. package/dist/slate.es.js +387 -59
  127. package/dist/slate.es.js.map +1 -1
  128. package/dist/text-input.cjs.js +22 -0
  129. package/dist/text-input.cjs.js.map +1 -1
  130. package/dist/text-input.es.js +18 -1
  131. package/dist/text-input.es.js.map +1 -1
  132. package/dist/types/src/api/react.d.ts.map +1 -1
  133. package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
  134. package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
  135. package/dist/types/src/components/page/Page.d.ts.map +1 -1
  136. package/dist/types/src/controls/control.d.ts +3 -2
  137. package/dist/types/src/controls/control.d.ts.map +1 -1
  138. package/dist/types/src/controls/icon-radio-group.d.ts +32 -0
  139. package/dist/types/src/controls/icon-radio-group.d.ts.map +1 -0
  140. package/dist/types/src/controls/index.d.ts +1 -0
  141. package/dist/types/src/controls/index.d.ts.map +1 -1
  142. package/dist/types/src/controls/rich-text/translation.d.ts +1 -1
  143. package/dist/types/src/controls/rich-text/translation.d.ts.map +1 -1
  144. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +7 -3
  145. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
  146. package/dist/types/src/controls/shape.d.ts +1 -2
  147. package/dist/types/src/controls/shape.d.ts.map +1 -1
  148. package/dist/types/src/controls/style-v2.d.ts +16 -7
  149. package/dist/types/src/controls/style-v2.d.ts.map +1 -1
  150. package/dist/types/src/next/client.d.ts.map +1 -1
  151. package/dist/types/src/next/document.d.ts.map +1 -1
  152. package/dist/types/src/prop-controllers/descriptors.d.ts +4 -2
  153. package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
  154. package/dist/types/src/prop-controllers/introspection.d.ts.map +1 -1
  155. package/dist/types/src/runtimes/react/controls/control.d.ts +3 -1
  156. package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
  157. package/dist/types/src/runtimes/react/controls/icon-radio-group.d.ts +4 -0
  158. package/dist/types/src/runtimes/react/controls/icon-radio-group.d.ts.map +1 -0
  159. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
  160. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts +10 -0
  161. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts.map +1 -0
  162. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts +10 -0
  163. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts.map +1 -0
  164. package/dist/types/src/runtimes/react/controls/style-v2.d.ts +10 -1
  165. package/dist/types/src/runtimes/react/controls/style-v2.d.ts.map +1 -1
  166. package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
  167. package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
  168. package/dist/types/src/slate/BlockPlugin/index.d.ts +1 -0
  169. package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
  170. package/dist/types/src/slate/ColorPlugin/index.d.ts +10 -0
  171. package/dist/types/src/slate/ColorPlugin/index.d.ts.map +1 -0
  172. package/dist/types/src/slate/InlineModePlugin/index.d.ts +1 -0
  173. package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
  174. package/dist/types/src/slate/InlinePlugin/getValue.d.ts +5 -0
  175. package/dist/types/src/slate/InlinePlugin/getValue.d.ts.map +1 -0
  176. package/dist/types/src/slate/InlinePlugin/index.d.ts +16 -0
  177. package/dist/types/src/slate/InlinePlugin/index.d.ts.map +1 -0
  178. package/dist/types/src/slate/InlinePlugin/onChange.d.ts +4 -0
  179. package/dist/types/src/slate/InlinePlugin/onChange.d.ts.map +1 -0
  180. package/dist/types/src/slate/InlinePlugin/types.d.ts +9 -0
  181. package/dist/types/src/slate/InlinePlugin/types.d.ts.map +1 -0
  182. package/dist/types/src/slate/LinkPlugin/getValue.d.ts +5 -0
  183. package/dist/types/src/slate/LinkPlugin/getValue.d.ts.map +1 -0
  184. package/dist/types/src/slate/LinkPlugin/index.d.ts +15 -0
  185. package/dist/types/src/slate/LinkPlugin/index.d.ts.map +1 -0
  186. package/dist/types/src/slate/LinkPlugin/onChange.d.ts +4 -0
  187. package/dist/types/src/slate/LinkPlugin/onChange.d.ts.map +1 -0
  188. package/dist/types/src/slate/LinkPlugin/types.d.ts +5 -0
  189. package/dist/types/src/slate/LinkPlugin/types.d.ts.map +1 -0
  190. package/dist/types/src/slate/TextAlignPlugin/index.d.ts +3 -1
  191. package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -1
  192. package/dist/types/src/slate/index.d.ts +3 -0
  193. package/dist/types/src/slate/index.d.ts.map +1 -1
  194. package/dist/types/src/slate/types.d.ts +21 -0
  195. package/dist/types/src/slate/types.d.ts.map +1 -1
  196. package/dist/types/src/slate/utils/responsive.d.ts +16 -0
  197. package/dist/types/src/slate/utils/responsive.d.ts.map +1 -0
  198. package/dist/types.cjs2.js +753 -0
  199. package/dist/types.cjs2.js.map +1 -0
  200. package/dist/types.es2.js +736 -0
  201. package/dist/types.es2.js.map +1 -0
  202. package/package.json +1 -1
  203. package/dist/deepEqual.cjs.js +0 -40
  204. package/dist/deepEqual.cjs.js.map +0 -1
  205. package/dist/deepEqual.es.js +0 -39
  206. package/dist/deepEqual.es.js.map +0 -1
@@ -32,9 +32,6 @@ var css = require("@emotion/css");
32
32
  var serialize = require("@emotion/serialize");
33
33
  var utils = require("@emotion/utils");
34
34
  var slate = require("slate");
35
- var isHotkey = require("is-hotkey");
36
- require("slate-react");
37
- var jsxRuntime = require("react/jsx-runtime");
38
35
  function _interopDefaultLegacy(e) {
39
36
  return e && typeof e === "object" && "default" in e ? e : { "default": e };
40
37
  }
@@ -60,7 +57,6 @@ function _interopNamespace(e) {
60
57
  }
61
58
  var thunk__default = /* @__PURE__ */ _interopDefaultLegacy(thunk);
62
59
  var React__namespace = /* @__PURE__ */ _interopNamespace(React);
63
- var isHotkey__default = /* @__PURE__ */ _interopDefaultLegacy(isHotkey);
64
60
  const ComponentIcon = {
65
61
  Billing: "billing",
66
62
  Bolt: "bolt",
@@ -325,92 +321,199 @@ function copyColorData(value, context) {
325
321
  swatchId: (_a2 = context.replacementContext.swatchIds.get(value.swatchId)) != null ? _a2 : value.swatchId
326
322
  });
327
323
  }
328
- const ImageControlType = "makeswift::controls::image";
329
- const ImageControlValueFormat = {
330
- URL: "makeswift::controls::image::format::url",
331
- WithDimensions: "makeswift::controls::image::format::with-dimensions"
332
- };
333
- function Image$1(config = {}) {
334
- return { type: ImageControlType, config };
324
+ class PropController {
325
+ constructor(send) {
326
+ __publicField(this, "send");
327
+ this.send = send;
328
+ }
335
329
  }
336
- Image$1.Format = ImageControlValueFormat;
337
- function copyImageData(value, context) {
330
+ const StyleControlType = "makeswift::controls::style";
331
+ const StyleControlProperty = {
332
+ Width: "makeswift::controls::style::property::width",
333
+ Margin: "makeswift::controls::style::property::margin",
334
+ Padding: "makeswift::controls::style::property::padding",
335
+ Border: "makeswift::controls::style::property::border",
336
+ BorderRadius: "makeswift::controls::style::property::border-radius",
337
+ TextStyle: "makeswift::controls::style::property::text-style"
338
+ };
339
+ const StyleControlDefaultProperties = [
340
+ StyleControlProperty.Width,
341
+ StyleControlProperty.Margin
342
+ ];
343
+ const AllStyleControlProperties = [
344
+ StyleControlProperty.Width,
345
+ StyleControlProperty.Margin,
346
+ StyleControlProperty.Padding,
347
+ StyleControlProperty.Border,
348
+ StyleControlProperty.BorderRadius,
349
+ StyleControlProperty.TextStyle
350
+ ];
351
+ function Style(params) {
338
352
  var _a2;
339
- if (value == null)
340
- return value;
341
- return (_a2 = context.replacementContext.fileIds.get(value)) != null ? _a2 : value;
342
- }
343
- if (void 0) {
344
- const { describe, test, expect } = void 0;
345
- describe.concurrent("image copy", () => {
346
- test("image is replaced by a one in replacement context", () => {
347
- const data = "file-id";
348
- const expected = "testing";
349
- const replacementContext = {
350
- elementHtmlIds: /* @__PURE__ */ new Set(),
351
- elementKeys: /* @__PURE__ */ new Map(),
352
- swatchIds: /* @__PURE__ */ new Map(),
353
- fileIds: /* @__PURE__ */ new Map([["file-id", "testing"]]),
354
- typographyIds: /* @__PURE__ */ new Map(),
355
- tableIds: /* @__PURE__ */ new Map(),
356
- tableColumnIds: /* @__PURE__ */ new Map(),
357
- pageIds: /* @__PURE__ */ new Map(),
358
- globalElementIds: /* @__PURE__ */ new Map(),
359
- globalElementData: /* @__PURE__ */ new Map()
360
- };
361
- const result = copyImageData(data, {
362
- replacementContext,
363
- copyElement: (node) => node
364
- });
365
- expect(result).toMatchObject(expected);
366
- });
367
- });
353
+ return {
354
+ type: StyleControlType,
355
+ config: { properties: (_a2 = params == null ? void 0 : params.properties) != null ? _a2 : StyleControlDefaultProperties }
356
+ };
368
357
  }
369
- const LinkControlType = "makeswift::controls::link";
370
- function Link$1(config = {}) {
371
- return { type: LinkControlType, config };
358
+ Style.Default = StyleControlDefaultProperties;
359
+ Style.All = AllStyleControlProperties;
360
+ Style.Width = StyleControlProperty.Width;
361
+ Style.Margin = StyleControlProperty.Margin;
362
+ Style.Padding = StyleControlProperty.Padding;
363
+ Style.Border = StyleControlProperty.Border;
364
+ Style.BorderRadius = StyleControlProperty.BorderRadius;
365
+ Style.TextStyle = StyleControlProperty.TextStyle;
366
+ const StyleControlMessageType = {
367
+ CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model"
368
+ };
369
+ class StyleControl extends PropController {
370
+ constructor(send) {
371
+ super(send);
372
+ }
373
+ changeBoxModel(boxModel) {
374
+ this.send({ type: StyleControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
375
+ }
376
+ recv() {
377
+ }
372
378
  }
373
- function copyLinkData(value, context) {
374
- var _a2;
379
+ function copyStyleData(value, context) {
375
380
  if (value == null)
376
381
  return value;
377
- if (value.type === "OPEN_PAGE") {
378
- const pageId = value.payload.pageId;
379
- if (pageId != null) {
380
- return __spreadProps(__spreadValues({}, value), {
381
- payload: __spreadProps(__spreadValues({}, value.payload), {
382
- pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : pageId
383
- })
382
+ function copyResponsiveBorder(responsiveBorder) {
383
+ if (responsiveBorder == null)
384
+ return void 0;
385
+ return responsiveBorder.map((deviceBorder) => __spreadProps(__spreadValues({}, deviceBorder), {
386
+ value: copyBorder(deviceBorder.value)
387
+ }));
388
+ }
389
+ function copyBorder(border) {
390
+ function copyBorderSide(side) {
391
+ if (side == null)
392
+ return null;
393
+ if (side.color == null)
394
+ return side;
395
+ return __spreadProps(__spreadValues({}, side), {
396
+ color: copyColorData(side.color, context)
384
397
  });
385
398
  }
399
+ return {
400
+ borderTop: copyBorderSide(border.borderTop),
401
+ borderBottom: copyBorderSide(border.borderBottom),
402
+ borderRight: copyBorderSide(border.borderRight),
403
+ borderLeft: copyBorderSide(border.borderLeft)
404
+ };
386
405
  }
387
- return value;
406
+ return __spreadProps(__spreadValues({}, value), { border: copyResponsiveBorder(value.border) });
388
407
  }
389
408
  if (void 0) {
390
409
  const { describe, test, expect } = void 0;
391
- describe.concurrent("link", () => {
392
- test("page id is replaced by one in replacement context", () => {
393
- const data = {
394
- type: "OPEN_PAGE",
395
- payload: {
396
- pageId: "UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=",
397
- openInNewTab: false
398
- }
410
+ describe.concurrent("style copy", () => {
411
+ test("colors are replaced", () => {
412
+ const value = {
413
+ width: [
414
+ {
415
+ value: {
416
+ unit: "px",
417
+ value: 100
418
+ },
419
+ deviceId: "desktop"
420
+ }
421
+ ],
422
+ border: [
423
+ {
424
+ value: {
425
+ borderTop: {
426
+ color: {
427
+ alpha: 1,
428
+ swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
429
+ },
430
+ style: "solid",
431
+ width: 9
432
+ },
433
+ borderLeft: {
434
+ color: {
435
+ alpha: 1,
436
+ swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
437
+ },
438
+ style: "solid",
439
+ width: 9
440
+ },
441
+ borderRight: {
442
+ color: {
443
+ alpha: 1,
444
+ swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
445
+ },
446
+ style: "solid",
447
+ width: 9
448
+ },
449
+ borderBottom: {
450
+ color: {
451
+ alpha: 1,
452
+ swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
453
+ },
454
+ style: "solid",
455
+ width: 9
456
+ }
457
+ },
458
+ deviceId: "desktop"
459
+ }
460
+ ],
461
+ textStyle: [
462
+ {
463
+ value: {
464
+ fontSize: {
465
+ unit: "px",
466
+ value: 46
467
+ },
468
+ fontStyle: [],
469
+ fontFamily: "Oswald",
470
+ fontWeight: 400,
471
+ letterSpacing: 5.2,
472
+ textTransform: []
473
+ },
474
+ deviceId: "desktop"
475
+ }
476
+ ],
477
+ borderRadius: [
478
+ {
479
+ value: {
480
+ borderTopLeftRadius: {
481
+ unit: "px",
482
+ value: 4
483
+ },
484
+ borderTopRightRadius: {
485
+ unit: "px",
486
+ value: 4
487
+ },
488
+ borderBottomLeftRadius: {
489
+ unit: "px",
490
+ value: 4
491
+ },
492
+ borderBottomRightRadius: {
493
+ unit: "px",
494
+ value: 4
495
+ }
496
+ },
497
+ deviceId: "desktop"
498
+ }
499
+ ]
399
500
  };
400
- const expected = JSON.parse(JSON.stringify(data).replace("UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=", "testing"));
501
+ const expected = JSON.parse(JSON.stringify(value).replaceAll("U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"));
401
502
  const replacementContext = {
402
503
  elementHtmlIds: /* @__PURE__ */ new Set(),
403
504
  elementKeys: /* @__PURE__ */ new Map(),
404
- swatchIds: /* @__PURE__ */ new Map(),
405
- pageIds: /* @__PURE__ */ new Map([["UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=", "testing"]]),
505
+ swatchIds: /* @__PURE__ */ new Map([
506
+ ["U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"]
507
+ ]),
508
+ fileIds: /* @__PURE__ */ new Map(),
406
509
  typographyIds: /* @__PURE__ */ new Map(),
407
510
  tableIds: /* @__PURE__ */ new Map(),
408
511
  tableColumnIds: /* @__PURE__ */ new Map(),
409
- fileIds: /* @__PURE__ */ new Map(),
512
+ pageIds: /* @__PURE__ */ new Map(),
410
513
  globalElementIds: /* @__PURE__ */ new Map(),
411
514
  globalElementData: /* @__PURE__ */ new Map()
412
515
  };
413
- const result = copyLinkData(data, {
516
+ const result = copyStyleData(value, {
414
517
  replacementContext,
415
518
  copyElement: (node) => node
416
519
  });
@@ -418,30 +521,340 @@ if (void 0) {
418
521
  });
419
522
  });
420
523
  }
421
- class PropController {
422
- constructor(send) {
423
- __publicField(this, "send");
424
- this.send = send;
425
- }
426
- }
427
- const RichTextPropControllerMessageType = {
428
- CHANGE_BUILDER_EDIT_MODE: "CHANGE_BUILDER_EDIT_MODE",
429
- INITIALIZE_EDITOR: "INITIALIZE_EDITOR",
430
- CHANGE_EDITOR_VALUE: "CHANGE_EDITOR_VALUE",
431
- FOCUS: "FOCUS",
432
- BLUR: "BLUR",
433
- UNDO: "UNDO",
434
- REDO: "REDO",
435
- CHANGE_BOX_MODEL: "CHANGE_BOX_MODEL"
436
- };
437
- class DefaultPropController extends PropController {
438
- constructor() {
439
- super(...arguments);
440
- __publicField(this, "recv", (_message) => {
441
- });
442
- }
443
- }
444
- class RichTextPropController extends PropController {
524
+ const Types = {
525
+ Backgrounds: "Backgrounds",
526
+ Border: "Border",
527
+ BorderRadius: "BorderRadius",
528
+ Checkbox: "Checkbox",
529
+ Date: "Date",
530
+ ElementID: "ElementID",
531
+ Font: "Font",
532
+ GapX: "GapX",
533
+ GapY: "GapY",
534
+ Grid: "Grid",
535
+ Image: "Image",
536
+ Images: "Images",
537
+ Link: "Link",
538
+ List: "List",
539
+ Margin: "Margin",
540
+ NavigationLinks: "NavigationLinks",
541
+ Number: "Number",
542
+ Padding: "Padding",
543
+ ResponsiveColor: "ResponsiveColor",
544
+ ResponsiveIconRadioGroup: "ResponsiveIconRadioGroup",
545
+ ResponsiveLength: "ResponsiveLength",
546
+ ResponsiveNumber: "ResponsiveNumber",
547
+ ResponsiveOpacity: "ResponsiveOpacity",
548
+ ResponsiveSelect: "ResponsiveSelect",
549
+ RichText: "RichText",
550
+ Shadows: "Shadows",
551
+ Shape: "Shape",
552
+ SocialLinks: "SocialLinks",
553
+ Table: "Table",
554
+ TableFormFields: "TableFormFields",
555
+ Typeahead: "Typeahead",
556
+ TextArea: "TextArea",
557
+ TextInput: "TextInput",
558
+ TextStyle: "TextStyle",
559
+ Video: "Video",
560
+ Width: "Width",
561
+ Style: StyleControlType
562
+ };
563
+ function Backgrounds(options = {}) {
564
+ return { type: Types.Backgrounds, options };
565
+ }
566
+ const BorderPropControllerFormat = {
567
+ ClassName: "makeswift::prop-controllers::border::format::class-name",
568
+ ResponsiveValue: "makeswift::prop-controllers:border::format::responsive-value"
569
+ };
570
+ function Border(options = {}) {
571
+ return { type: Types.Border, options };
572
+ }
573
+ Border.Format = BorderPropControllerFormat;
574
+ const BorderRadiusPropControllerFormat = {
575
+ ClassName: "makeswift::prop-controllers::border-radius::format::class-name",
576
+ ResponsiveValue: "makeswift::prop-controllers::border-radius::format::responsive-value"
577
+ };
578
+ function BorderRadius(options = {}) {
579
+ return { type: Types.BorderRadius, options };
580
+ }
581
+ BorderRadius.Format = BorderRadiusPropControllerFormat;
582
+ function Checkbox(options) {
583
+ return { type: Types.Checkbox, options };
584
+ }
585
+ function Date(options = {}) {
586
+ return { type: Types.Date, options };
587
+ }
588
+ function ElementID(options = {}) {
589
+ return { type: Types.ElementID, options };
590
+ }
591
+ function Font(options = {}) {
592
+ return { type: Types.Font, options };
593
+ }
594
+ function GapX(options = {}) {
595
+ return { type: Types.GapX, options };
596
+ }
597
+ function GapY(options = {}) {
598
+ return { type: Types.GapY, options };
599
+ }
600
+ function Grid(options = {}) {
601
+ return { type: Types.Grid, options };
602
+ }
603
+ function Image$1(options = {}) {
604
+ return { type: Types.Image, options };
605
+ }
606
+ function Images(options = {}) {
607
+ return { type: Types.Images, options };
608
+ }
609
+ function Link$1(options = {}) {
610
+ return { type: Types.Link, options };
611
+ }
612
+ function List$1(options) {
613
+ return { type: Types.List, options };
614
+ }
615
+ const MarginPropControllerFormat = {
616
+ ClassName: "makeswift::prop-controllers::margin::format::class-name",
617
+ ResponsiveValue: "makeswift::prop-controllers::margin::format::responsive-value"
618
+ };
619
+ function Margin(options = {}) {
620
+ return { type: Types.Margin, options };
621
+ }
622
+ Margin.Format = MarginPropControllerFormat;
623
+ function NavigationLinks(options = {}) {
624
+ return { type: Types.NavigationLinks, options };
625
+ }
626
+ function Number(options = {}) {
627
+ return { type: Types.Number, options };
628
+ }
629
+ const PaddingPropControllerFormat = {
630
+ ClassName: "makeswift::prop-controllers::padding::format::class-name",
631
+ ResponsiveValue: "makeswift::prop-controllers::padding::format::responsive-value"
632
+ };
633
+ function Padding(options = {}) {
634
+ return { type: Types.Padding, options };
635
+ }
636
+ Padding.Format = PaddingPropControllerFormat;
637
+ function ResponsiveColor(options = {}) {
638
+ return { type: Types.ResponsiveColor, options };
639
+ }
640
+ function ResponsiveIconRadioGroup(options) {
641
+ return { type: Types.ResponsiveIconRadioGroup, options };
642
+ }
643
+ function ResponsiveLength(options = {}) {
644
+ return { type: Types.ResponsiveLength, options };
645
+ }
646
+ function ResponsiveNumber(options = {}) {
647
+ return { type: Types.ResponsiveNumber, options };
648
+ }
649
+ function ResponsiveOpacity(options = {}) {
650
+ return { type: Types.ResponsiveOpacity, options };
651
+ }
652
+ function ResponsiveSelect(options) {
653
+ return { type: Types.ResponsiveSelect, options };
654
+ }
655
+ function RichText$1(options = {}) {
656
+ return { type: Types.RichText, options };
657
+ }
658
+ const ShadowsPropControllerFormat = {
659
+ ClassName: "makeswift::prop-controllers::shadows::format::class-name",
660
+ ResponsiveValue: "makeswift::prop-controllers::shadows::format::responsive-value"
661
+ };
662
+ function Shadows(options = {}) {
663
+ return { type: Types.Shadows, options };
664
+ }
665
+ Shadows.Format = ShadowsPropControllerFormat;
666
+ function Shape$1(options) {
667
+ return { type: Types.Shape, options };
668
+ }
669
+ function SocialLinks(options = {}) {
670
+ return { type: Types.SocialLinks, options };
671
+ }
672
+ function Table(options = {}) {
673
+ return { type: Types.Table, options };
674
+ }
675
+ function TableFormFields(options = {}) {
676
+ return { type: Types.TableFormFields, options };
677
+ }
678
+ function Typeahead(options) {
679
+ return { type: Types.Typeahead, options };
680
+ }
681
+ function TextArea(options = {}) {
682
+ return { type: Types.TextArea, options };
683
+ }
684
+ function TextInput(options = {}) {
685
+ return { type: Types.TextInput, options };
686
+ }
687
+ function TextStyle(options = {}) {
688
+ return { type: Types.TextStyle, options };
689
+ }
690
+ function Video(options = {}) {
691
+ return { type: Types.Video, options };
692
+ }
693
+ const WidthPropControllerFormat = {
694
+ ClassName: "makeswift::prop-controllers::width::format::class-name",
695
+ ResponsiveValue: "makeswift::prop-controllers::width::format::responsive-value"
696
+ };
697
+ function Width(options = {}) {
698
+ return { type: Types.Width, options };
699
+ }
700
+ Width.Format = WidthPropControllerFormat;
701
+ var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
702
+ __proto__: null,
703
+ Types,
704
+ Backgrounds,
705
+ BorderPropControllerFormat,
706
+ Border,
707
+ BorderRadiusPropControllerFormat,
708
+ BorderRadius,
709
+ Checkbox,
710
+ Date,
711
+ ElementID,
712
+ Font,
713
+ GapX,
714
+ GapY,
715
+ Grid,
716
+ Image: Image$1,
717
+ Images,
718
+ Link: Link$1,
719
+ List: List$1,
720
+ MarginPropControllerFormat,
721
+ Margin,
722
+ NavigationLinks,
723
+ Number,
724
+ PaddingPropControllerFormat,
725
+ Padding,
726
+ ResponsiveColor,
727
+ ResponsiveIconRadioGroup,
728
+ ResponsiveLength,
729
+ ResponsiveNumber,
730
+ ResponsiveOpacity,
731
+ ResponsiveSelect,
732
+ RichText: RichText$1,
733
+ ShadowsPropControllerFormat,
734
+ Shadows,
735
+ Shape: Shape$1,
736
+ SocialLinks,
737
+ Table,
738
+ TableFormFields,
739
+ Typeahead,
740
+ TextArea,
741
+ TextInput,
742
+ TextStyle,
743
+ Video,
744
+ WidthPropControllerFormat,
745
+ Width
746
+ }, Symbol.toStringTag, { value: "Module" }));
747
+ const ImageControlType = "makeswift::controls::image";
748
+ const ImageControlValueFormat = {
749
+ URL: "makeswift::controls::image::format::url",
750
+ WithDimensions: "makeswift::controls::image::format::with-dimensions"
751
+ };
752
+ function Image(config = {}) {
753
+ return { type: ImageControlType, config };
754
+ }
755
+ Image.Format = ImageControlValueFormat;
756
+ function copyImageData(value, context) {
757
+ var _a2;
758
+ if (value == null)
759
+ return value;
760
+ return (_a2 = context.replacementContext.fileIds.get(value)) != null ? _a2 : value;
761
+ }
762
+ if (void 0) {
763
+ const { describe, test, expect } = void 0;
764
+ describe.concurrent("image copy", () => {
765
+ test("image is replaced by a one in replacement context", () => {
766
+ const data = "file-id";
767
+ const expected = "testing";
768
+ const replacementContext = {
769
+ elementHtmlIds: /* @__PURE__ */ new Set(),
770
+ elementKeys: /* @__PURE__ */ new Map(),
771
+ swatchIds: /* @__PURE__ */ new Map(),
772
+ fileIds: /* @__PURE__ */ new Map([["file-id", "testing"]]),
773
+ typographyIds: /* @__PURE__ */ new Map(),
774
+ tableIds: /* @__PURE__ */ new Map(),
775
+ tableColumnIds: /* @__PURE__ */ new Map(),
776
+ pageIds: /* @__PURE__ */ new Map(),
777
+ globalElementIds: /* @__PURE__ */ new Map(),
778
+ globalElementData: /* @__PURE__ */ new Map()
779
+ };
780
+ const result = copyImageData(data, {
781
+ replacementContext,
782
+ copyElement: (node) => node
783
+ });
784
+ expect(result).toMatchObject(expected);
785
+ });
786
+ });
787
+ }
788
+ const LinkControlType = "makeswift::controls::link";
789
+ function Link(config = {}) {
790
+ return { type: LinkControlType, config };
791
+ }
792
+ function copyLinkData(value, context) {
793
+ var _a2;
794
+ if (value == null)
795
+ return value;
796
+ if (value.type === "OPEN_PAGE") {
797
+ const pageId = value.payload.pageId;
798
+ if (pageId != null) {
799
+ return __spreadProps(__spreadValues({}, value), {
800
+ payload: __spreadProps(__spreadValues({}, value.payload), {
801
+ pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : pageId
802
+ })
803
+ });
804
+ }
805
+ }
806
+ return value;
807
+ }
808
+ if (void 0) {
809
+ const { describe, test, expect } = void 0;
810
+ describe.concurrent("link", () => {
811
+ test("page id is replaced by one in replacement context", () => {
812
+ const data = {
813
+ type: "OPEN_PAGE",
814
+ payload: {
815
+ pageId: "UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=",
816
+ openInNewTab: false
817
+ }
818
+ };
819
+ const expected = JSON.parse(JSON.stringify(data).replace("UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=", "testing"));
820
+ const replacementContext = {
821
+ elementHtmlIds: /* @__PURE__ */ new Set(),
822
+ elementKeys: /* @__PURE__ */ new Map(),
823
+ swatchIds: /* @__PURE__ */ new Map(),
824
+ pageIds: /* @__PURE__ */ new Map([["UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=", "testing"]]),
825
+ typographyIds: /* @__PURE__ */ new Map(),
826
+ tableIds: /* @__PURE__ */ new Map(),
827
+ tableColumnIds: /* @__PURE__ */ new Map(),
828
+ fileIds: /* @__PURE__ */ new Map(),
829
+ globalElementIds: /* @__PURE__ */ new Map(),
830
+ globalElementData: /* @__PURE__ */ new Map()
831
+ };
832
+ const result = copyLinkData(data, {
833
+ replacementContext,
834
+ copyElement: (node) => node
835
+ });
836
+ expect(result).toMatchObject(expected);
837
+ });
838
+ });
839
+ }
840
+ const RichTextPropControllerMessageType = {
841
+ CHANGE_BUILDER_EDIT_MODE: "CHANGE_BUILDER_EDIT_MODE",
842
+ INITIALIZE_EDITOR: "INITIALIZE_EDITOR",
843
+ CHANGE_EDITOR_VALUE: "CHANGE_EDITOR_VALUE",
844
+ FOCUS: "FOCUS",
845
+ BLUR: "BLUR",
846
+ UNDO: "UNDO",
847
+ REDO: "REDO",
848
+ CHANGE_BOX_MODEL: "CHANGE_BOX_MODEL"
849
+ };
850
+ class DefaultPropController extends PropController {
851
+ constructor() {
852
+ super(...arguments);
853
+ __publicField(this, "recv", (_message) => {
854
+ });
855
+ }
856
+ }
857
+ class RichTextPropController extends PropController {
445
858
  constructor() {
446
859
  super(...arguments);
447
860
  __publicField(this, "editor", null);
@@ -533,13 +946,13 @@ function createPropController(descriptor, send) {
533
946
  case StyleControlType:
534
947
  return new StyleControl(send);
535
948
  case StyleV2ControlType:
536
- return new StyleV2Control(send);
949
+ return new StyleV2Control(send, descriptor);
537
950
  default:
538
951
  return new DefaultPropController(send);
539
952
  }
540
953
  }
541
954
  const ListControlType = "makeswift::controls::list";
542
- function List$1(config) {
955
+ function List(config) {
543
956
  return { type: ListControlType, config };
544
957
  }
545
958
  const ListControlMessageType = {
@@ -590,259 +1003,65 @@ class ListControl extends PropController {
590
1003
  this.controls = /* @__PURE__ */ new Map();
591
1004
  }
592
1005
  }
593
- function copyListData(definition2, value, context) {
1006
+ function copyListData(definition, value, context) {
594
1007
  if (value == null)
595
1008
  return value;
596
1009
  return value && value.map((item) => __spreadProps(__spreadValues({}, item), {
597
- value: copy(definition2.config.type, item.value, context)
1010
+ value: copy(definition.config.type, item.value, context)
598
1011
  }));
599
1012
  }
600
- const ShapeControlType = "makeswift::controls::shape";
601
- function Shape$1(config) {
602
- return { type: ShapeControlType, config };
603
- }
604
- const ShapeControlMessageType = {
605
- SHAPE_CONTROL_CHILD_CONTROL_MESSAGE: "makeswift::controls::shape::message::child-control-message"
606
- };
607
- class ShapeControl extends PropController {
608
- constructor(send, descriptor) {
609
- super(send);
610
- __publicField(this, "controls");
611
- __publicField(this, "descriptor");
612
- __publicField(this, "send");
613
- __publicField(this, "setControls", () => {
614
- const controls = /* @__PURE__ */ new Map();
615
- const children = this.descriptor.config.type;
616
- Object.keys(children).forEach((key) => {
617
- const control = createPropController(children[key], (message) => this.send({
618
- type: ShapeControlMessageType.SHAPE_CONTROL_CHILD_CONTROL_MESSAGE,
619
- payload: { message, key }
620
- }));
621
- controls.set(key, control);
622
- });
623
- this.controls = controls;
624
- return this.controls;
625
- });
626
- __publicField(this, "recv", (message) => {
627
- switch (message.type) {
628
- case ShapeControlMessageType.SHAPE_CONTROL_CHILD_CONTROL_MESSAGE: {
629
- const control = this.controls.get(message.payload.key);
630
- if (control == null)
631
- return;
632
- const recv = control.recv;
633
- recv(message.payload.message);
634
- }
635
- }
636
- });
637
- this.descriptor = descriptor;
638
- this.send = send;
639
- this.controls = /* @__PURE__ */ new Map();
640
- this.setControls();
641
- }
642
- }
643
- function copyShapeData(definition2, value, context) {
644
- if (value == null)
645
- return value;
646
- const newValue = {};
647
- for (const [key, itemDefinition] of Object.entries(definition2.config.type)) {
648
- const prop = value[key];
649
- newValue[key] = copy(itemDefinition, prop, context);
650
- }
651
- return newValue;
652
- }
653
- const StyleControlType = "makeswift::controls::style";
654
- const StyleControlProperty = {
655
- Width: "makeswift::controls::style::property::width",
656
- Margin: "makeswift::controls::style::property::margin",
657
- Padding: "makeswift::controls::style::property::padding",
658
- Border: "makeswift::controls::style::property::border",
659
- BorderRadius: "makeswift::controls::style::property::border-radius",
660
- TextStyle: "makeswift::controls::style::property::text-style"
661
- };
662
- const StyleControlDefaultProperties = [
663
- StyleControlProperty.Width,
664
- StyleControlProperty.Margin
665
- ];
666
- const AllStyleControlProperties = [
667
- StyleControlProperty.Width,
668
- StyleControlProperty.Margin,
669
- StyleControlProperty.Padding,
670
- StyleControlProperty.Border,
671
- StyleControlProperty.BorderRadius,
672
- StyleControlProperty.TextStyle
673
- ];
674
- function Style(params) {
675
- var _a2;
676
- return {
677
- type: StyleControlType,
678
- config: { properties: (_a2 = params == null ? void 0 : params.properties) != null ? _a2 : StyleControlDefaultProperties }
679
- };
680
- }
681
- Style.Default = StyleControlDefaultProperties;
682
- Style.All = AllStyleControlProperties;
683
- Style.Width = StyleControlProperty.Width;
684
- Style.Margin = StyleControlProperty.Margin;
685
- Style.Padding = StyleControlProperty.Padding;
686
- Style.Border = StyleControlProperty.Border;
687
- Style.BorderRadius = StyleControlProperty.BorderRadius;
688
- Style.TextStyle = StyleControlProperty.TextStyle;
689
- const StyleControlMessageType = {
690
- CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model"
691
- };
692
- class StyleControl extends PropController {
693
- constructor(send) {
694
- super(send);
695
- }
696
- changeBoxModel(boxModel) {
697
- this.send({ type: StyleControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
698
- }
699
- recv() {
700
- }
701
- }
702
- function copyStyleData(value, context) {
703
- if (value == null)
704
- return value;
705
- function copyResponsiveBorder(responsiveBorder) {
706
- if (responsiveBorder == null)
707
- return void 0;
708
- return responsiveBorder.map((deviceBorder) => __spreadProps(__spreadValues({}, deviceBorder), {
709
- value: copyBorder(deviceBorder.value)
710
- }));
711
- }
712
- function copyBorder(border) {
713
- function copyBorderSide(side) {
714
- if (side == null)
715
- return null;
716
- if (side.color == null)
717
- return side;
718
- return __spreadProps(__spreadValues({}, side), {
719
- color: copyColorData(side.color, context)
720
- });
721
- }
722
- return {
723
- borderTop: copyBorderSide(border.borderTop),
724
- borderBottom: copyBorderSide(border.borderBottom),
725
- borderRight: copyBorderSide(border.borderRight),
726
- borderLeft: copyBorderSide(border.borderLeft)
727
- };
728
- }
729
- return __spreadProps(__spreadValues({}, value), { border: copyResponsiveBorder(value.border) });
730
- }
731
- if (void 0) {
732
- const { describe, test, expect } = void 0;
733
- describe.concurrent("style copy", () => {
734
- test("colors are replaced", () => {
735
- const value = {
736
- width: [
737
- {
738
- value: {
739
- unit: "px",
740
- value: 100
741
- },
742
- deviceId: "desktop"
743
- }
744
- ],
745
- border: [
746
- {
747
- value: {
748
- borderTop: {
749
- color: {
750
- alpha: 1,
751
- swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
752
- },
753
- style: "solid",
754
- width: 9
755
- },
756
- borderLeft: {
757
- color: {
758
- alpha: 1,
759
- swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
760
- },
761
- style: "solid",
762
- width: 9
763
- },
764
- borderRight: {
765
- color: {
766
- alpha: 1,
767
- swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
768
- },
769
- style: "solid",
770
- width: 9
771
- },
772
- borderBottom: {
773
- color: {
774
- alpha: 1,
775
- swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
776
- },
777
- style: "solid",
778
- width: 9
779
- }
780
- },
781
- deviceId: "desktop"
782
- }
783
- ],
784
- textStyle: [
785
- {
786
- value: {
787
- fontSize: {
788
- unit: "px",
789
- value: 46
790
- },
791
- fontStyle: [],
792
- fontFamily: "Oswald",
793
- fontWeight: 400,
794
- letterSpacing: 5.2,
795
- textTransform: []
796
- },
797
- deviceId: "desktop"
798
- }
799
- ],
800
- borderRadius: [
801
- {
802
- value: {
803
- borderTopLeftRadius: {
804
- unit: "px",
805
- value: 4
806
- },
807
- borderTopRightRadius: {
808
- unit: "px",
809
- value: 4
810
- },
811
- borderBottomLeftRadius: {
812
- unit: "px",
813
- value: 4
814
- },
815
- borderBottomRightRadius: {
816
- unit: "px",
817
- value: 4
818
- }
819
- },
820
- deviceId: "desktop"
821
- }
822
- ]
823
- };
824
- const expected = JSON.parse(JSON.stringify(value).replaceAll("U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"));
825
- const replacementContext = {
826
- elementHtmlIds: /* @__PURE__ */ new Set(),
827
- elementKeys: /* @__PURE__ */ new Map(),
828
- swatchIds: /* @__PURE__ */ new Map([
829
- ["U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"]
830
- ]),
831
- fileIds: /* @__PURE__ */ new Map(),
832
- typographyIds: /* @__PURE__ */ new Map(),
833
- tableIds: /* @__PURE__ */ new Map(),
834
- tableColumnIds: /* @__PURE__ */ new Map(),
835
- pageIds: /* @__PURE__ */ new Map(),
836
- globalElementIds: /* @__PURE__ */ new Map(),
837
- globalElementData: /* @__PURE__ */ new Map()
838
- };
839
- const result = copyStyleData(value, {
840
- replacementContext,
841
- copyElement: (node) => node
1013
+ const ShapeControlType = "makeswift::controls::shape";
1014
+ function Shape(config) {
1015
+ return { type: ShapeControlType, config };
1016
+ }
1017
+ const ShapeControlMessageType = {
1018
+ SHAPE_CONTROL_CHILD_CONTROL_MESSAGE: "makeswift::controls::shape::message::child-control-message"
1019
+ };
1020
+ class ShapeControl extends PropController {
1021
+ constructor(send, descriptor) {
1022
+ super(send);
1023
+ __publicField(this, "controls");
1024
+ __publicField(this, "descriptor");
1025
+ __publicField(this, "send");
1026
+ __publicField(this, "setControls", () => {
1027
+ const controls = /* @__PURE__ */ new Map();
1028
+ const children = this.descriptor.config.type;
1029
+ Object.keys(children).forEach((key) => {
1030
+ const control = createPropController(children[key], (message) => this.send({
1031
+ type: ShapeControlMessageType.SHAPE_CONTROL_CHILD_CONTROL_MESSAGE,
1032
+ payload: { message, key }
1033
+ }));
1034
+ controls.set(key, control);
842
1035
  });
843
- expect(result).toMatchObject(expected);
1036
+ this.controls = controls;
1037
+ return this.controls;
844
1038
  });
845
- });
1039
+ __publicField(this, "recv", (message) => {
1040
+ switch (message.type) {
1041
+ case ShapeControlMessageType.SHAPE_CONTROL_CHILD_CONTROL_MESSAGE: {
1042
+ const control = this.controls.get(message.payload.key);
1043
+ if (control == null)
1044
+ return;
1045
+ const recv = control.recv;
1046
+ recv(message.payload.message);
1047
+ }
1048
+ }
1049
+ });
1050
+ this.descriptor = descriptor;
1051
+ this.send = send;
1052
+ this.controls = /* @__PURE__ */ new Map();
1053
+ this.setControls();
1054
+ }
1055
+ }
1056
+ function copyShapeData(definition, value, context) {
1057
+ if (value == null)
1058
+ return value;
1059
+ const newValue = {};
1060
+ for (const [key, itemDefinition] of Object.entries(definition.config.type)) {
1061
+ const prop = value[key];
1062
+ newValue[key] = copy(itemDefinition, prop, context);
1063
+ }
1064
+ return newValue;
846
1065
  }
847
1066
  const SlotControlType = "makeswift::controls::slot";
848
1067
  function Slot() {
@@ -1627,923 +1846,154 @@ function copy$1(descriptor, value, context) {
1627
1846
  return copy$6(value, context);
1628
1847
  case "Table":
1629
1848
  return copy$5(value, context);
1630
- case "Border":
1631
- return copy$4(value, context);
1632
- case "RichText":
1633
- return copy$3(value, context);
1634
- case "ElementID":
1635
- return copy$2(value, context);
1636
- default:
1637
- return value;
1638
- }
1639
- }
1640
- function copyElementReference(value, context) {
1641
- return context.replacementContext.globalElementIds.get(value) || value;
1642
- }
1643
- function copy(definition2, value, context) {
1644
- switch (definition2.type) {
1645
- case Types.Backgrounds:
1646
- case Types.Grid:
1647
- case Types.NavigationLinks:
1648
- case Types.Link:
1649
- case Types.Shadows:
1650
- case Types.Image:
1651
- case Types.Images:
1652
- case Types.ResponsiveColor:
1653
- case Types.TableFormFields:
1654
- case Types.Table:
1655
- case Types.Border:
1656
- case Types.RichText:
1657
- case Types.ElementID:
1658
- return copy$1(definition2, value, context);
1659
- case ColorControlType:
1660
- return copyColorData(value, context);
1661
- case ImageControlType:
1662
- return copyImageData(value, context);
1663
- case LinkControlType:
1664
- return copyLinkData(value, context);
1665
- case ShapeControlType:
1666
- return copyShapeData(definition2, value, context);
1667
- case ListControlType:
1668
- return copyListData(definition2, value, context);
1669
- case StyleControlType:
1670
- return copyStyleData(value, context);
1671
- case SlotControlType:
1672
- return copySlotData(value, context);
1673
- default:
1674
- return value;
1675
- }
1676
- }
1677
- function merge(definition2, a, b = a, context) {
1678
- switch (definition2.type) {
1679
- case SlotControlType:
1680
- return mergeSlotData(a, b, context);
1681
- default:
1682
- return b;
1683
- }
1684
- }
1685
- const SelectControlType = "makeswift::controls::select";
1686
- function Select(config) {
1687
- return { type: SelectControlType, config };
1688
- }
1689
- const isServer = typeof window === "undefined";
1690
- const useInsertionEffectSpecifier = "useInsertionEffect";
1691
- const useInsertionEffect = (_a = React__namespace[useInsertionEffectSpecifier]) != null ? _a : React__namespace.useLayoutEffect;
1692
- function useStyle(style) {
1693
- const serialized = serialize.serializeStyles([style], css.cache.registered);
1694
- utils.registerStyles(css.cache, serialized, false);
1695
- useInsertionEffect(() => {
1696
- utils.insertStyles(css.cache, serialized, false);
1697
- });
1698
- if (isServer)
1699
- utils.insertStyles(css.cache, serialized, false);
1700
- return `${css.cache.key}-${serialized.name}`;
1701
- }
1702
- const StyleV2ControlType = "makeswift::controls::style-v2";
1703
- const unstable_useStyleV2ClassName = useStyle;
1704
- function unstable_StyleV2(config) {
1705
- return { type: StyleV2ControlType, config };
1706
- }
1707
- const StyleV2ControlMessageType = {
1708
- CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model"
1709
- };
1710
- class StyleV2Control extends PropController {
1711
- constructor(send) {
1712
- super(send);
1713
- }
1714
- changeBoxModel(boxModel) {
1715
- this.send({ type: StyleV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
1716
- }
1717
- recv() {
1718
- }
1719
- }
1720
- const ObjectType = {
1721
- Value: "value",
1722
- Text: "text",
1723
- Inline: "inline",
1724
- Block: "block",
1725
- Document: "document",
1726
- Leaf: "leaf",
1727
- Selection: "selection",
1728
- Mark: "mark",
1729
- Range: "range",
1730
- Decoration: "decoration",
1731
- Annotation: "annotation",
1732
- Point: "point",
1733
- Operation: "operation"
1734
- };
1735
- const RootBlockType = {
1736
- Default: "default",
1737
- Text: "text-block",
1738
- Paragraph: "paragraph",
1739
- Heading1: "heading-one",
1740
- Heading2: "heading-two",
1741
- Heading3: "heading-three",
1742
- Heading4: "heading-four",
1743
- Heading5: "heading-five",
1744
- Heading6: "heading-six",
1745
- BlockQuote: "blockquote",
1746
- UnorderedList: "unordered-list",
1747
- OrderedList: "ordered-list"
1748
- };
1749
- const BlockType = __spreadProps(__spreadValues({}, RootBlockType), {
1750
- ListItem: "list-item",
1751
- ListItemChild: "list-item-child"
1752
- });
1753
- const InlineType = {
1754
- Code: "code",
1755
- SuperScript: "superscript",
1756
- SubScript: "subscript",
1757
- Link: "link"
1758
- };
1759
- const BlockTextAlignment = {
1760
- Left: "left",
1761
- Center: "center",
1762
- Right: "right",
1763
- Justify: "justify"
1764
- };
1765
- const ElementUtils = {
1766
- isRootBlock(node) {
1767
- return slate.Element.isElement(node) && (slate.Element.isElementType(node, BlockType.Paragraph) || slate.Element.isElementType(node, BlockType.Heading1) || slate.Element.isElementType(node, BlockType.Heading2) || slate.Element.isElementType(node, BlockType.Heading3) || slate.Element.isElementType(node, BlockType.Heading3) || slate.Element.isElementType(node, BlockType.Heading4) || slate.Element.isElementType(node, BlockType.Heading5) || slate.Element.isElementType(node, BlockType.Heading6) || slate.Element.isElementType(node, BlockType.BlockQuote) || slate.Element.isElementType(node, BlockType.UnorderedList) || slate.Element.isElementType(node, BlockType.OrderedList) || slate.Element.isElementType(node, BlockType.Text) || slate.Element.isElementType(node, BlockType.Default));
1768
- },
1769
- isBlock(node) {
1770
- return slate.Element.isElement(node) && (this.isRootBlock(node) || slate.Element.isElementType(node, BlockType.ListItem) || slate.Element.isElementType(node, BlockType.ListItemChild));
1771
- },
1772
- isInline(node) {
1773
- return slate.Element.isElementType(node, InlineType.Code) || slate.Element.isElementType(node, InlineType.Link) || slate.Element.isElementType(node, InlineType.SubScript) || slate.Element.isElementType(node, InlineType.SuperScript);
1774
- },
1775
- isConvertibleToListTextNode(node) {
1776
- return !this.isList(node) && !this.isListItem(node) && !this.isListItemChild(node);
1777
- },
1778
- isList(node) {
1779
- return slate.Element.isElementType(node, BlockType.OrderedList) || slate.Element.isElementType(node, BlockType.UnorderedList);
1780
- },
1781
- isListItem(node) {
1782
- return slate.Element.isElementType(node, BlockType.ListItem);
1783
- },
1784
- isListItemChild(node) {
1785
- return slate.Element.isElementType(node, BlockType.ListItemChild);
1786
- },
1787
- createText() {
1788
- return { text: "" };
1789
- },
1790
- createParagraph() {
1791
- return {
1792
- children: [this.createText()],
1793
- type: BlockType.Paragraph
1794
- };
1795
- },
1796
- createList(type = BlockType.UnorderedList) {
1797
- return { children: [this.createText()], type };
1798
- },
1799
- createListItem() {
1800
- return {
1801
- children: [this.createListItemChild()],
1802
- type: BlockType.ListItem
1803
- };
1804
- },
1805
- createListItemChild() {
1806
- return {
1807
- children: [this.createText()],
1808
- type: BlockType.ListItemChild
1809
- };
1810
- }
1811
- };
1812
- function unhangRange(editor, range) {
1813
- let [start, end] = slate.Range.edges(range);
1814
- if (start.offset !== 0 || end.offset !== 0 || slate.Range.isCollapsed(range)) {
1815
- return range;
1816
- }
1817
- const endBlock = slate.Editor.above(editor, {
1818
- at: end,
1819
- match: (n) => slate.Element.isElement(n) && slate.Editor.isBlock(editor, n)
1820
- });
1821
- const blockPath = endBlock ? endBlock[1] : [];
1822
- const first = slate.Editor.start(editor, start);
1823
- const before = { anchor: first, focus: end };
1824
- let skip = true;
1825
- for (const [node, path] of slate.Editor.nodes(editor, {
1826
- at: before,
1827
- match: slate.Text.isText,
1828
- reverse: true
1829
- })) {
1830
- if (skip) {
1831
- skip = false;
1832
- continue;
1833
- }
1834
- if (node.text !== "" || slate.Path.isBefore(path, blockPath)) {
1835
- end = { path, offset: node.text.length };
1836
- break;
1837
- }
1838
- }
1839
- return { anchor: start, focus: end };
1840
- }
1841
- function getSelection(editor) {
1842
- if (editor.selection)
1843
- return unhangRange(editor, editor.selection);
1844
- return {
1845
- anchor: slate.Editor.start(editor, []),
1846
- focus: slate.Editor.end(editor, [])
1847
- };
1848
- }
1849
- function getBlocksInSelection(editor) {
1850
- return Array.from(slate.Editor.nodes(editor, {
1851
- at: getSelection(editor),
1852
- match: (node) => ElementUtils.isRootBlock(node)
1853
- })).filter((entry) => ElementUtils.isRootBlock(entry[0]));
1854
- }
1855
- function getActiveBlockType(editor) {
1856
- var _a2;
1857
- const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type);
1858
- return rootBlocks.reduce((a, b) => a === b ? b : null, (_a2 = rootBlocks.at(0)) != null ? _a2 : null);
1859
- }
1860
- function setBlockKeyForDevice(editor, breakpoints, deviceId, key, value, options) {
1861
- var _a2, _b;
1862
- const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
1863
- if (!at)
1864
- return;
1865
- const rootElements = getBlocksInSelection(editor);
1866
- for (const [node, path] of rootElements) {
1867
- if (ElementUtils.isBlock(node)) {
1868
- const deviceValues = (_b = node[key]) != null ? _b : [];
1869
- const currentDeviceValue = state_breakpoints.findBreakpointOverride(breakpoints, deviceValues, deviceId, (v) => v);
1870
- const nextDeviceValue = __spreadProps(__spreadValues({}, currentDeviceValue), {
1871
- deviceId,
1872
- value
1873
- });
1874
- slate.Transforms.setNodes(editor, {
1875
- [key]: [...deviceValues.filter((v) => v.deviceId !== deviceId), nextDeviceValue]
1876
- }, { at: path });
1877
- }
1878
- }
1879
- }
1880
- function clearBlockKeyForDevice(editor, deviceId, key) {
1881
- var _a2;
1882
- const rootElements = getBlocksInSelection(editor);
1883
- for (const [node, path] of rootElements) {
1884
- if (ElementUtils.isBlock(node)) {
1885
- const deviceOverrides = (_a2 = node[key]) != null ? _a2 : [];
1886
- slate.Transforms.setNodes(editor, {
1887
- [key]: deviceOverrides.filter((v) => v.deviceId !== deviceId)
1888
- }, { at: path });
1889
- }
1890
- }
1891
- }
1892
- function wrapInline(editor, inline) {
1893
- slate.Transforms.wrapNodes(editor, inline, {
1894
- at: getSelection(editor),
1895
- split: true
1896
- });
1897
- }
1898
- function unwrapInline(editor, type) {
1899
- slate.Transforms.unwrapNodes(editor, {
1900
- match: (node) => ElementUtils.isInline(node) && node.type === type,
1901
- at: getSelection(editor)
1902
- });
1903
- }
1904
- const EditorUtils = {
1905
- getFirstAncestorList(editor, path) {
1906
- try {
1907
- const parentList = slate.Editor.above(editor, {
1908
- at: path,
1909
- match: (node) => ElementUtils.isList(node)
1910
- });
1911
- return parentList != null ? parentList : null;
1912
- } catch (e) {
1913
- return null;
1914
- }
1915
- },
1916
- getFirstAncestorListItem(editor, path) {
1917
- try {
1918
- const parentListItem = slate.Editor.above(editor, {
1919
- at: path,
1920
- match: (node) => ElementUtils.isListItem(node)
1921
- });
1922
- return parentListItem != null ? parentListItem : null;
1923
- } catch (e) {
1924
- return null;
1925
- }
1926
- }
1927
- };
1928
- const LIST_ITEM_CHILD_POSITION = 0;
1929
- const LIST_ITEM_LIST_POSITION = 1;
1930
- function filterForSubtreeRoots(entries) {
1931
- return entries.filter(([, nodePath]) => !slate.Path.ancestors(nodePath).some((ancestor) => {
1932
- return entries.some(([, path]) => slate.Path.equals(path, ancestor));
1933
- }));
1934
- }
1935
- function unwrapPath(editor, listItemPath) {
1936
- const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath);
1937
- const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath);
1938
- if (!parentList || listItemContainingParentList)
1939
- return;
1940
- slate.Editor.withoutNormalizing(editor, () => {
1941
- const listItemTextPath = [...listItemPath, LIST_ITEM_CHILD_POSITION];
1942
- const listItemNestedListPath = [...listItemPath, LIST_ITEM_LIST_POSITION];
1943
- if (slate.Node.has(editor, listItemNestedListPath)) {
1944
- slate.Transforms.setNodes(editor, { type: parentList[0].type }, { at: listItemNestedListPath });
1945
- slate.Transforms.liftNodes(editor, { at: listItemNestedListPath });
1946
- slate.Transforms.liftNodes(editor, { at: slate.Path.next(listItemPath) });
1947
- }
1948
- if (slate.Node.has(editor, listItemTextPath)) {
1949
- slate.Transforms.setNodes(editor, { type: BlockType.Paragraph }, {
1950
- at: listItemTextPath
1951
- });
1952
- slate.Transforms.liftNodes(editor, { at: listItemTextPath });
1953
- slate.Transforms.liftNodes(editor, { at: listItemPath });
1954
- }
1955
- });
1956
- }
1957
- function unwrapList(editor, options) {
1958
- var _a2;
1959
- const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
1960
- if (!at)
1961
- return;
1962
- const listItems = Array.from(slate.Editor.nodes(editor, {
1963
- at,
1964
- match: (node) => {
1965
- return slate.Element.isElement(node) && ElementUtils.isListItem(node);
1966
- }
1967
- }));
1968
- const subRoots = filterForSubtreeRoots(listItems);
1969
- const refs = subRoots.map(([_, path]) => slate.Editor.pathRef(editor, path));
1970
- refs.forEach((ref) => {
1971
- if (ref.current) {
1972
- unwrapPath(editor, ref.current);
1973
- }
1974
- ref.unref();
1975
- });
1976
- }
1977
- function wrapList(editor, options = { type: BlockType.UnorderedList }) {
1978
- var _a2;
1979
- const at = (_a2 = options.at) != null ? _a2 : editor.selection;
1980
- if (!at)
1981
- return;
1982
- const nonListEntries = Array.from(slate.Editor.nodes(editor, {
1983
- at,
1984
- match: (node) => {
1985
- return slate.Element.isElement(node) && ElementUtils.isConvertibleToListTextNode(node);
1986
- }
1987
- }));
1988
- const refs = nonListEntries.map(([_, path]) => slate.Editor.pathRef(editor, path));
1989
- refs.forEach((ref) => {
1990
- const path = ref.current;
1991
- if (path) {
1992
- slate.Editor.withoutNormalizing(editor, () => {
1993
- slate.Transforms.setNodes(editor, { type: BlockType.ListItemChild }, {
1994
- at: path
1995
- });
1996
- slate.Transforms.wrapNodes(editor, ElementUtils.createListItem(), {
1997
- match: (node) => ElementUtils.isListItemChild(node),
1998
- at: path
1999
- });
2000
- slate.Transforms.wrapNodes(editor, ElementUtils.createList(options.type), {
2001
- at: path
2002
- });
2003
- });
2004
- }
2005
- ref.unref();
2006
- });
2007
- }
2008
- const LocationUtils = {
2009
- getStartPath(location) {
2010
- if (slate.Range.isRange(location))
2011
- return slate.Range.start(location).path;
2012
- if (slate.Point.isPoint(location))
2013
- return location.path;
2014
- return location;
2015
- }
2016
- };
2017
- function getSelectedListItems(editor) {
2018
- var _a2, _b;
2019
- if (!editor.selection)
2020
- return [];
2021
- const start = LocationUtils.getStartPath(editor.selection);
2022
- const listItems = slate.Editor.nodes(editor, {
2023
- at: editor.selection,
2024
- match: (node) => ElementUtils.isListItem(node)
2025
- });
2026
- const firstAncestorPath = (_b = (_a2 = EditorUtils.getFirstAncestorListItem(editor, start)) == null ? void 0 : _a2[1]) != null ? _b : [];
2027
- return Array.from(listItems).filter((node) => slate.Path.isDescendant(start, node[1]) ? slate.Path.equals(node[1], firstAncestorPath) : !slate.Path.isAfter(start, node[1]));
2028
- }
2029
- function indentPath(editor, path) {
2030
- const parent = slate.Node.parent(editor, path);
2031
- if (!path || !slate.Path.hasPrevious(path) || !ElementUtils.isList(parent))
2032
- return;
2033
- const previosPath = slate.Path.previous(path);
2034
- const previousChildListPath = [...previosPath, LIST_ITEM_LIST_POSITION];
2035
- const previousHasChildList = slate.Node.has(editor, previousChildListPath);
2036
- slate.Editor.withoutNormalizing(editor, () => {
2037
- if (!previousHasChildList) {
2038
- slate.Transforms.insertNodes(editor, ElementUtils.createList(parent.type), {
2039
- at: previousChildListPath
2040
- });
2041
- }
2042
- const previousChildList = slate.Node.get(editor, previousChildListPath);
2043
- if (ElementUtils.isList(previousChildList)) {
2044
- const index = previousHasChildList ? previousChildList.children.length : 0;
2045
- slate.Transforms.moveNodes(editor, {
2046
- at: path,
2047
- to: [...previousChildListPath, index]
2048
- });
2049
- }
2050
- });
2051
- }
2052
- function indent(editor) {
2053
- if (!editor.selection)
2054
- return;
2055
- const listItems = getSelectedListItems(editor);
2056
- const subRoots = filterForSubtreeRoots(listItems);
2057
- const refs = subRoots.map(([_, path]) => slate.Editor.pathRef(editor, path));
2058
- refs.forEach((ref) => {
2059
- if (ref.current) {
2060
- indentPath(editor, ref.current);
2061
- }
2062
- ref.unref();
2063
- });
2064
- }
2065
- function dedentPath(editor, listItemPath) {
2066
- const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath);
2067
- const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath);
2068
- if (!parentList || !listItemContainingParentList)
2069
- return;
2070
- const [parentListNode, parentListPath] = parentList;
2071
- const [_, listItemContainingParentListPath] = listItemContainingParentList;
2072
- const listItemPosition = listItemPath[listItemPath.length - 1];
2073
- const previousSiblings = parentListNode.children.slice(0, listItemPosition);
2074
- const nextSiblings = parentListNode.children.slice(listItemPosition + 1);
2075
- slate.Editor.withoutNormalizing(editor, () => {
2076
- nextSiblings.forEach(() => {
2077
- const nextSiblingPath = [...parentListPath, listItemPosition + 1];
2078
- indentPath(editor, nextSiblingPath);
2079
- });
2080
- slate.Transforms.moveNodes(editor, {
2081
- at: listItemPath,
2082
- to: slate.Path.next(listItemContainingParentListPath)
2083
- });
2084
- if (previousSiblings.length === 0) {
2085
- slate.Transforms.removeNodes(editor, { at: parentListPath });
2086
- }
2087
- });
1849
+ case "Border":
1850
+ return copy$4(value, context);
1851
+ case "RichText":
1852
+ return copy$3(value, context);
1853
+ case "ElementID":
1854
+ return copy$2(value, context);
1855
+ default:
1856
+ return value;
1857
+ }
2088
1858
  }
2089
- function dedent(editor) {
2090
- if (!editor.selection)
2091
- return;
2092
- const listItems = getSelectedListItems(editor);
2093
- const subRoots = filterForSubtreeRoots(listItems);
2094
- const refs = subRoots.map(([_, path]) => slate.Editor.pathRef(editor, path));
2095
- refs.forEach((ref) => {
2096
- if (ref.current) {
2097
- dedentPath(editor, ref.current);
2098
- }
2099
- ref.unref();
2100
- });
1859
+ function copyElementReference(value, context) {
1860
+ return context.replacementContext.globalElementIds.get(value) || value;
2101
1861
  }
2102
- function toggleList(editor, options = { type: BlockType.UnorderedList }) {
2103
- var _a2;
2104
- const at = (_a2 = options.at) != null ? _a2 : editor.selection;
2105
- if (at == null)
2106
- return;
2107
- const start = LocationUtils.getStartPath(at);
2108
- const ancestorPath = slate.Path.ancestors(start).at(1);
2109
- if (!ancestorPath || !slate.Node.has(editor, ancestorPath))
2110
- return;
2111
- const ancestor = slate.Node.get(editor, ancestorPath);
2112
- if (!ElementUtils.isList(ancestor)) {
2113
- return wrapList(editor, { type: options.type, at });
2114
- }
2115
- if (ancestor.type === options.type) {
2116
- unwrapList(editor, { at });
2117
- } else {
2118
- slate.Transforms.setNodes(editor, { type: options.type }, { at: ancestorPath });
2119
- }
2120
- }
2121
- const BlockActions = {
2122
- setBlockKeyForDevice,
2123
- clearBlockKeyForDevice,
2124
- wrapInline,
2125
- unwrapInline
2126
- };
2127
- const ListActions = {
2128
- unwrapList,
2129
- wrapList,
2130
- indent,
2131
- dedent,
2132
- toggleList
2133
- };
2134
- function onKeyDown(e, editor) {
2135
- if (!editor.selection || Array.from(slate.Editor.nodes(editor, {
2136
- match: (node) => ElementUtils.isListItem(node)
2137
- })).length === 0)
2138
- return;
2139
- if (isHotkey__default["default"]("shift+tab", e)) {
2140
- e.preventDefault();
2141
- ListActions.dedent(editor);
2142
- }
2143
- if (isHotkey__default["default"]("tab", e)) {
2144
- e.preventDefault();
2145
- ListActions.indent(editor);
2146
- }
2147
- if (isHotkey__default["default"]("backspace", e)) {
2148
- if (!editor.selection)
2149
- return;
2150
- if (slate.Range.isExpanded(editor.selection))
2151
- return;
2152
- const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path);
2153
- if (editor.selection.anchor.offset === 0 && listItem) {
2154
- e.preventDefault();
2155
- const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1]);
2156
- const list = EditorUtils.getFirstAncestorList(editor, listItem[1]);
2157
- if (parentListItem) {
2158
- ListActions.dedent(editor);
2159
- } else if (list) {
2160
- ListActions.unwrapList(editor);
2161
- }
2162
- return;
2163
- }
2164
- }
2165
- if (isHotkey__default["default"]("enter", e)) {
2166
- e.preventDefault();
2167
- if (!editor.selection)
2168
- return;
2169
- if (slate.Range.isExpanded(editor.selection)) {
2170
- slate.Transforms.delete(editor);
2171
- return;
2172
- }
2173
- const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path);
2174
- if (editor.selection.anchor.offset === 0 && listItem && slate.Editor.string(editor, listItem[1]) === "") {
2175
- const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1]);
2176
- if (parentListItem) {
2177
- ListActions.dedent(editor);
2178
- } else {
2179
- ListActions.unwrapList(editor);
2180
- }
2181
- return;
2182
- }
2183
- slate.Transforms.splitNodes(editor, {
2184
- at: editor.selection,
2185
- always: true,
2186
- match: (node) => ElementUtils.isListItem(node)
2187
- });
2188
- }
2189
- if (isHotkey__default["default"]("shift+enter", e)) {
2190
- e.preventDefault();
2191
- editor.insertText("\n");
1862
+ function copy(definition, value, context) {
1863
+ switch (definition.type) {
1864
+ case Types.Backgrounds:
1865
+ case Types.Grid:
1866
+ case Types.NavigationLinks:
1867
+ case Types.Link:
1868
+ case Types.Shadows:
1869
+ case Types.Image:
1870
+ case Types.Images:
1871
+ case Types.ResponsiveColor:
1872
+ case Types.TableFormFields:
1873
+ case Types.Table:
1874
+ case Types.Border:
1875
+ case Types.RichText:
1876
+ case Types.ElementID:
1877
+ return copy$1(definition, value, context);
1878
+ case ColorControlType:
1879
+ return copyColorData(value, context);
1880
+ case ImageControlType:
1881
+ return copyImageData(value, context);
1882
+ case LinkControlType:
1883
+ return copyLinkData(value, context);
1884
+ case ShapeControlType:
1885
+ return copyShapeData(definition, value, context);
1886
+ case ListControlType:
1887
+ return copyListData(definition, value, context);
1888
+ case StyleControlType:
1889
+ return copyStyleData(value, context);
1890
+ case SlotControlType:
1891
+ return copySlotData(value, context);
1892
+ default:
1893
+ return value;
2192
1894
  }
2193
1895
  }
2194
- function withBlock(editor) {
2195
- const {
2196
- normalizeNode
2197
- } = editor;
2198
- editor.isInline = (entry) => {
2199
- return ElementUtils.isInline(entry);
2200
- };
2201
- editor.normalizeNode = (entry) => {
2202
- var _a2;
2203
- const [normalizationNode, normalizationPath] = entry;
2204
- if (ElementUtils.isBlock(normalizationNode) && ((_a2 = normalizationNode == null ? void 0 : normalizationNode.textAlign) == null ? void 0 : _a2.length) == 0) {
2205
- slate.Transforms.unsetNodes(editor, "textAlign", {
2206
- at: normalizationPath
2207
- });
2208
- return;
2209
- }
2210
- if (ElementUtils.isListItem(normalizationNode)) {
2211
- const pathToListItemText = [...normalizationPath, LIST_ITEM_CHILD_POSITION];
2212
- if (slate.Node.has(editor, pathToListItemText)) {
2213
- const nodeInListItemTextPosition = slate.Node.get(editor, pathToListItemText);
2214
- if (ElementUtils.isRootBlock(nodeInListItemTextPosition)) {
2215
- slate.Transforms.setNodes(editor, {
2216
- type: BlockType.ListItemChild
2217
- }, {
2218
- at: pathToListItemText
2219
- });
2220
- return;
2221
- }
2222
- } else {
2223
- slate.Transforms.insertNodes(editor, ElementUtils.createListItem(), {
2224
- at: pathToListItemText
2225
- });
2226
- return;
2227
- }
2228
- }
2229
- if (!slate.Text.isText(normalizationNode)) {
2230
- const mergeableChildren = Array.from(slate.Node.children(editor, normalizationPath)).map((child, index, children) => {
2231
- const potentialNodeToBeMerged = children.at(index + 1);
2232
- if (!potentialNodeToBeMerged || !ElementUtils.isList(potentialNodeToBeMerged[0]) || !ElementUtils.isList(child[0]) || potentialNodeToBeMerged[0].type !== child[0].type) {
2233
- return null;
2234
- }
2235
- return [slate.Editor.pathRef(editor, child[1]), slate.Editor.pathRef(editor, potentialNodeToBeMerged[1])];
2236
- }).filter((mergeableNodes) => Boolean(mergeableNodes));
2237
- if (mergeableChildren.length !== 0) {
2238
- mergeableChildren.reverse().forEach(([nodePathRef, nodeToBeMergedPathRef]) => {
2239
- const nodePath = nodePathRef.current;
2240
- const nodeToBeMergedPath = nodeToBeMergedPathRef.current;
2241
- if (nodePath == null || nodeToBeMergedPath == null)
2242
- return;
2243
- const nodeChildren = Array.from(slate.Node.children(editor, nodePath));
2244
- const childrenToBeMerged = Array.from(slate.Node.children(editor, nodeToBeMergedPath));
2245
- slate.Editor.withoutNormalizing(editor, () => {
2246
- childrenToBeMerged.reverse().forEach(([_, childPath]) => {
2247
- slate.Transforms.moveNodes(editor, {
2248
- at: childPath,
2249
- to: [...nodePath, nodeChildren.length]
2250
- });
2251
- });
2252
- slate.Transforms.removeNodes(editor, {
2253
- at: nodeToBeMergedPath
2254
- });
2255
- });
2256
- nodePathRef.unref();
2257
- nodeToBeMergedPathRef.unref();
2258
- });
2259
- return;
2260
- }
2261
- }
2262
- normalizeNode(entry);
2263
- };
2264
- return editor;
2265
- }
2266
- const definition = Select({
2267
- label: "Block",
2268
- labelOrientation: "horizontal",
2269
- options: [{
2270
- value: BlockType.Paragraph,
2271
- label: "Paragraph"
2272
- }, {
2273
- value: BlockType.Heading1,
2274
- label: "Heading 1"
2275
- }, {
2276
- value: BlockType.Heading2,
2277
- label: "Heading 2"
2278
- }, {
2279
- value: BlockType.Heading3,
2280
- label: "Heading 3"
2281
- }, {
2282
- value: BlockType.Heading4,
2283
- label: "Heading 4"
2284
- }, {
2285
- value: BlockType.Heading5,
2286
- label: "Heading 5"
2287
- }, {
2288
- value: BlockType.Heading6,
2289
- label: "Heading 6"
2290
- }, {
2291
- value: BlockType.UnorderedList,
2292
- label: "Bulleted list"
2293
- }, {
2294
- value: BlockType.OrderedList,
2295
- label: "Numbered list"
2296
- }, {
2297
- value: BlockType.BlockQuote,
2298
- label: "Quote"
2299
- }],
2300
- defaultValue: BlockType.Paragraph
2301
- });
2302
- function BlockPlugin() {
2303
- return createRichTextV2Plugin({
2304
- withPlugin: withBlock,
2305
- onKeyDown,
2306
- control: {
2307
- definition,
2308
- onChange: (editor, value) => {
2309
- const activeBlockType = getActiveBlockType(editor);
2310
- if (value === BlockType.UnorderedList || value === BlockType.OrderedList) {
2311
- ListActions.toggleList(editor, {
2312
- type: value,
2313
- at: getSelection(editor)
2314
- });
2315
- } else if (activeBlockType === value) {
2316
- slate.Transforms.setNodes(editor, {
2317
- type: BlockType.Default
2318
- }, {
2319
- at: getSelection(editor)
2320
- });
2321
- } else {
2322
- ListActions.unwrapList(editor, {
2323
- at: getSelection(editor)
2324
- });
2325
- slate.Transforms.setNodes(editor, {
2326
- type: value != null ? value : BlockType.Default
2327
- }, {
2328
- at: getSelection(editor)
2329
- });
2330
- }
2331
- },
2332
- getValue: (editor) => {
2333
- const activeBlock = getActiveBlockType(editor);
2334
- if (activeBlock === RootBlockType.Text || activeBlock === RootBlockType.Default)
2335
- return void 0;
2336
- return activeBlock;
2337
- }
2338
- },
2339
- renderElement: (renderElement) => (props) => /* @__PURE__ */ jsxRuntime.jsx(BlockPluginComponent, __spreadProps(__spreadValues({}, props), {
2340
- renderElement
2341
- }))
2342
- });
2343
- }
2344
- function BlockPluginComponent({
2345
- element,
2346
- attributes,
2347
- children,
2348
- renderElement
2349
- }) {
2350
- const blockStyles = [useStyle({
2351
- margin: 0
2352
- }), element.className];
2353
- const quoteStyles = useStyle({
2354
- padding: "0.5em 10px",
2355
- fontSize: "1.25em",
2356
- fontWeight: "300",
2357
- borderLeft: "5px solid rgba(0, 0, 0, 0.1)"
2358
- });
2359
- switch (element.type) {
2360
- case BlockType.Text:
2361
- return /* @__PURE__ */ jsxRuntime.jsx("span", __spreadProps(__spreadValues({}, attributes), {
2362
- className: css.cx(...blockStyles),
2363
- children
2364
- }));
2365
- case BlockType.Paragraph:
2366
- return /* @__PURE__ */ jsxRuntime.jsx("p", __spreadProps(__spreadValues({}, attributes), {
2367
- className: css.cx(...blockStyles),
2368
- children
2369
- }));
2370
- case BlockType.Heading1:
2371
- return /* @__PURE__ */ jsxRuntime.jsx("h1", __spreadProps(__spreadValues({}, attributes), {
2372
- className: css.cx(...blockStyles),
2373
- children
2374
- }));
2375
- case BlockType.Heading2:
2376
- return /* @__PURE__ */ jsxRuntime.jsx("h2", __spreadProps(__spreadValues({}, attributes), {
2377
- className: css.cx(...blockStyles),
2378
- children
2379
- }));
2380
- case BlockType.Heading3:
2381
- return /* @__PURE__ */ jsxRuntime.jsx("h3", __spreadProps(__spreadValues({}, attributes), {
2382
- className: css.cx(...blockStyles),
2383
- children
2384
- }));
2385
- case BlockType.Heading4:
2386
- return /* @__PURE__ */ jsxRuntime.jsx("h4", __spreadProps(__spreadValues({}, attributes), {
2387
- className: css.cx(...blockStyles),
2388
- children
2389
- }));
2390
- case BlockType.Heading5:
2391
- return /* @__PURE__ */ jsxRuntime.jsx("h5", __spreadProps(__spreadValues({}, attributes), {
2392
- className: css.cx(...blockStyles),
2393
- children
2394
- }));
2395
- case BlockType.Heading6:
2396
- return /* @__PURE__ */ jsxRuntime.jsx("h6", __spreadProps(__spreadValues({}, attributes), {
2397
- className: css.cx(...blockStyles),
2398
- children
2399
- }));
2400
- case BlockType.BlockQuote:
2401
- return /* @__PURE__ */ jsxRuntime.jsx("blockquote", __spreadProps(__spreadValues({}, attributes), {
2402
- className: css.cx(...blockStyles, quoteStyles),
2403
- children
2404
- }));
2405
- case BlockType.OrderedList:
2406
- return /* @__PURE__ */ jsxRuntime.jsx("ol", __spreadProps(__spreadValues({}, attributes), {
2407
- className: css.cx(...blockStyles),
2408
- style: {
2409
- listStylePosition: "inside"
2410
- },
2411
- children
2412
- }));
2413
- case BlockType.UnorderedList:
2414
- return /* @__PURE__ */ jsxRuntime.jsx("ul", __spreadProps(__spreadValues({}, attributes), {
2415
- className: css.cx(...blockStyles),
2416
- style: {
2417
- listStylePosition: "inside"
2418
- },
2419
- children
2420
- }));
2421
- case BlockType.ListItem:
2422
- return /* @__PURE__ */ jsxRuntime.jsx("li", __spreadProps(__spreadValues({}, attributes), {
2423
- className: css.cx(...blockStyles),
2424
- children
2425
- }));
2426
- case BlockType.ListItemChild:
2427
- return /* @__PURE__ */ jsxRuntime.jsx("span", __spreadProps(__spreadValues({}, attributes), {
2428
- className: css.cx(...blockStyles),
2429
- children
2430
- }));
2431
- case BlockType.Default:
2432
- return /* @__PURE__ */ jsxRuntime.jsx("p", __spreadProps(__spreadValues({}, attributes), {
2433
- className: css.cx(...blockStyles),
2434
- children
2435
- }));
1896
+ function merge(definition, a, b = a, context) {
1897
+ switch (definition.type) {
1898
+ case SlotControlType:
1899
+ return mergeSlotData(a, b, context);
2436
1900
  default:
2437
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
2438
- children: renderElement({
2439
- element,
2440
- attributes,
2441
- children
2442
- })
2443
- });
1901
+ return b;
2444
1902
  }
2445
1903
  }
2446
- const RichTextV2ControlType = "makeswift::controls::rich-text-v2";
2447
- const RichTextV2Mode = {
2448
- Inline: "makeswift::controls::rich-text-v2::mode::inline",
2449
- Block: "makeswift::controls::rich-text-v2::mode::block"
2450
- };
2451
- function createRichTextV2Plugin({
2452
- control,
2453
- withPlugin,
2454
- onKeyDown: onKeyDown2,
2455
- renderElement
2456
- }) {
2457
- return { control, withPlugin, onKeyDown: onKeyDown2, renderElement };
1904
+ const isServer = typeof window === "undefined";
1905
+ const useInsertionEffectSpecifier = "useInsertionEffect";
1906
+ const useInsertionEffect = (_a = React__namespace[useInsertionEffectSpecifier]) != null ? _a : React__namespace.useLayoutEffect;
1907
+ function useStyle(style) {
1908
+ const serialized = serialize.serializeStyles([style], css.cache.registered);
1909
+ utils.registerStyles(css.cache, serialized, false);
1910
+ useInsertionEffect(() => {
1911
+ utils.insertStyles(css.cache, serialized, false);
1912
+ });
1913
+ if (isServer)
1914
+ utils.insertStyles(css.cache, serialized, false);
1915
+ return `${css.cache.key}-${serialized.name}`;
2458
1916
  }
2459
- function unstable_RichTextV2(config = {}) {
2460
- return { type: RichTextV2ControlType, config };
1917
+ const StyleV2ControlType = "makeswift::controls::style-v2";
1918
+ const unstable_useStyleV2ClassName = useStyle;
1919
+ function unstable_StyleV2(config) {
1920
+ return { type: StyleV2ControlType, config };
2461
1921
  }
2462
- const RichTextV2ControlMessageType = {
2463
- RESET_VALUE: "RESET_VALUE",
2464
- FOCUS: "FOCUS",
2465
- RUN_PLUGIN_CONTROL_ACTION: "RUN_PLUGIN_CONTROL_ACTION",
2466
- SET_DEFAULT_VALUE: "SET_DEFAULT_VALUE",
2467
- SET_PLUGIN_CONTROL_VALUE: "SET_PLUGIN_CONTROL_VALUE",
2468
- ON_CHANGE: "ON_CHANGE",
2469
- SELECT: "SELECT",
2470
- SWITCH_TO_BUILD_MODE: "SWITCH_TO_BUILD_MODE",
2471
- CHANGE_BOX_MODEL: "CHANGE_BOX_MODEL"
1922
+ const StyleV2ControlMessageType = {
1923
+ CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model",
1924
+ STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE: "makeswift::controls::style-v2::message::child-control-message"
2472
1925
  };
2473
- class RichTextV2Control extends PropController {
1926
+ class StyleV2Control extends PropController {
2474
1927
  constructor(send, descriptor) {
2475
1928
  super(send);
2476
- __publicField(this, "editor", null);
2477
- __publicField(this, "defaultValue", null);
2478
- __publicField(this, "descriptor");
2479
- __publicField(this, "recv", (message) => {
2480
- var _a2, _b, _c;
2481
- if (!this.editor)
2482
- return;
2483
- switch (message.type) {
2484
- case RichTextV2ControlMessageType.FOCUS: {
2485
- this.editor.focusAndSelectAll();
2486
- break;
2487
- }
2488
- case RichTextV2ControlMessageType.RESET_VALUE: {
2489
- if (this.defaultValue) {
2490
- this.editor.selection = null;
2491
- this.editor.children = this.defaultValue;
2492
- this.editor.onChange();
2493
- }
2494
- break;
2495
- }
2496
- case RichTextV2ControlMessageType.RUN_PLUGIN_CONTROL_ACTION: {
2497
- (_c = (_b = (_a2 = this.descriptor.config.plugins) == null ? void 0 : _a2.at(message.pluginIndex)) == null ? void 0 : _b.control) == null ? void 0 : _c.onChange(this.editor, message.value);
2498
- break;
2499
- }
2500
- }
2501
- });
2502
- this.descriptor = descriptor;
2503
- this.send = send;
2504
- }
2505
- setEditor(editor) {
2506
- var _a2, _b, _c;
2507
- this.editor = editor;
2508
- this.send({
2509
- type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
2510
- value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
2511
- var _a3;
2512
- return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
2513
- })) != null ? _c : []
2514
- });
2515
- }
2516
- setDefaultValue(defaultValue) {
2517
- this.defaultValue = defaultValue;
2518
- this.send({ type: RichTextV2ControlMessageType.SET_DEFAULT_VALUE, value: defaultValue });
2519
- }
2520
- select() {
2521
- this.send({ type: RichTextV2ControlMessageType.SELECT });
2522
- }
2523
- switchToBuildMode() {
2524
- this.send({ type: RichTextV2ControlMessageType.SWITCH_TO_BUILD_MODE });
2525
- }
2526
- onChange(value) {
2527
- var _a2, _b, _c;
2528
- const editor = this.editor;
2529
- if (editor == null)
2530
- return;
2531
- this.send({
2532
- type: RichTextV2ControlMessageType.ON_CHANGE,
2533
- value
2534
- });
2535
- this.send({
2536
- type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
2537
- value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
2538
- var _a3;
2539
- return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
2540
- })) != null ? _c : []
1929
+ __publicField(this, "control");
1930
+ this.control = createPropController(descriptor.config.type, (message) => {
1931
+ this.send({
1932
+ type: StyleV2ControlMessageType.STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE,
1933
+ payload: { message }
1934
+ });
2541
1935
  });
2542
1936
  }
2543
1937
  changeBoxModel(boxModel) {
2544
- this.send({ type: RichTextV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
1938
+ this.send({ type: StyleV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
1939
+ }
1940
+ recv(message) {
1941
+ switch (message.type) {
1942
+ case StyleV2ControlMessageType.STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE: {
1943
+ const control = this.control;
1944
+ if (control == null)
1945
+ return;
1946
+ const recv = control.recv;
1947
+ recv(message.payload.message);
1948
+ }
1949
+ }
2545
1950
  }
2546
1951
  }
1952
+ const ObjectType = {
1953
+ Value: "value",
1954
+ Text: "text",
1955
+ Inline: "inline",
1956
+ Block: "block",
1957
+ Document: "document",
1958
+ Leaf: "leaf",
1959
+ Selection: "selection",
1960
+ Mark: "mark",
1961
+ Range: "range",
1962
+ Decoration: "decoration",
1963
+ Annotation: "annotation",
1964
+ Point: "point",
1965
+ Operation: "operation"
1966
+ };
1967
+ const RootBlockType = {
1968
+ Default: "default",
1969
+ Text: "text-block",
1970
+ Paragraph: "paragraph",
1971
+ Heading1: "heading-one",
1972
+ Heading2: "heading-two",
1973
+ Heading3: "heading-three",
1974
+ Heading4: "heading-four",
1975
+ Heading5: "heading-five",
1976
+ Heading6: "heading-six",
1977
+ BlockQuote: "blockquote",
1978
+ UnorderedList: "unordered-list",
1979
+ OrderedList: "ordered-list"
1980
+ };
1981
+ const BlockType = __spreadProps(__spreadValues({}, RootBlockType), {
1982
+ ListItem: "list-item",
1983
+ ListItemChild: "list-item-child"
1984
+ });
1985
+ const InlineType = {
1986
+ Code: "code",
1987
+ SuperScript: "superscript",
1988
+ SubScript: "subscript",
1989
+ Link: "link"
1990
+ };
1991
+ const BlockTextAlignment = {
1992
+ Left: "left",
1993
+ Center: "center",
1994
+ Right: "right",
1995
+ Justify: "justify"
1996
+ };
2547
1997
  function isText(node) {
2548
1998
  if (typeof node === "object" && "text" in node)
2549
1999
  return true;
@@ -2705,330 +2155,209 @@ function toNodeDTO(node) {
2705
2155
  }
2706
2156
  }
2707
2157
  function toSelectionDTO(selection) {
2708
- if (selection == null)
2709
- return void 0;
2710
- return {
2711
- isFocused: false,
2712
- marks: void 0,
2713
- object: "selection",
2714
- anchor: {
2715
- offset: selection.anchor.offset,
2716
- path: selection.anchor.path,
2717
- object: "point"
2718
- },
2719
- focus: {
2720
- offset: selection.focus.offset,
2721
- path: selection.focus.path,
2722
- object: "point"
2723
- }
2724
- };
2725
- }
2726
- function richTextDAOToDTO(children, selection) {
2727
- return {
2728
- document: {
2729
- data: void 0,
2730
- nodes: children.flatMap(toNodeDTO),
2731
- object: "document"
2732
- },
2733
- object: "value",
2734
- selection: toSelectionDTO(selection),
2735
- annotations: void 0,
2736
- data: void 0
2737
- };
2738
- }
2739
- const RichTextControlType = "makeswift::controls::rich-text";
2740
- function RichText$1() {
2741
- return { type: RichTextControlType };
2742
- }
2743
- const RichTextControlMessageType = {
2744
- CHANGE_BUILDER_EDIT_MODE: "CHANGE_BUILDER_EDIT_MODE",
2745
- INITIALIZE_EDITOR: "INITIALIZE_EDITOR",
2746
- CHANGE_EDITOR_VALUE: "CHANGE_EDITOR_VALUE",
2747
- FOCUS: "FOCUS",
2748
- BLUR: "BLUR",
2749
- UNDO: "UNDO",
2750
- REDO: "REDO",
2751
- CHANGE_BOX_MODEL: "CHANGE_BOX_MODEL"
2752
- };
2753
- class RichTextControl extends PropController {
2754
- constructor() {
2755
- super(...arguments);
2756
- __publicField(this, "editor", null);
2757
- __publicField(this, "recv", (message) => {
2758
- if (!this.editor)
2759
- return;
2760
- switch (message.type) {
2761
- case RichTextControlMessageType.CHANGE_BUILDER_EDIT_MODE: {
2762
- switch (message.editMode) {
2763
- case BuilderEditMode.BUILD:
2764
- case BuilderEditMode.INTERACT:
2765
- this.editor.deselectAndBlur();
2766
- }
2767
- break;
2768
- }
2769
- case RichTextControlMessageType.FOCUS: {
2770
- this.editor.focusAndSelectAll();
2771
- break;
2772
- }
2773
- }
2774
- });
2775
- }
2776
- setSlateEditor(editor) {
2777
- this.editor = editor;
2778
- this.send({
2779
- type: RichTextControlMessageType.INITIALIZE_EDITOR,
2780
- value: richTextDAOToDTO(editor.children, editor.selection)
2781
- });
2782
- const _onChange = editor.onChange;
2783
- this.editor.onChange = (options) => {
2784
- _onChange(options);
2785
- if ((options == null ? void 0 : options.operation) != null) {
2786
- this.send({
2787
- type: RichTextControlMessageType.CHANGE_EDITOR_VALUE,
2788
- value: richTextDAOToDTO(editor.children, editor.selection)
2789
- });
2790
- }
2791
- };
2792
- }
2793
- focus() {
2794
- this.send({ type: RichTextControlMessageType.FOCUS });
2795
- }
2796
- blur() {
2797
- this.send({ type: RichTextControlMessageType.BLUR });
2798
- }
2799
- undo() {
2800
- this.send({ type: RichTextControlMessageType.UNDO });
2801
- }
2802
- redo() {
2803
- this.send({ type: RichTextControlMessageType.REDO });
2804
- }
2805
- changeBoxModel(boxModel) {
2806
- this.send({ type: RichTextControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
2807
- }
2808
- }
2809
- const Types = {
2810
- Backgrounds: "Backgrounds",
2811
- Border: "Border",
2812
- BorderRadius: "BorderRadius",
2813
- Checkbox: "Checkbox",
2814
- Date: "Date",
2815
- ElementID: "ElementID",
2816
- Font: "Font",
2817
- GapX: "GapX",
2818
- GapY: "GapY",
2819
- Grid: "Grid",
2820
- Image: "Image",
2821
- Images: "Images",
2822
- Link: "Link",
2823
- List: "List",
2824
- Margin: "Margin",
2825
- NavigationLinks: "NavigationLinks",
2826
- Number: "Number",
2827
- Padding: "Padding",
2828
- ResponsiveColor: "ResponsiveColor",
2829
- ResponsiveIconRadioGroup: "ResponsiveIconRadioGroup",
2830
- ResponsiveLength: "ResponsiveLength",
2831
- ResponsiveNumber: "ResponsiveNumber",
2832
- ResponsiveOpacity: "ResponsiveOpacity",
2833
- ResponsiveSelect: "ResponsiveSelect",
2834
- RichText: "RichText",
2835
- Shadows: "Shadows",
2836
- Shape: "Shape",
2837
- SocialLinks: "SocialLinks",
2838
- Table: "Table",
2839
- TableFormFields: "TableFormFields",
2840
- Typeahead: "Typeahead",
2841
- TextArea: "TextArea",
2842
- TextInput: "TextInput",
2843
- TextStyle: "TextStyle",
2844
- Video: "Video",
2845
- Width: "Width",
2846
- Style: StyleControlType
2847
- };
2848
- function Backgrounds(options = {}) {
2849
- return { type: Types.Backgrounds, options };
2850
- }
2851
- const BorderPropControllerFormat = {
2852
- ClassName: "makeswift::prop-controllers::border::format::class-name",
2853
- ResponsiveValue: "makeswift::prop-controllers:border::format::responsive-value"
2854
- };
2855
- function Border(options = {}) {
2856
- return { type: Types.Border, options };
2857
- }
2858
- Border.Format = BorderPropControllerFormat;
2859
- const BorderRadiusPropControllerFormat = {
2860
- ClassName: "makeswift::prop-controllers::border-radius::format::class-name",
2861
- ResponsiveValue: "makeswift::prop-controllers::border-radius::format::responsive-value"
2862
- };
2863
- function BorderRadius(options = {}) {
2864
- return { type: Types.BorderRadius, options };
2865
- }
2866
- BorderRadius.Format = BorderRadiusPropControllerFormat;
2867
- function Checkbox(options) {
2868
- return { type: Types.Checkbox, options };
2869
- }
2870
- function Date(options = {}) {
2871
- return { type: Types.Date, options };
2872
- }
2873
- function ElementID(options = {}) {
2874
- return { type: Types.ElementID, options };
2875
- }
2876
- function Font(options = {}) {
2877
- return { type: Types.Font, options };
2878
- }
2879
- function GapX(options = {}) {
2880
- return { type: Types.GapX, options };
2881
- }
2882
- function GapY(options = {}) {
2883
- return { type: Types.GapY, options };
2884
- }
2885
- function Grid(options = {}) {
2886
- return { type: Types.Grid, options };
2887
- }
2888
- function Image(options = {}) {
2889
- return { type: Types.Image, options };
2890
- }
2891
- function Images(options = {}) {
2892
- return { type: Types.Images, options };
2893
- }
2894
- function Link(options = {}) {
2895
- return { type: Types.Link, options };
2896
- }
2897
- function List(options) {
2898
- return { type: Types.List, options };
2899
- }
2900
- const MarginPropControllerFormat = {
2901
- ClassName: "makeswift::prop-controllers::margin::format::class-name",
2902
- ResponsiveValue: "makeswift::prop-controllers::margin::format::responsive-value"
2903
- };
2904
- function Margin(options = {}) {
2905
- return { type: Types.Margin, options };
2906
- }
2907
- Margin.Format = MarginPropControllerFormat;
2908
- function NavigationLinks(options = {}) {
2909
- return { type: Types.NavigationLinks, options };
2910
- }
2911
- function Number(options = {}) {
2912
- return { type: Types.Number, options };
2913
- }
2914
- const PaddingPropControllerFormat = {
2915
- ClassName: "makeswift::prop-controllers::padding::format::class-name",
2916
- ResponsiveValue: "makeswift::prop-controllers::padding::format::responsive-value"
2917
- };
2918
- function Padding(options = {}) {
2919
- return { type: Types.Padding, options };
2920
- }
2921
- Padding.Format = PaddingPropControllerFormat;
2922
- function ResponsiveColor(options = {}) {
2923
- return { type: Types.ResponsiveColor, options };
2924
- }
2925
- function ResponsiveIconRadioGroup(options) {
2926
- return { type: Types.ResponsiveIconRadioGroup, options };
2927
- }
2928
- function ResponsiveLength(options = {}) {
2929
- return { type: Types.ResponsiveLength, options };
2930
- }
2931
- function ResponsiveNumber(options = {}) {
2932
- return { type: Types.ResponsiveNumber, options };
2933
- }
2934
- function ResponsiveOpacity(options = {}) {
2935
- return { type: Types.ResponsiveOpacity, options };
2936
- }
2937
- function ResponsiveSelect(options) {
2938
- return { type: Types.ResponsiveSelect, options };
2939
- }
2940
- function RichText(options = {}) {
2941
- return { type: Types.RichText, options };
2942
- }
2943
- const ShadowsPropControllerFormat = {
2944
- ClassName: "makeswift::prop-controllers::shadows::format::class-name",
2945
- ResponsiveValue: "makeswift::prop-controllers::shadows::format::responsive-value"
2946
- };
2947
- function Shadows(options = {}) {
2948
- return { type: Types.Shadows, options };
2949
- }
2950
- Shadows.Format = ShadowsPropControllerFormat;
2951
- function Shape(options) {
2952
- return { type: Types.Shape, options };
2953
- }
2954
- function SocialLinks(options = {}) {
2955
- return { type: Types.SocialLinks, options };
2956
- }
2957
- function Table(options = {}) {
2958
- return { type: Types.Table, options };
2959
- }
2960
- function TableFormFields(options = {}) {
2961
- return { type: Types.TableFormFields, options };
2158
+ if (selection == null)
2159
+ return void 0;
2160
+ return {
2161
+ isFocused: false,
2162
+ marks: void 0,
2163
+ object: "selection",
2164
+ anchor: {
2165
+ offset: selection.anchor.offset,
2166
+ path: selection.anchor.path,
2167
+ object: "point"
2168
+ },
2169
+ focus: {
2170
+ offset: selection.focus.offset,
2171
+ path: selection.focus.path,
2172
+ object: "point"
2173
+ }
2174
+ };
2962
2175
  }
2963
- function Typeahead(options) {
2964
- return { type: Types.Typeahead, options };
2176
+ function richTextDAOToDTO(children, selection) {
2177
+ return {
2178
+ document: {
2179
+ data: void 0,
2180
+ nodes: children.flatMap(toNodeDTO),
2181
+ object: "document"
2182
+ },
2183
+ object: "value",
2184
+ selection: toSelectionDTO(selection),
2185
+ annotations: void 0,
2186
+ data: void 0
2187
+ };
2965
2188
  }
2966
- function TextArea(options = {}) {
2967
- return { type: Types.TextArea, options };
2189
+ const RichTextControlType = "makeswift::controls::rich-text";
2190
+ function RichText() {
2191
+ return { type: RichTextControlType };
2968
2192
  }
2969
- function TextInput(options = {}) {
2970
- return { type: Types.TextInput, options };
2193
+ const RichTextControlMessageType = {
2194
+ CHANGE_BUILDER_EDIT_MODE: "CHANGE_BUILDER_EDIT_MODE",
2195
+ INITIALIZE_EDITOR: "INITIALIZE_EDITOR",
2196
+ CHANGE_EDITOR_VALUE: "CHANGE_EDITOR_VALUE",
2197
+ FOCUS: "FOCUS",
2198
+ BLUR: "BLUR",
2199
+ UNDO: "UNDO",
2200
+ REDO: "REDO",
2201
+ CHANGE_BOX_MODEL: "CHANGE_BOX_MODEL"
2202
+ };
2203
+ class RichTextControl extends PropController {
2204
+ constructor() {
2205
+ super(...arguments);
2206
+ __publicField(this, "editor", null);
2207
+ __publicField(this, "recv", (message) => {
2208
+ if (!this.editor)
2209
+ return;
2210
+ switch (message.type) {
2211
+ case RichTextControlMessageType.CHANGE_BUILDER_EDIT_MODE: {
2212
+ switch (message.editMode) {
2213
+ case BuilderEditMode.BUILD:
2214
+ case BuilderEditMode.INTERACT:
2215
+ this.editor.deselectAndBlur();
2216
+ }
2217
+ break;
2218
+ }
2219
+ case RichTextControlMessageType.FOCUS: {
2220
+ this.editor.focusAndSelectAll();
2221
+ break;
2222
+ }
2223
+ }
2224
+ });
2225
+ }
2226
+ setSlateEditor(editor) {
2227
+ this.editor = editor;
2228
+ this.send({
2229
+ type: RichTextControlMessageType.INITIALIZE_EDITOR,
2230
+ value: richTextDAOToDTO(editor.children, editor.selection)
2231
+ });
2232
+ const _onChange = editor.onChange;
2233
+ this.editor.onChange = (options) => {
2234
+ _onChange(options);
2235
+ if ((options == null ? void 0 : options.operation) != null) {
2236
+ this.send({
2237
+ type: RichTextControlMessageType.CHANGE_EDITOR_VALUE,
2238
+ value: richTextDAOToDTO(editor.children, editor.selection)
2239
+ });
2240
+ }
2241
+ };
2242
+ }
2243
+ focus() {
2244
+ this.send({ type: RichTextControlMessageType.FOCUS });
2245
+ }
2246
+ blur() {
2247
+ this.send({ type: RichTextControlMessageType.BLUR });
2248
+ }
2249
+ undo() {
2250
+ this.send({ type: RichTextControlMessageType.UNDO });
2251
+ }
2252
+ redo() {
2253
+ this.send({ type: RichTextControlMessageType.REDO });
2254
+ }
2255
+ changeBoxModel(boxModel) {
2256
+ this.send({ type: RichTextControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
2257
+ }
2971
2258
  }
2972
- function TextStyle(options = {}) {
2973
- return { type: Types.TextStyle, options };
2259
+ const RichTextV2ControlType = "makeswift::controls::rich-text-v2";
2260
+ const RichTextV2Mode = {
2261
+ Inline: "makeswift::controls::rich-text-v2::mode::inline",
2262
+ Block: "makeswift::controls::rich-text-v2::mode::block"
2263
+ };
2264
+ function createRichTextV2Plugin({
2265
+ control,
2266
+ withPlugin,
2267
+ onKeyDown,
2268
+ renderElement,
2269
+ renderLeaf
2270
+ }) {
2271
+ return { control, withPlugin, onKeyDown, renderElement, renderLeaf };
2974
2272
  }
2975
- function Video(options = {}) {
2976
- return { type: Types.Video, options };
2273
+ function unstable_RichTextV2(config = {}) {
2274
+ return { type: RichTextV2ControlType, config };
2977
2275
  }
2978
- const WidthPropControllerFormat = {
2979
- ClassName: "makeswift::prop-controllers::width::format::class-name",
2980
- ResponsiveValue: "makeswift::prop-controllers::width::format::responsive-value"
2276
+ const RichTextV2ControlMessageType = {
2277
+ RESET_VALUE: "RESET_VALUE",
2278
+ FOCUS: "FOCUS",
2279
+ RUN_PLUGIN_CONTROL_ACTION: "RUN_PLUGIN_CONTROL_ACTION",
2280
+ SET_DEFAULT_VALUE: "SET_DEFAULT_VALUE",
2281
+ SET_PLUGIN_CONTROL_VALUE: "SET_PLUGIN_CONTROL_VALUE",
2282
+ ON_CHANGE: "ON_CHANGE",
2283
+ SELECT: "SELECT",
2284
+ SWITCH_TO_BUILD_MODE: "SWITCH_TO_BUILD_MODE",
2285
+ CHANGE_BOX_MODEL: "CHANGE_BOX_MODEL"
2981
2286
  };
2982
- function Width(options = {}) {
2983
- return { type: Types.Width, options };
2287
+ class RichTextV2Control extends PropController {
2288
+ constructor(send, descriptor) {
2289
+ super(send);
2290
+ __publicField(this, "editor", null);
2291
+ __publicField(this, "defaultValue", null);
2292
+ __publicField(this, "descriptor");
2293
+ __publicField(this, "recv", (message) => {
2294
+ var _a2, _b, _c;
2295
+ if (!this.editor)
2296
+ return;
2297
+ switch (message.type) {
2298
+ case RichTextV2ControlMessageType.FOCUS: {
2299
+ this.editor.focusAndSelectAll();
2300
+ break;
2301
+ }
2302
+ case RichTextV2ControlMessageType.RESET_VALUE: {
2303
+ if (this.defaultValue) {
2304
+ this.editor.selection = null;
2305
+ this.editor.children = this.defaultValue;
2306
+ this.editor.onChange();
2307
+ }
2308
+ break;
2309
+ }
2310
+ case RichTextV2ControlMessageType.RUN_PLUGIN_CONTROL_ACTION: {
2311
+ (_c = (_b = (_a2 = this.descriptor.config.plugins) == null ? void 0 : _a2.at(message.pluginIndex)) == null ? void 0 : _b.control) == null ? void 0 : _c.onChange(this.editor, message.value);
2312
+ break;
2313
+ }
2314
+ }
2315
+ });
2316
+ this.descriptor = descriptor;
2317
+ this.send = send;
2318
+ }
2319
+ setEditor(editor) {
2320
+ var _a2, _b, _c;
2321
+ this.editor = editor;
2322
+ this.send({
2323
+ type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
2324
+ value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
2325
+ var _a3;
2326
+ return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
2327
+ })) != null ? _c : []
2328
+ });
2329
+ }
2330
+ setDefaultValue(defaultValue) {
2331
+ this.defaultValue = defaultValue;
2332
+ this.send({ type: RichTextV2ControlMessageType.SET_DEFAULT_VALUE, value: defaultValue });
2333
+ }
2334
+ select() {
2335
+ this.send({ type: RichTextV2ControlMessageType.SELECT });
2336
+ }
2337
+ switchToBuildMode() {
2338
+ this.send({ type: RichTextV2ControlMessageType.SWITCH_TO_BUILD_MODE });
2339
+ }
2340
+ onChange(value) {
2341
+ var _a2, _b, _c;
2342
+ const editor = this.editor;
2343
+ if (editor == null)
2344
+ return;
2345
+ this.send({
2346
+ type: RichTextV2ControlMessageType.ON_CHANGE,
2347
+ value
2348
+ });
2349
+ this.send({
2350
+ type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
2351
+ value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
2352
+ var _a3;
2353
+ return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
2354
+ })) != null ? _c : []
2355
+ });
2356
+ }
2357
+ changeBoxModel(boxModel) {
2358
+ this.send({ type: RichTextV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
2359
+ }
2984
2360
  }
2985
- Width.Format = WidthPropControllerFormat;
2986
- var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2987
- __proto__: null,
2988
- Types,
2989
- Backgrounds,
2990
- BorderPropControllerFormat,
2991
- Border,
2992
- BorderRadiusPropControllerFormat,
2993
- BorderRadius,
2994
- Checkbox,
2995
- Date,
2996
- ElementID,
2997
- Font,
2998
- GapX,
2999
- GapY,
3000
- Grid,
3001
- Image,
3002
- Images,
3003
- Link,
3004
- List,
3005
- MarginPropControllerFormat,
3006
- Margin,
3007
- NavigationLinks,
3008
- Number,
3009
- PaddingPropControllerFormat,
3010
- Padding,
3011
- ResponsiveColor,
3012
- ResponsiveIconRadioGroup,
3013
- ResponsiveLength,
3014
- ResponsiveNumber,
3015
- ResponsiveOpacity,
3016
- ResponsiveSelect,
3017
- RichText,
3018
- ShadowsPropControllerFormat,
3019
- Shadows,
3020
- Shape,
3021
- SocialLinks,
3022
- Table,
3023
- TableFormFields,
3024
- Typeahead,
3025
- TextArea,
3026
- TextInput,
3027
- TextStyle,
3028
- Video,
3029
- WidthPropControllerFormat,
3030
- Width
3031
- }, Symbol.toStringTag, { value: "Module" }));
3032
2361
  function isNonNullable(value) {
3033
2362
  return value != null;
3034
2363
  }
@@ -3157,6 +2486,39 @@ function getElementSwatchIds(descriptor, prop) {
3157
2486
  const value = prop;
3158
2487
  return (value == null ? void 0 : value.swatchId) == null ? [] : [value.swatchId];
3159
2488
  }
2489
+ case StyleV2ControlType: {
2490
+ const value = prop;
2491
+ return value.flatMap((value2) => getElementSwatchIds(descriptor.config.type, value2.value));
2492
+ }
2493
+ case RichTextV2ControlType: {
2494
+ let getDescendantSwatchIds = function(descendant) {
2495
+ if (slate.Element.isElement(descendant)) {
2496
+ return [
2497
+ ...getSlateElementSwatchIds(descendant),
2498
+ ...descendant.children.flatMap((d) => getDescendantSwatchIds(d))
2499
+ ];
2500
+ }
2501
+ if (slate.Text.isText(descendant)) {
2502
+ return getTextSwatchIds(descendant);
2503
+ }
2504
+ return [];
2505
+ }, getSlateElementSwatchIds = function(descendant) {
2506
+ var _a3;
2507
+ return (_a3 = plugins == null ? void 0 : plugins.flatMap((plugin) => {
2508
+ var _a4;
2509
+ return ((_a4 = plugin.control) == null ? void 0 : _a4.definition) && plugin.control.getElementValue ? getElementSwatchIds(plugin.control.definition, plugin.control.getElementValue(descendant)) : [];
2510
+ })) != null ? _a3 : [];
2511
+ }, getTextSwatchIds = function(text) {
2512
+ var _a3;
2513
+ return (_a3 = plugins == null ? void 0 : plugins.flatMap((plugin) => {
2514
+ var _a4;
2515
+ return ((_a4 = plugin.control) == null ? void 0 : _a4.definition) && plugin.control.getLeafValue ? getElementSwatchIds(plugin.control.definition, plugin.control.getLeafValue(text)) : [];
2516
+ })) != null ? _a3 : [];
2517
+ };
2518
+ const descendants = prop;
2519
+ const plugins = descriptor.config.plugins;
2520
+ return descendants.flatMap((d) => getDescendantSwatchIds(d));
2521
+ }
3160
2522
  default:
3161
2523
  return [];
3162
2524
  }
@@ -3510,8 +2872,6 @@ function configureStore({
3510
2872
  }), redux.applyMiddleware(thunk__default["default"]));
3511
2873
  }
3512
2874
  exports.Backgrounds = Backgrounds;
3513
- exports.BlockActions = BlockActions;
3514
- exports.BlockPlugin = BlockPlugin;
3515
2875
  exports.BlockTextAlignment = BlockTextAlignment;
3516
2876
  exports.BlockType = BlockType;
3517
2877
  exports.Border = Border;
@@ -3525,22 +2885,20 @@ exports.ColorControlType = ColorControlType;
3525
2885
  exports.ComponentIcon = ComponentIcon;
3526
2886
  exports.Date = Date;
3527
2887
  exports.ElementID = ElementID;
3528
- exports.ElementUtils = ElementUtils;
3529
2888
  exports.Font = Font;
3530
2889
  exports.GapX = GapX;
3531
2890
  exports.GapY = GapY;
3532
2891
  exports.Grid = Grid;
3533
- exports.Image = Image;
3534
- exports.Image$1 = Image$1;
2892
+ exports.Image = Image$1;
2893
+ exports.Image$1 = Image;
3535
2894
  exports.ImageControlType = ImageControlType;
3536
2895
  exports.ImageControlValueFormat = ImageControlValueFormat;
3537
2896
  exports.Images = Images;
3538
2897
  exports.InlineType = InlineType;
3539
- exports.Link = Link;
3540
- exports.Link$1 = Link$1;
2898
+ exports.Link = Link$1;
2899
+ exports.Link$1 = Link;
3541
2900
  exports.LinkControlType = LinkControlType;
3542
- exports.List = List$1;
3543
- exports.ListActions = ListActions;
2901
+ exports.List = List;
3544
2902
  exports.ListControl = ListControl;
3545
2903
  exports.ListControlMessageType = ListControlMessageType;
3546
2904
  exports.ListControlType = ListControlType;
@@ -3557,8 +2915,8 @@ exports.ResponsiveLength = ResponsiveLength;
3557
2915
  exports.ResponsiveNumber = ResponsiveNumber;
3558
2916
  exports.ResponsiveOpacity = ResponsiveOpacity;
3559
2917
  exports.ResponsiveSelect = ResponsiveSelect;
3560
- exports.RichText = RichText;
3561
- exports.RichText$1 = RichText$1;
2918
+ exports.RichText = RichText$1;
2919
+ exports.RichText$1 = RichText;
3562
2920
  exports.RichTextControl = RichTextControl;
3563
2921
  exports.RichTextControlMessageType = RichTextControlMessageType;
3564
2922
  exports.RichTextControlType = RichTextControlType;
@@ -3568,11 +2926,9 @@ exports.RichTextV2ControlMessageType = RichTextV2ControlMessageType;
3568
2926
  exports.RichTextV2ControlType = RichTextV2ControlType;
3569
2927
  exports.RichTextV2Mode = RichTextV2Mode;
3570
2928
  exports.RootBlockType = RootBlockType;
3571
- exports.Select = Select;
3572
- exports.SelectControlType = SelectControlType;
3573
2929
  exports.Shadows = Shadows;
3574
2930
  exports.ShadowsPropControllerFormat = ShadowsPropControllerFormat;
3575
- exports.Shape = Shape$1;
2931
+ exports.Shape = Shape;
3576
2932
  exports.ShapeControl = ShapeControl;
3577
2933
  exports.ShapeControlMessageType = ShapeControlMessageType;
3578
2934
  exports.ShapeControlType = ShapeControlType;
@@ -3616,7 +2972,6 @@ exports.createRichTextV2Plugin = createRichTextV2Plugin;
3616
2972
  exports.descriptors = descriptors;
3617
2973
  exports.getBackgroundsFileIds = getBackgroundsFileIds;
3618
2974
  exports.getBackgroundsSwatchIds = getBackgroundsSwatchIds;
3619
- exports.getBlocksInSelection = getBlocksInSelection;
3620
2975
  exports.getBorderSwatchIds = getBorderSwatchIds;
3621
2976
  exports.getBoxShadowsSwatchIds = getBoxShadowsSwatchIds;
3622
2977
  exports.getBreakpoints = getBreakpoints;
@@ -3653,7 +3008,6 @@ exports.isNonNullable = isNonNullable;
3653
3008
  exports.isPropControllersHandle = isPropControllersHandle;
3654
3009
  exports.merge = merge;
3655
3010
  exports.mergeSlotData = mergeSlotData;
3656
- exports.onKeyDown = onKeyDown;
3657
3011
  exports.reducer = reducer$8;
3658
3012
  exports.reducer$1 = reducer$7;
3659
3013
  exports.reducer$2 = reducer$9;
@@ -3671,5 +3025,4 @@ exports.unstable_RichTextV2 = unstable_RichTextV2;
3671
3025
  exports.unstable_StyleV2 = unstable_StyleV2;
3672
3026
  exports.unstable_useStyleV2ClassName = unstable_useStyleV2ClassName;
3673
3027
  exports.useStyle = useStyle;
3674
- exports.withBlock = withBlock;
3675
3028
  //# sourceMappingURL=react-page.cjs.js.map