@makeswift/runtime 0.9.0 → 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.
- package/dist/Box.cjs.js +15 -14
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +10 -9
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +12 -11
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +10 -9
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +26 -25
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +5 -4
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +15 -14
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +7 -6
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +12 -11
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +10 -9
- package/dist/Divider.es.js.map +1 -1
- package/dist/Embed.cjs.js +4 -29
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +3 -28
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +51 -50
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +7 -6
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +8 -7
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +7 -6
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +4 -3
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +6 -5
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +26 -25
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +5 -4
- package/dist/Navigation.es.js.map +1 -1
- package/dist/PreviewProvider.cjs.js +6 -5
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +6 -5
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +14 -13
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +9 -8
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +11 -10
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +7 -6
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +7 -6
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +5 -4
- package/dist/Root.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +14 -13
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +10 -9
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Text.cjs.js +4 -3
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +5 -4
- package/dist/Text.es.js.map +1 -1
- package/dist/Video.cjs.js +4 -29
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +3 -28
- package/dist/Video.es.js.map +1 -1
- package/dist/builder.cjs.js +5 -0
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +5 -0
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +9 -8
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +9 -8
- package/dist/components.es.js.map +1 -1
- package/dist/control-serialization.cjs.js +88 -9
- package/dist/control-serialization.cjs.js.map +1 -1
- package/dist/control-serialization.es.js +89 -10
- package/dist/control-serialization.es.js.map +1 -1
- package/dist/controls.cjs.js +10 -0
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +6 -1
- package/dist/controls.es.js.map +1 -1
- package/dist/deepEqual.cjs.js +40 -0
- package/dist/deepEqual.cjs.js.map +1 -0
- package/dist/deepEqual.es.js +39 -0
- package/dist/deepEqual.es.js.map +1 -0
- package/dist/index.cjs.js +62 -91
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs10.js +8 -7
- package/dist/index.cjs10.js.map +1 -1
- package/dist/index.cjs2.js +13 -13
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs4.js +2 -1
- package/dist/index.cjs4.js.map +1 -1
- package/dist/index.cjs8.js +4 -3
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.cjs9.js +69 -105
- package/dist/index.cjs9.js.map +1 -1
- package/dist/index.es.js +47 -75
- package/dist/index.es.js.map +1 -1
- package/dist/index.es10.js +5 -4
- package/dist/index.es10.js.map +1 -1
- package/dist/index.es2.js +2 -2
- package/dist/index.es3.js +1 -1
- package/dist/index.es4.js +2 -1
- package/dist/index.es4.js.map +1 -1
- package/dist/index.es6.js +1 -1
- package/dist/index.es8.js +4 -3
- package/dist/index.es8.js.map +1 -1
- package/dist/index.es9.js +71 -107
- package/dist/index.es9.js.map +1 -1
- package/dist/leaf.cjs.js +1 -1
- package/dist/leaf.cjs.js.map +1 -1
- package/dist/leaf.es.js +2 -2
- package/dist/main.cjs.js +5 -0
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +5 -0
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +4 -3
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +5 -4
- package/dist/next.es.js.map +1 -1
- package/dist/prop-controllers.cjs.js +5 -0
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +5 -0
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/react-page.cjs.js +376 -203
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +349 -204
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +4 -3
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +4 -3
- package/dist/react.es.js.map +1 -1
- package/dist/slate.cjs.js +88 -4
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +89 -5
- package/dist/slate.es.js.map +1 -1
- package/dist/types/src/builder/serialization/control-serialization.d.ts +3 -3
- package/dist/types/src/builder/serialization/control-serialization.d.ts.map +1 -1
- package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts +2 -2
- package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/builder/serialization/controls/style-v2.d.ts +5 -0
- package/dist/types/src/builder/serialization/controls/style-v2.d.ts.map +1 -0
- package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
- package/dist/types/src/components/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
- package/dist/types/src/components/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -1
- package/dist/types/src/controls/control.d.ts +3 -2
- package/dist/types/src/controls/control.d.ts.map +1 -1
- package/dist/types/src/controls/index.d.ts +1 -0
- package/dist/types/src/controls/index.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +8 -3
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/controls/style-v2.d.ts +55 -0
- package/dist/types/src/controls/style-v2.d.ts.map +1 -0
- package/dist/types/src/prop-controllers/descriptors.d.ts +4 -3
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/instances.d.ts +2 -2
- package/dist/types/src/prop-controllers/instances.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts +3 -2
- package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts +2 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/style-v2.d.ts +4 -0
- package/dist/types/src/runtimes/react/controls/style-v2.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/index.d.ts +3 -0
- package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlineModePlugin/index.d.ts +1 -0
- package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts +9 -0
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/index.d.ts +1 -0
- package/dist/types/src/slate/index.d.ts.map +1 -1
- package/dist/types/src/slate/types.d.ts +18 -0
- package/dist/types/src/slate/types.d.ts.map +1 -1
- package/dist/useMediaQuery.es.js +1 -1
- package/package.json +1 -1
package/dist/react-page.cjs.js
CHANGED
|
@@ -22,17 +22,44 @@ 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");
|
|
30
|
+
var React = require("react");
|
|
31
|
+
var css = require("@emotion/css");
|
|
32
|
+
var serialize = require("@emotion/serialize");
|
|
33
|
+
var utils = require("@emotion/utils");
|
|
29
34
|
var slate = require("slate");
|
|
30
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);
|
|
36
63
|
var isHotkey__default = /* @__PURE__ */ _interopDefaultLegacy(isHotkey);
|
|
37
64
|
const ComponentIcon = {
|
|
38
65
|
Billing: "billing",
|
|
@@ -101,8 +128,8 @@ function getDocuments(state) {
|
|
|
101
128
|
return state;
|
|
102
129
|
}
|
|
103
130
|
function getDocument$1(state, documentKey) {
|
|
104
|
-
var
|
|
105
|
-
return (
|
|
131
|
+
var _a2;
|
|
132
|
+
return (_a2 = getDocuments(state).get(documentKey)) != null ? _a2 : null;
|
|
106
133
|
}
|
|
107
134
|
function reducer$8(state = getInitialState$7(), action) {
|
|
108
135
|
switch (action.type) {
|
|
@@ -126,8 +153,8 @@ function getReactComponents(state) {
|
|
|
126
153
|
return state;
|
|
127
154
|
}
|
|
128
155
|
function getReactComponent$1(state, type) {
|
|
129
|
-
var
|
|
130
|
-
return (
|
|
156
|
+
var _a2;
|
|
157
|
+
return (_a2 = getReactComponents(state).get(type)) != null ? _a2 : null;
|
|
131
158
|
}
|
|
132
159
|
function reducer$7(state = getInitialState$6(), action) {
|
|
133
160
|
switch (action.type) {
|
|
@@ -151,8 +178,8 @@ function getPropControllerDescriptors$1(state) {
|
|
|
151
178
|
return state;
|
|
152
179
|
}
|
|
153
180
|
function getComponentPropControllerDescriptors$1(state, componentType) {
|
|
154
|
-
var
|
|
155
|
-
return (
|
|
181
|
+
var _a2;
|
|
182
|
+
return (_a2 = getPropControllerDescriptors$1(state).get(componentType)) != null ? _a2 : null;
|
|
156
183
|
}
|
|
157
184
|
function reducer$6(state = getInitialState$5(), action) {
|
|
158
185
|
switch (action.type) {
|
|
@@ -177,24 +204,24 @@ function getInitialState$4() {
|
|
|
177
204
|
return { handles: /* @__PURE__ */ new Map(), instances: /* @__PURE__ */ new Map() };
|
|
178
205
|
}
|
|
179
206
|
function getPropControllersHandle(state, documentKey, elementKey) {
|
|
180
|
-
var
|
|
181
|
-
return (_b = (
|
|
207
|
+
var _a2, _b;
|
|
208
|
+
return (_b = (_a2 = state.handles.get(documentKey)) == null ? void 0 : _a2.get(elementKey)) != null ? _b : null;
|
|
182
209
|
}
|
|
183
210
|
function getPropControllers$1(state, documentKey, elementKey) {
|
|
184
|
-
var
|
|
185
|
-
return (_b = (
|
|
211
|
+
var _a2, _b;
|
|
212
|
+
return (_b = (_a2 = state.instances.get(documentKey)) == null ? void 0 : _a2.get(elementKey)) != null ? _b : null;
|
|
186
213
|
}
|
|
187
214
|
function getPropController(state, documentKey, elementKey, propName) {
|
|
188
|
-
var
|
|
189
|
-
return (_b = (
|
|
215
|
+
var _a2, _b;
|
|
216
|
+
return (_b = (_a2 = getPropControllers$1(state, documentKey, elementKey)) == null ? void 0 : _a2[propName]) != null ? _b : null;
|
|
190
217
|
}
|
|
191
218
|
function reducer$5(state = getInitialState$4(), action) {
|
|
192
|
-
var
|
|
219
|
+
var _a2, _b, _c, _d;
|
|
193
220
|
switch (action.type) {
|
|
194
221
|
case actions.ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE: {
|
|
195
222
|
const { documentKey, elementKey, handle } = action.payload;
|
|
196
223
|
return __spreadProps(__spreadValues({}, state), {
|
|
197
|
-
handles: new Map(state.handles).set(documentKey, new Map((
|
|
224
|
+
handles: new Map(state.handles).set(documentKey, new Map((_a2 = state.handles.get(documentKey)) != null ? _a2 : []).set(elementKey, handle))
|
|
198
225
|
});
|
|
199
226
|
}
|
|
200
227
|
case actions.ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE: {
|
|
@@ -259,9 +286,9 @@ function reducer$2(state = getInitialState$1(), action) {
|
|
|
259
286
|
}
|
|
260
287
|
}
|
|
261
288
|
function getInitialState(initialState) {
|
|
262
|
-
var
|
|
289
|
+
var _a2, _b, _c;
|
|
263
290
|
return {
|
|
264
|
-
locales: (
|
|
291
|
+
locales: (_a2 = initialState == null ? void 0 : initialState.locales) != null ? _a2 : [],
|
|
265
292
|
locale: (_b = initialState == null ? void 0 : initialState.locale) != null ? _b : null,
|
|
266
293
|
defaultLocale: (_c = initialState == null ? void 0 : initialState.defaultLocale) != null ? _c : null
|
|
267
294
|
};
|
|
@@ -291,11 +318,11 @@ function Color(config = {}) {
|
|
|
291
318
|
return { type: ColorControlType, config };
|
|
292
319
|
}
|
|
293
320
|
function copyColorData(value, context) {
|
|
294
|
-
var
|
|
321
|
+
var _a2;
|
|
295
322
|
if (value == null)
|
|
296
323
|
return value;
|
|
297
324
|
return __spreadProps(__spreadValues({}, value), {
|
|
298
|
-
swatchId: (
|
|
325
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(value.swatchId)) != null ? _a2 : value.swatchId
|
|
299
326
|
});
|
|
300
327
|
}
|
|
301
328
|
const ImageControlType = "makeswift::controls::image";
|
|
@@ -308,10 +335,10 @@ function Image$1(config = {}) {
|
|
|
308
335
|
}
|
|
309
336
|
Image$1.Format = ImageControlValueFormat;
|
|
310
337
|
function copyImageData(value, context) {
|
|
311
|
-
var
|
|
338
|
+
var _a2;
|
|
312
339
|
if (value == null)
|
|
313
340
|
return value;
|
|
314
|
-
return (
|
|
341
|
+
return (_a2 = context.replacementContext.fileIds.get(value)) != null ? _a2 : value;
|
|
315
342
|
}
|
|
316
343
|
if (void 0) {
|
|
317
344
|
const { describe, test, expect } = void 0;
|
|
@@ -344,7 +371,7 @@ function Link$1(config = {}) {
|
|
|
344
371
|
return { type: LinkControlType, config };
|
|
345
372
|
}
|
|
346
373
|
function copyLinkData(value, context) {
|
|
347
|
-
var
|
|
374
|
+
var _a2;
|
|
348
375
|
if (value == null)
|
|
349
376
|
return value;
|
|
350
377
|
if (value.type === "OPEN_PAGE") {
|
|
@@ -352,7 +379,7 @@ function copyLinkData(value, context) {
|
|
|
352
379
|
if (pageId != null) {
|
|
353
380
|
return __spreadProps(__spreadValues({}, value), {
|
|
354
381
|
payload: __spreadProps(__spreadValues({}, value.payload), {
|
|
355
|
-
pageId: (
|
|
382
|
+
pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : pageId
|
|
356
383
|
})
|
|
357
384
|
});
|
|
358
385
|
}
|
|
@@ -505,6 +532,8 @@ function createPropController(descriptor, send) {
|
|
|
505
532
|
return new ShapeControl(send, descriptor);
|
|
506
533
|
case StyleControlType:
|
|
507
534
|
return new StyleControl(send);
|
|
535
|
+
case StyleV2ControlType:
|
|
536
|
+
return new StyleV2Control(send);
|
|
508
537
|
default:
|
|
509
538
|
return new DefaultPropController(send);
|
|
510
539
|
}
|
|
@@ -643,10 +672,10 @@ const AllStyleControlProperties = [
|
|
|
643
672
|
StyleControlProperty.TextStyle
|
|
644
673
|
];
|
|
645
674
|
function Style(params) {
|
|
646
|
-
var
|
|
675
|
+
var _a2;
|
|
647
676
|
return {
|
|
648
677
|
type: StyleControlType,
|
|
649
|
-
config: { properties: (
|
|
678
|
+
config: { properties: (_a2 = params == null ? void 0 : params.properties) != null ? _a2 : StyleControlDefaultProperties }
|
|
650
679
|
};
|
|
651
680
|
}
|
|
652
681
|
Style.Default = StyleControlDefaultProperties;
|
|
@@ -864,22 +893,22 @@ function copy$e(value, context) {
|
|
|
864
893
|
return value;
|
|
865
894
|
return value.map((override) => __spreadProps(__spreadValues({}, override), {
|
|
866
895
|
value: override.value.map((backgroundItem) => {
|
|
867
|
-
var
|
|
896
|
+
var _a2, _b;
|
|
868
897
|
switch (backgroundItem.type) {
|
|
869
898
|
case "color":
|
|
870
899
|
return __spreadProps(__spreadValues({}, backgroundItem), {
|
|
871
900
|
payload: backgroundItem.payload === null ? null : __spreadProps(__spreadValues({}, backgroundItem.payload), {
|
|
872
|
-
swatchId: (
|
|
901
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(backgroundItem.payload.swatchId)) != null ? _a2 : backgroundItem.payload.swatchId
|
|
873
902
|
})
|
|
874
903
|
});
|
|
875
904
|
case "gradient":
|
|
876
905
|
return __spreadProps(__spreadValues({}, backgroundItem), {
|
|
877
906
|
payload: __spreadProps(__spreadValues({}, backgroundItem.payload), {
|
|
878
907
|
stops: backgroundItem.payload.stops.map((stop) => {
|
|
879
|
-
var
|
|
908
|
+
var _a3;
|
|
880
909
|
return __spreadProps(__spreadValues({}, stop), {
|
|
881
910
|
color: stop.color == null ? null : __spreadProps(__spreadValues({}, stop.color), {
|
|
882
|
-
swatchId: (
|
|
911
|
+
swatchId: (_a3 = context.replacementContext.swatchIds.get(stop.color.swatchId)) != null ? _a3 : stop.color.swatchId
|
|
883
912
|
})
|
|
884
913
|
});
|
|
885
914
|
})
|
|
@@ -905,7 +934,7 @@ function copy$d(value, context) {
|
|
|
905
934
|
});
|
|
906
935
|
}
|
|
907
936
|
function copy$c(value, context) {
|
|
908
|
-
var
|
|
937
|
+
var _a2, _b;
|
|
909
938
|
if (value == null)
|
|
910
939
|
return value;
|
|
911
940
|
switch (value.type) {
|
|
@@ -915,7 +944,7 @@ function copy$c(value, context) {
|
|
|
915
944
|
return value;
|
|
916
945
|
return __spreadProps(__spreadValues({}, value), {
|
|
917
946
|
payload: __spreadProps(__spreadValues({}, value.payload), {
|
|
918
|
-
pageId: (
|
|
947
|
+
pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : pageId
|
|
919
948
|
})
|
|
920
949
|
});
|
|
921
950
|
}
|
|
@@ -948,10 +977,10 @@ function copy$b(value, context) {
|
|
|
948
977
|
payload: __spreadProps(__spreadValues({}, item.payload), {
|
|
949
978
|
link: link != null ? copy$c(link, context) : void 0,
|
|
950
979
|
color: color != null ? color.map((override) => {
|
|
951
|
-
var
|
|
980
|
+
var _a2;
|
|
952
981
|
return __spreadProps(__spreadValues({}, override), {
|
|
953
982
|
value: __spreadProps(__spreadValues({}, override.value), {
|
|
954
|
-
swatchId: (
|
|
983
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(override.value.swatchId)) != null ? _a2 : override.value.swatchId
|
|
955
984
|
})
|
|
956
985
|
});
|
|
957
986
|
}) : void 0
|
|
@@ -1009,14 +1038,14 @@ function copy$a(value, context) {
|
|
|
1009
1038
|
return value;
|
|
1010
1039
|
return value.map((override) => __spreadProps(__spreadValues({}, override), { value: override.value.map(copyShadowItem) }));
|
|
1011
1040
|
function copyShadowItem(item) {
|
|
1012
|
-
var
|
|
1041
|
+
var _a2;
|
|
1013
1042
|
const { color } = item.payload;
|
|
1014
1043
|
if (color == null)
|
|
1015
1044
|
return item;
|
|
1016
1045
|
return __spreadProps(__spreadValues({}, item), {
|
|
1017
1046
|
payload: __spreadProps(__spreadValues({}, item.payload), {
|
|
1018
1047
|
color: __spreadProps(__spreadValues({}, color), {
|
|
1019
|
-
swatchId: (
|
|
1048
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a2 : color.swatchId
|
|
1020
1049
|
})
|
|
1021
1050
|
})
|
|
1022
1051
|
});
|
|
@@ -1070,10 +1099,10 @@ if (void 0) {
|
|
|
1070
1099
|
});
|
|
1071
1100
|
}
|
|
1072
1101
|
function copy$9(value, context) {
|
|
1073
|
-
var
|
|
1102
|
+
var _a2;
|
|
1074
1103
|
if (value == null)
|
|
1075
1104
|
return value;
|
|
1076
|
-
return (
|
|
1105
|
+
return (_a2 = context.replacementContext.fileIds.get(value)) != null ? _a2 : value;
|
|
1077
1106
|
}
|
|
1078
1107
|
if (void 0) {
|
|
1079
1108
|
const { describe, test, expect } = void 0;
|
|
@@ -1106,13 +1135,13 @@ function copy$8(value, context) {
|
|
|
1106
1135
|
return value;
|
|
1107
1136
|
return value.map(copyImagesPanelItem);
|
|
1108
1137
|
function copyImagesPanelItem(imagesPanelItem) {
|
|
1109
|
-
var
|
|
1138
|
+
var _a2;
|
|
1110
1139
|
const { file } = imagesPanelItem.props;
|
|
1111
1140
|
if (file == null)
|
|
1112
1141
|
return imagesPanelItem;
|
|
1113
1142
|
return __spreadProps(__spreadValues({}, imagesPanelItem), {
|
|
1114
1143
|
props: __spreadProps(__spreadValues({}, imagesPanelItem.props), {
|
|
1115
|
-
file: (
|
|
1144
|
+
file: (_a2 = context.replacementContext.fileIds.get(file)) != null ? _a2 : file
|
|
1116
1145
|
})
|
|
1117
1146
|
});
|
|
1118
1147
|
}
|
|
@@ -1161,9 +1190,9 @@ function copy$7(value, context) {
|
|
|
1161
1190
|
return value;
|
|
1162
1191
|
return value.map((override) => __spreadProps(__spreadValues({}, override), { value: copyColorValue(override.value) }));
|
|
1163
1192
|
function copyColorValue(colorValue) {
|
|
1164
|
-
var
|
|
1193
|
+
var _a2;
|
|
1165
1194
|
return __spreadProps(__spreadValues({}, colorValue), {
|
|
1166
|
-
swatchId: (
|
|
1195
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(colorValue.swatchId)) != null ? _a2 : colorValue.swatchId
|
|
1167
1196
|
});
|
|
1168
1197
|
}
|
|
1169
1198
|
}
|
|
@@ -1172,9 +1201,9 @@ function copy$6(value, context) {
|
|
|
1172
1201
|
return value;
|
|
1173
1202
|
return __spreadProps(__spreadValues({}, value), { fields: value.fields.map(copyFormFieldsPanelItem) });
|
|
1174
1203
|
function copyFormFieldsPanelItem(item) {
|
|
1175
|
-
var
|
|
1204
|
+
var _a2;
|
|
1176
1205
|
return __spreadProps(__spreadValues({}, item), {
|
|
1177
|
-
tableColumnId: (
|
|
1206
|
+
tableColumnId: (_a2 = context.replacementContext.tableColumnIds.get(item.tableColumnId)) != null ? _a2 : item.tableColumnId
|
|
1178
1207
|
});
|
|
1179
1208
|
}
|
|
1180
1209
|
}
|
|
@@ -1228,10 +1257,10 @@ if (void 0) {
|
|
|
1228
1257
|
});
|
|
1229
1258
|
}
|
|
1230
1259
|
function copy$5(value, context) {
|
|
1231
|
-
var
|
|
1260
|
+
var _a2;
|
|
1232
1261
|
if (value == null)
|
|
1233
1262
|
return value;
|
|
1234
|
-
return (
|
|
1263
|
+
return (_a2 = context.replacementContext.tableIds.get(value)) != null ? _a2 : value;
|
|
1235
1264
|
}
|
|
1236
1265
|
if (void 0) {
|
|
1237
1266
|
const { describe, test, expect } = void 0;
|
|
@@ -1273,13 +1302,13 @@ function copy$4(value, context) {
|
|
|
1273
1302
|
};
|
|
1274
1303
|
}
|
|
1275
1304
|
function copyBorderSide(borderSide) {
|
|
1276
|
-
var
|
|
1305
|
+
var _a2;
|
|
1277
1306
|
const { color } = borderSide;
|
|
1278
1307
|
if (color == null)
|
|
1279
1308
|
return borderSide;
|
|
1280
1309
|
return __spreadProps(__spreadValues({}, borderSide), {
|
|
1281
1310
|
color: __spreadProps(__spreadValues({}, color), {
|
|
1282
|
-
swatchId: (
|
|
1311
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a2 : color.swatchId
|
|
1283
1312
|
})
|
|
1284
1313
|
});
|
|
1285
1314
|
}
|
|
@@ -1393,24 +1422,24 @@ function copy$3(value, context) {
|
|
|
1393
1422
|
return value;
|
|
1394
1423
|
return __spreadProps(__spreadValues({}, value), { document: value.document ? copyNode(value.document) : value.document });
|
|
1395
1424
|
function copyNode(node) {
|
|
1396
|
-
var
|
|
1425
|
+
var _a2;
|
|
1397
1426
|
switch (node.object) {
|
|
1398
1427
|
case "document":
|
|
1399
1428
|
case "block":
|
|
1400
1429
|
case "inline":
|
|
1401
1430
|
return copyInline(node);
|
|
1402
1431
|
case "text":
|
|
1403
|
-
return __spreadProps(__spreadValues({}, node), { marks: (
|
|
1432
|
+
return __spreadProps(__spreadValues({}, node), { marks: (_a2 = node.marks) == null ? void 0 : _a2.map(copyMark) });
|
|
1404
1433
|
default:
|
|
1405
1434
|
return node;
|
|
1406
1435
|
}
|
|
1407
1436
|
}
|
|
1408
1437
|
function copyInline(inline) {
|
|
1409
|
-
var
|
|
1438
|
+
var _a2, _b;
|
|
1410
1439
|
switch (inline.type) {
|
|
1411
1440
|
case "link":
|
|
1412
1441
|
return __spreadProps(__spreadValues({}, inline), {
|
|
1413
|
-
nodes: (
|
|
1442
|
+
nodes: (_a2 = inline.nodes) == null ? void 0 : _a2.map(copyNode),
|
|
1414
1443
|
data: inline.data ? copyLinkData2(inline.data) : inline.data
|
|
1415
1444
|
});
|
|
1416
1445
|
default:
|
|
@@ -1418,7 +1447,7 @@ function copy$3(value, context) {
|
|
|
1418
1447
|
}
|
|
1419
1448
|
}
|
|
1420
1449
|
function copyLinkData2(data) {
|
|
1421
|
-
var
|
|
1450
|
+
var _a2, _b;
|
|
1422
1451
|
switch (data.type) {
|
|
1423
1452
|
case "OPEN_PAGE": {
|
|
1424
1453
|
const pageId = data.payload.pageId;
|
|
@@ -1426,7 +1455,7 @@ function copy$3(value, context) {
|
|
|
1426
1455
|
return data;
|
|
1427
1456
|
return __spreadProps(__spreadValues({}, data), {
|
|
1428
1457
|
payload: __spreadProps(__spreadValues({}, data.payload), {
|
|
1429
|
-
pageId: (
|
|
1458
|
+
pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : data.payload.pageId
|
|
1430
1459
|
})
|
|
1431
1460
|
});
|
|
1432
1461
|
}
|
|
@@ -1447,20 +1476,20 @@ function copy$3(value, context) {
|
|
|
1447
1476
|
}
|
|
1448
1477
|
}
|
|
1449
1478
|
function copyMark(mark) {
|
|
1450
|
-
var
|
|
1479
|
+
var _a2, _b, _c, _d;
|
|
1451
1480
|
switch (mark.type) {
|
|
1452
1481
|
case "typography": {
|
|
1453
|
-
const typographyId = (
|
|
1482
|
+
const typographyId = (_a2 = mark.data) == null ? void 0 : _a2.value.id;
|
|
1454
1483
|
return __spreadProps(__spreadValues({}, mark), {
|
|
1455
1484
|
data: __spreadProps(__spreadValues({}, mark.data), {
|
|
1456
1485
|
value: __spreadProps(__spreadValues({}, (_b = mark.data) == null ? void 0 : _b.value), {
|
|
1457
1486
|
id: (_c = context.replacementContext.typographyIds.get(typographyId)) != null ? _c : typographyId,
|
|
1458
1487
|
style: (_d = mark.data) == null ? void 0 : _d.value.style.map((override) => {
|
|
1459
|
-
var
|
|
1488
|
+
var _a3, _b2, _c2;
|
|
1460
1489
|
return __spreadProps(__spreadValues({}, override), {
|
|
1461
1490
|
value: __spreadProps(__spreadValues({}, override.value), {
|
|
1462
1491
|
color: override.value.color == null ? override.value.color : __spreadProps(__spreadValues({}, override.value.color), {
|
|
1463
|
-
swatchId: (_c2 = context.replacementContext.swatchIds.get((
|
|
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
|
|
1464
1493
|
})
|
|
1465
1494
|
})
|
|
1466
1495
|
});
|
|
@@ -1657,6 +1686,37 @@ const SelectControlType = "makeswift::controls::select";
|
|
|
1657
1686
|
function Select(config) {
|
|
1658
1687
|
return { type: SelectControlType, config };
|
|
1659
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
|
+
}
|
|
1660
1720
|
const ObjectType = {
|
|
1661
1721
|
Value: "value",
|
|
1662
1722
|
Text: "text",
|
|
@@ -1793,13 +1853,13 @@ function getBlocksInSelection(editor) {
|
|
|
1793
1853
|
})).filter((entry) => ElementUtils.isRootBlock(entry[0]));
|
|
1794
1854
|
}
|
|
1795
1855
|
function getActiveBlockType(editor) {
|
|
1796
|
-
var
|
|
1856
|
+
var _a2;
|
|
1797
1857
|
const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type);
|
|
1798
|
-
return rootBlocks.reduce((a, b) => a === b ? b : null, (
|
|
1858
|
+
return rootBlocks.reduce((a, b) => a === b ? b : null, (_a2 = rootBlocks.at(0)) != null ? _a2 : null);
|
|
1799
1859
|
}
|
|
1800
1860
|
function setBlockKeyForDevice(editor, breakpoints, deviceId, key, value, options) {
|
|
1801
|
-
var
|
|
1802
|
-
const at = (
|
|
1861
|
+
var _a2, _b;
|
|
1862
|
+
const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
|
|
1803
1863
|
if (!at)
|
|
1804
1864
|
return;
|
|
1805
1865
|
const rootElements = getBlocksInSelection(editor);
|
|
@@ -1818,11 +1878,11 @@ function setBlockKeyForDevice(editor, breakpoints, deviceId, key, value, options
|
|
|
1818
1878
|
}
|
|
1819
1879
|
}
|
|
1820
1880
|
function clearBlockKeyForDevice(editor, deviceId, key) {
|
|
1821
|
-
var
|
|
1881
|
+
var _a2;
|
|
1822
1882
|
const rootElements = getBlocksInSelection(editor);
|
|
1823
1883
|
for (const [node, path] of rootElements) {
|
|
1824
1884
|
if (ElementUtils.isBlock(node)) {
|
|
1825
|
-
const deviceOverrides = (
|
|
1885
|
+
const deviceOverrides = (_a2 = node[key]) != null ? _a2 : [];
|
|
1826
1886
|
slate.Transforms.setNodes(editor, {
|
|
1827
1887
|
[key]: deviceOverrides.filter((v) => v.deviceId !== deviceId)
|
|
1828
1888
|
}, { at: path });
|
|
@@ -1895,8 +1955,8 @@ function unwrapPath(editor, listItemPath) {
|
|
|
1895
1955
|
});
|
|
1896
1956
|
}
|
|
1897
1957
|
function unwrapList(editor, options) {
|
|
1898
|
-
var
|
|
1899
|
-
const at = (
|
|
1958
|
+
var _a2;
|
|
1959
|
+
const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
|
|
1900
1960
|
if (!at)
|
|
1901
1961
|
return;
|
|
1902
1962
|
const listItems = Array.from(slate.Editor.nodes(editor, {
|
|
@@ -1915,8 +1975,8 @@ function unwrapList(editor, options) {
|
|
|
1915
1975
|
});
|
|
1916
1976
|
}
|
|
1917
1977
|
function wrapList(editor, options = { type: BlockType.UnorderedList }) {
|
|
1918
|
-
var
|
|
1919
|
-
const at = (
|
|
1978
|
+
var _a2;
|
|
1979
|
+
const at = (_a2 = options.at) != null ? _a2 : editor.selection;
|
|
1920
1980
|
if (!at)
|
|
1921
1981
|
return;
|
|
1922
1982
|
const nonListEntries = Array.from(slate.Editor.nodes(editor, {
|
|
@@ -1955,7 +2015,7 @@ const LocationUtils = {
|
|
|
1955
2015
|
}
|
|
1956
2016
|
};
|
|
1957
2017
|
function getSelectedListItems(editor) {
|
|
1958
|
-
var
|
|
2018
|
+
var _a2, _b;
|
|
1959
2019
|
if (!editor.selection)
|
|
1960
2020
|
return [];
|
|
1961
2021
|
const start = LocationUtils.getStartPath(editor.selection);
|
|
@@ -1963,7 +2023,7 @@ function getSelectedListItems(editor) {
|
|
|
1963
2023
|
at: editor.selection,
|
|
1964
2024
|
match: (node) => ElementUtils.isListItem(node)
|
|
1965
2025
|
});
|
|
1966
|
-
const firstAncestorPath = (_b = (
|
|
2026
|
+
const firstAncestorPath = (_b = (_a2 = EditorUtils.getFirstAncestorListItem(editor, start)) == null ? void 0 : _a2[1]) != null ? _b : [];
|
|
1967
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]));
|
|
1968
2028
|
}
|
|
1969
2029
|
function indentPath(editor, path) {
|
|
@@ -2040,8 +2100,8 @@ function dedent(editor) {
|
|
|
2040
2100
|
});
|
|
2041
2101
|
}
|
|
2042
2102
|
function toggleList(editor, options = { type: BlockType.UnorderedList }) {
|
|
2043
|
-
var
|
|
2044
|
-
const at = (
|
|
2103
|
+
var _a2;
|
|
2104
|
+
const at = (_a2 = options.at) != null ? _a2 : editor.selection;
|
|
2045
2105
|
if (at == null)
|
|
2046
2106
|
return;
|
|
2047
2107
|
const start = LocationUtils.getStartPath(at);
|
|
@@ -2072,7 +2132,9 @@ const ListActions = {
|
|
|
2072
2132
|
toggleList
|
|
2073
2133
|
};
|
|
2074
2134
|
function onKeyDown(e, editor) {
|
|
2075
|
-
if (!editor.selection || Array.from(slate.Editor.nodes(editor, {
|
|
2135
|
+
if (!editor.selection || Array.from(slate.Editor.nodes(editor, {
|
|
2136
|
+
match: (node) => ElementUtils.isListItem(node)
|
|
2137
|
+
})).length === 0)
|
|
2076
2138
|
return;
|
|
2077
2139
|
if (isHotkey__default["default"]("shift+tab", e)) {
|
|
2078
2140
|
e.preventDefault();
|
|
@@ -2130,15 +2192,19 @@ function onKeyDown(e, editor) {
|
|
|
2130
2192
|
}
|
|
2131
2193
|
}
|
|
2132
2194
|
function withBlock(editor) {
|
|
2133
|
-
const {
|
|
2195
|
+
const {
|
|
2196
|
+
normalizeNode
|
|
2197
|
+
} = editor;
|
|
2134
2198
|
editor.isInline = (entry) => {
|
|
2135
2199
|
return ElementUtils.isInline(entry);
|
|
2136
2200
|
};
|
|
2137
2201
|
editor.normalizeNode = (entry) => {
|
|
2138
|
-
var
|
|
2202
|
+
var _a2;
|
|
2139
2203
|
const [normalizationNode, normalizationPath] = entry;
|
|
2140
|
-
if (ElementUtils.isBlock(normalizationNode) && ((
|
|
2141
|
-
slate.Transforms.unsetNodes(editor, "textAlign", {
|
|
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
|
+
});
|
|
2142
2208
|
return;
|
|
2143
2209
|
}
|
|
2144
2210
|
if (ElementUtils.isListItem(normalizationNode)) {
|
|
@@ -2146,7 +2212,9 @@ function withBlock(editor) {
|
|
|
2146
2212
|
if (slate.Node.has(editor, pathToListItemText)) {
|
|
2147
2213
|
const nodeInListItemTextPosition = slate.Node.get(editor, pathToListItemText);
|
|
2148
2214
|
if (ElementUtils.isRootBlock(nodeInListItemTextPosition)) {
|
|
2149
|
-
slate.Transforms.setNodes(editor, {
|
|
2215
|
+
slate.Transforms.setNodes(editor, {
|
|
2216
|
+
type: BlockType.ListItemChild
|
|
2217
|
+
}, {
|
|
2150
2218
|
at: pathToListItemText
|
|
2151
2219
|
});
|
|
2152
2220
|
return;
|
|
@@ -2164,10 +2232,7 @@ function withBlock(editor) {
|
|
|
2164
2232
|
if (!potentialNodeToBeMerged || !ElementUtils.isList(potentialNodeToBeMerged[0]) || !ElementUtils.isList(child[0]) || potentialNodeToBeMerged[0].type !== child[0].type) {
|
|
2165
2233
|
return null;
|
|
2166
2234
|
}
|
|
2167
|
-
return [
|
|
2168
|
-
slate.Editor.pathRef(editor, child[1]),
|
|
2169
|
-
slate.Editor.pathRef(editor, potentialNodeToBeMerged[1])
|
|
2170
|
-
];
|
|
2235
|
+
return [slate.Editor.pathRef(editor, child[1]), slate.Editor.pathRef(editor, potentialNodeToBeMerged[1])];
|
|
2171
2236
|
}).filter((mergeableNodes) => Boolean(mergeableNodes));
|
|
2172
2237
|
if (mergeableChildren.length !== 0) {
|
|
2173
2238
|
mergeableChildren.reverse().forEach(([nodePathRef, nodeToBeMergedPathRef]) => {
|
|
@@ -2184,7 +2249,9 @@ function withBlock(editor) {
|
|
|
2184
2249
|
to: [...nodePath, nodeChildren.length]
|
|
2185
2250
|
});
|
|
2186
2251
|
});
|
|
2187
|
-
slate.Transforms.removeNodes(editor, {
|
|
2252
|
+
slate.Transforms.removeNodes(editor, {
|
|
2253
|
+
at: nodeToBeMergedPath
|
|
2254
|
+
});
|
|
2188
2255
|
});
|
|
2189
2256
|
nodePathRef.unref();
|
|
2190
2257
|
nodeToBeMergedPathRef.unref();
|
|
@@ -2199,48 +2266,37 @@ function withBlock(editor) {
|
|
|
2199
2266
|
const definition = Select({
|
|
2200
2267
|
label: "Block",
|
|
2201
2268
|
labelOrientation: "horizontal",
|
|
2202
|
-
options: [
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
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
|
-
],
|
|
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
|
+
}],
|
|
2244
2300
|
defaultValue: BlockType.Paragraph
|
|
2245
2301
|
});
|
|
2246
2302
|
function BlockPlugin() {
|
|
@@ -2259,14 +2315,18 @@ function BlockPlugin() {
|
|
|
2259
2315
|
} else if (activeBlockType === value) {
|
|
2260
2316
|
slate.Transforms.setNodes(editor, {
|
|
2261
2317
|
type: BlockType.Default
|
|
2262
|
-
}, {
|
|
2318
|
+
}, {
|
|
2319
|
+
at: getSelection(editor)
|
|
2320
|
+
});
|
|
2263
2321
|
} else {
|
|
2264
2322
|
ListActions.unwrapList(editor, {
|
|
2265
2323
|
at: getSelection(editor)
|
|
2266
2324
|
});
|
|
2267
2325
|
slate.Transforms.setNodes(editor, {
|
|
2268
2326
|
type: value != null ? value : BlockType.Default
|
|
2269
|
-
}, {
|
|
2327
|
+
}, {
|
|
2328
|
+
at: getSelection(editor)
|
|
2329
|
+
});
|
|
2270
2330
|
}
|
|
2271
2331
|
},
|
|
2272
2332
|
getValue: (editor) => {
|
|
@@ -2275,9 +2335,114 @@ function BlockPlugin() {
|
|
|
2275
2335
|
return void 0;
|
|
2276
2336
|
return activeBlock;
|
|
2277
2337
|
}
|
|
2278
|
-
}
|
|
2338
|
+
},
|
|
2339
|
+
renderElement: (renderElement) => (props) => /* @__PURE__ */ jsxRuntime.jsx(BlockPluginComponent, __spreadProps(__spreadValues({}, props), {
|
|
2340
|
+
renderElement
|
|
2341
|
+
}))
|
|
2279
2342
|
});
|
|
2280
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
|
+
}
|
|
2281
2446
|
const RichTextV2ControlType = "makeswift::controls::rich-text-v2";
|
|
2282
2447
|
const RichTextV2Mode = {
|
|
2283
2448
|
Inline: "makeswift::controls::rich-text-v2::mode::inline",
|
|
@@ -2286,9 +2451,10 @@ const RichTextV2Mode = {
|
|
|
2286
2451
|
function createRichTextV2Plugin({
|
|
2287
2452
|
control,
|
|
2288
2453
|
withPlugin,
|
|
2289
|
-
onKeyDown: onKeyDown2
|
|
2454
|
+
onKeyDown: onKeyDown2,
|
|
2455
|
+
renderElement
|
|
2290
2456
|
}) {
|
|
2291
|
-
return { control, withPlugin, onKeyDown: onKeyDown2 };
|
|
2457
|
+
return { control, withPlugin, onKeyDown: onKeyDown2, renderElement };
|
|
2292
2458
|
}
|
|
2293
2459
|
function unstable_RichTextV2(config = {}) {
|
|
2294
2460
|
return { type: RichTextV2ControlType, config };
|
|
@@ -2311,7 +2477,7 @@ class RichTextV2Control extends PropController {
|
|
|
2311
2477
|
__publicField(this, "defaultValue", null);
|
|
2312
2478
|
__publicField(this, "descriptor");
|
|
2313
2479
|
__publicField(this, "recv", (message) => {
|
|
2314
|
-
var
|
|
2480
|
+
var _a2, _b, _c;
|
|
2315
2481
|
if (!this.editor)
|
|
2316
2482
|
return;
|
|
2317
2483
|
switch (message.type) {
|
|
@@ -2328,7 +2494,7 @@ class RichTextV2Control extends PropController {
|
|
|
2328
2494
|
break;
|
|
2329
2495
|
}
|
|
2330
2496
|
case RichTextV2ControlMessageType.RUN_PLUGIN_CONTROL_ACTION: {
|
|
2331
|
-
(_c = (_b = (
|
|
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);
|
|
2332
2498
|
break;
|
|
2333
2499
|
}
|
|
2334
2500
|
}
|
|
@@ -2337,13 +2503,13 @@ class RichTextV2Control extends PropController {
|
|
|
2337
2503
|
this.send = send;
|
|
2338
2504
|
}
|
|
2339
2505
|
setEditor(editor) {
|
|
2340
|
-
var
|
|
2506
|
+
var _a2, _b, _c;
|
|
2341
2507
|
this.editor = editor;
|
|
2342
2508
|
this.send({
|
|
2343
2509
|
type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
|
|
2344
|
-
value: (_c = (_b = (
|
|
2345
|
-
var
|
|
2346
|
-
return (
|
|
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);
|
|
2347
2513
|
})) != null ? _c : []
|
|
2348
2514
|
});
|
|
2349
2515
|
}
|
|
@@ -2358,7 +2524,7 @@ class RichTextV2Control extends PropController {
|
|
|
2358
2524
|
this.send({ type: RichTextV2ControlMessageType.SWITCH_TO_BUILD_MODE });
|
|
2359
2525
|
}
|
|
2360
2526
|
onChange(value) {
|
|
2361
|
-
var
|
|
2527
|
+
var _a2, _b, _c;
|
|
2362
2528
|
const editor = this.editor;
|
|
2363
2529
|
if (editor == null)
|
|
2364
2530
|
return;
|
|
@@ -2368,9 +2534,9 @@ class RichTextV2Control extends PropController {
|
|
|
2368
2534
|
});
|
|
2369
2535
|
this.send({
|
|
2370
2536
|
type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
|
|
2371
|
-
value: (_c = (_b = (
|
|
2372
|
-
var
|
|
2373
|
-
return (
|
|
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);
|
|
2374
2540
|
})) != null ? _c : []
|
|
2375
2541
|
});
|
|
2376
2542
|
}
|
|
@@ -2384,8 +2550,8 @@ function isText(node) {
|
|
|
2384
2550
|
return false;
|
|
2385
2551
|
}
|
|
2386
2552
|
function toTextDAO(node) {
|
|
2387
|
-
var
|
|
2388
|
-
const typographyMark = (
|
|
2553
|
+
var _a2, _b, _c, _d;
|
|
2554
|
+
const typographyMark = (_a2 = node.marks) == null ? void 0 : _a2.find((mark) => mark.type === "typography");
|
|
2389
2555
|
return [
|
|
2390
2556
|
{
|
|
2391
2557
|
text: (_b = node.text) != null ? _b : "",
|
|
@@ -2394,12 +2560,12 @@ function toTextDAO(node) {
|
|
|
2394
2560
|
];
|
|
2395
2561
|
}
|
|
2396
2562
|
function toInlineDAO(node) {
|
|
2397
|
-
var
|
|
2563
|
+
var _a2, _b, _c, _d;
|
|
2398
2564
|
switch (node.type) {
|
|
2399
2565
|
case InlineType.Link:
|
|
2400
2566
|
return [
|
|
2401
2567
|
{
|
|
2402
|
-
children: (_b = (
|
|
2568
|
+
children: (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(toInlineOrTextDAO)) != null ? _b : [],
|
|
2403
2569
|
[node.type]: node.data,
|
|
2404
2570
|
type: node.type
|
|
2405
2571
|
}
|
|
@@ -2428,7 +2594,7 @@ function toInlineOrTextDAO(node) {
|
|
|
2428
2594
|
}
|
|
2429
2595
|
}
|
|
2430
2596
|
function toNodeDAO(node) {
|
|
2431
|
-
var
|
|
2597
|
+
var _a2, _b;
|
|
2432
2598
|
switch (node.object) {
|
|
2433
2599
|
case ObjectType.Inline:
|
|
2434
2600
|
case ObjectType.Text:
|
|
@@ -2438,7 +2604,7 @@ function toNodeDAO(node) {
|
|
|
2438
2604
|
{
|
|
2439
2605
|
type: node.type,
|
|
2440
2606
|
textAlign: (node == null ? void 0 : node.data) && "textAlign" in node.data ? node == null ? void 0 : node.data.textAlign : void 0,
|
|
2441
|
-
children: (_b = (
|
|
2607
|
+
children: (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(toNodeDAO)) != null ? _b : []
|
|
2442
2608
|
}
|
|
2443
2609
|
];
|
|
2444
2610
|
default:
|
|
@@ -2446,8 +2612,8 @@ function toNodeDAO(node) {
|
|
|
2446
2612
|
}
|
|
2447
2613
|
}
|
|
2448
2614
|
function richTextDTOtoSelection(data) {
|
|
2449
|
-
var
|
|
2450
|
-
if (((_b = (
|
|
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)
|
|
2451
2617
|
return {
|
|
2452
2618
|
anchor: {
|
|
2453
2619
|
offset: data.selection.anchor.offset,
|
|
@@ -2461,8 +2627,8 @@ function richTextDTOtoSelection(data) {
|
|
|
2461
2627
|
return null;
|
|
2462
2628
|
}
|
|
2463
2629
|
function richTextDTOtoDAO(data) {
|
|
2464
|
-
var
|
|
2465
|
-
return (_c = (_b = (
|
|
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 : [];
|
|
2466
2632
|
}
|
|
2467
2633
|
function toInlineOrTextDTO(node) {
|
|
2468
2634
|
if (isText(node)) {
|
|
@@ -2506,7 +2672,7 @@ function toInlineOrTextDTO(node) {
|
|
|
2506
2672
|
}
|
|
2507
2673
|
}
|
|
2508
2674
|
function toNodeDTO(node) {
|
|
2509
|
-
var
|
|
2675
|
+
var _a2, _b;
|
|
2510
2676
|
if (isText(node))
|
|
2511
2677
|
return toInlineOrTextDTO(node);
|
|
2512
2678
|
switch (node.type) {
|
|
@@ -2531,7 +2697,7 @@ function toNodeDTO(node) {
|
|
|
2531
2697
|
textAlign: node.textAlign
|
|
2532
2698
|
} : {},
|
|
2533
2699
|
object: "block",
|
|
2534
|
-
nodes: (_b = (
|
|
2700
|
+
nodes: (_b = (_a2 = node.children) == null ? void 0 : _a2.flatMap(toNodeDTO)) != null ? _b : []
|
|
2535
2701
|
}
|
|
2536
2702
|
];
|
|
2537
2703
|
default:
|
|
@@ -2895,51 +3061,51 @@ function getElementId$1(descriptor, prop) {
|
|
|
2895
3061
|
}
|
|
2896
3062
|
}
|
|
2897
3063
|
function getBackgroundsSwatchIds(value) {
|
|
2898
|
-
var
|
|
2899
|
-
return (
|
|
2900
|
-
var
|
|
3064
|
+
var _a2;
|
|
3065
|
+
return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
|
|
3066
|
+
var _a3;
|
|
2901
3067
|
switch (backgroundItem.type) {
|
|
2902
3068
|
case "color":
|
|
2903
|
-
return ((
|
|
3069
|
+
return ((_a3 = backgroundItem.payload) == null ? void 0 : _a3.swatchId) == null ? [] : [backgroundItem.payload.swatchId];
|
|
2904
3070
|
case "gradient":
|
|
2905
3071
|
return backgroundItem.payload.stops.flatMap((stop) => stop.color == null ? [] : stop.color.swatchId);
|
|
2906
3072
|
default:
|
|
2907
3073
|
return [];
|
|
2908
3074
|
}
|
|
2909
|
-
})) != null ?
|
|
3075
|
+
})) != null ? _a2 : [];
|
|
2910
3076
|
}
|
|
2911
3077
|
function getBorderSwatchIds(value) {
|
|
2912
|
-
var
|
|
2913
|
-
return (
|
|
2914
|
-
var
|
|
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;
|
|
2915
3081
|
return [
|
|
2916
|
-
(_b = (
|
|
3082
|
+
(_b = (_a3 = borderValue.borderTop) == null ? void 0 : _a3.color) == null ? void 0 : _b.swatchId,
|
|
2917
3083
|
(_d = (_c = borderValue.borderRight) == null ? void 0 : _c.color) == null ? void 0 : _d.swatchId,
|
|
2918
3084
|
(_f = (_e = borderValue.borderBottom) == null ? void 0 : _e.color) == null ? void 0 : _f.swatchId,
|
|
2919
3085
|
(_h = (_g = borderValue.borderLeft) == null ? void 0 : _g.color) == null ? void 0 : _h.swatchId
|
|
2920
3086
|
].filter((swatchId) => swatchId != null);
|
|
2921
|
-
})) != null ?
|
|
3087
|
+
})) != null ? _a2 : [];
|
|
2922
3088
|
}
|
|
2923
3089
|
function getBoxShadowsSwatchIds(value) {
|
|
2924
|
-
var
|
|
2925
|
-
return (
|
|
2926
|
-
var
|
|
2927
|
-
return (
|
|
2928
|
-
}).filter((swatchId) => swatchId != null)) != null ?
|
|
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 : [];
|
|
2929
3095
|
}
|
|
2930
3096
|
function getResponsiveColorSwatchIds(value) {
|
|
2931
|
-
var
|
|
2932
|
-
return (
|
|
3097
|
+
var _a2;
|
|
3098
|
+
return (_a2 = value == null ? void 0 : value.map((override) => override.value).map((color) => color.swatchId)) != null ? _a2 : [];
|
|
2933
3099
|
}
|
|
2934
3100
|
function getTypographyStyleSwatchIds(style) {
|
|
2935
|
-
var
|
|
2936
|
-
return (
|
|
2937
|
-
var
|
|
2938
|
-
return (
|
|
2939
|
-
}).filter(isNonNullable)) != null ?
|
|
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 : [];
|
|
2940
3106
|
}
|
|
2941
3107
|
function getElementSwatchIds(descriptor, prop) {
|
|
2942
|
-
var
|
|
3108
|
+
var _a2;
|
|
2943
3109
|
if (prop == null)
|
|
2944
3110
|
return [];
|
|
2945
3111
|
switch (descriptor.type) {
|
|
@@ -2949,17 +3115,17 @@ function getElementSwatchIds(descriptor, prop) {
|
|
|
2949
3115
|
return getBorderSwatchIds(prop);
|
|
2950
3116
|
case Types.NavigationLinks: {
|
|
2951
3117
|
const value = prop;
|
|
2952
|
-
return (
|
|
2953
|
-
var
|
|
3118
|
+
return (_a2 = value == null ? void 0 : value.flatMap((item) => {
|
|
3119
|
+
var _a3, _b, _c, _d;
|
|
2954
3120
|
switch (item.type) {
|
|
2955
3121
|
case "button":
|
|
2956
3122
|
case "dropdown":
|
|
2957
3123
|
return [
|
|
2958
|
-
...(_b = (
|
|
3124
|
+
...(_b = (_a3 = item.payload.color) == null ? void 0 : _a3.map((override) => override.value).map((color) => color.swatchId)) != null ? _b : [],
|
|
2959
3125
|
...(_d = (_c = item.payload.textColor) == null ? void 0 : _c.map((override) => override.value).map((color) => color.swatchId)) != null ? _d : []
|
|
2960
3126
|
];
|
|
2961
3127
|
}
|
|
2962
|
-
})) != null ?
|
|
3128
|
+
})) != null ? _a2 : [];
|
|
2963
3129
|
}
|
|
2964
3130
|
case Types.ResponsiveColor:
|
|
2965
3131
|
return getResponsiveColorSwatchIds(prop);
|
|
@@ -2967,20 +3133,20 @@ function getElementSwatchIds(descriptor, prop) {
|
|
|
2967
3133
|
return getBoxShadowsSwatchIds(prop);
|
|
2968
3134
|
case Types.RichText: {
|
|
2969
3135
|
let getNodeSwatchIds = function(node) {
|
|
2970
|
-
var
|
|
3136
|
+
var _a3, _b, _c, _d;
|
|
2971
3137
|
switch (node.object) {
|
|
2972
3138
|
case "document":
|
|
2973
3139
|
case "block":
|
|
2974
3140
|
case "inline":
|
|
2975
|
-
return (_b = (
|
|
3141
|
+
return (_b = (_a3 = node.nodes) == null ? void 0 : _a3.flatMap(getNodeSwatchIds)) != null ? _b : [];
|
|
2976
3142
|
case "text":
|
|
2977
3143
|
return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkSwatchIds)) != null ? _d : [];
|
|
2978
3144
|
default:
|
|
2979
3145
|
return [];
|
|
2980
3146
|
}
|
|
2981
3147
|
}, getMarkSwatchIds = function(mark) {
|
|
2982
|
-
var
|
|
2983
|
-
return getTypographyStyleSwatchIds((_b = (
|
|
3148
|
+
var _a3, _b;
|
|
3149
|
+
return getTypographyStyleSwatchIds((_b = (_a3 = mark.data) == null ? void 0 : _a3.value) == null ? void 0 : _b.style);
|
|
2984
3150
|
};
|
|
2985
3151
|
const value = prop;
|
|
2986
3152
|
if (value == null || value.document == null)
|
|
@@ -2996,18 +3162,18 @@ function getElementSwatchIds(descriptor, prop) {
|
|
|
2996
3162
|
}
|
|
2997
3163
|
}
|
|
2998
3164
|
function getBackgroundsFileIds(value) {
|
|
2999
|
-
var
|
|
3000
|
-
return (
|
|
3165
|
+
var _a2;
|
|
3166
|
+
return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
|
|
3001
3167
|
switch (backgroundItem.type) {
|
|
3002
3168
|
case "image":
|
|
3003
3169
|
return [backgroundItem.payload.imageId];
|
|
3004
3170
|
default:
|
|
3005
3171
|
return [];
|
|
3006
3172
|
}
|
|
3007
|
-
})) != null ?
|
|
3173
|
+
})) != null ? _a2 : [];
|
|
3008
3174
|
}
|
|
3009
3175
|
function getFileIds(descriptor, prop) {
|
|
3010
|
-
var
|
|
3176
|
+
var _a2;
|
|
3011
3177
|
if (prop == null)
|
|
3012
3178
|
return [];
|
|
3013
3179
|
switch (descriptor.type) {
|
|
@@ -3019,7 +3185,7 @@ function getFileIds(descriptor, prop) {
|
|
|
3019
3185
|
}
|
|
3020
3186
|
case Types.Images: {
|
|
3021
3187
|
const value = prop;
|
|
3022
|
-
return (
|
|
3188
|
+
return (_a2 = value == null ? void 0 : value.flatMap((item) => item.props.file == null ? [] : [item.props.file])) != null ? _a2 : [];
|
|
3023
3189
|
}
|
|
3024
3190
|
case ImageControlType: {
|
|
3025
3191
|
const value = prop;
|
|
@@ -3035,20 +3201,20 @@ function getTypographyIds(descriptor, prop) {
|
|
|
3035
3201
|
switch (descriptor.type) {
|
|
3036
3202
|
case Types.RichText: {
|
|
3037
3203
|
let getNodeTypographyIds = function(node) {
|
|
3038
|
-
var
|
|
3204
|
+
var _a2, _b, _c, _d;
|
|
3039
3205
|
switch (node.object) {
|
|
3040
3206
|
case "document":
|
|
3041
3207
|
case "block":
|
|
3042
3208
|
case "inline":
|
|
3043
|
-
return (_b = (
|
|
3209
|
+
return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodeTypographyIds)) != null ? _b : [];
|
|
3044
3210
|
case "text":
|
|
3045
3211
|
return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkTypographyIds)) != null ? _d : [];
|
|
3046
3212
|
default:
|
|
3047
3213
|
return [];
|
|
3048
3214
|
}
|
|
3049
3215
|
}, getMarkTypographyIds = function(mark) {
|
|
3050
|
-
var
|
|
3051
|
-
return [(_b = (
|
|
3216
|
+
var _a2, _b;
|
|
3217
|
+
return [(_b = (_a2 = mark.data) == null ? void 0 : _a2.value) == null ? void 0 : _b.id].filter((id) => id != null);
|
|
3052
3218
|
};
|
|
3053
3219
|
const value = prop;
|
|
3054
3220
|
if (value == null || value.document == null)
|
|
@@ -3072,7 +3238,7 @@ function getTableIds(descriptor, prop) {
|
|
|
3072
3238
|
}
|
|
3073
3239
|
}
|
|
3074
3240
|
function getPageIds(descriptor, prop) {
|
|
3075
|
-
var
|
|
3241
|
+
var _a2;
|
|
3076
3242
|
if (prop == null)
|
|
3077
3243
|
return [];
|
|
3078
3244
|
switch (descriptor.type) {
|
|
@@ -3091,8 +3257,8 @@ function getPageIds(descriptor, prop) {
|
|
|
3091
3257
|
const value = prop;
|
|
3092
3258
|
if (value == null)
|
|
3093
3259
|
return [];
|
|
3094
|
-
return (
|
|
3095
|
-
var
|
|
3260
|
+
return (_a2 = value == null ? void 0 : value.flatMap((item) => {
|
|
3261
|
+
var _a3, _b;
|
|
3096
3262
|
switch (item.type) {
|
|
3097
3263
|
case "button": {
|
|
3098
3264
|
if (item.payload.link == null)
|
|
@@ -3105,7 +3271,7 @@ function getPageIds(descriptor, prop) {
|
|
|
3105
3271
|
}
|
|
3106
3272
|
}
|
|
3107
3273
|
case "dropdown": {
|
|
3108
|
-
return (_b = (
|
|
3274
|
+
return (_b = (_a3 = item.payload.links) == null ? void 0 : _a3.flatMap((link) => {
|
|
3109
3275
|
if (link.payload.link == null)
|
|
3110
3276
|
return [];
|
|
3111
3277
|
switch (link.payload.link.type) {
|
|
@@ -3117,25 +3283,25 @@ function getPageIds(descriptor, prop) {
|
|
|
3117
3283
|
})) != null ? _b : [];
|
|
3118
3284
|
}
|
|
3119
3285
|
}
|
|
3120
|
-
})) != null ?
|
|
3286
|
+
})) != null ? _a2 : [];
|
|
3121
3287
|
}
|
|
3122
3288
|
case Types.RichText: {
|
|
3123
3289
|
let getNodePageIds = function(node) {
|
|
3124
|
-
var
|
|
3290
|
+
var _a3, _b;
|
|
3125
3291
|
switch (node.object) {
|
|
3126
3292
|
case "document":
|
|
3127
3293
|
case "block":
|
|
3128
|
-
return (_b = (
|
|
3294
|
+
return (_b = (_a3 = node.nodes) == null ? void 0 : _a3.flatMap(getNodePageIds)) != null ? _b : [];
|
|
3129
3295
|
case "inline":
|
|
3130
3296
|
return getInlinePageIds(node);
|
|
3131
3297
|
default:
|
|
3132
3298
|
return [];
|
|
3133
3299
|
}
|
|
3134
3300
|
}, getInlinePageIds = function(inline) {
|
|
3135
|
-
var
|
|
3301
|
+
var _a3, _b, _c, _d;
|
|
3136
3302
|
switch (inline.type) {
|
|
3137
3303
|
case "link": {
|
|
3138
|
-
const nodePageIds = (_b = (
|
|
3304
|
+
const nodePageIds = (_b = (_a3 = inline.nodes) == null ? void 0 : _a3.flatMap(getNodePageIds)) != null ? _b : [];
|
|
3139
3305
|
const dataPageIds = inline.data ? getLinkDataPageIds(inline.data) : [];
|
|
3140
3306
|
return [...nodePageIds, ...dataPageIds];
|
|
3141
3307
|
}
|
|
@@ -3250,14 +3416,14 @@ function getDocumentKeysSortedByDepth(state) {
|
|
|
3250
3416
|
elements.set(key, getDocumentElements(state, key));
|
|
3251
3417
|
});
|
|
3252
3418
|
keys.sort((a, b) => {
|
|
3253
|
-
var
|
|
3254
|
-
return ((
|
|
3419
|
+
var _a2;
|
|
3420
|
+
return ((_a2 = elements.get(a)) == null ? void 0 : _a2.has(b)) ? -1 : 1;
|
|
3255
3421
|
});
|
|
3256
3422
|
return keys;
|
|
3257
3423
|
}
|
|
3258
3424
|
function getElement(state, documentKey, elementKey) {
|
|
3259
|
-
var
|
|
3260
|
-
return (
|
|
3425
|
+
var _a2;
|
|
3426
|
+
return (_a2 = getDocumentElements(state, documentKey).get(elementKey)) != null ? _a2 : null;
|
|
3261
3427
|
}
|
|
3262
3428
|
function getElementPropControllerDescriptors(state, documentKey, elementKey) {
|
|
3263
3429
|
const element = getElement(state, documentKey, elementKey);
|
|
@@ -3420,6 +3586,9 @@ exports.StyleControl = StyleControl;
|
|
|
3420
3586
|
exports.StyleControlMessageType = StyleControlMessageType;
|
|
3421
3587
|
exports.StyleControlProperty = StyleControlProperty;
|
|
3422
3588
|
exports.StyleControlType = StyleControlType;
|
|
3589
|
+
exports.StyleV2Control = StyleV2Control;
|
|
3590
|
+
exports.StyleV2ControlMessageType = StyleV2ControlMessageType;
|
|
3591
|
+
exports.StyleV2ControlType = StyleV2ControlType;
|
|
3423
3592
|
exports.Table = Table;
|
|
3424
3593
|
exports.TableFormFields = TableFormFields;
|
|
3425
3594
|
exports.TableFormFieldsMessageType = TableFormFieldsMessageType;
|
|
@@ -3447,6 +3616,7 @@ exports.createRichTextV2Plugin = createRichTextV2Plugin;
|
|
|
3447
3616
|
exports.descriptors = descriptors;
|
|
3448
3617
|
exports.getBackgroundsFileIds = getBackgroundsFileIds;
|
|
3449
3618
|
exports.getBackgroundsSwatchIds = getBackgroundsSwatchIds;
|
|
3619
|
+
exports.getBlocksInSelection = getBlocksInSelection;
|
|
3450
3620
|
exports.getBorderSwatchIds = getBorderSwatchIds;
|
|
3451
3621
|
exports.getBoxShadowsSwatchIds = getBoxShadowsSwatchIds;
|
|
3452
3622
|
exports.getBreakpoints = getBreakpoints;
|
|
@@ -3498,5 +3668,8 @@ exports.richTextDTOtoDAO = richTextDTOtoDAO;
|
|
|
3498
3668
|
exports.richTextDTOtoSelection = richTextDTOtoSelection;
|
|
3499
3669
|
exports.toSelectionDTO = toSelectionDTO;
|
|
3500
3670
|
exports.unstable_RichTextV2 = unstable_RichTextV2;
|
|
3671
|
+
exports.unstable_StyleV2 = unstable_StyleV2;
|
|
3672
|
+
exports.unstable_useStyleV2ClassName = unstable_useStyleV2ClassName;
|
|
3673
|
+
exports.useStyle = useStyle;
|
|
3501
3674
|
exports.withBlock = withBlock;
|
|
3502
3675
|
//# sourceMappingURL=react-page.cjs.js.map
|