@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.
Files changed (196) hide show
  1. package/dist/Box.cjs.js +14 -10
  2. package/dist/Box.cjs.js.map +1 -1
  3. package/dist/Box.es.js +9 -5
  4. package/dist/Box.es.js.map +1 -1
  5. package/dist/Button.cjs.js +40 -36
  6. package/dist/Button.cjs.js.map +1 -1
  7. package/dist/Button.es.js +15 -11
  8. package/dist/Button.es.js.map +1 -1
  9. package/dist/Carousel.cjs.js +38 -34
  10. package/dist/Carousel.cjs.js.map +1 -1
  11. package/dist/Carousel.es.js +13 -9
  12. package/dist/Carousel.es.js.map +1 -1
  13. package/dist/Countdown.cjs.js +30 -54
  14. package/dist/Countdown.cjs.js.map +1 -1
  15. package/dist/Countdown.es.js +5 -29
  16. package/dist/Countdown.es.js.map +1 -1
  17. package/dist/Divider.cjs.js +11 -35
  18. package/dist/Divider.cjs.js.map +1 -1
  19. package/dist/Divider.es.js +5 -29
  20. package/dist/Divider.es.js.map +1 -1
  21. package/dist/Embed.cjs.js +6 -30
  22. package/dist/Embed.cjs.js.map +1 -1
  23. package/dist/Embed.es.js +5 -29
  24. package/dist/Embed.es.js.map +1 -1
  25. package/dist/Form.cjs.js +76 -72
  26. package/dist/Form.cjs.js.map +1 -1
  27. package/dist/Form.es.js +14 -10
  28. package/dist/Form.es.js.map +1 -1
  29. package/dist/Image.cjs.js +22 -18
  30. package/dist/Image.cjs.js.map +1 -1
  31. package/dist/Image.es.js +15 -11
  32. package/dist/Image.es.js.map +1 -1
  33. package/dist/LiveProvider.cjs.js +14 -10
  34. package/dist/LiveProvider.cjs.js.map +1 -1
  35. package/dist/LiveProvider.es.js +14 -10
  36. package/dist/LiveProvider.es.js.map +1 -1
  37. package/dist/Navigation.cjs.js +41 -37
  38. package/dist/Navigation.cjs.js.map +1 -1
  39. package/dist/Navigation.es.js +15 -11
  40. package/dist/Navigation.es.js.map +1 -1
  41. package/dist/PreviewProvider.cjs.js +12 -8
  42. package/dist/PreviewProvider.cjs.js.map +1 -1
  43. package/dist/PreviewProvider.es.js +12 -8
  44. package/dist/PreviewProvider.es.js.map +1 -1
  45. package/dist/ReadOnlyText.cjs.js +71 -67
  46. package/dist/ReadOnlyText.cjs.js.map +1 -1
  47. package/dist/ReadOnlyText.es.js +15 -11
  48. package/dist/ReadOnlyText.es.js.map +1 -1
  49. package/dist/Root.cjs.js +13 -9
  50. package/dist/Root.cjs.js.map +1 -1
  51. package/dist/Root.es.js +11 -7
  52. package/dist/Root.es.js.map +1 -1
  53. package/dist/SocialLinks.cjs.js +16 -12
  54. package/dist/SocialLinks.cjs.js.map +1 -1
  55. package/dist/SocialLinks.es.js +9 -5
  56. package/dist/SocialLinks.es.js.map +1 -1
  57. package/dist/Text.cjs.js +7 -3
  58. package/dist/Text.cjs.js.map +1 -1
  59. package/dist/Text.es.js +8 -4
  60. package/dist/Text.es.js.map +1 -1
  61. package/dist/Video.cjs.js +6 -30
  62. package/dist/Video.cjs.js.map +1 -1
  63. package/dist/Video.es.js +5 -29
  64. package/dist/Video.es.js.map +1 -1
  65. package/dist/actions.cjs.js +0 -13
  66. package/dist/actions.cjs.js.map +1 -1
  67. package/dist/actions.es.js +1 -12
  68. package/dist/actions.es.js.map +1 -1
  69. package/dist/api.cjs.js +1 -1
  70. package/dist/api.es.js +1 -1
  71. package/dist/builder.cjs.js +1 -0
  72. package/dist/builder.cjs.js.map +1 -1
  73. package/dist/builder.es.js +1 -0
  74. package/dist/builder.es.js.map +1 -1
  75. package/dist/components.cjs.js +14 -10
  76. package/dist/components.cjs.js.map +1 -1
  77. package/dist/components.es.js +14 -10
  78. package/dist/components.es.js.map +1 -1
  79. package/dist/control-serialization.cjs.js +37 -36
  80. package/dist/control-serialization.cjs.js.map +1 -1
  81. package/dist/control-serialization.es.js +2 -1
  82. package/dist/control-serialization.es.js.map +1 -1
  83. package/dist/controls.cjs.js +22 -22
  84. package/dist/controls.es.js +2 -1
  85. package/dist/controls.es.js.map +1 -1
  86. package/dist/index.cjs.js +548 -1689
  87. package/dist/index.cjs.js.map +1 -1
  88. package/dist/index.cjs2.js +23 -21
  89. package/dist/index.cjs2.js.map +1 -1
  90. package/dist/index.cjs3.js +2 -1
  91. package/dist/index.cjs3.js.map +1 -1
  92. package/dist/index.cjs4.js +2 -2
  93. package/dist/index.cjs4.js.map +1 -1
  94. package/dist/index.cjs5.js +20 -20
  95. package/dist/index.cjs5.js.map +1 -1
  96. package/dist/index.cjs6.js +7 -3
  97. package/dist/index.cjs6.js.map +1 -1
  98. package/dist/index.cjs7.js +50 -46
  99. package/dist/index.cjs7.js.map +1 -1
  100. package/dist/index.es.js +329 -1450
  101. package/dist/index.es.js.map +1 -1
  102. package/dist/index.es2.js +5 -3
  103. package/dist/index.es2.js.map +1 -1
  104. package/dist/index.es3.js +2 -1
  105. package/dist/index.es3.js.map +1 -1
  106. package/dist/index.es4.js +1 -1
  107. package/dist/index.es5.js +3 -3
  108. package/dist/index.es5.js.map +1 -1
  109. package/dist/index.es6.js +7 -3
  110. package/dist/index.es6.js.map +1 -1
  111. package/dist/index.es7.js +16 -12
  112. package/dist/index.es7.js.map +1 -1
  113. package/dist/introspection.cjs.js +21 -23
  114. package/dist/introspection.cjs.js.map +1 -1
  115. package/dist/introspection.es.js +4 -5
  116. package/dist/introspection.es.js.map +1 -1
  117. package/dist/isNonNullable.cjs.js +6 -0
  118. package/dist/isNonNullable.cjs.js.map +1 -0
  119. package/dist/isNonNullable.es.js +5 -0
  120. package/dist/isNonNullable.es.js.map +1 -0
  121. package/dist/leaf.cjs.js +11 -11
  122. package/dist/leaf.cjs.js.map +1 -1
  123. package/dist/leaf.es.js +2 -2
  124. package/dist/main.cjs.js +2 -0
  125. package/dist/main.cjs.js.map +1 -1
  126. package/dist/main.es.js +2 -0
  127. package/dist/main.es.js.map +1 -1
  128. package/dist/next.cjs.js +9 -6
  129. package/dist/next.cjs.js.map +1 -1
  130. package/dist/next.es.js +10 -6
  131. package/dist/next.es.js.map +1 -1
  132. package/dist/prop-controllers.cjs.js +3 -1
  133. package/dist/prop-controllers.cjs.js.map +1 -1
  134. package/dist/prop-controllers.es.js +3 -1
  135. package/dist/prop-controllers.es.js.map +1 -1
  136. package/dist/react.cjs.js +7 -3
  137. package/dist/react.cjs.js.map +1 -1
  138. package/dist/react.es.js +7 -3
  139. package/dist/react.es.js.map +1 -1
  140. package/dist/responsive-style.cjs.js +917 -0
  141. package/dist/responsive-style.cjs.js.map +1 -0
  142. package/dist/responsive-style.es.js +853 -0
  143. package/dist/responsive-style.es.js.map +1 -0
  144. package/dist/rich-text.cjs.js +61 -1319
  145. package/dist/rich-text.cjs.js.map +1 -1
  146. package/dist/rich-text.es.js +17 -1217
  147. package/dist/rich-text.es.js.map +1 -1
  148. package/dist/slate.cjs.js +8 -28
  149. package/dist/slate.cjs.js.map +1 -1
  150. package/dist/slate.es.js +8 -28
  151. package/dist/slate.es.js.map +1 -1
  152. package/dist/types/src/api/graphql/documents/queries.d.ts +0 -2
  153. package/dist/types/src/api/graphql/documents/queries.d.ts.map +1 -1
  154. package/dist/types/src/api/graphql/generated/types.d.ts +0 -70
  155. package/dist/types/src/api/graphql/generated/types.d.ts.map +1 -1
  156. package/dist/types/src/api/react.d.ts +0 -3
  157. package/dist/types/src/api/react.d.ts.map +1 -1
  158. package/dist/types/src/controls/rich-text/types.d.ts +1 -16
  159. package/dist/types/src/controls/rich-text/types.d.ts.map +1 -1
  160. package/dist/types/src/next/api-handler/handlers/element-tree.d.ts +12 -0
  161. package/dist/types/src/next/api-handler/handlers/element-tree.d.ts.map +1 -0
  162. package/dist/types/src/next/api-handler/handlers/fonts.d.ts +18 -0
  163. package/dist/types/src/next/api-handler/handlers/fonts.d.ts.map +1 -0
  164. package/dist/types/src/next/api-handler/handlers/manifest.d.ts +17 -0
  165. package/dist/types/src/next/api-handler/handlers/manifest.d.ts.map +1 -0
  166. package/dist/types/src/next/api-handler/handlers/proxy-preview-mode.d.ts +8 -0
  167. package/dist/types/src/next/api-handler/handlers/proxy-preview-mode.d.ts.map +1 -0
  168. package/dist/types/src/next/api-handler/handlers/revalidate.d.ts +13 -0
  169. package/dist/types/src/next/api-handler/handlers/revalidate.d.ts.map +1 -0
  170. package/dist/types/src/next/api-handler/index.d.ts +19 -0
  171. package/dist/types/src/next/api-handler/index.d.ts.map +1 -0
  172. package/dist/types/src/next/client.d.ts +11 -35
  173. package/dist/types/src/next/client.d.ts.map +1 -1
  174. package/dist/types/src/next/index.d.ts +1 -6
  175. package/dist/types/src/next/index.d.ts.map +1 -1
  176. package/dist/types/src/state/actions.d.ts +2 -22
  177. package/dist/types/src/state/actions.d.ts.map +1 -1
  178. package/dist/types/src/state/makeswift-api-client.d.ts +4 -9
  179. package/dist/types/src/state/makeswift-api-client.d.ts.map +1 -1
  180. package/dist/types/src/state/modules/api-resources.d.ts +4 -4
  181. package/dist/types/src/state/modules/api-resources.d.ts.map +1 -1
  182. package/dist/types.cjs.js +1272 -10
  183. package/dist/types.cjs.js.map +1 -1
  184. package/dist/types.cjs2.js +14 -0
  185. package/dist/types.cjs2.js.map +1 -0
  186. package/dist/types.es.js +1207 -10
  187. package/dist/types.es.js.map +1 -1
  188. package/dist/types.es2.js +13 -0
  189. package/dist/types.es2.js.map +1 -0
  190. package/package.json +3 -2
  191. package/dist/types/src/api/introspection.d.ts +0 -11
  192. package/dist/types/src/api/introspection.d.ts.map +0 -1
  193. package/dist/types/src/next/api-handler.d.ts +0 -48
  194. package/dist/types/src/next/api-handler.d.ts.map +0 -1
  195. package/dist/types/src/next/snapshots.d.ts +0 -152
  196. package/dist/types/src/next/snapshots.d.ts.map +0 -1
package/dist/types.es.js CHANGED
@@ -1,13 +1,1210 @@
1
- const APIResourceType = {
2
- Swatch: "Swatch",
3
- File: "File",
4
- Typography: "Typography",
5
- PagePathnameSlice: "PagePathnameSlice",
6
- GlobalElement: "GlobalElement",
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ const import_meta = {};
21
+ const ColorControlType = "makeswift::controls::color";
22
+ function Color(config = {}) {
23
+ return { type: ColorControlType, config };
24
+ }
25
+ function copyColorData(value, context) {
26
+ var _a;
27
+ if (value == null)
28
+ return value;
29
+ return __spreadProps(__spreadValues({}, value), {
30
+ swatchId: (_a = context.replacementContext.swatchIds.get(value.swatchId)) != null ? _a : value.swatchId
31
+ });
32
+ }
33
+ const StyleControlType = "makeswift::controls::style";
34
+ const StyleControlProperty = {
35
+ Width: "makeswift::controls::style::property::width",
36
+ Margin: "makeswift::controls::style::property::margin",
37
+ Padding: "makeswift::controls::style::property::padding",
38
+ Border: "makeswift::controls::style::property::border",
39
+ BorderRadius: "makeswift::controls::style::property::border-radius",
40
+ TextStyle: "makeswift::controls::style::property::text-style"
41
+ };
42
+ const StyleControlDefaultProperties = [
43
+ StyleControlProperty.Width,
44
+ StyleControlProperty.Margin
45
+ ];
46
+ const AllStyleControlProperties = [
47
+ StyleControlProperty.Width,
48
+ StyleControlProperty.Margin,
49
+ StyleControlProperty.Padding,
50
+ StyleControlProperty.Border,
51
+ StyleControlProperty.BorderRadius,
52
+ StyleControlProperty.TextStyle
53
+ ];
54
+ function Style(params) {
55
+ var _a;
56
+ return {
57
+ type: StyleControlType,
58
+ config: { properties: (_a = params == null ? void 0 : params.properties) != null ? _a : StyleControlDefaultProperties }
59
+ };
60
+ }
61
+ Style.Default = StyleControlDefaultProperties;
62
+ Style.All = AllStyleControlProperties;
63
+ Style.Width = StyleControlProperty.Width;
64
+ Style.Margin = StyleControlProperty.Margin;
65
+ Style.Padding = StyleControlProperty.Padding;
66
+ Style.Border = StyleControlProperty.Border;
67
+ Style.BorderRadius = StyleControlProperty.BorderRadius;
68
+ Style.TextStyle = StyleControlProperty.TextStyle;
69
+ function copyStyleData(value, context) {
70
+ if (value == null)
71
+ return value;
72
+ function copyResponsiveBorder(responsiveBorder) {
73
+ if (responsiveBorder == null)
74
+ return void 0;
75
+ return responsiveBorder.map((deviceBorder) => __spreadProps(__spreadValues({}, deviceBorder), {
76
+ value: copyBorder(deviceBorder.value)
77
+ }));
78
+ }
79
+ function copyBorder(border) {
80
+ function copyBorderSide(side) {
81
+ if (side == null)
82
+ return null;
83
+ if (side.color == null)
84
+ return side;
85
+ return __spreadProps(__spreadValues({}, side), {
86
+ color: copyColorData(side.color, context)
87
+ });
88
+ }
89
+ return {
90
+ borderTop: copyBorderSide(border.borderTop),
91
+ borderBottom: copyBorderSide(border.borderBottom),
92
+ borderRight: copyBorderSide(border.borderRight),
93
+ borderLeft: copyBorderSide(border.borderLeft)
94
+ };
95
+ }
96
+ return __spreadProps(__spreadValues({}, value), { border: copyResponsiveBorder(value.border) });
97
+ }
98
+ if (import_meta.vitest) {
99
+ const { describe, test, expect } = import_meta.vitest;
100
+ describe.concurrent("style copy", () => {
101
+ test("colors are replaced", () => {
102
+ const value = {
103
+ width: [
104
+ {
105
+ value: {
106
+ unit: "px",
107
+ value: 100
108
+ },
109
+ deviceId: "desktop"
110
+ }
111
+ ],
112
+ border: [
113
+ {
114
+ value: {
115
+ borderTop: {
116
+ color: {
117
+ alpha: 1,
118
+ swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
119
+ },
120
+ style: "solid",
121
+ width: 9
122
+ },
123
+ borderLeft: {
124
+ color: {
125
+ alpha: 1,
126
+ swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
127
+ },
128
+ style: "solid",
129
+ width: 9
130
+ },
131
+ borderRight: {
132
+ color: {
133
+ alpha: 1,
134
+ swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
135
+ },
136
+ style: "solid",
137
+ width: 9
138
+ },
139
+ borderBottom: {
140
+ color: {
141
+ alpha: 1,
142
+ swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
143
+ },
144
+ style: "solid",
145
+ width: 9
146
+ }
147
+ },
148
+ deviceId: "desktop"
149
+ }
150
+ ],
151
+ textStyle: [
152
+ {
153
+ value: {
154
+ fontSize: {
155
+ unit: "px",
156
+ value: 46
157
+ },
158
+ fontStyle: [],
159
+ fontFamily: "Oswald",
160
+ fontWeight: 400,
161
+ letterSpacing: 5.2,
162
+ textTransform: []
163
+ },
164
+ deviceId: "desktop"
165
+ }
166
+ ],
167
+ borderRadius: [
168
+ {
169
+ value: {
170
+ borderTopLeftRadius: {
171
+ unit: "px",
172
+ value: 4
173
+ },
174
+ borderTopRightRadius: {
175
+ unit: "px",
176
+ value: 4
177
+ },
178
+ borderBottomLeftRadius: {
179
+ unit: "px",
180
+ value: 4
181
+ },
182
+ borderBottomRightRadius: {
183
+ unit: "px",
184
+ value: 4
185
+ }
186
+ },
187
+ deviceId: "desktop"
188
+ }
189
+ ]
190
+ };
191
+ const expected = JSON.parse(JSON.stringify(value).replaceAll("U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"));
192
+ const replacementContext = {
193
+ elementHtmlIds: /* @__PURE__ */ new Set(),
194
+ elementKeys: /* @__PURE__ */ new Map(),
195
+ swatchIds: /* @__PURE__ */ new Map([
196
+ ["U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"]
197
+ ]),
198
+ fileIds: /* @__PURE__ */ new Map(),
199
+ typographyIds: /* @__PURE__ */ new Map(),
200
+ tableIds: /* @__PURE__ */ new Map(),
201
+ tableColumnIds: /* @__PURE__ */ new Map(),
202
+ pageIds: /* @__PURE__ */ new Map(),
203
+ globalElementIds: /* @__PURE__ */ new Map(),
204
+ globalElementData: /* @__PURE__ */ new Map()
205
+ };
206
+ const result = copyStyleData(value, {
207
+ replacementContext,
208
+ copyElement: (node) => node
209
+ });
210
+ expect(result).toMatchObject(expected);
211
+ });
212
+ });
213
+ }
214
+ const Types = {
215
+ Backgrounds: "Backgrounds",
216
+ Border: "Border",
217
+ BorderRadius: "BorderRadius",
218
+ Checkbox: "Checkbox",
219
+ Date: "Date",
220
+ ElementID: "ElementID",
221
+ Font: "Font",
222
+ GapX: "GapX",
223
+ GapY: "GapY",
224
+ Grid: "Grid",
225
+ Image: "Image",
226
+ Images: "Images",
227
+ Link: "Link",
228
+ List: "List",
229
+ Margin: "Margin",
230
+ NavigationLinks: "NavigationLinks",
231
+ Number: "Number",
232
+ Padding: "Padding",
233
+ ResponsiveColor: "ResponsiveColor",
234
+ ResponsiveIconRadioGroup: "ResponsiveIconRadioGroup",
235
+ ResponsiveLength: "ResponsiveLength",
236
+ ResponsiveNumber: "ResponsiveNumber",
237
+ ResponsiveOpacity: "ResponsiveOpacity",
238
+ ResponsiveSelect: "ResponsiveSelect",
239
+ RichText: "RichText",
240
+ Shadows: "Shadows",
241
+ Shape: "Shape",
242
+ SocialLinks: "SocialLinks",
7
243
  Table: "Table",
8
- Snippet: "Snippet",
9
- Page: "Page",
10
- Site: "Site"
244
+ TableFormFields: "TableFormFields",
245
+ Typeahead: "Typeahead",
246
+ TextArea: "TextArea",
247
+ TextInput: "TextInput",
248
+ TextStyle: "TextStyle",
249
+ Video: "Video",
250
+ Width: "Width",
251
+ Style: StyleControlType
252
+ };
253
+ function Backgrounds(options = {}) {
254
+ return { type: Types.Backgrounds, options };
255
+ }
256
+ const BorderPropControllerFormat = {
257
+ ClassName: "makeswift::prop-controllers::border::format::class-name",
258
+ ResponsiveValue: "makeswift::prop-controllers:border::format::responsive-value"
259
+ };
260
+ function Border(options = {}) {
261
+ return { type: Types.Border, options };
262
+ }
263
+ Border.Format = BorderPropControllerFormat;
264
+ const BorderRadiusPropControllerFormat = {
265
+ ClassName: "makeswift::prop-controllers::border-radius::format::class-name",
266
+ ResponsiveValue: "makeswift::prop-controllers::border-radius::format::responsive-value"
267
+ };
268
+ function BorderRadius(options = {}) {
269
+ return { type: Types.BorderRadius, options };
270
+ }
271
+ BorderRadius.Format = BorderRadiusPropControllerFormat;
272
+ function Checkbox(options) {
273
+ return { type: Types.Checkbox, options };
274
+ }
275
+ function Date(options = {}) {
276
+ return { type: Types.Date, options };
277
+ }
278
+ function ElementID(options = {}) {
279
+ return { type: Types.ElementID, options };
280
+ }
281
+ function Font(options = {}) {
282
+ return { type: Types.Font, options };
283
+ }
284
+ function GapX(options = {}) {
285
+ return { type: Types.GapX, options };
286
+ }
287
+ function GapY(options = {}) {
288
+ return { type: Types.GapY, options };
289
+ }
290
+ function Grid(options = {}) {
291
+ return { type: Types.Grid, options };
292
+ }
293
+ function Image$1(options = {}) {
294
+ return { type: Types.Image, options };
295
+ }
296
+ function Images(options = {}) {
297
+ return { type: Types.Images, options };
298
+ }
299
+ function Link$1(options = {}) {
300
+ return { type: Types.Link, options };
301
+ }
302
+ function List(options) {
303
+ return { type: Types.List, options };
304
+ }
305
+ const MarginPropControllerFormat = {
306
+ ClassName: "makeswift::prop-controllers::margin::format::class-name",
307
+ ResponsiveValue: "makeswift::prop-controllers::margin::format::responsive-value"
308
+ };
309
+ function Margin(options = {}) {
310
+ return { type: Types.Margin, options };
311
+ }
312
+ Margin.Format = MarginPropControllerFormat;
313
+ function NavigationLinks(options = {}) {
314
+ return { type: Types.NavigationLinks, options };
315
+ }
316
+ function Number(options = {}) {
317
+ return { type: Types.Number, options };
318
+ }
319
+ const PaddingPropControllerFormat = {
320
+ ClassName: "makeswift::prop-controllers::padding::format::class-name",
321
+ ResponsiveValue: "makeswift::prop-controllers::padding::format::responsive-value"
322
+ };
323
+ function Padding(options = {}) {
324
+ return { type: Types.Padding, options };
325
+ }
326
+ Padding.Format = PaddingPropControllerFormat;
327
+ function ResponsiveColor(options = {}) {
328
+ return { type: Types.ResponsiveColor, options };
329
+ }
330
+ function ResponsiveIconRadioGroup(options) {
331
+ return { type: Types.ResponsiveIconRadioGroup, options };
332
+ }
333
+ function ResponsiveLength(options = {}) {
334
+ return { type: Types.ResponsiveLength, options };
335
+ }
336
+ function ResponsiveNumber(options = {}) {
337
+ return { type: Types.ResponsiveNumber, options };
338
+ }
339
+ function ResponsiveOpacity(options = {}) {
340
+ return { type: Types.ResponsiveOpacity, options };
341
+ }
342
+ function ResponsiveSelect(options) {
343
+ return { type: Types.ResponsiveSelect, options };
344
+ }
345
+ function RichText(options = {}) {
346
+ return { type: Types.RichText, options };
347
+ }
348
+ const ShadowsPropControllerFormat = {
349
+ ClassName: "makeswift::prop-controllers::shadows::format::class-name",
350
+ ResponsiveValue: "makeswift::prop-controllers::shadows::format::responsive-value"
351
+ };
352
+ function Shadows(options = {}) {
353
+ return { type: Types.Shadows, options };
354
+ }
355
+ Shadows.Format = ShadowsPropControllerFormat;
356
+ function Shape(options) {
357
+ return { type: Types.Shape, options };
358
+ }
359
+ function SocialLinks(options = {}) {
360
+ return { type: Types.SocialLinks, options };
361
+ }
362
+ function Table(options = {}) {
363
+ return { type: Types.Table, options };
364
+ }
365
+ function TableFormFields(options = {}) {
366
+ return { type: Types.TableFormFields, options };
367
+ }
368
+ function Typeahead(options) {
369
+ return { type: Types.Typeahead, options };
370
+ }
371
+ function TextArea(options = {}) {
372
+ return { type: Types.TextArea, options };
373
+ }
374
+ function TextInput(options = {}) {
375
+ return { type: Types.TextInput, options };
376
+ }
377
+ function TextStyle(options = {}) {
378
+ return { type: Types.TextStyle, options };
379
+ }
380
+ function Video(options = {}) {
381
+ return { type: Types.Video, options };
382
+ }
383
+ const WidthPropControllerFormat = {
384
+ ClassName: "makeswift::prop-controllers::width::format::class-name",
385
+ ResponsiveValue: "makeswift::prop-controllers::width::format::responsive-value"
386
+ };
387
+ function Width(options = {}) {
388
+ return { type: Types.Width, options };
389
+ }
390
+ Width.Format = WidthPropControllerFormat;
391
+ var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
392
+ __proto__: null,
393
+ Types,
394
+ Backgrounds,
395
+ BorderPropControllerFormat,
396
+ Border,
397
+ BorderRadiusPropControllerFormat,
398
+ BorderRadius,
399
+ Checkbox,
400
+ Date,
401
+ ElementID,
402
+ Font,
403
+ GapX,
404
+ GapY,
405
+ Grid,
406
+ Image: Image$1,
407
+ Images,
408
+ Link: Link$1,
409
+ List,
410
+ MarginPropControllerFormat,
411
+ Margin,
412
+ NavigationLinks,
413
+ Number,
414
+ PaddingPropControllerFormat,
415
+ Padding,
416
+ ResponsiveColor,
417
+ ResponsiveIconRadioGroup,
418
+ ResponsiveLength,
419
+ ResponsiveNumber,
420
+ ResponsiveOpacity,
421
+ ResponsiveSelect,
422
+ RichText,
423
+ ShadowsPropControllerFormat,
424
+ Shadows,
425
+ Shape,
426
+ SocialLinks,
427
+ Table,
428
+ TableFormFields,
429
+ Typeahead,
430
+ TextArea,
431
+ TextInput,
432
+ TextStyle,
433
+ Video,
434
+ WidthPropControllerFormat,
435
+ Width
436
+ }, Symbol.toStringTag, { value: "Module" }));
437
+ const ImageControlType = "makeswift::controls::image";
438
+ const ImageControlValueFormat = {
439
+ URL: "makeswift::controls::image::format::url",
440
+ WithDimensions: "makeswift::controls::image::format::with-dimensions"
441
+ };
442
+ function Image(config = {}) {
443
+ return { type: ImageControlType, config };
444
+ }
445
+ Image.Format = ImageControlValueFormat;
446
+ function copyImageData(value, context) {
447
+ var _a;
448
+ if (value == null)
449
+ return value;
450
+ return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
451
+ }
452
+ if (import_meta.vitest) {
453
+ const { describe, test, expect } = import_meta.vitest;
454
+ describe.concurrent("image copy", () => {
455
+ test("image is replaced by a one in replacement context", () => {
456
+ const data = "file-id";
457
+ const expected = "testing";
458
+ const replacementContext = {
459
+ elementHtmlIds: /* @__PURE__ */ new Set(),
460
+ elementKeys: /* @__PURE__ */ new Map(),
461
+ swatchIds: /* @__PURE__ */ new Map(),
462
+ fileIds: /* @__PURE__ */ new Map([["file-id", "testing"]]),
463
+ typographyIds: /* @__PURE__ */ new Map(),
464
+ tableIds: /* @__PURE__ */ new Map(),
465
+ tableColumnIds: /* @__PURE__ */ new Map(),
466
+ pageIds: /* @__PURE__ */ new Map(),
467
+ globalElementIds: /* @__PURE__ */ new Map(),
468
+ globalElementData: /* @__PURE__ */ new Map()
469
+ };
470
+ const result = copyImageData(data, {
471
+ replacementContext,
472
+ copyElement: (node) => node
473
+ });
474
+ expect(result).toMatchObject(expected);
475
+ });
476
+ });
477
+ }
478
+ const LinkControlType = "makeswift::controls::link";
479
+ function Link(config = {}) {
480
+ return { type: LinkControlType, config };
481
+ }
482
+ function copyLinkData(value, context) {
483
+ var _a;
484
+ if (value == null)
485
+ return value;
486
+ if (value.type === "OPEN_PAGE") {
487
+ const pageId = value.payload.pageId;
488
+ if (pageId != null) {
489
+ return __spreadProps(__spreadValues({}, value), {
490
+ payload: __spreadProps(__spreadValues({}, value.payload), {
491
+ pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : pageId
492
+ })
493
+ });
494
+ }
495
+ }
496
+ return value;
497
+ }
498
+ if (import_meta.vitest) {
499
+ const { describe, test, expect } = import_meta.vitest;
500
+ describe.concurrent("link", () => {
501
+ test("page id is replaced by one in replacement context", () => {
502
+ const data = {
503
+ type: "OPEN_PAGE",
504
+ payload: {
505
+ pageId: "UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=",
506
+ openInNewTab: false
507
+ }
508
+ };
509
+ const expected = JSON.parse(JSON.stringify(data).replace("UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=", "testing"));
510
+ const replacementContext = {
511
+ elementHtmlIds: /* @__PURE__ */ new Set(),
512
+ elementKeys: /* @__PURE__ */ new Map(),
513
+ swatchIds: /* @__PURE__ */ new Map(),
514
+ pageIds: /* @__PURE__ */ new Map([["UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=", "testing"]]),
515
+ typographyIds: /* @__PURE__ */ new Map(),
516
+ tableIds: /* @__PURE__ */ new Map(),
517
+ tableColumnIds: /* @__PURE__ */ new Map(),
518
+ fileIds: /* @__PURE__ */ new Map(),
519
+ globalElementIds: /* @__PURE__ */ new Map(),
520
+ globalElementData: /* @__PURE__ */ new Map()
521
+ };
522
+ const result = copyLinkData(data, {
523
+ replacementContext,
524
+ copyElement: (node) => node
525
+ });
526
+ expect(result).toMatchObject(expected);
527
+ });
528
+ });
529
+ }
530
+ function copy$8(value, context) {
531
+ var _a, _b;
532
+ if (value == null)
533
+ return value;
534
+ switch (value.type) {
535
+ case "OPEN_PAGE": {
536
+ const pageId = value.payload.pageId;
537
+ if (pageId == null)
538
+ return value;
539
+ return __spreadProps(__spreadValues({}, value), {
540
+ payload: __spreadProps(__spreadValues({}, value.payload), {
541
+ pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : pageId
542
+ })
543
+ });
544
+ }
545
+ case "SCROLL_TO_ELEMENT": {
546
+ const elementIdConfig = value.payload.elementIdConfig;
547
+ if (elementIdConfig == null)
548
+ return value;
549
+ return __spreadProps(__spreadValues({}, value), {
550
+ payload: __spreadProps(__spreadValues({}, value.payload), {
551
+ elementIdConfig: __spreadProps(__spreadValues({}, elementIdConfig), {
552
+ elementKey: (_b = context.replacementContext.elementKeys.get(elementIdConfig.elementKey)) != null ? _b : elementIdConfig.elementKey
553
+ })
554
+ })
555
+ });
556
+ }
557
+ default:
558
+ return value;
559
+ }
560
+ }
561
+ function copy$7(value, context) {
562
+ if (value == null)
563
+ return value;
564
+ return value.map(copyNavigationLinksPanelItem);
565
+ function copyNavigationLinksPanelItem(item) {
566
+ switch (item.type) {
567
+ case "button":
568
+ case "dropdown": {
569
+ const { color, link } = item.payload;
570
+ return __spreadProps(__spreadValues({}, item), {
571
+ payload: __spreadProps(__spreadValues({}, item.payload), {
572
+ link: link != null ? copy$8(link, context) : void 0,
573
+ color: color != null ? color.map((override) => {
574
+ var _a;
575
+ return __spreadProps(__spreadValues({}, override), {
576
+ value: __spreadProps(__spreadValues({}, override.value), {
577
+ swatchId: (_a = context.replacementContext.swatchIds.get(override.value.swatchId)) != null ? _a : override.value.swatchId
578
+ })
579
+ });
580
+ }) : void 0
581
+ })
582
+ });
583
+ }
584
+ default:
585
+ return item;
586
+ }
587
+ }
588
+ }
589
+ if (import_meta.vitest) {
590
+ const { describe, test, expect } = import_meta.vitest;
591
+ describe.concurrent("navigation-links copy", () => {
592
+ test("replace page id from replacement context", () => {
593
+ const data = [
594
+ {
595
+ id: "e1cf2d04-012a-4481-832a-7b4dda62195e",
596
+ type: "button",
597
+ payload: {
598
+ link: {
599
+ type: "OPEN_PAGE",
600
+ payload: {
601
+ pageId: "UGFnZTo2OGMzODZhNC1jYzRkLTQzMzUtYWZiMi05MDdhZGRkYzQ3YTM=",
602
+ openInNewTab: true
603
+ }
604
+ },
605
+ label: "Fellow Page"
606
+ }
607
+ }
608
+ ];
609
+ const expected = JSON.parse(JSON.stringify(data).replace("UGFnZTo2OGMzODZhNC1jYzRkLTQzMzUtYWZiMi05MDdhZGRkYzQ3YTM=", "testing"));
610
+ const replacementContext = {
611
+ elementHtmlIds: /* @__PURE__ */ new Set(),
612
+ elementKeys: /* @__PURE__ */ new Map(),
613
+ swatchIds: /* @__PURE__ */ new Map(),
614
+ fileIds: /* @__PURE__ */ new Map(),
615
+ typographyIds: /* @__PURE__ */ new Map(),
616
+ tableIds: /* @__PURE__ */ new Map(),
617
+ tableColumnIds: /* @__PURE__ */ new Map(),
618
+ pageIds: /* @__PURE__ */ new Map([["UGFnZTo2OGMzODZhNC1jYzRkLTQzMzUtYWZiMi05MDdhZGRkYzQ3YTM=", "testing"]]),
619
+ globalElementIds: /* @__PURE__ */ new Map(),
620
+ globalElementData: /* @__PURE__ */ new Map()
621
+ };
622
+ const result = copy$7(data, {
623
+ replacementContext,
624
+ copyElement: (node) => node
625
+ });
626
+ expect(result).toMatchObject(expected);
627
+ });
628
+ });
629
+ }
630
+ function copy$6(value, context) {
631
+ if (value == null)
632
+ return value;
633
+ return value.map((override) => __spreadProps(__spreadValues({}, override), { value: override.value.map(copyShadowItem) }));
634
+ function copyShadowItem(item) {
635
+ var _a;
636
+ const { color } = item.payload;
637
+ if (color == null)
638
+ return item;
639
+ return __spreadProps(__spreadValues({}, item), {
640
+ payload: __spreadProps(__spreadValues({}, item.payload), {
641
+ color: __spreadProps(__spreadValues({}, color), {
642
+ swatchId: (_a = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a : color.swatchId
643
+ })
644
+ })
645
+ });
646
+ }
647
+ }
648
+ if (import_meta.vitest) {
649
+ const { describe, test, expect } = import_meta.vitest;
650
+ describe.concurrent("shadow copy", () => {
651
+ test("replaces the swatch id", () => {
652
+ const data = [
653
+ {
654
+ value: [
655
+ {
656
+ id: "8575efe6-4d04-4361-b593-e559537c4c3c",
657
+ payload: {
658
+ color: {
659
+ alpha: 1,
660
+ swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
661
+ },
662
+ offsetX: -5,
663
+ offsetY: 8.7,
664
+ blurRadius: 17,
665
+ spreadRadius: 16
666
+ }
667
+ }
668
+ ],
669
+ deviceId: "desktop"
670
+ }
671
+ ];
672
+ const expected = JSON.parse(JSON.stringify(data).replace("U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg==", "testing"));
673
+ const replacementContext = {
674
+ elementHtmlIds: /* @__PURE__ */ new Set(),
675
+ elementKeys: /* @__PURE__ */ new Map(),
676
+ swatchIds: /* @__PURE__ */ new Map([
677
+ ["U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg==", "testing"]
678
+ ]),
679
+ fileIds: /* @__PURE__ */ new Map(),
680
+ typographyIds: /* @__PURE__ */ new Map(),
681
+ tableIds: /* @__PURE__ */ new Map(),
682
+ tableColumnIds: /* @__PURE__ */ new Map(),
683
+ pageIds: /* @__PURE__ */ new Map(),
684
+ globalElementIds: /* @__PURE__ */ new Map(),
685
+ globalElementData: /* @__PURE__ */ new Map()
686
+ };
687
+ const result = copy$6(data, {
688
+ replacementContext,
689
+ copyElement: (node) => node
690
+ });
691
+ expect(result).toMatchObject(expected);
692
+ });
693
+ });
694
+ }
695
+ function copy$5(value, context) {
696
+ var _a;
697
+ if (value == null)
698
+ return value;
699
+ return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
700
+ }
701
+ if (import_meta.vitest) {
702
+ const { describe, test, expect } = import_meta.vitest;
703
+ describe.concurrent("image copy", () => {
704
+ test("image is replaced by a one in replacement context", () => {
705
+ const data = "file-id";
706
+ const expected = JSON.parse(JSON.stringify(data).replace("file-id", "testing"));
707
+ const replacementContext = {
708
+ elementHtmlIds: /* @__PURE__ */ new Set(),
709
+ elementKeys: /* @__PURE__ */ new Map(),
710
+ swatchIds: /* @__PURE__ */ new Map(),
711
+ fileIds: /* @__PURE__ */ new Map([["file-id", "testing"]]),
712
+ typographyIds: /* @__PURE__ */ new Map(),
713
+ tableIds: /* @__PURE__ */ new Map(),
714
+ tableColumnIds: /* @__PURE__ */ new Map(),
715
+ pageIds: /* @__PURE__ */ new Map(),
716
+ globalElementIds: /* @__PURE__ */ new Map(),
717
+ globalElementData: /* @__PURE__ */ new Map()
718
+ };
719
+ const result = copy$5(data, {
720
+ replacementContext,
721
+ copyElement: (node) => node
722
+ });
723
+ expect(result).toMatchObject(expected);
724
+ });
725
+ });
726
+ }
727
+ function copy$4(value, context) {
728
+ if (value == null)
729
+ return value;
730
+ return value.map(copyImagesPanelItem);
731
+ function copyImagesPanelItem(imagesPanelItem) {
732
+ var _a;
733
+ const { file } = imagesPanelItem.props;
734
+ if (file == null)
735
+ return imagesPanelItem;
736
+ return __spreadProps(__spreadValues({}, imagesPanelItem), {
737
+ props: __spreadProps(__spreadValues({}, imagesPanelItem.props), {
738
+ file: (_a = context.replacementContext.fileIds.get(file)) != null ? _a : file
739
+ })
740
+ });
741
+ }
742
+ }
743
+ if (import_meta.vitest) {
744
+ const { describe, test, expect } = import_meta.vitest;
745
+ describe.concurrent("images copy", () => {
746
+ test("images are replaced by ones in replacement context", () => {
747
+ const data = [
748
+ {
749
+ key: "0ae80f8f-9d4a-43bc-ae7c-007164a19d22",
750
+ props: {
751
+ file: "RmlsZTo5ZmU3ZGUzMi1jY2E0LTRkMjktOWVlMC1jNTI2NDYxY2I1YjM="
752
+ }
753
+ },
754
+ {
755
+ key: "161674c3-8710-4fd6-90e6-6096c4e9bb88",
756
+ props: {
757
+ file: "RmlsZTo5ZmU3ZGUzMi1jY2E0LTRkMjktOWVlMC1jNTI2NDYxY2I1YjM="
758
+ }
759
+ }
760
+ ];
761
+ const expected = JSON.parse(JSON.stringify(data).replaceAll("RmlsZTo5ZmU3ZGUzMi1jY2E0LTRkMjktOWVlMC1jNTI2NDYxY2I1YjM=", "testing"));
762
+ const replacementContext = {
763
+ elementHtmlIds: /* @__PURE__ */ new Set(),
764
+ elementKeys: /* @__PURE__ */ new Map(),
765
+ swatchIds: /* @__PURE__ */ new Map(),
766
+ fileIds: /* @__PURE__ */ new Map([["RmlsZTo5ZmU3ZGUzMi1jY2E0LTRkMjktOWVlMC1jNTI2NDYxY2I1YjM=", "testing"]]),
767
+ typographyIds: /* @__PURE__ */ new Map(),
768
+ tableIds: /* @__PURE__ */ new Map(),
769
+ tableColumnIds: /* @__PURE__ */ new Map(),
770
+ pageIds: /* @__PURE__ */ new Map(),
771
+ globalElementIds: /* @__PURE__ */ new Map(),
772
+ globalElementData: /* @__PURE__ */ new Map()
773
+ };
774
+ const result = copy$4(data, {
775
+ replacementContext,
776
+ copyElement: (node) => node
777
+ });
778
+ expect(result).toMatchObject(expected);
779
+ });
780
+ });
781
+ }
782
+ function copy$3(value, context) {
783
+ if (value == null)
784
+ return value;
785
+ return __spreadProps(__spreadValues({}, value), { fields: value.fields.map(copyFormFieldsPanelItem) });
786
+ function copyFormFieldsPanelItem(item) {
787
+ var _a;
788
+ return __spreadProps(__spreadValues({}, item), {
789
+ tableColumnId: (_a = context.replacementContext.tableColumnIds.get(item.tableColumnId)) != null ? _a : item.tableColumnId
790
+ });
791
+ }
792
+ }
793
+ if (import_meta.vitest) {
794
+ const { describe, test, expect } = import_meta.vitest;
795
+ describe.concurrent("table form fields copy", () => {
796
+ test("replaces the table column id", () => {
797
+ const data = {
798
+ grid: [
799
+ {
800
+ value: {
801
+ count: 12,
802
+ spans: [[12], [12]]
803
+ },
804
+ deviceId: "desktop"
805
+ }
806
+ ],
807
+ fields: [
808
+ {
809
+ id: "8c4b3dcb-d9d2-4199-9a66-c35aa39248f0",
810
+ label: "hello",
811
+ required: true,
812
+ tableColumnId: "U2luZ2xlTGluZVRleHRUYWJsZUNvbHVtbjphMzQ0Yzk3ZC04MTQ0LTRmMzctYjU2My1hODE5OTQ5OGMyYWI="
813
+ }
814
+ ]
815
+ };
816
+ const expected = JSON.parse(JSON.stringify(data).replace("U2luZ2xlTGluZVRleHRUYWJsZUNvbHVtbjphMzQ0Yzk3ZC04MTQ0LTRmMzctYjU2My1hODE5OTQ5OGMyYWI=", "testing"));
817
+ const replacementContext = {
818
+ elementHtmlIds: /* @__PURE__ */ new Set(),
819
+ elementKeys: /* @__PURE__ */ new Map(),
820
+ swatchIds: /* @__PURE__ */ new Map(),
821
+ fileIds: /* @__PURE__ */ new Map(),
822
+ typographyIds: /* @__PURE__ */ new Map(),
823
+ tableIds: /* @__PURE__ */ new Map(),
824
+ tableColumnIds: /* @__PURE__ */ new Map([
825
+ [
826
+ "U2luZ2xlTGluZVRleHRUYWJsZUNvbHVtbjphMzQ0Yzk3ZC04MTQ0LTRmMzctYjU2My1hODE5OTQ5OGMyYWI=",
827
+ "testing"
828
+ ]
829
+ ]),
830
+ pageIds: /* @__PURE__ */ new Map(),
831
+ globalElementIds: /* @__PURE__ */ new Map(),
832
+ globalElementData: /* @__PURE__ */ new Map()
833
+ };
834
+ const result = copy$3(data, {
835
+ replacementContext,
836
+ copyElement: (node) => node
837
+ });
838
+ expect(result).toMatchObject(expected);
839
+ });
840
+ });
841
+ }
842
+ function copy$2(value, context) {
843
+ var _a;
844
+ if (value == null)
845
+ return value;
846
+ return (_a = context.replacementContext.tableIds.get(value)) != null ? _a : value;
847
+ }
848
+ if (import_meta.vitest) {
849
+ const { describe, test, expect } = import_meta.vitest;
850
+ describe.concurrent("table copy", () => {
851
+ test("replaces the table id", () => {
852
+ const data = "VGFibGU6MTM5NDhlYzMtMjgwNS00Nzk0LTliNzctNDJkN2RhNmQxZWEy";
853
+ const replacementContext = {
854
+ elementHtmlIds: /* @__PURE__ */ new Set(),
855
+ elementKeys: /* @__PURE__ */ new Map(),
856
+ swatchIds: /* @__PURE__ */ new Map(),
857
+ fileIds: /* @__PURE__ */ new Map(),
858
+ typographyIds: /* @__PURE__ */ new Map(),
859
+ tableIds: /* @__PURE__ */ new Map([
860
+ ["VGFibGU6MTM5NDhlYzMtMjgwNS00Nzk0LTliNzctNDJkN2RhNmQxZWEy", "testing"]
861
+ ]),
862
+ tableColumnIds: /* @__PURE__ */ new Map(),
863
+ pageIds: /* @__PURE__ */ new Map(),
864
+ globalElementIds: /* @__PURE__ */ new Map(),
865
+ globalElementData: /* @__PURE__ */ new Map()
866
+ };
867
+ const result = copy$2(data, {
868
+ replacementContext,
869
+ copyElement: (node) => node
870
+ });
871
+ expect(result).toMatch("testing");
872
+ });
873
+ });
874
+ }
875
+ function copy$1(value, context) {
876
+ if (value == null)
877
+ return value;
878
+ return value.map((override) => __spreadProps(__spreadValues({}, override), { value: copyBorderValue(override.value) }));
879
+ function copyBorderValue({ borderTop, borderRight, borderBottom, borderLeft }) {
880
+ return {
881
+ borderTop: borderTop && copyBorderSide(borderTop),
882
+ borderRight: borderRight && copyBorderSide(borderRight),
883
+ borderBottom: borderBottom && copyBorderSide(borderBottom),
884
+ borderLeft: borderLeft && copyBorderSide(borderLeft)
885
+ };
886
+ }
887
+ function copyBorderSide(borderSide) {
888
+ var _a;
889
+ const { color } = borderSide;
890
+ if (color == null)
891
+ return borderSide;
892
+ return __spreadProps(__spreadValues({}, borderSide), {
893
+ color: __spreadProps(__spreadValues({}, color), {
894
+ swatchId: (_a = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a : color.swatchId
895
+ })
896
+ });
897
+ }
898
+ }
899
+ if (import_meta.vitest) {
900
+ const { describe, test, expect } = import_meta.vitest;
901
+ describe.concurrent("border copy", () => {
902
+ test("replaces the swatch id", () => {
903
+ const data = [
904
+ {
905
+ value: {
906
+ borderTop: {
907
+ color: {
908
+ alpha: 1,
909
+ swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
910
+ },
911
+ style: "solid",
912
+ width: 5
913
+ },
914
+ borderLeft: {
915
+ color: {
916
+ alpha: 1,
917
+ swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
918
+ },
919
+ style: "solid",
920
+ width: 5
921
+ },
922
+ borderRight: {
923
+ color: {
924
+ alpha: 1,
925
+ swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
926
+ },
927
+ style: "solid",
928
+ width: 5
929
+ },
930
+ borderBottom: {
931
+ color: {
932
+ alpha: 1,
933
+ swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
934
+ },
935
+ style: "solid",
936
+ width: 5
937
+ }
938
+ },
939
+ deviceId: "desktop"
940
+ }
941
+ ];
942
+ const expected = [
943
+ {
944
+ value: {
945
+ borderTop: {
946
+ color: {
947
+ alpha: 1,
948
+ swatchId: "testing"
949
+ },
950
+ style: "solid",
951
+ width: 5
952
+ },
953
+ borderLeft: {
954
+ color: {
955
+ alpha: 1,
956
+ swatchId: "testing"
957
+ },
958
+ style: "solid",
959
+ width: 5
960
+ },
961
+ borderRight: {
962
+ color: {
963
+ alpha: 1,
964
+ swatchId: "testing"
965
+ },
966
+ style: "solid",
967
+ width: 5
968
+ },
969
+ borderBottom: {
970
+ color: {
971
+ alpha: 1,
972
+ swatchId: "testing"
973
+ },
974
+ style: "solid",
975
+ width: 5
976
+ }
977
+ },
978
+ deviceId: "desktop"
979
+ }
980
+ ];
981
+ const replacementContext = {
982
+ elementHtmlIds: /* @__PURE__ */ new Set(),
983
+ elementKeys: /* @__PURE__ */ new Map(),
984
+ swatchIds: /* @__PURE__ */ new Map([
985
+ ["U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg==", "testing"]
986
+ ]),
987
+ fileIds: /* @__PURE__ */ new Map(),
988
+ typographyIds: /* @__PURE__ */ new Map(),
989
+ tableIds: /* @__PURE__ */ new Map(),
990
+ tableColumnIds: /* @__PURE__ */ new Map(),
991
+ pageIds: /* @__PURE__ */ new Map(),
992
+ globalElementIds: /* @__PURE__ */ new Map(),
993
+ globalElementData: /* @__PURE__ */ new Map()
994
+ };
995
+ const result = copy$1(data, {
996
+ replacementContext,
997
+ copyElement: (node) => node
998
+ });
999
+ expect(result).toMatchObject(expected);
1000
+ });
1001
+ });
1002
+ }
1003
+ function copy(value, context) {
1004
+ if (value == null)
1005
+ return value;
1006
+ return __spreadProps(__spreadValues({}, value), { document: value.document ? copyNode(value.document) : value.document });
1007
+ function copyNode(node) {
1008
+ var _a;
1009
+ switch (node.object) {
1010
+ case "document":
1011
+ case "block":
1012
+ case "inline":
1013
+ return copyInline(node);
1014
+ case "text":
1015
+ return __spreadProps(__spreadValues({}, node), { marks: (_a = node.marks) == null ? void 0 : _a.map(copyMark) });
1016
+ default:
1017
+ return node;
1018
+ }
1019
+ }
1020
+ function copyInline(inline) {
1021
+ var _a, _b;
1022
+ switch (inline.type) {
1023
+ case "link":
1024
+ return __spreadProps(__spreadValues({}, inline), {
1025
+ nodes: (_a = inline.nodes) == null ? void 0 : _a.map(copyNode),
1026
+ data: inline.data ? copyLinkData2(inline.data) : inline.data
1027
+ });
1028
+ default:
1029
+ return __spreadProps(__spreadValues({}, inline), { nodes: (_b = inline.nodes) == null ? void 0 : _b.map(copyNode) });
1030
+ }
1031
+ }
1032
+ function copyLinkData2(data) {
1033
+ var _a, _b;
1034
+ switch (data.type) {
1035
+ case "OPEN_PAGE": {
1036
+ const pageId = data.payload.pageId;
1037
+ if (pageId == null)
1038
+ return data;
1039
+ return __spreadProps(__spreadValues({}, data), {
1040
+ payload: __spreadProps(__spreadValues({}, data.payload), {
1041
+ pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : data.payload.pageId
1042
+ })
1043
+ });
1044
+ }
1045
+ case "SCROLL_TO_ELEMENT": {
1046
+ const elementIdConfig = data.payload.elementIdConfig;
1047
+ if (elementIdConfig == null)
1048
+ return data;
1049
+ return __spreadProps(__spreadValues({}, data), {
1050
+ payload: __spreadProps(__spreadValues({}, data.payload), {
1051
+ elementIdConfig: __spreadProps(__spreadValues({}, elementIdConfig), {
1052
+ elementKey: (_b = context.replacementContext.elementKeys.get(elementIdConfig.elementKey)) != null ? _b : elementIdConfig.elementKey
1053
+ })
1054
+ })
1055
+ });
1056
+ }
1057
+ default:
1058
+ return data;
1059
+ }
1060
+ }
1061
+ function copyMark(mark) {
1062
+ var _a, _b, _c, _d;
1063
+ switch (mark.type) {
1064
+ case "typography": {
1065
+ const typographyId = (_a = mark.data) == null ? void 0 : _a.value.id;
1066
+ return __spreadProps(__spreadValues({}, mark), {
1067
+ data: __spreadProps(__spreadValues({}, mark.data), {
1068
+ value: __spreadProps(__spreadValues({}, (_b = mark.data) == null ? void 0 : _b.value), {
1069
+ id: (_c = context.replacementContext.typographyIds.get(typographyId)) != null ? _c : typographyId,
1070
+ style: (_d = mark.data) == null ? void 0 : _d.value.style.map((override) => {
1071
+ var _a2, _b2, _c2;
1072
+ return __spreadProps(__spreadValues({}, override), {
1073
+ value: __spreadProps(__spreadValues({}, override.value), {
1074
+ color: override.value.color == null ? override.value.color : __spreadProps(__spreadValues({}, override.value.color), {
1075
+ 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
1076
+ })
1077
+ })
1078
+ });
1079
+ })
1080
+ })
1081
+ })
1082
+ });
1083
+ }
1084
+ default:
1085
+ return mark;
1086
+ }
1087
+ }
1088
+ }
1089
+ if (import_meta.vitest) {
1090
+ const { describe, test, expect } = import_meta.vitest;
1091
+ describe.concurrent("rich text copy", () => {
1092
+ test("replaces the swatch id", () => {
1093
+ const data = {
1094
+ object: "value",
1095
+ document: {
1096
+ data: {},
1097
+ nodes: [
1098
+ {
1099
+ data: {},
1100
+ type: "paragraph",
1101
+ nodes: [
1102
+ {
1103
+ text: "Hello world",
1104
+ marks: [
1105
+ {
1106
+ data: {
1107
+ value: {
1108
+ id: "VHlwb2dyYXBoeTo5ODE1NWY0Ni1mNmQzLTQ1M2YtODk5OC02ZWY5NzJhNTBlY2U=",
1109
+ style: [
1110
+ {
1111
+ value: {
1112
+ color: {
1113
+ alpha: 1,
1114
+ swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
1115
+ },
1116
+ fontSize: {
1117
+ unit: "px",
1118
+ value: 23
1119
+ },
1120
+ lineHeight: 2.5,
1121
+ strikethrough: true
1122
+ },
1123
+ deviceId: "desktop"
1124
+ }
1125
+ ]
1126
+ }
1127
+ },
1128
+ type: "typography",
1129
+ object: "mark"
1130
+ }
1131
+ ],
1132
+ object: "text"
1133
+ }
1134
+ ],
1135
+ object: "block"
1136
+ }
1137
+ ],
1138
+ object: "document"
1139
+ },
1140
+ selection: {
1141
+ focus: {
1142
+ path: [0, 0],
1143
+ object: "point",
1144
+ offset: 0
1145
+ },
1146
+ anchor: {
1147
+ path: [0, 0],
1148
+ object: "point",
1149
+ offset: 0
1150
+ },
1151
+ object: "selection",
1152
+ isFocused: false
1153
+ }
1154
+ };
1155
+ const expected = JSON.parse(JSON.stringify(data).replace("U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg==", "swatch-testing").replace("VHlwb2dyYXBoeTo5ODE1NWY0Ni1mNmQzLTQ1M2YtODk5OC02ZWY5NzJhNTBlY2U=", "typography-testing"));
1156
+ const replacementContext = {
1157
+ elementHtmlIds: /* @__PURE__ */ new Set(),
1158
+ elementKeys: /* @__PURE__ */ new Map(),
1159
+ swatchIds: /* @__PURE__ */ new Map([
1160
+ ["U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg==", "swatch-testing"]
1161
+ ]),
1162
+ fileIds: /* @__PURE__ */ new Map(),
1163
+ typographyIds: /* @__PURE__ */ new Map([
1164
+ [
1165
+ "VHlwb2dyYXBoeTo5ODE1NWY0Ni1mNmQzLTQ1M2YtODk5OC02ZWY5NzJhNTBlY2U=",
1166
+ "typography-testing"
1167
+ ]
1168
+ ]),
1169
+ tableIds: /* @__PURE__ */ new Map(),
1170
+ tableColumnIds: /* @__PURE__ */ new Map(),
1171
+ pageIds: /* @__PURE__ */ new Map(),
1172
+ globalElementIds: /* @__PURE__ */ new Map(),
1173
+ globalElementData: /* @__PURE__ */ new Map()
1174
+ };
1175
+ const result = copy(data, {
1176
+ replacementContext,
1177
+ copyElement: (node) => node
1178
+ });
1179
+ expect(result).toMatchObject(expected);
1180
+ });
1181
+ });
1182
+ }
1183
+ const BlockType = {
1184
+ Paragraph: "paragraph",
1185
+ Heading1: "heading-one",
1186
+ Heading2: "heading-two",
1187
+ Heading3: "heading-three",
1188
+ Heading4: "heading-four",
1189
+ Heading5: "heading-five",
1190
+ Heading6: "heading-six",
1191
+ BlockQuote: "blockquote",
1192
+ UnorderedList: "unordered-list",
1193
+ OrderedList: "ordered-list",
1194
+ ListItem: "list-item",
1195
+ ListItemChild: "list-item-child"
1196
+ };
1197
+ const InlineType = {
1198
+ Code: "code",
1199
+ SuperScript: "superscript",
1200
+ SubScript: "subscript",
1201
+ Link: "link"
1202
+ };
1203
+ const BlockTextAlignment = {
1204
+ Left: "left",
1205
+ Center: "center",
1206
+ Right: "right",
1207
+ Justify: "justify"
11
1208
  };
12
- export { APIResourceType as A };
1209
+ export { Video as $, ResponsiveColor as A, BlockType as B, ColorControlType as C, TextStyle as D, ElementID as E, Images as F, GapY as G, Date as H, ImageControlType as I, Font as J, ResponsiveLength as K, LinkControlType as L, Margin as M, Number as N, TextArea as O, Padding as P, Table as Q, ResponsiveIconRadioGroup as R, StyleControlType as S, Types as T, TableFormFields as U, Image$1 as V, Width as W, ResponsiveOpacity as X, NavigationLinks as Y, SocialLinks as Z, RichText as _, copy$1 as a, StyleControlProperty as a0, ImageControlValueFormat as a1, BorderPropControllerFormat as a2, ShadowsPropControllerFormat as a3, BorderRadiusPropControllerFormat as a4, MarginPropControllerFormat as a5, PaddingPropControllerFormat as a6, WidthPropControllerFormat as a7, Color as a8, Image as a9, Link as aa, Style as ab, BlockTextAlignment as ac, copy$2 as b, copy as c, copy$3 as d, copy$4 as e, copy$5 as f, copy$6 as g, copy$8 as h, copy$7 as i, copyStyleData as j, copyLinkData as k, copyImageData as l, copyColorData as m, InlineType as n, descriptors as o, Backgrounds as p, Border as q, BorderRadius as r, Shadows as s, GapX as t, ResponsiveSelect as u, ResponsiveNumber as v, Checkbox as w, Grid as x, TextInput as y, Link$1 as z };
13
1210
  //# sourceMappingURL=types.es.js.map