@makeswift/runtime 0.8.11 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/dist/Box.cjs.js +16 -15
  2. package/dist/Box.cjs.js.map +1 -1
  3. package/dist/Box.es.js +11 -10
  4. package/dist/Box.es.js.map +1 -1
  5. package/dist/Button.cjs.js +13 -12
  6. package/dist/Button.cjs.js.map +1 -1
  7. package/dist/Button.es.js +11 -10
  8. package/dist/Button.es.js.map +1 -1
  9. package/dist/Carousel.cjs.js +28 -27
  10. package/dist/Carousel.cjs.js.map +1 -1
  11. package/dist/Carousel.es.js +7 -6
  12. package/dist/Carousel.es.js.map +1 -1
  13. package/dist/Countdown.cjs.js +16 -15
  14. package/dist/Countdown.cjs.js.map +1 -1
  15. package/dist/Countdown.es.js +8 -7
  16. package/dist/Countdown.es.js.map +1 -1
  17. package/dist/Divider.cjs.js +13 -12
  18. package/dist/Divider.cjs.js.map +1 -1
  19. package/dist/Divider.es.js +11 -10
  20. package/dist/Divider.es.js.map +1 -1
  21. package/dist/Embed.cjs.js +4 -29
  22. package/dist/Embed.cjs.js.map +1 -1
  23. package/dist/Embed.es.js +3 -28
  24. package/dist/Embed.es.js.map +1 -1
  25. package/dist/Form.cjs.js +52 -51
  26. package/dist/Form.cjs.js.map +1 -1
  27. package/dist/Form.es.js +8 -7
  28. package/dist/Form.es.js.map +1 -1
  29. package/dist/Image.cjs.js +9 -8
  30. package/dist/Image.cjs.js.map +1 -1
  31. package/dist/Image.es.js +8 -7
  32. package/dist/Image.es.js.map +1 -1
  33. package/dist/LiveProvider.cjs.js +6 -5
  34. package/dist/LiveProvider.cjs.js.map +1 -1
  35. package/dist/LiveProvider.es.js +8 -7
  36. package/dist/LiveProvider.es.js.map +1 -1
  37. package/dist/Navigation.cjs.js +28 -27
  38. package/dist/Navigation.cjs.js.map +1 -1
  39. package/dist/Navigation.es.js +7 -6
  40. package/dist/Navigation.es.js.map +1 -1
  41. package/dist/PreviewProvider.cjs.js +23 -7
  42. package/dist/PreviewProvider.cjs.js.map +1 -1
  43. package/dist/PreviewProvider.es.js +24 -8
  44. package/dist/PreviewProvider.es.js.map +1 -1
  45. package/dist/ReadOnlyText.cjs.js +22 -20
  46. package/dist/ReadOnlyText.cjs.js.map +1 -1
  47. package/dist/ReadOnlyText.es.js +18 -16
  48. package/dist/ReadOnlyText.es.js.map +1 -1
  49. package/dist/ReadOnlyTextV2.cjs.js +19 -17
  50. package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
  51. package/dist/ReadOnlyTextV2.es.js +16 -14
  52. package/dist/ReadOnlyTextV2.es.js.map +1 -1
  53. package/dist/Root.cjs.js +8 -7
  54. package/dist/Root.cjs.js.map +1 -1
  55. package/dist/Root.es.js +6 -5
  56. package/dist/Root.es.js.map +1 -1
  57. package/dist/SocialLinks.cjs.js +15 -14
  58. package/dist/SocialLinks.cjs.js.map +1 -1
  59. package/dist/SocialLinks.es.js +11 -10
  60. package/dist/SocialLinks.es.js.map +1 -1
  61. package/dist/Text.cjs.js +5 -4
  62. package/dist/Text.cjs.js.map +1 -1
  63. package/dist/Text.es.js +6 -5
  64. package/dist/Text.es.js.map +1 -1
  65. package/dist/Video.cjs.js +4 -29
  66. package/dist/Video.cjs.js.map +1 -1
  67. package/dist/Video.es.js +3 -28
  68. package/dist/Video.es.js.map +1 -1
  69. package/dist/actions.cjs.js +16 -1
  70. package/dist/actions.cjs.js.map +1 -1
  71. package/dist/actions.es.js +14 -2
  72. package/dist/actions.es.js.map +1 -1
  73. package/dist/builder.cjs.js +5 -0
  74. package/dist/builder.cjs.js.map +1 -1
  75. package/dist/builder.es.js +5 -0
  76. package/dist/builder.es.js.map +1 -1
  77. package/dist/components.cjs.js +10 -9
  78. package/dist/components.cjs.js.map +1 -1
  79. package/dist/components.es.js +10 -9
  80. package/dist/components.es.js.map +1 -1
  81. package/dist/control-serialization.cjs.js +89 -10
  82. package/dist/control-serialization.cjs.js.map +1 -1
  83. package/dist/control-serialization.es.js +90 -11
  84. package/dist/control-serialization.es.js.map +1 -1
  85. package/dist/controls.cjs.js +12 -3
  86. package/dist/controls.cjs.js.map +1 -1
  87. package/dist/controls.es.js +6 -2
  88. package/dist/controls.es.js.map +1 -1
  89. package/dist/deepEqual.cjs.js +40 -0
  90. package/dist/deepEqual.cjs.js.map +1 -0
  91. package/dist/deepEqual.es.js +39 -0
  92. package/dist/deepEqual.es.js.map +1 -0
  93. package/dist/index.cjs.js +298 -292
  94. package/dist/index.cjs.js.map +1 -1
  95. package/dist/index.cjs10.js +18 -16
  96. package/dist/index.cjs10.js.map +1 -1
  97. package/dist/index.cjs2.js +14 -14
  98. package/dist/index.cjs2.js.map +1 -1
  99. package/dist/index.cjs4.js +2 -1
  100. package/dist/index.cjs4.js.map +1 -1
  101. package/dist/index.cjs5.js +0 -522
  102. package/dist/index.cjs5.js.map +1 -1
  103. package/dist/index.cjs6.js +1 -2
  104. package/dist/index.cjs6.js.map +1 -1
  105. package/dist/index.cjs7.js +0 -52
  106. package/dist/index.cjs7.js.map +1 -1
  107. package/dist/index.cjs8.js +5 -4
  108. package/dist/index.cjs8.js.map +1 -1
  109. package/dist/index.cjs9.js +72 -69
  110. package/dist/index.cjs9.js.map +1 -1
  111. package/dist/index.es.js +282 -275
  112. package/dist/index.es.js.map +1 -1
  113. package/dist/index.es10.js +16 -14
  114. package/dist/index.es10.js.map +1 -1
  115. package/dist/index.es2.js +3 -3
  116. package/dist/index.es3.js +1 -1
  117. package/dist/index.es4.js +2 -1
  118. package/dist/index.es4.js.map +1 -1
  119. package/dist/index.es5.js +2 -514
  120. package/dist/index.es5.js.map +1 -1
  121. package/dist/index.es6.js +1 -2
  122. package/dist/index.es6.js.map +1 -1
  123. package/dist/index.es7.js +2 -53
  124. package/dist/index.es7.js.map +1 -1
  125. package/dist/index.es8.js +5 -4
  126. package/dist/index.es8.js.map +1 -1
  127. package/dist/index.es9.js +74 -71
  128. package/dist/index.es9.js.map +1 -1
  129. package/dist/leaf.cjs.js +1 -1
  130. package/dist/leaf.cjs.js.map +1 -1
  131. package/dist/leaf.es.js +2 -2
  132. package/dist/main.cjs.js +8 -0
  133. package/dist/main.cjs.js.map +1 -1
  134. package/dist/main.es.js +7 -2
  135. package/dist/main.es.js.map +1 -1
  136. package/dist/next.cjs.js +5 -4
  137. package/dist/next.cjs.js.map +1 -1
  138. package/dist/next.es.js +6 -5
  139. package/dist/next.es.js.map +1 -1
  140. package/dist/prop-controllers.cjs.js +5 -0
  141. package/dist/prop-controllers.cjs.js.map +1 -1
  142. package/dist/prop-controllers.es.js +5 -0
  143. package/dist/prop-controllers.es.js.map +1 -1
  144. package/dist/react-page.cjs.js +1013 -190
  145. package/dist/react-page.cjs.js.map +1 -1
  146. package/dist/react-page.es.js +968 -185
  147. package/dist/react-page.es.js.map +1 -1
  148. package/dist/react.cjs.js +5 -4
  149. package/dist/react.cjs.js.map +1 -1
  150. package/dist/react.es.js +5 -4
  151. package/dist/react.es.js.map +1 -1
  152. package/dist/slate.cjs.js +96 -14
  153. package/dist/slate.cjs.js.map +1 -1
  154. package/dist/slate.es.js +89 -6
  155. package/dist/slate.es.js.map +1 -1
  156. package/dist/types/src/api/graphql/documents/queries.d.ts.map +1 -1
  157. package/dist/types/src/api/graphql/generated/types.d.ts +0 -8
  158. package/dist/types/src/api/graphql/generated/types.d.ts.map +1 -1
  159. package/dist/types/src/builder/serialization/control-serialization.d.ts +3 -3
  160. package/dist/types/src/builder/serialization/control-serialization.d.ts.map +1 -1
  161. package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts +2 -2
  162. package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts.map +1 -1
  163. package/dist/types/src/builder/serialization/controls/style-v2.d.ts +5 -0
  164. package/dist/types/src/builder/serialization/controls/style-v2.d.ts.map +1 -0
  165. package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
  166. package/dist/types/src/components/builtin/Carousel/register.d.ts.map +1 -1
  167. package/dist/types/src/components/builtin/Countdown/register.d.ts.map +1 -1
  168. package/dist/types/src/components/builtin/Divider/register.d.ts.map +1 -1
  169. package/dist/types/src/components/builtin/Embed/register.d.ts.map +1 -1
  170. package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
  171. package/dist/types/src/components/builtin/Form/register.d.ts.map +1 -1
  172. package/dist/types/src/components/builtin/Navigation/register.d.ts.map +1 -1
  173. package/dist/types/src/components/builtin/SocialLinks/register.d.ts.map +1 -1
  174. package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts.map +1 -1
  175. package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +1 -1
  176. package/dist/types/src/components/builtin/Text/components/Element/block.d.ts.map +1 -1
  177. package/dist/types/src/components/builtin/Video/register.d.ts.map +1 -1
  178. package/dist/types/src/components/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
  179. package/dist/types/src/components/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -1
  180. package/dist/types/src/controls/control.d.ts +3 -2
  181. package/dist/types/src/controls/control.d.ts.map +1 -1
  182. package/dist/types/src/controls/index.d.ts +1 -0
  183. package/dist/types/src/controls/index.d.ts.map +1 -1
  184. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +10 -5
  185. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
  186. package/dist/types/src/controls/style-v2.d.ts +55 -0
  187. package/dist/types/src/controls/style-v2.d.ts.map +1 -0
  188. package/dist/types/src/index.d.ts +2 -1
  189. package/dist/types/src/index.d.ts.map +1 -1
  190. package/dist/types/src/next/api-handler/handlers/manifest.d.ts +3 -1
  191. package/dist/types/src/next/api-handler/handlers/manifest.d.ts.map +1 -1
  192. package/dist/types/src/next/api-handler/handlers/proxy-preview-mode.d.ts.map +1 -1
  193. package/dist/types/src/next/api-handler/index.d.ts +2 -1
  194. package/dist/types/src/next/api-handler/index.d.ts.map +1 -1
  195. package/dist/types/src/next/client.d.ts +7 -7
  196. package/dist/types/src/next/client.d.ts.map +1 -1
  197. package/dist/types/src/next/index.d.ts +8 -5
  198. package/dist/types/src/next/index.d.ts.map +1 -1
  199. package/dist/types/src/next/preview-mode.d.ts +17 -3
  200. package/dist/types/src/next/preview-mode.d.ts.map +1 -1
  201. package/dist/types/src/prop-controllers/descriptors.d.ts +4 -3
  202. package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
  203. package/dist/types/src/prop-controllers/instances.d.ts +2 -2
  204. package/dist/types/src/prop-controllers/instances.d.ts.map +1 -1
  205. package/dist/types/src/runtimes/react/controls/control.d.ts +3 -2
  206. package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
  207. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts +2 -1
  208. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
  209. package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
  210. package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts +1 -1
  211. package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
  212. package/dist/types/src/runtimes/react/controls/style-v2.d.ts +4 -0
  213. package/dist/types/src/runtimes/react/controls/style-v2.d.ts.map +1 -0
  214. package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
  215. package/dist/types/src/runtimes/react/index.d.ts +3 -1
  216. package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
  217. package/dist/types/src/slate/BlockPlugin/constants.d.ts.map +1 -0
  218. package/dist/types/src/slate/BlockPlugin/dedent.d.ts.map +1 -0
  219. package/dist/types/src/slate/BlockPlugin/indent.d.ts.map +1 -0
  220. package/dist/types/src/slate/BlockPlugin/index.d.ts +29 -3
  221. package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
  222. package/dist/types/src/slate/BlockPlugin/toggleList.d.ts.map +1 -0
  223. package/dist/types/src/slate/BlockPlugin/unwrapList.d.ts.map +1 -0
  224. package/dist/types/src/slate/BlockPlugin/utils/filterForSubtreeRoots.d.ts.map +1 -0
  225. package/dist/types/src/slate/BlockPlugin/utils/getSelectedListItems.d.ts.map +1 -0
  226. package/dist/types/src/slate/BlockPlugin/utils/location.d.ts.map +1 -0
  227. package/dist/types/src/slate/BlockPlugin/wrapList.d.ts.map +1 -0
  228. package/dist/types/src/slate/InlineModePlugin/index.d.ts +2 -1
  229. package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
  230. package/dist/types/src/slate/TextAlignPlugin/index.d.ts +9 -0
  231. package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -0
  232. package/dist/types/src/slate/index.d.ts +1 -1
  233. package/dist/types/src/slate/index.d.ts.map +1 -1
  234. package/dist/types/src/slate/types.d.ts +18 -0
  235. package/dist/types/src/slate/types.d.ts.map +1 -1
  236. package/dist/types/src/slate/utils/element.d.ts +1 -2
  237. package/dist/types/src/slate/utils/element.d.ts.map +1 -1
  238. package/dist/types/src/state/actions.d.ts +26 -1
  239. package/dist/types/src/state/actions.d.ts.map +1 -1
  240. package/dist/types/src/state/modules/components-meta.d.ts +25 -1
  241. package/dist/types/src/state/modules/components-meta.d.ts.map +1 -1
  242. package/dist/types/src/state/modules/locales.d.ts +16 -0
  243. package/dist/types/src/state/modules/locales.d.ts.map +1 -0
  244. package/dist/types/src/state/react-builder-preview.d.ts +2 -0
  245. package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
  246. package/dist/types/src/state/react-page.d.ts +5 -1
  247. package/dist/types/src/state/react-page.d.ts.map +1 -1
  248. package/dist/useMediaQuery.es.js +1 -1
  249. package/package.json +6 -3
  250. package/dist/select.cjs.js +0 -8
  251. package/dist/select.cjs.js.map +0 -1
  252. package/dist/select.es.js +0 -6
  253. package/dist/select.es.js.map +0 -1
  254. package/dist/types/src/slate/ListPlugin/constants.d.ts.map +0 -1
  255. package/dist/types/src/slate/ListPlugin/dedent.d.ts.map +0 -1
  256. package/dist/types/src/slate/ListPlugin/indent.d.ts.map +0 -1
  257. package/dist/types/src/slate/ListPlugin/index.d.ts +0 -17
  258. package/dist/types/src/slate/ListPlugin/index.d.ts.map +0 -1
  259. package/dist/types/src/slate/ListPlugin/toggleList.d.ts.map +0 -1
  260. package/dist/types/src/slate/ListPlugin/unwrapList.d.ts.map +0 -1
  261. package/dist/types/src/slate/ListPlugin/utils/filterForSubtreeRoots.d.ts.map +0 -1
  262. package/dist/types/src/slate/ListPlugin/utils/getSelectedListItems.d.ts.map +0 -1
  263. package/dist/types/src/slate/ListPlugin/utils/location.d.ts.map +0 -1
  264. package/dist/types/src/slate/ListPlugin/wrapList.d.ts.map +0 -1
  265. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/constants.d.ts +0 -0
  266. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/dedent.d.ts +0 -0
  267. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/indent.d.ts +0 -0
  268. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/toggleList.d.ts +0 -0
  269. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/unwrapList.d.ts +0 -0
  270. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/utils/filterForSubtreeRoots.d.ts +0 -0
  271. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/utils/getSelectedListItems.d.ts +0 -0
  272. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/utils/location.d.ts +0 -0
  273. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/wrapList.d.ts +0 -0
@@ -22,17 +22,90 @@ var __publicField = (obj, key, value) => {
22
22
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
23
23
  return value;
24
24
  };
25
+ var _a;
25
26
  var redux = require("redux");
26
27
  var thunk = require("redux-thunk");
27
28
  var actions = require("./actions.cjs.js");
28
29
  var state_breakpoints = require("./state/breakpoints.cjs.js");
29
- require("slate");
30
- require("is-hotkey");
30
+ var React = require("react");
31
+ var css = require("@emotion/css");
32
+ var serialize = require("@emotion/serialize");
33
+ var utils = require("@emotion/utils");
34
+ var slate = require("slate");
35
+ var isHotkey = require("is-hotkey");
31
36
  require("slate-react");
37
+ var jsxRuntime = require("react/jsx-runtime");
32
38
  function _interopDefaultLegacy(e) {
33
39
  return e && typeof e === "object" && "default" in e ? e : { "default": e };
34
40
  }
41
+ function _interopNamespace(e) {
42
+ if (e && e.__esModule)
43
+ return e;
44
+ var n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
45
+ if (e) {
46
+ Object.keys(e).forEach(function(k) {
47
+ if (k !== "default") {
48
+ var d = Object.getOwnPropertyDescriptor(e, k);
49
+ Object.defineProperty(n, k, d.get ? d : {
50
+ enumerable: true,
51
+ get: function() {
52
+ return e[k];
53
+ }
54
+ });
55
+ }
56
+ });
57
+ }
58
+ n["default"] = e;
59
+ return Object.freeze(n);
60
+ }
35
61
  var thunk__default = /* @__PURE__ */ _interopDefaultLegacy(thunk);
62
+ var React__namespace = /* @__PURE__ */ _interopNamespace(React);
63
+ var isHotkey__default = /* @__PURE__ */ _interopDefaultLegacy(isHotkey);
64
+ const ComponentIcon = {
65
+ Billing: "billing",
66
+ Bolt: "bolt",
67
+ Button: "button",
68
+ Carousel: "carousel",
69
+ Chats: "chats",
70
+ Code: "code",
71
+ Countdown: "countdown",
72
+ Cube: "cube",
73
+ Database: "database",
74
+ Divider: "divider",
75
+ Form: "form",
76
+ Gallery: "gallery",
77
+ Help: "help",
78
+ Image: "image",
79
+ Layout: "layout",
80
+ Lock: "lock",
81
+ Navigation: "navigation",
82
+ SocialLinks: "social-links",
83
+ Star: "star",
84
+ Text: "text",
85
+ Users: "users",
86
+ Video: "video"
87
+ };
88
+ function getInitialState$8({
89
+ componentsMeta = /* @__PURE__ */ new Map()
90
+ } = {}) {
91
+ return componentsMeta;
92
+ }
93
+ function getComponentsMeta(state) {
94
+ return state;
95
+ }
96
+ function reducer$9(state = getInitialState$8(), action) {
97
+ switch (action.type) {
98
+ case actions.ActionTypes.REGISTER_COMPONENT:
99
+ return new Map(state).set(action.payload.type, action.payload.meta);
100
+ case actions.ActionTypes.UNREGISTER_COMPONENT: {
101
+ const nextState = new Map(state);
102
+ const deleted = nextState.delete(action.payload.type);
103
+ return deleted ? nextState : state;
104
+ }
105
+ default:
106
+ return state;
107
+ }
108
+ }
36
109
  function isElementReference(element) {
37
110
  return !("props" in element);
38
111
  }
@@ -55,8 +128,8 @@ function getDocuments(state) {
55
128
  return state;
56
129
  }
57
130
  function getDocument$1(state, documentKey) {
58
- var _a;
59
- return (_a = getDocuments(state).get(documentKey)) != null ? _a : null;
131
+ var _a2;
132
+ return (_a2 = getDocuments(state).get(documentKey)) != null ? _a2 : null;
60
133
  }
61
134
  function reducer$8(state = getInitialState$7(), action) {
62
135
  switch (action.type) {
@@ -80,8 +153,8 @@ function getReactComponents(state) {
80
153
  return state;
81
154
  }
82
155
  function getReactComponent$1(state, type) {
83
- var _a;
84
- return (_a = getReactComponents(state).get(type)) != null ? _a : null;
156
+ var _a2;
157
+ return (_a2 = getReactComponents(state).get(type)) != null ? _a2 : null;
85
158
  }
86
159
  function reducer$7(state = getInitialState$6(), action) {
87
160
  switch (action.type) {
@@ -97,27 +170,6 @@ function reducer$7(state = getInitialState$6(), action) {
97
170
  }
98
171
  }
99
172
  function getInitialState$5({
100
- componentsMeta = /* @__PURE__ */ new Map()
101
- } = {}) {
102
- return componentsMeta;
103
- }
104
- function getComponentsMeta(state) {
105
- return state;
106
- }
107
- function reducer$6(state = getInitialState$5(), action) {
108
- switch (action.type) {
109
- case actions.ActionTypes.REGISTER_COMPONENT:
110
- return new Map(state).set(action.payload.type, action.payload.meta);
111
- case actions.ActionTypes.UNREGISTER_COMPONENT: {
112
- const nextState = new Map(state);
113
- const deleted = nextState.delete(action.payload.type);
114
- return deleted ? nextState : state;
115
- }
116
- default:
117
- return state;
118
- }
119
- }
120
- function getInitialState$4({
121
173
  propControllerDescriptors = /* @__PURE__ */ new Map()
122
174
  } = {}) {
123
175
  return propControllerDescriptors;
@@ -126,10 +178,10 @@ function getPropControllerDescriptors$1(state) {
126
178
  return state;
127
179
  }
128
180
  function getComponentPropControllerDescriptors$1(state, componentType) {
129
- var _a;
130
- return (_a = getPropControllerDescriptors$1(state).get(componentType)) != null ? _a : null;
181
+ var _a2;
182
+ return (_a2 = getPropControllerDescriptors$1(state).get(componentType)) != null ? _a2 : null;
131
183
  }
132
- function reducer$5(state = getInitialState$4(), action) {
184
+ function reducer$6(state = getInitialState$5(), action) {
133
185
  switch (action.type) {
134
186
  case actions.ActionTypes.REGISTER_COMPONENT:
135
187
  return new Map(state).set(action.payload.type, action.payload.propControllerDescriptors);
@@ -148,28 +200,28 @@ function isPropControllersHandle(value) {
148
200
  }
149
201
  return false;
150
202
  }
151
- function getInitialState$3() {
203
+ function getInitialState$4() {
152
204
  return { handles: /* @__PURE__ */ new Map(), instances: /* @__PURE__ */ new Map() };
153
205
  }
154
206
  function getPropControllersHandle(state, documentKey, elementKey) {
155
- var _a, _b;
156
- return (_b = (_a = state.handles.get(documentKey)) == null ? void 0 : _a.get(elementKey)) != null ? _b : null;
207
+ var _a2, _b;
208
+ return (_b = (_a2 = state.handles.get(documentKey)) == null ? void 0 : _a2.get(elementKey)) != null ? _b : null;
157
209
  }
158
210
  function getPropControllers$1(state, documentKey, elementKey) {
159
- var _a, _b;
160
- return (_b = (_a = state.instances.get(documentKey)) == null ? void 0 : _a.get(elementKey)) != null ? _b : null;
211
+ var _a2, _b;
212
+ return (_b = (_a2 = state.instances.get(documentKey)) == null ? void 0 : _a2.get(elementKey)) != null ? _b : null;
161
213
  }
162
214
  function getPropController(state, documentKey, elementKey, propName) {
163
- var _a, _b;
164
- return (_b = (_a = getPropControllers$1(state, documentKey, elementKey)) == null ? void 0 : _a[propName]) != null ? _b : null;
215
+ var _a2, _b;
216
+ return (_b = (_a2 = getPropControllers$1(state, documentKey, elementKey)) == null ? void 0 : _a2[propName]) != null ? _b : null;
165
217
  }
166
- function reducer$4(state = getInitialState$3(), action) {
167
- var _a, _b, _c, _d;
218
+ function reducer$5(state = getInitialState$4(), action) {
219
+ var _a2, _b, _c, _d;
168
220
  switch (action.type) {
169
221
  case actions.ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE: {
170
222
  const { documentKey, elementKey, handle } = action.payload;
171
223
  return __spreadProps(__spreadValues({}, state), {
172
- handles: new Map(state.handles).set(documentKey, new Map((_a = state.handles.get(documentKey)) != null ? _a : []).set(elementKey, handle))
224
+ handles: new Map(state.handles).set(documentKey, new Map((_a2 = state.handles.get(documentKey)) != null ? _a2 : []).set(elementKey, handle))
173
225
  });
174
226
  }
175
227
  case actions.ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE: {
@@ -194,10 +246,10 @@ function reducer$4(state = getInitialState$3(), action) {
194
246
  return state;
195
247
  }
196
248
  }
197
- function getInitialState$2() {
249
+ function getInitialState$3() {
198
250
  return false;
199
251
  }
200
- function reducer$3(state = getInitialState$2(), action) {
252
+ function reducer$4(state = getInitialState$3(), action) {
201
253
  switch (action.type) {
202
254
  case actions.ActionTypes.SET_IS_IN_BUILDER:
203
255
  return action.payload;
@@ -205,13 +257,13 @@ function reducer$3(state = getInitialState$2(), action) {
205
257
  return state;
206
258
  }
207
259
  }
208
- function getInitialState$1(isPreview = false) {
260
+ function getInitialState$2(isPreview = false) {
209
261
  return isPreview;
210
262
  }
211
263
  function getIsPreview$1(state) {
212
264
  return state;
213
265
  }
214
- function reducer$2(state = getInitialState$1(), action) {
266
+ function reducer$3(state = getInitialState$2(), action) {
215
267
  switch (action.type) {
216
268
  default:
217
269
  return state;
@@ -222,10 +274,10 @@ const BuilderEditMode = {
222
274
  CONTENT: "content",
223
275
  INTERACT: "interact"
224
276
  };
225
- function getInitialState() {
277
+ function getInitialState$1() {
226
278
  return null;
227
279
  }
228
- function reducer$1(state = getInitialState(), action) {
280
+ function reducer$2(state = getInitialState$1(), action) {
229
281
  switch (action.type) {
230
282
  case actions.ActionTypes.SET_BUILDER_EDIT_MODE:
231
283
  return action.payload.editMode;
@@ -233,16 +285,44 @@ function reducer$1(state = getInitialState(), action) {
233
285
  return state;
234
286
  }
235
287
  }
288
+ function getInitialState(initialState) {
289
+ var _a2, _b, _c;
290
+ return {
291
+ locales: (_a2 = initialState == null ? void 0 : initialState.locales) != null ? _a2 : [],
292
+ locale: (_b = initialState == null ? void 0 : initialState.locale) != null ? _b : null,
293
+ defaultLocale: (_c = initialState == null ? void 0 : initialState.defaultLocale) != null ? _c : null
294
+ };
295
+ }
296
+ function reducer$1(state = getInitialState(), action) {
297
+ switch (action.type) {
298
+ case actions.ActionTypes.SET_LOCALES: {
299
+ const locales = action.payload.locales;
300
+ return __spreadProps(__spreadValues({}, state), { locales });
301
+ }
302
+ case actions.ActionTypes.SET_LOCALE: {
303
+ if (action.payload.locale === state.locale)
304
+ return state;
305
+ return __spreadProps(__spreadValues({}, state), { locale: action.payload.locale });
306
+ }
307
+ case actions.ActionTypes.SET_DEFAULT_LOCALE: {
308
+ if (action.payload.defaultLocale === state.defaultLocale)
309
+ return state;
310
+ return __spreadProps(__spreadValues({}, state), { defaultLocale: action.payload.defaultLocale });
311
+ }
312
+ default:
313
+ return state;
314
+ }
315
+ }
236
316
  const ColorControlType = "makeswift::controls::color";
237
317
  function Color(config = {}) {
238
318
  return { type: ColorControlType, config };
239
319
  }
240
320
  function copyColorData(value, context) {
241
- var _a;
321
+ var _a2;
242
322
  if (value == null)
243
323
  return value;
244
324
  return __spreadProps(__spreadValues({}, value), {
245
- swatchId: (_a = context.replacementContext.swatchIds.get(value.swatchId)) != null ? _a : value.swatchId
325
+ swatchId: (_a2 = context.replacementContext.swatchIds.get(value.swatchId)) != null ? _a2 : value.swatchId
246
326
  });
247
327
  }
248
328
  const ImageControlType = "makeswift::controls::image";
@@ -255,10 +335,10 @@ function Image$1(config = {}) {
255
335
  }
256
336
  Image$1.Format = ImageControlValueFormat;
257
337
  function copyImageData(value, context) {
258
- var _a;
338
+ var _a2;
259
339
  if (value == null)
260
340
  return value;
261
- return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
341
+ return (_a2 = context.replacementContext.fileIds.get(value)) != null ? _a2 : value;
262
342
  }
263
343
  if (void 0) {
264
344
  const { describe, test, expect } = void 0;
@@ -291,7 +371,7 @@ function Link$1(config = {}) {
291
371
  return { type: LinkControlType, config };
292
372
  }
293
373
  function copyLinkData(value, context) {
294
- var _a;
374
+ var _a2;
295
375
  if (value == null)
296
376
  return value;
297
377
  if (value.type === "OPEN_PAGE") {
@@ -299,7 +379,7 @@ function copyLinkData(value, context) {
299
379
  if (pageId != null) {
300
380
  return __spreadProps(__spreadValues({}, value), {
301
381
  payload: __spreadProps(__spreadValues({}, value.payload), {
302
- pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : pageId
382
+ pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : pageId
303
383
  })
304
384
  });
305
385
  }
@@ -452,6 +532,8 @@ function createPropController(descriptor, send) {
452
532
  return new ShapeControl(send, descriptor);
453
533
  case StyleControlType:
454
534
  return new StyleControl(send);
535
+ case StyleV2ControlType:
536
+ return new StyleV2Control(send);
455
537
  default:
456
538
  return new DefaultPropController(send);
457
539
  }
@@ -508,11 +590,11 @@ class ListControl extends PropController {
508
590
  this.controls = /* @__PURE__ */ new Map();
509
591
  }
510
592
  }
511
- function copyListData(definition, value, context) {
593
+ function copyListData(definition2, value, context) {
512
594
  if (value == null)
513
595
  return value;
514
596
  return value && value.map((item) => __spreadProps(__spreadValues({}, item), {
515
- value: copy(definition.config.type, item.value, context)
597
+ value: copy(definition2.config.type, item.value, context)
516
598
  }));
517
599
  }
518
600
  const ShapeControlType = "makeswift::controls::shape";
@@ -558,11 +640,11 @@ class ShapeControl extends PropController {
558
640
  this.setControls();
559
641
  }
560
642
  }
561
- function copyShapeData(definition, value, context) {
643
+ function copyShapeData(definition2, value, context) {
562
644
  if (value == null)
563
645
  return value;
564
646
  const newValue = {};
565
- for (const [key, itemDefinition] of Object.entries(definition.config.type)) {
647
+ for (const [key, itemDefinition] of Object.entries(definition2.config.type)) {
566
648
  const prop = value[key];
567
649
  newValue[key] = copy(itemDefinition, prop, context);
568
650
  }
@@ -590,10 +672,10 @@ const AllStyleControlProperties = [
590
672
  StyleControlProperty.TextStyle
591
673
  ];
592
674
  function Style(params) {
593
- var _a;
675
+ var _a2;
594
676
  return {
595
677
  type: StyleControlType,
596
- config: { properties: (_a = params == null ? void 0 : params.properties) != null ? _a : StyleControlDefaultProperties }
678
+ config: { properties: (_a2 = params == null ? void 0 : params.properties) != null ? _a2 : StyleControlDefaultProperties }
597
679
  };
598
680
  }
599
681
  Style.Default = StyleControlDefaultProperties;
@@ -811,22 +893,22 @@ function copy$e(value, context) {
811
893
  return value;
812
894
  return value.map((override) => __spreadProps(__spreadValues({}, override), {
813
895
  value: override.value.map((backgroundItem) => {
814
- var _a, _b;
896
+ var _a2, _b;
815
897
  switch (backgroundItem.type) {
816
898
  case "color":
817
899
  return __spreadProps(__spreadValues({}, backgroundItem), {
818
900
  payload: backgroundItem.payload === null ? null : __spreadProps(__spreadValues({}, backgroundItem.payload), {
819
- swatchId: (_a = context.replacementContext.swatchIds.get(backgroundItem.payload.swatchId)) != null ? _a : backgroundItem.payload.swatchId
901
+ swatchId: (_a2 = context.replacementContext.swatchIds.get(backgroundItem.payload.swatchId)) != null ? _a2 : backgroundItem.payload.swatchId
820
902
  })
821
903
  });
822
904
  case "gradient":
823
905
  return __spreadProps(__spreadValues({}, backgroundItem), {
824
906
  payload: __spreadProps(__spreadValues({}, backgroundItem.payload), {
825
907
  stops: backgroundItem.payload.stops.map((stop) => {
826
- var _a2;
908
+ var _a3;
827
909
  return __spreadProps(__spreadValues({}, stop), {
828
910
  color: stop.color == null ? null : __spreadProps(__spreadValues({}, stop.color), {
829
- swatchId: (_a2 = context.replacementContext.swatchIds.get(stop.color.swatchId)) != null ? _a2 : stop.color.swatchId
911
+ swatchId: (_a3 = context.replacementContext.swatchIds.get(stop.color.swatchId)) != null ? _a3 : stop.color.swatchId
830
912
  })
831
913
  });
832
914
  })
@@ -852,7 +934,7 @@ function copy$d(value, context) {
852
934
  });
853
935
  }
854
936
  function copy$c(value, context) {
855
- var _a, _b;
937
+ var _a2, _b;
856
938
  if (value == null)
857
939
  return value;
858
940
  switch (value.type) {
@@ -862,7 +944,7 @@ function copy$c(value, context) {
862
944
  return value;
863
945
  return __spreadProps(__spreadValues({}, value), {
864
946
  payload: __spreadProps(__spreadValues({}, value.payload), {
865
- pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : pageId
947
+ pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : pageId
866
948
  })
867
949
  });
868
950
  }
@@ -895,10 +977,10 @@ function copy$b(value, context) {
895
977
  payload: __spreadProps(__spreadValues({}, item.payload), {
896
978
  link: link != null ? copy$c(link, context) : void 0,
897
979
  color: color != null ? color.map((override) => {
898
- var _a;
980
+ var _a2;
899
981
  return __spreadProps(__spreadValues({}, override), {
900
982
  value: __spreadProps(__spreadValues({}, override.value), {
901
- swatchId: (_a = context.replacementContext.swatchIds.get(override.value.swatchId)) != null ? _a : override.value.swatchId
983
+ swatchId: (_a2 = context.replacementContext.swatchIds.get(override.value.swatchId)) != null ? _a2 : override.value.swatchId
902
984
  })
903
985
  });
904
986
  }) : void 0
@@ -956,14 +1038,14 @@ function copy$a(value, context) {
956
1038
  return value;
957
1039
  return value.map((override) => __spreadProps(__spreadValues({}, override), { value: override.value.map(copyShadowItem) }));
958
1040
  function copyShadowItem(item) {
959
- var _a;
1041
+ var _a2;
960
1042
  const { color } = item.payload;
961
1043
  if (color == null)
962
1044
  return item;
963
1045
  return __spreadProps(__spreadValues({}, item), {
964
1046
  payload: __spreadProps(__spreadValues({}, item.payload), {
965
1047
  color: __spreadProps(__spreadValues({}, color), {
966
- swatchId: (_a = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a : color.swatchId
1048
+ swatchId: (_a2 = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a2 : color.swatchId
967
1049
  })
968
1050
  })
969
1051
  });
@@ -1017,10 +1099,10 @@ if (void 0) {
1017
1099
  });
1018
1100
  }
1019
1101
  function copy$9(value, context) {
1020
- var _a;
1102
+ var _a2;
1021
1103
  if (value == null)
1022
1104
  return value;
1023
- return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
1105
+ return (_a2 = context.replacementContext.fileIds.get(value)) != null ? _a2 : value;
1024
1106
  }
1025
1107
  if (void 0) {
1026
1108
  const { describe, test, expect } = void 0;
@@ -1053,13 +1135,13 @@ function copy$8(value, context) {
1053
1135
  return value;
1054
1136
  return value.map(copyImagesPanelItem);
1055
1137
  function copyImagesPanelItem(imagesPanelItem) {
1056
- var _a;
1138
+ var _a2;
1057
1139
  const { file } = imagesPanelItem.props;
1058
1140
  if (file == null)
1059
1141
  return imagesPanelItem;
1060
1142
  return __spreadProps(__spreadValues({}, imagesPanelItem), {
1061
1143
  props: __spreadProps(__spreadValues({}, imagesPanelItem.props), {
1062
- file: (_a = context.replacementContext.fileIds.get(file)) != null ? _a : file
1144
+ file: (_a2 = context.replacementContext.fileIds.get(file)) != null ? _a2 : file
1063
1145
  })
1064
1146
  });
1065
1147
  }
@@ -1108,9 +1190,9 @@ function copy$7(value, context) {
1108
1190
  return value;
1109
1191
  return value.map((override) => __spreadProps(__spreadValues({}, override), { value: copyColorValue(override.value) }));
1110
1192
  function copyColorValue(colorValue) {
1111
- var _a;
1193
+ var _a2;
1112
1194
  return __spreadProps(__spreadValues({}, colorValue), {
1113
- swatchId: (_a = context.replacementContext.swatchIds.get(colorValue.swatchId)) != null ? _a : colorValue.swatchId
1195
+ swatchId: (_a2 = context.replacementContext.swatchIds.get(colorValue.swatchId)) != null ? _a2 : colorValue.swatchId
1114
1196
  });
1115
1197
  }
1116
1198
  }
@@ -1119,9 +1201,9 @@ function copy$6(value, context) {
1119
1201
  return value;
1120
1202
  return __spreadProps(__spreadValues({}, value), { fields: value.fields.map(copyFormFieldsPanelItem) });
1121
1203
  function copyFormFieldsPanelItem(item) {
1122
- var _a;
1204
+ var _a2;
1123
1205
  return __spreadProps(__spreadValues({}, item), {
1124
- tableColumnId: (_a = context.replacementContext.tableColumnIds.get(item.tableColumnId)) != null ? _a : item.tableColumnId
1206
+ tableColumnId: (_a2 = context.replacementContext.tableColumnIds.get(item.tableColumnId)) != null ? _a2 : item.tableColumnId
1125
1207
  });
1126
1208
  }
1127
1209
  }
@@ -1175,10 +1257,10 @@ if (void 0) {
1175
1257
  });
1176
1258
  }
1177
1259
  function copy$5(value, context) {
1178
- var _a;
1260
+ var _a2;
1179
1261
  if (value == null)
1180
1262
  return value;
1181
- return (_a = context.replacementContext.tableIds.get(value)) != null ? _a : value;
1263
+ return (_a2 = context.replacementContext.tableIds.get(value)) != null ? _a2 : value;
1182
1264
  }
1183
1265
  if (void 0) {
1184
1266
  const { describe, test, expect } = void 0;
@@ -1220,13 +1302,13 @@ function copy$4(value, context) {
1220
1302
  };
1221
1303
  }
1222
1304
  function copyBorderSide(borderSide) {
1223
- var _a;
1305
+ var _a2;
1224
1306
  const { color } = borderSide;
1225
1307
  if (color == null)
1226
1308
  return borderSide;
1227
1309
  return __spreadProps(__spreadValues({}, borderSide), {
1228
1310
  color: __spreadProps(__spreadValues({}, color), {
1229
- swatchId: (_a = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a : color.swatchId
1311
+ swatchId: (_a2 = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a2 : color.swatchId
1230
1312
  })
1231
1313
  });
1232
1314
  }
@@ -1340,24 +1422,24 @@ function copy$3(value, context) {
1340
1422
  return value;
1341
1423
  return __spreadProps(__spreadValues({}, value), { document: value.document ? copyNode(value.document) : value.document });
1342
1424
  function copyNode(node) {
1343
- var _a;
1425
+ var _a2;
1344
1426
  switch (node.object) {
1345
1427
  case "document":
1346
1428
  case "block":
1347
1429
  case "inline":
1348
1430
  return copyInline(node);
1349
1431
  case "text":
1350
- return __spreadProps(__spreadValues({}, node), { marks: (_a = node.marks) == null ? void 0 : _a.map(copyMark) });
1432
+ return __spreadProps(__spreadValues({}, node), { marks: (_a2 = node.marks) == null ? void 0 : _a2.map(copyMark) });
1351
1433
  default:
1352
1434
  return node;
1353
1435
  }
1354
1436
  }
1355
1437
  function copyInline(inline) {
1356
- var _a, _b;
1438
+ var _a2, _b;
1357
1439
  switch (inline.type) {
1358
1440
  case "link":
1359
1441
  return __spreadProps(__spreadValues({}, inline), {
1360
- nodes: (_a = inline.nodes) == null ? void 0 : _a.map(copyNode),
1442
+ nodes: (_a2 = inline.nodes) == null ? void 0 : _a2.map(copyNode),
1361
1443
  data: inline.data ? copyLinkData2(inline.data) : inline.data
1362
1444
  });
1363
1445
  default:
@@ -1365,7 +1447,7 @@ function copy$3(value, context) {
1365
1447
  }
1366
1448
  }
1367
1449
  function copyLinkData2(data) {
1368
- var _a, _b;
1450
+ var _a2, _b;
1369
1451
  switch (data.type) {
1370
1452
  case "OPEN_PAGE": {
1371
1453
  const pageId = data.payload.pageId;
@@ -1373,7 +1455,7 @@ function copy$3(value, context) {
1373
1455
  return data;
1374
1456
  return __spreadProps(__spreadValues({}, data), {
1375
1457
  payload: __spreadProps(__spreadValues({}, data.payload), {
1376
- pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : data.payload.pageId
1458
+ pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : data.payload.pageId
1377
1459
  })
1378
1460
  });
1379
1461
  }
@@ -1394,20 +1476,20 @@ function copy$3(value, context) {
1394
1476
  }
1395
1477
  }
1396
1478
  function copyMark(mark) {
1397
- var _a, _b, _c, _d;
1479
+ var _a2, _b, _c, _d;
1398
1480
  switch (mark.type) {
1399
1481
  case "typography": {
1400
- const typographyId = (_a = mark.data) == null ? void 0 : _a.value.id;
1482
+ const typographyId = (_a2 = mark.data) == null ? void 0 : _a2.value.id;
1401
1483
  return __spreadProps(__spreadValues({}, mark), {
1402
1484
  data: __spreadProps(__spreadValues({}, mark.data), {
1403
1485
  value: __spreadProps(__spreadValues({}, (_b = mark.data) == null ? void 0 : _b.value), {
1404
1486
  id: (_c = context.replacementContext.typographyIds.get(typographyId)) != null ? _c : typographyId,
1405
1487
  style: (_d = mark.data) == null ? void 0 : _d.value.style.map((override) => {
1406
- var _a2, _b2, _c2;
1488
+ var _a3, _b2, _c2;
1407
1489
  return __spreadProps(__spreadValues({}, override), {
1408
1490
  value: __spreadProps(__spreadValues({}, override.value), {
1409
1491
  color: override.value.color == null ? override.value.color : __spreadProps(__spreadValues({}, override.value.color), {
1410
- swatchId: (_c2 = context.replacementContext.swatchIds.get((_a2 = override.value.color) == null ? void 0 : _a2.swatchId)) != null ? _c2 : (_b2 = override.value.color) == null ? void 0 : _b2.swatchId
1492
+ swatchId: (_c2 = context.replacementContext.swatchIds.get((_a3 = override.value.color) == null ? void 0 : _a3.swatchId)) != null ? _c2 : (_b2 = override.value.color) == null ? void 0 : _b2.swatchId
1411
1493
  })
1412
1494
  })
1413
1495
  });
@@ -1558,8 +1640,8 @@ function copy$1(descriptor, value, context) {
1558
1640
  function copyElementReference(value, context) {
1559
1641
  return context.replacementContext.globalElementIds.get(value) || value;
1560
1642
  }
1561
- function copy(definition, value, context) {
1562
- switch (definition.type) {
1643
+ function copy(definition2, value, context) {
1644
+ switch (definition2.type) {
1563
1645
  case Types.Backgrounds:
1564
1646
  case Types.Grid:
1565
1647
  case Types.NavigationLinks:
@@ -1573,7 +1655,7 @@ function copy(definition, value, context) {
1573
1655
  case Types.Border:
1574
1656
  case Types.RichText:
1575
1657
  case Types.ElementID:
1576
- return copy$1(definition, value, context);
1658
+ return copy$1(definition2, value, context);
1577
1659
  case ColorControlType:
1578
1660
  return copyColorData(value, context);
1579
1661
  case ImageControlType:
@@ -1581,9 +1663,9 @@ function copy(definition, value, context) {
1581
1663
  case LinkControlType:
1582
1664
  return copyLinkData(value, context);
1583
1665
  case ShapeControlType:
1584
- return copyShapeData(definition, value, context);
1666
+ return copyShapeData(definition2, value, context);
1585
1667
  case ListControlType:
1586
- return copyListData(definition, value, context);
1668
+ return copyListData(definition2, value, context);
1587
1669
  case StyleControlType:
1588
1670
  return copyStyleData(value, context);
1589
1671
  case SlotControlType:
@@ -1592,14 +1674,49 @@ function copy(definition, value, context) {
1592
1674
  return value;
1593
1675
  }
1594
1676
  }
1595
- function merge(definition, a, b = a, context) {
1596
- switch (definition.type) {
1677
+ function merge(definition2, a, b = a, context) {
1678
+ switch (definition2.type) {
1597
1679
  case SlotControlType:
1598
1680
  return mergeSlotData(a, b, context);
1599
1681
  default:
1600
1682
  return b;
1601
1683
  }
1602
1684
  }
1685
+ const SelectControlType = "makeswift::controls::select";
1686
+ function Select(config) {
1687
+ return { type: SelectControlType, config };
1688
+ }
1689
+ const isServer = typeof window === "undefined";
1690
+ const useInsertionEffectSpecifier = "useInsertionEffect";
1691
+ const useInsertionEffect = (_a = React__namespace[useInsertionEffectSpecifier]) != null ? _a : React__namespace.useLayoutEffect;
1692
+ function useStyle(style) {
1693
+ const serialized = serialize.serializeStyles([style], css.cache.registered);
1694
+ utils.registerStyles(css.cache, serialized, false);
1695
+ useInsertionEffect(() => {
1696
+ utils.insertStyles(css.cache, serialized, false);
1697
+ });
1698
+ if (isServer)
1699
+ utils.insertStyles(css.cache, serialized, false);
1700
+ return `${css.cache.key}-${serialized.name}`;
1701
+ }
1702
+ const StyleV2ControlType = "makeswift::controls::style-v2";
1703
+ const unstable_useStyleV2ClassName = useStyle;
1704
+ function unstable_StyleV2(config) {
1705
+ return { type: StyleV2ControlType, config };
1706
+ }
1707
+ const StyleV2ControlMessageType = {
1708
+ CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model"
1709
+ };
1710
+ class StyleV2Control extends PropController {
1711
+ constructor(send) {
1712
+ super(send);
1713
+ }
1714
+ changeBoxModel(boxModel) {
1715
+ this.send({ type: StyleV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
1716
+ }
1717
+ recv() {
1718
+ }
1719
+ }
1603
1720
  const ObjectType = {
1604
1721
  Value: "value",
1605
1722
  Text: "text",
@@ -1645,6 +1762,687 @@ const BlockTextAlignment = {
1645
1762
  Right: "right",
1646
1763
  Justify: "justify"
1647
1764
  };
1765
+ const ElementUtils = {
1766
+ isRootBlock(node) {
1767
+ return slate.Element.isElement(node) && (slate.Element.isElementType(node, BlockType.Paragraph) || slate.Element.isElementType(node, BlockType.Heading1) || slate.Element.isElementType(node, BlockType.Heading2) || slate.Element.isElementType(node, BlockType.Heading3) || slate.Element.isElementType(node, BlockType.Heading3) || slate.Element.isElementType(node, BlockType.Heading4) || slate.Element.isElementType(node, BlockType.Heading5) || slate.Element.isElementType(node, BlockType.Heading6) || slate.Element.isElementType(node, BlockType.BlockQuote) || slate.Element.isElementType(node, BlockType.UnorderedList) || slate.Element.isElementType(node, BlockType.OrderedList) || slate.Element.isElementType(node, BlockType.Text) || slate.Element.isElementType(node, BlockType.Default));
1768
+ },
1769
+ isBlock(node) {
1770
+ return slate.Element.isElement(node) && (this.isRootBlock(node) || slate.Element.isElementType(node, BlockType.ListItem) || slate.Element.isElementType(node, BlockType.ListItemChild));
1771
+ },
1772
+ isInline(node) {
1773
+ return slate.Element.isElementType(node, InlineType.Code) || slate.Element.isElementType(node, InlineType.Link) || slate.Element.isElementType(node, InlineType.SubScript) || slate.Element.isElementType(node, InlineType.SuperScript);
1774
+ },
1775
+ isConvertibleToListTextNode(node) {
1776
+ return !this.isList(node) && !this.isListItem(node) && !this.isListItemChild(node);
1777
+ },
1778
+ isList(node) {
1779
+ return slate.Element.isElementType(node, BlockType.OrderedList) || slate.Element.isElementType(node, BlockType.UnorderedList);
1780
+ },
1781
+ isListItem(node) {
1782
+ return slate.Element.isElementType(node, BlockType.ListItem);
1783
+ },
1784
+ isListItemChild(node) {
1785
+ return slate.Element.isElementType(node, BlockType.ListItemChild);
1786
+ },
1787
+ createText() {
1788
+ return { text: "" };
1789
+ },
1790
+ createParagraph() {
1791
+ return {
1792
+ children: [this.createText()],
1793
+ type: BlockType.Paragraph
1794
+ };
1795
+ },
1796
+ createList(type = BlockType.UnorderedList) {
1797
+ return { children: [this.createText()], type };
1798
+ },
1799
+ createListItem() {
1800
+ return {
1801
+ children: [this.createListItemChild()],
1802
+ type: BlockType.ListItem
1803
+ };
1804
+ },
1805
+ createListItemChild() {
1806
+ return {
1807
+ children: [this.createText()],
1808
+ type: BlockType.ListItemChild
1809
+ };
1810
+ }
1811
+ };
1812
+ function unhangRange(editor, range) {
1813
+ let [start, end] = slate.Range.edges(range);
1814
+ if (start.offset !== 0 || end.offset !== 0 || slate.Range.isCollapsed(range)) {
1815
+ return range;
1816
+ }
1817
+ const endBlock = slate.Editor.above(editor, {
1818
+ at: end,
1819
+ match: (n) => slate.Element.isElement(n) && slate.Editor.isBlock(editor, n)
1820
+ });
1821
+ const blockPath = endBlock ? endBlock[1] : [];
1822
+ const first = slate.Editor.start(editor, start);
1823
+ const before = { anchor: first, focus: end };
1824
+ let skip = true;
1825
+ for (const [node, path] of slate.Editor.nodes(editor, {
1826
+ at: before,
1827
+ match: slate.Text.isText,
1828
+ reverse: true
1829
+ })) {
1830
+ if (skip) {
1831
+ skip = false;
1832
+ continue;
1833
+ }
1834
+ if (node.text !== "" || slate.Path.isBefore(path, blockPath)) {
1835
+ end = { path, offset: node.text.length };
1836
+ break;
1837
+ }
1838
+ }
1839
+ return { anchor: start, focus: end };
1840
+ }
1841
+ function getSelection(editor) {
1842
+ if (editor.selection)
1843
+ return unhangRange(editor, editor.selection);
1844
+ return {
1845
+ anchor: slate.Editor.start(editor, []),
1846
+ focus: slate.Editor.end(editor, [])
1847
+ };
1848
+ }
1849
+ function getBlocksInSelection(editor) {
1850
+ return Array.from(slate.Editor.nodes(editor, {
1851
+ at: getSelection(editor),
1852
+ match: (node) => ElementUtils.isRootBlock(node)
1853
+ })).filter((entry) => ElementUtils.isRootBlock(entry[0]));
1854
+ }
1855
+ function getActiveBlockType(editor) {
1856
+ var _a2;
1857
+ const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type);
1858
+ return rootBlocks.reduce((a, b) => a === b ? b : null, (_a2 = rootBlocks.at(0)) != null ? _a2 : null);
1859
+ }
1860
+ function setBlockKeyForDevice(editor, breakpoints, deviceId, key, value, options) {
1861
+ var _a2, _b;
1862
+ const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
1863
+ if (!at)
1864
+ return;
1865
+ const rootElements = getBlocksInSelection(editor);
1866
+ for (const [node, path] of rootElements) {
1867
+ if (ElementUtils.isBlock(node)) {
1868
+ const deviceValues = (_b = node[key]) != null ? _b : [];
1869
+ const currentDeviceValue = state_breakpoints.findBreakpointOverride(breakpoints, deviceValues, deviceId, (v) => v);
1870
+ const nextDeviceValue = __spreadProps(__spreadValues({}, currentDeviceValue), {
1871
+ deviceId,
1872
+ value
1873
+ });
1874
+ slate.Transforms.setNodes(editor, {
1875
+ [key]: [...deviceValues.filter((v) => v.deviceId !== deviceId), nextDeviceValue]
1876
+ }, { at: path });
1877
+ }
1878
+ }
1879
+ }
1880
+ function clearBlockKeyForDevice(editor, deviceId, key) {
1881
+ var _a2;
1882
+ const rootElements = getBlocksInSelection(editor);
1883
+ for (const [node, path] of rootElements) {
1884
+ if (ElementUtils.isBlock(node)) {
1885
+ const deviceOverrides = (_a2 = node[key]) != null ? _a2 : [];
1886
+ slate.Transforms.setNodes(editor, {
1887
+ [key]: deviceOverrides.filter((v) => v.deviceId !== deviceId)
1888
+ }, { at: path });
1889
+ }
1890
+ }
1891
+ }
1892
+ function wrapInline(editor, inline) {
1893
+ slate.Transforms.wrapNodes(editor, inline, {
1894
+ at: getSelection(editor),
1895
+ split: true
1896
+ });
1897
+ }
1898
+ function unwrapInline(editor, type) {
1899
+ slate.Transforms.unwrapNodes(editor, {
1900
+ match: (node) => ElementUtils.isInline(node) && node.type === type,
1901
+ at: getSelection(editor)
1902
+ });
1903
+ }
1904
+ const EditorUtils = {
1905
+ getFirstAncestorList(editor, path) {
1906
+ try {
1907
+ const parentList = slate.Editor.above(editor, {
1908
+ at: path,
1909
+ match: (node) => ElementUtils.isList(node)
1910
+ });
1911
+ return parentList != null ? parentList : null;
1912
+ } catch (e) {
1913
+ return null;
1914
+ }
1915
+ },
1916
+ getFirstAncestorListItem(editor, path) {
1917
+ try {
1918
+ const parentListItem = slate.Editor.above(editor, {
1919
+ at: path,
1920
+ match: (node) => ElementUtils.isListItem(node)
1921
+ });
1922
+ return parentListItem != null ? parentListItem : null;
1923
+ } catch (e) {
1924
+ return null;
1925
+ }
1926
+ }
1927
+ };
1928
+ const LIST_ITEM_CHILD_POSITION = 0;
1929
+ const LIST_ITEM_LIST_POSITION = 1;
1930
+ function filterForSubtreeRoots(entries) {
1931
+ return entries.filter(([, nodePath]) => !slate.Path.ancestors(nodePath).some((ancestor) => {
1932
+ return entries.some(([, path]) => slate.Path.equals(path, ancestor));
1933
+ }));
1934
+ }
1935
+ function unwrapPath(editor, listItemPath) {
1936
+ const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath);
1937
+ const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath);
1938
+ if (!parentList || listItemContainingParentList)
1939
+ return;
1940
+ slate.Editor.withoutNormalizing(editor, () => {
1941
+ const listItemTextPath = [...listItemPath, LIST_ITEM_CHILD_POSITION];
1942
+ const listItemNestedListPath = [...listItemPath, LIST_ITEM_LIST_POSITION];
1943
+ if (slate.Node.has(editor, listItemNestedListPath)) {
1944
+ slate.Transforms.setNodes(editor, { type: parentList[0].type }, { at: listItemNestedListPath });
1945
+ slate.Transforms.liftNodes(editor, { at: listItemNestedListPath });
1946
+ slate.Transforms.liftNodes(editor, { at: slate.Path.next(listItemPath) });
1947
+ }
1948
+ if (slate.Node.has(editor, listItemTextPath)) {
1949
+ slate.Transforms.setNodes(editor, { type: BlockType.Paragraph }, {
1950
+ at: listItemTextPath
1951
+ });
1952
+ slate.Transforms.liftNodes(editor, { at: listItemTextPath });
1953
+ slate.Transforms.liftNodes(editor, { at: listItemPath });
1954
+ }
1955
+ });
1956
+ }
1957
+ function unwrapList(editor, options) {
1958
+ var _a2;
1959
+ const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
1960
+ if (!at)
1961
+ return;
1962
+ const listItems = Array.from(slate.Editor.nodes(editor, {
1963
+ at,
1964
+ match: (node) => {
1965
+ return slate.Element.isElement(node) && ElementUtils.isListItem(node);
1966
+ }
1967
+ }));
1968
+ const subRoots = filterForSubtreeRoots(listItems);
1969
+ const refs = subRoots.map(([_, path]) => slate.Editor.pathRef(editor, path));
1970
+ refs.forEach((ref) => {
1971
+ if (ref.current) {
1972
+ unwrapPath(editor, ref.current);
1973
+ }
1974
+ ref.unref();
1975
+ });
1976
+ }
1977
+ function wrapList(editor, options = { type: BlockType.UnorderedList }) {
1978
+ var _a2;
1979
+ const at = (_a2 = options.at) != null ? _a2 : editor.selection;
1980
+ if (!at)
1981
+ return;
1982
+ const nonListEntries = Array.from(slate.Editor.nodes(editor, {
1983
+ at,
1984
+ match: (node) => {
1985
+ return slate.Element.isElement(node) && ElementUtils.isConvertibleToListTextNode(node);
1986
+ }
1987
+ }));
1988
+ const refs = nonListEntries.map(([_, path]) => slate.Editor.pathRef(editor, path));
1989
+ refs.forEach((ref) => {
1990
+ const path = ref.current;
1991
+ if (path) {
1992
+ slate.Editor.withoutNormalizing(editor, () => {
1993
+ slate.Transforms.setNodes(editor, { type: BlockType.ListItemChild }, {
1994
+ at: path
1995
+ });
1996
+ slate.Transforms.wrapNodes(editor, ElementUtils.createListItem(), {
1997
+ match: (node) => ElementUtils.isListItemChild(node),
1998
+ at: path
1999
+ });
2000
+ slate.Transforms.wrapNodes(editor, ElementUtils.createList(options.type), {
2001
+ at: path
2002
+ });
2003
+ });
2004
+ }
2005
+ ref.unref();
2006
+ });
2007
+ }
2008
+ const LocationUtils = {
2009
+ getStartPath(location) {
2010
+ if (slate.Range.isRange(location))
2011
+ return slate.Range.start(location).path;
2012
+ if (slate.Point.isPoint(location))
2013
+ return location.path;
2014
+ return location;
2015
+ }
2016
+ };
2017
+ function getSelectedListItems(editor) {
2018
+ var _a2, _b;
2019
+ if (!editor.selection)
2020
+ return [];
2021
+ const start = LocationUtils.getStartPath(editor.selection);
2022
+ const listItems = slate.Editor.nodes(editor, {
2023
+ at: editor.selection,
2024
+ match: (node) => ElementUtils.isListItem(node)
2025
+ });
2026
+ const firstAncestorPath = (_b = (_a2 = EditorUtils.getFirstAncestorListItem(editor, start)) == null ? void 0 : _a2[1]) != null ? _b : [];
2027
+ return Array.from(listItems).filter((node) => slate.Path.isDescendant(start, node[1]) ? slate.Path.equals(node[1], firstAncestorPath) : !slate.Path.isAfter(start, node[1]));
2028
+ }
2029
+ function indentPath(editor, path) {
2030
+ const parent = slate.Node.parent(editor, path);
2031
+ if (!path || !slate.Path.hasPrevious(path) || !ElementUtils.isList(parent))
2032
+ return;
2033
+ const previosPath = slate.Path.previous(path);
2034
+ const previousChildListPath = [...previosPath, LIST_ITEM_LIST_POSITION];
2035
+ const previousHasChildList = slate.Node.has(editor, previousChildListPath);
2036
+ slate.Editor.withoutNormalizing(editor, () => {
2037
+ if (!previousHasChildList) {
2038
+ slate.Transforms.insertNodes(editor, ElementUtils.createList(parent.type), {
2039
+ at: previousChildListPath
2040
+ });
2041
+ }
2042
+ const previousChildList = slate.Node.get(editor, previousChildListPath);
2043
+ if (ElementUtils.isList(previousChildList)) {
2044
+ const index = previousHasChildList ? previousChildList.children.length : 0;
2045
+ slate.Transforms.moveNodes(editor, {
2046
+ at: path,
2047
+ to: [...previousChildListPath, index]
2048
+ });
2049
+ }
2050
+ });
2051
+ }
2052
+ function indent(editor) {
2053
+ if (!editor.selection)
2054
+ return;
2055
+ const listItems = getSelectedListItems(editor);
2056
+ const subRoots = filterForSubtreeRoots(listItems);
2057
+ const refs = subRoots.map(([_, path]) => slate.Editor.pathRef(editor, path));
2058
+ refs.forEach((ref) => {
2059
+ if (ref.current) {
2060
+ indentPath(editor, ref.current);
2061
+ }
2062
+ ref.unref();
2063
+ });
2064
+ }
2065
+ function dedentPath(editor, listItemPath) {
2066
+ const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath);
2067
+ const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath);
2068
+ if (!parentList || !listItemContainingParentList)
2069
+ return;
2070
+ const [parentListNode, parentListPath] = parentList;
2071
+ const [_, listItemContainingParentListPath] = listItemContainingParentList;
2072
+ const listItemPosition = listItemPath[listItemPath.length - 1];
2073
+ const previousSiblings = parentListNode.children.slice(0, listItemPosition);
2074
+ const nextSiblings = parentListNode.children.slice(listItemPosition + 1);
2075
+ slate.Editor.withoutNormalizing(editor, () => {
2076
+ nextSiblings.forEach(() => {
2077
+ const nextSiblingPath = [...parentListPath, listItemPosition + 1];
2078
+ indentPath(editor, nextSiblingPath);
2079
+ });
2080
+ slate.Transforms.moveNodes(editor, {
2081
+ at: listItemPath,
2082
+ to: slate.Path.next(listItemContainingParentListPath)
2083
+ });
2084
+ if (previousSiblings.length === 0) {
2085
+ slate.Transforms.removeNodes(editor, { at: parentListPath });
2086
+ }
2087
+ });
2088
+ }
2089
+ function dedent(editor) {
2090
+ if (!editor.selection)
2091
+ return;
2092
+ const listItems = getSelectedListItems(editor);
2093
+ const subRoots = filterForSubtreeRoots(listItems);
2094
+ const refs = subRoots.map(([_, path]) => slate.Editor.pathRef(editor, path));
2095
+ refs.forEach((ref) => {
2096
+ if (ref.current) {
2097
+ dedentPath(editor, ref.current);
2098
+ }
2099
+ ref.unref();
2100
+ });
2101
+ }
2102
+ function toggleList(editor, options = { type: BlockType.UnorderedList }) {
2103
+ var _a2;
2104
+ const at = (_a2 = options.at) != null ? _a2 : editor.selection;
2105
+ if (at == null)
2106
+ return;
2107
+ const start = LocationUtils.getStartPath(at);
2108
+ const ancestorPath = slate.Path.ancestors(start).at(1);
2109
+ if (!ancestorPath || !slate.Node.has(editor, ancestorPath))
2110
+ return;
2111
+ const ancestor = slate.Node.get(editor, ancestorPath);
2112
+ if (!ElementUtils.isList(ancestor)) {
2113
+ return wrapList(editor, { type: options.type, at });
2114
+ }
2115
+ if (ancestor.type === options.type) {
2116
+ unwrapList(editor, { at });
2117
+ } else {
2118
+ slate.Transforms.setNodes(editor, { type: options.type }, { at: ancestorPath });
2119
+ }
2120
+ }
2121
+ const BlockActions = {
2122
+ setBlockKeyForDevice,
2123
+ clearBlockKeyForDevice,
2124
+ wrapInline,
2125
+ unwrapInline
2126
+ };
2127
+ const ListActions = {
2128
+ unwrapList,
2129
+ wrapList,
2130
+ indent,
2131
+ dedent,
2132
+ toggleList
2133
+ };
2134
+ function onKeyDown(e, editor) {
2135
+ if (!editor.selection || Array.from(slate.Editor.nodes(editor, {
2136
+ match: (node) => ElementUtils.isListItem(node)
2137
+ })).length === 0)
2138
+ return;
2139
+ if (isHotkey__default["default"]("shift+tab", e)) {
2140
+ e.preventDefault();
2141
+ ListActions.dedent(editor);
2142
+ }
2143
+ if (isHotkey__default["default"]("tab", e)) {
2144
+ e.preventDefault();
2145
+ ListActions.indent(editor);
2146
+ }
2147
+ if (isHotkey__default["default"]("backspace", e)) {
2148
+ if (!editor.selection)
2149
+ return;
2150
+ if (slate.Range.isExpanded(editor.selection))
2151
+ return;
2152
+ const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path);
2153
+ if (editor.selection.anchor.offset === 0 && listItem) {
2154
+ e.preventDefault();
2155
+ const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1]);
2156
+ const list = EditorUtils.getFirstAncestorList(editor, listItem[1]);
2157
+ if (parentListItem) {
2158
+ ListActions.dedent(editor);
2159
+ } else if (list) {
2160
+ ListActions.unwrapList(editor);
2161
+ }
2162
+ return;
2163
+ }
2164
+ }
2165
+ if (isHotkey__default["default"]("enter", e)) {
2166
+ e.preventDefault();
2167
+ if (!editor.selection)
2168
+ return;
2169
+ if (slate.Range.isExpanded(editor.selection)) {
2170
+ slate.Transforms.delete(editor);
2171
+ return;
2172
+ }
2173
+ const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path);
2174
+ if (editor.selection.anchor.offset === 0 && listItem && slate.Editor.string(editor, listItem[1]) === "") {
2175
+ const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1]);
2176
+ if (parentListItem) {
2177
+ ListActions.dedent(editor);
2178
+ } else {
2179
+ ListActions.unwrapList(editor);
2180
+ }
2181
+ return;
2182
+ }
2183
+ slate.Transforms.splitNodes(editor, {
2184
+ at: editor.selection,
2185
+ always: true,
2186
+ match: (node) => ElementUtils.isListItem(node)
2187
+ });
2188
+ }
2189
+ if (isHotkey__default["default"]("shift+enter", e)) {
2190
+ e.preventDefault();
2191
+ editor.insertText("\n");
2192
+ }
2193
+ }
2194
+ function withBlock(editor) {
2195
+ const {
2196
+ normalizeNode
2197
+ } = editor;
2198
+ editor.isInline = (entry) => {
2199
+ return ElementUtils.isInline(entry);
2200
+ };
2201
+ editor.normalizeNode = (entry) => {
2202
+ var _a2;
2203
+ const [normalizationNode, normalizationPath] = entry;
2204
+ if (ElementUtils.isBlock(normalizationNode) && ((_a2 = normalizationNode == null ? void 0 : normalizationNode.textAlign) == null ? void 0 : _a2.length) == 0) {
2205
+ slate.Transforms.unsetNodes(editor, "textAlign", {
2206
+ at: normalizationPath
2207
+ });
2208
+ return;
2209
+ }
2210
+ if (ElementUtils.isListItem(normalizationNode)) {
2211
+ const pathToListItemText = [...normalizationPath, LIST_ITEM_CHILD_POSITION];
2212
+ if (slate.Node.has(editor, pathToListItemText)) {
2213
+ const nodeInListItemTextPosition = slate.Node.get(editor, pathToListItemText);
2214
+ if (ElementUtils.isRootBlock(nodeInListItemTextPosition)) {
2215
+ slate.Transforms.setNodes(editor, {
2216
+ type: BlockType.ListItemChild
2217
+ }, {
2218
+ at: pathToListItemText
2219
+ });
2220
+ return;
2221
+ }
2222
+ } else {
2223
+ slate.Transforms.insertNodes(editor, ElementUtils.createListItem(), {
2224
+ at: pathToListItemText
2225
+ });
2226
+ return;
2227
+ }
2228
+ }
2229
+ if (!slate.Text.isText(normalizationNode)) {
2230
+ const mergeableChildren = Array.from(slate.Node.children(editor, normalizationPath)).map((child, index, children) => {
2231
+ const potentialNodeToBeMerged = children.at(index + 1);
2232
+ if (!potentialNodeToBeMerged || !ElementUtils.isList(potentialNodeToBeMerged[0]) || !ElementUtils.isList(child[0]) || potentialNodeToBeMerged[0].type !== child[0].type) {
2233
+ return null;
2234
+ }
2235
+ return [slate.Editor.pathRef(editor, child[1]), slate.Editor.pathRef(editor, potentialNodeToBeMerged[1])];
2236
+ }).filter((mergeableNodes) => Boolean(mergeableNodes));
2237
+ if (mergeableChildren.length !== 0) {
2238
+ mergeableChildren.reverse().forEach(([nodePathRef, nodeToBeMergedPathRef]) => {
2239
+ const nodePath = nodePathRef.current;
2240
+ const nodeToBeMergedPath = nodeToBeMergedPathRef.current;
2241
+ if (nodePath == null || nodeToBeMergedPath == null)
2242
+ return;
2243
+ const nodeChildren = Array.from(slate.Node.children(editor, nodePath));
2244
+ const childrenToBeMerged = Array.from(slate.Node.children(editor, nodeToBeMergedPath));
2245
+ slate.Editor.withoutNormalizing(editor, () => {
2246
+ childrenToBeMerged.reverse().forEach(([_, childPath]) => {
2247
+ slate.Transforms.moveNodes(editor, {
2248
+ at: childPath,
2249
+ to: [...nodePath, nodeChildren.length]
2250
+ });
2251
+ });
2252
+ slate.Transforms.removeNodes(editor, {
2253
+ at: nodeToBeMergedPath
2254
+ });
2255
+ });
2256
+ nodePathRef.unref();
2257
+ nodeToBeMergedPathRef.unref();
2258
+ });
2259
+ return;
2260
+ }
2261
+ }
2262
+ normalizeNode(entry);
2263
+ };
2264
+ return editor;
2265
+ }
2266
+ const definition = Select({
2267
+ label: "Block",
2268
+ labelOrientation: "horizontal",
2269
+ options: [{
2270
+ value: BlockType.Paragraph,
2271
+ label: "Paragraph"
2272
+ }, {
2273
+ value: BlockType.Heading1,
2274
+ label: "Heading 1"
2275
+ }, {
2276
+ value: BlockType.Heading2,
2277
+ label: "Heading 2"
2278
+ }, {
2279
+ value: BlockType.Heading3,
2280
+ label: "Heading 3"
2281
+ }, {
2282
+ value: BlockType.Heading4,
2283
+ label: "Heading 4"
2284
+ }, {
2285
+ value: BlockType.Heading5,
2286
+ label: "Heading 5"
2287
+ }, {
2288
+ value: BlockType.Heading6,
2289
+ label: "Heading 6"
2290
+ }, {
2291
+ value: BlockType.UnorderedList,
2292
+ label: "Bulleted list"
2293
+ }, {
2294
+ value: BlockType.OrderedList,
2295
+ label: "Numbered list"
2296
+ }, {
2297
+ value: BlockType.BlockQuote,
2298
+ label: "Quote"
2299
+ }],
2300
+ defaultValue: BlockType.Paragraph
2301
+ });
2302
+ function BlockPlugin() {
2303
+ return createRichTextV2Plugin({
2304
+ withPlugin: withBlock,
2305
+ onKeyDown,
2306
+ control: {
2307
+ definition,
2308
+ onChange: (editor, value) => {
2309
+ const activeBlockType = getActiveBlockType(editor);
2310
+ if (value === BlockType.UnorderedList || value === BlockType.OrderedList) {
2311
+ ListActions.toggleList(editor, {
2312
+ type: value,
2313
+ at: getSelection(editor)
2314
+ });
2315
+ } else if (activeBlockType === value) {
2316
+ slate.Transforms.setNodes(editor, {
2317
+ type: BlockType.Default
2318
+ }, {
2319
+ at: getSelection(editor)
2320
+ });
2321
+ } else {
2322
+ ListActions.unwrapList(editor, {
2323
+ at: getSelection(editor)
2324
+ });
2325
+ slate.Transforms.setNodes(editor, {
2326
+ type: value != null ? value : BlockType.Default
2327
+ }, {
2328
+ at: getSelection(editor)
2329
+ });
2330
+ }
2331
+ },
2332
+ getValue: (editor) => {
2333
+ const activeBlock = getActiveBlockType(editor);
2334
+ if (activeBlock === RootBlockType.Text || activeBlock === RootBlockType.Default)
2335
+ return void 0;
2336
+ return activeBlock;
2337
+ }
2338
+ },
2339
+ renderElement: (renderElement) => (props) => /* @__PURE__ */ jsxRuntime.jsx(BlockPluginComponent, __spreadProps(__spreadValues({}, props), {
2340
+ renderElement
2341
+ }))
2342
+ });
2343
+ }
2344
+ function BlockPluginComponent({
2345
+ element,
2346
+ attributes,
2347
+ children,
2348
+ renderElement
2349
+ }) {
2350
+ const blockStyles = [useStyle({
2351
+ margin: 0
2352
+ }), element.className];
2353
+ const quoteStyles = useStyle({
2354
+ padding: "0.5em 10px",
2355
+ fontSize: "1.25em",
2356
+ fontWeight: "300",
2357
+ borderLeft: "5px solid rgba(0, 0, 0, 0.1)"
2358
+ });
2359
+ switch (element.type) {
2360
+ case BlockType.Text:
2361
+ return /* @__PURE__ */ jsxRuntime.jsx("span", __spreadProps(__spreadValues({}, attributes), {
2362
+ className: css.cx(...blockStyles),
2363
+ children
2364
+ }));
2365
+ case BlockType.Paragraph:
2366
+ return /* @__PURE__ */ jsxRuntime.jsx("p", __spreadProps(__spreadValues({}, attributes), {
2367
+ className: css.cx(...blockStyles),
2368
+ children
2369
+ }));
2370
+ case BlockType.Heading1:
2371
+ return /* @__PURE__ */ jsxRuntime.jsx("h1", __spreadProps(__spreadValues({}, attributes), {
2372
+ className: css.cx(...blockStyles),
2373
+ children
2374
+ }));
2375
+ case BlockType.Heading2:
2376
+ return /* @__PURE__ */ jsxRuntime.jsx("h2", __spreadProps(__spreadValues({}, attributes), {
2377
+ className: css.cx(...blockStyles),
2378
+ children
2379
+ }));
2380
+ case BlockType.Heading3:
2381
+ return /* @__PURE__ */ jsxRuntime.jsx("h3", __spreadProps(__spreadValues({}, attributes), {
2382
+ className: css.cx(...blockStyles),
2383
+ children
2384
+ }));
2385
+ case BlockType.Heading4:
2386
+ return /* @__PURE__ */ jsxRuntime.jsx("h4", __spreadProps(__spreadValues({}, attributes), {
2387
+ className: css.cx(...blockStyles),
2388
+ children
2389
+ }));
2390
+ case BlockType.Heading5:
2391
+ return /* @__PURE__ */ jsxRuntime.jsx("h5", __spreadProps(__spreadValues({}, attributes), {
2392
+ className: css.cx(...blockStyles),
2393
+ children
2394
+ }));
2395
+ case BlockType.Heading6:
2396
+ return /* @__PURE__ */ jsxRuntime.jsx("h6", __spreadProps(__spreadValues({}, attributes), {
2397
+ className: css.cx(...blockStyles),
2398
+ children
2399
+ }));
2400
+ case BlockType.BlockQuote:
2401
+ return /* @__PURE__ */ jsxRuntime.jsx("blockquote", __spreadProps(__spreadValues({}, attributes), {
2402
+ className: css.cx(...blockStyles, quoteStyles),
2403
+ children
2404
+ }));
2405
+ case BlockType.OrderedList:
2406
+ return /* @__PURE__ */ jsxRuntime.jsx("ol", __spreadProps(__spreadValues({}, attributes), {
2407
+ className: css.cx(...blockStyles),
2408
+ style: {
2409
+ listStylePosition: "inside"
2410
+ },
2411
+ children
2412
+ }));
2413
+ case BlockType.UnorderedList:
2414
+ return /* @__PURE__ */ jsxRuntime.jsx("ul", __spreadProps(__spreadValues({}, attributes), {
2415
+ className: css.cx(...blockStyles),
2416
+ style: {
2417
+ listStylePosition: "inside"
2418
+ },
2419
+ children
2420
+ }));
2421
+ case BlockType.ListItem:
2422
+ return /* @__PURE__ */ jsxRuntime.jsx("li", __spreadProps(__spreadValues({}, attributes), {
2423
+ className: css.cx(...blockStyles),
2424
+ children
2425
+ }));
2426
+ case BlockType.ListItemChild:
2427
+ return /* @__PURE__ */ jsxRuntime.jsx("span", __spreadProps(__spreadValues({}, attributes), {
2428
+ className: css.cx(...blockStyles),
2429
+ children
2430
+ }));
2431
+ case BlockType.Default:
2432
+ return /* @__PURE__ */ jsxRuntime.jsx("p", __spreadProps(__spreadValues({}, attributes), {
2433
+ className: css.cx(...blockStyles),
2434
+ children
2435
+ }));
2436
+ default:
2437
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
2438
+ children: renderElement({
2439
+ element,
2440
+ attributes,
2441
+ children
2442
+ })
2443
+ });
2444
+ }
2445
+ }
1648
2446
  const RichTextV2ControlType = "makeswift::controls::rich-text-v2";
1649
2447
  const RichTextV2Mode = {
1650
2448
  Inline: "makeswift::controls::rich-text-v2::mode::inline",
@@ -1653,9 +2451,10 @@ const RichTextV2Mode = {
1653
2451
  function createRichTextV2Plugin({
1654
2452
  control,
1655
2453
  withPlugin,
1656
- onKeyDown
2454
+ onKeyDown: onKeyDown2,
2455
+ renderElement
1657
2456
  }) {
1658
- return { control, withPlugin, onKeyDown };
2457
+ return { control, withPlugin, onKeyDown: onKeyDown2, renderElement };
1659
2458
  }
1660
2459
  function unstable_RichTextV2(config = {}) {
1661
2460
  return { type: RichTextV2ControlType, config };
@@ -1678,7 +2477,7 @@ class RichTextV2Control extends PropController {
1678
2477
  __publicField(this, "defaultValue", null);
1679
2478
  __publicField(this, "descriptor");
1680
2479
  __publicField(this, "recv", (message) => {
1681
- var _a, _b, _c;
2480
+ var _a2, _b, _c;
1682
2481
  if (!this.editor)
1683
2482
  return;
1684
2483
  switch (message.type) {
@@ -1695,7 +2494,7 @@ class RichTextV2Control extends PropController {
1695
2494
  break;
1696
2495
  }
1697
2496
  case RichTextV2ControlMessageType.RUN_PLUGIN_CONTROL_ACTION: {
1698
- (_c = (_b = (_a = this.descriptor.config.plugins) == null ? void 0 : _a.at(message.pluginIndex)) == null ? void 0 : _b.control) == null ? void 0 : _c.onChange(this.editor, message.value);
2497
+ (_c = (_b = (_a2 = this.descriptor.config.plugins) == null ? void 0 : _a2.at(message.pluginIndex)) == null ? void 0 : _b.control) == null ? void 0 : _c.onChange(this.editor, message.value);
1699
2498
  break;
1700
2499
  }
1701
2500
  }
@@ -1704,13 +2503,13 @@ class RichTextV2Control extends PropController {
1704
2503
  this.send = send;
1705
2504
  }
1706
2505
  setEditor(editor) {
1707
- var _a, _b, _c;
2506
+ var _a2, _b, _c;
1708
2507
  this.editor = editor;
1709
2508
  this.send({
1710
2509
  type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
1711
- value: (_c = (_b = (_a = this.descriptor.config) == null ? void 0 : _a.plugins) == null ? void 0 : _b.map((plugin) => {
1712
- var _a2;
1713
- return (_a2 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a2.getValue(editor);
2510
+ value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
2511
+ var _a3;
2512
+ return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
1714
2513
  })) != null ? _c : []
1715
2514
  });
1716
2515
  }
@@ -1725,7 +2524,7 @@ class RichTextV2Control extends PropController {
1725
2524
  this.send({ type: RichTextV2ControlMessageType.SWITCH_TO_BUILD_MODE });
1726
2525
  }
1727
2526
  onChange(value) {
1728
- var _a, _b, _c;
2527
+ var _a2, _b, _c;
1729
2528
  const editor = this.editor;
1730
2529
  if (editor == null)
1731
2530
  return;
@@ -1735,9 +2534,9 @@ class RichTextV2Control extends PropController {
1735
2534
  });
1736
2535
  this.send({
1737
2536
  type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
1738
- value: (_c = (_b = (_a = this.descriptor.config) == null ? void 0 : _a.plugins) == null ? void 0 : _b.map((plugin) => {
1739
- var _a2;
1740
- return (_a2 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a2.getValue(editor);
2537
+ value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
2538
+ var _a3;
2539
+ return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
1741
2540
  })) != null ? _c : []
1742
2541
  });
1743
2542
  }
@@ -1751,8 +2550,8 @@ function isText(node) {
1751
2550
  return false;
1752
2551
  }
1753
2552
  function toTextDAO(node) {
1754
- var _a, _b, _c, _d;
1755
- const typographyMark = (_a = node.marks) == null ? void 0 : _a.find((mark) => mark.type === "typography");
2553
+ var _a2, _b, _c, _d;
2554
+ const typographyMark = (_a2 = node.marks) == null ? void 0 : _a2.find((mark) => mark.type === "typography");
1756
2555
  return [
1757
2556
  {
1758
2557
  text: (_b = node.text) != null ? _b : "",
@@ -1761,12 +2560,12 @@ function toTextDAO(node) {
1761
2560
  ];
1762
2561
  }
1763
2562
  function toInlineDAO(node) {
1764
- var _a, _b, _c, _d;
2563
+ var _a2, _b, _c, _d;
1765
2564
  switch (node.type) {
1766
2565
  case InlineType.Link:
1767
2566
  return [
1768
2567
  {
1769
- children: (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(toInlineOrTextDAO)) != null ? _b : [],
2568
+ children: (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(toInlineOrTextDAO)) != null ? _b : [],
1770
2569
  [node.type]: node.data,
1771
2570
  type: node.type
1772
2571
  }
@@ -1795,7 +2594,7 @@ function toInlineOrTextDAO(node) {
1795
2594
  }
1796
2595
  }
1797
2596
  function toNodeDAO(node) {
1798
- var _a, _b;
2597
+ var _a2, _b;
1799
2598
  switch (node.object) {
1800
2599
  case ObjectType.Inline:
1801
2600
  case ObjectType.Text:
@@ -1805,7 +2604,7 @@ function toNodeDAO(node) {
1805
2604
  {
1806
2605
  type: node.type,
1807
2606
  textAlign: (node == null ? void 0 : node.data) && "textAlign" in node.data ? node == null ? void 0 : node.data.textAlign : void 0,
1808
- children: (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(toNodeDAO)) != null ? _b : []
2607
+ children: (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(toNodeDAO)) != null ? _b : []
1809
2608
  }
1810
2609
  ];
1811
2610
  default:
@@ -1813,8 +2612,8 @@ function toNodeDAO(node) {
1813
2612
  }
1814
2613
  }
1815
2614
  function richTextDTOtoSelection(data) {
1816
- var _a, _b, _c, _d;
1817
- if (((_b = (_a = data.selection) == null ? void 0 : _a.anchor) == null ? void 0 : _b.offset) != null && data.selection.anchor.path != null && ((_d = (_c = data.selection) == null ? void 0 : _c.focus) == null ? void 0 : _d.offset) != null && data.selection.focus.path != null)
2615
+ var _a2, _b, _c, _d;
2616
+ if (((_b = (_a2 = data.selection) == null ? void 0 : _a2.anchor) == null ? void 0 : _b.offset) != null && data.selection.anchor.path != null && ((_d = (_c = data.selection) == null ? void 0 : _c.focus) == null ? void 0 : _d.offset) != null && data.selection.focus.path != null)
1818
2617
  return {
1819
2618
  anchor: {
1820
2619
  offset: data.selection.anchor.offset,
@@ -1828,8 +2627,8 @@ function richTextDTOtoSelection(data) {
1828
2627
  return null;
1829
2628
  }
1830
2629
  function richTextDTOtoDAO(data) {
1831
- var _a, _b, _c;
1832
- return (_c = (_b = (_a = data.document) == null ? void 0 : _a.nodes) == null ? void 0 : _b.flatMap(toNodeDAO)) != null ? _c : [];
2630
+ var _a2, _b, _c;
2631
+ return (_c = (_b = (_a2 = data.document) == null ? void 0 : _a2.nodes) == null ? void 0 : _b.flatMap(toNodeDAO)) != null ? _c : [];
1833
2632
  }
1834
2633
  function toInlineOrTextDTO(node) {
1835
2634
  if (isText(node)) {
@@ -1873,7 +2672,7 @@ function toInlineOrTextDTO(node) {
1873
2672
  }
1874
2673
  }
1875
2674
  function toNodeDTO(node) {
1876
- var _a, _b;
2675
+ var _a2, _b;
1877
2676
  if (isText(node))
1878
2677
  return toInlineOrTextDTO(node);
1879
2678
  switch (node.type) {
@@ -1898,7 +2697,7 @@ function toNodeDTO(node) {
1898
2697
  textAlign: node.textAlign
1899
2698
  } : {},
1900
2699
  object: "block",
1901
- nodes: (_b = (_a = node.children) == null ? void 0 : _a.flatMap(toNodeDTO)) != null ? _b : []
2700
+ nodes: (_b = (_a2 = node.children) == null ? void 0 : _a2.flatMap(toNodeDTO)) != null ? _b : []
1902
2701
  }
1903
2702
  ];
1904
2703
  default:
@@ -2262,51 +3061,51 @@ function getElementId$1(descriptor, prop) {
2262
3061
  }
2263
3062
  }
2264
3063
  function getBackgroundsSwatchIds(value) {
2265
- var _a;
2266
- return (_a = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
2267
- var _a2;
3064
+ var _a2;
3065
+ return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
3066
+ var _a3;
2268
3067
  switch (backgroundItem.type) {
2269
3068
  case "color":
2270
- return ((_a2 = backgroundItem.payload) == null ? void 0 : _a2.swatchId) == null ? [] : [backgroundItem.payload.swatchId];
3069
+ return ((_a3 = backgroundItem.payload) == null ? void 0 : _a3.swatchId) == null ? [] : [backgroundItem.payload.swatchId];
2271
3070
  case "gradient":
2272
3071
  return backgroundItem.payload.stops.flatMap((stop) => stop.color == null ? [] : stop.color.swatchId);
2273
3072
  default:
2274
3073
  return [];
2275
3074
  }
2276
- })) != null ? _a : [];
3075
+ })) != null ? _a2 : [];
2277
3076
  }
2278
3077
  function getBorderSwatchIds(value) {
2279
- var _a;
2280
- return (_a = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((borderValue) => {
2281
- var _a2, _b, _c, _d, _e, _f, _g, _h;
3078
+ var _a2;
3079
+ return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((borderValue) => {
3080
+ var _a3, _b, _c, _d, _e, _f, _g, _h;
2282
3081
  return [
2283
- (_b = (_a2 = borderValue.borderTop) == null ? void 0 : _a2.color) == null ? void 0 : _b.swatchId,
3082
+ (_b = (_a3 = borderValue.borderTop) == null ? void 0 : _a3.color) == null ? void 0 : _b.swatchId,
2284
3083
  (_d = (_c = borderValue.borderRight) == null ? void 0 : _c.color) == null ? void 0 : _d.swatchId,
2285
3084
  (_f = (_e = borderValue.borderBottom) == null ? void 0 : _e.color) == null ? void 0 : _f.swatchId,
2286
3085
  (_h = (_g = borderValue.borderLeft) == null ? void 0 : _g.color) == null ? void 0 : _h.swatchId
2287
3086
  ].filter((swatchId) => swatchId != null);
2288
- })) != null ? _a : [];
3087
+ })) != null ? _a2 : [];
2289
3088
  }
2290
3089
  function getBoxShadowsSwatchIds(value) {
2291
- var _a;
2292
- return (_a = value == null ? void 0 : value.flatMap((override) => override.value).map((item) => {
2293
- var _a2;
2294
- return (_a2 = item.payload.color) == null ? void 0 : _a2.swatchId;
2295
- }).filter((swatchId) => swatchId != null)) != null ? _a : [];
3090
+ var _a2;
3091
+ return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).map((item) => {
3092
+ var _a3;
3093
+ return (_a3 = item.payload.color) == null ? void 0 : _a3.swatchId;
3094
+ }).filter((swatchId) => swatchId != null)) != null ? _a2 : [];
2296
3095
  }
2297
3096
  function getResponsiveColorSwatchIds(value) {
2298
- var _a;
2299
- return (_a = value == null ? void 0 : value.map((override) => override.value).map((color) => color.swatchId)) != null ? _a : [];
3097
+ var _a2;
3098
+ return (_a2 = value == null ? void 0 : value.map((override) => override.value).map((color) => color.swatchId)) != null ? _a2 : [];
2300
3099
  }
2301
3100
  function getTypographyStyleSwatchIds(style) {
2302
- var _a;
2303
- return (_a = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
2304
- var _a2;
2305
- return (_a2 = typographyStyle.color) == null ? void 0 : _a2.swatchId;
2306
- }).filter(isNonNullable)) != null ? _a : [];
3101
+ var _a2;
3102
+ return (_a2 = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
3103
+ var _a3;
3104
+ return (_a3 = typographyStyle.color) == null ? void 0 : _a3.swatchId;
3105
+ }).filter(isNonNullable)) != null ? _a2 : [];
2307
3106
  }
2308
3107
  function getElementSwatchIds(descriptor, prop) {
2309
- var _a;
3108
+ var _a2;
2310
3109
  if (prop == null)
2311
3110
  return [];
2312
3111
  switch (descriptor.type) {
@@ -2316,17 +3115,17 @@ function getElementSwatchIds(descriptor, prop) {
2316
3115
  return getBorderSwatchIds(prop);
2317
3116
  case Types.NavigationLinks: {
2318
3117
  const value = prop;
2319
- return (_a = value == null ? void 0 : value.flatMap((item) => {
2320
- var _a2, _b, _c, _d;
3118
+ return (_a2 = value == null ? void 0 : value.flatMap((item) => {
3119
+ var _a3, _b, _c, _d;
2321
3120
  switch (item.type) {
2322
3121
  case "button":
2323
3122
  case "dropdown":
2324
3123
  return [
2325
- ...(_b = (_a2 = item.payload.color) == null ? void 0 : _a2.map((override) => override.value).map((color) => color.swatchId)) != null ? _b : [],
3124
+ ...(_b = (_a3 = item.payload.color) == null ? void 0 : _a3.map((override) => override.value).map((color) => color.swatchId)) != null ? _b : [],
2326
3125
  ...(_d = (_c = item.payload.textColor) == null ? void 0 : _c.map((override) => override.value).map((color) => color.swatchId)) != null ? _d : []
2327
3126
  ];
2328
3127
  }
2329
- })) != null ? _a : [];
3128
+ })) != null ? _a2 : [];
2330
3129
  }
2331
3130
  case Types.ResponsiveColor:
2332
3131
  return getResponsiveColorSwatchIds(prop);
@@ -2334,20 +3133,20 @@ function getElementSwatchIds(descriptor, prop) {
2334
3133
  return getBoxShadowsSwatchIds(prop);
2335
3134
  case Types.RichText: {
2336
3135
  let getNodeSwatchIds = function(node) {
2337
- var _a2, _b, _c, _d;
3136
+ var _a3, _b, _c, _d;
2338
3137
  switch (node.object) {
2339
3138
  case "document":
2340
3139
  case "block":
2341
3140
  case "inline":
2342
- return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodeSwatchIds)) != null ? _b : [];
3141
+ return (_b = (_a3 = node.nodes) == null ? void 0 : _a3.flatMap(getNodeSwatchIds)) != null ? _b : [];
2343
3142
  case "text":
2344
3143
  return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkSwatchIds)) != null ? _d : [];
2345
3144
  default:
2346
3145
  return [];
2347
3146
  }
2348
3147
  }, getMarkSwatchIds = function(mark) {
2349
- var _a2, _b;
2350
- return getTypographyStyleSwatchIds((_b = (_a2 = mark.data) == null ? void 0 : _a2.value) == null ? void 0 : _b.style);
3148
+ var _a3, _b;
3149
+ return getTypographyStyleSwatchIds((_b = (_a3 = mark.data) == null ? void 0 : _a3.value) == null ? void 0 : _b.style);
2351
3150
  };
2352
3151
  const value = prop;
2353
3152
  if (value == null || value.document == null)
@@ -2363,18 +3162,18 @@ function getElementSwatchIds(descriptor, prop) {
2363
3162
  }
2364
3163
  }
2365
3164
  function getBackgroundsFileIds(value) {
2366
- var _a;
2367
- return (_a = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
3165
+ var _a2;
3166
+ return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
2368
3167
  switch (backgroundItem.type) {
2369
3168
  case "image":
2370
3169
  return [backgroundItem.payload.imageId];
2371
3170
  default:
2372
3171
  return [];
2373
3172
  }
2374
- })) != null ? _a : [];
3173
+ })) != null ? _a2 : [];
2375
3174
  }
2376
3175
  function getFileIds(descriptor, prop) {
2377
- var _a;
3176
+ var _a2;
2378
3177
  if (prop == null)
2379
3178
  return [];
2380
3179
  switch (descriptor.type) {
@@ -2386,7 +3185,7 @@ function getFileIds(descriptor, prop) {
2386
3185
  }
2387
3186
  case Types.Images: {
2388
3187
  const value = prop;
2389
- return (_a = value == null ? void 0 : value.flatMap((item) => item.props.file == null ? [] : [item.props.file])) != null ? _a : [];
3188
+ return (_a2 = value == null ? void 0 : value.flatMap((item) => item.props.file == null ? [] : [item.props.file])) != null ? _a2 : [];
2390
3189
  }
2391
3190
  case ImageControlType: {
2392
3191
  const value = prop;
@@ -2402,20 +3201,20 @@ function getTypographyIds(descriptor, prop) {
2402
3201
  switch (descriptor.type) {
2403
3202
  case Types.RichText: {
2404
3203
  let getNodeTypographyIds = function(node) {
2405
- var _a, _b, _c, _d;
3204
+ var _a2, _b, _c, _d;
2406
3205
  switch (node.object) {
2407
3206
  case "document":
2408
3207
  case "block":
2409
3208
  case "inline":
2410
- return (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(getNodeTypographyIds)) != null ? _b : [];
3209
+ return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodeTypographyIds)) != null ? _b : [];
2411
3210
  case "text":
2412
3211
  return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkTypographyIds)) != null ? _d : [];
2413
3212
  default:
2414
3213
  return [];
2415
3214
  }
2416
3215
  }, getMarkTypographyIds = function(mark) {
2417
- var _a, _b;
2418
- return [(_b = (_a = mark.data) == null ? void 0 : _a.value) == null ? void 0 : _b.id].filter((id) => id != null);
3216
+ var _a2, _b;
3217
+ return [(_b = (_a2 = mark.data) == null ? void 0 : _a2.value) == null ? void 0 : _b.id].filter((id) => id != null);
2419
3218
  };
2420
3219
  const value = prop;
2421
3220
  if (value == null || value.document == null)
@@ -2439,7 +3238,7 @@ function getTableIds(descriptor, prop) {
2439
3238
  }
2440
3239
  }
2441
3240
  function getPageIds(descriptor, prop) {
2442
- var _a;
3241
+ var _a2;
2443
3242
  if (prop == null)
2444
3243
  return [];
2445
3244
  switch (descriptor.type) {
@@ -2458,8 +3257,8 @@ function getPageIds(descriptor, prop) {
2458
3257
  const value = prop;
2459
3258
  if (value == null)
2460
3259
  return [];
2461
- return (_a = value == null ? void 0 : value.flatMap((item) => {
2462
- var _a2, _b;
3260
+ return (_a2 = value == null ? void 0 : value.flatMap((item) => {
3261
+ var _a3, _b;
2463
3262
  switch (item.type) {
2464
3263
  case "button": {
2465
3264
  if (item.payload.link == null)
@@ -2472,7 +3271,7 @@ function getPageIds(descriptor, prop) {
2472
3271
  }
2473
3272
  }
2474
3273
  case "dropdown": {
2475
- return (_b = (_a2 = item.payload.links) == null ? void 0 : _a2.flatMap((link) => {
3274
+ return (_b = (_a3 = item.payload.links) == null ? void 0 : _a3.flatMap((link) => {
2476
3275
  if (link.payload.link == null)
2477
3276
  return [];
2478
3277
  switch (link.payload.link.type) {
@@ -2484,25 +3283,25 @@ function getPageIds(descriptor, prop) {
2484
3283
  })) != null ? _b : [];
2485
3284
  }
2486
3285
  }
2487
- })) != null ? _a : [];
3286
+ })) != null ? _a2 : [];
2488
3287
  }
2489
3288
  case Types.RichText: {
2490
3289
  let getNodePageIds = function(node) {
2491
- var _a2, _b;
3290
+ var _a3, _b;
2492
3291
  switch (node.object) {
2493
3292
  case "document":
2494
3293
  case "block":
2495
- return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodePageIds)) != null ? _b : [];
3294
+ return (_b = (_a3 = node.nodes) == null ? void 0 : _a3.flatMap(getNodePageIds)) != null ? _b : [];
2496
3295
  case "inline":
2497
3296
  return getInlinePageIds(node);
2498
3297
  default:
2499
3298
  return [];
2500
3299
  }
2501
3300
  }, getInlinePageIds = function(inline) {
2502
- var _a2, _b, _c, _d;
3301
+ var _a3, _b, _c, _d;
2503
3302
  switch (inline.type) {
2504
3303
  case "link": {
2505
- const nodePageIds = (_b = (_a2 = inline.nodes) == null ? void 0 : _a2.flatMap(getNodePageIds)) != null ? _b : [];
3304
+ const nodePageIds = (_b = (_a3 = inline.nodes) == null ? void 0 : _a3.flatMap(getNodePageIds)) != null ? _b : [];
2506
3305
  const dataPageIds = inline.data ? getLinkDataPageIds(inline.data) : [];
2507
3306
  return [...nodePageIds, ...dataPageIds];
2508
3307
  }
@@ -2545,13 +3344,14 @@ var introspection = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2545
3344
  const reducer = redux.combineReducers({
2546
3345
  documents: reducer$8,
2547
3346
  reactComponents: reducer$7,
2548
- componentsMeta: reducer$6,
2549
- propControllers: reducer$5,
2550
- propControllerHandles: reducer$4,
2551
- isInBuilder: reducer$3,
2552
- isPreview: reducer$2,
2553
- builderEditMode: reducer$1,
2554
- breakpoints: state_breakpoints.reducer
3347
+ componentsMeta: reducer$9,
3348
+ propControllers: reducer$6,
3349
+ propControllerHandles: reducer$5,
3350
+ isInBuilder: reducer$4,
3351
+ isPreview: reducer$3,
3352
+ builderEditMode: reducer$2,
3353
+ breakpoints: state_breakpoints.reducer,
3354
+ locales: reducer$1
2555
3355
  });
2556
3356
  function getDocumentsStateSlice(state) {
2557
3357
  return state.documents;
@@ -2616,14 +3416,14 @@ function getDocumentKeysSortedByDepth(state) {
2616
3416
  elements.set(key, getDocumentElements(state, key));
2617
3417
  });
2618
3418
  keys.sort((a, b) => {
2619
- var _a;
2620
- return ((_a = elements.get(a)) == null ? void 0 : _a.has(b)) ? -1 : 1;
3419
+ var _a2;
3420
+ return ((_a2 = elements.get(a)) == null ? void 0 : _a2.has(b)) ? -1 : 1;
2621
3421
  });
2622
3422
  return keys;
2623
3423
  }
2624
3424
  function getElement(state, documentKey, elementKey) {
2625
- var _a;
2626
- return (_a = getDocumentElements(state, documentKey).get(elementKey)) != null ? _a : null;
3425
+ var _a2;
3426
+ return (_a2 = getDocumentElements(state, documentKey).get(elementKey)) != null ? _a2 : null;
2627
3427
  }
2628
3428
  function getElementPropControllerDescriptors(state, documentKey, elementKey) {
2629
3429
  const element = getElement(state, documentKey, elementKey);
@@ -2694,17 +3494,24 @@ function getBuilderEditMode(state) {
2694
3494
  function getBreakpoints(state) {
2695
3495
  return state.breakpoints;
2696
3496
  }
3497
+ function getLocales(state) {
3498
+ return state.locales;
3499
+ }
2697
3500
  function configureStore({
2698
3501
  rootElements,
2699
3502
  preloadedState,
2700
- breakpoints
3503
+ breakpoints,
3504
+ locales
2701
3505
  } = {}) {
2702
3506
  return redux.createStore(reducer, __spreadProps(__spreadValues({}, preloadedState), {
2703
3507
  documents: getInitialState$7({ rootElements }),
2704
- breakpoints: state_breakpoints.getInitialState(breakpoints != null ? breakpoints : preloadedState == null ? void 0 : preloadedState.breakpoints)
3508
+ breakpoints: state_breakpoints.getInitialState(breakpoints != null ? breakpoints : preloadedState == null ? void 0 : preloadedState.breakpoints),
3509
+ locales: getInitialState(locales != null ? locales : preloadedState == null ? void 0 : preloadedState.locales)
2705
3510
  }), redux.applyMiddleware(thunk__default["default"]));
2706
3511
  }
2707
3512
  exports.Backgrounds = Backgrounds;
3513
+ exports.BlockActions = BlockActions;
3514
+ exports.BlockPlugin = BlockPlugin;
2708
3515
  exports.BlockTextAlignment = BlockTextAlignment;
2709
3516
  exports.BlockType = BlockType;
2710
3517
  exports.Border = Border;
@@ -2715,8 +3522,10 @@ exports.BuilderEditMode = BuilderEditMode;
2715
3522
  exports.Checkbox = Checkbox;
2716
3523
  exports.Color = Color;
2717
3524
  exports.ColorControlType = ColorControlType;
3525
+ exports.ComponentIcon = ComponentIcon;
2718
3526
  exports.Date = Date;
2719
3527
  exports.ElementID = ElementID;
3528
+ exports.ElementUtils = ElementUtils;
2720
3529
  exports.Font = Font;
2721
3530
  exports.GapX = GapX;
2722
3531
  exports.GapY = GapY;
@@ -2731,6 +3540,7 @@ exports.Link = Link;
2731
3540
  exports.Link$1 = Link$1;
2732
3541
  exports.LinkControlType = LinkControlType;
2733
3542
  exports.List = List$1;
3543
+ exports.ListActions = ListActions;
2734
3544
  exports.ListControl = ListControl;
2735
3545
  exports.ListControlMessageType = ListControlMessageType;
2736
3546
  exports.ListControlType = ListControlType;
@@ -2758,6 +3568,8 @@ exports.RichTextV2ControlMessageType = RichTextV2ControlMessageType;
2758
3568
  exports.RichTextV2ControlType = RichTextV2ControlType;
2759
3569
  exports.RichTextV2Mode = RichTextV2Mode;
2760
3570
  exports.RootBlockType = RootBlockType;
3571
+ exports.Select = Select;
3572
+ exports.SelectControlType = SelectControlType;
2761
3573
  exports.Shadows = Shadows;
2762
3574
  exports.ShadowsPropControllerFormat = ShadowsPropControllerFormat;
2763
3575
  exports.Shape = Shape$1;
@@ -2774,6 +3586,9 @@ exports.StyleControl = StyleControl;
2774
3586
  exports.StyleControlMessageType = StyleControlMessageType;
2775
3587
  exports.StyleControlProperty = StyleControlProperty;
2776
3588
  exports.StyleControlType = StyleControlType;
3589
+ exports.StyleV2Control = StyleV2Control;
3590
+ exports.StyleV2ControlMessageType = StyleV2ControlMessageType;
3591
+ exports.StyleV2ControlType = StyleV2ControlType;
2777
3592
  exports.Table = Table;
2778
3593
  exports.TableFormFields = TableFormFields;
2779
3594
  exports.TableFormFieldsMessageType = TableFormFieldsMessageType;
@@ -2801,6 +3616,7 @@ exports.createRichTextV2Plugin = createRichTextV2Plugin;
2801
3616
  exports.descriptors = descriptors;
2802
3617
  exports.getBackgroundsFileIds = getBackgroundsFileIds;
2803
3618
  exports.getBackgroundsSwatchIds = getBackgroundsSwatchIds;
3619
+ exports.getBlocksInSelection = getBlocksInSelection;
2804
3620
  exports.getBorderSwatchIds = getBorderSwatchIds;
2805
3621
  exports.getBoxShadowsSwatchIds = getBoxShadowsSwatchIds;
2806
3622
  exports.getBreakpoints = getBreakpoints;
@@ -2818,9 +3634,10 @@ exports.getElementPropControllerDescriptors = getElementPropControllerDescriptor
2818
3634
  exports.getElementSwatchIds = getElementSwatchIds;
2819
3635
  exports.getFileIds = getFileIds;
2820
3636
  exports.getInitialState = getInitialState$7;
2821
- exports.getInitialState$1 = getInitialState$1;
3637
+ exports.getInitialState$1 = getInitialState$2;
2822
3638
  exports.getIsInBuilder = getIsInBuilder;
2823
3639
  exports.getIsPreview = getIsPreview;
3640
+ exports.getLocales = getLocales;
2824
3641
  exports.getPageIds = getPageIds;
2825
3642
  exports.getPropController = getPropController;
2826
3643
  exports.getPropControllerDescriptors = getPropControllerDescriptors;
@@ -2836,17 +3653,23 @@ exports.isNonNullable = isNonNullable;
2836
3653
  exports.isPropControllersHandle = isPropControllersHandle;
2837
3654
  exports.merge = merge;
2838
3655
  exports.mergeSlotData = mergeSlotData;
3656
+ exports.onKeyDown = onKeyDown;
2839
3657
  exports.reducer = reducer$8;
2840
3658
  exports.reducer$1 = reducer$7;
2841
- exports.reducer$2 = reducer$6;
2842
- exports.reducer$3 = reducer$5;
2843
- exports.reducer$4 = reducer$4;
2844
- exports.reducer$5 = reducer$3;
2845
- exports.reducer$6 = reducer$2;
2846
- exports.reducer$7 = reducer$1;
3659
+ exports.reducer$2 = reducer$9;
3660
+ exports.reducer$3 = reducer$6;
3661
+ exports.reducer$4 = reducer$5;
3662
+ exports.reducer$5 = reducer$4;
3663
+ exports.reducer$6 = reducer$3;
3664
+ exports.reducer$7 = reducer$2;
3665
+ exports.reducer$8 = reducer$1;
2847
3666
  exports.richTextDAOToDTO = richTextDAOToDTO;
2848
3667
  exports.richTextDTOtoDAO = richTextDTOtoDAO;
2849
3668
  exports.richTextDTOtoSelection = richTextDTOtoSelection;
2850
3669
  exports.toSelectionDTO = toSelectionDTO;
2851
3670
  exports.unstable_RichTextV2 = unstable_RichTextV2;
3671
+ exports.unstable_StyleV2 = unstable_StyleV2;
3672
+ exports.unstable_useStyleV2ClassName = unstable_useStyleV2ClassName;
3673
+ exports.useStyle = useStyle;
3674
+ exports.withBlock = withBlock;
2852
3675
  //# sourceMappingURL=react-page.cjs.js.map