@makeswift/runtime 0.8.11 → 0.9.0

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 (182) hide show
  1. package/dist/Box.cjs.js +1 -1
  2. package/dist/Box.es.js +1 -1
  3. package/dist/Button.cjs.js +1 -1
  4. package/dist/Button.es.js +1 -1
  5. package/dist/Carousel.cjs.js +2 -2
  6. package/dist/Carousel.es.js +2 -2
  7. package/dist/Countdown.cjs.js +1 -1
  8. package/dist/Countdown.es.js +1 -1
  9. package/dist/Divider.cjs.js +1 -1
  10. package/dist/Divider.es.js +1 -1
  11. package/dist/Embed.cjs.js +1 -1
  12. package/dist/Embed.es.js +1 -1
  13. package/dist/Form.cjs.js +1 -1
  14. package/dist/Form.es.js +1 -1
  15. package/dist/Image.cjs.js +1 -1
  16. package/dist/Image.es.js +1 -1
  17. package/dist/LiveProvider.cjs.js +2 -2
  18. package/dist/LiveProvider.es.js +3 -3
  19. package/dist/Navigation.cjs.js +2 -2
  20. package/dist/Navigation.es.js +2 -2
  21. package/dist/PreviewProvider.cjs.js +17 -2
  22. package/dist/PreviewProvider.cjs.js.map +1 -1
  23. package/dist/PreviewProvider.es.js +19 -4
  24. package/dist/PreviewProvider.es.js.map +1 -1
  25. package/dist/ReadOnlyText.cjs.js +10 -9
  26. package/dist/ReadOnlyText.cjs.js.map +1 -1
  27. package/dist/ReadOnlyText.es.js +10 -9
  28. package/dist/ReadOnlyText.es.js.map +1 -1
  29. package/dist/ReadOnlyTextV2.cjs.js +10 -9
  30. package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
  31. package/dist/ReadOnlyTextV2.es.js +10 -9
  32. package/dist/ReadOnlyTextV2.es.js.map +1 -1
  33. package/dist/Root.cjs.js +1 -1
  34. package/dist/Root.es.js +1 -1
  35. package/dist/SocialLinks.cjs.js +1 -1
  36. package/dist/SocialLinks.es.js +1 -1
  37. package/dist/Text.cjs.js +1 -1
  38. package/dist/Text.es.js +1 -1
  39. package/dist/Video.cjs.js +1 -1
  40. package/dist/Video.es.js +1 -1
  41. package/dist/actions.cjs.js +16 -1
  42. package/dist/actions.cjs.js.map +1 -1
  43. package/dist/actions.es.js +14 -2
  44. package/dist/actions.es.js.map +1 -1
  45. package/dist/components.cjs.js +1 -1
  46. package/dist/components.es.js +1 -1
  47. package/dist/control-serialization.cjs.js +1 -1
  48. package/dist/control-serialization.es.js +2 -2
  49. package/dist/controls.cjs.js +2 -3
  50. package/dist/controls.cjs.js.map +1 -1
  51. package/dist/controls.es.js +1 -2
  52. package/dist/controls.es.js.map +1 -1
  53. package/dist/index.cjs.js +253 -218
  54. package/dist/index.cjs.js.map +1 -1
  55. package/dist/index.cjs10.js +11 -10
  56. package/dist/index.cjs10.js.map +1 -1
  57. package/dist/index.cjs2.js +1 -1
  58. package/dist/index.cjs5.js +0 -522
  59. package/dist/index.cjs5.js.map +1 -1
  60. package/dist/index.cjs6.js +1 -2
  61. package/dist/index.cjs6.js.map +1 -1
  62. package/dist/index.cjs7.js +0 -52
  63. package/dist/index.cjs7.js.map +1 -1
  64. package/dist/index.cjs8.js +1 -1
  65. package/dist/index.cjs9.js +42 -3
  66. package/dist/index.cjs9.js.map +1 -1
  67. package/dist/index.es.js +253 -218
  68. package/dist/index.es.js.map +1 -1
  69. package/dist/index.es10.js +12 -11
  70. package/dist/index.es10.js.map +1 -1
  71. package/dist/index.es2.js +2 -2
  72. package/dist/index.es5.js +2 -514
  73. package/dist/index.es5.js.map +1 -1
  74. package/dist/index.es6.js +1 -2
  75. package/dist/index.es6.js.map +1 -1
  76. package/dist/index.es7.js +2 -53
  77. package/dist/index.es7.js.map +1 -1
  78. package/dist/index.es8.js +1 -1
  79. package/dist/index.es9.js +43 -4
  80. package/dist/index.es9.js.map +1 -1
  81. package/dist/leaf.es.js +1 -1
  82. package/dist/main.cjs.js +3 -0
  83. package/dist/main.cjs.js.map +1 -1
  84. package/dist/main.es.js +2 -2
  85. package/dist/next.cjs.js +1 -1
  86. package/dist/next.es.js +1 -1
  87. package/dist/react-page.cjs.js +711 -61
  88. package/dist/react-page.cjs.js.map +1 -1
  89. package/dist/react-page.es.js +694 -56
  90. package/dist/react-page.es.js.map +1 -1
  91. package/dist/react.cjs.js +1 -1
  92. package/dist/react.es.js +1 -1
  93. package/dist/slate.cjs.js +11 -13
  94. package/dist/slate.cjs.js.map +1 -1
  95. package/dist/slate.es.js +4 -5
  96. package/dist/slate.es.js.map +1 -1
  97. package/dist/types/src/api/graphql/documents/queries.d.ts.map +1 -1
  98. package/dist/types/src/api/graphql/generated/types.d.ts +0 -8
  99. package/dist/types/src/api/graphql/generated/types.d.ts.map +1 -1
  100. package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
  101. package/dist/types/src/components/builtin/Carousel/register.d.ts.map +1 -1
  102. package/dist/types/src/components/builtin/Countdown/register.d.ts.map +1 -1
  103. package/dist/types/src/components/builtin/Divider/register.d.ts.map +1 -1
  104. package/dist/types/src/components/builtin/Embed/register.d.ts.map +1 -1
  105. package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
  106. package/dist/types/src/components/builtin/Form/register.d.ts.map +1 -1
  107. package/dist/types/src/components/builtin/Navigation/register.d.ts.map +1 -1
  108. package/dist/types/src/components/builtin/SocialLinks/register.d.ts.map +1 -1
  109. package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts.map +1 -1
  110. package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +1 -1
  111. package/dist/types/src/components/builtin/Text/components/Element/block.d.ts.map +1 -1
  112. package/dist/types/src/components/builtin/Video/register.d.ts.map +1 -1
  113. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +3 -3
  114. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
  115. package/dist/types/src/index.d.ts +2 -1
  116. package/dist/types/src/index.d.ts.map +1 -1
  117. package/dist/types/src/next/api-handler/handlers/manifest.d.ts +3 -1
  118. package/dist/types/src/next/api-handler/handlers/manifest.d.ts.map +1 -1
  119. package/dist/types/src/next/api-handler/handlers/proxy-preview-mode.d.ts.map +1 -1
  120. package/dist/types/src/next/api-handler/index.d.ts +2 -1
  121. package/dist/types/src/next/api-handler/index.d.ts.map +1 -1
  122. package/dist/types/src/next/client.d.ts +7 -7
  123. package/dist/types/src/next/client.d.ts.map +1 -1
  124. package/dist/types/src/next/index.d.ts +8 -5
  125. package/dist/types/src/next/index.d.ts.map +1 -1
  126. package/dist/types/src/next/preview-mode.d.ts +17 -3
  127. package/dist/types/src/next/preview-mode.d.ts.map +1 -1
  128. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
  129. package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
  130. package/dist/types/src/runtimes/react/index.d.ts +3 -1
  131. package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
  132. package/dist/types/src/slate/BlockPlugin/constants.d.ts.map +1 -0
  133. package/dist/types/src/slate/BlockPlugin/dedent.d.ts.map +1 -0
  134. package/dist/types/src/slate/BlockPlugin/indent.d.ts.map +1 -0
  135. package/dist/types/src/slate/BlockPlugin/index.d.ts +26 -3
  136. package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
  137. package/dist/types/src/slate/BlockPlugin/toggleList.d.ts.map +1 -0
  138. package/dist/types/src/slate/BlockPlugin/unwrapList.d.ts.map +1 -0
  139. package/dist/types/src/slate/BlockPlugin/utils/filterForSubtreeRoots.d.ts.map +1 -0
  140. package/dist/types/src/slate/BlockPlugin/utils/getSelectedListItems.d.ts.map +1 -0
  141. package/dist/types/src/slate/BlockPlugin/utils/location.d.ts.map +1 -0
  142. package/dist/types/src/slate/BlockPlugin/wrapList.d.ts.map +1 -0
  143. package/dist/types/src/slate/InlineModePlugin/index.d.ts +1 -1
  144. package/dist/types/src/slate/index.d.ts +0 -1
  145. package/dist/types/src/slate/index.d.ts.map +1 -1
  146. package/dist/types/src/slate/utils/element.d.ts +1 -2
  147. package/dist/types/src/slate/utils/element.d.ts.map +1 -1
  148. package/dist/types/src/state/actions.d.ts +26 -1
  149. package/dist/types/src/state/actions.d.ts.map +1 -1
  150. package/dist/types/src/state/modules/components-meta.d.ts +25 -1
  151. package/dist/types/src/state/modules/components-meta.d.ts.map +1 -1
  152. package/dist/types/src/state/modules/locales.d.ts +16 -0
  153. package/dist/types/src/state/modules/locales.d.ts.map +1 -0
  154. package/dist/types/src/state/react-builder-preview.d.ts +2 -0
  155. package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
  156. package/dist/types/src/state/react-page.d.ts +5 -1
  157. package/dist/types/src/state/react-page.d.ts.map +1 -1
  158. package/package.json +6 -3
  159. package/dist/select.cjs.js +0 -8
  160. package/dist/select.cjs.js.map +0 -1
  161. package/dist/select.es.js +0 -6
  162. package/dist/select.es.js.map +0 -1
  163. package/dist/types/src/slate/ListPlugin/constants.d.ts.map +0 -1
  164. package/dist/types/src/slate/ListPlugin/dedent.d.ts.map +0 -1
  165. package/dist/types/src/slate/ListPlugin/indent.d.ts.map +0 -1
  166. package/dist/types/src/slate/ListPlugin/index.d.ts +0 -17
  167. package/dist/types/src/slate/ListPlugin/index.d.ts.map +0 -1
  168. package/dist/types/src/slate/ListPlugin/toggleList.d.ts.map +0 -1
  169. package/dist/types/src/slate/ListPlugin/unwrapList.d.ts.map +0 -1
  170. package/dist/types/src/slate/ListPlugin/utils/filterForSubtreeRoots.d.ts.map +0 -1
  171. package/dist/types/src/slate/ListPlugin/utils/getSelectedListItems.d.ts.map +0 -1
  172. package/dist/types/src/slate/ListPlugin/utils/location.d.ts.map +0 -1
  173. package/dist/types/src/slate/ListPlugin/wrapList.d.ts.map +0 -1
  174. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/constants.d.ts +0 -0
  175. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/dedent.d.ts +0 -0
  176. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/indent.d.ts +0 -0
  177. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/toggleList.d.ts +0 -0
  178. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/unwrapList.d.ts +0 -0
  179. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/utils/filterForSubtreeRoots.d.ts +0 -0
  180. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/utils/getSelectedListItems.d.ts +0 -0
  181. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/utils/location.d.ts +0 -0
  182. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/wrapList.d.ts +0 -0
@@ -26,13 +26,59 @@ var redux = require("redux");
26
26
  var thunk = require("redux-thunk");
27
27
  var actions = require("./actions.cjs.js");
28
28
  var state_breakpoints = require("./state/breakpoints.cjs.js");
29
- require("slate");
30
- require("is-hotkey");
29
+ var slate = require("slate");
30
+ var isHotkey = require("is-hotkey");
31
31
  require("slate-react");
32
32
  function _interopDefaultLegacy(e) {
33
33
  return e && typeof e === "object" && "default" in e ? e : { "default": e };
34
34
  }
35
35
  var thunk__default = /* @__PURE__ */ _interopDefaultLegacy(thunk);
36
+ var isHotkey__default = /* @__PURE__ */ _interopDefaultLegacy(isHotkey);
37
+ const ComponentIcon = {
38
+ Billing: "billing",
39
+ Bolt: "bolt",
40
+ Button: "button",
41
+ Carousel: "carousel",
42
+ Chats: "chats",
43
+ Code: "code",
44
+ Countdown: "countdown",
45
+ Cube: "cube",
46
+ Database: "database",
47
+ Divider: "divider",
48
+ Form: "form",
49
+ Gallery: "gallery",
50
+ Help: "help",
51
+ Image: "image",
52
+ Layout: "layout",
53
+ Lock: "lock",
54
+ Navigation: "navigation",
55
+ SocialLinks: "social-links",
56
+ Star: "star",
57
+ Text: "text",
58
+ Users: "users",
59
+ Video: "video"
60
+ };
61
+ function getInitialState$8({
62
+ componentsMeta = /* @__PURE__ */ new Map()
63
+ } = {}) {
64
+ return componentsMeta;
65
+ }
66
+ function getComponentsMeta(state) {
67
+ return state;
68
+ }
69
+ function reducer$9(state = getInitialState$8(), action) {
70
+ switch (action.type) {
71
+ case actions.ActionTypes.REGISTER_COMPONENT:
72
+ return new Map(state).set(action.payload.type, action.payload.meta);
73
+ case actions.ActionTypes.UNREGISTER_COMPONENT: {
74
+ const nextState = new Map(state);
75
+ const deleted = nextState.delete(action.payload.type);
76
+ return deleted ? nextState : state;
77
+ }
78
+ default:
79
+ return state;
80
+ }
81
+ }
36
82
  function isElementReference(element) {
37
83
  return !("props" in element);
38
84
  }
@@ -97,27 +143,6 @@ function reducer$7(state = getInitialState$6(), action) {
97
143
  }
98
144
  }
99
145
  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
146
  propControllerDescriptors = /* @__PURE__ */ new Map()
122
147
  } = {}) {
123
148
  return propControllerDescriptors;
@@ -129,7 +154,7 @@ function getComponentPropControllerDescriptors$1(state, componentType) {
129
154
  var _a;
130
155
  return (_a = getPropControllerDescriptors$1(state).get(componentType)) != null ? _a : null;
131
156
  }
132
- function reducer$5(state = getInitialState$4(), action) {
157
+ function reducer$6(state = getInitialState$5(), action) {
133
158
  switch (action.type) {
134
159
  case actions.ActionTypes.REGISTER_COMPONENT:
135
160
  return new Map(state).set(action.payload.type, action.payload.propControllerDescriptors);
@@ -148,7 +173,7 @@ function isPropControllersHandle(value) {
148
173
  }
149
174
  return false;
150
175
  }
151
- function getInitialState$3() {
176
+ function getInitialState$4() {
152
177
  return { handles: /* @__PURE__ */ new Map(), instances: /* @__PURE__ */ new Map() };
153
178
  }
154
179
  function getPropControllersHandle(state, documentKey, elementKey) {
@@ -163,7 +188,7 @@ function getPropController(state, documentKey, elementKey, propName) {
163
188
  var _a, _b;
164
189
  return (_b = (_a = getPropControllers$1(state, documentKey, elementKey)) == null ? void 0 : _a[propName]) != null ? _b : null;
165
190
  }
166
- function reducer$4(state = getInitialState$3(), action) {
191
+ function reducer$5(state = getInitialState$4(), action) {
167
192
  var _a, _b, _c, _d;
168
193
  switch (action.type) {
169
194
  case actions.ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE: {
@@ -194,10 +219,10 @@ function reducer$4(state = getInitialState$3(), action) {
194
219
  return state;
195
220
  }
196
221
  }
197
- function getInitialState$2() {
222
+ function getInitialState$3() {
198
223
  return false;
199
224
  }
200
- function reducer$3(state = getInitialState$2(), action) {
225
+ function reducer$4(state = getInitialState$3(), action) {
201
226
  switch (action.type) {
202
227
  case actions.ActionTypes.SET_IS_IN_BUILDER:
203
228
  return action.payload;
@@ -205,13 +230,13 @@ function reducer$3(state = getInitialState$2(), action) {
205
230
  return state;
206
231
  }
207
232
  }
208
- function getInitialState$1(isPreview = false) {
233
+ function getInitialState$2(isPreview = false) {
209
234
  return isPreview;
210
235
  }
211
236
  function getIsPreview$1(state) {
212
237
  return state;
213
238
  }
214
- function reducer$2(state = getInitialState$1(), action) {
239
+ function reducer$3(state = getInitialState$2(), action) {
215
240
  switch (action.type) {
216
241
  default:
217
242
  return state;
@@ -222,10 +247,10 @@ const BuilderEditMode = {
222
247
  CONTENT: "content",
223
248
  INTERACT: "interact"
224
249
  };
225
- function getInitialState() {
250
+ function getInitialState$1() {
226
251
  return null;
227
252
  }
228
- function reducer$1(state = getInitialState(), action) {
253
+ function reducer$2(state = getInitialState$1(), action) {
229
254
  switch (action.type) {
230
255
  case actions.ActionTypes.SET_BUILDER_EDIT_MODE:
231
256
  return action.payload.editMode;
@@ -233,6 +258,34 @@ function reducer$1(state = getInitialState(), action) {
233
258
  return state;
234
259
  }
235
260
  }
261
+ function getInitialState(initialState) {
262
+ var _a, _b, _c;
263
+ return {
264
+ locales: (_a = initialState == null ? void 0 : initialState.locales) != null ? _a : [],
265
+ locale: (_b = initialState == null ? void 0 : initialState.locale) != null ? _b : null,
266
+ defaultLocale: (_c = initialState == null ? void 0 : initialState.defaultLocale) != null ? _c : null
267
+ };
268
+ }
269
+ function reducer$1(state = getInitialState(), action) {
270
+ switch (action.type) {
271
+ case actions.ActionTypes.SET_LOCALES: {
272
+ const locales = action.payload.locales;
273
+ return __spreadProps(__spreadValues({}, state), { locales });
274
+ }
275
+ case actions.ActionTypes.SET_LOCALE: {
276
+ if (action.payload.locale === state.locale)
277
+ return state;
278
+ return __spreadProps(__spreadValues({}, state), { locale: action.payload.locale });
279
+ }
280
+ case actions.ActionTypes.SET_DEFAULT_LOCALE: {
281
+ if (action.payload.defaultLocale === state.defaultLocale)
282
+ return state;
283
+ return __spreadProps(__spreadValues({}, state), { defaultLocale: action.payload.defaultLocale });
284
+ }
285
+ default:
286
+ return state;
287
+ }
288
+ }
236
289
  const ColorControlType = "makeswift::controls::color";
237
290
  function Color(config = {}) {
238
291
  return { type: ColorControlType, config };
@@ -508,11 +561,11 @@ class ListControl extends PropController {
508
561
  this.controls = /* @__PURE__ */ new Map();
509
562
  }
510
563
  }
511
- function copyListData(definition, value, context) {
564
+ function copyListData(definition2, value, context) {
512
565
  if (value == null)
513
566
  return value;
514
567
  return value && value.map((item) => __spreadProps(__spreadValues({}, item), {
515
- value: copy(definition.config.type, item.value, context)
568
+ value: copy(definition2.config.type, item.value, context)
516
569
  }));
517
570
  }
518
571
  const ShapeControlType = "makeswift::controls::shape";
@@ -558,11 +611,11 @@ class ShapeControl extends PropController {
558
611
  this.setControls();
559
612
  }
560
613
  }
561
- function copyShapeData(definition, value, context) {
614
+ function copyShapeData(definition2, value, context) {
562
615
  if (value == null)
563
616
  return value;
564
617
  const newValue = {};
565
- for (const [key, itemDefinition] of Object.entries(definition.config.type)) {
618
+ for (const [key, itemDefinition] of Object.entries(definition2.config.type)) {
566
619
  const prop = value[key];
567
620
  newValue[key] = copy(itemDefinition, prop, context);
568
621
  }
@@ -1558,8 +1611,8 @@ function copy$1(descriptor, value, context) {
1558
1611
  function copyElementReference(value, context) {
1559
1612
  return context.replacementContext.globalElementIds.get(value) || value;
1560
1613
  }
1561
- function copy(definition, value, context) {
1562
- switch (definition.type) {
1614
+ function copy(definition2, value, context) {
1615
+ switch (definition2.type) {
1563
1616
  case Types.Backgrounds:
1564
1617
  case Types.Grid:
1565
1618
  case Types.NavigationLinks:
@@ -1573,7 +1626,7 @@ function copy(definition, value, context) {
1573
1626
  case Types.Border:
1574
1627
  case Types.RichText:
1575
1628
  case Types.ElementID:
1576
- return copy$1(definition, value, context);
1629
+ return copy$1(definition2, value, context);
1577
1630
  case ColorControlType:
1578
1631
  return copyColorData(value, context);
1579
1632
  case ImageControlType:
@@ -1581,9 +1634,9 @@ function copy(definition, value, context) {
1581
1634
  case LinkControlType:
1582
1635
  return copyLinkData(value, context);
1583
1636
  case ShapeControlType:
1584
- return copyShapeData(definition, value, context);
1637
+ return copyShapeData(definition2, value, context);
1585
1638
  case ListControlType:
1586
- return copyListData(definition, value, context);
1639
+ return copyListData(definition2, value, context);
1587
1640
  case StyleControlType:
1588
1641
  return copyStyleData(value, context);
1589
1642
  case SlotControlType:
@@ -1592,14 +1645,18 @@ function copy(definition, value, context) {
1592
1645
  return value;
1593
1646
  }
1594
1647
  }
1595
- function merge(definition, a, b = a, context) {
1596
- switch (definition.type) {
1648
+ function merge(definition2, a, b = a, context) {
1649
+ switch (definition2.type) {
1597
1650
  case SlotControlType:
1598
1651
  return mergeSlotData(a, b, context);
1599
1652
  default:
1600
1653
  return b;
1601
1654
  }
1602
1655
  }
1656
+ const SelectControlType = "makeswift::controls::select";
1657
+ function Select(config) {
1658
+ return { type: SelectControlType, config };
1659
+ }
1603
1660
  const ObjectType = {
1604
1661
  Value: "value",
1605
1662
  Text: "text",
@@ -1645,6 +1702,582 @@ const BlockTextAlignment = {
1645
1702
  Right: "right",
1646
1703
  Justify: "justify"
1647
1704
  };
1705
+ const ElementUtils = {
1706
+ isRootBlock(node) {
1707
+ 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));
1708
+ },
1709
+ isBlock(node) {
1710
+ return slate.Element.isElement(node) && (this.isRootBlock(node) || slate.Element.isElementType(node, BlockType.ListItem) || slate.Element.isElementType(node, BlockType.ListItemChild));
1711
+ },
1712
+ isInline(node) {
1713
+ 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);
1714
+ },
1715
+ isConvertibleToListTextNode(node) {
1716
+ return !this.isList(node) && !this.isListItem(node) && !this.isListItemChild(node);
1717
+ },
1718
+ isList(node) {
1719
+ return slate.Element.isElementType(node, BlockType.OrderedList) || slate.Element.isElementType(node, BlockType.UnorderedList);
1720
+ },
1721
+ isListItem(node) {
1722
+ return slate.Element.isElementType(node, BlockType.ListItem);
1723
+ },
1724
+ isListItemChild(node) {
1725
+ return slate.Element.isElementType(node, BlockType.ListItemChild);
1726
+ },
1727
+ createText() {
1728
+ return { text: "" };
1729
+ },
1730
+ createParagraph() {
1731
+ return {
1732
+ children: [this.createText()],
1733
+ type: BlockType.Paragraph
1734
+ };
1735
+ },
1736
+ createList(type = BlockType.UnorderedList) {
1737
+ return { children: [this.createText()], type };
1738
+ },
1739
+ createListItem() {
1740
+ return {
1741
+ children: [this.createListItemChild()],
1742
+ type: BlockType.ListItem
1743
+ };
1744
+ },
1745
+ createListItemChild() {
1746
+ return {
1747
+ children: [this.createText()],
1748
+ type: BlockType.ListItemChild
1749
+ };
1750
+ }
1751
+ };
1752
+ function unhangRange(editor, range) {
1753
+ let [start, end] = slate.Range.edges(range);
1754
+ if (start.offset !== 0 || end.offset !== 0 || slate.Range.isCollapsed(range)) {
1755
+ return range;
1756
+ }
1757
+ const endBlock = slate.Editor.above(editor, {
1758
+ at: end,
1759
+ match: (n) => slate.Element.isElement(n) && slate.Editor.isBlock(editor, n)
1760
+ });
1761
+ const blockPath = endBlock ? endBlock[1] : [];
1762
+ const first = slate.Editor.start(editor, start);
1763
+ const before = { anchor: first, focus: end };
1764
+ let skip = true;
1765
+ for (const [node, path] of slate.Editor.nodes(editor, {
1766
+ at: before,
1767
+ match: slate.Text.isText,
1768
+ reverse: true
1769
+ })) {
1770
+ if (skip) {
1771
+ skip = false;
1772
+ continue;
1773
+ }
1774
+ if (node.text !== "" || slate.Path.isBefore(path, blockPath)) {
1775
+ end = { path, offset: node.text.length };
1776
+ break;
1777
+ }
1778
+ }
1779
+ return { anchor: start, focus: end };
1780
+ }
1781
+ function getSelection(editor) {
1782
+ if (editor.selection)
1783
+ return unhangRange(editor, editor.selection);
1784
+ return {
1785
+ anchor: slate.Editor.start(editor, []),
1786
+ focus: slate.Editor.end(editor, [])
1787
+ };
1788
+ }
1789
+ function getBlocksInSelection(editor) {
1790
+ return Array.from(slate.Editor.nodes(editor, {
1791
+ at: getSelection(editor),
1792
+ match: (node) => ElementUtils.isRootBlock(node)
1793
+ })).filter((entry) => ElementUtils.isRootBlock(entry[0]));
1794
+ }
1795
+ function getActiveBlockType(editor) {
1796
+ var _a;
1797
+ const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type);
1798
+ return rootBlocks.reduce((a, b) => a === b ? b : null, (_a = rootBlocks.at(0)) != null ? _a : null);
1799
+ }
1800
+ function setBlockKeyForDevice(editor, breakpoints, deviceId, key, value, options) {
1801
+ var _a, _b;
1802
+ const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
1803
+ if (!at)
1804
+ return;
1805
+ const rootElements = getBlocksInSelection(editor);
1806
+ for (const [node, path] of rootElements) {
1807
+ if (ElementUtils.isBlock(node)) {
1808
+ const deviceValues = (_b = node[key]) != null ? _b : [];
1809
+ const currentDeviceValue = state_breakpoints.findBreakpointOverride(breakpoints, deviceValues, deviceId, (v) => v);
1810
+ const nextDeviceValue = __spreadProps(__spreadValues({}, currentDeviceValue), {
1811
+ deviceId,
1812
+ value
1813
+ });
1814
+ slate.Transforms.setNodes(editor, {
1815
+ [key]: [...deviceValues.filter((v) => v.deviceId !== deviceId), nextDeviceValue]
1816
+ }, { at: path });
1817
+ }
1818
+ }
1819
+ }
1820
+ function clearBlockKeyForDevice(editor, deviceId, key) {
1821
+ var _a;
1822
+ const rootElements = getBlocksInSelection(editor);
1823
+ for (const [node, path] of rootElements) {
1824
+ if (ElementUtils.isBlock(node)) {
1825
+ const deviceOverrides = (_a = node[key]) != null ? _a : [];
1826
+ slate.Transforms.setNodes(editor, {
1827
+ [key]: deviceOverrides.filter((v) => v.deviceId !== deviceId)
1828
+ }, { at: path });
1829
+ }
1830
+ }
1831
+ }
1832
+ function wrapInline(editor, inline) {
1833
+ slate.Transforms.wrapNodes(editor, inline, {
1834
+ at: getSelection(editor),
1835
+ split: true
1836
+ });
1837
+ }
1838
+ function unwrapInline(editor, type) {
1839
+ slate.Transforms.unwrapNodes(editor, {
1840
+ match: (node) => ElementUtils.isInline(node) && node.type === type,
1841
+ at: getSelection(editor)
1842
+ });
1843
+ }
1844
+ const EditorUtils = {
1845
+ getFirstAncestorList(editor, path) {
1846
+ try {
1847
+ const parentList = slate.Editor.above(editor, {
1848
+ at: path,
1849
+ match: (node) => ElementUtils.isList(node)
1850
+ });
1851
+ return parentList != null ? parentList : null;
1852
+ } catch (e) {
1853
+ return null;
1854
+ }
1855
+ },
1856
+ getFirstAncestorListItem(editor, path) {
1857
+ try {
1858
+ const parentListItem = slate.Editor.above(editor, {
1859
+ at: path,
1860
+ match: (node) => ElementUtils.isListItem(node)
1861
+ });
1862
+ return parentListItem != null ? parentListItem : null;
1863
+ } catch (e) {
1864
+ return null;
1865
+ }
1866
+ }
1867
+ };
1868
+ const LIST_ITEM_CHILD_POSITION = 0;
1869
+ const LIST_ITEM_LIST_POSITION = 1;
1870
+ function filterForSubtreeRoots(entries) {
1871
+ return entries.filter(([, nodePath]) => !slate.Path.ancestors(nodePath).some((ancestor) => {
1872
+ return entries.some(([, path]) => slate.Path.equals(path, ancestor));
1873
+ }));
1874
+ }
1875
+ function unwrapPath(editor, listItemPath) {
1876
+ const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath);
1877
+ const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath);
1878
+ if (!parentList || listItemContainingParentList)
1879
+ return;
1880
+ slate.Editor.withoutNormalizing(editor, () => {
1881
+ const listItemTextPath = [...listItemPath, LIST_ITEM_CHILD_POSITION];
1882
+ const listItemNestedListPath = [...listItemPath, LIST_ITEM_LIST_POSITION];
1883
+ if (slate.Node.has(editor, listItemNestedListPath)) {
1884
+ slate.Transforms.setNodes(editor, { type: parentList[0].type }, { at: listItemNestedListPath });
1885
+ slate.Transforms.liftNodes(editor, { at: listItemNestedListPath });
1886
+ slate.Transforms.liftNodes(editor, { at: slate.Path.next(listItemPath) });
1887
+ }
1888
+ if (slate.Node.has(editor, listItemTextPath)) {
1889
+ slate.Transforms.setNodes(editor, { type: BlockType.Paragraph }, {
1890
+ at: listItemTextPath
1891
+ });
1892
+ slate.Transforms.liftNodes(editor, { at: listItemTextPath });
1893
+ slate.Transforms.liftNodes(editor, { at: listItemPath });
1894
+ }
1895
+ });
1896
+ }
1897
+ function unwrapList(editor, options) {
1898
+ var _a;
1899
+ const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
1900
+ if (!at)
1901
+ return;
1902
+ const listItems = Array.from(slate.Editor.nodes(editor, {
1903
+ at,
1904
+ match: (node) => {
1905
+ return slate.Element.isElement(node) && ElementUtils.isListItem(node);
1906
+ }
1907
+ }));
1908
+ const subRoots = filterForSubtreeRoots(listItems);
1909
+ const refs = subRoots.map(([_, path]) => slate.Editor.pathRef(editor, path));
1910
+ refs.forEach((ref) => {
1911
+ if (ref.current) {
1912
+ unwrapPath(editor, ref.current);
1913
+ }
1914
+ ref.unref();
1915
+ });
1916
+ }
1917
+ function wrapList(editor, options = { type: BlockType.UnorderedList }) {
1918
+ var _a;
1919
+ const at = (_a = options.at) != null ? _a : editor.selection;
1920
+ if (!at)
1921
+ return;
1922
+ const nonListEntries = Array.from(slate.Editor.nodes(editor, {
1923
+ at,
1924
+ match: (node) => {
1925
+ return slate.Element.isElement(node) && ElementUtils.isConvertibleToListTextNode(node);
1926
+ }
1927
+ }));
1928
+ const refs = nonListEntries.map(([_, path]) => slate.Editor.pathRef(editor, path));
1929
+ refs.forEach((ref) => {
1930
+ const path = ref.current;
1931
+ if (path) {
1932
+ slate.Editor.withoutNormalizing(editor, () => {
1933
+ slate.Transforms.setNodes(editor, { type: BlockType.ListItemChild }, {
1934
+ at: path
1935
+ });
1936
+ slate.Transforms.wrapNodes(editor, ElementUtils.createListItem(), {
1937
+ match: (node) => ElementUtils.isListItemChild(node),
1938
+ at: path
1939
+ });
1940
+ slate.Transforms.wrapNodes(editor, ElementUtils.createList(options.type), {
1941
+ at: path
1942
+ });
1943
+ });
1944
+ }
1945
+ ref.unref();
1946
+ });
1947
+ }
1948
+ const LocationUtils = {
1949
+ getStartPath(location) {
1950
+ if (slate.Range.isRange(location))
1951
+ return slate.Range.start(location).path;
1952
+ if (slate.Point.isPoint(location))
1953
+ return location.path;
1954
+ return location;
1955
+ }
1956
+ };
1957
+ function getSelectedListItems(editor) {
1958
+ var _a, _b;
1959
+ if (!editor.selection)
1960
+ return [];
1961
+ const start = LocationUtils.getStartPath(editor.selection);
1962
+ const listItems = slate.Editor.nodes(editor, {
1963
+ at: editor.selection,
1964
+ match: (node) => ElementUtils.isListItem(node)
1965
+ });
1966
+ const firstAncestorPath = (_b = (_a = EditorUtils.getFirstAncestorListItem(editor, start)) == null ? void 0 : _a[1]) != null ? _b : [];
1967
+ return Array.from(listItems).filter((node) => slate.Path.isDescendant(start, node[1]) ? slate.Path.equals(node[1], firstAncestorPath) : !slate.Path.isAfter(start, node[1]));
1968
+ }
1969
+ function indentPath(editor, path) {
1970
+ const parent = slate.Node.parent(editor, path);
1971
+ if (!path || !slate.Path.hasPrevious(path) || !ElementUtils.isList(parent))
1972
+ return;
1973
+ const previosPath = slate.Path.previous(path);
1974
+ const previousChildListPath = [...previosPath, LIST_ITEM_LIST_POSITION];
1975
+ const previousHasChildList = slate.Node.has(editor, previousChildListPath);
1976
+ slate.Editor.withoutNormalizing(editor, () => {
1977
+ if (!previousHasChildList) {
1978
+ slate.Transforms.insertNodes(editor, ElementUtils.createList(parent.type), {
1979
+ at: previousChildListPath
1980
+ });
1981
+ }
1982
+ const previousChildList = slate.Node.get(editor, previousChildListPath);
1983
+ if (ElementUtils.isList(previousChildList)) {
1984
+ const index = previousHasChildList ? previousChildList.children.length : 0;
1985
+ slate.Transforms.moveNodes(editor, {
1986
+ at: path,
1987
+ to: [...previousChildListPath, index]
1988
+ });
1989
+ }
1990
+ });
1991
+ }
1992
+ function indent(editor) {
1993
+ if (!editor.selection)
1994
+ return;
1995
+ const listItems = getSelectedListItems(editor);
1996
+ const subRoots = filterForSubtreeRoots(listItems);
1997
+ const refs = subRoots.map(([_, path]) => slate.Editor.pathRef(editor, path));
1998
+ refs.forEach((ref) => {
1999
+ if (ref.current) {
2000
+ indentPath(editor, ref.current);
2001
+ }
2002
+ ref.unref();
2003
+ });
2004
+ }
2005
+ function dedentPath(editor, listItemPath) {
2006
+ const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath);
2007
+ const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath);
2008
+ if (!parentList || !listItemContainingParentList)
2009
+ return;
2010
+ const [parentListNode, parentListPath] = parentList;
2011
+ const [_, listItemContainingParentListPath] = listItemContainingParentList;
2012
+ const listItemPosition = listItemPath[listItemPath.length - 1];
2013
+ const previousSiblings = parentListNode.children.slice(0, listItemPosition);
2014
+ const nextSiblings = parentListNode.children.slice(listItemPosition + 1);
2015
+ slate.Editor.withoutNormalizing(editor, () => {
2016
+ nextSiblings.forEach(() => {
2017
+ const nextSiblingPath = [...parentListPath, listItemPosition + 1];
2018
+ indentPath(editor, nextSiblingPath);
2019
+ });
2020
+ slate.Transforms.moveNodes(editor, {
2021
+ at: listItemPath,
2022
+ to: slate.Path.next(listItemContainingParentListPath)
2023
+ });
2024
+ if (previousSiblings.length === 0) {
2025
+ slate.Transforms.removeNodes(editor, { at: parentListPath });
2026
+ }
2027
+ });
2028
+ }
2029
+ function dedent(editor) {
2030
+ if (!editor.selection)
2031
+ return;
2032
+ const listItems = getSelectedListItems(editor);
2033
+ const subRoots = filterForSubtreeRoots(listItems);
2034
+ const refs = subRoots.map(([_, path]) => slate.Editor.pathRef(editor, path));
2035
+ refs.forEach((ref) => {
2036
+ if (ref.current) {
2037
+ dedentPath(editor, ref.current);
2038
+ }
2039
+ ref.unref();
2040
+ });
2041
+ }
2042
+ function toggleList(editor, options = { type: BlockType.UnorderedList }) {
2043
+ var _a;
2044
+ const at = (_a = options.at) != null ? _a : editor.selection;
2045
+ if (at == null)
2046
+ return;
2047
+ const start = LocationUtils.getStartPath(at);
2048
+ const ancestorPath = slate.Path.ancestors(start).at(1);
2049
+ if (!ancestorPath || !slate.Node.has(editor, ancestorPath))
2050
+ return;
2051
+ const ancestor = slate.Node.get(editor, ancestorPath);
2052
+ if (!ElementUtils.isList(ancestor)) {
2053
+ return wrapList(editor, { type: options.type, at });
2054
+ }
2055
+ if (ancestor.type === options.type) {
2056
+ unwrapList(editor, { at });
2057
+ } else {
2058
+ slate.Transforms.setNodes(editor, { type: options.type }, { at: ancestorPath });
2059
+ }
2060
+ }
2061
+ const BlockActions = {
2062
+ setBlockKeyForDevice,
2063
+ clearBlockKeyForDevice,
2064
+ wrapInline,
2065
+ unwrapInline
2066
+ };
2067
+ const ListActions = {
2068
+ unwrapList,
2069
+ wrapList,
2070
+ indent,
2071
+ dedent,
2072
+ toggleList
2073
+ };
2074
+ function onKeyDown(e, editor) {
2075
+ if (!editor.selection || Array.from(slate.Editor.nodes(editor, { match: (node) => ElementUtils.isListItem(node) })).length === 0)
2076
+ return;
2077
+ if (isHotkey__default["default"]("shift+tab", e)) {
2078
+ e.preventDefault();
2079
+ ListActions.dedent(editor);
2080
+ }
2081
+ if (isHotkey__default["default"]("tab", e)) {
2082
+ e.preventDefault();
2083
+ ListActions.indent(editor);
2084
+ }
2085
+ if (isHotkey__default["default"]("backspace", e)) {
2086
+ if (!editor.selection)
2087
+ return;
2088
+ if (slate.Range.isExpanded(editor.selection))
2089
+ return;
2090
+ const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path);
2091
+ if (editor.selection.anchor.offset === 0 && listItem) {
2092
+ e.preventDefault();
2093
+ const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1]);
2094
+ const list = EditorUtils.getFirstAncestorList(editor, listItem[1]);
2095
+ if (parentListItem) {
2096
+ ListActions.dedent(editor);
2097
+ } else if (list) {
2098
+ ListActions.unwrapList(editor);
2099
+ }
2100
+ return;
2101
+ }
2102
+ }
2103
+ if (isHotkey__default["default"]("enter", e)) {
2104
+ e.preventDefault();
2105
+ if (!editor.selection)
2106
+ return;
2107
+ if (slate.Range.isExpanded(editor.selection)) {
2108
+ slate.Transforms.delete(editor);
2109
+ return;
2110
+ }
2111
+ const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path);
2112
+ if (editor.selection.anchor.offset === 0 && listItem && slate.Editor.string(editor, listItem[1]) === "") {
2113
+ const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1]);
2114
+ if (parentListItem) {
2115
+ ListActions.dedent(editor);
2116
+ } else {
2117
+ ListActions.unwrapList(editor);
2118
+ }
2119
+ return;
2120
+ }
2121
+ slate.Transforms.splitNodes(editor, {
2122
+ at: editor.selection,
2123
+ always: true,
2124
+ match: (node) => ElementUtils.isListItem(node)
2125
+ });
2126
+ }
2127
+ if (isHotkey__default["default"]("shift+enter", e)) {
2128
+ e.preventDefault();
2129
+ editor.insertText("\n");
2130
+ }
2131
+ }
2132
+ function withBlock(editor) {
2133
+ const { normalizeNode } = editor;
2134
+ editor.isInline = (entry) => {
2135
+ return ElementUtils.isInline(entry);
2136
+ };
2137
+ editor.normalizeNode = (entry) => {
2138
+ var _a;
2139
+ const [normalizationNode, normalizationPath] = entry;
2140
+ if (ElementUtils.isBlock(normalizationNode) && ((_a = normalizationNode == null ? void 0 : normalizationNode.textAlign) == null ? void 0 : _a.length) == 0) {
2141
+ slate.Transforms.unsetNodes(editor, "textAlign", { at: normalizationPath });
2142
+ return;
2143
+ }
2144
+ if (ElementUtils.isListItem(normalizationNode)) {
2145
+ const pathToListItemText = [...normalizationPath, LIST_ITEM_CHILD_POSITION];
2146
+ if (slate.Node.has(editor, pathToListItemText)) {
2147
+ const nodeInListItemTextPosition = slate.Node.get(editor, pathToListItemText);
2148
+ if (ElementUtils.isRootBlock(nodeInListItemTextPosition)) {
2149
+ slate.Transforms.setNodes(editor, { type: BlockType.ListItemChild }, {
2150
+ at: pathToListItemText
2151
+ });
2152
+ return;
2153
+ }
2154
+ } else {
2155
+ slate.Transforms.insertNodes(editor, ElementUtils.createListItem(), {
2156
+ at: pathToListItemText
2157
+ });
2158
+ return;
2159
+ }
2160
+ }
2161
+ if (!slate.Text.isText(normalizationNode)) {
2162
+ const mergeableChildren = Array.from(slate.Node.children(editor, normalizationPath)).map((child, index, children) => {
2163
+ const potentialNodeToBeMerged = children.at(index + 1);
2164
+ if (!potentialNodeToBeMerged || !ElementUtils.isList(potentialNodeToBeMerged[0]) || !ElementUtils.isList(child[0]) || potentialNodeToBeMerged[0].type !== child[0].type) {
2165
+ return null;
2166
+ }
2167
+ return [
2168
+ slate.Editor.pathRef(editor, child[1]),
2169
+ slate.Editor.pathRef(editor, potentialNodeToBeMerged[1])
2170
+ ];
2171
+ }).filter((mergeableNodes) => Boolean(mergeableNodes));
2172
+ if (mergeableChildren.length !== 0) {
2173
+ mergeableChildren.reverse().forEach(([nodePathRef, nodeToBeMergedPathRef]) => {
2174
+ const nodePath = nodePathRef.current;
2175
+ const nodeToBeMergedPath = nodeToBeMergedPathRef.current;
2176
+ if (nodePath == null || nodeToBeMergedPath == null)
2177
+ return;
2178
+ const nodeChildren = Array.from(slate.Node.children(editor, nodePath));
2179
+ const childrenToBeMerged = Array.from(slate.Node.children(editor, nodeToBeMergedPath));
2180
+ slate.Editor.withoutNormalizing(editor, () => {
2181
+ childrenToBeMerged.reverse().forEach(([_, childPath]) => {
2182
+ slate.Transforms.moveNodes(editor, {
2183
+ at: childPath,
2184
+ to: [...nodePath, nodeChildren.length]
2185
+ });
2186
+ });
2187
+ slate.Transforms.removeNodes(editor, { at: nodeToBeMergedPath });
2188
+ });
2189
+ nodePathRef.unref();
2190
+ nodeToBeMergedPathRef.unref();
2191
+ });
2192
+ return;
2193
+ }
2194
+ }
2195
+ normalizeNode(entry);
2196
+ };
2197
+ return editor;
2198
+ }
2199
+ const definition = Select({
2200
+ label: "Block",
2201
+ labelOrientation: "horizontal",
2202
+ options: [
2203
+ {
2204
+ value: BlockType.Paragraph,
2205
+ label: "Paragraph"
2206
+ },
2207
+ {
2208
+ value: BlockType.Heading1,
2209
+ label: "Heading 1"
2210
+ },
2211
+ {
2212
+ value: BlockType.Heading2,
2213
+ label: "Heading 2"
2214
+ },
2215
+ {
2216
+ value: BlockType.Heading3,
2217
+ label: "Heading 3"
2218
+ },
2219
+ {
2220
+ value: BlockType.Heading4,
2221
+ label: "Heading 4"
2222
+ },
2223
+ {
2224
+ value: BlockType.Heading5,
2225
+ label: "Heading 5"
2226
+ },
2227
+ {
2228
+ value: BlockType.Heading6,
2229
+ label: "Heading 6"
2230
+ },
2231
+ {
2232
+ value: BlockType.UnorderedList,
2233
+ label: "Bulleted list"
2234
+ },
2235
+ {
2236
+ value: BlockType.OrderedList,
2237
+ label: "Numbered list"
2238
+ },
2239
+ {
2240
+ value: BlockType.BlockQuote,
2241
+ label: "Quote"
2242
+ }
2243
+ ],
2244
+ defaultValue: BlockType.Paragraph
2245
+ });
2246
+ function BlockPlugin() {
2247
+ return createRichTextV2Plugin({
2248
+ withPlugin: withBlock,
2249
+ onKeyDown,
2250
+ control: {
2251
+ definition,
2252
+ onChange: (editor, value) => {
2253
+ const activeBlockType = getActiveBlockType(editor);
2254
+ if (value === BlockType.UnorderedList || value === BlockType.OrderedList) {
2255
+ ListActions.toggleList(editor, {
2256
+ type: value,
2257
+ at: getSelection(editor)
2258
+ });
2259
+ } else if (activeBlockType === value) {
2260
+ slate.Transforms.setNodes(editor, {
2261
+ type: BlockType.Default
2262
+ }, { at: getSelection(editor) });
2263
+ } else {
2264
+ ListActions.unwrapList(editor, {
2265
+ at: getSelection(editor)
2266
+ });
2267
+ slate.Transforms.setNodes(editor, {
2268
+ type: value != null ? value : BlockType.Default
2269
+ }, { at: getSelection(editor) });
2270
+ }
2271
+ },
2272
+ getValue: (editor) => {
2273
+ const activeBlock = getActiveBlockType(editor);
2274
+ if (activeBlock === RootBlockType.Text || activeBlock === RootBlockType.Default)
2275
+ return void 0;
2276
+ return activeBlock;
2277
+ }
2278
+ }
2279
+ });
2280
+ }
1648
2281
  const RichTextV2ControlType = "makeswift::controls::rich-text-v2";
1649
2282
  const RichTextV2Mode = {
1650
2283
  Inline: "makeswift::controls::rich-text-v2::mode::inline",
@@ -1653,9 +2286,9 @@ const RichTextV2Mode = {
1653
2286
  function createRichTextV2Plugin({
1654
2287
  control,
1655
2288
  withPlugin,
1656
- onKeyDown
2289
+ onKeyDown: onKeyDown2
1657
2290
  }) {
1658
- return { control, withPlugin, onKeyDown };
2291
+ return { control, withPlugin, onKeyDown: onKeyDown2 };
1659
2292
  }
1660
2293
  function unstable_RichTextV2(config = {}) {
1661
2294
  return { type: RichTextV2ControlType, config };
@@ -2545,13 +3178,14 @@ var introspection = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2545
3178
  const reducer = redux.combineReducers({
2546
3179
  documents: reducer$8,
2547
3180
  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
3181
+ componentsMeta: reducer$9,
3182
+ propControllers: reducer$6,
3183
+ propControllerHandles: reducer$5,
3184
+ isInBuilder: reducer$4,
3185
+ isPreview: reducer$3,
3186
+ builderEditMode: reducer$2,
3187
+ breakpoints: state_breakpoints.reducer,
3188
+ locales: reducer$1
2555
3189
  });
2556
3190
  function getDocumentsStateSlice(state) {
2557
3191
  return state.documents;
@@ -2694,17 +3328,24 @@ function getBuilderEditMode(state) {
2694
3328
  function getBreakpoints(state) {
2695
3329
  return state.breakpoints;
2696
3330
  }
3331
+ function getLocales(state) {
3332
+ return state.locales;
3333
+ }
2697
3334
  function configureStore({
2698
3335
  rootElements,
2699
3336
  preloadedState,
2700
- breakpoints
3337
+ breakpoints,
3338
+ locales
2701
3339
  } = {}) {
2702
3340
  return redux.createStore(reducer, __spreadProps(__spreadValues({}, preloadedState), {
2703
3341
  documents: getInitialState$7({ rootElements }),
2704
- breakpoints: state_breakpoints.getInitialState(breakpoints != null ? breakpoints : preloadedState == null ? void 0 : preloadedState.breakpoints)
3342
+ breakpoints: state_breakpoints.getInitialState(breakpoints != null ? breakpoints : preloadedState == null ? void 0 : preloadedState.breakpoints),
3343
+ locales: getInitialState(locales != null ? locales : preloadedState == null ? void 0 : preloadedState.locales)
2705
3344
  }), redux.applyMiddleware(thunk__default["default"]));
2706
3345
  }
2707
3346
  exports.Backgrounds = Backgrounds;
3347
+ exports.BlockActions = BlockActions;
3348
+ exports.BlockPlugin = BlockPlugin;
2708
3349
  exports.BlockTextAlignment = BlockTextAlignment;
2709
3350
  exports.BlockType = BlockType;
2710
3351
  exports.Border = Border;
@@ -2715,8 +3356,10 @@ exports.BuilderEditMode = BuilderEditMode;
2715
3356
  exports.Checkbox = Checkbox;
2716
3357
  exports.Color = Color;
2717
3358
  exports.ColorControlType = ColorControlType;
3359
+ exports.ComponentIcon = ComponentIcon;
2718
3360
  exports.Date = Date;
2719
3361
  exports.ElementID = ElementID;
3362
+ exports.ElementUtils = ElementUtils;
2720
3363
  exports.Font = Font;
2721
3364
  exports.GapX = GapX;
2722
3365
  exports.GapY = GapY;
@@ -2731,6 +3374,7 @@ exports.Link = Link;
2731
3374
  exports.Link$1 = Link$1;
2732
3375
  exports.LinkControlType = LinkControlType;
2733
3376
  exports.List = List$1;
3377
+ exports.ListActions = ListActions;
2734
3378
  exports.ListControl = ListControl;
2735
3379
  exports.ListControlMessageType = ListControlMessageType;
2736
3380
  exports.ListControlType = ListControlType;
@@ -2758,6 +3402,8 @@ exports.RichTextV2ControlMessageType = RichTextV2ControlMessageType;
2758
3402
  exports.RichTextV2ControlType = RichTextV2ControlType;
2759
3403
  exports.RichTextV2Mode = RichTextV2Mode;
2760
3404
  exports.RootBlockType = RootBlockType;
3405
+ exports.Select = Select;
3406
+ exports.SelectControlType = SelectControlType;
2761
3407
  exports.Shadows = Shadows;
2762
3408
  exports.ShadowsPropControllerFormat = ShadowsPropControllerFormat;
2763
3409
  exports.Shape = Shape$1;
@@ -2818,9 +3464,10 @@ exports.getElementPropControllerDescriptors = getElementPropControllerDescriptor
2818
3464
  exports.getElementSwatchIds = getElementSwatchIds;
2819
3465
  exports.getFileIds = getFileIds;
2820
3466
  exports.getInitialState = getInitialState$7;
2821
- exports.getInitialState$1 = getInitialState$1;
3467
+ exports.getInitialState$1 = getInitialState$2;
2822
3468
  exports.getIsInBuilder = getIsInBuilder;
2823
3469
  exports.getIsPreview = getIsPreview;
3470
+ exports.getLocales = getLocales;
2824
3471
  exports.getPageIds = getPageIds;
2825
3472
  exports.getPropController = getPropController;
2826
3473
  exports.getPropControllerDescriptors = getPropControllerDescriptors;
@@ -2836,17 +3483,20 @@ exports.isNonNullable = isNonNullable;
2836
3483
  exports.isPropControllersHandle = isPropControllersHandle;
2837
3484
  exports.merge = merge;
2838
3485
  exports.mergeSlotData = mergeSlotData;
3486
+ exports.onKeyDown = onKeyDown;
2839
3487
  exports.reducer = reducer$8;
2840
3488
  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;
3489
+ exports.reducer$2 = reducer$9;
3490
+ exports.reducer$3 = reducer$6;
3491
+ exports.reducer$4 = reducer$5;
3492
+ exports.reducer$5 = reducer$4;
3493
+ exports.reducer$6 = reducer$3;
3494
+ exports.reducer$7 = reducer$2;
3495
+ exports.reducer$8 = reducer$1;
2847
3496
  exports.richTextDAOToDTO = richTextDAOToDTO;
2848
3497
  exports.richTextDTOtoDAO = richTextDTOtoDAO;
2849
3498
  exports.richTextDTOtoSelection = richTextDTOtoSelection;
2850
3499
  exports.toSelectionDTO = toSelectionDTO;
2851
3500
  exports.unstable_RichTextV2 = unstable_RichTextV2;
3501
+ exports.withBlock = withBlock;
2852
3502
  //# sourceMappingURL=react-page.cjs.js.map