@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
@@ -26,15 +26,12 @@ var _a;
26
26
  import { combineReducers, createStore, applyMiddleware } from "redux";
27
27
  import thunk from "redux-thunk";
28
28
  import { A as ActionTypes } from "./actions.es.js";
29
- import { findBreakpointOverride, reducer as reducer$a, getInitialState as getInitialState$9 } from "./state/breakpoints.es.js";
29
+ import { reducer as reducer$a, getInitialState as getInitialState$9 } from "./state/breakpoints.es.js";
30
30
  import * as React from "react";
31
- import { cache, cx } from "@emotion/css";
31
+ import { cache } from "@emotion/css";
32
32
  import { serializeStyles } from "@emotion/serialize";
33
33
  import { registerStyles, insertStyles } from "@emotion/utils";
34
- import { Element, Range, Editor, Text, Path, Transforms, Node, Point } from "slate";
35
- import isHotkey from "is-hotkey";
36
- import "slate-react";
37
- import { jsx, Fragment } from "react/jsx-runtime";
34
+ import { Element, Text } from "slate";
38
35
  const ComponentIcon = {
39
36
  Billing: "billing",
40
37
  Bolt: "bolt",
@@ -299,92 +296,199 @@ function copyColorData(value, context) {
299
296
  swatchId: (_a2 = context.replacementContext.swatchIds.get(value.swatchId)) != null ? _a2 : value.swatchId
300
297
  });
301
298
  }
302
- const ImageControlType = "makeswift::controls::image";
303
- const ImageControlValueFormat = {
304
- URL: "makeswift::controls::image::format::url",
305
- WithDimensions: "makeswift::controls::image::format::with-dimensions"
306
- };
307
- function Image$1(config = {}) {
308
- return { type: ImageControlType, config };
299
+ class PropController {
300
+ constructor(send) {
301
+ __publicField(this, "send");
302
+ this.send = send;
303
+ }
309
304
  }
310
- Image$1.Format = ImageControlValueFormat;
311
- function copyImageData(value, context) {
305
+ const StyleControlType = "makeswift::controls::style";
306
+ const StyleControlProperty = {
307
+ Width: "makeswift::controls::style::property::width",
308
+ Margin: "makeswift::controls::style::property::margin",
309
+ Padding: "makeswift::controls::style::property::padding",
310
+ Border: "makeswift::controls::style::property::border",
311
+ BorderRadius: "makeswift::controls::style::property::border-radius",
312
+ TextStyle: "makeswift::controls::style::property::text-style"
313
+ };
314
+ const StyleControlDefaultProperties = [
315
+ StyleControlProperty.Width,
316
+ StyleControlProperty.Margin
317
+ ];
318
+ const AllStyleControlProperties = [
319
+ StyleControlProperty.Width,
320
+ StyleControlProperty.Margin,
321
+ StyleControlProperty.Padding,
322
+ StyleControlProperty.Border,
323
+ StyleControlProperty.BorderRadius,
324
+ StyleControlProperty.TextStyle
325
+ ];
326
+ function Style(params) {
312
327
  var _a2;
313
- if (value == null)
314
- return value;
315
- return (_a2 = context.replacementContext.fileIds.get(value)) != null ? _a2 : value;
316
- }
317
- if (import_meta.vitest) {
318
- const { describe, test, expect } = import_meta.vitest;
319
- describe.concurrent("image copy", () => {
320
- test("image is replaced by a one in replacement context", () => {
321
- const data = "file-id";
322
- const expected = "testing";
323
- const replacementContext = {
324
- elementHtmlIds: /* @__PURE__ */ new Set(),
325
- elementKeys: /* @__PURE__ */ new Map(),
326
- swatchIds: /* @__PURE__ */ new Map(),
327
- fileIds: /* @__PURE__ */ new Map([["file-id", "testing"]]),
328
- typographyIds: /* @__PURE__ */ new Map(),
329
- tableIds: /* @__PURE__ */ new Map(),
330
- tableColumnIds: /* @__PURE__ */ new Map(),
331
- pageIds: /* @__PURE__ */ new Map(),
332
- globalElementIds: /* @__PURE__ */ new Map(),
333
- globalElementData: /* @__PURE__ */ new Map()
334
- };
335
- const result = copyImageData(data, {
336
- replacementContext,
337
- copyElement: (node) => node
338
- });
339
- expect(result).toMatchObject(expected);
340
- });
341
- });
328
+ return {
329
+ type: StyleControlType,
330
+ config: { properties: (_a2 = params == null ? void 0 : params.properties) != null ? _a2 : StyleControlDefaultProperties }
331
+ };
342
332
  }
343
- const LinkControlType = "makeswift::controls::link";
344
- function Link$1(config = {}) {
345
- return { type: LinkControlType, config };
333
+ Style.Default = StyleControlDefaultProperties;
334
+ Style.All = AllStyleControlProperties;
335
+ Style.Width = StyleControlProperty.Width;
336
+ Style.Margin = StyleControlProperty.Margin;
337
+ Style.Padding = StyleControlProperty.Padding;
338
+ Style.Border = StyleControlProperty.Border;
339
+ Style.BorderRadius = StyleControlProperty.BorderRadius;
340
+ Style.TextStyle = StyleControlProperty.TextStyle;
341
+ const StyleControlMessageType = {
342
+ CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model"
343
+ };
344
+ class StyleControl extends PropController {
345
+ constructor(send) {
346
+ super(send);
347
+ }
348
+ changeBoxModel(boxModel) {
349
+ this.send({ type: StyleControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
350
+ }
351
+ recv() {
352
+ }
346
353
  }
347
- function copyLinkData(value, context) {
348
- var _a2;
354
+ function copyStyleData(value, context) {
349
355
  if (value == null)
350
356
  return value;
351
- if (value.type === "OPEN_PAGE") {
352
- const pageId = value.payload.pageId;
353
- if (pageId != null) {
354
- return __spreadProps(__spreadValues({}, value), {
355
- payload: __spreadProps(__spreadValues({}, value.payload), {
356
- pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : pageId
357
- })
357
+ function copyResponsiveBorder(responsiveBorder) {
358
+ if (responsiveBorder == null)
359
+ return void 0;
360
+ return responsiveBorder.map((deviceBorder) => __spreadProps(__spreadValues({}, deviceBorder), {
361
+ value: copyBorder(deviceBorder.value)
362
+ }));
363
+ }
364
+ function copyBorder(border) {
365
+ function copyBorderSide(side) {
366
+ if (side == null)
367
+ return null;
368
+ if (side.color == null)
369
+ return side;
370
+ return __spreadProps(__spreadValues({}, side), {
371
+ color: copyColorData(side.color, context)
358
372
  });
359
373
  }
374
+ return {
375
+ borderTop: copyBorderSide(border.borderTop),
376
+ borderBottom: copyBorderSide(border.borderBottom),
377
+ borderRight: copyBorderSide(border.borderRight),
378
+ borderLeft: copyBorderSide(border.borderLeft)
379
+ };
360
380
  }
361
- return value;
381
+ return __spreadProps(__spreadValues({}, value), { border: copyResponsiveBorder(value.border) });
362
382
  }
363
383
  if (import_meta.vitest) {
364
384
  const { describe, test, expect } = import_meta.vitest;
365
- describe.concurrent("link", () => {
366
- test("page id is replaced by one in replacement context", () => {
367
- const data = {
368
- type: "OPEN_PAGE",
369
- payload: {
370
- pageId: "UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=",
371
- openInNewTab: false
372
- }
385
+ describe.concurrent("style copy", () => {
386
+ test("colors are replaced", () => {
387
+ const value = {
388
+ width: [
389
+ {
390
+ value: {
391
+ unit: "px",
392
+ value: 100
393
+ },
394
+ deviceId: "desktop"
395
+ }
396
+ ],
397
+ border: [
398
+ {
399
+ value: {
400
+ borderTop: {
401
+ color: {
402
+ alpha: 1,
403
+ swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
404
+ },
405
+ style: "solid",
406
+ width: 9
407
+ },
408
+ borderLeft: {
409
+ color: {
410
+ alpha: 1,
411
+ swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
412
+ },
413
+ style: "solid",
414
+ width: 9
415
+ },
416
+ borderRight: {
417
+ color: {
418
+ alpha: 1,
419
+ swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
420
+ },
421
+ style: "solid",
422
+ width: 9
423
+ },
424
+ borderBottom: {
425
+ color: {
426
+ alpha: 1,
427
+ swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
428
+ },
429
+ style: "solid",
430
+ width: 9
431
+ }
432
+ },
433
+ deviceId: "desktop"
434
+ }
435
+ ],
436
+ textStyle: [
437
+ {
438
+ value: {
439
+ fontSize: {
440
+ unit: "px",
441
+ value: 46
442
+ },
443
+ fontStyle: [],
444
+ fontFamily: "Oswald",
445
+ fontWeight: 400,
446
+ letterSpacing: 5.2,
447
+ textTransform: []
448
+ },
449
+ deviceId: "desktop"
450
+ }
451
+ ],
452
+ borderRadius: [
453
+ {
454
+ value: {
455
+ borderTopLeftRadius: {
456
+ unit: "px",
457
+ value: 4
458
+ },
459
+ borderTopRightRadius: {
460
+ unit: "px",
461
+ value: 4
462
+ },
463
+ borderBottomLeftRadius: {
464
+ unit: "px",
465
+ value: 4
466
+ },
467
+ borderBottomRightRadius: {
468
+ unit: "px",
469
+ value: 4
470
+ }
471
+ },
472
+ deviceId: "desktop"
473
+ }
474
+ ]
373
475
  };
374
- const expected = JSON.parse(JSON.stringify(data).replace("UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=", "testing"));
476
+ const expected = JSON.parse(JSON.stringify(value).replaceAll("U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"));
375
477
  const replacementContext = {
376
478
  elementHtmlIds: /* @__PURE__ */ new Set(),
377
479
  elementKeys: /* @__PURE__ */ new Map(),
378
- swatchIds: /* @__PURE__ */ new Map(),
379
- pageIds: /* @__PURE__ */ new Map([["UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=", "testing"]]),
480
+ swatchIds: /* @__PURE__ */ new Map([
481
+ ["U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"]
482
+ ]),
483
+ fileIds: /* @__PURE__ */ new Map(),
380
484
  typographyIds: /* @__PURE__ */ new Map(),
381
485
  tableIds: /* @__PURE__ */ new Map(),
382
486
  tableColumnIds: /* @__PURE__ */ new Map(),
383
- fileIds: /* @__PURE__ */ new Map(),
487
+ pageIds: /* @__PURE__ */ new Map(),
384
488
  globalElementIds: /* @__PURE__ */ new Map(),
385
489
  globalElementData: /* @__PURE__ */ new Map()
386
490
  };
387
- const result = copyLinkData(data, {
491
+ const result = copyStyleData(value, {
388
492
  replacementContext,
389
493
  copyElement: (node) => node
390
494
  });
@@ -392,30 +496,340 @@ if (import_meta.vitest) {
392
496
  });
393
497
  });
394
498
  }
395
- class PropController {
396
- constructor(send) {
397
- __publicField(this, "send");
398
- this.send = send;
399
- }
400
- }
401
- const RichTextPropControllerMessageType = {
402
- CHANGE_BUILDER_EDIT_MODE: "CHANGE_BUILDER_EDIT_MODE",
403
- INITIALIZE_EDITOR: "INITIALIZE_EDITOR",
404
- CHANGE_EDITOR_VALUE: "CHANGE_EDITOR_VALUE",
405
- FOCUS: "FOCUS",
406
- BLUR: "BLUR",
407
- UNDO: "UNDO",
408
- REDO: "REDO",
409
- CHANGE_BOX_MODEL: "CHANGE_BOX_MODEL"
410
- };
411
- class DefaultPropController extends PropController {
412
- constructor() {
413
- super(...arguments);
414
- __publicField(this, "recv", (_message) => {
415
- });
416
- }
417
- }
418
- class RichTextPropController extends PropController {
499
+ const Types = {
500
+ Backgrounds: "Backgrounds",
501
+ Border: "Border",
502
+ BorderRadius: "BorderRadius",
503
+ Checkbox: "Checkbox",
504
+ Date: "Date",
505
+ ElementID: "ElementID",
506
+ Font: "Font",
507
+ GapX: "GapX",
508
+ GapY: "GapY",
509
+ Grid: "Grid",
510
+ Image: "Image",
511
+ Images: "Images",
512
+ Link: "Link",
513
+ List: "List",
514
+ Margin: "Margin",
515
+ NavigationLinks: "NavigationLinks",
516
+ Number: "Number",
517
+ Padding: "Padding",
518
+ ResponsiveColor: "ResponsiveColor",
519
+ ResponsiveIconRadioGroup: "ResponsiveIconRadioGroup",
520
+ ResponsiveLength: "ResponsiveLength",
521
+ ResponsiveNumber: "ResponsiveNumber",
522
+ ResponsiveOpacity: "ResponsiveOpacity",
523
+ ResponsiveSelect: "ResponsiveSelect",
524
+ RichText: "RichText",
525
+ Shadows: "Shadows",
526
+ Shape: "Shape",
527
+ SocialLinks: "SocialLinks",
528
+ Table: "Table",
529
+ TableFormFields: "TableFormFields",
530
+ Typeahead: "Typeahead",
531
+ TextArea: "TextArea",
532
+ TextInput: "TextInput",
533
+ TextStyle: "TextStyle",
534
+ Video: "Video",
535
+ Width: "Width",
536
+ Style: StyleControlType
537
+ };
538
+ function Backgrounds(options = {}) {
539
+ return { type: Types.Backgrounds, options };
540
+ }
541
+ const BorderPropControllerFormat = {
542
+ ClassName: "makeswift::prop-controllers::border::format::class-name",
543
+ ResponsiveValue: "makeswift::prop-controllers:border::format::responsive-value"
544
+ };
545
+ function Border(options = {}) {
546
+ return { type: Types.Border, options };
547
+ }
548
+ Border.Format = BorderPropControllerFormat;
549
+ const BorderRadiusPropControllerFormat = {
550
+ ClassName: "makeswift::prop-controllers::border-radius::format::class-name",
551
+ ResponsiveValue: "makeswift::prop-controllers::border-radius::format::responsive-value"
552
+ };
553
+ function BorderRadius(options = {}) {
554
+ return { type: Types.BorderRadius, options };
555
+ }
556
+ BorderRadius.Format = BorderRadiusPropControllerFormat;
557
+ function Checkbox(options) {
558
+ return { type: Types.Checkbox, options };
559
+ }
560
+ function Date(options = {}) {
561
+ return { type: Types.Date, options };
562
+ }
563
+ function ElementID(options = {}) {
564
+ return { type: Types.ElementID, options };
565
+ }
566
+ function Font(options = {}) {
567
+ return { type: Types.Font, options };
568
+ }
569
+ function GapX(options = {}) {
570
+ return { type: Types.GapX, options };
571
+ }
572
+ function GapY(options = {}) {
573
+ return { type: Types.GapY, options };
574
+ }
575
+ function Grid(options = {}) {
576
+ return { type: Types.Grid, options };
577
+ }
578
+ function Image$1(options = {}) {
579
+ return { type: Types.Image, options };
580
+ }
581
+ function Images(options = {}) {
582
+ return { type: Types.Images, options };
583
+ }
584
+ function Link$1(options = {}) {
585
+ return { type: Types.Link, options };
586
+ }
587
+ function List$1(options) {
588
+ return { type: Types.List, options };
589
+ }
590
+ const MarginPropControllerFormat = {
591
+ ClassName: "makeswift::prop-controllers::margin::format::class-name",
592
+ ResponsiveValue: "makeswift::prop-controllers::margin::format::responsive-value"
593
+ };
594
+ function Margin(options = {}) {
595
+ return { type: Types.Margin, options };
596
+ }
597
+ Margin.Format = MarginPropControllerFormat;
598
+ function NavigationLinks(options = {}) {
599
+ return { type: Types.NavigationLinks, options };
600
+ }
601
+ function Number(options = {}) {
602
+ return { type: Types.Number, options };
603
+ }
604
+ const PaddingPropControllerFormat = {
605
+ ClassName: "makeswift::prop-controllers::padding::format::class-name",
606
+ ResponsiveValue: "makeswift::prop-controllers::padding::format::responsive-value"
607
+ };
608
+ function Padding(options = {}) {
609
+ return { type: Types.Padding, options };
610
+ }
611
+ Padding.Format = PaddingPropControllerFormat;
612
+ function ResponsiveColor(options = {}) {
613
+ return { type: Types.ResponsiveColor, options };
614
+ }
615
+ function ResponsiveIconRadioGroup(options) {
616
+ return { type: Types.ResponsiveIconRadioGroup, options };
617
+ }
618
+ function ResponsiveLength(options = {}) {
619
+ return { type: Types.ResponsiveLength, options };
620
+ }
621
+ function ResponsiveNumber(options = {}) {
622
+ return { type: Types.ResponsiveNumber, options };
623
+ }
624
+ function ResponsiveOpacity(options = {}) {
625
+ return { type: Types.ResponsiveOpacity, options };
626
+ }
627
+ function ResponsiveSelect(options) {
628
+ return { type: Types.ResponsiveSelect, options };
629
+ }
630
+ function RichText$1(options = {}) {
631
+ return { type: Types.RichText, options };
632
+ }
633
+ const ShadowsPropControllerFormat = {
634
+ ClassName: "makeswift::prop-controllers::shadows::format::class-name",
635
+ ResponsiveValue: "makeswift::prop-controllers::shadows::format::responsive-value"
636
+ };
637
+ function Shadows(options = {}) {
638
+ return { type: Types.Shadows, options };
639
+ }
640
+ Shadows.Format = ShadowsPropControllerFormat;
641
+ function Shape$1(options) {
642
+ return { type: Types.Shape, options };
643
+ }
644
+ function SocialLinks(options = {}) {
645
+ return { type: Types.SocialLinks, options };
646
+ }
647
+ function Table(options = {}) {
648
+ return { type: Types.Table, options };
649
+ }
650
+ function TableFormFields(options = {}) {
651
+ return { type: Types.TableFormFields, options };
652
+ }
653
+ function Typeahead(options) {
654
+ return { type: Types.Typeahead, options };
655
+ }
656
+ function TextArea(options = {}) {
657
+ return { type: Types.TextArea, options };
658
+ }
659
+ function TextInput(options = {}) {
660
+ return { type: Types.TextInput, options };
661
+ }
662
+ function TextStyle(options = {}) {
663
+ return { type: Types.TextStyle, options };
664
+ }
665
+ function Video(options = {}) {
666
+ return { type: Types.Video, options };
667
+ }
668
+ const WidthPropControllerFormat = {
669
+ ClassName: "makeswift::prop-controllers::width::format::class-name",
670
+ ResponsiveValue: "makeswift::prop-controllers::width::format::responsive-value"
671
+ };
672
+ function Width(options = {}) {
673
+ return { type: Types.Width, options };
674
+ }
675
+ Width.Format = WidthPropControllerFormat;
676
+ var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
677
+ __proto__: null,
678
+ Types,
679
+ Backgrounds,
680
+ BorderPropControllerFormat,
681
+ Border,
682
+ BorderRadiusPropControllerFormat,
683
+ BorderRadius,
684
+ Checkbox,
685
+ Date,
686
+ ElementID,
687
+ Font,
688
+ GapX,
689
+ GapY,
690
+ Grid,
691
+ Image: Image$1,
692
+ Images,
693
+ Link: Link$1,
694
+ List: List$1,
695
+ MarginPropControllerFormat,
696
+ Margin,
697
+ NavigationLinks,
698
+ Number,
699
+ PaddingPropControllerFormat,
700
+ Padding,
701
+ ResponsiveColor,
702
+ ResponsiveIconRadioGroup,
703
+ ResponsiveLength,
704
+ ResponsiveNumber,
705
+ ResponsiveOpacity,
706
+ ResponsiveSelect,
707
+ RichText: RichText$1,
708
+ ShadowsPropControllerFormat,
709
+ Shadows,
710
+ Shape: Shape$1,
711
+ SocialLinks,
712
+ Table,
713
+ TableFormFields,
714
+ Typeahead,
715
+ TextArea,
716
+ TextInput,
717
+ TextStyle,
718
+ Video,
719
+ WidthPropControllerFormat,
720
+ Width
721
+ }, Symbol.toStringTag, { value: "Module" }));
722
+ const ImageControlType = "makeswift::controls::image";
723
+ const ImageControlValueFormat = {
724
+ URL: "makeswift::controls::image::format::url",
725
+ WithDimensions: "makeswift::controls::image::format::with-dimensions"
726
+ };
727
+ function Image(config = {}) {
728
+ return { type: ImageControlType, config };
729
+ }
730
+ Image.Format = ImageControlValueFormat;
731
+ function copyImageData(value, context) {
732
+ var _a2;
733
+ if (value == null)
734
+ return value;
735
+ return (_a2 = context.replacementContext.fileIds.get(value)) != null ? _a2 : value;
736
+ }
737
+ if (import_meta.vitest) {
738
+ const { describe, test, expect } = import_meta.vitest;
739
+ describe.concurrent("image copy", () => {
740
+ test("image is replaced by a one in replacement context", () => {
741
+ const data = "file-id";
742
+ const expected = "testing";
743
+ const replacementContext = {
744
+ elementHtmlIds: /* @__PURE__ */ new Set(),
745
+ elementKeys: /* @__PURE__ */ new Map(),
746
+ swatchIds: /* @__PURE__ */ new Map(),
747
+ fileIds: /* @__PURE__ */ new Map([["file-id", "testing"]]),
748
+ typographyIds: /* @__PURE__ */ new Map(),
749
+ tableIds: /* @__PURE__ */ new Map(),
750
+ tableColumnIds: /* @__PURE__ */ new Map(),
751
+ pageIds: /* @__PURE__ */ new Map(),
752
+ globalElementIds: /* @__PURE__ */ new Map(),
753
+ globalElementData: /* @__PURE__ */ new Map()
754
+ };
755
+ const result = copyImageData(data, {
756
+ replacementContext,
757
+ copyElement: (node) => node
758
+ });
759
+ expect(result).toMatchObject(expected);
760
+ });
761
+ });
762
+ }
763
+ const LinkControlType = "makeswift::controls::link";
764
+ function Link(config = {}) {
765
+ return { type: LinkControlType, config };
766
+ }
767
+ function copyLinkData(value, context) {
768
+ var _a2;
769
+ if (value == null)
770
+ return value;
771
+ if (value.type === "OPEN_PAGE") {
772
+ const pageId = value.payload.pageId;
773
+ if (pageId != null) {
774
+ return __spreadProps(__spreadValues({}, value), {
775
+ payload: __spreadProps(__spreadValues({}, value.payload), {
776
+ pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : pageId
777
+ })
778
+ });
779
+ }
780
+ }
781
+ return value;
782
+ }
783
+ if (import_meta.vitest) {
784
+ const { describe, test, expect } = import_meta.vitest;
785
+ describe.concurrent("link", () => {
786
+ test("page id is replaced by one in replacement context", () => {
787
+ const data = {
788
+ type: "OPEN_PAGE",
789
+ payload: {
790
+ pageId: "UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=",
791
+ openInNewTab: false
792
+ }
793
+ };
794
+ const expected = JSON.parse(JSON.stringify(data).replace("UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=", "testing"));
795
+ const replacementContext = {
796
+ elementHtmlIds: /* @__PURE__ */ new Set(),
797
+ elementKeys: /* @__PURE__ */ new Map(),
798
+ swatchIds: /* @__PURE__ */ new Map(),
799
+ pageIds: /* @__PURE__ */ new Map([["UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=", "testing"]]),
800
+ typographyIds: /* @__PURE__ */ new Map(),
801
+ tableIds: /* @__PURE__ */ new Map(),
802
+ tableColumnIds: /* @__PURE__ */ new Map(),
803
+ fileIds: /* @__PURE__ */ new Map(),
804
+ globalElementIds: /* @__PURE__ */ new Map(),
805
+ globalElementData: /* @__PURE__ */ new Map()
806
+ };
807
+ const result = copyLinkData(data, {
808
+ replacementContext,
809
+ copyElement: (node) => node
810
+ });
811
+ expect(result).toMatchObject(expected);
812
+ });
813
+ });
814
+ }
815
+ const RichTextPropControllerMessageType = {
816
+ CHANGE_BUILDER_EDIT_MODE: "CHANGE_BUILDER_EDIT_MODE",
817
+ INITIALIZE_EDITOR: "INITIALIZE_EDITOR",
818
+ CHANGE_EDITOR_VALUE: "CHANGE_EDITOR_VALUE",
819
+ FOCUS: "FOCUS",
820
+ BLUR: "BLUR",
821
+ UNDO: "UNDO",
822
+ REDO: "REDO",
823
+ CHANGE_BOX_MODEL: "CHANGE_BOX_MODEL"
824
+ };
825
+ class DefaultPropController extends PropController {
826
+ constructor() {
827
+ super(...arguments);
828
+ __publicField(this, "recv", (_message) => {
829
+ });
830
+ }
831
+ }
832
+ class RichTextPropController extends PropController {
419
833
  constructor() {
420
834
  super(...arguments);
421
835
  __publicField(this, "editor", null);
@@ -507,13 +921,13 @@ function createPropController(descriptor, send) {
507
921
  case StyleControlType:
508
922
  return new StyleControl(send);
509
923
  case StyleV2ControlType:
510
- return new StyleV2Control(send);
924
+ return new StyleV2Control(send, descriptor);
511
925
  default:
512
926
  return new DefaultPropController(send);
513
927
  }
514
928
  }
515
929
  const ListControlType = "makeswift::controls::list";
516
- function List$1(config) {
930
+ function List(config) {
517
931
  return { type: ListControlType, config };
518
932
  }
519
933
  const ListControlMessageType = {
@@ -564,259 +978,65 @@ class ListControl extends PropController {
564
978
  this.controls = /* @__PURE__ */ new Map();
565
979
  }
566
980
  }
567
- function copyListData(definition2, value, context) {
981
+ function copyListData(definition, value, context) {
568
982
  if (value == null)
569
983
  return value;
570
984
  return value && value.map((item) => __spreadProps(__spreadValues({}, item), {
571
- value: copy(definition2.config.type, item.value, context)
985
+ value: copy(definition.config.type, item.value, context)
572
986
  }));
573
987
  }
574
- const ShapeControlType = "makeswift::controls::shape";
575
- function Shape$1(config) {
576
- return { type: ShapeControlType, config };
577
- }
578
- const ShapeControlMessageType = {
579
- SHAPE_CONTROL_CHILD_CONTROL_MESSAGE: "makeswift::controls::shape::message::child-control-message"
580
- };
581
- class ShapeControl extends PropController {
582
- constructor(send, descriptor) {
583
- super(send);
584
- __publicField(this, "controls");
585
- __publicField(this, "descriptor");
586
- __publicField(this, "send");
587
- __publicField(this, "setControls", () => {
588
- const controls = /* @__PURE__ */ new Map();
589
- const children = this.descriptor.config.type;
590
- Object.keys(children).forEach((key) => {
591
- const control = createPropController(children[key], (message) => this.send({
592
- type: ShapeControlMessageType.SHAPE_CONTROL_CHILD_CONTROL_MESSAGE,
593
- payload: { message, key }
594
- }));
595
- controls.set(key, control);
596
- });
597
- this.controls = controls;
598
- return this.controls;
599
- });
600
- __publicField(this, "recv", (message) => {
601
- switch (message.type) {
602
- case ShapeControlMessageType.SHAPE_CONTROL_CHILD_CONTROL_MESSAGE: {
603
- const control = this.controls.get(message.payload.key);
604
- if (control == null)
605
- return;
606
- const recv = control.recv;
607
- recv(message.payload.message);
608
- }
609
- }
610
- });
611
- this.descriptor = descriptor;
612
- this.send = send;
613
- this.controls = /* @__PURE__ */ new Map();
614
- this.setControls();
615
- }
616
- }
617
- function copyShapeData(definition2, value, context) {
618
- if (value == null)
619
- return value;
620
- const newValue = {};
621
- for (const [key, itemDefinition] of Object.entries(definition2.config.type)) {
622
- const prop = value[key];
623
- newValue[key] = copy(itemDefinition, prop, context);
624
- }
625
- return newValue;
626
- }
627
- const StyleControlType = "makeswift::controls::style";
628
- const StyleControlProperty = {
629
- Width: "makeswift::controls::style::property::width",
630
- Margin: "makeswift::controls::style::property::margin",
631
- Padding: "makeswift::controls::style::property::padding",
632
- Border: "makeswift::controls::style::property::border",
633
- BorderRadius: "makeswift::controls::style::property::border-radius",
634
- TextStyle: "makeswift::controls::style::property::text-style"
635
- };
636
- const StyleControlDefaultProperties = [
637
- StyleControlProperty.Width,
638
- StyleControlProperty.Margin
639
- ];
640
- const AllStyleControlProperties = [
641
- StyleControlProperty.Width,
642
- StyleControlProperty.Margin,
643
- StyleControlProperty.Padding,
644
- StyleControlProperty.Border,
645
- StyleControlProperty.BorderRadius,
646
- StyleControlProperty.TextStyle
647
- ];
648
- function Style(params) {
649
- var _a2;
650
- return {
651
- type: StyleControlType,
652
- config: { properties: (_a2 = params == null ? void 0 : params.properties) != null ? _a2 : StyleControlDefaultProperties }
653
- };
654
- }
655
- Style.Default = StyleControlDefaultProperties;
656
- Style.All = AllStyleControlProperties;
657
- Style.Width = StyleControlProperty.Width;
658
- Style.Margin = StyleControlProperty.Margin;
659
- Style.Padding = StyleControlProperty.Padding;
660
- Style.Border = StyleControlProperty.Border;
661
- Style.BorderRadius = StyleControlProperty.BorderRadius;
662
- Style.TextStyle = StyleControlProperty.TextStyle;
663
- const StyleControlMessageType = {
664
- CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model"
665
- };
666
- class StyleControl extends PropController {
667
- constructor(send) {
668
- super(send);
669
- }
670
- changeBoxModel(boxModel) {
671
- this.send({ type: StyleControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
672
- }
673
- recv() {
674
- }
675
- }
676
- function copyStyleData(value, context) {
677
- if (value == null)
678
- return value;
679
- function copyResponsiveBorder(responsiveBorder) {
680
- if (responsiveBorder == null)
681
- return void 0;
682
- return responsiveBorder.map((deviceBorder) => __spreadProps(__spreadValues({}, deviceBorder), {
683
- value: copyBorder(deviceBorder.value)
684
- }));
685
- }
686
- function copyBorder(border) {
687
- function copyBorderSide(side) {
688
- if (side == null)
689
- return null;
690
- if (side.color == null)
691
- return side;
692
- return __spreadProps(__spreadValues({}, side), {
693
- color: copyColorData(side.color, context)
694
- });
695
- }
696
- return {
697
- borderTop: copyBorderSide(border.borderTop),
698
- borderBottom: copyBorderSide(border.borderBottom),
699
- borderRight: copyBorderSide(border.borderRight),
700
- borderLeft: copyBorderSide(border.borderLeft)
701
- };
702
- }
703
- return __spreadProps(__spreadValues({}, value), { border: copyResponsiveBorder(value.border) });
704
- }
705
- if (import_meta.vitest) {
706
- const { describe, test, expect } = import_meta.vitest;
707
- describe.concurrent("style copy", () => {
708
- test("colors are replaced", () => {
709
- const value = {
710
- width: [
711
- {
712
- value: {
713
- unit: "px",
714
- value: 100
715
- },
716
- deviceId: "desktop"
717
- }
718
- ],
719
- border: [
720
- {
721
- value: {
722
- borderTop: {
723
- color: {
724
- alpha: 1,
725
- swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
726
- },
727
- style: "solid",
728
- width: 9
729
- },
730
- borderLeft: {
731
- color: {
732
- alpha: 1,
733
- swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
734
- },
735
- style: "solid",
736
- width: 9
737
- },
738
- borderRight: {
739
- color: {
740
- alpha: 1,
741
- swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
742
- },
743
- style: "solid",
744
- width: 9
745
- },
746
- borderBottom: {
747
- color: {
748
- alpha: 1,
749
- swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
750
- },
751
- style: "solid",
752
- width: 9
753
- }
754
- },
755
- deviceId: "desktop"
756
- }
757
- ],
758
- textStyle: [
759
- {
760
- value: {
761
- fontSize: {
762
- unit: "px",
763
- value: 46
764
- },
765
- fontStyle: [],
766
- fontFamily: "Oswald",
767
- fontWeight: 400,
768
- letterSpacing: 5.2,
769
- textTransform: []
770
- },
771
- deviceId: "desktop"
772
- }
773
- ],
774
- borderRadius: [
775
- {
776
- value: {
777
- borderTopLeftRadius: {
778
- unit: "px",
779
- value: 4
780
- },
781
- borderTopRightRadius: {
782
- unit: "px",
783
- value: 4
784
- },
785
- borderBottomLeftRadius: {
786
- unit: "px",
787
- value: 4
788
- },
789
- borderBottomRightRadius: {
790
- unit: "px",
791
- value: 4
792
- }
793
- },
794
- deviceId: "desktop"
795
- }
796
- ]
797
- };
798
- const expected = JSON.parse(JSON.stringify(value).replaceAll("U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"));
799
- const replacementContext = {
800
- elementHtmlIds: /* @__PURE__ */ new Set(),
801
- elementKeys: /* @__PURE__ */ new Map(),
802
- swatchIds: /* @__PURE__ */ new Map([
803
- ["U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"]
804
- ]),
805
- fileIds: /* @__PURE__ */ new Map(),
806
- typographyIds: /* @__PURE__ */ new Map(),
807
- tableIds: /* @__PURE__ */ new Map(),
808
- tableColumnIds: /* @__PURE__ */ new Map(),
809
- pageIds: /* @__PURE__ */ new Map(),
810
- globalElementIds: /* @__PURE__ */ new Map(),
811
- globalElementData: /* @__PURE__ */ new Map()
812
- };
813
- const result = copyStyleData(value, {
814
- replacementContext,
815
- copyElement: (node) => node
988
+ const ShapeControlType = "makeswift::controls::shape";
989
+ function Shape(config) {
990
+ return { type: ShapeControlType, config };
991
+ }
992
+ const ShapeControlMessageType = {
993
+ SHAPE_CONTROL_CHILD_CONTROL_MESSAGE: "makeswift::controls::shape::message::child-control-message"
994
+ };
995
+ class ShapeControl extends PropController {
996
+ constructor(send, descriptor) {
997
+ super(send);
998
+ __publicField(this, "controls");
999
+ __publicField(this, "descriptor");
1000
+ __publicField(this, "send");
1001
+ __publicField(this, "setControls", () => {
1002
+ const controls = /* @__PURE__ */ new Map();
1003
+ const children = this.descriptor.config.type;
1004
+ Object.keys(children).forEach((key) => {
1005
+ const control = createPropController(children[key], (message) => this.send({
1006
+ type: ShapeControlMessageType.SHAPE_CONTROL_CHILD_CONTROL_MESSAGE,
1007
+ payload: { message, key }
1008
+ }));
1009
+ controls.set(key, control);
816
1010
  });
817
- expect(result).toMatchObject(expected);
1011
+ this.controls = controls;
1012
+ return this.controls;
818
1013
  });
819
- });
1014
+ __publicField(this, "recv", (message) => {
1015
+ switch (message.type) {
1016
+ case ShapeControlMessageType.SHAPE_CONTROL_CHILD_CONTROL_MESSAGE: {
1017
+ const control = this.controls.get(message.payload.key);
1018
+ if (control == null)
1019
+ return;
1020
+ const recv = control.recv;
1021
+ recv(message.payload.message);
1022
+ }
1023
+ }
1024
+ });
1025
+ this.descriptor = descriptor;
1026
+ this.send = send;
1027
+ this.controls = /* @__PURE__ */ new Map();
1028
+ this.setControls();
1029
+ }
1030
+ }
1031
+ function copyShapeData(definition, value, context) {
1032
+ if (value == null)
1033
+ return value;
1034
+ const newValue = {};
1035
+ for (const [key, itemDefinition] of Object.entries(definition.config.type)) {
1036
+ const prop = value[key];
1037
+ newValue[key] = copy(itemDefinition, prop, context);
1038
+ }
1039
+ return newValue;
820
1040
  }
821
1041
  const SlotControlType = "makeswift::controls::slot";
822
1042
  function Slot() {
@@ -1601,923 +1821,154 @@ function copy$1(descriptor, value, context) {
1601
1821
  return copy$6(value, context);
1602
1822
  case "Table":
1603
1823
  return copy$5(value, context);
1604
- case "Border":
1605
- return copy$4(value, context);
1606
- case "RichText":
1607
- return copy$3(value, context);
1608
- case "ElementID":
1609
- return copy$2(value, context);
1610
- default:
1611
- return value;
1612
- }
1613
- }
1614
- function copyElementReference(value, context) {
1615
- return context.replacementContext.globalElementIds.get(value) || value;
1616
- }
1617
- function copy(definition2, value, context) {
1618
- switch (definition2.type) {
1619
- case Types.Backgrounds:
1620
- case Types.Grid:
1621
- case Types.NavigationLinks:
1622
- case Types.Link:
1623
- case Types.Shadows:
1624
- case Types.Image:
1625
- case Types.Images:
1626
- case Types.ResponsiveColor:
1627
- case Types.TableFormFields:
1628
- case Types.Table:
1629
- case Types.Border:
1630
- case Types.RichText:
1631
- case Types.ElementID:
1632
- return copy$1(definition2, value, context);
1633
- case ColorControlType:
1634
- return copyColorData(value, context);
1635
- case ImageControlType:
1636
- return copyImageData(value, context);
1637
- case LinkControlType:
1638
- return copyLinkData(value, context);
1639
- case ShapeControlType:
1640
- return copyShapeData(definition2, value, context);
1641
- case ListControlType:
1642
- return copyListData(definition2, value, context);
1643
- case StyleControlType:
1644
- return copyStyleData(value, context);
1645
- case SlotControlType:
1646
- return copySlotData(value, context);
1647
- default:
1648
- return value;
1649
- }
1650
- }
1651
- function merge(definition2, a, b = a, context) {
1652
- switch (definition2.type) {
1653
- case SlotControlType:
1654
- return mergeSlotData(a, b, context);
1655
- default:
1656
- return b;
1657
- }
1658
- }
1659
- const SelectControlType = "makeswift::controls::select";
1660
- function Select(config) {
1661
- return { type: SelectControlType, config };
1662
- }
1663
- const isServer = typeof window === "undefined";
1664
- const useInsertionEffectSpecifier = "useInsertionEffect";
1665
- const useInsertionEffect = (_a = React[useInsertionEffectSpecifier]) != null ? _a : React.useLayoutEffect;
1666
- function useStyle(style) {
1667
- const serialized = serializeStyles([style], cache.registered);
1668
- registerStyles(cache, serialized, false);
1669
- useInsertionEffect(() => {
1670
- insertStyles(cache, serialized, false);
1671
- });
1672
- if (isServer)
1673
- insertStyles(cache, serialized, false);
1674
- return `${cache.key}-${serialized.name}`;
1675
- }
1676
- const StyleV2ControlType = "makeswift::controls::style-v2";
1677
- const unstable_useStyleV2ClassName = useStyle;
1678
- function unstable_StyleV2(config) {
1679
- return { type: StyleV2ControlType, config };
1680
- }
1681
- const StyleV2ControlMessageType = {
1682
- CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model"
1683
- };
1684
- class StyleV2Control extends PropController {
1685
- constructor(send) {
1686
- super(send);
1687
- }
1688
- changeBoxModel(boxModel) {
1689
- this.send({ type: StyleV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
1690
- }
1691
- recv() {
1692
- }
1693
- }
1694
- const ObjectType = {
1695
- Value: "value",
1696
- Text: "text",
1697
- Inline: "inline",
1698
- Block: "block",
1699
- Document: "document",
1700
- Leaf: "leaf",
1701
- Selection: "selection",
1702
- Mark: "mark",
1703
- Range: "range",
1704
- Decoration: "decoration",
1705
- Annotation: "annotation",
1706
- Point: "point",
1707
- Operation: "operation"
1708
- };
1709
- const RootBlockType = {
1710
- Default: "default",
1711
- Text: "text-block",
1712
- Paragraph: "paragraph",
1713
- Heading1: "heading-one",
1714
- Heading2: "heading-two",
1715
- Heading3: "heading-three",
1716
- Heading4: "heading-four",
1717
- Heading5: "heading-five",
1718
- Heading6: "heading-six",
1719
- BlockQuote: "blockquote",
1720
- UnorderedList: "unordered-list",
1721
- OrderedList: "ordered-list"
1722
- };
1723
- const BlockType = __spreadProps(__spreadValues({}, RootBlockType), {
1724
- ListItem: "list-item",
1725
- ListItemChild: "list-item-child"
1726
- });
1727
- const InlineType = {
1728
- Code: "code",
1729
- SuperScript: "superscript",
1730
- SubScript: "subscript",
1731
- Link: "link"
1732
- };
1733
- const BlockTextAlignment = {
1734
- Left: "left",
1735
- Center: "center",
1736
- Right: "right",
1737
- Justify: "justify"
1738
- };
1739
- const ElementUtils = {
1740
- isRootBlock(node) {
1741
- return Element.isElement(node) && (Element.isElementType(node, BlockType.Paragraph) || Element.isElementType(node, BlockType.Heading1) || Element.isElementType(node, BlockType.Heading2) || Element.isElementType(node, BlockType.Heading3) || Element.isElementType(node, BlockType.Heading3) || Element.isElementType(node, BlockType.Heading4) || Element.isElementType(node, BlockType.Heading5) || Element.isElementType(node, BlockType.Heading6) || Element.isElementType(node, BlockType.BlockQuote) || Element.isElementType(node, BlockType.UnorderedList) || Element.isElementType(node, BlockType.OrderedList) || Element.isElementType(node, BlockType.Text) || Element.isElementType(node, BlockType.Default));
1742
- },
1743
- isBlock(node) {
1744
- return Element.isElement(node) && (this.isRootBlock(node) || Element.isElementType(node, BlockType.ListItem) || Element.isElementType(node, BlockType.ListItemChild));
1745
- },
1746
- isInline(node) {
1747
- return Element.isElementType(node, InlineType.Code) || Element.isElementType(node, InlineType.Link) || Element.isElementType(node, InlineType.SubScript) || Element.isElementType(node, InlineType.SuperScript);
1748
- },
1749
- isConvertibleToListTextNode(node) {
1750
- return !this.isList(node) && !this.isListItem(node) && !this.isListItemChild(node);
1751
- },
1752
- isList(node) {
1753
- return Element.isElementType(node, BlockType.OrderedList) || Element.isElementType(node, BlockType.UnorderedList);
1754
- },
1755
- isListItem(node) {
1756
- return Element.isElementType(node, BlockType.ListItem);
1757
- },
1758
- isListItemChild(node) {
1759
- return Element.isElementType(node, BlockType.ListItemChild);
1760
- },
1761
- createText() {
1762
- return { text: "" };
1763
- },
1764
- createParagraph() {
1765
- return {
1766
- children: [this.createText()],
1767
- type: BlockType.Paragraph
1768
- };
1769
- },
1770
- createList(type = BlockType.UnorderedList) {
1771
- return { children: [this.createText()], type };
1772
- },
1773
- createListItem() {
1774
- return {
1775
- children: [this.createListItemChild()],
1776
- type: BlockType.ListItem
1777
- };
1778
- },
1779
- createListItemChild() {
1780
- return {
1781
- children: [this.createText()],
1782
- type: BlockType.ListItemChild
1783
- };
1784
- }
1785
- };
1786
- function unhangRange(editor, range) {
1787
- let [start, end] = Range.edges(range);
1788
- if (start.offset !== 0 || end.offset !== 0 || Range.isCollapsed(range)) {
1789
- return range;
1790
- }
1791
- const endBlock = Editor.above(editor, {
1792
- at: end,
1793
- match: (n) => Element.isElement(n) && Editor.isBlock(editor, n)
1794
- });
1795
- const blockPath = endBlock ? endBlock[1] : [];
1796
- const first = Editor.start(editor, start);
1797
- const before = { anchor: first, focus: end };
1798
- let skip = true;
1799
- for (const [node, path] of Editor.nodes(editor, {
1800
- at: before,
1801
- match: Text.isText,
1802
- reverse: true
1803
- })) {
1804
- if (skip) {
1805
- skip = false;
1806
- continue;
1807
- }
1808
- if (node.text !== "" || Path.isBefore(path, blockPath)) {
1809
- end = { path, offset: node.text.length };
1810
- break;
1811
- }
1812
- }
1813
- return { anchor: start, focus: end };
1814
- }
1815
- function getSelection(editor) {
1816
- if (editor.selection)
1817
- return unhangRange(editor, editor.selection);
1818
- return {
1819
- anchor: Editor.start(editor, []),
1820
- focus: Editor.end(editor, [])
1821
- };
1822
- }
1823
- function getBlocksInSelection(editor) {
1824
- return Array.from(Editor.nodes(editor, {
1825
- at: getSelection(editor),
1826
- match: (node) => ElementUtils.isRootBlock(node)
1827
- })).filter((entry) => ElementUtils.isRootBlock(entry[0]));
1828
- }
1829
- function getActiveBlockType(editor) {
1830
- var _a2;
1831
- const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type);
1832
- return rootBlocks.reduce((a, b) => a === b ? b : null, (_a2 = rootBlocks.at(0)) != null ? _a2 : null);
1833
- }
1834
- function setBlockKeyForDevice(editor, breakpoints, deviceId, key, value, options) {
1835
- var _a2, _b;
1836
- const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
1837
- if (!at)
1838
- return;
1839
- const rootElements = getBlocksInSelection(editor);
1840
- for (const [node, path] of rootElements) {
1841
- if (ElementUtils.isBlock(node)) {
1842
- const deviceValues = (_b = node[key]) != null ? _b : [];
1843
- const currentDeviceValue = findBreakpointOverride(breakpoints, deviceValues, deviceId, (v) => v);
1844
- const nextDeviceValue = __spreadProps(__spreadValues({}, currentDeviceValue), {
1845
- deviceId,
1846
- value
1847
- });
1848
- Transforms.setNodes(editor, {
1849
- [key]: [...deviceValues.filter((v) => v.deviceId !== deviceId), nextDeviceValue]
1850
- }, { at: path });
1851
- }
1852
- }
1853
- }
1854
- function clearBlockKeyForDevice(editor, deviceId, key) {
1855
- var _a2;
1856
- const rootElements = getBlocksInSelection(editor);
1857
- for (const [node, path] of rootElements) {
1858
- if (ElementUtils.isBlock(node)) {
1859
- const deviceOverrides = (_a2 = node[key]) != null ? _a2 : [];
1860
- Transforms.setNodes(editor, {
1861
- [key]: deviceOverrides.filter((v) => v.deviceId !== deviceId)
1862
- }, { at: path });
1863
- }
1864
- }
1865
- }
1866
- function wrapInline(editor, inline) {
1867
- Transforms.wrapNodes(editor, inline, {
1868
- at: getSelection(editor),
1869
- split: true
1870
- });
1871
- }
1872
- function unwrapInline(editor, type) {
1873
- Transforms.unwrapNodes(editor, {
1874
- match: (node) => ElementUtils.isInline(node) && node.type === type,
1875
- at: getSelection(editor)
1876
- });
1877
- }
1878
- const EditorUtils = {
1879
- getFirstAncestorList(editor, path) {
1880
- try {
1881
- const parentList = Editor.above(editor, {
1882
- at: path,
1883
- match: (node) => ElementUtils.isList(node)
1884
- });
1885
- return parentList != null ? parentList : null;
1886
- } catch (e) {
1887
- return null;
1888
- }
1889
- },
1890
- getFirstAncestorListItem(editor, path) {
1891
- try {
1892
- const parentListItem = Editor.above(editor, {
1893
- at: path,
1894
- match: (node) => ElementUtils.isListItem(node)
1895
- });
1896
- return parentListItem != null ? parentListItem : null;
1897
- } catch (e) {
1898
- return null;
1899
- }
1900
- }
1901
- };
1902
- const LIST_ITEM_CHILD_POSITION = 0;
1903
- const LIST_ITEM_LIST_POSITION = 1;
1904
- function filterForSubtreeRoots(entries) {
1905
- return entries.filter(([, nodePath]) => !Path.ancestors(nodePath).some((ancestor) => {
1906
- return entries.some(([, path]) => Path.equals(path, ancestor));
1907
- }));
1908
- }
1909
- function unwrapPath(editor, listItemPath) {
1910
- const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath);
1911
- const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath);
1912
- if (!parentList || listItemContainingParentList)
1913
- return;
1914
- Editor.withoutNormalizing(editor, () => {
1915
- const listItemTextPath = [...listItemPath, LIST_ITEM_CHILD_POSITION];
1916
- const listItemNestedListPath = [...listItemPath, LIST_ITEM_LIST_POSITION];
1917
- if (Node.has(editor, listItemNestedListPath)) {
1918
- Transforms.setNodes(editor, { type: parentList[0].type }, { at: listItemNestedListPath });
1919
- Transforms.liftNodes(editor, { at: listItemNestedListPath });
1920
- Transforms.liftNodes(editor, { at: Path.next(listItemPath) });
1921
- }
1922
- if (Node.has(editor, listItemTextPath)) {
1923
- Transforms.setNodes(editor, { type: BlockType.Paragraph }, {
1924
- at: listItemTextPath
1925
- });
1926
- Transforms.liftNodes(editor, { at: listItemTextPath });
1927
- Transforms.liftNodes(editor, { at: listItemPath });
1928
- }
1929
- });
1930
- }
1931
- function unwrapList(editor, options) {
1932
- var _a2;
1933
- const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
1934
- if (!at)
1935
- return;
1936
- const listItems = Array.from(Editor.nodes(editor, {
1937
- at,
1938
- match: (node) => {
1939
- return Element.isElement(node) && ElementUtils.isListItem(node);
1940
- }
1941
- }));
1942
- const subRoots = filterForSubtreeRoots(listItems);
1943
- const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path));
1944
- refs.forEach((ref) => {
1945
- if (ref.current) {
1946
- unwrapPath(editor, ref.current);
1947
- }
1948
- ref.unref();
1949
- });
1950
- }
1951
- function wrapList(editor, options = { type: BlockType.UnorderedList }) {
1952
- var _a2;
1953
- const at = (_a2 = options.at) != null ? _a2 : editor.selection;
1954
- if (!at)
1955
- return;
1956
- const nonListEntries = Array.from(Editor.nodes(editor, {
1957
- at,
1958
- match: (node) => {
1959
- return Element.isElement(node) && ElementUtils.isConvertibleToListTextNode(node);
1960
- }
1961
- }));
1962
- const refs = nonListEntries.map(([_, path]) => Editor.pathRef(editor, path));
1963
- refs.forEach((ref) => {
1964
- const path = ref.current;
1965
- if (path) {
1966
- Editor.withoutNormalizing(editor, () => {
1967
- Transforms.setNodes(editor, { type: BlockType.ListItemChild }, {
1968
- at: path
1969
- });
1970
- Transforms.wrapNodes(editor, ElementUtils.createListItem(), {
1971
- match: (node) => ElementUtils.isListItemChild(node),
1972
- at: path
1973
- });
1974
- Transforms.wrapNodes(editor, ElementUtils.createList(options.type), {
1975
- at: path
1976
- });
1977
- });
1978
- }
1979
- ref.unref();
1980
- });
1981
- }
1982
- const LocationUtils = {
1983
- getStartPath(location) {
1984
- if (Range.isRange(location))
1985
- return Range.start(location).path;
1986
- if (Point.isPoint(location))
1987
- return location.path;
1988
- return location;
1989
- }
1990
- };
1991
- function getSelectedListItems(editor) {
1992
- var _a2, _b;
1993
- if (!editor.selection)
1994
- return [];
1995
- const start = LocationUtils.getStartPath(editor.selection);
1996
- const listItems = Editor.nodes(editor, {
1997
- at: editor.selection,
1998
- match: (node) => ElementUtils.isListItem(node)
1999
- });
2000
- const firstAncestorPath = (_b = (_a2 = EditorUtils.getFirstAncestorListItem(editor, start)) == null ? void 0 : _a2[1]) != null ? _b : [];
2001
- return Array.from(listItems).filter((node) => Path.isDescendant(start, node[1]) ? Path.equals(node[1], firstAncestorPath) : !Path.isAfter(start, node[1]));
2002
- }
2003
- function indentPath(editor, path) {
2004
- const parent = Node.parent(editor, path);
2005
- if (!path || !Path.hasPrevious(path) || !ElementUtils.isList(parent))
2006
- return;
2007
- const previosPath = Path.previous(path);
2008
- const previousChildListPath = [...previosPath, LIST_ITEM_LIST_POSITION];
2009
- const previousHasChildList = Node.has(editor, previousChildListPath);
2010
- Editor.withoutNormalizing(editor, () => {
2011
- if (!previousHasChildList) {
2012
- Transforms.insertNodes(editor, ElementUtils.createList(parent.type), {
2013
- at: previousChildListPath
2014
- });
2015
- }
2016
- const previousChildList = Node.get(editor, previousChildListPath);
2017
- if (ElementUtils.isList(previousChildList)) {
2018
- const index = previousHasChildList ? previousChildList.children.length : 0;
2019
- Transforms.moveNodes(editor, {
2020
- at: path,
2021
- to: [...previousChildListPath, index]
2022
- });
2023
- }
2024
- });
2025
- }
2026
- function indent(editor) {
2027
- if (!editor.selection)
2028
- return;
2029
- const listItems = getSelectedListItems(editor);
2030
- const subRoots = filterForSubtreeRoots(listItems);
2031
- const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path));
2032
- refs.forEach((ref) => {
2033
- if (ref.current) {
2034
- indentPath(editor, ref.current);
2035
- }
2036
- ref.unref();
2037
- });
2038
- }
2039
- function dedentPath(editor, listItemPath) {
2040
- const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath);
2041
- const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath);
2042
- if (!parentList || !listItemContainingParentList)
2043
- return;
2044
- const [parentListNode, parentListPath] = parentList;
2045
- const [_, listItemContainingParentListPath] = listItemContainingParentList;
2046
- const listItemPosition = listItemPath[listItemPath.length - 1];
2047
- const previousSiblings = parentListNode.children.slice(0, listItemPosition);
2048
- const nextSiblings = parentListNode.children.slice(listItemPosition + 1);
2049
- Editor.withoutNormalizing(editor, () => {
2050
- nextSiblings.forEach(() => {
2051
- const nextSiblingPath = [...parentListPath, listItemPosition + 1];
2052
- indentPath(editor, nextSiblingPath);
2053
- });
2054
- Transforms.moveNodes(editor, {
2055
- at: listItemPath,
2056
- to: Path.next(listItemContainingParentListPath)
2057
- });
2058
- if (previousSiblings.length === 0) {
2059
- Transforms.removeNodes(editor, { at: parentListPath });
2060
- }
2061
- });
1824
+ case "Border":
1825
+ return copy$4(value, context);
1826
+ case "RichText":
1827
+ return copy$3(value, context);
1828
+ case "ElementID":
1829
+ return copy$2(value, context);
1830
+ default:
1831
+ return value;
1832
+ }
2062
1833
  }
2063
- function dedent(editor) {
2064
- if (!editor.selection)
2065
- return;
2066
- const listItems = getSelectedListItems(editor);
2067
- const subRoots = filterForSubtreeRoots(listItems);
2068
- const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path));
2069
- refs.forEach((ref) => {
2070
- if (ref.current) {
2071
- dedentPath(editor, ref.current);
2072
- }
2073
- ref.unref();
2074
- });
1834
+ function copyElementReference(value, context) {
1835
+ return context.replacementContext.globalElementIds.get(value) || value;
2075
1836
  }
2076
- function toggleList(editor, options = { type: BlockType.UnorderedList }) {
2077
- var _a2;
2078
- const at = (_a2 = options.at) != null ? _a2 : editor.selection;
2079
- if (at == null)
2080
- return;
2081
- const start = LocationUtils.getStartPath(at);
2082
- const ancestorPath = Path.ancestors(start).at(1);
2083
- if (!ancestorPath || !Node.has(editor, ancestorPath))
2084
- return;
2085
- const ancestor = Node.get(editor, ancestorPath);
2086
- if (!ElementUtils.isList(ancestor)) {
2087
- return wrapList(editor, { type: options.type, at });
2088
- }
2089
- if (ancestor.type === options.type) {
2090
- unwrapList(editor, { at });
2091
- } else {
2092
- Transforms.setNodes(editor, { type: options.type }, { at: ancestorPath });
2093
- }
2094
- }
2095
- const BlockActions = {
2096
- setBlockKeyForDevice,
2097
- clearBlockKeyForDevice,
2098
- wrapInline,
2099
- unwrapInline
2100
- };
2101
- const ListActions = {
2102
- unwrapList,
2103
- wrapList,
2104
- indent,
2105
- dedent,
2106
- toggleList
2107
- };
2108
- function onKeyDown(e, editor) {
2109
- if (!editor.selection || Array.from(Editor.nodes(editor, {
2110
- match: (node) => ElementUtils.isListItem(node)
2111
- })).length === 0)
2112
- return;
2113
- if (isHotkey("shift+tab", e)) {
2114
- e.preventDefault();
2115
- ListActions.dedent(editor);
2116
- }
2117
- if (isHotkey("tab", e)) {
2118
- e.preventDefault();
2119
- ListActions.indent(editor);
2120
- }
2121
- if (isHotkey("backspace", e)) {
2122
- if (!editor.selection)
2123
- return;
2124
- if (Range.isExpanded(editor.selection))
2125
- return;
2126
- const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path);
2127
- if (editor.selection.anchor.offset === 0 && listItem) {
2128
- e.preventDefault();
2129
- const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1]);
2130
- const list = EditorUtils.getFirstAncestorList(editor, listItem[1]);
2131
- if (parentListItem) {
2132
- ListActions.dedent(editor);
2133
- } else if (list) {
2134
- ListActions.unwrapList(editor);
2135
- }
2136
- return;
2137
- }
2138
- }
2139
- if (isHotkey("enter", e)) {
2140
- e.preventDefault();
2141
- if (!editor.selection)
2142
- return;
2143
- if (Range.isExpanded(editor.selection)) {
2144
- Transforms.delete(editor);
2145
- return;
2146
- }
2147
- const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path);
2148
- if (editor.selection.anchor.offset === 0 && listItem && Editor.string(editor, listItem[1]) === "") {
2149
- const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1]);
2150
- if (parentListItem) {
2151
- ListActions.dedent(editor);
2152
- } else {
2153
- ListActions.unwrapList(editor);
2154
- }
2155
- return;
2156
- }
2157
- Transforms.splitNodes(editor, {
2158
- at: editor.selection,
2159
- always: true,
2160
- match: (node) => ElementUtils.isListItem(node)
2161
- });
2162
- }
2163
- if (isHotkey("shift+enter", e)) {
2164
- e.preventDefault();
2165
- editor.insertText("\n");
1837
+ function copy(definition, value, context) {
1838
+ switch (definition.type) {
1839
+ case Types.Backgrounds:
1840
+ case Types.Grid:
1841
+ case Types.NavigationLinks:
1842
+ case Types.Link:
1843
+ case Types.Shadows:
1844
+ case Types.Image:
1845
+ case Types.Images:
1846
+ case Types.ResponsiveColor:
1847
+ case Types.TableFormFields:
1848
+ case Types.Table:
1849
+ case Types.Border:
1850
+ case Types.RichText:
1851
+ case Types.ElementID:
1852
+ return copy$1(definition, value, context);
1853
+ case ColorControlType:
1854
+ return copyColorData(value, context);
1855
+ case ImageControlType:
1856
+ return copyImageData(value, context);
1857
+ case LinkControlType:
1858
+ return copyLinkData(value, context);
1859
+ case ShapeControlType:
1860
+ return copyShapeData(definition, value, context);
1861
+ case ListControlType:
1862
+ return copyListData(definition, value, context);
1863
+ case StyleControlType:
1864
+ return copyStyleData(value, context);
1865
+ case SlotControlType:
1866
+ return copySlotData(value, context);
1867
+ default:
1868
+ return value;
2166
1869
  }
2167
1870
  }
2168
- function withBlock(editor) {
2169
- const {
2170
- normalizeNode
2171
- } = editor;
2172
- editor.isInline = (entry) => {
2173
- return ElementUtils.isInline(entry);
2174
- };
2175
- editor.normalizeNode = (entry) => {
2176
- var _a2;
2177
- const [normalizationNode, normalizationPath] = entry;
2178
- if (ElementUtils.isBlock(normalizationNode) && ((_a2 = normalizationNode == null ? void 0 : normalizationNode.textAlign) == null ? void 0 : _a2.length) == 0) {
2179
- Transforms.unsetNodes(editor, "textAlign", {
2180
- at: normalizationPath
2181
- });
2182
- return;
2183
- }
2184
- if (ElementUtils.isListItem(normalizationNode)) {
2185
- const pathToListItemText = [...normalizationPath, LIST_ITEM_CHILD_POSITION];
2186
- if (Node.has(editor, pathToListItemText)) {
2187
- const nodeInListItemTextPosition = Node.get(editor, pathToListItemText);
2188
- if (ElementUtils.isRootBlock(nodeInListItemTextPosition)) {
2189
- Transforms.setNodes(editor, {
2190
- type: BlockType.ListItemChild
2191
- }, {
2192
- at: pathToListItemText
2193
- });
2194
- return;
2195
- }
2196
- } else {
2197
- Transforms.insertNodes(editor, ElementUtils.createListItem(), {
2198
- at: pathToListItemText
2199
- });
2200
- return;
2201
- }
2202
- }
2203
- if (!Text.isText(normalizationNode)) {
2204
- const mergeableChildren = Array.from(Node.children(editor, normalizationPath)).map((child, index, children) => {
2205
- const potentialNodeToBeMerged = children.at(index + 1);
2206
- if (!potentialNodeToBeMerged || !ElementUtils.isList(potentialNodeToBeMerged[0]) || !ElementUtils.isList(child[0]) || potentialNodeToBeMerged[0].type !== child[0].type) {
2207
- return null;
2208
- }
2209
- return [Editor.pathRef(editor, child[1]), Editor.pathRef(editor, potentialNodeToBeMerged[1])];
2210
- }).filter((mergeableNodes) => Boolean(mergeableNodes));
2211
- if (mergeableChildren.length !== 0) {
2212
- mergeableChildren.reverse().forEach(([nodePathRef, nodeToBeMergedPathRef]) => {
2213
- const nodePath = nodePathRef.current;
2214
- const nodeToBeMergedPath = nodeToBeMergedPathRef.current;
2215
- if (nodePath == null || nodeToBeMergedPath == null)
2216
- return;
2217
- const nodeChildren = Array.from(Node.children(editor, nodePath));
2218
- const childrenToBeMerged = Array.from(Node.children(editor, nodeToBeMergedPath));
2219
- Editor.withoutNormalizing(editor, () => {
2220
- childrenToBeMerged.reverse().forEach(([_, childPath]) => {
2221
- Transforms.moveNodes(editor, {
2222
- at: childPath,
2223
- to: [...nodePath, nodeChildren.length]
2224
- });
2225
- });
2226
- Transforms.removeNodes(editor, {
2227
- at: nodeToBeMergedPath
2228
- });
2229
- });
2230
- nodePathRef.unref();
2231
- nodeToBeMergedPathRef.unref();
2232
- });
2233
- return;
2234
- }
2235
- }
2236
- normalizeNode(entry);
2237
- };
2238
- return editor;
2239
- }
2240
- const definition = Select({
2241
- label: "Block",
2242
- labelOrientation: "horizontal",
2243
- options: [{
2244
- value: BlockType.Paragraph,
2245
- label: "Paragraph"
2246
- }, {
2247
- value: BlockType.Heading1,
2248
- label: "Heading 1"
2249
- }, {
2250
- value: BlockType.Heading2,
2251
- label: "Heading 2"
2252
- }, {
2253
- value: BlockType.Heading3,
2254
- label: "Heading 3"
2255
- }, {
2256
- value: BlockType.Heading4,
2257
- label: "Heading 4"
2258
- }, {
2259
- value: BlockType.Heading5,
2260
- label: "Heading 5"
2261
- }, {
2262
- value: BlockType.Heading6,
2263
- label: "Heading 6"
2264
- }, {
2265
- value: BlockType.UnorderedList,
2266
- label: "Bulleted list"
2267
- }, {
2268
- value: BlockType.OrderedList,
2269
- label: "Numbered list"
2270
- }, {
2271
- value: BlockType.BlockQuote,
2272
- label: "Quote"
2273
- }],
2274
- defaultValue: BlockType.Paragraph
2275
- });
2276
- function BlockPlugin() {
2277
- return createRichTextV2Plugin({
2278
- withPlugin: withBlock,
2279
- onKeyDown,
2280
- control: {
2281
- definition,
2282
- onChange: (editor, value) => {
2283
- const activeBlockType = getActiveBlockType(editor);
2284
- if (value === BlockType.UnorderedList || value === BlockType.OrderedList) {
2285
- ListActions.toggleList(editor, {
2286
- type: value,
2287
- at: getSelection(editor)
2288
- });
2289
- } else if (activeBlockType === value) {
2290
- Transforms.setNodes(editor, {
2291
- type: BlockType.Default
2292
- }, {
2293
- at: getSelection(editor)
2294
- });
2295
- } else {
2296
- ListActions.unwrapList(editor, {
2297
- at: getSelection(editor)
2298
- });
2299
- Transforms.setNodes(editor, {
2300
- type: value != null ? value : BlockType.Default
2301
- }, {
2302
- at: getSelection(editor)
2303
- });
2304
- }
2305
- },
2306
- getValue: (editor) => {
2307
- const activeBlock = getActiveBlockType(editor);
2308
- if (activeBlock === RootBlockType.Text || activeBlock === RootBlockType.Default)
2309
- return void 0;
2310
- return activeBlock;
2311
- }
2312
- },
2313
- renderElement: (renderElement) => (props) => /* @__PURE__ */ jsx(BlockPluginComponent, __spreadProps(__spreadValues({}, props), {
2314
- renderElement
2315
- }))
2316
- });
2317
- }
2318
- function BlockPluginComponent({
2319
- element,
2320
- attributes,
2321
- children,
2322
- renderElement
2323
- }) {
2324
- const blockStyles = [useStyle({
2325
- margin: 0
2326
- }), element.className];
2327
- const quoteStyles = useStyle({
2328
- padding: "0.5em 10px",
2329
- fontSize: "1.25em",
2330
- fontWeight: "300",
2331
- borderLeft: "5px solid rgba(0, 0, 0, 0.1)"
2332
- });
2333
- switch (element.type) {
2334
- case BlockType.Text:
2335
- return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({}, attributes), {
2336
- className: cx(...blockStyles),
2337
- children
2338
- }));
2339
- case BlockType.Paragraph:
2340
- return /* @__PURE__ */ jsx("p", __spreadProps(__spreadValues({}, attributes), {
2341
- className: cx(...blockStyles),
2342
- children
2343
- }));
2344
- case BlockType.Heading1:
2345
- return /* @__PURE__ */ jsx("h1", __spreadProps(__spreadValues({}, attributes), {
2346
- className: cx(...blockStyles),
2347
- children
2348
- }));
2349
- case BlockType.Heading2:
2350
- return /* @__PURE__ */ jsx("h2", __spreadProps(__spreadValues({}, attributes), {
2351
- className: cx(...blockStyles),
2352
- children
2353
- }));
2354
- case BlockType.Heading3:
2355
- return /* @__PURE__ */ jsx("h3", __spreadProps(__spreadValues({}, attributes), {
2356
- className: cx(...blockStyles),
2357
- children
2358
- }));
2359
- case BlockType.Heading4:
2360
- return /* @__PURE__ */ jsx("h4", __spreadProps(__spreadValues({}, attributes), {
2361
- className: cx(...blockStyles),
2362
- children
2363
- }));
2364
- case BlockType.Heading5:
2365
- return /* @__PURE__ */ jsx("h5", __spreadProps(__spreadValues({}, attributes), {
2366
- className: cx(...blockStyles),
2367
- children
2368
- }));
2369
- case BlockType.Heading6:
2370
- return /* @__PURE__ */ jsx("h6", __spreadProps(__spreadValues({}, attributes), {
2371
- className: cx(...blockStyles),
2372
- children
2373
- }));
2374
- case BlockType.BlockQuote:
2375
- return /* @__PURE__ */ jsx("blockquote", __spreadProps(__spreadValues({}, attributes), {
2376
- className: cx(...blockStyles, quoteStyles),
2377
- children
2378
- }));
2379
- case BlockType.OrderedList:
2380
- return /* @__PURE__ */ jsx("ol", __spreadProps(__spreadValues({}, attributes), {
2381
- className: cx(...blockStyles),
2382
- style: {
2383
- listStylePosition: "inside"
2384
- },
2385
- children
2386
- }));
2387
- case BlockType.UnorderedList:
2388
- return /* @__PURE__ */ jsx("ul", __spreadProps(__spreadValues({}, attributes), {
2389
- className: cx(...blockStyles),
2390
- style: {
2391
- listStylePosition: "inside"
2392
- },
2393
- children
2394
- }));
2395
- case BlockType.ListItem:
2396
- return /* @__PURE__ */ jsx("li", __spreadProps(__spreadValues({}, attributes), {
2397
- className: cx(...blockStyles),
2398
- children
2399
- }));
2400
- case BlockType.ListItemChild:
2401
- return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({}, attributes), {
2402
- className: cx(...blockStyles),
2403
- children
2404
- }));
2405
- case BlockType.Default:
2406
- return /* @__PURE__ */ jsx("p", __spreadProps(__spreadValues({}, attributes), {
2407
- className: cx(...blockStyles),
2408
- children
2409
- }));
1871
+ function merge(definition, a, b = a, context) {
1872
+ switch (definition.type) {
1873
+ case SlotControlType:
1874
+ return mergeSlotData(a, b, context);
2410
1875
  default:
2411
- return /* @__PURE__ */ jsx(Fragment, {
2412
- children: renderElement({
2413
- element,
2414
- attributes,
2415
- children
2416
- })
2417
- });
1876
+ return b;
2418
1877
  }
2419
1878
  }
2420
- const RichTextV2ControlType = "makeswift::controls::rich-text-v2";
2421
- const RichTextV2Mode = {
2422
- Inline: "makeswift::controls::rich-text-v2::mode::inline",
2423
- Block: "makeswift::controls::rich-text-v2::mode::block"
2424
- };
2425
- function createRichTextV2Plugin({
2426
- control,
2427
- withPlugin,
2428
- onKeyDown: onKeyDown2,
2429
- renderElement
2430
- }) {
2431
- return { control, withPlugin, onKeyDown: onKeyDown2, renderElement };
1879
+ const isServer = typeof window === "undefined";
1880
+ const useInsertionEffectSpecifier = "useInsertionEffect";
1881
+ const useInsertionEffect = (_a = React[useInsertionEffectSpecifier]) != null ? _a : React.useLayoutEffect;
1882
+ function useStyle(style) {
1883
+ const serialized = serializeStyles([style], cache.registered);
1884
+ registerStyles(cache, serialized, false);
1885
+ useInsertionEffect(() => {
1886
+ insertStyles(cache, serialized, false);
1887
+ });
1888
+ if (isServer)
1889
+ insertStyles(cache, serialized, false);
1890
+ return `${cache.key}-${serialized.name}`;
2432
1891
  }
2433
- function unstable_RichTextV2(config = {}) {
2434
- return { type: RichTextV2ControlType, config };
1892
+ const StyleV2ControlType = "makeswift::controls::style-v2";
1893
+ const unstable_useStyleV2ClassName = useStyle;
1894
+ function unstable_StyleV2(config) {
1895
+ return { type: StyleV2ControlType, config };
2435
1896
  }
2436
- const RichTextV2ControlMessageType = {
2437
- RESET_VALUE: "RESET_VALUE",
2438
- FOCUS: "FOCUS",
2439
- RUN_PLUGIN_CONTROL_ACTION: "RUN_PLUGIN_CONTROL_ACTION",
2440
- SET_DEFAULT_VALUE: "SET_DEFAULT_VALUE",
2441
- SET_PLUGIN_CONTROL_VALUE: "SET_PLUGIN_CONTROL_VALUE",
2442
- ON_CHANGE: "ON_CHANGE",
2443
- SELECT: "SELECT",
2444
- SWITCH_TO_BUILD_MODE: "SWITCH_TO_BUILD_MODE",
2445
- CHANGE_BOX_MODEL: "CHANGE_BOX_MODEL"
1897
+ const StyleV2ControlMessageType = {
1898
+ CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model",
1899
+ STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE: "makeswift::controls::style-v2::message::child-control-message"
2446
1900
  };
2447
- class RichTextV2Control extends PropController {
1901
+ class StyleV2Control extends PropController {
2448
1902
  constructor(send, descriptor) {
2449
1903
  super(send);
2450
- __publicField(this, "editor", null);
2451
- __publicField(this, "defaultValue", null);
2452
- __publicField(this, "descriptor");
2453
- __publicField(this, "recv", (message) => {
2454
- var _a2, _b, _c;
2455
- if (!this.editor)
2456
- return;
2457
- switch (message.type) {
2458
- case RichTextV2ControlMessageType.FOCUS: {
2459
- this.editor.focusAndSelectAll();
2460
- break;
2461
- }
2462
- case RichTextV2ControlMessageType.RESET_VALUE: {
2463
- if (this.defaultValue) {
2464
- this.editor.selection = null;
2465
- this.editor.children = this.defaultValue;
2466
- this.editor.onChange();
2467
- }
2468
- break;
2469
- }
2470
- case RichTextV2ControlMessageType.RUN_PLUGIN_CONTROL_ACTION: {
2471
- (_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);
2472
- break;
2473
- }
2474
- }
2475
- });
2476
- this.descriptor = descriptor;
2477
- this.send = send;
2478
- }
2479
- setEditor(editor) {
2480
- var _a2, _b, _c;
2481
- this.editor = editor;
2482
- this.send({
2483
- type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
2484
- value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
2485
- var _a3;
2486
- return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
2487
- })) != null ? _c : []
2488
- });
2489
- }
2490
- setDefaultValue(defaultValue) {
2491
- this.defaultValue = defaultValue;
2492
- this.send({ type: RichTextV2ControlMessageType.SET_DEFAULT_VALUE, value: defaultValue });
2493
- }
2494
- select() {
2495
- this.send({ type: RichTextV2ControlMessageType.SELECT });
2496
- }
2497
- switchToBuildMode() {
2498
- this.send({ type: RichTextV2ControlMessageType.SWITCH_TO_BUILD_MODE });
2499
- }
2500
- onChange(value) {
2501
- var _a2, _b, _c;
2502
- const editor = this.editor;
2503
- if (editor == null)
2504
- return;
2505
- this.send({
2506
- type: RichTextV2ControlMessageType.ON_CHANGE,
2507
- value
2508
- });
2509
- this.send({
2510
- type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
2511
- value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
2512
- var _a3;
2513
- return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
2514
- })) != null ? _c : []
1904
+ __publicField(this, "control");
1905
+ this.control = createPropController(descriptor.config.type, (message) => {
1906
+ this.send({
1907
+ type: StyleV2ControlMessageType.STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE,
1908
+ payload: { message }
1909
+ });
2515
1910
  });
2516
1911
  }
2517
1912
  changeBoxModel(boxModel) {
2518
- this.send({ type: RichTextV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
1913
+ this.send({ type: StyleV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
1914
+ }
1915
+ recv(message) {
1916
+ switch (message.type) {
1917
+ case StyleV2ControlMessageType.STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE: {
1918
+ const control = this.control;
1919
+ if (control == null)
1920
+ return;
1921
+ const recv = control.recv;
1922
+ recv(message.payload.message);
1923
+ }
1924
+ }
2519
1925
  }
2520
1926
  }
1927
+ const ObjectType = {
1928
+ Value: "value",
1929
+ Text: "text",
1930
+ Inline: "inline",
1931
+ Block: "block",
1932
+ Document: "document",
1933
+ Leaf: "leaf",
1934
+ Selection: "selection",
1935
+ Mark: "mark",
1936
+ Range: "range",
1937
+ Decoration: "decoration",
1938
+ Annotation: "annotation",
1939
+ Point: "point",
1940
+ Operation: "operation"
1941
+ };
1942
+ const RootBlockType = {
1943
+ Default: "default",
1944
+ Text: "text-block",
1945
+ Paragraph: "paragraph",
1946
+ Heading1: "heading-one",
1947
+ Heading2: "heading-two",
1948
+ Heading3: "heading-three",
1949
+ Heading4: "heading-four",
1950
+ Heading5: "heading-five",
1951
+ Heading6: "heading-six",
1952
+ BlockQuote: "blockquote",
1953
+ UnorderedList: "unordered-list",
1954
+ OrderedList: "ordered-list"
1955
+ };
1956
+ const BlockType = __spreadProps(__spreadValues({}, RootBlockType), {
1957
+ ListItem: "list-item",
1958
+ ListItemChild: "list-item-child"
1959
+ });
1960
+ const InlineType = {
1961
+ Code: "code",
1962
+ SuperScript: "superscript",
1963
+ SubScript: "subscript",
1964
+ Link: "link"
1965
+ };
1966
+ const BlockTextAlignment = {
1967
+ Left: "left",
1968
+ Center: "center",
1969
+ Right: "right",
1970
+ Justify: "justify"
1971
+ };
2521
1972
  function isText(node) {
2522
1973
  if (typeof node === "object" && "text" in node)
2523
1974
  return true;
@@ -2679,330 +2130,209 @@ function toNodeDTO(node) {
2679
2130
  }
2680
2131
  }
2681
2132
  function toSelectionDTO(selection) {
2682
- if (selection == null)
2683
- return void 0;
2684
- return {
2685
- isFocused: false,
2686
- marks: void 0,
2687
- object: "selection",
2688
- anchor: {
2689
- offset: selection.anchor.offset,
2690
- path: selection.anchor.path,
2691
- object: "point"
2692
- },
2693
- focus: {
2694
- offset: selection.focus.offset,
2695
- path: selection.focus.path,
2696
- object: "point"
2697
- }
2698
- };
2699
- }
2700
- function richTextDAOToDTO(children, selection) {
2701
- return {
2702
- document: {
2703
- data: void 0,
2704
- nodes: children.flatMap(toNodeDTO),
2705
- object: "document"
2706
- },
2707
- object: "value",
2708
- selection: toSelectionDTO(selection),
2709
- annotations: void 0,
2710
- data: void 0
2711
- };
2712
- }
2713
- const RichTextControlType = "makeswift::controls::rich-text";
2714
- function RichText$1() {
2715
- return { type: RichTextControlType };
2716
- }
2717
- const RichTextControlMessageType = {
2718
- CHANGE_BUILDER_EDIT_MODE: "CHANGE_BUILDER_EDIT_MODE",
2719
- INITIALIZE_EDITOR: "INITIALIZE_EDITOR",
2720
- CHANGE_EDITOR_VALUE: "CHANGE_EDITOR_VALUE",
2721
- FOCUS: "FOCUS",
2722
- BLUR: "BLUR",
2723
- UNDO: "UNDO",
2724
- REDO: "REDO",
2725
- CHANGE_BOX_MODEL: "CHANGE_BOX_MODEL"
2726
- };
2727
- class RichTextControl extends PropController {
2728
- constructor() {
2729
- super(...arguments);
2730
- __publicField(this, "editor", null);
2731
- __publicField(this, "recv", (message) => {
2732
- if (!this.editor)
2733
- return;
2734
- switch (message.type) {
2735
- case RichTextControlMessageType.CHANGE_BUILDER_EDIT_MODE: {
2736
- switch (message.editMode) {
2737
- case BuilderEditMode.BUILD:
2738
- case BuilderEditMode.INTERACT:
2739
- this.editor.deselectAndBlur();
2740
- }
2741
- break;
2742
- }
2743
- case RichTextControlMessageType.FOCUS: {
2744
- this.editor.focusAndSelectAll();
2745
- break;
2746
- }
2747
- }
2748
- });
2749
- }
2750
- setSlateEditor(editor) {
2751
- this.editor = editor;
2752
- this.send({
2753
- type: RichTextControlMessageType.INITIALIZE_EDITOR,
2754
- value: richTextDAOToDTO(editor.children, editor.selection)
2755
- });
2756
- const _onChange = editor.onChange;
2757
- this.editor.onChange = (options) => {
2758
- _onChange(options);
2759
- if ((options == null ? void 0 : options.operation) != null) {
2760
- this.send({
2761
- type: RichTextControlMessageType.CHANGE_EDITOR_VALUE,
2762
- value: richTextDAOToDTO(editor.children, editor.selection)
2763
- });
2764
- }
2765
- };
2766
- }
2767
- focus() {
2768
- this.send({ type: RichTextControlMessageType.FOCUS });
2769
- }
2770
- blur() {
2771
- this.send({ type: RichTextControlMessageType.BLUR });
2772
- }
2773
- undo() {
2774
- this.send({ type: RichTextControlMessageType.UNDO });
2775
- }
2776
- redo() {
2777
- this.send({ type: RichTextControlMessageType.REDO });
2778
- }
2779
- changeBoxModel(boxModel) {
2780
- this.send({ type: RichTextControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
2781
- }
2782
- }
2783
- const Types = {
2784
- Backgrounds: "Backgrounds",
2785
- Border: "Border",
2786
- BorderRadius: "BorderRadius",
2787
- Checkbox: "Checkbox",
2788
- Date: "Date",
2789
- ElementID: "ElementID",
2790
- Font: "Font",
2791
- GapX: "GapX",
2792
- GapY: "GapY",
2793
- Grid: "Grid",
2794
- Image: "Image",
2795
- Images: "Images",
2796
- Link: "Link",
2797
- List: "List",
2798
- Margin: "Margin",
2799
- NavigationLinks: "NavigationLinks",
2800
- Number: "Number",
2801
- Padding: "Padding",
2802
- ResponsiveColor: "ResponsiveColor",
2803
- ResponsiveIconRadioGroup: "ResponsiveIconRadioGroup",
2804
- ResponsiveLength: "ResponsiveLength",
2805
- ResponsiveNumber: "ResponsiveNumber",
2806
- ResponsiveOpacity: "ResponsiveOpacity",
2807
- ResponsiveSelect: "ResponsiveSelect",
2808
- RichText: "RichText",
2809
- Shadows: "Shadows",
2810
- Shape: "Shape",
2811
- SocialLinks: "SocialLinks",
2812
- Table: "Table",
2813
- TableFormFields: "TableFormFields",
2814
- Typeahead: "Typeahead",
2815
- TextArea: "TextArea",
2816
- TextInput: "TextInput",
2817
- TextStyle: "TextStyle",
2818
- Video: "Video",
2819
- Width: "Width",
2820
- Style: StyleControlType
2821
- };
2822
- function Backgrounds(options = {}) {
2823
- return { type: Types.Backgrounds, options };
2824
- }
2825
- const BorderPropControllerFormat = {
2826
- ClassName: "makeswift::prop-controllers::border::format::class-name",
2827
- ResponsiveValue: "makeswift::prop-controllers:border::format::responsive-value"
2828
- };
2829
- function Border(options = {}) {
2830
- return { type: Types.Border, options };
2831
- }
2832
- Border.Format = BorderPropControllerFormat;
2833
- const BorderRadiusPropControllerFormat = {
2834
- ClassName: "makeswift::prop-controllers::border-radius::format::class-name",
2835
- ResponsiveValue: "makeswift::prop-controllers::border-radius::format::responsive-value"
2836
- };
2837
- function BorderRadius(options = {}) {
2838
- return { type: Types.BorderRadius, options };
2839
- }
2840
- BorderRadius.Format = BorderRadiusPropControllerFormat;
2841
- function Checkbox(options) {
2842
- return { type: Types.Checkbox, options };
2843
- }
2844
- function Date(options = {}) {
2845
- return { type: Types.Date, options };
2846
- }
2847
- function ElementID(options = {}) {
2848
- return { type: Types.ElementID, options };
2849
- }
2850
- function Font(options = {}) {
2851
- return { type: Types.Font, options };
2852
- }
2853
- function GapX(options = {}) {
2854
- return { type: Types.GapX, options };
2855
- }
2856
- function GapY(options = {}) {
2857
- return { type: Types.GapY, options };
2858
- }
2859
- function Grid(options = {}) {
2860
- return { type: Types.Grid, options };
2861
- }
2862
- function Image(options = {}) {
2863
- return { type: Types.Image, options };
2864
- }
2865
- function Images(options = {}) {
2866
- return { type: Types.Images, options };
2867
- }
2868
- function Link(options = {}) {
2869
- return { type: Types.Link, options };
2870
- }
2871
- function List(options) {
2872
- return { type: Types.List, options };
2873
- }
2874
- const MarginPropControllerFormat = {
2875
- ClassName: "makeswift::prop-controllers::margin::format::class-name",
2876
- ResponsiveValue: "makeswift::prop-controllers::margin::format::responsive-value"
2877
- };
2878
- function Margin(options = {}) {
2879
- return { type: Types.Margin, options };
2880
- }
2881
- Margin.Format = MarginPropControllerFormat;
2882
- function NavigationLinks(options = {}) {
2883
- return { type: Types.NavigationLinks, options };
2884
- }
2885
- function Number(options = {}) {
2886
- return { type: Types.Number, options };
2887
- }
2888
- const PaddingPropControllerFormat = {
2889
- ClassName: "makeswift::prop-controllers::padding::format::class-name",
2890
- ResponsiveValue: "makeswift::prop-controllers::padding::format::responsive-value"
2891
- };
2892
- function Padding(options = {}) {
2893
- return { type: Types.Padding, options };
2894
- }
2895
- Padding.Format = PaddingPropControllerFormat;
2896
- function ResponsiveColor(options = {}) {
2897
- return { type: Types.ResponsiveColor, options };
2898
- }
2899
- function ResponsiveIconRadioGroup(options) {
2900
- return { type: Types.ResponsiveIconRadioGroup, options };
2901
- }
2902
- function ResponsiveLength(options = {}) {
2903
- return { type: Types.ResponsiveLength, options };
2904
- }
2905
- function ResponsiveNumber(options = {}) {
2906
- return { type: Types.ResponsiveNumber, options };
2907
- }
2908
- function ResponsiveOpacity(options = {}) {
2909
- return { type: Types.ResponsiveOpacity, options };
2910
- }
2911
- function ResponsiveSelect(options) {
2912
- return { type: Types.ResponsiveSelect, options };
2913
- }
2914
- function RichText(options = {}) {
2915
- return { type: Types.RichText, options };
2916
- }
2917
- const ShadowsPropControllerFormat = {
2918
- ClassName: "makeswift::prop-controllers::shadows::format::class-name",
2919
- ResponsiveValue: "makeswift::prop-controllers::shadows::format::responsive-value"
2920
- };
2921
- function Shadows(options = {}) {
2922
- return { type: Types.Shadows, options };
2923
- }
2924
- Shadows.Format = ShadowsPropControllerFormat;
2925
- function Shape(options) {
2926
- return { type: Types.Shape, options };
2927
- }
2928
- function SocialLinks(options = {}) {
2929
- return { type: Types.SocialLinks, options };
2930
- }
2931
- function Table(options = {}) {
2932
- return { type: Types.Table, options };
2933
- }
2934
- function TableFormFields(options = {}) {
2935
- return { type: Types.TableFormFields, options };
2133
+ if (selection == null)
2134
+ return void 0;
2135
+ return {
2136
+ isFocused: false,
2137
+ marks: void 0,
2138
+ object: "selection",
2139
+ anchor: {
2140
+ offset: selection.anchor.offset,
2141
+ path: selection.anchor.path,
2142
+ object: "point"
2143
+ },
2144
+ focus: {
2145
+ offset: selection.focus.offset,
2146
+ path: selection.focus.path,
2147
+ object: "point"
2148
+ }
2149
+ };
2936
2150
  }
2937
- function Typeahead(options) {
2938
- return { type: Types.Typeahead, options };
2151
+ function richTextDAOToDTO(children, selection) {
2152
+ return {
2153
+ document: {
2154
+ data: void 0,
2155
+ nodes: children.flatMap(toNodeDTO),
2156
+ object: "document"
2157
+ },
2158
+ object: "value",
2159
+ selection: toSelectionDTO(selection),
2160
+ annotations: void 0,
2161
+ data: void 0
2162
+ };
2939
2163
  }
2940
- function TextArea(options = {}) {
2941
- return { type: Types.TextArea, options };
2164
+ const RichTextControlType = "makeswift::controls::rich-text";
2165
+ function RichText() {
2166
+ return { type: RichTextControlType };
2942
2167
  }
2943
- function TextInput(options = {}) {
2944
- return { type: Types.TextInput, options };
2168
+ const RichTextControlMessageType = {
2169
+ CHANGE_BUILDER_EDIT_MODE: "CHANGE_BUILDER_EDIT_MODE",
2170
+ INITIALIZE_EDITOR: "INITIALIZE_EDITOR",
2171
+ CHANGE_EDITOR_VALUE: "CHANGE_EDITOR_VALUE",
2172
+ FOCUS: "FOCUS",
2173
+ BLUR: "BLUR",
2174
+ UNDO: "UNDO",
2175
+ REDO: "REDO",
2176
+ CHANGE_BOX_MODEL: "CHANGE_BOX_MODEL"
2177
+ };
2178
+ class RichTextControl extends PropController {
2179
+ constructor() {
2180
+ super(...arguments);
2181
+ __publicField(this, "editor", null);
2182
+ __publicField(this, "recv", (message) => {
2183
+ if (!this.editor)
2184
+ return;
2185
+ switch (message.type) {
2186
+ case RichTextControlMessageType.CHANGE_BUILDER_EDIT_MODE: {
2187
+ switch (message.editMode) {
2188
+ case BuilderEditMode.BUILD:
2189
+ case BuilderEditMode.INTERACT:
2190
+ this.editor.deselectAndBlur();
2191
+ }
2192
+ break;
2193
+ }
2194
+ case RichTextControlMessageType.FOCUS: {
2195
+ this.editor.focusAndSelectAll();
2196
+ break;
2197
+ }
2198
+ }
2199
+ });
2200
+ }
2201
+ setSlateEditor(editor) {
2202
+ this.editor = editor;
2203
+ this.send({
2204
+ type: RichTextControlMessageType.INITIALIZE_EDITOR,
2205
+ value: richTextDAOToDTO(editor.children, editor.selection)
2206
+ });
2207
+ const _onChange = editor.onChange;
2208
+ this.editor.onChange = (options) => {
2209
+ _onChange(options);
2210
+ if ((options == null ? void 0 : options.operation) != null) {
2211
+ this.send({
2212
+ type: RichTextControlMessageType.CHANGE_EDITOR_VALUE,
2213
+ value: richTextDAOToDTO(editor.children, editor.selection)
2214
+ });
2215
+ }
2216
+ };
2217
+ }
2218
+ focus() {
2219
+ this.send({ type: RichTextControlMessageType.FOCUS });
2220
+ }
2221
+ blur() {
2222
+ this.send({ type: RichTextControlMessageType.BLUR });
2223
+ }
2224
+ undo() {
2225
+ this.send({ type: RichTextControlMessageType.UNDO });
2226
+ }
2227
+ redo() {
2228
+ this.send({ type: RichTextControlMessageType.REDO });
2229
+ }
2230
+ changeBoxModel(boxModel) {
2231
+ this.send({ type: RichTextControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
2232
+ }
2945
2233
  }
2946
- function TextStyle(options = {}) {
2947
- return { type: Types.TextStyle, options };
2234
+ const RichTextV2ControlType = "makeswift::controls::rich-text-v2";
2235
+ const RichTextV2Mode = {
2236
+ Inline: "makeswift::controls::rich-text-v2::mode::inline",
2237
+ Block: "makeswift::controls::rich-text-v2::mode::block"
2238
+ };
2239
+ function createRichTextV2Plugin({
2240
+ control,
2241
+ withPlugin,
2242
+ onKeyDown,
2243
+ renderElement,
2244
+ renderLeaf
2245
+ }) {
2246
+ return { control, withPlugin, onKeyDown, renderElement, renderLeaf };
2948
2247
  }
2949
- function Video(options = {}) {
2950
- return { type: Types.Video, options };
2248
+ function unstable_RichTextV2(config = {}) {
2249
+ return { type: RichTextV2ControlType, config };
2951
2250
  }
2952
- const WidthPropControllerFormat = {
2953
- ClassName: "makeswift::prop-controllers::width::format::class-name",
2954
- ResponsiveValue: "makeswift::prop-controllers::width::format::responsive-value"
2251
+ const RichTextV2ControlMessageType = {
2252
+ RESET_VALUE: "RESET_VALUE",
2253
+ FOCUS: "FOCUS",
2254
+ RUN_PLUGIN_CONTROL_ACTION: "RUN_PLUGIN_CONTROL_ACTION",
2255
+ SET_DEFAULT_VALUE: "SET_DEFAULT_VALUE",
2256
+ SET_PLUGIN_CONTROL_VALUE: "SET_PLUGIN_CONTROL_VALUE",
2257
+ ON_CHANGE: "ON_CHANGE",
2258
+ SELECT: "SELECT",
2259
+ SWITCH_TO_BUILD_MODE: "SWITCH_TO_BUILD_MODE",
2260
+ CHANGE_BOX_MODEL: "CHANGE_BOX_MODEL"
2955
2261
  };
2956
- function Width(options = {}) {
2957
- return { type: Types.Width, options };
2262
+ class RichTextV2Control extends PropController {
2263
+ constructor(send, descriptor) {
2264
+ super(send);
2265
+ __publicField(this, "editor", null);
2266
+ __publicField(this, "defaultValue", null);
2267
+ __publicField(this, "descriptor");
2268
+ __publicField(this, "recv", (message) => {
2269
+ var _a2, _b, _c;
2270
+ if (!this.editor)
2271
+ return;
2272
+ switch (message.type) {
2273
+ case RichTextV2ControlMessageType.FOCUS: {
2274
+ this.editor.focusAndSelectAll();
2275
+ break;
2276
+ }
2277
+ case RichTextV2ControlMessageType.RESET_VALUE: {
2278
+ if (this.defaultValue) {
2279
+ this.editor.selection = null;
2280
+ this.editor.children = this.defaultValue;
2281
+ this.editor.onChange();
2282
+ }
2283
+ break;
2284
+ }
2285
+ case RichTextV2ControlMessageType.RUN_PLUGIN_CONTROL_ACTION: {
2286
+ (_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);
2287
+ break;
2288
+ }
2289
+ }
2290
+ });
2291
+ this.descriptor = descriptor;
2292
+ this.send = send;
2293
+ }
2294
+ setEditor(editor) {
2295
+ var _a2, _b, _c;
2296
+ this.editor = editor;
2297
+ this.send({
2298
+ type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
2299
+ value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
2300
+ var _a3;
2301
+ return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
2302
+ })) != null ? _c : []
2303
+ });
2304
+ }
2305
+ setDefaultValue(defaultValue) {
2306
+ this.defaultValue = defaultValue;
2307
+ this.send({ type: RichTextV2ControlMessageType.SET_DEFAULT_VALUE, value: defaultValue });
2308
+ }
2309
+ select() {
2310
+ this.send({ type: RichTextV2ControlMessageType.SELECT });
2311
+ }
2312
+ switchToBuildMode() {
2313
+ this.send({ type: RichTextV2ControlMessageType.SWITCH_TO_BUILD_MODE });
2314
+ }
2315
+ onChange(value) {
2316
+ var _a2, _b, _c;
2317
+ const editor = this.editor;
2318
+ if (editor == null)
2319
+ return;
2320
+ this.send({
2321
+ type: RichTextV2ControlMessageType.ON_CHANGE,
2322
+ value
2323
+ });
2324
+ this.send({
2325
+ type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
2326
+ value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
2327
+ var _a3;
2328
+ return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
2329
+ })) != null ? _c : []
2330
+ });
2331
+ }
2332
+ changeBoxModel(boxModel) {
2333
+ this.send({ type: RichTextV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
2334
+ }
2958
2335
  }
2959
- Width.Format = WidthPropControllerFormat;
2960
- var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2961
- __proto__: null,
2962
- Types,
2963
- Backgrounds,
2964
- BorderPropControllerFormat,
2965
- Border,
2966
- BorderRadiusPropControllerFormat,
2967
- BorderRadius,
2968
- Checkbox,
2969
- Date,
2970
- ElementID,
2971
- Font,
2972
- GapX,
2973
- GapY,
2974
- Grid,
2975
- Image,
2976
- Images,
2977
- Link,
2978
- List,
2979
- MarginPropControllerFormat,
2980
- Margin,
2981
- NavigationLinks,
2982
- Number,
2983
- PaddingPropControllerFormat,
2984
- Padding,
2985
- ResponsiveColor,
2986
- ResponsiveIconRadioGroup,
2987
- ResponsiveLength,
2988
- ResponsiveNumber,
2989
- ResponsiveOpacity,
2990
- ResponsiveSelect,
2991
- RichText,
2992
- ShadowsPropControllerFormat,
2993
- Shadows,
2994
- Shape,
2995
- SocialLinks,
2996
- Table,
2997
- TableFormFields,
2998
- Typeahead,
2999
- TextArea,
3000
- TextInput,
3001
- TextStyle,
3002
- Video,
3003
- WidthPropControllerFormat,
3004
- Width
3005
- }, Symbol.toStringTag, { value: "Module" }));
3006
2336
  function isNonNullable(value) {
3007
2337
  return value != null;
3008
2338
  }
@@ -3131,6 +2461,39 @@ function getElementSwatchIds(descriptor, prop) {
3131
2461
  const value = prop;
3132
2462
  return (value == null ? void 0 : value.swatchId) == null ? [] : [value.swatchId];
3133
2463
  }
2464
+ case StyleV2ControlType: {
2465
+ const value = prop;
2466
+ return value.flatMap((value2) => getElementSwatchIds(descriptor.config.type, value2.value));
2467
+ }
2468
+ case RichTextV2ControlType: {
2469
+ let getDescendantSwatchIds = function(descendant) {
2470
+ if (Element.isElement(descendant)) {
2471
+ return [
2472
+ ...getSlateElementSwatchIds(descendant),
2473
+ ...descendant.children.flatMap((d) => getDescendantSwatchIds(d))
2474
+ ];
2475
+ }
2476
+ if (Text.isText(descendant)) {
2477
+ return getTextSwatchIds(descendant);
2478
+ }
2479
+ return [];
2480
+ }, getSlateElementSwatchIds = function(descendant) {
2481
+ var _a3;
2482
+ return (_a3 = plugins == null ? void 0 : plugins.flatMap((plugin) => {
2483
+ var _a4;
2484
+ return ((_a4 = plugin.control) == null ? void 0 : _a4.definition) && plugin.control.getElementValue ? getElementSwatchIds(plugin.control.definition, plugin.control.getElementValue(descendant)) : [];
2485
+ })) != null ? _a3 : [];
2486
+ }, getTextSwatchIds = function(text) {
2487
+ var _a3;
2488
+ return (_a3 = plugins == null ? void 0 : plugins.flatMap((plugin) => {
2489
+ var _a4;
2490
+ return ((_a4 = plugin.control) == null ? void 0 : _a4.definition) && plugin.control.getLeafValue ? getElementSwatchIds(plugin.control.definition, plugin.control.getLeafValue(text)) : [];
2491
+ })) != null ? _a3 : [];
2492
+ };
2493
+ const descendants = prop;
2494
+ const plugins = descriptor.config.plugins;
2495
+ return descendants.flatMap((d) => getDescendantSwatchIds(d));
2496
+ }
3134
2497
  default:
3135
2498
  return [];
3136
2499
  }
@@ -3483,5 +2846,5 @@ function configureStore({
3483
2846
  locales: getInitialState(locales != null ? locales : preloadedState == null ? void 0 : preloadedState.locales)
3484
2847
  }), applyMiddleware(thunk));
3485
2848
  }
3486
- export { isNonNullable as $, ResponsiveLength as A, Backgrounds as B, ComponentIcon as C, Date as D, ElementID as E, Font as F, GapY as G, TextArea as H, Images as I, Table as J, TableFormFields as K, ListControlType as L, Margin as M, Number as N, Image as O, Padding as P, ResponsiveOpacity as Q, RichTextPropControllerMessageType as R, ShapeControlType as S, TableFormFieldsMessageType as T, NavigationLinks as U, SocialLinks as V, Width as W, RichText as X, Video as Y, useStyle as Z, getBorderSwatchIds as _, createDocumentReference as a, ObjectType as a$, getBoxShadowsSwatchIds as a0, getResponsiveColorSwatchIds as a1, StyleControlProperty as a2, ImageControlValueFormat as a3, isPropControllersHandle as a4, StyleV2ControlType as a5, StyleControlType as a6, RichTextV2ControlType as a7, RichTextControlType as a8, SlotControlType as a9, merge as aA, Image$1 as aB, copyImageData as aC, Link$1 as aD, copyLinkData as aE, List$1 as aF, ListControlMessageType as aG, ListControl as aH, copyListData as aI, Select as aJ, Shape$1 as aK, ShapeControlMessageType as aL, ShapeControl as aM, copyShapeData as aN, Slot as aO, SlotControlMessageType as aP, SlotControl as aQ, copySlotData as aR, mergeSlotData as aS, Style as aT, StyleControlMessageType as aU, StyleControl as aV, copyStyleData as aW, unstable_useStyleV2ClassName as aX, unstable_StyleV2 as aY, StyleV2ControlMessageType as aZ, StyleV2Control as a_, LinkControlType as aa, ImageControlType as ab, ColorControlType as ac, SelectControlType as ad, getComponentPropControllerDescriptors as ae, getPropControllers as af, BorderPropControllerFormat as ag, ShadowsPropControllerFormat as ah, BorderRadiusPropControllerFormat as ai, MarginPropControllerFormat as aj, PaddingPropControllerFormat as ak, WidthPropControllerFormat as al, configureStore as am, copyElementTree as an, getBreakpoints as ao, getDocument as ap, getElementId as aq, getIsPreview as ar, getIsInBuilder as as, getReactComponent as at, getBuilderEditMode as au, getBackgroundsFileIds as av, getBackgroundsSwatchIds as aw, Color as ax, copyColorData as ay, copy as az, isElementReference as b, RichText$1 as b0, RichTextControlMessageType as b1, RichTextControl as b2, richTextDTOtoSelection as b3, richTextDTOtoDAO as b4, toSelectionDTO as b5, richTextDAOToDTO as b6, RichTextV2Mode as b7, createRichTextV2Plugin as b8, unstable_RichTextV2 as b9, reducer$7 as bA, reducer$9 as bB, reducer$6 as bC, reducer$5 as bD, reducer$4 as bE, reducer$3 as bF, reducer$2 as bG, reducer$1 as bH, getInitialState$2 as bI, RichTextV2ControlMessageType as ba, RichTextV2Control as bb, getBlocksInSelection as bc, ElementUtils as bd, BlockActions as be, ListActions as bf, onKeyDown as bg, withBlock as bh, BlockPlugin as bi, RootBlockType as bj, BlockType as bk, InlineType as bl, BlockTextAlignment as bm, getInitialState$7 as bn, reducer$8 as bo, getDocument$1 as bp, getComponentsMeta as bq, getComponentPropControllerDescriptors$1 as br, getLocales as bs, BuilderEditMode as bt, getDocumentKeysSortedByDepth as bu, getPropController as bv, getPropControllersHandle as bw, getElement as bx, getElementPropControllerDescriptors as by, createPropController as bz, createDocument as c, descriptors as d, getElementSwatchIds as e, getFileIds as f, getPropControllerDescriptors as g, getTypographyIds as h, introspection as i, getTableIds as j, getPageIds as k, getElementChildren as l, Types as m, ResponsiveIconRadioGroup as n, Border as o, BorderRadius as p, Shadows as q, GapX as r, ResponsiveSelect as s, ResponsiveNumber as t, Checkbox as u, Grid as v, TextInput as w, Link as x, ResponsiveColor as y, TextStyle as z };
2849
+ export { isNonNullable as $, ResponsiveLength as A, Backgrounds as B, ComponentIcon as C, Date as D, ElementID as E, Font as F, GapY as G, TextArea as H, Images as I, Table as J, TableFormFields as K, ListControlType as L, Margin as M, Number as N, Image$1 as O, Padding as P, ResponsiveOpacity as Q, RichTextPropControllerMessageType as R, ShapeControlType as S, TableFormFieldsMessageType as T, NavigationLinks as U, SocialLinks as V, Width as W, RichText$1 as X, Video as Y, useStyle as Z, getBorderSwatchIds as _, createDocumentReference as a, RichTextControlMessageType as a$, getBoxShadowsSwatchIds as a0, getResponsiveColorSwatchIds as a1, StyleControlProperty as a2, ImageControlValueFormat as a3, isPropControllersHandle as a4, StyleControlType as a5, RichTextV2ControlType as a6, RichTextControlType as a7, SlotControlType as a8, StyleV2ControlType as a9, Image as aA, copyImageData as aB, Link as aC, copyLinkData as aD, List as aE, ListControlMessageType as aF, ListControl as aG, copyListData as aH, Shape as aI, ShapeControlMessageType as aJ, ShapeControl as aK, copyShapeData as aL, Slot as aM, SlotControlMessageType as aN, SlotControl as aO, copySlotData as aP, mergeSlotData as aQ, Style as aR, StyleControlMessageType as aS, StyleControl as aT, copyStyleData as aU, unstable_useStyleV2ClassName as aV, unstable_StyleV2 as aW, StyleV2ControlMessageType as aX, StyleV2Control as aY, ObjectType as aZ, RichText as a_, LinkControlType as aa, ImageControlType as ab, ColorControlType as ac, getComponentPropControllerDescriptors as ad, getPropControllers as ae, BorderPropControllerFormat as af, ShadowsPropControllerFormat as ag, BorderRadiusPropControllerFormat as ah, MarginPropControllerFormat as ai, PaddingPropControllerFormat as aj, WidthPropControllerFormat as ak, configureStore as al, copyElementTree as am, getBreakpoints as an, getDocument as ao, getElementId as ap, getIsPreview as aq, getIsInBuilder as ar, getReactComponent as as, getBuilderEditMode as at, getBackgroundsFileIds as au, getBackgroundsSwatchIds as av, Color as aw, copyColorData as ax, copy as ay, merge as az, isElementReference as b, RichTextControl as b0, richTextDTOtoSelection as b1, richTextDTOtoDAO as b2, toSelectionDTO as b3, richTextDAOToDTO as b4, RichTextV2Mode as b5, createRichTextV2Plugin as b6, unstable_RichTextV2 as b7, RichTextV2ControlMessageType as b8, RichTextV2Control as b9, InlineType as ba, RootBlockType as bb, BlockType as bc, BlockTextAlignment as bd, getInitialState$7 as be, reducer$8 as bf, getDocument$1 as bg, getComponentsMeta as bh, getComponentPropControllerDescriptors$1 as bi, getLocales as bj, BuilderEditMode as bk, getDocumentKeysSortedByDepth as bl, getPropController as bm, getPropControllersHandle as bn, getElement as bo, getElementPropControllerDescriptors as bp, createPropController as bq, reducer$7 as br, reducer$9 as bs, reducer$6 as bt, reducer$5 as bu, reducer$4 as bv, reducer$3 as bw, reducer$2 as bx, reducer$1 as by, getInitialState$2 as bz, createDocument as c, descriptors as d, getElementSwatchIds as e, getFileIds as f, getPropControllerDescriptors as g, getTypographyIds as h, introspection as i, getTableIds as j, getPageIds as k, getElementChildren as l, Types as m, ResponsiveIconRadioGroup as n, Border as o, BorderRadius as p, Shadows as q, GapX as r, ResponsiveSelect as s, ResponsiveNumber as t, Checkbox as u, Grid as v, TextInput as w, Link$1 as x, ResponsiveColor as y, TextStyle as z };
3487
2850
  //# sourceMappingURL=react-page.es.js.map