@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.es.js
CHANGED
|
@@ -34,30 +34,34 @@ var __publicField = (obj, key, value) => {
|
|
|
34
34
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
35
35
|
return value;
|
|
36
36
|
};
|
|
37
|
+
var _c;
|
|
37
38
|
import * as React from "react";
|
|
38
|
-
import { useEffect, useState, useMemo, useRef, Children, createElement, forwardRef, memo,
|
|
39
|
+
import { useEffect, createContext, useContext, useState, useMemo, useRef, Children, createElement, forwardRef, memo, useId, useCallback, useImperativeHandle, Component, Suspense } from "react";
|
|
39
40
|
import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector";
|
|
40
41
|
import dynamic from "next/dynamic";
|
|
41
|
-
import { a as createDocumentReference, g as getPropControllerDescriptors, i as isElementReference, M as MakeswiftComponentType, b as isPropControllersHandle, d as getComponentPropControllerDescriptors, e as getPropControllers, f as configureStore, h as getDocument, j as
|
|
42
|
-
import { A as ActionTypes,
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
42
|
+
import { a as createDocumentReference, g as getPropControllerDescriptors, i as isElementReference, M as MakeswiftComponentType, b as isPropControllersHandle, d as getComponentPropControllerDescriptors, e as getPropControllers, f as configureStore$1, h as getDocument, j as getBreakpoints, k as getElementId, l as getIsPreview, m as getIsInBuilder, n as copyElementTree, o as getReactComponent, p as getBuilderEditMode } from "./constants.es.js";
|
|
43
|
+
import { A as ActionTypes, k as apiResourceFulfilled, l as registerComponentHandleEffect, n as mountComponentEffect, o as registerComponentEffect, p as registerReactComponentEffect, j as setBreakpoints } from "./actions.es.js";
|
|
44
|
+
import { cache, cx } from "@emotion/css";
|
|
45
|
+
import { serializeStyles } from "@emotion/serialize";
|
|
46
|
+
import { registerStyles, insertStyles } from "@emotion/utils";
|
|
47
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
48
|
+
import { S as ShapeControlType, L as ListControlType, T as Types, E as ElementID, B as Backgrounds, W as Width, f as ResponsiveIconRadioGroup, M as Margin, P as Padding, g as Border, h as BorderRadius, i as Shadows, G as GapY, j as GapX, k as ResponsiveSelect, l as ResponsiveNumber, m as Checkbox, n as Grid, o as TextInput, p as Link, q as ResponsiveColor, s as TextStyle, t as Images, N as Number$1, D as Date$1, F as Font, u as ResponsiveLength, v as TextArea, w as Table, x as TableFormFields, y as Image, z as ResponsiveOpacity, A as NavigationLinks, H as SocialLinks, J as RichText, V as Video, K as StyleControlProperty, O as ImageControlValueFormat, Q as StyleControlType, U as RichTextControlType, b as SlotControlType, X as LinkControlType, I as ImageControlType, C as ColorControlType, Y as BorderPropControllerFormat, Z as ShadowsPropControllerFormat, _ as BorderRadiusPropControllerFormat, $ as MarginPropControllerFormat, a0 as PaddingPropControllerFormat, a1 as WidthPropControllerFormat } from "./descriptors.es.js";
|
|
46
49
|
import "slate";
|
|
47
50
|
import { S as SelectControlType, T as TextAreaControlType, a as TextInputControlType, N as NumberControlType, C as CheckboxControlType } from "./text-input.es.js";
|
|
48
51
|
import { C as ComboboxControlType } from "./combobox.es.js";
|
|
49
52
|
import "slate-react";
|
|
50
53
|
import { useSyncExternalStore } from "use-sync-external-store/shim";
|
|
51
|
-
import {
|
|
52
|
-
import
|
|
54
|
+
import { createStore, applyMiddleware } from "redux";
|
|
55
|
+
import thunk from "redux-thunk";
|
|
56
|
+
import { A as APIResourceType } from "./types.es.js";
|
|
57
|
+
import { b as getElementSwatchIds, c as getFileIds, d as getTypographyIds, e as getTableIds, f as getPageIds, a as getElementChildren, h as getBorderSwatchIds, j as isNonNullable, k as getBoxShadowsSwatchIds, l as getResponsiveColorSwatchIds } from "./introspection.es.js";
|
|
58
|
+
import { getBaseBreakpoint, findBreakpointOverride, DefaultBreakpointID, join, getBreakpoint, getBreakpointMediaQuery, parseBreakpointsInput } from "./state/breakpoints.es.js";
|
|
53
59
|
import { g as getBox, i as isMeasurable, m as measure } from "./box-models.es.js";
|
|
54
60
|
import ColorHelper from "color";
|
|
55
61
|
import scrollIntoView from "scroll-into-view-if-needed";
|
|
56
|
-
import { cache, cx } from "@emotion/css";
|
|
57
62
|
import { findDOMNode } from "react-dom";
|
|
58
63
|
import parse from "html-react-parser";
|
|
59
64
|
import Head from "next/head";
|
|
60
|
-
import { A as APIResourceType } from "./types.es.js";
|
|
61
65
|
import createEmotionServer from "@emotion/server/create-instance";
|
|
62
66
|
import NextDocument, { Html, Head as Head$1, Main, NextScript } from "next/document";
|
|
63
67
|
import Cors from "cors";
|
|
@@ -111,6 +115,448 @@ function BodySnippet({
|
|
|
111
115
|
}, [code, cleanup]);
|
|
112
116
|
return null;
|
|
113
117
|
}
|
|
118
|
+
function is(x, y) {
|
|
119
|
+
if (x === y)
|
|
120
|
+
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
121
|
+
return x !== x && y !== y;
|
|
122
|
+
}
|
|
123
|
+
const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
|
|
124
|
+
const shallowEqual = (a, b) => {
|
|
125
|
+
if (is(a, b))
|
|
126
|
+
return true;
|
|
127
|
+
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
128
|
+
return false;
|
|
129
|
+
const keysA = Object.keys(a);
|
|
130
|
+
const keysB = Object.keys(b);
|
|
131
|
+
if (keysA.length !== keysB.length)
|
|
132
|
+
return false;
|
|
133
|
+
for (let i = 0; i < keysA.length; i += 1) {
|
|
134
|
+
if (!hasOwnProperty$1.call(b, keysA[i]) || !is(a[keysA[i]], b[keysA[i]]))
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
return true;
|
|
138
|
+
};
|
|
139
|
+
const { hasOwnProperty } = Object.prototype;
|
|
140
|
+
const deepEqual = (a, b) => {
|
|
141
|
+
if (shallowEqual(a, b))
|
|
142
|
+
return true;
|
|
143
|
+
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
144
|
+
return false;
|
|
145
|
+
const keysA = Object.keys(a);
|
|
146
|
+
const keysB = Object.keys(b);
|
|
147
|
+
if (keysA.length !== keysB.length)
|
|
148
|
+
return false;
|
|
149
|
+
for (let i = 0; i < keysA.length; i += 1) {
|
|
150
|
+
if (!hasOwnProperty.call(b, keysA[i]) || !deepEqual(a[keysA[i]], b[keysA[i]]))
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
return true;
|
|
154
|
+
};
|
|
155
|
+
function getInitialState(serializedState = {
|
|
156
|
+
Swatch: [],
|
|
157
|
+
File: [],
|
|
158
|
+
Typography: [],
|
|
159
|
+
PagePathnameSlice: [],
|
|
160
|
+
GlobalElement: [],
|
|
161
|
+
Table: [],
|
|
162
|
+
Snippet: [],
|
|
163
|
+
Page: [],
|
|
164
|
+
Site: []
|
|
165
|
+
}) {
|
|
166
|
+
return new Map(Object.entries(serializedState).map(([apiResourceType, resources]) => [
|
|
167
|
+
apiResourceType,
|
|
168
|
+
new Map(resources.map(({ id, value }) => [id, value]))
|
|
169
|
+
]));
|
|
170
|
+
}
|
|
171
|
+
function getHasAPIResource$1(state, resourceType, resourceId) {
|
|
172
|
+
var _a, _b;
|
|
173
|
+
return (_b = (_a = state.get(resourceType)) == null ? void 0 : _a.has(resourceId)) != null ? _b : false;
|
|
174
|
+
}
|
|
175
|
+
function getAPIResource$1(state, resourceType, resourceId) {
|
|
176
|
+
var _a;
|
|
177
|
+
const resource = (_a = state.get(resourceType)) == null ? void 0 : _a.get(resourceId);
|
|
178
|
+
return (resource == null ? void 0 : resource.__typename) === resourceType ? resource : null;
|
|
179
|
+
}
|
|
180
|
+
function reducer$1(state = getInitialState(), action) {
|
|
181
|
+
switch (action.type) {
|
|
182
|
+
case ActionTypes.API_RESOURCE_FULFILLED: {
|
|
183
|
+
const { resourceType, resourceId, resource } = action.payload;
|
|
184
|
+
return new Map(state).set(resourceType, new Map(state.get(resourceType)).set(resourceId, resource));
|
|
185
|
+
}
|
|
186
|
+
case ActionTypes.CHANGE_API_RESOURCE: {
|
|
187
|
+
const existingApiResource = getAPIResource$1(state, action.payload.resource.__typename, action.payload.resource.id);
|
|
188
|
+
if (deepEqual(existingApiResource, action.payload.resource))
|
|
189
|
+
return state;
|
|
190
|
+
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));
|
|
191
|
+
}
|
|
192
|
+
case ActionTypes.EVICT_API_RESOURCE: {
|
|
193
|
+
const [resourceType, resourceId] = action.payload.id.split(":");
|
|
194
|
+
if (!(resourceType in APIResourceType))
|
|
195
|
+
return state;
|
|
196
|
+
const resources = new Map(state.get(resourceType));
|
|
197
|
+
const deleted = resources.delete(resourceId);
|
|
198
|
+
return deleted ? new Map(state).set(resourceType, resources) : state;
|
|
199
|
+
}
|
|
200
|
+
default:
|
|
201
|
+
return state;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const reducer = reducer$1;
|
|
205
|
+
function getHasAPIResource(state, resourceType, resourceId) {
|
|
206
|
+
return getHasAPIResource$1(state, resourceType, resourceId);
|
|
207
|
+
}
|
|
208
|
+
function getAPIResource(state, resourceType, resourceId) {
|
|
209
|
+
return getAPIResource$1(state, resourceType, resourceId);
|
|
210
|
+
}
|
|
211
|
+
async function fetchJson(url) {
|
|
212
|
+
var _a;
|
|
213
|
+
const response = await fetch(url, {
|
|
214
|
+
headers: { "Content-Type": "application/json" }
|
|
215
|
+
});
|
|
216
|
+
if (response.status === 404)
|
|
217
|
+
return null;
|
|
218
|
+
if (!response.ok)
|
|
219
|
+
throw new Error(response.statusText);
|
|
220
|
+
if (((_a = response.headers.get("content-type")) == null ? void 0 : _a.includes("application/json")) !== true) {
|
|
221
|
+
throw new Error(`Expected JSON response from "${url}" but got "${response.headers.get("content-type")}"`);
|
|
222
|
+
}
|
|
223
|
+
return response.json();
|
|
224
|
+
}
|
|
225
|
+
function fetchAPIResource(resourceType, resourceId) {
|
|
226
|
+
return async (dispatch, getState) => {
|
|
227
|
+
const state = getState();
|
|
228
|
+
if (getHasAPIResource(state, resourceType, resourceId)) {
|
|
229
|
+
return getAPIResource(state, resourceType, resourceId);
|
|
230
|
+
}
|
|
231
|
+
let resource;
|
|
232
|
+
switch (resourceType) {
|
|
233
|
+
case APIResourceType.Swatch:
|
|
234
|
+
resource = await fetchJson(`/api/makeswift/swatches/${resourceId}`);
|
|
235
|
+
break;
|
|
236
|
+
case APIResourceType.File:
|
|
237
|
+
resource = await fetchJson(`/api/makeswift/files/${resourceId}`);
|
|
238
|
+
break;
|
|
239
|
+
case APIResourceType.Typography:
|
|
240
|
+
resource = await fetchJson(`/api/makeswift/typographies/${resourceId}`);
|
|
241
|
+
break;
|
|
242
|
+
case APIResourceType.GlobalElement:
|
|
243
|
+
resource = await fetchJson(`/api/makeswift/global-elements/${resourceId}`);
|
|
244
|
+
break;
|
|
245
|
+
case APIResourceType.PagePathnameSlice:
|
|
246
|
+
resource = await fetchJson(`/api/makeswift/page-pathname-slices/${resourceId}`);
|
|
247
|
+
break;
|
|
248
|
+
case APIResourceType.Table:
|
|
249
|
+
resource = await fetchJson(`/api/makeswift/tables/${resourceId}`);
|
|
250
|
+
break;
|
|
251
|
+
default:
|
|
252
|
+
resource = null;
|
|
253
|
+
}
|
|
254
|
+
dispatch(apiResourceFulfilled(resourceType, resourceId, resource));
|
|
255
|
+
return resource;
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
function configureStore({ serializedState }) {
|
|
259
|
+
return createStore(reducer, getInitialState(serializedState), applyMiddleware(thunk));
|
|
260
|
+
}
|
|
261
|
+
class GraphQLClient {
|
|
262
|
+
constructor(endpoint) {
|
|
263
|
+
__publicField(this, "endpoint");
|
|
264
|
+
this.endpoint = endpoint;
|
|
265
|
+
}
|
|
266
|
+
async request(query, variables = {}) {
|
|
267
|
+
const response = await fetch(this.endpoint, {
|
|
268
|
+
method: "POST",
|
|
269
|
+
headers: { "Content-Type": "application/json" },
|
|
270
|
+
body: JSON.stringify({ query, variables })
|
|
271
|
+
});
|
|
272
|
+
if (!response.ok && response.status !== 400) {
|
|
273
|
+
throw new Error(`${response.status} ${response.statusText}`);
|
|
274
|
+
}
|
|
275
|
+
const body = await response.json();
|
|
276
|
+
if (body.errors != null) {
|
|
277
|
+
console.error(body);
|
|
278
|
+
throw new Error("GraphQL response contains errors, check the console.");
|
|
279
|
+
}
|
|
280
|
+
return body.data;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
const SwatchFragment = `
|
|
284
|
+
fragment Swatch on Swatch {
|
|
285
|
+
__typename
|
|
286
|
+
id
|
|
287
|
+
hue
|
|
288
|
+
saturation
|
|
289
|
+
lightness
|
|
290
|
+
}
|
|
291
|
+
`;
|
|
292
|
+
const FileFragment = `
|
|
293
|
+
fragment File on File {
|
|
294
|
+
__typename
|
|
295
|
+
id
|
|
296
|
+
name
|
|
297
|
+
publicUrl: publicUrlV2
|
|
298
|
+
extension
|
|
299
|
+
dimensions {
|
|
300
|
+
width
|
|
301
|
+
height
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
`;
|
|
305
|
+
const TypographyFragment = `
|
|
306
|
+
fragment Typography on Typography {
|
|
307
|
+
__typename
|
|
308
|
+
id
|
|
309
|
+
name
|
|
310
|
+
style {
|
|
311
|
+
deviceId
|
|
312
|
+
value {
|
|
313
|
+
fontFamily
|
|
314
|
+
fontSize {
|
|
315
|
+
value
|
|
316
|
+
unit
|
|
317
|
+
}
|
|
318
|
+
color {
|
|
319
|
+
swatchId
|
|
320
|
+
alpha
|
|
321
|
+
}
|
|
322
|
+
lineHeight
|
|
323
|
+
letterSpacing
|
|
324
|
+
fontWeight
|
|
325
|
+
textAlign
|
|
326
|
+
uppercase
|
|
327
|
+
underline
|
|
328
|
+
strikethrough
|
|
329
|
+
italic
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
`;
|
|
334
|
+
const PagePathnameSliceFragment = `
|
|
335
|
+
fragment PagePathnameSlice on PagePathnameSlice {
|
|
336
|
+
__typename
|
|
337
|
+
id
|
|
338
|
+
pathname
|
|
339
|
+
}
|
|
340
|
+
`;
|
|
341
|
+
const GlobalElementFragment = `
|
|
342
|
+
fragment GlobalElement on GlobalElement {
|
|
343
|
+
__typename
|
|
344
|
+
id
|
|
345
|
+
data
|
|
346
|
+
}
|
|
347
|
+
`;
|
|
348
|
+
const TableFragment = `
|
|
349
|
+
fragment Table on Table {
|
|
350
|
+
__typename
|
|
351
|
+
id
|
|
352
|
+
name
|
|
353
|
+
columns {
|
|
354
|
+
__typename
|
|
355
|
+
id
|
|
356
|
+
name
|
|
357
|
+
|
|
358
|
+
... on MultipleSelectTableColumn {
|
|
359
|
+
options {
|
|
360
|
+
id
|
|
361
|
+
name
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
... on SingleSelectTableColumn {
|
|
366
|
+
options {
|
|
367
|
+
id
|
|
368
|
+
name
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
`;
|
|
374
|
+
const IntrospectedResourcesQuery = `
|
|
375
|
+
query IntrospectedResources(
|
|
376
|
+
$swatchIds: [ID!]!
|
|
377
|
+
$fileIds: [ID!]!
|
|
378
|
+
$pageIds: [ID!]!
|
|
379
|
+
$tableIds: [ID!]!
|
|
380
|
+
) {
|
|
381
|
+
swatches(ids: $swatchIds) {
|
|
382
|
+
...Swatch
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
files(ids: $fileIds) {
|
|
386
|
+
...File
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
pagePathnamesById(ids: $pageIds) {
|
|
390
|
+
...PagePathnameSlice
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
tables(ids: $tableIds) {
|
|
394
|
+
...Table
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
${SwatchFragment}
|
|
399
|
+
${FileFragment}
|
|
400
|
+
${PagePathnameSliceFragment}
|
|
401
|
+
${TableFragment}
|
|
402
|
+
`;
|
|
403
|
+
const SwatchQuery = `
|
|
404
|
+
query Swatch($swatchId: ID!) {
|
|
405
|
+
swatch(id: $swatchId) {
|
|
406
|
+
...Swatch
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
${SwatchFragment}
|
|
411
|
+
`;
|
|
412
|
+
const FileQuery = `
|
|
413
|
+
query File($fileId: ID!) {
|
|
414
|
+
file(id: $fileId) {
|
|
415
|
+
...File
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
${FileFragment}
|
|
420
|
+
`;
|
|
421
|
+
const TypographyQuery = `
|
|
422
|
+
query Typography($typographyId: ID!) {
|
|
423
|
+
typography(id: $typographyId) {
|
|
424
|
+
...Typography
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
${TypographyFragment}
|
|
429
|
+
`;
|
|
430
|
+
const PagePathnamesByIdQuery = `
|
|
431
|
+
query PagePathnamesById($pageIds: [ID!]!) {
|
|
432
|
+
pagePathnamesById(ids: $pageIds) {
|
|
433
|
+
...PagePathnameSlice
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
${PagePathnameSliceFragment}
|
|
438
|
+
`;
|
|
439
|
+
const TableQuery = `
|
|
440
|
+
query Table($tableId: ID!) {
|
|
441
|
+
table(id: $tableId) {
|
|
442
|
+
...Table
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
${TableFragment}
|
|
447
|
+
`;
|
|
448
|
+
const TypographiesQuery = `
|
|
449
|
+
query Typographies($typographyIds: [ID!]!) {
|
|
450
|
+
typographies(ids: $typographyIds) {
|
|
451
|
+
...Typography
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
${TypographyFragment}
|
|
456
|
+
`;
|
|
457
|
+
const GlobalElementQuery = `
|
|
458
|
+
query GlobalElement($globalElementId: ID!) {
|
|
459
|
+
globalElement(id: $globalElementId) {
|
|
460
|
+
...GlobalElement
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
${GlobalElementFragment}
|
|
465
|
+
`;
|
|
466
|
+
const CreateTableRecordMutation = `
|
|
467
|
+
mutation CreateTableRecord($input: CreateTableRecordInput!) {
|
|
468
|
+
createTableRecord(input: $input) {
|
|
469
|
+
tableRecord {
|
|
470
|
+
id
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
`;
|
|
475
|
+
class MakeswiftClient {
|
|
476
|
+
constructor({
|
|
477
|
+
uri,
|
|
478
|
+
cacheData
|
|
479
|
+
}) {
|
|
480
|
+
__publicField(this, "graphqlClient");
|
|
481
|
+
__publicField(this, "makeswiftApiClient");
|
|
482
|
+
__publicField(this, "subscribe");
|
|
483
|
+
this.graphqlClient = new GraphQLClient(uri);
|
|
484
|
+
this.makeswiftApiClient = configureStore({
|
|
485
|
+
serializedState: cacheData
|
|
486
|
+
});
|
|
487
|
+
this.subscribe = this.makeswiftApiClient.subscribe;
|
|
488
|
+
}
|
|
489
|
+
readSwatch(swatchId) {
|
|
490
|
+
return getAPIResource(this.makeswiftApiClient.getState(), APIResourceType.Swatch, swatchId);
|
|
491
|
+
}
|
|
492
|
+
async fetchSwatch(swatchId) {
|
|
493
|
+
return await this.makeswiftApiClient.dispatch(fetchAPIResource(APIResourceType.Swatch, swatchId));
|
|
494
|
+
}
|
|
495
|
+
readFile(fileId) {
|
|
496
|
+
return getAPIResource(this.makeswiftApiClient.getState(), APIResourceType.File, fileId);
|
|
497
|
+
}
|
|
498
|
+
async fetchFile(fileId) {
|
|
499
|
+
return await this.makeswiftApiClient.dispatch(fetchAPIResource(APIResourceType.File, fileId));
|
|
500
|
+
}
|
|
501
|
+
readTypography(typographyId) {
|
|
502
|
+
return getAPIResource(this.makeswiftApiClient.getState(), APIResourceType.Typography, typographyId);
|
|
503
|
+
}
|
|
504
|
+
async fetchTypography(typographyId) {
|
|
505
|
+
return await this.makeswiftApiClient.dispatch(fetchAPIResource(APIResourceType.Typography, typographyId));
|
|
506
|
+
}
|
|
507
|
+
readGlobalElement(globalElementId) {
|
|
508
|
+
return getAPIResource(this.makeswiftApiClient.getState(), APIResourceType.GlobalElement, globalElementId);
|
|
509
|
+
}
|
|
510
|
+
async fetchGlobalElement(globalElementId) {
|
|
511
|
+
return await this.makeswiftApiClient.dispatch(fetchAPIResource(APIResourceType.GlobalElement, globalElementId));
|
|
512
|
+
}
|
|
513
|
+
readPagePathnameSlice(pageId) {
|
|
514
|
+
return getAPIResource(this.makeswiftApiClient.getState(), APIResourceType.PagePathnameSlice, pageId);
|
|
515
|
+
}
|
|
516
|
+
async fetchPagePathnameSlice(pageId) {
|
|
517
|
+
return await this.makeswiftApiClient.dispatch(fetchAPIResource(APIResourceType.PagePathnameSlice, pageId));
|
|
518
|
+
}
|
|
519
|
+
readTable(tableId) {
|
|
520
|
+
return getAPIResource(this.makeswiftApiClient.getState(), APIResourceType.Table, tableId);
|
|
521
|
+
}
|
|
522
|
+
async fetchTable(tableId) {
|
|
523
|
+
return await this.makeswiftApiClient.dispatch(fetchAPIResource(APIResourceType.Table, tableId));
|
|
524
|
+
}
|
|
525
|
+
async createTableRecord(tableId, columns) {
|
|
526
|
+
await this.graphqlClient.request(CreateTableRecordMutation, {
|
|
527
|
+
input: {
|
|
528
|
+
data: {
|
|
529
|
+
tableId,
|
|
530
|
+
columns
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
readSite(siteId) {
|
|
536
|
+
return getAPIResource(this.makeswiftApiClient.getState(), APIResourceType.Site, siteId);
|
|
537
|
+
}
|
|
538
|
+
readPage(pageId) {
|
|
539
|
+
return getAPIResource(this.makeswiftApiClient.getState(), APIResourceType.Page, pageId);
|
|
540
|
+
}
|
|
541
|
+
readSnippet(snippetId) {
|
|
542
|
+
return getAPIResource(this.makeswiftApiClient.getState(), APIResourceType.Snippet, snippetId);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
const Context$1 = createContext(new MakeswiftClient({
|
|
546
|
+
uri: "https://api.makeswift.com/graphql"
|
|
547
|
+
}));
|
|
548
|
+
function useMakeswiftClient() {
|
|
549
|
+
return useContext(Context$1);
|
|
550
|
+
}
|
|
551
|
+
function MakeswiftProvider({
|
|
552
|
+
client,
|
|
553
|
+
children
|
|
554
|
+
}) {
|
|
555
|
+
return /* @__PURE__ */ jsx(Context$1.Provider, {
|
|
556
|
+
value: client,
|
|
557
|
+
children
|
|
558
|
+
});
|
|
559
|
+
}
|
|
114
560
|
const SnippetLocation = {
|
|
115
561
|
Body: "BODY",
|
|
116
562
|
Head: "HEAD"
|
|
@@ -677,7 +1123,7 @@ async function fonts(_req, res, { getFonts } = {}) {
|
|
|
677
1123
|
const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
|
|
678
1124
|
return res.json(fonts2);
|
|
679
1125
|
}
|
|
680
|
-
const version = "0.8.
|
|
1126
|
+
const version = "0.8.6";
|
|
681
1127
|
async function handler(req, res, { apiKey }) {
|
|
682
1128
|
if (req.query.secret !== apiKey) {
|
|
683
1129
|
return res.status(401).json({ message: "Unauthorized" });
|
|
@@ -890,14 +1336,14 @@ async function getStaticPaths() {
|
|
|
890
1336
|
}
|
|
891
1337
|
const REVALIDATE_SECONDS = 1;
|
|
892
1338
|
async function getStaticProps(ctx) {
|
|
893
|
-
var _a, _b,
|
|
1339
|
+
var _a, _b, _c2;
|
|
894
1340
|
deprecationWarning("getStaticProps");
|
|
895
1341
|
const makeswift = new Makeswift(getApiKey(), {
|
|
896
1342
|
apiOrigin: getApiOrigin()
|
|
897
1343
|
});
|
|
898
1344
|
const path = "/" + ((_b = (_a = ctx.params) == null ? void 0 : _a.path) != null ? _b : []).join("/");
|
|
899
1345
|
const snapshot = await makeswift.getPageSnapshot(path, {
|
|
900
|
-
preview: ((
|
|
1346
|
+
preview: ((_c2 = ctx.previewData) == null ? void 0 : _c2.makeswift) === true
|
|
901
1347
|
});
|
|
902
1348
|
if (snapshot == null)
|
|
903
1349
|
return {
|
|
@@ -958,7 +1404,7 @@ function registerComponent$c(runtime) {
|
|
|
958
1404
|
function isHiddenBasedOnAnimationType(props, deviceId, property) {
|
|
959
1405
|
var _a, _b;
|
|
960
1406
|
const animateIn = props[property];
|
|
961
|
-
return ((_b = (_a =
|
|
1407
|
+
return ((_b = (_a = findBreakpointOverride(runtime.getBreakpoints(), animateIn, deviceId)) == null ? void 0 : _a.value) != null ? _b : "none") === "none";
|
|
962
1408
|
}
|
|
963
1409
|
const isHiddenBasedOnBoxAnimation = (props, deviceId) => isHiddenBasedOnAnimationType(props, deviceId, "boxAnimateType");
|
|
964
1410
|
const isHiddenBasedOnItemAnimation = (props, deviceId) => isHiddenBasedOnAnimationType(props, deviceId, "itemAnimateType");
|
|
@@ -999,7 +1445,7 @@ function registerComponent$c(runtime) {
|
|
|
999
1445
|
format: Padding.Format.ClassName,
|
|
1000
1446
|
preset: [
|
|
1001
1447
|
{
|
|
1002
|
-
deviceId:
|
|
1448
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1003
1449
|
value: {
|
|
1004
1450
|
paddingTop: { value: 10, unit: "px" },
|
|
1005
1451
|
paddingRight: { value: 10, unit: "px" },
|
|
@@ -1149,7 +1595,7 @@ function registerComponent$b(runtime) {
|
|
|
1149
1595
|
color: ResponsiveColor((props, device) => {
|
|
1150
1596
|
var _a;
|
|
1151
1597
|
const variant = props.variant;
|
|
1152
|
-
const hidden = ((_a =
|
|
1598
|
+
const hidden = ((_a = findBreakpointOverride(runtime.getBreakpoints(), variant, device)) == null ? void 0 : _a.value) === "clear";
|
|
1153
1599
|
return { placeholder: "black", hidden };
|
|
1154
1600
|
}),
|
|
1155
1601
|
textColor: ResponsiveColor({
|
|
@@ -1196,7 +1642,7 @@ function registerComponent$a(runtime) {
|
|
|
1196
1642
|
step: ResponsiveNumber((props, device) => {
|
|
1197
1643
|
var _a, _b;
|
|
1198
1644
|
const pageSize = props.pageSize;
|
|
1199
|
-
const pageSizeValue = (_b = (_a =
|
|
1645
|
+
const pageSizeValue = (_b = (_a = findBreakpointOverride(runtime.getBreakpoints(), pageSize, device)) == null ? void 0 : _a.value) != null ? _b : 1;
|
|
1200
1646
|
return {
|
|
1201
1647
|
label: "Step",
|
|
1202
1648
|
defaultValue: 1,
|
|
@@ -1220,7 +1666,7 @@ function registerComponent$a(runtime) {
|
|
|
1220
1666
|
defaultValue: { value: 0, unit: "px" }
|
|
1221
1667
|
}),
|
|
1222
1668
|
autoplay: Checkbox({ label: "Autoplay" }),
|
|
1223
|
-
delay: Number((props) => ({
|
|
1669
|
+
delay: Number$1((props) => ({
|
|
1224
1670
|
label: "Delay",
|
|
1225
1671
|
preset: 5,
|
|
1226
1672
|
min: 1,
|
|
@@ -1308,7 +1754,12 @@ function registerComponent$9(runtime) {
|
|
|
1308
1754
|
defaultValue: "medium"
|
|
1309
1755
|
}),
|
|
1310
1756
|
gap: GapX({
|
|
1311
|
-
preset: [
|
|
1757
|
+
preset: [
|
|
1758
|
+
{
|
|
1759
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1760
|
+
value: { value: 10, unit: "px" }
|
|
1761
|
+
}
|
|
1762
|
+
],
|
|
1312
1763
|
label: "Gap",
|
|
1313
1764
|
step: 1,
|
|
1314
1765
|
min: 0,
|
|
@@ -1434,7 +1885,12 @@ function registerComponent$6(runtime) {
|
|
|
1434
1885
|
hidden: props.tableId == null
|
|
1435
1886
|
})),
|
|
1436
1887
|
gap: GapY((props) => ({
|
|
1437
|
-
preset: [
|
|
1888
|
+
preset: [
|
|
1889
|
+
{
|
|
1890
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1891
|
+
value: { value: 10, unit: "px" }
|
|
1892
|
+
}
|
|
1893
|
+
],
|
|
1438
1894
|
label: "Gap",
|
|
1439
1895
|
defaultValue: { value: 0, unit: "px" },
|
|
1440
1896
|
hidden: props.tableId == null
|
|
@@ -1472,7 +1928,7 @@ function registerComponent$6(runtime) {
|
|
|
1472
1928
|
labelTextColor: ResponsiveColor((props, device) => {
|
|
1473
1929
|
const hidden = props.tableId == null;
|
|
1474
1930
|
const responsiveContrast = props.contrast;
|
|
1475
|
-
const contrast =
|
|
1931
|
+
const contrast = findBreakpointOverride(runtime.getBreakpoints(), responsiveContrast, device);
|
|
1476
1932
|
return {
|
|
1477
1933
|
hidden,
|
|
1478
1934
|
label: "Label text color",
|
|
@@ -1524,7 +1980,12 @@ function registerComponent$6(runtime) {
|
|
|
1524
1980
|
hidden: props.tableId == null
|
|
1525
1981
|
})),
|
|
1526
1982
|
width: Width({
|
|
1527
|
-
preset: [
|
|
1983
|
+
preset: [
|
|
1984
|
+
{
|
|
1985
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1986
|
+
value: { value: 550, unit: "px" }
|
|
1987
|
+
}
|
|
1988
|
+
],
|
|
1528
1989
|
defaultValue: { value: 100, unit: "%" },
|
|
1529
1990
|
format: Width.Format.ClassName
|
|
1530
1991
|
}),
|
|
@@ -1572,7 +2033,12 @@ function registerComponent$4(runtime) {
|
|
|
1572
2033
|
hidden: props.showLogo === false
|
|
1573
2034
|
})),
|
|
1574
2035
|
logoWidth: ResponsiveLength((props) => ({
|
|
1575
|
-
preset: [
|
|
2036
|
+
preset: [
|
|
2037
|
+
{
|
|
2038
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2039
|
+
value: { value: 100, unit: "px" }
|
|
2040
|
+
}
|
|
2041
|
+
],
|
|
1576
2042
|
label: "Logo width",
|
|
1577
2043
|
min: 0,
|
|
1578
2044
|
max: 1e3,
|
|
@@ -1597,7 +2063,12 @@ function registerComponent$4(runtime) {
|
|
|
1597
2063
|
defaultValue: "flex-end"
|
|
1598
2064
|
}),
|
|
1599
2065
|
gutter: GapX({
|
|
1600
|
-
preset: [
|
|
2066
|
+
preset: [
|
|
2067
|
+
{
|
|
2068
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2069
|
+
value: { value: 10, unit: "px" }
|
|
2070
|
+
}
|
|
2071
|
+
],
|
|
1601
2072
|
label: "Link gap",
|
|
1602
2073
|
min: 0,
|
|
1603
2074
|
max: 100,
|
|
@@ -1613,7 +2084,7 @@ function registerComponent$4(runtime) {
|
|
|
1613
2084
|
}),
|
|
1614
2085
|
mobileMenuOpenIconColor: ResponsiveColor((props, device) => {
|
|
1615
2086
|
const mobileMenuAnimation = props.mobileMenuAnimation;
|
|
1616
|
-
const hidden = !
|
|
2087
|
+
const hidden = !findBreakpointOverride(runtime.getBreakpoints(), mobileMenuAnimation, device);
|
|
1617
2088
|
return {
|
|
1618
2089
|
label: "Open icon color",
|
|
1619
2090
|
placeholder: "rgba(161, 168, 194, 0.5)",
|
|
@@ -1622,7 +2093,7 @@ function registerComponent$4(runtime) {
|
|
|
1622
2093
|
}),
|
|
1623
2094
|
mobileMenuCloseIconColor: ResponsiveColor((props, device) => {
|
|
1624
2095
|
const mobileMenuAnimation = props.mobileMenuAnimation;
|
|
1625
|
-
const hidden = !
|
|
2096
|
+
const hidden = !findBreakpointOverride(runtime.getBreakpoints(), mobileMenuAnimation, device);
|
|
1626
2097
|
return {
|
|
1627
2098
|
label: "Close icon color",
|
|
1628
2099
|
placeholder: "rgba(161, 168, 194, 0.5)",
|
|
@@ -1631,7 +2102,7 @@ function registerComponent$4(runtime) {
|
|
|
1631
2102
|
}),
|
|
1632
2103
|
mobileMenuBackgroundColor: ResponsiveColor((props, device) => {
|
|
1633
2104
|
const mobileMenuAnimation = props.mobileMenuAnimation;
|
|
1634
|
-
const hidden = !
|
|
2105
|
+
const hidden = !findBreakpointOverride(runtime.getBreakpoints(), mobileMenuAnimation, device);
|
|
1635
2106
|
return {
|
|
1636
2107
|
label: "Menu BG color",
|
|
1637
2108
|
placeholder: "black",
|
|
@@ -1754,7 +2225,12 @@ function registerComponent$2(runtime) {
|
|
|
1754
2225
|
defaultValue: "center"
|
|
1755
2226
|
}),
|
|
1756
2227
|
gutter: GapX({
|
|
1757
|
-
preset: [
|
|
2228
|
+
preset: [
|
|
2229
|
+
{
|
|
2230
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2231
|
+
value: { value: 10, unit: "px" }
|
|
2232
|
+
}
|
|
2233
|
+
],
|
|
1758
2234
|
label: "Link gap",
|
|
1759
2235
|
min: 0,
|
|
1760
2236
|
max: 100,
|
|
@@ -1769,7 +2245,7 @@ function registerComponent$2(runtime) {
|
|
|
1769
2245
|
format: Margin.Format.ClassName,
|
|
1770
2246
|
preset: [
|
|
1771
2247
|
{
|
|
1772
|
-
deviceId:
|
|
2248
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1773
2249
|
value: {
|
|
1774
2250
|
marginTop: { value: 10, unit: "px" },
|
|
1775
2251
|
marginRight: "auto",
|
|
@@ -1809,17 +2285,19 @@ function registerComponent$1(runtime) {
|
|
|
1809
2285
|
id: null,
|
|
1810
2286
|
style: [
|
|
1811
2287
|
{
|
|
1812
|
-
deviceId:
|
|
1813
|
-
value: { fontSize: { value: 16, unit: "px" } }
|
|
1814
|
-
},
|
|
1815
|
-
{
|
|
1816
|
-
deviceId: "desktop",
|
|
2288
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1817
2289
|
value: {
|
|
1818
2290
|
fontWeight: 400,
|
|
1819
2291
|
fontSize: { value: 18, unit: "px" },
|
|
1820
2292
|
lineHeight: 1.5
|
|
1821
2293
|
}
|
|
1822
|
-
}
|
|
2294
|
+
},
|
|
2295
|
+
...runtime.getBreakpoints().some(({ id }) => id === DefaultBreakpointID.Mobile) ? [
|
|
2296
|
+
{
|
|
2297
|
+
deviceId: DefaultBreakpointID.Mobile,
|
|
2298
|
+
value: { fontSize: { value: 16, unit: "px" } }
|
|
2299
|
+
}
|
|
2300
|
+
] : []
|
|
1823
2301
|
]
|
|
1824
2302
|
}
|
|
1825
2303
|
}
|
|
@@ -1834,14 +2312,19 @@ function registerComponent$1(runtime) {
|
|
|
1834
2312
|
})),
|
|
1835
2313
|
width: Width({
|
|
1836
2314
|
format: Width.Format.ClassName,
|
|
1837
|
-
preset: [
|
|
2315
|
+
preset: [
|
|
2316
|
+
{
|
|
2317
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2318
|
+
value: { value: 700, unit: "px" }
|
|
2319
|
+
}
|
|
2320
|
+
],
|
|
1838
2321
|
defaultValue: { value: 100, unit: "%" }
|
|
1839
2322
|
}),
|
|
1840
2323
|
margin: Margin({
|
|
1841
2324
|
format: Margin.Format.ClassName,
|
|
1842
2325
|
preset: [
|
|
1843
2326
|
{
|
|
1844
|
-
deviceId:
|
|
2327
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1845
2328
|
value: {
|
|
1846
2329
|
marginTop: null,
|
|
1847
2330
|
marginRight: "auto",
|
|
@@ -1901,6 +2384,19 @@ function registerBuiltinComponents(runtime) {
|
|
|
1901
2384
|
unregisterVideoComponent();
|
|
1902
2385
|
};
|
|
1903
2386
|
}
|
|
2387
|
+
const isServer = typeof window === "undefined";
|
|
2388
|
+
const useInsertionEffectSpecifier = "useInsertionEffect";
|
|
2389
|
+
const useInsertionEffect = (_c = React[useInsertionEffectSpecifier]) != null ? _c : React.useLayoutEffect;
|
|
2390
|
+
function useStyle(style) {
|
|
2391
|
+
const serialized = serializeStyles([style], cache.registered);
|
|
2392
|
+
registerStyles(cache, serialized, false);
|
|
2393
|
+
useInsertionEffect(() => {
|
|
2394
|
+
insertStyles(cache, serialized, false);
|
|
2395
|
+
});
|
|
2396
|
+
if (isServer)
|
|
2397
|
+
insertStyles(cache, serialized, false);
|
|
2398
|
+
return `${cache.key}-${serialized.name}`;
|
|
2399
|
+
}
|
|
1904
2400
|
var _path;
|
|
1905
2401
|
function _extends() {
|
|
1906
2402
|
_extends = Object.assign || function(target) {
|
|
@@ -1952,8 +2448,100 @@ const FallbackComponent = forwardRef(function FallbackComponent2({
|
|
|
1952
2448
|
})]
|
|
1953
2449
|
});
|
|
1954
2450
|
});
|
|
1955
|
-
function
|
|
1956
|
-
|
|
2451
|
+
function useSwatch(swatchId) {
|
|
2452
|
+
const client = useMakeswiftClient();
|
|
2453
|
+
const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
|
|
2454
|
+
const swatch = useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
|
|
2455
|
+
useEffect(() => {
|
|
2456
|
+
if (swatchId != null)
|
|
2457
|
+
client.fetchSwatch(swatchId).catch(console.error);
|
|
2458
|
+
}, [client, swatchId]);
|
|
2459
|
+
return swatch;
|
|
2460
|
+
}
|
|
2461
|
+
function useSwatches(swatchIds) {
|
|
2462
|
+
const client = useMakeswiftClient();
|
|
2463
|
+
const lastSnapshot = useRef();
|
|
2464
|
+
function getSnapshot() {
|
|
2465
|
+
const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
|
|
2466
|
+
if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
|
|
2467
|
+
return lastSnapshot.current;
|
|
2468
|
+
}
|
|
2469
|
+
return lastSnapshot.current = swatches2;
|
|
2470
|
+
}
|
|
2471
|
+
const swatches = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2472
|
+
useEffect(() => {
|
|
2473
|
+
Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
|
|
2474
|
+
}, [client, swatchIds]);
|
|
2475
|
+
return swatches;
|
|
2476
|
+
}
|
|
2477
|
+
function useFile(fileId) {
|
|
2478
|
+
const client = useMakeswiftClient();
|
|
2479
|
+
const readFile = () => fileId == null ? null : client.readFile(fileId);
|
|
2480
|
+
const file = useSyncExternalStore(client.subscribe, readFile, readFile);
|
|
2481
|
+
useEffect(() => {
|
|
2482
|
+
if (fileId != null)
|
|
2483
|
+
client.fetchFile(fileId);
|
|
2484
|
+
}, [client, fileId]);
|
|
2485
|
+
return file;
|
|
2486
|
+
}
|
|
2487
|
+
function useFiles(fileIds) {
|
|
2488
|
+
const client = useMakeswiftClient();
|
|
2489
|
+
const lastSnapshot = useRef();
|
|
2490
|
+
function getSnapshot() {
|
|
2491
|
+
const files2 = fileIds.map((fileId) => client.readFile(fileId));
|
|
2492
|
+
if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
|
|
2493
|
+
return lastSnapshot.current;
|
|
2494
|
+
}
|
|
2495
|
+
return lastSnapshot.current = files2;
|
|
2496
|
+
}
|
|
2497
|
+
const files = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2498
|
+
useEffect(() => {
|
|
2499
|
+
Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
|
|
2500
|
+
}, [client, fileIds]);
|
|
2501
|
+
return files;
|
|
2502
|
+
}
|
|
2503
|
+
function useTypography(typographyId) {
|
|
2504
|
+
const client = useMakeswiftClient();
|
|
2505
|
+
const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
|
|
2506
|
+
const typography = useSyncExternalStore(client.subscribe, readTypography, readTypography);
|
|
2507
|
+
useEffect(() => {
|
|
2508
|
+
if (typographyId != null)
|
|
2509
|
+
client.fetchTypography(typographyId).catch(console.error);
|
|
2510
|
+
}, [client, typographyId]);
|
|
2511
|
+
return typography;
|
|
2512
|
+
}
|
|
2513
|
+
function useGlobalElement(globalElementId) {
|
|
2514
|
+
const client = useMakeswiftClient();
|
|
2515
|
+
const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
|
|
2516
|
+
const globalElement = useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
|
|
2517
|
+
useEffect(() => {
|
|
2518
|
+
if (globalElementId != null)
|
|
2519
|
+
client.fetchGlobalElement(globalElementId).catch(console.error);
|
|
2520
|
+
}, [client, globalElementId]);
|
|
2521
|
+
return globalElement;
|
|
2522
|
+
}
|
|
2523
|
+
function usePagePathnameSlice(pageId) {
|
|
2524
|
+
const client = useMakeswiftClient();
|
|
2525
|
+
const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
|
|
2526
|
+
const pagePathnameSlice = useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
|
|
2527
|
+
useEffect(() => {
|
|
2528
|
+
if (pageId != null)
|
|
2529
|
+
client.fetchPagePathnameSlice(pageId).catch(console.error);
|
|
2530
|
+
}, [client, pageId]);
|
|
2531
|
+
return pagePathnameSlice;
|
|
2532
|
+
}
|
|
2533
|
+
function useTable(tableId) {
|
|
2534
|
+
const client = useMakeswiftClient();
|
|
2535
|
+
const readTable = () => tableId == null ? null : client.readTable(tableId);
|
|
2536
|
+
const table = useSyncExternalStore(client.subscribe, readTable, readTable);
|
|
2537
|
+
useEffect(() => {
|
|
2538
|
+
if (tableId != null)
|
|
2539
|
+
client.fetchTable(tableId).catch(console.error);
|
|
2540
|
+
}, [client, tableId]);
|
|
2541
|
+
return table;
|
|
2542
|
+
}
|
|
2543
|
+
function mapSideColor(swatches, _d) {
|
|
2544
|
+
var _e = _d, { color } = _e, restOfSide = __objRest(_e, ["color"]);
|
|
1957
2545
|
return __spreadProps(__spreadValues({}, restOfSide), {
|
|
1958
2546
|
color: color && {
|
|
1959
2547
|
alpha: color.alpha,
|
|
@@ -2029,34 +2617,235 @@ function useResponsiveColor(color) {
|
|
|
2029
2617
|
return swatch == null ? null : __spreadProps(__spreadValues({}, rest), { value: { swatch, alpha } });
|
|
2030
2618
|
}).filter(isNonNullable);
|
|
2031
2619
|
}
|
|
2032
|
-
const
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2620
|
+
const getIndexes = (spans, index) => {
|
|
2621
|
+
const flattened = spans.reduce((a, s) => a.concat(s), []);
|
|
2622
|
+
if (index < 0 || index > flattened.length)
|
|
2623
|
+
throw new RangeError();
|
|
2624
|
+
let remainder = index;
|
|
2625
|
+
let rowIndex = 0;
|
|
2626
|
+
while (rowIndex < spans.length - 1 && remainder >= spans[rowIndex].length) {
|
|
2627
|
+
remainder -= spans[rowIndex].length;
|
|
2628
|
+
rowIndex += 1;
|
|
2629
|
+
}
|
|
2630
|
+
return [rowIndex, remainder];
|
|
2631
|
+
};
|
|
2632
|
+
function lengthDataToString(data) {
|
|
2633
|
+
if (typeof data === "object")
|
|
2634
|
+
return `${data.value}${data.unit}`;
|
|
2635
|
+
if (typeof data === "number")
|
|
2636
|
+
return `${data}px`;
|
|
2637
|
+
return data;
|
|
2638
|
+
}
|
|
2639
|
+
function paddingPropertyDataToStyle(data, defaultValue = {}) {
|
|
2640
|
+
var _a, _b, _c2, _d;
|
|
2641
|
+
const paddingTop = (_a = data.paddingTop) != null ? _a : defaultValue.paddingTop;
|
|
2642
|
+
const paddingRight = (_b = data.paddingRight) != null ? _b : defaultValue.paddingRight;
|
|
2643
|
+
const paddingBottom = (_c2 = data.paddingBottom) != null ? _c2 : defaultValue.paddingBottom;
|
|
2644
|
+
const paddingLeft = (_d = data.paddingLeft) != null ? _d : defaultValue.paddingLeft;
|
|
2645
|
+
const style = {};
|
|
2646
|
+
if (paddingTop != null)
|
|
2647
|
+
style.paddingTop = lengthDataToString(paddingTop);
|
|
2648
|
+
if (paddingRight != null)
|
|
2649
|
+
style.paddingRight = lengthDataToString(paddingRight);
|
|
2650
|
+
if (paddingBottom != null)
|
|
2651
|
+
style.paddingBottom = lengthDataToString(paddingBottom);
|
|
2652
|
+
if (paddingLeft != null)
|
|
2653
|
+
style.paddingLeft = lengthDataToString(paddingLeft);
|
|
2654
|
+
return style;
|
|
2655
|
+
}
|
|
2656
|
+
function marginPropertyDataToStyle(data, defaultValue = {}) {
|
|
2657
|
+
var _a, _b, _c2, _d;
|
|
2658
|
+
const marginTop = (_a = data.marginTop) != null ? _a : defaultValue.marginTop;
|
|
2659
|
+
const marginRight = (_b = data.marginRight) != null ? _b : defaultValue.marginRight;
|
|
2660
|
+
const marginBottom = (_c2 = data.marginBottom) != null ? _c2 : defaultValue.marginBottom;
|
|
2661
|
+
const marginLeft = (_d = data.marginLeft) != null ? _d : defaultValue.marginLeft;
|
|
2662
|
+
const style = {};
|
|
2663
|
+
if (marginTop != null)
|
|
2664
|
+
style.marginTop = lengthDataToString(marginTop);
|
|
2665
|
+
if (marginRight != null)
|
|
2666
|
+
style.marginRight = lengthDataToString(marginRight);
|
|
2667
|
+
if (marginBottom != null)
|
|
2668
|
+
style.marginBottom = lengthDataToString(marginBottom);
|
|
2669
|
+
if (marginLeft != null)
|
|
2670
|
+
style.marginLeft = lengthDataToString(marginLeft);
|
|
2671
|
+
return style;
|
|
2672
|
+
}
|
|
2673
|
+
function lengthPercentageDataToString(data) {
|
|
2674
|
+
if (typeof data === "object")
|
|
2675
|
+
return `${data.value}${data.unit}`;
|
|
2676
|
+
if (typeof data === "number")
|
|
2677
|
+
return `${data}px`;
|
|
2678
|
+
return data;
|
|
2679
|
+
}
|
|
2680
|
+
function borderRadiusPropertyDataToStyle(data, defaultValue = {}) {
|
|
2681
|
+
var _a, _b, _c2, _d;
|
|
2682
|
+
const borderTopLeftRadius = (_a = data.borderTopLeftRadius) != null ? _a : defaultValue.borderTopLeftRadius;
|
|
2683
|
+
const borderTopRightRadius = (_b = data.borderTopRightRadius) != null ? _b : defaultValue.borderTopRightRadius;
|
|
2684
|
+
const borderBottomRightRadius = (_c2 = data.borderBottomRightRadius) != null ? _c2 : defaultValue.borderBottomRightRadius;
|
|
2685
|
+
const borderBottomLeftRadius = (_d = data.borderBottomLeftRadius) != null ? _d : defaultValue.borderBottomLeftRadius;
|
|
2686
|
+
const style = {};
|
|
2687
|
+
if (borderTopLeftRadius != null) {
|
|
2688
|
+
style.borderTopLeftRadius = lengthPercentageDataToString(borderTopLeftRadius);
|
|
2689
|
+
}
|
|
2690
|
+
if (borderTopRightRadius != null) {
|
|
2691
|
+
style.borderTopRightRadius = lengthPercentageDataToString(borderTopRightRadius);
|
|
2692
|
+
}
|
|
2693
|
+
if (borderBottomRightRadius != null) {
|
|
2694
|
+
style.borderBottomRightRadius = lengthPercentageDataToString(borderBottomRightRadius);
|
|
2695
|
+
}
|
|
2696
|
+
if (borderBottomLeftRadius != null) {
|
|
2697
|
+
style.borderBottomLeftRadius = lengthPercentageDataToString(borderBottomLeftRadius);
|
|
2698
|
+
}
|
|
2699
|
+
return style;
|
|
2700
|
+
}
|
|
2701
|
+
function colorToString(color) {
|
|
2702
|
+
return color && color.swatch ? `hsla(${color.swatch.hue},${color.swatch.saturation}%,${color.swatch.lightness}%,${color.alpha})` : "";
|
|
2703
|
+
}
|
|
2704
|
+
function borderPropertyDataToStyle(data, defaultValue = {}) {
|
|
2705
|
+
var _a, _b, _c2, _d;
|
|
2706
|
+
const borderTop = (_a = data.borderTop) != null ? _a : defaultValue.borderTop;
|
|
2707
|
+
const borderRight = (_b = data.borderRight) != null ? _b : defaultValue.borderRight;
|
|
2708
|
+
const borderBottom = (_c2 = data.borderBottom) != null ? _c2 : defaultValue.borderBottom;
|
|
2709
|
+
const borderLeft = (_d = data.borderLeft) != null ? _d : defaultValue.borderLeft;
|
|
2710
|
+
const style = {};
|
|
2711
|
+
if (borderTop != null)
|
|
2712
|
+
style.borderTop = borderSideToString(borderTop);
|
|
2713
|
+
if (borderRight != null)
|
|
2714
|
+
style.borderRight = borderSideToString(borderRight);
|
|
2715
|
+
if (borderBottom != null)
|
|
2716
|
+
style.borderBottom = borderSideToString(borderBottom);
|
|
2717
|
+
if (borderLeft != null)
|
|
2718
|
+
style.borderLeft = borderSideToString(borderLeft);
|
|
2719
|
+
return style;
|
|
2720
|
+
}
|
|
2721
|
+
function borderSideToString(borderSide) {
|
|
2722
|
+
if (typeof borderSide === "string")
|
|
2723
|
+
return borderSide;
|
|
2724
|
+
if (typeof borderSide === "number")
|
|
2725
|
+
return `${borderSide}px`;
|
|
2726
|
+
const { width, color, style } = borderSide;
|
|
2727
|
+
return `${width != null ? width : 0}px ${style} ${color != null ? colorToString(color) : "black"}`;
|
|
2728
|
+
}
|
|
2729
|
+
function responsiveStyle(breakpoints, responsiveValues, join$1, strategy) {
|
|
2730
|
+
return join(breakpoints, responsiveValues, join$1, strategy).reduce((acc, { deviceId, value }) => {
|
|
2731
|
+
const breakpoint = getBreakpoint(breakpoints, deviceId);
|
|
2732
|
+
const mediaQuery = getBreakpointMediaQuery(breakpoint);
|
|
2733
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
2734
|
+
[mediaQuery]: __spreadValues(__spreadValues({}, acc[mediaQuery]), value)
|
|
2735
|
+
});
|
|
2736
|
+
}, {});
|
|
2737
|
+
}
|
|
2738
|
+
function useResponsiveStyle(responsiveValues, join2, strategy) {
|
|
2739
|
+
return responsiveStyle(useBreakpoints(), responsiveValues, join2, strategy);
|
|
2740
|
+
}
|
|
2741
|
+
function responsiveWidth(breakpoints, widthData, defaultValue = "100%") {
|
|
2742
|
+
return __spreadValues({
|
|
2743
|
+
maxWidth: "100%"
|
|
2744
|
+
}, responsiveStyle(breakpoints, [widthData], ([width = defaultValue]) => ({
|
|
2745
|
+
width: typeof width === "object" ? `${width.value}${width.unit}` : width
|
|
2746
|
+
})));
|
|
2747
|
+
}
|
|
2748
|
+
function useResponsiveWidth(...args) {
|
|
2749
|
+
return responsiveWidth(useBreakpoints(), ...args);
|
|
2750
|
+
}
|
|
2751
|
+
function responsivePadding(breakpoints, paddingData, defaultValue = {}) {
|
|
2752
|
+
return responsiveStyle(breakpoints, [paddingData], ([padding = {}]) => paddingPropertyDataToStyle(padding, Object.assign({ paddingTop: 0, paddingRight: 0, paddingBottom: 0, paddingLeft: 0 }, defaultValue)));
|
|
2753
|
+
}
|
|
2754
|
+
function useResponsivePadding(...args) {
|
|
2755
|
+
return responsivePadding(useBreakpoints(), ...args);
|
|
2756
|
+
}
|
|
2757
|
+
function responsiveMargin(breakpoints, marginData, defaultValue = {}) {
|
|
2758
|
+
return responsiveStyle(breakpoints, [marginData], ([margin = {}]) => marginPropertyDataToStyle(margin, Object.assign({ marginTop: 0, marginRight: "auto", marginBottom: 0, marginLeft: "auto" }, defaultValue)));
|
|
2759
|
+
}
|
|
2760
|
+
function useResponsiveMargin(...args) {
|
|
2761
|
+
return responsiveMargin(useBreakpoints(), ...args);
|
|
2762
|
+
}
|
|
2763
|
+
function responsiveBorderRadius(breakpoints, borderRadiusData, defaultValue = {}) {
|
|
2764
|
+
return responsiveStyle(breakpoints, [borderRadiusData], ([borderRadius = {}]) => borderRadiusPropertyDataToStyle(borderRadius, Object.assign({
|
|
2765
|
+
borderTopLeftRadius: 0,
|
|
2766
|
+
borderTopRightRadius: 0,
|
|
2767
|
+
borderBottomRightRadius: 0,
|
|
2768
|
+
borderBottomLeftRadius: 0
|
|
2769
|
+
}, defaultValue)));
|
|
2770
|
+
}
|
|
2771
|
+
function useResponsiveBorderRadius(...args) {
|
|
2772
|
+
return responsiveBorderRadius(useBreakpoints(), ...args);
|
|
2773
|
+
}
|
|
2774
|
+
function useResponsiveBorder(borderData, defaultValue = {}) {
|
|
2775
|
+
return useResponsiveStyle([borderData], ([border = {}]) => borderPropertyDataToStyle(border, Object.assign({
|
|
2776
|
+
borderTop: "0px solid black",
|
|
2777
|
+
borderRight: "0px solid black",
|
|
2778
|
+
borderBottom: "0px solid black",
|
|
2779
|
+
borderLeft: "0px solid black"
|
|
2780
|
+
}, defaultValue)));
|
|
2781
|
+
}
|
|
2782
|
+
const floor = (d) => (v) => Math.floor(10 ** d * v) / 10 ** d;
|
|
2783
|
+
function responsiveGridItem(breakpoints, props) {
|
|
2784
|
+
return __spreadValues({
|
|
2785
|
+
display: "flex"
|
|
2786
|
+
}, responsiveStyle(breakpoints, [props.grid, props.columnGap, props.rowGap], ([
|
|
2787
|
+
{ spans, count } = { spans: [[12]], count: 12 },
|
|
2788
|
+
columnGap = { value: 0, unit: "px" },
|
|
2789
|
+
rowGap = { value: 0, unit: "px" }
|
|
2790
|
+
]) => {
|
|
2791
|
+
const [rowIndex, columnIndex] = getIndexes(spans, props.index);
|
|
2792
|
+
const firstCol = columnIndex === 0;
|
|
2793
|
+
const lastCol = columnIndex === spans[rowIndex].length - 1;
|
|
2794
|
+
const span = spans[rowIndex][columnIndex];
|
|
2795
|
+
const fraction = floor(5)(span / count);
|
|
2796
|
+
const width = `${fraction} * (100% + ${columnGap.value}${columnGap.unit})`;
|
|
2797
|
+
const excessWidth = `${Number(firstCol) + Number(lastCol)} * ${columnGap.value}${columnGap.unit} / 2`;
|
|
2798
|
+
const iePrecisionError = "0.01px";
|
|
2799
|
+
const flexBasis = `calc(${width} - ${excessWidth} - ${iePrecisionError})`;
|
|
2800
|
+
const firstRow = rowIndex === 0;
|
|
2801
|
+
const lastRow = rowIndex === spans.length - 1;
|
|
2802
|
+
return span === 0 ? { display: "none" } : {
|
|
2803
|
+
flexBasis,
|
|
2804
|
+
minWidth: flexBasis,
|
|
2805
|
+
maxWidth: flexBasis,
|
|
2806
|
+
paddingLeft: firstCol ? 0 : `${columnGap.value / 2}${columnGap.unit}`,
|
|
2807
|
+
paddingRight: lastCol ? 0 : `${columnGap.value / 2}${columnGap.unit}`,
|
|
2808
|
+
paddingTop: firstRow ? 0 : `${rowGap.value / 2}${rowGap.unit}`,
|
|
2809
|
+
paddingBottom: lastRow ? 0 : `${rowGap.value / 2}${rowGap.unit}`
|
|
2810
|
+
};
|
|
2811
|
+
}));
|
|
2812
|
+
}
|
|
2813
|
+
function useResponsiveGridItem(...args) {
|
|
2814
|
+
return responsiveGridItem(useBreakpoints(), ...args);
|
|
2815
|
+
}
|
|
2816
|
+
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();
|
|
2817
|
+
function responsiveShadow(breakpoints, value) {
|
|
2818
|
+
return responsiveStyle(breakpoints, [value], ([shadow = []]) => ({
|
|
2819
|
+
boxShadow: getBoxShadow(shadow)
|
|
2820
|
+
}));
|
|
2821
|
+
}
|
|
2822
|
+
function useResponsiveShadow(...args) {
|
|
2823
|
+
return responsiveShadow(useBreakpoints(), ...args);
|
|
2824
|
+
}
|
|
2825
|
+
function responsiveTextStyle(breakpoints, value) {
|
|
2826
|
+
return responsiveStyle(breakpoints, [value], ([
|
|
2827
|
+
textStyle = {
|
|
2828
|
+
fontFamily: null,
|
|
2829
|
+
letterSpacing: null,
|
|
2830
|
+
fontSize: null,
|
|
2831
|
+
fontWeight: null,
|
|
2832
|
+
textTransform: [],
|
|
2833
|
+
fontStyle: []
|
|
2834
|
+
}
|
|
2835
|
+
]) => {
|
|
2836
|
+
const {
|
|
2837
|
+
fontSize,
|
|
2838
|
+
fontWeight,
|
|
2839
|
+
fontStyle = [],
|
|
2840
|
+
textTransform = [],
|
|
2841
|
+
letterSpacing,
|
|
2842
|
+
fontFamily
|
|
2843
|
+
} = textStyle;
|
|
2844
|
+
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" } : {});
|
|
2041
2845
|
});
|
|
2042
|
-
return () => cleanUpFns.forEach((fn) => fn());
|
|
2043
2846
|
}
|
|
2044
|
-
function
|
|
2045
|
-
|
|
2046
|
-
var _a;
|
|
2047
|
-
return (_a = findDeviceOverride(responsiveValue, DEVICES[0].id)) == null ? void 0 : _a.value;
|
|
2048
|
-
};
|
|
2049
|
-
function getSnapshot() {
|
|
2050
|
-
var _a;
|
|
2051
|
-
const deviceId = DEVICE_QUERIES.reduce((matchedDevice, deviceQueries) => {
|
|
2052
|
-
if (window.matchMedia(deviceQueries.query).matches) {
|
|
2053
|
-
return deviceQueries.id;
|
|
2054
|
-
}
|
|
2055
|
-
return matchedDevice;
|
|
2056
|
-
}, DEVICE_QUERIES[0].id);
|
|
2057
|
-
return (_a = findDeviceOverride(responsiveValue, deviceId)) == null ? void 0 : _a.value;
|
|
2058
|
-
}
|
|
2059
|
-
return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
2847
|
+
function useResponsiveTextStyle(...args) {
|
|
2848
|
+
return responsiveTextStyle(useBreakpoints(), ...args);
|
|
2060
2849
|
}
|
|
2061
2850
|
const defaultMargin = {
|
|
2062
2851
|
marginTop: 0,
|
|
@@ -2074,7 +2863,7 @@ function useStyleControlCssObject(style, controlDefinition) {
|
|
|
2074
2863
|
const { properties } = controlDefinition.config;
|
|
2075
2864
|
return __spreadValues(__spreadValues({}, properties.includes(StyleControlProperty.Width) && {
|
|
2076
2865
|
maxWidth: "100%"
|
|
2077
|
-
}),
|
|
2866
|
+
}), useResponsiveStyle([
|
|
2078
2867
|
style == null ? void 0 : style.width,
|
|
2079
2868
|
style == null ? void 0 : style.margin,
|
|
2080
2869
|
style == null ? void 0 : style.padding,
|
|
@@ -2082,14 +2871,14 @@ function useStyleControlCssObject(style, controlDefinition) {
|
|
|
2082
2871
|
style == null ? void 0 : style.borderRadius,
|
|
2083
2872
|
style == null ? void 0 : style.textStyle
|
|
2084
2873
|
], ([width, margin, padding, border, borderRadius, textStyle]) => {
|
|
2085
|
-
var _a, _b,
|
|
2874
|
+
var _a, _b, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2086
2875
|
return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, properties.includes(StyleControlProperty.Width) && {
|
|
2087
2876
|
width: (_a = widthToString(width)) != null ? _a : "100%"
|
|
2088
2877
|
}), properties.includes(StyleControlProperty.Margin) && marginPropertyDataToStyle(margin != null ? margin : defaultMargin, defaultMargin)), properties.includes(StyleControlProperty.Padding) && paddingPropertyDataToStyle(padding != null ? padding : defaultPadding, defaultPadding)), properties.includes(StyleControlProperty.Border) && {
|
|
2089
|
-
borderTop: (_b =
|
|
2090
|
-
borderRight: (
|
|
2091
|
-
borderBottom: (_d =
|
|
2092
|
-
borderLeft: (_e =
|
|
2878
|
+
borderTop: (_b = borderSideToString2(border == null ? void 0 : border.borderTop)) != null ? _b : "0 solid black",
|
|
2879
|
+
borderRight: (_c2 = borderSideToString2(border == null ? void 0 : border.borderRight)) != null ? _c2 : "0 solid black",
|
|
2880
|
+
borderBottom: (_d = borderSideToString2(border == null ? void 0 : border.borderBottom)) != null ? _d : "0 solid black",
|
|
2881
|
+
borderLeft: (_e = borderSideToString2(border == null ? void 0 : border.borderLeft)) != null ? _e : "0 solid black"
|
|
2093
2882
|
}), properties.includes(StyleControlProperty.BorderRadius) && {
|
|
2094
2883
|
borderTopLeftRadius: (_f = borderRadiusToString(borderRadius == null ? void 0 : borderRadius.borderTopLeftRadius)) != null ? _f : 0,
|
|
2095
2884
|
borderTopRightRadius: (_g = borderRadiusToString(borderRadius == null ? void 0 : borderRadius.borderTopRightRadius)) != null ? _g : 0,
|
|
@@ -2105,7 +2894,7 @@ function useStyleControlCssObject(style, controlDefinition) {
|
|
|
2105
2894
|
return null;
|
|
2106
2895
|
return lengthPercentageDataToString(widthProperty);
|
|
2107
2896
|
}
|
|
2108
|
-
function
|
|
2897
|
+
function borderSideToString2(borderSide) {
|
|
2109
2898
|
if (borderSide == null)
|
|
2110
2899
|
return null;
|
|
2111
2900
|
const { width, color, style: style2 } = borderSide;
|
|
@@ -2350,13 +3139,13 @@ function useSlot(data, control) {
|
|
|
2350
3139
|
}, element.key))
|
|
2351
3140
|
});
|
|
2352
3141
|
}
|
|
2353
|
-
function Slot(
|
|
2354
|
-
var
|
|
3142
|
+
function Slot(_f) {
|
|
3143
|
+
var _g = _f, {
|
|
2355
3144
|
as,
|
|
2356
3145
|
control,
|
|
2357
3146
|
children,
|
|
2358
3147
|
className
|
|
2359
|
-
} =
|
|
3148
|
+
} = _g, restOfProps = __objRest(_g, [
|
|
2360
3149
|
"as",
|
|
2361
3150
|
"control",
|
|
2362
3151
|
"children",
|
|
@@ -2385,15 +3174,15 @@ function Slot(_e) {
|
|
|
2385
3174
|
}
|
|
2386
3175
|
Slot.Placeholder = SlotPlaceholder;
|
|
2387
3176
|
Slot.Item = SlotItem;
|
|
2388
|
-
function SlotItem(
|
|
2389
|
-
var
|
|
3177
|
+
function SlotItem(_h) {
|
|
3178
|
+
var _i = _h, {
|
|
2390
3179
|
as,
|
|
2391
3180
|
control,
|
|
2392
3181
|
grid,
|
|
2393
3182
|
index,
|
|
2394
3183
|
children,
|
|
2395
3184
|
className
|
|
2396
|
-
} =
|
|
3185
|
+
} = _i, restOfProps = __objRest(_i, [
|
|
2397
3186
|
"as",
|
|
2398
3187
|
"control",
|
|
2399
3188
|
"grid",
|
|
@@ -2405,7 +3194,7 @@ function SlotItem(_g) {
|
|
|
2405
3194
|
const [element, setElement] = useState(null);
|
|
2406
3195
|
const baseClassName = useStyle(__spreadValues({
|
|
2407
3196
|
display: "flex"
|
|
2408
|
-
},
|
|
3197
|
+
}, useResponsiveStyle([grid], ([{
|
|
2409
3198
|
count = 12,
|
|
2410
3199
|
spans = [[12]]
|
|
2411
3200
|
} = {}]) => {
|
|
@@ -2579,24 +3368,24 @@ function ControlValue({
|
|
|
2579
3368
|
}
|
|
2580
3369
|
}
|
|
2581
3370
|
function useWidthStyle(value, descriptor) {
|
|
2582
|
-
return useStyle(
|
|
3371
|
+
return useStyle(useResponsiveWidth(value, descriptor.options.defaultValue));
|
|
2583
3372
|
}
|
|
2584
3373
|
function usePaddingStyle(value) {
|
|
2585
|
-
return useStyle(
|
|
3374
|
+
return useStyle(useResponsivePadding(value));
|
|
2586
3375
|
}
|
|
2587
3376
|
function useMarginStyle(value) {
|
|
2588
|
-
return useStyle(
|
|
3377
|
+
return useStyle(useResponsiveMargin(value));
|
|
2589
3378
|
}
|
|
2590
3379
|
function useBorderRadiusStyle(value) {
|
|
2591
|
-
return useStyle(
|
|
3380
|
+
return useStyle(useResponsiveBorderRadius(value));
|
|
2592
3381
|
}
|
|
2593
3382
|
function useShadowsStyle(value) {
|
|
2594
3383
|
const shadowValue = useBoxShadow(value);
|
|
2595
|
-
return useStyle(
|
|
3384
|
+
return useStyle(useResponsiveShadow(shadowValue != null ? shadowValue : void 0));
|
|
2596
3385
|
}
|
|
2597
3386
|
function useBorderStyle(value) {
|
|
2598
3387
|
const borderData = useBorder(value);
|
|
2599
|
-
return useStyle(
|
|
3388
|
+
return useStyle(useResponsiveBorder(borderData != null ? borderData : void 0));
|
|
2600
3389
|
}
|
|
2601
3390
|
function PropsValue({
|
|
2602
3391
|
element,
|
|
@@ -2613,7 +3402,7 @@ function PropsValue({
|
|
|
2613
3402
|
return getPropControllers(state, documentKey, element.key);
|
|
2614
3403
|
});
|
|
2615
3404
|
return Object.entries(propControllerDescriptorsRef.current).reduceRight((renderFn, [propName, descriptor]) => (propsValue) => {
|
|
2616
|
-
var _a2, _b,
|
|
3405
|
+
var _a2, _b, _c2;
|
|
2617
3406
|
switch (descriptor.type) {
|
|
2618
3407
|
case CheckboxControlType:
|
|
2619
3408
|
case NumberControlType:
|
|
@@ -2655,7 +3444,7 @@ function PropsValue({
|
|
|
2655
3444
|
}, descriptor.type);
|
|
2656
3445
|
}
|
|
2657
3446
|
case SlotControlType: {
|
|
2658
|
-
const control = (
|
|
3447
|
+
const control = (_c2 = propControllers == null ? void 0 : propControllers[propName]) != null ? _c2 : null;
|
|
2659
3448
|
return /* @__PURE__ */ jsx(RenderHook, {
|
|
2660
3449
|
hook: useSlot,
|
|
2661
3450
|
parameters: [props[propName], control],
|
|
@@ -2837,7 +3626,7 @@ function isDomNodeHandle(value) {
|
|
|
2837
3626
|
}
|
|
2838
3627
|
return false;
|
|
2839
3628
|
}
|
|
2840
|
-
const storeContextDefaultValue = configureStore();
|
|
3629
|
+
const storeContextDefaultValue = configureStore$1();
|
|
2841
3630
|
function createReactRuntime(store) {
|
|
2842
3631
|
return {
|
|
2843
3632
|
registerComponent(component, {
|
|
@@ -2860,6 +3649,12 @@ function createReactRuntime(store) {
|
|
|
2860
3649
|
},
|
|
2861
3650
|
copyElementTree(elementTree2, replacementContext) {
|
|
2862
3651
|
return copyElementTree(store.getState(), elementTree2, replacementContext);
|
|
3652
|
+
},
|
|
3653
|
+
getBreakpoints() {
|
|
3654
|
+
return getBreakpoints(store.getState());
|
|
3655
|
+
},
|
|
3656
|
+
unstable_setBreakpoints(breakpoints) {
|
|
3657
|
+
return store.dispatch(setBreakpoints(parseBreakpointsInput(breakpoints)));
|
|
2863
3658
|
}
|
|
2864
3659
|
};
|
|
2865
3660
|
}
|
|
@@ -2868,10 +3663,10 @@ registerBuiltinComponents(ReactRuntime);
|
|
|
2868
3663
|
const StoreContext = createContext(storeContextDefaultValue);
|
|
2869
3664
|
const PreviewProvider = dynamic(() => import("./PreviewProvider.es.js"));
|
|
2870
3665
|
const LiveProvider = dynamic(() => import("./LiveProvider.es.js"));
|
|
2871
|
-
function RuntimeProvider(
|
|
2872
|
-
var
|
|
3666
|
+
function RuntimeProvider(_j) {
|
|
3667
|
+
var _k = _j, {
|
|
2873
3668
|
preview
|
|
2874
|
-
} =
|
|
3669
|
+
} = _k, props = __objRest(_k, [
|
|
2875
3670
|
"preview"
|
|
2876
3671
|
]);
|
|
2877
3672
|
return preview ? /* @__PURE__ */ jsx(PreviewProvider, __spreadValues({}, props)) : /* @__PURE__ */ jsx(LiveProvider, __spreadValues({}, props));
|
|
@@ -2926,6 +3721,9 @@ function useIsPreview() {
|
|
|
2926
3721
|
function useBuilderEditMode() {
|
|
2927
3722
|
return useSelector((state) => getBuilderEditMode(state));
|
|
2928
3723
|
}
|
|
3724
|
+
function useBreakpoints() {
|
|
3725
|
+
return useSelector((state) => getBreakpoints(state));
|
|
3726
|
+
}
|
|
2929
3727
|
function useDispatch() {
|
|
2930
3728
|
const store = useContext(StoreContext);
|
|
2931
3729
|
return store.dispatch;
|
|
@@ -3069,5 +3867,5 @@ const DocumentReference = memo(forwardRef(function DocumentReference2({
|
|
|
3069
3867
|
document: document2
|
|
3070
3868
|
});
|
|
3071
3869
|
}));
|
|
3072
|
-
export { Alignments as A,
|
|
3870
|
+
export { PreviewModeScript as $, Alignments as A, useFile as B, Contrasts as C, DocumentReference as D, Element$1 as E, forwardNextDynamicRef as F, useIsPreview as G, useFiles as H, useSwatches as I, usePagePathnameSlice as J, useElementId as K, deepEqual as L, ElementImperativeHandle as M, storeContextDefaultValue as N, StoreContext as O, PageProvider as P, MakeswiftProvider as Q, RuntimeProvider as R, Shapes as S, useBuilderEditMode as T, pollBoxModel as U, useTypography as V, getStaticPaths as W, getStaticProps as X, getServerSideProps as Y, Page as Z, Makeswift as _, ReactRuntime as a, Document$1 as a0, MakeswiftApiHandler as a1, usePageId as b, DEFAULT_BOX_ANIMATE_TYPE as c, DEFAULT_BOX_ANIMATE_DELAY as d, DEFAULT_BOX_ANIMATE_DURATION as e, DEFAULT_ITEM_ANIMATE_TYPE as f, DEFAULT_ITEM_ANIMATE_DELAY as g, DEFAULT_ITEM_ANIMATE_DURATION as h, DEFAULT_ITEM_STAGGER_DURATION as i, useBorder as j, useBoxShadow as k, useResponsiveColor as l, Page$1 as m, useStyle as n, useResponsiveStyle as o, useResponsiveWidth as p, useResponsiveTextStyle as q, colorToString as r, useBreakpoints as s, Sizes as t, useIsInBuilder as u, useFormContext as v, useResponsiveGridItem as w, useTable as x, useMakeswiftClient as y, Provider as z };
|
|
3073
3871
|
//# sourceMappingURL=index.es.js.map
|