@makeswift/runtime 0.10.2 → 0.10.4
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 +1 -3
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +2 -4
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +5 -5
- package/dist/Button.es.js +6 -6
- package/dist/Carousel.cjs.js +4 -4
- package/dist/Carousel.es.js +5 -5
- package/dist/Countdown.cjs.js +3 -5
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +4 -6
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +2 -4
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +3 -5
- package/dist/Divider.es.js.map +1 -1
- package/dist/Embed.cjs.js +3 -1
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +4 -2
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +15 -15
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +7 -7
- package/dist/Image.cjs.js +13 -13
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +13 -13
- package/dist/LiveProvider.cjs.js +2 -4
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +4 -6
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +13 -13
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +13 -13
- package/dist/PreviewProvider.cjs.js +2 -4
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +4 -6
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +8 -7
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +5 -4
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +8 -61
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +10 -63
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +2 -4
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +3 -5
- package/dist/Root.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +7 -7
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +8 -8
- package/dist/Video.cjs.js +3 -1
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +4 -2
- package/dist/Video.es.js.map +1 -1
- package/dist/builder.cjs.js +3 -1
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +3 -1
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +4 -4
- package/dist/components.es.js +4 -4
- package/dist/control-serialization.cjs.js +1 -0
- package/dist/control-serialization.cjs.js.map +1 -1
- package/dist/control-serialization.es.js +2 -1
- package/dist/control-serialization.es.js.map +1 -1
- package/dist/controls.cjs.js +5 -1
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +4 -2
- package/dist/controls.es.js.map +1 -1
- package/dist/index.cjs.js +121 -257
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs2.js +1 -0
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs3.js +107 -21
- package/dist/index.cjs3.js.map +1 -1
- package/dist/index.cjs4.js +57 -16
- package/dist/index.cjs4.js.map +1 -1
- package/dist/index.cjs5.js +42 -81
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs6.js +82 -17
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +18 -377
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.cjs8.js +258 -181
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.cjs9.js +343 -0
- package/dist/index.cjs9.js.map +1 -0
- package/dist/index.es.js +126 -261
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js +2 -1
- package/dist/index.es2.js.map +1 -1
- package/dist/index.es3.js +103 -22
- package/dist/index.es3.js.map +1 -1
- package/dist/index.es4.js +57 -16
- package/dist/index.es4.js.map +1 -1
- package/dist/index.es5.js +42 -80
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es6.js +81 -17
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es7.js +18 -371
- package/dist/index.es7.js.map +1 -1
- package/dist/index.es8.js +259 -182
- package/dist/index.es8.js.map +1 -1
- package/dist/index.es9.js +336 -0
- package/dist/index.es9.js.map +1 -0
- package/dist/main.cjs.js +3 -1
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +3 -1
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +3 -5
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +4 -6
- package/dist/next.es.js.map +1 -1
- package/dist/prop-controllers.cjs.js +3 -1
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +3 -1
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/react-page.cjs.js +499 -314
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +498 -315
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +3 -5
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +3 -5
- package/dist/react.es.js.map +1 -1
- package/dist/slate.cjs.js +11 -8
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +11 -9
- package/dist/slate.es.js.map +1 -1
- package/dist/toText.cjs.js +67 -0
- package/dist/toText.cjs.js.map +1 -0
- package/dist/toText.es.js +66 -0
- package/dist/toText.es.js.map +1 -0
- package/dist/types/src/components/builtin/Text/register.d.ts.map +1 -1
- package/dist/types/src/controls/control.d.ts +1 -1
- package/dist/types/src/controls/control.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/__test__/copy.test.d.ts +2 -0
- package/dist/types/src/controls/rich-text/__test__/copy.test.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text/__test__/introspection.test.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text/__test__/translation.test.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text/copy.d.ts +4 -0
- package/dist/types/src/controls/rich-text/copy.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text/index.d.ts +1 -0
- package/dist/types/src/controls/rich-text/index.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/__test__/copy.test.d.ts +2 -0
- package/dist/types/src/controls/rich-text-v2/__test__/copy.test.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/__test__/introspection.test.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/copy.d.ts +4 -0
- package/dist/types/src/controls/rich-text-v2/copy.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/index.d.ts +1 -0
- package/dist/types/src/controls/rich-text-v2/index.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +2 -4
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/translation.d.ts +1 -1
- package/dist/types/src/controls/rich-text-v2/translation.d.ts.map +1 -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/EditableTextV2/render-element.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/usePresetValue.d.ts +10 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/usePresetValue.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
- package/dist/types/src/slate/BuilderPlugin/index.d.ts +2 -1
- package/dist/types/src/slate/BuilderPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlinePlugin/index.d.ts +2 -2
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/TypographyPlugin/index.d.ts +3 -3
- 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/utils/index.d.ts +2 -0
- package/dist/types/src/slate/utils/index.d.ts.map +1 -0
- package/dist/types/src/slate/utils/toText.d.ts +4 -0
- package/dist/types/src/slate/utils/toText.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/types/src/controls/rich-text/introspection.test.d.ts.map +0 -1
- package/dist/types/src/controls/rich-text/translation.test.d.ts.map +0 -1
- package/dist/types/src/controls/rich-text-v2/introspection.test.d.ts.map +0 -1
- /package/dist/types/src/controls/rich-text/{introspection.test.d.ts → __test__/introspection.test.d.ts} +0 -0
- /package/dist/types/src/controls/rich-text/{translation.test.d.ts → __test__/translation.test.d.ts} +0 -0
- /package/dist/types/src/controls/rich-text-v2/{introspection.test.d.ts → __test__/introspection.test.d.ts} +0 -0
package/dist/react-page.cjs.js
CHANGED
|
@@ -34,22 +34,25 @@ var __publicField = (obj, key, value) => {
|
|
|
34
34
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
35
35
|
return value;
|
|
36
36
|
};
|
|
37
|
-
var
|
|
37
|
+
var _c;
|
|
38
38
|
var redux = require("redux");
|
|
39
39
|
var thunk = require("redux-thunk");
|
|
40
40
|
var actions = require("./actions.cjs.js");
|
|
41
41
|
var state_breakpoints = require("./state/breakpoints.cjs.js");
|
|
42
|
+
var ipsum = require("corporate-ipsum");
|
|
43
|
+
var slate = require("slate");
|
|
44
|
+
var uuid = require("uuid");
|
|
42
45
|
var React = require("react");
|
|
43
46
|
var css = require("@emotion/css");
|
|
44
47
|
var serialize = require("@emotion/serialize");
|
|
45
48
|
var utils = require("@emotion/utils");
|
|
46
|
-
var slate = require("slate");
|
|
47
49
|
var jsxRuntime = require("react/jsx-runtime");
|
|
48
50
|
var isHotkey = require("is-hotkey");
|
|
49
51
|
function _interopDefaultLegacy(e) {
|
|
50
52
|
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
51
53
|
}
|
|
52
54
|
var thunk__default = /* @__PURE__ */ _interopDefaultLegacy(thunk);
|
|
55
|
+
var ipsum__default = /* @__PURE__ */ _interopDefaultLegacy(ipsum);
|
|
53
56
|
var React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
|
|
54
57
|
var isHotkey__default = /* @__PURE__ */ _interopDefaultLegacy(isHotkey);
|
|
55
58
|
const ComponentIcon = {
|
|
@@ -119,8 +122,8 @@ function getDocuments(state) {
|
|
|
119
122
|
return state;
|
|
120
123
|
}
|
|
121
124
|
function getDocument$1(state, documentKey) {
|
|
122
|
-
var
|
|
123
|
-
return (
|
|
125
|
+
var _a;
|
|
126
|
+
return (_a = getDocuments(state).get(documentKey)) != null ? _a : null;
|
|
124
127
|
}
|
|
125
128
|
function reducer$8(state = getInitialState$7(), action) {
|
|
126
129
|
switch (action.type) {
|
|
@@ -144,8 +147,8 @@ function getReactComponents(state) {
|
|
|
144
147
|
return state;
|
|
145
148
|
}
|
|
146
149
|
function getReactComponent$1(state, type) {
|
|
147
|
-
var
|
|
148
|
-
return (
|
|
150
|
+
var _a;
|
|
151
|
+
return (_a = getReactComponents(state).get(type)) != null ? _a : null;
|
|
149
152
|
}
|
|
150
153
|
function reducer$7(state = getInitialState$6(), action) {
|
|
151
154
|
switch (action.type) {
|
|
@@ -169,8 +172,8 @@ function getPropControllerDescriptors$1(state) {
|
|
|
169
172
|
return state;
|
|
170
173
|
}
|
|
171
174
|
function getComponentPropControllerDescriptors$1(state, componentType) {
|
|
172
|
-
var
|
|
173
|
-
return (
|
|
175
|
+
var _a;
|
|
176
|
+
return (_a = getPropControllerDescriptors$1(state).get(componentType)) != null ? _a : null;
|
|
174
177
|
}
|
|
175
178
|
function reducer$6(state = getInitialState$5(), action) {
|
|
176
179
|
switch (action.type) {
|
|
@@ -195,24 +198,24 @@ function getInitialState$4() {
|
|
|
195
198
|
return { handles: /* @__PURE__ */ new Map(), instances: /* @__PURE__ */ new Map() };
|
|
196
199
|
}
|
|
197
200
|
function getPropControllersHandle(state, documentKey, elementKey) {
|
|
198
|
-
var
|
|
199
|
-
return (_b = (
|
|
201
|
+
var _a, _b;
|
|
202
|
+
return (_b = (_a = state.handles.get(documentKey)) == null ? void 0 : _a.get(elementKey)) != null ? _b : null;
|
|
200
203
|
}
|
|
201
204
|
function getPropControllers$1(state, documentKey, elementKey) {
|
|
202
|
-
var
|
|
203
|
-
return (_b = (
|
|
205
|
+
var _a, _b;
|
|
206
|
+
return (_b = (_a = state.instances.get(documentKey)) == null ? void 0 : _a.get(elementKey)) != null ? _b : null;
|
|
204
207
|
}
|
|
205
208
|
function getPropController(state, documentKey, elementKey, propName) {
|
|
206
|
-
var
|
|
207
|
-
return (_b = (
|
|
209
|
+
var _a, _b;
|
|
210
|
+
return (_b = (_a = getPropControllers$1(state, documentKey, elementKey)) == null ? void 0 : _a[propName]) != null ? _b : null;
|
|
208
211
|
}
|
|
209
212
|
function reducer$5(state = getInitialState$4(), action) {
|
|
210
|
-
var
|
|
213
|
+
var _a, _b, _c2, _d;
|
|
211
214
|
switch (action.type) {
|
|
212
215
|
case actions.ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE: {
|
|
213
216
|
const { documentKey, elementKey, handle } = action.payload;
|
|
214
217
|
return __spreadProps(__spreadValues({}, state), {
|
|
215
|
-
handles: new Map(state.handles).set(documentKey, new Map((
|
|
218
|
+
handles: new Map(state.handles).set(documentKey, new Map((_a = state.handles.get(documentKey)) != null ? _a : []).set(elementKey, handle))
|
|
216
219
|
});
|
|
217
220
|
}
|
|
218
221
|
case actions.ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE: {
|
|
@@ -224,7 +227,7 @@ function reducer$5(state = getInitialState$4(), action) {
|
|
|
224
227
|
case actions.ActionTypes.REGISTER_PROP_CONTROLLERS: {
|
|
225
228
|
const { documentKey, elementKey, propControllers } = action.payload;
|
|
226
229
|
return __spreadProps(__spreadValues({}, state), {
|
|
227
|
-
instances: new Map(state.instances).set(documentKey, new Map((
|
|
230
|
+
instances: new Map(state.instances).set(documentKey, new Map((_c2 = state.instances.get(documentKey)) != null ? _c2 : []).set(elementKey, propControllers))
|
|
228
231
|
});
|
|
229
232
|
}
|
|
230
233
|
case actions.ActionTypes.UNREGISTER_PROP_CONTROLLERS: {
|
|
@@ -277,11 +280,11 @@ function reducer$2(state = getInitialState$1(), action) {
|
|
|
277
280
|
}
|
|
278
281
|
}
|
|
279
282
|
function getInitialState(initialState) {
|
|
280
|
-
var
|
|
283
|
+
var _a, _b, _c2;
|
|
281
284
|
return {
|
|
282
|
-
locales: (
|
|
285
|
+
locales: (_a = initialState == null ? void 0 : initialState.locales) != null ? _a : [],
|
|
283
286
|
locale: (_b = initialState == null ? void 0 : initialState.locale) != null ? _b : null,
|
|
284
|
-
defaultLocale: (
|
|
287
|
+
defaultLocale: (_c2 = initialState == null ? void 0 : initialState.defaultLocale) != null ? _c2 : null
|
|
285
288
|
};
|
|
286
289
|
}
|
|
287
290
|
function reducer$1(state = getInitialState(), action) {
|
|
@@ -322,11 +325,11 @@ function Color(config = {}) {
|
|
|
322
325
|
return { type: ColorControlType, config };
|
|
323
326
|
}
|
|
324
327
|
function copyColorData(value, context) {
|
|
325
|
-
var
|
|
328
|
+
var _a;
|
|
326
329
|
if (value == null)
|
|
327
330
|
return value;
|
|
328
331
|
return __spreadProps(__spreadValues({}, value), {
|
|
329
|
-
swatchId: (
|
|
332
|
+
swatchId: (_a = context.replacementContext.swatchIds.get(value.swatchId)) != null ? _a : value.swatchId
|
|
330
333
|
});
|
|
331
334
|
}
|
|
332
335
|
class PropController {
|
|
@@ -357,10 +360,10 @@ const AllStyleControlProperties = [
|
|
|
357
360
|
StyleControlProperty.TextStyle
|
|
358
361
|
];
|
|
359
362
|
function Style(params) {
|
|
360
|
-
var
|
|
363
|
+
var _a;
|
|
361
364
|
return {
|
|
362
365
|
type: StyleControlType,
|
|
363
|
-
config: { properties: (
|
|
366
|
+
config: { properties: (_a = params == null ? void 0 : params.properties) != null ? _a : StyleControlDefaultProperties }
|
|
364
367
|
};
|
|
365
368
|
}
|
|
366
369
|
Style.Default = StyleControlDefaultProperties;
|
|
@@ -814,10 +817,10 @@ function Image(config = {}) {
|
|
|
814
817
|
}
|
|
815
818
|
Image.Format = ImageControlValueFormat;
|
|
816
819
|
function copyImageData(value, context) {
|
|
817
|
-
var
|
|
820
|
+
var _a;
|
|
818
821
|
if (value == null)
|
|
819
822
|
return value;
|
|
820
|
-
return (
|
|
823
|
+
return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
|
|
821
824
|
}
|
|
822
825
|
if (void 0) {
|
|
823
826
|
const { describe, test, expect } = void 0;
|
|
@@ -850,7 +853,7 @@ function Link(config = {}) {
|
|
|
850
853
|
return { type: LinkControlType, config };
|
|
851
854
|
}
|
|
852
855
|
function copyLinkData(value, context) {
|
|
853
|
-
var
|
|
856
|
+
var _a;
|
|
854
857
|
if (value == null)
|
|
855
858
|
return value;
|
|
856
859
|
if (value.type === "OPEN_PAGE") {
|
|
@@ -858,7 +861,7 @@ function copyLinkData(value, context) {
|
|
|
858
861
|
if (pageId != null) {
|
|
859
862
|
return __spreadProps(__spreadValues({}, value), {
|
|
860
863
|
payload: __spreadProps(__spreadValues({}, value.payload), {
|
|
861
|
-
pageId: (
|
|
864
|
+
pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : pageId
|
|
862
865
|
})
|
|
863
866
|
});
|
|
864
867
|
}
|
|
@@ -1212,22 +1215,22 @@ function copy$e(value, context) {
|
|
|
1212
1215
|
return value;
|
|
1213
1216
|
return value.map((override) => __spreadProps(__spreadValues({}, override), {
|
|
1214
1217
|
value: override.value.map((backgroundItem) => {
|
|
1215
|
-
var
|
|
1218
|
+
var _a, _b;
|
|
1216
1219
|
switch (backgroundItem.type) {
|
|
1217
1220
|
case "color":
|
|
1218
1221
|
return __spreadProps(__spreadValues({}, backgroundItem), {
|
|
1219
1222
|
payload: backgroundItem.payload === null ? null : __spreadProps(__spreadValues({}, backgroundItem.payload), {
|
|
1220
|
-
swatchId: (
|
|
1223
|
+
swatchId: (_a = context.replacementContext.swatchIds.get(backgroundItem.payload.swatchId)) != null ? _a : backgroundItem.payload.swatchId
|
|
1221
1224
|
})
|
|
1222
1225
|
});
|
|
1223
1226
|
case "gradient":
|
|
1224
1227
|
return __spreadProps(__spreadValues({}, backgroundItem), {
|
|
1225
1228
|
payload: __spreadProps(__spreadValues({}, backgroundItem.payload), {
|
|
1226
1229
|
stops: backgroundItem.payload.stops.map((stop) => {
|
|
1227
|
-
var
|
|
1230
|
+
var _a2;
|
|
1228
1231
|
return __spreadProps(__spreadValues({}, stop), {
|
|
1229
1232
|
color: stop.color == null ? null : __spreadProps(__spreadValues({}, stop.color), {
|
|
1230
|
-
swatchId: (
|
|
1233
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(stop.color.swatchId)) != null ? _a2 : stop.color.swatchId
|
|
1231
1234
|
})
|
|
1232
1235
|
});
|
|
1233
1236
|
})
|
|
@@ -1253,7 +1256,7 @@ function copy$d(value, context) {
|
|
|
1253
1256
|
});
|
|
1254
1257
|
}
|
|
1255
1258
|
function copy$c(value, context) {
|
|
1256
|
-
var
|
|
1259
|
+
var _a, _b;
|
|
1257
1260
|
if (value == null)
|
|
1258
1261
|
return value;
|
|
1259
1262
|
switch (value.type) {
|
|
@@ -1263,7 +1266,7 @@ function copy$c(value, context) {
|
|
|
1263
1266
|
return value;
|
|
1264
1267
|
return __spreadProps(__spreadValues({}, value), {
|
|
1265
1268
|
payload: __spreadProps(__spreadValues({}, value.payload), {
|
|
1266
|
-
pageId: (
|
|
1269
|
+
pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : pageId
|
|
1267
1270
|
})
|
|
1268
1271
|
});
|
|
1269
1272
|
}
|
|
@@ -1296,10 +1299,10 @@ function copy$b(value, context) {
|
|
|
1296
1299
|
payload: __spreadProps(__spreadValues({}, item.payload), {
|
|
1297
1300
|
link: link != null ? copy$c(link, context) : void 0,
|
|
1298
1301
|
color: color != null ? color.map((override) => {
|
|
1299
|
-
var
|
|
1302
|
+
var _a;
|
|
1300
1303
|
return __spreadProps(__spreadValues({}, override), {
|
|
1301
1304
|
value: __spreadProps(__spreadValues({}, override.value), {
|
|
1302
|
-
swatchId: (
|
|
1305
|
+
swatchId: (_a = context.replacementContext.swatchIds.get(override.value.swatchId)) != null ? _a : override.value.swatchId
|
|
1303
1306
|
})
|
|
1304
1307
|
});
|
|
1305
1308
|
}) : void 0
|
|
@@ -1357,14 +1360,14 @@ function copy$a(value, context) {
|
|
|
1357
1360
|
return value;
|
|
1358
1361
|
return value.map((override) => __spreadProps(__spreadValues({}, override), { value: override.value.map(copyShadowItem) }));
|
|
1359
1362
|
function copyShadowItem(item) {
|
|
1360
|
-
var
|
|
1363
|
+
var _a;
|
|
1361
1364
|
const { color } = item.payload;
|
|
1362
1365
|
if (color == null)
|
|
1363
1366
|
return item;
|
|
1364
1367
|
return __spreadProps(__spreadValues({}, item), {
|
|
1365
1368
|
payload: __spreadProps(__spreadValues({}, item.payload), {
|
|
1366
1369
|
color: __spreadProps(__spreadValues({}, color), {
|
|
1367
|
-
swatchId: (
|
|
1370
|
+
swatchId: (_a = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a : color.swatchId
|
|
1368
1371
|
})
|
|
1369
1372
|
})
|
|
1370
1373
|
});
|
|
@@ -1418,10 +1421,10 @@ if (void 0) {
|
|
|
1418
1421
|
});
|
|
1419
1422
|
}
|
|
1420
1423
|
function copy$9(value, context) {
|
|
1421
|
-
var
|
|
1424
|
+
var _a;
|
|
1422
1425
|
if (value == null)
|
|
1423
1426
|
return value;
|
|
1424
|
-
return (
|
|
1427
|
+
return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
|
|
1425
1428
|
}
|
|
1426
1429
|
if (void 0) {
|
|
1427
1430
|
const { describe, test, expect } = void 0;
|
|
@@ -1454,13 +1457,13 @@ function copy$8(value, context) {
|
|
|
1454
1457
|
return value;
|
|
1455
1458
|
return value.map(copyImagesPanelItem);
|
|
1456
1459
|
function copyImagesPanelItem(imagesPanelItem) {
|
|
1457
|
-
var
|
|
1460
|
+
var _a;
|
|
1458
1461
|
const { file } = imagesPanelItem.props;
|
|
1459
1462
|
if (file == null)
|
|
1460
1463
|
return imagesPanelItem;
|
|
1461
1464
|
return __spreadProps(__spreadValues({}, imagesPanelItem), {
|
|
1462
1465
|
props: __spreadProps(__spreadValues({}, imagesPanelItem.props), {
|
|
1463
|
-
file: (
|
|
1466
|
+
file: (_a = context.replacementContext.fileIds.get(file)) != null ? _a : file
|
|
1464
1467
|
})
|
|
1465
1468
|
});
|
|
1466
1469
|
}
|
|
@@ -1509,9 +1512,9 @@ function copy$7(value, context) {
|
|
|
1509
1512
|
return value;
|
|
1510
1513
|
return value.map((override) => __spreadProps(__spreadValues({}, override), { value: copyColorValue(override.value) }));
|
|
1511
1514
|
function copyColorValue(colorValue) {
|
|
1512
|
-
var
|
|
1515
|
+
var _a;
|
|
1513
1516
|
return __spreadProps(__spreadValues({}, colorValue), {
|
|
1514
|
-
swatchId: (
|
|
1517
|
+
swatchId: (_a = context.replacementContext.swatchIds.get(colorValue.swatchId)) != null ? _a : colorValue.swatchId
|
|
1515
1518
|
});
|
|
1516
1519
|
}
|
|
1517
1520
|
}
|
|
@@ -1520,9 +1523,9 @@ function copy$6(value, context) {
|
|
|
1520
1523
|
return value;
|
|
1521
1524
|
return __spreadProps(__spreadValues({}, value), { fields: value.fields.map(copyFormFieldsPanelItem) });
|
|
1522
1525
|
function copyFormFieldsPanelItem(item) {
|
|
1523
|
-
var
|
|
1526
|
+
var _a;
|
|
1524
1527
|
return __spreadProps(__spreadValues({}, item), {
|
|
1525
|
-
tableColumnId: (
|
|
1528
|
+
tableColumnId: (_a = context.replacementContext.tableColumnIds.get(item.tableColumnId)) != null ? _a : item.tableColumnId
|
|
1526
1529
|
});
|
|
1527
1530
|
}
|
|
1528
1531
|
}
|
|
@@ -1576,10 +1579,10 @@ if (void 0) {
|
|
|
1576
1579
|
});
|
|
1577
1580
|
}
|
|
1578
1581
|
function copy$5(value, context) {
|
|
1579
|
-
var
|
|
1582
|
+
var _a;
|
|
1580
1583
|
if (value == null)
|
|
1581
1584
|
return value;
|
|
1582
|
-
return (
|
|
1585
|
+
return (_a = context.replacementContext.tableIds.get(value)) != null ? _a : value;
|
|
1583
1586
|
}
|
|
1584
1587
|
if (void 0) {
|
|
1585
1588
|
const { describe, test, expect } = void 0;
|
|
@@ -1621,13 +1624,13 @@ function copy$4(value, context) {
|
|
|
1621
1624
|
};
|
|
1622
1625
|
}
|
|
1623
1626
|
function copyBorderSide(borderSide) {
|
|
1624
|
-
var
|
|
1627
|
+
var _a;
|
|
1625
1628
|
const { color } = borderSide;
|
|
1626
1629
|
if (color == null)
|
|
1627
1630
|
return borderSide;
|
|
1628
1631
|
return __spreadProps(__spreadValues({}, borderSide), {
|
|
1629
1632
|
color: __spreadProps(__spreadValues({}, color), {
|
|
1630
|
-
swatchId: (
|
|
1633
|
+
swatchId: (_a = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a : color.swatchId
|
|
1631
1634
|
})
|
|
1632
1635
|
});
|
|
1633
1636
|
}
|
|
@@ -1741,24 +1744,24 @@ function copy$3(value, context) {
|
|
|
1741
1744
|
return value;
|
|
1742
1745
|
return __spreadProps(__spreadValues({}, value), { document: value.document ? copyNode(value.document) : value.document });
|
|
1743
1746
|
function copyNode(node) {
|
|
1744
|
-
var
|
|
1747
|
+
var _a;
|
|
1745
1748
|
switch (node.object) {
|
|
1746
1749
|
case "document":
|
|
1747
1750
|
case "block":
|
|
1748
1751
|
case "inline":
|
|
1749
1752
|
return copyInline(node);
|
|
1750
1753
|
case "text":
|
|
1751
|
-
return __spreadProps(__spreadValues({}, node), { marks: (
|
|
1754
|
+
return __spreadProps(__spreadValues({}, node), { marks: (_a = node.marks) == null ? void 0 : _a.map(copyMark) });
|
|
1752
1755
|
default:
|
|
1753
1756
|
return node;
|
|
1754
1757
|
}
|
|
1755
1758
|
}
|
|
1756
1759
|
function copyInline(inline) {
|
|
1757
|
-
var
|
|
1760
|
+
var _a, _b;
|
|
1758
1761
|
switch (inline.type) {
|
|
1759
1762
|
case "link":
|
|
1760
1763
|
return __spreadProps(__spreadValues({}, inline), {
|
|
1761
|
-
nodes: (
|
|
1764
|
+
nodes: (_a = inline.nodes) == null ? void 0 : _a.map(copyNode),
|
|
1762
1765
|
data: inline.data ? copyLinkData2(inline.data) : inline.data
|
|
1763
1766
|
});
|
|
1764
1767
|
default:
|
|
@@ -1766,7 +1769,7 @@ function copy$3(value, context) {
|
|
|
1766
1769
|
}
|
|
1767
1770
|
}
|
|
1768
1771
|
function copyLinkData2(data) {
|
|
1769
|
-
var
|
|
1772
|
+
var _a, _b;
|
|
1770
1773
|
switch (data.type) {
|
|
1771
1774
|
case "OPEN_PAGE": {
|
|
1772
1775
|
const pageId = data.payload.pageId;
|
|
@@ -1774,7 +1777,7 @@ function copy$3(value, context) {
|
|
|
1774
1777
|
return data;
|
|
1775
1778
|
return __spreadProps(__spreadValues({}, data), {
|
|
1776
1779
|
payload: __spreadProps(__spreadValues({}, data.payload), {
|
|
1777
|
-
pageId: (
|
|
1780
|
+
pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : data.payload.pageId
|
|
1778
1781
|
})
|
|
1779
1782
|
});
|
|
1780
1783
|
}
|
|
@@ -1795,20 +1798,20 @@ function copy$3(value, context) {
|
|
|
1795
1798
|
}
|
|
1796
1799
|
}
|
|
1797
1800
|
function copyMark(mark) {
|
|
1798
|
-
var
|
|
1801
|
+
var _a, _b, _c2, _d;
|
|
1799
1802
|
switch (mark.type) {
|
|
1800
1803
|
case "typography": {
|
|
1801
|
-
const typographyId = (
|
|
1804
|
+
const typographyId = (_a = mark.data) == null ? void 0 : _a.value.id;
|
|
1802
1805
|
return __spreadProps(__spreadValues({}, mark), {
|
|
1803
1806
|
data: __spreadProps(__spreadValues({}, mark.data), {
|
|
1804
1807
|
value: __spreadProps(__spreadValues({}, (_b = mark.data) == null ? void 0 : _b.value), {
|
|
1805
|
-
id: (
|
|
1808
|
+
id: (_c2 = context.replacementContext.typographyIds.get(typographyId)) != null ? _c2 : typographyId,
|
|
1806
1809
|
style: (_d = mark.data) == null ? void 0 : _d.value.style.map((override) => {
|
|
1807
|
-
var
|
|
1810
|
+
var _a2, _b2, _c3;
|
|
1808
1811
|
return __spreadProps(__spreadValues({}, override), {
|
|
1809
1812
|
value: __spreadProps(__spreadValues({}, override.value), {
|
|
1810
1813
|
color: override.value.color == null ? override.value.color : __spreadProps(__spreadValues({}, override.value.color), {
|
|
1811
|
-
swatchId: (
|
|
1814
|
+
swatchId: (_c3 = context.replacementContext.swatchIds.get((_a2 = override.value.color) == null ? void 0 : _a2.swatchId)) != null ? _c3 : (_b2 = override.value.color) == null ? void 0 : _b2.swatchId
|
|
1812
1815
|
})
|
|
1813
1816
|
})
|
|
1814
1817
|
});
|
|
@@ -1959,110 +1962,89 @@ function copy$1(descriptor, value, context) {
|
|
|
1959
1962
|
function copyElementReference(value, context) {
|
|
1960
1963
|
return context.replacementContext.globalElementIds.get(value) || value;
|
|
1961
1964
|
}
|
|
1962
|
-
function
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
case ColorControlType:
|
|
1979
|
-
return copyColorData(value, context);
|
|
1980
|
-
case ImageControlType:
|
|
1981
|
-
return copyImageData(value, context);
|
|
1982
|
-
case LinkControlType:
|
|
1983
|
-
return copyLinkData(value, context);
|
|
1984
|
-
case ShapeControlType:
|
|
1985
|
-
return copyShapeData(definition2, value, context);
|
|
1986
|
-
case ListControlType:
|
|
1987
|
-
return copyListData(definition2, value, context);
|
|
1988
|
-
case StyleControlType:
|
|
1989
|
-
return copyStyleData(value, context);
|
|
1990
|
-
case SlotControlType:
|
|
1991
|
-
return copySlotData(value, context);
|
|
1992
|
-
default:
|
|
1993
|
-
return value;
|
|
1994
|
-
}
|
|
1995
|
-
}
|
|
1996
|
-
function merge(definition2, a, b = a, context) {
|
|
1997
|
-
switch (definition2.type) {
|
|
1998
|
-
case SlotControlType:
|
|
1999
|
-
return mergeSlotData(a, b, context);
|
|
2000
|
-
default:
|
|
2001
|
-
return b;
|
|
1965
|
+
function copyRichTextData(value, context) {
|
|
1966
|
+
if (value == null)
|
|
1967
|
+
return value;
|
|
1968
|
+
return __spreadProps(__spreadValues({}, value), { document: value.document ? copyNode(value.document) : value.document });
|
|
1969
|
+
function copyNode(node) {
|
|
1970
|
+
var _a;
|
|
1971
|
+
switch (node.object) {
|
|
1972
|
+
case "document":
|
|
1973
|
+
case "block":
|
|
1974
|
+
case "inline":
|
|
1975
|
+
return copyInline(node);
|
|
1976
|
+
case "text":
|
|
1977
|
+
return __spreadProps(__spreadValues({}, node), { marks: (_a = node.marks) == null ? void 0 : _a.map(copyMark) });
|
|
1978
|
+
default:
|
|
1979
|
+
return node;
|
|
1980
|
+
}
|
|
2002
1981
|
}
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
};
|
|
2013
|
-
|
|
2014
|
-
function unstable_IconRadioGroup(config) {
|
|
2015
|
-
return { type: IconRadioGroupControlType, config };
|
|
2016
|
-
}
|
|
2017
|
-
const SelectControlType = "makeswift::controls::select";
|
|
2018
|
-
function Select(config) {
|
|
2019
|
-
return { type: SelectControlType, config };
|
|
2020
|
-
}
|
|
2021
|
-
const isServer = typeof window === "undefined";
|
|
2022
|
-
const useInsertionEffectSpecifier = "useInsertionEffect";
|
|
2023
|
-
const useInsertionEffect = (_a = React__default["default"][useInsertionEffectSpecifier]) != null ? _a : React__default["default"].useLayoutEffect;
|
|
2024
|
-
function useStyle(style) {
|
|
2025
|
-
const serialized = serialize.serializeStyles([style], css.cache.registered);
|
|
2026
|
-
utils.registerStyles(css.cache, serialized, false);
|
|
2027
|
-
useInsertionEffect(() => {
|
|
2028
|
-
utils.insertStyles(css.cache, serialized, false);
|
|
2029
|
-
});
|
|
2030
|
-
if (isServer)
|
|
2031
|
-
utils.insertStyles(css.cache, serialized, false);
|
|
2032
|
-
return `${css.cache.key}-${serialized.name}`;
|
|
2033
|
-
}
|
|
2034
|
-
const StyleV2ControlType = "makeswift::controls::style-v2";
|
|
2035
|
-
const unstable_useStyleV2ClassName = useStyle;
|
|
2036
|
-
function unstable_StyleV2(config) {
|
|
2037
|
-
return { type: StyleV2ControlType, config };
|
|
2038
|
-
}
|
|
2039
|
-
const StyleV2ControlMessageType = {
|
|
2040
|
-
CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model",
|
|
2041
|
-
STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE: "makeswift::controls::style-v2::message::child-control-message"
|
|
2042
|
-
};
|
|
2043
|
-
class StyleV2Control extends PropController {
|
|
2044
|
-
constructor(send, descriptor) {
|
|
2045
|
-
super(send);
|
|
2046
|
-
__publicField(this, "control");
|
|
2047
|
-
this.control = createPropController(descriptor.config.type, (message) => {
|
|
2048
|
-
this.send({
|
|
2049
|
-
type: StyleV2ControlMessageType.STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE,
|
|
2050
|
-
payload: { message }
|
|
2051
|
-
});
|
|
2052
|
-
});
|
|
1982
|
+
function copyInline(inline) {
|
|
1983
|
+
var _a, _b;
|
|
1984
|
+
switch (inline.type) {
|
|
1985
|
+
case "link":
|
|
1986
|
+
return __spreadProps(__spreadValues({}, inline), {
|
|
1987
|
+
nodes: (_a = inline.nodes) == null ? void 0 : _a.map(copyNode),
|
|
1988
|
+
data: inline.data ? copyLinkData2(inline.data) : inline.data
|
|
1989
|
+
});
|
|
1990
|
+
default:
|
|
1991
|
+
return __spreadProps(__spreadValues({}, inline), { nodes: (_b = inline.nodes) == null ? void 0 : _b.map(copyNode) });
|
|
1992
|
+
}
|
|
2053
1993
|
}
|
|
2054
|
-
|
|
2055
|
-
|
|
1994
|
+
function copyLinkData2(data) {
|
|
1995
|
+
var _a, _b;
|
|
1996
|
+
switch (data.type) {
|
|
1997
|
+
case "OPEN_PAGE": {
|
|
1998
|
+
const pageId = data.payload.pageId;
|
|
1999
|
+
if (pageId == null)
|
|
2000
|
+
return data;
|
|
2001
|
+
return __spreadProps(__spreadValues({}, data), {
|
|
2002
|
+
payload: __spreadProps(__spreadValues({}, data.payload), {
|
|
2003
|
+
pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : data.payload.pageId
|
|
2004
|
+
})
|
|
2005
|
+
});
|
|
2006
|
+
}
|
|
2007
|
+
case "SCROLL_TO_ELEMENT": {
|
|
2008
|
+
const elementIdConfig = data.payload.elementIdConfig;
|
|
2009
|
+
if (elementIdConfig == null)
|
|
2010
|
+
return data;
|
|
2011
|
+
return __spreadProps(__spreadValues({}, data), {
|
|
2012
|
+
payload: __spreadProps(__spreadValues({}, data.payload), {
|
|
2013
|
+
elementIdConfig: __spreadProps(__spreadValues({}, elementIdConfig), {
|
|
2014
|
+
elementKey: (_b = context.replacementContext.elementKeys.get(elementIdConfig.elementKey)) != null ? _b : elementIdConfig.elementKey
|
|
2015
|
+
})
|
|
2016
|
+
})
|
|
2017
|
+
});
|
|
2018
|
+
}
|
|
2019
|
+
default:
|
|
2020
|
+
return data;
|
|
2021
|
+
}
|
|
2056
2022
|
}
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2023
|
+
function copyMark(mark) {
|
|
2024
|
+
var _a, _b, _c2, _d;
|
|
2025
|
+
switch (mark.type) {
|
|
2026
|
+
case "typography": {
|
|
2027
|
+
const typographyId = (_a = mark.data) == null ? void 0 : _a.value.id;
|
|
2028
|
+
return __spreadProps(__spreadValues({}, mark), {
|
|
2029
|
+
data: __spreadProps(__spreadValues({}, mark.data), {
|
|
2030
|
+
value: __spreadProps(__spreadValues({}, (_b = mark.data) == null ? void 0 : _b.value), {
|
|
2031
|
+
id: (_c2 = context.replacementContext.typographyIds.get(typographyId)) != null ? _c2 : typographyId,
|
|
2032
|
+
style: (_d = mark.data) == null ? void 0 : _d.value.style.map((override) => {
|
|
2033
|
+
var _a2, _b2, _c3;
|
|
2034
|
+
return __spreadProps(__spreadValues({}, override), {
|
|
2035
|
+
value: __spreadProps(__spreadValues({}, override.value), {
|
|
2036
|
+
color: override.value.color == null ? override.value.color : __spreadProps(__spreadValues({}, override.value.color), {
|
|
2037
|
+
swatchId: (_c3 = context.replacementContext.swatchIds.get((_a2 = override.value.color) == null ? void 0 : _a2.swatchId)) != null ? _c3 : (_b2 = override.value.color) == null ? void 0 : _b2.swatchId
|
|
2038
|
+
})
|
|
2039
|
+
})
|
|
2040
|
+
});
|
|
2041
|
+
})
|
|
2042
|
+
})
|
|
2043
|
+
})
|
|
2044
|
+
});
|
|
2065
2045
|
}
|
|
2046
|
+
default:
|
|
2047
|
+
return mark;
|
|
2066
2048
|
}
|
|
2067
2049
|
}
|
|
2068
2050
|
}
|
|
@@ -2116,22 +2098,22 @@ function isText(node) {
|
|
|
2116
2098
|
return false;
|
|
2117
2099
|
}
|
|
2118
2100
|
function toTextDAO(node) {
|
|
2119
|
-
var
|
|
2120
|
-
const typographyMark = (
|
|
2101
|
+
var _a, _b, _c2, _d;
|
|
2102
|
+
const typographyMark = (_a = node.marks) == null ? void 0 : _a.find((mark) => mark.type === "typography");
|
|
2121
2103
|
return [
|
|
2122
2104
|
{
|
|
2123
2105
|
text: (_b = node.text) != null ? _b : "",
|
|
2124
|
-
typography: (_d = (
|
|
2106
|
+
typography: (_d = (_c2 = typographyMark == null ? void 0 : typographyMark.data) == null ? void 0 : _c2.value) != null ? _d : void 0
|
|
2125
2107
|
}
|
|
2126
2108
|
];
|
|
2127
2109
|
}
|
|
2128
2110
|
function toInlineDAO(node) {
|
|
2129
|
-
var
|
|
2111
|
+
var _a, _b, _c2, _d;
|
|
2130
2112
|
switch (node.type) {
|
|
2131
2113
|
case InlineType.Link:
|
|
2132
2114
|
return [
|
|
2133
2115
|
{
|
|
2134
|
-
children: (_b = (
|
|
2116
|
+
children: (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(toInlineOrTextDAO)) != null ? _b : [],
|
|
2135
2117
|
[node.type]: node.data,
|
|
2136
2118
|
type: node.type
|
|
2137
2119
|
}
|
|
@@ -2141,7 +2123,7 @@ function toInlineDAO(node) {
|
|
|
2141
2123
|
case InlineType.SuperScript:
|
|
2142
2124
|
return [
|
|
2143
2125
|
{
|
|
2144
|
-
children: (_d = (
|
|
2126
|
+
children: (_d = (_c2 = node.nodes) == null ? void 0 : _c2.flatMap(toInlineOrTextDAO)) != null ? _d : [],
|
|
2145
2127
|
type: node.type
|
|
2146
2128
|
}
|
|
2147
2129
|
];
|
|
@@ -2177,8 +2159,8 @@ function toNodeDAO(node) {
|
|
|
2177
2159
|
}
|
|
2178
2160
|
}
|
|
2179
2161
|
function richTextDTOtoSelection(data) {
|
|
2180
|
-
var
|
|
2181
|
-
if (((_b = (
|
|
2162
|
+
var _a, _b, _c2, _d;
|
|
2163
|
+
if (((_b = (_a = data.selection) == null ? void 0 : _a.anchor) == null ? void 0 : _b.offset) != null && data.selection.anchor.path != null && ((_d = (_c2 = data.selection) == null ? void 0 : _c2.focus) == null ? void 0 : _d.offset) != null && data.selection.focus.path != null)
|
|
2182
2164
|
return {
|
|
2183
2165
|
anchor: {
|
|
2184
2166
|
offset: data.selection.anchor.offset,
|
|
@@ -2192,11 +2174,11 @@ function richTextDTOtoSelection(data) {
|
|
|
2192
2174
|
return null;
|
|
2193
2175
|
}
|
|
2194
2176
|
function richTextDTOtoDAO(data) {
|
|
2195
|
-
var
|
|
2196
|
-
return (
|
|
2177
|
+
var _a, _b, _c2;
|
|
2178
|
+
return (_c2 = (_b = (_a = data.document) == null ? void 0 : _a.nodes) == null ? void 0 : _b.flatMap(toNodeDAO)) != null ? _c2 : [];
|
|
2197
2179
|
}
|
|
2198
2180
|
function toInlineOrTextDTO(node) {
|
|
2199
|
-
var
|
|
2181
|
+
var _a;
|
|
2200
2182
|
if (isText(node)) {
|
|
2201
2183
|
return [
|
|
2202
2184
|
{
|
|
@@ -2221,7 +2203,7 @@ function toInlineOrTextDTO(node) {
|
|
|
2221
2203
|
object: ObjectType.Inline,
|
|
2222
2204
|
nodes: node.children.flatMap(toInlineOrTextDTO),
|
|
2223
2205
|
type: node.type,
|
|
2224
|
-
data: (
|
|
2206
|
+
data: (_a = node.link) != null ? _a : void 0
|
|
2225
2207
|
}
|
|
2226
2208
|
];
|
|
2227
2209
|
case InlineType.Code:
|
|
@@ -2238,7 +2220,7 @@ function toInlineOrTextDTO(node) {
|
|
|
2238
2220
|
}
|
|
2239
2221
|
}
|
|
2240
2222
|
function toNodeDTO(node) {
|
|
2241
|
-
var
|
|
2223
|
+
var _a, _b;
|
|
2242
2224
|
if (isText(node))
|
|
2243
2225
|
return toInlineOrTextDTO(node);
|
|
2244
2226
|
switch (node.type) {
|
|
@@ -2267,7 +2249,7 @@ function toNodeDTO(node) {
|
|
|
2267
2249
|
textAlign: node.textAlign
|
|
2268
2250
|
} : {},
|
|
2269
2251
|
object: "block",
|
|
2270
|
-
nodes: (_b = (
|
|
2252
|
+
nodes: (_b = (_a = node.children) == null ? void 0 : _a.flatMap(toNodeDTO)) != null ? _b : []
|
|
2271
2253
|
}
|
|
2272
2254
|
];
|
|
2273
2255
|
default:
|
|
@@ -2373,17 +2355,6 @@ class RichTextControl extends PropController {
|
|
|
2373
2355
|
this.send({ type: RichTextControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
|
|
2374
2356
|
}
|
|
2375
2357
|
}
|
|
2376
|
-
function richTextV2DataToDescendents(data) {
|
|
2377
|
-
return data.descendants;
|
|
2378
|
-
}
|
|
2379
|
-
function richTextV2DescendentsToData(descendants, key) {
|
|
2380
|
-
return {
|
|
2381
|
-
type: RichTextV2ControlType,
|
|
2382
|
-
version: 2,
|
|
2383
|
-
descendants,
|
|
2384
|
-
key
|
|
2385
|
-
};
|
|
2386
|
-
}
|
|
2387
2358
|
function createRichTextV2Plugin({
|
|
2388
2359
|
control,
|
|
2389
2360
|
withPlugin,
|
|
@@ -2530,9 +2501,9 @@ function getBlocksInSelection(editor) {
|
|
|
2530
2501
|
})).filter((entry) => ElementUtils.isRootBlock(entry[0]));
|
|
2531
2502
|
}
|
|
2532
2503
|
function getActiveBlockType(editor) {
|
|
2533
|
-
var
|
|
2504
|
+
var _a;
|
|
2534
2505
|
const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type);
|
|
2535
|
-
return rootBlocks.reduce((a, b) => a === b ? b : null, (
|
|
2506
|
+
return rootBlocks.reduce((a, b) => a === b ? b : null, (_a = rootBlocks.at(0)) != null ? _a : null);
|
|
2536
2507
|
}
|
|
2537
2508
|
function unwrapInline(editor, type) {
|
|
2538
2509
|
slate.Transforms.unwrapNodes(editor, {
|
|
@@ -2558,13 +2529,13 @@ function getLinksAndTextInSelection(editor) {
|
|
|
2558
2529
|
}));
|
|
2559
2530
|
}
|
|
2560
2531
|
const getValue$3 = (editor) => {
|
|
2561
|
-
var
|
|
2532
|
+
var _a;
|
|
2562
2533
|
const roots = filterForSubtreeRoots(getLinksAndTextInSelection(editor));
|
|
2563
2534
|
const areAllRootsLinks = roots.every(([root]) => isLinkElement(root) || slate.Text.isText(root));
|
|
2564
2535
|
if (!areAllRootsLinks)
|
|
2565
2536
|
return void 0;
|
|
2566
2537
|
const matchingValues = roots.map(([node]) => node).filter(isLinkElement);
|
|
2567
|
-
const match = matchingValues.reduce((a, b) => deepEqual(a == null ? void 0 : a.link, b == null ? void 0 : b.link) ? b : null, (
|
|
2538
|
+
const match = matchingValues.reduce((a, b) => deepEqual(a == null ? void 0 : a.link, b == null ? void 0 : b.link) ? b : null, (_a = matchingValues.at(0)) != null ? _a : void 0);
|
|
2568
2539
|
return match == null ? match : match.link;
|
|
2569
2540
|
};
|
|
2570
2541
|
const onChange$1 = (editor, value) => {
|
|
@@ -2595,6 +2566,19 @@ function LinkPlugin() {
|
|
|
2595
2566
|
}
|
|
2596
2567
|
});
|
|
2597
2568
|
}
|
|
2569
|
+
const unstable_IconRadioGroupIcon = {
|
|
2570
|
+
TextAlignCenter: "TextAlignCenter",
|
|
2571
|
+
TextAlignJustify: "TextAlignJustify",
|
|
2572
|
+
TextAlignLeft: "TextAlignLeft",
|
|
2573
|
+
TextAlignRight: "TextAlignRight",
|
|
2574
|
+
Superscript: "Superscript16",
|
|
2575
|
+
Subscript: "Subscript16",
|
|
2576
|
+
Code: "Code16"
|
|
2577
|
+
};
|
|
2578
|
+
const IconRadioGroupControlType = "makeswift::controls::icon-radio-group";
|
|
2579
|
+
function unstable_IconRadioGroup(config) {
|
|
2580
|
+
return { type: IconRadioGroupControlType, config };
|
|
2581
|
+
}
|
|
2598
2582
|
const supportedInlineOptions = [
|
|
2599
2583
|
{
|
|
2600
2584
|
icon: unstable_IconRadioGroupIcon.Superscript,
|
|
@@ -2626,13 +2610,13 @@ function getSupportedInlinesAndTextInSelection(editor) {
|
|
|
2626
2610
|
}));
|
|
2627
2611
|
}
|
|
2628
2612
|
const getValue$2 = (editor) => {
|
|
2629
|
-
var
|
|
2613
|
+
var _a;
|
|
2630
2614
|
const roots = filterForSubtreeRoots(getSupportedInlinesAndTextInSelection(editor));
|
|
2631
2615
|
const areAllRootsSupportedInlineTypesOrText = roots.every((entry) => isSupportedInlineEntry(entry) || slate.Text.isText(entry[0]));
|
|
2632
2616
|
if (!areAllRootsSupportedInlineTypesOrText)
|
|
2633
2617
|
return void 0;
|
|
2634
2618
|
const matchingValues = roots.filter(isSupportedInlineEntry).map(([node]) => node);
|
|
2635
|
-
const match = matchingValues.reduce((a, b) => (a == null ? void 0 : a.type) === (b == null ? void 0 : b.type) ? b : null, (
|
|
2619
|
+
const match = matchingValues.reduce((a, b) => (a == null ? void 0 : a.type) === (b == null ? void 0 : b.type) ? b : null, (_a = matchingValues.at(0)) != null ? _a : void 0);
|
|
2636
2620
|
return match == null ? match : match.type;
|
|
2637
2621
|
};
|
|
2638
2622
|
const onChange = (editor, value) => {
|
|
@@ -2688,10 +2672,10 @@ function InlinePlugin() {
|
|
|
2688
2672
|
}
|
|
2689
2673
|
});
|
|
2690
2674
|
}
|
|
2691
|
-
function InlinePluginComponent(
|
|
2692
|
-
var
|
|
2675
|
+
function InlinePluginComponent(_a) {
|
|
2676
|
+
var _b = _a, {
|
|
2693
2677
|
renderElement
|
|
2694
|
-
} =
|
|
2678
|
+
} = _b, props = __objRest(_b, [
|
|
2695
2679
|
"renderElement"
|
|
2696
2680
|
]);
|
|
2697
2681
|
switch (props.element.type) {
|
|
@@ -2851,8 +2835,8 @@ function TextAlignPlugin() {
|
|
|
2851
2835
|
});
|
|
2852
2836
|
}
|
|
2853
2837
|
function setBlockKeyForDevice(editor, breakpoints, deviceId, key, value, options) {
|
|
2854
|
-
var
|
|
2855
|
-
const at = (
|
|
2838
|
+
var _a, _b;
|
|
2839
|
+
const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
|
|
2856
2840
|
if (!at)
|
|
2857
2841
|
return;
|
|
2858
2842
|
const rootElements = getBlocksInSelection(editor);
|
|
@@ -2871,17 +2855,21 @@ function setBlockKeyForDevice(editor, breakpoints, deviceId, key, value, options
|
|
|
2871
2855
|
}
|
|
2872
2856
|
}
|
|
2873
2857
|
function clearBlockKeyForDevice(editor, deviceId, key) {
|
|
2874
|
-
var
|
|
2858
|
+
var _a;
|
|
2875
2859
|
const rootElements = getBlocksInSelection(editor);
|
|
2876
2860
|
for (const [node, path] of rootElements) {
|
|
2877
2861
|
if (ElementUtils.isBlock(node)) {
|
|
2878
|
-
const deviceOverrides = (
|
|
2862
|
+
const deviceOverrides = (_a = node[key]) != null ? _a : [];
|
|
2879
2863
|
slate.Transforms.setNodes(editor, {
|
|
2880
2864
|
[key]: deviceOverrides.filter((v) => v.deviceId !== deviceId)
|
|
2881
2865
|
}, { at: path });
|
|
2882
2866
|
}
|
|
2883
2867
|
}
|
|
2884
2868
|
}
|
|
2869
|
+
const SelectControlType = "makeswift::controls::select";
|
|
2870
|
+
function Select(config) {
|
|
2871
|
+
return { type: SelectControlType, config };
|
|
2872
|
+
}
|
|
2885
2873
|
const EditorUtils = {
|
|
2886
2874
|
getFirstAncestorList(editor, path) {
|
|
2887
2875
|
try {
|
|
@@ -2931,8 +2919,8 @@ function unwrapPath(editor, listItemPath) {
|
|
|
2931
2919
|
});
|
|
2932
2920
|
}
|
|
2933
2921
|
function unwrapList(editor, options) {
|
|
2934
|
-
var
|
|
2935
|
-
const at = (
|
|
2922
|
+
var _a;
|
|
2923
|
+
const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
|
|
2936
2924
|
if (!at)
|
|
2937
2925
|
return;
|
|
2938
2926
|
const listItems = Array.from(slate.Editor.nodes(editor, {
|
|
@@ -2951,8 +2939,8 @@ function unwrapList(editor, options) {
|
|
|
2951
2939
|
});
|
|
2952
2940
|
}
|
|
2953
2941
|
function wrapList(editor, options = { type: BlockType.UnorderedList }) {
|
|
2954
|
-
var
|
|
2955
|
-
const at = (
|
|
2942
|
+
var _a;
|
|
2943
|
+
const at = (_a = options.at) != null ? _a : editor.selection;
|
|
2956
2944
|
if (!at)
|
|
2957
2945
|
return;
|
|
2958
2946
|
const nonListEntries = Array.from(slate.Editor.nodes(editor, {
|
|
@@ -2991,7 +2979,7 @@ const LocationUtils = {
|
|
|
2991
2979
|
}
|
|
2992
2980
|
};
|
|
2993
2981
|
function getSelectedListItems(editor) {
|
|
2994
|
-
var
|
|
2982
|
+
var _a, _b;
|
|
2995
2983
|
if (!editor.selection)
|
|
2996
2984
|
return [];
|
|
2997
2985
|
const start = LocationUtils.getStartPath(editor.selection);
|
|
@@ -2999,7 +2987,7 @@ function getSelectedListItems(editor) {
|
|
|
2999
2987
|
at: editor.selection,
|
|
3000
2988
|
match: (node) => ElementUtils.isListItem(node)
|
|
3001
2989
|
});
|
|
3002
|
-
const firstAncestorPath = (_b = (
|
|
2990
|
+
const firstAncestorPath = (_b = (_a = EditorUtils.getFirstAncestorListItem(editor, start)) == null ? void 0 : _a[1]) != null ? _b : [];
|
|
3003
2991
|
return Array.from(listItems).filter((node) => slate.Path.isDescendant(start, node[1]) ? slate.Path.equals(node[1], firstAncestorPath) : !slate.Path.isAfter(start, node[1]));
|
|
3004
2992
|
}
|
|
3005
2993
|
function indentPath(editor, path) {
|
|
@@ -3076,8 +3064,8 @@ function dedent(editor) {
|
|
|
3076
3064
|
});
|
|
3077
3065
|
}
|
|
3078
3066
|
function toggleList(editor, options = { type: BlockType.UnorderedList }) {
|
|
3079
|
-
var
|
|
3080
|
-
const at = (
|
|
3067
|
+
var _a;
|
|
3068
|
+
const at = (_a = options.at) != null ? _a : editor.selection;
|
|
3081
3069
|
if (at == null)
|
|
3082
3070
|
return;
|
|
3083
3071
|
const start = LocationUtils.getStartPath(at);
|
|
@@ -3094,6 +3082,19 @@ function toggleList(editor, options = { type: BlockType.UnorderedList }) {
|
|
|
3094
3082
|
slate.Transforms.setNodes(editor, { type: options.type }, { at: ancestorPath });
|
|
3095
3083
|
}
|
|
3096
3084
|
}
|
|
3085
|
+
const isServer = typeof window === "undefined";
|
|
3086
|
+
const useInsertionEffectSpecifier = "useInsertionEffect";
|
|
3087
|
+
const useInsertionEffect = (_c = React__default["default"][useInsertionEffectSpecifier]) != null ? _c : React__default["default"].useLayoutEffect;
|
|
3088
|
+
function useStyle(style) {
|
|
3089
|
+
const serialized = serialize.serializeStyles([style], css.cache.registered);
|
|
3090
|
+
utils.registerStyles(css.cache, serialized, false);
|
|
3091
|
+
useInsertionEffect(() => {
|
|
3092
|
+
utils.insertStyles(css.cache, serialized, false);
|
|
3093
|
+
});
|
|
3094
|
+
if (isServer)
|
|
3095
|
+
utils.insertStyles(css.cache, serialized, false);
|
|
3096
|
+
return `${css.cache.key}-${serialized.name}`;
|
|
3097
|
+
}
|
|
3097
3098
|
const BlockActions = {
|
|
3098
3099
|
setBlockKeyForDevice,
|
|
3099
3100
|
clearBlockKeyForDevice,
|
|
@@ -3175,9 +3176,9 @@ function withBlock(editor) {
|
|
|
3175
3176
|
return ElementUtils.isInline(entry);
|
|
3176
3177
|
};
|
|
3177
3178
|
editor.normalizeNode = (entry) => {
|
|
3178
|
-
var
|
|
3179
|
+
var _a;
|
|
3179
3180
|
const [normalizationNode, normalizationPath] = entry;
|
|
3180
|
-
if (ElementUtils.isBlock(normalizationNode) && ((
|
|
3181
|
+
if (ElementUtils.isBlock(normalizationNode) && ((_a = normalizationNode == null ? void 0 : normalizationNode.textAlign) == null ? void 0 : _a.length) == 0) {
|
|
3181
3182
|
slate.Transforms.unsetNodes(editor, "textAlign", {
|
|
3182
3183
|
at: normalizationPath
|
|
3183
3184
|
});
|
|
@@ -3418,8 +3419,8 @@ function BlockPluginComponent(_d) {
|
|
|
3418
3419
|
}
|
|
3419
3420
|
function clearActiveTypographyStyle(editor, options) {
|
|
3420
3421
|
slate.Editor.withoutNormalizing(editor, () => {
|
|
3421
|
-
var
|
|
3422
|
-
const at = (
|
|
3422
|
+
var _a;
|
|
3423
|
+
const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
|
|
3423
3424
|
if (!at)
|
|
3424
3425
|
return;
|
|
3425
3426
|
const atRef = slate.Editor.rangeRef(editor, at);
|
|
@@ -3453,8 +3454,8 @@ function clearActiveTypographyStyle(editor, options) {
|
|
|
3453
3454
|
}
|
|
3454
3455
|
function clearDeviceActiveTypography(editor, currentDeviceId, options) {
|
|
3455
3456
|
slate.Editor.withoutNormalizing(editor, () => {
|
|
3456
|
-
var
|
|
3457
|
-
const at = (
|
|
3457
|
+
var _a, _b, _c2;
|
|
3458
|
+
const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
|
|
3458
3459
|
if (!at)
|
|
3459
3460
|
return;
|
|
3460
3461
|
const atRef = slate.Editor.rangeRef(editor, at);
|
|
@@ -3475,7 +3476,7 @@ function clearDeviceActiveTypography(editor, currentDeviceId, options) {
|
|
|
3475
3476
|
for (const [node, path] of textNodes) {
|
|
3476
3477
|
if (slate.Text.isText(node)) {
|
|
3477
3478
|
const typography = __spreadProps(__spreadValues({}, node.typography), {
|
|
3478
|
-
style: (
|
|
3479
|
+
style: (_c2 = (_b = node == null ? void 0 : node.typography) == null ? void 0 : _b.style.filter(({ deviceId }) => deviceId !== currentDeviceId)) != null ? _c2 : []
|
|
3479
3480
|
});
|
|
3480
3481
|
slate.Transforms.setNodes(editor, {
|
|
3481
3482
|
typography
|
|
@@ -3488,8 +3489,8 @@ function clearDeviceActiveTypography(editor, currentDeviceId, options) {
|
|
|
3488
3489
|
}
|
|
3489
3490
|
function detachActiveTypography(editor, value, options) {
|
|
3490
3491
|
slate.Editor.withoutNormalizing(editor, () => {
|
|
3491
|
-
var
|
|
3492
|
-
const at = (
|
|
3492
|
+
var _a;
|
|
3493
|
+
const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
|
|
3493
3494
|
if (!at)
|
|
3494
3495
|
return;
|
|
3495
3496
|
const atRef = slate.Editor.rangeRef(editor, at);
|
|
@@ -3521,8 +3522,8 @@ function detachActiveTypography(editor, value, options) {
|
|
|
3521
3522
|
});
|
|
3522
3523
|
}
|
|
3523
3524
|
function setActiveTypographyId(editor, id, options) {
|
|
3524
|
-
var
|
|
3525
|
-
const at = (
|
|
3525
|
+
var _a;
|
|
3526
|
+
const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
|
|
3526
3527
|
if (!at)
|
|
3527
3528
|
return;
|
|
3528
3529
|
slate.Transforms.setNodes(editor, {
|
|
@@ -3538,8 +3539,8 @@ function setActiveTypographyId(editor, id, options) {
|
|
|
3538
3539
|
}
|
|
3539
3540
|
function setActiveTypographyStyle(editor, breakpoints, deviceId, prop, value, options) {
|
|
3540
3541
|
slate.Editor.withoutNormalizing(editor, () => {
|
|
3541
|
-
var
|
|
3542
|
-
const at = (
|
|
3542
|
+
var _a, _b, _c2;
|
|
3543
|
+
const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
|
|
3543
3544
|
if (!at)
|
|
3544
3545
|
return;
|
|
3545
3546
|
const atRef = slate.Editor.rangeRef(editor, at);
|
|
@@ -3559,7 +3560,7 @@ function setActiveTypographyStyle(editor, breakpoints, deviceId, prop, value, op
|
|
|
3559
3560
|
}));
|
|
3560
3561
|
for (const [node, path] of textNodes) {
|
|
3561
3562
|
if (slate.Text.isText(node)) {
|
|
3562
|
-
const deviceOverrides = (
|
|
3563
|
+
const deviceOverrides = (_c2 = (_b = node == null ? void 0 : node.typography) == null ? void 0 : _b.style) != null ? _c2 : [];
|
|
3563
3564
|
const deviceStyle = state_breakpoints.findBreakpointOverride(breakpoints, deviceOverrides, deviceId, (v) => v) || {
|
|
3564
3565
|
value: {}
|
|
3565
3566
|
};
|
|
@@ -3597,9 +3598,9 @@ const TYPOGRAPHY_KEY = "typography";
|
|
|
3597
3598
|
function withTypography(editor) {
|
|
3598
3599
|
const { normalizeNode } = editor;
|
|
3599
3600
|
editor.normalizeNode = (entry) => {
|
|
3600
|
-
var
|
|
3601
|
+
var _a, _b;
|
|
3601
3602
|
const [normalizationNode, normalizationPath] = entry;
|
|
3602
|
-
if (slate.Text.isText(normalizationNode) && ((
|
|
3603
|
+
if (slate.Text.isText(normalizationNode) && ((_a = normalizationNode == null ? void 0 : normalizationNode.typography) == null ? void 0 : _a.id) == null && ((_b = normalizationNode == null ? void 0 : normalizationNode.typography) == null ? void 0 : _b.style.length) === 0) {
|
|
3603
3604
|
slate.Transforms.unsetNodes(editor, TYPOGRAPHY_KEY, { at: normalizationPath });
|
|
3604
3605
|
return;
|
|
3605
3606
|
}
|
|
@@ -3706,13 +3707,31 @@ function InlineModePlugin() {
|
|
|
3706
3707
|
}))
|
|
3707
3708
|
});
|
|
3708
3709
|
}
|
|
3710
|
+
const minWidth = `${"Write some text...".length}ch`;
|
|
3709
3711
|
function InlineModePluginComponent(_f) {
|
|
3710
3712
|
var _g = _f, {
|
|
3711
3713
|
renderElement
|
|
3712
3714
|
} = _g, props = __objRest(_g, [
|
|
3713
3715
|
"renderElement"
|
|
3714
3716
|
]);
|
|
3715
|
-
|
|
3717
|
+
if (props.element.children.length === 1) {
|
|
3718
|
+
const text = props.element.children[0];
|
|
3719
|
+
if (slate.Text.isText(text) && text.text === "") {
|
|
3720
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", __spreadProps(__spreadValues({
|
|
3721
|
+
style: {
|
|
3722
|
+
display: "inline-block",
|
|
3723
|
+
minWidth
|
|
3724
|
+
}
|
|
3725
|
+
}, props.attributes), {
|
|
3726
|
+
children: renderElement(props)
|
|
3727
|
+
}));
|
|
3728
|
+
}
|
|
3729
|
+
}
|
|
3730
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", __spreadProps(__spreadValues({
|
|
3731
|
+
style: {
|
|
3732
|
+
minWidth
|
|
3733
|
+
}
|
|
3734
|
+
}, props.attributes), {
|
|
3716
3735
|
children: renderElement(props)
|
|
3717
3736
|
}));
|
|
3718
3737
|
}
|
|
@@ -3726,7 +3745,7 @@ function RichText(config = {}) {
|
|
|
3726
3745
|
type: RichTextV2ControlType,
|
|
3727
3746
|
config: {
|
|
3728
3747
|
mode: config.mode,
|
|
3729
|
-
defaultValue: config == null ? void 0 : config.
|
|
3748
|
+
defaultValue: (config == null ? void 0 : config.mode) === RichTextV2Mode.Inline ? "Edit this text" : ipsum__default["default"](3),
|
|
3730
3749
|
plugins: (config == null ? void 0 : config.mode) === RichTextV2Mode.Inline ? [InlineModePlugin()] : [BlockPlugin(), TypographyPlugin(), TextAlignPlugin(), InlinePlugin(), LinkPlugin()]
|
|
3731
3750
|
}
|
|
3732
3751
|
};
|
|
@@ -3752,7 +3771,7 @@ class RichTextV2Control extends PropController {
|
|
|
3752
3771
|
__publicField(this, "defaultValue", null);
|
|
3753
3772
|
__publicField(this, "descriptor");
|
|
3754
3773
|
__publicField(this, "recv", (message) => {
|
|
3755
|
-
var
|
|
3774
|
+
var _a, _b, _c2;
|
|
3756
3775
|
if (!this.editor)
|
|
3757
3776
|
return;
|
|
3758
3777
|
switch (message.type) {
|
|
@@ -3762,15 +3781,15 @@ class RichTextV2Control extends PropController {
|
|
|
3762
3781
|
}
|
|
3763
3782
|
case RichTextV2ControlMessageType.RESET_VALUE: {
|
|
3764
3783
|
if (this.defaultValue) {
|
|
3765
|
-
this.editor.
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3784
|
+
this.editor.resetValue(this.defaultValue);
|
|
3785
|
+
setTimeout(() => {
|
|
3786
|
+
this.onLocalUserChange();
|
|
3787
|
+
});
|
|
3769
3788
|
}
|
|
3770
3789
|
break;
|
|
3771
3790
|
}
|
|
3772
3791
|
case RichTextV2ControlMessageType.RUN_PLUGIN_CONTROL_ACTION: {
|
|
3773
|
-
(
|
|
3792
|
+
(_c2 = (_b = (_a = this.descriptor.config.plugins) == null ? void 0 : _a.at(message.pluginIndex)) == null ? void 0 : _b.control) == null ? void 0 : _c2.onChange(this.editor, message.value);
|
|
3774
3793
|
break;
|
|
3775
3794
|
}
|
|
3776
3795
|
}
|
|
@@ -3779,14 +3798,14 @@ class RichTextV2Control extends PropController {
|
|
|
3779
3798
|
this.send = send;
|
|
3780
3799
|
}
|
|
3781
3800
|
setEditor(editor) {
|
|
3782
|
-
var
|
|
3801
|
+
var _a, _b, _c2;
|
|
3783
3802
|
this.editor = editor;
|
|
3784
3803
|
this.send({
|
|
3785
3804
|
type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
|
|
3786
|
-
value: (
|
|
3787
|
-
var
|
|
3788
|
-
return (
|
|
3789
|
-
})) != null ?
|
|
3805
|
+
value: (_c2 = (_b = (_a = this.descriptor.config) == null ? void 0 : _a.plugins) == null ? void 0 : _b.map((plugin) => {
|
|
3806
|
+
var _a2;
|
|
3807
|
+
return (_a2 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a2.getValue(editor);
|
|
3808
|
+
})) != null ? _c2 : []
|
|
3790
3809
|
});
|
|
3791
3810
|
const _onChange = editor.onChange;
|
|
3792
3811
|
this.editor.onChange = (options) => {
|
|
@@ -3813,16 +3832,16 @@ class RichTextV2Control extends PropController {
|
|
|
3813
3832
|
});
|
|
3814
3833
|
}
|
|
3815
3834
|
updatePluginValues() {
|
|
3816
|
-
var
|
|
3835
|
+
var _a, _b, _c2;
|
|
3817
3836
|
const editor = this.editor;
|
|
3818
3837
|
if (editor == null)
|
|
3819
3838
|
return;
|
|
3820
3839
|
this.send({
|
|
3821
3840
|
type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
|
|
3822
|
-
value: (
|
|
3823
|
-
var
|
|
3824
|
-
return (
|
|
3825
|
-
})) != null ?
|
|
3841
|
+
value: (_c2 = (_b = (_a = this.descriptor.config) == null ? void 0 : _a.plugins) == null ? void 0 : _b.map((plugin) => {
|
|
3842
|
+
var _a2;
|
|
3843
|
+
return (_a2 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a2.getValue(editor);
|
|
3844
|
+
})) != null ? _c2 : []
|
|
3826
3845
|
});
|
|
3827
3846
|
}
|
|
3828
3847
|
select() {
|
|
@@ -3844,6 +3863,171 @@ class RichTextV2Control extends PropController {
|
|
|
3844
3863
|
function isRichTextV1Data(value) {
|
|
3845
3864
|
return value !== void 0 && typeof value === "object" && !Array.isArray(value) && "document" in value;
|
|
3846
3865
|
}
|
|
3866
|
+
function richTextV2DataToDescendents(data) {
|
|
3867
|
+
return data.descendants;
|
|
3868
|
+
}
|
|
3869
|
+
function richTextV2DescendentsToData(descendants, key) {
|
|
3870
|
+
return {
|
|
3871
|
+
type: RichTextV2ControlType,
|
|
3872
|
+
version: 2,
|
|
3873
|
+
descendants,
|
|
3874
|
+
key: key != null ? key : uuid.v4()
|
|
3875
|
+
};
|
|
3876
|
+
}
|
|
3877
|
+
function copyRichTextV2Data(data, context) {
|
|
3878
|
+
var _a;
|
|
3879
|
+
if (data == null)
|
|
3880
|
+
return data;
|
|
3881
|
+
return richTextV2DescendentsToData((_a = data.descendants) == null ? void 0 : _a.flatMap((d) => copyNode(d)));
|
|
3882
|
+
function copyNode(descendant) {
|
|
3883
|
+
if (slate.Element.isElement(descendant) && ElementUtils.isInline(descendant)) {
|
|
3884
|
+
return copyLinkData2(descendant);
|
|
3885
|
+
}
|
|
3886
|
+
if (slate.Text.isText(descendant)) {
|
|
3887
|
+
return copyTypographyData(descendant);
|
|
3888
|
+
}
|
|
3889
|
+
return __spreadProps(__spreadValues({}, descendant), { children: descendant.children.map(copyNode) });
|
|
3890
|
+
}
|
|
3891
|
+
function copyLinkData2(descendant) {
|
|
3892
|
+
var _a2, _b;
|
|
3893
|
+
if (descendant.type !== "link") {
|
|
3894
|
+
return __spreadProps(__spreadValues({}, descendant), { children: descendant.children.map(copyNode) });
|
|
3895
|
+
}
|
|
3896
|
+
if (descendant.link == null)
|
|
3897
|
+
return descendant;
|
|
3898
|
+
switch (descendant.link.type) {
|
|
3899
|
+
case "OPEN_PAGE": {
|
|
3900
|
+
const pageId = descendant.link.payload.pageId;
|
|
3901
|
+
if (pageId == null)
|
|
3902
|
+
return descendant;
|
|
3903
|
+
return __spreadProps(__spreadValues({}, descendant), {
|
|
3904
|
+
link: __spreadProps(__spreadValues({}, descendant.link), {
|
|
3905
|
+
payload: __spreadProps(__spreadValues({}, descendant.link.payload), {
|
|
3906
|
+
pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : descendant.link.payload.pageId
|
|
3907
|
+
})
|
|
3908
|
+
}),
|
|
3909
|
+
children: descendant.children.map(copyNode)
|
|
3910
|
+
});
|
|
3911
|
+
}
|
|
3912
|
+
case "SCROLL_TO_ELEMENT": {
|
|
3913
|
+
const elementIdConfig = descendant.link.payload.elementIdConfig;
|
|
3914
|
+
if (elementIdConfig == null)
|
|
3915
|
+
return descendant;
|
|
3916
|
+
return __spreadProps(__spreadValues({}, descendant), {
|
|
3917
|
+
link: __spreadProps(__spreadValues({}, descendant.link), {
|
|
3918
|
+
payload: __spreadProps(__spreadValues({}, descendant.link.payload), {
|
|
3919
|
+
elementIdConfig: __spreadProps(__spreadValues({}, elementIdConfig), {
|
|
3920
|
+
elementKey: (_b = context.replacementContext.elementKeys.get(elementIdConfig.elementKey)) != null ? _b : elementIdConfig.elementKey
|
|
3921
|
+
})
|
|
3922
|
+
})
|
|
3923
|
+
}),
|
|
3924
|
+
children: descendant.children.map(copyNode)
|
|
3925
|
+
});
|
|
3926
|
+
}
|
|
3927
|
+
default:
|
|
3928
|
+
return descendant;
|
|
3929
|
+
}
|
|
3930
|
+
}
|
|
3931
|
+
function copyTypographyData(descendant) {
|
|
3932
|
+
var _a2, _b, _c2, _d, _e;
|
|
3933
|
+
return __spreadValues(__spreadValues({}, descendant), descendant.typography == null ? {} : {
|
|
3934
|
+
typography: {
|
|
3935
|
+
id: (_d = context.replacementContext.typographyIds.get((_b = (_a2 = descendant.typography) == null ? void 0 : _a2.id) != null ? _b : "")) != null ? _d : (_c2 = descendant.typography) == null ? void 0 : _c2.id,
|
|
3936
|
+
style: (_e = descendant.typography) == null ? void 0 : _e.style.map((override) => {
|
|
3937
|
+
var _a3, _b2, _c3, _d2;
|
|
3938
|
+
return __spreadProps(__spreadValues({}, override), {
|
|
3939
|
+
value: __spreadValues(__spreadValues({}, override.value), override.value.color == null ? {} : {
|
|
3940
|
+
color: __spreadProps(__spreadValues({}, override.value.color), {
|
|
3941
|
+
swatchId: (_d2 = context.replacementContext.swatchIds.get((_b2 = (_a3 = override.value.color) == null ? void 0 : _a3.swatchId) != null ? _b2 : "")) != null ? _d2 : (_c3 = override.value.color) == null ? void 0 : _c3.swatchId
|
|
3942
|
+
})
|
|
3943
|
+
})
|
|
3944
|
+
});
|
|
3945
|
+
})
|
|
3946
|
+
}
|
|
3947
|
+
});
|
|
3948
|
+
}
|
|
3949
|
+
}
|
|
3950
|
+
function copy(definition2, value, context) {
|
|
3951
|
+
switch (definition2.type) {
|
|
3952
|
+
case Types.Backgrounds:
|
|
3953
|
+
case Types.Grid:
|
|
3954
|
+
case Types.NavigationLinks:
|
|
3955
|
+
case Types.Link:
|
|
3956
|
+
case Types.Shadows:
|
|
3957
|
+
case Types.Image:
|
|
3958
|
+
case Types.Images:
|
|
3959
|
+
case Types.ResponsiveColor:
|
|
3960
|
+
case Types.TableFormFields:
|
|
3961
|
+
case Types.Table:
|
|
3962
|
+
case Types.Border:
|
|
3963
|
+
case Types.RichText:
|
|
3964
|
+
case Types.ElementID:
|
|
3965
|
+
return copy$1(definition2, value, context);
|
|
3966
|
+
case RichTextControlType:
|
|
3967
|
+
return copyRichTextData(value, context);
|
|
3968
|
+
case RichTextV2ControlType:
|
|
3969
|
+
return copyRichTextV2Data(isRichTextV1Data(value) ? richTextV2DescendentsToData(richTextDTOtoDAO(value)) : value, context);
|
|
3970
|
+
case ColorControlType:
|
|
3971
|
+
return copyColorData(value, context);
|
|
3972
|
+
case ImageControlType:
|
|
3973
|
+
return copyImageData(value, context);
|
|
3974
|
+
case LinkControlType:
|
|
3975
|
+
return copyLinkData(value, context);
|
|
3976
|
+
case ShapeControlType:
|
|
3977
|
+
return copyShapeData(definition2, value, context);
|
|
3978
|
+
case ListControlType:
|
|
3979
|
+
return copyListData(definition2, value, context);
|
|
3980
|
+
case StyleControlType:
|
|
3981
|
+
return copyStyleData(value, context);
|
|
3982
|
+
case SlotControlType:
|
|
3983
|
+
return copySlotData(value, context);
|
|
3984
|
+
default:
|
|
3985
|
+
return value;
|
|
3986
|
+
}
|
|
3987
|
+
}
|
|
3988
|
+
function merge(definition2, a, b = a, context) {
|
|
3989
|
+
switch (definition2.type) {
|
|
3990
|
+
case SlotControlType:
|
|
3991
|
+
return mergeSlotData(a, b, context);
|
|
3992
|
+
default:
|
|
3993
|
+
return b;
|
|
3994
|
+
}
|
|
3995
|
+
}
|
|
3996
|
+
const StyleV2ControlType = "makeswift::controls::style-v2";
|
|
3997
|
+
const unstable_useStyleV2ClassName = useStyle;
|
|
3998
|
+
function unstable_StyleV2(config) {
|
|
3999
|
+
return { type: StyleV2ControlType, config };
|
|
4000
|
+
}
|
|
4001
|
+
const StyleV2ControlMessageType = {
|
|
4002
|
+
CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model",
|
|
4003
|
+
STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE: "makeswift::controls::style-v2::message::child-control-message"
|
|
4004
|
+
};
|
|
4005
|
+
class StyleV2Control extends PropController {
|
|
4006
|
+
constructor(send, descriptor) {
|
|
4007
|
+
super(send);
|
|
4008
|
+
__publicField(this, "control");
|
|
4009
|
+
this.control = createPropController(descriptor.config.type, (message) => {
|
|
4010
|
+
this.send({
|
|
4011
|
+
type: StyleV2ControlMessageType.STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE,
|
|
4012
|
+
payload: { message }
|
|
4013
|
+
});
|
|
4014
|
+
});
|
|
4015
|
+
}
|
|
4016
|
+
changeBoxModel(boxModel) {
|
|
4017
|
+
this.send({ type: StyleV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
|
|
4018
|
+
}
|
|
4019
|
+
recv(message) {
|
|
4020
|
+
switch (message.type) {
|
|
4021
|
+
case StyleV2ControlMessageType.STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE: {
|
|
4022
|
+
const control = this.control;
|
|
4023
|
+
if (control == null)
|
|
4024
|
+
return;
|
|
4025
|
+
const recv = control.recv;
|
|
4026
|
+
recv(message.payload.message);
|
|
4027
|
+
}
|
|
4028
|
+
}
|
|
4029
|
+
}
|
|
4030
|
+
}
|
|
3847
4031
|
const TypographyControlType = "makeswift::controls::typography";
|
|
3848
4032
|
function unstable_Typography() {
|
|
3849
4033
|
return {
|
|
@@ -3851,11 +4035,11 @@ function unstable_Typography() {
|
|
|
3851
4035
|
};
|
|
3852
4036
|
}
|
|
3853
4037
|
function getTypographySwatchIds(value) {
|
|
3854
|
-
var
|
|
3855
|
-
return (
|
|
3856
|
-
var
|
|
3857
|
-
return (_b = (
|
|
3858
|
-
}).filter(isNonNullable)) != null ?
|
|
4038
|
+
var _a;
|
|
4039
|
+
return (_a = value == null ? void 0 : value.style.flatMap((style) => {
|
|
4040
|
+
var _a2, _b;
|
|
4041
|
+
return (_b = (_a2 = style.value.color) == null ? void 0 : _a2.swatchId) != null ? _b : [];
|
|
4042
|
+
}).filter(isNonNullable)) != null ? _a : [];
|
|
3859
4043
|
}
|
|
3860
4044
|
function getTypographyTypographyIds(value) {
|
|
3861
4045
|
return [value == null ? void 0 : value.id].filter(isNonNullable);
|
|
@@ -3865,28 +4049,28 @@ function getRichTextSwatchIds(value) {
|
|
|
3865
4049
|
return [];
|
|
3866
4050
|
return getNodeSwatchIds(value.document);
|
|
3867
4051
|
function getNodeSwatchIds(node) {
|
|
3868
|
-
var
|
|
4052
|
+
var _a, _b, _c2, _d;
|
|
3869
4053
|
switch (node.object) {
|
|
3870
4054
|
case "document":
|
|
3871
4055
|
case "block":
|
|
3872
4056
|
case "inline":
|
|
3873
|
-
return (_b = (
|
|
4057
|
+
return (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(getNodeSwatchIds)) != null ? _b : [];
|
|
3874
4058
|
case "text":
|
|
3875
|
-
return (_d = (
|
|
4059
|
+
return (_d = (_c2 = node.marks) == null ? void 0 : _c2.flatMap(getMarkSwatchIds)) != null ? _d : [];
|
|
3876
4060
|
default:
|
|
3877
4061
|
return [];
|
|
3878
4062
|
}
|
|
3879
4063
|
}
|
|
3880
4064
|
function getTypographyStyleSwatchIds(style) {
|
|
3881
|
-
var
|
|
3882
|
-
return (
|
|
3883
|
-
var
|
|
3884
|
-
return (
|
|
3885
|
-
}).filter(isNonNullable)) != null ?
|
|
4065
|
+
var _a;
|
|
4066
|
+
return (_a = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
|
|
4067
|
+
var _a2;
|
|
4068
|
+
return (_a2 = typographyStyle.color) == null ? void 0 : _a2.swatchId;
|
|
4069
|
+
}).filter(isNonNullable)) != null ? _a : [];
|
|
3886
4070
|
}
|
|
3887
4071
|
function getMarkSwatchIds(mark) {
|
|
3888
|
-
var
|
|
3889
|
-
return getTypographyStyleSwatchIds((_b = (
|
|
4072
|
+
var _a, _b;
|
|
4073
|
+
return getTypographyStyleSwatchIds((_b = (_a = mark.data) == null ? void 0 : _a.value) == null ? void 0 : _b.style);
|
|
3890
4074
|
}
|
|
3891
4075
|
}
|
|
3892
4076
|
function getRichTextTypographyIds(value) {
|
|
@@ -3894,21 +4078,21 @@ function getRichTextTypographyIds(value) {
|
|
|
3894
4078
|
return [];
|
|
3895
4079
|
return getNodeSwatchIds(value.document);
|
|
3896
4080
|
function getNodeSwatchIds(node) {
|
|
3897
|
-
var
|
|
4081
|
+
var _a, _b, _c2, _d;
|
|
3898
4082
|
switch (node.object) {
|
|
3899
4083
|
case "document":
|
|
3900
4084
|
case "block":
|
|
3901
4085
|
case "inline":
|
|
3902
|
-
return (_b = (
|
|
4086
|
+
return (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(getNodeSwatchIds)) != null ? _b : [];
|
|
3903
4087
|
case "text":
|
|
3904
|
-
return (_d = (
|
|
4088
|
+
return (_d = (_c2 = node.marks) == null ? void 0 : _c2.flatMap(getMarkSwatchIds)) != null ? _d : [];
|
|
3905
4089
|
default:
|
|
3906
4090
|
return [];
|
|
3907
4091
|
}
|
|
3908
4092
|
}
|
|
3909
4093
|
function getMarkSwatchIds(mark) {
|
|
3910
|
-
var
|
|
3911
|
-
return [(_b = (
|
|
4094
|
+
var _a, _b;
|
|
4095
|
+
return [(_b = (_a = mark.data) == null ? void 0 : _a.value) == null ? void 0 : _b.id].filter(isNonNullable);
|
|
3912
4096
|
}
|
|
3913
4097
|
}
|
|
3914
4098
|
function getRichTextPageIds(value) {
|
|
@@ -3916,11 +4100,11 @@ function getRichTextPageIds(value) {
|
|
|
3916
4100
|
return [];
|
|
3917
4101
|
return getNodePageIds(value.document);
|
|
3918
4102
|
function getNodePageIds(node) {
|
|
3919
|
-
var
|
|
4103
|
+
var _a, _b;
|
|
3920
4104
|
switch (node.object) {
|
|
3921
4105
|
case "document":
|
|
3922
4106
|
case "block":
|
|
3923
|
-
return (_b = (
|
|
4107
|
+
return (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(getNodePageIds)) != null ? _b : [];
|
|
3924
4108
|
case "inline":
|
|
3925
4109
|
return getInlinePageIds(node);
|
|
3926
4110
|
default:
|
|
@@ -3928,15 +4112,15 @@ function getRichTextPageIds(value) {
|
|
|
3928
4112
|
}
|
|
3929
4113
|
}
|
|
3930
4114
|
function getInlinePageIds(inline) {
|
|
3931
|
-
var
|
|
4115
|
+
var _a, _b, _c2, _d;
|
|
3932
4116
|
switch (inline.type) {
|
|
3933
4117
|
case "link": {
|
|
3934
|
-
const nodePageIds = (_b = (
|
|
4118
|
+
const nodePageIds = (_b = (_a = inline.nodes) == null ? void 0 : _a.flatMap(getNodePageIds)) != null ? _b : [];
|
|
3935
4119
|
const dataPageIds = inline.data ? getLinkDataPageIds(inline.data) : [];
|
|
3936
4120
|
return [...nodePageIds, ...dataPageIds];
|
|
3937
4121
|
}
|
|
3938
4122
|
default:
|
|
3939
|
-
return (_d = (
|
|
4123
|
+
return (_d = (_c2 = inline.nodes) == null ? void 0 : _c2.flatMap(getNodePageIds)) != null ? _d : [];
|
|
3940
4124
|
}
|
|
3941
4125
|
}
|
|
3942
4126
|
function getLinkDataPageIds(link) {
|
|
@@ -3964,18 +4148,18 @@ function introspectRichTextV2Data(definition2, data, func) {
|
|
|
3964
4148
|
return [];
|
|
3965
4149
|
}
|
|
3966
4150
|
function getElementTypographyIds(descendant) {
|
|
3967
|
-
var
|
|
3968
|
-
return (
|
|
3969
|
-
var
|
|
3970
|
-
return ((
|
|
3971
|
-
})) != null ?
|
|
4151
|
+
var _a;
|
|
4152
|
+
return (_a = plugins == null ? void 0 : plugins.flatMap((plugin) => {
|
|
4153
|
+
var _a2;
|
|
4154
|
+
return ((_a2 = plugin.control) == null ? void 0 : _a2.definition) && plugin.control.getElementValue ? func(plugin.control.definition, plugin.control.getElementValue(descendant)) : [];
|
|
4155
|
+
})) != null ? _a : [];
|
|
3972
4156
|
}
|
|
3973
4157
|
function getTextTypographyIds(text) {
|
|
3974
|
-
var
|
|
3975
|
-
return (
|
|
3976
|
-
var
|
|
3977
|
-
return ((
|
|
3978
|
-
})) != null ?
|
|
4158
|
+
var _a;
|
|
4159
|
+
return (_a = plugins == null ? void 0 : plugins.flatMap((plugin) => {
|
|
4160
|
+
var _a2;
|
|
4161
|
+
return ((_a2 = plugin.control) == null ? void 0 : _a2.definition) && plugin.control.getLeafValue ? func(plugin.control.definition, plugin.control.getLeafValue(text)) : [];
|
|
4162
|
+
})) != null ? _a : [];
|
|
3979
4163
|
}
|
|
3980
4164
|
}
|
|
3981
4165
|
function getRichTextV2SwatchIds(definition2, data) {
|
|
@@ -4024,44 +4208,44 @@ function getElementId$1(descriptor, prop) {
|
|
|
4024
4208
|
}
|
|
4025
4209
|
}
|
|
4026
4210
|
function getBackgroundsSwatchIds(value) {
|
|
4027
|
-
var
|
|
4028
|
-
return (
|
|
4029
|
-
var
|
|
4211
|
+
var _a;
|
|
4212
|
+
return (_a = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
|
|
4213
|
+
var _a2;
|
|
4030
4214
|
switch (backgroundItem.type) {
|
|
4031
4215
|
case "color":
|
|
4032
|
-
return ((
|
|
4216
|
+
return ((_a2 = backgroundItem.payload) == null ? void 0 : _a2.swatchId) == null ? [] : [backgroundItem.payload.swatchId];
|
|
4033
4217
|
case "gradient":
|
|
4034
4218
|
return backgroundItem.payload.stops.flatMap((stop) => stop.color == null ? [] : stop.color.swatchId);
|
|
4035
4219
|
default:
|
|
4036
4220
|
return [];
|
|
4037
4221
|
}
|
|
4038
|
-
})) != null ?
|
|
4222
|
+
})) != null ? _a : [];
|
|
4039
4223
|
}
|
|
4040
4224
|
function getBorderSwatchIds(value) {
|
|
4041
|
-
var
|
|
4042
|
-
return (
|
|
4043
|
-
var
|
|
4225
|
+
var _a;
|
|
4226
|
+
return (_a = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((borderValue) => {
|
|
4227
|
+
var _a2, _b, _c2, _d, _e, _f, _g, _h;
|
|
4044
4228
|
return [
|
|
4045
|
-
(_b = (
|
|
4046
|
-
(_d = (
|
|
4229
|
+
(_b = (_a2 = borderValue.borderTop) == null ? void 0 : _a2.color) == null ? void 0 : _b.swatchId,
|
|
4230
|
+
(_d = (_c2 = borderValue.borderRight) == null ? void 0 : _c2.color) == null ? void 0 : _d.swatchId,
|
|
4047
4231
|
(_f = (_e = borderValue.borderBottom) == null ? void 0 : _e.color) == null ? void 0 : _f.swatchId,
|
|
4048
4232
|
(_h = (_g = borderValue.borderLeft) == null ? void 0 : _g.color) == null ? void 0 : _h.swatchId
|
|
4049
4233
|
].filter((swatchId) => swatchId != null);
|
|
4050
|
-
})) != null ?
|
|
4234
|
+
})) != null ? _a : [];
|
|
4051
4235
|
}
|
|
4052
4236
|
function getBoxShadowsSwatchIds(value) {
|
|
4053
|
-
var
|
|
4054
|
-
return (
|
|
4055
|
-
var
|
|
4056
|
-
return (
|
|
4057
|
-
}).filter((swatchId) => swatchId != null)) != null ?
|
|
4237
|
+
var _a;
|
|
4238
|
+
return (_a = value == null ? void 0 : value.flatMap((override) => override.value).map((item) => {
|
|
4239
|
+
var _a2;
|
|
4240
|
+
return (_a2 = item.payload.color) == null ? void 0 : _a2.swatchId;
|
|
4241
|
+
}).filter((swatchId) => swatchId != null)) != null ? _a : [];
|
|
4058
4242
|
}
|
|
4059
4243
|
function getResponsiveColorSwatchIds(value) {
|
|
4060
|
-
var
|
|
4061
|
-
return (
|
|
4244
|
+
var _a;
|
|
4245
|
+
return (_a = value == null ? void 0 : value.map((override) => override.value).map((color) => color.swatchId)) != null ? _a : [];
|
|
4062
4246
|
}
|
|
4063
4247
|
function getSwatchIds(descriptor, prop) {
|
|
4064
|
-
var
|
|
4248
|
+
var _a, _b;
|
|
4065
4249
|
if (prop == null)
|
|
4066
4250
|
return [];
|
|
4067
4251
|
switch (descriptor.type) {
|
|
@@ -4071,17 +4255,17 @@ function getSwatchIds(descriptor, prop) {
|
|
|
4071
4255
|
return getBorderSwatchIds(prop);
|
|
4072
4256
|
case Types.NavigationLinks: {
|
|
4073
4257
|
const value = prop;
|
|
4074
|
-
return (
|
|
4075
|
-
var
|
|
4258
|
+
return (_a = value == null ? void 0 : value.flatMap((item) => {
|
|
4259
|
+
var _a2, _b2, _c2, _d;
|
|
4076
4260
|
switch (item.type) {
|
|
4077
4261
|
case "button":
|
|
4078
4262
|
case "dropdown":
|
|
4079
4263
|
return [
|
|
4080
|
-
...(_b2 = (
|
|
4081
|
-
...(_d = (
|
|
4264
|
+
...(_b2 = (_a2 = item.payload.color) == null ? void 0 : _a2.map((override) => override.value).map((color) => color.swatchId)) != null ? _b2 : [],
|
|
4265
|
+
...(_d = (_c2 = item.payload.textColor) == null ? void 0 : _c2.map((override) => override.value).map((color) => color.swatchId)) != null ? _d : []
|
|
4082
4266
|
];
|
|
4083
4267
|
}
|
|
4084
|
-
})) != null ?
|
|
4268
|
+
})) != null ? _a : [];
|
|
4085
4269
|
}
|
|
4086
4270
|
case Types.ResponsiveColor:
|
|
4087
4271
|
return getResponsiveColorSwatchIds(prop);
|
|
@@ -4125,18 +4309,18 @@ function getSwatchIds(descriptor, prop) {
|
|
|
4125
4309
|
}
|
|
4126
4310
|
}
|
|
4127
4311
|
function getBackgroundsFileIds(value) {
|
|
4128
|
-
var
|
|
4129
|
-
return (
|
|
4312
|
+
var _a;
|
|
4313
|
+
return (_a = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
|
|
4130
4314
|
switch (backgroundItem.type) {
|
|
4131
4315
|
case "image":
|
|
4132
4316
|
return [backgroundItem.payload.imageId];
|
|
4133
4317
|
default:
|
|
4134
4318
|
return [];
|
|
4135
4319
|
}
|
|
4136
|
-
})) != null ?
|
|
4320
|
+
})) != null ? _a : [];
|
|
4137
4321
|
}
|
|
4138
4322
|
function getFileIds(descriptor, prop) {
|
|
4139
|
-
var
|
|
4323
|
+
var _a;
|
|
4140
4324
|
if (prop == null)
|
|
4141
4325
|
return [];
|
|
4142
4326
|
switch (descriptor.type) {
|
|
@@ -4148,7 +4332,7 @@ function getFileIds(descriptor, prop) {
|
|
|
4148
4332
|
}
|
|
4149
4333
|
case Types.Images: {
|
|
4150
4334
|
const value = prop;
|
|
4151
|
-
return (
|
|
4335
|
+
return (_a = value == null ? void 0 : value.flatMap((item) => item.props.file == null ? [] : [item.props.file])) != null ? _a : [];
|
|
4152
4336
|
}
|
|
4153
4337
|
case ImageControlType: {
|
|
4154
4338
|
const value = prop;
|
|
@@ -4216,7 +4400,7 @@ function getTableIds(descriptor, prop) {
|
|
|
4216
4400
|
}
|
|
4217
4401
|
}
|
|
4218
4402
|
function getPageIds(descriptor, prop) {
|
|
4219
|
-
var
|
|
4403
|
+
var _a;
|
|
4220
4404
|
if (prop == null)
|
|
4221
4405
|
return [];
|
|
4222
4406
|
switch (descriptor.type) {
|
|
@@ -4246,8 +4430,8 @@ function getPageIds(descriptor, prop) {
|
|
|
4246
4430
|
const value = prop;
|
|
4247
4431
|
if (value == null)
|
|
4248
4432
|
return [];
|
|
4249
|
-
return (
|
|
4250
|
-
var
|
|
4433
|
+
return (_a = value == null ? void 0 : value.flatMap((item) => {
|
|
4434
|
+
var _a2, _b;
|
|
4251
4435
|
switch (item.type) {
|
|
4252
4436
|
case "button": {
|
|
4253
4437
|
if (item.payload.link == null)
|
|
@@ -4260,7 +4444,7 @@ function getPageIds(descriptor, prop) {
|
|
|
4260
4444
|
}
|
|
4261
4445
|
}
|
|
4262
4446
|
case "dropdown": {
|
|
4263
|
-
return (_b = (
|
|
4447
|
+
return (_b = (_a2 = item.payload.links) == null ? void 0 : _a2.flatMap((link) => {
|
|
4264
4448
|
if (link.payload.link == null)
|
|
4265
4449
|
return [];
|
|
4266
4450
|
switch (link.payload.link.type) {
|
|
@@ -4272,7 +4456,7 @@ function getPageIds(descriptor, prop) {
|
|
|
4272
4456
|
})) != null ? _b : [];
|
|
4273
4457
|
}
|
|
4274
4458
|
}
|
|
4275
|
-
})) != null ?
|
|
4459
|
+
})) != null ? _a : [];
|
|
4276
4460
|
}
|
|
4277
4461
|
case RichTextControlType:
|
|
4278
4462
|
case Types.RichText: {
|
|
@@ -4390,14 +4574,14 @@ function getDocumentKeysSortedByDepth(state) {
|
|
|
4390
4574
|
elements.set(key, getDocumentElements(state, key));
|
|
4391
4575
|
});
|
|
4392
4576
|
keys.sort((a, b) => {
|
|
4393
|
-
var
|
|
4394
|
-
return ((
|
|
4577
|
+
var _a;
|
|
4578
|
+
return ((_a = elements.get(a)) == null ? void 0 : _a.has(b)) ? -1 : 1;
|
|
4395
4579
|
});
|
|
4396
4580
|
return keys;
|
|
4397
4581
|
}
|
|
4398
4582
|
function getElement(state, documentKey, elementKey) {
|
|
4399
|
-
var
|
|
4400
|
-
return (
|
|
4583
|
+
var _a;
|
|
4584
|
+
return (_a = getDocumentElements(state, documentKey).get(elementKey)) != null ? _a : null;
|
|
4401
4585
|
}
|
|
4402
4586
|
function getElementPropControllerDescriptors(state, documentKey, elementKey) {
|
|
4403
4587
|
const element = getElement(state, documentKey, elementKey);
|
|
@@ -4590,6 +4774,7 @@ exports.copyElementTree = copyElementTree;
|
|
|
4590
4774
|
exports.copyImageData = copyImageData;
|
|
4591
4775
|
exports.copyLinkData = copyLinkData;
|
|
4592
4776
|
exports.copyListData = copyListData;
|
|
4777
|
+
exports.copyRichTextData = copyRichTextData;
|
|
4593
4778
|
exports.copyShapeData = copyShapeData;
|
|
4594
4779
|
exports.copySlotData = copySlotData;
|
|
4595
4780
|
exports.copyStyleData = copyStyleData;
|