@makeswift/runtime 0.9.0 → 0.9.2
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 -15
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +10 -10
- package/dist/Button.cjs.js +12 -12
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +10 -10
- package/dist/Carousel.cjs.js +28 -28
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +7 -7
- package/dist/Countdown.cjs.js +15 -15
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +7 -7
- package/dist/Divider.cjs.js +12 -12
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +10 -10
- package/dist/Embed.cjs.js +3 -30
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +2 -29
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +51 -51
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +7 -7
- package/dist/Image.cjs.js +8 -8
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +7 -7
- package/dist/LiveProvider.cjs.js +6 -6
- package/dist/LiveProvider.es.js +8 -8
- package/dist/Navigation.cjs.js +27 -27
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +6 -6
- package/dist/PreviewProvider.cjs.js +7 -7
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +7 -7
- package/dist/ReadOnlyText.cjs.js +16 -13
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +11 -8
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +13 -10
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +9 -6
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +8 -8
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +6 -6
- package/dist/SocialLinks.cjs.js +14 -14
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +10 -10
- package/dist/Text.cjs.js +4 -4
- package/dist/Text.es.js +5 -5
- package/dist/Video.cjs.js +3 -30
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +2 -29
- package/dist/Video.es.js.map +1 -1
- package/dist/builder.cjs.js +4 -2
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +4 -2
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +9 -9
- package/dist/components.es.js +9 -9
- package/dist/control-serialization.cjs.js +88 -12
- package/dist/control-serialization.cjs.js.map +1 -1
- package/dist/control-serialization.es.js +89 -13
- package/dist/control-serialization.es.js.map +1 -1
- package/dist/controls.cjs.js +15 -4
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +6 -3
- 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 +102 -98
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs10.js +173 -249
- package/dist/index.cjs10.js.map +1 -1
- package/dist/index.cjs11.js +375 -0
- package/dist/index.cjs11.js.map +1 -0
- package/dist/index.cjs2.js +14 -16
- 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.cjs6.js +700 -22
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +37 -13
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.cjs8.js +17 -41
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.cjs9.js +13 -266
- package/dist/index.cjs9.js.map +1 -1
- package/dist/index.es.js +85 -80
- package/dist/index.es.js.map +1 -1
- package/dist/index.es10.js +174 -250
- package/dist/index.es10.js.map +1 -1
- package/dist/index.es11.js +368 -0
- package/dist/index.es11.js.map +1 -0
- package/dist/index.es2.js +3 -5
- package/dist/index.es2.js.map +1 -1
- 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 +695 -22
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es7.js +33 -14
- package/dist/index.es7.js.map +1 -1
- package/dist/index.es8.js +17 -39
- package/dist/index.es8.js.map +1 -1
- package/dist/index.es9.js +12 -261
- 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 +4 -2
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +4 -2
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +3 -3
- package/dist/next.es.js +4 -4
- package/dist/prop-controllers.cjs.js +4 -2
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +4 -2
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/react-page.cjs.js +958 -1431
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +852 -1343
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +3 -3
- package/dist/react.es.js +3 -3
- package/dist/select.cjs.js +21 -0
- package/dist/select.cjs.js.map +1 -0
- package/dist/select.es.js +16 -0
- package/dist/select.es.js.map +1 -0
- package/dist/slate.cjs.js +213 -12
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +207 -6
- package/dist/slate.es.js.map +1 -1
- package/dist/types/src/api/react.d.ts.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/components/page/Page.d.ts.map +1 -1
- package/dist/types/src/controls/control.d.ts +4 -2
- package/dist/types/src/controls/control.d.ts.map +1 -1
- package/dist/types/src/controls/icon-radio-group.d.ts +29 -0
- package/dist/types/src/controls/icon-radio-group.d.ts.map +1 -0
- package/dist/types/src/controls/index.d.ts +2 -0
- package/dist/types/src/controls/index.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/translation.d.ts +1 -1
- package/dist/types/src/controls/rich-text/translation.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +12 -3
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/controls/shape.d.ts +1 -2
- package/dist/types/src/controls/shape.d.ts.map +1 -1
- package/dist/types/src/controls/style-v2.d.ts +64 -0
- package/dist/types/src/controls/style-v2.d.ts.map +1 -0
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/next/document.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts +6 -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/prop-controllers/introspection.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts +5 -2
- package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/icon-radio-group.d.ts +4 -0
- package/dist/types/src/runtimes/react/controls/icon-radio-group.d.ts.map +1 -0
- 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/EditableTextV2/render-element.d.ts +10 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts +10 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts.map +1 -0
- 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 +13 -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/runtimes/react/index.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/index.d.ts +4 -0
- package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/ColorPlugin/index.d.ts +10 -0
- package/dist/types/src/slate/ColorPlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/InlineModePlugin/index.d.ts +2 -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 +2 -0
- package/dist/types/src/slate/index.d.ts.map +1 -1
- package/dist/types/src/slate/types.d.ts +39 -0
- package/dist/types/src/slate/types.d.ts.map +1 -1
- package/dist/types/src/slate/utils/responsive.d.ts +16 -0
- package/dist/types/src/slate/utils/responsive.d.ts.map +1 -0
- package/dist/useMediaQuery.es.js +1 -1
- package/package.json +1 -1
package/dist/react-page.es.js
CHANGED
|
@@ -22,13 +22,16 @@ 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
|
-
import {
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import "
|
|
29
|
+
import { reducer as reducer$a, getInitialState as getInitialState$9 } from "./state/breakpoints.es.js";
|
|
30
|
+
import * as React from "react";
|
|
31
|
+
import { cache } from "@emotion/css";
|
|
32
|
+
import { serializeStyles } from "@emotion/serialize";
|
|
33
|
+
import { registerStyles, insertStyles } from "@emotion/utils";
|
|
34
|
+
import { Element, Text } from "slate";
|
|
32
35
|
const ComponentIcon = {
|
|
33
36
|
Billing: "billing",
|
|
34
37
|
Bolt: "bolt",
|
|
@@ -96,8 +99,8 @@ function getDocuments(state) {
|
|
|
96
99
|
return state;
|
|
97
100
|
}
|
|
98
101
|
function getDocument$1(state, documentKey) {
|
|
99
|
-
var
|
|
100
|
-
return (
|
|
102
|
+
var _a2;
|
|
103
|
+
return (_a2 = getDocuments(state).get(documentKey)) != null ? _a2 : null;
|
|
101
104
|
}
|
|
102
105
|
function reducer$8(state = getInitialState$7(), action) {
|
|
103
106
|
switch (action.type) {
|
|
@@ -121,8 +124,8 @@ function getReactComponents(state) {
|
|
|
121
124
|
return state;
|
|
122
125
|
}
|
|
123
126
|
function getReactComponent$1(state, type) {
|
|
124
|
-
var
|
|
125
|
-
return (
|
|
127
|
+
var _a2;
|
|
128
|
+
return (_a2 = getReactComponents(state).get(type)) != null ? _a2 : null;
|
|
126
129
|
}
|
|
127
130
|
function reducer$7(state = getInitialState$6(), action) {
|
|
128
131
|
switch (action.type) {
|
|
@@ -146,8 +149,8 @@ function getPropControllerDescriptors$1(state) {
|
|
|
146
149
|
return state;
|
|
147
150
|
}
|
|
148
151
|
function getComponentPropControllerDescriptors$1(state, componentType) {
|
|
149
|
-
var
|
|
150
|
-
return (
|
|
152
|
+
var _a2;
|
|
153
|
+
return (_a2 = getPropControllerDescriptors$1(state).get(componentType)) != null ? _a2 : null;
|
|
151
154
|
}
|
|
152
155
|
function reducer$6(state = getInitialState$5(), action) {
|
|
153
156
|
switch (action.type) {
|
|
@@ -172,24 +175,24 @@ function getInitialState$4() {
|
|
|
172
175
|
return { handles: /* @__PURE__ */ new Map(), instances: /* @__PURE__ */ new Map() };
|
|
173
176
|
}
|
|
174
177
|
function getPropControllersHandle(state, documentKey, elementKey) {
|
|
175
|
-
var
|
|
176
|
-
return (_b = (
|
|
178
|
+
var _a2, _b;
|
|
179
|
+
return (_b = (_a2 = state.handles.get(documentKey)) == null ? void 0 : _a2.get(elementKey)) != null ? _b : null;
|
|
177
180
|
}
|
|
178
181
|
function getPropControllers$1(state, documentKey, elementKey) {
|
|
179
|
-
var
|
|
180
|
-
return (_b = (
|
|
182
|
+
var _a2, _b;
|
|
183
|
+
return (_b = (_a2 = state.instances.get(documentKey)) == null ? void 0 : _a2.get(elementKey)) != null ? _b : null;
|
|
181
184
|
}
|
|
182
185
|
function getPropController(state, documentKey, elementKey, propName) {
|
|
183
|
-
var
|
|
184
|
-
return (_b = (
|
|
186
|
+
var _a2, _b;
|
|
187
|
+
return (_b = (_a2 = getPropControllers$1(state, documentKey, elementKey)) == null ? void 0 : _a2[propName]) != null ? _b : null;
|
|
185
188
|
}
|
|
186
189
|
function reducer$5(state = getInitialState$4(), action) {
|
|
187
|
-
var
|
|
190
|
+
var _a2, _b, _c, _d;
|
|
188
191
|
switch (action.type) {
|
|
189
192
|
case ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE: {
|
|
190
193
|
const { documentKey, elementKey, handle } = action.payload;
|
|
191
194
|
return __spreadProps(__spreadValues({}, state), {
|
|
192
|
-
handles: new Map(state.handles).set(documentKey, new Map((
|
|
195
|
+
handles: new Map(state.handles).set(documentKey, new Map((_a2 = state.handles.get(documentKey)) != null ? _a2 : []).set(elementKey, handle))
|
|
193
196
|
});
|
|
194
197
|
}
|
|
195
198
|
case ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE: {
|
|
@@ -254,9 +257,9 @@ function reducer$2(state = getInitialState$1(), action) {
|
|
|
254
257
|
}
|
|
255
258
|
}
|
|
256
259
|
function getInitialState(initialState) {
|
|
257
|
-
var
|
|
260
|
+
var _a2, _b, _c;
|
|
258
261
|
return {
|
|
259
|
-
locales: (
|
|
262
|
+
locales: (_a2 = initialState == null ? void 0 : initialState.locales) != null ? _a2 : [],
|
|
260
263
|
locale: (_b = initialState == null ? void 0 : initialState.locale) != null ? _b : null,
|
|
261
264
|
defaultLocale: (_c = initialState == null ? void 0 : initialState.defaultLocale) != null ? _c : null
|
|
262
265
|
};
|
|
@@ -286,27 +289,450 @@ function Color(config = {}) {
|
|
|
286
289
|
return { type: ColorControlType, config };
|
|
287
290
|
}
|
|
288
291
|
function copyColorData(value, context) {
|
|
289
|
-
var
|
|
292
|
+
var _a2;
|
|
290
293
|
if (value == null)
|
|
291
294
|
return value;
|
|
292
295
|
return __spreadProps(__spreadValues({}, value), {
|
|
293
|
-
swatchId: (
|
|
296
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(value.swatchId)) != null ? _a2 : value.swatchId
|
|
294
297
|
});
|
|
295
298
|
}
|
|
299
|
+
class PropController {
|
|
300
|
+
constructor(send) {
|
|
301
|
+
__publicField(this, "send");
|
|
302
|
+
this.send = send;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
const StyleControlType = "makeswift::controls::style";
|
|
306
|
+
const StyleControlProperty = {
|
|
307
|
+
Width: "makeswift::controls::style::property::width",
|
|
308
|
+
Margin: "makeswift::controls::style::property::margin",
|
|
309
|
+
Padding: "makeswift::controls::style::property::padding",
|
|
310
|
+
Border: "makeswift::controls::style::property::border",
|
|
311
|
+
BorderRadius: "makeswift::controls::style::property::border-radius",
|
|
312
|
+
TextStyle: "makeswift::controls::style::property::text-style"
|
|
313
|
+
};
|
|
314
|
+
const StyleControlDefaultProperties = [
|
|
315
|
+
StyleControlProperty.Width,
|
|
316
|
+
StyleControlProperty.Margin
|
|
317
|
+
];
|
|
318
|
+
const AllStyleControlProperties = [
|
|
319
|
+
StyleControlProperty.Width,
|
|
320
|
+
StyleControlProperty.Margin,
|
|
321
|
+
StyleControlProperty.Padding,
|
|
322
|
+
StyleControlProperty.Border,
|
|
323
|
+
StyleControlProperty.BorderRadius,
|
|
324
|
+
StyleControlProperty.TextStyle
|
|
325
|
+
];
|
|
326
|
+
function Style(params) {
|
|
327
|
+
var _a2;
|
|
328
|
+
return {
|
|
329
|
+
type: StyleControlType,
|
|
330
|
+
config: { properties: (_a2 = params == null ? void 0 : params.properties) != null ? _a2 : StyleControlDefaultProperties }
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
Style.Default = StyleControlDefaultProperties;
|
|
334
|
+
Style.All = AllStyleControlProperties;
|
|
335
|
+
Style.Width = StyleControlProperty.Width;
|
|
336
|
+
Style.Margin = StyleControlProperty.Margin;
|
|
337
|
+
Style.Padding = StyleControlProperty.Padding;
|
|
338
|
+
Style.Border = StyleControlProperty.Border;
|
|
339
|
+
Style.BorderRadius = StyleControlProperty.BorderRadius;
|
|
340
|
+
Style.TextStyle = StyleControlProperty.TextStyle;
|
|
341
|
+
const StyleControlMessageType = {
|
|
342
|
+
CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model"
|
|
343
|
+
};
|
|
344
|
+
class StyleControl extends PropController {
|
|
345
|
+
constructor(send) {
|
|
346
|
+
super(send);
|
|
347
|
+
}
|
|
348
|
+
changeBoxModel(boxModel) {
|
|
349
|
+
this.send({ type: StyleControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
|
|
350
|
+
}
|
|
351
|
+
recv() {
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
function copyStyleData(value, context) {
|
|
355
|
+
if (value == null)
|
|
356
|
+
return value;
|
|
357
|
+
function copyResponsiveBorder(responsiveBorder) {
|
|
358
|
+
if (responsiveBorder == null)
|
|
359
|
+
return void 0;
|
|
360
|
+
return responsiveBorder.map((deviceBorder) => __spreadProps(__spreadValues({}, deviceBorder), {
|
|
361
|
+
value: copyBorder(deviceBorder.value)
|
|
362
|
+
}));
|
|
363
|
+
}
|
|
364
|
+
function copyBorder(border) {
|
|
365
|
+
function copyBorderSide(side) {
|
|
366
|
+
if (side == null)
|
|
367
|
+
return null;
|
|
368
|
+
if (side.color == null)
|
|
369
|
+
return side;
|
|
370
|
+
return __spreadProps(__spreadValues({}, side), {
|
|
371
|
+
color: copyColorData(side.color, context)
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
return {
|
|
375
|
+
borderTop: copyBorderSide(border.borderTop),
|
|
376
|
+
borderBottom: copyBorderSide(border.borderBottom),
|
|
377
|
+
borderRight: copyBorderSide(border.borderRight),
|
|
378
|
+
borderLeft: copyBorderSide(border.borderLeft)
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
return __spreadProps(__spreadValues({}, value), { border: copyResponsiveBorder(value.border) });
|
|
382
|
+
}
|
|
383
|
+
if (import_meta.vitest) {
|
|
384
|
+
const { describe, test, expect } = import_meta.vitest;
|
|
385
|
+
describe.concurrent("style copy", () => {
|
|
386
|
+
test("colors are replaced", () => {
|
|
387
|
+
const value = {
|
|
388
|
+
width: [
|
|
389
|
+
{
|
|
390
|
+
value: {
|
|
391
|
+
unit: "px",
|
|
392
|
+
value: 100
|
|
393
|
+
},
|
|
394
|
+
deviceId: "desktop"
|
|
395
|
+
}
|
|
396
|
+
],
|
|
397
|
+
border: [
|
|
398
|
+
{
|
|
399
|
+
value: {
|
|
400
|
+
borderTop: {
|
|
401
|
+
color: {
|
|
402
|
+
alpha: 1,
|
|
403
|
+
swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
|
|
404
|
+
},
|
|
405
|
+
style: "solid",
|
|
406
|
+
width: 9
|
|
407
|
+
},
|
|
408
|
+
borderLeft: {
|
|
409
|
+
color: {
|
|
410
|
+
alpha: 1,
|
|
411
|
+
swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
|
|
412
|
+
},
|
|
413
|
+
style: "solid",
|
|
414
|
+
width: 9
|
|
415
|
+
},
|
|
416
|
+
borderRight: {
|
|
417
|
+
color: {
|
|
418
|
+
alpha: 1,
|
|
419
|
+
swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
|
|
420
|
+
},
|
|
421
|
+
style: "solid",
|
|
422
|
+
width: 9
|
|
423
|
+
},
|
|
424
|
+
borderBottom: {
|
|
425
|
+
color: {
|
|
426
|
+
alpha: 1,
|
|
427
|
+
swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
|
|
428
|
+
},
|
|
429
|
+
style: "solid",
|
|
430
|
+
width: 9
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
deviceId: "desktop"
|
|
434
|
+
}
|
|
435
|
+
],
|
|
436
|
+
textStyle: [
|
|
437
|
+
{
|
|
438
|
+
value: {
|
|
439
|
+
fontSize: {
|
|
440
|
+
unit: "px",
|
|
441
|
+
value: 46
|
|
442
|
+
},
|
|
443
|
+
fontStyle: [],
|
|
444
|
+
fontFamily: "Oswald",
|
|
445
|
+
fontWeight: 400,
|
|
446
|
+
letterSpacing: 5.2,
|
|
447
|
+
textTransform: []
|
|
448
|
+
},
|
|
449
|
+
deviceId: "desktop"
|
|
450
|
+
}
|
|
451
|
+
],
|
|
452
|
+
borderRadius: [
|
|
453
|
+
{
|
|
454
|
+
value: {
|
|
455
|
+
borderTopLeftRadius: {
|
|
456
|
+
unit: "px",
|
|
457
|
+
value: 4
|
|
458
|
+
},
|
|
459
|
+
borderTopRightRadius: {
|
|
460
|
+
unit: "px",
|
|
461
|
+
value: 4
|
|
462
|
+
},
|
|
463
|
+
borderBottomLeftRadius: {
|
|
464
|
+
unit: "px",
|
|
465
|
+
value: 4
|
|
466
|
+
},
|
|
467
|
+
borderBottomRightRadius: {
|
|
468
|
+
unit: "px",
|
|
469
|
+
value: 4
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
deviceId: "desktop"
|
|
473
|
+
}
|
|
474
|
+
]
|
|
475
|
+
};
|
|
476
|
+
const expected = JSON.parse(JSON.stringify(value).replaceAll("U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"));
|
|
477
|
+
const replacementContext = {
|
|
478
|
+
elementHtmlIds: /* @__PURE__ */ new Set(),
|
|
479
|
+
elementKeys: /* @__PURE__ */ new Map(),
|
|
480
|
+
swatchIds: /* @__PURE__ */ new Map([
|
|
481
|
+
["U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"]
|
|
482
|
+
]),
|
|
483
|
+
fileIds: /* @__PURE__ */ new Map(),
|
|
484
|
+
typographyIds: /* @__PURE__ */ new Map(),
|
|
485
|
+
tableIds: /* @__PURE__ */ new Map(),
|
|
486
|
+
tableColumnIds: /* @__PURE__ */ new Map(),
|
|
487
|
+
pageIds: /* @__PURE__ */ new Map(),
|
|
488
|
+
globalElementIds: /* @__PURE__ */ new Map(),
|
|
489
|
+
globalElementData: /* @__PURE__ */ new Map()
|
|
490
|
+
};
|
|
491
|
+
const result = copyStyleData(value, {
|
|
492
|
+
replacementContext,
|
|
493
|
+
copyElement: (node) => node
|
|
494
|
+
});
|
|
495
|
+
expect(result).toMatchObject(expected);
|
|
496
|
+
});
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
const Types = {
|
|
500
|
+
Backgrounds: "Backgrounds",
|
|
501
|
+
Border: "Border",
|
|
502
|
+
BorderRadius: "BorderRadius",
|
|
503
|
+
Checkbox: "Checkbox",
|
|
504
|
+
Date: "Date",
|
|
505
|
+
ElementID: "ElementID",
|
|
506
|
+
Font: "Font",
|
|
507
|
+
GapX: "GapX",
|
|
508
|
+
GapY: "GapY",
|
|
509
|
+
Grid: "Grid",
|
|
510
|
+
Image: "Image",
|
|
511
|
+
Images: "Images",
|
|
512
|
+
Link: "Link",
|
|
513
|
+
List: "List",
|
|
514
|
+
Margin: "Margin",
|
|
515
|
+
NavigationLinks: "NavigationLinks",
|
|
516
|
+
Number: "Number",
|
|
517
|
+
Padding: "Padding",
|
|
518
|
+
ResponsiveColor: "ResponsiveColor",
|
|
519
|
+
ResponsiveIconRadioGroup: "ResponsiveIconRadioGroup",
|
|
520
|
+
ResponsiveLength: "ResponsiveLength",
|
|
521
|
+
ResponsiveNumber: "ResponsiveNumber",
|
|
522
|
+
ResponsiveOpacity: "ResponsiveOpacity",
|
|
523
|
+
ResponsiveSelect: "ResponsiveSelect",
|
|
524
|
+
RichText: "RichText",
|
|
525
|
+
Shadows: "Shadows",
|
|
526
|
+
Shape: "Shape",
|
|
527
|
+
SocialLinks: "SocialLinks",
|
|
528
|
+
Table: "Table",
|
|
529
|
+
TableFormFields: "TableFormFields",
|
|
530
|
+
Typeahead: "Typeahead",
|
|
531
|
+
TextArea: "TextArea",
|
|
532
|
+
TextInput: "TextInput",
|
|
533
|
+
TextStyle: "TextStyle",
|
|
534
|
+
Video: "Video",
|
|
535
|
+
Width: "Width",
|
|
536
|
+
Style: StyleControlType
|
|
537
|
+
};
|
|
538
|
+
function Backgrounds(options = {}) {
|
|
539
|
+
return { type: Types.Backgrounds, options };
|
|
540
|
+
}
|
|
541
|
+
const BorderPropControllerFormat = {
|
|
542
|
+
ClassName: "makeswift::prop-controllers::border::format::class-name",
|
|
543
|
+
ResponsiveValue: "makeswift::prop-controllers:border::format::responsive-value"
|
|
544
|
+
};
|
|
545
|
+
function Border(options = {}) {
|
|
546
|
+
return { type: Types.Border, options };
|
|
547
|
+
}
|
|
548
|
+
Border.Format = BorderPropControllerFormat;
|
|
549
|
+
const BorderRadiusPropControllerFormat = {
|
|
550
|
+
ClassName: "makeswift::prop-controllers::border-radius::format::class-name",
|
|
551
|
+
ResponsiveValue: "makeswift::prop-controllers::border-radius::format::responsive-value"
|
|
552
|
+
};
|
|
553
|
+
function BorderRadius(options = {}) {
|
|
554
|
+
return { type: Types.BorderRadius, options };
|
|
555
|
+
}
|
|
556
|
+
BorderRadius.Format = BorderRadiusPropControllerFormat;
|
|
557
|
+
function Checkbox(options) {
|
|
558
|
+
return { type: Types.Checkbox, options };
|
|
559
|
+
}
|
|
560
|
+
function Date(options = {}) {
|
|
561
|
+
return { type: Types.Date, options };
|
|
562
|
+
}
|
|
563
|
+
function ElementID(options = {}) {
|
|
564
|
+
return { type: Types.ElementID, options };
|
|
565
|
+
}
|
|
566
|
+
function Font(options = {}) {
|
|
567
|
+
return { type: Types.Font, options };
|
|
568
|
+
}
|
|
569
|
+
function GapX(options = {}) {
|
|
570
|
+
return { type: Types.GapX, options };
|
|
571
|
+
}
|
|
572
|
+
function GapY(options = {}) {
|
|
573
|
+
return { type: Types.GapY, options };
|
|
574
|
+
}
|
|
575
|
+
function Grid(options = {}) {
|
|
576
|
+
return { type: Types.Grid, options };
|
|
577
|
+
}
|
|
578
|
+
function Image$1(options = {}) {
|
|
579
|
+
return { type: Types.Image, options };
|
|
580
|
+
}
|
|
581
|
+
function Images(options = {}) {
|
|
582
|
+
return { type: Types.Images, options };
|
|
583
|
+
}
|
|
584
|
+
function Link$1(options = {}) {
|
|
585
|
+
return { type: Types.Link, options };
|
|
586
|
+
}
|
|
587
|
+
function List$1(options) {
|
|
588
|
+
return { type: Types.List, options };
|
|
589
|
+
}
|
|
590
|
+
const MarginPropControllerFormat = {
|
|
591
|
+
ClassName: "makeswift::prop-controllers::margin::format::class-name",
|
|
592
|
+
ResponsiveValue: "makeswift::prop-controllers::margin::format::responsive-value"
|
|
593
|
+
};
|
|
594
|
+
function Margin(options = {}) {
|
|
595
|
+
return { type: Types.Margin, options };
|
|
596
|
+
}
|
|
597
|
+
Margin.Format = MarginPropControllerFormat;
|
|
598
|
+
function NavigationLinks(options = {}) {
|
|
599
|
+
return { type: Types.NavigationLinks, options };
|
|
600
|
+
}
|
|
601
|
+
function Number(options = {}) {
|
|
602
|
+
return { type: Types.Number, options };
|
|
603
|
+
}
|
|
604
|
+
const PaddingPropControllerFormat = {
|
|
605
|
+
ClassName: "makeswift::prop-controllers::padding::format::class-name",
|
|
606
|
+
ResponsiveValue: "makeswift::prop-controllers::padding::format::responsive-value"
|
|
607
|
+
};
|
|
608
|
+
function Padding(options = {}) {
|
|
609
|
+
return { type: Types.Padding, options };
|
|
610
|
+
}
|
|
611
|
+
Padding.Format = PaddingPropControllerFormat;
|
|
612
|
+
function ResponsiveColor(options = {}) {
|
|
613
|
+
return { type: Types.ResponsiveColor, options };
|
|
614
|
+
}
|
|
615
|
+
function ResponsiveIconRadioGroup(options) {
|
|
616
|
+
return { type: Types.ResponsiveIconRadioGroup, options };
|
|
617
|
+
}
|
|
618
|
+
function ResponsiveLength(options = {}) {
|
|
619
|
+
return { type: Types.ResponsiveLength, options };
|
|
620
|
+
}
|
|
621
|
+
function ResponsiveNumber(options = {}) {
|
|
622
|
+
return { type: Types.ResponsiveNumber, options };
|
|
623
|
+
}
|
|
624
|
+
function ResponsiveOpacity(options = {}) {
|
|
625
|
+
return { type: Types.ResponsiveOpacity, options };
|
|
626
|
+
}
|
|
627
|
+
function ResponsiveSelect(options) {
|
|
628
|
+
return { type: Types.ResponsiveSelect, options };
|
|
629
|
+
}
|
|
630
|
+
function RichText$1(options = {}) {
|
|
631
|
+
return { type: Types.RichText, options };
|
|
632
|
+
}
|
|
633
|
+
const ShadowsPropControllerFormat = {
|
|
634
|
+
ClassName: "makeswift::prop-controllers::shadows::format::class-name",
|
|
635
|
+
ResponsiveValue: "makeswift::prop-controllers::shadows::format::responsive-value"
|
|
636
|
+
};
|
|
637
|
+
function Shadows(options = {}) {
|
|
638
|
+
return { type: Types.Shadows, options };
|
|
639
|
+
}
|
|
640
|
+
Shadows.Format = ShadowsPropControllerFormat;
|
|
641
|
+
function Shape$1(options) {
|
|
642
|
+
return { type: Types.Shape, options };
|
|
643
|
+
}
|
|
644
|
+
function SocialLinks(options = {}) {
|
|
645
|
+
return { type: Types.SocialLinks, options };
|
|
646
|
+
}
|
|
647
|
+
function Table(options = {}) {
|
|
648
|
+
return { type: Types.Table, options };
|
|
649
|
+
}
|
|
650
|
+
function TableFormFields(options = {}) {
|
|
651
|
+
return { type: Types.TableFormFields, options };
|
|
652
|
+
}
|
|
653
|
+
function Typeahead(options) {
|
|
654
|
+
return { type: Types.Typeahead, options };
|
|
655
|
+
}
|
|
656
|
+
function TextArea(options = {}) {
|
|
657
|
+
return { type: Types.TextArea, options };
|
|
658
|
+
}
|
|
659
|
+
function TextInput(options = {}) {
|
|
660
|
+
return { type: Types.TextInput, options };
|
|
661
|
+
}
|
|
662
|
+
function TextStyle(options = {}) {
|
|
663
|
+
return { type: Types.TextStyle, options };
|
|
664
|
+
}
|
|
665
|
+
function Video(options = {}) {
|
|
666
|
+
return { type: Types.Video, options };
|
|
667
|
+
}
|
|
668
|
+
const WidthPropControllerFormat = {
|
|
669
|
+
ClassName: "makeswift::prop-controllers::width::format::class-name",
|
|
670
|
+
ResponsiveValue: "makeswift::prop-controllers::width::format::responsive-value"
|
|
671
|
+
};
|
|
672
|
+
function Width(options = {}) {
|
|
673
|
+
return { type: Types.Width, options };
|
|
674
|
+
}
|
|
675
|
+
Width.Format = WidthPropControllerFormat;
|
|
676
|
+
var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
677
|
+
__proto__: null,
|
|
678
|
+
Types,
|
|
679
|
+
Backgrounds,
|
|
680
|
+
BorderPropControllerFormat,
|
|
681
|
+
Border,
|
|
682
|
+
BorderRadiusPropControllerFormat,
|
|
683
|
+
BorderRadius,
|
|
684
|
+
Checkbox,
|
|
685
|
+
Date,
|
|
686
|
+
ElementID,
|
|
687
|
+
Font,
|
|
688
|
+
GapX,
|
|
689
|
+
GapY,
|
|
690
|
+
Grid,
|
|
691
|
+
Image: Image$1,
|
|
692
|
+
Images,
|
|
693
|
+
Link: Link$1,
|
|
694
|
+
List: List$1,
|
|
695
|
+
MarginPropControllerFormat,
|
|
696
|
+
Margin,
|
|
697
|
+
NavigationLinks,
|
|
698
|
+
Number,
|
|
699
|
+
PaddingPropControllerFormat,
|
|
700
|
+
Padding,
|
|
701
|
+
ResponsiveColor,
|
|
702
|
+
ResponsiveIconRadioGroup,
|
|
703
|
+
ResponsiveLength,
|
|
704
|
+
ResponsiveNumber,
|
|
705
|
+
ResponsiveOpacity,
|
|
706
|
+
ResponsiveSelect,
|
|
707
|
+
RichText: RichText$1,
|
|
708
|
+
ShadowsPropControllerFormat,
|
|
709
|
+
Shadows,
|
|
710
|
+
Shape: Shape$1,
|
|
711
|
+
SocialLinks,
|
|
712
|
+
Table,
|
|
713
|
+
TableFormFields,
|
|
714
|
+
Typeahead,
|
|
715
|
+
TextArea,
|
|
716
|
+
TextInput,
|
|
717
|
+
TextStyle,
|
|
718
|
+
Video,
|
|
719
|
+
WidthPropControllerFormat,
|
|
720
|
+
Width
|
|
721
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
296
722
|
const ImageControlType = "makeswift::controls::image";
|
|
297
723
|
const ImageControlValueFormat = {
|
|
298
724
|
URL: "makeswift::controls::image::format::url",
|
|
299
725
|
WithDimensions: "makeswift::controls::image::format::with-dimensions"
|
|
300
726
|
};
|
|
301
|
-
function Image
|
|
727
|
+
function Image(config = {}) {
|
|
302
728
|
return { type: ImageControlType, config };
|
|
303
729
|
}
|
|
304
|
-
Image
|
|
730
|
+
Image.Format = ImageControlValueFormat;
|
|
305
731
|
function copyImageData(value, context) {
|
|
306
|
-
var
|
|
732
|
+
var _a2;
|
|
307
733
|
if (value == null)
|
|
308
734
|
return value;
|
|
309
|
-
return (
|
|
735
|
+
return (_a2 = context.replacementContext.fileIds.get(value)) != null ? _a2 : value;
|
|
310
736
|
}
|
|
311
737
|
if (import_meta.vitest) {
|
|
312
738
|
const { describe, test, expect } = import_meta.vitest;
|
|
@@ -335,11 +761,11 @@ if (import_meta.vitest) {
|
|
|
335
761
|
});
|
|
336
762
|
}
|
|
337
763
|
const LinkControlType = "makeswift::controls::link";
|
|
338
|
-
function Link
|
|
764
|
+
function Link(config = {}) {
|
|
339
765
|
return { type: LinkControlType, config };
|
|
340
766
|
}
|
|
341
767
|
function copyLinkData(value, context) {
|
|
342
|
-
var
|
|
768
|
+
var _a2;
|
|
343
769
|
if (value == null)
|
|
344
770
|
return value;
|
|
345
771
|
if (value.type === "OPEN_PAGE") {
|
|
@@ -347,7 +773,7 @@ function copyLinkData(value, context) {
|
|
|
347
773
|
if (pageId != null) {
|
|
348
774
|
return __spreadProps(__spreadValues({}, value), {
|
|
349
775
|
payload: __spreadProps(__spreadValues({}, value.payload), {
|
|
350
|
-
pageId: (
|
|
776
|
+
pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : pageId
|
|
351
777
|
})
|
|
352
778
|
});
|
|
353
779
|
}
|
|
@@ -386,12 +812,6 @@ if (import_meta.vitest) {
|
|
|
386
812
|
});
|
|
387
813
|
});
|
|
388
814
|
}
|
|
389
|
-
class PropController {
|
|
390
|
-
constructor(send) {
|
|
391
|
-
__publicField(this, "send");
|
|
392
|
-
this.send = send;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
815
|
const RichTextPropControllerMessageType = {
|
|
396
816
|
CHANGE_BUILDER_EDIT_MODE: "CHANGE_BUILDER_EDIT_MODE",
|
|
397
817
|
INITIALIZE_EDITOR: "INITIALIZE_EDITOR",
|
|
@@ -500,12 +920,14 @@ function createPropController(descriptor, send) {
|
|
|
500
920
|
return new ShapeControl(send, descriptor);
|
|
501
921
|
case StyleControlType:
|
|
502
922
|
return new StyleControl(send);
|
|
923
|
+
case StyleV2ControlType:
|
|
924
|
+
return new StyleV2Control(send, descriptor);
|
|
503
925
|
default:
|
|
504
926
|
return new DefaultPropController(send);
|
|
505
927
|
}
|
|
506
928
|
}
|
|
507
929
|
const ListControlType = "makeswift::controls::list";
|
|
508
|
-
function List
|
|
930
|
+
function List(config) {
|
|
509
931
|
return { type: ListControlType, config };
|
|
510
932
|
}
|
|
511
933
|
const ListControlMessageType = {
|
|
@@ -556,15 +978,15 @@ class ListControl extends PropController {
|
|
|
556
978
|
this.controls = /* @__PURE__ */ new Map();
|
|
557
979
|
}
|
|
558
980
|
}
|
|
559
|
-
function copyListData(
|
|
981
|
+
function copyListData(definition, value, context) {
|
|
560
982
|
if (value == null)
|
|
561
983
|
return value;
|
|
562
984
|
return value && value.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
563
|
-
value: copy(
|
|
985
|
+
value: copy(definition.config.type, item.value, context)
|
|
564
986
|
}));
|
|
565
987
|
}
|
|
566
988
|
const ShapeControlType = "makeswift::controls::shape";
|
|
567
|
-
function Shape
|
|
989
|
+
function Shape(config) {
|
|
568
990
|
return { type: ShapeControlType, config };
|
|
569
991
|
}
|
|
570
992
|
const ShapeControlMessageType = {
|
|
@@ -606,210 +1028,16 @@ class ShapeControl extends PropController {
|
|
|
606
1028
|
this.setControls();
|
|
607
1029
|
}
|
|
608
1030
|
}
|
|
609
|
-
function copyShapeData(
|
|
1031
|
+
function copyShapeData(definition, value, context) {
|
|
610
1032
|
if (value == null)
|
|
611
1033
|
return value;
|
|
612
1034
|
const newValue = {};
|
|
613
|
-
for (const [key, itemDefinition] of Object.entries(
|
|
1035
|
+
for (const [key, itemDefinition] of Object.entries(definition.config.type)) {
|
|
614
1036
|
const prop = value[key];
|
|
615
1037
|
newValue[key] = copy(itemDefinition, prop, context);
|
|
616
1038
|
}
|
|
617
1039
|
return newValue;
|
|
618
1040
|
}
|
|
619
|
-
const StyleControlType = "makeswift::controls::style";
|
|
620
|
-
const StyleControlProperty = {
|
|
621
|
-
Width: "makeswift::controls::style::property::width",
|
|
622
|
-
Margin: "makeswift::controls::style::property::margin",
|
|
623
|
-
Padding: "makeswift::controls::style::property::padding",
|
|
624
|
-
Border: "makeswift::controls::style::property::border",
|
|
625
|
-
BorderRadius: "makeswift::controls::style::property::border-radius",
|
|
626
|
-
TextStyle: "makeswift::controls::style::property::text-style"
|
|
627
|
-
};
|
|
628
|
-
const StyleControlDefaultProperties = [
|
|
629
|
-
StyleControlProperty.Width,
|
|
630
|
-
StyleControlProperty.Margin
|
|
631
|
-
];
|
|
632
|
-
const AllStyleControlProperties = [
|
|
633
|
-
StyleControlProperty.Width,
|
|
634
|
-
StyleControlProperty.Margin,
|
|
635
|
-
StyleControlProperty.Padding,
|
|
636
|
-
StyleControlProperty.Border,
|
|
637
|
-
StyleControlProperty.BorderRadius,
|
|
638
|
-
StyleControlProperty.TextStyle
|
|
639
|
-
];
|
|
640
|
-
function Style(params) {
|
|
641
|
-
var _a;
|
|
642
|
-
return {
|
|
643
|
-
type: StyleControlType,
|
|
644
|
-
config: { properties: (_a = params == null ? void 0 : params.properties) != null ? _a : StyleControlDefaultProperties }
|
|
645
|
-
};
|
|
646
|
-
}
|
|
647
|
-
Style.Default = StyleControlDefaultProperties;
|
|
648
|
-
Style.All = AllStyleControlProperties;
|
|
649
|
-
Style.Width = StyleControlProperty.Width;
|
|
650
|
-
Style.Margin = StyleControlProperty.Margin;
|
|
651
|
-
Style.Padding = StyleControlProperty.Padding;
|
|
652
|
-
Style.Border = StyleControlProperty.Border;
|
|
653
|
-
Style.BorderRadius = StyleControlProperty.BorderRadius;
|
|
654
|
-
Style.TextStyle = StyleControlProperty.TextStyle;
|
|
655
|
-
const StyleControlMessageType = {
|
|
656
|
-
CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model"
|
|
657
|
-
};
|
|
658
|
-
class StyleControl extends PropController {
|
|
659
|
-
constructor(send) {
|
|
660
|
-
super(send);
|
|
661
|
-
}
|
|
662
|
-
changeBoxModel(boxModel) {
|
|
663
|
-
this.send({ type: StyleControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
|
|
664
|
-
}
|
|
665
|
-
recv() {
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
function copyStyleData(value, context) {
|
|
669
|
-
if (value == null)
|
|
670
|
-
return value;
|
|
671
|
-
function copyResponsiveBorder(responsiveBorder) {
|
|
672
|
-
if (responsiveBorder == null)
|
|
673
|
-
return void 0;
|
|
674
|
-
return responsiveBorder.map((deviceBorder) => __spreadProps(__spreadValues({}, deviceBorder), {
|
|
675
|
-
value: copyBorder(deviceBorder.value)
|
|
676
|
-
}));
|
|
677
|
-
}
|
|
678
|
-
function copyBorder(border) {
|
|
679
|
-
function copyBorderSide(side) {
|
|
680
|
-
if (side == null)
|
|
681
|
-
return null;
|
|
682
|
-
if (side.color == null)
|
|
683
|
-
return side;
|
|
684
|
-
return __spreadProps(__spreadValues({}, side), {
|
|
685
|
-
color: copyColorData(side.color, context)
|
|
686
|
-
});
|
|
687
|
-
}
|
|
688
|
-
return {
|
|
689
|
-
borderTop: copyBorderSide(border.borderTop),
|
|
690
|
-
borderBottom: copyBorderSide(border.borderBottom),
|
|
691
|
-
borderRight: copyBorderSide(border.borderRight),
|
|
692
|
-
borderLeft: copyBorderSide(border.borderLeft)
|
|
693
|
-
};
|
|
694
|
-
}
|
|
695
|
-
return __spreadProps(__spreadValues({}, value), { border: copyResponsiveBorder(value.border) });
|
|
696
|
-
}
|
|
697
|
-
if (import_meta.vitest) {
|
|
698
|
-
const { describe, test, expect } = import_meta.vitest;
|
|
699
|
-
describe.concurrent("style copy", () => {
|
|
700
|
-
test("colors are replaced", () => {
|
|
701
|
-
const value = {
|
|
702
|
-
width: [
|
|
703
|
-
{
|
|
704
|
-
value: {
|
|
705
|
-
unit: "px",
|
|
706
|
-
value: 100
|
|
707
|
-
},
|
|
708
|
-
deviceId: "desktop"
|
|
709
|
-
}
|
|
710
|
-
],
|
|
711
|
-
border: [
|
|
712
|
-
{
|
|
713
|
-
value: {
|
|
714
|
-
borderTop: {
|
|
715
|
-
color: {
|
|
716
|
-
alpha: 1,
|
|
717
|
-
swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
|
|
718
|
-
},
|
|
719
|
-
style: "solid",
|
|
720
|
-
width: 9
|
|
721
|
-
},
|
|
722
|
-
borderLeft: {
|
|
723
|
-
color: {
|
|
724
|
-
alpha: 1,
|
|
725
|
-
swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
|
|
726
|
-
},
|
|
727
|
-
style: "solid",
|
|
728
|
-
width: 9
|
|
729
|
-
},
|
|
730
|
-
borderRight: {
|
|
731
|
-
color: {
|
|
732
|
-
alpha: 1,
|
|
733
|
-
swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
|
|
734
|
-
},
|
|
735
|
-
style: "solid",
|
|
736
|
-
width: 9
|
|
737
|
-
},
|
|
738
|
-
borderBottom: {
|
|
739
|
-
color: {
|
|
740
|
-
alpha: 1,
|
|
741
|
-
swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
|
|
742
|
-
},
|
|
743
|
-
style: "solid",
|
|
744
|
-
width: 9
|
|
745
|
-
}
|
|
746
|
-
},
|
|
747
|
-
deviceId: "desktop"
|
|
748
|
-
}
|
|
749
|
-
],
|
|
750
|
-
textStyle: [
|
|
751
|
-
{
|
|
752
|
-
value: {
|
|
753
|
-
fontSize: {
|
|
754
|
-
unit: "px",
|
|
755
|
-
value: 46
|
|
756
|
-
},
|
|
757
|
-
fontStyle: [],
|
|
758
|
-
fontFamily: "Oswald",
|
|
759
|
-
fontWeight: 400,
|
|
760
|
-
letterSpacing: 5.2,
|
|
761
|
-
textTransform: []
|
|
762
|
-
},
|
|
763
|
-
deviceId: "desktop"
|
|
764
|
-
}
|
|
765
|
-
],
|
|
766
|
-
borderRadius: [
|
|
767
|
-
{
|
|
768
|
-
value: {
|
|
769
|
-
borderTopLeftRadius: {
|
|
770
|
-
unit: "px",
|
|
771
|
-
value: 4
|
|
772
|
-
},
|
|
773
|
-
borderTopRightRadius: {
|
|
774
|
-
unit: "px",
|
|
775
|
-
value: 4
|
|
776
|
-
},
|
|
777
|
-
borderBottomLeftRadius: {
|
|
778
|
-
unit: "px",
|
|
779
|
-
value: 4
|
|
780
|
-
},
|
|
781
|
-
borderBottomRightRadius: {
|
|
782
|
-
unit: "px",
|
|
783
|
-
value: 4
|
|
784
|
-
}
|
|
785
|
-
},
|
|
786
|
-
deviceId: "desktop"
|
|
787
|
-
}
|
|
788
|
-
]
|
|
789
|
-
};
|
|
790
|
-
const expected = JSON.parse(JSON.stringify(value).replaceAll("U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"));
|
|
791
|
-
const replacementContext = {
|
|
792
|
-
elementHtmlIds: /* @__PURE__ */ new Set(),
|
|
793
|
-
elementKeys: /* @__PURE__ */ new Map(),
|
|
794
|
-
swatchIds: /* @__PURE__ */ new Map([
|
|
795
|
-
["U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"]
|
|
796
|
-
]),
|
|
797
|
-
fileIds: /* @__PURE__ */ new Map(),
|
|
798
|
-
typographyIds: /* @__PURE__ */ new Map(),
|
|
799
|
-
tableIds: /* @__PURE__ */ new Map(),
|
|
800
|
-
tableColumnIds: /* @__PURE__ */ new Map(),
|
|
801
|
-
pageIds: /* @__PURE__ */ new Map(),
|
|
802
|
-
globalElementIds: /* @__PURE__ */ new Map(),
|
|
803
|
-
globalElementData: /* @__PURE__ */ new Map()
|
|
804
|
-
};
|
|
805
|
-
const result = copyStyleData(value, {
|
|
806
|
-
replacementContext,
|
|
807
|
-
copyElement: (node) => node
|
|
808
|
-
});
|
|
809
|
-
expect(result).toMatchObject(expected);
|
|
810
|
-
});
|
|
811
|
-
});
|
|
812
|
-
}
|
|
813
1041
|
const SlotControlType = "makeswift::controls::slot";
|
|
814
1042
|
function Slot() {
|
|
815
1043
|
return { type: SlotControlType };
|
|
@@ -859,22 +1087,22 @@ function copy$e(value, context) {
|
|
|
859
1087
|
return value;
|
|
860
1088
|
return value.map((override) => __spreadProps(__spreadValues({}, override), {
|
|
861
1089
|
value: override.value.map((backgroundItem) => {
|
|
862
|
-
var
|
|
1090
|
+
var _a2, _b;
|
|
863
1091
|
switch (backgroundItem.type) {
|
|
864
1092
|
case "color":
|
|
865
1093
|
return __spreadProps(__spreadValues({}, backgroundItem), {
|
|
866
1094
|
payload: backgroundItem.payload === null ? null : __spreadProps(__spreadValues({}, backgroundItem.payload), {
|
|
867
|
-
swatchId: (
|
|
1095
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(backgroundItem.payload.swatchId)) != null ? _a2 : backgroundItem.payload.swatchId
|
|
868
1096
|
})
|
|
869
1097
|
});
|
|
870
1098
|
case "gradient":
|
|
871
1099
|
return __spreadProps(__spreadValues({}, backgroundItem), {
|
|
872
1100
|
payload: __spreadProps(__spreadValues({}, backgroundItem.payload), {
|
|
873
1101
|
stops: backgroundItem.payload.stops.map((stop) => {
|
|
874
|
-
var
|
|
1102
|
+
var _a3;
|
|
875
1103
|
return __spreadProps(__spreadValues({}, stop), {
|
|
876
1104
|
color: stop.color == null ? null : __spreadProps(__spreadValues({}, stop.color), {
|
|
877
|
-
swatchId: (
|
|
1105
|
+
swatchId: (_a3 = context.replacementContext.swatchIds.get(stop.color.swatchId)) != null ? _a3 : stop.color.swatchId
|
|
878
1106
|
})
|
|
879
1107
|
});
|
|
880
1108
|
})
|
|
@@ -900,7 +1128,7 @@ function copy$d(value, context) {
|
|
|
900
1128
|
});
|
|
901
1129
|
}
|
|
902
1130
|
function copy$c(value, context) {
|
|
903
|
-
var
|
|
1131
|
+
var _a2, _b;
|
|
904
1132
|
if (value == null)
|
|
905
1133
|
return value;
|
|
906
1134
|
switch (value.type) {
|
|
@@ -910,7 +1138,7 @@ function copy$c(value, context) {
|
|
|
910
1138
|
return value;
|
|
911
1139
|
return __spreadProps(__spreadValues({}, value), {
|
|
912
1140
|
payload: __spreadProps(__spreadValues({}, value.payload), {
|
|
913
|
-
pageId: (
|
|
1141
|
+
pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : pageId
|
|
914
1142
|
})
|
|
915
1143
|
});
|
|
916
1144
|
}
|
|
@@ -943,10 +1171,10 @@ function copy$b(value, context) {
|
|
|
943
1171
|
payload: __spreadProps(__spreadValues({}, item.payload), {
|
|
944
1172
|
link: link != null ? copy$c(link, context) : void 0,
|
|
945
1173
|
color: color != null ? color.map((override) => {
|
|
946
|
-
var
|
|
1174
|
+
var _a2;
|
|
947
1175
|
return __spreadProps(__spreadValues({}, override), {
|
|
948
1176
|
value: __spreadProps(__spreadValues({}, override.value), {
|
|
949
|
-
swatchId: (
|
|
1177
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(override.value.swatchId)) != null ? _a2 : override.value.swatchId
|
|
950
1178
|
})
|
|
951
1179
|
});
|
|
952
1180
|
}) : void 0
|
|
@@ -1004,14 +1232,14 @@ function copy$a(value, context) {
|
|
|
1004
1232
|
return value;
|
|
1005
1233
|
return value.map((override) => __spreadProps(__spreadValues({}, override), { value: override.value.map(copyShadowItem) }));
|
|
1006
1234
|
function copyShadowItem(item) {
|
|
1007
|
-
var
|
|
1235
|
+
var _a2;
|
|
1008
1236
|
const { color } = item.payload;
|
|
1009
1237
|
if (color == null)
|
|
1010
1238
|
return item;
|
|
1011
1239
|
return __spreadProps(__spreadValues({}, item), {
|
|
1012
1240
|
payload: __spreadProps(__spreadValues({}, item.payload), {
|
|
1013
1241
|
color: __spreadProps(__spreadValues({}, color), {
|
|
1014
|
-
swatchId: (
|
|
1242
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a2 : color.swatchId
|
|
1015
1243
|
})
|
|
1016
1244
|
})
|
|
1017
1245
|
});
|
|
@@ -1065,10 +1293,10 @@ if (import_meta.vitest) {
|
|
|
1065
1293
|
});
|
|
1066
1294
|
}
|
|
1067
1295
|
function copy$9(value, context) {
|
|
1068
|
-
var
|
|
1296
|
+
var _a2;
|
|
1069
1297
|
if (value == null)
|
|
1070
1298
|
return value;
|
|
1071
|
-
return (
|
|
1299
|
+
return (_a2 = context.replacementContext.fileIds.get(value)) != null ? _a2 : value;
|
|
1072
1300
|
}
|
|
1073
1301
|
if (import_meta.vitest) {
|
|
1074
1302
|
const { describe, test, expect } = import_meta.vitest;
|
|
@@ -1101,13 +1329,13 @@ function copy$8(value, context) {
|
|
|
1101
1329
|
return value;
|
|
1102
1330
|
return value.map(copyImagesPanelItem);
|
|
1103
1331
|
function copyImagesPanelItem(imagesPanelItem) {
|
|
1104
|
-
var
|
|
1332
|
+
var _a2;
|
|
1105
1333
|
const { file } = imagesPanelItem.props;
|
|
1106
1334
|
if (file == null)
|
|
1107
1335
|
return imagesPanelItem;
|
|
1108
1336
|
return __spreadProps(__spreadValues({}, imagesPanelItem), {
|
|
1109
1337
|
props: __spreadProps(__spreadValues({}, imagesPanelItem.props), {
|
|
1110
|
-
file: (
|
|
1338
|
+
file: (_a2 = context.replacementContext.fileIds.get(file)) != null ? _a2 : file
|
|
1111
1339
|
})
|
|
1112
1340
|
});
|
|
1113
1341
|
}
|
|
@@ -1156,9 +1384,9 @@ function copy$7(value, context) {
|
|
|
1156
1384
|
return value;
|
|
1157
1385
|
return value.map((override) => __spreadProps(__spreadValues({}, override), { value: copyColorValue(override.value) }));
|
|
1158
1386
|
function copyColorValue(colorValue) {
|
|
1159
|
-
var
|
|
1387
|
+
var _a2;
|
|
1160
1388
|
return __spreadProps(__spreadValues({}, colorValue), {
|
|
1161
|
-
swatchId: (
|
|
1389
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(colorValue.swatchId)) != null ? _a2 : colorValue.swatchId
|
|
1162
1390
|
});
|
|
1163
1391
|
}
|
|
1164
1392
|
}
|
|
@@ -1167,9 +1395,9 @@ function copy$6(value, context) {
|
|
|
1167
1395
|
return value;
|
|
1168
1396
|
return __spreadProps(__spreadValues({}, value), { fields: value.fields.map(copyFormFieldsPanelItem) });
|
|
1169
1397
|
function copyFormFieldsPanelItem(item) {
|
|
1170
|
-
var
|
|
1398
|
+
var _a2;
|
|
1171
1399
|
return __spreadProps(__spreadValues({}, item), {
|
|
1172
|
-
tableColumnId: (
|
|
1400
|
+
tableColumnId: (_a2 = context.replacementContext.tableColumnIds.get(item.tableColumnId)) != null ? _a2 : item.tableColumnId
|
|
1173
1401
|
});
|
|
1174
1402
|
}
|
|
1175
1403
|
}
|
|
@@ -1223,10 +1451,10 @@ if (import_meta.vitest) {
|
|
|
1223
1451
|
});
|
|
1224
1452
|
}
|
|
1225
1453
|
function copy$5(value, context) {
|
|
1226
|
-
var
|
|
1454
|
+
var _a2;
|
|
1227
1455
|
if (value == null)
|
|
1228
1456
|
return value;
|
|
1229
|
-
return (
|
|
1457
|
+
return (_a2 = context.replacementContext.tableIds.get(value)) != null ? _a2 : value;
|
|
1230
1458
|
}
|
|
1231
1459
|
if (import_meta.vitest) {
|
|
1232
1460
|
const { describe, test, expect } = import_meta.vitest;
|
|
@@ -1268,13 +1496,13 @@ function copy$4(value, context) {
|
|
|
1268
1496
|
};
|
|
1269
1497
|
}
|
|
1270
1498
|
function copyBorderSide(borderSide) {
|
|
1271
|
-
var
|
|
1499
|
+
var _a2;
|
|
1272
1500
|
const { color } = borderSide;
|
|
1273
1501
|
if (color == null)
|
|
1274
1502
|
return borderSide;
|
|
1275
1503
|
return __spreadProps(__spreadValues({}, borderSide), {
|
|
1276
1504
|
color: __spreadProps(__spreadValues({}, color), {
|
|
1277
|
-
swatchId: (
|
|
1505
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a2 : color.swatchId
|
|
1278
1506
|
})
|
|
1279
1507
|
});
|
|
1280
1508
|
}
|
|
@@ -1388,24 +1616,24 @@ function copy$3(value, context) {
|
|
|
1388
1616
|
return value;
|
|
1389
1617
|
return __spreadProps(__spreadValues({}, value), { document: value.document ? copyNode(value.document) : value.document });
|
|
1390
1618
|
function copyNode(node) {
|
|
1391
|
-
var
|
|
1619
|
+
var _a2;
|
|
1392
1620
|
switch (node.object) {
|
|
1393
1621
|
case "document":
|
|
1394
1622
|
case "block":
|
|
1395
1623
|
case "inline":
|
|
1396
1624
|
return copyInline(node);
|
|
1397
1625
|
case "text":
|
|
1398
|
-
return __spreadProps(__spreadValues({}, node), { marks: (
|
|
1626
|
+
return __spreadProps(__spreadValues({}, node), { marks: (_a2 = node.marks) == null ? void 0 : _a2.map(copyMark) });
|
|
1399
1627
|
default:
|
|
1400
1628
|
return node;
|
|
1401
1629
|
}
|
|
1402
1630
|
}
|
|
1403
1631
|
function copyInline(inline) {
|
|
1404
|
-
var
|
|
1632
|
+
var _a2, _b;
|
|
1405
1633
|
switch (inline.type) {
|
|
1406
1634
|
case "link":
|
|
1407
1635
|
return __spreadProps(__spreadValues({}, inline), {
|
|
1408
|
-
nodes: (
|
|
1636
|
+
nodes: (_a2 = inline.nodes) == null ? void 0 : _a2.map(copyNode),
|
|
1409
1637
|
data: inline.data ? copyLinkData2(inline.data) : inline.data
|
|
1410
1638
|
});
|
|
1411
1639
|
default:
|
|
@@ -1413,7 +1641,7 @@ function copy$3(value, context) {
|
|
|
1413
1641
|
}
|
|
1414
1642
|
}
|
|
1415
1643
|
function copyLinkData2(data) {
|
|
1416
|
-
var
|
|
1644
|
+
var _a2, _b;
|
|
1417
1645
|
switch (data.type) {
|
|
1418
1646
|
case "OPEN_PAGE": {
|
|
1419
1647
|
const pageId = data.payload.pageId;
|
|
@@ -1421,7 +1649,7 @@ function copy$3(value, context) {
|
|
|
1421
1649
|
return data;
|
|
1422
1650
|
return __spreadProps(__spreadValues({}, data), {
|
|
1423
1651
|
payload: __spreadProps(__spreadValues({}, data.payload), {
|
|
1424
|
-
pageId: (
|
|
1652
|
+
pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : data.payload.pageId
|
|
1425
1653
|
})
|
|
1426
1654
|
});
|
|
1427
1655
|
}
|
|
@@ -1442,20 +1670,20 @@ function copy$3(value, context) {
|
|
|
1442
1670
|
}
|
|
1443
1671
|
}
|
|
1444
1672
|
function copyMark(mark) {
|
|
1445
|
-
var
|
|
1673
|
+
var _a2, _b, _c, _d;
|
|
1446
1674
|
switch (mark.type) {
|
|
1447
1675
|
case "typography": {
|
|
1448
|
-
const typographyId = (
|
|
1676
|
+
const typographyId = (_a2 = mark.data) == null ? void 0 : _a2.value.id;
|
|
1449
1677
|
return __spreadProps(__spreadValues({}, mark), {
|
|
1450
1678
|
data: __spreadProps(__spreadValues({}, mark.data), {
|
|
1451
1679
|
value: __spreadProps(__spreadValues({}, (_b = mark.data) == null ? void 0 : _b.value), {
|
|
1452
1680
|
id: (_c = context.replacementContext.typographyIds.get(typographyId)) != null ? _c : typographyId,
|
|
1453
1681
|
style: (_d = mark.data) == null ? void 0 : _d.value.style.map((override) => {
|
|
1454
|
-
var
|
|
1682
|
+
var _a3, _b2, _c2;
|
|
1455
1683
|
return __spreadProps(__spreadValues({}, override), {
|
|
1456
1684
|
value: __spreadProps(__spreadValues({}, override.value), {
|
|
1457
1685
|
color: override.value.color == null ? override.value.color : __spreadProps(__spreadValues({}, override.value.color), {
|
|
1458
|
-
swatchId: (_c2 = context.replacementContext.swatchIds.get((
|
|
1686
|
+
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
1687
|
})
|
|
1460
1688
|
})
|
|
1461
1689
|
});
|
|
@@ -1606,8 +1834,8 @@ function copy$1(descriptor, value, context) {
|
|
|
1606
1834
|
function copyElementReference(value, context) {
|
|
1607
1835
|
return context.replacementContext.globalElementIds.get(value) || value;
|
|
1608
1836
|
}
|
|
1609
|
-
function copy(
|
|
1610
|
-
switch (
|
|
1837
|
+
function copy(definition, value, context) {
|
|
1838
|
+
switch (definition.type) {
|
|
1611
1839
|
case Types.Backgrounds:
|
|
1612
1840
|
case Types.Grid:
|
|
1613
1841
|
case Types.NavigationLinks:
|
|
@@ -1621,7 +1849,7 @@ function copy(definition2, value, context) {
|
|
|
1621
1849
|
case Types.Border:
|
|
1622
1850
|
case Types.RichText:
|
|
1623
1851
|
case Types.ElementID:
|
|
1624
|
-
return copy$1(
|
|
1852
|
+
return copy$1(definition, value, context);
|
|
1625
1853
|
case ColorControlType:
|
|
1626
1854
|
return copyColorData(value, context);
|
|
1627
1855
|
case ImageControlType:
|
|
@@ -1629,9 +1857,9 @@ function copy(definition2, value, context) {
|
|
|
1629
1857
|
case LinkControlType:
|
|
1630
1858
|
return copyLinkData(value, context);
|
|
1631
1859
|
case ShapeControlType:
|
|
1632
|
-
return copyShapeData(
|
|
1860
|
+
return copyShapeData(definition, value, context);
|
|
1633
1861
|
case ListControlType:
|
|
1634
|
-
return copyListData(
|
|
1862
|
+
return copyListData(definition, value, context);
|
|
1635
1863
|
case StyleControlType:
|
|
1636
1864
|
return copyStyleData(value, context);
|
|
1637
1865
|
case SlotControlType:
|
|
@@ -1640,17 +1868,62 @@ function copy(definition2, value, context) {
|
|
|
1640
1868
|
return value;
|
|
1641
1869
|
}
|
|
1642
1870
|
}
|
|
1643
|
-
function merge(
|
|
1644
|
-
switch (
|
|
1871
|
+
function merge(definition, a, b = a, context) {
|
|
1872
|
+
switch (definition.type) {
|
|
1645
1873
|
case SlotControlType:
|
|
1646
1874
|
return mergeSlotData(a, b, context);
|
|
1647
1875
|
default:
|
|
1648
1876
|
return b;
|
|
1649
1877
|
}
|
|
1650
1878
|
}
|
|
1651
|
-
const
|
|
1652
|
-
|
|
1653
|
-
|
|
1879
|
+
const isServer = typeof window === "undefined";
|
|
1880
|
+
const useInsertionEffectSpecifier = "useInsertionEffect";
|
|
1881
|
+
const useInsertionEffect = (_a = React[useInsertionEffectSpecifier]) != null ? _a : React.useLayoutEffect;
|
|
1882
|
+
function useStyle(style) {
|
|
1883
|
+
const serialized = serializeStyles([style], cache.registered);
|
|
1884
|
+
registerStyles(cache, serialized, false);
|
|
1885
|
+
useInsertionEffect(() => {
|
|
1886
|
+
insertStyles(cache, serialized, false);
|
|
1887
|
+
});
|
|
1888
|
+
if (isServer)
|
|
1889
|
+
insertStyles(cache, serialized, false);
|
|
1890
|
+
return `${cache.key}-${serialized.name}`;
|
|
1891
|
+
}
|
|
1892
|
+
const StyleV2ControlType = "makeswift::controls::style-v2";
|
|
1893
|
+
const unstable_useStyleV2ClassName = useStyle;
|
|
1894
|
+
function unstable_StyleV2(config) {
|
|
1895
|
+
return { type: StyleV2ControlType, config };
|
|
1896
|
+
}
|
|
1897
|
+
const StyleV2ControlMessageType = {
|
|
1898
|
+
CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model",
|
|
1899
|
+
STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE: "makeswift::controls::style-v2::message::child-control-message"
|
|
1900
|
+
};
|
|
1901
|
+
class StyleV2Control extends PropController {
|
|
1902
|
+
constructor(send, descriptor) {
|
|
1903
|
+
super(send);
|
|
1904
|
+
__publicField(this, "control");
|
|
1905
|
+
this.control = createPropController(descriptor.config.type, (message) => {
|
|
1906
|
+
console.log("message you are supposed to be sending in styleV2 control", { message });
|
|
1907
|
+
this.send({
|
|
1908
|
+
type: StyleV2ControlMessageType.STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE,
|
|
1909
|
+
payload: { message }
|
|
1910
|
+
});
|
|
1911
|
+
});
|
|
1912
|
+
}
|
|
1913
|
+
changeBoxModel(boxModel) {
|
|
1914
|
+
this.send({ type: StyleV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
|
|
1915
|
+
}
|
|
1916
|
+
recv(message) {
|
|
1917
|
+
switch (message.type) {
|
|
1918
|
+
case StyleV2ControlMessageType.STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE: {
|
|
1919
|
+
const control = this.control;
|
|
1920
|
+
if (control == null)
|
|
1921
|
+
return;
|
|
1922
|
+
const recv = control.recv;
|
|
1923
|
+
recv(message.payload.message);
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1654
1927
|
}
|
|
1655
1928
|
const ObjectType = {
|
|
1656
1929
|
Value: "value",
|
|
@@ -1689,698 +1962,22 @@ const InlineType = {
|
|
|
1689
1962
|
Code: "code",
|
|
1690
1963
|
SuperScript: "superscript",
|
|
1691
1964
|
SubScript: "subscript",
|
|
1692
|
-
Link: "link"
|
|
1693
|
-
};
|
|
1694
|
-
const BlockTextAlignment = {
|
|
1695
|
-
Left: "left",
|
|
1696
|
-
Center: "center",
|
|
1697
|
-
Right: "right",
|
|
1698
|
-
Justify: "justify"
|
|
1699
|
-
};
|
|
1700
|
-
const ElementUtils = {
|
|
1701
|
-
isRootBlock(node) {
|
|
1702
|
-
return Element.isElement(node) && (Element.isElementType(node, BlockType.Paragraph) || Element.isElementType(node, BlockType.Heading1) || Element.isElementType(node, BlockType.Heading2) || Element.isElementType(node, BlockType.Heading3) || Element.isElementType(node, BlockType.Heading3) || Element.isElementType(node, BlockType.Heading4) || Element.isElementType(node, BlockType.Heading5) || Element.isElementType(node, BlockType.Heading6) || Element.isElementType(node, BlockType.BlockQuote) || Element.isElementType(node, BlockType.UnorderedList) || Element.isElementType(node, BlockType.OrderedList) || Element.isElementType(node, BlockType.Text) || Element.isElementType(node, BlockType.Default));
|
|
1703
|
-
},
|
|
1704
|
-
isBlock(node) {
|
|
1705
|
-
return Element.isElement(node) && (this.isRootBlock(node) || Element.isElementType(node, BlockType.ListItem) || Element.isElementType(node, BlockType.ListItemChild));
|
|
1706
|
-
},
|
|
1707
|
-
isInline(node) {
|
|
1708
|
-
return Element.isElementType(node, InlineType.Code) || Element.isElementType(node, InlineType.Link) || Element.isElementType(node, InlineType.SubScript) || Element.isElementType(node, InlineType.SuperScript);
|
|
1709
|
-
},
|
|
1710
|
-
isConvertibleToListTextNode(node) {
|
|
1711
|
-
return !this.isList(node) && !this.isListItem(node) && !this.isListItemChild(node);
|
|
1712
|
-
},
|
|
1713
|
-
isList(node) {
|
|
1714
|
-
return Element.isElementType(node, BlockType.OrderedList) || Element.isElementType(node, BlockType.UnorderedList);
|
|
1715
|
-
},
|
|
1716
|
-
isListItem(node) {
|
|
1717
|
-
return Element.isElementType(node, BlockType.ListItem);
|
|
1718
|
-
},
|
|
1719
|
-
isListItemChild(node) {
|
|
1720
|
-
return Element.isElementType(node, BlockType.ListItemChild);
|
|
1721
|
-
},
|
|
1722
|
-
createText() {
|
|
1723
|
-
return { text: "" };
|
|
1724
|
-
},
|
|
1725
|
-
createParagraph() {
|
|
1726
|
-
return {
|
|
1727
|
-
children: [this.createText()],
|
|
1728
|
-
type: BlockType.Paragraph
|
|
1729
|
-
};
|
|
1730
|
-
},
|
|
1731
|
-
createList(type = BlockType.UnorderedList) {
|
|
1732
|
-
return { children: [this.createText()], type };
|
|
1733
|
-
},
|
|
1734
|
-
createListItem() {
|
|
1735
|
-
return {
|
|
1736
|
-
children: [this.createListItemChild()],
|
|
1737
|
-
type: BlockType.ListItem
|
|
1738
|
-
};
|
|
1739
|
-
},
|
|
1740
|
-
createListItemChild() {
|
|
1741
|
-
return {
|
|
1742
|
-
children: [this.createText()],
|
|
1743
|
-
type: BlockType.ListItemChild
|
|
1744
|
-
};
|
|
1745
|
-
}
|
|
1746
|
-
};
|
|
1747
|
-
function unhangRange(editor, range) {
|
|
1748
|
-
let [start, end] = Range.edges(range);
|
|
1749
|
-
if (start.offset !== 0 || end.offset !== 0 || Range.isCollapsed(range)) {
|
|
1750
|
-
return range;
|
|
1751
|
-
}
|
|
1752
|
-
const endBlock = Editor.above(editor, {
|
|
1753
|
-
at: end,
|
|
1754
|
-
match: (n) => Element.isElement(n) && Editor.isBlock(editor, n)
|
|
1755
|
-
});
|
|
1756
|
-
const blockPath = endBlock ? endBlock[1] : [];
|
|
1757
|
-
const first = Editor.start(editor, start);
|
|
1758
|
-
const before = { anchor: first, focus: end };
|
|
1759
|
-
let skip = true;
|
|
1760
|
-
for (const [node, path] of Editor.nodes(editor, {
|
|
1761
|
-
at: before,
|
|
1762
|
-
match: Text.isText,
|
|
1763
|
-
reverse: true
|
|
1764
|
-
})) {
|
|
1765
|
-
if (skip) {
|
|
1766
|
-
skip = false;
|
|
1767
|
-
continue;
|
|
1768
|
-
}
|
|
1769
|
-
if (node.text !== "" || Path.isBefore(path, blockPath)) {
|
|
1770
|
-
end = { path, offset: node.text.length };
|
|
1771
|
-
break;
|
|
1772
|
-
}
|
|
1773
|
-
}
|
|
1774
|
-
return { anchor: start, focus: end };
|
|
1775
|
-
}
|
|
1776
|
-
function getSelection(editor) {
|
|
1777
|
-
if (editor.selection)
|
|
1778
|
-
return unhangRange(editor, editor.selection);
|
|
1779
|
-
return {
|
|
1780
|
-
anchor: Editor.start(editor, []),
|
|
1781
|
-
focus: Editor.end(editor, [])
|
|
1782
|
-
};
|
|
1783
|
-
}
|
|
1784
|
-
function getBlocksInSelection(editor) {
|
|
1785
|
-
return Array.from(Editor.nodes(editor, {
|
|
1786
|
-
at: getSelection(editor),
|
|
1787
|
-
match: (node) => ElementUtils.isRootBlock(node)
|
|
1788
|
-
})).filter((entry) => ElementUtils.isRootBlock(entry[0]));
|
|
1789
|
-
}
|
|
1790
|
-
function getActiveBlockType(editor) {
|
|
1791
|
-
var _a;
|
|
1792
|
-
const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type);
|
|
1793
|
-
return rootBlocks.reduce((a, b) => a === b ? b : null, (_a = rootBlocks.at(0)) != null ? _a : null);
|
|
1794
|
-
}
|
|
1795
|
-
function setBlockKeyForDevice(editor, breakpoints, deviceId, key, value, options) {
|
|
1796
|
-
var _a, _b;
|
|
1797
|
-
const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
|
|
1798
|
-
if (!at)
|
|
1799
|
-
return;
|
|
1800
|
-
const rootElements = getBlocksInSelection(editor);
|
|
1801
|
-
for (const [node, path] of rootElements) {
|
|
1802
|
-
if (ElementUtils.isBlock(node)) {
|
|
1803
|
-
const deviceValues = (_b = node[key]) != null ? _b : [];
|
|
1804
|
-
const currentDeviceValue = findBreakpointOverride(breakpoints, deviceValues, deviceId, (v) => v);
|
|
1805
|
-
const nextDeviceValue = __spreadProps(__spreadValues({}, currentDeviceValue), {
|
|
1806
|
-
deviceId,
|
|
1807
|
-
value
|
|
1808
|
-
});
|
|
1809
|
-
Transforms.setNodes(editor, {
|
|
1810
|
-
[key]: [...deviceValues.filter((v) => v.deviceId !== deviceId), nextDeviceValue]
|
|
1811
|
-
}, { at: path });
|
|
1812
|
-
}
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
function clearBlockKeyForDevice(editor, deviceId, key) {
|
|
1816
|
-
var _a;
|
|
1817
|
-
const rootElements = getBlocksInSelection(editor);
|
|
1818
|
-
for (const [node, path] of rootElements) {
|
|
1819
|
-
if (ElementUtils.isBlock(node)) {
|
|
1820
|
-
const deviceOverrides = (_a = node[key]) != null ? _a : [];
|
|
1821
|
-
Transforms.setNodes(editor, {
|
|
1822
|
-
[key]: deviceOverrides.filter((v) => v.deviceId !== deviceId)
|
|
1823
|
-
}, { at: path });
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
function wrapInline(editor, inline) {
|
|
1828
|
-
Transforms.wrapNodes(editor, inline, {
|
|
1829
|
-
at: getSelection(editor),
|
|
1830
|
-
split: true
|
|
1831
|
-
});
|
|
1832
|
-
}
|
|
1833
|
-
function unwrapInline(editor, type) {
|
|
1834
|
-
Transforms.unwrapNodes(editor, {
|
|
1835
|
-
match: (node) => ElementUtils.isInline(node) && node.type === type,
|
|
1836
|
-
at: getSelection(editor)
|
|
1837
|
-
});
|
|
1838
|
-
}
|
|
1839
|
-
const EditorUtils = {
|
|
1840
|
-
getFirstAncestorList(editor, path) {
|
|
1841
|
-
try {
|
|
1842
|
-
const parentList = Editor.above(editor, {
|
|
1843
|
-
at: path,
|
|
1844
|
-
match: (node) => ElementUtils.isList(node)
|
|
1845
|
-
});
|
|
1846
|
-
return parentList != null ? parentList : null;
|
|
1847
|
-
} catch (e) {
|
|
1848
|
-
return null;
|
|
1849
|
-
}
|
|
1850
|
-
},
|
|
1851
|
-
getFirstAncestorListItem(editor, path) {
|
|
1852
|
-
try {
|
|
1853
|
-
const parentListItem = Editor.above(editor, {
|
|
1854
|
-
at: path,
|
|
1855
|
-
match: (node) => ElementUtils.isListItem(node)
|
|
1856
|
-
});
|
|
1857
|
-
return parentListItem != null ? parentListItem : null;
|
|
1858
|
-
} catch (e) {
|
|
1859
|
-
return null;
|
|
1860
|
-
}
|
|
1861
|
-
}
|
|
1862
|
-
};
|
|
1863
|
-
const LIST_ITEM_CHILD_POSITION = 0;
|
|
1864
|
-
const LIST_ITEM_LIST_POSITION = 1;
|
|
1865
|
-
function filterForSubtreeRoots(entries) {
|
|
1866
|
-
return entries.filter(([, nodePath]) => !Path.ancestors(nodePath).some((ancestor) => {
|
|
1867
|
-
return entries.some(([, path]) => Path.equals(path, ancestor));
|
|
1868
|
-
}));
|
|
1869
|
-
}
|
|
1870
|
-
function unwrapPath(editor, listItemPath) {
|
|
1871
|
-
const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath);
|
|
1872
|
-
const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath);
|
|
1873
|
-
if (!parentList || listItemContainingParentList)
|
|
1874
|
-
return;
|
|
1875
|
-
Editor.withoutNormalizing(editor, () => {
|
|
1876
|
-
const listItemTextPath = [...listItemPath, LIST_ITEM_CHILD_POSITION];
|
|
1877
|
-
const listItemNestedListPath = [...listItemPath, LIST_ITEM_LIST_POSITION];
|
|
1878
|
-
if (Node.has(editor, listItemNestedListPath)) {
|
|
1879
|
-
Transforms.setNodes(editor, { type: parentList[0].type }, { at: listItemNestedListPath });
|
|
1880
|
-
Transforms.liftNodes(editor, { at: listItemNestedListPath });
|
|
1881
|
-
Transforms.liftNodes(editor, { at: Path.next(listItemPath) });
|
|
1882
|
-
}
|
|
1883
|
-
if (Node.has(editor, listItemTextPath)) {
|
|
1884
|
-
Transforms.setNodes(editor, { type: BlockType.Paragraph }, {
|
|
1885
|
-
at: listItemTextPath
|
|
1886
|
-
});
|
|
1887
|
-
Transforms.liftNodes(editor, { at: listItemTextPath });
|
|
1888
|
-
Transforms.liftNodes(editor, { at: listItemPath });
|
|
1889
|
-
}
|
|
1890
|
-
});
|
|
1891
|
-
}
|
|
1892
|
-
function unwrapList(editor, options) {
|
|
1893
|
-
var _a;
|
|
1894
|
-
const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
|
|
1895
|
-
if (!at)
|
|
1896
|
-
return;
|
|
1897
|
-
const listItems = Array.from(Editor.nodes(editor, {
|
|
1898
|
-
at,
|
|
1899
|
-
match: (node) => {
|
|
1900
|
-
return Element.isElement(node) && ElementUtils.isListItem(node);
|
|
1901
|
-
}
|
|
1902
|
-
}));
|
|
1903
|
-
const subRoots = filterForSubtreeRoots(listItems);
|
|
1904
|
-
const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path));
|
|
1905
|
-
refs.forEach((ref) => {
|
|
1906
|
-
if (ref.current) {
|
|
1907
|
-
unwrapPath(editor, ref.current);
|
|
1908
|
-
}
|
|
1909
|
-
ref.unref();
|
|
1910
|
-
});
|
|
1911
|
-
}
|
|
1912
|
-
function wrapList(editor, options = { type: BlockType.UnorderedList }) {
|
|
1913
|
-
var _a;
|
|
1914
|
-
const at = (_a = options.at) != null ? _a : editor.selection;
|
|
1915
|
-
if (!at)
|
|
1916
|
-
return;
|
|
1917
|
-
const nonListEntries = Array.from(Editor.nodes(editor, {
|
|
1918
|
-
at,
|
|
1919
|
-
match: (node) => {
|
|
1920
|
-
return Element.isElement(node) && ElementUtils.isConvertibleToListTextNode(node);
|
|
1921
|
-
}
|
|
1922
|
-
}));
|
|
1923
|
-
const refs = nonListEntries.map(([_, path]) => Editor.pathRef(editor, path));
|
|
1924
|
-
refs.forEach((ref) => {
|
|
1925
|
-
const path = ref.current;
|
|
1926
|
-
if (path) {
|
|
1927
|
-
Editor.withoutNormalizing(editor, () => {
|
|
1928
|
-
Transforms.setNodes(editor, { type: BlockType.ListItemChild }, {
|
|
1929
|
-
at: path
|
|
1930
|
-
});
|
|
1931
|
-
Transforms.wrapNodes(editor, ElementUtils.createListItem(), {
|
|
1932
|
-
match: (node) => ElementUtils.isListItemChild(node),
|
|
1933
|
-
at: path
|
|
1934
|
-
});
|
|
1935
|
-
Transforms.wrapNodes(editor, ElementUtils.createList(options.type), {
|
|
1936
|
-
at: path
|
|
1937
|
-
});
|
|
1938
|
-
});
|
|
1939
|
-
}
|
|
1940
|
-
ref.unref();
|
|
1941
|
-
});
|
|
1942
|
-
}
|
|
1943
|
-
const LocationUtils = {
|
|
1944
|
-
getStartPath(location) {
|
|
1945
|
-
if (Range.isRange(location))
|
|
1946
|
-
return Range.start(location).path;
|
|
1947
|
-
if (Point.isPoint(location))
|
|
1948
|
-
return location.path;
|
|
1949
|
-
return location;
|
|
1950
|
-
}
|
|
1951
|
-
};
|
|
1952
|
-
function getSelectedListItems(editor) {
|
|
1953
|
-
var _a, _b;
|
|
1954
|
-
if (!editor.selection)
|
|
1955
|
-
return [];
|
|
1956
|
-
const start = LocationUtils.getStartPath(editor.selection);
|
|
1957
|
-
const listItems = Editor.nodes(editor, {
|
|
1958
|
-
at: editor.selection,
|
|
1959
|
-
match: (node) => ElementUtils.isListItem(node)
|
|
1960
|
-
});
|
|
1961
|
-
const firstAncestorPath = (_b = (_a = EditorUtils.getFirstAncestorListItem(editor, start)) == null ? void 0 : _a[1]) != null ? _b : [];
|
|
1962
|
-
return Array.from(listItems).filter((node) => Path.isDescendant(start, node[1]) ? Path.equals(node[1], firstAncestorPath) : !Path.isAfter(start, node[1]));
|
|
1963
|
-
}
|
|
1964
|
-
function indentPath(editor, path) {
|
|
1965
|
-
const parent = Node.parent(editor, path);
|
|
1966
|
-
if (!path || !Path.hasPrevious(path) || !ElementUtils.isList(parent))
|
|
1967
|
-
return;
|
|
1968
|
-
const previosPath = Path.previous(path);
|
|
1969
|
-
const previousChildListPath = [...previosPath, LIST_ITEM_LIST_POSITION];
|
|
1970
|
-
const previousHasChildList = Node.has(editor, previousChildListPath);
|
|
1971
|
-
Editor.withoutNormalizing(editor, () => {
|
|
1972
|
-
if (!previousHasChildList) {
|
|
1973
|
-
Transforms.insertNodes(editor, ElementUtils.createList(parent.type), {
|
|
1974
|
-
at: previousChildListPath
|
|
1975
|
-
});
|
|
1976
|
-
}
|
|
1977
|
-
const previousChildList = Node.get(editor, previousChildListPath);
|
|
1978
|
-
if (ElementUtils.isList(previousChildList)) {
|
|
1979
|
-
const index = previousHasChildList ? previousChildList.children.length : 0;
|
|
1980
|
-
Transforms.moveNodes(editor, {
|
|
1981
|
-
at: path,
|
|
1982
|
-
to: [...previousChildListPath, index]
|
|
1983
|
-
});
|
|
1984
|
-
}
|
|
1985
|
-
});
|
|
1986
|
-
}
|
|
1987
|
-
function indent(editor) {
|
|
1988
|
-
if (!editor.selection)
|
|
1989
|
-
return;
|
|
1990
|
-
const listItems = getSelectedListItems(editor);
|
|
1991
|
-
const subRoots = filterForSubtreeRoots(listItems);
|
|
1992
|
-
const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path));
|
|
1993
|
-
refs.forEach((ref) => {
|
|
1994
|
-
if (ref.current) {
|
|
1995
|
-
indentPath(editor, ref.current);
|
|
1996
|
-
}
|
|
1997
|
-
ref.unref();
|
|
1998
|
-
});
|
|
1999
|
-
}
|
|
2000
|
-
function dedentPath(editor, listItemPath) {
|
|
2001
|
-
const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath);
|
|
2002
|
-
const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath);
|
|
2003
|
-
if (!parentList || !listItemContainingParentList)
|
|
2004
|
-
return;
|
|
2005
|
-
const [parentListNode, parentListPath] = parentList;
|
|
2006
|
-
const [_, listItemContainingParentListPath] = listItemContainingParentList;
|
|
2007
|
-
const listItemPosition = listItemPath[listItemPath.length - 1];
|
|
2008
|
-
const previousSiblings = parentListNode.children.slice(0, listItemPosition);
|
|
2009
|
-
const nextSiblings = parentListNode.children.slice(listItemPosition + 1);
|
|
2010
|
-
Editor.withoutNormalizing(editor, () => {
|
|
2011
|
-
nextSiblings.forEach(() => {
|
|
2012
|
-
const nextSiblingPath = [...parentListPath, listItemPosition + 1];
|
|
2013
|
-
indentPath(editor, nextSiblingPath);
|
|
2014
|
-
});
|
|
2015
|
-
Transforms.moveNodes(editor, {
|
|
2016
|
-
at: listItemPath,
|
|
2017
|
-
to: Path.next(listItemContainingParentListPath)
|
|
2018
|
-
});
|
|
2019
|
-
if (previousSiblings.length === 0) {
|
|
2020
|
-
Transforms.removeNodes(editor, { at: parentListPath });
|
|
2021
|
-
}
|
|
2022
|
-
});
|
|
2023
|
-
}
|
|
2024
|
-
function dedent(editor) {
|
|
2025
|
-
if (!editor.selection)
|
|
2026
|
-
return;
|
|
2027
|
-
const listItems = getSelectedListItems(editor);
|
|
2028
|
-
const subRoots = filterForSubtreeRoots(listItems);
|
|
2029
|
-
const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path));
|
|
2030
|
-
refs.forEach((ref) => {
|
|
2031
|
-
if (ref.current) {
|
|
2032
|
-
dedentPath(editor, ref.current);
|
|
2033
|
-
}
|
|
2034
|
-
ref.unref();
|
|
2035
|
-
});
|
|
2036
|
-
}
|
|
2037
|
-
function toggleList(editor, options = { type: BlockType.UnorderedList }) {
|
|
2038
|
-
var _a;
|
|
2039
|
-
const at = (_a = options.at) != null ? _a : editor.selection;
|
|
2040
|
-
if (at == null)
|
|
2041
|
-
return;
|
|
2042
|
-
const start = LocationUtils.getStartPath(at);
|
|
2043
|
-
const ancestorPath = Path.ancestors(start).at(1);
|
|
2044
|
-
if (!ancestorPath || !Node.has(editor, ancestorPath))
|
|
2045
|
-
return;
|
|
2046
|
-
const ancestor = Node.get(editor, ancestorPath);
|
|
2047
|
-
if (!ElementUtils.isList(ancestor)) {
|
|
2048
|
-
return wrapList(editor, { type: options.type, at });
|
|
2049
|
-
}
|
|
2050
|
-
if (ancestor.type === options.type) {
|
|
2051
|
-
unwrapList(editor, { at });
|
|
2052
|
-
} else {
|
|
2053
|
-
Transforms.setNodes(editor, { type: options.type }, { at: ancestorPath });
|
|
2054
|
-
}
|
|
2055
|
-
}
|
|
2056
|
-
const BlockActions = {
|
|
2057
|
-
setBlockKeyForDevice,
|
|
2058
|
-
clearBlockKeyForDevice,
|
|
2059
|
-
wrapInline,
|
|
2060
|
-
unwrapInline
|
|
2061
|
-
};
|
|
2062
|
-
const ListActions = {
|
|
2063
|
-
unwrapList,
|
|
2064
|
-
wrapList,
|
|
2065
|
-
indent,
|
|
2066
|
-
dedent,
|
|
2067
|
-
toggleList
|
|
2068
|
-
};
|
|
2069
|
-
function onKeyDown(e, editor) {
|
|
2070
|
-
if (!editor.selection || Array.from(Editor.nodes(editor, { match: (node) => ElementUtils.isListItem(node) })).length === 0)
|
|
2071
|
-
return;
|
|
2072
|
-
if (isHotkey("shift+tab", e)) {
|
|
2073
|
-
e.preventDefault();
|
|
2074
|
-
ListActions.dedent(editor);
|
|
2075
|
-
}
|
|
2076
|
-
if (isHotkey("tab", e)) {
|
|
2077
|
-
e.preventDefault();
|
|
2078
|
-
ListActions.indent(editor);
|
|
2079
|
-
}
|
|
2080
|
-
if (isHotkey("backspace", e)) {
|
|
2081
|
-
if (!editor.selection)
|
|
2082
|
-
return;
|
|
2083
|
-
if (Range.isExpanded(editor.selection))
|
|
2084
|
-
return;
|
|
2085
|
-
const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path);
|
|
2086
|
-
if (editor.selection.anchor.offset === 0 && listItem) {
|
|
2087
|
-
e.preventDefault();
|
|
2088
|
-
const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1]);
|
|
2089
|
-
const list = EditorUtils.getFirstAncestorList(editor, listItem[1]);
|
|
2090
|
-
if (parentListItem) {
|
|
2091
|
-
ListActions.dedent(editor);
|
|
2092
|
-
} else if (list) {
|
|
2093
|
-
ListActions.unwrapList(editor);
|
|
2094
|
-
}
|
|
2095
|
-
return;
|
|
2096
|
-
}
|
|
2097
|
-
}
|
|
2098
|
-
if (isHotkey("enter", e)) {
|
|
2099
|
-
e.preventDefault();
|
|
2100
|
-
if (!editor.selection)
|
|
2101
|
-
return;
|
|
2102
|
-
if (Range.isExpanded(editor.selection)) {
|
|
2103
|
-
Transforms.delete(editor);
|
|
2104
|
-
return;
|
|
2105
|
-
}
|
|
2106
|
-
const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path);
|
|
2107
|
-
if (editor.selection.anchor.offset === 0 && listItem && Editor.string(editor, listItem[1]) === "") {
|
|
2108
|
-
const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1]);
|
|
2109
|
-
if (parentListItem) {
|
|
2110
|
-
ListActions.dedent(editor);
|
|
2111
|
-
} else {
|
|
2112
|
-
ListActions.unwrapList(editor);
|
|
2113
|
-
}
|
|
2114
|
-
return;
|
|
2115
|
-
}
|
|
2116
|
-
Transforms.splitNodes(editor, {
|
|
2117
|
-
at: editor.selection,
|
|
2118
|
-
always: true,
|
|
2119
|
-
match: (node) => ElementUtils.isListItem(node)
|
|
2120
|
-
});
|
|
2121
|
-
}
|
|
2122
|
-
if (isHotkey("shift+enter", e)) {
|
|
2123
|
-
e.preventDefault();
|
|
2124
|
-
editor.insertText("\n");
|
|
2125
|
-
}
|
|
2126
|
-
}
|
|
2127
|
-
function withBlock(editor) {
|
|
2128
|
-
const { normalizeNode } = editor;
|
|
2129
|
-
editor.isInline = (entry) => {
|
|
2130
|
-
return ElementUtils.isInline(entry);
|
|
2131
|
-
};
|
|
2132
|
-
editor.normalizeNode = (entry) => {
|
|
2133
|
-
var _a;
|
|
2134
|
-
const [normalizationNode, normalizationPath] = entry;
|
|
2135
|
-
if (ElementUtils.isBlock(normalizationNode) && ((_a = normalizationNode == null ? void 0 : normalizationNode.textAlign) == null ? void 0 : _a.length) == 0) {
|
|
2136
|
-
Transforms.unsetNodes(editor, "textAlign", { at: normalizationPath });
|
|
2137
|
-
return;
|
|
2138
|
-
}
|
|
2139
|
-
if (ElementUtils.isListItem(normalizationNode)) {
|
|
2140
|
-
const pathToListItemText = [...normalizationPath, LIST_ITEM_CHILD_POSITION];
|
|
2141
|
-
if (Node.has(editor, pathToListItemText)) {
|
|
2142
|
-
const nodeInListItemTextPosition = Node.get(editor, pathToListItemText);
|
|
2143
|
-
if (ElementUtils.isRootBlock(nodeInListItemTextPosition)) {
|
|
2144
|
-
Transforms.setNodes(editor, { type: BlockType.ListItemChild }, {
|
|
2145
|
-
at: pathToListItemText
|
|
2146
|
-
});
|
|
2147
|
-
return;
|
|
2148
|
-
}
|
|
2149
|
-
} else {
|
|
2150
|
-
Transforms.insertNodes(editor, ElementUtils.createListItem(), {
|
|
2151
|
-
at: pathToListItemText
|
|
2152
|
-
});
|
|
2153
|
-
return;
|
|
2154
|
-
}
|
|
2155
|
-
}
|
|
2156
|
-
if (!Text.isText(normalizationNode)) {
|
|
2157
|
-
const mergeableChildren = Array.from(Node.children(editor, normalizationPath)).map((child, index, children) => {
|
|
2158
|
-
const potentialNodeToBeMerged = children.at(index + 1);
|
|
2159
|
-
if (!potentialNodeToBeMerged || !ElementUtils.isList(potentialNodeToBeMerged[0]) || !ElementUtils.isList(child[0]) || potentialNodeToBeMerged[0].type !== child[0].type) {
|
|
2160
|
-
return null;
|
|
2161
|
-
}
|
|
2162
|
-
return [
|
|
2163
|
-
Editor.pathRef(editor, child[1]),
|
|
2164
|
-
Editor.pathRef(editor, potentialNodeToBeMerged[1])
|
|
2165
|
-
];
|
|
2166
|
-
}).filter((mergeableNodes) => Boolean(mergeableNodes));
|
|
2167
|
-
if (mergeableChildren.length !== 0) {
|
|
2168
|
-
mergeableChildren.reverse().forEach(([nodePathRef, nodeToBeMergedPathRef]) => {
|
|
2169
|
-
const nodePath = nodePathRef.current;
|
|
2170
|
-
const nodeToBeMergedPath = nodeToBeMergedPathRef.current;
|
|
2171
|
-
if (nodePath == null || nodeToBeMergedPath == null)
|
|
2172
|
-
return;
|
|
2173
|
-
const nodeChildren = Array.from(Node.children(editor, nodePath));
|
|
2174
|
-
const childrenToBeMerged = Array.from(Node.children(editor, nodeToBeMergedPath));
|
|
2175
|
-
Editor.withoutNormalizing(editor, () => {
|
|
2176
|
-
childrenToBeMerged.reverse().forEach(([_, childPath]) => {
|
|
2177
|
-
Transforms.moveNodes(editor, {
|
|
2178
|
-
at: childPath,
|
|
2179
|
-
to: [...nodePath, nodeChildren.length]
|
|
2180
|
-
});
|
|
2181
|
-
});
|
|
2182
|
-
Transforms.removeNodes(editor, { at: nodeToBeMergedPath });
|
|
2183
|
-
});
|
|
2184
|
-
nodePathRef.unref();
|
|
2185
|
-
nodeToBeMergedPathRef.unref();
|
|
2186
|
-
});
|
|
2187
|
-
return;
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
|
-
normalizeNode(entry);
|
|
2191
|
-
};
|
|
2192
|
-
return editor;
|
|
2193
|
-
}
|
|
2194
|
-
const definition = Select({
|
|
2195
|
-
label: "Block",
|
|
2196
|
-
labelOrientation: "horizontal",
|
|
2197
|
-
options: [
|
|
2198
|
-
{
|
|
2199
|
-
value: BlockType.Paragraph,
|
|
2200
|
-
label: "Paragraph"
|
|
2201
|
-
},
|
|
2202
|
-
{
|
|
2203
|
-
value: BlockType.Heading1,
|
|
2204
|
-
label: "Heading 1"
|
|
2205
|
-
},
|
|
2206
|
-
{
|
|
2207
|
-
value: BlockType.Heading2,
|
|
2208
|
-
label: "Heading 2"
|
|
2209
|
-
},
|
|
2210
|
-
{
|
|
2211
|
-
value: BlockType.Heading3,
|
|
2212
|
-
label: "Heading 3"
|
|
2213
|
-
},
|
|
2214
|
-
{
|
|
2215
|
-
value: BlockType.Heading4,
|
|
2216
|
-
label: "Heading 4"
|
|
2217
|
-
},
|
|
2218
|
-
{
|
|
2219
|
-
value: BlockType.Heading5,
|
|
2220
|
-
label: "Heading 5"
|
|
2221
|
-
},
|
|
2222
|
-
{
|
|
2223
|
-
value: BlockType.Heading6,
|
|
2224
|
-
label: "Heading 6"
|
|
2225
|
-
},
|
|
2226
|
-
{
|
|
2227
|
-
value: BlockType.UnorderedList,
|
|
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
|
-
],
|
|
2239
|
-
defaultValue: BlockType.Paragraph
|
|
2240
|
-
});
|
|
2241
|
-
function BlockPlugin() {
|
|
2242
|
-
return createRichTextV2Plugin({
|
|
2243
|
-
withPlugin: withBlock,
|
|
2244
|
-
onKeyDown,
|
|
2245
|
-
control: {
|
|
2246
|
-
definition,
|
|
2247
|
-
onChange: (editor, value) => {
|
|
2248
|
-
const activeBlockType = getActiveBlockType(editor);
|
|
2249
|
-
if (value === BlockType.UnorderedList || value === BlockType.OrderedList) {
|
|
2250
|
-
ListActions.toggleList(editor, {
|
|
2251
|
-
type: value,
|
|
2252
|
-
at: getSelection(editor)
|
|
2253
|
-
});
|
|
2254
|
-
} else if (activeBlockType === value) {
|
|
2255
|
-
Transforms.setNodes(editor, {
|
|
2256
|
-
type: BlockType.Default
|
|
2257
|
-
}, { at: getSelection(editor) });
|
|
2258
|
-
} else {
|
|
2259
|
-
ListActions.unwrapList(editor, {
|
|
2260
|
-
at: getSelection(editor)
|
|
2261
|
-
});
|
|
2262
|
-
Transforms.setNodes(editor, {
|
|
2263
|
-
type: value != null ? value : BlockType.Default
|
|
2264
|
-
}, { at: getSelection(editor) });
|
|
2265
|
-
}
|
|
2266
|
-
},
|
|
2267
|
-
getValue: (editor) => {
|
|
2268
|
-
const activeBlock = getActiveBlockType(editor);
|
|
2269
|
-
if (activeBlock === RootBlockType.Text || activeBlock === RootBlockType.Default)
|
|
2270
|
-
return void 0;
|
|
2271
|
-
return activeBlock;
|
|
2272
|
-
}
|
|
2273
|
-
}
|
|
2274
|
-
});
|
|
2275
|
-
}
|
|
2276
|
-
const RichTextV2ControlType = "makeswift::controls::rich-text-v2";
|
|
2277
|
-
const RichTextV2Mode = {
|
|
2278
|
-
Inline: "makeswift::controls::rich-text-v2::mode::inline",
|
|
2279
|
-
Block: "makeswift::controls::rich-text-v2::mode::block"
|
|
2280
|
-
};
|
|
2281
|
-
function createRichTextV2Plugin({
|
|
2282
|
-
control,
|
|
2283
|
-
withPlugin,
|
|
2284
|
-
onKeyDown: onKeyDown2
|
|
2285
|
-
}) {
|
|
2286
|
-
return { control, withPlugin, onKeyDown: onKeyDown2 };
|
|
2287
|
-
}
|
|
2288
|
-
function unstable_RichTextV2(config = {}) {
|
|
2289
|
-
return { type: RichTextV2ControlType, config };
|
|
2290
|
-
}
|
|
2291
|
-
const RichTextV2ControlMessageType = {
|
|
2292
|
-
RESET_VALUE: "RESET_VALUE",
|
|
2293
|
-
FOCUS: "FOCUS",
|
|
2294
|
-
RUN_PLUGIN_CONTROL_ACTION: "RUN_PLUGIN_CONTROL_ACTION",
|
|
2295
|
-
SET_DEFAULT_VALUE: "SET_DEFAULT_VALUE",
|
|
2296
|
-
SET_PLUGIN_CONTROL_VALUE: "SET_PLUGIN_CONTROL_VALUE",
|
|
2297
|
-
ON_CHANGE: "ON_CHANGE",
|
|
2298
|
-
SELECT: "SELECT",
|
|
2299
|
-
SWITCH_TO_BUILD_MODE: "SWITCH_TO_BUILD_MODE",
|
|
2300
|
-
CHANGE_BOX_MODEL: "CHANGE_BOX_MODEL"
|
|
2301
|
-
};
|
|
2302
|
-
class RichTextV2Control extends PropController {
|
|
2303
|
-
constructor(send, descriptor) {
|
|
2304
|
-
super(send);
|
|
2305
|
-
__publicField(this, "editor", null);
|
|
2306
|
-
__publicField(this, "defaultValue", null);
|
|
2307
|
-
__publicField(this, "descriptor");
|
|
2308
|
-
__publicField(this, "recv", (message) => {
|
|
2309
|
-
var _a, _b, _c;
|
|
2310
|
-
if (!this.editor)
|
|
2311
|
-
return;
|
|
2312
|
-
switch (message.type) {
|
|
2313
|
-
case RichTextV2ControlMessageType.FOCUS: {
|
|
2314
|
-
this.editor.focusAndSelectAll();
|
|
2315
|
-
break;
|
|
2316
|
-
}
|
|
2317
|
-
case RichTextV2ControlMessageType.RESET_VALUE: {
|
|
2318
|
-
if (this.defaultValue) {
|
|
2319
|
-
this.editor.selection = null;
|
|
2320
|
-
this.editor.children = this.defaultValue;
|
|
2321
|
-
this.editor.onChange();
|
|
2322
|
-
}
|
|
2323
|
-
break;
|
|
2324
|
-
}
|
|
2325
|
-
case RichTextV2ControlMessageType.RUN_PLUGIN_CONTROL_ACTION: {
|
|
2326
|
-
(_c = (_b = (_a = this.descriptor.config.plugins) == null ? void 0 : _a.at(message.pluginIndex)) == null ? void 0 : _b.control) == null ? void 0 : _c.onChange(this.editor, message.value);
|
|
2327
|
-
break;
|
|
2328
|
-
}
|
|
2329
|
-
}
|
|
2330
|
-
});
|
|
2331
|
-
this.descriptor = descriptor;
|
|
2332
|
-
this.send = send;
|
|
2333
|
-
}
|
|
2334
|
-
setEditor(editor) {
|
|
2335
|
-
var _a, _b, _c;
|
|
2336
|
-
this.editor = editor;
|
|
2337
|
-
this.send({
|
|
2338
|
-
type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
|
|
2339
|
-
value: (_c = (_b = (_a = this.descriptor.config) == null ? void 0 : _a.plugins) == null ? void 0 : _b.map((plugin) => {
|
|
2340
|
-
var _a2;
|
|
2341
|
-
return (_a2 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a2.getValue(editor);
|
|
2342
|
-
})) != null ? _c : []
|
|
2343
|
-
});
|
|
2344
|
-
}
|
|
2345
|
-
setDefaultValue(defaultValue) {
|
|
2346
|
-
this.defaultValue = defaultValue;
|
|
2347
|
-
this.send({ type: RichTextV2ControlMessageType.SET_DEFAULT_VALUE, value: defaultValue });
|
|
2348
|
-
}
|
|
2349
|
-
select() {
|
|
2350
|
-
this.send({ type: RichTextV2ControlMessageType.SELECT });
|
|
2351
|
-
}
|
|
2352
|
-
switchToBuildMode() {
|
|
2353
|
-
this.send({ type: RichTextV2ControlMessageType.SWITCH_TO_BUILD_MODE });
|
|
2354
|
-
}
|
|
2355
|
-
onChange(value) {
|
|
2356
|
-
var _a, _b, _c;
|
|
2357
|
-
const editor = this.editor;
|
|
2358
|
-
if (editor == null)
|
|
2359
|
-
return;
|
|
2360
|
-
this.send({
|
|
2361
|
-
type: RichTextV2ControlMessageType.ON_CHANGE,
|
|
2362
|
-
value
|
|
2363
|
-
});
|
|
2364
|
-
this.send({
|
|
2365
|
-
type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
|
|
2366
|
-
value: (_c = (_b = (_a = this.descriptor.config) == null ? void 0 : _a.plugins) == null ? void 0 : _b.map((plugin) => {
|
|
2367
|
-
var _a2;
|
|
2368
|
-
return (_a2 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a2.getValue(editor);
|
|
2369
|
-
})) != null ? _c : []
|
|
2370
|
-
});
|
|
2371
|
-
}
|
|
2372
|
-
changeBoxModel(boxModel) {
|
|
2373
|
-
this.send({ type: RichTextV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
|
|
2374
|
-
}
|
|
2375
|
-
}
|
|
1965
|
+
Link: "link"
|
|
1966
|
+
};
|
|
1967
|
+
const BlockTextAlignment = {
|
|
1968
|
+
Left: "left",
|
|
1969
|
+
Center: "center",
|
|
1970
|
+
Right: "right",
|
|
1971
|
+
Justify: "justify"
|
|
1972
|
+
};
|
|
2376
1973
|
function isText(node) {
|
|
2377
1974
|
if (typeof node === "object" && "text" in node)
|
|
2378
1975
|
return true;
|
|
2379
1976
|
return false;
|
|
2380
1977
|
}
|
|
2381
1978
|
function toTextDAO(node) {
|
|
2382
|
-
var
|
|
2383
|
-
const typographyMark = (
|
|
1979
|
+
var _a2, _b, _c, _d;
|
|
1980
|
+
const typographyMark = (_a2 = node.marks) == null ? void 0 : _a2.find((mark) => mark.type === "typography");
|
|
2384
1981
|
return [
|
|
2385
1982
|
{
|
|
2386
1983
|
text: (_b = node.text) != null ? _b : "",
|
|
@@ -2389,12 +1986,12 @@ function toTextDAO(node) {
|
|
|
2389
1986
|
];
|
|
2390
1987
|
}
|
|
2391
1988
|
function toInlineDAO(node) {
|
|
2392
|
-
var
|
|
1989
|
+
var _a2, _b, _c, _d;
|
|
2393
1990
|
switch (node.type) {
|
|
2394
1991
|
case InlineType.Link:
|
|
2395
1992
|
return [
|
|
2396
1993
|
{
|
|
2397
|
-
children: (_b = (
|
|
1994
|
+
children: (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(toInlineOrTextDAO)) != null ? _b : [],
|
|
2398
1995
|
[node.type]: node.data,
|
|
2399
1996
|
type: node.type
|
|
2400
1997
|
}
|
|
@@ -2423,7 +2020,7 @@ function toInlineOrTextDAO(node) {
|
|
|
2423
2020
|
}
|
|
2424
2021
|
}
|
|
2425
2022
|
function toNodeDAO(node) {
|
|
2426
|
-
var
|
|
2023
|
+
var _a2, _b;
|
|
2427
2024
|
switch (node.object) {
|
|
2428
2025
|
case ObjectType.Inline:
|
|
2429
2026
|
case ObjectType.Text:
|
|
@@ -2433,7 +2030,7 @@ function toNodeDAO(node) {
|
|
|
2433
2030
|
{
|
|
2434
2031
|
type: node.type,
|
|
2435
2032
|
textAlign: (node == null ? void 0 : node.data) && "textAlign" in node.data ? node == null ? void 0 : node.data.textAlign : void 0,
|
|
2436
|
-
children: (_b = (
|
|
2033
|
+
children: (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(toNodeDAO)) != null ? _b : []
|
|
2437
2034
|
}
|
|
2438
2035
|
];
|
|
2439
2036
|
default:
|
|
@@ -2441,8 +2038,8 @@ function toNodeDAO(node) {
|
|
|
2441
2038
|
}
|
|
2442
2039
|
}
|
|
2443
2040
|
function richTextDTOtoSelection(data) {
|
|
2444
|
-
var
|
|
2445
|
-
if (((_b = (
|
|
2041
|
+
var _a2, _b, _c, _d;
|
|
2042
|
+
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
2043
|
return {
|
|
2447
2044
|
anchor: {
|
|
2448
2045
|
offset: data.selection.anchor.offset,
|
|
@@ -2456,8 +2053,8 @@ function richTextDTOtoSelection(data) {
|
|
|
2456
2053
|
return null;
|
|
2457
2054
|
}
|
|
2458
2055
|
function richTextDTOtoDAO(data) {
|
|
2459
|
-
var
|
|
2460
|
-
return (_c = (_b = (
|
|
2056
|
+
var _a2, _b, _c;
|
|
2057
|
+
return (_c = (_b = (_a2 = data.document) == null ? void 0 : _a2.nodes) == null ? void 0 : _b.flatMap(toNodeDAO)) != null ? _c : [];
|
|
2461
2058
|
}
|
|
2462
2059
|
function toInlineOrTextDTO(node) {
|
|
2463
2060
|
if (isText(node)) {
|
|
@@ -2501,7 +2098,7 @@ function toInlineOrTextDTO(node) {
|
|
|
2501
2098
|
}
|
|
2502
2099
|
}
|
|
2503
2100
|
function toNodeDTO(node) {
|
|
2504
|
-
var
|
|
2101
|
+
var _a2, _b;
|
|
2505
2102
|
if (isText(node))
|
|
2506
2103
|
return toInlineOrTextDTO(node);
|
|
2507
2104
|
switch (node.type) {
|
|
@@ -2526,7 +2123,7 @@ function toNodeDTO(node) {
|
|
|
2526
2123
|
textAlign: node.textAlign
|
|
2527
2124
|
} : {},
|
|
2528
2125
|
object: "block",
|
|
2529
|
-
nodes: (_b = (
|
|
2126
|
+
nodes: (_b = (_a2 = node.children) == null ? void 0 : _a2.flatMap(toNodeDTO)) != null ? _b : []
|
|
2530
2127
|
}
|
|
2531
2128
|
];
|
|
2532
2129
|
default:
|
|
@@ -2534,330 +2131,209 @@ function toNodeDTO(node) {
|
|
|
2534
2131
|
}
|
|
2535
2132
|
}
|
|
2536
2133
|
function toSelectionDTO(selection) {
|
|
2537
|
-
if (selection == null)
|
|
2538
|
-
return void 0;
|
|
2539
|
-
return {
|
|
2540
|
-
isFocused: false,
|
|
2541
|
-
marks: void 0,
|
|
2542
|
-
object: "selection",
|
|
2543
|
-
anchor: {
|
|
2544
|
-
offset: selection.anchor.offset,
|
|
2545
|
-
path: selection.anchor.path,
|
|
2546
|
-
object: "point"
|
|
2547
|
-
},
|
|
2548
|
-
focus: {
|
|
2549
|
-
offset: selection.focus.offset,
|
|
2550
|
-
path: selection.focus.path,
|
|
2551
|
-
object: "point"
|
|
2552
|
-
}
|
|
2553
|
-
};
|
|
2554
|
-
}
|
|
2555
|
-
function richTextDAOToDTO(children, selection) {
|
|
2556
|
-
return {
|
|
2557
|
-
document: {
|
|
2558
|
-
data: void 0,
|
|
2559
|
-
nodes: children.flatMap(toNodeDTO),
|
|
2560
|
-
object: "document"
|
|
2561
|
-
},
|
|
2562
|
-
object: "value",
|
|
2563
|
-
selection: toSelectionDTO(selection),
|
|
2564
|
-
annotations: void 0,
|
|
2565
|
-
data: void 0
|
|
2566
|
-
};
|
|
2567
|
-
}
|
|
2568
|
-
const RichTextControlType = "makeswift::controls::rich-text";
|
|
2569
|
-
function RichText$1() {
|
|
2570
|
-
return { type: RichTextControlType };
|
|
2571
|
-
}
|
|
2572
|
-
const RichTextControlMessageType = {
|
|
2573
|
-
CHANGE_BUILDER_EDIT_MODE: "CHANGE_BUILDER_EDIT_MODE",
|
|
2574
|
-
INITIALIZE_EDITOR: "INITIALIZE_EDITOR",
|
|
2575
|
-
CHANGE_EDITOR_VALUE: "CHANGE_EDITOR_VALUE",
|
|
2576
|
-
FOCUS: "FOCUS",
|
|
2577
|
-
BLUR: "BLUR",
|
|
2578
|
-
UNDO: "UNDO",
|
|
2579
|
-
REDO: "REDO",
|
|
2580
|
-
CHANGE_BOX_MODEL: "CHANGE_BOX_MODEL"
|
|
2581
|
-
};
|
|
2582
|
-
class RichTextControl extends PropController {
|
|
2583
|
-
constructor() {
|
|
2584
|
-
super(...arguments);
|
|
2585
|
-
__publicField(this, "editor", null);
|
|
2586
|
-
__publicField(this, "recv", (message) => {
|
|
2587
|
-
if (!this.editor)
|
|
2588
|
-
return;
|
|
2589
|
-
switch (message.type) {
|
|
2590
|
-
case RichTextControlMessageType.CHANGE_BUILDER_EDIT_MODE: {
|
|
2591
|
-
switch (message.editMode) {
|
|
2592
|
-
case BuilderEditMode.BUILD:
|
|
2593
|
-
case BuilderEditMode.INTERACT:
|
|
2594
|
-
this.editor.deselectAndBlur();
|
|
2595
|
-
}
|
|
2596
|
-
break;
|
|
2597
|
-
}
|
|
2598
|
-
case RichTextControlMessageType.FOCUS: {
|
|
2599
|
-
this.editor.focusAndSelectAll();
|
|
2600
|
-
break;
|
|
2601
|
-
}
|
|
2602
|
-
}
|
|
2603
|
-
});
|
|
2604
|
-
}
|
|
2605
|
-
setSlateEditor(editor) {
|
|
2606
|
-
this.editor = editor;
|
|
2607
|
-
this.send({
|
|
2608
|
-
type: RichTextControlMessageType.INITIALIZE_EDITOR,
|
|
2609
|
-
value: richTextDAOToDTO(editor.children, editor.selection)
|
|
2610
|
-
});
|
|
2611
|
-
const _onChange = editor.onChange;
|
|
2612
|
-
this.editor.onChange = (options) => {
|
|
2613
|
-
_onChange(options);
|
|
2614
|
-
if ((options == null ? void 0 : options.operation) != null) {
|
|
2615
|
-
this.send({
|
|
2616
|
-
type: RichTextControlMessageType.CHANGE_EDITOR_VALUE,
|
|
2617
|
-
value: richTextDAOToDTO(editor.children, editor.selection)
|
|
2618
|
-
});
|
|
2619
|
-
}
|
|
2620
|
-
};
|
|
2621
|
-
}
|
|
2622
|
-
focus() {
|
|
2623
|
-
this.send({ type: RichTextControlMessageType.FOCUS });
|
|
2624
|
-
}
|
|
2625
|
-
blur() {
|
|
2626
|
-
this.send({ type: RichTextControlMessageType.BLUR });
|
|
2627
|
-
}
|
|
2628
|
-
undo() {
|
|
2629
|
-
this.send({ type: RichTextControlMessageType.UNDO });
|
|
2630
|
-
}
|
|
2631
|
-
redo() {
|
|
2632
|
-
this.send({ type: RichTextControlMessageType.REDO });
|
|
2633
|
-
}
|
|
2634
|
-
changeBoxModel(boxModel) {
|
|
2635
|
-
this.send({ type: RichTextControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
|
|
2636
|
-
}
|
|
2637
|
-
}
|
|
2638
|
-
const Types = {
|
|
2639
|
-
Backgrounds: "Backgrounds",
|
|
2640
|
-
Border: "Border",
|
|
2641
|
-
BorderRadius: "BorderRadius",
|
|
2642
|
-
Checkbox: "Checkbox",
|
|
2643
|
-
Date: "Date",
|
|
2644
|
-
ElementID: "ElementID",
|
|
2645
|
-
Font: "Font",
|
|
2646
|
-
GapX: "GapX",
|
|
2647
|
-
GapY: "GapY",
|
|
2648
|
-
Grid: "Grid",
|
|
2649
|
-
Image: "Image",
|
|
2650
|
-
Images: "Images",
|
|
2651
|
-
Link: "Link",
|
|
2652
|
-
List: "List",
|
|
2653
|
-
Margin: "Margin",
|
|
2654
|
-
NavigationLinks: "NavigationLinks",
|
|
2655
|
-
Number: "Number",
|
|
2656
|
-
Padding: "Padding",
|
|
2657
|
-
ResponsiveColor: "ResponsiveColor",
|
|
2658
|
-
ResponsiveIconRadioGroup: "ResponsiveIconRadioGroup",
|
|
2659
|
-
ResponsiveLength: "ResponsiveLength",
|
|
2660
|
-
ResponsiveNumber: "ResponsiveNumber",
|
|
2661
|
-
ResponsiveOpacity: "ResponsiveOpacity",
|
|
2662
|
-
ResponsiveSelect: "ResponsiveSelect",
|
|
2663
|
-
RichText: "RichText",
|
|
2664
|
-
Shadows: "Shadows",
|
|
2665
|
-
Shape: "Shape",
|
|
2666
|
-
SocialLinks: "SocialLinks",
|
|
2667
|
-
Table: "Table",
|
|
2668
|
-
TableFormFields: "TableFormFields",
|
|
2669
|
-
Typeahead: "Typeahead",
|
|
2670
|
-
TextArea: "TextArea",
|
|
2671
|
-
TextInput: "TextInput",
|
|
2672
|
-
TextStyle: "TextStyle",
|
|
2673
|
-
Video: "Video",
|
|
2674
|
-
Width: "Width",
|
|
2675
|
-
Style: StyleControlType
|
|
2676
|
-
};
|
|
2677
|
-
function Backgrounds(options = {}) {
|
|
2678
|
-
return { type: Types.Backgrounds, options };
|
|
2679
|
-
}
|
|
2680
|
-
const BorderPropControllerFormat = {
|
|
2681
|
-
ClassName: "makeswift::prop-controllers::border::format::class-name",
|
|
2682
|
-
ResponsiveValue: "makeswift::prop-controllers:border::format::responsive-value"
|
|
2683
|
-
};
|
|
2684
|
-
function Border(options = {}) {
|
|
2685
|
-
return { type: Types.Border, options };
|
|
2686
|
-
}
|
|
2687
|
-
Border.Format = BorderPropControllerFormat;
|
|
2688
|
-
const BorderRadiusPropControllerFormat = {
|
|
2689
|
-
ClassName: "makeswift::prop-controllers::border-radius::format::class-name",
|
|
2690
|
-
ResponsiveValue: "makeswift::prop-controllers::border-radius::format::responsive-value"
|
|
2691
|
-
};
|
|
2692
|
-
function BorderRadius(options = {}) {
|
|
2693
|
-
return { type: Types.BorderRadius, options };
|
|
2694
|
-
}
|
|
2695
|
-
BorderRadius.Format = BorderRadiusPropControllerFormat;
|
|
2696
|
-
function Checkbox(options) {
|
|
2697
|
-
return { type: Types.Checkbox, options };
|
|
2698
|
-
}
|
|
2699
|
-
function Date(options = {}) {
|
|
2700
|
-
return { type: Types.Date, options };
|
|
2701
|
-
}
|
|
2702
|
-
function ElementID(options = {}) {
|
|
2703
|
-
return { type: Types.ElementID, options };
|
|
2704
|
-
}
|
|
2705
|
-
function Font(options = {}) {
|
|
2706
|
-
return { type: Types.Font, options };
|
|
2707
|
-
}
|
|
2708
|
-
function GapX(options = {}) {
|
|
2709
|
-
return { type: Types.GapX, options };
|
|
2710
|
-
}
|
|
2711
|
-
function GapY(options = {}) {
|
|
2712
|
-
return { type: Types.GapY, options };
|
|
2713
|
-
}
|
|
2714
|
-
function Grid(options = {}) {
|
|
2715
|
-
return { type: Types.Grid, options };
|
|
2716
|
-
}
|
|
2717
|
-
function Image(options = {}) {
|
|
2718
|
-
return { type: Types.Image, options };
|
|
2719
|
-
}
|
|
2720
|
-
function Images(options = {}) {
|
|
2721
|
-
return { type: Types.Images, options };
|
|
2722
|
-
}
|
|
2723
|
-
function Link(options = {}) {
|
|
2724
|
-
return { type: Types.Link, options };
|
|
2725
|
-
}
|
|
2726
|
-
function List(options) {
|
|
2727
|
-
return { type: Types.List, options };
|
|
2728
|
-
}
|
|
2729
|
-
const MarginPropControllerFormat = {
|
|
2730
|
-
ClassName: "makeswift::prop-controllers::margin::format::class-name",
|
|
2731
|
-
ResponsiveValue: "makeswift::prop-controllers::margin::format::responsive-value"
|
|
2732
|
-
};
|
|
2733
|
-
function Margin(options = {}) {
|
|
2734
|
-
return { type: Types.Margin, options };
|
|
2735
|
-
}
|
|
2736
|
-
Margin.Format = MarginPropControllerFormat;
|
|
2737
|
-
function NavigationLinks(options = {}) {
|
|
2738
|
-
return { type: Types.NavigationLinks, options };
|
|
2739
|
-
}
|
|
2740
|
-
function Number(options = {}) {
|
|
2741
|
-
return { type: Types.Number, options };
|
|
2742
|
-
}
|
|
2743
|
-
const PaddingPropControllerFormat = {
|
|
2744
|
-
ClassName: "makeswift::prop-controllers::padding::format::class-name",
|
|
2745
|
-
ResponsiveValue: "makeswift::prop-controllers::padding::format::responsive-value"
|
|
2746
|
-
};
|
|
2747
|
-
function Padding(options = {}) {
|
|
2748
|
-
return { type: Types.Padding, options };
|
|
2749
|
-
}
|
|
2750
|
-
Padding.Format = PaddingPropControllerFormat;
|
|
2751
|
-
function ResponsiveColor(options = {}) {
|
|
2752
|
-
return { type: Types.ResponsiveColor, options };
|
|
2753
|
-
}
|
|
2754
|
-
function ResponsiveIconRadioGroup(options) {
|
|
2755
|
-
return { type: Types.ResponsiveIconRadioGroup, options };
|
|
2756
|
-
}
|
|
2757
|
-
function ResponsiveLength(options = {}) {
|
|
2758
|
-
return { type: Types.ResponsiveLength, options };
|
|
2759
|
-
}
|
|
2760
|
-
function ResponsiveNumber(options = {}) {
|
|
2761
|
-
return { type: Types.ResponsiveNumber, options };
|
|
2762
|
-
}
|
|
2763
|
-
function ResponsiveOpacity(options = {}) {
|
|
2764
|
-
return { type: Types.ResponsiveOpacity, options };
|
|
2765
|
-
}
|
|
2766
|
-
function ResponsiveSelect(options) {
|
|
2767
|
-
return { type: Types.ResponsiveSelect, options };
|
|
2768
|
-
}
|
|
2769
|
-
function RichText(options = {}) {
|
|
2770
|
-
return { type: Types.RichText, options };
|
|
2771
|
-
}
|
|
2772
|
-
const ShadowsPropControllerFormat = {
|
|
2773
|
-
ClassName: "makeswift::prop-controllers::shadows::format::class-name",
|
|
2774
|
-
ResponsiveValue: "makeswift::prop-controllers::shadows::format::responsive-value"
|
|
2775
|
-
};
|
|
2776
|
-
function Shadows(options = {}) {
|
|
2777
|
-
return { type: Types.Shadows, options };
|
|
2778
|
-
}
|
|
2779
|
-
Shadows.Format = ShadowsPropControllerFormat;
|
|
2780
|
-
function Shape(options) {
|
|
2781
|
-
return { type: Types.Shape, options };
|
|
2782
|
-
}
|
|
2783
|
-
function SocialLinks(options = {}) {
|
|
2784
|
-
return { type: Types.SocialLinks, options };
|
|
2785
|
-
}
|
|
2786
|
-
function Table(options = {}) {
|
|
2787
|
-
return { type: Types.Table, options };
|
|
2788
|
-
}
|
|
2789
|
-
function TableFormFields(options = {}) {
|
|
2790
|
-
return { type: Types.TableFormFields, options };
|
|
2134
|
+
if (selection == null)
|
|
2135
|
+
return void 0;
|
|
2136
|
+
return {
|
|
2137
|
+
isFocused: false,
|
|
2138
|
+
marks: void 0,
|
|
2139
|
+
object: "selection",
|
|
2140
|
+
anchor: {
|
|
2141
|
+
offset: selection.anchor.offset,
|
|
2142
|
+
path: selection.anchor.path,
|
|
2143
|
+
object: "point"
|
|
2144
|
+
},
|
|
2145
|
+
focus: {
|
|
2146
|
+
offset: selection.focus.offset,
|
|
2147
|
+
path: selection.focus.path,
|
|
2148
|
+
object: "point"
|
|
2149
|
+
}
|
|
2150
|
+
};
|
|
2791
2151
|
}
|
|
2792
|
-
function
|
|
2793
|
-
return {
|
|
2152
|
+
function richTextDAOToDTO(children, selection) {
|
|
2153
|
+
return {
|
|
2154
|
+
document: {
|
|
2155
|
+
data: void 0,
|
|
2156
|
+
nodes: children.flatMap(toNodeDTO),
|
|
2157
|
+
object: "document"
|
|
2158
|
+
},
|
|
2159
|
+
object: "value",
|
|
2160
|
+
selection: toSelectionDTO(selection),
|
|
2161
|
+
annotations: void 0,
|
|
2162
|
+
data: void 0
|
|
2163
|
+
};
|
|
2794
2164
|
}
|
|
2795
|
-
|
|
2796
|
-
|
|
2165
|
+
const RichTextControlType = "makeswift::controls::rich-text";
|
|
2166
|
+
function RichText() {
|
|
2167
|
+
return { type: RichTextControlType };
|
|
2797
2168
|
}
|
|
2798
|
-
|
|
2799
|
-
|
|
2169
|
+
const RichTextControlMessageType = {
|
|
2170
|
+
CHANGE_BUILDER_EDIT_MODE: "CHANGE_BUILDER_EDIT_MODE",
|
|
2171
|
+
INITIALIZE_EDITOR: "INITIALIZE_EDITOR",
|
|
2172
|
+
CHANGE_EDITOR_VALUE: "CHANGE_EDITOR_VALUE",
|
|
2173
|
+
FOCUS: "FOCUS",
|
|
2174
|
+
BLUR: "BLUR",
|
|
2175
|
+
UNDO: "UNDO",
|
|
2176
|
+
REDO: "REDO",
|
|
2177
|
+
CHANGE_BOX_MODEL: "CHANGE_BOX_MODEL"
|
|
2178
|
+
};
|
|
2179
|
+
class RichTextControl extends PropController {
|
|
2180
|
+
constructor() {
|
|
2181
|
+
super(...arguments);
|
|
2182
|
+
__publicField(this, "editor", null);
|
|
2183
|
+
__publicField(this, "recv", (message) => {
|
|
2184
|
+
if (!this.editor)
|
|
2185
|
+
return;
|
|
2186
|
+
switch (message.type) {
|
|
2187
|
+
case RichTextControlMessageType.CHANGE_BUILDER_EDIT_MODE: {
|
|
2188
|
+
switch (message.editMode) {
|
|
2189
|
+
case BuilderEditMode.BUILD:
|
|
2190
|
+
case BuilderEditMode.INTERACT:
|
|
2191
|
+
this.editor.deselectAndBlur();
|
|
2192
|
+
}
|
|
2193
|
+
break;
|
|
2194
|
+
}
|
|
2195
|
+
case RichTextControlMessageType.FOCUS: {
|
|
2196
|
+
this.editor.focusAndSelectAll();
|
|
2197
|
+
break;
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
});
|
|
2201
|
+
}
|
|
2202
|
+
setSlateEditor(editor) {
|
|
2203
|
+
this.editor = editor;
|
|
2204
|
+
this.send({
|
|
2205
|
+
type: RichTextControlMessageType.INITIALIZE_EDITOR,
|
|
2206
|
+
value: richTextDAOToDTO(editor.children, editor.selection)
|
|
2207
|
+
});
|
|
2208
|
+
const _onChange = editor.onChange;
|
|
2209
|
+
this.editor.onChange = (options) => {
|
|
2210
|
+
_onChange(options);
|
|
2211
|
+
if ((options == null ? void 0 : options.operation) != null) {
|
|
2212
|
+
this.send({
|
|
2213
|
+
type: RichTextControlMessageType.CHANGE_EDITOR_VALUE,
|
|
2214
|
+
value: richTextDAOToDTO(editor.children, editor.selection)
|
|
2215
|
+
});
|
|
2216
|
+
}
|
|
2217
|
+
};
|
|
2218
|
+
}
|
|
2219
|
+
focus() {
|
|
2220
|
+
this.send({ type: RichTextControlMessageType.FOCUS });
|
|
2221
|
+
}
|
|
2222
|
+
blur() {
|
|
2223
|
+
this.send({ type: RichTextControlMessageType.BLUR });
|
|
2224
|
+
}
|
|
2225
|
+
undo() {
|
|
2226
|
+
this.send({ type: RichTextControlMessageType.UNDO });
|
|
2227
|
+
}
|
|
2228
|
+
redo() {
|
|
2229
|
+
this.send({ type: RichTextControlMessageType.REDO });
|
|
2230
|
+
}
|
|
2231
|
+
changeBoxModel(boxModel) {
|
|
2232
|
+
this.send({ type: RichTextControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
|
|
2233
|
+
}
|
|
2800
2234
|
}
|
|
2801
|
-
|
|
2802
|
-
|
|
2235
|
+
const RichTextV2ControlType = "makeswift::controls::rich-text-v2";
|
|
2236
|
+
const RichTextV2Mode = {
|
|
2237
|
+
Inline: "makeswift::controls::rich-text-v2::mode::inline",
|
|
2238
|
+
Block: "makeswift::controls::rich-text-v2::mode::block"
|
|
2239
|
+
};
|
|
2240
|
+
function createRichTextV2Plugin({
|
|
2241
|
+
control,
|
|
2242
|
+
withPlugin,
|
|
2243
|
+
onKeyDown,
|
|
2244
|
+
renderElement,
|
|
2245
|
+
renderLeaf
|
|
2246
|
+
}) {
|
|
2247
|
+
return { control, withPlugin, onKeyDown, renderElement, renderLeaf };
|
|
2803
2248
|
}
|
|
2804
|
-
function
|
|
2805
|
-
return { type:
|
|
2249
|
+
function unstable_RichTextV2(config = {}) {
|
|
2250
|
+
return { type: RichTextV2ControlType, config };
|
|
2806
2251
|
}
|
|
2807
|
-
const
|
|
2808
|
-
|
|
2809
|
-
|
|
2252
|
+
const RichTextV2ControlMessageType = {
|
|
2253
|
+
RESET_VALUE: "RESET_VALUE",
|
|
2254
|
+
FOCUS: "FOCUS",
|
|
2255
|
+
RUN_PLUGIN_CONTROL_ACTION: "RUN_PLUGIN_CONTROL_ACTION",
|
|
2256
|
+
SET_DEFAULT_VALUE: "SET_DEFAULT_VALUE",
|
|
2257
|
+
SET_PLUGIN_CONTROL_VALUE: "SET_PLUGIN_CONTROL_VALUE",
|
|
2258
|
+
ON_CHANGE: "ON_CHANGE",
|
|
2259
|
+
SELECT: "SELECT",
|
|
2260
|
+
SWITCH_TO_BUILD_MODE: "SWITCH_TO_BUILD_MODE",
|
|
2261
|
+
CHANGE_BOX_MODEL: "CHANGE_BOX_MODEL"
|
|
2810
2262
|
};
|
|
2811
|
-
|
|
2812
|
-
|
|
2263
|
+
class RichTextV2Control extends PropController {
|
|
2264
|
+
constructor(send, descriptor) {
|
|
2265
|
+
super(send);
|
|
2266
|
+
__publicField(this, "editor", null);
|
|
2267
|
+
__publicField(this, "defaultValue", null);
|
|
2268
|
+
__publicField(this, "descriptor");
|
|
2269
|
+
__publicField(this, "recv", (message) => {
|
|
2270
|
+
var _a2, _b, _c;
|
|
2271
|
+
if (!this.editor)
|
|
2272
|
+
return;
|
|
2273
|
+
switch (message.type) {
|
|
2274
|
+
case RichTextV2ControlMessageType.FOCUS: {
|
|
2275
|
+
this.editor.focusAndSelectAll();
|
|
2276
|
+
break;
|
|
2277
|
+
}
|
|
2278
|
+
case RichTextV2ControlMessageType.RESET_VALUE: {
|
|
2279
|
+
if (this.defaultValue) {
|
|
2280
|
+
this.editor.selection = null;
|
|
2281
|
+
this.editor.children = this.defaultValue;
|
|
2282
|
+
this.editor.onChange();
|
|
2283
|
+
}
|
|
2284
|
+
break;
|
|
2285
|
+
}
|
|
2286
|
+
case RichTextV2ControlMessageType.RUN_PLUGIN_CONTROL_ACTION: {
|
|
2287
|
+
(_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);
|
|
2288
|
+
break;
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
});
|
|
2292
|
+
this.descriptor = descriptor;
|
|
2293
|
+
this.send = send;
|
|
2294
|
+
}
|
|
2295
|
+
setEditor(editor) {
|
|
2296
|
+
var _a2, _b, _c;
|
|
2297
|
+
this.editor = editor;
|
|
2298
|
+
this.send({
|
|
2299
|
+
type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
|
|
2300
|
+
value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
|
|
2301
|
+
var _a3;
|
|
2302
|
+
return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
|
|
2303
|
+
})) != null ? _c : []
|
|
2304
|
+
});
|
|
2305
|
+
}
|
|
2306
|
+
setDefaultValue(defaultValue) {
|
|
2307
|
+
this.defaultValue = defaultValue;
|
|
2308
|
+
this.send({ type: RichTextV2ControlMessageType.SET_DEFAULT_VALUE, value: defaultValue });
|
|
2309
|
+
}
|
|
2310
|
+
select() {
|
|
2311
|
+
this.send({ type: RichTextV2ControlMessageType.SELECT });
|
|
2312
|
+
}
|
|
2313
|
+
switchToBuildMode() {
|
|
2314
|
+
this.send({ type: RichTextV2ControlMessageType.SWITCH_TO_BUILD_MODE });
|
|
2315
|
+
}
|
|
2316
|
+
onChange(value) {
|
|
2317
|
+
var _a2, _b, _c;
|
|
2318
|
+
const editor = this.editor;
|
|
2319
|
+
if (editor == null)
|
|
2320
|
+
return;
|
|
2321
|
+
this.send({
|
|
2322
|
+
type: RichTextV2ControlMessageType.ON_CHANGE,
|
|
2323
|
+
value
|
|
2324
|
+
});
|
|
2325
|
+
this.send({
|
|
2326
|
+
type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
|
|
2327
|
+
value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
|
|
2328
|
+
var _a3;
|
|
2329
|
+
return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
|
|
2330
|
+
})) != null ? _c : []
|
|
2331
|
+
});
|
|
2332
|
+
}
|
|
2333
|
+
changeBoxModel(boxModel) {
|
|
2334
|
+
this.send({ type: RichTextV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
|
|
2335
|
+
}
|
|
2813
2336
|
}
|
|
2814
|
-
Width.Format = WidthPropControllerFormat;
|
|
2815
|
-
var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2816
|
-
__proto__: null,
|
|
2817
|
-
Types,
|
|
2818
|
-
Backgrounds,
|
|
2819
|
-
BorderPropControllerFormat,
|
|
2820
|
-
Border,
|
|
2821
|
-
BorderRadiusPropControllerFormat,
|
|
2822
|
-
BorderRadius,
|
|
2823
|
-
Checkbox,
|
|
2824
|
-
Date,
|
|
2825
|
-
ElementID,
|
|
2826
|
-
Font,
|
|
2827
|
-
GapX,
|
|
2828
|
-
GapY,
|
|
2829
|
-
Grid,
|
|
2830
|
-
Image,
|
|
2831
|
-
Images,
|
|
2832
|
-
Link,
|
|
2833
|
-
List,
|
|
2834
|
-
MarginPropControllerFormat,
|
|
2835
|
-
Margin,
|
|
2836
|
-
NavigationLinks,
|
|
2837
|
-
Number,
|
|
2838
|
-
PaddingPropControllerFormat,
|
|
2839
|
-
Padding,
|
|
2840
|
-
ResponsiveColor,
|
|
2841
|
-
ResponsiveIconRadioGroup,
|
|
2842
|
-
ResponsiveLength,
|
|
2843
|
-
ResponsiveNumber,
|
|
2844
|
-
ResponsiveOpacity,
|
|
2845
|
-
ResponsiveSelect,
|
|
2846
|
-
RichText,
|
|
2847
|
-
ShadowsPropControllerFormat,
|
|
2848
|
-
Shadows,
|
|
2849
|
-
Shape,
|
|
2850
|
-
SocialLinks,
|
|
2851
|
-
Table,
|
|
2852
|
-
TableFormFields,
|
|
2853
|
-
Typeahead,
|
|
2854
|
-
TextArea,
|
|
2855
|
-
TextInput,
|
|
2856
|
-
TextStyle,
|
|
2857
|
-
Video,
|
|
2858
|
-
WidthPropControllerFormat,
|
|
2859
|
-
Width
|
|
2860
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
2861
2337
|
function isNonNullable(value) {
|
|
2862
2338
|
return value != null;
|
|
2863
2339
|
}
|
|
@@ -2890,51 +2366,51 @@ function getElementId$1(descriptor, prop) {
|
|
|
2890
2366
|
}
|
|
2891
2367
|
}
|
|
2892
2368
|
function getBackgroundsSwatchIds(value) {
|
|
2893
|
-
var
|
|
2894
|
-
return (
|
|
2895
|
-
var
|
|
2369
|
+
var _a2;
|
|
2370
|
+
return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
|
|
2371
|
+
var _a3;
|
|
2896
2372
|
switch (backgroundItem.type) {
|
|
2897
2373
|
case "color":
|
|
2898
|
-
return ((
|
|
2374
|
+
return ((_a3 = backgroundItem.payload) == null ? void 0 : _a3.swatchId) == null ? [] : [backgroundItem.payload.swatchId];
|
|
2899
2375
|
case "gradient":
|
|
2900
2376
|
return backgroundItem.payload.stops.flatMap((stop) => stop.color == null ? [] : stop.color.swatchId);
|
|
2901
2377
|
default:
|
|
2902
2378
|
return [];
|
|
2903
2379
|
}
|
|
2904
|
-
})) != null ?
|
|
2380
|
+
})) != null ? _a2 : [];
|
|
2905
2381
|
}
|
|
2906
2382
|
function getBorderSwatchIds(value) {
|
|
2907
|
-
var
|
|
2908
|
-
return (
|
|
2909
|
-
var
|
|
2383
|
+
var _a2;
|
|
2384
|
+
return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((borderValue) => {
|
|
2385
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h;
|
|
2910
2386
|
return [
|
|
2911
|
-
(_b = (
|
|
2387
|
+
(_b = (_a3 = borderValue.borderTop) == null ? void 0 : _a3.color) == null ? void 0 : _b.swatchId,
|
|
2912
2388
|
(_d = (_c = borderValue.borderRight) == null ? void 0 : _c.color) == null ? void 0 : _d.swatchId,
|
|
2913
2389
|
(_f = (_e = borderValue.borderBottom) == null ? void 0 : _e.color) == null ? void 0 : _f.swatchId,
|
|
2914
2390
|
(_h = (_g = borderValue.borderLeft) == null ? void 0 : _g.color) == null ? void 0 : _h.swatchId
|
|
2915
2391
|
].filter((swatchId) => swatchId != null);
|
|
2916
|
-
})) != null ?
|
|
2392
|
+
})) != null ? _a2 : [];
|
|
2917
2393
|
}
|
|
2918
2394
|
function getBoxShadowsSwatchIds(value) {
|
|
2919
|
-
var
|
|
2920
|
-
return (
|
|
2921
|
-
var
|
|
2922
|
-
return (
|
|
2923
|
-
}).filter((swatchId) => swatchId != null)) != null ?
|
|
2395
|
+
var _a2;
|
|
2396
|
+
return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).map((item) => {
|
|
2397
|
+
var _a3;
|
|
2398
|
+
return (_a3 = item.payload.color) == null ? void 0 : _a3.swatchId;
|
|
2399
|
+
}).filter((swatchId) => swatchId != null)) != null ? _a2 : [];
|
|
2924
2400
|
}
|
|
2925
2401
|
function getResponsiveColorSwatchIds(value) {
|
|
2926
|
-
var
|
|
2927
|
-
return (
|
|
2402
|
+
var _a2;
|
|
2403
|
+
return (_a2 = value == null ? void 0 : value.map((override) => override.value).map((color) => color.swatchId)) != null ? _a2 : [];
|
|
2928
2404
|
}
|
|
2929
2405
|
function getTypographyStyleSwatchIds(style) {
|
|
2930
|
-
var
|
|
2931
|
-
return (
|
|
2932
|
-
var
|
|
2933
|
-
return (
|
|
2934
|
-
}).filter(isNonNullable)) != null ?
|
|
2406
|
+
var _a2;
|
|
2407
|
+
return (_a2 = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
|
|
2408
|
+
var _a3;
|
|
2409
|
+
return (_a3 = typographyStyle.color) == null ? void 0 : _a3.swatchId;
|
|
2410
|
+
}).filter(isNonNullable)) != null ? _a2 : [];
|
|
2935
2411
|
}
|
|
2936
2412
|
function getElementSwatchIds(descriptor, prop) {
|
|
2937
|
-
var
|
|
2413
|
+
var _a2;
|
|
2938
2414
|
if (prop == null)
|
|
2939
2415
|
return [];
|
|
2940
2416
|
switch (descriptor.type) {
|
|
@@ -2944,17 +2420,17 @@ function getElementSwatchIds(descriptor, prop) {
|
|
|
2944
2420
|
return getBorderSwatchIds(prop);
|
|
2945
2421
|
case Types.NavigationLinks: {
|
|
2946
2422
|
const value = prop;
|
|
2947
|
-
return (
|
|
2948
|
-
var
|
|
2423
|
+
return (_a2 = value == null ? void 0 : value.flatMap((item) => {
|
|
2424
|
+
var _a3, _b, _c, _d;
|
|
2949
2425
|
switch (item.type) {
|
|
2950
2426
|
case "button":
|
|
2951
2427
|
case "dropdown":
|
|
2952
2428
|
return [
|
|
2953
|
-
...(_b = (
|
|
2429
|
+
...(_b = (_a3 = item.payload.color) == null ? void 0 : _a3.map((override) => override.value).map((color) => color.swatchId)) != null ? _b : [],
|
|
2954
2430
|
...(_d = (_c = item.payload.textColor) == null ? void 0 : _c.map((override) => override.value).map((color) => color.swatchId)) != null ? _d : []
|
|
2955
2431
|
];
|
|
2956
2432
|
}
|
|
2957
|
-
})) != null ?
|
|
2433
|
+
})) != null ? _a2 : [];
|
|
2958
2434
|
}
|
|
2959
2435
|
case Types.ResponsiveColor:
|
|
2960
2436
|
return getResponsiveColorSwatchIds(prop);
|
|
@@ -2962,20 +2438,20 @@ function getElementSwatchIds(descriptor, prop) {
|
|
|
2962
2438
|
return getBoxShadowsSwatchIds(prop);
|
|
2963
2439
|
case Types.RichText: {
|
|
2964
2440
|
let getNodeSwatchIds = function(node) {
|
|
2965
|
-
var
|
|
2441
|
+
var _a3, _b, _c, _d;
|
|
2966
2442
|
switch (node.object) {
|
|
2967
2443
|
case "document":
|
|
2968
2444
|
case "block":
|
|
2969
2445
|
case "inline":
|
|
2970
|
-
return (_b = (
|
|
2446
|
+
return (_b = (_a3 = node.nodes) == null ? void 0 : _a3.flatMap(getNodeSwatchIds)) != null ? _b : [];
|
|
2971
2447
|
case "text":
|
|
2972
2448
|
return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkSwatchIds)) != null ? _d : [];
|
|
2973
2449
|
default:
|
|
2974
2450
|
return [];
|
|
2975
2451
|
}
|
|
2976
2452
|
}, getMarkSwatchIds = function(mark) {
|
|
2977
|
-
var
|
|
2978
|
-
return getTypographyStyleSwatchIds((_b = (
|
|
2453
|
+
var _a3, _b;
|
|
2454
|
+
return getTypographyStyleSwatchIds((_b = (_a3 = mark.data) == null ? void 0 : _a3.value) == null ? void 0 : _b.style);
|
|
2979
2455
|
};
|
|
2980
2456
|
const value = prop;
|
|
2981
2457
|
if (value == null || value.document == null)
|
|
@@ -2986,23 +2462,56 @@ function getElementSwatchIds(descriptor, prop) {
|
|
|
2986
2462
|
const value = prop;
|
|
2987
2463
|
return (value == null ? void 0 : value.swatchId) == null ? [] : [value.swatchId];
|
|
2988
2464
|
}
|
|
2465
|
+
case StyleV2ControlType: {
|
|
2466
|
+
const value = prop;
|
|
2467
|
+
return value.flatMap((value2) => getElementSwatchIds(descriptor.config.type, value2.value));
|
|
2468
|
+
}
|
|
2469
|
+
case RichTextV2ControlType: {
|
|
2470
|
+
let getDescendantSwatchIds = function(descendant) {
|
|
2471
|
+
if (Element.isElement(descendant)) {
|
|
2472
|
+
return [
|
|
2473
|
+
...getSlateElementSwatchIds(descendant),
|
|
2474
|
+
...descendant.children.flatMap((d) => getDescendantSwatchIds(d))
|
|
2475
|
+
];
|
|
2476
|
+
}
|
|
2477
|
+
if (Text.isText(descendant)) {
|
|
2478
|
+
return getTextSwatchIds(descendant);
|
|
2479
|
+
}
|
|
2480
|
+
return [];
|
|
2481
|
+
}, getSlateElementSwatchIds = function(descendant) {
|
|
2482
|
+
var _a3;
|
|
2483
|
+
return (_a3 = plugins == null ? void 0 : plugins.flatMap((plugin) => {
|
|
2484
|
+
var _a4;
|
|
2485
|
+
return ((_a4 = plugin.control) == null ? void 0 : _a4.definition) && plugin.control.getElementValue ? getElementSwatchIds(plugin.control.definition, plugin.control.getElementValue(descendant)) : [];
|
|
2486
|
+
})) != null ? _a3 : [];
|
|
2487
|
+
}, getTextSwatchIds = function(text) {
|
|
2488
|
+
var _a3;
|
|
2489
|
+
return (_a3 = plugins == null ? void 0 : plugins.flatMap((plugin) => {
|
|
2490
|
+
var _a4;
|
|
2491
|
+
return ((_a4 = plugin.control) == null ? void 0 : _a4.definition) && plugin.control.getLeafValue ? getElementSwatchIds(plugin.control.definition, plugin.control.getLeafValue(text)) : [];
|
|
2492
|
+
})) != null ? _a3 : [];
|
|
2493
|
+
};
|
|
2494
|
+
const descendants = prop;
|
|
2495
|
+
const plugins = descriptor.config.plugins;
|
|
2496
|
+
return descendants.flatMap((d) => getDescendantSwatchIds(d));
|
|
2497
|
+
}
|
|
2989
2498
|
default:
|
|
2990
2499
|
return [];
|
|
2991
2500
|
}
|
|
2992
2501
|
}
|
|
2993
2502
|
function getBackgroundsFileIds(value) {
|
|
2994
|
-
var
|
|
2995
|
-
return (
|
|
2503
|
+
var _a2;
|
|
2504
|
+
return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
|
|
2996
2505
|
switch (backgroundItem.type) {
|
|
2997
2506
|
case "image":
|
|
2998
2507
|
return [backgroundItem.payload.imageId];
|
|
2999
2508
|
default:
|
|
3000
2509
|
return [];
|
|
3001
2510
|
}
|
|
3002
|
-
})) != null ?
|
|
2511
|
+
})) != null ? _a2 : [];
|
|
3003
2512
|
}
|
|
3004
2513
|
function getFileIds(descriptor, prop) {
|
|
3005
|
-
var
|
|
2514
|
+
var _a2;
|
|
3006
2515
|
if (prop == null)
|
|
3007
2516
|
return [];
|
|
3008
2517
|
switch (descriptor.type) {
|
|
@@ -3014,7 +2523,7 @@ function getFileIds(descriptor, prop) {
|
|
|
3014
2523
|
}
|
|
3015
2524
|
case Types.Images: {
|
|
3016
2525
|
const value = prop;
|
|
3017
|
-
return (
|
|
2526
|
+
return (_a2 = value == null ? void 0 : value.flatMap((item) => item.props.file == null ? [] : [item.props.file])) != null ? _a2 : [];
|
|
3018
2527
|
}
|
|
3019
2528
|
case ImageControlType: {
|
|
3020
2529
|
const value = prop;
|
|
@@ -3030,20 +2539,20 @@ function getTypographyIds(descriptor, prop) {
|
|
|
3030
2539
|
switch (descriptor.type) {
|
|
3031
2540
|
case Types.RichText: {
|
|
3032
2541
|
let getNodeTypographyIds = function(node) {
|
|
3033
|
-
var
|
|
2542
|
+
var _a2, _b, _c, _d;
|
|
3034
2543
|
switch (node.object) {
|
|
3035
2544
|
case "document":
|
|
3036
2545
|
case "block":
|
|
3037
2546
|
case "inline":
|
|
3038
|
-
return (_b = (
|
|
2547
|
+
return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodeTypographyIds)) != null ? _b : [];
|
|
3039
2548
|
case "text":
|
|
3040
2549
|
return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkTypographyIds)) != null ? _d : [];
|
|
3041
2550
|
default:
|
|
3042
2551
|
return [];
|
|
3043
2552
|
}
|
|
3044
2553
|
}, getMarkTypographyIds = function(mark) {
|
|
3045
|
-
var
|
|
3046
|
-
return [(_b = (
|
|
2554
|
+
var _a2, _b;
|
|
2555
|
+
return [(_b = (_a2 = mark.data) == null ? void 0 : _a2.value) == null ? void 0 : _b.id].filter((id) => id != null);
|
|
3047
2556
|
};
|
|
3048
2557
|
const value = prop;
|
|
3049
2558
|
if (value == null || value.document == null)
|
|
@@ -3067,7 +2576,7 @@ function getTableIds(descriptor, prop) {
|
|
|
3067
2576
|
}
|
|
3068
2577
|
}
|
|
3069
2578
|
function getPageIds(descriptor, prop) {
|
|
3070
|
-
var
|
|
2579
|
+
var _a2;
|
|
3071
2580
|
if (prop == null)
|
|
3072
2581
|
return [];
|
|
3073
2582
|
switch (descriptor.type) {
|
|
@@ -3086,8 +2595,8 @@ function getPageIds(descriptor, prop) {
|
|
|
3086
2595
|
const value = prop;
|
|
3087
2596
|
if (value == null)
|
|
3088
2597
|
return [];
|
|
3089
|
-
return (
|
|
3090
|
-
var
|
|
2598
|
+
return (_a2 = value == null ? void 0 : value.flatMap((item) => {
|
|
2599
|
+
var _a3, _b;
|
|
3091
2600
|
switch (item.type) {
|
|
3092
2601
|
case "button": {
|
|
3093
2602
|
if (item.payload.link == null)
|
|
@@ -3100,7 +2609,7 @@ function getPageIds(descriptor, prop) {
|
|
|
3100
2609
|
}
|
|
3101
2610
|
}
|
|
3102
2611
|
case "dropdown": {
|
|
3103
|
-
return (_b = (
|
|
2612
|
+
return (_b = (_a3 = item.payload.links) == null ? void 0 : _a3.flatMap((link) => {
|
|
3104
2613
|
if (link.payload.link == null)
|
|
3105
2614
|
return [];
|
|
3106
2615
|
switch (link.payload.link.type) {
|
|
@@ -3112,25 +2621,25 @@ function getPageIds(descriptor, prop) {
|
|
|
3112
2621
|
})) != null ? _b : [];
|
|
3113
2622
|
}
|
|
3114
2623
|
}
|
|
3115
|
-
})) != null ?
|
|
2624
|
+
})) != null ? _a2 : [];
|
|
3116
2625
|
}
|
|
3117
2626
|
case Types.RichText: {
|
|
3118
2627
|
let getNodePageIds = function(node) {
|
|
3119
|
-
var
|
|
2628
|
+
var _a3, _b;
|
|
3120
2629
|
switch (node.object) {
|
|
3121
2630
|
case "document":
|
|
3122
2631
|
case "block":
|
|
3123
|
-
return (_b = (
|
|
2632
|
+
return (_b = (_a3 = node.nodes) == null ? void 0 : _a3.flatMap(getNodePageIds)) != null ? _b : [];
|
|
3124
2633
|
case "inline":
|
|
3125
2634
|
return getInlinePageIds(node);
|
|
3126
2635
|
default:
|
|
3127
2636
|
return [];
|
|
3128
2637
|
}
|
|
3129
2638
|
}, getInlinePageIds = function(inline) {
|
|
3130
|
-
var
|
|
2639
|
+
var _a3, _b, _c, _d;
|
|
3131
2640
|
switch (inline.type) {
|
|
3132
2641
|
case "link": {
|
|
3133
|
-
const nodePageIds = (_b = (
|
|
2642
|
+
const nodePageIds = (_b = (_a3 = inline.nodes) == null ? void 0 : _a3.flatMap(getNodePageIds)) != null ? _b : [];
|
|
3134
2643
|
const dataPageIds = inline.data ? getLinkDataPageIds(inline.data) : [];
|
|
3135
2644
|
return [...nodePageIds, ...dataPageIds];
|
|
3136
2645
|
}
|
|
@@ -3245,14 +2754,14 @@ function getDocumentKeysSortedByDepth(state) {
|
|
|
3245
2754
|
elements.set(key, getDocumentElements(state, key));
|
|
3246
2755
|
});
|
|
3247
2756
|
keys.sort((a, b) => {
|
|
3248
|
-
var
|
|
3249
|
-
return ((
|
|
2757
|
+
var _a2;
|
|
2758
|
+
return ((_a2 = elements.get(a)) == null ? void 0 : _a2.has(b)) ? -1 : 1;
|
|
3250
2759
|
});
|
|
3251
2760
|
return keys;
|
|
3252
2761
|
}
|
|
3253
2762
|
function getElement(state, documentKey, elementKey) {
|
|
3254
|
-
var
|
|
3255
|
-
return (
|
|
2763
|
+
var _a2;
|
|
2764
|
+
return (_a2 = getDocumentElements(state, documentKey).get(elementKey)) != null ? _a2 : null;
|
|
3256
2765
|
}
|
|
3257
2766
|
function getElementPropControllerDescriptors(state, documentKey, elementKey) {
|
|
3258
2767
|
const element = getElement(state, documentKey, elementKey);
|
|
@@ -3338,5 +2847,5 @@ function configureStore({
|
|
|
3338
2847
|
locales: getInitialState(locales != null ? locales : preloadedState == null ? void 0 : preloadedState.locales)
|
|
3339
2848
|
}), applyMiddleware(thunk));
|
|
3340
2849
|
}
|
|
3341
|
-
export {
|
|
2850
|
+
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$1 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$1 as X, Video as Y, useStyle as Z, getBorderSwatchIds as _, createDocumentReference as a, RichTextControlMessageType as a$, getBoxShadowsSwatchIds as a0, getResponsiveColorSwatchIds as a1, StyleControlProperty as a2, ImageControlValueFormat as a3, isPropControllersHandle as a4, StyleControlType as a5, RichTextV2ControlType as a6, RichTextControlType as a7, SlotControlType as a8, StyleV2ControlType as a9, Image as aA, copyImageData as aB, Link as aC, copyLinkData as aD, List as aE, ListControlMessageType as aF, ListControl as aG, copyListData as aH, Shape as aI, ShapeControlMessageType as aJ, ShapeControl as aK, copyShapeData as aL, Slot as aM, SlotControlMessageType as aN, SlotControl as aO, copySlotData as aP, mergeSlotData as aQ, Style as aR, StyleControlMessageType as aS, StyleControl as aT, copyStyleData as aU, unstable_useStyleV2ClassName as aV, unstable_StyleV2 as aW, StyleV2ControlMessageType as aX, StyleV2Control as aY, ObjectType as aZ, RichText as a_, LinkControlType as aa, ImageControlType as ab, ColorControlType as ac, getComponentPropControllerDescriptors as ad, getPropControllers as ae, BorderPropControllerFormat as af, ShadowsPropControllerFormat as ag, BorderRadiusPropControllerFormat as ah, MarginPropControllerFormat as ai, PaddingPropControllerFormat as aj, WidthPropControllerFormat as ak, configureStore as al, copyElementTree as am, getBreakpoints as an, getDocument as ao, getElementId as ap, getIsPreview as aq, getIsInBuilder as ar, getReactComponent as as, getBuilderEditMode as at, getBackgroundsFileIds as au, getBackgroundsSwatchIds as av, Color as aw, copyColorData as ax, copy as ay, merge as az, isElementReference as b, RichTextControl as b0, richTextDTOtoSelection as b1, richTextDTOtoDAO as b2, toSelectionDTO as b3, richTextDAOToDTO as b4, RichTextV2Mode as b5, createRichTextV2Plugin as b6, unstable_RichTextV2 as b7, RichTextV2ControlMessageType as b8, RichTextV2Control as b9, RootBlockType as ba, BlockType as bb, InlineType as bc, BlockTextAlignment as bd, getInitialState$7 as be, reducer$8 as bf, getDocument$1 as bg, getComponentsMeta as bh, getComponentPropControllerDescriptors$1 as bi, getLocales as bj, BuilderEditMode as bk, getDocumentKeysSortedByDepth as bl, getPropController as bm, getPropControllersHandle as bn, getElement as bo, getElementPropControllerDescriptors as bp, createPropController as bq, reducer$7 as br, reducer$9 as bs, reducer$6 as bt, reducer$5 as bu, reducer$4 as bv, reducer$3 as bw, reducer$2 as bx, reducer$1 as by, getInitialState$2 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$1 as x, ResponsiveColor as y, TextStyle as z };
|
|
3342
2851
|
//# sourceMappingURL=react-page.es.js.map
|