@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/index.cjs.js CHANGED
@@ -35,36 +35,35 @@ var __publicField = (obj, key, value) => {
35
35
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
36
36
  return value;
37
37
  };
38
- var _c;
39
38
  var React = require("react");
40
39
  var withSelector = require("use-sync-external-store/shim/with-selector");
41
40
  var dynamic = require("next/dynamic");
42
41
  var constants = require("./constants.cjs.js");
43
42
  var actions = require("./actions.cjs.js");
44
- var css = require("@emotion/css");
45
- var serialize = require("@emotion/serialize");
46
- var utils = require("@emotion/utils");
43
+ var responsiveStyle = require("./responsive-style.cjs.js");
47
44
  var jsxRuntime = require("react/jsx-runtime");
48
- var richText = require("./rich-text.cjs.js");
45
+ var types$1 = require("./types.cjs.js");
49
46
  require("slate");
50
47
  var textInput = require("./text-input.cjs.js");
51
48
  var combobox = require("./combobox.cjs.js");
49
+ var richText = require("./rich-text.cjs.js");
52
50
  require("slate-react");
53
51
  var shim = require("use-sync-external-store/shim");
54
52
  var introspection = require("./introspection.cjs.js");
55
- var redux = require("redux");
56
- var thunk = require("redux-thunk");
57
- var types = require("./types.cjs.js");
53
+ var isNonNullable = require("./isNonNullable.cjs.js");
58
54
  var ColorHelper = require("color");
59
55
  var scrollIntoView = require("scroll-into-view-if-needed");
56
+ var css = require("@emotion/css");
60
57
  var boxModels = require("./box-models.cjs.js");
61
58
  var reactDom = require("react-dom");
62
59
  var parse = require("html-react-parser");
63
60
  var Head = require("next/head");
61
+ var types = require("./types.cjs2.js");
64
62
  var createEmotionServer = require("@emotion/server/create-instance");
65
63
  var NextDocument = require("next/document");
66
- var cookie = require("cookie");
67
64
  var Cors = require("cors");
65
+ var pathToRegexp = require("path-to-regexp");
66
+ var cookie = require("cookie");
68
67
  var httpProxy = require("http-proxy");
69
68
  var setCookieParser = require("set-cookie-parser");
70
69
  var uuid = require("uuid");
@@ -94,7 +93,6 @@ function _interopNamespace(e) {
94
93
  }
95
94
  var React__namespace = /* @__PURE__ */ _interopNamespace(React);
96
95
  var dynamic__default = /* @__PURE__ */ _interopDefaultLegacy(dynamic);
97
- var thunk__default = /* @__PURE__ */ _interopDefaultLegacy(thunk);
98
96
  var ColorHelper__default = /* @__PURE__ */ _interopDefaultLegacy(ColorHelper);
99
97
  var scrollIntoView__default = /* @__PURE__ */ _interopDefaultLegacy(scrollIntoView);
100
98
  var parse__default = /* @__PURE__ */ _interopDefaultLegacy(parse);
@@ -147,661 +145,6 @@ function BodySnippet({
147
145
  }, [code, cleanup]);
148
146
  return null;
149
147
  }
150
- async function introspect(element, client, store) {
151
- const descriptors = constants.getPropControllerDescriptors(store.getState());
152
- const swatchIds = /* @__PURE__ */ new Set();
153
- const fileIds = /* @__PURE__ */ new Set();
154
- const typographyIds = /* @__PURE__ */ new Set();
155
- const tableIds = /* @__PURE__ */ new Set();
156
- const pageIds = /* @__PURE__ */ new Set();
157
- const remaining = [element];
158
- const seen = /* @__PURE__ */ new Set();
159
- let current;
160
- while (current = remaining.pop()) {
161
- let getResourcesFromElementDescriptors = function(elementDescriptors2, props) {
162
- Object.entries(elementDescriptors2).forEach(([propName, descriptor]) => {
163
- introspection.getElementSwatchIds(descriptor, props[propName]).forEach((swatchId) => {
164
- swatchIds.add(swatchId);
165
- });
166
- introspection.getFileIds(descriptor, props[propName]).forEach((fileId) => fileIds.add(fileId));
167
- introspection.getTypographyIds(descriptor, props[propName]).forEach((typographyId) => typographyIds.add(typographyId));
168
- introspection.getTableIds(descriptor, props[propName]).forEach((tableId) => tableIds.add(tableId));
169
- introspection.getPageIds(descriptor, props[propName]).forEach((pageId) => pageIds.add(pageId));
170
- introspection.getElementChildren(descriptor, props[propName]).forEach((child) => {
171
- if (!seen.has(child.key)) {
172
- seen.add(child.key);
173
- remaining.push(child);
174
- }
175
- });
176
- if (descriptor.type === richText.ShapeControlType) {
177
- const prop = props[propName];
178
- if (prop == null)
179
- return;
180
- getResourcesFromElementDescriptors(descriptor.config.type, prop);
181
- }
182
- if (descriptor.type === richText.ListControlType) {
183
- const prop = props[propName];
184
- if (prop == null)
185
- return;
186
- prop.forEach((item) => {
187
- getResourcesFromElementDescriptors({ propName: descriptor.config.type }, { propName: item.value });
188
- });
189
- }
190
- if (descriptor.type === richText.Types.Shape) {
191
- const prop = props[propName];
192
- if (prop == null)
193
- return;
194
- getResourcesFromElementDescriptors(descriptor.options.type, prop);
195
- }
196
- if (descriptor.type === richText.Types.List) {
197
- const prop = props[propName];
198
- if (prop == null)
199
- return;
200
- prop.forEach((item) => {
201
- getResourcesFromElementDescriptors({ propName: descriptor.options.type }, { propName: item.value });
202
- });
203
- }
204
- });
205
- };
206
- let element2;
207
- if (constants.isElementReference(current)) {
208
- const globalElement = await client.fetchGlobalElement(current.value);
209
- const elementData = globalElement == null ? void 0 : globalElement.data;
210
- if (elementData == null)
211
- continue;
212
- element2 = elementData;
213
- } else {
214
- element2 = current;
215
- }
216
- const elementDescriptors = descriptors.get(element2.type);
217
- if (elementDescriptors == null)
218
- continue;
219
- getResourcesFromElementDescriptors(elementDescriptors, element2.props);
220
- }
221
- const typographies = await client.fetchTypographies([...typographyIds]);
222
- typographies.forEach((typography) => {
223
- typography == null ? void 0 : typography.style.forEach((style) => {
224
- var _a;
225
- const swatchId = (_a = style.value.color) == null ? void 0 : _a.swatchId;
226
- if (swatchId != null)
227
- swatchIds.add(swatchId);
228
- });
229
- });
230
- return {
231
- swatchIds: [...swatchIds],
232
- fileIds: [...fileIds],
233
- typographyIds: [...typographyIds],
234
- tableIds: [...tableIds],
235
- pageIds: [...pageIds]
236
- };
237
- }
238
- function normalizeToMakeswiftResources(partialResources) {
239
- const resources = {
240
- swatches: (partialResources == null ? void 0 : partialResources.swatches) || [],
241
- typographies: (partialResources == null ? void 0 : partialResources.typographies) || [],
242
- files: (partialResources == null ? void 0 : partialResources.files) || [],
243
- tables: (partialResources == null ? void 0 : partialResources.tables) || [],
244
- pagePathnameSlices: (partialResources == null ? void 0 : partialResources.pagePathnameSlices) || [],
245
- globalElements: (partialResources == null ? void 0 : partialResources.globalElements) || [],
246
- snippets: (partialResources == null ? void 0 : partialResources.snippets) || [],
247
- fonts: (partialResources == null ? void 0 : partialResources.fonts) || [],
248
- pageMetadata: (partialResources == null ? void 0 : partialResources.pageMetadata) || {},
249
- pageSeo: (partialResources == null ? void 0 : partialResources.pageSeo) || {}
250
- };
251
- return resources;
252
- }
253
- function fileToFileSnapshot(file) {
254
- return file;
255
- }
256
- function is(x, y) {
257
- if (x === y)
258
- return x !== 0 || y !== 0 || 1 / x === 1 / y;
259
- return x !== x && y !== y;
260
- }
261
- const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
262
- const shallowEqual = (a, b) => {
263
- if (is(a, b))
264
- return true;
265
- if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
266
- return false;
267
- const keysA = Object.keys(a);
268
- const keysB = Object.keys(b);
269
- if (keysA.length !== keysB.length)
270
- return false;
271
- for (let i = 0; i < keysA.length; i += 1) {
272
- if (!hasOwnProperty$1.call(b, keysA[i]) || !is(a[keysA[i]], b[keysA[i]]))
273
- return false;
274
- }
275
- return true;
276
- };
277
- const { hasOwnProperty } = Object.prototype;
278
- const deepEqual = (a, b) => {
279
- if (shallowEqual(a, b))
280
- return true;
281
- if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
282
- return false;
283
- const keysA = Object.keys(a);
284
- const keysB = Object.keys(b);
285
- if (keysA.length !== keysB.length)
286
- return false;
287
- for (let i = 0; i < keysA.length; i += 1) {
288
- if (!hasOwnProperty.call(b, keysA[i]) || !deepEqual(a[keysA[i]], b[keysA[i]]))
289
- return false;
290
- }
291
- return true;
292
- };
293
- function isNonNullable(value) {
294
- return value != null;
295
- }
296
- function getSnapshotResourcesFromSerializedState(serializedState) {
297
- const resources = {
298
- swatches: serializedState.Swatch.filter((_) => true),
299
- typographies: serializedState.Typography.filter((_) => true),
300
- files: serializedState.File.map(({ id, value }) => value.__typename === types.APIResourceType.File ? { id, value: fileToFileSnapshot(value) } : null).filter(isNonNullable),
301
- tables: serializedState.Table.filter((_) => true),
302
- pagePathnameSlices: serializedState.PagePathnameSlice.filter((_) => true),
303
- globalElements: serializedState.GlobalElement.filter((_) => true)
304
- };
305
- return resources;
306
- }
307
- function getInitialState(serializedState = {
308
- Swatch: [],
309
- File: [],
310
- Typography: [],
311
- PagePathnameSlice: [],
312
- GlobalElement: [],
313
- Table: [],
314
- Snippet: [],
315
- Page: [],
316
- Site: []
317
- }) {
318
- return new Map(Object.entries(serializedState).map(([apiResourceType, resources]) => [
319
- apiResourceType,
320
- new Map(resources.map(({ id, value }) => [id, value]))
321
- ]));
322
- }
323
- function getSerializedState$1(state) {
324
- const resourceMap = {
325
- Swatch: [],
326
- File: [],
327
- Typography: [],
328
- PagePathnameSlice: [],
329
- GlobalElement: [],
330
- Table: [],
331
- Snippet: [],
332
- Page: [],
333
- Site: []
334
- };
335
- Array.from(state.entries()).forEach(([resourceType, resources]) => {
336
- const particularResourceMap = [];
337
- Array.from(resources.entries()).forEach(([id, value]) => {
338
- if (value != null) {
339
- particularResourceMap.push({ id, value });
340
- }
341
- });
342
- resourceMap[resourceType] = particularResourceMap;
343
- });
344
- return resourceMap;
345
- }
346
- function getHasAPIResource$1(state, resourceType, resourceId) {
347
- var _a, _b;
348
- return (_b = (_a = state.get(resourceType)) == null ? void 0 : _a.has(resourceId)) != null ? _b : false;
349
- }
350
- function getAPIResource$1(state, resourceType, resourceId) {
351
- var _a;
352
- const resource = (_a = state.get(resourceType)) == null ? void 0 : _a.get(resourceId);
353
- return (resource == null ? void 0 : resource.__typename) === resourceType ? resource : null;
354
- }
355
- function reducer$1(state = getInitialState(), action) {
356
- switch (action.type) {
357
- case actions.ActionTypes.API_RESOURCE_FULFILLED: {
358
- const { resourceType, resourceId, resource } = action.payload;
359
- return new Map(state).set(resourceType, new Map(state.get(resourceType)).set(resourceId, resource));
360
- }
361
- case actions.ActionTypes.INTROSPECTED_RESOURCES_FULFILLED: {
362
- const { introspectedResourceIds, introspectedResources } = action.payload;
363
- const swatches = new Map(state.get(types.APIResourceType.Swatch));
364
- const files = new Map(state.get(types.APIResourceType.File));
365
- const typographies = new Map(state.get(types.APIResourceType.Typography));
366
- const pagePathnameSlices = new Map(state.get(types.APIResourceType.PagePathnameSlice));
367
- const tables = new Map(state.get(types.APIResourceType.Table));
368
- introspectedResourceIds.swatchIds.forEach((swatchId, idx) => {
369
- swatches.set(swatchId, introspectedResources.swatches[idx]);
370
- });
371
- introspectedResourceIds.fileIds.forEach((fileId, idx) => {
372
- files.set(fileId, introspectedResources.files[idx]);
373
- });
374
- introspectedResourceIds.typographyIds.forEach((typographyId, idx) => {
375
- typographies.set(typographyId, introspectedResources.typographies[idx]);
376
- });
377
- introspectedResourceIds.pageIds.forEach((pageId, idx) => {
378
- const pagePathnameSlice = introspectedResources.pagePathnamesById[idx];
379
- if (pagePathnameSlice == null) {
380
- pagePathnameSlices.set(pageId, pagePathnameSlice);
381
- } else {
382
- const nodeId = Buffer.from(`Page:${pagePathnameSlice.id}`).toString("base64");
383
- pagePathnameSlices.set(nodeId, __spreadProps(__spreadValues({}, pagePathnameSlice), { id: nodeId }));
384
- }
385
- });
386
- introspectedResourceIds.tableIds.forEach((tableId, idx) => {
387
- tables.set(tableId, introspectedResources.tables[idx]);
388
- });
389
- return new Map(state).set(types.APIResourceType.Swatch, swatches).set(types.APIResourceType.File, files).set(types.APIResourceType.Typography, typographies).set(types.APIResourceType.PagePathnameSlice, pagePathnameSlices).set(types.APIResourceType.Table, tables);
390
- }
391
- case actions.ActionTypes.TYPOGRAPHIES_FULFILLED: {
392
- const typographies = new Map(state.get(types.APIResourceType.Typography));
393
- action.payload.typographyIds.forEach((typographyId, idx) => {
394
- typographies.set(typographyId, action.payload.typographies[idx]);
395
- });
396
- return new Map(state).set(types.APIResourceType.Typography, typographies);
397
- }
398
- case actions.ActionTypes.CHANGE_API_RESOURCE: {
399
- const existingApiResource = getAPIResource$1(state, action.payload.resource.__typename, action.payload.resource.id);
400
- if (deepEqual(existingApiResource, action.payload.resource))
401
- return state;
402
- return new Map(state).set(action.payload.resource.__typename, new Map(state.get(action.payload.resource.__typename)).set(action.payload.resource.id, action.payload.resource));
403
- }
404
- case actions.ActionTypes.EVICT_API_RESOURCE: {
405
- const [resourceType, resourceId] = action.payload.id.split(":");
406
- if (!(resourceType in types.APIResourceType))
407
- return state;
408
- const resources = new Map(state.get(resourceType));
409
- const deleted = resources.delete(resourceId);
410
- return deleted ? new Map(state).set(resourceType, resources) : state;
411
- }
412
- default:
413
- return state;
414
- }
415
- }
416
- const SwatchFragment = `
417
- fragment Swatch on Swatch {
418
- __typename
419
- id
420
- hue
421
- saturation
422
- lightness
423
- }
424
- `;
425
- const FileFragment = `
426
- fragment File on File {
427
- __typename
428
- id
429
- name
430
- publicUrl: publicUrlV2
431
- extension
432
- dimensions {
433
- width
434
- height
435
- }
436
- }
437
- `;
438
- const TypographyFragment = `
439
- fragment Typography on Typography {
440
- __typename
441
- id
442
- name
443
- style {
444
- deviceId
445
- value {
446
- fontFamily
447
- fontSize {
448
- value
449
- unit
450
- }
451
- color {
452
- swatchId
453
- alpha
454
- }
455
- lineHeight
456
- letterSpacing
457
- fontWeight
458
- textAlign
459
- uppercase
460
- underline
461
- strikethrough
462
- italic
463
- }
464
- }
465
- }
466
- `;
467
- const PagePathnameSliceFragment = `
468
- fragment PagePathnameSlice on PagePathnameSlice {
469
- __typename
470
- id
471
- pathname
472
- }
473
- `;
474
- const GlobalElementFragment = `
475
- fragment GlobalElement on GlobalElement {
476
- __typename
477
- id
478
- data
479
- }
480
- `;
481
- const TableFragment = `
482
- fragment Table on Table {
483
- __typename
484
- id
485
- name
486
- columns {
487
- __typename
488
- id
489
- name
490
-
491
- ... on MultipleSelectTableColumn {
492
- options {
493
- id
494
- name
495
- }
496
- }
497
-
498
- ... on SingleSelectTableColumn {
499
- options {
500
- id
501
- name
502
- }
503
- }
504
- }
505
- }
506
- `;
507
- const IntrospectedResourcesQuery = `
508
- query IntrospectedResources(
509
- $swatchIds: [ID!]!
510
- $fileIds: [ID!]!
511
- $typographyIds: [ID!]!
512
- $pageIds: [ID!]!
513
- $tableIds: [ID!]!
514
- ) {
515
- swatches(ids: $swatchIds) {
516
- ...Swatch
517
- }
518
-
519
- files(ids: $fileIds) {
520
- ...File
521
- }
522
-
523
- typographies(ids: $typographyIds) {
524
- ...Typography
525
- }
526
-
527
- pagePathnamesById(ids: $pageIds) {
528
- ...PagePathnameSlice
529
- }
530
-
531
- tables(ids: $tableIds) {
532
- ...Table
533
- }
534
- }
535
-
536
- ${SwatchFragment}
537
- ${FileFragment}
538
- ${TypographyFragment}
539
- ${PagePathnameSliceFragment}
540
- ${TableFragment}
541
- `;
542
- const SwatchQuery = `
543
- query Swatch($swatchId: ID!) {
544
- swatch(id: $swatchId) {
545
- ...Swatch
546
- }
547
- }
548
-
549
- ${SwatchFragment}
550
- `;
551
- const FileQuery = `
552
- query File($fileId: ID!) {
553
- file(id: $fileId) {
554
- ...File
555
- }
556
- }
557
-
558
- ${FileFragment}
559
- `;
560
- const TypographyQuery = `
561
- query Typography($typographyId: ID!) {
562
- typography(id: $typographyId) {
563
- ...Typography
564
- }
565
- }
566
-
567
- ${TypographyFragment}
568
- `;
569
- const PagePathnamesByIdQuery = `
570
- query PagePathnamesById($pageIds: [ID!]!) {
571
- pagePathnamesById(ids: $pageIds) {
572
- ...PagePathnameSlice
573
- }
574
- }
575
-
576
- ${PagePathnameSliceFragment}
577
- `;
578
- const TableQuery = `
579
- query Table($tableId: ID!) {
580
- table(id: $tableId) {
581
- ...Table
582
- }
583
- }
584
-
585
- ${TableFragment}
586
- `;
587
- const TypographiesQuery = `
588
- query Typographies($typographyIds: [ID!]!) {
589
- typographies(ids: $typographyIds) {
590
- ...Typography
591
- }
592
- }
593
-
594
- ${TypographyFragment}
595
- `;
596
- const GlobalElementQuery = `
597
- query GlobalElement($globalElementId: ID!) {
598
- globalElement(id: $globalElementId) {
599
- ...GlobalElement
600
- }
601
- }
602
-
603
- ${GlobalElementFragment}
604
- `;
605
- const CreateTableRecordMutation = `
606
- mutation CreateTableRecord($input: CreateTableRecordInput!) {
607
- createTableRecord(input: $input) {
608
- tableRecord {
609
- id
610
- }
611
- }
612
- }
613
- `;
614
- const reducer = reducer$1;
615
- function getSerializedState(state) {
616
- return getSerializedState$1(state);
617
- }
618
- function getHasAPIResource(state, resourceType, resourceId) {
619
- return getHasAPIResource$1(state, resourceType, resourceId);
620
- }
621
- function getAPIResource(state, resourceType, resourceId) {
622
- return getAPIResource$1(state, resourceType, resourceId);
623
- }
624
- function fetchAPIResource(resourceType, resourceId) {
625
- return async (dispatch, getState, client) => {
626
- var _a;
627
- const state = getState();
628
- if (getHasAPIResource(state, resourceType, resourceId)) {
629
- return getAPIResource(state, resourceType, resourceId);
630
- }
631
- let resource;
632
- switch (resourceType) {
633
- case types.APIResourceType.Swatch:
634
- resource = (await client.request(SwatchQuery, {
635
- swatchId: resourceId
636
- })).swatch;
637
- break;
638
- case types.APIResourceType.File:
639
- resource = (await client.request(FileQuery, {
640
- fileId: resourceId
641
- })).file;
642
- break;
643
- case types.APIResourceType.Typography:
644
- resource = (await client.request(TypographyQuery, {
645
- typographyId: resourceId
646
- })).typography;
647
- break;
648
- case types.APIResourceType.GlobalElement:
649
- resource = (await client.request(GlobalElementQuery, { globalElementId: resourceId })).globalElement;
650
- break;
651
- case types.APIResourceType.PagePathnameSlice:
652
- resource = (_a = (await client.request(PagePathnamesByIdQuery, { pageIds: [resourceId] })).pagePathnamesById[0]) != null ? _a : null;
653
- break;
654
- case types.APIResourceType.Table:
655
- resource = (await client.request(TableQuery, {
656
- tableId: resourceId
657
- })).table;
658
- break;
659
- default:
660
- resource = null;
661
- }
662
- dispatch(actions.apiResourceFulfilled(resourceType, resourceId, resource));
663
- return resource;
664
- };
665
- }
666
- function fetchIntrospectedResources(introspectedResourceIds) {
667
- return async (dispatch, _getState, client) => {
668
- const introspectedResources = await client.request(IntrospectedResourcesQuery, introspectedResourceIds);
669
- dispatch(actions.introspectedResourcesFulfilled(introspectedResourceIds, introspectedResources));
670
- };
671
- }
672
- function fetchTypographies(typographyIds) {
673
- return async (dispatch, getState, client) => {
674
- const state = getState();
675
- if (typographyIds.every((typographyId) => getHasAPIResource(state, types.APIResourceType.Typography, typographyId))) {
676
- return typographyIds.map((typographyId) => getAPIResource(state, types.APIResourceType.Typography, typographyId));
677
- }
678
- const { typographies } = await client.request(TypographiesQuery, { typographyIds });
679
- dispatch(actions.typographiesFulfilled(typographyIds, typographies));
680
- return typographies;
681
- };
682
- }
683
- function configureStore({
684
- graphqlClient,
685
- serializedState
686
- }) {
687
- return redux.createStore(reducer, getInitialState(serializedState), redux.applyMiddleware(thunk__default["default"].withExtraArgument(graphqlClient)));
688
- }
689
- class GraphQLClient {
690
- constructor(endpoint) {
691
- __publicField(this, "endpoint");
692
- this.endpoint = endpoint;
693
- }
694
- async request(query, variables = {}) {
695
- const response = await fetch(this.endpoint, {
696
- method: "POST",
697
- headers: { "Content-Type": "application/json" },
698
- body: JSON.stringify({ query, variables })
699
- });
700
- if (!response.ok && response.status !== 400) {
701
- throw new Error(`${response.status} ${response.statusText}`);
702
- }
703
- const body = await response.json();
704
- if (body.errors != null) {
705
- console.error(body);
706
- throw new Error("GraphQL response contains errors, check the console.");
707
- }
708
- return body.data;
709
- }
710
- }
711
- class MakeswiftClient {
712
- constructor({
713
- uri,
714
- cacheData
715
- }) {
716
- __publicField(this, "graphqlClient");
717
- __publicField(this, "makeswiftApiClient");
718
- __publicField(this, "subscribe");
719
- this.graphqlClient = new GraphQLClient(uri);
720
- this.makeswiftApiClient = configureStore({
721
- graphqlClient: this.graphqlClient,
722
- serializedState: cacheData
723
- });
724
- this.subscribe = this.makeswiftApiClient.subscribe;
725
- }
726
- async prefetch(element) {
727
- const introspectionData = await introspect(element, this, storeContextDefaultValue);
728
- await this.makeswiftApiClient.dispatch(fetchIntrospectedResources(introspectionData));
729
- return getSerializedState(this.makeswiftApiClient.getState());
730
- }
731
- readSwatch(swatchId) {
732
- return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.Swatch, swatchId);
733
- }
734
- async fetchSwatch(swatchId) {
735
- return await this.makeswiftApiClient.dispatch(fetchAPIResource(types.APIResourceType.Swatch, swatchId));
736
- }
737
- readFile(fileId) {
738
- return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.File, fileId);
739
- }
740
- async fetchFile(fileId) {
741
- return await this.makeswiftApiClient.dispatch(fetchAPIResource(types.APIResourceType.File, fileId));
742
- }
743
- readTypography(typographyId) {
744
- return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.Typography, typographyId);
745
- }
746
- async fetchTypography(typographyId) {
747
- return await this.makeswiftApiClient.dispatch(fetchAPIResource(types.APIResourceType.Typography, typographyId));
748
- }
749
- async fetchTypographies(typographyIds) {
750
- return await this.makeswiftApiClient.dispatch(fetchTypographies(typographyIds));
751
- }
752
- readGlobalElement(globalElementId) {
753
- return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.GlobalElement, globalElementId);
754
- }
755
- async fetchGlobalElement(globalElementId) {
756
- return await this.makeswiftApiClient.dispatch(fetchAPIResource(types.APIResourceType.GlobalElement, globalElementId));
757
- }
758
- readPagePathnameSlice(pageId) {
759
- return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.PagePathnameSlice, pageId);
760
- }
761
- async fetchPagePathnameSlice(pageId) {
762
- return await this.makeswiftApiClient.dispatch(fetchAPIResource(types.APIResourceType.PagePathnameSlice, pageId));
763
- }
764
- readTable(tableId) {
765
- return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.Table, tableId);
766
- }
767
- async fetchTable(tableId) {
768
- return await this.makeswiftApiClient.dispatch(fetchAPIResource(types.APIResourceType.Table, tableId));
769
- }
770
- async createTableRecord(tableId, columns) {
771
- await this.graphqlClient.request(CreateTableRecordMutation, {
772
- input: {
773
- data: {
774
- tableId,
775
- columns
776
- }
777
- }
778
- });
779
- }
780
- readSite(siteId) {
781
- return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.Site, siteId);
782
- }
783
- readPage(pageId) {
784
- return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.Page, pageId);
785
- }
786
- readSnippet(snippetId) {
787
- return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.Snippet, snippetId);
788
- }
789
- }
790
- const Context$1 = React.createContext(new MakeswiftClient({
791
- uri: "https://api.makeswift.com/graphql"
792
- }));
793
- function useMakeswiftClient() {
794
- return React.useContext(Context$1);
795
- }
796
- function MakeswiftProvider({
797
- client,
798
- children
799
- }) {
800
- return /* @__PURE__ */ jsxRuntime.jsx(Context$1.Provider, {
801
- value: client,
802
- children
803
- });
804
- }
805
148
  const SnippetLocation = {
806
149
  Body: "BODY",
807
150
  Head: "HEAD"
@@ -849,7 +192,7 @@ function Page$1({
849
192
  return;
850
193
  const oldSnippets = snippets.map(filterUsedSnippetProperties);
851
194
  const newSnippets = cachedPage.snippets.map(filterUsedSnippetProperties);
852
- if (deepEqual(newSnippets, oldSnippets))
195
+ if (responsiveStyle.deepEqual(newSnippets, oldSnippets))
853
196
  return;
854
197
  setSnippets(cachedPage.snippets);
855
198
  }, [cachedPage]);
@@ -991,22 +334,22 @@ function Page$1({
991
334
  });
992
335
  }
993
336
  function useCachedPage(pageId) {
994
- const client = useMakeswiftClient();
337
+ const client = responsiveStyle.useMakeswiftClient();
995
338
  const getSnapshot = () => pageId == null ? null : client.readPage(pageId);
996
339
  const page = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
997
340
  return page;
998
341
  }
999
342
  function useCachedSite(siteId) {
1000
- const client = useMakeswiftClient();
343
+ const client = responsiveStyle.useMakeswiftClient();
1001
344
  const getSnapshot = () => siteId == null ? null : client.readSite(siteId);
1002
345
  const site = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
1003
346
  return site;
1004
347
  }
1005
- const version = "0.0.0-20230407200421";
1006
348
  class Makeswift {
1007
349
  constructor(apiKey, { apiOrigin = "https://api.makeswift.com" } = {}) {
1008
350
  __publicField(this, "apiKey");
1009
351
  __publicField(this, "apiOrigin");
352
+ __publicField(this, "graphqlClient");
1010
353
  if (typeof apiKey !== "string") {
1011
354
  throw new Error(`The Makeswift client must be passed a valid Makeswift site API key: \`new Makeswift('<makeswift_site_api_key>')\`
1012
355
  Received "${apiKey}" instead.`);
@@ -1017,6 +360,7 @@ Received "${apiKey}" instead.`);
1017
360
  } catch {
1018
361
  throw new Error(`The Makeswift client received an invalid \`apiOrigin\` parameter: "${apiOrigin}".`);
1019
362
  }
363
+ this.graphqlClient = new responsiveStyle.GraphQLClient(new URL("graphql", apiOrigin).href);
1020
364
  }
1021
365
  async fetch(path, init) {
1022
366
  const response = await fetch(new URL(path, this.apiOrigin).toString(), __spreadProps(__spreadValues({}, init), {
@@ -1033,9 +377,149 @@ Received "${apiKey}" instead.`);
1033
377
  const json = await response.json();
1034
378
  return json;
1035
379
  }
380
+ async getTypographies(typographyIds) {
381
+ const result = await this.graphqlClient.request(responsiveStyle.TypographiesQuery, { typographyIds });
382
+ return result.typographies;
383
+ }
384
+ async getIntrospectedResources(introspectedResourceIds) {
385
+ const result = await this.graphqlClient.request(responsiveStyle.IntrospectedResourcesQuery, introspectedResourceIds);
386
+ return result;
387
+ }
388
+ async introspect(element) {
389
+ const descriptors = constants.getPropControllerDescriptors(storeContextDefaultValue.getState());
390
+ const swatchIds = /* @__PURE__ */ new Set();
391
+ const fileIds = /* @__PURE__ */ new Set();
392
+ const typographyIds = /* @__PURE__ */ new Set();
393
+ const tableIds = /* @__PURE__ */ new Set();
394
+ const pageIds = /* @__PURE__ */ new Set();
395
+ const globalElements = /* @__PURE__ */ new Map();
396
+ const remaining = [element];
397
+ const seen = /* @__PURE__ */ new Set();
398
+ let current;
399
+ while (current = remaining.pop()) {
400
+ let getResourcesFromElementDescriptors = function(elementDescriptors2, props) {
401
+ Object.entries(elementDescriptors2).forEach(([propName, descriptor]) => {
402
+ introspection.getElementSwatchIds(descriptor, props[propName]).forEach((swatchId) => {
403
+ swatchIds.add(swatchId);
404
+ });
405
+ introspection.getFileIds(descriptor, props[propName]).forEach((fileId) => fileIds.add(fileId));
406
+ introspection.getTypographyIds(descriptor, props[propName]).forEach((typographyId) => typographyIds.add(typographyId));
407
+ introspection.getTableIds(descriptor, props[propName]).forEach((tableId) => tableIds.add(tableId));
408
+ introspection.getPageIds(descriptor, props[propName]).forEach((pageId) => pageIds.add(pageId));
409
+ introspection.getElementChildren(descriptor, props[propName]).forEach((child) => {
410
+ if (!seen.has(child.key)) {
411
+ seen.add(child.key);
412
+ remaining.push(child);
413
+ }
414
+ });
415
+ if (descriptor.type === richText.ShapeControlType) {
416
+ const prop = props[propName];
417
+ if (prop == null)
418
+ return;
419
+ getResourcesFromElementDescriptors(descriptor.config.type, prop);
420
+ }
421
+ if (descriptor.type === richText.ListControlType) {
422
+ const prop = props[propName];
423
+ if (prop == null)
424
+ return;
425
+ prop.forEach((item) => {
426
+ getResourcesFromElementDescriptors({ propName: descriptor.config.type }, { propName: item.value });
427
+ });
428
+ }
429
+ if (descriptor.type === types$1.Types.Shape) {
430
+ const prop = props[propName];
431
+ if (prop == null)
432
+ return;
433
+ getResourcesFromElementDescriptors(descriptor.options.type, prop);
434
+ }
435
+ if (descriptor.type === types$1.Types.List) {
436
+ const prop = props[propName];
437
+ if (prop == null)
438
+ return;
439
+ prop.forEach((item) => {
440
+ getResourcesFromElementDescriptors({ propName: descriptor.options.type }, { propName: item.value });
441
+ });
442
+ }
443
+ });
444
+ };
445
+ let element2;
446
+ if (constants.isElementReference(current)) {
447
+ const globalElement = await this.getGlobalElement(current.value);
448
+ globalElements.set(current.value, globalElement);
449
+ const elementData = globalElement == null ? void 0 : globalElement.data;
450
+ if (elementData == null)
451
+ continue;
452
+ element2 = elementData;
453
+ } else {
454
+ element2 = current;
455
+ }
456
+ const elementDescriptors = descriptors.get(element2.type);
457
+ if (elementDescriptors == null)
458
+ continue;
459
+ getResourcesFromElementDescriptors(elementDescriptors, element2.props);
460
+ }
461
+ const typographies = await this.getTypographies([...typographyIds]);
462
+ typographies.forEach((typography) => {
463
+ typography == null ? void 0 : typography.style.forEach((style) => {
464
+ var _a;
465
+ const swatchId = (_a = style.value.color) == null ? void 0 : _a.swatchId;
466
+ if (swatchId != null)
467
+ swatchIds.add(swatchId);
468
+ });
469
+ });
470
+ const { swatches, files, tables, pagePathnamesById } = await this.getIntrospectedResources({
471
+ swatchIds: [...swatchIds],
472
+ fileIds: [...fileIds],
473
+ tableIds: [...tableIds],
474
+ pageIds: [...pageIds]
475
+ });
476
+ const pagePathnameSlices = pagePathnamesById.map((pagePathnameSlice) => pagePathnameSlice && __spreadProps(__spreadValues({}, pagePathnameSlice), {
477
+ id: Buffer.from(`Page:${pagePathnameSlice.id}`).toString("base64")
478
+ }));
479
+ return {
480
+ [types.APIResourceType.Swatch]: [...swatchIds].map((id) => {
481
+ var _a;
482
+ return {
483
+ id,
484
+ value: (_a = swatches.find((swatch) => (swatch == null ? void 0 : swatch.id) === id)) != null ? _a : null
485
+ };
486
+ }),
487
+ [types.APIResourceType.File]: [...fileIds].map((id) => {
488
+ var _a;
489
+ return {
490
+ id,
491
+ value: (_a = files.find((file) => (file == null ? void 0 : file.id) === id)) != null ? _a : null
492
+ };
493
+ }),
494
+ [types.APIResourceType.Typography]: [...typographyIds].map((id) => {
495
+ var _a;
496
+ return {
497
+ id,
498
+ value: (_a = typographies.find((typography) => (typography == null ? void 0 : typography.id) === id)) != null ? _a : null
499
+ };
500
+ }),
501
+ [types.APIResourceType.Table]: [...tableIds].map((id) => {
502
+ var _a;
503
+ return {
504
+ id,
505
+ value: (_a = tables.find((table) => (table == null ? void 0 : table.id) === id)) != null ? _a : null
506
+ };
507
+ }),
508
+ [types.APIResourceType.PagePathnameSlice]: [...pageIds].map((id) => {
509
+ var _a;
510
+ return {
511
+ id,
512
+ value: (_a = pagePathnameSlices.find((pagePathnameSlice) => (pagePathnameSlice == null ? void 0 : pagePathnameSlice.id) === id)) != null ? _a : null
513
+ };
514
+ }),
515
+ [types.APIResourceType.GlobalElement]: [...globalElements.entries()].map(([id, value]) => ({
516
+ id,
517
+ value
518
+ }))
519
+ };
520
+ }
1036
521
  async createSnapshot(document2, preview) {
1037
- const client = new MakeswiftClient({ uri: new URL("graphql", this.apiOrigin).href });
1038
- const cacheData = await client.prefetch(document2.data);
522
+ const cacheData = await this.introspect(document2.data);
1039
523
  return { document: document2, apiOrigin: this.apiOrigin.href, cacheData, preview };
1040
524
  }
1041
525
  async getPageSnapshotByPageId(pageId, { preview = false } = {}) {
@@ -1056,161 +540,30 @@ Received "${apiKey}" instead.`);
1056
540
  const snapshot = this.getPageSnapshotByPageId(page.id, { preview });
1057
541
  return snapshot;
1058
542
  }
1059
- async unstable_getPageData(path, { preview } = {}) {
1060
- const [page] = await this.getPages({ path });
1061
- if (page == null)
1062
- return null;
1063
- const document2 = await this.getDocumentForPage(page.id);
1064
- const snapshot = await this.unstable_createSnapshotOnDemand({ document: document2, pageId: page.id });
1065
- return {
1066
- pageId: page.id,
1067
- siteId: document2.site.id,
1068
- snapshot,
1069
- options: { preview: preview || false, apiOrigin: this.apiOrigin.href }
1070
- };
543
+ async getSwatch(swatchId) {
544
+ const result = await this.graphqlClient.request(responsiveStyle.SwatchQuery, { swatchId });
545
+ return result.swatch;
1071
546
  }
1072
- async getDocumentForPage(pageId) {
1073
- const response = await this.fetch(`/v1/pages/${pageId}/document?preview=false`);
1074
- if (!response.ok) {
1075
- if (response.status === 404)
1076
- throw Error("Document not found.");
1077
- throw new Error(`Failed to create snapshot with error: "${response.statusText}"`);
1078
- }
1079
- const document2 = await response.json();
1080
- return document2;
547
+ async getFile(fileId) {
548
+ const result = await this.graphqlClient.request(responsiveStyle.FileQuery, { fileId });
549
+ return result.file;
1081
550
  }
1082
- async unstable_createSnapshotOnDemand({
1083
- document: document2,
1084
- pageId
1085
- }) {
1086
- let fetchedDocument = document2;
1087
- if (fetchedDocument == null) {
1088
- const response = await this.fetch(`/v1/pages/${pageId}/document?preview=false`);
1089
- if (!response.ok) {
1090
- if (response.status === 404) {
1091
- throw new Error("Not found");
1092
- }
1093
- throw new Error(`Failed to create snapshot with error: "${response.statusText}"`);
1094
- }
1095
- fetchedDocument = await response.json();
1096
- }
1097
- if (fetchedDocument == null) {
1098
- throw Error("fetchedDocument should never be null");
1099
- }
1100
- const client = new MakeswiftClient({ uri: new URL("graphql", this.apiOrigin).href });
1101
- const prefetchedResources = await client.prefetch(fetchedDocument.data);
1102
- const resources = normalizeToMakeswiftResources(getSnapshotResourcesFromSerializedState(prefetchedResources));
1103
- resources.snippets = fetchedDocument.snippets.map((snippet) => ({
1104
- id: snippet.id,
1105
- value: snippet
1106
- }));
1107
- resources.pageMetadata = fetchedDocument.meta;
1108
- resources.pageSeo = fetchedDocument.seo;
1109
- resources.fonts = fetchedDocument.fonts.map((font) => ({ id: font.family, value: font }));
1110
- return { resources, elementTree: fetchedDocument.data, runtimeVersion: version };
551
+ async getTypography(typographyId) {
552
+ const result = await this.graphqlClient.request(responsiveStyle.TypographyQuery, { typographyId });
553
+ return result.typography;
1111
554
  }
1112
- async unstable_createSnapshot({
1113
- publishedResources,
1114
- deletedResources,
1115
- publishedElementTree,
1116
- currentSnapshot
1117
- }) {
1118
- const client = new MakeswiftClient({ uri: new URL("graphql", this.apiOrigin).href });
1119
- function mergeResources({
1120
- resourcesFromPublishedElementTree: resourcesFromPublishedElementTree2,
1121
- resourcesFromCurrentSnapshot: resourcesFromCurrentSnapshot2,
1122
- publishedResources: publishedResources2,
1123
- deletedResources: deletedResources2
1124
- }) {
1125
- function mergeIdSpecifiedResource(resourceSet, deletedResources3) {
1126
- const map = new Map(resourceSet.map(({ id, value }) => [id, value]));
1127
- deletedResources3 == null ? void 0 : deletedResources3.forEach((id) => map.delete(id));
1128
- const finalResourceSet = [];
1129
- Array.from(map.entries()).forEach(([id, value]) => {
1130
- if (value != null) {
1131
- finalResourceSet.push({ id, value });
1132
- }
1133
- });
1134
- return finalResourceSet;
1135
- }
1136
- const resources2 = {
1137
- swatches: mergeIdSpecifiedResource([
1138
- ...resourcesFromPublishedElementTree2.swatches,
1139
- ...resourcesFromCurrentSnapshot2.swatches,
1140
- ...publishedResources2.swatches
1141
- ], deletedResources2 == null ? void 0 : deletedResources2.swatches),
1142
- files: mergeIdSpecifiedResource([
1143
- ...resourcesFromPublishedElementTree2.files,
1144
- ...resourcesFromCurrentSnapshot2.files,
1145
- ...publishedResources2.files
1146
- ], deletedResources2 == null ? void 0 : deletedResources2.files),
1147
- tables: mergeIdSpecifiedResource([
1148
- ...resourcesFromPublishedElementTree2.tables,
1149
- ...resourcesFromCurrentSnapshot2.tables,
1150
- ...publishedResources2.tables
1151
- ], deletedResources2 == null ? void 0 : deletedResources2.tables),
1152
- typographies: mergeIdSpecifiedResource([
1153
- ...resourcesFromPublishedElementTree2.typographies,
1154
- ...resourcesFromCurrentSnapshot2.typographies,
1155
- ...publishedResources2.typographies
1156
- ], deletedResources2 == null ? void 0 : deletedResources2.typographies),
1157
- pagePathnameSlices: mergeIdSpecifiedResource([
1158
- ...resourcesFromPublishedElementTree2.pagePathnameSlices,
1159
- ...resourcesFromCurrentSnapshot2.pagePathnameSlices,
1160
- ...publishedResources2.pagePathnameSlices
1161
- ], deletedResources2 == null ? void 0 : deletedResources2.pagePathnameSlices),
1162
- globalElements: mergeIdSpecifiedResource([
1163
- ...resourcesFromPublishedElementTree2.globalElements,
1164
- ...resourcesFromCurrentSnapshot2.globalElements,
1165
- ...publishedResources2.globalElements
1166
- ], deletedResources2 == null ? void 0 : deletedResources2.globalElements),
1167
- snippets: mergeIdSpecifiedResource([
1168
- ...resourcesFromPublishedElementTree2.snippets,
1169
- ...resourcesFromCurrentSnapshot2.snippets,
1170
- ...publishedResources2.snippets
1171
- ], deletedResources2 == null ? void 0 : deletedResources2.snippets),
1172
- fonts: mergeIdSpecifiedResource([
1173
- ...resourcesFromPublishedElementTree2.fonts,
1174
- ...resourcesFromCurrentSnapshot2.fonts,
1175
- ...publishedResources2.fonts
1176
- ], deletedResources2 == null ? void 0 : deletedResources2.fonts),
1177
- pageMetadata: __spreadValues(__spreadValues({}, resourcesFromCurrentSnapshot2.pageMetadata), publishedResources2.pageMetadata),
1178
- pageSeo: __spreadValues(__spreadValues({}, resourcesFromCurrentSnapshot2.pageSeo), publishedResources2.pageSeo)
1179
- };
1180
- return resources2;
1181
- }
1182
- const resourcesFromPublishedElementTree = publishedElementTree != null ? normalizeToMakeswiftResources(getSnapshotResourcesFromSerializedState(await client.prefetch(publishedElementTree))) : normalizeToMakeswiftResources({});
1183
- const resourcesFromCurrentSnapshot = normalizeToMakeswiftResources((currentSnapshot == null ? void 0 : currentSnapshot.resources) || {});
1184
- const resources = mergeResources({
1185
- resourcesFromPublishedElementTree,
1186
- resourcesFromCurrentSnapshot,
1187
- publishedResources: normalizeToMakeswiftResources(publishedResources),
1188
- deletedResources
1189
- });
1190
- const elementTree = publishedElementTree || (currentSnapshot == null ? void 0 : currentSnapshot.elementTree);
1191
- if (elementTree == null) {
1192
- throw Error("elementTree should not be null; something went wrong.");
1193
- }
1194
- return {
1195
- resources,
1196
- elementTree,
1197
- runtimeVersion: version
1198
- };
555
+ async getGlobalElement(globalElementId) {
556
+ const result = await this.graphqlClient.request(responsiveStyle.GlobalElementQuery, { globalElementId });
557
+ return result.globalElement;
1199
558
  }
1200
- unstable_getSnapshotResourceMapping(snapshot) {
1201
- const resources = snapshot.resources;
1202
- function parseResourceIds({ id }) {
1203
- return id;
1204
- }
1205
- return [
1206
- ...resources.swatches.map(parseResourceIds),
1207
- ...resources.files.map(parseResourceIds),
1208
- ...resources.tables.map(parseResourceIds),
1209
- ...resources.typographies.map(parseResourceIds),
1210
- ...resources.pagePathnameSlices.map(parseResourceIds),
1211
- ...resources.globalElements.map(parseResourceIds),
1212
- ...resources.snippets.map(parseResourceIds)
1213
- ];
559
+ async getPagePathnameSlice(pageId) {
560
+ var _a;
561
+ const result = await this.graphqlClient.request(responsiveStyle.PagePathnamesByIdQuery, { pageIds: [pageId] });
562
+ return (_a = result.pagePathnamesById.at(0)) != null ? _a : null;
563
+ }
564
+ async getTable(tableId) {
565
+ const result = await this.graphqlClient.request(responsiveStyle.TableQuery, { tableId });
566
+ return result.table;
1214
567
  }
1215
568
  }
1216
569
  function PreviewModeScript({
@@ -1340,28 +693,111 @@ class Document$1 extends NextDocument__default["default"] {
1340
693
  });
1341
694
  }
1342
695
  }
696
+ async function elementTree(req, res) {
697
+ const elementTree2 = req.body.elementTree;
698
+ const replacementContext = req.body.replacementContext;
699
+ if (elementTree2 == null) {
700
+ return res.status(400).json({ message: "elementTree must be defined" });
701
+ }
702
+ if (replacementContext == null) {
703
+ return res.status(400).json({ message: "replacementContext must be defined" });
704
+ }
705
+ const generatedElementTree = ReactRuntime.copyElementTree(elementTree2, replacementContext);
706
+ const response = { elementTree: generatedElementTree };
707
+ return res.json(response);
708
+ }
709
+ async function fonts(_req, res, { getFonts } = {}) {
710
+ var _a;
711
+ const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
712
+ return res.json(fonts2);
713
+ }
714
+ const version = "0.0.0-20230410231005";
715
+ async function handler(req, res, { apiKey }) {
716
+ if (req.query.secret !== apiKey) {
717
+ return res.status(401).json({ message: "Unauthorized" });
718
+ }
719
+ return res.json({
720
+ version,
721
+ previewMode: true,
722
+ interactionMode: true,
723
+ clientSideNavigation: true,
724
+ elementFromPoint: false
725
+ });
726
+ }
727
+ const previewModeProxy = httpProxy.createProxyServer();
728
+ async function proxyPreviewMode(req, res, { apiKey }) {
729
+ previewModeProxy.on("proxyReq", (proxyReq) => {
730
+ proxyReq.removeHeader("X-Makeswift-Preview-Mode");
731
+ const url = new URL(proxyReq.path, "http://n");
732
+ url.searchParams.delete("x-makeswift-preview-mode");
733
+ proxyReq.path = url.pathname + url.search;
734
+ });
735
+ if (req.query.secret !== apiKey)
736
+ return res.status(401).send("Unauthorized");
737
+ const host = req.headers.host;
738
+ if (host == null)
739
+ return res.status(400).send("Bad Request");
740
+ const forwardedProto = req.headers["x-forwarded-proto"];
741
+ const isForwardedProtoHttps = typeof forwardedProto === "string" && forwardedProto === "https";
742
+ const forwardedSSL = req.headers["x-forwarded-ssl"];
743
+ const isForwardedSSL = typeof forwardedSSL === "string" && forwardedSSL === "on";
744
+ const proto = isForwardedProtoHttps || isForwardedSSL ? "https" : "http";
745
+ let target = `${proto}://${host}`;
746
+ if (process.env["NODE_ENV"] !== "production") {
747
+ const port = req.socket.localPort;
748
+ if (port != null)
749
+ target = `http://localhost:${port}`;
750
+ }
751
+ const setCookie = res.setPreviewData({ makeswift: true }).getHeader("Set-Cookie");
752
+ res.removeHeader("Set-Cookie");
753
+ if (!Array.isArray(setCookie))
754
+ return res.status(500).send("Internal Server Error");
755
+ const cookie$1 = setCookieParser.parse(setCookie).map((cookie2) => cookie.serialize(cookie2.name, cookie2.value, cookie2)).join(";");
756
+ return await new Promise((resolve2, reject) => previewModeProxy.web(req, res, { target, headers: { cookie: cookie$1 } }, (err) => {
757
+ if (err)
758
+ reject(err);
759
+ else
760
+ resolve2();
761
+ }));
762
+ }
1343
763
  function isErrorWithMessage(error) {
1344
764
  return typeof error === "object" && error !== null && "message" in error && typeof error.message === "string";
1345
765
  }
766
+ async function revalidate(req, res, { apiKey }) {
767
+ if (req.query.secret !== apiKey) {
768
+ return res.status(401).json({ message: "Unauthorized" });
769
+ }
770
+ if (typeof req.query.path !== "string") {
771
+ return res.status(400).json({ message: "Bad Request" });
772
+ }
773
+ const revalidate2 = res.revalidate;
774
+ if (typeof revalidate2 !== "function") {
775
+ const message = `Cannot revalidate path "${req.query.path}" because \`revalidate\` function does not exist in API handler response. Please update to Next.js v12.2.0 or higher for support for on-demand revalidation.
776
+ Read more here: https://nextjs.org/blog/next-12-2#on-demand-incremental-static-regeneration-stable`;
777
+ console.warn(message);
778
+ return res.json({ revalidated: false });
779
+ }
780
+ try {
781
+ await revalidate2(req.query.path);
782
+ return res.json({ revalidated: true });
783
+ } catch (error) {
784
+ if (isErrorWithMessage(error)) {
785
+ return res.status(500).json({ message: error.message });
786
+ }
787
+ return res.status(500).json({ message: "Error Revalidating" });
788
+ }
789
+ }
1346
790
  function MakeswiftApiHandler(apiKey, {
1347
791
  appOrigin = "https://app.makeswift.com",
1348
792
  apiOrigin = "https://api.makeswift.com",
1349
793
  getFonts
1350
794
  } = {}) {
1351
795
  const cors = Cors__default["default"]({ origin: appOrigin });
1352
- const previewModeProxy = httpProxy.createProxyServer();
1353
- previewModeProxy.on("proxyReq", (proxyReq) => {
1354
- proxyReq.removeHeader("X-Makeswift-Preview-Mode");
1355
- const url = new URL(proxyReq.path, "http://n");
1356
- url.searchParams.delete("x-makeswift-preview-mode");
1357
- proxyReq.path = url.pathname + url.search;
1358
- });
1359
796
  if (typeof apiKey !== "string") {
1360
797
  throw new Error(`The Makeswift Next.js API handler must be passed a valid Makeswift site API key: \`MakeswiftApiHandler('<makeswift_site_api_key>')\`
1361
798
  Received "${apiKey}" instead.`);
1362
799
  }
1363
800
  return async function makeswiftApiHandler(req, res) {
1364
- var _a;
1365
801
  await new Promise((resolve2, reject) => {
1366
802
  cors(req, res, (err) => {
1367
803
  if (err instanceof Error)
@@ -1376,224 +812,40 @@ Received "${apiKey}" instead.`);
1376
812
  Received "${makeswift}" for the \`makeswift\` param instead.
1377
813
  Read more about dynamic catch-all routes here: https://nextjs.org/docs/routing/dynamic-routes#catch-all-routes`);
1378
814
  }
1379
- const action = makeswift.join("/");
1380
- switch (action) {
1381
- case "manifest": {
1382
- if (req.query.secret !== apiKey)
1383
- return res.status(401).json({ message: "Unauthorized" });
1384
- return res.json({
1385
- version,
1386
- previewMode: true,
1387
- interactionMode: true,
1388
- clientSideNavigation: true,
1389
- elementFromPoint: false
1390
- });
1391
- }
1392
- case "revalidate": {
1393
- if (req.query.secret !== apiKey) {
1394
- return res.status(401).json({ message: "Unauthorized" });
1395
- }
1396
- if (typeof req.query.path !== "string") {
1397
- return res.status(400).json({ message: "Bad Request" });
1398
- }
1399
- const revalidate = res.revalidate;
1400
- if (typeof revalidate !== "function") {
1401
- const message = `Cannot revalidate path "${req.query.path}" because \`revalidate\` function does not exist in API handler response. Please update to Next.js v12.2.0 or higher for support for on-demand revalidation.
1402
- Read more here: https://nextjs.org/blog/next-12-2#on-demand-incremental-static-regeneration-stable`;
1403
- console.warn(message);
1404
- return res.json({ revalidated: false });
1405
- }
1406
- try {
1407
- await revalidate(req.query.path);
1408
- return res.json({ revalidated: true });
1409
- } catch (error) {
1410
- if (isErrorWithMessage(error)) {
1411
- return res.status(500).json({ message: error.message });
1412
- }
1413
- return res.status(500).json({ message: "Error Revalidating" });
1414
- }
1415
- }
1416
- case "proxy-preview-mode": {
1417
- if (req.query.secret !== apiKey)
1418
- return res.status(401).send("Unauthorized");
1419
- const host = req.headers.host;
1420
- if (host == null)
1421
- return res.status(400).send("Bad Request");
1422
- const forwardedProto = req.headers["x-forwarded-proto"];
1423
- const isForwardedProtoHttps = typeof forwardedProto === "string" && forwardedProto === "https";
1424
- const forwardedSSL = req.headers["x-forwarded-ssl"];
1425
- const isForwardedSSL = typeof forwardedSSL === "string" && forwardedSSL === "on";
1426
- const proto = isForwardedProtoHttps || isForwardedSSL ? "https" : "http";
1427
- let target = `${proto}://${host}`;
1428
- if (process.env["NODE_ENV"] !== "production") {
1429
- const port = req.socket.localPort;
1430
- if (port != null)
1431
- target = `http://localhost:${port}`;
1432
- }
1433
- const setCookie = res.setPreviewData({ makeswift: true }).getHeader("Set-Cookie");
1434
- res.removeHeader("Set-Cookie");
1435
- if (!Array.isArray(setCookie))
1436
- return res.status(500).send("Internal Server Error");
1437
- const cookie$1 = setCookieParser.parse(setCookie).map((cookie2) => cookie.serialize(cookie2.name, cookie2.value, cookie2)).join(";");
1438
- return await new Promise((resolve2, reject) => previewModeProxy.web(req, res, { target, headers: { cookie: cookie$1 } }, (err) => {
1439
- if (err)
1440
- reject(err);
1441
- else
1442
- resolve2();
1443
- }));
1444
- }
1445
- case "fonts": {
1446
- const fonts = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
1447
- return res.json(fonts);
1448
- }
1449
- case "element-tree": {
1450
- const elementTree = req.body.elementTree;
1451
- const replacementContext = req.body.replacementContext;
1452
- if (elementTree == null) {
1453
- return res.status(400).json({ message: "elementTree must be defined" });
1454
- }
1455
- if (replacementContext == null) {
1456
- return res.status(400).json({ message: "replacementContext must be defined" });
1457
- }
1458
- const generatedElementTree = ReactRuntime.copyElementTree(elementTree, replacementContext);
1459
- const response = { elementTree: generatedElementTree };
1460
- return res.json(response);
1461
- }
1462
- case "snapshot": {
1463
- let validateBody = function(body2) {
1464
- if (body2.pageId == null) {
1465
- return res.status(400).json({ message: "Must define pageId." });
1466
- }
1467
- if (body2.currentSnapshot == null && body2.publishedElementTree == null) {
1468
- return res.status(400).json({ message: "Either currentSnapshot or publishedElementTree must be defined." });
1469
- }
1470
- };
1471
- const body = req.body;
1472
- validateBody(body);
1473
- const client = new Makeswift(apiKey, {
1474
- apiOrigin
1475
- });
1476
- const makeswiftApiClient = new MakeswiftClient({ uri: new URL("graphql", apiOrigin).href });
1477
- async function formMakeswiftResources(publishedResources) {
1478
- var _a2, _b, _c2, _d, _e, _f, _g, _h;
1479
- const publishedResourcesInMakeswiftSnapshotFormat = {
1480
- swatches: [],
1481
- typographies: [],
1482
- files: [],
1483
- tables: [],
1484
- pagePathnameSlices: [],
1485
- globalElements: [],
1486
- snippets: [],
1487
- fonts: [],
1488
- pageMetadata: publishedResources == null ? void 0 : publishedResources.pageMetadata,
1489
- pageSeo: publishedResources == null ? void 0 : publishedResources.pageSeo
1490
- };
1491
- if (publishedResources == null) {
1492
- return publishedResourcesInMakeswiftSnapshotFormat;
1493
- }
1494
- for await (const swatchId of publishedResources.swatches || []) {
1495
- const swatch = await makeswiftApiClient.fetchSwatch(swatchId);
1496
- if (swatch != null) {
1497
- (_a2 = publishedResourcesInMakeswiftSnapshotFormat.swatches) == null ? void 0 : _a2.push({
1498
- id: swatchId,
1499
- value: swatch
1500
- });
1501
- }
1502
- }
1503
- for await (const typographyId of publishedResources.typographies || []) {
1504
- const typography = await makeswiftApiClient.fetchTypography(typographyId);
1505
- if (typography != null) {
1506
- (_b = publishedResourcesInMakeswiftSnapshotFormat.typographies) == null ? void 0 : _b.push({
1507
- id: typographyId,
1508
- value: typography
1509
- });
1510
- }
1511
- }
1512
- for await (const fileId of publishedResources.files || []) {
1513
- const file = await makeswiftApiClient.fetchFile(fileId);
1514
- if (file != null) {
1515
- (_c2 = publishedResourcesInMakeswiftSnapshotFormat.files) == null ? void 0 : _c2.push({
1516
- id: fileId,
1517
- value: fileToFileSnapshot(file)
1518
- });
1519
- }
1520
- }
1521
- for await (const tableId of publishedResources.tables || []) {
1522
- const table = await makeswiftApiClient.fetchTable(tableId);
1523
- if (table != null) {
1524
- (_d = publishedResourcesInMakeswiftSnapshotFormat.tables) == null ? void 0 : _d.push({
1525
- id: tableId,
1526
- value: table
1527
- });
1528
- }
1529
- }
1530
- for await (const pageId of publishedResources.pagePathnameSlices || []) {
1531
- const pagePathnameSlice = await makeswiftApiClient.fetchPagePathnameSlice(pageId);
1532
- if (pagePathnameSlice != null) {
1533
- (_e = publishedResourcesInMakeswiftSnapshotFormat.pagePathnameSlices) == null ? void 0 : _e.push({
1534
- id: pageId,
1535
- value: pagePathnameSlice
1536
- });
1537
- }
1538
- }
1539
- for await (const globalElementId of publishedResources.globalElements || []) {
1540
- const globalElement = await makeswiftApiClient.fetchGlobalElement(globalElementId);
1541
- if (globalElement != null) {
1542
- (_f = publishedResourcesInMakeswiftSnapshotFormat.globalElements) == null ? void 0 : _f.push({
1543
- id: globalElementId,
1544
- value: globalElement
1545
- });
1546
- }
1547
- }
1548
- if (publishedResources.snippets != null || publishedResources.fonts != null) {
1549
- const response2 = await fetch(new URL(`/v1/pages/${body.pageId}/document?preview=false`, apiOrigin).toString(), {
1550
- headers: { ["X-API-Key"]: apiKey }
1551
- });
1552
- if (!response2.ok) {
1553
- throw new Error(`Failed to hit live page endpoint: "${response2.statusText}"`);
1554
- }
1555
- const document2 = await response2.json();
1556
- const availableSnippets = document2.snippets;
1557
- const availableFonts = document2.fonts;
1558
- for await (const snippetId of publishedResources.snippets || []) {
1559
- const snippet = availableSnippets.find((availableSnippet) => availableSnippet.id === snippetId);
1560
- if (snippet != null) {
1561
- (_g = publishedResourcesInMakeswiftSnapshotFormat.snippets) == null ? void 0 : _g.push({
1562
- id: snippetId,
1563
- value: snippet
1564
- });
1565
- }
1566
- }
1567
- for await (const family of publishedResources.fonts || []) {
1568
- const font = availableFonts.find((availableFont) => availableFont.family === family);
1569
- if (font != null) {
1570
- (_h = publishedResourcesInMakeswiftSnapshotFormat.fonts) == null ? void 0 : _h.push({
1571
- id: family,
1572
- value: font
1573
- });
1574
- }
1575
- }
1576
- }
1577
- return publishedResourcesInMakeswiftSnapshotFormat;
1578
- }
1579
- const snapshot = await client.unstable_createSnapshot({
1580
- publishedResources: await formMakeswiftResources(body.publishedResources),
1581
- deletedResources: body.deletedResources,
1582
- publishedElementTree: body.publishedElementTree,
1583
- currentSnapshot: body.currentSnapshot
1584
- });
1585
- const usedResources = client.unstable_getSnapshotResourceMapping(snapshot);
1586
- const response = {
1587
- pageId: body.pageId,
1588
- snapshot,
1589
- livePageChanges: body.livePageChanges,
1590
- usedResources
1591
- };
1592
- return res.json(response);
1593
- }
1594
- default:
1595
- return res.status(404).json({ message: "Not Found" });
1596
- }
815
+ const client = new Makeswift(apiKey, { apiOrigin });
816
+ const action = "/" + makeswift.join("/");
817
+ const matches = (pattern) => pathToRegexp.match(pattern, { decode: decodeURIComponent })(action);
818
+ let m;
819
+ if (matches("/manifest"))
820
+ return handler(req, res, { apiKey });
821
+ if (matches("/revalidate"))
822
+ return revalidate(req, res, { apiKey });
823
+ if (matches("/proxy-preview-mode"))
824
+ return proxyPreviewMode(req, res, { apiKey });
825
+ if (matches("/fonts"))
826
+ return fonts(req, res, { getFonts });
827
+ if (matches("/element-tree"))
828
+ return elementTree(req, res);
829
+ const handleResource = (resource) => resource === null ? res.status(404).json({ message: "Not Found" }) : res.json(resource);
830
+ if (m = matches("/swatches/:id")) {
831
+ return client.getSwatch(m.params.id).then(handleResource);
832
+ }
833
+ if (m = matches("/files/:id")) {
834
+ return client.getFile(m.params.id).then(handleResource);
835
+ }
836
+ if (m = matches("/typographies/:id")) {
837
+ return client.getTypography(m.params.id).then(handleResource);
838
+ }
839
+ if (m = matches("/global-elements/:id")) {
840
+ return client.getGlobalElement(m.params.id).then(handleResource);
841
+ }
842
+ if (m = matches("/page-pathname-slices/:id")) {
843
+ return client.getPagePathnameSlice(m.params.id).then(handleResource);
844
+ }
845
+ if (m = matches("/tables/:id")) {
846
+ return client.getTable(m.params.id).then(handleResource);
847
+ }
848
+ return res.status(404).json({ message: "Not Found" });
1597
849
  };
1598
850
  }
1599
851
  const FORWARDED_NEXT_DYNAMIC_REF_KEY = "__forwarded_next_dynamic_ref__";
@@ -1668,14 +920,14 @@ async function getStaticPaths() {
1668
920
  }
1669
921
  const REVALIDATE_SECONDS = 1;
1670
922
  async function getStaticProps(ctx) {
1671
- var _a, _b, _c2;
923
+ var _a, _b, _c;
1672
924
  deprecationWarning("getStaticProps");
1673
925
  const makeswift = new Makeswift(getApiKey(), {
1674
926
  apiOrigin: getApiOrigin()
1675
927
  });
1676
928
  const path = "/" + ((_b = (_a = ctx.params) == null ? void 0 : _a.path) != null ? _b : []).join("/");
1677
929
  const snapshot = await makeswift.getPageSnapshot(path, {
1678
- preview: ((_c2 = ctx.previewData) == null ? void 0 : _c2.makeswift) === true
930
+ preview: ((_c = ctx.previewData) == null ? void 0 : _c.makeswift) === true
1679
931
  });
1680
932
  if (snapshot == null)
1681
933
  return {
@@ -1712,7 +964,7 @@ async function getServerSideProps(ctx) {
1712
964
  const Page = React.memo(({
1713
965
  snapshot
1714
966
  }) => {
1715
- const client = React.useMemo(() => new MakeswiftClient({
967
+ const client = React.useMemo(() => new responsiveStyle.MakeswiftClient({
1716
968
  uri: new URL("graphql", snapshot.apiOrigin).href,
1717
969
  cacheData: snapshot.cacheData
1718
970
  }), [snapshot]);
@@ -1725,69 +977,6 @@ const Page = React.memo(({
1725
977
  }, snapshot.document.data.key)
1726
978
  });
1727
979
  });
1728
- const keys = (o) => Object.keys(o);
1729
- const coalesce = (...args) => {
1730
- let i;
1731
- for (i = 0; i < args.length - 1; i += 1) {
1732
- if (args[i] != null)
1733
- return args[i];
1734
- }
1735
- return args[i];
1736
- };
1737
- function shallowMerge(a, b) {
1738
- const bKeys = keys(b);
1739
- const merged = __spreadValues({}, a);
1740
- bKeys.forEach((key) => {
1741
- merged[key] = coalesce(merged[key], b[key]);
1742
- });
1743
- return merged;
1744
- }
1745
- const DEVICES = [
1746
- { id: "desktop", minWidth: 769 },
1747
- { id: "tablet", minWidth: 576, maxWidth: 768 },
1748
- { id: "mobile", maxWidth: 575 }
1749
- ];
1750
- const getDevice = (deviceId) => {
1751
- const device = DEVICES.find(({ id }) => id === deviceId);
1752
- if (device == null)
1753
- throw new Error(`Unrecognized device ID: "${deviceId}".`);
1754
- return device;
1755
- };
1756
- function defaultStrategy(value, fallbacks) {
1757
- return value || fallbacks[0];
1758
- }
1759
- function shallowMergeFallbacks(value, fallbacks) {
1760
- return [value, ...fallbacks].filter((override) => Boolean(override)).reduce((a, b) => ({
1761
- deviceId: a.deviceId || b.deviceId,
1762
- value: shallowMerge(a.value, b.value)
1763
- }));
1764
- }
1765
- function findDeviceOverride(values = [], deviceId, strategy = defaultStrategy) {
1766
- const value = values.find(({ deviceId: d }) => d === deviceId);
1767
- const fallbacks = DEVICES.slice(0, DEVICES.findIndex((d) => d.id === deviceId) + 1).reverse().map((d) => values.find((v) => v.deviceId === d.id)).filter((override) => Boolean(override));
1768
- return value != null || fallbacks.length > 0 ? strategy(value, fallbacks) : void 0;
1769
- }
1770
- function join(responsiveValues, joinFn, strategy) {
1771
- return DEVICES.map(({ id }) => id).map((deviceId) => {
1772
- const value = joinFn(responsiveValues.map((responsiveValue) => {
1773
- const deviceValue = responsiveValue && findDeviceOverride(responsiveValue, deviceId, strategy);
1774
- return deviceValue == null ? void 0 : deviceValue.value;
1775
- }));
1776
- if (value == null)
1777
- return null;
1778
- return { deviceId, value };
1779
- }).filter((override) => Boolean(override));
1780
- }
1781
- const getDeviceMediaQuery = (device) => {
1782
- const parts = ["@media only screen"];
1783
- if (device.minWidth != null) {
1784
- parts.push(`(min-width: ${device.minWidth}px)`);
1785
- }
1786
- if (device.maxWidth != null) {
1787
- parts.push(`(max-width: ${device.maxWidth}px)`);
1788
- }
1789
- return parts.join(" and ");
1790
- };
1791
980
  const DEFAULT_BOX_ANIMATE_TYPE = "none";
1792
981
  const DEFAULT_BOX_ANIMATE_DELAY = 0;
1793
982
  const DEFAULT_BOX_ANIMATE_DURATION = 0.75;
@@ -1799,7 +988,7 @@ function registerComponent$c(runtime) {
1799
988
  function isHiddenBasedOnAnimationType(props, deviceId, property) {
1800
989
  var _a, _b;
1801
990
  const animateIn = props[property];
1802
- return ((_b = (_a = findDeviceOverride(animateIn, deviceId)) == null ? void 0 : _a.value) != null ? _b : "none") === "none";
991
+ return ((_b = (_a = responsiveStyle.findDeviceOverride(animateIn, deviceId)) == null ? void 0 : _a.value) != null ? _b : "none") === "none";
1803
992
  }
1804
993
  const isHiddenBasedOnBoxAnimation = (props, deviceId) => isHiddenBasedOnAnimationType(props, deviceId, "boxAnimateType");
1805
994
  const isHiddenBasedOnItemAnimation = (props, deviceId) => isHiddenBasedOnAnimationType(props, deviceId, "itemAnimateType");
@@ -1809,13 +998,13 @@ function registerComponent$c(runtime) {
1809
998
  type: constants.MakeswiftComponentType.Box,
1810
999
  label: "Box",
1811
1000
  props: {
1812
- id: richText.ElementID(),
1813
- backgrounds: richText.Backgrounds(),
1814
- width: richText.Width({
1815
- format: richText.Width.Format.ClassName,
1001
+ id: types$1.ElementID(),
1002
+ backgrounds: types$1.Backgrounds(),
1003
+ width: types$1.Width({
1004
+ format: types$1.Width.Format.ClassName,
1816
1005
  defaultValue: { value: 100, unit: "%" }
1817
1006
  }),
1818
- height: richText.ResponsiveIconRadioGroup({
1007
+ height: types$1.ResponsiveIconRadioGroup({
1819
1008
  label: "Height",
1820
1009
  options: [
1821
1010
  { value: "auto", label: "Auto", icon: "HeightAuto16" },
@@ -1823,7 +1012,7 @@ function registerComponent$c(runtime) {
1823
1012
  ],
1824
1013
  defaultValue: "auto"
1825
1014
  }),
1826
- verticalAlign: richText.ResponsiveIconRadioGroup({
1015
+ verticalAlign: types$1.ResponsiveIconRadioGroup({
1827
1016
  label: "Align items",
1828
1017
  options: [
1829
1018
  { value: "flex-start", label: "Top", icon: "VerticalAlignStart16" },
@@ -1837,9 +1026,9 @@ function registerComponent$c(runtime) {
1837
1026
  ],
1838
1027
  defaultValue: "flex-start"
1839
1028
  }),
1840
- margin: richText.Margin({ format: richText.Margin.Format.ClassName }),
1841
- padding: richText.Padding({
1842
- format: richText.Padding.Format.ClassName,
1029
+ margin: types$1.Margin({ format: types$1.Margin.Format.ClassName }),
1030
+ padding: types$1.Padding({
1031
+ format: types$1.Padding.Format.ClassName,
1843
1032
  preset: [
1844
1033
  {
1845
1034
  deviceId: "desktop",
@@ -1852,16 +1041,16 @@ function registerComponent$c(runtime) {
1852
1041
  }
1853
1042
  ]
1854
1043
  }),
1855
- border: richText.Border({ format: richText.Border.Format.ClassName }),
1856
- borderRadius: richText.BorderRadius({ format: richText.BorderRadius.Format.ClassName }),
1857
- boxShadow: richText.Shadows({ format: richText.Shadows.Format.ClassName }),
1858
- rowGap: richText.GapY((props) => ({
1044
+ border: types$1.Border({ format: types$1.Border.Format.ClassName }),
1045
+ borderRadius: types$1.BorderRadius({ format: types$1.BorderRadius.Format.ClassName }),
1046
+ boxShadow: types$1.Shadows({ format: types$1.Shadows.Format.ClassName }),
1047
+ rowGap: types$1.GapY((props) => ({
1859
1048
  hidden: props.children == null
1860
1049
  })),
1861
- columnGap: richText.GapX((props) => ({
1050
+ columnGap: types$1.GapX((props) => ({
1862
1051
  hidden: props.children == null
1863
1052
  })),
1864
- boxAnimateType: richText.ResponsiveSelect({
1053
+ boxAnimateType: types$1.ResponsiveSelect({
1865
1054
  label: "Animate box in",
1866
1055
  labelOrientation: "vertical",
1867
1056
  options: [
@@ -1877,7 +1066,7 @@ function registerComponent$c(runtime) {
1877
1066
  ],
1878
1067
  defaultValue: "none"
1879
1068
  }),
1880
- boxAnimateDuration: richText.ResponsiveNumber((props, device) => ({
1069
+ boxAnimateDuration: types$1.ResponsiveNumber((props, device) => ({
1881
1070
  label: "Box duration",
1882
1071
  defaultValue: DEFAULT_BOX_ANIMATE_DURATION,
1883
1072
  min: 0.1,
@@ -1885,7 +1074,7 @@ function registerComponent$c(runtime) {
1885
1074
  suffix: "s",
1886
1075
  hidden: isHiddenBasedOnBoxAnimation(props, device)
1887
1076
  })),
1888
- boxAnimateDelay: richText.ResponsiveNumber((props, device) => ({
1077
+ boxAnimateDelay: types$1.ResponsiveNumber((props, device) => ({
1889
1078
  label: "Box delay",
1890
1079
  defaultValue: DEFAULT_BOX_ANIMATE_DELAY,
1891
1080
  min: 0,
@@ -1893,7 +1082,7 @@ function registerComponent$c(runtime) {
1893
1082
  suffix: "s",
1894
1083
  hidden: isHiddenBasedOnBoxAnimation(props, device)
1895
1084
  })),
1896
- itemAnimateType: richText.ResponsiveSelect({
1085
+ itemAnimateType: types$1.ResponsiveSelect({
1897
1086
  label: "Animate items in",
1898
1087
  labelOrientation: "vertical",
1899
1088
  options: [
@@ -1909,7 +1098,7 @@ function registerComponent$c(runtime) {
1909
1098
  ],
1910
1099
  defaultValue: "none"
1911
1100
  }),
1912
- itemAnimateDuration: richText.ResponsiveNumber((props, device) => ({
1101
+ itemAnimateDuration: types$1.ResponsiveNumber((props, device) => ({
1913
1102
  label: "Items duration",
1914
1103
  defaultValue: DEFAULT_BOX_ANIMATE_DURATION,
1915
1104
  min: 0.1,
@@ -1917,7 +1106,7 @@ function registerComponent$c(runtime) {
1917
1106
  suffix: "s",
1918
1107
  hidden: isHiddenBasedOnItemAnimation(props, device)
1919
1108
  })),
1920
- itemAnimateDelay: richText.ResponsiveNumber((props, device) => ({
1109
+ itemAnimateDelay: types$1.ResponsiveNumber((props, device) => ({
1921
1110
  label: "Items delay",
1922
1111
  defaultValue: DEFAULT_ITEM_ANIMATE_DELAY,
1923
1112
  min: 0,
@@ -1925,7 +1114,7 @@ function registerComponent$c(runtime) {
1925
1114
  suffix: "s",
1926
1115
  hidden: isHiddenBasedOnItemAnimation(props, device)
1927
1116
  })),
1928
- itemStaggerDuration: richText.ResponsiveNumber((props, device) => ({
1117
+ itemStaggerDuration: types$1.ResponsiveNumber((props, device) => ({
1929
1118
  label: "Stagger",
1930
1119
  min: 0,
1931
1120
  step: 0.05,
@@ -1933,11 +1122,11 @@ function registerComponent$c(runtime) {
1933
1122
  defaultValue: DEFAULT_ITEM_STAGGER_DURATION,
1934
1123
  hidden: isHiddenBasedOnItemAnimation(props, device)
1935
1124
  })),
1936
- hidePlaceholder: richText.Checkbox((props) => ({
1125
+ hidePlaceholder: types$1.Checkbox((props) => ({
1937
1126
  label: "Hide placeholder",
1938
1127
  hidden: props.children != null
1939
1128
  })),
1940
- children: richText.Grid()
1129
+ children: types$1.Grid()
1941
1130
  }
1942
1131
  });
1943
1132
  }
@@ -1948,9 +1137,9 @@ function registerComponent$b(runtime) {
1948
1137
  type: constants.MakeswiftComponentType.Button,
1949
1138
  label: "Button",
1950
1139
  props: {
1951
- id: richText.ElementID(),
1952
- children: richText.TextInput({ placeholder: "Button text" }),
1953
- link: richText.Link({
1140
+ id: types$1.ElementID(),
1141
+ children: types$1.TextInput({ placeholder: "Button text" }),
1142
+ link: types$1.Link({
1954
1143
  defaultValue: {
1955
1144
  type: "OPEN_PAGE",
1956
1145
  payload: {
@@ -1959,7 +1148,7 @@ function registerComponent$b(runtime) {
1959
1148
  }
1960
1149
  }
1961
1150
  }),
1962
- variant: richText.ResponsiveSelect({
1151
+ variant: types$1.ResponsiveSelect({
1963
1152
  label: "Style",
1964
1153
  labelOrientation: "horizontal",
1965
1154
  options: [
@@ -1973,7 +1162,7 @@ function registerComponent$b(runtime) {
1973
1162
  ],
1974
1163
  defaultValue: "flat"
1975
1164
  }),
1976
- shape: richText.ResponsiveIconRadioGroup({
1165
+ shape: types$1.ResponsiveIconRadioGroup({
1977
1166
  label: "Shape",
1978
1167
  options: [
1979
1168
  { label: "Pill", value: "pill", icon: "ButtonPill16" },
@@ -1982,7 +1171,7 @@ function registerComponent$b(runtime) {
1982
1171
  ],
1983
1172
  defaultValue: "rounded"
1984
1173
  }),
1985
- size: richText.ResponsiveIconRadioGroup({
1174
+ size: types$1.ResponsiveIconRadioGroup({
1986
1175
  label: "Size",
1987
1176
  options: [
1988
1177
  { label: "Small", value: "small", icon: "SizeSmall16" },
@@ -1991,19 +1180,19 @@ function registerComponent$b(runtime) {
1991
1180
  ],
1992
1181
  defaultValue: "medium"
1993
1182
  }),
1994
- color: richText.ResponsiveColor((props, device) => {
1183
+ color: types$1.ResponsiveColor((props, device) => {
1995
1184
  var _a;
1996
1185
  const variant = props.variant;
1997
- const hidden = ((_a = findDeviceOverride(variant, device)) == null ? void 0 : _a.value) === "clear";
1186
+ const hidden = ((_a = responsiveStyle.findDeviceOverride(variant, device)) == null ? void 0 : _a.value) === "clear";
1998
1187
  return { placeholder: "black", hidden };
1999
1188
  }),
2000
- textColor: richText.ResponsiveColor({
1189
+ textColor: types$1.ResponsiveColor({
2001
1190
  label: "Text color",
2002
1191
  placeholder: "white"
2003
1192
  }),
2004
- textStyle: richText.TextStyle(),
2005
- width: richText.Width(),
2006
- margin: richText.Margin({ format: richText.Margin.Format.ClassName })
1193
+ textStyle: types$1.TextStyle(),
1194
+ width: types$1.Width(),
1195
+ margin: types$1.Margin({ format: types$1.Margin.Format.ClassName })
2007
1196
  }
2008
1197
  });
2009
1198
  }
@@ -2015,20 +1204,20 @@ function registerComponent$a(runtime) {
2015
1204
  label: "Carousel",
2016
1205
  icon: "Carousel40",
2017
1206
  props: {
2018
- id: richText.ElementID(),
2019
- images: richText.Images({
1207
+ id: types$1.ElementID(),
1208
+ images: types$1.Images({
2020
1209
  preset: [
2021
1210
  { key: uuid.v4(), props: {} },
2022
1211
  { key: uuid.v4(), props: {} },
2023
1212
  { key: uuid.v4(), props: {} }
2024
1213
  ]
2025
1214
  }),
2026
- width: richText.Width({
2027
- format: richText.Width.Format.ClassName,
1215
+ width: types$1.Width({
1216
+ format: types$1.Width.Format.ClassName,
2028
1217
  defaultValue: { value: 400, unit: "px" }
2029
1218
  }),
2030
- margin: richText.Margin({ format: richText.Margin.Format.ClassName }),
2031
- pageSize: richText.ResponsiveNumber((props) => {
1219
+ margin: types$1.Margin({ format: types$1.Margin.Format.ClassName }),
1220
+ pageSize: types$1.ResponsiveNumber((props) => {
2032
1221
  var _a;
2033
1222
  const images = props.images;
2034
1223
  const imagesLength = (_a = images == null ? void 0 : images.length) != null ? _a : 0;
@@ -2040,10 +1229,10 @@ function registerComponent$a(runtime) {
2040
1229
  step: 1
2041
1230
  };
2042
1231
  }),
2043
- step: richText.ResponsiveNumber((props, device) => {
1232
+ step: types$1.ResponsiveNumber((props, device) => {
2044
1233
  var _a, _b;
2045
1234
  const pageSize = props.pageSize;
2046
- const pageSizeValue = (_b = (_a = findDeviceOverride(pageSize, device)) == null ? void 0 : _a.value) != null ? _b : 1;
1235
+ const pageSizeValue = (_b = (_a = responsiveStyle.findDeviceOverride(pageSize, device)) == null ? void 0 : _a.value) != null ? _b : 1;
2047
1236
  return {
2048
1237
  label: "Step",
2049
1238
  defaultValue: 1,
@@ -2052,7 +1241,7 @@ function registerComponent$a(runtime) {
2052
1241
  step: 1
2053
1242
  };
2054
1243
  }),
2055
- slideAlignment: richText.ResponsiveIconRadioGroup({
1244
+ slideAlignment: types$1.ResponsiveIconRadioGroup({
2056
1245
  label: "Alignment",
2057
1246
  options: [
2058
1247
  { label: "Top", value: "flex-start", icon: "VerticalAlignStart16" },
@@ -2061,13 +1250,13 @@ function registerComponent$a(runtime) {
2061
1250
  ],
2062
1251
  defaultValue: "center"
2063
1252
  }),
2064
- gap: richText.GapX({
1253
+ gap: types$1.GapX({
2065
1254
  label: "Gap",
2066
1255
  step: 5,
2067
1256
  defaultValue: { value: 0, unit: "px" }
2068
1257
  }),
2069
- autoplay: richText.Checkbox({ label: "Autoplay" }),
2070
- delay: richText.Number((props) => ({
1258
+ autoplay: types$1.Checkbox({ label: "Autoplay" }),
1259
+ delay: types$1.Number((props) => ({
2071
1260
  label: "Delay",
2072
1261
  preset: 5,
2073
1262
  min: 1,
@@ -2075,8 +1264,8 @@ function registerComponent$a(runtime) {
2075
1264
  suffix: "seconds",
2076
1265
  hidden: !props.autoplay
2077
1266
  })),
2078
- showArrows: richText.Checkbox({ preset: true, label: "Show arrows" }),
2079
- arrowPosition: richText.ResponsiveIconRadioGroup((props) => ({
1267
+ showArrows: types$1.Checkbox({ preset: true, label: "Show arrows" }),
1268
+ arrowPosition: types$1.ResponsiveIconRadioGroup((props) => ({
2080
1269
  label: "Arrow position",
2081
1270
  options: [
2082
1271
  { label: "Inside", value: "inside", icon: "ArrowInside16" },
@@ -2086,24 +1275,24 @@ function registerComponent$a(runtime) {
2086
1275
  defaultValue: "inside",
2087
1276
  hidden: props.showArrows === false
2088
1277
  })),
2089
- arrowColor: richText.ResponsiveColor((props) => ({
1278
+ arrowColor: types$1.ResponsiveColor((props) => ({
2090
1279
  label: "Arrow color",
2091
1280
  placeholder: "black",
2092
1281
  hidden: props.showArrows === false
2093
1282
  })),
2094
- arrowBackground: richText.ResponsiveColor((props) => ({
1283
+ arrowBackground: types$1.ResponsiveColor((props) => ({
2095
1284
  label: "Arrow background",
2096
1285
  placeholder: "white",
2097
1286
  hidden: props.showArrows === false
2098
1287
  })),
2099
- showDots: richText.Checkbox({ preset: true, label: "Show dots" }),
2100
- dotColor: richText.ResponsiveColor((props) => ({
1288
+ showDots: types$1.Checkbox({ preset: true, label: "Show dots" }),
1289
+ dotColor: types$1.ResponsiveColor((props) => ({
2101
1290
  label: "Dot color",
2102
1291
  placeholder: "black",
2103
1292
  hidden: props.showDots === false
2104
1293
  })),
2105
- slideBorder: richText.Border({ format: richText.Border.Format.ClassName }),
2106
- slideBorderRadius: richText.BorderRadius({ format: richText.BorderRadius.Format.ClassName })
1294
+ slideBorder: types$1.Border({ format: types$1.Border.Format.ClassName }),
1295
+ slideBorderRadius: types$1.BorderRadius({ format: types$1.BorderRadius.Format.ClassName })
2107
1296
  }
2108
1297
  });
2109
1298
  }
@@ -2115,11 +1304,11 @@ function registerComponent$9(runtime) {
2115
1304
  label: "Countdown",
2116
1305
  icon: "Countdown40",
2117
1306
  props: {
2118
- id: richText.ElementID(),
2119
- date: richText.Date(() => ({
1307
+ id: types$1.ElementID(),
1308
+ date: types$1.Date(() => ({
2120
1309
  preset: new Date(Date.now() + 1e3 * 60 * 60 * 24 * 2).toISOString()
2121
1310
  })),
2122
- variant: richText.ResponsiveIconRadioGroup({
1311
+ variant: types$1.ResponsiveIconRadioGroup({
2123
1312
  label: "Style",
2124
1313
  options: [
2125
1314
  { label: "Filled", value: "filled", icon: "CountdownSolid16" },
@@ -2138,7 +1327,7 @@ function registerComponent$9(runtime) {
2138
1327
  ],
2139
1328
  defaultValue: "filled"
2140
1329
  }),
2141
- shape: richText.ResponsiveIconRadioGroup({
1330
+ shape: types$1.ResponsiveIconRadioGroup({
2142
1331
  label: "Shape",
2143
1332
  options: [
2144
1333
  { label: "Pill", value: "pill", icon: "ButtonPill16" },
@@ -2147,7 +1336,7 @@ function registerComponent$9(runtime) {
2147
1336
  ],
2148
1337
  defaultValue: "rounded"
2149
1338
  }),
2150
- size: richText.ResponsiveIconRadioGroup({
1339
+ size: types$1.ResponsiveIconRadioGroup({
2151
1340
  label: "Size",
2152
1341
  options: [
2153
1342
  { label: "Small", value: "small", icon: "SizeSmall16" },
@@ -2156,7 +1345,7 @@ function registerComponent$9(runtime) {
2156
1345
  ],
2157
1346
  defaultValue: "medium"
2158
1347
  }),
2159
- gap: richText.GapX({
1348
+ gap: types$1.GapX({
2160
1349
  preset: [{ deviceId: "desktop", value: { value: 10, unit: "px" } }],
2161
1350
  label: "Gap",
2162
1351
  step: 1,
@@ -2164,32 +1353,32 @@ function registerComponent$9(runtime) {
2164
1353
  max: 100,
2165
1354
  defaultValue: { value: 0, unit: "px" }
2166
1355
  }),
2167
- numberFont: richText.Font({ label: "Number font" }),
2168
- numberColor: richText.ResponsiveColor({
1356
+ numberFont: types$1.Font({ label: "Number font" }),
1357
+ numberColor: types$1.ResponsiveColor({
2169
1358
  label: "Number color",
2170
1359
  placeholder: "white"
2171
1360
  }),
2172
- blockColor: richText.ResponsiveColor({
1361
+ blockColor: types$1.ResponsiveColor({
2173
1362
  label: "Block color",
2174
1363
  placeholder: "black"
2175
1364
  }),
2176
- labelFont: richText.Font({ label: "Label font" }),
2177
- labelColor: richText.ResponsiveColor({
1365
+ labelFont: types$1.Font({ label: "Label font" }),
1366
+ labelColor: types$1.ResponsiveColor({
2178
1367
  label: "Label color",
2179
1368
  placeholder: "black"
2180
1369
  }),
2181
- width: richText.Width({
2182
- format: richText.Width.Format.ClassName,
1370
+ width: types$1.Width({
1371
+ format: types$1.Width.Format.ClassName,
2183
1372
  defaultValue: { value: 560, unit: "px" }
2184
1373
  }),
2185
- margin: richText.Margin({ format: richText.Margin.Format.ClassName }),
2186
- daysLabel: richText.TextInput({ label: "Days label", placeholder: "Days" }),
2187
- hoursLabel: richText.TextInput({ label: "Hours label", placeholder: "Hours" }),
2188
- minutesLabel: richText.TextInput({
1374
+ margin: types$1.Margin({ format: types$1.Margin.Format.ClassName }),
1375
+ daysLabel: types$1.TextInput({ label: "Days label", placeholder: "Days" }),
1376
+ hoursLabel: types$1.TextInput({ label: "Hours label", placeholder: "Hours" }),
1377
+ minutesLabel: types$1.TextInput({
2189
1378
  label: "Minutes label",
2190
1379
  placeholder: "Minutes"
2191
1380
  }),
2192
- secondsLabel: richText.TextInput({
1381
+ secondsLabel: types$1.TextInput({
2193
1382
  label: "Seconds label",
2194
1383
  placeholder: "Seconds"
2195
1384
  })
@@ -2204,8 +1393,8 @@ function registerComponent$8(runtime) {
2204
1393
  label: "Divider",
2205
1394
  icon: "Divider40",
2206
1395
  props: {
2207
- id: richText.ElementID(),
2208
- variant: richText.ResponsiveSelect({
1396
+ id: types$1.ElementID(),
1397
+ variant: types$1.ResponsiveSelect({
2209
1398
  label: "Style",
2210
1399
  labelOrientation: "horizontal",
2211
1400
  options: [
@@ -2216,17 +1405,17 @@ function registerComponent$8(runtime) {
2216
1405
  ],
2217
1406
  defaultValue: "solid"
2218
1407
  }),
2219
- thickness: richText.ResponsiveLength({
1408
+ thickness: types$1.ResponsiveLength({
2220
1409
  label: "Height",
2221
1410
  defaultValue: { value: 1, unit: "px" },
2222
1411
  options: [{ value: "px", label: "Pixels", icon: "Px16" }]
2223
1412
  }),
2224
- color: richText.ResponsiveColor({ placeholder: "black" }),
2225
- width: richText.Width({
2226
- format: richText.Width.Format.ClassName,
1413
+ color: types$1.ResponsiveColor({ placeholder: "black" }),
1414
+ width: types$1.Width({
1415
+ format: types$1.Width.Format.ClassName,
2227
1416
  defaultValue: { value: 100, unit: "%" }
2228
1417
  }),
2229
- margin: richText.Margin({ format: richText.Margin.Format.ClassName })
1418
+ margin: types$1.Margin({ format: types$1.Margin.Format.ClassName })
2230
1419
  }
2231
1420
  });
2232
1421
  }
@@ -2238,10 +1427,10 @@ function registerComponent$7(runtime) {
2238
1427
  label: "Embed",
2239
1428
  icon: "Code40",
2240
1429
  props: {
2241
- id: richText.ElementID(),
2242
- html: richText.TextArea({ label: "Code", rows: 20 }),
2243
- width: richText.Width({ format: richText.Width.Format.ClassName }),
2244
- margin: richText.Margin({ format: richText.Margin.Format.ClassName })
1430
+ id: types$1.ElementID(),
1431
+ html: types$1.TextArea({ label: "Code", rows: 20 }),
1432
+ width: types$1.Width({ format: types$1.Width.Format.ClassName }),
1433
+ margin: types$1.Margin({ format: types$1.Margin.Format.ClassName })
2245
1434
  }
2246
1435
  });
2247
1436
  }
@@ -2277,10 +1466,10 @@ function registerComponent$6(runtime) {
2277
1466
  label: "Form",
2278
1467
  icon: "Form40",
2279
1468
  props: {
2280
- id: richText.ElementID(),
2281
- tableId: richText.Table(),
2282
- fields: richText.TableFormFields(),
2283
- submitLink: richText.Link((props) => ({
1469
+ id: types$1.ElementID(),
1470
+ tableId: types$1.Table(),
1471
+ fields: types$1.TableFormFields(),
1472
+ submitLink: types$1.Link((props) => ({
2284
1473
  label: "Redirect to",
2285
1474
  options: [
2286
1475
  { value: "OPEN_PAGE", label: "Open page" },
@@ -2288,13 +1477,13 @@ function registerComponent$6(runtime) {
2288
1477
  ],
2289
1478
  hidden: props.tableId == null
2290
1479
  })),
2291
- gap: richText.GapY((props) => ({
1480
+ gap: types$1.GapY((props) => ({
2292
1481
  preset: [{ deviceId: "desktop", value: { value: 10, unit: "px" } }],
2293
1482
  label: "Gap",
2294
1483
  defaultValue: { value: 0, unit: "px" },
2295
1484
  hidden: props.tableId == null
2296
1485
  })),
2297
- shape: richText.ResponsiveIconRadioGroup((props) => ({
1486
+ shape: types$1.ResponsiveIconRadioGroup((props) => ({
2298
1487
  label: "Shape",
2299
1488
  options: [
2300
1489
  { label: "Pill", value: Shapes.PILL, icon: "ButtonPill16" },
@@ -2304,7 +1493,7 @@ function registerComponent$6(runtime) {
2304
1493
  defaultValue: Shapes.ROUNDED,
2305
1494
  hidden: props.tableId == null
2306
1495
  })),
2307
- size: richText.ResponsiveIconRadioGroup((props) => ({
1496
+ size: types$1.ResponsiveIconRadioGroup((props) => ({
2308
1497
  label: "Size",
2309
1498
  options: [
2310
1499
  { label: "Small", value: Sizes.SMALL, icon: "SizeSmall16" },
@@ -2314,7 +1503,7 @@ function registerComponent$6(runtime) {
2314
1503
  defaultValue: Sizes.MEDIUM,
2315
1504
  hidden: (props == null ? void 0 : props.tableId) == null
2316
1505
  })),
2317
- contrast: richText.ResponsiveIconRadioGroup((props) => ({
1506
+ contrast: types$1.ResponsiveIconRadioGroup((props) => ({
2318
1507
  label: "Color",
2319
1508
  options: [
2320
1509
  { label: "Light mode", value: Contrasts.LIGHT, icon: "Sun16" },
@@ -2323,34 +1512,34 @@ function registerComponent$6(runtime) {
2323
1512
  defaultValue: Contrasts.LIGHT,
2324
1513
  hidden: props.tableId == null
2325
1514
  })),
2326
- labelTextStyle: richText.TextStyle({ label: "Label text style" }),
2327
- labelTextColor: richText.ResponsiveColor((props, device) => {
1515
+ labelTextStyle: types$1.TextStyle({ label: "Label text style" }),
1516
+ labelTextColor: types$1.ResponsiveColor((props, device) => {
2328
1517
  const hidden = props.tableId == null;
2329
1518
  const responsiveContrast = props.contrast;
2330
- const contrast = findDeviceOverride(responsiveContrast, device);
1519
+ const contrast = responsiveStyle.findDeviceOverride(responsiveContrast, device);
2331
1520
  return {
2332
1521
  hidden,
2333
1522
  label: "Label text color",
2334
1523
  placeholder: (contrast == null ? void 0 : contrast.value) === Contrasts.DARK ? "rgba(255,255,255,0.95)" : "rgba(0,0,0,0.8)"
2335
1524
  };
2336
1525
  }),
2337
- submitTextStyle: richText.TextStyle({ label: "Button text style" }),
2338
- brandColor: richText.ResponsiveColor((props) => ({
1526
+ submitTextStyle: types$1.TextStyle({ label: "Button text style" }),
1527
+ brandColor: types$1.ResponsiveColor((props) => ({
2339
1528
  label: "Button color",
2340
1529
  placeholder: "black",
2341
1530
  hidden: props.tableId == null
2342
1531
  })),
2343
- submitTextColor: richText.ResponsiveColor((props) => ({
1532
+ submitTextColor: types$1.ResponsiveColor((props) => ({
2344
1533
  label: "Button text color",
2345
1534
  placeholder: "white",
2346
1535
  hidden: props.tableId == null
2347
1536
  })),
2348
- submitLabel: richText.TextInput((props) => ({
1537
+ submitLabel: types$1.TextInput((props) => ({
2349
1538
  label: "Button label",
2350
1539
  placeholder: "Submit",
2351
1540
  hidden: props.tableId == null
2352
1541
  })),
2353
- submitVariant: richText.ResponsiveSelect((props) => ({
1542
+ submitVariant: types$1.ResponsiveSelect((props) => ({
2354
1543
  label: "Button style",
2355
1544
  options: [
2356
1545
  { value: "flat", label: "Flat" },
@@ -2364,11 +1553,11 @@ function registerComponent$6(runtime) {
2364
1553
  defaultValue: "flat",
2365
1554
  hidden: props.tableId == null
2366
1555
  })),
2367
- submitWidth: richText.ResponsiveLength((props) => ({
1556
+ submitWidth: types$1.ResponsiveLength((props) => ({
2368
1557
  label: "Button width",
2369
1558
  hidden: props.tableId == null
2370
1559
  })),
2371
- submitAlignment: richText.ResponsiveIconRadioGroup((props) => ({
1560
+ submitAlignment: types$1.ResponsiveIconRadioGroup((props) => ({
2372
1561
  label: "Button alignment",
2373
1562
  options: [
2374
1563
  { label: "Left", value: Alignments.LEFT, icon: "AlignLeft16" },
@@ -2378,12 +1567,12 @@ function registerComponent$6(runtime) {
2378
1567
  defaultValue: Alignments.CENTER,
2379
1568
  hidden: props.tableId == null
2380
1569
  })),
2381
- width: richText.Width({
1570
+ width: types$1.Width({
2382
1571
  preset: [{ deviceId: "desktop", value: { value: 550, unit: "px" } }],
2383
1572
  defaultValue: { value: 100, unit: "%" },
2384
- format: richText.Width.Format.ClassName
1573
+ format: types$1.Width.Format.ClassName
2385
1574
  }),
2386
- margin: richText.Margin({ format: richText.Margin.Format.ClassName })
1575
+ margin: types$1.Margin({ format: types$1.Margin.Format.ClassName })
2387
1576
  }
2388
1577
  });
2389
1578
  }
@@ -2394,17 +1583,17 @@ function registerComponent$5(runtime) {
2394
1583
  type: constants.MakeswiftComponentType.Image,
2395
1584
  label: "Image",
2396
1585
  props: {
2397
- id: richText.ElementID(),
2398
- file: richText.Image(),
2399
- altText: richText.TextInput({ label: "Alt text" }),
2400
- link: richText.Link({ label: "On click" }),
2401
- width: richText.Width(),
2402
- margin: richText.Margin({ format: richText.Margin.Format.ClassName }),
2403
- padding: richText.Padding({ format: richText.Padding.Format.ClassName }),
2404
- border: richText.Border({ format: richText.Border.Format.ClassName }),
2405
- borderRadius: richText.BorderRadius({ format: richText.BorderRadius.Format.ClassName }),
2406
- boxShadow: richText.Shadows({ format: richText.Shadows.Format.ClassName }),
2407
- opacity: richText.ResponsiveOpacity()
1586
+ id: types$1.ElementID(),
1587
+ file: types$1.Image(),
1588
+ altText: types$1.TextInput({ label: "Alt text" }),
1589
+ link: types$1.Link({ label: "On click" }),
1590
+ width: types$1.Width(),
1591
+ margin: types$1.Margin({ format: types$1.Margin.Format.ClassName }),
1592
+ padding: types$1.Padding({ format: types$1.Padding.Format.ClassName }),
1593
+ border: types$1.Border({ format: types$1.Border.Format.ClassName }),
1594
+ borderRadius: types$1.BorderRadius({ format: types$1.BorderRadius.Format.ClassName }),
1595
+ boxShadow: types$1.Shadows({ format: types$1.Shadows.Format.ClassName }),
1596
+ opacity: types$1.ResponsiveOpacity()
2408
1597
  }
2409
1598
  });
2410
1599
  }
@@ -2416,21 +1605,21 @@ function registerComponent$4(runtime) {
2416
1605
  label: "Navigation",
2417
1606
  icon: "Navigation40",
2418
1607
  props: {
2419
- id: richText.ElementID(),
2420
- links: richText.NavigationLinks(),
2421
- linkTextStyle: richText.TextStyle((props) => {
1608
+ id: types$1.ElementID(),
1609
+ links: types$1.NavigationLinks(),
1610
+ linkTextStyle: types$1.TextStyle((props) => {
2422
1611
  const links = props.links;
2423
1612
  return {
2424
1613
  label: "Link text style",
2425
1614
  hidden: links == null || links.length === 0
2426
1615
  };
2427
1616
  }),
2428
- showLogo: richText.Checkbox({ preset: true, label: "Show logo" }),
2429
- logoFile: richText.Image((props) => ({
1617
+ showLogo: types$1.Checkbox({ preset: true, label: "Show logo" }),
1618
+ logoFile: types$1.Image((props) => ({
2430
1619
  label: "Logo",
2431
1620
  hidden: props.showLogo === false
2432
1621
  })),
2433
- logoWidth: richText.ResponsiveLength((props) => ({
1622
+ logoWidth: types$1.ResponsiveLength((props) => ({
2434
1623
  preset: [{ deviceId: "desktop", value: { value: 100, unit: "px" } }],
2435
1624
  label: "Logo width",
2436
1625
  min: 0,
@@ -2438,15 +1627,15 @@ function registerComponent$4(runtime) {
2438
1627
  options: [{ value: "px", label: "Pixels", icon: "Px16" }],
2439
1628
  hidden: props.showLogo === false
2440
1629
  })),
2441
- logoAltText: richText.TextInput((props) => ({
1630
+ logoAltText: types$1.TextInput((props) => ({
2442
1631
  label: "Logo alt text",
2443
1632
  hidden: props.showLogo === false
2444
1633
  })),
2445
- logoLink: richText.Link((props) => ({
1634
+ logoLink: types$1.Link((props) => ({
2446
1635
  label: "Logo on click",
2447
1636
  hidden: props.showLogo === false
2448
1637
  })),
2449
- alignment: richText.ResponsiveIconRadioGroup({
1638
+ alignment: types$1.ResponsiveIconRadioGroup({
2450
1639
  label: "Alignment",
2451
1640
  options: [
2452
1641
  { label: "Left", value: "flex-start", icon: "AlignLeft16" },
@@ -2455,7 +1644,7 @@ function registerComponent$4(runtime) {
2455
1644
  ],
2456
1645
  defaultValue: "flex-end"
2457
1646
  }),
2458
- gutter: richText.GapX({
1647
+ gutter: types$1.GapX({
2459
1648
  preset: [{ deviceId: "desktop", value: { value: 10, unit: "px" } }],
2460
1649
  label: "Link gap",
2461
1650
  min: 0,
@@ -2463,45 +1652,45 @@ function registerComponent$4(runtime) {
2463
1652
  step: 1,
2464
1653
  defaultValue: { value: 0, unit: "px" }
2465
1654
  }),
2466
- mobileMenuAnimation: richText.ResponsiveSelect({
1655
+ mobileMenuAnimation: types$1.ResponsiveSelect({
2467
1656
  label: "Mobile menu",
2468
1657
  options: [
2469
1658
  { value: "coverRight", label: "Cover from right" },
2470
1659
  { value: "coverLeft", label: "Cover from left" }
2471
1660
  ]
2472
1661
  }),
2473
- mobileMenuOpenIconColor: richText.ResponsiveColor((props, device) => {
1662
+ mobileMenuOpenIconColor: types$1.ResponsiveColor((props, device) => {
2474
1663
  const mobileMenuAnimation = props.mobileMenuAnimation;
2475
- const hidden = !findDeviceOverride(mobileMenuAnimation, device);
1664
+ const hidden = !responsiveStyle.findDeviceOverride(mobileMenuAnimation, device);
2476
1665
  return {
2477
1666
  label: "Open icon color",
2478
1667
  placeholder: "rgba(161, 168, 194, 0.5)",
2479
1668
  hidden
2480
1669
  };
2481
1670
  }),
2482
- mobileMenuCloseIconColor: richText.ResponsiveColor((props, device) => {
1671
+ mobileMenuCloseIconColor: types$1.ResponsiveColor((props, device) => {
2483
1672
  const mobileMenuAnimation = props.mobileMenuAnimation;
2484
- const hidden = !findDeviceOverride(mobileMenuAnimation, device);
1673
+ const hidden = !responsiveStyle.findDeviceOverride(mobileMenuAnimation, device);
2485
1674
  return {
2486
1675
  label: "Close icon color",
2487
1676
  placeholder: "rgba(161, 168, 194, 0.5)",
2488
1677
  hidden
2489
1678
  };
2490
1679
  }),
2491
- mobileMenuBackgroundColor: richText.ResponsiveColor((props, device) => {
1680
+ mobileMenuBackgroundColor: types$1.ResponsiveColor((props, device) => {
2492
1681
  const mobileMenuAnimation = props.mobileMenuAnimation;
2493
- const hidden = !findDeviceOverride(mobileMenuAnimation, device);
1682
+ const hidden = !responsiveStyle.findDeviceOverride(mobileMenuAnimation, device);
2494
1683
  return {
2495
1684
  label: "Menu BG color",
2496
1685
  placeholder: "black",
2497
1686
  hidden
2498
1687
  };
2499
1688
  }),
2500
- width: richText.Width({
2501
- format: richText.Width.Format.ClassName,
1689
+ width: types$1.Width({
1690
+ format: types$1.Width.Format.ClassName,
2502
1691
  defaultValue: { value: 100, unit: "%" }
2503
1692
  }),
2504
- margin: richText.Margin({ format: richText.Margin.Format.ClassName })
1693
+ margin: types$1.Margin({ format: types$1.Margin.Format.ClassName })
2505
1694
  }
2506
1695
  });
2507
1696
  }
@@ -2513,10 +1702,10 @@ function registerComponent$3(runtime) {
2513
1702
  label: "Page",
2514
1703
  hidden: true,
2515
1704
  props: {
2516
- children: richText.Grid(),
2517
- backgrounds: richText.Backgrounds(),
2518
- rowGap: richText.GapY(),
2519
- columnGap: richText.GapX()
1705
+ children: types$1.Grid(),
1706
+ backgrounds: types$1.Backgrounds(),
1707
+ rowGap: types$1.GapY(),
1708
+ columnGap: types$1.GapX()
2520
1709
  }
2521
1710
  });
2522
1711
  }
@@ -2528,8 +1717,8 @@ function registerComponent$2(runtime) {
2528
1717
  label: "Social Links",
2529
1718
  icon: "SocialLinks40",
2530
1719
  props: {
2531
- id: richText.ElementID(),
2532
- links: richText.SocialLinks({
1720
+ id: types$1.ElementID(),
1721
+ links: types$1.SocialLinks({
2533
1722
  preset: {
2534
1723
  links: [
2535
1724
  {
@@ -2548,7 +1737,7 @@ function registerComponent$2(runtime) {
2548
1737
  openInNewTab: false
2549
1738
  }
2550
1739
  }),
2551
- shape: richText.ResponsiveIconRadioGroup((props) => {
1740
+ shape: types$1.ResponsiveIconRadioGroup((props) => {
2552
1741
  const links = props.links;
2553
1742
  return {
2554
1743
  label: "Shape",
@@ -2562,7 +1751,7 @@ function registerComponent$2(runtime) {
2562
1751
  hidden: links == null || links.links.length === 0
2563
1752
  };
2564
1753
  }),
2565
- size: richText.ResponsiveIconRadioGroup((props) => {
1754
+ size: types$1.ResponsiveIconRadioGroup((props) => {
2566
1755
  const links = props.links;
2567
1756
  return {
2568
1757
  label: "Size",
@@ -2575,7 +1764,7 @@ function registerComponent$2(runtime) {
2575
1764
  hidden: links == null || links.links.length === 0
2576
1765
  };
2577
1766
  }),
2578
- hoverStyle: richText.ResponsiveSelect((props) => {
1767
+ hoverStyle: types$1.ResponsiveSelect((props) => {
2579
1768
  const links = props.links;
2580
1769
  const hidden = links == null || links.links.length === 0;
2581
1770
  return {
@@ -2591,7 +1780,7 @@ function registerComponent$2(runtime) {
2591
1780
  hidden
2592
1781
  };
2593
1782
  }),
2594
- fill: richText.ResponsiveColor((props) => {
1783
+ fill: types$1.ResponsiveColor((props) => {
2595
1784
  const links = props.links;
2596
1785
  const hidden = links == null || links.links.length === 0;
2597
1786
  return {
@@ -2599,7 +1788,7 @@ function registerComponent$2(runtime) {
2599
1788
  hidden
2600
1789
  };
2601
1790
  }),
2602
- backgroundColor: richText.ResponsiveColor((props) => {
1791
+ backgroundColor: types$1.ResponsiveColor((props) => {
2603
1792
  const links = props.links;
2604
1793
  const hidden = links == null || links.links.length === 0;
2605
1794
  return {
@@ -2607,7 +1796,7 @@ function registerComponent$2(runtime) {
2607
1796
  hidden
2608
1797
  };
2609
1798
  }),
2610
- alignment: richText.ResponsiveIconRadioGroup({
1799
+ alignment: types$1.ResponsiveIconRadioGroup({
2611
1800
  label: "Alignment",
2612
1801
  options: [
2613
1802
  { label: "flex-start", value: "flex-start", icon: "AlignLeft16" },
@@ -2616,7 +1805,7 @@ function registerComponent$2(runtime) {
2616
1805
  ],
2617
1806
  defaultValue: "center"
2618
1807
  }),
2619
- gutter: richText.GapX({
1808
+ gutter: types$1.GapX({
2620
1809
  preset: [{ deviceId: "desktop", value: { value: 10, unit: "px" } }],
2621
1810
  label: "Link gap",
2622
1811
  min: 0,
@@ -2624,12 +1813,12 @@ function registerComponent$2(runtime) {
2624
1813
  step: 1,
2625
1814
  defaultValue: { value: 0, unit: "px" }
2626
1815
  }),
2627
- width: richText.Width({
2628
- format: richText.Width.Format.ClassName,
1816
+ width: types$1.Width({
1817
+ format: types$1.Width.Format.ClassName,
2629
1818
  defaultValue: { value: 100, unit: "%" }
2630
1819
  }),
2631
- margin: richText.Margin({
2632
- format: richText.Margin.Format.ClassName,
1820
+ margin: types$1.Margin({
1821
+ format: types$1.Margin.Format.ClassName,
2633
1822
  preset: [
2634
1823
  {
2635
1824
  deviceId: "desktop",
@@ -2652,8 +1841,8 @@ function registerComponent$1(runtime) {
2652
1841
  type: constants.MakeswiftComponentType.Text,
2653
1842
  label: "Text",
2654
1843
  props: {
2655
- id: richText.ElementID(),
2656
- text: richText.RichText(() => ({
1844
+ id: types$1.ElementID(),
1845
+ text: types$1.RichText(() => ({
2657
1846
  preset: {
2658
1847
  document: {
2659
1848
  object: "document",
@@ -2697,13 +1886,13 @@ function registerComponent$1(runtime) {
2697
1886
  }
2698
1887
  }
2699
1888
  })),
2700
- width: richText.Width({
2701
- format: richText.Width.Format.ClassName,
1889
+ width: types$1.Width({
1890
+ format: types$1.Width.Format.ClassName,
2702
1891
  preset: [{ deviceId: "desktop", value: { value: 700, unit: "px" } }],
2703
1892
  defaultValue: { value: 100, unit: "%" }
2704
1893
  }),
2705
- margin: richText.Margin({
2706
- format: richText.Margin.Format.ClassName,
1894
+ margin: types$1.Margin({
1895
+ format: types$1.Margin.Format.ClassName,
2707
1896
  preset: [
2708
1897
  {
2709
1898
  deviceId: "desktop",
@@ -2727,14 +1916,14 @@ function registerComponent(runtime) {
2727
1916
  label: "Video",
2728
1917
  icon: "Video40",
2729
1918
  props: {
2730
- id: richText.ElementID(),
2731
- video: richText.Video({ preset: { controls: true } }),
2732
- width: richText.Width({
2733
- format: richText.Width.Format.ClassName,
1919
+ id: types$1.ElementID(),
1920
+ video: types$1.Video({ preset: { controls: true } }),
1921
+ width: types$1.Width({
1922
+ format: types$1.Width.Format.ClassName,
2734
1923
  defaultValue: { value: 560, unit: "px" }
2735
1924
  }),
2736
- margin: richText.Margin({ format: richText.Margin.Format.ClassName }),
2737
- borderRadius: richText.BorderRadius({ format: richText.BorderRadius.Format.ClassName })
1925
+ margin: types$1.Margin({ format: types$1.Margin.Format.ClassName }),
1926
+ borderRadius: types$1.BorderRadius({ format: types$1.BorderRadius.Format.ClassName })
2738
1927
  }
2739
1928
  });
2740
1929
  }
@@ -2768,19 +1957,6 @@ function registerBuiltinComponents(runtime) {
2768
1957
  unregisterVideoComponent();
2769
1958
  };
2770
1959
  }
2771
- const isServer = typeof window === "undefined";
2772
- const useInsertionEffectSpecifier = "useInsertionEffect";
2773
- const useInsertionEffect = (_c = React__namespace[useInsertionEffectSpecifier]) != null ? _c : React__namespace.useLayoutEffect;
2774
- function useStyle(style) {
2775
- const serialized = serialize.serializeStyles([style], css.cache.registered);
2776
- utils.registerStyles(css.cache, serialized, false);
2777
- useInsertionEffect(() => {
2778
- utils.insertStyles(css.cache, serialized, false);
2779
- });
2780
- if (isServer)
2781
- utils.insertStyles(css.cache, serialized, false);
2782
- return `${css.cache.key}-${serialized.name}`;
2783
- }
2784
1960
  var _path;
2785
1961
  function _extends() {
2786
1962
  _extends = Object.assign || function(target) {
@@ -2813,7 +1989,7 @@ const FallbackComponent = React.forwardRef(function FallbackComponent2({
2813
1989
  }, ref) {
2814
1990
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
2815
1991
  ref,
2816
- className: useStyle({
1992
+ className: responsiveStyle.useStyle({
2817
1993
  width: "100%",
2818
1994
  height: 54,
2819
1995
  backgroundColor: "#fcedf2",
@@ -2832,110 +2008,18 @@ const FallbackComponent = React.forwardRef(function FallbackComponent2({
2832
2008
  })]
2833
2009
  });
2834
2010
  });
2835
- function useSwatch(swatchId) {
2836
- const client = useMakeswiftClient();
2837
- const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
2838
- const swatch = shim.useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
2839
- React.useEffect(() => {
2840
- if (swatchId != null)
2841
- client.fetchSwatch(swatchId).catch(console.error);
2842
- }, [client, swatchId]);
2843
- return swatch;
2844
- }
2845
- function useSwatches(swatchIds) {
2846
- const client = useMakeswiftClient();
2847
- const lastSnapshot = React.useRef();
2848
- function getSnapshot() {
2849
- const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
2850
- if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
2851
- return lastSnapshot.current;
2852
- }
2853
- return lastSnapshot.current = swatches2;
2854
- }
2855
- const swatches = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
2856
- React.useEffect(() => {
2857
- Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
2858
- }, [client, swatchIds]);
2859
- return swatches;
2860
- }
2861
- function useFile(fileId) {
2862
- const client = useMakeswiftClient();
2863
- const readFile = () => fileId == null ? null : client.readFile(fileId);
2864
- const file = shim.useSyncExternalStore(client.subscribe, readFile, readFile);
2865
- React.useEffect(() => {
2866
- if (fileId != null)
2867
- client.fetchFile(fileId);
2868
- }, [client, fileId]);
2869
- return file;
2870
- }
2871
- function useFiles(fileIds) {
2872
- const client = useMakeswiftClient();
2873
- const lastSnapshot = React.useRef();
2874
- function getSnapshot() {
2875
- const files2 = fileIds.map((fileId) => client.readFile(fileId));
2876
- if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
2877
- return lastSnapshot.current;
2878
- }
2879
- return lastSnapshot.current = files2;
2880
- }
2881
- const files = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
2882
- React.useEffect(() => {
2883
- Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
2884
- }, [client, fileIds]);
2885
- return files;
2886
- }
2887
- function useTypography(typographyId) {
2888
- const client = useMakeswiftClient();
2889
- const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
2890
- const typography = shim.useSyncExternalStore(client.subscribe, readTypography, readTypography);
2891
- React.useEffect(() => {
2892
- if (typographyId != null)
2893
- client.fetchTypography(typographyId).catch(console.error);
2894
- }, [client, typographyId]);
2895
- return typography;
2896
- }
2897
- function useGlobalElement(globalElementId) {
2898
- const client = useMakeswiftClient();
2899
- const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
2900
- const globalElement = shim.useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
2901
- React.useEffect(() => {
2902
- if (globalElementId != null)
2903
- client.fetchGlobalElement(globalElementId).catch(console.error);
2904
- }, [client, globalElementId]);
2905
- return globalElement;
2906
- }
2907
- function usePagePathnameSlice(pageId) {
2908
- const client = useMakeswiftClient();
2909
- const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
2910
- const pagePathnameSlice = shim.useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
2911
- React.useEffect(() => {
2912
- if (pageId != null)
2913
- client.fetchPagePathnameSlice(pageId).catch(console.error);
2914
- }, [client, pageId]);
2915
- return pagePathnameSlice;
2916
- }
2917
- function useTable(tableId) {
2918
- const client = useMakeswiftClient();
2919
- const readTable = () => tableId == null ? null : client.readTable(tableId);
2920
- const table = shim.useSyncExternalStore(client.subscribe, readTable, readTable);
2921
- React.useEffect(() => {
2922
- if (tableId != null)
2923
- client.fetchTable(tableId).catch(console.error);
2924
- }, [client, tableId]);
2925
- return table;
2926
- }
2927
- function mapSideColor(swatches, _d) {
2928
- var _e = _d, { color } = _e, restOfSide = __objRest(_e, ["color"]);
2011
+ function mapSideColor(swatches, _c) {
2012
+ var _d = _c, { color } = _d, restOfSide = __objRest(_d, ["color"]);
2929
2013
  return __spreadProps(__spreadValues({}, restOfSide), {
2930
2014
  color: color && {
2931
2015
  alpha: color.alpha,
2932
- swatch: swatches.filter(introspection.isNonNullable).find((s) => s && s.id === color.swatchId)
2016
+ swatch: swatches.filter(isNonNullable.isNonNullable).find((s) => s && s.id === color.swatchId)
2933
2017
  }
2934
2018
  });
2935
2019
  }
2936
2020
  function useBorder(value) {
2937
2021
  const swatchIds = introspection.getBorderSwatchIds(value);
2938
- const swatches = useSwatches(swatchIds);
2022
+ const swatches = responsiveStyle.useSwatches(swatchIds);
2939
2023
  if (value == null)
2940
2024
  return null;
2941
2025
  return value.map((_a) => {
@@ -2960,7 +2044,7 @@ const ShadowDefaultValue = {
2960
2044
  };
2961
2045
  function useBoxShadow(value) {
2962
2046
  const swatchIds = introspection.getBoxShadowsSwatchIds(value);
2963
- const swatches = useSwatches(swatchIds);
2047
+ const swatches = responsiveStyle.useSwatches(swatchIds);
2964
2048
  if (value == null)
2965
2049
  return null;
2966
2050
  return value.map((_a) => {
@@ -2975,7 +2059,7 @@ function useBoxShadow(value) {
2975
2059
  return __spreadProps(__spreadValues({}, restOfShadow), {
2976
2060
  payload: {
2977
2061
  color: color != null ? {
2978
- swatch: swatches.filter(introspection.isNonNullable).find((s) => s && s.id === color.swatchId),
2062
+ swatch: swatches.filter(isNonNullable.isNonNullable).find((s) => s && s.id === color.swatchId),
2979
2063
  alpha: color.alpha
2980
2064
  } : null,
2981
2065
  inset: inset != null ? inset : ShadowDefaultValue.inset,
@@ -2991,7 +2075,7 @@ function useBoxShadow(value) {
2991
2075
  }
2992
2076
  function useResponsiveColor(color) {
2993
2077
  const swatchIds = introspection.getResponsiveColorSwatchIds(color);
2994
- const swatches = useSwatches(swatchIds);
2078
+ const swatches = responsiveStyle.useSwatches(swatchIds);
2995
2079
  if (color == null)
2996
2080
  return null;
2997
2081
  return color.map((_a) => {
@@ -2999,11 +2083,11 @@ function useResponsiveColor(color) {
2999
2083
  const { swatchId, alpha } = v;
3000
2084
  const swatch = swatches.find((s) => s && s.id === swatchId);
3001
2085
  return swatch == null ? null : __spreadProps(__spreadValues({}, rest), { value: { swatch, alpha } });
3002
- }).filter(introspection.isNonNullable);
2086
+ }).filter(isNonNullable.isNonNullable);
3003
2087
  }
3004
- const DEVICE_QUERIES = DEVICES.map((device) => ({
2088
+ const DEVICE_QUERIES = responsiveStyle.DEVICES.map((device) => ({
3005
2089
  id: device.id,
3006
- query: getDeviceMediaQuery(device).replace("@media", "")
2090
+ query: responsiveStyle.getDeviceMediaQuery(device).replace("@media", "")
3007
2091
  }));
3008
2092
  function subscribe(notify) {
3009
2093
  const cleanUpFns = DEVICE_QUERIES.map((q) => {
@@ -3016,7 +2100,7 @@ function subscribe(notify) {
3016
2100
  function useMediaQuery(responsiveValue) {
3017
2101
  const getServerSnapshot = () => {
3018
2102
  var _a;
3019
- return (_a = findDeviceOverride(responsiveValue, DEVICES[0].id)) == null ? void 0 : _a.value;
2103
+ return (_a = responsiveStyle.findDeviceOverride(responsiveValue, responsiveStyle.DEVICES[0].id)) == null ? void 0 : _a.value;
3020
2104
  };
3021
2105
  function getSnapshot() {
3022
2106
  var _a;
@@ -3026,216 +2110,10 @@ function useMediaQuery(responsiveValue) {
3026
2110
  }
3027
2111
  return matchedDevice;
3028
2112
  }, DEVICE_QUERIES[0].id);
3029
- return (_a = findDeviceOverride(responsiveValue, deviceId)) == null ? void 0 : _a.value;
2113
+ return (_a = responsiveStyle.findDeviceOverride(responsiveValue, deviceId)) == null ? void 0 : _a.value;
3030
2114
  }
3031
2115
  return shim.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
3032
2116
  }
3033
- const getIndexes = (spans, index) => {
3034
- const flattened = spans.reduce((a, s) => a.concat(s), []);
3035
- if (index < 0 || index > flattened.length)
3036
- throw new RangeError();
3037
- let remainder = index;
3038
- let rowIndex = 0;
3039
- while (rowIndex < spans.length - 1 && remainder >= spans[rowIndex].length) {
3040
- remainder -= spans[rowIndex].length;
3041
- rowIndex += 1;
3042
- }
3043
- return [rowIndex, remainder];
3044
- };
3045
- function lengthDataToString(data) {
3046
- if (typeof data === "object")
3047
- return `${data.value}${data.unit}`;
3048
- if (typeof data === "number")
3049
- return `${data}px`;
3050
- return data;
3051
- }
3052
- function paddingPropertyDataToStyle(data, defaultValue = {}) {
3053
- var _a, _b, _c2, _d;
3054
- const paddingTop = (_a = data.paddingTop) != null ? _a : defaultValue.paddingTop;
3055
- const paddingRight = (_b = data.paddingRight) != null ? _b : defaultValue.paddingRight;
3056
- const paddingBottom = (_c2 = data.paddingBottom) != null ? _c2 : defaultValue.paddingBottom;
3057
- const paddingLeft = (_d = data.paddingLeft) != null ? _d : defaultValue.paddingLeft;
3058
- const style = {};
3059
- if (paddingTop != null)
3060
- style.paddingTop = lengthDataToString(paddingTop);
3061
- if (paddingRight != null)
3062
- style.paddingRight = lengthDataToString(paddingRight);
3063
- if (paddingBottom != null)
3064
- style.paddingBottom = lengthDataToString(paddingBottom);
3065
- if (paddingLeft != null)
3066
- style.paddingLeft = lengthDataToString(paddingLeft);
3067
- return style;
3068
- }
3069
- function marginPropertyDataToStyle(data, defaultValue = {}) {
3070
- var _a, _b, _c2, _d;
3071
- const marginTop = (_a = data.marginTop) != null ? _a : defaultValue.marginTop;
3072
- const marginRight = (_b = data.marginRight) != null ? _b : defaultValue.marginRight;
3073
- const marginBottom = (_c2 = data.marginBottom) != null ? _c2 : defaultValue.marginBottom;
3074
- const marginLeft = (_d = data.marginLeft) != null ? _d : defaultValue.marginLeft;
3075
- const style = {};
3076
- if (marginTop != null)
3077
- style.marginTop = lengthDataToString(marginTop);
3078
- if (marginRight != null)
3079
- style.marginRight = lengthDataToString(marginRight);
3080
- if (marginBottom != null)
3081
- style.marginBottom = lengthDataToString(marginBottom);
3082
- if (marginLeft != null)
3083
- style.marginLeft = lengthDataToString(marginLeft);
3084
- return style;
3085
- }
3086
- function lengthPercentageDataToString(data) {
3087
- if (typeof data === "object")
3088
- return `${data.value}${data.unit}`;
3089
- if (typeof data === "number")
3090
- return `${data}px`;
3091
- return data;
3092
- }
3093
- function borderRadiusPropertyDataToStyle(data, defaultValue = {}) {
3094
- var _a, _b, _c2, _d;
3095
- const borderTopLeftRadius = (_a = data.borderTopLeftRadius) != null ? _a : defaultValue.borderTopLeftRadius;
3096
- const borderTopRightRadius = (_b = data.borderTopRightRadius) != null ? _b : defaultValue.borderTopRightRadius;
3097
- const borderBottomRightRadius = (_c2 = data.borderBottomRightRadius) != null ? _c2 : defaultValue.borderBottomRightRadius;
3098
- const borderBottomLeftRadius = (_d = data.borderBottomLeftRadius) != null ? _d : defaultValue.borderBottomLeftRadius;
3099
- const style = {};
3100
- if (borderTopLeftRadius != null) {
3101
- style.borderTopLeftRadius = lengthPercentageDataToString(borderTopLeftRadius);
3102
- }
3103
- if (borderTopRightRadius != null) {
3104
- style.borderTopRightRadius = lengthPercentageDataToString(borderTopRightRadius);
3105
- }
3106
- if (borderBottomRightRadius != null) {
3107
- style.borderBottomRightRadius = lengthPercentageDataToString(borderBottomRightRadius);
3108
- }
3109
- if (borderBottomLeftRadius != null) {
3110
- style.borderBottomLeftRadius = lengthPercentageDataToString(borderBottomLeftRadius);
3111
- }
3112
- return style;
3113
- }
3114
- function colorToString(color) {
3115
- return color && color.swatch ? `hsla(${color.swatch.hue},${color.swatch.saturation}%,${color.swatch.lightness}%,${color.alpha})` : "";
3116
- }
3117
- function borderPropertyDataToStyle(data, defaultValue = {}) {
3118
- var _a, _b, _c2, _d;
3119
- const borderTop = (_a = data.borderTop) != null ? _a : defaultValue.borderTop;
3120
- const borderRight = (_b = data.borderRight) != null ? _b : defaultValue.borderRight;
3121
- const borderBottom = (_c2 = data.borderBottom) != null ? _c2 : defaultValue.borderBottom;
3122
- const borderLeft = (_d = data.borderLeft) != null ? _d : defaultValue.borderLeft;
3123
- const style = {};
3124
- if (borderTop != null)
3125
- style.borderTop = borderSideToString(borderTop);
3126
- if (borderRight != null)
3127
- style.borderRight = borderSideToString(borderRight);
3128
- if (borderBottom != null)
3129
- style.borderBottom = borderSideToString(borderBottom);
3130
- if (borderLeft != null)
3131
- style.borderLeft = borderSideToString(borderLeft);
3132
- return style;
3133
- }
3134
- function borderSideToString(borderSide) {
3135
- if (typeof borderSide === "string")
3136
- return borderSide;
3137
- if (typeof borderSide === "number")
3138
- return `${borderSide}px`;
3139
- const { width, color, style } = borderSide;
3140
- return `${width != null ? width : 0}px ${style} ${color != null ? colorToString(color) : "black"}`;
3141
- }
3142
- function responsiveStyle(responsiveValues, join$1, strategy) {
3143
- return join(responsiveValues, join$1, strategy).reduce((acc, { deviceId, value }) => {
3144
- const device = getDevice(deviceId);
3145
- const mediaQuery = getDeviceMediaQuery(device);
3146
- return __spreadProps(__spreadValues({}, acc), {
3147
- [mediaQuery]: __spreadValues(__spreadValues({}, acc[mediaQuery]), value)
3148
- });
3149
- }, {});
3150
- }
3151
- function responsiveWidth(widthData, defaultValue = "100%") {
3152
- return __spreadValues({
3153
- maxWidth: "100%"
3154
- }, responsiveStyle([widthData], ([width = defaultValue]) => ({
3155
- width: typeof width === "object" ? `${width.value}${width.unit}` : width
3156
- })));
3157
- }
3158
- function responsivePadding(paddingData, defaultValue = {}) {
3159
- return responsiveStyle([paddingData], ([padding = {}]) => paddingPropertyDataToStyle(padding, Object.assign({ paddingTop: 0, paddingRight: 0, paddingBottom: 0, paddingLeft: 0 }, defaultValue)));
3160
- }
3161
- function responsiveMargin(marginData, defaultValue = {}) {
3162
- return responsiveStyle([marginData], ([margin = {}]) => marginPropertyDataToStyle(margin, Object.assign({ marginTop: 0, marginRight: "auto", marginBottom: 0, marginLeft: "auto" }, defaultValue)));
3163
- }
3164
- function responsiveBorderRadius(borderRadiusData, defaultValue = {}) {
3165
- return responsiveStyle([borderRadiusData], ([borderRadius = {}]) => borderRadiusPropertyDataToStyle(borderRadius, Object.assign({
3166
- borderTopLeftRadius: 0,
3167
- borderTopRightRadius: 0,
3168
- borderBottomRightRadius: 0,
3169
- borderBottomLeftRadius: 0
3170
- }, defaultValue)));
3171
- }
3172
- function responsiveBorder(borderData, defaultValue = {}) {
3173
- return responsiveStyle([borderData], ([border = {}]) => borderPropertyDataToStyle(border, Object.assign({
3174
- borderTop: "0px solid black",
3175
- borderRight: "0px solid black",
3176
- borderBottom: "0px solid black",
3177
- borderLeft: "0px solid black"
3178
- }, defaultValue)));
3179
- }
3180
- const floor = (d) => (v) => Math.floor(10 ** d * v) / 10 ** d;
3181
- function responsiveGridItem(props) {
3182
- return __spreadValues({
3183
- display: "flex"
3184
- }, responsiveStyle([props.grid, props.columnGap, props.rowGap], ([
3185
- { spans, count } = { spans: [[12]], count: 12 },
3186
- columnGap = { value: 0, unit: "px" },
3187
- rowGap = { value: 0, unit: "px" }
3188
- ]) => {
3189
- const [rowIndex, columnIndex] = getIndexes(spans, props.index);
3190
- const firstCol = columnIndex === 0;
3191
- const lastCol = columnIndex === spans[rowIndex].length - 1;
3192
- const span = spans[rowIndex][columnIndex];
3193
- const fraction = floor(5)(span / count);
3194
- const width = `${fraction} * (100% + ${columnGap.value}${columnGap.unit})`;
3195
- const excessWidth = `${Number(firstCol) + Number(lastCol)} * ${columnGap.value}${columnGap.unit} / 2`;
3196
- const iePrecisionError = "0.01px";
3197
- const flexBasis = `calc(${width} - ${excessWidth} - ${iePrecisionError})`;
3198
- const firstRow = rowIndex === 0;
3199
- const lastRow = rowIndex === spans.length - 1;
3200
- return span === 0 ? { display: "none" } : {
3201
- flexBasis,
3202
- minWidth: flexBasis,
3203
- maxWidth: flexBasis,
3204
- paddingLeft: firstCol ? 0 : `${columnGap.value / 2}${columnGap.unit}`,
3205
- paddingRight: lastCol ? 0 : `${columnGap.value / 2}${columnGap.unit}`,
3206
- paddingTop: firstRow ? 0 : `${rowGap.value / 2}${rowGap.unit}`,
3207
- paddingBottom: lastRow ? 0 : `${rowGap.value / 2}${rowGap.unit}`
3208
- };
3209
- }));
3210
- }
3211
- const getBoxShadow = (shadows) => shadows.map(({ payload: { inset, offsetX, offsetY, blurRadius, spreadRadius, color } }) => `${inset ? "inset " : ""}${offsetX.toFixed(1)}px ${offsetY.toFixed(1)}px ${blurRadius}px ${spreadRadius}px ${color != null ? colorToString(color) : "rgba(0,0,0,0.2)"}`).filter(Boolean).join();
3212
- function responsiveShadow(value) {
3213
- return responsiveStyle([value], ([shadow = []]) => ({
3214
- boxShadow: getBoxShadow(shadow)
3215
- }));
3216
- }
3217
- function responsiveTextStyle(value) {
3218
- return responsiveStyle([value], ([
3219
- textStyle = {
3220
- fontFamily: null,
3221
- letterSpacing: null,
3222
- fontSize: null,
3223
- fontWeight: null,
3224
- textTransform: [],
3225
- fontStyle: []
3226
- }
3227
- ]) => {
3228
- const {
3229
- fontSize,
3230
- fontWeight,
3231
- fontStyle = [],
3232
- textTransform = [],
3233
- letterSpacing,
3234
- fontFamily
3235
- } = textStyle;
3236
- return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, fontFamily == null ? {} : { fontFamily: `"${fontFamily}"` }), fontWeight == null ? {} : { fontWeight }), letterSpacing == null ? {} : { letterSpacing }), fontSize == null ? {} : { fontSize: `${fontSize.value}${fontSize.unit}` }), textTransform.includes("uppercase") ? { textTransform: "uppercase" } : {}), fontStyle.includes("italic") ? { fontStyle: "italic" } : {});
3237
- });
3238
- }
3239
2117
  const defaultMargin = {
3240
2118
  marginTop: 0,
3241
2119
  marginRight: "auto",
@@ -3250,9 +2128,9 @@ const defaultPadding = {
3250
2128
  };
3251
2129
  function useStyleControlCssObject(style, controlDefinition) {
3252
2130
  const { properties } = controlDefinition.config;
3253
- return __spreadValues(__spreadValues({}, properties.includes(richText.StyleControlProperty.Width) && {
2131
+ return __spreadValues(__spreadValues({}, properties.includes(types$1.StyleControlProperty.Width) && {
3254
2132
  maxWidth: "100%"
3255
- }), responsiveStyle([
2133
+ }), responsiveStyle.responsiveStyle([
3256
2134
  style == null ? void 0 : style.width,
3257
2135
  style == null ? void 0 : style.margin,
3258
2136
  style == null ? void 0 : style.padding,
@@ -3260,20 +2138,20 @@ function useStyleControlCssObject(style, controlDefinition) {
3260
2138
  style == null ? void 0 : style.borderRadius,
3261
2139
  style == null ? void 0 : style.textStyle
3262
2140
  ], ([width, margin, padding, border, borderRadius, textStyle]) => {
3263
- var _a, _b, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
3264
- return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, properties.includes(richText.StyleControlProperty.Width) && {
2141
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
2142
+ return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, properties.includes(types$1.StyleControlProperty.Width) && {
3265
2143
  width: (_a = widthToString(width)) != null ? _a : "100%"
3266
- }), properties.includes(richText.StyleControlProperty.Margin) && marginPropertyDataToStyle(margin != null ? margin : defaultMargin, defaultMargin)), properties.includes(richText.StyleControlProperty.Padding) && paddingPropertyDataToStyle(padding != null ? padding : defaultPadding, defaultPadding)), properties.includes(richText.StyleControlProperty.Border) && {
3267
- borderTop: (_b = borderSideToString2(border == null ? void 0 : border.borderTop)) != null ? _b : "0 solid black",
3268
- borderRight: (_c2 = borderSideToString2(border == null ? void 0 : border.borderRight)) != null ? _c2 : "0 solid black",
3269
- borderBottom: (_d = borderSideToString2(border == null ? void 0 : border.borderBottom)) != null ? _d : "0 solid black",
3270
- borderLeft: (_e = borderSideToString2(border == null ? void 0 : border.borderLeft)) != null ? _e : "0 solid black"
3271
- }), properties.includes(richText.StyleControlProperty.BorderRadius) && {
2144
+ }), properties.includes(types$1.StyleControlProperty.Margin) && responsiveStyle.marginPropertyDataToStyle(margin != null ? margin : defaultMargin, defaultMargin)), properties.includes(types$1.StyleControlProperty.Padding) && responsiveStyle.paddingPropertyDataToStyle(padding != null ? padding : defaultPadding, defaultPadding)), properties.includes(types$1.StyleControlProperty.Border) && {
2145
+ borderTop: (_b = borderSideToString(border == null ? void 0 : border.borderTop)) != null ? _b : "0 solid black",
2146
+ borderRight: (_c = borderSideToString(border == null ? void 0 : border.borderRight)) != null ? _c : "0 solid black",
2147
+ borderBottom: (_d = borderSideToString(border == null ? void 0 : border.borderBottom)) != null ? _d : "0 solid black",
2148
+ borderLeft: (_e = borderSideToString(border == null ? void 0 : border.borderLeft)) != null ? _e : "0 solid black"
2149
+ }), properties.includes(types$1.StyleControlProperty.BorderRadius) && {
3272
2150
  borderTopLeftRadius: (_f = borderRadiusToString(borderRadius == null ? void 0 : borderRadius.borderTopLeftRadius)) != null ? _f : 0,
3273
2151
  borderTopRightRadius: (_g = borderRadiusToString(borderRadius == null ? void 0 : borderRadius.borderTopRightRadius)) != null ? _g : 0,
3274
2152
  borderBottomRightRadius: (_h = borderRadiusToString(borderRadius == null ? void 0 : borderRadius.borderBottomRightRadius)) != null ? _h : 0,
3275
2153
  borderBottomLeftRadius: (_i = borderRadiusToString(borderRadius == null ? void 0 : borderRadius.borderBottomLeftRadius)) != null ? _i : 0
3276
- }), properties.includes(richText.StyleControlProperty.TextStyle) && __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, (textStyle == null ? void 0 : textStyle.fontFamily) && { fontFamily: `"${textStyle.fontFamily}"` }), (textStyle == null ? void 0 : textStyle.letterSpacing) && { letterSpacing: textStyle.letterSpacing }), (textStyle == null ? void 0 : textStyle.fontSize) && { fontSize: fontSizeToString(textStyle.fontSize) }), (textStyle == null ? void 0 : textStyle.fontWeight) && { fontWeight: textStyle.fontWeight }), {
2154
+ }), properties.includes(types$1.StyleControlProperty.TextStyle) && __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, (textStyle == null ? void 0 : textStyle.fontFamily) && { fontFamily: `"${textStyle.fontFamily}"` }), (textStyle == null ? void 0 : textStyle.letterSpacing) && { letterSpacing: textStyle.letterSpacing }), (textStyle == null ? void 0 : textStyle.fontSize) && { fontSize: fontSizeToString(textStyle.fontSize) }), (textStyle == null ? void 0 : textStyle.fontWeight) && { fontWeight: textStyle.fontWeight }), {
3277
2155
  textTransform: (_j = textStyle == null ? void 0 : textStyle.textTransform) != null ? _j : [],
3278
2156
  fontStyle: (_k = textStyle == null ? void 0 : textStyle.fontStyle) != null ? _k : []
3279
2157
  }));
@@ -3281,18 +2159,18 @@ function useStyleControlCssObject(style, controlDefinition) {
3281
2159
  function widthToString(widthProperty) {
3282
2160
  if (widthProperty == null)
3283
2161
  return null;
3284
- return lengthPercentageDataToString(widthProperty);
2162
+ return responsiveStyle.lengthPercentageDataToString(widthProperty);
3285
2163
  }
3286
- function borderSideToString2(borderSide) {
2164
+ function borderSideToString(borderSide) {
3287
2165
  if (borderSide == null)
3288
2166
  return null;
3289
2167
  const { width, color, style: style2 } = borderSide;
3290
- return `${width != null ? width : 0}px ${style2} ${color != null ? colorToString(color) : "black"}`;
2168
+ return `${width != null ? width : 0}px ${style2} ${color != null ? responsiveStyle.colorToString(color) : "black"}`;
3291
2169
  }
3292
2170
  function borderRadiusToString(borderRadius) {
3293
2171
  if (borderRadius == null)
3294
2172
  return null;
3295
- return lengthPercentageDataToString(borderRadius);
2173
+ return responsiveStyle.lengthPercentageDataToString(borderRadius);
3296
2174
  }
3297
2175
  function fontSizeToString(fontSize) {
3298
2176
  return `${fontSize.value}${fontSize.unit}`;
@@ -3300,7 +2178,7 @@ function useStyleControlCssObject(style, controlDefinition) {
3300
2178
  }
3301
2179
  function useFormattedStyle(styleControlData, controlDefinition) {
3302
2180
  const style = useStyleControlCssObject(styleControlData, controlDefinition);
3303
- return useStyle(style);
2181
+ return responsiveStyle.useStyle(style);
3304
2182
  }
3305
2183
  function RenderHook({
3306
2184
  hook: useHook,
@@ -3315,7 +2193,7 @@ function useCheckboxControlValue(data, definition) {
3315
2193
  function useColorValue(data, definition) {
3316
2194
  var _a, _b;
3317
2195
  const swatchId = (_a = data == null ? void 0 : data.swatchId) != null ? _a : null;
3318
- const swatch = useSwatch(swatchId);
2196
+ const swatch = responsiveStyle.useSwatch(swatchId);
3319
2197
  const alpha = (_b = data == null ? void 0 : data.alpha) != null ? _b : 1;
3320
2198
  if (swatch == null) {
3321
2199
  const { defaultValue } = definition.config;
@@ -3336,10 +2214,10 @@ function useComboboxControlValue(data) {
3336
2214
  }
3337
2215
  function useImageControlValue(data, definition) {
3338
2216
  var _a;
3339
- const format = (_a = definition.config.format) != null ? _a : richText.ImageControlValueFormat.URL;
2217
+ const format = (_a = definition.config.format) != null ? _a : types$1.ImageControlValueFormat.URL;
3340
2218
  const fileId = data != null ? data : null;
3341
- const file = useFile(fileId);
3342
- if (format === richText.ImageControlValueFormat.URL) {
2219
+ const file = responsiveStyle.useFile(fileId);
2220
+ if (format === types$1.ImageControlValueFormat.URL) {
3343
2221
  return file == null ? void 0 : file.publicUrl;
3344
2222
  }
3345
2223
  if (file == null || file.dimensions == null)
@@ -3352,7 +2230,7 @@ function useImageControlValue(data, definition) {
3352
2230
  function useLinkControlValue(link, _definition) {
3353
2231
  var _a;
3354
2232
  const pageId = link && link.type === "OPEN_PAGE" ? link.payload.pageId : null;
3355
- const page = usePagePathnameSlice(pageId != null ? pageId : null);
2233
+ const page = responsiveStyle.usePagePathnameSlice(pageId != null ? pageId : null);
3356
2234
  const elementKey = (link == null ? void 0 : link.type) === "SCROLL_TO_ELEMENT" ? (_a = link.payload.elementIdConfig) == null ? void 0 : _a.elementKey : null;
3357
2235
  const elementId = useElementId(elementKey);
3358
2236
  let href = "#";
@@ -3478,7 +2356,7 @@ function pollBoxModel({
3478
2356
  let currentBoxModel = null;
3479
2357
  const handleAnimationFrameRequest = () => {
3480
2358
  const measuredBoxModel = boxModels.getBox(element);
3481
- if (!deepEqual(currentBoxModel, measuredBoxModel)) {
2359
+ if (!responsiveStyle.deepEqual(currentBoxModel, measuredBoxModel)) {
3482
2360
  currentBoxModel = measuredBoxModel;
3483
2361
  onBoxModelChange(currentBoxModel);
3484
2362
  }
@@ -3508,13 +2386,13 @@ function useSlot(data, control) {
3508
2386
  }, element.key))
3509
2387
  });
3510
2388
  }
3511
- function Slot(_f) {
3512
- var _g = _f, {
2389
+ function Slot(_e) {
2390
+ var _f = _e, {
3513
2391
  as,
3514
2392
  control,
3515
2393
  children,
3516
2394
  className
3517
- } = _g, restOfProps = __objRest(_g, [
2395
+ } = _f, restOfProps = __objRest(_f, [
3518
2396
  "as",
3519
2397
  "control",
3520
2398
  "children",
@@ -3522,7 +2400,7 @@ function Slot(_f) {
3522
2400
  ]);
3523
2401
  const As = as != null ? as : "div";
3524
2402
  const [element, setElement] = React.useState(null);
3525
- const baseClassName = useStyle({
2403
+ const baseClassName = responsiveStyle.useStyle({
3526
2404
  display: "flex",
3527
2405
  flexWrap: "wrap",
3528
2406
  width: "100%"
@@ -3543,15 +2421,15 @@ function Slot(_f) {
3543
2421
  }
3544
2422
  Slot.Placeholder = SlotPlaceholder;
3545
2423
  Slot.Item = SlotItem;
3546
- function SlotItem(_h) {
3547
- var _i = _h, {
2424
+ function SlotItem(_g) {
2425
+ var _h = _g, {
3548
2426
  as,
3549
2427
  control,
3550
2428
  grid,
3551
2429
  index,
3552
2430
  children,
3553
2431
  className
3554
- } = _i, restOfProps = __objRest(_i, [
2432
+ } = _h, restOfProps = __objRest(_h, [
3555
2433
  "as",
3556
2434
  "control",
3557
2435
  "grid",
@@ -3561,13 +2439,13 @@ function SlotItem(_h) {
3561
2439
  ]);
3562
2440
  const As = as != null ? as : "div";
3563
2441
  const [element, setElement] = React.useState(null);
3564
- const baseClassName = useStyle(__spreadValues({
2442
+ const baseClassName = responsiveStyle.useStyle(__spreadValues({
3565
2443
  display: "flex"
3566
- }, responsiveStyle([grid], ([{
2444
+ }, responsiveStyle.responsiveStyle([grid], ([{
3567
2445
  count = 12,
3568
2446
  spans = [[12]]
3569
2447
  } = {}]) => {
3570
- const [rowIndex, columnIndex] = getIndexes(spans, index);
2448
+ const [rowIndex, columnIndex] = responsiveStyle.getIndexes(spans, index);
3571
2449
  const span = spans[rowIndex][columnIndex];
3572
2450
  const flexBasis = `calc(100% * ${(span / count).toFixed(5)})`;
3573
2451
  return span === 0 ? {
@@ -3605,7 +2483,7 @@ function SlotPlaceholder({
3605
2483
  }, [element, control]);
3606
2484
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
3607
2485
  ref: setElement,
3608
- className: useStyle({
2486
+ className: responsiveStyle.useStyle({
3609
2487
  width: "100%",
3610
2488
  background: "rgba(161, 168, 194, 0.18)",
3611
2489
  height: "80px"
@@ -3614,7 +2492,7 @@ function SlotPlaceholder({
3614
2492
  xmlns: "http://www.w3.org/2000/svg",
3615
2493
  width: "100%",
3616
2494
  height: "100%",
3617
- className: useStyle({
2495
+ className: responsiveStyle.useStyle({
3618
2496
  overflow: "visible",
3619
2497
  padding: 8
3620
2498
  }),
@@ -3676,19 +2554,19 @@ function ControlValue({
3676
2554
  parameters: [data, definition],
3677
2555
  children: (value) => children(value)
3678
2556
  }, definition.type);
3679
- case richText.ColorControlType:
2557
+ case types$1.ColorControlType:
3680
2558
  return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
3681
2559
  hook: useColorValue,
3682
2560
  parameters: [data, definition],
3683
2561
  children: (value) => children(value)
3684
2562
  }, definition.type);
3685
- case richText.ImageControlType:
2563
+ case types$1.ImageControlType:
3686
2564
  return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
3687
2565
  hook: useImageControlValue,
3688
2566
  parameters: [data, definition],
3689
2567
  children: (value) => children(value)
3690
2568
  }, definition.type);
3691
- case richText.LinkControlType:
2569
+ case types$1.LinkControlType:
3692
2570
  return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
3693
2571
  hook: useLinkControlValue,
3694
2572
  parameters: [data, definition],
@@ -3731,24 +2609,24 @@ function ControlValue({
3731
2609
  }
3732
2610
  }
3733
2611
  function useWidthStyle(value, descriptor) {
3734
- return useStyle(responsiveWidth(value, descriptor.options.defaultValue));
2612
+ return responsiveStyle.useStyle(responsiveStyle.responsiveWidth(value, descriptor.options.defaultValue));
3735
2613
  }
3736
2614
  function usePaddingStyle(value) {
3737
- return useStyle(responsivePadding(value));
2615
+ return responsiveStyle.useStyle(responsiveStyle.responsivePadding(value));
3738
2616
  }
3739
2617
  function useMarginStyle(value) {
3740
- return useStyle(responsiveMargin(value));
2618
+ return responsiveStyle.useStyle(responsiveStyle.responsiveMargin(value));
3741
2619
  }
3742
2620
  function useBorderRadiusStyle(value) {
3743
- return useStyle(responsiveBorderRadius(value));
2621
+ return responsiveStyle.useStyle(responsiveStyle.responsiveBorderRadius(value));
3744
2622
  }
3745
2623
  function useShadowsStyle(value) {
3746
2624
  const shadowValue = useBoxShadow(value);
3747
- return useStyle(responsiveShadow(shadowValue != null ? shadowValue : void 0));
2625
+ return responsiveStyle.useStyle(responsiveStyle.responsiveShadow(shadowValue != null ? shadowValue : void 0));
3748
2626
  }
3749
2627
  function useBorderStyle(value) {
3750
2628
  const borderData = useBorder(value);
3751
- return useStyle(responsiveBorder(borderData != null ? borderData : void 0));
2629
+ return responsiveStyle.useStyle(responsiveStyle.responsiveBorder(borderData != null ? borderData : void 0));
3752
2630
  }
3753
2631
  function PropsValue({
3754
2632
  element,
@@ -3772,12 +2650,12 @@ function PropsValue({
3772
2650
  case textInput.TextInputControlType:
3773
2651
  case textInput.TextAreaControlType:
3774
2652
  case textInput.SelectControlType:
3775
- case richText.ColorControlType:
3776
- case richText.ImageControlType:
2653
+ case types$1.ColorControlType:
2654
+ case types$1.ImageControlType:
3777
2655
  case combobox.ComboboxControlType:
3778
2656
  case richText.ShapeControlType:
3779
2657
  case richText.ListControlType:
3780
- case richText.LinkControlType:
2658
+ case types$1.LinkControlType:
3781
2659
  return /* @__PURE__ */ jsxRuntime.jsx(ControlValue, {
3782
2660
  definition: descriptor,
3783
2661
  data: props[propName],
@@ -3786,7 +2664,7 @@ function PropsValue({
3786
2664
  [propName]: value
3787
2665
  }))
3788
2666
  });
3789
- case richText.StyleControlType:
2667
+ case types$1.StyleControlType:
3790
2668
  return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
3791
2669
  hook: useFormattedStyle,
3792
2670
  parameters: [props[propName], descriptor],
@@ -3813,9 +2691,9 @@ function PropsValue({
3813
2691
  }))
3814
2692
  }, descriptor.type);
3815
2693
  }
3816
- case richText.Types.Width:
2694
+ case types$1.Types.Width:
3817
2695
  switch (descriptor.options.format) {
3818
- case richText.WidthPropControllerFormat.ClassName:
2696
+ case types$1.WidthPropControllerFormat.ClassName:
3819
2697
  return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
3820
2698
  hook: useWidthStyle,
3821
2699
  parameters: [props[propName], descriptor],
@@ -3828,9 +2706,9 @@ function PropsValue({
3828
2706
  [propName]: props[propName]
3829
2707
  }));
3830
2708
  }
3831
- case richText.Types.Padding:
2709
+ case types$1.Types.Padding:
3832
2710
  switch (descriptor.options.format) {
3833
- case richText.PaddingPropControllerFormat.ClassName:
2711
+ case types$1.PaddingPropControllerFormat.ClassName:
3834
2712
  return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
3835
2713
  hook: usePaddingStyle,
3836
2714
  parameters: [props[propName]],
@@ -3843,9 +2721,9 @@ function PropsValue({
3843
2721
  [propName]: props[propName]
3844
2722
  }));
3845
2723
  }
3846
- case richText.Types.Margin:
2724
+ case types$1.Types.Margin:
3847
2725
  switch (descriptor.options.format) {
3848
- case richText.MarginPropControllerFormat.ClassName:
2726
+ case types$1.MarginPropControllerFormat.ClassName:
3849
2727
  return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
3850
2728
  hook: useMarginStyle,
3851
2729
  parameters: [props[propName]],
@@ -3858,9 +2736,9 @@ function PropsValue({
3858
2736
  [propName]: props[propName]
3859
2737
  }));
3860
2738
  }
3861
- case richText.Types.BorderRadius:
2739
+ case types$1.Types.BorderRadius:
3862
2740
  switch (descriptor.options.format) {
3863
- case richText.BorderRadiusPropControllerFormat.ClassName:
2741
+ case types$1.BorderRadiusPropControllerFormat.ClassName:
3864
2742
  return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
3865
2743
  hook: useBorderRadiusStyle,
3866
2744
  parameters: [props[propName]],
@@ -3873,9 +2751,9 @@ function PropsValue({
3873
2751
  [propName]: props[propName]
3874
2752
  }));
3875
2753
  }
3876
- case richText.Types.Shadows:
2754
+ case types$1.Types.Shadows:
3877
2755
  switch (descriptor.options.format) {
3878
- case richText.ShadowsPropControllerFormat.ClassName:
2756
+ case types$1.ShadowsPropControllerFormat.ClassName:
3879
2757
  return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
3880
2758
  hook: useShadowsStyle,
3881
2759
  parameters: [props[propName]],
@@ -3888,9 +2766,9 @@ function PropsValue({
3888
2766
  [propName]: props[propName]
3889
2767
  }));
3890
2768
  }
3891
- case richText.Types.Border:
2769
+ case types$1.Types.Border:
3892
2770
  switch (descriptor.options.format) {
3893
- case richText.BorderPropControllerFormat.ClassName:
2771
+ case types$1.BorderPropControllerFormat.ClassName:
3894
2772
  return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
3895
2773
  hook: useBorderStyle,
3896
2774
  parameters: [props[propName]],
@@ -3903,7 +2781,7 @@ function PropsValue({
3903
2781
  [propName]: props[propName]
3904
2782
  }));
3905
2783
  }
3906
- case richText.Types.ResponsiveColor:
2784
+ case types$1.Types.ResponsiveColor:
3907
2785
  return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
3908
2786
  hook: useResponsiveColor,
3909
2787
  parameters: [props[propName]],
@@ -4007,8 +2885,8 @@ function createReactRuntime(store) {
4007
2885
  unregisterReactComponent();
4008
2886
  };
4009
2887
  },
4010
- copyElementTree(elementTree, replacementContext) {
4011
- return constants.copyElementTree(store.getState(), elementTree, replacementContext);
2888
+ copyElementTree(elementTree2, replacementContext) {
2889
+ return constants.copyElementTree(store.getState(), elementTree2, replacementContext);
4012
2890
  }
4013
2891
  };
4014
2892
  }
@@ -4021,10 +2899,10 @@ const PreviewProvider = dynamic__default["default"](() => Promise.resolve().then
4021
2899
  const LiveProvider = dynamic__default["default"](() => Promise.resolve().then(function() {
4022
2900
  return require("./LiveProvider.cjs.js");
4023
2901
  }));
4024
- function RuntimeProvider(_j) {
4025
- var _k = _j, {
2902
+ function RuntimeProvider(_i) {
2903
+ var _j = _i, {
4026
2904
  preview
4027
- } = _k, props = __objRest(_k, [
2905
+ } = _j, props = __objRest(_j, [
4028
2906
  "preview"
4029
2907
  ]);
4030
2908
  return preview ? /* @__PURE__ */ jsxRuntime.jsx(PreviewProvider, __spreadValues({}, props)) : /* @__PURE__ */ jsxRuntime.jsx(LiveProvider, __spreadValues({}, props));
@@ -4121,7 +2999,7 @@ const DisableRegisterElement = React.createContext(false);
4121
2999
  const ElementReference = React.memo(React.forwardRef(function ElementReference2({
4122
3000
  elementReference
4123
3001
  }, ref) {
4124
- const globalElement = useGlobalElement(elementReference.value);
3002
+ const globalElement = responsiveStyle.useGlobalElement(elementReference.value);
4125
3003
  const globalElementData = globalElement == null ? void 0 : globalElement.data;
4126
3004
  const elementReferenceDocument = useDocument(elementReference.key);
4127
3005
  const documentKey = elementReference.key;
@@ -4231,15 +3109,12 @@ exports.DEFAULT_ITEM_ANIMATE_DELAY = DEFAULT_ITEM_ANIMATE_DELAY;
4231
3109
  exports.DEFAULT_ITEM_ANIMATE_DURATION = DEFAULT_ITEM_ANIMATE_DURATION;
4232
3110
  exports.DEFAULT_ITEM_ANIMATE_TYPE = DEFAULT_ITEM_ANIMATE_TYPE;
4233
3111
  exports.DEFAULT_ITEM_STAGGER_DURATION = DEFAULT_ITEM_STAGGER_DURATION;
4234
- exports.DEVICES = DEVICES;
4235
3112
  exports.Document = Document$1;
4236
3113
  exports.DocumentReference = DocumentReference;
4237
3114
  exports.Element = Element$1;
4238
3115
  exports.ElementImperativeHandle = ElementImperativeHandle;
4239
3116
  exports.Makeswift = Makeswift;
4240
3117
  exports.MakeswiftApiHandler = MakeswiftApiHandler;
4241
- exports.MakeswiftClient = MakeswiftClient;
4242
- exports.MakeswiftProvider = MakeswiftProvider;
4243
3118
  exports.Page = Page$1;
4244
3119
  exports.Page$1 = Page;
4245
3120
  exports.PageProvider = PageProvider;
@@ -4250,36 +3125,20 @@ exports.RuntimeProvider = RuntimeProvider;
4250
3125
  exports.Shapes = Shapes;
4251
3126
  exports.Sizes = Sizes;
4252
3127
  exports.StoreContext = StoreContext;
4253
- exports.colorToString = colorToString;
4254
- exports.deepEqual = deepEqual;
4255
- exports.findDeviceOverride = findDeviceOverride;
4256
3128
  exports.forwardNextDynamicRef = forwardNextDynamicRef;
4257
3129
  exports.getServerSideProps = getServerSideProps;
4258
3130
  exports.getStaticPaths = getStaticPaths;
4259
3131
  exports.getStaticProps = getStaticProps;
4260
3132
  exports.pollBoxModel = pollBoxModel;
4261
- exports.responsiveGridItem = responsiveGridItem;
4262
- exports.responsiveStyle = responsiveStyle;
4263
- exports.responsiveTextStyle = responsiveTextStyle;
4264
- exports.responsiveWidth = responsiveWidth;
4265
- exports.shallowMergeFallbacks = shallowMergeFallbacks;
4266
3133
  exports.storeContextDefaultValue = storeContextDefaultValue;
4267
3134
  exports.useBorder = useBorder;
4268
3135
  exports.useBoxShadow = useBoxShadow;
4269
3136
  exports.useBuilderEditMode = useBuilderEditMode;
4270
3137
  exports.useElementId = useElementId;
4271
- exports.useFile = useFile;
4272
- exports.useFiles = useFiles;
4273
3138
  exports.useFormContext = useFormContext;
4274
3139
  exports.useIsInBuilder = useIsInBuilder;
4275
3140
  exports.useIsPreview = useIsPreview;
4276
- exports.useMakeswiftClient = useMakeswiftClient;
4277
3141
  exports.useMediaQuery = useMediaQuery;
4278
3142
  exports.usePageId = usePageId;
4279
- exports.usePagePathnameSlice = usePagePathnameSlice;
4280
3143
  exports.useResponsiveColor = useResponsiveColor;
4281
- exports.useStyle = useStyle;
4282
- exports.useSwatches = useSwatches;
4283
- exports.useTable = useTable;
4284
- exports.useTypography = useTypography;
4285
3144
  //# sourceMappingURL=index.cjs.js.map