@makeswift/runtime 0.8.5 → 0.8.7

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 (239) hide show
  1. package/dist/Box.cjs.js +11 -11
  2. package/dist/Box.cjs.js.map +1 -1
  3. package/dist/Box.es.js +9 -9
  4. package/dist/Box.es.js.map +1 -1
  5. package/dist/Button.cjs.js +36 -37
  6. package/dist/Button.cjs.js.map +1 -1
  7. package/dist/Button.es.js +13 -14
  8. package/dist/Button.es.js.map +1 -1
  9. package/dist/Carousel.cjs.js +38 -37
  10. package/dist/Carousel.cjs.js.map +1 -1
  11. package/dist/Carousel.es.js +19 -18
  12. package/dist/Carousel.es.js.map +1 -1
  13. package/dist/Countdown.cjs.js +55 -29
  14. package/dist/Countdown.cjs.js.map +1 -1
  15. package/dist/Countdown.es.js +35 -9
  16. package/dist/Countdown.es.js.map +1 -1
  17. package/dist/Divider.cjs.js +36 -10
  18. package/dist/Divider.cjs.js.map +1 -1
  19. package/dist/Divider.es.js +31 -5
  20. package/dist/Divider.es.js.map +1 -1
  21. package/dist/Embed.cjs.js +31 -5
  22. package/dist/Embed.cjs.js.map +1 -1
  23. package/dist/Embed.es.js +30 -4
  24. package/dist/Embed.es.js.map +1 -1
  25. package/dist/Form.cjs.js +72 -73
  26. package/dist/Form.cjs.js.map +1 -1
  27. package/dist/Form.es.js +32 -33
  28. package/dist/Form.es.js.map +1 -1
  29. package/dist/Image.cjs.js +22 -21
  30. package/dist/Image.cjs.js.map +1 -1
  31. package/dist/Image.es.js +20 -19
  32. package/dist/Image.es.js.map +1 -1
  33. package/dist/LiveProvider.cjs.js +12 -12
  34. package/dist/LiveProvider.cjs.js.map +1 -1
  35. package/dist/LiveProvider.es.js +12 -12
  36. package/dist/LiveProvider.es.js.map +1 -1
  37. package/dist/Navigation.cjs.js +33 -34
  38. package/dist/Navigation.cjs.js.map +1 -1
  39. package/dist/Navigation.es.js +14 -15
  40. package/dist/Navigation.es.js.map +1 -1
  41. package/dist/PreviewProvider.cjs.js +16 -13
  42. package/dist/PreviewProvider.cjs.js.map +1 -1
  43. package/dist/PreviewProvider.es.js +16 -13
  44. package/dist/PreviewProvider.es.js.map +1 -1
  45. package/dist/ReadOnlyText.cjs.js +15 -16
  46. package/dist/ReadOnlyText.cjs.js.map +1 -1
  47. package/dist/ReadOnlyText.es.js +11 -12
  48. package/dist/ReadOnlyText.es.js.map +1 -1
  49. package/dist/Root.cjs.js +10 -10
  50. package/dist/Root.cjs.js.map +1 -1
  51. package/dist/Root.es.js +8 -8
  52. package/dist/SocialLinks.cjs.js +12 -13
  53. package/dist/SocialLinks.cjs.js.map +1 -1
  54. package/dist/SocialLinks.es.js +7 -8
  55. package/dist/SocialLinks.es.js.map +1 -1
  56. package/dist/Text.cjs.js +3 -4
  57. package/dist/Text.cjs.js.map +1 -1
  58. package/dist/Text.es.js +4 -5
  59. package/dist/Text.es.js.map +1 -1
  60. package/dist/Video.cjs.js +31 -5
  61. package/dist/Video.cjs.js.map +1 -1
  62. package/dist/Video.es.js +30 -4
  63. package/dist/Video.es.js.map +1 -1
  64. package/dist/actions.cjs.js +6 -1
  65. package/dist/actions.cjs.js.map +1 -1
  66. package/dist/actions.es.js +6 -2
  67. package/dist/actions.es.js.map +1 -1
  68. package/dist/components.cjs.js +10 -10
  69. package/dist/components.es.js +10 -10
  70. package/dist/constants.cjs.js +13 -3
  71. package/dist/constants.cjs.js.map +1 -1
  72. package/dist/constants.es.js +13 -4
  73. package/dist/constants.es.js.map +1 -1
  74. package/dist/descriptors.cjs.js.map +1 -1
  75. package/dist/descriptors.es.js.map +1 -1
  76. package/dist/index.cjs.js +1010 -163
  77. package/dist/index.cjs.js.map +1 -1
  78. package/dist/index.cjs2.js +29 -29
  79. package/dist/index.cjs2.js.map +1 -1
  80. package/dist/index.cjs3.js +1 -2
  81. package/dist/index.cjs3.js.map +1 -1
  82. package/dist/index.cjs4.js +2 -2
  83. package/dist/index.cjs4.js.map +1 -1
  84. package/dist/index.cjs5.js +262 -109
  85. package/dist/index.cjs5.js.map +1 -1
  86. package/dist/index.cjs6.js +3 -4
  87. package/dist/index.cjs6.js.map +1 -1
  88. package/dist/index.cjs7.js +16 -17
  89. package/dist/index.cjs7.js.map +1 -1
  90. package/dist/index.es.js +965 -133
  91. package/dist/index.es.js.map +1 -1
  92. package/dist/index.es2.js +6 -6
  93. package/dist/index.es2.js.map +1 -1
  94. package/dist/index.es3.js +1 -2
  95. package/dist/index.es3.js.map +1 -1
  96. package/dist/index.es4.js +2 -2
  97. package/dist/index.es4.js.map +1 -1
  98. package/dist/index.es5.js +262 -109
  99. package/dist/index.es5.js.map +1 -1
  100. package/dist/index.es6.js +3 -4
  101. package/dist/index.es6.js.map +1 -1
  102. package/dist/index.es7.js +12 -13
  103. package/dist/index.es7.js.map +1 -1
  104. package/dist/introspection.cjs.js +5 -2
  105. package/dist/introspection.cjs.js.map +1 -1
  106. package/dist/introspection.es.js +4 -2
  107. package/dist/introspection.es.js.map +1 -1
  108. package/dist/leaf.cjs.js +15 -17
  109. package/dist/leaf.cjs.js.map +1 -1
  110. package/dist/leaf.es.js +10 -11
  111. package/dist/leaf.es.js.map +1 -1
  112. package/dist/main.cjs.js +2 -1
  113. package/dist/main.cjs.js.map +1 -1
  114. package/dist/main.es.js +2 -2
  115. package/dist/next.cjs.js +5 -6
  116. package/dist/next.cjs.js.map +1 -1
  117. package/dist/next.es.js +6 -7
  118. package/dist/next.es.js.map +1 -1
  119. package/dist/prop-controllers.cjs.js +0 -1
  120. package/dist/prop-controllers.cjs.js.map +1 -1
  121. package/dist/prop-controllers.es.js +0 -1
  122. package/dist/prop-controllers.es.js.map +1 -1
  123. package/dist/react.cjs.js +3 -4
  124. package/dist/react.cjs.js.map +1 -1
  125. package/dist/react.es.js +3 -4
  126. package/dist/react.es.js.map +1 -1
  127. package/dist/slate.cjs.js +1 -12
  128. package/dist/slate.cjs.js.map +1 -1
  129. package/dist/slate.es.js +1 -12
  130. package/dist/slate.es.js.map +1 -1
  131. package/dist/state/breakpoints.cjs.js +175 -0
  132. package/dist/state/breakpoints.cjs.js.map +1 -0
  133. package/dist/state/breakpoints.es.js +160 -0
  134. package/dist/state/breakpoints.es.js.map +1 -0
  135. package/dist/types/src/components/builtin/Box/Box.d.ts.map +1 -1
  136. package/dist/types/src/components/builtin/Box/register.d.ts.map +1 -1
  137. package/dist/types/src/components/builtin/Button/Button.d.ts.map +1 -1
  138. package/dist/types/src/components/builtin/Button/register.d.ts.map +1 -1
  139. package/dist/types/src/components/builtin/Carousel/Carousel.d.ts.map +1 -1
  140. package/dist/types/src/components/builtin/Carousel/register.d.ts.map +1 -1
  141. package/dist/types/src/components/builtin/Countdown/register.d.ts.map +1 -1
  142. package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
  143. package/dist/types/src/components/builtin/Form/components/Field/components/Label/index.d.ts.map +1 -1
  144. package/dist/types/src/components/builtin/Form/register.d.ts.map +1 -1
  145. package/dist/types/src/components/builtin/Image/Image.d.ts.map +1 -1
  146. package/dist/types/src/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts.map +1 -1
  147. package/dist/types/src/components/builtin/Navigation/components/MobileMenu/index.d.ts.map +1 -1
  148. package/dist/types/src/components/builtin/Navigation/register.d.ts.map +1 -1
  149. package/dist/types/src/components/builtin/SocialLinks/register.d.ts.map +1 -1
  150. package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts +0 -4
  151. package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts.map +1 -1
  152. package/dist/types/src/components/builtin/Text/register.d.ts.map +1 -1
  153. package/dist/types/src/components/hooks/useMediaQuery.d.ts.map +1 -1
  154. package/dist/types/src/components/utils/drop-first.d.ts +2 -0
  155. package/dist/types/src/components/utils/drop-first.d.ts.map +1 -0
  156. package/dist/types/src/components/utils/responsive-style.d.ts +21 -10
  157. package/dist/types/src/components/utils/responsive-style.d.ts.map +1 -1
  158. package/dist/types/src/controls/types.d.ts +1 -1
  159. package/dist/types/src/controls/types.d.ts.map +1 -1
  160. package/dist/types/src/index.d.ts +2 -2
  161. package/dist/types/src/index.d.ts.map +1 -1
  162. package/dist/types/src/next/api-handler/handlers/manifest.d.ts +1 -0
  163. package/dist/types/src/next/api-handler/handlers/manifest.d.ts.map +1 -1
  164. package/dist/types/src/next/client.d.ts +4 -1
  165. package/dist/types/src/next/client.d.ts.map +1 -1
  166. package/dist/types/src/next/index.d.ts +3 -1
  167. package/dist/types/src/next/index.d.ts.map +1 -1
  168. package/dist/types/src/prop-controllers/descriptors.d.ts +1 -1
  169. package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
  170. package/dist/types/src/runtimes/react/components/LiveProvider.d.ts +3 -1
  171. package/dist/types/src/runtimes/react/components/LiveProvider.d.ts.map +1 -1
  172. package/dist/types/src/runtimes/react/components/PreviewProvider.d.ts +3 -1
  173. package/dist/types/src/runtimes/react/components/PreviewProvider.d.ts.map +1 -1
  174. package/dist/types/src/runtimes/react/index.d.ts +22 -4
  175. package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
  176. package/dist/types/src/slate/BlockPlugin/clearBlockKeyForDevice.d.ts +2 -2
  177. package/dist/types/src/slate/BlockPlugin/clearBlockKeyForDevice.d.ts.map +1 -1
  178. package/dist/types/src/slate/BlockPlugin/index.d.ts +4 -0
  179. package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
  180. package/dist/types/src/slate/BlockPlugin/setBlockKeyForDevice.d.ts +7 -3
  181. package/dist/types/src/slate/BlockPlugin/setBlockKeyForDevice.d.ts.map +1 -1
  182. package/dist/types/src/slate/BlockPlugin/types.d.ts +2 -2
  183. package/dist/types/src/slate/BlockPlugin/types.d.ts.map +1 -1
  184. package/dist/types/src/slate/BlockPlugin/unwrapInline.d.ts +4 -0
  185. package/dist/types/src/slate/BlockPlugin/unwrapInline.d.ts.map +1 -0
  186. package/dist/types/src/slate/BlockPlugin/wrapInline.d.ts +4 -0
  187. package/dist/types/src/slate/BlockPlugin/wrapInline.d.ts.map +1 -0
  188. package/dist/types/src/slate/ListPlugin/toggleList.d.ts +2 -1
  189. package/dist/types/src/slate/ListPlugin/toggleList.d.ts.map +1 -1
  190. package/dist/types/src/slate/ListPlugin/unwrapList.d.ts +6 -2
  191. package/dist/types/src/slate/ListPlugin/unwrapList.d.ts.map +1 -1
  192. package/dist/types/src/slate/ListPlugin/utils/getSelectedListItems.d.ts +0 -1
  193. package/dist/types/src/slate/ListPlugin/utils/getSelectedListItems.d.ts.map +1 -1
  194. package/dist/types/src/slate/ListPlugin/wrapList.d.ts +2 -1
  195. package/dist/types/src/slate/ListPlugin/wrapList.d.ts.map +1 -1
  196. package/dist/types/src/slate/TypographyPlugin/clearActiveTypographyStyle.d.ts +6 -2
  197. package/dist/types/src/slate/TypographyPlugin/clearActiveTypographyStyle.d.ts.map +1 -1
  198. package/dist/types/src/slate/TypographyPlugin/clearDeviceActiveTypography.d.ts +6 -2
  199. package/dist/types/src/slate/TypographyPlugin/clearDeviceActiveTypography.d.ts.map +1 -1
  200. package/dist/types/src/slate/TypographyPlugin/detachActiveTypography.d.ts +6 -2
  201. package/dist/types/src/slate/TypographyPlugin/detachActiveTypography.d.ts.map +1 -1
  202. package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
  203. package/dist/types/src/slate/TypographyPlugin/setActiveTypographyId.d.ts +6 -2
  204. package/dist/types/src/slate/TypographyPlugin/setActiveTypographyId.d.ts.map +1 -1
  205. package/dist/types/src/slate/TypographyPlugin/setActiveTypographyStyle.d.ts +7 -2
  206. package/dist/types/src/slate/TypographyPlugin/setActiveTypographyStyle.d.ts.map +1 -1
  207. package/dist/types/src/slate/selectors.d.ts +19 -0
  208. package/dist/types/src/slate/selectors.d.ts.map +1 -0
  209. package/dist/types/src/slate/utils/editor.d.ts.map +1 -1
  210. package/dist/types/src/slate/utils/element.d.ts +2 -1
  211. package/dist/types/src/slate/utils/element.d.ts.map +1 -1
  212. package/dist/types/src/slate/utils/unhangRange.d.ts +10 -0
  213. package/dist/types/src/slate/utils/unhangRange.d.ts.map +1 -0
  214. package/dist/types/src/state/actions.d.ts +10 -1
  215. package/dist/types/src/state/actions.d.ts.map +1 -1
  216. package/dist/types/src/state/modules/breakpoints.d.ts +44 -0
  217. package/dist/types/src/state/modules/breakpoints.d.ts.map +1 -0
  218. package/dist/types/src/state/react-builder-preview.d.ts +2 -0
  219. package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
  220. package/dist/types/src/state/react-page.d.ts +5 -1
  221. package/dist/types/src/state/react-page.d.ts.map +1 -1
  222. package/dist/types/src/utils/isNonNullable.d.ts +2 -0
  223. package/dist/types/src/utils/isNonNullable.d.ts.map +1 -0
  224. package/dist/useMediaQuery.cjs.js +38 -0
  225. package/dist/useMediaQuery.cjs.js.map +1 -0
  226. package/dist/useMediaQuery.es.js +37 -0
  227. package/dist/useMediaQuery.es.js.map +1 -0
  228. package/package.json +10 -2
  229. package/state/breakpoints.js +1 -0
  230. package/dist/isNonNullable.cjs.js +0 -6
  231. package/dist/isNonNullable.cjs.js.map +0 -1
  232. package/dist/isNonNullable.es.js +0 -5
  233. package/dist/isNonNullable.es.js.map +0 -1
  234. package/dist/responsive-style.cjs.js +0 -917
  235. package/dist/responsive-style.cjs.js.map +0 -1
  236. package/dist/responsive-style.es.js +0 -853
  237. package/dist/responsive-style.es.js.map +0 -1
  238. package/dist/types/src/components/utils/devices.d.ts +0 -17
  239. package/dist/types/src/components/utils/devices.d.ts.map +0 -1
package/dist/index.cjs.js CHANGED
@@ -35,12 +35,15 @@ var __publicField = (obj, key, value) => {
35
35
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
36
36
  return value;
37
37
  };
38
+ var _c;
38
39
  var React = require("react");
39
40
  var withSelector = require("use-sync-external-store/shim/with-selector");
40
41
  var dynamic = require("next/dynamic");
41
42
  var constants = require("./constants.cjs.js");
42
43
  var actions = require("./actions.cjs.js");
43
- var responsiveStyle = require("./responsive-style.cjs.js");
44
+ var css = require("@emotion/css");
45
+ var serialize = require("@emotion/serialize");
46
+ var utils = require("@emotion/utils");
44
47
  var jsxRuntime = require("react/jsx-runtime");
45
48
  var descriptors = require("./descriptors.cjs.js");
46
49
  require("slate");
@@ -48,16 +51,17 @@ var textInput = require("./text-input.cjs.js");
48
51
  var combobox = require("./combobox.cjs.js");
49
52
  require("slate-react");
50
53
  var shim = require("use-sync-external-store/shim");
54
+ var redux = require("redux");
55
+ var thunk = require("redux-thunk");
56
+ var types = require("./types.cjs.js");
51
57
  var introspection = require("./introspection.cjs.js");
52
- var isNonNullable = require("./isNonNullable.cjs.js");
58
+ var state_breakpoints = require("./state/breakpoints.cjs.js");
53
59
  var boxModels = require("./box-models.cjs.js");
54
60
  var ColorHelper = require("color");
55
61
  var scrollIntoView = require("scroll-into-view-if-needed");
56
- var css = require("@emotion/css");
57
62
  var reactDom = require("react-dom");
58
63
  var parse = require("html-react-parser");
59
64
  var Head = require("next/head");
60
- var types = require("./types.cjs.js");
61
65
  var createEmotionServer = require("@emotion/server/create-instance");
62
66
  var NextDocument = require("next/document");
63
67
  var Cors = require("cors");
@@ -92,6 +96,7 @@ function _interopNamespace(e) {
92
96
  }
93
97
  var React__namespace = /* @__PURE__ */ _interopNamespace(React);
94
98
  var dynamic__default = /* @__PURE__ */ _interopDefaultLegacy(dynamic);
99
+ var thunk__default = /* @__PURE__ */ _interopDefaultLegacy(thunk);
95
100
  var ColorHelper__default = /* @__PURE__ */ _interopDefaultLegacy(ColorHelper);
96
101
  var scrollIntoView__default = /* @__PURE__ */ _interopDefaultLegacy(scrollIntoView);
97
102
  var parse__default = /* @__PURE__ */ _interopDefaultLegacy(parse);
@@ -144,6 +149,448 @@ function BodySnippet({
144
149
  }, [code, cleanup]);
145
150
  return null;
146
151
  }
152
+ function is(x, y) {
153
+ if (x === y)
154
+ return x !== 0 || y !== 0 || 1 / x === 1 / y;
155
+ return x !== x && y !== y;
156
+ }
157
+ const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
158
+ const shallowEqual = (a, b) => {
159
+ if (is(a, b))
160
+ return true;
161
+ if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
162
+ return false;
163
+ const keysA = Object.keys(a);
164
+ const keysB = Object.keys(b);
165
+ if (keysA.length !== keysB.length)
166
+ return false;
167
+ for (let i = 0; i < keysA.length; i += 1) {
168
+ if (!hasOwnProperty$1.call(b, keysA[i]) || !is(a[keysA[i]], b[keysA[i]]))
169
+ return false;
170
+ }
171
+ return true;
172
+ };
173
+ const { hasOwnProperty } = Object.prototype;
174
+ const deepEqual = (a, b) => {
175
+ if (shallowEqual(a, b))
176
+ return true;
177
+ if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
178
+ return false;
179
+ const keysA = Object.keys(a);
180
+ const keysB = Object.keys(b);
181
+ if (keysA.length !== keysB.length)
182
+ return false;
183
+ for (let i = 0; i < keysA.length; i += 1) {
184
+ if (!hasOwnProperty.call(b, keysA[i]) || !deepEqual(a[keysA[i]], b[keysA[i]]))
185
+ return false;
186
+ }
187
+ return true;
188
+ };
189
+ function getInitialState(serializedState = {
190
+ Swatch: [],
191
+ File: [],
192
+ Typography: [],
193
+ PagePathnameSlice: [],
194
+ GlobalElement: [],
195
+ Table: [],
196
+ Snippet: [],
197
+ Page: [],
198
+ Site: []
199
+ }) {
200
+ return new Map(Object.entries(serializedState).map(([apiResourceType, resources]) => [
201
+ apiResourceType,
202
+ new Map(resources.map(({ id, value }) => [id, value]))
203
+ ]));
204
+ }
205
+ function getHasAPIResource$1(state, resourceType, resourceId) {
206
+ var _a, _b;
207
+ return (_b = (_a = state.get(resourceType)) == null ? void 0 : _a.has(resourceId)) != null ? _b : false;
208
+ }
209
+ function getAPIResource$1(state, resourceType, resourceId) {
210
+ var _a;
211
+ const resource = (_a = state.get(resourceType)) == null ? void 0 : _a.get(resourceId);
212
+ return (resource == null ? void 0 : resource.__typename) === resourceType ? resource : null;
213
+ }
214
+ function reducer$1(state = getInitialState(), action) {
215
+ switch (action.type) {
216
+ case actions.ActionTypes.API_RESOURCE_FULFILLED: {
217
+ const { resourceType, resourceId, resource } = action.payload;
218
+ return new Map(state).set(resourceType, new Map(state.get(resourceType)).set(resourceId, resource));
219
+ }
220
+ case actions.ActionTypes.CHANGE_API_RESOURCE: {
221
+ const existingApiResource = getAPIResource$1(state, action.payload.resource.__typename, action.payload.resource.id);
222
+ if (deepEqual(existingApiResource, action.payload.resource))
223
+ return state;
224
+ 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));
225
+ }
226
+ case actions.ActionTypes.EVICT_API_RESOURCE: {
227
+ const [resourceType, resourceId] = action.payload.id.split(":");
228
+ if (!(resourceType in types.APIResourceType))
229
+ return state;
230
+ const resources = new Map(state.get(resourceType));
231
+ const deleted = resources.delete(resourceId);
232
+ return deleted ? new Map(state).set(resourceType, resources) : state;
233
+ }
234
+ default:
235
+ return state;
236
+ }
237
+ }
238
+ const reducer = reducer$1;
239
+ function getHasAPIResource(state, resourceType, resourceId) {
240
+ return getHasAPIResource$1(state, resourceType, resourceId);
241
+ }
242
+ function getAPIResource(state, resourceType, resourceId) {
243
+ return getAPIResource$1(state, resourceType, resourceId);
244
+ }
245
+ async function fetchJson(url) {
246
+ var _a;
247
+ const response = await fetch(url, {
248
+ headers: { "Content-Type": "application/json" }
249
+ });
250
+ if (response.status === 404)
251
+ return null;
252
+ if (!response.ok)
253
+ throw new Error(response.statusText);
254
+ if (((_a = response.headers.get("content-type")) == null ? void 0 : _a.includes("application/json")) !== true) {
255
+ throw new Error(`Expected JSON response from "${url}" but got "${response.headers.get("content-type")}"`);
256
+ }
257
+ return response.json();
258
+ }
259
+ function fetchAPIResource(resourceType, resourceId) {
260
+ return async (dispatch, getState) => {
261
+ const state = getState();
262
+ if (getHasAPIResource(state, resourceType, resourceId)) {
263
+ return getAPIResource(state, resourceType, resourceId);
264
+ }
265
+ let resource;
266
+ switch (resourceType) {
267
+ case types.APIResourceType.Swatch:
268
+ resource = await fetchJson(`/api/makeswift/swatches/${resourceId}`);
269
+ break;
270
+ case types.APIResourceType.File:
271
+ resource = await fetchJson(`/api/makeswift/files/${resourceId}`);
272
+ break;
273
+ case types.APIResourceType.Typography:
274
+ resource = await fetchJson(`/api/makeswift/typographies/${resourceId}`);
275
+ break;
276
+ case types.APIResourceType.GlobalElement:
277
+ resource = await fetchJson(`/api/makeswift/global-elements/${resourceId}`);
278
+ break;
279
+ case types.APIResourceType.PagePathnameSlice:
280
+ resource = await fetchJson(`/api/makeswift/page-pathname-slices/${resourceId}`);
281
+ break;
282
+ case types.APIResourceType.Table:
283
+ resource = await fetchJson(`/api/makeswift/tables/${resourceId}`);
284
+ break;
285
+ default:
286
+ resource = null;
287
+ }
288
+ dispatch(actions.apiResourceFulfilled(resourceType, resourceId, resource));
289
+ return resource;
290
+ };
291
+ }
292
+ function configureStore({ serializedState }) {
293
+ return redux.createStore(reducer, getInitialState(serializedState), redux.applyMiddleware(thunk__default["default"]));
294
+ }
295
+ class GraphQLClient {
296
+ constructor(endpoint) {
297
+ __publicField(this, "endpoint");
298
+ this.endpoint = endpoint;
299
+ }
300
+ async request(query, variables = {}) {
301
+ const response = await fetch(this.endpoint, {
302
+ method: "POST",
303
+ headers: { "Content-Type": "application/json" },
304
+ body: JSON.stringify({ query, variables })
305
+ });
306
+ if (!response.ok && response.status !== 400) {
307
+ throw new Error(`${response.status} ${response.statusText}`);
308
+ }
309
+ const body = await response.json();
310
+ if (body.errors != null) {
311
+ console.error(body);
312
+ throw new Error("GraphQL response contains errors, check the console.");
313
+ }
314
+ return body.data;
315
+ }
316
+ }
317
+ const SwatchFragment = `
318
+ fragment Swatch on Swatch {
319
+ __typename
320
+ id
321
+ hue
322
+ saturation
323
+ lightness
324
+ }
325
+ `;
326
+ const FileFragment = `
327
+ fragment File on File {
328
+ __typename
329
+ id
330
+ name
331
+ publicUrl: publicUrlV2
332
+ extension
333
+ dimensions {
334
+ width
335
+ height
336
+ }
337
+ }
338
+ `;
339
+ const TypographyFragment = `
340
+ fragment Typography on Typography {
341
+ __typename
342
+ id
343
+ name
344
+ style {
345
+ deviceId
346
+ value {
347
+ fontFamily
348
+ fontSize {
349
+ value
350
+ unit
351
+ }
352
+ color {
353
+ swatchId
354
+ alpha
355
+ }
356
+ lineHeight
357
+ letterSpacing
358
+ fontWeight
359
+ textAlign
360
+ uppercase
361
+ underline
362
+ strikethrough
363
+ italic
364
+ }
365
+ }
366
+ }
367
+ `;
368
+ const PagePathnameSliceFragment = `
369
+ fragment PagePathnameSlice on PagePathnameSlice {
370
+ __typename
371
+ id
372
+ pathname
373
+ }
374
+ `;
375
+ const GlobalElementFragment = `
376
+ fragment GlobalElement on GlobalElement {
377
+ __typename
378
+ id
379
+ data
380
+ }
381
+ `;
382
+ const TableFragment = `
383
+ fragment Table on Table {
384
+ __typename
385
+ id
386
+ name
387
+ columns {
388
+ __typename
389
+ id
390
+ name
391
+
392
+ ... on MultipleSelectTableColumn {
393
+ options {
394
+ id
395
+ name
396
+ }
397
+ }
398
+
399
+ ... on SingleSelectTableColumn {
400
+ options {
401
+ id
402
+ name
403
+ }
404
+ }
405
+ }
406
+ }
407
+ `;
408
+ const IntrospectedResourcesQuery = `
409
+ query IntrospectedResources(
410
+ $swatchIds: [ID!]!
411
+ $fileIds: [ID!]!
412
+ $pageIds: [ID!]!
413
+ $tableIds: [ID!]!
414
+ ) {
415
+ swatches(ids: $swatchIds) {
416
+ ...Swatch
417
+ }
418
+
419
+ files(ids: $fileIds) {
420
+ ...File
421
+ }
422
+
423
+ pagePathnamesById(ids: $pageIds) {
424
+ ...PagePathnameSlice
425
+ }
426
+
427
+ tables(ids: $tableIds) {
428
+ ...Table
429
+ }
430
+ }
431
+
432
+ ${SwatchFragment}
433
+ ${FileFragment}
434
+ ${PagePathnameSliceFragment}
435
+ ${TableFragment}
436
+ `;
437
+ const SwatchQuery = `
438
+ query Swatch($swatchId: ID!) {
439
+ swatch(id: $swatchId) {
440
+ ...Swatch
441
+ }
442
+ }
443
+
444
+ ${SwatchFragment}
445
+ `;
446
+ const FileQuery = `
447
+ query File($fileId: ID!) {
448
+ file(id: $fileId) {
449
+ ...File
450
+ }
451
+ }
452
+
453
+ ${FileFragment}
454
+ `;
455
+ const TypographyQuery = `
456
+ query Typography($typographyId: ID!) {
457
+ typography(id: $typographyId) {
458
+ ...Typography
459
+ }
460
+ }
461
+
462
+ ${TypographyFragment}
463
+ `;
464
+ const PagePathnamesByIdQuery = `
465
+ query PagePathnamesById($pageIds: [ID!]!) {
466
+ pagePathnamesById(ids: $pageIds) {
467
+ ...PagePathnameSlice
468
+ }
469
+ }
470
+
471
+ ${PagePathnameSliceFragment}
472
+ `;
473
+ const TableQuery = `
474
+ query Table($tableId: ID!) {
475
+ table(id: $tableId) {
476
+ ...Table
477
+ }
478
+ }
479
+
480
+ ${TableFragment}
481
+ `;
482
+ const TypographiesQuery = `
483
+ query Typographies($typographyIds: [ID!]!) {
484
+ typographies(ids: $typographyIds) {
485
+ ...Typography
486
+ }
487
+ }
488
+
489
+ ${TypographyFragment}
490
+ `;
491
+ const GlobalElementQuery = `
492
+ query GlobalElement($globalElementId: ID!) {
493
+ globalElement(id: $globalElementId) {
494
+ ...GlobalElement
495
+ }
496
+ }
497
+
498
+ ${GlobalElementFragment}
499
+ `;
500
+ const CreateTableRecordMutation = `
501
+ mutation CreateTableRecord($input: CreateTableRecordInput!) {
502
+ createTableRecord(input: $input) {
503
+ tableRecord {
504
+ id
505
+ }
506
+ }
507
+ }
508
+ `;
509
+ class MakeswiftClient {
510
+ constructor({
511
+ uri,
512
+ cacheData
513
+ }) {
514
+ __publicField(this, "graphqlClient");
515
+ __publicField(this, "makeswiftApiClient");
516
+ __publicField(this, "subscribe");
517
+ this.graphqlClient = new GraphQLClient(uri);
518
+ this.makeswiftApiClient = configureStore({
519
+ serializedState: cacheData
520
+ });
521
+ this.subscribe = this.makeswiftApiClient.subscribe;
522
+ }
523
+ readSwatch(swatchId) {
524
+ return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.Swatch, swatchId);
525
+ }
526
+ async fetchSwatch(swatchId) {
527
+ return await this.makeswiftApiClient.dispatch(fetchAPIResource(types.APIResourceType.Swatch, swatchId));
528
+ }
529
+ readFile(fileId) {
530
+ return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.File, fileId);
531
+ }
532
+ async fetchFile(fileId) {
533
+ return await this.makeswiftApiClient.dispatch(fetchAPIResource(types.APIResourceType.File, fileId));
534
+ }
535
+ readTypography(typographyId) {
536
+ return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.Typography, typographyId);
537
+ }
538
+ async fetchTypography(typographyId) {
539
+ return await this.makeswiftApiClient.dispatch(fetchAPIResource(types.APIResourceType.Typography, typographyId));
540
+ }
541
+ readGlobalElement(globalElementId) {
542
+ return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.GlobalElement, globalElementId);
543
+ }
544
+ async fetchGlobalElement(globalElementId) {
545
+ return await this.makeswiftApiClient.dispatch(fetchAPIResource(types.APIResourceType.GlobalElement, globalElementId));
546
+ }
547
+ readPagePathnameSlice(pageId) {
548
+ return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.PagePathnameSlice, pageId);
549
+ }
550
+ async fetchPagePathnameSlice(pageId) {
551
+ return await this.makeswiftApiClient.dispatch(fetchAPIResource(types.APIResourceType.PagePathnameSlice, pageId));
552
+ }
553
+ readTable(tableId) {
554
+ return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.Table, tableId);
555
+ }
556
+ async fetchTable(tableId) {
557
+ return await this.makeswiftApiClient.dispatch(fetchAPIResource(types.APIResourceType.Table, tableId));
558
+ }
559
+ async createTableRecord(tableId, columns) {
560
+ await this.graphqlClient.request(CreateTableRecordMutation, {
561
+ input: {
562
+ data: {
563
+ tableId,
564
+ columns
565
+ }
566
+ }
567
+ });
568
+ }
569
+ readSite(siteId) {
570
+ return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.Site, siteId);
571
+ }
572
+ readPage(pageId) {
573
+ return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.Page, pageId);
574
+ }
575
+ readSnippet(snippetId) {
576
+ return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.Snippet, snippetId);
577
+ }
578
+ }
579
+ const Context$1 = React.createContext(new MakeswiftClient({
580
+ uri: "https://api.makeswift.com/graphql"
581
+ }));
582
+ function useMakeswiftClient() {
583
+ return React.useContext(Context$1);
584
+ }
585
+ function MakeswiftProvider({
586
+ client,
587
+ children
588
+ }) {
589
+ return /* @__PURE__ */ jsxRuntime.jsx(Context$1.Provider, {
590
+ value: client,
591
+ children
592
+ });
593
+ }
147
594
  const SnippetLocation = {
148
595
  Body: "BODY",
149
596
  Head: "HEAD"
@@ -191,7 +638,7 @@ function Page$1({
191
638
  return;
192
639
  const oldSnippets = snippets.map(filterUsedSnippetProperties);
193
640
  const newSnippets = cachedPage.snippets.map(filterUsedSnippetProperties);
194
- if (responsiveStyle.deepEqual(newSnippets, oldSnippets))
641
+ if (deepEqual(newSnippets, oldSnippets))
195
642
  return;
196
643
  setSnippets(cachedPage.snippets);
197
644
  }, [cachedPage]);
@@ -333,22 +780,23 @@ function Page$1({
333
780
  });
334
781
  }
335
782
  function useCachedPage(pageId) {
336
- const client = responsiveStyle.useMakeswiftClient();
783
+ const client = useMakeswiftClient();
337
784
  const getSnapshot = () => pageId == null ? null : client.readPage(pageId);
338
785
  const page = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
339
786
  return page;
340
787
  }
341
788
  function useCachedSite(siteId) {
342
- const client = responsiveStyle.useMakeswiftClient();
789
+ const client = useMakeswiftClient();
343
790
  const getSnapshot = () => siteId == null ? null : client.readSite(siteId);
344
791
  const site = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
345
792
  return site;
346
793
  }
347
794
  class Makeswift {
348
- constructor(apiKey, { apiOrigin = "https://api.makeswift.com" } = {}) {
795
+ constructor(apiKey, { apiOrigin = "https://api.makeswift.com", runtime } = {}) {
349
796
  __publicField(this, "apiKey");
350
797
  __publicField(this, "apiOrigin");
351
798
  __publicField(this, "graphqlClient");
799
+ __publicField(this, "runtime");
352
800
  if (typeof apiKey !== "string") {
353
801
  throw new Error(`The Makeswift client must be passed a valid Makeswift site API key: \`new Makeswift('<makeswift_site_api_key>')\`
354
802
  Received "${apiKey}" instead.`);
@@ -359,7 +807,8 @@ Received "${apiKey}" instead.`);
359
807
  } catch {
360
808
  throw new Error(`The Makeswift client received an invalid \`apiOrigin\` parameter: "${apiOrigin}".`);
361
809
  }
362
- this.graphqlClient = new responsiveStyle.GraphQLClient(new URL("graphql", apiOrigin).href);
810
+ this.graphqlClient = new GraphQLClient(new URL("graphql", apiOrigin).href);
811
+ this.runtime = runtime;
363
812
  }
364
813
  async fetch(path, init) {
365
814
  const response = await fetch(new URL(path, this.apiOrigin).toString(), __spreadProps(__spreadValues({}, init), {
@@ -377,15 +826,17 @@ Received "${apiKey}" instead.`);
377
826
  return json;
378
827
  }
379
828
  async getTypographies(typographyIds) {
380
- const result = await this.graphqlClient.request(responsiveStyle.TypographiesQuery, { typographyIds });
829
+ const result = await this.graphqlClient.request(TypographiesQuery, { typographyIds });
381
830
  return result.typographies;
382
831
  }
383
832
  async getIntrospectedResources(introspectedResourceIds) {
384
- const result = await this.graphqlClient.request(responsiveStyle.IntrospectedResourcesQuery, introspectedResourceIds);
833
+ const result = await this.graphqlClient.request(IntrospectedResourcesQuery, introspectedResourceIds);
385
834
  return result;
386
835
  }
387
836
  async introspect(element) {
388
- const descriptors$1 = constants.getPropControllerDescriptors(storeContextDefaultValue.getState());
837
+ var _a;
838
+ const runtime = (_a = this.runtime) != null ? _a : ReactRuntime;
839
+ const descriptors$1 = constants.getPropControllerDescriptors(runtime.store.getState());
389
840
  const swatchIds = /* @__PURE__ */ new Set();
390
841
  const fileIds = /* @__PURE__ */ new Set();
391
842
  const typographyIds = /* @__PURE__ */ new Set();
@@ -460,8 +911,8 @@ Received "${apiKey}" instead.`);
460
911
  const typographies = await this.getTypographies([...typographyIds]);
461
912
  typographies.forEach((typography) => {
462
913
  typography == null ? void 0 : typography.style.forEach((style) => {
463
- var _a;
464
- const swatchId = (_a = style.value.color) == null ? void 0 : _a.swatchId;
914
+ var _a2;
915
+ const swatchId = (_a2 = style.value.color) == null ? void 0 : _a2.swatchId;
465
916
  if (swatchId != null)
466
917
  swatchIds.add(swatchId);
467
918
  });
@@ -477,38 +928,38 @@ Received "${apiKey}" instead.`);
477
928
  }));
478
929
  return {
479
930
  [types.APIResourceType.Swatch]: [...swatchIds].map((id) => {
480
- var _a;
931
+ var _a2;
481
932
  return {
482
933
  id,
483
- value: (_a = swatches.find((swatch) => (swatch == null ? void 0 : swatch.id) === id)) != null ? _a : null
934
+ value: (_a2 = swatches.find((swatch) => (swatch == null ? void 0 : swatch.id) === id)) != null ? _a2 : null
484
935
  };
485
936
  }),
486
937
  [types.APIResourceType.File]: [...fileIds].map((id) => {
487
- var _a;
938
+ var _a2;
488
939
  return {
489
940
  id,
490
- value: (_a = files.find((file) => (file == null ? void 0 : file.id) === id)) != null ? _a : null
941
+ value: (_a2 = files.find((file) => (file == null ? void 0 : file.id) === id)) != null ? _a2 : null
491
942
  };
492
943
  }),
493
944
  [types.APIResourceType.Typography]: [...typographyIds].map((id) => {
494
- var _a;
945
+ var _a2;
495
946
  return {
496
947
  id,
497
- value: (_a = typographies.find((typography) => (typography == null ? void 0 : typography.id) === id)) != null ? _a : null
948
+ value: (_a2 = typographies.find((typography) => (typography == null ? void 0 : typography.id) === id)) != null ? _a2 : null
498
949
  };
499
950
  }),
500
951
  [types.APIResourceType.Table]: [...tableIds].map((id) => {
501
- var _a;
952
+ var _a2;
502
953
  return {
503
954
  id,
504
- value: (_a = tables.find((table) => (table == null ? void 0 : table.id) === id)) != null ? _a : null
955
+ value: (_a2 = tables.find((table) => (table == null ? void 0 : table.id) === id)) != null ? _a2 : null
505
956
  };
506
957
  }),
507
958
  [types.APIResourceType.PagePathnameSlice]: [...pageIds].map((id) => {
508
- var _a;
959
+ var _a2;
509
960
  return {
510
961
  id,
511
- value: (_a = pagePathnameSlices.find((pagePathnameSlice) => (pagePathnameSlice == null ? void 0 : pagePathnameSlice.id) === id)) != null ? _a : null
962
+ value: (_a2 = pagePathnameSlices.find((pagePathnameSlice) => (pagePathnameSlice == null ? void 0 : pagePathnameSlice.id) === id)) != null ? _a2 : null
512
963
  };
513
964
  }),
514
965
  [types.APIResourceType.GlobalElement]: [...globalElements.entries()].map(([id, value]) => ({
@@ -540,28 +991,28 @@ Received "${apiKey}" instead.`);
540
991
  return snapshot;
541
992
  }
542
993
  async getSwatch(swatchId) {
543
- const result = await this.graphqlClient.request(responsiveStyle.SwatchQuery, { swatchId });
994
+ const result = await this.graphqlClient.request(SwatchQuery, { swatchId });
544
995
  return result.swatch;
545
996
  }
546
997
  async getFile(fileId) {
547
- const result = await this.graphqlClient.request(responsiveStyle.FileQuery, { fileId });
998
+ const result = await this.graphqlClient.request(FileQuery, { fileId });
548
999
  return result.file;
549
1000
  }
550
1001
  async getTypography(typographyId) {
551
- const result = await this.graphqlClient.request(responsiveStyle.TypographyQuery, { typographyId });
1002
+ const result = await this.graphqlClient.request(TypographyQuery, { typographyId });
552
1003
  return result.typography;
553
1004
  }
554
1005
  async getGlobalElement(globalElementId) {
555
- const result = await this.graphqlClient.request(responsiveStyle.GlobalElementQuery, { globalElementId });
1006
+ const result = await this.graphqlClient.request(GlobalElementQuery, { globalElementId });
556
1007
  return result.globalElement;
557
1008
  }
558
1009
  async getPagePathnameSlice(pageId) {
559
1010
  var _a;
560
- const result = await this.graphqlClient.request(responsiveStyle.PagePathnamesByIdQuery, { pageIds: [pageId] });
1011
+ const result = await this.graphqlClient.request(PagePathnamesByIdQuery, { pageIds: [pageId] });
561
1012
  return (_a = result.pagePathnamesById.at(0)) != null ? _a : null;
562
1013
  }
563
1014
  async getTable(tableId) {
564
- const result = await this.graphqlClient.request(responsiveStyle.TableQuery, { tableId });
1015
+ const result = await this.graphqlClient.request(TableQuery, { tableId });
565
1016
  return result.table;
566
1017
  }
567
1018
  }
@@ -710,7 +1161,7 @@ async function fonts(_req, res, { getFonts } = {}) {
710
1161
  const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
711
1162
  return res.json(fonts2);
712
1163
  }
713
- const version = "0.8.5";
1164
+ const version = "0.8.7";
714
1165
  async function handler(req, res, { apiKey }) {
715
1166
  if (req.query.secret !== apiKey) {
716
1167
  return res.status(401).json({ message: "Unauthorized" });
@@ -720,7 +1171,8 @@ async function handler(req, res, { apiKey }) {
720
1171
  previewMode: true,
721
1172
  interactionMode: true,
722
1173
  clientSideNavigation: true,
723
- elementFromPoint: false
1174
+ elementFromPoint: false,
1175
+ customBreakpoints: true
724
1176
  });
725
1177
  }
726
1178
  async function proxyPreviewMode(req, res, { apiKey }) {
@@ -923,14 +1375,14 @@ async function getStaticPaths() {
923
1375
  }
924
1376
  const REVALIDATE_SECONDS = 1;
925
1377
  async function getStaticProps(ctx) {
926
- var _a, _b, _c;
1378
+ var _a, _b, _c2;
927
1379
  deprecationWarning("getStaticProps");
928
1380
  const makeswift = new Makeswift(getApiKey(), {
929
1381
  apiOrigin: getApiOrigin()
930
1382
  });
931
1383
  const path = "/" + ((_b = (_a = ctx.params) == null ? void 0 : _a.path) != null ? _b : []).join("/");
932
1384
  const snapshot = await makeswift.getPageSnapshot(path, {
933
- preview: ((_c = ctx.previewData) == null ? void 0 : _c.makeswift) === true
1385
+ preview: ((_c2 = ctx.previewData) == null ? void 0 : _c2.makeswift) === true
934
1386
  });
935
1387
  if (snapshot == null)
936
1388
  return {
@@ -965,9 +1417,10 @@ async function getServerSideProps(ctx) {
965
1417
  };
966
1418
  }
967
1419
  const Page = React.memo(({
968
- snapshot
1420
+ snapshot,
1421
+ runtime
969
1422
  }) => {
970
- const client = React.useMemo(() => new responsiveStyle.MakeswiftClient({
1423
+ const client = React.useMemo(() => new MakeswiftClient({
971
1424
  uri: new URL("graphql", snapshot.apiOrigin).href,
972
1425
  cacheData: snapshot.cacheData
973
1426
  }), [snapshot]);
@@ -975,6 +1428,7 @@ const Page = React.memo(({
975
1428
  client,
976
1429
  rootElements: /* @__PURE__ */ new Map([[snapshot.document.id, snapshot.document.data]]),
977
1430
  preview: snapshot.preview,
1431
+ runtime,
978
1432
  children: /* @__PURE__ */ jsxRuntime.jsx(Page$1, {
979
1433
  document: snapshot.document
980
1434
  }, snapshot.document.data.key)
@@ -991,7 +1445,7 @@ function registerComponent$c(runtime) {
991
1445
  function isHiddenBasedOnAnimationType(props, deviceId, property) {
992
1446
  var _a, _b;
993
1447
  const animateIn = props[property];
994
- return ((_b = (_a = responsiveStyle.findDeviceOverride(animateIn, deviceId)) == null ? void 0 : _a.value) != null ? _b : "none") === "none";
1448
+ return ((_b = (_a = state_breakpoints.findBreakpointOverride(runtime.getBreakpoints(), animateIn, deviceId)) == null ? void 0 : _a.value) != null ? _b : "none") === "none";
995
1449
  }
996
1450
  const isHiddenBasedOnBoxAnimation = (props, deviceId) => isHiddenBasedOnAnimationType(props, deviceId, "boxAnimateType");
997
1451
  const isHiddenBasedOnItemAnimation = (props, deviceId) => isHiddenBasedOnAnimationType(props, deviceId, "itemAnimateType");
@@ -1034,7 +1488,7 @@ function registerComponent$c(runtime) {
1034
1488
  format: descriptors.Padding.Format.ClassName,
1035
1489
  preset: [
1036
1490
  {
1037
- deviceId: "desktop",
1491
+ deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
1038
1492
  value: {
1039
1493
  paddingTop: { value: 10, unit: "px" },
1040
1494
  paddingRight: { value: 10, unit: "px" },
@@ -1186,7 +1640,7 @@ function registerComponent$b(runtime) {
1186
1640
  color: descriptors.ResponsiveColor((props, device) => {
1187
1641
  var _a;
1188
1642
  const variant = props.variant;
1189
- const hidden = ((_a = responsiveStyle.findDeviceOverride(variant, device)) == null ? void 0 : _a.value) === "clear";
1643
+ const hidden = ((_a = state_breakpoints.findBreakpointOverride(runtime.getBreakpoints(), variant, device)) == null ? void 0 : _a.value) === "clear";
1190
1644
  return { placeholder: "black", hidden };
1191
1645
  }),
1192
1646
  textColor: descriptors.ResponsiveColor({
@@ -1235,7 +1689,7 @@ function registerComponent$a(runtime) {
1235
1689
  step: descriptors.ResponsiveNumber((props, device) => {
1236
1690
  var _a, _b;
1237
1691
  const pageSize = props.pageSize;
1238
- const pageSizeValue = (_b = (_a = responsiveStyle.findDeviceOverride(pageSize, device)) == null ? void 0 : _a.value) != null ? _b : 1;
1692
+ const pageSizeValue = (_b = (_a = state_breakpoints.findBreakpointOverride(runtime.getBreakpoints(), pageSize, device)) == null ? void 0 : _a.value) != null ? _b : 1;
1239
1693
  return {
1240
1694
  label: "Step",
1241
1695
  defaultValue: 1,
@@ -1349,7 +1803,12 @@ function registerComponent$9(runtime) {
1349
1803
  defaultValue: "medium"
1350
1804
  }),
1351
1805
  gap: descriptors.GapX({
1352
- preset: [{ deviceId: "desktop", value: { value: 10, unit: "px" } }],
1806
+ preset: [
1807
+ {
1808
+ deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
1809
+ value: { value: 10, unit: "px" }
1810
+ }
1811
+ ],
1353
1812
  label: "Gap",
1354
1813
  step: 1,
1355
1814
  min: 0,
@@ -1481,7 +1940,12 @@ function registerComponent$6(runtime) {
1481
1940
  hidden: props.tableId == null
1482
1941
  })),
1483
1942
  gap: descriptors.GapY((props) => ({
1484
- preset: [{ deviceId: "desktop", value: { value: 10, unit: "px" } }],
1943
+ preset: [
1944
+ {
1945
+ deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
1946
+ value: { value: 10, unit: "px" }
1947
+ }
1948
+ ],
1485
1949
  label: "Gap",
1486
1950
  defaultValue: { value: 0, unit: "px" },
1487
1951
  hidden: props.tableId == null
@@ -1519,7 +1983,7 @@ function registerComponent$6(runtime) {
1519
1983
  labelTextColor: descriptors.ResponsiveColor((props, device) => {
1520
1984
  const hidden = props.tableId == null;
1521
1985
  const responsiveContrast = props.contrast;
1522
- const contrast = responsiveStyle.findDeviceOverride(responsiveContrast, device);
1986
+ const contrast = state_breakpoints.findBreakpointOverride(runtime.getBreakpoints(), responsiveContrast, device);
1523
1987
  return {
1524
1988
  hidden,
1525
1989
  label: "Label text color",
@@ -1571,7 +2035,12 @@ function registerComponent$6(runtime) {
1571
2035
  hidden: props.tableId == null
1572
2036
  })),
1573
2037
  width: descriptors.Width({
1574
- preset: [{ deviceId: "desktop", value: { value: 550, unit: "px" } }],
2038
+ preset: [
2039
+ {
2040
+ deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
2041
+ value: { value: 550, unit: "px" }
2042
+ }
2043
+ ],
1575
2044
  defaultValue: { value: 100, unit: "%" },
1576
2045
  format: descriptors.Width.Format.ClassName
1577
2046
  }),
@@ -1623,7 +2092,12 @@ function registerComponent$4(runtime) {
1623
2092
  hidden: props.showLogo === false
1624
2093
  })),
1625
2094
  logoWidth: descriptors.ResponsiveLength((props) => ({
1626
- preset: [{ deviceId: "desktop", value: { value: 100, unit: "px" } }],
2095
+ preset: [
2096
+ {
2097
+ deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
2098
+ value: { value: 100, unit: "px" }
2099
+ }
2100
+ ],
1627
2101
  label: "Logo width",
1628
2102
  min: 0,
1629
2103
  max: 1e3,
@@ -1648,7 +2122,12 @@ function registerComponent$4(runtime) {
1648
2122
  defaultValue: "flex-end"
1649
2123
  }),
1650
2124
  gutter: descriptors.GapX({
1651
- preset: [{ deviceId: "desktop", value: { value: 10, unit: "px" } }],
2125
+ preset: [
2126
+ {
2127
+ deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
2128
+ value: { value: 10, unit: "px" }
2129
+ }
2130
+ ],
1652
2131
  label: "Link gap",
1653
2132
  min: 0,
1654
2133
  max: 100,
@@ -1664,7 +2143,7 @@ function registerComponent$4(runtime) {
1664
2143
  }),
1665
2144
  mobileMenuOpenIconColor: descriptors.ResponsiveColor((props, device) => {
1666
2145
  const mobileMenuAnimation = props.mobileMenuAnimation;
1667
- const hidden = !responsiveStyle.findDeviceOverride(mobileMenuAnimation, device);
2146
+ const hidden = !state_breakpoints.findBreakpointOverride(runtime.getBreakpoints(), mobileMenuAnimation, device);
1668
2147
  return {
1669
2148
  label: "Open icon color",
1670
2149
  placeholder: "rgba(161, 168, 194, 0.5)",
@@ -1673,7 +2152,7 @@ function registerComponent$4(runtime) {
1673
2152
  }),
1674
2153
  mobileMenuCloseIconColor: descriptors.ResponsiveColor((props, device) => {
1675
2154
  const mobileMenuAnimation = props.mobileMenuAnimation;
1676
- const hidden = !responsiveStyle.findDeviceOverride(mobileMenuAnimation, device);
2155
+ const hidden = !state_breakpoints.findBreakpointOverride(runtime.getBreakpoints(), mobileMenuAnimation, device);
1677
2156
  return {
1678
2157
  label: "Close icon color",
1679
2158
  placeholder: "rgba(161, 168, 194, 0.5)",
@@ -1682,7 +2161,7 @@ function registerComponent$4(runtime) {
1682
2161
  }),
1683
2162
  mobileMenuBackgroundColor: descriptors.ResponsiveColor((props, device) => {
1684
2163
  const mobileMenuAnimation = props.mobileMenuAnimation;
1685
- const hidden = !responsiveStyle.findDeviceOverride(mobileMenuAnimation, device);
2164
+ const hidden = !state_breakpoints.findBreakpointOverride(runtime.getBreakpoints(), mobileMenuAnimation, device);
1686
2165
  return {
1687
2166
  label: "Menu BG color",
1688
2167
  placeholder: "black",
@@ -1809,7 +2288,12 @@ function registerComponent$2(runtime) {
1809
2288
  defaultValue: "center"
1810
2289
  }),
1811
2290
  gutter: descriptors.GapX({
1812
- preset: [{ deviceId: "desktop", value: { value: 10, unit: "px" } }],
2291
+ preset: [
2292
+ {
2293
+ deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
2294
+ value: { value: 10, unit: "px" }
2295
+ }
2296
+ ],
1813
2297
  label: "Link gap",
1814
2298
  min: 0,
1815
2299
  max: 100,
@@ -1824,7 +2308,7 @@ function registerComponent$2(runtime) {
1824
2308
  format: descriptors.Margin.Format.ClassName,
1825
2309
  preset: [
1826
2310
  {
1827
- deviceId: "desktop",
2311
+ deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
1828
2312
  value: {
1829
2313
  marginTop: { value: 10, unit: "px" },
1830
2314
  marginRight: "auto",
@@ -1866,17 +2350,19 @@ function registerComponent$1(runtime) {
1866
2350
  id: null,
1867
2351
  style: [
1868
2352
  {
1869
- deviceId: "mobile",
1870
- value: { fontSize: { value: 16, unit: "px" } }
1871
- },
1872
- {
1873
- deviceId: "desktop",
2353
+ deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
1874
2354
  value: {
1875
2355
  fontWeight: 400,
1876
2356
  fontSize: { value: 18, unit: "px" },
1877
2357
  lineHeight: 1.5
1878
2358
  }
1879
- }
2359
+ },
2360
+ ...runtime.getBreakpoints().some(({ id }) => id === state_breakpoints.DefaultBreakpointID.Mobile) ? [
2361
+ {
2362
+ deviceId: state_breakpoints.DefaultBreakpointID.Mobile,
2363
+ value: { fontSize: { value: 16, unit: "px" } }
2364
+ }
2365
+ ] : []
1880
2366
  ]
1881
2367
  }
1882
2368
  }
@@ -1891,14 +2377,19 @@ function registerComponent$1(runtime) {
1891
2377
  })),
1892
2378
  width: descriptors.Width({
1893
2379
  format: descriptors.Width.Format.ClassName,
1894
- preset: [{ deviceId: "desktop", value: { value: 700, unit: "px" } }],
2380
+ preset: [
2381
+ {
2382
+ deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
2383
+ value: { value: 700, unit: "px" }
2384
+ }
2385
+ ],
1895
2386
  defaultValue: { value: 100, unit: "%" }
1896
2387
  }),
1897
2388
  margin: descriptors.Margin({
1898
2389
  format: descriptors.Margin.Format.ClassName,
1899
2390
  preset: [
1900
2391
  {
1901
- deviceId: "desktop",
2392
+ deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
1902
2393
  value: {
1903
2394
  marginTop: null,
1904
2395
  marginRight: "auto",
@@ -1960,6 +2451,19 @@ function registerBuiltinComponents(runtime) {
1960
2451
  unregisterVideoComponent();
1961
2452
  };
1962
2453
  }
2454
+ const isServer = typeof window === "undefined";
2455
+ const useInsertionEffectSpecifier = "useInsertionEffect";
2456
+ const useInsertionEffect = (_c = React__namespace[useInsertionEffectSpecifier]) != null ? _c : React__namespace.useLayoutEffect;
2457
+ function useStyle(style) {
2458
+ const serialized = serialize.serializeStyles([style], css.cache.registered);
2459
+ utils.registerStyles(css.cache, serialized, false);
2460
+ useInsertionEffect(() => {
2461
+ utils.insertStyles(css.cache, serialized, false);
2462
+ });
2463
+ if (isServer)
2464
+ utils.insertStyles(css.cache, serialized, false);
2465
+ return `${css.cache.key}-${serialized.name}`;
2466
+ }
1963
2467
  var _path;
1964
2468
  function _extends() {
1965
2469
  _extends = Object.assign || function(target) {
@@ -1992,7 +2496,7 @@ const FallbackComponent = React.forwardRef(function FallbackComponent2({
1992
2496
  }, ref) {
1993
2497
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
1994
2498
  ref,
1995
- className: responsiveStyle.useStyle({
2499
+ className: useStyle({
1996
2500
  width: "100%",
1997
2501
  height: 54,
1998
2502
  backgroundColor: "#fcedf2",
@@ -2011,18 +2515,110 @@ const FallbackComponent = React.forwardRef(function FallbackComponent2({
2011
2515
  })]
2012
2516
  });
2013
2517
  });
2014
- function mapSideColor(swatches, _c) {
2015
- var _d = _c, { color } = _d, restOfSide = __objRest(_d, ["color"]);
2518
+ function useSwatch(swatchId) {
2519
+ const client = useMakeswiftClient();
2520
+ const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
2521
+ const swatch = shim.useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
2522
+ React.useEffect(() => {
2523
+ if (swatchId != null)
2524
+ client.fetchSwatch(swatchId).catch(console.error);
2525
+ }, [client, swatchId]);
2526
+ return swatch;
2527
+ }
2528
+ function useSwatches(swatchIds) {
2529
+ const client = useMakeswiftClient();
2530
+ const lastSnapshot = React.useRef();
2531
+ function getSnapshot() {
2532
+ const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
2533
+ if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
2534
+ return lastSnapshot.current;
2535
+ }
2536
+ return lastSnapshot.current = swatches2;
2537
+ }
2538
+ const swatches = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
2539
+ React.useEffect(() => {
2540
+ Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
2541
+ }, [client, swatchIds]);
2542
+ return swatches;
2543
+ }
2544
+ function useFile(fileId) {
2545
+ const client = useMakeswiftClient();
2546
+ const readFile = () => fileId == null ? null : client.readFile(fileId);
2547
+ const file = shim.useSyncExternalStore(client.subscribe, readFile, readFile);
2548
+ React.useEffect(() => {
2549
+ if (fileId != null)
2550
+ client.fetchFile(fileId);
2551
+ }, [client, fileId]);
2552
+ return file;
2553
+ }
2554
+ function useFiles(fileIds) {
2555
+ const client = useMakeswiftClient();
2556
+ const lastSnapshot = React.useRef();
2557
+ function getSnapshot() {
2558
+ const files2 = fileIds.map((fileId) => client.readFile(fileId));
2559
+ if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
2560
+ return lastSnapshot.current;
2561
+ }
2562
+ return lastSnapshot.current = files2;
2563
+ }
2564
+ const files = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
2565
+ React.useEffect(() => {
2566
+ Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
2567
+ }, [client, fileIds]);
2568
+ return files;
2569
+ }
2570
+ function useTypography(typographyId) {
2571
+ const client = useMakeswiftClient();
2572
+ const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
2573
+ const typography = shim.useSyncExternalStore(client.subscribe, readTypography, readTypography);
2574
+ React.useEffect(() => {
2575
+ if (typographyId != null)
2576
+ client.fetchTypography(typographyId).catch(console.error);
2577
+ }, [client, typographyId]);
2578
+ return typography;
2579
+ }
2580
+ function useGlobalElement(globalElementId) {
2581
+ const client = useMakeswiftClient();
2582
+ const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
2583
+ const globalElement = shim.useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
2584
+ React.useEffect(() => {
2585
+ if (globalElementId != null)
2586
+ client.fetchGlobalElement(globalElementId).catch(console.error);
2587
+ }, [client, globalElementId]);
2588
+ return globalElement;
2589
+ }
2590
+ function usePagePathnameSlice(pageId) {
2591
+ const client = useMakeswiftClient();
2592
+ const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
2593
+ const pagePathnameSlice = shim.useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
2594
+ React.useEffect(() => {
2595
+ if (pageId != null)
2596
+ client.fetchPagePathnameSlice(pageId).catch(console.error);
2597
+ }, [client, pageId]);
2598
+ return pagePathnameSlice;
2599
+ }
2600
+ function useTable(tableId) {
2601
+ const client = useMakeswiftClient();
2602
+ const readTable = () => tableId == null ? null : client.readTable(tableId);
2603
+ const table = shim.useSyncExternalStore(client.subscribe, readTable, readTable);
2604
+ React.useEffect(() => {
2605
+ if (tableId != null)
2606
+ client.fetchTable(tableId).catch(console.error);
2607
+ }, [client, tableId]);
2608
+ return table;
2609
+ }
2610
+ function mapSideColor(swatches, _d) {
2611
+ var _e = _d, { color } = _e, restOfSide = __objRest(_e, ["color"]);
2016
2612
  return __spreadProps(__spreadValues({}, restOfSide), {
2017
2613
  color: color && {
2018
2614
  alpha: color.alpha,
2019
- swatch: swatches.filter(isNonNullable.isNonNullable).find((s) => s && s.id === color.swatchId)
2615
+ swatch: swatches.filter(introspection.isNonNullable).find((s) => s && s.id === color.swatchId)
2020
2616
  }
2021
2617
  });
2022
2618
  }
2023
2619
  function useBorder(value) {
2024
2620
  const swatchIds = introspection.getBorderSwatchIds(value);
2025
- const swatches = responsiveStyle.useSwatches(swatchIds);
2621
+ const swatches = useSwatches(swatchIds);
2026
2622
  if (value == null)
2027
2623
  return null;
2028
2624
  return value.map((_a) => {
@@ -2047,7 +2643,7 @@ const ShadowDefaultValue = {
2047
2643
  };
2048
2644
  function useBoxShadow(value) {
2049
2645
  const swatchIds = introspection.getBoxShadowsSwatchIds(value);
2050
- const swatches = responsiveStyle.useSwatches(swatchIds);
2646
+ const swatches = useSwatches(swatchIds);
2051
2647
  if (value == null)
2052
2648
  return null;
2053
2649
  return value.map((_a) => {
@@ -2062,7 +2658,7 @@ function useBoxShadow(value) {
2062
2658
  return __spreadProps(__spreadValues({}, restOfShadow), {
2063
2659
  payload: {
2064
2660
  color: color != null ? {
2065
- swatch: swatches.filter(isNonNullable.isNonNullable).find((s) => s && s.id === color.swatchId),
2661
+ swatch: swatches.filter(introspection.isNonNullable).find((s) => s && s.id === color.swatchId),
2066
2662
  alpha: color.alpha
2067
2663
  } : null,
2068
2664
  inset: inset != null ? inset : ShadowDefaultValue.inset,
@@ -2078,7 +2674,7 @@ function useBoxShadow(value) {
2078
2674
  }
2079
2675
  function useResponsiveColor(color) {
2080
2676
  const swatchIds = introspection.getResponsiveColorSwatchIds(color);
2081
- const swatches = responsiveStyle.useSwatches(swatchIds);
2677
+ const swatches = useSwatches(swatchIds);
2082
2678
  if (color == null)
2083
2679
  return null;
2084
2680
  return color.map((_a) => {
@@ -2086,36 +2682,237 @@ function useResponsiveColor(color) {
2086
2682
  const { swatchId, alpha } = v;
2087
2683
  const swatch = swatches.find((s) => s && s.id === swatchId);
2088
2684
  return swatch == null ? null : __spreadProps(__spreadValues({}, rest), { value: { swatch, alpha } });
2089
- }).filter(isNonNullable.isNonNullable);
2685
+ }).filter(introspection.isNonNullable);
2686
+ }
2687
+ const getIndexes = (spans, index) => {
2688
+ const flattened = spans.reduce((a, s) => a.concat(s), []);
2689
+ if (index < 0 || index > flattened.length)
2690
+ throw new RangeError();
2691
+ let remainder = index;
2692
+ let rowIndex = 0;
2693
+ while (rowIndex < spans.length - 1 && remainder >= spans[rowIndex].length) {
2694
+ remainder -= spans[rowIndex].length;
2695
+ rowIndex += 1;
2696
+ }
2697
+ return [rowIndex, remainder];
2698
+ };
2699
+ function lengthDataToString(data) {
2700
+ if (typeof data === "object")
2701
+ return `${data.value}${data.unit}`;
2702
+ if (typeof data === "number")
2703
+ return `${data}px`;
2704
+ return data;
2705
+ }
2706
+ function paddingPropertyDataToStyle(data, defaultValue = {}) {
2707
+ var _a, _b, _c2, _d;
2708
+ const paddingTop = (_a = data.paddingTop) != null ? _a : defaultValue.paddingTop;
2709
+ const paddingRight = (_b = data.paddingRight) != null ? _b : defaultValue.paddingRight;
2710
+ const paddingBottom = (_c2 = data.paddingBottom) != null ? _c2 : defaultValue.paddingBottom;
2711
+ const paddingLeft = (_d = data.paddingLeft) != null ? _d : defaultValue.paddingLeft;
2712
+ const style = {};
2713
+ if (paddingTop != null)
2714
+ style.paddingTop = lengthDataToString(paddingTop);
2715
+ if (paddingRight != null)
2716
+ style.paddingRight = lengthDataToString(paddingRight);
2717
+ if (paddingBottom != null)
2718
+ style.paddingBottom = lengthDataToString(paddingBottom);
2719
+ if (paddingLeft != null)
2720
+ style.paddingLeft = lengthDataToString(paddingLeft);
2721
+ return style;
2722
+ }
2723
+ function marginPropertyDataToStyle(data, defaultValue = {}) {
2724
+ var _a, _b, _c2, _d;
2725
+ const marginTop = (_a = data.marginTop) != null ? _a : defaultValue.marginTop;
2726
+ const marginRight = (_b = data.marginRight) != null ? _b : defaultValue.marginRight;
2727
+ const marginBottom = (_c2 = data.marginBottom) != null ? _c2 : defaultValue.marginBottom;
2728
+ const marginLeft = (_d = data.marginLeft) != null ? _d : defaultValue.marginLeft;
2729
+ const style = {};
2730
+ if (marginTop != null)
2731
+ style.marginTop = lengthDataToString(marginTop);
2732
+ if (marginRight != null)
2733
+ style.marginRight = lengthDataToString(marginRight);
2734
+ if (marginBottom != null)
2735
+ style.marginBottom = lengthDataToString(marginBottom);
2736
+ if (marginLeft != null)
2737
+ style.marginLeft = lengthDataToString(marginLeft);
2738
+ return style;
2739
+ }
2740
+ function lengthPercentageDataToString(data) {
2741
+ if (typeof data === "object")
2742
+ return `${data.value}${data.unit}`;
2743
+ if (typeof data === "number")
2744
+ return `${data}px`;
2745
+ return data;
2746
+ }
2747
+ function borderRadiusPropertyDataToStyle(data, defaultValue = {}) {
2748
+ var _a, _b, _c2, _d;
2749
+ const borderTopLeftRadius = (_a = data.borderTopLeftRadius) != null ? _a : defaultValue.borderTopLeftRadius;
2750
+ const borderTopRightRadius = (_b = data.borderTopRightRadius) != null ? _b : defaultValue.borderTopRightRadius;
2751
+ const borderBottomRightRadius = (_c2 = data.borderBottomRightRadius) != null ? _c2 : defaultValue.borderBottomRightRadius;
2752
+ const borderBottomLeftRadius = (_d = data.borderBottomLeftRadius) != null ? _d : defaultValue.borderBottomLeftRadius;
2753
+ const style = {};
2754
+ if (borderTopLeftRadius != null) {
2755
+ style.borderTopLeftRadius = lengthPercentageDataToString(borderTopLeftRadius);
2756
+ }
2757
+ if (borderTopRightRadius != null) {
2758
+ style.borderTopRightRadius = lengthPercentageDataToString(borderTopRightRadius);
2759
+ }
2760
+ if (borderBottomRightRadius != null) {
2761
+ style.borderBottomRightRadius = lengthPercentageDataToString(borderBottomRightRadius);
2762
+ }
2763
+ if (borderBottomLeftRadius != null) {
2764
+ style.borderBottomLeftRadius = lengthPercentageDataToString(borderBottomLeftRadius);
2765
+ }
2766
+ return style;
2767
+ }
2768
+ function colorToString(color) {
2769
+ return color && color.swatch ? `hsla(${color.swatch.hue},${color.swatch.saturation}%,${color.swatch.lightness}%,${color.alpha})` : "";
2770
+ }
2771
+ function borderPropertyDataToStyle(data, defaultValue = {}) {
2772
+ var _a, _b, _c2, _d;
2773
+ const borderTop = (_a = data.borderTop) != null ? _a : defaultValue.borderTop;
2774
+ const borderRight = (_b = data.borderRight) != null ? _b : defaultValue.borderRight;
2775
+ const borderBottom = (_c2 = data.borderBottom) != null ? _c2 : defaultValue.borderBottom;
2776
+ const borderLeft = (_d = data.borderLeft) != null ? _d : defaultValue.borderLeft;
2777
+ const style = {};
2778
+ if (borderTop != null)
2779
+ style.borderTop = borderSideToString(borderTop);
2780
+ if (borderRight != null)
2781
+ style.borderRight = borderSideToString(borderRight);
2782
+ if (borderBottom != null)
2783
+ style.borderBottom = borderSideToString(borderBottom);
2784
+ if (borderLeft != null)
2785
+ style.borderLeft = borderSideToString(borderLeft);
2786
+ return style;
2787
+ }
2788
+ function borderSideToString(borderSide) {
2789
+ if (typeof borderSide === "string")
2790
+ return borderSide;
2791
+ if (typeof borderSide === "number")
2792
+ return `${borderSide}px`;
2793
+ const { width, color, style } = borderSide;
2794
+ return `${width != null ? width : 0}px ${style} ${color != null ? colorToString(color) : "black"}`;
2795
+ }
2796
+ function responsiveStyle(breakpoints, responsiveValues, join, strategy) {
2797
+ return state_breakpoints.join(breakpoints, responsiveValues, join, strategy).reduce((acc, { deviceId, value }) => {
2798
+ const breakpoint = state_breakpoints.getBreakpoint(breakpoints, deviceId);
2799
+ const mediaQuery = state_breakpoints.getBreakpointMediaQuery(breakpoint);
2800
+ return __spreadProps(__spreadValues({}, acc), {
2801
+ [mediaQuery]: __spreadValues(__spreadValues({}, acc[mediaQuery]), value)
2802
+ });
2803
+ }, {});
2090
2804
  }
2091
- const DEVICE_QUERIES = responsiveStyle.DEVICES.map((device) => ({
2092
- id: device.id,
2093
- query: responsiveStyle.getDeviceMediaQuery(device).replace("@media", "")
2094
- }));
2095
- function subscribe(notify) {
2096
- const cleanUpFns = DEVICE_QUERIES.map((q) => {
2097
- const mediaQueryList = window.matchMedia(q.query);
2098
- mediaQueryList.addEventListener("change", notify);
2099
- return () => mediaQueryList.removeEventListener("change", notify);
2805
+ function useResponsiveStyle(responsiveValues, join, strategy) {
2806
+ return responsiveStyle(useBreakpoints(), responsiveValues, join, strategy);
2807
+ }
2808
+ function responsiveWidth(breakpoints, widthData, defaultValue = "100%") {
2809
+ return __spreadValues({
2810
+ maxWidth: "100%"
2811
+ }, responsiveStyle(breakpoints, [widthData], ([width = defaultValue]) => ({
2812
+ width: typeof width === "object" ? `${width.value}${width.unit}` : width
2813
+ })));
2814
+ }
2815
+ function useResponsiveWidth(...args) {
2816
+ return responsiveWidth(useBreakpoints(), ...args);
2817
+ }
2818
+ function responsivePadding(breakpoints, paddingData, defaultValue = {}) {
2819
+ return responsiveStyle(breakpoints, [paddingData], ([padding = {}]) => paddingPropertyDataToStyle(padding, Object.assign({ paddingTop: 0, paddingRight: 0, paddingBottom: 0, paddingLeft: 0 }, defaultValue)));
2820
+ }
2821
+ function useResponsivePadding(...args) {
2822
+ return responsivePadding(useBreakpoints(), ...args);
2823
+ }
2824
+ function responsiveMargin(breakpoints, marginData, defaultValue = {}) {
2825
+ return responsiveStyle(breakpoints, [marginData], ([margin = {}]) => marginPropertyDataToStyle(margin, Object.assign({ marginTop: 0, marginRight: "auto", marginBottom: 0, marginLeft: "auto" }, defaultValue)));
2826
+ }
2827
+ function useResponsiveMargin(...args) {
2828
+ return responsiveMargin(useBreakpoints(), ...args);
2829
+ }
2830
+ function responsiveBorderRadius(breakpoints, borderRadiusData, defaultValue = {}) {
2831
+ return responsiveStyle(breakpoints, [borderRadiusData], ([borderRadius = {}]) => borderRadiusPropertyDataToStyle(borderRadius, Object.assign({
2832
+ borderTopLeftRadius: 0,
2833
+ borderTopRightRadius: 0,
2834
+ borderBottomRightRadius: 0,
2835
+ borderBottomLeftRadius: 0
2836
+ }, defaultValue)));
2837
+ }
2838
+ function useResponsiveBorderRadius(...args) {
2839
+ return responsiveBorderRadius(useBreakpoints(), ...args);
2840
+ }
2841
+ function useResponsiveBorder(borderData, defaultValue = {}) {
2842
+ return useResponsiveStyle([borderData], ([border = {}]) => borderPropertyDataToStyle(border, Object.assign({
2843
+ borderTop: "0px solid black",
2844
+ borderRight: "0px solid black",
2845
+ borderBottom: "0px solid black",
2846
+ borderLeft: "0px solid black"
2847
+ }, defaultValue)));
2848
+ }
2849
+ const floor = (d) => (v) => Math.floor(10 ** d * v) / 10 ** d;
2850
+ function responsiveGridItem(breakpoints, props) {
2851
+ return __spreadValues({
2852
+ display: "flex"
2853
+ }, responsiveStyle(breakpoints, [props.grid, props.columnGap, props.rowGap], ([
2854
+ { spans, count } = { spans: [[12]], count: 12 },
2855
+ columnGap = { value: 0, unit: "px" },
2856
+ rowGap = { value: 0, unit: "px" }
2857
+ ]) => {
2858
+ const [rowIndex, columnIndex] = getIndexes(spans, props.index);
2859
+ const firstCol = columnIndex === 0;
2860
+ const lastCol = columnIndex === spans[rowIndex].length - 1;
2861
+ const span = spans[rowIndex][columnIndex];
2862
+ const fraction = floor(5)(span / count);
2863
+ const width = `${fraction} * (100% + ${columnGap.value}${columnGap.unit})`;
2864
+ const excessWidth = `${Number(firstCol) + Number(lastCol)} * ${columnGap.value}${columnGap.unit} / 2`;
2865
+ const iePrecisionError = "0.01px";
2866
+ const flexBasis = `calc(${width} - ${excessWidth} - ${iePrecisionError})`;
2867
+ const firstRow = rowIndex === 0;
2868
+ const lastRow = rowIndex === spans.length - 1;
2869
+ return span === 0 ? { display: "none" } : {
2870
+ flexBasis,
2871
+ minWidth: flexBasis,
2872
+ maxWidth: flexBasis,
2873
+ paddingLeft: firstCol ? 0 : `${columnGap.value / 2}${columnGap.unit}`,
2874
+ paddingRight: lastCol ? 0 : `${columnGap.value / 2}${columnGap.unit}`,
2875
+ paddingTop: firstRow ? 0 : `${rowGap.value / 2}${rowGap.unit}`,
2876
+ paddingBottom: lastRow ? 0 : `${rowGap.value / 2}${rowGap.unit}`
2877
+ };
2878
+ }));
2879
+ }
2880
+ function useResponsiveGridItem(...args) {
2881
+ return responsiveGridItem(useBreakpoints(), ...args);
2882
+ }
2883
+ 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();
2884
+ function responsiveShadow(breakpoints, value) {
2885
+ return responsiveStyle(breakpoints, [value], ([shadow = []]) => ({
2886
+ boxShadow: getBoxShadow(shadow)
2887
+ }));
2888
+ }
2889
+ function useResponsiveShadow(...args) {
2890
+ return responsiveShadow(useBreakpoints(), ...args);
2891
+ }
2892
+ function responsiveTextStyle(breakpoints, value) {
2893
+ return responsiveStyle(breakpoints, [value], ([
2894
+ textStyle = {
2895
+ fontFamily: null,
2896
+ letterSpacing: null,
2897
+ fontSize: null,
2898
+ fontWeight: null,
2899
+ textTransform: [],
2900
+ fontStyle: []
2901
+ }
2902
+ ]) => {
2903
+ const {
2904
+ fontSize,
2905
+ fontWeight,
2906
+ fontStyle = [],
2907
+ textTransform = [],
2908
+ letterSpacing,
2909
+ fontFamily
2910
+ } = textStyle;
2911
+ 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" } : {});
2100
2912
  });
2101
- return () => cleanUpFns.forEach((fn) => fn());
2102
2913
  }
2103
- function useMediaQuery(responsiveValue) {
2104
- const getServerSnapshot = () => {
2105
- var _a;
2106
- return (_a = responsiveStyle.findDeviceOverride(responsiveValue, responsiveStyle.DEVICES[0].id)) == null ? void 0 : _a.value;
2107
- };
2108
- function getSnapshot() {
2109
- var _a;
2110
- const deviceId = DEVICE_QUERIES.reduce((matchedDevice, deviceQueries) => {
2111
- if (window.matchMedia(deviceQueries.query).matches) {
2112
- return deviceQueries.id;
2113
- }
2114
- return matchedDevice;
2115
- }, DEVICE_QUERIES[0].id);
2116
- return (_a = responsiveStyle.findDeviceOverride(responsiveValue, deviceId)) == null ? void 0 : _a.value;
2117
- }
2118
- return shim.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
2914
+ function useResponsiveTextStyle(...args) {
2915
+ return responsiveTextStyle(useBreakpoints(), ...args);
2119
2916
  }
2120
2917
  const defaultMargin = {
2121
2918
  marginTop: 0,
@@ -2133,7 +2930,7 @@ function useStyleControlCssObject(style, controlDefinition) {
2133
2930
  const { properties } = controlDefinition.config;
2134
2931
  return __spreadValues(__spreadValues({}, properties.includes(descriptors.StyleControlProperty.Width) && {
2135
2932
  maxWidth: "100%"
2136
- }), responsiveStyle.responsiveStyle([
2933
+ }), useResponsiveStyle([
2137
2934
  style == null ? void 0 : style.width,
2138
2935
  style == null ? void 0 : style.margin,
2139
2936
  style == null ? void 0 : style.padding,
@@ -2141,14 +2938,14 @@ function useStyleControlCssObject(style, controlDefinition) {
2141
2938
  style == null ? void 0 : style.borderRadius,
2142
2939
  style == null ? void 0 : style.textStyle
2143
2940
  ], ([width, margin, padding, border, borderRadius, textStyle]) => {
2144
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
2941
+ var _a, _b, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
2145
2942
  return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, properties.includes(descriptors.StyleControlProperty.Width) && {
2146
2943
  width: (_a = widthToString(width)) != null ? _a : "100%"
2147
- }), properties.includes(descriptors.StyleControlProperty.Margin) && responsiveStyle.marginPropertyDataToStyle(margin != null ? margin : defaultMargin, defaultMargin)), properties.includes(descriptors.StyleControlProperty.Padding) && responsiveStyle.paddingPropertyDataToStyle(padding != null ? padding : defaultPadding, defaultPadding)), properties.includes(descriptors.StyleControlProperty.Border) && {
2148
- borderTop: (_b = borderSideToString(border == null ? void 0 : border.borderTop)) != null ? _b : "0 solid black",
2149
- borderRight: (_c = borderSideToString(border == null ? void 0 : border.borderRight)) != null ? _c : "0 solid black",
2150
- borderBottom: (_d = borderSideToString(border == null ? void 0 : border.borderBottom)) != null ? _d : "0 solid black",
2151
- borderLeft: (_e = borderSideToString(border == null ? void 0 : border.borderLeft)) != null ? _e : "0 solid black"
2944
+ }), properties.includes(descriptors.StyleControlProperty.Margin) && marginPropertyDataToStyle(margin != null ? margin : defaultMargin, defaultMargin)), properties.includes(descriptors.StyleControlProperty.Padding) && paddingPropertyDataToStyle(padding != null ? padding : defaultPadding, defaultPadding)), properties.includes(descriptors.StyleControlProperty.Border) && {
2945
+ borderTop: (_b = borderSideToString2(border == null ? void 0 : border.borderTop)) != null ? _b : "0 solid black",
2946
+ borderRight: (_c2 = borderSideToString2(border == null ? void 0 : border.borderRight)) != null ? _c2 : "0 solid black",
2947
+ borderBottom: (_d = borderSideToString2(border == null ? void 0 : border.borderBottom)) != null ? _d : "0 solid black",
2948
+ borderLeft: (_e = borderSideToString2(border == null ? void 0 : border.borderLeft)) != null ? _e : "0 solid black"
2152
2949
  }), properties.includes(descriptors.StyleControlProperty.BorderRadius) && {
2153
2950
  borderTopLeftRadius: (_f = borderRadiusToString(borderRadius == null ? void 0 : borderRadius.borderTopLeftRadius)) != null ? _f : 0,
2154
2951
  borderTopRightRadius: (_g = borderRadiusToString(borderRadius == null ? void 0 : borderRadius.borderTopRightRadius)) != null ? _g : 0,
@@ -2162,18 +2959,18 @@ function useStyleControlCssObject(style, controlDefinition) {
2162
2959
  function widthToString(widthProperty) {
2163
2960
  if (widthProperty == null)
2164
2961
  return null;
2165
- return responsiveStyle.lengthPercentageDataToString(widthProperty);
2962
+ return lengthPercentageDataToString(widthProperty);
2166
2963
  }
2167
- function borderSideToString(borderSide) {
2964
+ function borderSideToString2(borderSide) {
2168
2965
  if (borderSide == null)
2169
2966
  return null;
2170
2967
  const { width, color, style: style2 } = borderSide;
2171
- return `${width != null ? width : 0}px ${style2} ${color != null ? responsiveStyle.colorToString(color) : "black"}`;
2968
+ return `${width != null ? width : 0}px ${style2} ${color != null ? colorToString(color) : "black"}`;
2172
2969
  }
2173
2970
  function borderRadiusToString(borderRadius) {
2174
2971
  if (borderRadius == null)
2175
2972
  return null;
2176
- return responsiveStyle.lengthPercentageDataToString(borderRadius);
2973
+ return lengthPercentageDataToString(borderRadius);
2177
2974
  }
2178
2975
  function fontSizeToString(fontSize) {
2179
2976
  return `${fontSize.value}${fontSize.unit}`;
@@ -2182,7 +2979,7 @@ function useStyleControlCssObject(style, controlDefinition) {
2182
2979
  function useFormattedStyle(styleControlData, controlDefinition, control) {
2183
2980
  const style = useStyleControlCssObject(styleControlData, controlDefinition);
2184
2981
  const guid = React.useId().replaceAll(":", "");
2185
- const styleClassName = responsiveStyle.useStyle(style);
2982
+ const styleClassName = useStyle(style);
2186
2983
  const classNames = `${styleClassName} ${guid}`;
2187
2984
  React.useEffect(() => {
2188
2985
  let currentBoxModel = null;
@@ -2191,7 +2988,7 @@ function useFormattedStyle(styleControlData, controlDefinition, control) {
2191
2988
  return;
2192
2989
  const element = document.querySelector(`.${guid}`);
2193
2990
  const measuredBoxModel = element == null ? null : boxModels.getBox(element);
2194
- if (!responsiveStyle.deepEqual(currentBoxModel, measuredBoxModel)) {
2991
+ if (!deepEqual(currentBoxModel, measuredBoxModel)) {
2195
2992
  currentBoxModel = measuredBoxModel;
2196
2993
  control.changeBoxModel(currentBoxModel);
2197
2994
  }
@@ -2218,7 +3015,7 @@ function useCheckboxControlValue(data, definition) {
2218
3015
  function useColorValue(data, definition) {
2219
3016
  var _a, _b;
2220
3017
  const swatchId = (_a = data == null ? void 0 : data.swatchId) != null ? _a : null;
2221
- const swatch = responsiveStyle.useSwatch(swatchId);
3018
+ const swatch = useSwatch(swatchId);
2222
3019
  const alpha = (_b = data == null ? void 0 : data.alpha) != null ? _b : 1;
2223
3020
  if (swatch == null) {
2224
3021
  const { defaultValue } = definition.config;
@@ -2241,7 +3038,7 @@ function useImageControlValue(data, definition) {
2241
3038
  var _a;
2242
3039
  const format = (_a = definition.config.format) != null ? _a : descriptors.ImageControlValueFormat.URL;
2243
3040
  const fileId = data != null ? data : null;
2244
- const file = responsiveStyle.useFile(fileId);
3041
+ const file = useFile(fileId);
2245
3042
  if (format === descriptors.ImageControlValueFormat.URL) {
2246
3043
  return file == null ? void 0 : file.publicUrl;
2247
3044
  }
@@ -2255,7 +3052,7 @@ function useImageControlValue(data, definition) {
2255
3052
  function useLinkControlValue(link, _definition) {
2256
3053
  var _a;
2257
3054
  const pageId = link && link.type === "OPEN_PAGE" ? link.payload.pageId : null;
2258
- const page = responsiveStyle.usePagePathnameSlice(pageId != null ? pageId : null);
3055
+ const page = usePagePathnameSlice(pageId != null ? pageId : null);
2259
3056
  const elementKey = (link == null ? void 0 : link.type) === "SCROLL_TO_ELEMENT" ? (_a = link.payload.elementIdConfig) == null ? void 0 : _a.elementKey : null;
2260
3057
  const elementId = useElementId(elementKey);
2261
3058
  let href = "#";
@@ -2381,7 +3178,7 @@ function pollBoxModel({
2381
3178
  let currentBoxModel = null;
2382
3179
  const handleAnimationFrameRequest = () => {
2383
3180
  const measuredBoxModel = boxModels.getBox(element);
2384
- if (!responsiveStyle.deepEqual(currentBoxModel, measuredBoxModel)) {
3181
+ if (!deepEqual(currentBoxModel, measuredBoxModel)) {
2385
3182
  currentBoxModel = measuredBoxModel;
2386
3183
  onBoxModelChange(currentBoxModel);
2387
3184
  }
@@ -2411,13 +3208,13 @@ function useSlot(data, control) {
2411
3208
  }, element.key))
2412
3209
  });
2413
3210
  }
2414
- function Slot(_e) {
2415
- var _f = _e, {
3211
+ function Slot(_f) {
3212
+ var _g = _f, {
2416
3213
  as,
2417
3214
  control,
2418
3215
  children,
2419
3216
  className
2420
- } = _f, restOfProps = __objRest(_f, [
3217
+ } = _g, restOfProps = __objRest(_g, [
2421
3218
  "as",
2422
3219
  "control",
2423
3220
  "children",
@@ -2425,7 +3222,7 @@ function Slot(_e) {
2425
3222
  ]);
2426
3223
  const As = as != null ? as : "div";
2427
3224
  const [element, setElement] = React.useState(null);
2428
- const baseClassName = responsiveStyle.useStyle({
3225
+ const baseClassName = useStyle({
2429
3226
  display: "flex",
2430
3227
  flexWrap: "wrap",
2431
3228
  width: "100%"
@@ -2446,15 +3243,15 @@ function Slot(_e) {
2446
3243
  }
2447
3244
  Slot.Placeholder = SlotPlaceholder;
2448
3245
  Slot.Item = SlotItem;
2449
- function SlotItem(_g) {
2450
- var _h = _g, {
3246
+ function SlotItem(_h) {
3247
+ var _i = _h, {
2451
3248
  as,
2452
3249
  control,
2453
3250
  grid,
2454
3251
  index,
2455
3252
  children,
2456
3253
  className
2457
- } = _h, restOfProps = __objRest(_h, [
3254
+ } = _i, restOfProps = __objRest(_i, [
2458
3255
  "as",
2459
3256
  "control",
2460
3257
  "grid",
@@ -2464,13 +3261,13 @@ function SlotItem(_g) {
2464
3261
  ]);
2465
3262
  const As = as != null ? as : "div";
2466
3263
  const [element, setElement] = React.useState(null);
2467
- const baseClassName = responsiveStyle.useStyle(__spreadValues({
3264
+ const baseClassName = useStyle(__spreadValues({
2468
3265
  display: "flex"
2469
- }, responsiveStyle.responsiveStyle([grid], ([{
3266
+ }, useResponsiveStyle([grid], ([{
2470
3267
  count = 12,
2471
3268
  spans = [[12]]
2472
3269
  } = {}]) => {
2473
- const [rowIndex, columnIndex] = responsiveStyle.getIndexes(spans, index);
3270
+ const [rowIndex, columnIndex] = getIndexes(spans, index);
2474
3271
  const span = spans[rowIndex][columnIndex];
2475
3272
  const flexBasis = `calc(100% * ${(span / count).toFixed(5)})`;
2476
3273
  return span === 0 ? {
@@ -2508,7 +3305,7 @@ function SlotPlaceholder({
2508
3305
  }, [element, control]);
2509
3306
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
2510
3307
  ref: setElement,
2511
- className: responsiveStyle.useStyle({
3308
+ className: useStyle({
2512
3309
  width: "100%",
2513
3310
  background: "rgba(161, 168, 194, 0.18)",
2514
3311
  height: "80px"
@@ -2517,7 +3314,7 @@ function SlotPlaceholder({
2517
3314
  xmlns: "http://www.w3.org/2000/svg",
2518
3315
  width: "100%",
2519
3316
  height: "100%",
2520
- className: responsiveStyle.useStyle({
3317
+ className: useStyle({
2521
3318
  overflow: "visible",
2522
3319
  padding: 8
2523
3320
  }),
@@ -2640,24 +3437,24 @@ function ControlValue({
2640
3437
  }
2641
3438
  }
2642
3439
  function useWidthStyle(value, descriptor) {
2643
- return responsiveStyle.useStyle(responsiveStyle.responsiveWidth(value, descriptor.options.defaultValue));
3440
+ return useStyle(useResponsiveWidth(value, descriptor.options.defaultValue));
2644
3441
  }
2645
3442
  function usePaddingStyle(value) {
2646
- return responsiveStyle.useStyle(responsiveStyle.responsivePadding(value));
3443
+ return useStyle(useResponsivePadding(value));
2647
3444
  }
2648
3445
  function useMarginStyle(value) {
2649
- return responsiveStyle.useStyle(responsiveStyle.responsiveMargin(value));
3446
+ return useStyle(useResponsiveMargin(value));
2650
3447
  }
2651
3448
  function useBorderRadiusStyle(value) {
2652
- return responsiveStyle.useStyle(responsiveStyle.responsiveBorderRadius(value));
3449
+ return useStyle(useResponsiveBorderRadius(value));
2653
3450
  }
2654
3451
  function useShadowsStyle(value) {
2655
3452
  const shadowValue = useBoxShadow(value);
2656
- return responsiveStyle.useStyle(responsiveStyle.responsiveShadow(shadowValue != null ? shadowValue : void 0));
3453
+ return useStyle(useResponsiveShadow(shadowValue != null ? shadowValue : void 0));
2657
3454
  }
2658
3455
  function useBorderStyle(value) {
2659
3456
  const borderData = useBorder(value);
2660
- return responsiveStyle.useStyle(responsiveStyle.responsiveBorder(borderData != null ? borderData : void 0));
3457
+ return useStyle(useResponsiveBorder(borderData != null ? borderData : void 0));
2661
3458
  }
2662
3459
  function PropsValue({
2663
3460
  element,
@@ -2674,7 +3471,7 @@ function PropsValue({
2674
3471
  return constants.getPropControllers(state, documentKey, element.key);
2675
3472
  });
2676
3473
  return Object.entries(propControllerDescriptorsRef.current).reduceRight((renderFn, [propName, descriptor]) => (propsValue) => {
2677
- var _a2, _b, _c;
3474
+ var _a2, _b, _c2;
2678
3475
  switch (descriptor.type) {
2679
3476
  case textInput.CheckboxControlType:
2680
3477
  case textInput.NumberControlType:
@@ -2716,7 +3513,7 @@ function PropsValue({
2716
3513
  }, descriptor.type);
2717
3514
  }
2718
3515
  case descriptors.SlotControlType: {
2719
- const control = (_c = propControllers == null ? void 0 : propControllers[propName]) != null ? _c : null;
3516
+ const control = (_c2 = propControllers == null ? void 0 : propControllers[propName]) != null ? _c2 : null;
2720
3517
  return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
2721
3518
  hook: useSlot,
2722
3519
  parameters: [props[propName], control],
@@ -2898,45 +3695,78 @@ function isDomNodeHandle(value) {
2898
3695
  }
2899
3696
  return false;
2900
3697
  }
2901
- const storeContextDefaultValue = constants.configureStore();
2902
- function createReactRuntime(store) {
2903
- return {
2904
- registerComponent(component, {
2905
- type,
3698
+ class ReactRuntime {
3699
+ constructor({
3700
+ unstable_breakpoints
3701
+ }) {
3702
+ __publicField(this, "store");
3703
+ this.store = constants.configureStore({
3704
+ breakpoints: unstable_breakpoints ? state_breakpoints.parseBreakpointsInput(unstable_breakpoints) : void 0
3705
+ });
3706
+ registerBuiltinComponents(this);
3707
+ }
3708
+ static registerComponent(component, {
3709
+ type,
3710
+ label,
3711
+ icon = "Cube40",
3712
+ hidden = false,
3713
+ props
3714
+ }) {
3715
+ const unregisterComponent = this.store.dispatch(actions.registerComponentEffect(type, {
2906
3716
  label,
2907
- icon = "Cube40",
2908
- hidden = false,
2909
- props
2910
- }) {
2911
- const unregisterComponent = store.dispatch(actions.registerComponentEffect(type, {
2912
- label,
2913
- icon,
2914
- hidden
2915
- }, props != null ? props : {}));
2916
- const unregisterReactComponent = store.dispatch(actions.registerReactComponentEffect(type, component));
2917
- return () => {
2918
- unregisterComponent();
2919
- unregisterReactComponent();
2920
- };
2921
- },
2922
- copyElementTree(elementTree2, replacementContext) {
2923
- return constants.copyElementTree(store.getState(), elementTree2, replacementContext);
2924
- }
2925
- };
3717
+ icon,
3718
+ hidden
3719
+ }, props != null ? props : {}));
3720
+ const unregisterReactComponent = this.store.dispatch(actions.registerReactComponentEffect(type, component));
3721
+ return () => {
3722
+ unregisterComponent();
3723
+ unregisterReactComponent();
3724
+ };
3725
+ }
3726
+ static copyElementTree(elementTree2, replacementContext) {
3727
+ return constants.copyElementTree(this.store.getState(), elementTree2, replacementContext);
3728
+ }
3729
+ static getBreakpoints() {
3730
+ return constants.getBreakpoints(this.store.getState());
3731
+ }
3732
+ registerComponent(component, {
3733
+ type,
3734
+ label,
3735
+ icon = "Cube40",
3736
+ hidden = false,
3737
+ props
3738
+ }) {
3739
+ const unregisterComponent = this.store.dispatch(actions.registerComponentEffect(type, {
3740
+ label,
3741
+ icon,
3742
+ hidden
3743
+ }, props != null ? props : {}));
3744
+ const unregisterReactComponent = this.store.dispatch(actions.registerReactComponentEffect(type, component));
3745
+ return () => {
3746
+ unregisterComponent();
3747
+ unregisterReactComponent();
3748
+ };
3749
+ }
3750
+ copyElementTree(elementTree2, replacementContext) {
3751
+ return constants.copyElementTree(this.store.getState(), elementTree2, replacementContext);
3752
+ }
3753
+ getBreakpoints() {
3754
+ return constants.getBreakpoints(this.store.getState());
3755
+ }
2926
3756
  }
2927
- const ReactRuntime = createReactRuntime(storeContextDefaultValue);
3757
+ __publicField(ReactRuntime, "store", constants.configureStore());
2928
3758
  registerBuiltinComponents(ReactRuntime);
2929
- const StoreContext = React.createContext(storeContextDefaultValue);
3759
+ const StoreContext = React.createContext(ReactRuntime.store);
2930
3760
  const PreviewProvider = dynamic__default["default"](() => Promise.resolve().then(function() {
2931
3761
  return require("./PreviewProvider.cjs.js");
2932
3762
  }));
2933
3763
  const LiveProvider = dynamic__default["default"](() => Promise.resolve().then(function() {
2934
3764
  return require("./LiveProvider.cjs.js");
2935
3765
  }));
2936
- function RuntimeProvider(_i) {
2937
- var _j = _i, {
3766
+ function RuntimeProvider(_j) {
3767
+ var _k = _j, {
2938
3768
  preview
2939
- } = _j, props = __objRest(_j, [
3769
+ } = _k, props = __objRest(_k, [
2940
3770
  "preview"
2941
3771
  ]);
2942
3772
  return preview ? /* @__PURE__ */ jsxRuntime.jsx(PreviewProvider, __spreadValues({}, props)) : /* @__PURE__ */ jsxRuntime.jsx(LiveProvider, __spreadValues({}, props));
@@ -2991,6 +3821,9 @@ function useIsPreview() {
2991
3821
  function useBuilderEditMode() {
2992
3822
  return useSelector((state) => constants.getBuilderEditMode(state));
2993
3823
  }
3824
+ function useBreakpoints() {
3825
+ return useSelector((state) => constants.getBreakpoints(state));
3826
+ }
2994
3827
  function useDispatch() {
2995
3828
  const store = React.useContext(StoreContext);
2996
3829
  return store.dispatch;
@@ -3033,7 +3866,7 @@ const DisableRegisterElement = React.createContext(false);
3033
3866
  const ElementReference = React.memo(React.forwardRef(function ElementReference2({
3034
3867
  elementReference
3035
3868
  }, ref) {
3036
- const globalElement = responsiveStyle.useGlobalElement(elementReference.value);
3869
+ const globalElement = useGlobalElement(elementReference.value);
3037
3870
  const globalElementData = globalElement == null ? void 0 : globalElement.data;
3038
3871
  const elementReferenceDocument = useDocument(elementReference.key);
3039
3872
  const documentKey = elementReference.key;
@@ -3149,6 +3982,7 @@ exports.Element = Element$1;
3149
3982
  exports.ElementImperativeHandle = ElementImperativeHandle;
3150
3983
  exports.Makeswift = Makeswift;
3151
3984
  exports.MakeswiftApiHandler = MakeswiftApiHandler;
3985
+ exports.MakeswiftProvider = MakeswiftProvider;
3152
3986
  exports.Page = Page$1;
3153
3987
  exports.Page$1 = Page;
3154
3988
  exports.PageProvider = PageProvider;
@@ -3159,20 +3993,33 @@ exports.RuntimeProvider = RuntimeProvider;
3159
3993
  exports.Shapes = Shapes;
3160
3994
  exports.Sizes = Sizes;
3161
3995
  exports.StoreContext = StoreContext;
3996
+ exports.colorToString = colorToString;
3997
+ exports.deepEqual = deepEqual;
3162
3998
  exports.forwardNextDynamicRef = forwardNextDynamicRef;
3163
3999
  exports.getServerSideProps = getServerSideProps;
3164
4000
  exports.getStaticPaths = getStaticPaths;
3165
4001
  exports.getStaticProps = getStaticProps;
3166
4002
  exports.pollBoxModel = pollBoxModel;
3167
- exports.storeContextDefaultValue = storeContextDefaultValue;
3168
4003
  exports.useBorder = useBorder;
3169
4004
  exports.useBoxShadow = useBoxShadow;
4005
+ exports.useBreakpoints = useBreakpoints;
3170
4006
  exports.useBuilderEditMode = useBuilderEditMode;
3171
4007
  exports.useElementId = useElementId;
4008
+ exports.useFile = useFile;
4009
+ exports.useFiles = useFiles;
3172
4010
  exports.useFormContext = useFormContext;
3173
4011
  exports.useIsInBuilder = useIsInBuilder;
3174
4012
  exports.useIsPreview = useIsPreview;
3175
- exports.useMediaQuery = useMediaQuery;
4013
+ exports.useMakeswiftClient = useMakeswiftClient;
3176
4014
  exports.usePageId = usePageId;
4015
+ exports.usePagePathnameSlice = usePagePathnameSlice;
3177
4016
  exports.useResponsiveColor = useResponsiveColor;
4017
+ exports.useResponsiveGridItem = useResponsiveGridItem;
4018
+ exports.useResponsiveStyle = useResponsiveStyle;
4019
+ exports.useResponsiveTextStyle = useResponsiveTextStyle;
4020
+ exports.useResponsiveWidth = useResponsiveWidth;
4021
+ exports.useStyle = useStyle;
4022
+ exports.useSwatches = useSwatches;
4023
+ exports.useTable = useTable;
4024
+ exports.useTypography = useTypography;
3178
4025
  //# sourceMappingURL=index.cjs.js.map