@makeswift/runtime 0.8.4 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Box.cjs.js +11 -11
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +9 -9
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +36 -37
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +13 -14
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +38 -37
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +19 -18
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +55 -29
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +35 -9
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +36 -10
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +31 -5
- package/dist/Divider.es.js.map +1 -1
- package/dist/Embed.cjs.js +31 -5
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +30 -4
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +72 -73
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +32 -33
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +22 -21
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +20 -19
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +8 -9
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +8 -9
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +33 -34
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +14 -15
- package/dist/Navigation.es.js.map +1 -1
- package/dist/PreviewProvider.cjs.js +12 -10
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +12 -10
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +15 -16
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +11 -12
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/Root.cjs.js +10 -10
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +8 -8
- package/dist/SocialLinks.cjs.js +12 -13
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +7 -8
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Text.cjs.js +3 -4
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +4 -5
- package/dist/Text.es.js.map +1 -1
- package/dist/Video.cjs.js +31 -5
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +30 -4
- package/dist/Video.es.js.map +1 -1
- package/dist/actions.cjs.js +6 -1
- package/dist/actions.cjs.js.map +1 -1
- package/dist/actions.es.js +6 -2
- package/dist/actions.es.js.map +1 -1
- package/dist/components.cjs.js +10 -10
- package/dist/components.es.js +10 -10
- package/dist/constants.cjs.js +7 -1
- package/dist/constants.cjs.js.map +1 -1
- package/dist/constants.es.js +7 -2
- package/dist/constants.es.js.map +1 -1
- package/dist/descriptors.cjs.js.map +1 -1
- package/dist/descriptors.es.js.map +1 -1
- package/dist/index.cjs.js +934 -120
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs2.js +29 -29
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs3.js +1 -2
- package/dist/index.cjs3.js.map +1 -1
- package/dist/index.cjs4.js +2 -2
- package/dist/index.cjs4.js.map +1 -1
- package/dist/index.cjs5.js +6 -7
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs6.js +3 -4
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +29 -23
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.es.js +890 -92
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js +6 -6
- package/dist/index.es2.js.map +1 -1
- package/dist/index.es3.js +1 -2
- package/dist/index.es3.js.map +1 -1
- package/dist/index.es4.js +2 -2
- package/dist/index.es4.js.map +1 -1
- package/dist/index.es5.js +6 -7
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es6.js +3 -4
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es7.js +25 -19
- package/dist/index.es7.js.map +1 -1
- package/dist/introspection.cjs.js +5 -2
- package/dist/introspection.cjs.js.map +1 -1
- package/dist/introspection.es.js +4 -2
- package/dist/introspection.es.js.map +1 -1
- package/dist/leaf.cjs.js +15 -17
- package/dist/leaf.cjs.js.map +1 -1
- package/dist/leaf.es.js +10 -11
- package/dist/leaf.es.js.map +1 -1
- package/dist/main.cjs.js +2 -1
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +2 -2
- package/dist/next.cjs.js +5 -6
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +6 -7
- package/dist/next.es.js.map +1 -1
- package/dist/prop-controllers.cjs.js +0 -1
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +0 -1
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/react.cjs.js +3 -4
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +3 -4
- package/dist/react.es.js.map +1 -1
- package/dist/slate.cjs.js +1 -12
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +1 -12
- package/dist/slate.es.js.map +1 -1
- package/dist/state/breakpoints.cjs.js +175 -0
- package/dist/state/breakpoints.cjs.js.map +1 -0
- package/dist/state/breakpoints.es.js +160 -0
- package/dist/state/breakpoints.es.js.map +1 -0
- package/dist/types/src/components/builtin/Box/Box.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Box/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Button/Button.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Button/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Carousel/Carousel.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Carousel/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Countdown/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/Label/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Image/Image.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Navigation/components/MobileMenu/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Navigation/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/SocialLinks/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/EditableText/useSyncDOMSelection.d.ts +1 -1
- package/dist/types/src/components/builtin/Text/EditableText/useSyncDOMSelection.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts +0 -4
- package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/register.d.ts.map +1 -1
- package/dist/types/src/components/hooks/useMediaQuery.d.ts.map +1 -1
- package/dist/types/src/components/utils/drop-first.d.ts +2 -0
- package/dist/types/src/components/utils/drop-first.d.ts.map +1 -0
- package/dist/types/src/components/utils/responsive-style.d.ts +21 -10
- package/dist/types/src/components/utils/responsive-style.d.ts.map +1 -1
- package/dist/types/src/controls/types.d.ts +1 -1
- package/dist/types/src/controls/types.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/index.d.ts +4 -0
- package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/setBlockKeyForDevice.d.ts +2 -1
- package/dist/types/src/slate/BlockPlugin/setBlockKeyForDevice.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/setActiveTypographyStyle.d.ts +2 -1
- package/dist/types/src/slate/TypographyPlugin/setActiveTypographyStyle.d.ts.map +1 -1
- package/dist/types/src/state/actions.d.ts +10 -1
- package/dist/types/src/state/actions.d.ts.map +1 -1
- package/dist/types/src/state/modules/breakpoints.d.ts +44 -0
- package/dist/types/src/state/modules/breakpoints.d.ts.map +1 -0
- package/dist/types/src/state/react-builder-preview.d.ts +2 -0
- package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
- package/dist/types/src/state/react-page.d.ts +3 -0
- package/dist/types/src/state/react-page.d.ts.map +1 -1
- package/dist/useMediaQuery.cjs.js +38 -0
- package/dist/useMediaQuery.cjs.js.map +1 -0
- package/dist/useMediaQuery.es.js +37 -0
- package/dist/useMediaQuery.es.js.map +1 -0
- package/package.json +10 -2
- package/state/breakpoints.js +1 -0
- package/dist/isNonNullable.cjs.js +0 -6
- package/dist/isNonNullable.cjs.js.map +0 -1
- package/dist/isNonNullable.es.js +0 -5
- package/dist/isNonNullable.es.js.map +0 -1
- package/dist/responsive-style.cjs.js +0 -917
- package/dist/responsive-style.cjs.js.map +0 -1
- package/dist/responsive-style.es.js +0 -853
- package/dist/responsive-style.es.js.map +0 -1
- package/dist/types/src/components/utils/devices.d.ts +0 -17
- 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
|
|
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
|
|
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 (
|
|
641
|
+
if (deepEqual(newSnippets, oldSnippets))
|
|
195
642
|
return;
|
|
196
643
|
setSnippets(cachedPage.snippets);
|
|
197
644
|
}, [cachedPage]);
|
|
@@ -333,13 +780,13 @@ function Page$1({
|
|
|
333
780
|
});
|
|
334
781
|
}
|
|
335
782
|
function useCachedPage(pageId) {
|
|
336
|
-
const client =
|
|
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 =
|
|
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;
|
|
@@ -359,7 +806,7 @@ Received "${apiKey}" instead.`);
|
|
|
359
806
|
} catch {
|
|
360
807
|
throw new Error(`The Makeswift client received an invalid \`apiOrigin\` parameter: "${apiOrigin}".`);
|
|
361
808
|
}
|
|
362
|
-
this.graphqlClient = new
|
|
809
|
+
this.graphqlClient = new GraphQLClient(new URL("graphql", apiOrigin).href);
|
|
363
810
|
}
|
|
364
811
|
async fetch(path, init) {
|
|
365
812
|
const response = await fetch(new URL(path, this.apiOrigin).toString(), __spreadProps(__spreadValues({}, init), {
|
|
@@ -377,11 +824,11 @@ Received "${apiKey}" instead.`);
|
|
|
377
824
|
return json;
|
|
378
825
|
}
|
|
379
826
|
async getTypographies(typographyIds) {
|
|
380
|
-
const result = await this.graphqlClient.request(
|
|
827
|
+
const result = await this.graphqlClient.request(TypographiesQuery, { typographyIds });
|
|
381
828
|
return result.typographies;
|
|
382
829
|
}
|
|
383
830
|
async getIntrospectedResources(introspectedResourceIds) {
|
|
384
|
-
const result = await this.graphqlClient.request(
|
|
831
|
+
const result = await this.graphqlClient.request(IntrospectedResourcesQuery, introspectedResourceIds);
|
|
385
832
|
return result;
|
|
386
833
|
}
|
|
387
834
|
async introspect(element) {
|
|
@@ -540,28 +987,28 @@ Received "${apiKey}" instead.`);
|
|
|
540
987
|
return snapshot;
|
|
541
988
|
}
|
|
542
989
|
async getSwatch(swatchId) {
|
|
543
|
-
const result = await this.graphqlClient.request(
|
|
990
|
+
const result = await this.graphqlClient.request(SwatchQuery, { swatchId });
|
|
544
991
|
return result.swatch;
|
|
545
992
|
}
|
|
546
993
|
async getFile(fileId) {
|
|
547
|
-
const result = await this.graphqlClient.request(
|
|
994
|
+
const result = await this.graphqlClient.request(FileQuery, { fileId });
|
|
548
995
|
return result.file;
|
|
549
996
|
}
|
|
550
997
|
async getTypography(typographyId) {
|
|
551
|
-
const result = await this.graphqlClient.request(
|
|
998
|
+
const result = await this.graphqlClient.request(TypographyQuery, { typographyId });
|
|
552
999
|
return result.typography;
|
|
553
1000
|
}
|
|
554
1001
|
async getGlobalElement(globalElementId) {
|
|
555
|
-
const result = await this.graphqlClient.request(
|
|
1002
|
+
const result = await this.graphqlClient.request(GlobalElementQuery, { globalElementId });
|
|
556
1003
|
return result.globalElement;
|
|
557
1004
|
}
|
|
558
1005
|
async getPagePathnameSlice(pageId) {
|
|
559
1006
|
var _a;
|
|
560
|
-
const result = await this.graphqlClient.request(
|
|
1007
|
+
const result = await this.graphqlClient.request(PagePathnamesByIdQuery, { pageIds: [pageId] });
|
|
561
1008
|
return (_a = result.pagePathnamesById.at(0)) != null ? _a : null;
|
|
562
1009
|
}
|
|
563
1010
|
async getTable(tableId) {
|
|
564
|
-
const result = await this.graphqlClient.request(
|
|
1011
|
+
const result = await this.graphqlClient.request(TableQuery, { tableId });
|
|
565
1012
|
return result.table;
|
|
566
1013
|
}
|
|
567
1014
|
}
|
|
@@ -710,7 +1157,7 @@ async function fonts(_req, res, { getFonts } = {}) {
|
|
|
710
1157
|
const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
|
|
711
1158
|
return res.json(fonts2);
|
|
712
1159
|
}
|
|
713
|
-
const version = "0.8.
|
|
1160
|
+
const version = "0.8.6";
|
|
714
1161
|
async function handler(req, res, { apiKey }) {
|
|
715
1162
|
if (req.query.secret !== apiKey) {
|
|
716
1163
|
return res.status(401).json({ message: "Unauthorized" });
|
|
@@ -923,14 +1370,14 @@ async function getStaticPaths() {
|
|
|
923
1370
|
}
|
|
924
1371
|
const REVALIDATE_SECONDS = 1;
|
|
925
1372
|
async function getStaticProps(ctx) {
|
|
926
|
-
var _a, _b,
|
|
1373
|
+
var _a, _b, _c2;
|
|
927
1374
|
deprecationWarning("getStaticProps");
|
|
928
1375
|
const makeswift = new Makeswift(getApiKey(), {
|
|
929
1376
|
apiOrigin: getApiOrigin()
|
|
930
1377
|
});
|
|
931
1378
|
const path = "/" + ((_b = (_a = ctx.params) == null ? void 0 : _a.path) != null ? _b : []).join("/");
|
|
932
1379
|
const snapshot = await makeswift.getPageSnapshot(path, {
|
|
933
|
-
preview: ((
|
|
1380
|
+
preview: ((_c2 = ctx.previewData) == null ? void 0 : _c2.makeswift) === true
|
|
934
1381
|
});
|
|
935
1382
|
if (snapshot == null)
|
|
936
1383
|
return {
|
|
@@ -967,7 +1414,7 @@ async function getServerSideProps(ctx) {
|
|
|
967
1414
|
const Page = React.memo(({
|
|
968
1415
|
snapshot
|
|
969
1416
|
}) => {
|
|
970
|
-
const client = React.useMemo(() => new
|
|
1417
|
+
const client = React.useMemo(() => new MakeswiftClient({
|
|
971
1418
|
uri: new URL("graphql", snapshot.apiOrigin).href,
|
|
972
1419
|
cacheData: snapshot.cacheData
|
|
973
1420
|
}), [snapshot]);
|
|
@@ -991,7 +1438,7 @@ function registerComponent$c(runtime) {
|
|
|
991
1438
|
function isHiddenBasedOnAnimationType(props, deviceId, property) {
|
|
992
1439
|
var _a, _b;
|
|
993
1440
|
const animateIn = props[property];
|
|
994
|
-
return ((_b = (_a =
|
|
1441
|
+
return ((_b = (_a = state_breakpoints.findBreakpointOverride(runtime.getBreakpoints(), animateIn, deviceId)) == null ? void 0 : _a.value) != null ? _b : "none") === "none";
|
|
995
1442
|
}
|
|
996
1443
|
const isHiddenBasedOnBoxAnimation = (props, deviceId) => isHiddenBasedOnAnimationType(props, deviceId, "boxAnimateType");
|
|
997
1444
|
const isHiddenBasedOnItemAnimation = (props, deviceId) => isHiddenBasedOnAnimationType(props, deviceId, "itemAnimateType");
|
|
@@ -1034,7 +1481,7 @@ function registerComponent$c(runtime) {
|
|
|
1034
1481
|
format: descriptors.Padding.Format.ClassName,
|
|
1035
1482
|
preset: [
|
|
1036
1483
|
{
|
|
1037
|
-
deviceId:
|
|
1484
|
+
deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1038
1485
|
value: {
|
|
1039
1486
|
paddingTop: { value: 10, unit: "px" },
|
|
1040
1487
|
paddingRight: { value: 10, unit: "px" },
|
|
@@ -1186,7 +1633,7 @@ function registerComponent$b(runtime) {
|
|
|
1186
1633
|
color: descriptors.ResponsiveColor((props, device) => {
|
|
1187
1634
|
var _a;
|
|
1188
1635
|
const variant = props.variant;
|
|
1189
|
-
const hidden = ((_a =
|
|
1636
|
+
const hidden = ((_a = state_breakpoints.findBreakpointOverride(runtime.getBreakpoints(), variant, device)) == null ? void 0 : _a.value) === "clear";
|
|
1190
1637
|
return { placeholder: "black", hidden };
|
|
1191
1638
|
}),
|
|
1192
1639
|
textColor: descriptors.ResponsiveColor({
|
|
@@ -1235,7 +1682,7 @@ function registerComponent$a(runtime) {
|
|
|
1235
1682
|
step: descriptors.ResponsiveNumber((props, device) => {
|
|
1236
1683
|
var _a, _b;
|
|
1237
1684
|
const pageSize = props.pageSize;
|
|
1238
|
-
const pageSizeValue = (_b = (_a =
|
|
1685
|
+
const pageSizeValue = (_b = (_a = state_breakpoints.findBreakpointOverride(runtime.getBreakpoints(), pageSize, device)) == null ? void 0 : _a.value) != null ? _b : 1;
|
|
1239
1686
|
return {
|
|
1240
1687
|
label: "Step",
|
|
1241
1688
|
defaultValue: 1,
|
|
@@ -1349,7 +1796,12 @@ function registerComponent$9(runtime) {
|
|
|
1349
1796
|
defaultValue: "medium"
|
|
1350
1797
|
}),
|
|
1351
1798
|
gap: descriptors.GapX({
|
|
1352
|
-
preset: [
|
|
1799
|
+
preset: [
|
|
1800
|
+
{
|
|
1801
|
+
deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1802
|
+
value: { value: 10, unit: "px" }
|
|
1803
|
+
}
|
|
1804
|
+
],
|
|
1353
1805
|
label: "Gap",
|
|
1354
1806
|
step: 1,
|
|
1355
1807
|
min: 0,
|
|
@@ -1481,7 +1933,12 @@ function registerComponent$6(runtime) {
|
|
|
1481
1933
|
hidden: props.tableId == null
|
|
1482
1934
|
})),
|
|
1483
1935
|
gap: descriptors.GapY((props) => ({
|
|
1484
|
-
preset: [
|
|
1936
|
+
preset: [
|
|
1937
|
+
{
|
|
1938
|
+
deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1939
|
+
value: { value: 10, unit: "px" }
|
|
1940
|
+
}
|
|
1941
|
+
],
|
|
1485
1942
|
label: "Gap",
|
|
1486
1943
|
defaultValue: { value: 0, unit: "px" },
|
|
1487
1944
|
hidden: props.tableId == null
|
|
@@ -1519,7 +1976,7 @@ function registerComponent$6(runtime) {
|
|
|
1519
1976
|
labelTextColor: descriptors.ResponsiveColor((props, device) => {
|
|
1520
1977
|
const hidden = props.tableId == null;
|
|
1521
1978
|
const responsiveContrast = props.contrast;
|
|
1522
|
-
const contrast =
|
|
1979
|
+
const contrast = state_breakpoints.findBreakpointOverride(runtime.getBreakpoints(), responsiveContrast, device);
|
|
1523
1980
|
return {
|
|
1524
1981
|
hidden,
|
|
1525
1982
|
label: "Label text color",
|
|
@@ -1571,7 +2028,12 @@ function registerComponent$6(runtime) {
|
|
|
1571
2028
|
hidden: props.tableId == null
|
|
1572
2029
|
})),
|
|
1573
2030
|
width: descriptors.Width({
|
|
1574
|
-
preset: [
|
|
2031
|
+
preset: [
|
|
2032
|
+
{
|
|
2033
|
+
deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2034
|
+
value: { value: 550, unit: "px" }
|
|
2035
|
+
}
|
|
2036
|
+
],
|
|
1575
2037
|
defaultValue: { value: 100, unit: "%" },
|
|
1576
2038
|
format: descriptors.Width.Format.ClassName
|
|
1577
2039
|
}),
|
|
@@ -1623,7 +2085,12 @@ function registerComponent$4(runtime) {
|
|
|
1623
2085
|
hidden: props.showLogo === false
|
|
1624
2086
|
})),
|
|
1625
2087
|
logoWidth: descriptors.ResponsiveLength((props) => ({
|
|
1626
|
-
preset: [
|
|
2088
|
+
preset: [
|
|
2089
|
+
{
|
|
2090
|
+
deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2091
|
+
value: { value: 100, unit: "px" }
|
|
2092
|
+
}
|
|
2093
|
+
],
|
|
1627
2094
|
label: "Logo width",
|
|
1628
2095
|
min: 0,
|
|
1629
2096
|
max: 1e3,
|
|
@@ -1648,7 +2115,12 @@ function registerComponent$4(runtime) {
|
|
|
1648
2115
|
defaultValue: "flex-end"
|
|
1649
2116
|
}),
|
|
1650
2117
|
gutter: descriptors.GapX({
|
|
1651
|
-
preset: [
|
|
2118
|
+
preset: [
|
|
2119
|
+
{
|
|
2120
|
+
deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2121
|
+
value: { value: 10, unit: "px" }
|
|
2122
|
+
}
|
|
2123
|
+
],
|
|
1652
2124
|
label: "Link gap",
|
|
1653
2125
|
min: 0,
|
|
1654
2126
|
max: 100,
|
|
@@ -1664,7 +2136,7 @@ function registerComponent$4(runtime) {
|
|
|
1664
2136
|
}),
|
|
1665
2137
|
mobileMenuOpenIconColor: descriptors.ResponsiveColor((props, device) => {
|
|
1666
2138
|
const mobileMenuAnimation = props.mobileMenuAnimation;
|
|
1667
|
-
const hidden = !
|
|
2139
|
+
const hidden = !state_breakpoints.findBreakpointOverride(runtime.getBreakpoints(), mobileMenuAnimation, device);
|
|
1668
2140
|
return {
|
|
1669
2141
|
label: "Open icon color",
|
|
1670
2142
|
placeholder: "rgba(161, 168, 194, 0.5)",
|
|
@@ -1673,7 +2145,7 @@ function registerComponent$4(runtime) {
|
|
|
1673
2145
|
}),
|
|
1674
2146
|
mobileMenuCloseIconColor: descriptors.ResponsiveColor((props, device) => {
|
|
1675
2147
|
const mobileMenuAnimation = props.mobileMenuAnimation;
|
|
1676
|
-
const hidden = !
|
|
2148
|
+
const hidden = !state_breakpoints.findBreakpointOverride(runtime.getBreakpoints(), mobileMenuAnimation, device);
|
|
1677
2149
|
return {
|
|
1678
2150
|
label: "Close icon color",
|
|
1679
2151
|
placeholder: "rgba(161, 168, 194, 0.5)",
|
|
@@ -1682,7 +2154,7 @@ function registerComponent$4(runtime) {
|
|
|
1682
2154
|
}),
|
|
1683
2155
|
mobileMenuBackgroundColor: descriptors.ResponsiveColor((props, device) => {
|
|
1684
2156
|
const mobileMenuAnimation = props.mobileMenuAnimation;
|
|
1685
|
-
const hidden = !
|
|
2157
|
+
const hidden = !state_breakpoints.findBreakpointOverride(runtime.getBreakpoints(), mobileMenuAnimation, device);
|
|
1686
2158
|
return {
|
|
1687
2159
|
label: "Menu BG color",
|
|
1688
2160
|
placeholder: "black",
|
|
@@ -1809,7 +2281,12 @@ function registerComponent$2(runtime) {
|
|
|
1809
2281
|
defaultValue: "center"
|
|
1810
2282
|
}),
|
|
1811
2283
|
gutter: descriptors.GapX({
|
|
1812
|
-
preset: [
|
|
2284
|
+
preset: [
|
|
2285
|
+
{
|
|
2286
|
+
deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2287
|
+
value: { value: 10, unit: "px" }
|
|
2288
|
+
}
|
|
2289
|
+
],
|
|
1813
2290
|
label: "Link gap",
|
|
1814
2291
|
min: 0,
|
|
1815
2292
|
max: 100,
|
|
@@ -1824,7 +2301,7 @@ function registerComponent$2(runtime) {
|
|
|
1824
2301
|
format: descriptors.Margin.Format.ClassName,
|
|
1825
2302
|
preset: [
|
|
1826
2303
|
{
|
|
1827
|
-
deviceId:
|
|
2304
|
+
deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1828
2305
|
value: {
|
|
1829
2306
|
marginTop: { value: 10, unit: "px" },
|
|
1830
2307
|
marginRight: "auto",
|
|
@@ -1866,17 +2343,19 @@ function registerComponent$1(runtime) {
|
|
|
1866
2343
|
id: null,
|
|
1867
2344
|
style: [
|
|
1868
2345
|
{
|
|
1869
|
-
deviceId:
|
|
1870
|
-
value: { fontSize: { value: 16, unit: "px" } }
|
|
1871
|
-
},
|
|
1872
|
-
{
|
|
1873
|
-
deviceId: "desktop",
|
|
2346
|
+
deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1874
2347
|
value: {
|
|
1875
2348
|
fontWeight: 400,
|
|
1876
2349
|
fontSize: { value: 18, unit: "px" },
|
|
1877
2350
|
lineHeight: 1.5
|
|
1878
2351
|
}
|
|
1879
|
-
}
|
|
2352
|
+
},
|
|
2353
|
+
...runtime.getBreakpoints().some(({ id }) => id === state_breakpoints.DefaultBreakpointID.Mobile) ? [
|
|
2354
|
+
{
|
|
2355
|
+
deviceId: state_breakpoints.DefaultBreakpointID.Mobile,
|
|
2356
|
+
value: { fontSize: { value: 16, unit: "px" } }
|
|
2357
|
+
}
|
|
2358
|
+
] : []
|
|
1880
2359
|
]
|
|
1881
2360
|
}
|
|
1882
2361
|
}
|
|
@@ -1891,14 +2370,19 @@ function registerComponent$1(runtime) {
|
|
|
1891
2370
|
})),
|
|
1892
2371
|
width: descriptors.Width({
|
|
1893
2372
|
format: descriptors.Width.Format.ClassName,
|
|
1894
|
-
preset: [
|
|
2373
|
+
preset: [
|
|
2374
|
+
{
|
|
2375
|
+
deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2376
|
+
value: { value: 700, unit: "px" }
|
|
2377
|
+
}
|
|
2378
|
+
],
|
|
1895
2379
|
defaultValue: { value: 100, unit: "%" }
|
|
1896
2380
|
}),
|
|
1897
2381
|
margin: descriptors.Margin({
|
|
1898
2382
|
format: descriptors.Margin.Format.ClassName,
|
|
1899
2383
|
preset: [
|
|
1900
2384
|
{
|
|
1901
|
-
deviceId:
|
|
2385
|
+
deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1902
2386
|
value: {
|
|
1903
2387
|
marginTop: null,
|
|
1904
2388
|
marginRight: "auto",
|
|
@@ -1960,6 +2444,19 @@ function registerBuiltinComponents(runtime) {
|
|
|
1960
2444
|
unregisterVideoComponent();
|
|
1961
2445
|
};
|
|
1962
2446
|
}
|
|
2447
|
+
const isServer = typeof window === "undefined";
|
|
2448
|
+
const useInsertionEffectSpecifier = "useInsertionEffect";
|
|
2449
|
+
const useInsertionEffect = (_c = React__namespace[useInsertionEffectSpecifier]) != null ? _c : React__namespace.useLayoutEffect;
|
|
2450
|
+
function useStyle(style) {
|
|
2451
|
+
const serialized = serialize.serializeStyles([style], css.cache.registered);
|
|
2452
|
+
utils.registerStyles(css.cache, serialized, false);
|
|
2453
|
+
useInsertionEffect(() => {
|
|
2454
|
+
utils.insertStyles(css.cache, serialized, false);
|
|
2455
|
+
});
|
|
2456
|
+
if (isServer)
|
|
2457
|
+
utils.insertStyles(css.cache, serialized, false);
|
|
2458
|
+
return `${css.cache.key}-${serialized.name}`;
|
|
2459
|
+
}
|
|
1963
2460
|
var _path;
|
|
1964
2461
|
function _extends() {
|
|
1965
2462
|
_extends = Object.assign || function(target) {
|
|
@@ -1992,7 +2489,7 @@ const FallbackComponent = React.forwardRef(function FallbackComponent2({
|
|
|
1992
2489
|
}, ref) {
|
|
1993
2490
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
1994
2491
|
ref,
|
|
1995
|
-
className:
|
|
2492
|
+
className: useStyle({
|
|
1996
2493
|
width: "100%",
|
|
1997
2494
|
height: 54,
|
|
1998
2495
|
backgroundColor: "#fcedf2",
|
|
@@ -2011,18 +2508,110 @@ const FallbackComponent = React.forwardRef(function FallbackComponent2({
|
|
|
2011
2508
|
})]
|
|
2012
2509
|
});
|
|
2013
2510
|
});
|
|
2014
|
-
function
|
|
2015
|
-
|
|
2511
|
+
function useSwatch(swatchId) {
|
|
2512
|
+
const client = useMakeswiftClient();
|
|
2513
|
+
const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
|
|
2514
|
+
const swatch = shim.useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
|
|
2515
|
+
React.useEffect(() => {
|
|
2516
|
+
if (swatchId != null)
|
|
2517
|
+
client.fetchSwatch(swatchId).catch(console.error);
|
|
2518
|
+
}, [client, swatchId]);
|
|
2519
|
+
return swatch;
|
|
2520
|
+
}
|
|
2521
|
+
function useSwatches(swatchIds) {
|
|
2522
|
+
const client = useMakeswiftClient();
|
|
2523
|
+
const lastSnapshot = React.useRef();
|
|
2524
|
+
function getSnapshot() {
|
|
2525
|
+
const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
|
|
2526
|
+
if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
|
|
2527
|
+
return lastSnapshot.current;
|
|
2528
|
+
}
|
|
2529
|
+
return lastSnapshot.current = swatches2;
|
|
2530
|
+
}
|
|
2531
|
+
const swatches = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2532
|
+
React.useEffect(() => {
|
|
2533
|
+
Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
|
|
2534
|
+
}, [client, swatchIds]);
|
|
2535
|
+
return swatches;
|
|
2536
|
+
}
|
|
2537
|
+
function useFile(fileId) {
|
|
2538
|
+
const client = useMakeswiftClient();
|
|
2539
|
+
const readFile = () => fileId == null ? null : client.readFile(fileId);
|
|
2540
|
+
const file = shim.useSyncExternalStore(client.subscribe, readFile, readFile);
|
|
2541
|
+
React.useEffect(() => {
|
|
2542
|
+
if (fileId != null)
|
|
2543
|
+
client.fetchFile(fileId);
|
|
2544
|
+
}, [client, fileId]);
|
|
2545
|
+
return file;
|
|
2546
|
+
}
|
|
2547
|
+
function useFiles(fileIds) {
|
|
2548
|
+
const client = useMakeswiftClient();
|
|
2549
|
+
const lastSnapshot = React.useRef();
|
|
2550
|
+
function getSnapshot() {
|
|
2551
|
+
const files2 = fileIds.map((fileId) => client.readFile(fileId));
|
|
2552
|
+
if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
|
|
2553
|
+
return lastSnapshot.current;
|
|
2554
|
+
}
|
|
2555
|
+
return lastSnapshot.current = files2;
|
|
2556
|
+
}
|
|
2557
|
+
const files = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2558
|
+
React.useEffect(() => {
|
|
2559
|
+
Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
|
|
2560
|
+
}, [client, fileIds]);
|
|
2561
|
+
return files;
|
|
2562
|
+
}
|
|
2563
|
+
function useTypography(typographyId) {
|
|
2564
|
+
const client = useMakeswiftClient();
|
|
2565
|
+
const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
|
|
2566
|
+
const typography = shim.useSyncExternalStore(client.subscribe, readTypography, readTypography);
|
|
2567
|
+
React.useEffect(() => {
|
|
2568
|
+
if (typographyId != null)
|
|
2569
|
+
client.fetchTypography(typographyId).catch(console.error);
|
|
2570
|
+
}, [client, typographyId]);
|
|
2571
|
+
return typography;
|
|
2572
|
+
}
|
|
2573
|
+
function useGlobalElement(globalElementId) {
|
|
2574
|
+
const client = useMakeswiftClient();
|
|
2575
|
+
const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
|
|
2576
|
+
const globalElement = shim.useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
|
|
2577
|
+
React.useEffect(() => {
|
|
2578
|
+
if (globalElementId != null)
|
|
2579
|
+
client.fetchGlobalElement(globalElementId).catch(console.error);
|
|
2580
|
+
}, [client, globalElementId]);
|
|
2581
|
+
return globalElement;
|
|
2582
|
+
}
|
|
2583
|
+
function usePagePathnameSlice(pageId) {
|
|
2584
|
+
const client = useMakeswiftClient();
|
|
2585
|
+
const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
|
|
2586
|
+
const pagePathnameSlice = shim.useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
|
|
2587
|
+
React.useEffect(() => {
|
|
2588
|
+
if (pageId != null)
|
|
2589
|
+
client.fetchPagePathnameSlice(pageId).catch(console.error);
|
|
2590
|
+
}, [client, pageId]);
|
|
2591
|
+
return pagePathnameSlice;
|
|
2592
|
+
}
|
|
2593
|
+
function useTable(tableId) {
|
|
2594
|
+
const client = useMakeswiftClient();
|
|
2595
|
+
const readTable = () => tableId == null ? null : client.readTable(tableId);
|
|
2596
|
+
const table = shim.useSyncExternalStore(client.subscribe, readTable, readTable);
|
|
2597
|
+
React.useEffect(() => {
|
|
2598
|
+
if (tableId != null)
|
|
2599
|
+
client.fetchTable(tableId).catch(console.error);
|
|
2600
|
+
}, [client, tableId]);
|
|
2601
|
+
return table;
|
|
2602
|
+
}
|
|
2603
|
+
function mapSideColor(swatches, _d) {
|
|
2604
|
+
var _e = _d, { color } = _e, restOfSide = __objRest(_e, ["color"]);
|
|
2016
2605
|
return __spreadProps(__spreadValues({}, restOfSide), {
|
|
2017
2606
|
color: color && {
|
|
2018
2607
|
alpha: color.alpha,
|
|
2019
|
-
swatch: swatches.filter(
|
|
2608
|
+
swatch: swatches.filter(introspection.isNonNullable).find((s) => s && s.id === color.swatchId)
|
|
2020
2609
|
}
|
|
2021
2610
|
});
|
|
2022
2611
|
}
|
|
2023
2612
|
function useBorder(value) {
|
|
2024
2613
|
const swatchIds = introspection.getBorderSwatchIds(value);
|
|
2025
|
-
const swatches =
|
|
2614
|
+
const swatches = useSwatches(swatchIds);
|
|
2026
2615
|
if (value == null)
|
|
2027
2616
|
return null;
|
|
2028
2617
|
return value.map((_a) => {
|
|
@@ -2047,7 +2636,7 @@ const ShadowDefaultValue = {
|
|
|
2047
2636
|
};
|
|
2048
2637
|
function useBoxShadow(value) {
|
|
2049
2638
|
const swatchIds = introspection.getBoxShadowsSwatchIds(value);
|
|
2050
|
-
const swatches =
|
|
2639
|
+
const swatches = useSwatches(swatchIds);
|
|
2051
2640
|
if (value == null)
|
|
2052
2641
|
return null;
|
|
2053
2642
|
return value.map((_a) => {
|
|
@@ -2062,7 +2651,7 @@ function useBoxShadow(value) {
|
|
|
2062
2651
|
return __spreadProps(__spreadValues({}, restOfShadow), {
|
|
2063
2652
|
payload: {
|
|
2064
2653
|
color: color != null ? {
|
|
2065
|
-
swatch: swatches.filter(
|
|
2654
|
+
swatch: swatches.filter(introspection.isNonNullable).find((s) => s && s.id === color.swatchId),
|
|
2066
2655
|
alpha: color.alpha
|
|
2067
2656
|
} : null,
|
|
2068
2657
|
inset: inset != null ? inset : ShadowDefaultValue.inset,
|
|
@@ -2078,7 +2667,7 @@ function useBoxShadow(value) {
|
|
|
2078
2667
|
}
|
|
2079
2668
|
function useResponsiveColor(color) {
|
|
2080
2669
|
const swatchIds = introspection.getResponsiveColorSwatchIds(color);
|
|
2081
|
-
const swatches =
|
|
2670
|
+
const swatches = useSwatches(swatchIds);
|
|
2082
2671
|
if (color == null)
|
|
2083
2672
|
return null;
|
|
2084
2673
|
return color.map((_a) => {
|
|
@@ -2086,36 +2675,237 @@ function useResponsiveColor(color) {
|
|
|
2086
2675
|
const { swatchId, alpha } = v;
|
|
2087
2676
|
const swatch = swatches.find((s) => s && s.id === swatchId);
|
|
2088
2677
|
return swatch == null ? null : __spreadProps(__spreadValues({}, rest), { value: { swatch, alpha } });
|
|
2089
|
-
}).filter(
|
|
2678
|
+
}).filter(introspection.isNonNullable);
|
|
2679
|
+
}
|
|
2680
|
+
const getIndexes = (spans, index) => {
|
|
2681
|
+
const flattened = spans.reduce((a, s) => a.concat(s), []);
|
|
2682
|
+
if (index < 0 || index > flattened.length)
|
|
2683
|
+
throw new RangeError();
|
|
2684
|
+
let remainder = index;
|
|
2685
|
+
let rowIndex = 0;
|
|
2686
|
+
while (rowIndex < spans.length - 1 && remainder >= spans[rowIndex].length) {
|
|
2687
|
+
remainder -= spans[rowIndex].length;
|
|
2688
|
+
rowIndex += 1;
|
|
2689
|
+
}
|
|
2690
|
+
return [rowIndex, remainder];
|
|
2691
|
+
};
|
|
2692
|
+
function lengthDataToString(data) {
|
|
2693
|
+
if (typeof data === "object")
|
|
2694
|
+
return `${data.value}${data.unit}`;
|
|
2695
|
+
if (typeof data === "number")
|
|
2696
|
+
return `${data}px`;
|
|
2697
|
+
return data;
|
|
2698
|
+
}
|
|
2699
|
+
function paddingPropertyDataToStyle(data, defaultValue = {}) {
|
|
2700
|
+
var _a, _b, _c2, _d;
|
|
2701
|
+
const paddingTop = (_a = data.paddingTop) != null ? _a : defaultValue.paddingTop;
|
|
2702
|
+
const paddingRight = (_b = data.paddingRight) != null ? _b : defaultValue.paddingRight;
|
|
2703
|
+
const paddingBottom = (_c2 = data.paddingBottom) != null ? _c2 : defaultValue.paddingBottom;
|
|
2704
|
+
const paddingLeft = (_d = data.paddingLeft) != null ? _d : defaultValue.paddingLeft;
|
|
2705
|
+
const style = {};
|
|
2706
|
+
if (paddingTop != null)
|
|
2707
|
+
style.paddingTop = lengthDataToString(paddingTop);
|
|
2708
|
+
if (paddingRight != null)
|
|
2709
|
+
style.paddingRight = lengthDataToString(paddingRight);
|
|
2710
|
+
if (paddingBottom != null)
|
|
2711
|
+
style.paddingBottom = lengthDataToString(paddingBottom);
|
|
2712
|
+
if (paddingLeft != null)
|
|
2713
|
+
style.paddingLeft = lengthDataToString(paddingLeft);
|
|
2714
|
+
return style;
|
|
2715
|
+
}
|
|
2716
|
+
function marginPropertyDataToStyle(data, defaultValue = {}) {
|
|
2717
|
+
var _a, _b, _c2, _d;
|
|
2718
|
+
const marginTop = (_a = data.marginTop) != null ? _a : defaultValue.marginTop;
|
|
2719
|
+
const marginRight = (_b = data.marginRight) != null ? _b : defaultValue.marginRight;
|
|
2720
|
+
const marginBottom = (_c2 = data.marginBottom) != null ? _c2 : defaultValue.marginBottom;
|
|
2721
|
+
const marginLeft = (_d = data.marginLeft) != null ? _d : defaultValue.marginLeft;
|
|
2722
|
+
const style = {};
|
|
2723
|
+
if (marginTop != null)
|
|
2724
|
+
style.marginTop = lengthDataToString(marginTop);
|
|
2725
|
+
if (marginRight != null)
|
|
2726
|
+
style.marginRight = lengthDataToString(marginRight);
|
|
2727
|
+
if (marginBottom != null)
|
|
2728
|
+
style.marginBottom = lengthDataToString(marginBottom);
|
|
2729
|
+
if (marginLeft != null)
|
|
2730
|
+
style.marginLeft = lengthDataToString(marginLeft);
|
|
2731
|
+
return style;
|
|
2732
|
+
}
|
|
2733
|
+
function lengthPercentageDataToString(data) {
|
|
2734
|
+
if (typeof data === "object")
|
|
2735
|
+
return `${data.value}${data.unit}`;
|
|
2736
|
+
if (typeof data === "number")
|
|
2737
|
+
return `${data}px`;
|
|
2738
|
+
return data;
|
|
2739
|
+
}
|
|
2740
|
+
function borderRadiusPropertyDataToStyle(data, defaultValue = {}) {
|
|
2741
|
+
var _a, _b, _c2, _d;
|
|
2742
|
+
const borderTopLeftRadius = (_a = data.borderTopLeftRadius) != null ? _a : defaultValue.borderTopLeftRadius;
|
|
2743
|
+
const borderTopRightRadius = (_b = data.borderTopRightRadius) != null ? _b : defaultValue.borderTopRightRadius;
|
|
2744
|
+
const borderBottomRightRadius = (_c2 = data.borderBottomRightRadius) != null ? _c2 : defaultValue.borderBottomRightRadius;
|
|
2745
|
+
const borderBottomLeftRadius = (_d = data.borderBottomLeftRadius) != null ? _d : defaultValue.borderBottomLeftRadius;
|
|
2746
|
+
const style = {};
|
|
2747
|
+
if (borderTopLeftRadius != null) {
|
|
2748
|
+
style.borderTopLeftRadius = lengthPercentageDataToString(borderTopLeftRadius);
|
|
2749
|
+
}
|
|
2750
|
+
if (borderTopRightRadius != null) {
|
|
2751
|
+
style.borderTopRightRadius = lengthPercentageDataToString(borderTopRightRadius);
|
|
2752
|
+
}
|
|
2753
|
+
if (borderBottomRightRadius != null) {
|
|
2754
|
+
style.borderBottomRightRadius = lengthPercentageDataToString(borderBottomRightRadius);
|
|
2755
|
+
}
|
|
2756
|
+
if (borderBottomLeftRadius != null) {
|
|
2757
|
+
style.borderBottomLeftRadius = lengthPercentageDataToString(borderBottomLeftRadius);
|
|
2758
|
+
}
|
|
2759
|
+
return style;
|
|
2760
|
+
}
|
|
2761
|
+
function colorToString(color) {
|
|
2762
|
+
return color && color.swatch ? `hsla(${color.swatch.hue},${color.swatch.saturation}%,${color.swatch.lightness}%,${color.alpha})` : "";
|
|
2763
|
+
}
|
|
2764
|
+
function borderPropertyDataToStyle(data, defaultValue = {}) {
|
|
2765
|
+
var _a, _b, _c2, _d;
|
|
2766
|
+
const borderTop = (_a = data.borderTop) != null ? _a : defaultValue.borderTop;
|
|
2767
|
+
const borderRight = (_b = data.borderRight) != null ? _b : defaultValue.borderRight;
|
|
2768
|
+
const borderBottom = (_c2 = data.borderBottom) != null ? _c2 : defaultValue.borderBottom;
|
|
2769
|
+
const borderLeft = (_d = data.borderLeft) != null ? _d : defaultValue.borderLeft;
|
|
2770
|
+
const style = {};
|
|
2771
|
+
if (borderTop != null)
|
|
2772
|
+
style.borderTop = borderSideToString(borderTop);
|
|
2773
|
+
if (borderRight != null)
|
|
2774
|
+
style.borderRight = borderSideToString(borderRight);
|
|
2775
|
+
if (borderBottom != null)
|
|
2776
|
+
style.borderBottom = borderSideToString(borderBottom);
|
|
2777
|
+
if (borderLeft != null)
|
|
2778
|
+
style.borderLeft = borderSideToString(borderLeft);
|
|
2779
|
+
return style;
|
|
2780
|
+
}
|
|
2781
|
+
function borderSideToString(borderSide) {
|
|
2782
|
+
if (typeof borderSide === "string")
|
|
2783
|
+
return borderSide;
|
|
2784
|
+
if (typeof borderSide === "number")
|
|
2785
|
+
return `${borderSide}px`;
|
|
2786
|
+
const { width, color, style } = borderSide;
|
|
2787
|
+
return `${width != null ? width : 0}px ${style} ${color != null ? colorToString(color) : "black"}`;
|
|
2788
|
+
}
|
|
2789
|
+
function responsiveStyle(breakpoints, responsiveValues, join, strategy) {
|
|
2790
|
+
return state_breakpoints.join(breakpoints, responsiveValues, join, strategy).reduce((acc, { deviceId, value }) => {
|
|
2791
|
+
const breakpoint = state_breakpoints.getBreakpoint(breakpoints, deviceId);
|
|
2792
|
+
const mediaQuery = state_breakpoints.getBreakpointMediaQuery(breakpoint);
|
|
2793
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
2794
|
+
[mediaQuery]: __spreadValues(__spreadValues({}, acc[mediaQuery]), value)
|
|
2795
|
+
});
|
|
2796
|
+
}, {});
|
|
2090
2797
|
}
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2798
|
+
function useResponsiveStyle(responsiveValues, join, strategy) {
|
|
2799
|
+
return responsiveStyle(useBreakpoints(), responsiveValues, join, strategy);
|
|
2800
|
+
}
|
|
2801
|
+
function responsiveWidth(breakpoints, widthData, defaultValue = "100%") {
|
|
2802
|
+
return __spreadValues({
|
|
2803
|
+
maxWidth: "100%"
|
|
2804
|
+
}, responsiveStyle(breakpoints, [widthData], ([width = defaultValue]) => ({
|
|
2805
|
+
width: typeof width === "object" ? `${width.value}${width.unit}` : width
|
|
2806
|
+
})));
|
|
2807
|
+
}
|
|
2808
|
+
function useResponsiveWidth(...args) {
|
|
2809
|
+
return responsiveWidth(useBreakpoints(), ...args);
|
|
2810
|
+
}
|
|
2811
|
+
function responsivePadding(breakpoints, paddingData, defaultValue = {}) {
|
|
2812
|
+
return responsiveStyle(breakpoints, [paddingData], ([padding = {}]) => paddingPropertyDataToStyle(padding, Object.assign({ paddingTop: 0, paddingRight: 0, paddingBottom: 0, paddingLeft: 0 }, defaultValue)));
|
|
2813
|
+
}
|
|
2814
|
+
function useResponsivePadding(...args) {
|
|
2815
|
+
return responsivePadding(useBreakpoints(), ...args);
|
|
2816
|
+
}
|
|
2817
|
+
function responsiveMargin(breakpoints, marginData, defaultValue = {}) {
|
|
2818
|
+
return responsiveStyle(breakpoints, [marginData], ([margin = {}]) => marginPropertyDataToStyle(margin, Object.assign({ marginTop: 0, marginRight: "auto", marginBottom: 0, marginLeft: "auto" }, defaultValue)));
|
|
2819
|
+
}
|
|
2820
|
+
function useResponsiveMargin(...args) {
|
|
2821
|
+
return responsiveMargin(useBreakpoints(), ...args);
|
|
2822
|
+
}
|
|
2823
|
+
function responsiveBorderRadius(breakpoints, borderRadiusData, defaultValue = {}) {
|
|
2824
|
+
return responsiveStyle(breakpoints, [borderRadiusData], ([borderRadius = {}]) => borderRadiusPropertyDataToStyle(borderRadius, Object.assign({
|
|
2825
|
+
borderTopLeftRadius: 0,
|
|
2826
|
+
borderTopRightRadius: 0,
|
|
2827
|
+
borderBottomRightRadius: 0,
|
|
2828
|
+
borderBottomLeftRadius: 0
|
|
2829
|
+
}, defaultValue)));
|
|
2830
|
+
}
|
|
2831
|
+
function useResponsiveBorderRadius(...args) {
|
|
2832
|
+
return responsiveBorderRadius(useBreakpoints(), ...args);
|
|
2833
|
+
}
|
|
2834
|
+
function useResponsiveBorder(borderData, defaultValue = {}) {
|
|
2835
|
+
return useResponsiveStyle([borderData], ([border = {}]) => borderPropertyDataToStyle(border, Object.assign({
|
|
2836
|
+
borderTop: "0px solid black",
|
|
2837
|
+
borderRight: "0px solid black",
|
|
2838
|
+
borderBottom: "0px solid black",
|
|
2839
|
+
borderLeft: "0px solid black"
|
|
2840
|
+
}, defaultValue)));
|
|
2841
|
+
}
|
|
2842
|
+
const floor = (d) => (v) => Math.floor(10 ** d * v) / 10 ** d;
|
|
2843
|
+
function responsiveGridItem(breakpoints, props) {
|
|
2844
|
+
return __spreadValues({
|
|
2845
|
+
display: "flex"
|
|
2846
|
+
}, responsiveStyle(breakpoints, [props.grid, props.columnGap, props.rowGap], ([
|
|
2847
|
+
{ spans, count } = { spans: [[12]], count: 12 },
|
|
2848
|
+
columnGap = { value: 0, unit: "px" },
|
|
2849
|
+
rowGap = { value: 0, unit: "px" }
|
|
2850
|
+
]) => {
|
|
2851
|
+
const [rowIndex, columnIndex] = getIndexes(spans, props.index);
|
|
2852
|
+
const firstCol = columnIndex === 0;
|
|
2853
|
+
const lastCol = columnIndex === spans[rowIndex].length - 1;
|
|
2854
|
+
const span = spans[rowIndex][columnIndex];
|
|
2855
|
+
const fraction = floor(5)(span / count);
|
|
2856
|
+
const width = `${fraction} * (100% + ${columnGap.value}${columnGap.unit})`;
|
|
2857
|
+
const excessWidth = `${Number(firstCol) + Number(lastCol)} * ${columnGap.value}${columnGap.unit} / 2`;
|
|
2858
|
+
const iePrecisionError = "0.01px";
|
|
2859
|
+
const flexBasis = `calc(${width} - ${excessWidth} - ${iePrecisionError})`;
|
|
2860
|
+
const firstRow = rowIndex === 0;
|
|
2861
|
+
const lastRow = rowIndex === spans.length - 1;
|
|
2862
|
+
return span === 0 ? { display: "none" } : {
|
|
2863
|
+
flexBasis,
|
|
2864
|
+
minWidth: flexBasis,
|
|
2865
|
+
maxWidth: flexBasis,
|
|
2866
|
+
paddingLeft: firstCol ? 0 : `${columnGap.value / 2}${columnGap.unit}`,
|
|
2867
|
+
paddingRight: lastCol ? 0 : `${columnGap.value / 2}${columnGap.unit}`,
|
|
2868
|
+
paddingTop: firstRow ? 0 : `${rowGap.value / 2}${rowGap.unit}`,
|
|
2869
|
+
paddingBottom: lastRow ? 0 : `${rowGap.value / 2}${rowGap.unit}`
|
|
2870
|
+
};
|
|
2871
|
+
}));
|
|
2872
|
+
}
|
|
2873
|
+
function useResponsiveGridItem(...args) {
|
|
2874
|
+
return responsiveGridItem(useBreakpoints(), ...args);
|
|
2875
|
+
}
|
|
2876
|
+
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();
|
|
2877
|
+
function responsiveShadow(breakpoints, value) {
|
|
2878
|
+
return responsiveStyle(breakpoints, [value], ([shadow = []]) => ({
|
|
2879
|
+
boxShadow: getBoxShadow(shadow)
|
|
2880
|
+
}));
|
|
2881
|
+
}
|
|
2882
|
+
function useResponsiveShadow(...args) {
|
|
2883
|
+
return responsiveShadow(useBreakpoints(), ...args);
|
|
2884
|
+
}
|
|
2885
|
+
function responsiveTextStyle(breakpoints, value) {
|
|
2886
|
+
return responsiveStyle(breakpoints, [value], ([
|
|
2887
|
+
textStyle = {
|
|
2888
|
+
fontFamily: null,
|
|
2889
|
+
letterSpacing: null,
|
|
2890
|
+
fontSize: null,
|
|
2891
|
+
fontWeight: null,
|
|
2892
|
+
textTransform: [],
|
|
2893
|
+
fontStyle: []
|
|
2894
|
+
}
|
|
2895
|
+
]) => {
|
|
2896
|
+
const {
|
|
2897
|
+
fontSize,
|
|
2898
|
+
fontWeight,
|
|
2899
|
+
fontStyle = [],
|
|
2900
|
+
textTransform = [],
|
|
2901
|
+
letterSpacing,
|
|
2902
|
+
fontFamily
|
|
2903
|
+
} = textStyle;
|
|
2904
|
+
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
2905
|
});
|
|
2101
|
-
return () => cleanUpFns.forEach((fn) => fn());
|
|
2102
2906
|
}
|
|
2103
|
-
function
|
|
2104
|
-
|
|
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);
|
|
2907
|
+
function useResponsiveTextStyle(...args) {
|
|
2908
|
+
return responsiveTextStyle(useBreakpoints(), ...args);
|
|
2119
2909
|
}
|
|
2120
2910
|
const defaultMargin = {
|
|
2121
2911
|
marginTop: 0,
|
|
@@ -2133,7 +2923,7 @@ function useStyleControlCssObject(style, controlDefinition) {
|
|
|
2133
2923
|
const { properties } = controlDefinition.config;
|
|
2134
2924
|
return __spreadValues(__spreadValues({}, properties.includes(descriptors.StyleControlProperty.Width) && {
|
|
2135
2925
|
maxWidth: "100%"
|
|
2136
|
-
}),
|
|
2926
|
+
}), useResponsiveStyle([
|
|
2137
2927
|
style == null ? void 0 : style.width,
|
|
2138
2928
|
style == null ? void 0 : style.margin,
|
|
2139
2929
|
style == null ? void 0 : style.padding,
|
|
@@ -2141,14 +2931,14 @@ function useStyleControlCssObject(style, controlDefinition) {
|
|
|
2141
2931
|
style == null ? void 0 : style.borderRadius,
|
|
2142
2932
|
style == null ? void 0 : style.textStyle
|
|
2143
2933
|
], ([width, margin, padding, border, borderRadius, textStyle]) => {
|
|
2144
|
-
var _a, _b,
|
|
2934
|
+
var _a, _b, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2145
2935
|
return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, properties.includes(descriptors.StyleControlProperty.Width) && {
|
|
2146
2936
|
width: (_a = widthToString(width)) != null ? _a : "100%"
|
|
2147
|
-
}), properties.includes(descriptors.StyleControlProperty.Margin) &&
|
|
2148
|
-
borderTop: (_b =
|
|
2149
|
-
borderRight: (
|
|
2150
|
-
borderBottom: (_d =
|
|
2151
|
-
borderLeft: (_e =
|
|
2937
|
+
}), 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) && {
|
|
2938
|
+
borderTop: (_b = borderSideToString2(border == null ? void 0 : border.borderTop)) != null ? _b : "0 solid black",
|
|
2939
|
+
borderRight: (_c2 = borderSideToString2(border == null ? void 0 : border.borderRight)) != null ? _c2 : "0 solid black",
|
|
2940
|
+
borderBottom: (_d = borderSideToString2(border == null ? void 0 : border.borderBottom)) != null ? _d : "0 solid black",
|
|
2941
|
+
borderLeft: (_e = borderSideToString2(border == null ? void 0 : border.borderLeft)) != null ? _e : "0 solid black"
|
|
2152
2942
|
}), properties.includes(descriptors.StyleControlProperty.BorderRadius) && {
|
|
2153
2943
|
borderTopLeftRadius: (_f = borderRadiusToString(borderRadius == null ? void 0 : borderRadius.borderTopLeftRadius)) != null ? _f : 0,
|
|
2154
2944
|
borderTopRightRadius: (_g = borderRadiusToString(borderRadius == null ? void 0 : borderRadius.borderTopRightRadius)) != null ? _g : 0,
|
|
@@ -2162,18 +2952,18 @@ function useStyleControlCssObject(style, controlDefinition) {
|
|
|
2162
2952
|
function widthToString(widthProperty) {
|
|
2163
2953
|
if (widthProperty == null)
|
|
2164
2954
|
return null;
|
|
2165
|
-
return
|
|
2955
|
+
return lengthPercentageDataToString(widthProperty);
|
|
2166
2956
|
}
|
|
2167
|
-
function
|
|
2957
|
+
function borderSideToString2(borderSide) {
|
|
2168
2958
|
if (borderSide == null)
|
|
2169
2959
|
return null;
|
|
2170
2960
|
const { width, color, style: style2 } = borderSide;
|
|
2171
|
-
return `${width != null ? width : 0}px ${style2} ${color != null ?
|
|
2961
|
+
return `${width != null ? width : 0}px ${style2} ${color != null ? colorToString(color) : "black"}`;
|
|
2172
2962
|
}
|
|
2173
2963
|
function borderRadiusToString(borderRadius) {
|
|
2174
2964
|
if (borderRadius == null)
|
|
2175
2965
|
return null;
|
|
2176
|
-
return
|
|
2966
|
+
return lengthPercentageDataToString(borderRadius);
|
|
2177
2967
|
}
|
|
2178
2968
|
function fontSizeToString(fontSize) {
|
|
2179
2969
|
return `${fontSize.value}${fontSize.unit}`;
|
|
@@ -2182,7 +2972,7 @@ function useStyleControlCssObject(style, controlDefinition) {
|
|
|
2182
2972
|
function useFormattedStyle(styleControlData, controlDefinition, control) {
|
|
2183
2973
|
const style = useStyleControlCssObject(styleControlData, controlDefinition);
|
|
2184
2974
|
const guid = React.useId().replaceAll(":", "");
|
|
2185
|
-
const styleClassName =
|
|
2975
|
+
const styleClassName = useStyle(style);
|
|
2186
2976
|
const classNames = `${styleClassName} ${guid}`;
|
|
2187
2977
|
React.useEffect(() => {
|
|
2188
2978
|
let currentBoxModel = null;
|
|
@@ -2191,7 +2981,7 @@ function useFormattedStyle(styleControlData, controlDefinition, control) {
|
|
|
2191
2981
|
return;
|
|
2192
2982
|
const element = document.querySelector(`.${guid}`);
|
|
2193
2983
|
const measuredBoxModel = element == null ? null : boxModels.getBox(element);
|
|
2194
|
-
if (!
|
|
2984
|
+
if (!deepEqual(currentBoxModel, measuredBoxModel)) {
|
|
2195
2985
|
currentBoxModel = measuredBoxModel;
|
|
2196
2986
|
control.changeBoxModel(currentBoxModel);
|
|
2197
2987
|
}
|
|
@@ -2218,7 +3008,7 @@ function useCheckboxControlValue(data, definition) {
|
|
|
2218
3008
|
function useColorValue(data, definition) {
|
|
2219
3009
|
var _a, _b;
|
|
2220
3010
|
const swatchId = (_a = data == null ? void 0 : data.swatchId) != null ? _a : null;
|
|
2221
|
-
const swatch =
|
|
3011
|
+
const swatch = useSwatch(swatchId);
|
|
2222
3012
|
const alpha = (_b = data == null ? void 0 : data.alpha) != null ? _b : 1;
|
|
2223
3013
|
if (swatch == null) {
|
|
2224
3014
|
const { defaultValue } = definition.config;
|
|
@@ -2241,7 +3031,7 @@ function useImageControlValue(data, definition) {
|
|
|
2241
3031
|
var _a;
|
|
2242
3032
|
const format = (_a = definition.config.format) != null ? _a : descriptors.ImageControlValueFormat.URL;
|
|
2243
3033
|
const fileId = data != null ? data : null;
|
|
2244
|
-
const file =
|
|
3034
|
+
const file = useFile(fileId);
|
|
2245
3035
|
if (format === descriptors.ImageControlValueFormat.URL) {
|
|
2246
3036
|
return file == null ? void 0 : file.publicUrl;
|
|
2247
3037
|
}
|
|
@@ -2255,7 +3045,7 @@ function useImageControlValue(data, definition) {
|
|
|
2255
3045
|
function useLinkControlValue(link, _definition) {
|
|
2256
3046
|
var _a;
|
|
2257
3047
|
const pageId = link && link.type === "OPEN_PAGE" ? link.payload.pageId : null;
|
|
2258
|
-
const page =
|
|
3048
|
+
const page = usePagePathnameSlice(pageId != null ? pageId : null);
|
|
2259
3049
|
const elementKey = (link == null ? void 0 : link.type) === "SCROLL_TO_ELEMENT" ? (_a = link.payload.elementIdConfig) == null ? void 0 : _a.elementKey : null;
|
|
2260
3050
|
const elementId = useElementId(elementKey);
|
|
2261
3051
|
let href = "#";
|
|
@@ -2381,7 +3171,7 @@ function pollBoxModel({
|
|
|
2381
3171
|
let currentBoxModel = null;
|
|
2382
3172
|
const handleAnimationFrameRequest = () => {
|
|
2383
3173
|
const measuredBoxModel = boxModels.getBox(element);
|
|
2384
|
-
if (!
|
|
3174
|
+
if (!deepEqual(currentBoxModel, measuredBoxModel)) {
|
|
2385
3175
|
currentBoxModel = measuredBoxModel;
|
|
2386
3176
|
onBoxModelChange(currentBoxModel);
|
|
2387
3177
|
}
|
|
@@ -2411,13 +3201,13 @@ function useSlot(data, control) {
|
|
|
2411
3201
|
}, element.key))
|
|
2412
3202
|
});
|
|
2413
3203
|
}
|
|
2414
|
-
function Slot(
|
|
2415
|
-
var
|
|
3204
|
+
function Slot(_f) {
|
|
3205
|
+
var _g = _f, {
|
|
2416
3206
|
as,
|
|
2417
3207
|
control,
|
|
2418
3208
|
children,
|
|
2419
3209
|
className
|
|
2420
|
-
} =
|
|
3210
|
+
} = _g, restOfProps = __objRest(_g, [
|
|
2421
3211
|
"as",
|
|
2422
3212
|
"control",
|
|
2423
3213
|
"children",
|
|
@@ -2425,7 +3215,7 @@ function Slot(_e) {
|
|
|
2425
3215
|
]);
|
|
2426
3216
|
const As = as != null ? as : "div";
|
|
2427
3217
|
const [element, setElement] = React.useState(null);
|
|
2428
|
-
const baseClassName =
|
|
3218
|
+
const baseClassName = useStyle({
|
|
2429
3219
|
display: "flex",
|
|
2430
3220
|
flexWrap: "wrap",
|
|
2431
3221
|
width: "100%"
|
|
@@ -2446,15 +3236,15 @@ function Slot(_e) {
|
|
|
2446
3236
|
}
|
|
2447
3237
|
Slot.Placeholder = SlotPlaceholder;
|
|
2448
3238
|
Slot.Item = SlotItem;
|
|
2449
|
-
function SlotItem(
|
|
2450
|
-
var
|
|
3239
|
+
function SlotItem(_h) {
|
|
3240
|
+
var _i = _h, {
|
|
2451
3241
|
as,
|
|
2452
3242
|
control,
|
|
2453
3243
|
grid,
|
|
2454
3244
|
index,
|
|
2455
3245
|
children,
|
|
2456
3246
|
className
|
|
2457
|
-
} =
|
|
3247
|
+
} = _i, restOfProps = __objRest(_i, [
|
|
2458
3248
|
"as",
|
|
2459
3249
|
"control",
|
|
2460
3250
|
"grid",
|
|
@@ -2464,13 +3254,13 @@ function SlotItem(_g) {
|
|
|
2464
3254
|
]);
|
|
2465
3255
|
const As = as != null ? as : "div";
|
|
2466
3256
|
const [element, setElement] = React.useState(null);
|
|
2467
|
-
const baseClassName =
|
|
3257
|
+
const baseClassName = useStyle(__spreadValues({
|
|
2468
3258
|
display: "flex"
|
|
2469
|
-
},
|
|
3259
|
+
}, useResponsiveStyle([grid], ([{
|
|
2470
3260
|
count = 12,
|
|
2471
3261
|
spans = [[12]]
|
|
2472
3262
|
} = {}]) => {
|
|
2473
|
-
const [rowIndex, columnIndex] =
|
|
3263
|
+
const [rowIndex, columnIndex] = getIndexes(spans, index);
|
|
2474
3264
|
const span = spans[rowIndex][columnIndex];
|
|
2475
3265
|
const flexBasis = `calc(100% * ${(span / count).toFixed(5)})`;
|
|
2476
3266
|
return span === 0 ? {
|
|
@@ -2508,7 +3298,7 @@ function SlotPlaceholder({
|
|
|
2508
3298
|
}, [element, control]);
|
|
2509
3299
|
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
2510
3300
|
ref: setElement,
|
|
2511
|
-
className:
|
|
3301
|
+
className: useStyle({
|
|
2512
3302
|
width: "100%",
|
|
2513
3303
|
background: "rgba(161, 168, 194, 0.18)",
|
|
2514
3304
|
height: "80px"
|
|
@@ -2517,7 +3307,7 @@ function SlotPlaceholder({
|
|
|
2517
3307
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2518
3308
|
width: "100%",
|
|
2519
3309
|
height: "100%",
|
|
2520
|
-
className:
|
|
3310
|
+
className: useStyle({
|
|
2521
3311
|
overflow: "visible",
|
|
2522
3312
|
padding: 8
|
|
2523
3313
|
}),
|
|
@@ -2640,24 +3430,24 @@ function ControlValue({
|
|
|
2640
3430
|
}
|
|
2641
3431
|
}
|
|
2642
3432
|
function useWidthStyle(value, descriptor) {
|
|
2643
|
-
return
|
|
3433
|
+
return useStyle(useResponsiveWidth(value, descriptor.options.defaultValue));
|
|
2644
3434
|
}
|
|
2645
3435
|
function usePaddingStyle(value) {
|
|
2646
|
-
return
|
|
3436
|
+
return useStyle(useResponsivePadding(value));
|
|
2647
3437
|
}
|
|
2648
3438
|
function useMarginStyle(value) {
|
|
2649
|
-
return
|
|
3439
|
+
return useStyle(useResponsiveMargin(value));
|
|
2650
3440
|
}
|
|
2651
3441
|
function useBorderRadiusStyle(value) {
|
|
2652
|
-
return
|
|
3442
|
+
return useStyle(useResponsiveBorderRadius(value));
|
|
2653
3443
|
}
|
|
2654
3444
|
function useShadowsStyle(value) {
|
|
2655
3445
|
const shadowValue = useBoxShadow(value);
|
|
2656
|
-
return
|
|
3446
|
+
return useStyle(useResponsiveShadow(shadowValue != null ? shadowValue : void 0));
|
|
2657
3447
|
}
|
|
2658
3448
|
function useBorderStyle(value) {
|
|
2659
3449
|
const borderData = useBorder(value);
|
|
2660
|
-
return
|
|
3450
|
+
return useStyle(useResponsiveBorder(borderData != null ? borderData : void 0));
|
|
2661
3451
|
}
|
|
2662
3452
|
function PropsValue({
|
|
2663
3453
|
element,
|
|
@@ -2674,7 +3464,7 @@ function PropsValue({
|
|
|
2674
3464
|
return constants.getPropControllers(state, documentKey, element.key);
|
|
2675
3465
|
});
|
|
2676
3466
|
return Object.entries(propControllerDescriptorsRef.current).reduceRight((renderFn, [propName, descriptor]) => (propsValue) => {
|
|
2677
|
-
var _a2, _b,
|
|
3467
|
+
var _a2, _b, _c2;
|
|
2678
3468
|
switch (descriptor.type) {
|
|
2679
3469
|
case textInput.CheckboxControlType:
|
|
2680
3470
|
case textInput.NumberControlType:
|
|
@@ -2716,7 +3506,7 @@ function PropsValue({
|
|
|
2716
3506
|
}, descriptor.type);
|
|
2717
3507
|
}
|
|
2718
3508
|
case descriptors.SlotControlType: {
|
|
2719
|
-
const control = (
|
|
3509
|
+
const control = (_c2 = propControllers == null ? void 0 : propControllers[propName]) != null ? _c2 : null;
|
|
2720
3510
|
return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
|
|
2721
3511
|
hook: useSlot,
|
|
2722
3512
|
parameters: [props[propName], control],
|
|
@@ -2921,6 +3711,12 @@ function createReactRuntime(store) {
|
|
|
2921
3711
|
},
|
|
2922
3712
|
copyElementTree(elementTree2, replacementContext) {
|
|
2923
3713
|
return constants.copyElementTree(store.getState(), elementTree2, replacementContext);
|
|
3714
|
+
},
|
|
3715
|
+
getBreakpoints() {
|
|
3716
|
+
return constants.getBreakpoints(store.getState());
|
|
3717
|
+
},
|
|
3718
|
+
unstable_setBreakpoints(breakpoints) {
|
|
3719
|
+
return store.dispatch(actions.setBreakpoints(state_breakpoints.parseBreakpointsInput(breakpoints)));
|
|
2924
3720
|
}
|
|
2925
3721
|
};
|
|
2926
3722
|
}
|
|
@@ -2933,10 +3729,10 @@ const PreviewProvider = dynamic__default["default"](() => Promise.resolve().then
|
|
|
2933
3729
|
const LiveProvider = dynamic__default["default"](() => Promise.resolve().then(function() {
|
|
2934
3730
|
return require("./LiveProvider.cjs.js");
|
|
2935
3731
|
}));
|
|
2936
|
-
function RuntimeProvider(
|
|
2937
|
-
var
|
|
3732
|
+
function RuntimeProvider(_j) {
|
|
3733
|
+
var _k = _j, {
|
|
2938
3734
|
preview
|
|
2939
|
-
} =
|
|
3735
|
+
} = _k, props = __objRest(_k, [
|
|
2940
3736
|
"preview"
|
|
2941
3737
|
]);
|
|
2942
3738
|
return preview ? /* @__PURE__ */ jsxRuntime.jsx(PreviewProvider, __spreadValues({}, props)) : /* @__PURE__ */ jsxRuntime.jsx(LiveProvider, __spreadValues({}, props));
|
|
@@ -2991,6 +3787,9 @@ function useIsPreview() {
|
|
|
2991
3787
|
function useBuilderEditMode() {
|
|
2992
3788
|
return useSelector((state) => constants.getBuilderEditMode(state));
|
|
2993
3789
|
}
|
|
3790
|
+
function useBreakpoints() {
|
|
3791
|
+
return useSelector((state) => constants.getBreakpoints(state));
|
|
3792
|
+
}
|
|
2994
3793
|
function useDispatch() {
|
|
2995
3794
|
const store = React.useContext(StoreContext);
|
|
2996
3795
|
return store.dispatch;
|
|
@@ -3033,7 +3832,7 @@ const DisableRegisterElement = React.createContext(false);
|
|
|
3033
3832
|
const ElementReference = React.memo(React.forwardRef(function ElementReference2({
|
|
3034
3833
|
elementReference
|
|
3035
3834
|
}, ref) {
|
|
3036
|
-
const globalElement =
|
|
3835
|
+
const globalElement = useGlobalElement(elementReference.value);
|
|
3037
3836
|
const globalElementData = globalElement == null ? void 0 : globalElement.data;
|
|
3038
3837
|
const elementReferenceDocument = useDocument(elementReference.key);
|
|
3039
3838
|
const documentKey = elementReference.key;
|
|
@@ -3149,6 +3948,7 @@ exports.Element = Element$1;
|
|
|
3149
3948
|
exports.ElementImperativeHandle = ElementImperativeHandle;
|
|
3150
3949
|
exports.Makeswift = Makeswift;
|
|
3151
3950
|
exports.MakeswiftApiHandler = MakeswiftApiHandler;
|
|
3951
|
+
exports.MakeswiftProvider = MakeswiftProvider;
|
|
3152
3952
|
exports.Page = Page$1;
|
|
3153
3953
|
exports.Page$1 = Page;
|
|
3154
3954
|
exports.PageProvider = PageProvider;
|
|
@@ -3159,6 +3959,8 @@ exports.RuntimeProvider = RuntimeProvider;
|
|
|
3159
3959
|
exports.Shapes = Shapes;
|
|
3160
3960
|
exports.Sizes = Sizes;
|
|
3161
3961
|
exports.StoreContext = StoreContext;
|
|
3962
|
+
exports.colorToString = colorToString;
|
|
3963
|
+
exports.deepEqual = deepEqual;
|
|
3162
3964
|
exports.forwardNextDynamicRef = forwardNextDynamicRef;
|
|
3163
3965
|
exports.getServerSideProps = getServerSideProps;
|
|
3164
3966
|
exports.getStaticPaths = getStaticPaths;
|
|
@@ -3167,12 +3969,24 @@ exports.pollBoxModel = pollBoxModel;
|
|
|
3167
3969
|
exports.storeContextDefaultValue = storeContextDefaultValue;
|
|
3168
3970
|
exports.useBorder = useBorder;
|
|
3169
3971
|
exports.useBoxShadow = useBoxShadow;
|
|
3972
|
+
exports.useBreakpoints = useBreakpoints;
|
|
3170
3973
|
exports.useBuilderEditMode = useBuilderEditMode;
|
|
3171
3974
|
exports.useElementId = useElementId;
|
|
3975
|
+
exports.useFile = useFile;
|
|
3976
|
+
exports.useFiles = useFiles;
|
|
3172
3977
|
exports.useFormContext = useFormContext;
|
|
3173
3978
|
exports.useIsInBuilder = useIsInBuilder;
|
|
3174
3979
|
exports.useIsPreview = useIsPreview;
|
|
3175
|
-
exports.
|
|
3980
|
+
exports.useMakeswiftClient = useMakeswiftClient;
|
|
3176
3981
|
exports.usePageId = usePageId;
|
|
3982
|
+
exports.usePagePathnameSlice = usePagePathnameSlice;
|
|
3177
3983
|
exports.useResponsiveColor = useResponsiveColor;
|
|
3984
|
+
exports.useResponsiveGridItem = useResponsiveGridItem;
|
|
3985
|
+
exports.useResponsiveStyle = useResponsiveStyle;
|
|
3986
|
+
exports.useResponsiveTextStyle = useResponsiveTextStyle;
|
|
3987
|
+
exports.useResponsiveWidth = useResponsiveWidth;
|
|
3988
|
+
exports.useStyle = useStyle;
|
|
3989
|
+
exports.useSwatches = useSwatches;
|
|
3990
|
+
exports.useTable = useTable;
|
|
3991
|
+
exports.useTypography = useTypography;
|
|
3178
3992
|
//# sourceMappingURL=index.cjs.js.map
|