@makeswift/runtime 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Box.cjs.js +15 -14
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +10 -9
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +12 -11
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +10 -9
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +26 -25
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +5 -4
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +15 -14
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +7 -6
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +12 -11
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +10 -9
- package/dist/Divider.es.js.map +1 -1
- package/dist/Embed.cjs.js +4 -29
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +3 -28
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +51 -50
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +7 -6
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +8 -7
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +7 -6
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +4 -3
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +6 -5
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +26 -25
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +5 -4
- package/dist/Navigation.es.js.map +1 -1
- package/dist/PreviewProvider.cjs.js +6 -5
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +6 -5
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +14 -13
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +9 -8
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +11 -10
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +7 -6
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +7 -6
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +5 -4
- package/dist/Root.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +14 -13
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +10 -9
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Text.cjs.js +4 -3
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +5 -4
- package/dist/Text.es.js.map +1 -1
- package/dist/Video.cjs.js +4 -29
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +3 -28
- package/dist/Video.es.js.map +1 -1
- package/dist/builder.cjs.js +5 -0
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +5 -0
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +9 -8
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +9 -8
- package/dist/components.es.js.map +1 -1
- package/dist/control-serialization.cjs.js +88 -9
- package/dist/control-serialization.cjs.js.map +1 -1
- package/dist/control-serialization.es.js +89 -10
- package/dist/control-serialization.es.js.map +1 -1
- package/dist/controls.cjs.js +10 -0
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +6 -1
- package/dist/controls.es.js.map +1 -1
- package/dist/deepEqual.cjs.js +40 -0
- package/dist/deepEqual.cjs.js.map +1 -0
- package/dist/deepEqual.es.js +39 -0
- package/dist/deepEqual.es.js.map +1 -0
- package/dist/index.cjs.js +62 -91
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs10.js +8 -7
- package/dist/index.cjs10.js.map +1 -1
- package/dist/index.cjs2.js +13 -13
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs4.js +2 -1
- package/dist/index.cjs4.js.map +1 -1
- package/dist/index.cjs8.js +4 -3
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.cjs9.js +69 -105
- package/dist/index.cjs9.js.map +1 -1
- package/dist/index.es.js +47 -75
- package/dist/index.es.js.map +1 -1
- package/dist/index.es10.js +5 -4
- package/dist/index.es10.js.map +1 -1
- package/dist/index.es2.js +2 -2
- package/dist/index.es3.js +1 -1
- package/dist/index.es4.js +2 -1
- package/dist/index.es4.js.map +1 -1
- package/dist/index.es6.js +1 -1
- package/dist/index.es8.js +4 -3
- package/dist/index.es8.js.map +1 -1
- package/dist/index.es9.js +71 -107
- package/dist/index.es9.js.map +1 -1
- package/dist/leaf.cjs.js +1 -1
- package/dist/leaf.cjs.js.map +1 -1
- package/dist/leaf.es.js +2 -2
- package/dist/main.cjs.js +5 -0
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +5 -0
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +4 -3
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +5 -4
- package/dist/next.es.js.map +1 -1
- package/dist/prop-controllers.cjs.js +5 -0
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +5 -0
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/react-page.cjs.js +376 -203
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +349 -204
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +4 -3
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +4 -3
- package/dist/react.es.js.map +1 -1
- package/dist/slate.cjs.js +88 -4
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +89 -5
- package/dist/slate.es.js.map +1 -1
- package/dist/types/src/builder/serialization/control-serialization.d.ts +3 -3
- package/dist/types/src/builder/serialization/control-serialization.d.ts.map +1 -1
- package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts +2 -2
- package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/builder/serialization/controls/style-v2.d.ts +5 -0
- package/dist/types/src/builder/serialization/controls/style-v2.d.ts.map +1 -0
- package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
- package/dist/types/src/components/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
- package/dist/types/src/components/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -1
- package/dist/types/src/controls/control.d.ts +3 -2
- package/dist/types/src/controls/control.d.ts.map +1 -1
- package/dist/types/src/controls/index.d.ts +1 -0
- package/dist/types/src/controls/index.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +8 -3
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/controls/style-v2.d.ts +55 -0
- package/dist/types/src/controls/style-v2.d.ts.map +1 -0
- package/dist/types/src/prop-controllers/descriptors.d.ts +4 -3
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/instances.d.ts +2 -2
- package/dist/types/src/prop-controllers/instances.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts +3 -2
- package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts +2 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/style-v2.d.ts +4 -0
- package/dist/types/src/runtimes/react/controls/style-v2.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/index.d.ts +3 -0
- package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlineModePlugin/index.d.ts +1 -0
- package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts +9 -0
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/index.d.ts +1 -0
- package/dist/types/src/slate/index.d.ts.map +1 -1
- package/dist/types/src/slate/types.d.ts +18 -0
- package/dist/types/src/slate/types.d.ts.map +1 -1
- package/dist/useMediaQuery.es.js +1 -1
- package/package.json +1 -1
package/dist/react-page.es.js
CHANGED
|
@@ -22,13 +22,19 @@ var __publicField = (obj, key, value) => {
|
|
|
22
22
|
return value;
|
|
23
23
|
};
|
|
24
24
|
const import_meta = {};
|
|
25
|
+
var _a;
|
|
25
26
|
import { combineReducers, createStore, applyMiddleware } from "redux";
|
|
26
27
|
import thunk from "redux-thunk";
|
|
27
28
|
import { A as ActionTypes } from "./actions.es.js";
|
|
28
29
|
import { findBreakpointOverride, reducer as reducer$a, getInitialState as getInitialState$9 } from "./state/breakpoints.es.js";
|
|
30
|
+
import * as React from "react";
|
|
31
|
+
import { cache, cx } from "@emotion/css";
|
|
32
|
+
import { serializeStyles } from "@emotion/serialize";
|
|
33
|
+
import { registerStyles, insertStyles } from "@emotion/utils";
|
|
29
34
|
import { Element, Range, Editor, Text, Path, Transforms, Node, Point } from "slate";
|
|
30
35
|
import isHotkey from "is-hotkey";
|
|
31
36
|
import "slate-react";
|
|
37
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
32
38
|
const ComponentIcon = {
|
|
33
39
|
Billing: "billing",
|
|
34
40
|
Bolt: "bolt",
|
|
@@ -96,8 +102,8 @@ function getDocuments(state) {
|
|
|
96
102
|
return state;
|
|
97
103
|
}
|
|
98
104
|
function getDocument$1(state, documentKey) {
|
|
99
|
-
var
|
|
100
|
-
return (
|
|
105
|
+
var _a2;
|
|
106
|
+
return (_a2 = getDocuments(state).get(documentKey)) != null ? _a2 : null;
|
|
101
107
|
}
|
|
102
108
|
function reducer$8(state = getInitialState$7(), action) {
|
|
103
109
|
switch (action.type) {
|
|
@@ -121,8 +127,8 @@ function getReactComponents(state) {
|
|
|
121
127
|
return state;
|
|
122
128
|
}
|
|
123
129
|
function getReactComponent$1(state, type) {
|
|
124
|
-
var
|
|
125
|
-
return (
|
|
130
|
+
var _a2;
|
|
131
|
+
return (_a2 = getReactComponents(state).get(type)) != null ? _a2 : null;
|
|
126
132
|
}
|
|
127
133
|
function reducer$7(state = getInitialState$6(), action) {
|
|
128
134
|
switch (action.type) {
|
|
@@ -146,8 +152,8 @@ function getPropControllerDescriptors$1(state) {
|
|
|
146
152
|
return state;
|
|
147
153
|
}
|
|
148
154
|
function getComponentPropControllerDescriptors$1(state, componentType) {
|
|
149
|
-
var
|
|
150
|
-
return (
|
|
155
|
+
var _a2;
|
|
156
|
+
return (_a2 = getPropControllerDescriptors$1(state).get(componentType)) != null ? _a2 : null;
|
|
151
157
|
}
|
|
152
158
|
function reducer$6(state = getInitialState$5(), action) {
|
|
153
159
|
switch (action.type) {
|
|
@@ -172,24 +178,24 @@ function getInitialState$4() {
|
|
|
172
178
|
return { handles: /* @__PURE__ */ new Map(), instances: /* @__PURE__ */ new Map() };
|
|
173
179
|
}
|
|
174
180
|
function getPropControllersHandle(state, documentKey, elementKey) {
|
|
175
|
-
var
|
|
176
|
-
return (_b = (
|
|
181
|
+
var _a2, _b;
|
|
182
|
+
return (_b = (_a2 = state.handles.get(documentKey)) == null ? void 0 : _a2.get(elementKey)) != null ? _b : null;
|
|
177
183
|
}
|
|
178
184
|
function getPropControllers$1(state, documentKey, elementKey) {
|
|
179
|
-
var
|
|
180
|
-
return (_b = (
|
|
185
|
+
var _a2, _b;
|
|
186
|
+
return (_b = (_a2 = state.instances.get(documentKey)) == null ? void 0 : _a2.get(elementKey)) != null ? _b : null;
|
|
181
187
|
}
|
|
182
188
|
function getPropController(state, documentKey, elementKey, propName) {
|
|
183
|
-
var
|
|
184
|
-
return (_b = (
|
|
189
|
+
var _a2, _b;
|
|
190
|
+
return (_b = (_a2 = getPropControllers$1(state, documentKey, elementKey)) == null ? void 0 : _a2[propName]) != null ? _b : null;
|
|
185
191
|
}
|
|
186
192
|
function reducer$5(state = getInitialState$4(), action) {
|
|
187
|
-
var
|
|
193
|
+
var _a2, _b, _c, _d;
|
|
188
194
|
switch (action.type) {
|
|
189
195
|
case ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE: {
|
|
190
196
|
const { documentKey, elementKey, handle } = action.payload;
|
|
191
197
|
return __spreadProps(__spreadValues({}, state), {
|
|
192
|
-
handles: new Map(state.handles).set(documentKey, new Map((
|
|
198
|
+
handles: new Map(state.handles).set(documentKey, new Map((_a2 = state.handles.get(documentKey)) != null ? _a2 : []).set(elementKey, handle))
|
|
193
199
|
});
|
|
194
200
|
}
|
|
195
201
|
case ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE: {
|
|
@@ -254,9 +260,9 @@ function reducer$2(state = getInitialState$1(), action) {
|
|
|
254
260
|
}
|
|
255
261
|
}
|
|
256
262
|
function getInitialState(initialState) {
|
|
257
|
-
var
|
|
263
|
+
var _a2, _b, _c;
|
|
258
264
|
return {
|
|
259
|
-
locales: (
|
|
265
|
+
locales: (_a2 = initialState == null ? void 0 : initialState.locales) != null ? _a2 : [],
|
|
260
266
|
locale: (_b = initialState == null ? void 0 : initialState.locale) != null ? _b : null,
|
|
261
267
|
defaultLocale: (_c = initialState == null ? void 0 : initialState.defaultLocale) != null ? _c : null
|
|
262
268
|
};
|
|
@@ -286,11 +292,11 @@ function Color(config = {}) {
|
|
|
286
292
|
return { type: ColorControlType, config };
|
|
287
293
|
}
|
|
288
294
|
function copyColorData(value, context) {
|
|
289
|
-
var
|
|
295
|
+
var _a2;
|
|
290
296
|
if (value == null)
|
|
291
297
|
return value;
|
|
292
298
|
return __spreadProps(__spreadValues({}, value), {
|
|
293
|
-
swatchId: (
|
|
299
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(value.swatchId)) != null ? _a2 : value.swatchId
|
|
294
300
|
});
|
|
295
301
|
}
|
|
296
302
|
const ImageControlType = "makeswift::controls::image";
|
|
@@ -303,10 +309,10 @@ function Image$1(config = {}) {
|
|
|
303
309
|
}
|
|
304
310
|
Image$1.Format = ImageControlValueFormat;
|
|
305
311
|
function copyImageData(value, context) {
|
|
306
|
-
var
|
|
312
|
+
var _a2;
|
|
307
313
|
if (value == null)
|
|
308
314
|
return value;
|
|
309
|
-
return (
|
|
315
|
+
return (_a2 = context.replacementContext.fileIds.get(value)) != null ? _a2 : value;
|
|
310
316
|
}
|
|
311
317
|
if (import_meta.vitest) {
|
|
312
318
|
const { describe, test, expect } = import_meta.vitest;
|
|
@@ -339,7 +345,7 @@ function Link$1(config = {}) {
|
|
|
339
345
|
return { type: LinkControlType, config };
|
|
340
346
|
}
|
|
341
347
|
function copyLinkData(value, context) {
|
|
342
|
-
var
|
|
348
|
+
var _a2;
|
|
343
349
|
if (value == null)
|
|
344
350
|
return value;
|
|
345
351
|
if (value.type === "OPEN_PAGE") {
|
|
@@ -347,7 +353,7 @@ function copyLinkData(value, context) {
|
|
|
347
353
|
if (pageId != null) {
|
|
348
354
|
return __spreadProps(__spreadValues({}, value), {
|
|
349
355
|
payload: __spreadProps(__spreadValues({}, value.payload), {
|
|
350
|
-
pageId: (
|
|
356
|
+
pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : pageId
|
|
351
357
|
})
|
|
352
358
|
});
|
|
353
359
|
}
|
|
@@ -500,6 +506,8 @@ function createPropController(descriptor, send) {
|
|
|
500
506
|
return new ShapeControl(send, descriptor);
|
|
501
507
|
case StyleControlType:
|
|
502
508
|
return new StyleControl(send);
|
|
509
|
+
case StyleV2ControlType:
|
|
510
|
+
return new StyleV2Control(send);
|
|
503
511
|
default:
|
|
504
512
|
return new DefaultPropController(send);
|
|
505
513
|
}
|
|
@@ -638,10 +646,10 @@ const AllStyleControlProperties = [
|
|
|
638
646
|
StyleControlProperty.TextStyle
|
|
639
647
|
];
|
|
640
648
|
function Style(params) {
|
|
641
|
-
var
|
|
649
|
+
var _a2;
|
|
642
650
|
return {
|
|
643
651
|
type: StyleControlType,
|
|
644
|
-
config: { properties: (
|
|
652
|
+
config: { properties: (_a2 = params == null ? void 0 : params.properties) != null ? _a2 : StyleControlDefaultProperties }
|
|
645
653
|
};
|
|
646
654
|
}
|
|
647
655
|
Style.Default = StyleControlDefaultProperties;
|
|
@@ -859,22 +867,22 @@ function copy$e(value, context) {
|
|
|
859
867
|
return value;
|
|
860
868
|
return value.map((override) => __spreadProps(__spreadValues({}, override), {
|
|
861
869
|
value: override.value.map((backgroundItem) => {
|
|
862
|
-
var
|
|
870
|
+
var _a2, _b;
|
|
863
871
|
switch (backgroundItem.type) {
|
|
864
872
|
case "color":
|
|
865
873
|
return __spreadProps(__spreadValues({}, backgroundItem), {
|
|
866
874
|
payload: backgroundItem.payload === null ? null : __spreadProps(__spreadValues({}, backgroundItem.payload), {
|
|
867
|
-
swatchId: (
|
|
875
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(backgroundItem.payload.swatchId)) != null ? _a2 : backgroundItem.payload.swatchId
|
|
868
876
|
})
|
|
869
877
|
});
|
|
870
878
|
case "gradient":
|
|
871
879
|
return __spreadProps(__spreadValues({}, backgroundItem), {
|
|
872
880
|
payload: __spreadProps(__spreadValues({}, backgroundItem.payload), {
|
|
873
881
|
stops: backgroundItem.payload.stops.map((stop) => {
|
|
874
|
-
var
|
|
882
|
+
var _a3;
|
|
875
883
|
return __spreadProps(__spreadValues({}, stop), {
|
|
876
884
|
color: stop.color == null ? null : __spreadProps(__spreadValues({}, stop.color), {
|
|
877
|
-
swatchId: (
|
|
885
|
+
swatchId: (_a3 = context.replacementContext.swatchIds.get(stop.color.swatchId)) != null ? _a3 : stop.color.swatchId
|
|
878
886
|
})
|
|
879
887
|
});
|
|
880
888
|
})
|
|
@@ -900,7 +908,7 @@ function copy$d(value, context) {
|
|
|
900
908
|
});
|
|
901
909
|
}
|
|
902
910
|
function copy$c(value, context) {
|
|
903
|
-
var
|
|
911
|
+
var _a2, _b;
|
|
904
912
|
if (value == null)
|
|
905
913
|
return value;
|
|
906
914
|
switch (value.type) {
|
|
@@ -910,7 +918,7 @@ function copy$c(value, context) {
|
|
|
910
918
|
return value;
|
|
911
919
|
return __spreadProps(__spreadValues({}, value), {
|
|
912
920
|
payload: __spreadProps(__spreadValues({}, value.payload), {
|
|
913
|
-
pageId: (
|
|
921
|
+
pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : pageId
|
|
914
922
|
})
|
|
915
923
|
});
|
|
916
924
|
}
|
|
@@ -943,10 +951,10 @@ function copy$b(value, context) {
|
|
|
943
951
|
payload: __spreadProps(__spreadValues({}, item.payload), {
|
|
944
952
|
link: link != null ? copy$c(link, context) : void 0,
|
|
945
953
|
color: color != null ? color.map((override) => {
|
|
946
|
-
var
|
|
954
|
+
var _a2;
|
|
947
955
|
return __spreadProps(__spreadValues({}, override), {
|
|
948
956
|
value: __spreadProps(__spreadValues({}, override.value), {
|
|
949
|
-
swatchId: (
|
|
957
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(override.value.swatchId)) != null ? _a2 : override.value.swatchId
|
|
950
958
|
})
|
|
951
959
|
});
|
|
952
960
|
}) : void 0
|
|
@@ -1004,14 +1012,14 @@ function copy$a(value, context) {
|
|
|
1004
1012
|
return value;
|
|
1005
1013
|
return value.map((override) => __spreadProps(__spreadValues({}, override), { value: override.value.map(copyShadowItem) }));
|
|
1006
1014
|
function copyShadowItem(item) {
|
|
1007
|
-
var
|
|
1015
|
+
var _a2;
|
|
1008
1016
|
const { color } = item.payload;
|
|
1009
1017
|
if (color == null)
|
|
1010
1018
|
return item;
|
|
1011
1019
|
return __spreadProps(__spreadValues({}, item), {
|
|
1012
1020
|
payload: __spreadProps(__spreadValues({}, item.payload), {
|
|
1013
1021
|
color: __spreadProps(__spreadValues({}, color), {
|
|
1014
|
-
swatchId: (
|
|
1022
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a2 : color.swatchId
|
|
1015
1023
|
})
|
|
1016
1024
|
})
|
|
1017
1025
|
});
|
|
@@ -1065,10 +1073,10 @@ if (import_meta.vitest) {
|
|
|
1065
1073
|
});
|
|
1066
1074
|
}
|
|
1067
1075
|
function copy$9(value, context) {
|
|
1068
|
-
var
|
|
1076
|
+
var _a2;
|
|
1069
1077
|
if (value == null)
|
|
1070
1078
|
return value;
|
|
1071
|
-
return (
|
|
1079
|
+
return (_a2 = context.replacementContext.fileIds.get(value)) != null ? _a2 : value;
|
|
1072
1080
|
}
|
|
1073
1081
|
if (import_meta.vitest) {
|
|
1074
1082
|
const { describe, test, expect } = import_meta.vitest;
|
|
@@ -1101,13 +1109,13 @@ function copy$8(value, context) {
|
|
|
1101
1109
|
return value;
|
|
1102
1110
|
return value.map(copyImagesPanelItem);
|
|
1103
1111
|
function copyImagesPanelItem(imagesPanelItem) {
|
|
1104
|
-
var
|
|
1112
|
+
var _a2;
|
|
1105
1113
|
const { file } = imagesPanelItem.props;
|
|
1106
1114
|
if (file == null)
|
|
1107
1115
|
return imagesPanelItem;
|
|
1108
1116
|
return __spreadProps(__spreadValues({}, imagesPanelItem), {
|
|
1109
1117
|
props: __spreadProps(__spreadValues({}, imagesPanelItem.props), {
|
|
1110
|
-
file: (
|
|
1118
|
+
file: (_a2 = context.replacementContext.fileIds.get(file)) != null ? _a2 : file
|
|
1111
1119
|
})
|
|
1112
1120
|
});
|
|
1113
1121
|
}
|
|
@@ -1156,9 +1164,9 @@ function copy$7(value, context) {
|
|
|
1156
1164
|
return value;
|
|
1157
1165
|
return value.map((override) => __spreadProps(__spreadValues({}, override), { value: copyColorValue(override.value) }));
|
|
1158
1166
|
function copyColorValue(colorValue) {
|
|
1159
|
-
var
|
|
1167
|
+
var _a2;
|
|
1160
1168
|
return __spreadProps(__spreadValues({}, colorValue), {
|
|
1161
|
-
swatchId: (
|
|
1169
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(colorValue.swatchId)) != null ? _a2 : colorValue.swatchId
|
|
1162
1170
|
});
|
|
1163
1171
|
}
|
|
1164
1172
|
}
|
|
@@ -1167,9 +1175,9 @@ function copy$6(value, context) {
|
|
|
1167
1175
|
return value;
|
|
1168
1176
|
return __spreadProps(__spreadValues({}, value), { fields: value.fields.map(copyFormFieldsPanelItem) });
|
|
1169
1177
|
function copyFormFieldsPanelItem(item) {
|
|
1170
|
-
var
|
|
1178
|
+
var _a2;
|
|
1171
1179
|
return __spreadProps(__spreadValues({}, item), {
|
|
1172
|
-
tableColumnId: (
|
|
1180
|
+
tableColumnId: (_a2 = context.replacementContext.tableColumnIds.get(item.tableColumnId)) != null ? _a2 : item.tableColumnId
|
|
1173
1181
|
});
|
|
1174
1182
|
}
|
|
1175
1183
|
}
|
|
@@ -1223,10 +1231,10 @@ if (import_meta.vitest) {
|
|
|
1223
1231
|
});
|
|
1224
1232
|
}
|
|
1225
1233
|
function copy$5(value, context) {
|
|
1226
|
-
var
|
|
1234
|
+
var _a2;
|
|
1227
1235
|
if (value == null)
|
|
1228
1236
|
return value;
|
|
1229
|
-
return (
|
|
1237
|
+
return (_a2 = context.replacementContext.tableIds.get(value)) != null ? _a2 : value;
|
|
1230
1238
|
}
|
|
1231
1239
|
if (import_meta.vitest) {
|
|
1232
1240
|
const { describe, test, expect } = import_meta.vitest;
|
|
@@ -1268,13 +1276,13 @@ function copy$4(value, context) {
|
|
|
1268
1276
|
};
|
|
1269
1277
|
}
|
|
1270
1278
|
function copyBorderSide(borderSide) {
|
|
1271
|
-
var
|
|
1279
|
+
var _a2;
|
|
1272
1280
|
const { color } = borderSide;
|
|
1273
1281
|
if (color == null)
|
|
1274
1282
|
return borderSide;
|
|
1275
1283
|
return __spreadProps(__spreadValues({}, borderSide), {
|
|
1276
1284
|
color: __spreadProps(__spreadValues({}, color), {
|
|
1277
|
-
swatchId: (
|
|
1285
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a2 : color.swatchId
|
|
1278
1286
|
})
|
|
1279
1287
|
});
|
|
1280
1288
|
}
|
|
@@ -1388,24 +1396,24 @@ function copy$3(value, context) {
|
|
|
1388
1396
|
return value;
|
|
1389
1397
|
return __spreadProps(__spreadValues({}, value), { document: value.document ? copyNode(value.document) : value.document });
|
|
1390
1398
|
function copyNode(node) {
|
|
1391
|
-
var
|
|
1399
|
+
var _a2;
|
|
1392
1400
|
switch (node.object) {
|
|
1393
1401
|
case "document":
|
|
1394
1402
|
case "block":
|
|
1395
1403
|
case "inline":
|
|
1396
1404
|
return copyInline(node);
|
|
1397
1405
|
case "text":
|
|
1398
|
-
return __spreadProps(__spreadValues({}, node), { marks: (
|
|
1406
|
+
return __spreadProps(__spreadValues({}, node), { marks: (_a2 = node.marks) == null ? void 0 : _a2.map(copyMark) });
|
|
1399
1407
|
default:
|
|
1400
1408
|
return node;
|
|
1401
1409
|
}
|
|
1402
1410
|
}
|
|
1403
1411
|
function copyInline(inline) {
|
|
1404
|
-
var
|
|
1412
|
+
var _a2, _b;
|
|
1405
1413
|
switch (inline.type) {
|
|
1406
1414
|
case "link":
|
|
1407
1415
|
return __spreadProps(__spreadValues({}, inline), {
|
|
1408
|
-
nodes: (
|
|
1416
|
+
nodes: (_a2 = inline.nodes) == null ? void 0 : _a2.map(copyNode),
|
|
1409
1417
|
data: inline.data ? copyLinkData2(inline.data) : inline.data
|
|
1410
1418
|
});
|
|
1411
1419
|
default:
|
|
@@ -1413,7 +1421,7 @@ function copy$3(value, context) {
|
|
|
1413
1421
|
}
|
|
1414
1422
|
}
|
|
1415
1423
|
function copyLinkData2(data) {
|
|
1416
|
-
var
|
|
1424
|
+
var _a2, _b;
|
|
1417
1425
|
switch (data.type) {
|
|
1418
1426
|
case "OPEN_PAGE": {
|
|
1419
1427
|
const pageId = data.payload.pageId;
|
|
@@ -1421,7 +1429,7 @@ function copy$3(value, context) {
|
|
|
1421
1429
|
return data;
|
|
1422
1430
|
return __spreadProps(__spreadValues({}, data), {
|
|
1423
1431
|
payload: __spreadProps(__spreadValues({}, data.payload), {
|
|
1424
|
-
pageId: (
|
|
1432
|
+
pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : data.payload.pageId
|
|
1425
1433
|
})
|
|
1426
1434
|
});
|
|
1427
1435
|
}
|
|
@@ -1442,20 +1450,20 @@ function copy$3(value, context) {
|
|
|
1442
1450
|
}
|
|
1443
1451
|
}
|
|
1444
1452
|
function copyMark(mark) {
|
|
1445
|
-
var
|
|
1453
|
+
var _a2, _b, _c, _d;
|
|
1446
1454
|
switch (mark.type) {
|
|
1447
1455
|
case "typography": {
|
|
1448
|
-
const typographyId = (
|
|
1456
|
+
const typographyId = (_a2 = mark.data) == null ? void 0 : _a2.value.id;
|
|
1449
1457
|
return __spreadProps(__spreadValues({}, mark), {
|
|
1450
1458
|
data: __spreadProps(__spreadValues({}, mark.data), {
|
|
1451
1459
|
value: __spreadProps(__spreadValues({}, (_b = mark.data) == null ? void 0 : _b.value), {
|
|
1452
1460
|
id: (_c = context.replacementContext.typographyIds.get(typographyId)) != null ? _c : typographyId,
|
|
1453
1461
|
style: (_d = mark.data) == null ? void 0 : _d.value.style.map((override) => {
|
|
1454
|
-
var
|
|
1462
|
+
var _a3, _b2, _c2;
|
|
1455
1463
|
return __spreadProps(__spreadValues({}, override), {
|
|
1456
1464
|
value: __spreadProps(__spreadValues({}, override.value), {
|
|
1457
1465
|
color: override.value.color == null ? override.value.color : __spreadProps(__spreadValues({}, override.value.color), {
|
|
1458
|
-
swatchId: (_c2 = context.replacementContext.swatchIds.get((
|
|
1466
|
+
swatchId: (_c2 = context.replacementContext.swatchIds.get((_a3 = override.value.color) == null ? void 0 : _a3.swatchId)) != null ? _c2 : (_b2 = override.value.color) == null ? void 0 : _b2.swatchId
|
|
1459
1467
|
})
|
|
1460
1468
|
})
|
|
1461
1469
|
});
|
|
@@ -1652,6 +1660,37 @@ const SelectControlType = "makeswift::controls::select";
|
|
|
1652
1660
|
function Select(config) {
|
|
1653
1661
|
return { type: SelectControlType, config };
|
|
1654
1662
|
}
|
|
1663
|
+
const isServer = typeof window === "undefined";
|
|
1664
|
+
const useInsertionEffectSpecifier = "useInsertionEffect";
|
|
1665
|
+
const useInsertionEffect = (_a = React[useInsertionEffectSpecifier]) != null ? _a : React.useLayoutEffect;
|
|
1666
|
+
function useStyle(style) {
|
|
1667
|
+
const serialized = serializeStyles([style], cache.registered);
|
|
1668
|
+
registerStyles(cache, serialized, false);
|
|
1669
|
+
useInsertionEffect(() => {
|
|
1670
|
+
insertStyles(cache, serialized, false);
|
|
1671
|
+
});
|
|
1672
|
+
if (isServer)
|
|
1673
|
+
insertStyles(cache, serialized, false);
|
|
1674
|
+
return `${cache.key}-${serialized.name}`;
|
|
1675
|
+
}
|
|
1676
|
+
const StyleV2ControlType = "makeswift::controls::style-v2";
|
|
1677
|
+
const unstable_useStyleV2ClassName = useStyle;
|
|
1678
|
+
function unstable_StyleV2(config) {
|
|
1679
|
+
return { type: StyleV2ControlType, config };
|
|
1680
|
+
}
|
|
1681
|
+
const StyleV2ControlMessageType = {
|
|
1682
|
+
CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model"
|
|
1683
|
+
};
|
|
1684
|
+
class StyleV2Control extends PropController {
|
|
1685
|
+
constructor(send) {
|
|
1686
|
+
super(send);
|
|
1687
|
+
}
|
|
1688
|
+
changeBoxModel(boxModel) {
|
|
1689
|
+
this.send({ type: StyleV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
|
|
1690
|
+
}
|
|
1691
|
+
recv() {
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1655
1694
|
const ObjectType = {
|
|
1656
1695
|
Value: "value",
|
|
1657
1696
|
Text: "text",
|
|
@@ -1788,13 +1827,13 @@ function getBlocksInSelection(editor) {
|
|
|
1788
1827
|
})).filter((entry) => ElementUtils.isRootBlock(entry[0]));
|
|
1789
1828
|
}
|
|
1790
1829
|
function getActiveBlockType(editor) {
|
|
1791
|
-
var
|
|
1830
|
+
var _a2;
|
|
1792
1831
|
const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type);
|
|
1793
|
-
return rootBlocks.reduce((a, b) => a === b ? b : null, (
|
|
1832
|
+
return rootBlocks.reduce((a, b) => a === b ? b : null, (_a2 = rootBlocks.at(0)) != null ? _a2 : null);
|
|
1794
1833
|
}
|
|
1795
1834
|
function setBlockKeyForDevice(editor, breakpoints, deviceId, key, value, options) {
|
|
1796
|
-
var
|
|
1797
|
-
const at = (
|
|
1835
|
+
var _a2, _b;
|
|
1836
|
+
const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
|
|
1798
1837
|
if (!at)
|
|
1799
1838
|
return;
|
|
1800
1839
|
const rootElements = getBlocksInSelection(editor);
|
|
@@ -1813,11 +1852,11 @@ function setBlockKeyForDevice(editor, breakpoints, deviceId, key, value, options
|
|
|
1813
1852
|
}
|
|
1814
1853
|
}
|
|
1815
1854
|
function clearBlockKeyForDevice(editor, deviceId, key) {
|
|
1816
|
-
var
|
|
1855
|
+
var _a2;
|
|
1817
1856
|
const rootElements = getBlocksInSelection(editor);
|
|
1818
1857
|
for (const [node, path] of rootElements) {
|
|
1819
1858
|
if (ElementUtils.isBlock(node)) {
|
|
1820
|
-
const deviceOverrides = (
|
|
1859
|
+
const deviceOverrides = (_a2 = node[key]) != null ? _a2 : [];
|
|
1821
1860
|
Transforms.setNodes(editor, {
|
|
1822
1861
|
[key]: deviceOverrides.filter((v) => v.deviceId !== deviceId)
|
|
1823
1862
|
}, { at: path });
|
|
@@ -1890,8 +1929,8 @@ function unwrapPath(editor, listItemPath) {
|
|
|
1890
1929
|
});
|
|
1891
1930
|
}
|
|
1892
1931
|
function unwrapList(editor, options) {
|
|
1893
|
-
var
|
|
1894
|
-
const at = (
|
|
1932
|
+
var _a2;
|
|
1933
|
+
const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
|
|
1895
1934
|
if (!at)
|
|
1896
1935
|
return;
|
|
1897
1936
|
const listItems = Array.from(Editor.nodes(editor, {
|
|
@@ -1910,8 +1949,8 @@ function unwrapList(editor, options) {
|
|
|
1910
1949
|
});
|
|
1911
1950
|
}
|
|
1912
1951
|
function wrapList(editor, options = { type: BlockType.UnorderedList }) {
|
|
1913
|
-
var
|
|
1914
|
-
const at = (
|
|
1952
|
+
var _a2;
|
|
1953
|
+
const at = (_a2 = options.at) != null ? _a2 : editor.selection;
|
|
1915
1954
|
if (!at)
|
|
1916
1955
|
return;
|
|
1917
1956
|
const nonListEntries = Array.from(Editor.nodes(editor, {
|
|
@@ -1950,7 +1989,7 @@ const LocationUtils = {
|
|
|
1950
1989
|
}
|
|
1951
1990
|
};
|
|
1952
1991
|
function getSelectedListItems(editor) {
|
|
1953
|
-
var
|
|
1992
|
+
var _a2, _b;
|
|
1954
1993
|
if (!editor.selection)
|
|
1955
1994
|
return [];
|
|
1956
1995
|
const start = LocationUtils.getStartPath(editor.selection);
|
|
@@ -1958,7 +1997,7 @@ function getSelectedListItems(editor) {
|
|
|
1958
1997
|
at: editor.selection,
|
|
1959
1998
|
match: (node) => ElementUtils.isListItem(node)
|
|
1960
1999
|
});
|
|
1961
|
-
const firstAncestorPath = (_b = (
|
|
2000
|
+
const firstAncestorPath = (_b = (_a2 = EditorUtils.getFirstAncestorListItem(editor, start)) == null ? void 0 : _a2[1]) != null ? _b : [];
|
|
1962
2001
|
return Array.from(listItems).filter((node) => Path.isDescendant(start, node[1]) ? Path.equals(node[1], firstAncestorPath) : !Path.isAfter(start, node[1]));
|
|
1963
2002
|
}
|
|
1964
2003
|
function indentPath(editor, path) {
|
|
@@ -2035,8 +2074,8 @@ function dedent(editor) {
|
|
|
2035
2074
|
});
|
|
2036
2075
|
}
|
|
2037
2076
|
function toggleList(editor, options = { type: BlockType.UnorderedList }) {
|
|
2038
|
-
var
|
|
2039
|
-
const at = (
|
|
2077
|
+
var _a2;
|
|
2078
|
+
const at = (_a2 = options.at) != null ? _a2 : editor.selection;
|
|
2040
2079
|
if (at == null)
|
|
2041
2080
|
return;
|
|
2042
2081
|
const start = LocationUtils.getStartPath(at);
|
|
@@ -2067,7 +2106,9 @@ const ListActions = {
|
|
|
2067
2106
|
toggleList
|
|
2068
2107
|
};
|
|
2069
2108
|
function onKeyDown(e, editor) {
|
|
2070
|
-
if (!editor.selection || Array.from(Editor.nodes(editor, {
|
|
2109
|
+
if (!editor.selection || Array.from(Editor.nodes(editor, {
|
|
2110
|
+
match: (node) => ElementUtils.isListItem(node)
|
|
2111
|
+
})).length === 0)
|
|
2071
2112
|
return;
|
|
2072
2113
|
if (isHotkey("shift+tab", e)) {
|
|
2073
2114
|
e.preventDefault();
|
|
@@ -2125,15 +2166,19 @@ function onKeyDown(e, editor) {
|
|
|
2125
2166
|
}
|
|
2126
2167
|
}
|
|
2127
2168
|
function withBlock(editor) {
|
|
2128
|
-
const {
|
|
2169
|
+
const {
|
|
2170
|
+
normalizeNode
|
|
2171
|
+
} = editor;
|
|
2129
2172
|
editor.isInline = (entry) => {
|
|
2130
2173
|
return ElementUtils.isInline(entry);
|
|
2131
2174
|
};
|
|
2132
2175
|
editor.normalizeNode = (entry) => {
|
|
2133
|
-
var
|
|
2176
|
+
var _a2;
|
|
2134
2177
|
const [normalizationNode, normalizationPath] = entry;
|
|
2135
|
-
if (ElementUtils.isBlock(normalizationNode) && ((
|
|
2136
|
-
Transforms.unsetNodes(editor, "textAlign", {
|
|
2178
|
+
if (ElementUtils.isBlock(normalizationNode) && ((_a2 = normalizationNode == null ? void 0 : normalizationNode.textAlign) == null ? void 0 : _a2.length) == 0) {
|
|
2179
|
+
Transforms.unsetNodes(editor, "textAlign", {
|
|
2180
|
+
at: normalizationPath
|
|
2181
|
+
});
|
|
2137
2182
|
return;
|
|
2138
2183
|
}
|
|
2139
2184
|
if (ElementUtils.isListItem(normalizationNode)) {
|
|
@@ -2141,7 +2186,9 @@ function withBlock(editor) {
|
|
|
2141
2186
|
if (Node.has(editor, pathToListItemText)) {
|
|
2142
2187
|
const nodeInListItemTextPosition = Node.get(editor, pathToListItemText);
|
|
2143
2188
|
if (ElementUtils.isRootBlock(nodeInListItemTextPosition)) {
|
|
2144
|
-
Transforms.setNodes(editor, {
|
|
2189
|
+
Transforms.setNodes(editor, {
|
|
2190
|
+
type: BlockType.ListItemChild
|
|
2191
|
+
}, {
|
|
2145
2192
|
at: pathToListItemText
|
|
2146
2193
|
});
|
|
2147
2194
|
return;
|
|
@@ -2159,10 +2206,7 @@ function withBlock(editor) {
|
|
|
2159
2206
|
if (!potentialNodeToBeMerged || !ElementUtils.isList(potentialNodeToBeMerged[0]) || !ElementUtils.isList(child[0]) || potentialNodeToBeMerged[0].type !== child[0].type) {
|
|
2160
2207
|
return null;
|
|
2161
2208
|
}
|
|
2162
|
-
return [
|
|
2163
|
-
Editor.pathRef(editor, child[1]),
|
|
2164
|
-
Editor.pathRef(editor, potentialNodeToBeMerged[1])
|
|
2165
|
-
];
|
|
2209
|
+
return [Editor.pathRef(editor, child[1]), Editor.pathRef(editor, potentialNodeToBeMerged[1])];
|
|
2166
2210
|
}).filter((mergeableNodes) => Boolean(mergeableNodes));
|
|
2167
2211
|
if (mergeableChildren.length !== 0) {
|
|
2168
2212
|
mergeableChildren.reverse().forEach(([nodePathRef, nodeToBeMergedPathRef]) => {
|
|
@@ -2179,7 +2223,9 @@ function withBlock(editor) {
|
|
|
2179
2223
|
to: [...nodePath, nodeChildren.length]
|
|
2180
2224
|
});
|
|
2181
2225
|
});
|
|
2182
|
-
Transforms.removeNodes(editor, {
|
|
2226
|
+
Transforms.removeNodes(editor, {
|
|
2227
|
+
at: nodeToBeMergedPath
|
|
2228
|
+
});
|
|
2183
2229
|
});
|
|
2184
2230
|
nodePathRef.unref();
|
|
2185
2231
|
nodeToBeMergedPathRef.unref();
|
|
@@ -2194,48 +2240,37 @@ function withBlock(editor) {
|
|
|
2194
2240
|
const definition = Select({
|
|
2195
2241
|
label: "Block",
|
|
2196
2242
|
labelOrientation: "horizontal",
|
|
2197
|
-
options: [
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
label: "Bulleted list"
|
|
2229
|
-
},
|
|
2230
|
-
{
|
|
2231
|
-
value: BlockType.OrderedList,
|
|
2232
|
-
label: "Numbered list"
|
|
2233
|
-
},
|
|
2234
|
-
{
|
|
2235
|
-
value: BlockType.BlockQuote,
|
|
2236
|
-
label: "Quote"
|
|
2237
|
-
}
|
|
2238
|
-
],
|
|
2243
|
+
options: [{
|
|
2244
|
+
value: BlockType.Paragraph,
|
|
2245
|
+
label: "Paragraph"
|
|
2246
|
+
}, {
|
|
2247
|
+
value: BlockType.Heading1,
|
|
2248
|
+
label: "Heading 1"
|
|
2249
|
+
}, {
|
|
2250
|
+
value: BlockType.Heading2,
|
|
2251
|
+
label: "Heading 2"
|
|
2252
|
+
}, {
|
|
2253
|
+
value: BlockType.Heading3,
|
|
2254
|
+
label: "Heading 3"
|
|
2255
|
+
}, {
|
|
2256
|
+
value: BlockType.Heading4,
|
|
2257
|
+
label: "Heading 4"
|
|
2258
|
+
}, {
|
|
2259
|
+
value: BlockType.Heading5,
|
|
2260
|
+
label: "Heading 5"
|
|
2261
|
+
}, {
|
|
2262
|
+
value: BlockType.Heading6,
|
|
2263
|
+
label: "Heading 6"
|
|
2264
|
+
}, {
|
|
2265
|
+
value: BlockType.UnorderedList,
|
|
2266
|
+
label: "Bulleted list"
|
|
2267
|
+
}, {
|
|
2268
|
+
value: BlockType.OrderedList,
|
|
2269
|
+
label: "Numbered list"
|
|
2270
|
+
}, {
|
|
2271
|
+
value: BlockType.BlockQuote,
|
|
2272
|
+
label: "Quote"
|
|
2273
|
+
}],
|
|
2239
2274
|
defaultValue: BlockType.Paragraph
|
|
2240
2275
|
});
|
|
2241
2276
|
function BlockPlugin() {
|
|
@@ -2254,14 +2289,18 @@ function BlockPlugin() {
|
|
|
2254
2289
|
} else if (activeBlockType === value) {
|
|
2255
2290
|
Transforms.setNodes(editor, {
|
|
2256
2291
|
type: BlockType.Default
|
|
2257
|
-
}, {
|
|
2292
|
+
}, {
|
|
2293
|
+
at: getSelection(editor)
|
|
2294
|
+
});
|
|
2258
2295
|
} else {
|
|
2259
2296
|
ListActions.unwrapList(editor, {
|
|
2260
2297
|
at: getSelection(editor)
|
|
2261
2298
|
});
|
|
2262
2299
|
Transforms.setNodes(editor, {
|
|
2263
2300
|
type: value != null ? value : BlockType.Default
|
|
2264
|
-
}, {
|
|
2301
|
+
}, {
|
|
2302
|
+
at: getSelection(editor)
|
|
2303
|
+
});
|
|
2265
2304
|
}
|
|
2266
2305
|
},
|
|
2267
2306
|
getValue: (editor) => {
|
|
@@ -2270,9 +2309,114 @@ function BlockPlugin() {
|
|
|
2270
2309
|
return void 0;
|
|
2271
2310
|
return activeBlock;
|
|
2272
2311
|
}
|
|
2273
|
-
}
|
|
2312
|
+
},
|
|
2313
|
+
renderElement: (renderElement) => (props) => /* @__PURE__ */ jsx(BlockPluginComponent, __spreadProps(__spreadValues({}, props), {
|
|
2314
|
+
renderElement
|
|
2315
|
+
}))
|
|
2274
2316
|
});
|
|
2275
2317
|
}
|
|
2318
|
+
function BlockPluginComponent({
|
|
2319
|
+
element,
|
|
2320
|
+
attributes,
|
|
2321
|
+
children,
|
|
2322
|
+
renderElement
|
|
2323
|
+
}) {
|
|
2324
|
+
const blockStyles = [useStyle({
|
|
2325
|
+
margin: 0
|
|
2326
|
+
}), element.className];
|
|
2327
|
+
const quoteStyles = useStyle({
|
|
2328
|
+
padding: "0.5em 10px",
|
|
2329
|
+
fontSize: "1.25em",
|
|
2330
|
+
fontWeight: "300",
|
|
2331
|
+
borderLeft: "5px solid rgba(0, 0, 0, 0.1)"
|
|
2332
|
+
});
|
|
2333
|
+
switch (element.type) {
|
|
2334
|
+
case BlockType.Text:
|
|
2335
|
+
return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({}, attributes), {
|
|
2336
|
+
className: cx(...blockStyles),
|
|
2337
|
+
children
|
|
2338
|
+
}));
|
|
2339
|
+
case BlockType.Paragraph:
|
|
2340
|
+
return /* @__PURE__ */ jsx("p", __spreadProps(__spreadValues({}, attributes), {
|
|
2341
|
+
className: cx(...blockStyles),
|
|
2342
|
+
children
|
|
2343
|
+
}));
|
|
2344
|
+
case BlockType.Heading1:
|
|
2345
|
+
return /* @__PURE__ */ jsx("h1", __spreadProps(__spreadValues({}, attributes), {
|
|
2346
|
+
className: cx(...blockStyles),
|
|
2347
|
+
children
|
|
2348
|
+
}));
|
|
2349
|
+
case BlockType.Heading2:
|
|
2350
|
+
return /* @__PURE__ */ jsx("h2", __spreadProps(__spreadValues({}, attributes), {
|
|
2351
|
+
className: cx(...blockStyles),
|
|
2352
|
+
children
|
|
2353
|
+
}));
|
|
2354
|
+
case BlockType.Heading3:
|
|
2355
|
+
return /* @__PURE__ */ jsx("h3", __spreadProps(__spreadValues({}, attributes), {
|
|
2356
|
+
className: cx(...blockStyles),
|
|
2357
|
+
children
|
|
2358
|
+
}));
|
|
2359
|
+
case BlockType.Heading4:
|
|
2360
|
+
return /* @__PURE__ */ jsx("h4", __spreadProps(__spreadValues({}, attributes), {
|
|
2361
|
+
className: cx(...blockStyles),
|
|
2362
|
+
children
|
|
2363
|
+
}));
|
|
2364
|
+
case BlockType.Heading5:
|
|
2365
|
+
return /* @__PURE__ */ jsx("h5", __spreadProps(__spreadValues({}, attributes), {
|
|
2366
|
+
className: cx(...blockStyles),
|
|
2367
|
+
children
|
|
2368
|
+
}));
|
|
2369
|
+
case BlockType.Heading6:
|
|
2370
|
+
return /* @__PURE__ */ jsx("h6", __spreadProps(__spreadValues({}, attributes), {
|
|
2371
|
+
className: cx(...blockStyles),
|
|
2372
|
+
children
|
|
2373
|
+
}));
|
|
2374
|
+
case BlockType.BlockQuote:
|
|
2375
|
+
return /* @__PURE__ */ jsx("blockquote", __spreadProps(__spreadValues({}, attributes), {
|
|
2376
|
+
className: cx(...blockStyles, quoteStyles),
|
|
2377
|
+
children
|
|
2378
|
+
}));
|
|
2379
|
+
case BlockType.OrderedList:
|
|
2380
|
+
return /* @__PURE__ */ jsx("ol", __spreadProps(__spreadValues({}, attributes), {
|
|
2381
|
+
className: cx(...blockStyles),
|
|
2382
|
+
style: {
|
|
2383
|
+
listStylePosition: "inside"
|
|
2384
|
+
},
|
|
2385
|
+
children
|
|
2386
|
+
}));
|
|
2387
|
+
case BlockType.UnorderedList:
|
|
2388
|
+
return /* @__PURE__ */ jsx("ul", __spreadProps(__spreadValues({}, attributes), {
|
|
2389
|
+
className: cx(...blockStyles),
|
|
2390
|
+
style: {
|
|
2391
|
+
listStylePosition: "inside"
|
|
2392
|
+
},
|
|
2393
|
+
children
|
|
2394
|
+
}));
|
|
2395
|
+
case BlockType.ListItem:
|
|
2396
|
+
return /* @__PURE__ */ jsx("li", __spreadProps(__spreadValues({}, attributes), {
|
|
2397
|
+
className: cx(...blockStyles),
|
|
2398
|
+
children
|
|
2399
|
+
}));
|
|
2400
|
+
case BlockType.ListItemChild:
|
|
2401
|
+
return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({}, attributes), {
|
|
2402
|
+
className: cx(...blockStyles),
|
|
2403
|
+
children
|
|
2404
|
+
}));
|
|
2405
|
+
case BlockType.Default:
|
|
2406
|
+
return /* @__PURE__ */ jsx("p", __spreadProps(__spreadValues({}, attributes), {
|
|
2407
|
+
className: cx(...blockStyles),
|
|
2408
|
+
children
|
|
2409
|
+
}));
|
|
2410
|
+
default:
|
|
2411
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
2412
|
+
children: renderElement({
|
|
2413
|
+
element,
|
|
2414
|
+
attributes,
|
|
2415
|
+
children
|
|
2416
|
+
})
|
|
2417
|
+
});
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2276
2420
|
const RichTextV2ControlType = "makeswift::controls::rich-text-v2";
|
|
2277
2421
|
const RichTextV2Mode = {
|
|
2278
2422
|
Inline: "makeswift::controls::rich-text-v2::mode::inline",
|
|
@@ -2281,9 +2425,10 @@ const RichTextV2Mode = {
|
|
|
2281
2425
|
function createRichTextV2Plugin({
|
|
2282
2426
|
control,
|
|
2283
2427
|
withPlugin,
|
|
2284
|
-
onKeyDown: onKeyDown2
|
|
2428
|
+
onKeyDown: onKeyDown2,
|
|
2429
|
+
renderElement
|
|
2285
2430
|
}) {
|
|
2286
|
-
return { control, withPlugin, onKeyDown: onKeyDown2 };
|
|
2431
|
+
return { control, withPlugin, onKeyDown: onKeyDown2, renderElement };
|
|
2287
2432
|
}
|
|
2288
2433
|
function unstable_RichTextV2(config = {}) {
|
|
2289
2434
|
return { type: RichTextV2ControlType, config };
|
|
@@ -2306,7 +2451,7 @@ class RichTextV2Control extends PropController {
|
|
|
2306
2451
|
__publicField(this, "defaultValue", null);
|
|
2307
2452
|
__publicField(this, "descriptor");
|
|
2308
2453
|
__publicField(this, "recv", (message) => {
|
|
2309
|
-
var
|
|
2454
|
+
var _a2, _b, _c;
|
|
2310
2455
|
if (!this.editor)
|
|
2311
2456
|
return;
|
|
2312
2457
|
switch (message.type) {
|
|
@@ -2323,7 +2468,7 @@ class RichTextV2Control extends PropController {
|
|
|
2323
2468
|
break;
|
|
2324
2469
|
}
|
|
2325
2470
|
case RichTextV2ControlMessageType.RUN_PLUGIN_CONTROL_ACTION: {
|
|
2326
|
-
(_c = (_b = (
|
|
2471
|
+
(_c = (_b = (_a2 = this.descriptor.config.plugins) == null ? void 0 : _a2.at(message.pluginIndex)) == null ? void 0 : _b.control) == null ? void 0 : _c.onChange(this.editor, message.value);
|
|
2327
2472
|
break;
|
|
2328
2473
|
}
|
|
2329
2474
|
}
|
|
@@ -2332,13 +2477,13 @@ class RichTextV2Control extends PropController {
|
|
|
2332
2477
|
this.send = send;
|
|
2333
2478
|
}
|
|
2334
2479
|
setEditor(editor) {
|
|
2335
|
-
var
|
|
2480
|
+
var _a2, _b, _c;
|
|
2336
2481
|
this.editor = editor;
|
|
2337
2482
|
this.send({
|
|
2338
2483
|
type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
|
|
2339
|
-
value: (_c = (_b = (
|
|
2340
|
-
var
|
|
2341
|
-
return (
|
|
2484
|
+
value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
|
|
2485
|
+
var _a3;
|
|
2486
|
+
return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
|
|
2342
2487
|
})) != null ? _c : []
|
|
2343
2488
|
});
|
|
2344
2489
|
}
|
|
@@ -2353,7 +2498,7 @@ class RichTextV2Control extends PropController {
|
|
|
2353
2498
|
this.send({ type: RichTextV2ControlMessageType.SWITCH_TO_BUILD_MODE });
|
|
2354
2499
|
}
|
|
2355
2500
|
onChange(value) {
|
|
2356
|
-
var
|
|
2501
|
+
var _a2, _b, _c;
|
|
2357
2502
|
const editor = this.editor;
|
|
2358
2503
|
if (editor == null)
|
|
2359
2504
|
return;
|
|
@@ -2363,9 +2508,9 @@ class RichTextV2Control extends PropController {
|
|
|
2363
2508
|
});
|
|
2364
2509
|
this.send({
|
|
2365
2510
|
type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
|
|
2366
|
-
value: (_c = (_b = (
|
|
2367
|
-
var
|
|
2368
|
-
return (
|
|
2511
|
+
value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
|
|
2512
|
+
var _a3;
|
|
2513
|
+
return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
|
|
2369
2514
|
})) != null ? _c : []
|
|
2370
2515
|
});
|
|
2371
2516
|
}
|
|
@@ -2379,8 +2524,8 @@ function isText(node) {
|
|
|
2379
2524
|
return false;
|
|
2380
2525
|
}
|
|
2381
2526
|
function toTextDAO(node) {
|
|
2382
|
-
var
|
|
2383
|
-
const typographyMark = (
|
|
2527
|
+
var _a2, _b, _c, _d;
|
|
2528
|
+
const typographyMark = (_a2 = node.marks) == null ? void 0 : _a2.find((mark) => mark.type === "typography");
|
|
2384
2529
|
return [
|
|
2385
2530
|
{
|
|
2386
2531
|
text: (_b = node.text) != null ? _b : "",
|
|
@@ -2389,12 +2534,12 @@ function toTextDAO(node) {
|
|
|
2389
2534
|
];
|
|
2390
2535
|
}
|
|
2391
2536
|
function toInlineDAO(node) {
|
|
2392
|
-
var
|
|
2537
|
+
var _a2, _b, _c, _d;
|
|
2393
2538
|
switch (node.type) {
|
|
2394
2539
|
case InlineType.Link:
|
|
2395
2540
|
return [
|
|
2396
2541
|
{
|
|
2397
|
-
children: (_b = (
|
|
2542
|
+
children: (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(toInlineOrTextDAO)) != null ? _b : [],
|
|
2398
2543
|
[node.type]: node.data,
|
|
2399
2544
|
type: node.type
|
|
2400
2545
|
}
|
|
@@ -2423,7 +2568,7 @@ function toInlineOrTextDAO(node) {
|
|
|
2423
2568
|
}
|
|
2424
2569
|
}
|
|
2425
2570
|
function toNodeDAO(node) {
|
|
2426
|
-
var
|
|
2571
|
+
var _a2, _b;
|
|
2427
2572
|
switch (node.object) {
|
|
2428
2573
|
case ObjectType.Inline:
|
|
2429
2574
|
case ObjectType.Text:
|
|
@@ -2433,7 +2578,7 @@ function toNodeDAO(node) {
|
|
|
2433
2578
|
{
|
|
2434
2579
|
type: node.type,
|
|
2435
2580
|
textAlign: (node == null ? void 0 : node.data) && "textAlign" in node.data ? node == null ? void 0 : node.data.textAlign : void 0,
|
|
2436
|
-
children: (_b = (
|
|
2581
|
+
children: (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(toNodeDAO)) != null ? _b : []
|
|
2437
2582
|
}
|
|
2438
2583
|
];
|
|
2439
2584
|
default:
|
|
@@ -2441,8 +2586,8 @@ function toNodeDAO(node) {
|
|
|
2441
2586
|
}
|
|
2442
2587
|
}
|
|
2443
2588
|
function richTextDTOtoSelection(data) {
|
|
2444
|
-
var
|
|
2445
|
-
if (((_b = (
|
|
2589
|
+
var _a2, _b, _c, _d;
|
|
2590
|
+
if (((_b = (_a2 = data.selection) == null ? void 0 : _a2.anchor) == null ? void 0 : _b.offset) != null && data.selection.anchor.path != null && ((_d = (_c = data.selection) == null ? void 0 : _c.focus) == null ? void 0 : _d.offset) != null && data.selection.focus.path != null)
|
|
2446
2591
|
return {
|
|
2447
2592
|
anchor: {
|
|
2448
2593
|
offset: data.selection.anchor.offset,
|
|
@@ -2456,8 +2601,8 @@ function richTextDTOtoSelection(data) {
|
|
|
2456
2601
|
return null;
|
|
2457
2602
|
}
|
|
2458
2603
|
function richTextDTOtoDAO(data) {
|
|
2459
|
-
var
|
|
2460
|
-
return (_c = (_b = (
|
|
2604
|
+
var _a2, _b, _c;
|
|
2605
|
+
return (_c = (_b = (_a2 = data.document) == null ? void 0 : _a2.nodes) == null ? void 0 : _b.flatMap(toNodeDAO)) != null ? _c : [];
|
|
2461
2606
|
}
|
|
2462
2607
|
function toInlineOrTextDTO(node) {
|
|
2463
2608
|
if (isText(node)) {
|
|
@@ -2501,7 +2646,7 @@ function toInlineOrTextDTO(node) {
|
|
|
2501
2646
|
}
|
|
2502
2647
|
}
|
|
2503
2648
|
function toNodeDTO(node) {
|
|
2504
|
-
var
|
|
2649
|
+
var _a2, _b;
|
|
2505
2650
|
if (isText(node))
|
|
2506
2651
|
return toInlineOrTextDTO(node);
|
|
2507
2652
|
switch (node.type) {
|
|
@@ -2526,7 +2671,7 @@ function toNodeDTO(node) {
|
|
|
2526
2671
|
textAlign: node.textAlign
|
|
2527
2672
|
} : {},
|
|
2528
2673
|
object: "block",
|
|
2529
|
-
nodes: (_b = (
|
|
2674
|
+
nodes: (_b = (_a2 = node.children) == null ? void 0 : _a2.flatMap(toNodeDTO)) != null ? _b : []
|
|
2530
2675
|
}
|
|
2531
2676
|
];
|
|
2532
2677
|
default:
|
|
@@ -2890,51 +3035,51 @@ function getElementId$1(descriptor, prop) {
|
|
|
2890
3035
|
}
|
|
2891
3036
|
}
|
|
2892
3037
|
function getBackgroundsSwatchIds(value) {
|
|
2893
|
-
var
|
|
2894
|
-
return (
|
|
2895
|
-
var
|
|
3038
|
+
var _a2;
|
|
3039
|
+
return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
|
|
3040
|
+
var _a3;
|
|
2896
3041
|
switch (backgroundItem.type) {
|
|
2897
3042
|
case "color":
|
|
2898
|
-
return ((
|
|
3043
|
+
return ((_a3 = backgroundItem.payload) == null ? void 0 : _a3.swatchId) == null ? [] : [backgroundItem.payload.swatchId];
|
|
2899
3044
|
case "gradient":
|
|
2900
3045
|
return backgroundItem.payload.stops.flatMap((stop) => stop.color == null ? [] : stop.color.swatchId);
|
|
2901
3046
|
default:
|
|
2902
3047
|
return [];
|
|
2903
3048
|
}
|
|
2904
|
-
})) != null ?
|
|
3049
|
+
})) != null ? _a2 : [];
|
|
2905
3050
|
}
|
|
2906
3051
|
function getBorderSwatchIds(value) {
|
|
2907
|
-
var
|
|
2908
|
-
return (
|
|
2909
|
-
var
|
|
3052
|
+
var _a2;
|
|
3053
|
+
return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((borderValue) => {
|
|
3054
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h;
|
|
2910
3055
|
return [
|
|
2911
|
-
(_b = (
|
|
3056
|
+
(_b = (_a3 = borderValue.borderTop) == null ? void 0 : _a3.color) == null ? void 0 : _b.swatchId,
|
|
2912
3057
|
(_d = (_c = borderValue.borderRight) == null ? void 0 : _c.color) == null ? void 0 : _d.swatchId,
|
|
2913
3058
|
(_f = (_e = borderValue.borderBottom) == null ? void 0 : _e.color) == null ? void 0 : _f.swatchId,
|
|
2914
3059
|
(_h = (_g = borderValue.borderLeft) == null ? void 0 : _g.color) == null ? void 0 : _h.swatchId
|
|
2915
3060
|
].filter((swatchId) => swatchId != null);
|
|
2916
|
-
})) != null ?
|
|
3061
|
+
})) != null ? _a2 : [];
|
|
2917
3062
|
}
|
|
2918
3063
|
function getBoxShadowsSwatchIds(value) {
|
|
2919
|
-
var
|
|
2920
|
-
return (
|
|
2921
|
-
var
|
|
2922
|
-
return (
|
|
2923
|
-
}).filter((swatchId) => swatchId != null)) != null ?
|
|
3064
|
+
var _a2;
|
|
3065
|
+
return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).map((item) => {
|
|
3066
|
+
var _a3;
|
|
3067
|
+
return (_a3 = item.payload.color) == null ? void 0 : _a3.swatchId;
|
|
3068
|
+
}).filter((swatchId) => swatchId != null)) != null ? _a2 : [];
|
|
2924
3069
|
}
|
|
2925
3070
|
function getResponsiveColorSwatchIds(value) {
|
|
2926
|
-
var
|
|
2927
|
-
return (
|
|
3071
|
+
var _a2;
|
|
3072
|
+
return (_a2 = value == null ? void 0 : value.map((override) => override.value).map((color) => color.swatchId)) != null ? _a2 : [];
|
|
2928
3073
|
}
|
|
2929
3074
|
function getTypographyStyleSwatchIds(style) {
|
|
2930
|
-
var
|
|
2931
|
-
return (
|
|
2932
|
-
var
|
|
2933
|
-
return (
|
|
2934
|
-
}).filter(isNonNullable)) != null ?
|
|
3075
|
+
var _a2;
|
|
3076
|
+
return (_a2 = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
|
|
3077
|
+
var _a3;
|
|
3078
|
+
return (_a3 = typographyStyle.color) == null ? void 0 : _a3.swatchId;
|
|
3079
|
+
}).filter(isNonNullable)) != null ? _a2 : [];
|
|
2935
3080
|
}
|
|
2936
3081
|
function getElementSwatchIds(descriptor, prop) {
|
|
2937
|
-
var
|
|
3082
|
+
var _a2;
|
|
2938
3083
|
if (prop == null)
|
|
2939
3084
|
return [];
|
|
2940
3085
|
switch (descriptor.type) {
|
|
@@ -2944,17 +3089,17 @@ function getElementSwatchIds(descriptor, prop) {
|
|
|
2944
3089
|
return getBorderSwatchIds(prop);
|
|
2945
3090
|
case Types.NavigationLinks: {
|
|
2946
3091
|
const value = prop;
|
|
2947
|
-
return (
|
|
2948
|
-
var
|
|
3092
|
+
return (_a2 = value == null ? void 0 : value.flatMap((item) => {
|
|
3093
|
+
var _a3, _b, _c, _d;
|
|
2949
3094
|
switch (item.type) {
|
|
2950
3095
|
case "button":
|
|
2951
3096
|
case "dropdown":
|
|
2952
3097
|
return [
|
|
2953
|
-
...(_b = (
|
|
3098
|
+
...(_b = (_a3 = item.payload.color) == null ? void 0 : _a3.map((override) => override.value).map((color) => color.swatchId)) != null ? _b : [],
|
|
2954
3099
|
...(_d = (_c = item.payload.textColor) == null ? void 0 : _c.map((override) => override.value).map((color) => color.swatchId)) != null ? _d : []
|
|
2955
3100
|
];
|
|
2956
3101
|
}
|
|
2957
|
-
})) != null ?
|
|
3102
|
+
})) != null ? _a2 : [];
|
|
2958
3103
|
}
|
|
2959
3104
|
case Types.ResponsiveColor:
|
|
2960
3105
|
return getResponsiveColorSwatchIds(prop);
|
|
@@ -2962,20 +3107,20 @@ function getElementSwatchIds(descriptor, prop) {
|
|
|
2962
3107
|
return getBoxShadowsSwatchIds(prop);
|
|
2963
3108
|
case Types.RichText: {
|
|
2964
3109
|
let getNodeSwatchIds = function(node) {
|
|
2965
|
-
var
|
|
3110
|
+
var _a3, _b, _c, _d;
|
|
2966
3111
|
switch (node.object) {
|
|
2967
3112
|
case "document":
|
|
2968
3113
|
case "block":
|
|
2969
3114
|
case "inline":
|
|
2970
|
-
return (_b = (
|
|
3115
|
+
return (_b = (_a3 = node.nodes) == null ? void 0 : _a3.flatMap(getNodeSwatchIds)) != null ? _b : [];
|
|
2971
3116
|
case "text":
|
|
2972
3117
|
return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkSwatchIds)) != null ? _d : [];
|
|
2973
3118
|
default:
|
|
2974
3119
|
return [];
|
|
2975
3120
|
}
|
|
2976
3121
|
}, getMarkSwatchIds = function(mark) {
|
|
2977
|
-
var
|
|
2978
|
-
return getTypographyStyleSwatchIds((_b = (
|
|
3122
|
+
var _a3, _b;
|
|
3123
|
+
return getTypographyStyleSwatchIds((_b = (_a3 = mark.data) == null ? void 0 : _a3.value) == null ? void 0 : _b.style);
|
|
2979
3124
|
};
|
|
2980
3125
|
const value = prop;
|
|
2981
3126
|
if (value == null || value.document == null)
|
|
@@ -2991,18 +3136,18 @@ function getElementSwatchIds(descriptor, prop) {
|
|
|
2991
3136
|
}
|
|
2992
3137
|
}
|
|
2993
3138
|
function getBackgroundsFileIds(value) {
|
|
2994
|
-
var
|
|
2995
|
-
return (
|
|
3139
|
+
var _a2;
|
|
3140
|
+
return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
|
|
2996
3141
|
switch (backgroundItem.type) {
|
|
2997
3142
|
case "image":
|
|
2998
3143
|
return [backgroundItem.payload.imageId];
|
|
2999
3144
|
default:
|
|
3000
3145
|
return [];
|
|
3001
3146
|
}
|
|
3002
|
-
})) != null ?
|
|
3147
|
+
})) != null ? _a2 : [];
|
|
3003
3148
|
}
|
|
3004
3149
|
function getFileIds(descriptor, prop) {
|
|
3005
|
-
var
|
|
3150
|
+
var _a2;
|
|
3006
3151
|
if (prop == null)
|
|
3007
3152
|
return [];
|
|
3008
3153
|
switch (descriptor.type) {
|
|
@@ -3014,7 +3159,7 @@ function getFileIds(descriptor, prop) {
|
|
|
3014
3159
|
}
|
|
3015
3160
|
case Types.Images: {
|
|
3016
3161
|
const value = prop;
|
|
3017
|
-
return (
|
|
3162
|
+
return (_a2 = value == null ? void 0 : value.flatMap((item) => item.props.file == null ? [] : [item.props.file])) != null ? _a2 : [];
|
|
3018
3163
|
}
|
|
3019
3164
|
case ImageControlType: {
|
|
3020
3165
|
const value = prop;
|
|
@@ -3030,20 +3175,20 @@ function getTypographyIds(descriptor, prop) {
|
|
|
3030
3175
|
switch (descriptor.type) {
|
|
3031
3176
|
case Types.RichText: {
|
|
3032
3177
|
let getNodeTypographyIds = function(node) {
|
|
3033
|
-
var
|
|
3178
|
+
var _a2, _b, _c, _d;
|
|
3034
3179
|
switch (node.object) {
|
|
3035
3180
|
case "document":
|
|
3036
3181
|
case "block":
|
|
3037
3182
|
case "inline":
|
|
3038
|
-
return (_b = (
|
|
3183
|
+
return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodeTypographyIds)) != null ? _b : [];
|
|
3039
3184
|
case "text":
|
|
3040
3185
|
return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkTypographyIds)) != null ? _d : [];
|
|
3041
3186
|
default:
|
|
3042
3187
|
return [];
|
|
3043
3188
|
}
|
|
3044
3189
|
}, getMarkTypographyIds = function(mark) {
|
|
3045
|
-
var
|
|
3046
|
-
return [(_b = (
|
|
3190
|
+
var _a2, _b;
|
|
3191
|
+
return [(_b = (_a2 = mark.data) == null ? void 0 : _a2.value) == null ? void 0 : _b.id].filter((id) => id != null);
|
|
3047
3192
|
};
|
|
3048
3193
|
const value = prop;
|
|
3049
3194
|
if (value == null || value.document == null)
|
|
@@ -3067,7 +3212,7 @@ function getTableIds(descriptor, prop) {
|
|
|
3067
3212
|
}
|
|
3068
3213
|
}
|
|
3069
3214
|
function getPageIds(descriptor, prop) {
|
|
3070
|
-
var
|
|
3215
|
+
var _a2;
|
|
3071
3216
|
if (prop == null)
|
|
3072
3217
|
return [];
|
|
3073
3218
|
switch (descriptor.type) {
|
|
@@ -3086,8 +3231,8 @@ function getPageIds(descriptor, prop) {
|
|
|
3086
3231
|
const value = prop;
|
|
3087
3232
|
if (value == null)
|
|
3088
3233
|
return [];
|
|
3089
|
-
return (
|
|
3090
|
-
var
|
|
3234
|
+
return (_a2 = value == null ? void 0 : value.flatMap((item) => {
|
|
3235
|
+
var _a3, _b;
|
|
3091
3236
|
switch (item.type) {
|
|
3092
3237
|
case "button": {
|
|
3093
3238
|
if (item.payload.link == null)
|
|
@@ -3100,7 +3245,7 @@ function getPageIds(descriptor, prop) {
|
|
|
3100
3245
|
}
|
|
3101
3246
|
}
|
|
3102
3247
|
case "dropdown": {
|
|
3103
|
-
return (_b = (
|
|
3248
|
+
return (_b = (_a3 = item.payload.links) == null ? void 0 : _a3.flatMap((link) => {
|
|
3104
3249
|
if (link.payload.link == null)
|
|
3105
3250
|
return [];
|
|
3106
3251
|
switch (link.payload.link.type) {
|
|
@@ -3112,25 +3257,25 @@ function getPageIds(descriptor, prop) {
|
|
|
3112
3257
|
})) != null ? _b : [];
|
|
3113
3258
|
}
|
|
3114
3259
|
}
|
|
3115
|
-
})) != null ?
|
|
3260
|
+
})) != null ? _a2 : [];
|
|
3116
3261
|
}
|
|
3117
3262
|
case Types.RichText: {
|
|
3118
3263
|
let getNodePageIds = function(node) {
|
|
3119
|
-
var
|
|
3264
|
+
var _a3, _b;
|
|
3120
3265
|
switch (node.object) {
|
|
3121
3266
|
case "document":
|
|
3122
3267
|
case "block":
|
|
3123
|
-
return (_b = (
|
|
3268
|
+
return (_b = (_a3 = node.nodes) == null ? void 0 : _a3.flatMap(getNodePageIds)) != null ? _b : [];
|
|
3124
3269
|
case "inline":
|
|
3125
3270
|
return getInlinePageIds(node);
|
|
3126
3271
|
default:
|
|
3127
3272
|
return [];
|
|
3128
3273
|
}
|
|
3129
3274
|
}, getInlinePageIds = function(inline) {
|
|
3130
|
-
var
|
|
3275
|
+
var _a3, _b, _c, _d;
|
|
3131
3276
|
switch (inline.type) {
|
|
3132
3277
|
case "link": {
|
|
3133
|
-
const nodePageIds = (_b = (
|
|
3278
|
+
const nodePageIds = (_b = (_a3 = inline.nodes) == null ? void 0 : _a3.flatMap(getNodePageIds)) != null ? _b : [];
|
|
3134
3279
|
const dataPageIds = inline.data ? getLinkDataPageIds(inline.data) : [];
|
|
3135
3280
|
return [...nodePageIds, ...dataPageIds];
|
|
3136
3281
|
}
|
|
@@ -3245,14 +3390,14 @@ function getDocumentKeysSortedByDepth(state) {
|
|
|
3245
3390
|
elements.set(key, getDocumentElements(state, key));
|
|
3246
3391
|
});
|
|
3247
3392
|
keys.sort((a, b) => {
|
|
3248
|
-
var
|
|
3249
|
-
return ((
|
|
3393
|
+
var _a2;
|
|
3394
|
+
return ((_a2 = elements.get(a)) == null ? void 0 : _a2.has(b)) ? -1 : 1;
|
|
3250
3395
|
});
|
|
3251
3396
|
return keys;
|
|
3252
3397
|
}
|
|
3253
3398
|
function getElement(state, documentKey, elementKey) {
|
|
3254
|
-
var
|
|
3255
|
-
return (
|
|
3399
|
+
var _a2;
|
|
3400
|
+
return (_a2 = getDocumentElements(state, documentKey).get(elementKey)) != null ? _a2 : null;
|
|
3256
3401
|
}
|
|
3257
3402
|
function getElementPropControllerDescriptors(state, documentKey, elementKey) {
|
|
3258
3403
|
const element = getElement(state, documentKey, elementKey);
|
|
@@ -3338,5 +3483,5 @@ function configureStore({
|
|
|
3338
3483
|
locales: getInitialState(locales != null ? locales : preloadedState == null ? void 0 : preloadedState.locales)
|
|
3339
3484
|
}), applyMiddleware(thunk));
|
|
3340
3485
|
}
|
|
3341
|
-
export {
|
|
3486
|
+
export { isNonNullable 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, ListControlType as L, Margin as M, Number as N, Image as O, Padding as P, ResponsiveOpacity as Q, RichTextPropControllerMessageType as R, ShapeControlType 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 _, createDocumentReference as a, ObjectType as a$, getBoxShadowsSwatchIds as a0, getResponsiveColorSwatchIds as a1, StyleControlProperty as a2, ImageControlValueFormat as a3, isPropControllersHandle as a4, StyleV2ControlType as a5, StyleControlType as a6, RichTextV2ControlType as a7, RichTextControlType as a8, SlotControlType as a9, merge as aA, Image$1 as aB, copyImageData as aC, Link$1 as aD, copyLinkData as aE, List$1 as aF, ListControlMessageType as aG, ListControl as aH, copyListData as aI, Select as aJ, Shape$1 as aK, ShapeControlMessageType as aL, ShapeControl as aM, copyShapeData as aN, Slot as aO, SlotControlMessageType as aP, SlotControl as aQ, copySlotData as aR, mergeSlotData as aS, Style as aT, StyleControlMessageType as aU, StyleControl as aV, copyStyleData as aW, unstable_useStyleV2ClassName as aX, unstable_StyleV2 as aY, StyleV2ControlMessageType as aZ, StyleV2Control as a_, LinkControlType as aa, ImageControlType as ab, ColorControlType as ac, SelectControlType as ad, getComponentPropControllerDescriptors as ae, getPropControllers as af, BorderPropControllerFormat as ag, ShadowsPropControllerFormat as ah, BorderRadiusPropControllerFormat as ai, MarginPropControllerFormat as aj, PaddingPropControllerFormat as ak, WidthPropControllerFormat as al, configureStore as am, copyElementTree as an, getBreakpoints as ao, getDocument as ap, getElementId as aq, getIsPreview as ar, getIsInBuilder as as, getReactComponent as at, getBuilderEditMode as au, getBackgroundsFileIds as av, getBackgroundsSwatchIds as aw, Color as ax, copyColorData as ay, copy as az, isElementReference as b, RichText$1 as b0, RichTextControlMessageType as b1, RichTextControl as b2, richTextDTOtoSelection as b3, richTextDTOtoDAO as b4, toSelectionDTO as b5, richTextDAOToDTO as b6, RichTextV2Mode as b7, createRichTextV2Plugin as b8, unstable_RichTextV2 as b9, reducer$7 as bA, reducer$9 as bB, reducer$6 as bC, reducer$5 as bD, reducer$4 as bE, reducer$3 as bF, reducer$2 as bG, reducer$1 as bH, getInitialState$2 as bI, RichTextV2ControlMessageType as ba, RichTextV2Control as bb, getBlocksInSelection as bc, ElementUtils as bd, BlockActions as be, ListActions as bf, onKeyDown as bg, withBlock as bh, BlockPlugin as bi, RootBlockType as bj, BlockType as bk, InlineType as bl, BlockTextAlignment as bm, getInitialState$7 as bn, reducer$8 as bo, getDocument$1 as bp, getComponentsMeta as bq, getComponentPropControllerDescriptors$1 as br, getLocales as bs, BuilderEditMode as bt, getDocumentKeysSortedByDepth as bu, getPropController as bv, getPropControllersHandle as bw, getElement as bx, getElementPropControllerDescriptors as by, createPropController as bz, createDocument as c, descriptors as d, getElementSwatchIds as e, getFileIds as f, getPropControllerDescriptors as g, getTypographyIds as h, introspection as i, getTableIds as j, getPageIds as k, getElementChildren as l, Types as m, ResponsiveIconRadioGroup as n, Border as o, BorderRadius as p, Shadows as q, GapX as r, ResponsiveSelect as s, ResponsiveNumber as t, Checkbox as u, Grid as v, TextInput as w, Link as x, ResponsiveColor as y, TextStyle as z };
|
|
3342
3487
|
//# sourceMappingURL=react-page.es.js.map
|