@makeswift/runtime 0.0.0-20230407200421 → 0.0.0-20230410231005
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 +14 -10
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +9 -5
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +40 -36
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +15 -11
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +38 -34
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +13 -9
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +30 -54
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +5 -29
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +11 -35
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +5 -29
- package/dist/Divider.es.js.map +1 -1
- package/dist/Embed.cjs.js +6 -30
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +5 -29
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +76 -72
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +14 -10
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +22 -18
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +15 -11
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +14 -10
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +14 -10
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +41 -37
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +15 -11
- package/dist/Navigation.es.js.map +1 -1
- package/dist/PreviewProvider.cjs.js +12 -8
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +12 -8
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +71 -67
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +15 -11
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/Root.cjs.js +13 -9
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +11 -7
- package/dist/Root.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +16 -12
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +9 -5
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Text.cjs.js +7 -3
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +8 -4
- package/dist/Text.es.js.map +1 -1
- package/dist/Video.cjs.js +6 -30
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +5 -29
- package/dist/Video.es.js.map +1 -1
- package/dist/actions.cjs.js +0 -13
- package/dist/actions.cjs.js.map +1 -1
- package/dist/actions.es.js +1 -12
- package/dist/actions.es.js.map +1 -1
- package/dist/api.cjs.js +1 -1
- package/dist/api.es.js +1 -1
- package/dist/builder.cjs.js +1 -0
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +1 -0
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +14 -10
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +14 -10
- package/dist/components.es.js.map +1 -1
- package/dist/control-serialization.cjs.js +37 -36
- package/dist/control-serialization.cjs.js.map +1 -1
- package/dist/control-serialization.es.js +2 -1
- package/dist/control-serialization.es.js.map +1 -1
- package/dist/controls.cjs.js +22 -22
- package/dist/controls.es.js +2 -1
- package/dist/controls.es.js.map +1 -1
- package/dist/index.cjs.js +548 -1689
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs2.js +23 -21
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs3.js +2 -1
- package/dist/index.cjs3.js.map +1 -1
- package/dist/index.cjs4.js +2 -2
- package/dist/index.cjs4.js.map +1 -1
- package/dist/index.cjs5.js +20 -20
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs6.js +7 -3
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +50 -46
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.es.js +329 -1450
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js +5 -3
- package/dist/index.es2.js.map +1 -1
- package/dist/index.es3.js +2 -1
- package/dist/index.es3.js.map +1 -1
- package/dist/index.es4.js +1 -1
- package/dist/index.es5.js +3 -3
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es6.js +7 -3
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es7.js +16 -12
- package/dist/index.es7.js.map +1 -1
- package/dist/introspection.cjs.js +21 -23
- package/dist/introspection.cjs.js.map +1 -1
- package/dist/introspection.es.js +4 -5
- package/dist/introspection.es.js.map +1 -1
- package/dist/isNonNullable.cjs.js +6 -0
- package/dist/isNonNullable.cjs.js.map +1 -0
- package/dist/isNonNullable.es.js +5 -0
- package/dist/isNonNullable.es.js.map +1 -0
- package/dist/leaf.cjs.js +11 -11
- package/dist/leaf.cjs.js.map +1 -1
- package/dist/leaf.es.js +2 -2
- package/dist/main.cjs.js +2 -0
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +2 -0
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +9 -6
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +10 -6
- package/dist/next.es.js.map +1 -1
- package/dist/prop-controllers.cjs.js +3 -1
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +3 -1
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/react.cjs.js +7 -3
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +7 -3
- package/dist/react.es.js.map +1 -1
- package/dist/responsive-style.cjs.js +917 -0
- package/dist/responsive-style.cjs.js.map +1 -0
- package/dist/responsive-style.es.js +853 -0
- package/dist/responsive-style.es.js.map +1 -0
- package/dist/rich-text.cjs.js +61 -1319
- package/dist/rich-text.cjs.js.map +1 -1
- package/dist/rich-text.es.js +17 -1217
- package/dist/rich-text.es.js.map +1 -1
- package/dist/slate.cjs.js +8 -28
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +8 -28
- package/dist/slate.es.js.map +1 -1
- package/dist/types/src/api/graphql/documents/queries.d.ts +0 -2
- package/dist/types/src/api/graphql/documents/queries.d.ts.map +1 -1
- package/dist/types/src/api/graphql/generated/types.d.ts +0 -70
- package/dist/types/src/api/graphql/generated/types.d.ts.map +1 -1
- package/dist/types/src/api/react.d.ts +0 -3
- package/dist/types/src/api/react.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/types.d.ts +1 -16
- package/dist/types/src/controls/rich-text/types.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/handlers/element-tree.d.ts +12 -0
- package/dist/types/src/next/api-handler/handlers/element-tree.d.ts.map +1 -0
- package/dist/types/src/next/api-handler/handlers/fonts.d.ts +18 -0
- package/dist/types/src/next/api-handler/handlers/fonts.d.ts.map +1 -0
- package/dist/types/src/next/api-handler/handlers/manifest.d.ts +17 -0
- package/dist/types/src/next/api-handler/handlers/manifest.d.ts.map +1 -0
- package/dist/types/src/next/api-handler/handlers/proxy-preview-mode.d.ts +8 -0
- package/dist/types/src/next/api-handler/handlers/proxy-preview-mode.d.ts.map +1 -0
- package/dist/types/src/next/api-handler/handlers/revalidate.d.ts +13 -0
- package/dist/types/src/next/api-handler/handlers/revalidate.d.ts.map +1 -0
- package/dist/types/src/next/api-handler/index.d.ts +19 -0
- package/dist/types/src/next/api-handler/index.d.ts.map +1 -0
- package/dist/types/src/next/client.d.ts +11 -35
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/next/index.d.ts +1 -6
- package/dist/types/src/next/index.d.ts.map +1 -1
- package/dist/types/src/state/actions.d.ts +2 -22
- package/dist/types/src/state/actions.d.ts.map +1 -1
- package/dist/types/src/state/makeswift-api-client.d.ts +4 -9
- package/dist/types/src/state/makeswift-api-client.d.ts.map +1 -1
- package/dist/types/src/state/modules/api-resources.d.ts +4 -4
- package/dist/types/src/state/modules/api-resources.d.ts.map +1 -1
- package/dist/types.cjs.js +1272 -10
- package/dist/types.cjs.js.map +1 -1
- package/dist/types.cjs2.js +14 -0
- package/dist/types.cjs2.js.map +1 -0
- package/dist/types.es.js +1207 -10
- package/dist/types.es.js.map +1 -1
- package/dist/types.es2.js +13 -0
- package/dist/types.es2.js.map +1 -0
- package/package.json +3 -2
- package/dist/types/src/api/introspection.d.ts +0 -11
- package/dist/types/src/api/introspection.d.ts.map +0 -1
- package/dist/types/src/next/api-handler.d.ts +0 -48
- package/dist/types/src/next/api-handler.d.ts.map +0 -1
- package/dist/types/src/next/snapshots.d.ts +0 -152
- package/dist/types/src/next/snapshots.d.ts.map +0 -1
package/dist/rich-text.cjs.js
CHANGED
|
@@ -24,6 +24,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24
24
|
};
|
|
25
25
|
var actions = require("./actions.cjs.js");
|
|
26
26
|
var slate = require("slate");
|
|
27
|
+
var types = require("./types.cjs.js");
|
|
27
28
|
var slateReact = require("slate-react");
|
|
28
29
|
const BuilderEditMode = {
|
|
29
30
|
BUILD: "build",
|
|
@@ -41,515 +42,6 @@ function reducer(state = getInitialState(), action) {
|
|
|
41
42
|
return state;
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
|
-
const ColorControlType = "makeswift::controls::color";
|
|
45
|
-
function Color(config = {}) {
|
|
46
|
-
return { type: ColorControlType, config };
|
|
47
|
-
}
|
|
48
|
-
function copyColorData(value, context) {
|
|
49
|
-
var _a;
|
|
50
|
-
if (value == null)
|
|
51
|
-
return value;
|
|
52
|
-
return __spreadProps(__spreadValues({}, value), {
|
|
53
|
-
swatchId: (_a = context.replacementContext.swatchIds.get(value.swatchId)) != null ? _a : value.swatchId
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
const StyleControlType = "makeswift::controls::style";
|
|
57
|
-
const StyleControlProperty = {
|
|
58
|
-
Width: "makeswift::controls::style::property::width",
|
|
59
|
-
Margin: "makeswift::controls::style::property::margin",
|
|
60
|
-
Padding: "makeswift::controls::style::property::padding",
|
|
61
|
-
Border: "makeswift::controls::style::property::border",
|
|
62
|
-
BorderRadius: "makeswift::controls::style::property::border-radius",
|
|
63
|
-
TextStyle: "makeswift::controls::style::property::text-style"
|
|
64
|
-
};
|
|
65
|
-
const StyleControlDefaultProperties = [
|
|
66
|
-
StyleControlProperty.Width,
|
|
67
|
-
StyleControlProperty.Margin
|
|
68
|
-
];
|
|
69
|
-
const AllStyleControlProperties = [
|
|
70
|
-
StyleControlProperty.Width,
|
|
71
|
-
StyleControlProperty.Margin,
|
|
72
|
-
StyleControlProperty.Padding,
|
|
73
|
-
StyleControlProperty.Border,
|
|
74
|
-
StyleControlProperty.BorderRadius,
|
|
75
|
-
StyleControlProperty.TextStyle
|
|
76
|
-
];
|
|
77
|
-
function Style(params) {
|
|
78
|
-
var _a;
|
|
79
|
-
return {
|
|
80
|
-
type: StyleControlType,
|
|
81
|
-
config: { properties: (_a = params == null ? void 0 : params.properties) != null ? _a : StyleControlDefaultProperties }
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
Style.Default = StyleControlDefaultProperties;
|
|
85
|
-
Style.All = AllStyleControlProperties;
|
|
86
|
-
Style.Width = StyleControlProperty.Width;
|
|
87
|
-
Style.Margin = StyleControlProperty.Margin;
|
|
88
|
-
Style.Padding = StyleControlProperty.Padding;
|
|
89
|
-
Style.Border = StyleControlProperty.Border;
|
|
90
|
-
Style.BorderRadius = StyleControlProperty.BorderRadius;
|
|
91
|
-
Style.TextStyle = StyleControlProperty.TextStyle;
|
|
92
|
-
function copyStyleData(value, context) {
|
|
93
|
-
if (value == null)
|
|
94
|
-
return value;
|
|
95
|
-
function copyResponsiveBorder(responsiveBorder) {
|
|
96
|
-
if (responsiveBorder == null)
|
|
97
|
-
return void 0;
|
|
98
|
-
return responsiveBorder.map((deviceBorder) => __spreadProps(__spreadValues({}, deviceBorder), {
|
|
99
|
-
value: copyBorder(deviceBorder.value)
|
|
100
|
-
}));
|
|
101
|
-
}
|
|
102
|
-
function copyBorder(border) {
|
|
103
|
-
function copyBorderSide(side) {
|
|
104
|
-
if (side == null)
|
|
105
|
-
return null;
|
|
106
|
-
if (side.color == null)
|
|
107
|
-
return side;
|
|
108
|
-
return __spreadProps(__spreadValues({}, side), {
|
|
109
|
-
color: copyColorData(side.color, context)
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
return {
|
|
113
|
-
borderTop: copyBorderSide(border.borderTop),
|
|
114
|
-
borderBottom: copyBorderSide(border.borderBottom),
|
|
115
|
-
borderRight: copyBorderSide(border.borderRight),
|
|
116
|
-
borderLeft: copyBorderSide(border.borderLeft)
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
return __spreadProps(__spreadValues({}, value), { border: copyResponsiveBorder(value.border) });
|
|
120
|
-
}
|
|
121
|
-
if (void 0) {
|
|
122
|
-
const { describe, test, expect } = void 0;
|
|
123
|
-
describe.concurrent("style copy", () => {
|
|
124
|
-
test("colors are replaced", () => {
|
|
125
|
-
const value = {
|
|
126
|
-
width: [
|
|
127
|
-
{
|
|
128
|
-
value: {
|
|
129
|
-
unit: "px",
|
|
130
|
-
value: 100
|
|
131
|
-
},
|
|
132
|
-
deviceId: "desktop"
|
|
133
|
-
}
|
|
134
|
-
],
|
|
135
|
-
border: [
|
|
136
|
-
{
|
|
137
|
-
value: {
|
|
138
|
-
borderTop: {
|
|
139
|
-
color: {
|
|
140
|
-
alpha: 1,
|
|
141
|
-
swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
|
|
142
|
-
},
|
|
143
|
-
style: "solid",
|
|
144
|
-
width: 9
|
|
145
|
-
},
|
|
146
|
-
borderLeft: {
|
|
147
|
-
color: {
|
|
148
|
-
alpha: 1,
|
|
149
|
-
swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
|
|
150
|
-
},
|
|
151
|
-
style: "solid",
|
|
152
|
-
width: 9
|
|
153
|
-
},
|
|
154
|
-
borderRight: {
|
|
155
|
-
color: {
|
|
156
|
-
alpha: 1,
|
|
157
|
-
swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
|
|
158
|
-
},
|
|
159
|
-
style: "solid",
|
|
160
|
-
width: 9
|
|
161
|
-
},
|
|
162
|
-
borderBottom: {
|
|
163
|
-
color: {
|
|
164
|
-
alpha: 1,
|
|
165
|
-
swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
|
|
166
|
-
},
|
|
167
|
-
style: "solid",
|
|
168
|
-
width: 9
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
deviceId: "desktop"
|
|
172
|
-
}
|
|
173
|
-
],
|
|
174
|
-
textStyle: [
|
|
175
|
-
{
|
|
176
|
-
value: {
|
|
177
|
-
fontSize: {
|
|
178
|
-
unit: "px",
|
|
179
|
-
value: 46
|
|
180
|
-
},
|
|
181
|
-
fontStyle: [],
|
|
182
|
-
fontFamily: "Oswald",
|
|
183
|
-
fontWeight: 400,
|
|
184
|
-
letterSpacing: 5.2,
|
|
185
|
-
textTransform: []
|
|
186
|
-
},
|
|
187
|
-
deviceId: "desktop"
|
|
188
|
-
}
|
|
189
|
-
],
|
|
190
|
-
borderRadius: [
|
|
191
|
-
{
|
|
192
|
-
value: {
|
|
193
|
-
borderTopLeftRadius: {
|
|
194
|
-
unit: "px",
|
|
195
|
-
value: 4
|
|
196
|
-
},
|
|
197
|
-
borderTopRightRadius: {
|
|
198
|
-
unit: "px",
|
|
199
|
-
value: 4
|
|
200
|
-
},
|
|
201
|
-
borderBottomLeftRadius: {
|
|
202
|
-
unit: "px",
|
|
203
|
-
value: 4
|
|
204
|
-
},
|
|
205
|
-
borderBottomRightRadius: {
|
|
206
|
-
unit: "px",
|
|
207
|
-
value: 4
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
deviceId: "desktop"
|
|
211
|
-
}
|
|
212
|
-
]
|
|
213
|
-
};
|
|
214
|
-
const expected = JSON.parse(JSON.stringify(value).replaceAll("U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"));
|
|
215
|
-
const replacementContext = {
|
|
216
|
-
elementHtmlIds: /* @__PURE__ */ new Set(),
|
|
217
|
-
elementKeys: /* @__PURE__ */ new Map(),
|
|
218
|
-
swatchIds: /* @__PURE__ */ new Map([
|
|
219
|
-
["U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"]
|
|
220
|
-
]),
|
|
221
|
-
fileIds: /* @__PURE__ */ new Map(),
|
|
222
|
-
typographyIds: /* @__PURE__ */ new Map(),
|
|
223
|
-
tableIds: /* @__PURE__ */ new Map(),
|
|
224
|
-
tableColumnIds: /* @__PURE__ */ new Map(),
|
|
225
|
-
pageIds: /* @__PURE__ */ new Map(),
|
|
226
|
-
globalElementIds: /* @__PURE__ */ new Map(),
|
|
227
|
-
globalElementData: /* @__PURE__ */ new Map()
|
|
228
|
-
};
|
|
229
|
-
const result = copyStyleData(value, {
|
|
230
|
-
replacementContext,
|
|
231
|
-
copyElement: (node) => node
|
|
232
|
-
});
|
|
233
|
-
expect(result).toMatchObject(expected);
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
const Types = {
|
|
238
|
-
Backgrounds: "Backgrounds",
|
|
239
|
-
Border: "Border",
|
|
240
|
-
BorderRadius: "BorderRadius",
|
|
241
|
-
Checkbox: "Checkbox",
|
|
242
|
-
Date: "Date",
|
|
243
|
-
ElementID: "ElementID",
|
|
244
|
-
Font: "Font",
|
|
245
|
-
GapX: "GapX",
|
|
246
|
-
GapY: "GapY",
|
|
247
|
-
Grid: "Grid",
|
|
248
|
-
Image: "Image",
|
|
249
|
-
Images: "Images",
|
|
250
|
-
Link: "Link",
|
|
251
|
-
List: "List",
|
|
252
|
-
Margin: "Margin",
|
|
253
|
-
NavigationLinks: "NavigationLinks",
|
|
254
|
-
Number: "Number",
|
|
255
|
-
Padding: "Padding",
|
|
256
|
-
ResponsiveColor: "ResponsiveColor",
|
|
257
|
-
ResponsiveIconRadioGroup: "ResponsiveIconRadioGroup",
|
|
258
|
-
ResponsiveLength: "ResponsiveLength",
|
|
259
|
-
ResponsiveNumber: "ResponsiveNumber",
|
|
260
|
-
ResponsiveOpacity: "ResponsiveOpacity",
|
|
261
|
-
ResponsiveSelect: "ResponsiveSelect",
|
|
262
|
-
RichText: "RichText",
|
|
263
|
-
Shadows: "Shadows",
|
|
264
|
-
Shape: "Shape",
|
|
265
|
-
SocialLinks: "SocialLinks",
|
|
266
|
-
Table: "Table",
|
|
267
|
-
TableFormFields: "TableFormFields",
|
|
268
|
-
Typeahead: "Typeahead",
|
|
269
|
-
TextArea: "TextArea",
|
|
270
|
-
TextInput: "TextInput",
|
|
271
|
-
TextStyle: "TextStyle",
|
|
272
|
-
Video: "Video",
|
|
273
|
-
Width: "Width",
|
|
274
|
-
Style: StyleControlType
|
|
275
|
-
};
|
|
276
|
-
function Backgrounds(options = {}) {
|
|
277
|
-
return { type: Types.Backgrounds, options };
|
|
278
|
-
}
|
|
279
|
-
const BorderPropControllerFormat = {
|
|
280
|
-
ClassName: "makeswift::prop-controllers::border::format::class-name",
|
|
281
|
-
ResponsiveValue: "makeswift::prop-controllers:border::format::responsive-value"
|
|
282
|
-
};
|
|
283
|
-
function Border(options = {}) {
|
|
284
|
-
return { type: Types.Border, options };
|
|
285
|
-
}
|
|
286
|
-
Border.Format = BorderPropControllerFormat;
|
|
287
|
-
const BorderRadiusPropControllerFormat = {
|
|
288
|
-
ClassName: "makeswift::prop-controllers::border-radius::format::class-name",
|
|
289
|
-
ResponsiveValue: "makeswift::prop-controllers::border-radius::format::responsive-value"
|
|
290
|
-
};
|
|
291
|
-
function BorderRadius(options = {}) {
|
|
292
|
-
return { type: Types.BorderRadius, options };
|
|
293
|
-
}
|
|
294
|
-
BorderRadius.Format = BorderRadiusPropControllerFormat;
|
|
295
|
-
function Checkbox(options) {
|
|
296
|
-
return { type: Types.Checkbox, options };
|
|
297
|
-
}
|
|
298
|
-
function Date(options = {}) {
|
|
299
|
-
return { type: Types.Date, options };
|
|
300
|
-
}
|
|
301
|
-
function ElementID(options = {}) {
|
|
302
|
-
return { type: Types.ElementID, options };
|
|
303
|
-
}
|
|
304
|
-
function Font(options = {}) {
|
|
305
|
-
return { type: Types.Font, options };
|
|
306
|
-
}
|
|
307
|
-
function GapX(options = {}) {
|
|
308
|
-
return { type: Types.GapX, options };
|
|
309
|
-
}
|
|
310
|
-
function GapY(options = {}) {
|
|
311
|
-
return { type: Types.GapY, options };
|
|
312
|
-
}
|
|
313
|
-
function Grid(options = {}) {
|
|
314
|
-
return { type: Types.Grid, options };
|
|
315
|
-
}
|
|
316
|
-
function Image$1(options = {}) {
|
|
317
|
-
return { type: Types.Image, options };
|
|
318
|
-
}
|
|
319
|
-
function Images(options = {}) {
|
|
320
|
-
return { type: Types.Images, options };
|
|
321
|
-
}
|
|
322
|
-
function Link$1(options = {}) {
|
|
323
|
-
return { type: Types.Link, options };
|
|
324
|
-
}
|
|
325
|
-
function List$1(options) {
|
|
326
|
-
return { type: Types.List, options };
|
|
327
|
-
}
|
|
328
|
-
const MarginPropControllerFormat = {
|
|
329
|
-
ClassName: "makeswift::prop-controllers::margin::format::class-name",
|
|
330
|
-
ResponsiveValue: "makeswift::prop-controllers::margin::format::responsive-value"
|
|
331
|
-
};
|
|
332
|
-
function Margin(options = {}) {
|
|
333
|
-
return { type: Types.Margin, options };
|
|
334
|
-
}
|
|
335
|
-
Margin.Format = MarginPropControllerFormat;
|
|
336
|
-
function NavigationLinks(options = {}) {
|
|
337
|
-
return { type: Types.NavigationLinks, options };
|
|
338
|
-
}
|
|
339
|
-
function Number(options = {}) {
|
|
340
|
-
return { type: Types.Number, options };
|
|
341
|
-
}
|
|
342
|
-
const PaddingPropControllerFormat = {
|
|
343
|
-
ClassName: "makeswift::prop-controllers::padding::format::class-name",
|
|
344
|
-
ResponsiveValue: "makeswift::prop-controllers::padding::format::responsive-value"
|
|
345
|
-
};
|
|
346
|
-
function Padding(options = {}) {
|
|
347
|
-
return { type: Types.Padding, options };
|
|
348
|
-
}
|
|
349
|
-
Padding.Format = PaddingPropControllerFormat;
|
|
350
|
-
function ResponsiveColor(options = {}) {
|
|
351
|
-
return { type: Types.ResponsiveColor, options };
|
|
352
|
-
}
|
|
353
|
-
function ResponsiveIconRadioGroup(options) {
|
|
354
|
-
return { type: Types.ResponsiveIconRadioGroup, options };
|
|
355
|
-
}
|
|
356
|
-
function ResponsiveLength(options = {}) {
|
|
357
|
-
return { type: Types.ResponsiveLength, options };
|
|
358
|
-
}
|
|
359
|
-
function ResponsiveNumber(options = {}) {
|
|
360
|
-
return { type: Types.ResponsiveNumber, options };
|
|
361
|
-
}
|
|
362
|
-
function ResponsiveOpacity(options = {}) {
|
|
363
|
-
return { type: Types.ResponsiveOpacity, options };
|
|
364
|
-
}
|
|
365
|
-
function ResponsiveSelect(options) {
|
|
366
|
-
return { type: Types.ResponsiveSelect, options };
|
|
367
|
-
}
|
|
368
|
-
function RichText$1(options = {}) {
|
|
369
|
-
return { type: Types.RichText, options };
|
|
370
|
-
}
|
|
371
|
-
const ShadowsPropControllerFormat = {
|
|
372
|
-
ClassName: "makeswift::prop-controllers::shadows::format::class-name",
|
|
373
|
-
ResponsiveValue: "makeswift::prop-controllers::shadows::format::responsive-value"
|
|
374
|
-
};
|
|
375
|
-
function Shadows(options = {}) {
|
|
376
|
-
return { type: Types.Shadows, options };
|
|
377
|
-
}
|
|
378
|
-
Shadows.Format = ShadowsPropControllerFormat;
|
|
379
|
-
function Shape$1(options) {
|
|
380
|
-
return { type: Types.Shape, options };
|
|
381
|
-
}
|
|
382
|
-
function SocialLinks(options = {}) {
|
|
383
|
-
return { type: Types.SocialLinks, options };
|
|
384
|
-
}
|
|
385
|
-
function Table(options = {}) {
|
|
386
|
-
return { type: Types.Table, options };
|
|
387
|
-
}
|
|
388
|
-
function TableFormFields(options = {}) {
|
|
389
|
-
return { type: Types.TableFormFields, options };
|
|
390
|
-
}
|
|
391
|
-
function Typeahead(options) {
|
|
392
|
-
return { type: Types.Typeahead, options };
|
|
393
|
-
}
|
|
394
|
-
function TextArea(options = {}) {
|
|
395
|
-
return { type: Types.TextArea, options };
|
|
396
|
-
}
|
|
397
|
-
function TextInput(options = {}) {
|
|
398
|
-
return { type: Types.TextInput, options };
|
|
399
|
-
}
|
|
400
|
-
function TextStyle(options = {}) {
|
|
401
|
-
return { type: Types.TextStyle, options };
|
|
402
|
-
}
|
|
403
|
-
function Video(options = {}) {
|
|
404
|
-
return { type: Types.Video, options };
|
|
405
|
-
}
|
|
406
|
-
const WidthPropControllerFormat = {
|
|
407
|
-
ClassName: "makeswift::prop-controllers::width::format::class-name",
|
|
408
|
-
ResponsiveValue: "makeswift::prop-controllers::width::format::responsive-value"
|
|
409
|
-
};
|
|
410
|
-
function Width(options = {}) {
|
|
411
|
-
return { type: Types.Width, options };
|
|
412
|
-
}
|
|
413
|
-
Width.Format = WidthPropControllerFormat;
|
|
414
|
-
var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
415
|
-
__proto__: null,
|
|
416
|
-
Types,
|
|
417
|
-
Backgrounds,
|
|
418
|
-
BorderPropControllerFormat,
|
|
419
|
-
Border,
|
|
420
|
-
BorderRadiusPropControllerFormat,
|
|
421
|
-
BorderRadius,
|
|
422
|
-
Checkbox,
|
|
423
|
-
Date,
|
|
424
|
-
ElementID,
|
|
425
|
-
Font,
|
|
426
|
-
GapX,
|
|
427
|
-
GapY,
|
|
428
|
-
Grid,
|
|
429
|
-
Image: Image$1,
|
|
430
|
-
Images,
|
|
431
|
-
Link: Link$1,
|
|
432
|
-
List: List$1,
|
|
433
|
-
MarginPropControllerFormat,
|
|
434
|
-
Margin,
|
|
435
|
-
NavigationLinks,
|
|
436
|
-
Number,
|
|
437
|
-
PaddingPropControllerFormat,
|
|
438
|
-
Padding,
|
|
439
|
-
ResponsiveColor,
|
|
440
|
-
ResponsiveIconRadioGroup,
|
|
441
|
-
ResponsiveLength,
|
|
442
|
-
ResponsiveNumber,
|
|
443
|
-
ResponsiveOpacity,
|
|
444
|
-
ResponsiveSelect,
|
|
445
|
-
RichText: RichText$1,
|
|
446
|
-
ShadowsPropControllerFormat,
|
|
447
|
-
Shadows,
|
|
448
|
-
Shape: Shape$1,
|
|
449
|
-
SocialLinks,
|
|
450
|
-
Table,
|
|
451
|
-
TableFormFields,
|
|
452
|
-
Typeahead,
|
|
453
|
-
TextArea,
|
|
454
|
-
TextInput,
|
|
455
|
-
TextStyle,
|
|
456
|
-
Video,
|
|
457
|
-
WidthPropControllerFormat,
|
|
458
|
-
Width
|
|
459
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
460
|
-
const ImageControlType = "makeswift::controls::image";
|
|
461
|
-
const ImageControlValueFormat = {
|
|
462
|
-
URL: "makeswift::controls::image::format::url",
|
|
463
|
-
WithDimensions: "makeswift::controls::image::format::with-dimensions"
|
|
464
|
-
};
|
|
465
|
-
function Image(config = {}) {
|
|
466
|
-
return { type: ImageControlType, config };
|
|
467
|
-
}
|
|
468
|
-
Image.Format = ImageControlValueFormat;
|
|
469
|
-
function copyImageData(value, context) {
|
|
470
|
-
var _a;
|
|
471
|
-
if (value == null)
|
|
472
|
-
return value;
|
|
473
|
-
return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
|
|
474
|
-
}
|
|
475
|
-
if (void 0) {
|
|
476
|
-
const { describe, test, expect } = void 0;
|
|
477
|
-
describe.concurrent("image copy", () => {
|
|
478
|
-
test("image is replaced by a one in replacement context", () => {
|
|
479
|
-
const data = "file-id";
|
|
480
|
-
const expected = "testing";
|
|
481
|
-
const replacementContext = {
|
|
482
|
-
elementHtmlIds: /* @__PURE__ */ new Set(),
|
|
483
|
-
elementKeys: /* @__PURE__ */ new Map(),
|
|
484
|
-
swatchIds: /* @__PURE__ */ new Map(),
|
|
485
|
-
fileIds: /* @__PURE__ */ new Map([["file-id", "testing"]]),
|
|
486
|
-
typographyIds: /* @__PURE__ */ new Map(),
|
|
487
|
-
tableIds: /* @__PURE__ */ new Map(),
|
|
488
|
-
tableColumnIds: /* @__PURE__ */ new Map(),
|
|
489
|
-
pageIds: /* @__PURE__ */ new Map(),
|
|
490
|
-
globalElementIds: /* @__PURE__ */ new Map(),
|
|
491
|
-
globalElementData: /* @__PURE__ */ new Map()
|
|
492
|
-
};
|
|
493
|
-
const result = copyImageData(data, {
|
|
494
|
-
replacementContext,
|
|
495
|
-
copyElement: (node) => node
|
|
496
|
-
});
|
|
497
|
-
expect(result).toMatchObject(expected);
|
|
498
|
-
});
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
const LinkControlType = "makeswift::controls::link";
|
|
502
|
-
function Link(config = {}) {
|
|
503
|
-
return { type: LinkControlType, config };
|
|
504
|
-
}
|
|
505
|
-
function copyLinkData(value, context) {
|
|
506
|
-
var _a;
|
|
507
|
-
if (value == null)
|
|
508
|
-
return value;
|
|
509
|
-
if (value.type === "OPEN_PAGE") {
|
|
510
|
-
const pageId = value.payload.pageId;
|
|
511
|
-
if (pageId != null) {
|
|
512
|
-
return __spreadProps(__spreadValues({}, value), {
|
|
513
|
-
payload: __spreadProps(__spreadValues({}, value.payload), {
|
|
514
|
-
pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : pageId
|
|
515
|
-
})
|
|
516
|
-
});
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
return value;
|
|
520
|
-
}
|
|
521
|
-
if (void 0) {
|
|
522
|
-
const { describe, test, expect } = void 0;
|
|
523
|
-
describe.concurrent("link", () => {
|
|
524
|
-
test("page id is replaced by one in replacement context", () => {
|
|
525
|
-
const data = {
|
|
526
|
-
type: "OPEN_PAGE",
|
|
527
|
-
payload: {
|
|
528
|
-
pageId: "UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=",
|
|
529
|
-
openInNewTab: false
|
|
530
|
-
}
|
|
531
|
-
};
|
|
532
|
-
const expected = JSON.parse(JSON.stringify(data).replace("UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=", "testing"));
|
|
533
|
-
const replacementContext = {
|
|
534
|
-
elementHtmlIds: /* @__PURE__ */ new Set(),
|
|
535
|
-
elementKeys: /* @__PURE__ */ new Map(),
|
|
536
|
-
swatchIds: /* @__PURE__ */ new Map(),
|
|
537
|
-
pageIds: /* @__PURE__ */ new Map([["UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=", "testing"]]),
|
|
538
|
-
typographyIds: /* @__PURE__ */ new Map(),
|
|
539
|
-
tableIds: /* @__PURE__ */ new Map(),
|
|
540
|
-
tableColumnIds: /* @__PURE__ */ new Map(),
|
|
541
|
-
fileIds: /* @__PURE__ */ new Map(),
|
|
542
|
-
globalElementIds: /* @__PURE__ */ new Map(),
|
|
543
|
-
globalElementData: /* @__PURE__ */ new Map()
|
|
544
|
-
};
|
|
545
|
-
const result = copyLinkData(data, {
|
|
546
|
-
replacementContext,
|
|
547
|
-
copyElement: (node) => node
|
|
548
|
-
});
|
|
549
|
-
expect(result).toMatchObject(expected);
|
|
550
|
-
});
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
45
|
const RichTextPropControllerMessageType = {
|
|
554
46
|
CHANGE_BUILDER_EDIT_MODE: "CHANGE_BUILDER_EDIT_MODE",
|
|
555
47
|
INITIALIZE_EDITOR: "INITIALIZE_EDITOR",
|
|
@@ -653,9 +145,9 @@ class TableFormFieldsPropController extends PropController {
|
|
|
653
145
|
}
|
|
654
146
|
function createPropController(descriptor, send) {
|
|
655
147
|
switch (descriptor.type) {
|
|
656
|
-
case Types.RichText:
|
|
148
|
+
case types.Types.RichText:
|
|
657
149
|
return new RichTextPropController(send);
|
|
658
|
-
case Types.TableFormFields:
|
|
150
|
+
case types.Types.TableFormFields:
|
|
659
151
|
return new TableFormFieldsPropController(send);
|
|
660
152
|
case SlotControlType:
|
|
661
153
|
return new SlotControl(send);
|
|
@@ -809,7 +301,7 @@ function copySlotData(value, context) {
|
|
|
809
301
|
elements: value.elements.map((element) => context.copyElement(element))
|
|
810
302
|
});
|
|
811
303
|
}
|
|
812
|
-
function copy$
|
|
304
|
+
function copy$5(value, context) {
|
|
813
305
|
if (value == null)
|
|
814
306
|
return value;
|
|
815
307
|
return value.map((override) => __spreadProps(__spreadValues({}, override), {
|
|
@@ -847,266 +339,14 @@ function copy$e(value, context) {
|
|
|
847
339
|
})
|
|
848
340
|
}));
|
|
849
341
|
}
|
|
850
|
-
function copy$
|
|
342
|
+
function copy$4(value, context) {
|
|
851
343
|
if (value == null)
|
|
852
344
|
return void 0;
|
|
853
345
|
return __spreadProps(__spreadValues({}, value), {
|
|
854
346
|
elements: value.elements.map((element) => context.copyElement(element))
|
|
855
347
|
});
|
|
856
348
|
}
|
|
857
|
-
function copy$
|
|
858
|
-
var _a, _b;
|
|
859
|
-
if (value == null)
|
|
860
|
-
return value;
|
|
861
|
-
switch (value.type) {
|
|
862
|
-
case "OPEN_PAGE": {
|
|
863
|
-
const pageId = value.payload.pageId;
|
|
864
|
-
if (pageId == null)
|
|
865
|
-
return value;
|
|
866
|
-
return __spreadProps(__spreadValues({}, value), {
|
|
867
|
-
payload: __spreadProps(__spreadValues({}, value.payload), {
|
|
868
|
-
pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : pageId
|
|
869
|
-
})
|
|
870
|
-
});
|
|
871
|
-
}
|
|
872
|
-
case "SCROLL_TO_ELEMENT": {
|
|
873
|
-
const elementIdConfig = value.payload.elementIdConfig;
|
|
874
|
-
if (elementIdConfig == null)
|
|
875
|
-
return value;
|
|
876
|
-
return __spreadProps(__spreadValues({}, value), {
|
|
877
|
-
payload: __spreadProps(__spreadValues({}, value.payload), {
|
|
878
|
-
elementIdConfig: __spreadProps(__spreadValues({}, elementIdConfig), {
|
|
879
|
-
elementKey: (_b = context.replacementContext.elementKeys.get(elementIdConfig.elementKey)) != null ? _b : elementIdConfig.elementKey
|
|
880
|
-
})
|
|
881
|
-
})
|
|
882
|
-
});
|
|
883
|
-
}
|
|
884
|
-
default:
|
|
885
|
-
return value;
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
function copy$b(value, context) {
|
|
889
|
-
if (value == null)
|
|
890
|
-
return value;
|
|
891
|
-
return value.map(copyNavigationLinksPanelItem);
|
|
892
|
-
function copyNavigationLinksPanelItem(item) {
|
|
893
|
-
switch (item.type) {
|
|
894
|
-
case "button":
|
|
895
|
-
case "dropdown": {
|
|
896
|
-
const { color, link } = item.payload;
|
|
897
|
-
return __spreadProps(__spreadValues({}, item), {
|
|
898
|
-
payload: __spreadProps(__spreadValues({}, item.payload), {
|
|
899
|
-
link: link != null ? copy$c(link, context) : void 0,
|
|
900
|
-
color: color != null ? color.map((override) => {
|
|
901
|
-
var _a;
|
|
902
|
-
return __spreadProps(__spreadValues({}, override), {
|
|
903
|
-
value: __spreadProps(__spreadValues({}, override.value), {
|
|
904
|
-
swatchId: (_a = context.replacementContext.swatchIds.get(override.value.swatchId)) != null ? _a : override.value.swatchId
|
|
905
|
-
})
|
|
906
|
-
});
|
|
907
|
-
}) : void 0
|
|
908
|
-
})
|
|
909
|
-
});
|
|
910
|
-
}
|
|
911
|
-
default:
|
|
912
|
-
return item;
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
if (void 0) {
|
|
917
|
-
const { describe, test, expect } = void 0;
|
|
918
|
-
describe.concurrent("navigation-links copy", () => {
|
|
919
|
-
test("replace page id from replacement context", () => {
|
|
920
|
-
const data = [
|
|
921
|
-
{
|
|
922
|
-
id: "e1cf2d04-012a-4481-832a-7b4dda62195e",
|
|
923
|
-
type: "button",
|
|
924
|
-
payload: {
|
|
925
|
-
link: {
|
|
926
|
-
type: "OPEN_PAGE",
|
|
927
|
-
payload: {
|
|
928
|
-
pageId: "UGFnZTo2OGMzODZhNC1jYzRkLTQzMzUtYWZiMi05MDdhZGRkYzQ3YTM=",
|
|
929
|
-
openInNewTab: true
|
|
930
|
-
}
|
|
931
|
-
},
|
|
932
|
-
label: "Fellow Page"
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
];
|
|
936
|
-
const expected = JSON.parse(JSON.stringify(data).replace("UGFnZTo2OGMzODZhNC1jYzRkLTQzMzUtYWZiMi05MDdhZGRkYzQ3YTM=", "testing"));
|
|
937
|
-
const replacementContext = {
|
|
938
|
-
elementHtmlIds: /* @__PURE__ */ new Set(),
|
|
939
|
-
elementKeys: /* @__PURE__ */ new Map(),
|
|
940
|
-
swatchIds: /* @__PURE__ */ new Map(),
|
|
941
|
-
fileIds: /* @__PURE__ */ new Map(),
|
|
942
|
-
typographyIds: /* @__PURE__ */ new Map(),
|
|
943
|
-
tableIds: /* @__PURE__ */ new Map(),
|
|
944
|
-
tableColumnIds: /* @__PURE__ */ new Map(),
|
|
945
|
-
pageIds: /* @__PURE__ */ new Map([["UGFnZTo2OGMzODZhNC1jYzRkLTQzMzUtYWZiMi05MDdhZGRkYzQ3YTM=", "testing"]]),
|
|
946
|
-
globalElementIds: /* @__PURE__ */ new Map(),
|
|
947
|
-
globalElementData: /* @__PURE__ */ new Map()
|
|
948
|
-
};
|
|
949
|
-
const result = copy$b(data, {
|
|
950
|
-
replacementContext,
|
|
951
|
-
copyElement: (node) => node
|
|
952
|
-
});
|
|
953
|
-
expect(result).toMatchObject(expected);
|
|
954
|
-
});
|
|
955
|
-
});
|
|
956
|
-
}
|
|
957
|
-
function copy$a(value, context) {
|
|
958
|
-
if (value == null)
|
|
959
|
-
return value;
|
|
960
|
-
return value.map((override) => __spreadProps(__spreadValues({}, override), { value: override.value.map(copyShadowItem) }));
|
|
961
|
-
function copyShadowItem(item) {
|
|
962
|
-
var _a;
|
|
963
|
-
const { color } = item.payload;
|
|
964
|
-
if (color == null)
|
|
965
|
-
return item;
|
|
966
|
-
return __spreadProps(__spreadValues({}, item), {
|
|
967
|
-
payload: __spreadProps(__spreadValues({}, item.payload), {
|
|
968
|
-
color: __spreadProps(__spreadValues({}, color), {
|
|
969
|
-
swatchId: (_a = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a : color.swatchId
|
|
970
|
-
})
|
|
971
|
-
})
|
|
972
|
-
});
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
if (void 0) {
|
|
976
|
-
const { describe, test, expect } = void 0;
|
|
977
|
-
describe.concurrent("shadow copy", () => {
|
|
978
|
-
test("replaces the swatch id", () => {
|
|
979
|
-
const data = [
|
|
980
|
-
{
|
|
981
|
-
value: [
|
|
982
|
-
{
|
|
983
|
-
id: "8575efe6-4d04-4361-b593-e559537c4c3c",
|
|
984
|
-
payload: {
|
|
985
|
-
color: {
|
|
986
|
-
alpha: 1,
|
|
987
|
-
swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
|
|
988
|
-
},
|
|
989
|
-
offsetX: -5,
|
|
990
|
-
offsetY: 8.7,
|
|
991
|
-
blurRadius: 17,
|
|
992
|
-
spreadRadius: 16
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
],
|
|
996
|
-
deviceId: "desktop"
|
|
997
|
-
}
|
|
998
|
-
];
|
|
999
|
-
const expected = JSON.parse(JSON.stringify(data).replace("U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg==", "testing"));
|
|
1000
|
-
const replacementContext = {
|
|
1001
|
-
elementHtmlIds: /* @__PURE__ */ new Set(),
|
|
1002
|
-
elementKeys: /* @__PURE__ */ new Map(),
|
|
1003
|
-
swatchIds: /* @__PURE__ */ new Map([
|
|
1004
|
-
["U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg==", "testing"]
|
|
1005
|
-
]),
|
|
1006
|
-
fileIds: /* @__PURE__ */ new Map(),
|
|
1007
|
-
typographyIds: /* @__PURE__ */ new Map(),
|
|
1008
|
-
tableIds: /* @__PURE__ */ new Map(),
|
|
1009
|
-
tableColumnIds: /* @__PURE__ */ new Map(),
|
|
1010
|
-
pageIds: /* @__PURE__ */ new Map(),
|
|
1011
|
-
globalElementIds: /* @__PURE__ */ new Map(),
|
|
1012
|
-
globalElementData: /* @__PURE__ */ new Map()
|
|
1013
|
-
};
|
|
1014
|
-
const result = copy$a(data, {
|
|
1015
|
-
replacementContext,
|
|
1016
|
-
copyElement: (node) => node
|
|
1017
|
-
});
|
|
1018
|
-
expect(result).toMatchObject(expected);
|
|
1019
|
-
});
|
|
1020
|
-
});
|
|
1021
|
-
}
|
|
1022
|
-
function copy$9(value, context) {
|
|
1023
|
-
var _a;
|
|
1024
|
-
if (value == null)
|
|
1025
|
-
return value;
|
|
1026
|
-
return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
|
|
1027
|
-
}
|
|
1028
|
-
if (void 0) {
|
|
1029
|
-
const { describe, test, expect } = void 0;
|
|
1030
|
-
describe.concurrent("image copy", () => {
|
|
1031
|
-
test("image is replaced by a one in replacement context", () => {
|
|
1032
|
-
const data = "file-id";
|
|
1033
|
-
const expected = JSON.parse(JSON.stringify(data).replace("file-id", "testing"));
|
|
1034
|
-
const replacementContext = {
|
|
1035
|
-
elementHtmlIds: /* @__PURE__ */ new Set(),
|
|
1036
|
-
elementKeys: /* @__PURE__ */ new Map(),
|
|
1037
|
-
swatchIds: /* @__PURE__ */ new Map(),
|
|
1038
|
-
fileIds: /* @__PURE__ */ new Map([["file-id", "testing"]]),
|
|
1039
|
-
typographyIds: /* @__PURE__ */ new Map(),
|
|
1040
|
-
tableIds: /* @__PURE__ */ new Map(),
|
|
1041
|
-
tableColumnIds: /* @__PURE__ */ new Map(),
|
|
1042
|
-
pageIds: /* @__PURE__ */ new Map(),
|
|
1043
|
-
globalElementIds: /* @__PURE__ */ new Map(),
|
|
1044
|
-
globalElementData: /* @__PURE__ */ new Map()
|
|
1045
|
-
};
|
|
1046
|
-
const result = copy$9(data, {
|
|
1047
|
-
replacementContext,
|
|
1048
|
-
copyElement: (node) => node
|
|
1049
|
-
});
|
|
1050
|
-
expect(result).toMatchObject(expected);
|
|
1051
|
-
});
|
|
1052
|
-
});
|
|
1053
|
-
}
|
|
1054
|
-
function copy$8(value, context) {
|
|
1055
|
-
if (value == null)
|
|
1056
|
-
return value;
|
|
1057
|
-
return value.map(copyImagesPanelItem);
|
|
1058
|
-
function copyImagesPanelItem(imagesPanelItem) {
|
|
1059
|
-
var _a;
|
|
1060
|
-
const { file } = imagesPanelItem.props;
|
|
1061
|
-
if (file == null)
|
|
1062
|
-
return imagesPanelItem;
|
|
1063
|
-
return __spreadProps(__spreadValues({}, imagesPanelItem), {
|
|
1064
|
-
props: __spreadProps(__spreadValues({}, imagesPanelItem.props), {
|
|
1065
|
-
file: (_a = context.replacementContext.fileIds.get(file)) != null ? _a : file
|
|
1066
|
-
})
|
|
1067
|
-
});
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
if (void 0) {
|
|
1071
|
-
const { describe, test, expect } = void 0;
|
|
1072
|
-
describe.concurrent("images copy", () => {
|
|
1073
|
-
test("images are replaced by ones in replacement context", () => {
|
|
1074
|
-
const data = [
|
|
1075
|
-
{
|
|
1076
|
-
key: "0ae80f8f-9d4a-43bc-ae7c-007164a19d22",
|
|
1077
|
-
props: {
|
|
1078
|
-
file: "RmlsZTo5ZmU3ZGUzMi1jY2E0LTRkMjktOWVlMC1jNTI2NDYxY2I1YjM="
|
|
1079
|
-
}
|
|
1080
|
-
},
|
|
1081
|
-
{
|
|
1082
|
-
key: "161674c3-8710-4fd6-90e6-6096c4e9bb88",
|
|
1083
|
-
props: {
|
|
1084
|
-
file: "RmlsZTo5ZmU3ZGUzMi1jY2E0LTRkMjktOWVlMC1jNTI2NDYxY2I1YjM="
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
];
|
|
1088
|
-
const expected = JSON.parse(JSON.stringify(data).replaceAll("RmlsZTo5ZmU3ZGUzMi1jY2E0LTRkMjktOWVlMC1jNTI2NDYxY2I1YjM=", "testing"));
|
|
1089
|
-
const replacementContext = {
|
|
1090
|
-
elementHtmlIds: /* @__PURE__ */ new Set(),
|
|
1091
|
-
elementKeys: /* @__PURE__ */ new Map(),
|
|
1092
|
-
swatchIds: /* @__PURE__ */ new Map(),
|
|
1093
|
-
fileIds: /* @__PURE__ */ new Map([["RmlsZTo5ZmU3ZGUzMi1jY2E0LTRkMjktOWVlMC1jNTI2NDYxY2I1YjM=", "testing"]]),
|
|
1094
|
-
typographyIds: /* @__PURE__ */ new Map(),
|
|
1095
|
-
tableIds: /* @__PURE__ */ new Map(),
|
|
1096
|
-
tableColumnIds: /* @__PURE__ */ new Map(),
|
|
1097
|
-
pageIds: /* @__PURE__ */ new Map(),
|
|
1098
|
-
globalElementIds: /* @__PURE__ */ new Map(),
|
|
1099
|
-
globalElementData: /* @__PURE__ */ new Map()
|
|
1100
|
-
};
|
|
1101
|
-
const result = copy$8(data, {
|
|
1102
|
-
replacementContext,
|
|
1103
|
-
copyElement: (node) => node
|
|
1104
|
-
});
|
|
1105
|
-
expect(result).toMatchObject(expected);
|
|
1106
|
-
});
|
|
1107
|
-
});
|
|
1108
|
-
}
|
|
1109
|
-
function copy$7(value, context) {
|
|
349
|
+
function copy$3(value, context) {
|
|
1110
350
|
if (value == null)
|
|
1111
351
|
return value;
|
|
1112
352
|
return value.map((override) => __spreadProps(__spreadValues({}, override), { value: copyColorValue(override.value) }));
|
|
@@ -1117,407 +357,6 @@ function copy$7(value, context) {
|
|
|
1117
357
|
});
|
|
1118
358
|
}
|
|
1119
359
|
}
|
|
1120
|
-
function copy$6(value, context) {
|
|
1121
|
-
if (value == null)
|
|
1122
|
-
return value;
|
|
1123
|
-
return __spreadProps(__spreadValues({}, value), { fields: value.fields.map(copyFormFieldsPanelItem) });
|
|
1124
|
-
function copyFormFieldsPanelItem(item) {
|
|
1125
|
-
var _a;
|
|
1126
|
-
return __spreadProps(__spreadValues({}, item), {
|
|
1127
|
-
tableColumnId: (_a = context.replacementContext.tableColumnIds.get(item.tableColumnId)) != null ? _a : item.tableColumnId
|
|
1128
|
-
});
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
if (void 0) {
|
|
1132
|
-
const { describe, test, expect } = void 0;
|
|
1133
|
-
describe.concurrent("table form fields copy", () => {
|
|
1134
|
-
test("replaces the table column id", () => {
|
|
1135
|
-
const data = {
|
|
1136
|
-
grid: [
|
|
1137
|
-
{
|
|
1138
|
-
value: {
|
|
1139
|
-
count: 12,
|
|
1140
|
-
spans: [[12], [12]]
|
|
1141
|
-
},
|
|
1142
|
-
deviceId: "desktop"
|
|
1143
|
-
}
|
|
1144
|
-
],
|
|
1145
|
-
fields: [
|
|
1146
|
-
{
|
|
1147
|
-
id: "8c4b3dcb-d9d2-4199-9a66-c35aa39248f0",
|
|
1148
|
-
label: "hello",
|
|
1149
|
-
required: true,
|
|
1150
|
-
tableColumnId: "U2luZ2xlTGluZVRleHRUYWJsZUNvbHVtbjphMzQ0Yzk3ZC04MTQ0LTRmMzctYjU2My1hODE5OTQ5OGMyYWI="
|
|
1151
|
-
}
|
|
1152
|
-
]
|
|
1153
|
-
};
|
|
1154
|
-
const expected = JSON.parse(JSON.stringify(data).replace("U2luZ2xlTGluZVRleHRUYWJsZUNvbHVtbjphMzQ0Yzk3ZC04MTQ0LTRmMzctYjU2My1hODE5OTQ5OGMyYWI=", "testing"));
|
|
1155
|
-
const replacementContext = {
|
|
1156
|
-
elementHtmlIds: /* @__PURE__ */ new Set(),
|
|
1157
|
-
elementKeys: /* @__PURE__ */ new Map(),
|
|
1158
|
-
swatchIds: /* @__PURE__ */ new Map(),
|
|
1159
|
-
fileIds: /* @__PURE__ */ new Map(),
|
|
1160
|
-
typographyIds: /* @__PURE__ */ new Map(),
|
|
1161
|
-
tableIds: /* @__PURE__ */ new Map(),
|
|
1162
|
-
tableColumnIds: /* @__PURE__ */ new Map([
|
|
1163
|
-
[
|
|
1164
|
-
"U2luZ2xlTGluZVRleHRUYWJsZUNvbHVtbjphMzQ0Yzk3ZC04MTQ0LTRmMzctYjU2My1hODE5OTQ5OGMyYWI=",
|
|
1165
|
-
"testing"
|
|
1166
|
-
]
|
|
1167
|
-
]),
|
|
1168
|
-
pageIds: /* @__PURE__ */ new Map(),
|
|
1169
|
-
globalElementIds: /* @__PURE__ */ new Map(),
|
|
1170
|
-
globalElementData: /* @__PURE__ */ new Map()
|
|
1171
|
-
};
|
|
1172
|
-
const result = copy$6(data, {
|
|
1173
|
-
replacementContext,
|
|
1174
|
-
copyElement: (node) => node
|
|
1175
|
-
});
|
|
1176
|
-
expect(result).toMatchObject(expected);
|
|
1177
|
-
});
|
|
1178
|
-
});
|
|
1179
|
-
}
|
|
1180
|
-
function copy$5(value, context) {
|
|
1181
|
-
var _a;
|
|
1182
|
-
if (value == null)
|
|
1183
|
-
return value;
|
|
1184
|
-
return (_a = context.replacementContext.tableIds.get(value)) != null ? _a : value;
|
|
1185
|
-
}
|
|
1186
|
-
if (void 0) {
|
|
1187
|
-
const { describe, test, expect } = void 0;
|
|
1188
|
-
describe.concurrent("table copy", () => {
|
|
1189
|
-
test("replaces the table id", () => {
|
|
1190
|
-
const data = "VGFibGU6MTM5NDhlYzMtMjgwNS00Nzk0LTliNzctNDJkN2RhNmQxZWEy";
|
|
1191
|
-
const replacementContext = {
|
|
1192
|
-
elementHtmlIds: /* @__PURE__ */ new Set(),
|
|
1193
|
-
elementKeys: /* @__PURE__ */ new Map(),
|
|
1194
|
-
swatchIds: /* @__PURE__ */ new Map(),
|
|
1195
|
-
fileIds: /* @__PURE__ */ new Map(),
|
|
1196
|
-
typographyIds: /* @__PURE__ */ new Map(),
|
|
1197
|
-
tableIds: /* @__PURE__ */ new Map([
|
|
1198
|
-
["VGFibGU6MTM5NDhlYzMtMjgwNS00Nzk0LTliNzctNDJkN2RhNmQxZWEy", "testing"]
|
|
1199
|
-
]),
|
|
1200
|
-
tableColumnIds: /* @__PURE__ */ new Map(),
|
|
1201
|
-
pageIds: /* @__PURE__ */ new Map(),
|
|
1202
|
-
globalElementIds: /* @__PURE__ */ new Map(),
|
|
1203
|
-
globalElementData: /* @__PURE__ */ new Map()
|
|
1204
|
-
};
|
|
1205
|
-
const result = copy$5(data, {
|
|
1206
|
-
replacementContext,
|
|
1207
|
-
copyElement: (node) => node
|
|
1208
|
-
});
|
|
1209
|
-
expect(result).toMatch("testing");
|
|
1210
|
-
});
|
|
1211
|
-
});
|
|
1212
|
-
}
|
|
1213
|
-
function copy$4(value, context) {
|
|
1214
|
-
if (value == null)
|
|
1215
|
-
return value;
|
|
1216
|
-
return value.map((override) => __spreadProps(__spreadValues({}, override), { value: copyBorderValue(override.value) }));
|
|
1217
|
-
function copyBorderValue({ borderTop, borderRight, borderBottom, borderLeft }) {
|
|
1218
|
-
return {
|
|
1219
|
-
borderTop: borderTop && copyBorderSide(borderTop),
|
|
1220
|
-
borderRight: borderRight && copyBorderSide(borderRight),
|
|
1221
|
-
borderBottom: borderBottom && copyBorderSide(borderBottom),
|
|
1222
|
-
borderLeft: borderLeft && copyBorderSide(borderLeft)
|
|
1223
|
-
};
|
|
1224
|
-
}
|
|
1225
|
-
function copyBorderSide(borderSide) {
|
|
1226
|
-
var _a;
|
|
1227
|
-
const { color } = borderSide;
|
|
1228
|
-
if (color == null)
|
|
1229
|
-
return borderSide;
|
|
1230
|
-
return __spreadProps(__spreadValues({}, borderSide), {
|
|
1231
|
-
color: __spreadProps(__spreadValues({}, color), {
|
|
1232
|
-
swatchId: (_a = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a : color.swatchId
|
|
1233
|
-
})
|
|
1234
|
-
});
|
|
1235
|
-
}
|
|
1236
|
-
}
|
|
1237
|
-
if (void 0) {
|
|
1238
|
-
const { describe, test, expect } = void 0;
|
|
1239
|
-
describe.concurrent("border copy", () => {
|
|
1240
|
-
test("replaces the swatch id", () => {
|
|
1241
|
-
const data = [
|
|
1242
|
-
{
|
|
1243
|
-
value: {
|
|
1244
|
-
borderTop: {
|
|
1245
|
-
color: {
|
|
1246
|
-
alpha: 1,
|
|
1247
|
-
swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
|
|
1248
|
-
},
|
|
1249
|
-
style: "solid",
|
|
1250
|
-
width: 5
|
|
1251
|
-
},
|
|
1252
|
-
borderLeft: {
|
|
1253
|
-
color: {
|
|
1254
|
-
alpha: 1,
|
|
1255
|
-
swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
|
|
1256
|
-
},
|
|
1257
|
-
style: "solid",
|
|
1258
|
-
width: 5
|
|
1259
|
-
},
|
|
1260
|
-
borderRight: {
|
|
1261
|
-
color: {
|
|
1262
|
-
alpha: 1,
|
|
1263
|
-
swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
|
|
1264
|
-
},
|
|
1265
|
-
style: "solid",
|
|
1266
|
-
width: 5
|
|
1267
|
-
},
|
|
1268
|
-
borderBottom: {
|
|
1269
|
-
color: {
|
|
1270
|
-
alpha: 1,
|
|
1271
|
-
swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
|
|
1272
|
-
},
|
|
1273
|
-
style: "solid",
|
|
1274
|
-
width: 5
|
|
1275
|
-
}
|
|
1276
|
-
},
|
|
1277
|
-
deviceId: "desktop"
|
|
1278
|
-
}
|
|
1279
|
-
];
|
|
1280
|
-
const expected = [
|
|
1281
|
-
{
|
|
1282
|
-
value: {
|
|
1283
|
-
borderTop: {
|
|
1284
|
-
color: {
|
|
1285
|
-
alpha: 1,
|
|
1286
|
-
swatchId: "testing"
|
|
1287
|
-
},
|
|
1288
|
-
style: "solid",
|
|
1289
|
-
width: 5
|
|
1290
|
-
},
|
|
1291
|
-
borderLeft: {
|
|
1292
|
-
color: {
|
|
1293
|
-
alpha: 1,
|
|
1294
|
-
swatchId: "testing"
|
|
1295
|
-
},
|
|
1296
|
-
style: "solid",
|
|
1297
|
-
width: 5
|
|
1298
|
-
},
|
|
1299
|
-
borderRight: {
|
|
1300
|
-
color: {
|
|
1301
|
-
alpha: 1,
|
|
1302
|
-
swatchId: "testing"
|
|
1303
|
-
},
|
|
1304
|
-
style: "solid",
|
|
1305
|
-
width: 5
|
|
1306
|
-
},
|
|
1307
|
-
borderBottom: {
|
|
1308
|
-
color: {
|
|
1309
|
-
alpha: 1,
|
|
1310
|
-
swatchId: "testing"
|
|
1311
|
-
},
|
|
1312
|
-
style: "solid",
|
|
1313
|
-
width: 5
|
|
1314
|
-
}
|
|
1315
|
-
},
|
|
1316
|
-
deviceId: "desktop"
|
|
1317
|
-
}
|
|
1318
|
-
];
|
|
1319
|
-
const replacementContext = {
|
|
1320
|
-
elementHtmlIds: /* @__PURE__ */ new Set(),
|
|
1321
|
-
elementKeys: /* @__PURE__ */ new Map(),
|
|
1322
|
-
swatchIds: /* @__PURE__ */ new Map([
|
|
1323
|
-
["U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg==", "testing"]
|
|
1324
|
-
]),
|
|
1325
|
-
fileIds: /* @__PURE__ */ new Map(),
|
|
1326
|
-
typographyIds: /* @__PURE__ */ new Map(),
|
|
1327
|
-
tableIds: /* @__PURE__ */ new Map(),
|
|
1328
|
-
tableColumnIds: /* @__PURE__ */ new Map(),
|
|
1329
|
-
pageIds: /* @__PURE__ */ new Map(),
|
|
1330
|
-
globalElementIds: /* @__PURE__ */ new Map(),
|
|
1331
|
-
globalElementData: /* @__PURE__ */ new Map()
|
|
1332
|
-
};
|
|
1333
|
-
const result = copy$4(data, {
|
|
1334
|
-
replacementContext,
|
|
1335
|
-
copyElement: (node) => node
|
|
1336
|
-
});
|
|
1337
|
-
expect(result).toMatchObject(expected);
|
|
1338
|
-
});
|
|
1339
|
-
});
|
|
1340
|
-
}
|
|
1341
|
-
function copy$3(value, context) {
|
|
1342
|
-
if (value == null)
|
|
1343
|
-
return value;
|
|
1344
|
-
return __spreadProps(__spreadValues({}, value), { document: value.document ? copyNode(value.document) : value.document });
|
|
1345
|
-
function copyNode(node) {
|
|
1346
|
-
var _a;
|
|
1347
|
-
switch (node.object) {
|
|
1348
|
-
case "document":
|
|
1349
|
-
case "block":
|
|
1350
|
-
case "inline":
|
|
1351
|
-
return copyInline(node);
|
|
1352
|
-
case "text":
|
|
1353
|
-
return __spreadProps(__spreadValues({}, node), { marks: (_a = node.marks) == null ? void 0 : _a.map(copyMark) });
|
|
1354
|
-
default:
|
|
1355
|
-
return node;
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
function copyInline(inline) {
|
|
1359
|
-
var _a, _b;
|
|
1360
|
-
switch (inline.type) {
|
|
1361
|
-
case "link":
|
|
1362
|
-
return __spreadProps(__spreadValues({}, inline), {
|
|
1363
|
-
nodes: (_a = inline.nodes) == null ? void 0 : _a.map(copyNode),
|
|
1364
|
-
data: inline.data ? copyLinkData2(inline.data) : inline.data
|
|
1365
|
-
});
|
|
1366
|
-
default:
|
|
1367
|
-
return __spreadProps(__spreadValues({}, inline), { nodes: (_b = inline.nodes) == null ? void 0 : _b.map(copyNode) });
|
|
1368
|
-
}
|
|
1369
|
-
}
|
|
1370
|
-
function copyLinkData2(data) {
|
|
1371
|
-
var _a, _b;
|
|
1372
|
-
switch (data.type) {
|
|
1373
|
-
case "OPEN_PAGE": {
|
|
1374
|
-
const pageId = data.payload.pageId;
|
|
1375
|
-
if (pageId == null)
|
|
1376
|
-
return data;
|
|
1377
|
-
return __spreadProps(__spreadValues({}, data), {
|
|
1378
|
-
payload: __spreadProps(__spreadValues({}, data.payload), {
|
|
1379
|
-
pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : data.payload.pageId
|
|
1380
|
-
})
|
|
1381
|
-
});
|
|
1382
|
-
}
|
|
1383
|
-
case "SCROLL_TO_ELEMENT": {
|
|
1384
|
-
const elementIdConfig = data.payload.elementIdConfig;
|
|
1385
|
-
if (elementIdConfig == null)
|
|
1386
|
-
return data;
|
|
1387
|
-
return __spreadProps(__spreadValues({}, data), {
|
|
1388
|
-
payload: __spreadProps(__spreadValues({}, data.payload), {
|
|
1389
|
-
elementIdConfig: __spreadProps(__spreadValues({}, elementIdConfig), {
|
|
1390
|
-
elementKey: (_b = context.replacementContext.elementKeys.get(elementIdConfig.elementKey)) != null ? _b : elementIdConfig.elementKey
|
|
1391
|
-
})
|
|
1392
|
-
})
|
|
1393
|
-
});
|
|
1394
|
-
}
|
|
1395
|
-
default:
|
|
1396
|
-
return data;
|
|
1397
|
-
}
|
|
1398
|
-
}
|
|
1399
|
-
function copyMark(mark) {
|
|
1400
|
-
var _a, _b, _c, _d;
|
|
1401
|
-
switch (mark.type) {
|
|
1402
|
-
case "typography": {
|
|
1403
|
-
const typographyId = (_a = mark.data) == null ? void 0 : _a.value.id;
|
|
1404
|
-
return __spreadProps(__spreadValues({}, mark), {
|
|
1405
|
-
data: __spreadProps(__spreadValues({}, mark.data), {
|
|
1406
|
-
value: __spreadProps(__spreadValues({}, (_b = mark.data) == null ? void 0 : _b.value), {
|
|
1407
|
-
id: (_c = context.replacementContext.typographyIds.get(typographyId)) != null ? _c : typographyId,
|
|
1408
|
-
style: (_d = mark.data) == null ? void 0 : _d.value.style.map((override) => {
|
|
1409
|
-
var _a2, _b2, _c2;
|
|
1410
|
-
return __spreadProps(__spreadValues({}, override), {
|
|
1411
|
-
value: __spreadProps(__spreadValues({}, override.value), {
|
|
1412
|
-
color: override.value.color == null ? override.value.color : __spreadProps(__spreadValues({}, override.value.color), {
|
|
1413
|
-
swatchId: (_c2 = context.replacementContext.swatchIds.get((_a2 = override.value.color) == null ? void 0 : _a2.swatchId)) != null ? _c2 : (_b2 = override.value.color) == null ? void 0 : _b2.swatchId
|
|
1414
|
-
})
|
|
1415
|
-
})
|
|
1416
|
-
});
|
|
1417
|
-
})
|
|
1418
|
-
})
|
|
1419
|
-
})
|
|
1420
|
-
});
|
|
1421
|
-
}
|
|
1422
|
-
default:
|
|
1423
|
-
return mark;
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
if (void 0) {
|
|
1428
|
-
const { describe, test, expect } = void 0;
|
|
1429
|
-
describe.concurrent("rich text copy", () => {
|
|
1430
|
-
test("replaces the swatch id", () => {
|
|
1431
|
-
const data = {
|
|
1432
|
-
object: "value",
|
|
1433
|
-
document: {
|
|
1434
|
-
data: {},
|
|
1435
|
-
nodes: [
|
|
1436
|
-
{
|
|
1437
|
-
data: {},
|
|
1438
|
-
type: "paragraph",
|
|
1439
|
-
nodes: [
|
|
1440
|
-
{
|
|
1441
|
-
text: "Hello world",
|
|
1442
|
-
marks: [
|
|
1443
|
-
{
|
|
1444
|
-
data: {
|
|
1445
|
-
value: {
|
|
1446
|
-
id: "VHlwb2dyYXBoeTo5ODE1NWY0Ni1mNmQzLTQ1M2YtODk5OC02ZWY5NzJhNTBlY2U=",
|
|
1447
|
-
style: [
|
|
1448
|
-
{
|
|
1449
|
-
value: {
|
|
1450
|
-
color: {
|
|
1451
|
-
alpha: 1,
|
|
1452
|
-
swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
|
|
1453
|
-
},
|
|
1454
|
-
fontSize: {
|
|
1455
|
-
unit: "px",
|
|
1456
|
-
value: 23
|
|
1457
|
-
},
|
|
1458
|
-
lineHeight: 2.5,
|
|
1459
|
-
strikethrough: true
|
|
1460
|
-
},
|
|
1461
|
-
deviceId: "desktop"
|
|
1462
|
-
}
|
|
1463
|
-
]
|
|
1464
|
-
}
|
|
1465
|
-
},
|
|
1466
|
-
type: "typography",
|
|
1467
|
-
object: "mark"
|
|
1468
|
-
}
|
|
1469
|
-
],
|
|
1470
|
-
object: "text"
|
|
1471
|
-
}
|
|
1472
|
-
],
|
|
1473
|
-
object: "block"
|
|
1474
|
-
}
|
|
1475
|
-
],
|
|
1476
|
-
object: "document"
|
|
1477
|
-
},
|
|
1478
|
-
selection: {
|
|
1479
|
-
focus: {
|
|
1480
|
-
path: [0, 0],
|
|
1481
|
-
object: "point",
|
|
1482
|
-
offset: 0
|
|
1483
|
-
},
|
|
1484
|
-
anchor: {
|
|
1485
|
-
path: [0, 0],
|
|
1486
|
-
object: "point",
|
|
1487
|
-
offset: 0
|
|
1488
|
-
},
|
|
1489
|
-
object: "selection",
|
|
1490
|
-
isFocused: false
|
|
1491
|
-
}
|
|
1492
|
-
};
|
|
1493
|
-
const expected = JSON.parse(JSON.stringify(data).replace("U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg==", "swatch-testing").replace("VHlwb2dyYXBoeTo5ODE1NWY0Ni1mNmQzLTQ1M2YtODk5OC02ZWY5NzJhNTBlY2U=", "typography-testing"));
|
|
1494
|
-
const replacementContext = {
|
|
1495
|
-
elementHtmlIds: /* @__PURE__ */ new Set(),
|
|
1496
|
-
elementKeys: /* @__PURE__ */ new Map(),
|
|
1497
|
-
swatchIds: /* @__PURE__ */ new Map([
|
|
1498
|
-
["U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg==", "swatch-testing"]
|
|
1499
|
-
]),
|
|
1500
|
-
fileIds: /* @__PURE__ */ new Map(),
|
|
1501
|
-
typographyIds: /* @__PURE__ */ new Map([
|
|
1502
|
-
[
|
|
1503
|
-
"VHlwb2dyYXBoeTo5ODE1NWY0Ni1mNmQzLTQ1M2YtODk5OC02ZWY5NzJhNTBlY2U=",
|
|
1504
|
-
"typography-testing"
|
|
1505
|
-
]
|
|
1506
|
-
]),
|
|
1507
|
-
tableIds: /* @__PURE__ */ new Map(),
|
|
1508
|
-
tableColumnIds: /* @__PURE__ */ new Map(),
|
|
1509
|
-
pageIds: /* @__PURE__ */ new Map(),
|
|
1510
|
-
globalElementIds: /* @__PURE__ */ new Map(),
|
|
1511
|
-
globalElementData: /* @__PURE__ */ new Map()
|
|
1512
|
-
};
|
|
1513
|
-
const result = copy$3(data, {
|
|
1514
|
-
replacementContext,
|
|
1515
|
-
copyElement: (node) => node
|
|
1516
|
-
});
|
|
1517
|
-
expect(result).toMatchObject(expected);
|
|
1518
|
-
});
|
|
1519
|
-
});
|
|
1520
|
-
}
|
|
1521
360
|
function copy$2(value, context) {
|
|
1522
361
|
if (value == null)
|
|
1523
362
|
return value;
|
|
@@ -1529,29 +368,29 @@ function copy$2(value, context) {
|
|
|
1529
368
|
function copy$1(descriptor, value, context) {
|
|
1530
369
|
switch (descriptor.type) {
|
|
1531
370
|
case "Backgrounds":
|
|
1532
|
-
return copy$
|
|
371
|
+
return copy$5(value, context);
|
|
1533
372
|
case "Grid":
|
|
1534
|
-
return copy$
|
|
373
|
+
return copy$4(value, context);
|
|
1535
374
|
case "NavigationLinks":
|
|
1536
|
-
return copy$
|
|
375
|
+
return types.copy$8(value, context);
|
|
1537
376
|
case "Link":
|
|
1538
|
-
return copy$
|
|
377
|
+
return types.copy$7(value, context);
|
|
1539
378
|
case "Shadows":
|
|
1540
|
-
return copy$
|
|
379
|
+
return types.copy$6(value, context);
|
|
1541
380
|
case "Image":
|
|
1542
|
-
return copy$
|
|
381
|
+
return types.copy$5(value, context);
|
|
1543
382
|
case "Images":
|
|
1544
|
-
return copy$
|
|
383
|
+
return types.copy$4(value, context);
|
|
1545
384
|
case "ResponsiveColor":
|
|
1546
|
-
return copy$
|
|
385
|
+
return copy$3(value, context);
|
|
1547
386
|
case "TableFormFields":
|
|
1548
|
-
return copy$
|
|
387
|
+
return types.copy$3(value, context);
|
|
1549
388
|
case "Table":
|
|
1550
|
-
return copy$
|
|
389
|
+
return types.copy$2(value, context);
|
|
1551
390
|
case "Border":
|
|
1552
|
-
return copy$
|
|
391
|
+
return types.copy$1(value, context);
|
|
1553
392
|
case "RichText":
|
|
1554
|
-
return copy
|
|
393
|
+
return types.copy(value, context);
|
|
1555
394
|
case "ElementID":
|
|
1556
395
|
return copy$2(value, context);
|
|
1557
396
|
default:
|
|
@@ -1563,32 +402,32 @@ function copyElementReference(value, context) {
|
|
|
1563
402
|
}
|
|
1564
403
|
function copy(definition, value, context) {
|
|
1565
404
|
switch (definition.type) {
|
|
1566
|
-
case Types.Backgrounds:
|
|
1567
|
-
case Types.Grid:
|
|
1568
|
-
case Types.NavigationLinks:
|
|
1569
|
-
case Types.Link:
|
|
1570
|
-
case Types.Shadows:
|
|
1571
|
-
case Types.Image:
|
|
1572
|
-
case Types.Images:
|
|
1573
|
-
case Types.ResponsiveColor:
|
|
1574
|
-
case Types.TableFormFields:
|
|
1575
|
-
case Types.Table:
|
|
1576
|
-
case Types.Border:
|
|
1577
|
-
case Types.RichText:
|
|
1578
|
-
case Types.ElementID:
|
|
405
|
+
case types.Types.Backgrounds:
|
|
406
|
+
case types.Types.Grid:
|
|
407
|
+
case types.Types.NavigationLinks:
|
|
408
|
+
case types.Types.Link:
|
|
409
|
+
case types.Types.Shadows:
|
|
410
|
+
case types.Types.Image:
|
|
411
|
+
case types.Types.Images:
|
|
412
|
+
case types.Types.ResponsiveColor:
|
|
413
|
+
case types.Types.TableFormFields:
|
|
414
|
+
case types.Types.Table:
|
|
415
|
+
case types.Types.Border:
|
|
416
|
+
case types.Types.RichText:
|
|
417
|
+
case types.Types.ElementID:
|
|
1579
418
|
return copy$1(definition, value, context);
|
|
1580
|
-
case ColorControlType:
|
|
1581
|
-
return copyColorData(value, context);
|
|
1582
|
-
case ImageControlType:
|
|
1583
|
-
return copyImageData(value, context);
|
|
1584
|
-
case LinkControlType:
|
|
1585
|
-
return copyLinkData(value, context);
|
|
419
|
+
case types.ColorControlType:
|
|
420
|
+
return types.copyColorData(value, context);
|
|
421
|
+
case types.ImageControlType:
|
|
422
|
+
return types.copyImageData(value, context);
|
|
423
|
+
case types.LinkControlType:
|
|
424
|
+
return types.copyLinkData(value, context);
|
|
1586
425
|
case ShapeControlType:
|
|
1587
426
|
return copyShapeData(definition, value, context);
|
|
1588
427
|
case ListControlType:
|
|
1589
428
|
return copyListData(definition, value, context);
|
|
1590
|
-
case StyleControlType:
|
|
1591
|
-
return copyStyleData(value, context);
|
|
429
|
+
case types.StyleControlType:
|
|
430
|
+
return types.copyStyleData(value, context);
|
|
1592
431
|
case SlotControlType:
|
|
1593
432
|
return copySlotData(value, context);
|
|
1594
433
|
default:
|
|
@@ -1610,44 +449,6 @@ const ObjectType = {
|
|
|
1610
449
|
Point: "point",
|
|
1611
450
|
Operation: "operation"
|
|
1612
451
|
};
|
|
1613
|
-
const RootBlockType = {
|
|
1614
|
-
Paragraph: "paragraph",
|
|
1615
|
-
Heading1: "heading-one",
|
|
1616
|
-
Heading2: "heading-two",
|
|
1617
|
-
Heading3: "heading-three",
|
|
1618
|
-
Heading4: "heading-four",
|
|
1619
|
-
Heading5: "heading-five",
|
|
1620
|
-
Heading6: "heading-six",
|
|
1621
|
-
BlockQuote: "blockquote",
|
|
1622
|
-
UnorderedList: "unordered-list",
|
|
1623
|
-
OrderedList: "ordered-list"
|
|
1624
|
-
};
|
|
1625
|
-
const BlockType = {
|
|
1626
|
-
Paragraph: "paragraph",
|
|
1627
|
-
Heading1: "heading-one",
|
|
1628
|
-
Heading2: "heading-two",
|
|
1629
|
-
Heading3: "heading-three",
|
|
1630
|
-
Heading4: "heading-four",
|
|
1631
|
-
Heading5: "heading-five",
|
|
1632
|
-
Heading6: "heading-six",
|
|
1633
|
-
BlockQuote: "blockquote",
|
|
1634
|
-
UnorderedList: "unordered-list",
|
|
1635
|
-
OrderedList: "ordered-list",
|
|
1636
|
-
ListItem: "list-item",
|
|
1637
|
-
ListItemChild: "list-item-child"
|
|
1638
|
-
};
|
|
1639
|
-
const InlineType = {
|
|
1640
|
-
Code: "code",
|
|
1641
|
-
SuperScript: "superscript",
|
|
1642
|
-
SubScript: "subscript",
|
|
1643
|
-
Link: "link"
|
|
1644
|
-
};
|
|
1645
|
-
const BlockTextAlignment = {
|
|
1646
|
-
Left: "left",
|
|
1647
|
-
Center: "center",
|
|
1648
|
-
Right: "right",
|
|
1649
|
-
Justify: "justify"
|
|
1650
|
-
};
|
|
1651
452
|
function toTextDAO(node) {
|
|
1652
453
|
var _a, _b, _c, _d;
|
|
1653
454
|
const typographyMark = (_a = node.marks) == null ? void 0 : _a.find((mark) => mark.type === "typography");
|
|
@@ -1661,7 +462,7 @@ function toTextDAO(node) {
|
|
|
1661
462
|
function toInlineDAO(node) {
|
|
1662
463
|
var _a, _b, _c, _d;
|
|
1663
464
|
switch (node.type) {
|
|
1664
|
-
case InlineType.Link:
|
|
465
|
+
case types.InlineType.Link:
|
|
1665
466
|
return [
|
|
1666
467
|
{
|
|
1667
468
|
children: (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(toInlineOrTextDAO)) != null ? _b : [],
|
|
@@ -1669,9 +470,9 @@ function toInlineDAO(node) {
|
|
|
1669
470
|
type: node.type
|
|
1670
471
|
}
|
|
1671
472
|
];
|
|
1672
|
-
case InlineType.Code:
|
|
1673
|
-
case InlineType.SubScript:
|
|
1674
|
-
case InlineType.SuperScript:
|
|
473
|
+
case types.InlineType.Code:
|
|
474
|
+
case types.InlineType.SubScript:
|
|
475
|
+
case types.InlineType.SuperScript:
|
|
1675
476
|
return [
|
|
1676
477
|
{
|
|
1677
478
|
children: (_d = (_c = node.nodes) == null ? void 0 : _c.flatMap(toInlineOrTextDAO)) != null ? _d : [],
|
|
@@ -1748,7 +549,7 @@ function toInlineOrTextDTO(node) {
|
|
|
1748
549
|
];
|
|
1749
550
|
}
|
|
1750
551
|
switch (node.type) {
|
|
1751
|
-
case InlineType.Link:
|
|
552
|
+
case types.InlineType.Link:
|
|
1752
553
|
return [
|
|
1753
554
|
{
|
|
1754
555
|
object: ObjectType.Inline,
|
|
@@ -1757,9 +558,9 @@ function toInlineOrTextDTO(node) {
|
|
|
1757
558
|
data: node.link
|
|
1758
559
|
}
|
|
1759
560
|
];
|
|
1760
|
-
case InlineType.Code:
|
|
1761
|
-
case InlineType.SubScript:
|
|
1762
|
-
case InlineType.SuperScript:
|
|
561
|
+
case types.InlineType.Code:
|
|
562
|
+
case types.InlineType.SubScript:
|
|
563
|
+
case types.InlineType.SuperScript:
|
|
1763
564
|
return [
|
|
1764
565
|
{
|
|
1765
566
|
object: "inline",
|
|
@@ -1775,20 +576,20 @@ function toNodeDTO(node) {
|
|
|
1775
576
|
if (slate.Text.isText(node))
|
|
1776
577
|
return toInlineOrTextDTO(node);
|
|
1777
578
|
switch (node.type) {
|
|
1778
|
-
case InlineType.Link:
|
|
1779
|
-
case InlineType.Code:
|
|
1780
|
-
case InlineType.SubScript:
|
|
1781
|
-
case InlineType.SuperScript:
|
|
579
|
+
case types.InlineType.Link:
|
|
580
|
+
case types.InlineType.Code:
|
|
581
|
+
case types.InlineType.SubScript:
|
|
582
|
+
case types.InlineType.SuperScript:
|
|
1782
583
|
return toInlineOrTextDTO(node);
|
|
1783
|
-
case BlockType.Heading1:
|
|
1784
|
-
case BlockType.Heading2:
|
|
1785
|
-
case BlockType.Heading3:
|
|
1786
|
-
case BlockType.BlockQuote:
|
|
1787
|
-
case BlockType.Paragraph:
|
|
1788
|
-
case BlockType.OrderedList:
|
|
1789
|
-
case BlockType.UnorderedList:
|
|
1790
|
-
case BlockType.ListItem:
|
|
1791
|
-
case BlockType.ListItemChild:
|
|
584
|
+
case types.BlockType.Heading1:
|
|
585
|
+
case types.BlockType.Heading2:
|
|
586
|
+
case types.BlockType.Heading3:
|
|
587
|
+
case types.BlockType.BlockQuote:
|
|
588
|
+
case types.BlockType.Paragraph:
|
|
589
|
+
case types.BlockType.OrderedList:
|
|
590
|
+
case types.BlockType.UnorderedList:
|
|
591
|
+
case types.BlockType.ListItem:
|
|
592
|
+
case types.BlockType.ListItemChild:
|
|
1792
593
|
return [
|
|
1793
594
|
{
|
|
1794
595
|
type: node.type,
|
|
@@ -1910,58 +711,17 @@ class RichTextControl extends PropController {
|
|
|
1910
711
|
this.send({ type: RichTextControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
|
|
1911
712
|
}
|
|
1912
713
|
}
|
|
1913
|
-
exports.Backgrounds = Backgrounds;
|
|
1914
|
-
exports.BlockTextAlignment = BlockTextAlignment;
|
|
1915
|
-
exports.BlockType = BlockType;
|
|
1916
|
-
exports.Border = Border;
|
|
1917
|
-
exports.BorderPropControllerFormat = BorderPropControllerFormat;
|
|
1918
|
-
exports.BorderRadius = BorderRadius;
|
|
1919
|
-
exports.BorderRadiusPropControllerFormat = BorderRadiusPropControllerFormat;
|
|
1920
714
|
exports.BuilderEditMode = BuilderEditMode;
|
|
1921
|
-
exports.Checkbox = Checkbox;
|
|
1922
|
-
exports.Color = Color;
|
|
1923
|
-
exports.ColorControlType = ColorControlType;
|
|
1924
|
-
exports.Date = Date;
|
|
1925
|
-
exports.ElementID = ElementID;
|
|
1926
|
-
exports.Font = Font;
|
|
1927
|
-
exports.GapX = GapX;
|
|
1928
|
-
exports.GapY = GapY;
|
|
1929
|
-
exports.Grid = Grid;
|
|
1930
|
-
exports.Image = Image$1;
|
|
1931
|
-
exports.Image$1 = Image;
|
|
1932
|
-
exports.ImageControlType = ImageControlType;
|
|
1933
|
-
exports.ImageControlValueFormat = ImageControlValueFormat;
|
|
1934
|
-
exports.Images = Images;
|
|
1935
|
-
exports.InlineType = InlineType;
|
|
1936
|
-
exports.Link = Link$1;
|
|
1937
|
-
exports.Link$1 = Link;
|
|
1938
|
-
exports.LinkControlType = LinkControlType;
|
|
1939
715
|
exports.List = List;
|
|
1940
716
|
exports.ListControl = ListControl;
|
|
1941
717
|
exports.ListControlMessageType = ListControlMessageType;
|
|
1942
718
|
exports.ListControlType = ListControlType;
|
|
1943
|
-
exports.Margin = Margin;
|
|
1944
|
-
exports.MarginPropControllerFormat = MarginPropControllerFormat;
|
|
1945
|
-
exports.NavigationLinks = NavigationLinks;
|
|
1946
|
-
exports.Number = Number;
|
|
1947
719
|
exports.ObjectType = ObjectType;
|
|
1948
|
-
exports.
|
|
1949
|
-
exports.PaddingPropControllerFormat = PaddingPropControllerFormat;
|
|
1950
|
-
exports.ResponsiveColor = ResponsiveColor;
|
|
1951
|
-
exports.ResponsiveIconRadioGroup = ResponsiveIconRadioGroup;
|
|
1952
|
-
exports.ResponsiveLength = ResponsiveLength;
|
|
1953
|
-
exports.ResponsiveNumber = ResponsiveNumber;
|
|
1954
|
-
exports.ResponsiveOpacity = ResponsiveOpacity;
|
|
1955
|
-
exports.ResponsiveSelect = ResponsiveSelect;
|
|
1956
|
-
exports.RichText = RichText$1;
|
|
1957
|
-
exports.RichText$1 = RichText;
|
|
720
|
+
exports.RichText = RichText;
|
|
1958
721
|
exports.RichTextControl = RichTextControl;
|
|
1959
722
|
exports.RichTextControlMessageType = RichTextControlMessageType;
|
|
1960
723
|
exports.RichTextControlType = RichTextControlType;
|
|
1961
724
|
exports.RichTextPropControllerMessageType = RichTextPropControllerMessageType;
|
|
1962
|
-
exports.RootBlockType = RootBlockType;
|
|
1963
|
-
exports.Shadows = Shadows;
|
|
1964
|
-
exports.ShadowsPropControllerFormat = ShadowsPropControllerFormat;
|
|
1965
725
|
exports.Shape = Shape;
|
|
1966
726
|
exports.ShapeControl = ShapeControl;
|
|
1967
727
|
exports.ShapeControlMessageType = ShapeControlMessageType;
|
|
@@ -1970,31 +730,13 @@ exports.Slot = Slot;
|
|
|
1970
730
|
exports.SlotControl = SlotControl;
|
|
1971
731
|
exports.SlotControlMessageType = SlotControlMessageType;
|
|
1972
732
|
exports.SlotControlType = SlotControlType;
|
|
1973
|
-
exports.SocialLinks = SocialLinks;
|
|
1974
|
-
exports.Style = Style;
|
|
1975
|
-
exports.StyleControlProperty = StyleControlProperty;
|
|
1976
|
-
exports.StyleControlType = StyleControlType;
|
|
1977
|
-
exports.Table = Table;
|
|
1978
|
-
exports.TableFormFields = TableFormFields;
|
|
1979
733
|
exports.TableFormFieldsMessageType = TableFormFieldsMessageType;
|
|
1980
|
-
exports.TextArea = TextArea;
|
|
1981
|
-
exports.TextInput = TextInput;
|
|
1982
|
-
exports.TextStyle = TextStyle;
|
|
1983
|
-
exports.Types = Types;
|
|
1984
|
-
exports.Video = Video;
|
|
1985
|
-
exports.Width = Width;
|
|
1986
|
-
exports.WidthPropControllerFormat = WidthPropControllerFormat;
|
|
1987
734
|
exports.copy = copy;
|
|
1988
|
-
exports.copyColorData = copyColorData;
|
|
1989
735
|
exports.copyElementReference = copyElementReference;
|
|
1990
|
-
exports.copyImageData = copyImageData;
|
|
1991
|
-
exports.copyLinkData = copyLinkData;
|
|
1992
736
|
exports.copyListData = copyListData;
|
|
1993
737
|
exports.copyShapeData = copyShapeData;
|
|
1994
738
|
exports.copySlotData = copySlotData;
|
|
1995
|
-
exports.copyStyleData = copyStyleData;
|
|
1996
739
|
exports.createPropController = createPropController;
|
|
1997
|
-
exports.descriptors = descriptors;
|
|
1998
740
|
exports.reducer = reducer;
|
|
1999
741
|
exports.richTextDAOToDTO = richTextDAOToDTO;
|
|
2000
742
|
exports.richTextDTOtoDAO = richTextDTOtoDAO;
|