@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.es.js
CHANGED
|
@@ -34,16 +34,18 @@ var __publicField = (obj, key, value) => {
|
|
|
34
34
|
return value;
|
|
35
35
|
};
|
|
36
36
|
const import_meta = {};
|
|
37
|
-
var
|
|
37
|
+
var _c;
|
|
38
38
|
import { combineReducers, createStore, applyMiddleware } from "redux";
|
|
39
39
|
import thunk from "redux-thunk";
|
|
40
40
|
import { A as ActionTypes, n as localeStringSchema } from "./actions.es.js";
|
|
41
41
|
import { findBreakpointOverride, reducer as reducer$a, getInitialState as getInitialState$9 } from "./state/breakpoints.es.js";
|
|
42
|
+
import ipsum from "corporate-ipsum";
|
|
43
|
+
import { Element, Range, Editor, Text, Path, Transforms, Node, Point } from "slate";
|
|
44
|
+
import { v4 } from "uuid";
|
|
42
45
|
import React__default from "react";
|
|
43
46
|
import { cache, cx } from "@emotion/css";
|
|
44
47
|
import { serializeStyles } from "@emotion/serialize";
|
|
45
48
|
import { registerStyles, insertStyles } from "@emotion/utils";
|
|
46
|
-
import { Element, Range, Editor, Text, Path, Transforms, Node, Point } from "slate";
|
|
47
49
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
48
50
|
import isHotkey from "is-hotkey";
|
|
49
51
|
const ComponentIcon = {
|
|
@@ -113,8 +115,8 @@ function getDocuments(state) {
|
|
|
113
115
|
return state;
|
|
114
116
|
}
|
|
115
117
|
function getDocument$1(state, documentKey) {
|
|
116
|
-
var
|
|
117
|
-
return (
|
|
118
|
+
var _a;
|
|
119
|
+
return (_a = getDocuments(state).get(documentKey)) != null ? _a : null;
|
|
118
120
|
}
|
|
119
121
|
function reducer$8(state = getInitialState$7(), action) {
|
|
120
122
|
switch (action.type) {
|
|
@@ -138,8 +140,8 @@ function getReactComponents(state) {
|
|
|
138
140
|
return state;
|
|
139
141
|
}
|
|
140
142
|
function getReactComponent$1(state, type) {
|
|
141
|
-
var
|
|
142
|
-
return (
|
|
143
|
+
var _a;
|
|
144
|
+
return (_a = getReactComponents(state).get(type)) != null ? _a : null;
|
|
143
145
|
}
|
|
144
146
|
function reducer$7(state = getInitialState$6(), action) {
|
|
145
147
|
switch (action.type) {
|
|
@@ -163,8 +165,8 @@ function getPropControllerDescriptors$1(state) {
|
|
|
163
165
|
return state;
|
|
164
166
|
}
|
|
165
167
|
function getComponentPropControllerDescriptors$1(state, componentType) {
|
|
166
|
-
var
|
|
167
|
-
return (
|
|
168
|
+
var _a;
|
|
169
|
+
return (_a = getPropControllerDescriptors$1(state).get(componentType)) != null ? _a : null;
|
|
168
170
|
}
|
|
169
171
|
function reducer$6(state = getInitialState$5(), action) {
|
|
170
172
|
switch (action.type) {
|
|
@@ -189,24 +191,24 @@ function getInitialState$4() {
|
|
|
189
191
|
return { handles: /* @__PURE__ */ new Map(), instances: /* @__PURE__ */ new Map() };
|
|
190
192
|
}
|
|
191
193
|
function getPropControllersHandle(state, documentKey, elementKey) {
|
|
192
|
-
var
|
|
193
|
-
return (_b = (
|
|
194
|
+
var _a, _b;
|
|
195
|
+
return (_b = (_a = state.handles.get(documentKey)) == null ? void 0 : _a.get(elementKey)) != null ? _b : null;
|
|
194
196
|
}
|
|
195
197
|
function getPropControllers$1(state, documentKey, elementKey) {
|
|
196
|
-
var
|
|
197
|
-
return (_b = (
|
|
198
|
+
var _a, _b;
|
|
199
|
+
return (_b = (_a = state.instances.get(documentKey)) == null ? void 0 : _a.get(elementKey)) != null ? _b : null;
|
|
198
200
|
}
|
|
199
201
|
function getPropController(state, documentKey, elementKey, propName) {
|
|
200
|
-
var
|
|
201
|
-
return (_b = (
|
|
202
|
+
var _a, _b;
|
|
203
|
+
return (_b = (_a = getPropControllers$1(state, documentKey, elementKey)) == null ? void 0 : _a[propName]) != null ? _b : null;
|
|
202
204
|
}
|
|
203
205
|
function reducer$5(state = getInitialState$4(), action) {
|
|
204
|
-
var
|
|
206
|
+
var _a, _b, _c2, _d;
|
|
205
207
|
switch (action.type) {
|
|
206
208
|
case ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE: {
|
|
207
209
|
const { documentKey, elementKey, handle } = action.payload;
|
|
208
210
|
return __spreadProps(__spreadValues({}, state), {
|
|
209
|
-
handles: new Map(state.handles).set(documentKey, new Map((
|
|
211
|
+
handles: new Map(state.handles).set(documentKey, new Map((_a = state.handles.get(documentKey)) != null ? _a : []).set(elementKey, handle))
|
|
210
212
|
});
|
|
211
213
|
}
|
|
212
214
|
case ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE: {
|
|
@@ -218,7 +220,7 @@ function reducer$5(state = getInitialState$4(), action) {
|
|
|
218
220
|
case ActionTypes.REGISTER_PROP_CONTROLLERS: {
|
|
219
221
|
const { documentKey, elementKey, propControllers } = action.payload;
|
|
220
222
|
return __spreadProps(__spreadValues({}, state), {
|
|
221
|
-
instances: new Map(state.instances).set(documentKey, new Map((
|
|
223
|
+
instances: new Map(state.instances).set(documentKey, new Map((_c2 = state.instances.get(documentKey)) != null ? _c2 : []).set(elementKey, propControllers))
|
|
222
224
|
});
|
|
223
225
|
}
|
|
224
226
|
case ActionTypes.UNREGISTER_PROP_CONTROLLERS: {
|
|
@@ -271,11 +273,11 @@ function reducer$2(state = getInitialState$1(), action) {
|
|
|
271
273
|
}
|
|
272
274
|
}
|
|
273
275
|
function getInitialState(initialState) {
|
|
274
|
-
var
|
|
276
|
+
var _a, _b, _c2;
|
|
275
277
|
return {
|
|
276
|
-
locales: (
|
|
278
|
+
locales: (_a = initialState == null ? void 0 : initialState.locales) != null ? _a : [],
|
|
277
279
|
locale: (_b = initialState == null ? void 0 : initialState.locale) != null ? _b : null,
|
|
278
|
-
defaultLocale: (
|
|
280
|
+
defaultLocale: (_c2 = initialState == null ? void 0 : initialState.defaultLocale) != null ? _c2 : null
|
|
279
281
|
};
|
|
280
282
|
}
|
|
281
283
|
function reducer$1(state = getInitialState(), action) {
|
|
@@ -316,11 +318,11 @@ function Color(config = {}) {
|
|
|
316
318
|
return { type: ColorControlType, config };
|
|
317
319
|
}
|
|
318
320
|
function copyColorData(value, context) {
|
|
319
|
-
var
|
|
321
|
+
var _a;
|
|
320
322
|
if (value == null)
|
|
321
323
|
return value;
|
|
322
324
|
return __spreadProps(__spreadValues({}, value), {
|
|
323
|
-
swatchId: (
|
|
325
|
+
swatchId: (_a = context.replacementContext.swatchIds.get(value.swatchId)) != null ? _a : value.swatchId
|
|
324
326
|
});
|
|
325
327
|
}
|
|
326
328
|
class PropController {
|
|
@@ -351,10 +353,10 @@ const AllStyleControlProperties = [
|
|
|
351
353
|
StyleControlProperty.TextStyle
|
|
352
354
|
];
|
|
353
355
|
function Style(params) {
|
|
354
|
-
var
|
|
356
|
+
var _a;
|
|
355
357
|
return {
|
|
356
358
|
type: StyleControlType,
|
|
357
|
-
config: { properties: (
|
|
359
|
+
config: { properties: (_a = params == null ? void 0 : params.properties) != null ? _a : StyleControlDefaultProperties }
|
|
358
360
|
};
|
|
359
361
|
}
|
|
360
362
|
Style.Default = StyleControlDefaultProperties;
|
|
@@ -808,10 +810,10 @@ function Image(config = {}) {
|
|
|
808
810
|
}
|
|
809
811
|
Image.Format = ImageControlValueFormat;
|
|
810
812
|
function copyImageData(value, context) {
|
|
811
|
-
var
|
|
813
|
+
var _a;
|
|
812
814
|
if (value == null)
|
|
813
815
|
return value;
|
|
814
|
-
return (
|
|
816
|
+
return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
|
|
815
817
|
}
|
|
816
818
|
if (import_meta.vitest) {
|
|
817
819
|
const { describe, test, expect } = import_meta.vitest;
|
|
@@ -844,7 +846,7 @@ function Link(config = {}) {
|
|
|
844
846
|
return { type: LinkControlType, config };
|
|
845
847
|
}
|
|
846
848
|
function copyLinkData(value, context) {
|
|
847
|
-
var
|
|
849
|
+
var _a;
|
|
848
850
|
if (value == null)
|
|
849
851
|
return value;
|
|
850
852
|
if (value.type === "OPEN_PAGE") {
|
|
@@ -852,7 +854,7 @@ function copyLinkData(value, context) {
|
|
|
852
854
|
if (pageId != null) {
|
|
853
855
|
return __spreadProps(__spreadValues({}, value), {
|
|
854
856
|
payload: __spreadProps(__spreadValues({}, value.payload), {
|
|
855
|
-
pageId: (
|
|
857
|
+
pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : pageId
|
|
856
858
|
})
|
|
857
859
|
});
|
|
858
860
|
}
|
|
@@ -1206,22 +1208,22 @@ function copy$e(value, context) {
|
|
|
1206
1208
|
return value;
|
|
1207
1209
|
return value.map((override) => __spreadProps(__spreadValues({}, override), {
|
|
1208
1210
|
value: override.value.map((backgroundItem) => {
|
|
1209
|
-
var
|
|
1211
|
+
var _a, _b;
|
|
1210
1212
|
switch (backgroundItem.type) {
|
|
1211
1213
|
case "color":
|
|
1212
1214
|
return __spreadProps(__spreadValues({}, backgroundItem), {
|
|
1213
1215
|
payload: backgroundItem.payload === null ? null : __spreadProps(__spreadValues({}, backgroundItem.payload), {
|
|
1214
|
-
swatchId: (
|
|
1216
|
+
swatchId: (_a = context.replacementContext.swatchIds.get(backgroundItem.payload.swatchId)) != null ? _a : backgroundItem.payload.swatchId
|
|
1215
1217
|
})
|
|
1216
1218
|
});
|
|
1217
1219
|
case "gradient":
|
|
1218
1220
|
return __spreadProps(__spreadValues({}, backgroundItem), {
|
|
1219
1221
|
payload: __spreadProps(__spreadValues({}, backgroundItem.payload), {
|
|
1220
1222
|
stops: backgroundItem.payload.stops.map((stop) => {
|
|
1221
|
-
var
|
|
1223
|
+
var _a2;
|
|
1222
1224
|
return __spreadProps(__spreadValues({}, stop), {
|
|
1223
1225
|
color: stop.color == null ? null : __spreadProps(__spreadValues({}, stop.color), {
|
|
1224
|
-
swatchId: (
|
|
1226
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(stop.color.swatchId)) != null ? _a2 : stop.color.swatchId
|
|
1225
1227
|
})
|
|
1226
1228
|
});
|
|
1227
1229
|
})
|
|
@@ -1247,7 +1249,7 @@ function copy$d(value, context) {
|
|
|
1247
1249
|
});
|
|
1248
1250
|
}
|
|
1249
1251
|
function copy$c(value, context) {
|
|
1250
|
-
var
|
|
1252
|
+
var _a, _b;
|
|
1251
1253
|
if (value == null)
|
|
1252
1254
|
return value;
|
|
1253
1255
|
switch (value.type) {
|
|
@@ -1257,7 +1259,7 @@ function copy$c(value, context) {
|
|
|
1257
1259
|
return value;
|
|
1258
1260
|
return __spreadProps(__spreadValues({}, value), {
|
|
1259
1261
|
payload: __spreadProps(__spreadValues({}, value.payload), {
|
|
1260
|
-
pageId: (
|
|
1262
|
+
pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : pageId
|
|
1261
1263
|
})
|
|
1262
1264
|
});
|
|
1263
1265
|
}
|
|
@@ -1290,10 +1292,10 @@ function copy$b(value, context) {
|
|
|
1290
1292
|
payload: __spreadProps(__spreadValues({}, item.payload), {
|
|
1291
1293
|
link: link != null ? copy$c(link, context) : void 0,
|
|
1292
1294
|
color: color != null ? color.map((override) => {
|
|
1293
|
-
var
|
|
1295
|
+
var _a;
|
|
1294
1296
|
return __spreadProps(__spreadValues({}, override), {
|
|
1295
1297
|
value: __spreadProps(__spreadValues({}, override.value), {
|
|
1296
|
-
swatchId: (
|
|
1298
|
+
swatchId: (_a = context.replacementContext.swatchIds.get(override.value.swatchId)) != null ? _a : override.value.swatchId
|
|
1297
1299
|
})
|
|
1298
1300
|
});
|
|
1299
1301
|
}) : void 0
|
|
@@ -1351,14 +1353,14 @@ function copy$a(value, context) {
|
|
|
1351
1353
|
return value;
|
|
1352
1354
|
return value.map((override) => __spreadProps(__spreadValues({}, override), { value: override.value.map(copyShadowItem) }));
|
|
1353
1355
|
function copyShadowItem(item) {
|
|
1354
|
-
var
|
|
1356
|
+
var _a;
|
|
1355
1357
|
const { color } = item.payload;
|
|
1356
1358
|
if (color == null)
|
|
1357
1359
|
return item;
|
|
1358
1360
|
return __spreadProps(__spreadValues({}, item), {
|
|
1359
1361
|
payload: __spreadProps(__spreadValues({}, item.payload), {
|
|
1360
1362
|
color: __spreadProps(__spreadValues({}, color), {
|
|
1361
|
-
swatchId: (
|
|
1363
|
+
swatchId: (_a = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a : color.swatchId
|
|
1362
1364
|
})
|
|
1363
1365
|
})
|
|
1364
1366
|
});
|
|
@@ -1412,10 +1414,10 @@ if (import_meta.vitest) {
|
|
|
1412
1414
|
});
|
|
1413
1415
|
}
|
|
1414
1416
|
function copy$9(value, context) {
|
|
1415
|
-
var
|
|
1417
|
+
var _a;
|
|
1416
1418
|
if (value == null)
|
|
1417
1419
|
return value;
|
|
1418
|
-
return (
|
|
1420
|
+
return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
|
|
1419
1421
|
}
|
|
1420
1422
|
if (import_meta.vitest) {
|
|
1421
1423
|
const { describe, test, expect } = import_meta.vitest;
|
|
@@ -1448,13 +1450,13 @@ function copy$8(value, context) {
|
|
|
1448
1450
|
return value;
|
|
1449
1451
|
return value.map(copyImagesPanelItem);
|
|
1450
1452
|
function copyImagesPanelItem(imagesPanelItem) {
|
|
1451
|
-
var
|
|
1453
|
+
var _a;
|
|
1452
1454
|
const { file } = imagesPanelItem.props;
|
|
1453
1455
|
if (file == null)
|
|
1454
1456
|
return imagesPanelItem;
|
|
1455
1457
|
return __spreadProps(__spreadValues({}, imagesPanelItem), {
|
|
1456
1458
|
props: __spreadProps(__spreadValues({}, imagesPanelItem.props), {
|
|
1457
|
-
file: (
|
|
1459
|
+
file: (_a = context.replacementContext.fileIds.get(file)) != null ? _a : file
|
|
1458
1460
|
})
|
|
1459
1461
|
});
|
|
1460
1462
|
}
|
|
@@ -1503,9 +1505,9 @@ function copy$7(value, context) {
|
|
|
1503
1505
|
return value;
|
|
1504
1506
|
return value.map((override) => __spreadProps(__spreadValues({}, override), { value: copyColorValue(override.value) }));
|
|
1505
1507
|
function copyColorValue(colorValue) {
|
|
1506
|
-
var
|
|
1508
|
+
var _a;
|
|
1507
1509
|
return __spreadProps(__spreadValues({}, colorValue), {
|
|
1508
|
-
swatchId: (
|
|
1510
|
+
swatchId: (_a = context.replacementContext.swatchIds.get(colorValue.swatchId)) != null ? _a : colorValue.swatchId
|
|
1509
1511
|
});
|
|
1510
1512
|
}
|
|
1511
1513
|
}
|
|
@@ -1514,9 +1516,9 @@ function copy$6(value, context) {
|
|
|
1514
1516
|
return value;
|
|
1515
1517
|
return __spreadProps(__spreadValues({}, value), { fields: value.fields.map(copyFormFieldsPanelItem) });
|
|
1516
1518
|
function copyFormFieldsPanelItem(item) {
|
|
1517
|
-
var
|
|
1519
|
+
var _a;
|
|
1518
1520
|
return __spreadProps(__spreadValues({}, item), {
|
|
1519
|
-
tableColumnId: (
|
|
1521
|
+
tableColumnId: (_a = context.replacementContext.tableColumnIds.get(item.tableColumnId)) != null ? _a : item.tableColumnId
|
|
1520
1522
|
});
|
|
1521
1523
|
}
|
|
1522
1524
|
}
|
|
@@ -1570,10 +1572,10 @@ if (import_meta.vitest) {
|
|
|
1570
1572
|
});
|
|
1571
1573
|
}
|
|
1572
1574
|
function copy$5(value, context) {
|
|
1573
|
-
var
|
|
1575
|
+
var _a;
|
|
1574
1576
|
if (value == null)
|
|
1575
1577
|
return value;
|
|
1576
|
-
return (
|
|
1578
|
+
return (_a = context.replacementContext.tableIds.get(value)) != null ? _a : value;
|
|
1577
1579
|
}
|
|
1578
1580
|
if (import_meta.vitest) {
|
|
1579
1581
|
const { describe, test, expect } = import_meta.vitest;
|
|
@@ -1615,13 +1617,13 @@ function copy$4(value, context) {
|
|
|
1615
1617
|
};
|
|
1616
1618
|
}
|
|
1617
1619
|
function copyBorderSide(borderSide) {
|
|
1618
|
-
var
|
|
1620
|
+
var _a;
|
|
1619
1621
|
const { color } = borderSide;
|
|
1620
1622
|
if (color == null)
|
|
1621
1623
|
return borderSide;
|
|
1622
1624
|
return __spreadProps(__spreadValues({}, borderSide), {
|
|
1623
1625
|
color: __spreadProps(__spreadValues({}, color), {
|
|
1624
|
-
swatchId: (
|
|
1626
|
+
swatchId: (_a = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a : color.swatchId
|
|
1625
1627
|
})
|
|
1626
1628
|
});
|
|
1627
1629
|
}
|
|
@@ -1735,24 +1737,24 @@ function copy$3(value, context) {
|
|
|
1735
1737
|
return value;
|
|
1736
1738
|
return __spreadProps(__spreadValues({}, value), { document: value.document ? copyNode(value.document) : value.document });
|
|
1737
1739
|
function copyNode(node) {
|
|
1738
|
-
var
|
|
1740
|
+
var _a;
|
|
1739
1741
|
switch (node.object) {
|
|
1740
1742
|
case "document":
|
|
1741
1743
|
case "block":
|
|
1742
1744
|
case "inline":
|
|
1743
1745
|
return copyInline(node);
|
|
1744
1746
|
case "text":
|
|
1745
|
-
return __spreadProps(__spreadValues({}, node), { marks: (
|
|
1747
|
+
return __spreadProps(__spreadValues({}, node), { marks: (_a = node.marks) == null ? void 0 : _a.map(copyMark) });
|
|
1746
1748
|
default:
|
|
1747
1749
|
return node;
|
|
1748
1750
|
}
|
|
1749
1751
|
}
|
|
1750
1752
|
function copyInline(inline) {
|
|
1751
|
-
var
|
|
1753
|
+
var _a, _b;
|
|
1752
1754
|
switch (inline.type) {
|
|
1753
1755
|
case "link":
|
|
1754
1756
|
return __spreadProps(__spreadValues({}, inline), {
|
|
1755
|
-
nodes: (
|
|
1757
|
+
nodes: (_a = inline.nodes) == null ? void 0 : _a.map(copyNode),
|
|
1756
1758
|
data: inline.data ? copyLinkData2(inline.data) : inline.data
|
|
1757
1759
|
});
|
|
1758
1760
|
default:
|
|
@@ -1760,7 +1762,7 @@ function copy$3(value, context) {
|
|
|
1760
1762
|
}
|
|
1761
1763
|
}
|
|
1762
1764
|
function copyLinkData2(data) {
|
|
1763
|
-
var
|
|
1765
|
+
var _a, _b;
|
|
1764
1766
|
switch (data.type) {
|
|
1765
1767
|
case "OPEN_PAGE": {
|
|
1766
1768
|
const pageId = data.payload.pageId;
|
|
@@ -1768,7 +1770,7 @@ function copy$3(value, context) {
|
|
|
1768
1770
|
return data;
|
|
1769
1771
|
return __spreadProps(__spreadValues({}, data), {
|
|
1770
1772
|
payload: __spreadProps(__spreadValues({}, data.payload), {
|
|
1771
|
-
pageId: (
|
|
1773
|
+
pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : data.payload.pageId
|
|
1772
1774
|
})
|
|
1773
1775
|
});
|
|
1774
1776
|
}
|
|
@@ -1789,20 +1791,20 @@ function copy$3(value, context) {
|
|
|
1789
1791
|
}
|
|
1790
1792
|
}
|
|
1791
1793
|
function copyMark(mark) {
|
|
1792
|
-
var
|
|
1794
|
+
var _a, _b, _c2, _d;
|
|
1793
1795
|
switch (mark.type) {
|
|
1794
1796
|
case "typography": {
|
|
1795
|
-
const typographyId = (
|
|
1797
|
+
const typographyId = (_a = mark.data) == null ? void 0 : _a.value.id;
|
|
1796
1798
|
return __spreadProps(__spreadValues({}, mark), {
|
|
1797
1799
|
data: __spreadProps(__spreadValues({}, mark.data), {
|
|
1798
1800
|
value: __spreadProps(__spreadValues({}, (_b = mark.data) == null ? void 0 : _b.value), {
|
|
1799
|
-
id: (
|
|
1801
|
+
id: (_c2 = context.replacementContext.typographyIds.get(typographyId)) != null ? _c2 : typographyId,
|
|
1800
1802
|
style: (_d = mark.data) == null ? void 0 : _d.value.style.map((override) => {
|
|
1801
|
-
var
|
|
1803
|
+
var _a2, _b2, _c3;
|
|
1802
1804
|
return __spreadProps(__spreadValues({}, override), {
|
|
1803
1805
|
value: __spreadProps(__spreadValues({}, override.value), {
|
|
1804
1806
|
color: override.value.color == null ? override.value.color : __spreadProps(__spreadValues({}, override.value.color), {
|
|
1805
|
-
swatchId: (
|
|
1807
|
+
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
|
|
1806
1808
|
})
|
|
1807
1809
|
})
|
|
1808
1810
|
});
|
|
@@ -1953,110 +1955,89 @@ function copy$1(descriptor, value, context) {
|
|
|
1953
1955
|
function copyElementReference(value, context) {
|
|
1954
1956
|
return context.replacementContext.globalElementIds.get(value) || value;
|
|
1955
1957
|
}
|
|
1956
|
-
function
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
case ColorControlType:
|
|
1973
|
-
return copyColorData(value, context);
|
|
1974
|
-
case ImageControlType:
|
|
1975
|
-
return copyImageData(value, context);
|
|
1976
|
-
case LinkControlType:
|
|
1977
|
-
return copyLinkData(value, context);
|
|
1978
|
-
case ShapeControlType:
|
|
1979
|
-
return copyShapeData(definition2, value, context);
|
|
1980
|
-
case ListControlType:
|
|
1981
|
-
return copyListData(definition2, value, context);
|
|
1982
|
-
case StyleControlType:
|
|
1983
|
-
return copyStyleData(value, context);
|
|
1984
|
-
case SlotControlType:
|
|
1985
|
-
return copySlotData(value, context);
|
|
1986
|
-
default:
|
|
1987
|
-
return value;
|
|
1988
|
-
}
|
|
1989
|
-
}
|
|
1990
|
-
function merge(definition2, a, b = a, context) {
|
|
1991
|
-
switch (definition2.type) {
|
|
1992
|
-
case SlotControlType:
|
|
1993
|
-
return mergeSlotData(a, b, context);
|
|
1994
|
-
default:
|
|
1995
|
-
return b;
|
|
1958
|
+
function copyRichTextData(value, context) {
|
|
1959
|
+
if (value == null)
|
|
1960
|
+
return value;
|
|
1961
|
+
return __spreadProps(__spreadValues({}, value), { document: value.document ? copyNode(value.document) : value.document });
|
|
1962
|
+
function copyNode(node) {
|
|
1963
|
+
var _a;
|
|
1964
|
+
switch (node.object) {
|
|
1965
|
+
case "document":
|
|
1966
|
+
case "block":
|
|
1967
|
+
case "inline":
|
|
1968
|
+
return copyInline(node);
|
|
1969
|
+
case "text":
|
|
1970
|
+
return __spreadProps(__spreadValues({}, node), { marks: (_a = node.marks) == null ? void 0 : _a.map(copyMark) });
|
|
1971
|
+
default:
|
|
1972
|
+
return node;
|
|
1973
|
+
}
|
|
1996
1974
|
}
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
};
|
|
2007
|
-
|
|
2008
|
-
function unstable_IconRadioGroup(config) {
|
|
2009
|
-
return { type: IconRadioGroupControlType, config };
|
|
2010
|
-
}
|
|
2011
|
-
const SelectControlType = "makeswift::controls::select";
|
|
2012
|
-
function Select(config) {
|
|
2013
|
-
return { type: SelectControlType, config };
|
|
2014
|
-
}
|
|
2015
|
-
const isServer = typeof window === "undefined";
|
|
2016
|
-
const useInsertionEffectSpecifier = "useInsertionEffect";
|
|
2017
|
-
const useInsertionEffect = (_a = React__default[useInsertionEffectSpecifier]) != null ? _a : React__default.useLayoutEffect;
|
|
2018
|
-
function useStyle(style) {
|
|
2019
|
-
const serialized = serializeStyles([style], cache.registered);
|
|
2020
|
-
registerStyles(cache, serialized, false);
|
|
2021
|
-
useInsertionEffect(() => {
|
|
2022
|
-
insertStyles(cache, serialized, false);
|
|
2023
|
-
});
|
|
2024
|
-
if (isServer)
|
|
2025
|
-
insertStyles(cache, serialized, false);
|
|
2026
|
-
return `${cache.key}-${serialized.name}`;
|
|
2027
|
-
}
|
|
2028
|
-
const StyleV2ControlType = "makeswift::controls::style-v2";
|
|
2029
|
-
const unstable_useStyleV2ClassName = useStyle;
|
|
2030
|
-
function unstable_StyleV2(config) {
|
|
2031
|
-
return { type: StyleV2ControlType, config };
|
|
2032
|
-
}
|
|
2033
|
-
const StyleV2ControlMessageType = {
|
|
2034
|
-
CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model",
|
|
2035
|
-
STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE: "makeswift::controls::style-v2::message::child-control-message"
|
|
2036
|
-
};
|
|
2037
|
-
class StyleV2Control extends PropController {
|
|
2038
|
-
constructor(send, descriptor) {
|
|
2039
|
-
super(send);
|
|
2040
|
-
__publicField(this, "control");
|
|
2041
|
-
this.control = createPropController(descriptor.config.type, (message) => {
|
|
2042
|
-
this.send({
|
|
2043
|
-
type: StyleV2ControlMessageType.STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE,
|
|
2044
|
-
payload: { message }
|
|
2045
|
-
});
|
|
2046
|
-
});
|
|
1975
|
+
function copyInline(inline) {
|
|
1976
|
+
var _a, _b;
|
|
1977
|
+
switch (inline.type) {
|
|
1978
|
+
case "link":
|
|
1979
|
+
return __spreadProps(__spreadValues({}, inline), {
|
|
1980
|
+
nodes: (_a = inline.nodes) == null ? void 0 : _a.map(copyNode),
|
|
1981
|
+
data: inline.data ? copyLinkData2(inline.data) : inline.data
|
|
1982
|
+
});
|
|
1983
|
+
default:
|
|
1984
|
+
return __spreadProps(__spreadValues({}, inline), { nodes: (_b = inline.nodes) == null ? void 0 : _b.map(copyNode) });
|
|
1985
|
+
}
|
|
2047
1986
|
}
|
|
2048
|
-
|
|
2049
|
-
|
|
1987
|
+
function copyLinkData2(data) {
|
|
1988
|
+
var _a, _b;
|
|
1989
|
+
switch (data.type) {
|
|
1990
|
+
case "OPEN_PAGE": {
|
|
1991
|
+
const pageId = data.payload.pageId;
|
|
1992
|
+
if (pageId == null)
|
|
1993
|
+
return data;
|
|
1994
|
+
return __spreadProps(__spreadValues({}, data), {
|
|
1995
|
+
payload: __spreadProps(__spreadValues({}, data.payload), {
|
|
1996
|
+
pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : data.payload.pageId
|
|
1997
|
+
})
|
|
1998
|
+
});
|
|
1999
|
+
}
|
|
2000
|
+
case "SCROLL_TO_ELEMENT": {
|
|
2001
|
+
const elementIdConfig = data.payload.elementIdConfig;
|
|
2002
|
+
if (elementIdConfig == null)
|
|
2003
|
+
return data;
|
|
2004
|
+
return __spreadProps(__spreadValues({}, data), {
|
|
2005
|
+
payload: __spreadProps(__spreadValues({}, data.payload), {
|
|
2006
|
+
elementIdConfig: __spreadProps(__spreadValues({}, elementIdConfig), {
|
|
2007
|
+
elementKey: (_b = context.replacementContext.elementKeys.get(elementIdConfig.elementKey)) != null ? _b : elementIdConfig.elementKey
|
|
2008
|
+
})
|
|
2009
|
+
})
|
|
2010
|
+
});
|
|
2011
|
+
}
|
|
2012
|
+
default:
|
|
2013
|
+
return data;
|
|
2014
|
+
}
|
|
2050
2015
|
}
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2016
|
+
function copyMark(mark) {
|
|
2017
|
+
var _a, _b, _c2, _d;
|
|
2018
|
+
switch (mark.type) {
|
|
2019
|
+
case "typography": {
|
|
2020
|
+
const typographyId = (_a = mark.data) == null ? void 0 : _a.value.id;
|
|
2021
|
+
return __spreadProps(__spreadValues({}, mark), {
|
|
2022
|
+
data: __spreadProps(__spreadValues({}, mark.data), {
|
|
2023
|
+
value: __spreadProps(__spreadValues({}, (_b = mark.data) == null ? void 0 : _b.value), {
|
|
2024
|
+
id: (_c2 = context.replacementContext.typographyIds.get(typographyId)) != null ? _c2 : typographyId,
|
|
2025
|
+
style: (_d = mark.data) == null ? void 0 : _d.value.style.map((override) => {
|
|
2026
|
+
var _a2, _b2, _c3;
|
|
2027
|
+
return __spreadProps(__spreadValues({}, override), {
|
|
2028
|
+
value: __spreadProps(__spreadValues({}, override.value), {
|
|
2029
|
+
color: override.value.color == null ? override.value.color : __spreadProps(__spreadValues({}, override.value.color), {
|
|
2030
|
+
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
|
|
2031
|
+
})
|
|
2032
|
+
})
|
|
2033
|
+
});
|
|
2034
|
+
})
|
|
2035
|
+
})
|
|
2036
|
+
})
|
|
2037
|
+
});
|
|
2059
2038
|
}
|
|
2039
|
+
default:
|
|
2040
|
+
return mark;
|
|
2060
2041
|
}
|
|
2061
2042
|
}
|
|
2062
2043
|
}
|
|
@@ -2110,22 +2091,22 @@ function isText(node) {
|
|
|
2110
2091
|
return false;
|
|
2111
2092
|
}
|
|
2112
2093
|
function toTextDAO(node) {
|
|
2113
|
-
var
|
|
2114
|
-
const typographyMark = (
|
|
2094
|
+
var _a, _b, _c2, _d;
|
|
2095
|
+
const typographyMark = (_a = node.marks) == null ? void 0 : _a.find((mark) => mark.type === "typography");
|
|
2115
2096
|
return [
|
|
2116
2097
|
{
|
|
2117
2098
|
text: (_b = node.text) != null ? _b : "",
|
|
2118
|
-
typography: (_d = (
|
|
2099
|
+
typography: (_d = (_c2 = typographyMark == null ? void 0 : typographyMark.data) == null ? void 0 : _c2.value) != null ? _d : void 0
|
|
2119
2100
|
}
|
|
2120
2101
|
];
|
|
2121
2102
|
}
|
|
2122
2103
|
function toInlineDAO(node) {
|
|
2123
|
-
var
|
|
2104
|
+
var _a, _b, _c2, _d;
|
|
2124
2105
|
switch (node.type) {
|
|
2125
2106
|
case InlineType.Link:
|
|
2126
2107
|
return [
|
|
2127
2108
|
{
|
|
2128
|
-
children: (_b = (
|
|
2109
|
+
children: (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(toInlineOrTextDAO)) != null ? _b : [],
|
|
2129
2110
|
[node.type]: node.data,
|
|
2130
2111
|
type: node.type
|
|
2131
2112
|
}
|
|
@@ -2135,7 +2116,7 @@ function toInlineDAO(node) {
|
|
|
2135
2116
|
case InlineType.SuperScript:
|
|
2136
2117
|
return [
|
|
2137
2118
|
{
|
|
2138
|
-
children: (_d = (
|
|
2119
|
+
children: (_d = (_c2 = node.nodes) == null ? void 0 : _c2.flatMap(toInlineOrTextDAO)) != null ? _d : [],
|
|
2139
2120
|
type: node.type
|
|
2140
2121
|
}
|
|
2141
2122
|
];
|
|
@@ -2171,8 +2152,8 @@ function toNodeDAO(node) {
|
|
|
2171
2152
|
}
|
|
2172
2153
|
}
|
|
2173
2154
|
function richTextDTOtoSelection(data) {
|
|
2174
|
-
var
|
|
2175
|
-
if (((_b = (
|
|
2155
|
+
var _a, _b, _c2, _d;
|
|
2156
|
+
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)
|
|
2176
2157
|
return {
|
|
2177
2158
|
anchor: {
|
|
2178
2159
|
offset: data.selection.anchor.offset,
|
|
@@ -2186,11 +2167,11 @@ function richTextDTOtoSelection(data) {
|
|
|
2186
2167
|
return null;
|
|
2187
2168
|
}
|
|
2188
2169
|
function richTextDTOtoDAO(data) {
|
|
2189
|
-
var
|
|
2190
|
-
return (
|
|
2170
|
+
var _a, _b, _c2;
|
|
2171
|
+
return (_c2 = (_b = (_a = data.document) == null ? void 0 : _a.nodes) == null ? void 0 : _b.flatMap(toNodeDAO)) != null ? _c2 : [];
|
|
2191
2172
|
}
|
|
2192
2173
|
function toInlineOrTextDTO(node) {
|
|
2193
|
-
var
|
|
2174
|
+
var _a;
|
|
2194
2175
|
if (isText(node)) {
|
|
2195
2176
|
return [
|
|
2196
2177
|
{
|
|
@@ -2215,7 +2196,7 @@ function toInlineOrTextDTO(node) {
|
|
|
2215
2196
|
object: ObjectType.Inline,
|
|
2216
2197
|
nodes: node.children.flatMap(toInlineOrTextDTO),
|
|
2217
2198
|
type: node.type,
|
|
2218
|
-
data: (
|
|
2199
|
+
data: (_a = node.link) != null ? _a : void 0
|
|
2219
2200
|
}
|
|
2220
2201
|
];
|
|
2221
2202
|
case InlineType.Code:
|
|
@@ -2232,7 +2213,7 @@ function toInlineOrTextDTO(node) {
|
|
|
2232
2213
|
}
|
|
2233
2214
|
}
|
|
2234
2215
|
function toNodeDTO(node) {
|
|
2235
|
-
var
|
|
2216
|
+
var _a, _b;
|
|
2236
2217
|
if (isText(node))
|
|
2237
2218
|
return toInlineOrTextDTO(node);
|
|
2238
2219
|
switch (node.type) {
|
|
@@ -2261,7 +2242,7 @@ function toNodeDTO(node) {
|
|
|
2261
2242
|
textAlign: node.textAlign
|
|
2262
2243
|
} : {},
|
|
2263
2244
|
object: "block",
|
|
2264
|
-
nodes: (_b = (
|
|
2245
|
+
nodes: (_b = (_a = node.children) == null ? void 0 : _a.flatMap(toNodeDTO)) != null ? _b : []
|
|
2265
2246
|
}
|
|
2266
2247
|
];
|
|
2267
2248
|
default:
|
|
@@ -2367,17 +2348,6 @@ class RichTextControl extends PropController {
|
|
|
2367
2348
|
this.send({ type: RichTextControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
|
|
2368
2349
|
}
|
|
2369
2350
|
}
|
|
2370
|
-
function richTextV2DataToDescendents(data) {
|
|
2371
|
-
return data.descendants;
|
|
2372
|
-
}
|
|
2373
|
-
function richTextV2DescendentsToData(descendants, key) {
|
|
2374
|
-
return {
|
|
2375
|
-
type: RichTextV2ControlType,
|
|
2376
|
-
version: 2,
|
|
2377
|
-
descendants,
|
|
2378
|
-
key
|
|
2379
|
-
};
|
|
2380
|
-
}
|
|
2381
2351
|
function createRichTextV2Plugin({
|
|
2382
2352
|
control,
|
|
2383
2353
|
withPlugin,
|
|
@@ -2524,9 +2494,9 @@ function getBlocksInSelection(editor) {
|
|
|
2524
2494
|
})).filter((entry) => ElementUtils.isRootBlock(entry[0]));
|
|
2525
2495
|
}
|
|
2526
2496
|
function getActiveBlockType(editor) {
|
|
2527
|
-
var
|
|
2497
|
+
var _a;
|
|
2528
2498
|
const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type);
|
|
2529
|
-
return rootBlocks.reduce((a, b) => a === b ? b : null, (
|
|
2499
|
+
return rootBlocks.reduce((a, b) => a === b ? b : null, (_a = rootBlocks.at(0)) != null ? _a : null);
|
|
2530
2500
|
}
|
|
2531
2501
|
function unwrapInline(editor, type) {
|
|
2532
2502
|
Transforms.unwrapNodes(editor, {
|
|
@@ -2552,13 +2522,13 @@ function getLinksAndTextInSelection(editor) {
|
|
|
2552
2522
|
}));
|
|
2553
2523
|
}
|
|
2554
2524
|
const getValue$3 = (editor) => {
|
|
2555
|
-
var
|
|
2525
|
+
var _a;
|
|
2556
2526
|
const roots = filterForSubtreeRoots(getLinksAndTextInSelection(editor));
|
|
2557
2527
|
const areAllRootsLinks = roots.every(([root]) => isLinkElement(root) || Text.isText(root));
|
|
2558
2528
|
if (!areAllRootsLinks)
|
|
2559
2529
|
return void 0;
|
|
2560
2530
|
const matchingValues = roots.map(([node]) => node).filter(isLinkElement);
|
|
2561
|
-
const match = matchingValues.reduce((a, b) => deepEqual(a == null ? void 0 : a.link, b == null ? void 0 : b.link) ? b : null, (
|
|
2531
|
+
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);
|
|
2562
2532
|
return match == null ? match : match.link;
|
|
2563
2533
|
};
|
|
2564
2534
|
const onChange$1 = (editor, value) => {
|
|
@@ -2589,6 +2559,19 @@ function LinkPlugin() {
|
|
|
2589
2559
|
}
|
|
2590
2560
|
});
|
|
2591
2561
|
}
|
|
2562
|
+
const unstable_IconRadioGroupIcon = {
|
|
2563
|
+
TextAlignCenter: "TextAlignCenter",
|
|
2564
|
+
TextAlignJustify: "TextAlignJustify",
|
|
2565
|
+
TextAlignLeft: "TextAlignLeft",
|
|
2566
|
+
TextAlignRight: "TextAlignRight",
|
|
2567
|
+
Superscript: "Superscript16",
|
|
2568
|
+
Subscript: "Subscript16",
|
|
2569
|
+
Code: "Code16"
|
|
2570
|
+
};
|
|
2571
|
+
const IconRadioGroupControlType = "makeswift::controls::icon-radio-group";
|
|
2572
|
+
function unstable_IconRadioGroup(config) {
|
|
2573
|
+
return { type: IconRadioGroupControlType, config };
|
|
2574
|
+
}
|
|
2592
2575
|
const supportedInlineOptions = [
|
|
2593
2576
|
{
|
|
2594
2577
|
icon: unstable_IconRadioGroupIcon.Superscript,
|
|
@@ -2620,13 +2603,13 @@ function getSupportedInlinesAndTextInSelection(editor) {
|
|
|
2620
2603
|
}));
|
|
2621
2604
|
}
|
|
2622
2605
|
const getValue$2 = (editor) => {
|
|
2623
|
-
var
|
|
2606
|
+
var _a;
|
|
2624
2607
|
const roots = filterForSubtreeRoots(getSupportedInlinesAndTextInSelection(editor));
|
|
2625
2608
|
const areAllRootsSupportedInlineTypesOrText = roots.every((entry) => isSupportedInlineEntry(entry) || Text.isText(entry[0]));
|
|
2626
2609
|
if (!areAllRootsSupportedInlineTypesOrText)
|
|
2627
2610
|
return void 0;
|
|
2628
2611
|
const matchingValues = roots.filter(isSupportedInlineEntry).map(([node]) => node);
|
|
2629
|
-
const match = matchingValues.reduce((a, b) => (a == null ? void 0 : a.type) === (b == null ? void 0 : b.type) ? b : null, (
|
|
2612
|
+
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);
|
|
2630
2613
|
return match == null ? match : match.type;
|
|
2631
2614
|
};
|
|
2632
2615
|
const onChange = (editor, value) => {
|
|
@@ -2682,10 +2665,10 @@ function InlinePlugin() {
|
|
|
2682
2665
|
}
|
|
2683
2666
|
});
|
|
2684
2667
|
}
|
|
2685
|
-
function InlinePluginComponent(
|
|
2686
|
-
var
|
|
2668
|
+
function InlinePluginComponent(_a) {
|
|
2669
|
+
var _b = _a, {
|
|
2687
2670
|
renderElement
|
|
2688
|
-
} =
|
|
2671
|
+
} = _b, props = __objRest(_b, [
|
|
2689
2672
|
"renderElement"
|
|
2690
2673
|
]);
|
|
2691
2674
|
switch (props.element.type) {
|
|
@@ -2845,8 +2828,8 @@ function TextAlignPlugin() {
|
|
|
2845
2828
|
});
|
|
2846
2829
|
}
|
|
2847
2830
|
function setBlockKeyForDevice(editor, breakpoints, deviceId, key, value, options) {
|
|
2848
|
-
var
|
|
2849
|
-
const at = (
|
|
2831
|
+
var _a, _b;
|
|
2832
|
+
const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
|
|
2850
2833
|
if (!at)
|
|
2851
2834
|
return;
|
|
2852
2835
|
const rootElements = getBlocksInSelection(editor);
|
|
@@ -2865,17 +2848,21 @@ function setBlockKeyForDevice(editor, breakpoints, deviceId, key, value, options
|
|
|
2865
2848
|
}
|
|
2866
2849
|
}
|
|
2867
2850
|
function clearBlockKeyForDevice(editor, deviceId, key) {
|
|
2868
|
-
var
|
|
2851
|
+
var _a;
|
|
2869
2852
|
const rootElements = getBlocksInSelection(editor);
|
|
2870
2853
|
for (const [node, path] of rootElements) {
|
|
2871
2854
|
if (ElementUtils.isBlock(node)) {
|
|
2872
|
-
const deviceOverrides = (
|
|
2855
|
+
const deviceOverrides = (_a = node[key]) != null ? _a : [];
|
|
2873
2856
|
Transforms.setNodes(editor, {
|
|
2874
2857
|
[key]: deviceOverrides.filter((v) => v.deviceId !== deviceId)
|
|
2875
2858
|
}, { at: path });
|
|
2876
2859
|
}
|
|
2877
2860
|
}
|
|
2878
2861
|
}
|
|
2862
|
+
const SelectControlType = "makeswift::controls::select";
|
|
2863
|
+
function Select(config) {
|
|
2864
|
+
return { type: SelectControlType, config };
|
|
2865
|
+
}
|
|
2879
2866
|
const EditorUtils = {
|
|
2880
2867
|
getFirstAncestorList(editor, path) {
|
|
2881
2868
|
try {
|
|
@@ -2925,8 +2912,8 @@ function unwrapPath(editor, listItemPath) {
|
|
|
2925
2912
|
});
|
|
2926
2913
|
}
|
|
2927
2914
|
function unwrapList(editor, options) {
|
|
2928
|
-
var
|
|
2929
|
-
const at = (
|
|
2915
|
+
var _a;
|
|
2916
|
+
const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
|
|
2930
2917
|
if (!at)
|
|
2931
2918
|
return;
|
|
2932
2919
|
const listItems = Array.from(Editor.nodes(editor, {
|
|
@@ -2945,8 +2932,8 @@ function unwrapList(editor, options) {
|
|
|
2945
2932
|
});
|
|
2946
2933
|
}
|
|
2947
2934
|
function wrapList(editor, options = { type: BlockType.UnorderedList }) {
|
|
2948
|
-
var
|
|
2949
|
-
const at = (
|
|
2935
|
+
var _a;
|
|
2936
|
+
const at = (_a = options.at) != null ? _a : editor.selection;
|
|
2950
2937
|
if (!at)
|
|
2951
2938
|
return;
|
|
2952
2939
|
const nonListEntries = Array.from(Editor.nodes(editor, {
|
|
@@ -2985,7 +2972,7 @@ const LocationUtils = {
|
|
|
2985
2972
|
}
|
|
2986
2973
|
};
|
|
2987
2974
|
function getSelectedListItems(editor) {
|
|
2988
|
-
var
|
|
2975
|
+
var _a, _b;
|
|
2989
2976
|
if (!editor.selection)
|
|
2990
2977
|
return [];
|
|
2991
2978
|
const start = LocationUtils.getStartPath(editor.selection);
|
|
@@ -2993,7 +2980,7 @@ function getSelectedListItems(editor) {
|
|
|
2993
2980
|
at: editor.selection,
|
|
2994
2981
|
match: (node) => ElementUtils.isListItem(node)
|
|
2995
2982
|
});
|
|
2996
|
-
const firstAncestorPath = (_b = (
|
|
2983
|
+
const firstAncestorPath = (_b = (_a = EditorUtils.getFirstAncestorListItem(editor, start)) == null ? void 0 : _a[1]) != null ? _b : [];
|
|
2997
2984
|
return Array.from(listItems).filter((node) => Path.isDescendant(start, node[1]) ? Path.equals(node[1], firstAncestorPath) : !Path.isAfter(start, node[1]));
|
|
2998
2985
|
}
|
|
2999
2986
|
function indentPath(editor, path) {
|
|
@@ -3070,8 +3057,8 @@ function dedent(editor) {
|
|
|
3070
3057
|
});
|
|
3071
3058
|
}
|
|
3072
3059
|
function toggleList(editor, options = { type: BlockType.UnorderedList }) {
|
|
3073
|
-
var
|
|
3074
|
-
const at = (
|
|
3060
|
+
var _a;
|
|
3061
|
+
const at = (_a = options.at) != null ? _a : editor.selection;
|
|
3075
3062
|
if (at == null)
|
|
3076
3063
|
return;
|
|
3077
3064
|
const start = LocationUtils.getStartPath(at);
|
|
@@ -3088,6 +3075,19 @@ function toggleList(editor, options = { type: BlockType.UnorderedList }) {
|
|
|
3088
3075
|
Transforms.setNodes(editor, { type: options.type }, { at: ancestorPath });
|
|
3089
3076
|
}
|
|
3090
3077
|
}
|
|
3078
|
+
const isServer = typeof window === "undefined";
|
|
3079
|
+
const useInsertionEffectSpecifier = "useInsertionEffect";
|
|
3080
|
+
const useInsertionEffect = (_c = React__default[useInsertionEffectSpecifier]) != null ? _c : React__default.useLayoutEffect;
|
|
3081
|
+
function useStyle(style) {
|
|
3082
|
+
const serialized = serializeStyles([style], cache.registered);
|
|
3083
|
+
registerStyles(cache, serialized, false);
|
|
3084
|
+
useInsertionEffect(() => {
|
|
3085
|
+
insertStyles(cache, serialized, false);
|
|
3086
|
+
});
|
|
3087
|
+
if (isServer)
|
|
3088
|
+
insertStyles(cache, serialized, false);
|
|
3089
|
+
return `${cache.key}-${serialized.name}`;
|
|
3090
|
+
}
|
|
3091
3091
|
const BlockActions = {
|
|
3092
3092
|
setBlockKeyForDevice,
|
|
3093
3093
|
clearBlockKeyForDevice,
|
|
@@ -3169,9 +3169,9 @@ function withBlock(editor) {
|
|
|
3169
3169
|
return ElementUtils.isInline(entry);
|
|
3170
3170
|
};
|
|
3171
3171
|
editor.normalizeNode = (entry) => {
|
|
3172
|
-
var
|
|
3172
|
+
var _a;
|
|
3173
3173
|
const [normalizationNode, normalizationPath] = entry;
|
|
3174
|
-
if (ElementUtils.isBlock(normalizationNode) && ((
|
|
3174
|
+
if (ElementUtils.isBlock(normalizationNode) && ((_a = normalizationNode == null ? void 0 : normalizationNode.textAlign) == null ? void 0 : _a.length) == 0) {
|
|
3175
3175
|
Transforms.unsetNodes(editor, "textAlign", {
|
|
3176
3176
|
at: normalizationPath
|
|
3177
3177
|
});
|
|
@@ -3412,8 +3412,8 @@ function BlockPluginComponent(_d) {
|
|
|
3412
3412
|
}
|
|
3413
3413
|
function clearActiveTypographyStyle(editor, options) {
|
|
3414
3414
|
Editor.withoutNormalizing(editor, () => {
|
|
3415
|
-
var
|
|
3416
|
-
const at = (
|
|
3415
|
+
var _a;
|
|
3416
|
+
const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
|
|
3417
3417
|
if (!at)
|
|
3418
3418
|
return;
|
|
3419
3419
|
const atRef = Editor.rangeRef(editor, at);
|
|
@@ -3447,8 +3447,8 @@ function clearActiveTypographyStyle(editor, options) {
|
|
|
3447
3447
|
}
|
|
3448
3448
|
function clearDeviceActiveTypography(editor, currentDeviceId, options) {
|
|
3449
3449
|
Editor.withoutNormalizing(editor, () => {
|
|
3450
|
-
var
|
|
3451
|
-
const at = (
|
|
3450
|
+
var _a, _b, _c2;
|
|
3451
|
+
const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
|
|
3452
3452
|
if (!at)
|
|
3453
3453
|
return;
|
|
3454
3454
|
const atRef = Editor.rangeRef(editor, at);
|
|
@@ -3469,7 +3469,7 @@ function clearDeviceActiveTypography(editor, currentDeviceId, options) {
|
|
|
3469
3469
|
for (const [node, path] of textNodes) {
|
|
3470
3470
|
if (Text.isText(node)) {
|
|
3471
3471
|
const typography = __spreadProps(__spreadValues({}, node.typography), {
|
|
3472
|
-
style: (
|
|
3472
|
+
style: (_c2 = (_b = node == null ? void 0 : node.typography) == null ? void 0 : _b.style.filter(({ deviceId }) => deviceId !== currentDeviceId)) != null ? _c2 : []
|
|
3473
3473
|
});
|
|
3474
3474
|
Transforms.setNodes(editor, {
|
|
3475
3475
|
typography
|
|
@@ -3482,8 +3482,8 @@ function clearDeviceActiveTypography(editor, currentDeviceId, options) {
|
|
|
3482
3482
|
}
|
|
3483
3483
|
function detachActiveTypography(editor, value, options) {
|
|
3484
3484
|
Editor.withoutNormalizing(editor, () => {
|
|
3485
|
-
var
|
|
3486
|
-
const at = (
|
|
3485
|
+
var _a;
|
|
3486
|
+
const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
|
|
3487
3487
|
if (!at)
|
|
3488
3488
|
return;
|
|
3489
3489
|
const atRef = Editor.rangeRef(editor, at);
|
|
@@ -3515,8 +3515,8 @@ function detachActiveTypography(editor, value, options) {
|
|
|
3515
3515
|
});
|
|
3516
3516
|
}
|
|
3517
3517
|
function setActiveTypographyId(editor, id, options) {
|
|
3518
|
-
var
|
|
3519
|
-
const at = (
|
|
3518
|
+
var _a;
|
|
3519
|
+
const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
|
|
3520
3520
|
if (!at)
|
|
3521
3521
|
return;
|
|
3522
3522
|
Transforms.setNodes(editor, {
|
|
@@ -3532,8 +3532,8 @@ function setActiveTypographyId(editor, id, options) {
|
|
|
3532
3532
|
}
|
|
3533
3533
|
function setActiveTypographyStyle(editor, breakpoints, deviceId, prop, value, options) {
|
|
3534
3534
|
Editor.withoutNormalizing(editor, () => {
|
|
3535
|
-
var
|
|
3536
|
-
const at = (
|
|
3535
|
+
var _a, _b, _c2;
|
|
3536
|
+
const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
|
|
3537
3537
|
if (!at)
|
|
3538
3538
|
return;
|
|
3539
3539
|
const atRef = Editor.rangeRef(editor, at);
|
|
@@ -3553,7 +3553,7 @@ function setActiveTypographyStyle(editor, breakpoints, deviceId, prop, value, op
|
|
|
3553
3553
|
}));
|
|
3554
3554
|
for (const [node, path] of textNodes) {
|
|
3555
3555
|
if (Text.isText(node)) {
|
|
3556
|
-
const deviceOverrides = (
|
|
3556
|
+
const deviceOverrides = (_c2 = (_b = node == null ? void 0 : node.typography) == null ? void 0 : _b.style) != null ? _c2 : [];
|
|
3557
3557
|
const deviceStyle = findBreakpointOverride(breakpoints, deviceOverrides, deviceId, (v) => v) || {
|
|
3558
3558
|
value: {}
|
|
3559
3559
|
};
|
|
@@ -3591,9 +3591,9 @@ const TYPOGRAPHY_KEY = "typography";
|
|
|
3591
3591
|
function withTypography(editor) {
|
|
3592
3592
|
const { normalizeNode } = editor;
|
|
3593
3593
|
editor.normalizeNode = (entry) => {
|
|
3594
|
-
var
|
|
3594
|
+
var _a, _b;
|
|
3595
3595
|
const [normalizationNode, normalizationPath] = entry;
|
|
3596
|
-
if (Text.isText(normalizationNode) && ((
|
|
3596
|
+
if (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) {
|
|
3597
3597
|
Transforms.unsetNodes(editor, TYPOGRAPHY_KEY, { at: normalizationPath });
|
|
3598
3598
|
return;
|
|
3599
3599
|
}
|
|
@@ -3700,13 +3700,31 @@ function InlineModePlugin() {
|
|
|
3700
3700
|
}))
|
|
3701
3701
|
});
|
|
3702
3702
|
}
|
|
3703
|
+
const minWidth = `${"Write some text...".length}ch`;
|
|
3703
3704
|
function InlineModePluginComponent(_f) {
|
|
3704
3705
|
var _g = _f, {
|
|
3705
3706
|
renderElement
|
|
3706
3707
|
} = _g, props = __objRest(_g, [
|
|
3707
3708
|
"renderElement"
|
|
3708
3709
|
]);
|
|
3709
|
-
|
|
3710
|
+
if (props.element.children.length === 1) {
|
|
3711
|
+
const text = props.element.children[0];
|
|
3712
|
+
if (Text.isText(text) && text.text === "") {
|
|
3713
|
+
return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({
|
|
3714
|
+
style: {
|
|
3715
|
+
display: "inline-block",
|
|
3716
|
+
minWidth
|
|
3717
|
+
}
|
|
3718
|
+
}, props.attributes), {
|
|
3719
|
+
children: renderElement(props)
|
|
3720
|
+
}));
|
|
3721
|
+
}
|
|
3722
|
+
}
|
|
3723
|
+
return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({
|
|
3724
|
+
style: {
|
|
3725
|
+
minWidth
|
|
3726
|
+
}
|
|
3727
|
+
}, props.attributes), {
|
|
3710
3728
|
children: renderElement(props)
|
|
3711
3729
|
}));
|
|
3712
3730
|
}
|
|
@@ -3720,7 +3738,7 @@ function RichText(config = {}) {
|
|
|
3720
3738
|
type: RichTextV2ControlType,
|
|
3721
3739
|
config: {
|
|
3722
3740
|
mode: config.mode,
|
|
3723
|
-
defaultValue: config == null ? void 0 : config.
|
|
3741
|
+
defaultValue: (config == null ? void 0 : config.mode) === RichTextV2Mode.Inline ? "Edit this text" : ipsum(3),
|
|
3724
3742
|
plugins: (config == null ? void 0 : config.mode) === RichTextV2Mode.Inline ? [InlineModePlugin()] : [BlockPlugin(), TypographyPlugin(), TextAlignPlugin(), InlinePlugin(), LinkPlugin()]
|
|
3725
3743
|
}
|
|
3726
3744
|
};
|
|
@@ -3746,7 +3764,7 @@ class RichTextV2Control extends PropController {
|
|
|
3746
3764
|
__publicField(this, "defaultValue", null);
|
|
3747
3765
|
__publicField(this, "descriptor");
|
|
3748
3766
|
__publicField(this, "recv", (message) => {
|
|
3749
|
-
var
|
|
3767
|
+
var _a, _b, _c2;
|
|
3750
3768
|
if (!this.editor)
|
|
3751
3769
|
return;
|
|
3752
3770
|
switch (message.type) {
|
|
@@ -3756,15 +3774,15 @@ class RichTextV2Control extends PropController {
|
|
|
3756
3774
|
}
|
|
3757
3775
|
case RichTextV2ControlMessageType.RESET_VALUE: {
|
|
3758
3776
|
if (this.defaultValue) {
|
|
3759
|
-
this.editor.
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3777
|
+
this.editor.resetValue(this.defaultValue);
|
|
3778
|
+
setTimeout(() => {
|
|
3779
|
+
this.onLocalUserChange();
|
|
3780
|
+
});
|
|
3763
3781
|
}
|
|
3764
3782
|
break;
|
|
3765
3783
|
}
|
|
3766
3784
|
case RichTextV2ControlMessageType.RUN_PLUGIN_CONTROL_ACTION: {
|
|
3767
|
-
(
|
|
3785
|
+
(_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);
|
|
3768
3786
|
break;
|
|
3769
3787
|
}
|
|
3770
3788
|
}
|
|
@@ -3773,14 +3791,14 @@ class RichTextV2Control extends PropController {
|
|
|
3773
3791
|
this.send = send;
|
|
3774
3792
|
}
|
|
3775
3793
|
setEditor(editor) {
|
|
3776
|
-
var
|
|
3794
|
+
var _a, _b, _c2;
|
|
3777
3795
|
this.editor = editor;
|
|
3778
3796
|
this.send({
|
|
3779
3797
|
type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
|
|
3780
|
-
value: (
|
|
3781
|
-
var
|
|
3782
|
-
return (
|
|
3783
|
-
})) != null ?
|
|
3798
|
+
value: (_c2 = (_b = (_a = this.descriptor.config) == null ? void 0 : _a.plugins) == null ? void 0 : _b.map((plugin) => {
|
|
3799
|
+
var _a2;
|
|
3800
|
+
return (_a2 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a2.getValue(editor);
|
|
3801
|
+
})) != null ? _c2 : []
|
|
3784
3802
|
});
|
|
3785
3803
|
const _onChange = editor.onChange;
|
|
3786
3804
|
this.editor.onChange = (options) => {
|
|
@@ -3807,16 +3825,16 @@ class RichTextV2Control extends PropController {
|
|
|
3807
3825
|
});
|
|
3808
3826
|
}
|
|
3809
3827
|
updatePluginValues() {
|
|
3810
|
-
var
|
|
3828
|
+
var _a, _b, _c2;
|
|
3811
3829
|
const editor = this.editor;
|
|
3812
3830
|
if (editor == null)
|
|
3813
3831
|
return;
|
|
3814
3832
|
this.send({
|
|
3815
3833
|
type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
|
|
3816
|
-
value: (
|
|
3817
|
-
var
|
|
3818
|
-
return (
|
|
3819
|
-
})) != null ?
|
|
3834
|
+
value: (_c2 = (_b = (_a = this.descriptor.config) == null ? void 0 : _a.plugins) == null ? void 0 : _b.map((plugin) => {
|
|
3835
|
+
var _a2;
|
|
3836
|
+
return (_a2 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a2.getValue(editor);
|
|
3837
|
+
})) != null ? _c2 : []
|
|
3820
3838
|
});
|
|
3821
3839
|
}
|
|
3822
3840
|
select() {
|
|
@@ -3838,6 +3856,171 @@ class RichTextV2Control extends PropController {
|
|
|
3838
3856
|
function isRichTextV1Data(value) {
|
|
3839
3857
|
return value !== void 0 && typeof value === "object" && !Array.isArray(value) && "document" in value;
|
|
3840
3858
|
}
|
|
3859
|
+
function richTextV2DataToDescendents(data) {
|
|
3860
|
+
return data.descendants;
|
|
3861
|
+
}
|
|
3862
|
+
function richTextV2DescendentsToData(descendants, key) {
|
|
3863
|
+
return {
|
|
3864
|
+
type: RichTextV2ControlType,
|
|
3865
|
+
version: 2,
|
|
3866
|
+
descendants,
|
|
3867
|
+
key: key != null ? key : v4()
|
|
3868
|
+
};
|
|
3869
|
+
}
|
|
3870
|
+
function copyRichTextV2Data(data, context) {
|
|
3871
|
+
var _a;
|
|
3872
|
+
if (data == null)
|
|
3873
|
+
return data;
|
|
3874
|
+
return richTextV2DescendentsToData((_a = data.descendants) == null ? void 0 : _a.flatMap((d) => copyNode(d)));
|
|
3875
|
+
function copyNode(descendant) {
|
|
3876
|
+
if (Element.isElement(descendant) && ElementUtils.isInline(descendant)) {
|
|
3877
|
+
return copyLinkData2(descendant);
|
|
3878
|
+
}
|
|
3879
|
+
if (Text.isText(descendant)) {
|
|
3880
|
+
return copyTypographyData(descendant);
|
|
3881
|
+
}
|
|
3882
|
+
return __spreadProps(__spreadValues({}, descendant), { children: descendant.children.map(copyNode) });
|
|
3883
|
+
}
|
|
3884
|
+
function copyLinkData2(descendant) {
|
|
3885
|
+
var _a2, _b;
|
|
3886
|
+
if (descendant.type !== "link") {
|
|
3887
|
+
return __spreadProps(__spreadValues({}, descendant), { children: descendant.children.map(copyNode) });
|
|
3888
|
+
}
|
|
3889
|
+
if (descendant.link == null)
|
|
3890
|
+
return descendant;
|
|
3891
|
+
switch (descendant.link.type) {
|
|
3892
|
+
case "OPEN_PAGE": {
|
|
3893
|
+
const pageId = descendant.link.payload.pageId;
|
|
3894
|
+
if (pageId == null)
|
|
3895
|
+
return descendant;
|
|
3896
|
+
return __spreadProps(__spreadValues({}, descendant), {
|
|
3897
|
+
link: __spreadProps(__spreadValues({}, descendant.link), {
|
|
3898
|
+
payload: __spreadProps(__spreadValues({}, descendant.link.payload), {
|
|
3899
|
+
pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : descendant.link.payload.pageId
|
|
3900
|
+
})
|
|
3901
|
+
}),
|
|
3902
|
+
children: descendant.children.map(copyNode)
|
|
3903
|
+
});
|
|
3904
|
+
}
|
|
3905
|
+
case "SCROLL_TO_ELEMENT": {
|
|
3906
|
+
const elementIdConfig = descendant.link.payload.elementIdConfig;
|
|
3907
|
+
if (elementIdConfig == null)
|
|
3908
|
+
return descendant;
|
|
3909
|
+
return __spreadProps(__spreadValues({}, descendant), {
|
|
3910
|
+
link: __spreadProps(__spreadValues({}, descendant.link), {
|
|
3911
|
+
payload: __spreadProps(__spreadValues({}, descendant.link.payload), {
|
|
3912
|
+
elementIdConfig: __spreadProps(__spreadValues({}, elementIdConfig), {
|
|
3913
|
+
elementKey: (_b = context.replacementContext.elementKeys.get(elementIdConfig.elementKey)) != null ? _b : elementIdConfig.elementKey
|
|
3914
|
+
})
|
|
3915
|
+
})
|
|
3916
|
+
}),
|
|
3917
|
+
children: descendant.children.map(copyNode)
|
|
3918
|
+
});
|
|
3919
|
+
}
|
|
3920
|
+
default:
|
|
3921
|
+
return descendant;
|
|
3922
|
+
}
|
|
3923
|
+
}
|
|
3924
|
+
function copyTypographyData(descendant) {
|
|
3925
|
+
var _a2, _b, _c2, _d, _e;
|
|
3926
|
+
return __spreadValues(__spreadValues({}, descendant), descendant.typography == null ? {} : {
|
|
3927
|
+
typography: {
|
|
3928
|
+
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,
|
|
3929
|
+
style: (_e = descendant.typography) == null ? void 0 : _e.style.map((override) => {
|
|
3930
|
+
var _a3, _b2, _c3, _d2;
|
|
3931
|
+
return __spreadProps(__spreadValues({}, override), {
|
|
3932
|
+
value: __spreadValues(__spreadValues({}, override.value), override.value.color == null ? {} : {
|
|
3933
|
+
color: __spreadProps(__spreadValues({}, override.value.color), {
|
|
3934
|
+
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
|
|
3935
|
+
})
|
|
3936
|
+
})
|
|
3937
|
+
});
|
|
3938
|
+
})
|
|
3939
|
+
}
|
|
3940
|
+
});
|
|
3941
|
+
}
|
|
3942
|
+
}
|
|
3943
|
+
function copy(definition2, value, context) {
|
|
3944
|
+
switch (definition2.type) {
|
|
3945
|
+
case Types.Backgrounds:
|
|
3946
|
+
case Types.Grid:
|
|
3947
|
+
case Types.NavigationLinks:
|
|
3948
|
+
case Types.Link:
|
|
3949
|
+
case Types.Shadows:
|
|
3950
|
+
case Types.Image:
|
|
3951
|
+
case Types.Images:
|
|
3952
|
+
case Types.ResponsiveColor:
|
|
3953
|
+
case Types.TableFormFields:
|
|
3954
|
+
case Types.Table:
|
|
3955
|
+
case Types.Border:
|
|
3956
|
+
case Types.RichText:
|
|
3957
|
+
case Types.ElementID:
|
|
3958
|
+
return copy$1(definition2, value, context);
|
|
3959
|
+
case RichTextControlType:
|
|
3960
|
+
return copyRichTextData(value, context);
|
|
3961
|
+
case RichTextV2ControlType:
|
|
3962
|
+
return copyRichTextV2Data(isRichTextV1Data(value) ? richTextV2DescendentsToData(richTextDTOtoDAO(value)) : value, context);
|
|
3963
|
+
case ColorControlType:
|
|
3964
|
+
return copyColorData(value, context);
|
|
3965
|
+
case ImageControlType:
|
|
3966
|
+
return copyImageData(value, context);
|
|
3967
|
+
case LinkControlType:
|
|
3968
|
+
return copyLinkData(value, context);
|
|
3969
|
+
case ShapeControlType:
|
|
3970
|
+
return copyShapeData(definition2, value, context);
|
|
3971
|
+
case ListControlType:
|
|
3972
|
+
return copyListData(definition2, value, context);
|
|
3973
|
+
case StyleControlType:
|
|
3974
|
+
return copyStyleData(value, context);
|
|
3975
|
+
case SlotControlType:
|
|
3976
|
+
return copySlotData(value, context);
|
|
3977
|
+
default:
|
|
3978
|
+
return value;
|
|
3979
|
+
}
|
|
3980
|
+
}
|
|
3981
|
+
function merge(definition2, a, b = a, context) {
|
|
3982
|
+
switch (definition2.type) {
|
|
3983
|
+
case SlotControlType:
|
|
3984
|
+
return mergeSlotData(a, b, context);
|
|
3985
|
+
default:
|
|
3986
|
+
return b;
|
|
3987
|
+
}
|
|
3988
|
+
}
|
|
3989
|
+
const StyleV2ControlType = "makeswift::controls::style-v2";
|
|
3990
|
+
const unstable_useStyleV2ClassName = useStyle;
|
|
3991
|
+
function unstable_StyleV2(config) {
|
|
3992
|
+
return { type: StyleV2ControlType, config };
|
|
3993
|
+
}
|
|
3994
|
+
const StyleV2ControlMessageType = {
|
|
3995
|
+
CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model",
|
|
3996
|
+
STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE: "makeswift::controls::style-v2::message::child-control-message"
|
|
3997
|
+
};
|
|
3998
|
+
class StyleV2Control extends PropController {
|
|
3999
|
+
constructor(send, descriptor) {
|
|
4000
|
+
super(send);
|
|
4001
|
+
__publicField(this, "control");
|
|
4002
|
+
this.control = createPropController(descriptor.config.type, (message) => {
|
|
4003
|
+
this.send({
|
|
4004
|
+
type: StyleV2ControlMessageType.STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE,
|
|
4005
|
+
payload: { message }
|
|
4006
|
+
});
|
|
4007
|
+
});
|
|
4008
|
+
}
|
|
4009
|
+
changeBoxModel(boxModel) {
|
|
4010
|
+
this.send({ type: StyleV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
|
|
4011
|
+
}
|
|
4012
|
+
recv(message) {
|
|
4013
|
+
switch (message.type) {
|
|
4014
|
+
case StyleV2ControlMessageType.STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE: {
|
|
4015
|
+
const control = this.control;
|
|
4016
|
+
if (control == null)
|
|
4017
|
+
return;
|
|
4018
|
+
const recv = control.recv;
|
|
4019
|
+
recv(message.payload.message);
|
|
4020
|
+
}
|
|
4021
|
+
}
|
|
4022
|
+
}
|
|
4023
|
+
}
|
|
3841
4024
|
const TypographyControlType = "makeswift::controls::typography";
|
|
3842
4025
|
function unstable_Typography() {
|
|
3843
4026
|
return {
|
|
@@ -3845,11 +4028,11 @@ function unstable_Typography() {
|
|
|
3845
4028
|
};
|
|
3846
4029
|
}
|
|
3847
4030
|
function getTypographySwatchIds(value) {
|
|
3848
|
-
var
|
|
3849
|
-
return (
|
|
3850
|
-
var
|
|
3851
|
-
return (_b = (
|
|
3852
|
-
}).filter(isNonNullable)) != null ?
|
|
4031
|
+
var _a;
|
|
4032
|
+
return (_a = value == null ? void 0 : value.style.flatMap((style) => {
|
|
4033
|
+
var _a2, _b;
|
|
4034
|
+
return (_b = (_a2 = style.value.color) == null ? void 0 : _a2.swatchId) != null ? _b : [];
|
|
4035
|
+
}).filter(isNonNullable)) != null ? _a : [];
|
|
3853
4036
|
}
|
|
3854
4037
|
function getTypographyTypographyIds(value) {
|
|
3855
4038
|
return [value == null ? void 0 : value.id].filter(isNonNullable);
|
|
@@ -3859,28 +4042,28 @@ function getRichTextSwatchIds(value) {
|
|
|
3859
4042
|
return [];
|
|
3860
4043
|
return getNodeSwatchIds(value.document);
|
|
3861
4044
|
function getNodeSwatchIds(node) {
|
|
3862
|
-
var
|
|
4045
|
+
var _a, _b, _c2, _d;
|
|
3863
4046
|
switch (node.object) {
|
|
3864
4047
|
case "document":
|
|
3865
4048
|
case "block":
|
|
3866
4049
|
case "inline":
|
|
3867
|
-
return (_b = (
|
|
4050
|
+
return (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(getNodeSwatchIds)) != null ? _b : [];
|
|
3868
4051
|
case "text":
|
|
3869
|
-
return (_d = (
|
|
4052
|
+
return (_d = (_c2 = node.marks) == null ? void 0 : _c2.flatMap(getMarkSwatchIds)) != null ? _d : [];
|
|
3870
4053
|
default:
|
|
3871
4054
|
return [];
|
|
3872
4055
|
}
|
|
3873
4056
|
}
|
|
3874
4057
|
function getTypographyStyleSwatchIds(style) {
|
|
3875
|
-
var
|
|
3876
|
-
return (
|
|
3877
|
-
var
|
|
3878
|
-
return (
|
|
3879
|
-
}).filter(isNonNullable)) != null ?
|
|
4058
|
+
var _a;
|
|
4059
|
+
return (_a = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
|
|
4060
|
+
var _a2;
|
|
4061
|
+
return (_a2 = typographyStyle.color) == null ? void 0 : _a2.swatchId;
|
|
4062
|
+
}).filter(isNonNullable)) != null ? _a : [];
|
|
3880
4063
|
}
|
|
3881
4064
|
function getMarkSwatchIds(mark) {
|
|
3882
|
-
var
|
|
3883
|
-
return getTypographyStyleSwatchIds((_b = (
|
|
4065
|
+
var _a, _b;
|
|
4066
|
+
return getTypographyStyleSwatchIds((_b = (_a = mark.data) == null ? void 0 : _a.value) == null ? void 0 : _b.style);
|
|
3884
4067
|
}
|
|
3885
4068
|
}
|
|
3886
4069
|
function getRichTextTypographyIds(value) {
|
|
@@ -3888,21 +4071,21 @@ function getRichTextTypographyIds(value) {
|
|
|
3888
4071
|
return [];
|
|
3889
4072
|
return getNodeSwatchIds(value.document);
|
|
3890
4073
|
function getNodeSwatchIds(node) {
|
|
3891
|
-
var
|
|
4074
|
+
var _a, _b, _c2, _d;
|
|
3892
4075
|
switch (node.object) {
|
|
3893
4076
|
case "document":
|
|
3894
4077
|
case "block":
|
|
3895
4078
|
case "inline":
|
|
3896
|
-
return (_b = (
|
|
4079
|
+
return (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(getNodeSwatchIds)) != null ? _b : [];
|
|
3897
4080
|
case "text":
|
|
3898
|
-
return (_d = (
|
|
4081
|
+
return (_d = (_c2 = node.marks) == null ? void 0 : _c2.flatMap(getMarkSwatchIds)) != null ? _d : [];
|
|
3899
4082
|
default:
|
|
3900
4083
|
return [];
|
|
3901
4084
|
}
|
|
3902
4085
|
}
|
|
3903
4086
|
function getMarkSwatchIds(mark) {
|
|
3904
|
-
var
|
|
3905
|
-
return [(_b = (
|
|
4087
|
+
var _a, _b;
|
|
4088
|
+
return [(_b = (_a = mark.data) == null ? void 0 : _a.value) == null ? void 0 : _b.id].filter(isNonNullable);
|
|
3906
4089
|
}
|
|
3907
4090
|
}
|
|
3908
4091
|
function getRichTextPageIds(value) {
|
|
@@ -3910,11 +4093,11 @@ function getRichTextPageIds(value) {
|
|
|
3910
4093
|
return [];
|
|
3911
4094
|
return getNodePageIds(value.document);
|
|
3912
4095
|
function getNodePageIds(node) {
|
|
3913
|
-
var
|
|
4096
|
+
var _a, _b;
|
|
3914
4097
|
switch (node.object) {
|
|
3915
4098
|
case "document":
|
|
3916
4099
|
case "block":
|
|
3917
|
-
return (_b = (
|
|
4100
|
+
return (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(getNodePageIds)) != null ? _b : [];
|
|
3918
4101
|
case "inline":
|
|
3919
4102
|
return getInlinePageIds(node);
|
|
3920
4103
|
default:
|
|
@@ -3922,15 +4105,15 @@ function getRichTextPageIds(value) {
|
|
|
3922
4105
|
}
|
|
3923
4106
|
}
|
|
3924
4107
|
function getInlinePageIds(inline) {
|
|
3925
|
-
var
|
|
4108
|
+
var _a, _b, _c2, _d;
|
|
3926
4109
|
switch (inline.type) {
|
|
3927
4110
|
case "link": {
|
|
3928
|
-
const nodePageIds = (_b = (
|
|
4111
|
+
const nodePageIds = (_b = (_a = inline.nodes) == null ? void 0 : _a.flatMap(getNodePageIds)) != null ? _b : [];
|
|
3929
4112
|
const dataPageIds = inline.data ? getLinkDataPageIds(inline.data) : [];
|
|
3930
4113
|
return [...nodePageIds, ...dataPageIds];
|
|
3931
4114
|
}
|
|
3932
4115
|
default:
|
|
3933
|
-
return (_d = (
|
|
4116
|
+
return (_d = (_c2 = inline.nodes) == null ? void 0 : _c2.flatMap(getNodePageIds)) != null ? _d : [];
|
|
3934
4117
|
}
|
|
3935
4118
|
}
|
|
3936
4119
|
function getLinkDataPageIds(link) {
|
|
@@ -3958,18 +4141,18 @@ function introspectRichTextV2Data(definition2, data, func) {
|
|
|
3958
4141
|
return [];
|
|
3959
4142
|
}
|
|
3960
4143
|
function getElementTypographyIds(descendant) {
|
|
3961
|
-
var
|
|
3962
|
-
return (
|
|
3963
|
-
var
|
|
3964
|
-
return ((
|
|
3965
|
-
})) != null ?
|
|
4144
|
+
var _a;
|
|
4145
|
+
return (_a = plugins == null ? void 0 : plugins.flatMap((plugin) => {
|
|
4146
|
+
var _a2;
|
|
4147
|
+
return ((_a2 = plugin.control) == null ? void 0 : _a2.definition) && plugin.control.getElementValue ? func(plugin.control.definition, plugin.control.getElementValue(descendant)) : [];
|
|
4148
|
+
})) != null ? _a : [];
|
|
3966
4149
|
}
|
|
3967
4150
|
function getTextTypographyIds(text) {
|
|
3968
|
-
var
|
|
3969
|
-
return (
|
|
3970
|
-
var
|
|
3971
|
-
return ((
|
|
3972
|
-
})) != 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.getLeafValue ? func(plugin.control.definition, plugin.control.getLeafValue(text)) : [];
|
|
4155
|
+
})) != null ? _a : [];
|
|
3973
4156
|
}
|
|
3974
4157
|
}
|
|
3975
4158
|
function getRichTextV2SwatchIds(definition2, data) {
|
|
@@ -4018,44 +4201,44 @@ function getElementId$1(descriptor, prop) {
|
|
|
4018
4201
|
}
|
|
4019
4202
|
}
|
|
4020
4203
|
function getBackgroundsSwatchIds(value) {
|
|
4021
|
-
var
|
|
4022
|
-
return (
|
|
4023
|
-
var
|
|
4204
|
+
var _a;
|
|
4205
|
+
return (_a = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
|
|
4206
|
+
var _a2;
|
|
4024
4207
|
switch (backgroundItem.type) {
|
|
4025
4208
|
case "color":
|
|
4026
|
-
return ((
|
|
4209
|
+
return ((_a2 = backgroundItem.payload) == null ? void 0 : _a2.swatchId) == null ? [] : [backgroundItem.payload.swatchId];
|
|
4027
4210
|
case "gradient":
|
|
4028
4211
|
return backgroundItem.payload.stops.flatMap((stop) => stop.color == null ? [] : stop.color.swatchId);
|
|
4029
4212
|
default:
|
|
4030
4213
|
return [];
|
|
4031
4214
|
}
|
|
4032
|
-
})) != null ?
|
|
4215
|
+
})) != null ? _a : [];
|
|
4033
4216
|
}
|
|
4034
4217
|
function getBorderSwatchIds(value) {
|
|
4035
|
-
var
|
|
4036
|
-
return (
|
|
4037
|
-
var
|
|
4218
|
+
var _a;
|
|
4219
|
+
return (_a = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((borderValue) => {
|
|
4220
|
+
var _a2, _b, _c2, _d, _e, _f, _g, _h;
|
|
4038
4221
|
return [
|
|
4039
|
-
(_b = (
|
|
4040
|
-
(_d = (
|
|
4222
|
+
(_b = (_a2 = borderValue.borderTop) == null ? void 0 : _a2.color) == null ? void 0 : _b.swatchId,
|
|
4223
|
+
(_d = (_c2 = borderValue.borderRight) == null ? void 0 : _c2.color) == null ? void 0 : _d.swatchId,
|
|
4041
4224
|
(_f = (_e = borderValue.borderBottom) == null ? void 0 : _e.color) == null ? void 0 : _f.swatchId,
|
|
4042
4225
|
(_h = (_g = borderValue.borderLeft) == null ? void 0 : _g.color) == null ? void 0 : _h.swatchId
|
|
4043
4226
|
].filter((swatchId) => swatchId != null);
|
|
4044
|
-
})) != null ?
|
|
4227
|
+
})) != null ? _a : [];
|
|
4045
4228
|
}
|
|
4046
4229
|
function getBoxShadowsSwatchIds(value) {
|
|
4047
|
-
var
|
|
4048
|
-
return (
|
|
4049
|
-
var
|
|
4050
|
-
return (
|
|
4051
|
-
}).filter((swatchId) => swatchId != null)) != null ?
|
|
4230
|
+
var _a;
|
|
4231
|
+
return (_a = value == null ? void 0 : value.flatMap((override) => override.value).map((item) => {
|
|
4232
|
+
var _a2;
|
|
4233
|
+
return (_a2 = item.payload.color) == null ? void 0 : _a2.swatchId;
|
|
4234
|
+
}).filter((swatchId) => swatchId != null)) != null ? _a : [];
|
|
4052
4235
|
}
|
|
4053
4236
|
function getResponsiveColorSwatchIds(value) {
|
|
4054
|
-
var
|
|
4055
|
-
return (
|
|
4237
|
+
var _a;
|
|
4238
|
+
return (_a = value == null ? void 0 : value.map((override) => override.value).map((color) => color.swatchId)) != null ? _a : [];
|
|
4056
4239
|
}
|
|
4057
4240
|
function getSwatchIds(descriptor, prop) {
|
|
4058
|
-
var
|
|
4241
|
+
var _a, _b;
|
|
4059
4242
|
if (prop == null)
|
|
4060
4243
|
return [];
|
|
4061
4244
|
switch (descriptor.type) {
|
|
@@ -4065,17 +4248,17 @@ function getSwatchIds(descriptor, prop) {
|
|
|
4065
4248
|
return getBorderSwatchIds(prop);
|
|
4066
4249
|
case Types.NavigationLinks: {
|
|
4067
4250
|
const value = prop;
|
|
4068
|
-
return (
|
|
4069
|
-
var
|
|
4251
|
+
return (_a = value == null ? void 0 : value.flatMap((item) => {
|
|
4252
|
+
var _a2, _b2, _c2, _d;
|
|
4070
4253
|
switch (item.type) {
|
|
4071
4254
|
case "button":
|
|
4072
4255
|
case "dropdown":
|
|
4073
4256
|
return [
|
|
4074
|
-
...(_b2 = (
|
|
4075
|
-
...(_d = (
|
|
4257
|
+
...(_b2 = (_a2 = item.payload.color) == null ? void 0 : _a2.map((override) => override.value).map((color) => color.swatchId)) != null ? _b2 : [],
|
|
4258
|
+
...(_d = (_c2 = item.payload.textColor) == null ? void 0 : _c2.map((override) => override.value).map((color) => color.swatchId)) != null ? _d : []
|
|
4076
4259
|
];
|
|
4077
4260
|
}
|
|
4078
|
-
})) != null ?
|
|
4261
|
+
})) != null ? _a : [];
|
|
4079
4262
|
}
|
|
4080
4263
|
case Types.ResponsiveColor:
|
|
4081
4264
|
return getResponsiveColorSwatchIds(prop);
|
|
@@ -4119,18 +4302,18 @@ function getSwatchIds(descriptor, prop) {
|
|
|
4119
4302
|
}
|
|
4120
4303
|
}
|
|
4121
4304
|
function getBackgroundsFileIds(value) {
|
|
4122
|
-
var
|
|
4123
|
-
return (
|
|
4305
|
+
var _a;
|
|
4306
|
+
return (_a = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
|
|
4124
4307
|
switch (backgroundItem.type) {
|
|
4125
4308
|
case "image":
|
|
4126
4309
|
return [backgroundItem.payload.imageId];
|
|
4127
4310
|
default:
|
|
4128
4311
|
return [];
|
|
4129
4312
|
}
|
|
4130
|
-
})) != null ?
|
|
4313
|
+
})) != null ? _a : [];
|
|
4131
4314
|
}
|
|
4132
4315
|
function getFileIds(descriptor, prop) {
|
|
4133
|
-
var
|
|
4316
|
+
var _a;
|
|
4134
4317
|
if (prop == null)
|
|
4135
4318
|
return [];
|
|
4136
4319
|
switch (descriptor.type) {
|
|
@@ -4142,7 +4325,7 @@ function getFileIds(descriptor, prop) {
|
|
|
4142
4325
|
}
|
|
4143
4326
|
case Types.Images: {
|
|
4144
4327
|
const value = prop;
|
|
4145
|
-
return (
|
|
4328
|
+
return (_a = value == null ? void 0 : value.flatMap((item) => item.props.file == null ? [] : [item.props.file])) != null ? _a : [];
|
|
4146
4329
|
}
|
|
4147
4330
|
case ImageControlType: {
|
|
4148
4331
|
const value = prop;
|
|
@@ -4210,7 +4393,7 @@ function getTableIds(descriptor, prop) {
|
|
|
4210
4393
|
}
|
|
4211
4394
|
}
|
|
4212
4395
|
function getPageIds(descriptor, prop) {
|
|
4213
|
-
var
|
|
4396
|
+
var _a;
|
|
4214
4397
|
if (prop == null)
|
|
4215
4398
|
return [];
|
|
4216
4399
|
switch (descriptor.type) {
|
|
@@ -4240,8 +4423,8 @@ function getPageIds(descriptor, prop) {
|
|
|
4240
4423
|
const value = prop;
|
|
4241
4424
|
if (value == null)
|
|
4242
4425
|
return [];
|
|
4243
|
-
return (
|
|
4244
|
-
var
|
|
4426
|
+
return (_a = value == null ? void 0 : value.flatMap((item) => {
|
|
4427
|
+
var _a2, _b;
|
|
4245
4428
|
switch (item.type) {
|
|
4246
4429
|
case "button": {
|
|
4247
4430
|
if (item.payload.link == null)
|
|
@@ -4254,7 +4437,7 @@ function getPageIds(descriptor, prop) {
|
|
|
4254
4437
|
}
|
|
4255
4438
|
}
|
|
4256
4439
|
case "dropdown": {
|
|
4257
|
-
return (_b = (
|
|
4440
|
+
return (_b = (_a2 = item.payload.links) == null ? void 0 : _a2.flatMap((link) => {
|
|
4258
4441
|
if (link.payload.link == null)
|
|
4259
4442
|
return [];
|
|
4260
4443
|
switch (link.payload.link.type) {
|
|
@@ -4266,7 +4449,7 @@ function getPageIds(descriptor, prop) {
|
|
|
4266
4449
|
})) != null ? _b : [];
|
|
4267
4450
|
}
|
|
4268
4451
|
}
|
|
4269
|
-
})) != null ?
|
|
4452
|
+
})) != null ? _a : [];
|
|
4270
4453
|
}
|
|
4271
4454
|
case RichTextControlType:
|
|
4272
4455
|
case Types.RichText: {
|
|
@@ -4384,14 +4567,14 @@ function getDocumentKeysSortedByDepth(state) {
|
|
|
4384
4567
|
elements.set(key, getDocumentElements(state, key));
|
|
4385
4568
|
});
|
|
4386
4569
|
keys.sort((a, b) => {
|
|
4387
|
-
var
|
|
4388
|
-
return ((
|
|
4570
|
+
var _a;
|
|
4571
|
+
return ((_a = elements.get(a)) == null ? void 0 : _a.has(b)) ? -1 : 1;
|
|
4389
4572
|
});
|
|
4390
4573
|
return keys;
|
|
4391
4574
|
}
|
|
4392
4575
|
function getElement(state, documentKey, elementKey) {
|
|
4393
|
-
var
|
|
4394
|
-
return (
|
|
4576
|
+
var _a;
|
|
4577
|
+
return (_a = getDocumentElements(state, documentKey).get(elementKey)) != null ? _a : null;
|
|
4395
4578
|
}
|
|
4396
4579
|
function getElementPropControllerDescriptors(state, documentKey, elementKey) {
|
|
4397
4580
|
const element = getElement(state, documentKey, elementKey);
|
|
@@ -4480,5 +4663,5 @@ function configureStore({
|
|
|
4480
4663
|
locales: getInitialState(locales != null ? locales : preloadedState == null ? void 0 : preloadedState.locales)
|
|
4481
4664
|
}), applyMiddleware(thunk));
|
|
4482
4665
|
}
|
|
4483
|
-
export {
|
|
4666
|
+
export { getBoxShadowsSwatchIds as $, ResponsiveLength as A, Backgrounds as B, ComponentIcon as C, Date as D, ElementID as E, Font as F, GapY as G, TextArea as H, Images as I, Table as J, TableFormFields as K, Link$1 as L, Margin as M, Number as N, Image$1 as O, Padding as P, ResponsiveOpacity as Q, RichTextPropControllerMessageType as R, Shadows as S, TableFormFieldsMessageType as T, NavigationLinks as U, SocialLinks as V, Width as W, RichText as X, Video as Y, useStyle as Z, getBorderSwatchIds as _, deepEqual as a, copyShapeData as a$, getResponsiveColorSwatchIds as a0, StyleControlProperty as a1, ImageControlValueFormat as a2, isPropControllersHandle as a3, isRichTextV1Data as a4, isNonNullable as a5, TypographyControlType as a6, StyleControlType as a7, RichTextV2ControlType as a8, RichTextControlType as a9, getBuilderEditMode as aA, getIsPreview as aB, getBackgroundsFileIds as aC, getBackgroundsSwatchIds as aD, Color as aE, copyColorData as aF, copy as aG, merge as aH, unstable_IconRadioGroupIcon as aI, unstable_IconRadioGroup as aJ, Image as aK, copyImageData as aL, Link as aM, copyLinkData as aN, List as aO, ListControlMessageType as aP, ListControl as aQ, copyListData as aR, getListElementChildren as aS, getListSwatchIds as aT, getListFileIds as aU, getListTypographyIds as aV, getListPageIds as aW, Select as aX, Shape as aY, ShapeControlMessageType as aZ, ShapeControl as a_, SlotControlType as aa, StyleV2ControlType as ab, ListControlType as ac, ShapeControlType as ad, LinkControlType as ae, ImageControlType as af, IconRadioGroupControlType as ag, ColorControlType as ah, SelectControlType as ai, getComponentPropControllerDescriptors as aj, getPropControllers as ak, Types as al, BorderPropControllerFormat as am, ShadowsPropControllerFormat as an, BorderRadiusPropControllerFormat as ao, MarginPropControllerFormat as ap, PaddingPropControllerFormat as aq, WidthPropControllerFormat as ar, configureStore as as, copyElementTree as at, getBreakpoints as au, parseLocalesInput as av, getDocument as aw, getElementId as ax, getIsInBuilder as ay, getReactComponent as az, createDocumentReference as b, BuilderEditMode as b$, getShapeElementChildren as b0, getShapeSwatchIds as b1, getShapeTypographyIds as b2, getShapePageIds as b3, getShapeFileIds as b4, Slot as b5, SlotControlMessageType as b6, SlotControl as b7, copySlotData as b8, mergeSlotData as b9, TYPOGRAPHY_KEY as bA, withTypography as bB, TypographyPlugin as bC, BlockActions as bD, ListActions as bE, onKeyDown as bF, withBlock as bG, BlockPlugin as bH, withInlineMode as bI, InlineModePlugin as bJ, withTextAlign as bK, TextAlignPlugin as bL, RootBlockType as bM, BlockType as bN, InlineType as bO, BlockTextAlignment as bP, withInline as bQ, InlinePlugin as bR, ElementUtils as bS, onChange$1 as bT, getValue$3 as bU, isLinkElement as bV, getInitialState$7 as bW, reducer$8 as bX, getDocument$1 as bY, getComponentsMeta as bZ, getComponentPropControllerDescriptors$1 as b_, Style as ba, StyleControlMessageType as bb, StyleControl as bc, copyStyleData as bd, unstable_useStyleV2ClassName as be, unstable_StyleV2 as bf, StyleV2ControlMessageType as bg, StyleV2Control as bh, copyRichTextData as bi, ObjectType as bj, RichTextControlMessageType as bk, RichTextControl as bl, richTextDTOtoSelection as bm, richTextDTOtoDAO as bn, toSelectionDTO as bo, richTextDAOToDTO as bp, RichTextV2Mode as bq, RichTextV2ControlMessageType as br, RichTextV2Control as bs, richTextV2DataToDescendents as bt, richTextV2DescendentsToData as bu, createRichTextV2Plugin as bv, unstable_Typography as bw, getTypographySwatchIds as bx, getTypographyTypographyIds as by, TypographyActions as bz, createDocument as c, getDocumentKeysSortedByDepth as c0, getPropController as c1, getPropControllersHandle as c2, getElement as c3, getElementPropControllerDescriptors as c4, createPropController as c5, reducer$7 as c6, reducer$9 as c7, reducer$6 as c8, reducer$5 as c9, reducer$4 as ca, reducer$3 as cb, reducer$2 as cc, reducer$1 as cd, getInitialState$2 as ce, descriptors as d, isElementReference as e, getDefaultLocale as f, getPropControllerDescriptors as g, getLocales as h, introspection as i, getSwatchIds as j, getFileIds as k, getTypographyIds as l, getTableIds as m, getPageIds as n, getElementChildren as o, ResponsiveIconRadioGroup as p, Border as q, BorderRadius as r, GapX as s, ResponsiveSelect as t, ResponsiveNumber as u, Checkbox as v, Grid as w, TextInput as x, ResponsiveColor as y, TextStyle as z };
|
|
4484
4667
|
//# sourceMappingURL=react-page.es.js.map
|