@makeswift/runtime 0.8.5 → 0.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +12 -12
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +12 -12
- 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 +16 -13
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +16 -13
- 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 +13 -3
- package/dist/constants.cjs.js.map +1 -1
- package/dist/constants.es.js +13 -4
- 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 +1010 -163
- 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 +262 -109
- 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 +16 -17
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.es.js +965 -133
- 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 +262 -109
- 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 +12 -13
- 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/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/next/api-handler/handlers/manifest.d.ts +1 -0
- package/dist/types/src/next/api-handler/handlers/manifest.d.ts.map +1 -1
- package/dist/types/src/next/client.d.ts +4 -1
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/next/index.d.ts +3 -1
- package/dist/types/src/next/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/components/LiveProvider.d.ts +3 -1
- package/dist/types/src/runtimes/react/components/LiveProvider.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/components/PreviewProvider.d.ts +3 -1
- package/dist/types/src/runtimes/react/components/PreviewProvider.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/index.d.ts +22 -4
- package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/clearBlockKeyForDevice.d.ts +2 -2
- package/dist/types/src/slate/BlockPlugin/clearBlockKeyForDevice.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/index.d.ts +4 -0
- package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/setBlockKeyForDevice.d.ts +7 -3
- package/dist/types/src/slate/BlockPlugin/setBlockKeyForDevice.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/types.d.ts +2 -2
- package/dist/types/src/slate/BlockPlugin/types.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/unwrapInline.d.ts +4 -0
- package/dist/types/src/slate/BlockPlugin/unwrapInline.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/wrapInline.d.ts +4 -0
- package/dist/types/src/slate/BlockPlugin/wrapInline.d.ts.map +1 -0
- package/dist/types/src/slate/ListPlugin/toggleList.d.ts +2 -1
- package/dist/types/src/slate/ListPlugin/toggleList.d.ts.map +1 -1
- package/dist/types/src/slate/ListPlugin/unwrapList.d.ts +6 -2
- package/dist/types/src/slate/ListPlugin/unwrapList.d.ts.map +1 -1
- package/dist/types/src/slate/ListPlugin/utils/getSelectedListItems.d.ts +0 -1
- package/dist/types/src/slate/ListPlugin/utils/getSelectedListItems.d.ts.map +1 -1
- package/dist/types/src/slate/ListPlugin/wrapList.d.ts +2 -1
- package/dist/types/src/slate/ListPlugin/wrapList.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/clearActiveTypographyStyle.d.ts +6 -2
- package/dist/types/src/slate/TypographyPlugin/clearActiveTypographyStyle.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/clearDeviceActiveTypography.d.ts +6 -2
- package/dist/types/src/slate/TypographyPlugin/clearDeviceActiveTypography.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/detachActiveTypography.d.ts +6 -2
- package/dist/types/src/slate/TypographyPlugin/detachActiveTypography.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/setActiveTypographyId.d.ts +6 -2
- package/dist/types/src/slate/TypographyPlugin/setActiveTypographyId.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/setActiveTypographyStyle.d.ts +7 -2
- package/dist/types/src/slate/TypographyPlugin/setActiveTypographyStyle.d.ts.map +1 -1
- package/dist/types/src/slate/selectors.d.ts +19 -0
- package/dist/types/src/slate/selectors.d.ts.map +1 -0
- package/dist/types/src/slate/utils/editor.d.ts.map +1 -1
- package/dist/types/src/slate/utils/element.d.ts +2 -1
- package/dist/types/src/slate/utils/element.d.ts.map +1 -1
- package/dist/types/src/slate/utils/unhangRange.d.ts +10 -0
- package/dist/types/src/slate/utils/unhangRange.d.ts.map +1 -0
- 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 +5 -1
- package/dist/types/src/state/react-page.d.ts.map +1 -1
- package/dist/types/src/utils/isNonNullable.d.ts +2 -0
- package/dist/types/src/utils/isNonNullable.d.ts.map +1 -0
- 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
|
|
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 copyElementTree, j as getBreakpoints, k as getDocument, l as getElementId, m as getIsPreview, n as getIsInBuilder, o as getReactComponent, p as getBuilderEditMode } from "./constants.es.js";
|
|
43
|
+
import { A as ActionTypes, k as apiResourceFulfilled, l as registerComponentEffect, n as registerReactComponentEffect, o as registerComponentHandleEffect, p as mountComponentEffect } 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"
|
|
@@ -312,10 +758,11 @@ function useCachedSite(siteId) {
|
|
|
312
758
|
return site;
|
|
313
759
|
}
|
|
314
760
|
class Makeswift {
|
|
315
|
-
constructor(apiKey, { apiOrigin = "https://api.makeswift.com" } = {}) {
|
|
761
|
+
constructor(apiKey, { apiOrigin = "https://api.makeswift.com", runtime } = {}) {
|
|
316
762
|
__publicField(this, "apiKey");
|
|
317
763
|
__publicField(this, "apiOrigin");
|
|
318
764
|
__publicField(this, "graphqlClient");
|
|
765
|
+
__publicField(this, "runtime");
|
|
319
766
|
if (typeof apiKey !== "string") {
|
|
320
767
|
throw new Error(`The Makeswift client must be passed a valid Makeswift site API key: \`new Makeswift('<makeswift_site_api_key>')\`
|
|
321
768
|
Received "${apiKey}" instead.`);
|
|
@@ -327,6 +774,7 @@ Received "${apiKey}" instead.`);
|
|
|
327
774
|
throw new Error(`The Makeswift client received an invalid \`apiOrigin\` parameter: "${apiOrigin}".`);
|
|
328
775
|
}
|
|
329
776
|
this.graphqlClient = new GraphQLClient(new URL("graphql", apiOrigin).href);
|
|
777
|
+
this.runtime = runtime;
|
|
330
778
|
}
|
|
331
779
|
async fetch(path, init) {
|
|
332
780
|
const response = await fetch(new URL(path, this.apiOrigin).toString(), __spreadProps(__spreadValues({}, init), {
|
|
@@ -352,7 +800,9 @@ Received "${apiKey}" instead.`);
|
|
|
352
800
|
return result;
|
|
353
801
|
}
|
|
354
802
|
async introspect(element) {
|
|
355
|
-
|
|
803
|
+
var _a;
|
|
804
|
+
const runtime = (_a = this.runtime) != null ? _a : ReactRuntime;
|
|
805
|
+
const descriptors = getPropControllerDescriptors(runtime.store.getState());
|
|
356
806
|
const swatchIds = /* @__PURE__ */ new Set();
|
|
357
807
|
const fileIds = /* @__PURE__ */ new Set();
|
|
358
808
|
const typographyIds = /* @__PURE__ */ new Set();
|
|
@@ -427,8 +877,8 @@ Received "${apiKey}" instead.`);
|
|
|
427
877
|
const typographies = await this.getTypographies([...typographyIds]);
|
|
428
878
|
typographies.forEach((typography) => {
|
|
429
879
|
typography == null ? void 0 : typography.style.forEach((style) => {
|
|
430
|
-
var
|
|
431
|
-
const swatchId = (
|
|
880
|
+
var _a2;
|
|
881
|
+
const swatchId = (_a2 = style.value.color) == null ? void 0 : _a2.swatchId;
|
|
432
882
|
if (swatchId != null)
|
|
433
883
|
swatchIds.add(swatchId);
|
|
434
884
|
});
|
|
@@ -444,38 +894,38 @@ Received "${apiKey}" instead.`);
|
|
|
444
894
|
}));
|
|
445
895
|
return {
|
|
446
896
|
[APIResourceType.Swatch]: [...swatchIds].map((id) => {
|
|
447
|
-
var
|
|
897
|
+
var _a2;
|
|
448
898
|
return {
|
|
449
899
|
id,
|
|
450
|
-
value: (
|
|
900
|
+
value: (_a2 = swatches.find((swatch) => (swatch == null ? void 0 : swatch.id) === id)) != null ? _a2 : null
|
|
451
901
|
};
|
|
452
902
|
}),
|
|
453
903
|
[APIResourceType.File]: [...fileIds].map((id) => {
|
|
454
|
-
var
|
|
904
|
+
var _a2;
|
|
455
905
|
return {
|
|
456
906
|
id,
|
|
457
|
-
value: (
|
|
907
|
+
value: (_a2 = files.find((file) => (file == null ? void 0 : file.id) === id)) != null ? _a2 : null
|
|
458
908
|
};
|
|
459
909
|
}),
|
|
460
910
|
[APIResourceType.Typography]: [...typographyIds].map((id) => {
|
|
461
|
-
var
|
|
911
|
+
var _a2;
|
|
462
912
|
return {
|
|
463
913
|
id,
|
|
464
|
-
value: (
|
|
914
|
+
value: (_a2 = typographies.find((typography) => (typography == null ? void 0 : typography.id) === id)) != null ? _a2 : null
|
|
465
915
|
};
|
|
466
916
|
}),
|
|
467
917
|
[APIResourceType.Table]: [...tableIds].map((id) => {
|
|
468
|
-
var
|
|
918
|
+
var _a2;
|
|
469
919
|
return {
|
|
470
920
|
id,
|
|
471
|
-
value: (
|
|
921
|
+
value: (_a2 = tables.find((table) => (table == null ? void 0 : table.id) === id)) != null ? _a2 : null
|
|
472
922
|
};
|
|
473
923
|
}),
|
|
474
924
|
[APIResourceType.PagePathnameSlice]: [...pageIds].map((id) => {
|
|
475
|
-
var
|
|
925
|
+
var _a2;
|
|
476
926
|
return {
|
|
477
927
|
id,
|
|
478
|
-
value: (
|
|
928
|
+
value: (_a2 = pagePathnameSlices.find((pagePathnameSlice) => (pagePathnameSlice == null ? void 0 : pagePathnameSlice.id) === id)) != null ? _a2 : null
|
|
479
929
|
};
|
|
480
930
|
}),
|
|
481
931
|
[APIResourceType.GlobalElement]: [...globalElements.entries()].map(([id, value]) => ({
|
|
@@ -677,7 +1127,7 @@ async function fonts(_req, res, { getFonts } = {}) {
|
|
|
677
1127
|
const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
|
|
678
1128
|
return res.json(fonts2);
|
|
679
1129
|
}
|
|
680
|
-
const version = "0.8.
|
|
1130
|
+
const version = "0.8.7";
|
|
681
1131
|
async function handler(req, res, { apiKey }) {
|
|
682
1132
|
if (req.query.secret !== apiKey) {
|
|
683
1133
|
return res.status(401).json({ message: "Unauthorized" });
|
|
@@ -687,7 +1137,8 @@ async function handler(req, res, { apiKey }) {
|
|
|
687
1137
|
previewMode: true,
|
|
688
1138
|
interactionMode: true,
|
|
689
1139
|
clientSideNavigation: true,
|
|
690
|
-
elementFromPoint: false
|
|
1140
|
+
elementFromPoint: false,
|
|
1141
|
+
customBreakpoints: true
|
|
691
1142
|
});
|
|
692
1143
|
}
|
|
693
1144
|
async function proxyPreviewMode(req, res, { apiKey }) {
|
|
@@ -890,14 +1341,14 @@ async function getStaticPaths() {
|
|
|
890
1341
|
}
|
|
891
1342
|
const REVALIDATE_SECONDS = 1;
|
|
892
1343
|
async function getStaticProps(ctx) {
|
|
893
|
-
var _a, _b,
|
|
1344
|
+
var _a, _b, _c2;
|
|
894
1345
|
deprecationWarning("getStaticProps");
|
|
895
1346
|
const makeswift = new Makeswift(getApiKey(), {
|
|
896
1347
|
apiOrigin: getApiOrigin()
|
|
897
1348
|
});
|
|
898
1349
|
const path = "/" + ((_b = (_a = ctx.params) == null ? void 0 : _a.path) != null ? _b : []).join("/");
|
|
899
1350
|
const snapshot = await makeswift.getPageSnapshot(path, {
|
|
900
|
-
preview: ((
|
|
1351
|
+
preview: ((_c2 = ctx.previewData) == null ? void 0 : _c2.makeswift) === true
|
|
901
1352
|
});
|
|
902
1353
|
if (snapshot == null)
|
|
903
1354
|
return {
|
|
@@ -932,7 +1383,8 @@ async function getServerSideProps(ctx) {
|
|
|
932
1383
|
};
|
|
933
1384
|
}
|
|
934
1385
|
const Page = memo(({
|
|
935
|
-
snapshot
|
|
1386
|
+
snapshot,
|
|
1387
|
+
runtime
|
|
936
1388
|
}) => {
|
|
937
1389
|
const client = useMemo(() => new MakeswiftClient({
|
|
938
1390
|
uri: new URL("graphql", snapshot.apiOrigin).href,
|
|
@@ -942,6 +1394,7 @@ const Page = memo(({
|
|
|
942
1394
|
client,
|
|
943
1395
|
rootElements: /* @__PURE__ */ new Map([[snapshot.document.id, snapshot.document.data]]),
|
|
944
1396
|
preview: snapshot.preview,
|
|
1397
|
+
runtime,
|
|
945
1398
|
children: /* @__PURE__ */ jsx(Page$1, {
|
|
946
1399
|
document: snapshot.document
|
|
947
1400
|
}, snapshot.document.data.key)
|
|
@@ -958,7 +1411,7 @@ function registerComponent$c(runtime) {
|
|
|
958
1411
|
function isHiddenBasedOnAnimationType(props, deviceId, property) {
|
|
959
1412
|
var _a, _b;
|
|
960
1413
|
const animateIn = props[property];
|
|
961
|
-
return ((_b = (_a =
|
|
1414
|
+
return ((_b = (_a = findBreakpointOverride(runtime.getBreakpoints(), animateIn, deviceId)) == null ? void 0 : _a.value) != null ? _b : "none") === "none";
|
|
962
1415
|
}
|
|
963
1416
|
const isHiddenBasedOnBoxAnimation = (props, deviceId) => isHiddenBasedOnAnimationType(props, deviceId, "boxAnimateType");
|
|
964
1417
|
const isHiddenBasedOnItemAnimation = (props, deviceId) => isHiddenBasedOnAnimationType(props, deviceId, "itemAnimateType");
|
|
@@ -999,7 +1452,7 @@ function registerComponent$c(runtime) {
|
|
|
999
1452
|
format: Padding.Format.ClassName,
|
|
1000
1453
|
preset: [
|
|
1001
1454
|
{
|
|
1002
|
-
deviceId:
|
|
1455
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1003
1456
|
value: {
|
|
1004
1457
|
paddingTop: { value: 10, unit: "px" },
|
|
1005
1458
|
paddingRight: { value: 10, unit: "px" },
|
|
@@ -1149,7 +1602,7 @@ function registerComponent$b(runtime) {
|
|
|
1149
1602
|
color: ResponsiveColor((props, device) => {
|
|
1150
1603
|
var _a;
|
|
1151
1604
|
const variant = props.variant;
|
|
1152
|
-
const hidden = ((_a =
|
|
1605
|
+
const hidden = ((_a = findBreakpointOverride(runtime.getBreakpoints(), variant, device)) == null ? void 0 : _a.value) === "clear";
|
|
1153
1606
|
return { placeholder: "black", hidden };
|
|
1154
1607
|
}),
|
|
1155
1608
|
textColor: ResponsiveColor({
|
|
@@ -1196,7 +1649,7 @@ function registerComponent$a(runtime) {
|
|
|
1196
1649
|
step: ResponsiveNumber((props, device) => {
|
|
1197
1650
|
var _a, _b;
|
|
1198
1651
|
const pageSize = props.pageSize;
|
|
1199
|
-
const pageSizeValue = (_b = (_a =
|
|
1652
|
+
const pageSizeValue = (_b = (_a = findBreakpointOverride(runtime.getBreakpoints(), pageSize, device)) == null ? void 0 : _a.value) != null ? _b : 1;
|
|
1200
1653
|
return {
|
|
1201
1654
|
label: "Step",
|
|
1202
1655
|
defaultValue: 1,
|
|
@@ -1220,7 +1673,7 @@ function registerComponent$a(runtime) {
|
|
|
1220
1673
|
defaultValue: { value: 0, unit: "px" }
|
|
1221
1674
|
}),
|
|
1222
1675
|
autoplay: Checkbox({ label: "Autoplay" }),
|
|
1223
|
-
delay: Number((props) => ({
|
|
1676
|
+
delay: Number$1((props) => ({
|
|
1224
1677
|
label: "Delay",
|
|
1225
1678
|
preset: 5,
|
|
1226
1679
|
min: 1,
|
|
@@ -1308,7 +1761,12 @@ function registerComponent$9(runtime) {
|
|
|
1308
1761
|
defaultValue: "medium"
|
|
1309
1762
|
}),
|
|
1310
1763
|
gap: GapX({
|
|
1311
|
-
preset: [
|
|
1764
|
+
preset: [
|
|
1765
|
+
{
|
|
1766
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1767
|
+
value: { value: 10, unit: "px" }
|
|
1768
|
+
}
|
|
1769
|
+
],
|
|
1312
1770
|
label: "Gap",
|
|
1313
1771
|
step: 1,
|
|
1314
1772
|
min: 0,
|
|
@@ -1434,7 +1892,12 @@ function registerComponent$6(runtime) {
|
|
|
1434
1892
|
hidden: props.tableId == null
|
|
1435
1893
|
})),
|
|
1436
1894
|
gap: GapY((props) => ({
|
|
1437
|
-
preset: [
|
|
1895
|
+
preset: [
|
|
1896
|
+
{
|
|
1897
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1898
|
+
value: { value: 10, unit: "px" }
|
|
1899
|
+
}
|
|
1900
|
+
],
|
|
1438
1901
|
label: "Gap",
|
|
1439
1902
|
defaultValue: { value: 0, unit: "px" },
|
|
1440
1903
|
hidden: props.tableId == null
|
|
@@ -1472,7 +1935,7 @@ function registerComponent$6(runtime) {
|
|
|
1472
1935
|
labelTextColor: ResponsiveColor((props, device) => {
|
|
1473
1936
|
const hidden = props.tableId == null;
|
|
1474
1937
|
const responsiveContrast = props.contrast;
|
|
1475
|
-
const contrast =
|
|
1938
|
+
const contrast = findBreakpointOverride(runtime.getBreakpoints(), responsiveContrast, device);
|
|
1476
1939
|
return {
|
|
1477
1940
|
hidden,
|
|
1478
1941
|
label: "Label text color",
|
|
@@ -1524,7 +1987,12 @@ function registerComponent$6(runtime) {
|
|
|
1524
1987
|
hidden: props.tableId == null
|
|
1525
1988
|
})),
|
|
1526
1989
|
width: Width({
|
|
1527
|
-
preset: [
|
|
1990
|
+
preset: [
|
|
1991
|
+
{
|
|
1992
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1993
|
+
value: { value: 550, unit: "px" }
|
|
1994
|
+
}
|
|
1995
|
+
],
|
|
1528
1996
|
defaultValue: { value: 100, unit: "%" },
|
|
1529
1997
|
format: Width.Format.ClassName
|
|
1530
1998
|
}),
|
|
@@ -1572,7 +2040,12 @@ function registerComponent$4(runtime) {
|
|
|
1572
2040
|
hidden: props.showLogo === false
|
|
1573
2041
|
})),
|
|
1574
2042
|
logoWidth: ResponsiveLength((props) => ({
|
|
1575
|
-
preset: [
|
|
2043
|
+
preset: [
|
|
2044
|
+
{
|
|
2045
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2046
|
+
value: { value: 100, unit: "px" }
|
|
2047
|
+
}
|
|
2048
|
+
],
|
|
1576
2049
|
label: "Logo width",
|
|
1577
2050
|
min: 0,
|
|
1578
2051
|
max: 1e3,
|
|
@@ -1597,7 +2070,12 @@ function registerComponent$4(runtime) {
|
|
|
1597
2070
|
defaultValue: "flex-end"
|
|
1598
2071
|
}),
|
|
1599
2072
|
gutter: GapX({
|
|
1600
|
-
preset: [
|
|
2073
|
+
preset: [
|
|
2074
|
+
{
|
|
2075
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2076
|
+
value: { value: 10, unit: "px" }
|
|
2077
|
+
}
|
|
2078
|
+
],
|
|
1601
2079
|
label: "Link gap",
|
|
1602
2080
|
min: 0,
|
|
1603
2081
|
max: 100,
|
|
@@ -1613,7 +2091,7 @@ function registerComponent$4(runtime) {
|
|
|
1613
2091
|
}),
|
|
1614
2092
|
mobileMenuOpenIconColor: ResponsiveColor((props, device) => {
|
|
1615
2093
|
const mobileMenuAnimation = props.mobileMenuAnimation;
|
|
1616
|
-
const hidden = !
|
|
2094
|
+
const hidden = !findBreakpointOverride(runtime.getBreakpoints(), mobileMenuAnimation, device);
|
|
1617
2095
|
return {
|
|
1618
2096
|
label: "Open icon color",
|
|
1619
2097
|
placeholder: "rgba(161, 168, 194, 0.5)",
|
|
@@ -1622,7 +2100,7 @@ function registerComponent$4(runtime) {
|
|
|
1622
2100
|
}),
|
|
1623
2101
|
mobileMenuCloseIconColor: ResponsiveColor((props, device) => {
|
|
1624
2102
|
const mobileMenuAnimation = props.mobileMenuAnimation;
|
|
1625
|
-
const hidden = !
|
|
2103
|
+
const hidden = !findBreakpointOverride(runtime.getBreakpoints(), mobileMenuAnimation, device);
|
|
1626
2104
|
return {
|
|
1627
2105
|
label: "Close icon color",
|
|
1628
2106
|
placeholder: "rgba(161, 168, 194, 0.5)",
|
|
@@ -1631,7 +2109,7 @@ function registerComponent$4(runtime) {
|
|
|
1631
2109
|
}),
|
|
1632
2110
|
mobileMenuBackgroundColor: ResponsiveColor((props, device) => {
|
|
1633
2111
|
const mobileMenuAnimation = props.mobileMenuAnimation;
|
|
1634
|
-
const hidden = !
|
|
2112
|
+
const hidden = !findBreakpointOverride(runtime.getBreakpoints(), mobileMenuAnimation, device);
|
|
1635
2113
|
return {
|
|
1636
2114
|
label: "Menu BG color",
|
|
1637
2115
|
placeholder: "black",
|
|
@@ -1754,7 +2232,12 @@ function registerComponent$2(runtime) {
|
|
|
1754
2232
|
defaultValue: "center"
|
|
1755
2233
|
}),
|
|
1756
2234
|
gutter: GapX({
|
|
1757
|
-
preset: [
|
|
2235
|
+
preset: [
|
|
2236
|
+
{
|
|
2237
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2238
|
+
value: { value: 10, unit: "px" }
|
|
2239
|
+
}
|
|
2240
|
+
],
|
|
1758
2241
|
label: "Link gap",
|
|
1759
2242
|
min: 0,
|
|
1760
2243
|
max: 100,
|
|
@@ -1769,7 +2252,7 @@ function registerComponent$2(runtime) {
|
|
|
1769
2252
|
format: Margin.Format.ClassName,
|
|
1770
2253
|
preset: [
|
|
1771
2254
|
{
|
|
1772
|
-
deviceId:
|
|
2255
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1773
2256
|
value: {
|
|
1774
2257
|
marginTop: { value: 10, unit: "px" },
|
|
1775
2258
|
marginRight: "auto",
|
|
@@ -1809,17 +2292,19 @@ function registerComponent$1(runtime) {
|
|
|
1809
2292
|
id: null,
|
|
1810
2293
|
style: [
|
|
1811
2294
|
{
|
|
1812
|
-
deviceId:
|
|
1813
|
-
value: { fontSize: { value: 16, unit: "px" } }
|
|
1814
|
-
},
|
|
1815
|
-
{
|
|
1816
|
-
deviceId: "desktop",
|
|
2295
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1817
2296
|
value: {
|
|
1818
2297
|
fontWeight: 400,
|
|
1819
2298
|
fontSize: { value: 18, unit: "px" },
|
|
1820
2299
|
lineHeight: 1.5
|
|
1821
2300
|
}
|
|
1822
|
-
}
|
|
2301
|
+
},
|
|
2302
|
+
...runtime.getBreakpoints().some(({ id }) => id === DefaultBreakpointID.Mobile) ? [
|
|
2303
|
+
{
|
|
2304
|
+
deviceId: DefaultBreakpointID.Mobile,
|
|
2305
|
+
value: { fontSize: { value: 16, unit: "px" } }
|
|
2306
|
+
}
|
|
2307
|
+
] : []
|
|
1823
2308
|
]
|
|
1824
2309
|
}
|
|
1825
2310
|
}
|
|
@@ -1834,14 +2319,19 @@ function registerComponent$1(runtime) {
|
|
|
1834
2319
|
})),
|
|
1835
2320
|
width: Width({
|
|
1836
2321
|
format: Width.Format.ClassName,
|
|
1837
|
-
preset: [
|
|
2322
|
+
preset: [
|
|
2323
|
+
{
|
|
2324
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2325
|
+
value: { value: 700, unit: "px" }
|
|
2326
|
+
}
|
|
2327
|
+
],
|
|
1838
2328
|
defaultValue: { value: 100, unit: "%" }
|
|
1839
2329
|
}),
|
|
1840
2330
|
margin: Margin({
|
|
1841
2331
|
format: Margin.Format.ClassName,
|
|
1842
2332
|
preset: [
|
|
1843
2333
|
{
|
|
1844
|
-
deviceId:
|
|
2334
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
1845
2335
|
value: {
|
|
1846
2336
|
marginTop: null,
|
|
1847
2337
|
marginRight: "auto",
|
|
@@ -1901,6 +2391,19 @@ function registerBuiltinComponents(runtime) {
|
|
|
1901
2391
|
unregisterVideoComponent();
|
|
1902
2392
|
};
|
|
1903
2393
|
}
|
|
2394
|
+
const isServer = typeof window === "undefined";
|
|
2395
|
+
const useInsertionEffectSpecifier = "useInsertionEffect";
|
|
2396
|
+
const useInsertionEffect = (_c = React[useInsertionEffectSpecifier]) != null ? _c : React.useLayoutEffect;
|
|
2397
|
+
function useStyle(style) {
|
|
2398
|
+
const serialized = serializeStyles([style], cache.registered);
|
|
2399
|
+
registerStyles(cache, serialized, false);
|
|
2400
|
+
useInsertionEffect(() => {
|
|
2401
|
+
insertStyles(cache, serialized, false);
|
|
2402
|
+
});
|
|
2403
|
+
if (isServer)
|
|
2404
|
+
insertStyles(cache, serialized, false);
|
|
2405
|
+
return `${cache.key}-${serialized.name}`;
|
|
2406
|
+
}
|
|
1904
2407
|
var _path;
|
|
1905
2408
|
function _extends() {
|
|
1906
2409
|
_extends = Object.assign || function(target) {
|
|
@@ -1952,8 +2455,100 @@ const FallbackComponent = forwardRef(function FallbackComponent2({
|
|
|
1952
2455
|
})]
|
|
1953
2456
|
});
|
|
1954
2457
|
});
|
|
1955
|
-
function
|
|
1956
|
-
|
|
2458
|
+
function useSwatch(swatchId) {
|
|
2459
|
+
const client = useMakeswiftClient();
|
|
2460
|
+
const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
|
|
2461
|
+
const swatch = useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
|
|
2462
|
+
useEffect(() => {
|
|
2463
|
+
if (swatchId != null)
|
|
2464
|
+
client.fetchSwatch(swatchId).catch(console.error);
|
|
2465
|
+
}, [client, swatchId]);
|
|
2466
|
+
return swatch;
|
|
2467
|
+
}
|
|
2468
|
+
function useSwatches(swatchIds) {
|
|
2469
|
+
const client = useMakeswiftClient();
|
|
2470
|
+
const lastSnapshot = useRef();
|
|
2471
|
+
function getSnapshot() {
|
|
2472
|
+
const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
|
|
2473
|
+
if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
|
|
2474
|
+
return lastSnapshot.current;
|
|
2475
|
+
}
|
|
2476
|
+
return lastSnapshot.current = swatches2;
|
|
2477
|
+
}
|
|
2478
|
+
const swatches = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2479
|
+
useEffect(() => {
|
|
2480
|
+
Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
|
|
2481
|
+
}, [client, swatchIds]);
|
|
2482
|
+
return swatches;
|
|
2483
|
+
}
|
|
2484
|
+
function useFile(fileId) {
|
|
2485
|
+
const client = useMakeswiftClient();
|
|
2486
|
+
const readFile = () => fileId == null ? null : client.readFile(fileId);
|
|
2487
|
+
const file = useSyncExternalStore(client.subscribe, readFile, readFile);
|
|
2488
|
+
useEffect(() => {
|
|
2489
|
+
if (fileId != null)
|
|
2490
|
+
client.fetchFile(fileId);
|
|
2491
|
+
}, [client, fileId]);
|
|
2492
|
+
return file;
|
|
2493
|
+
}
|
|
2494
|
+
function useFiles(fileIds) {
|
|
2495
|
+
const client = useMakeswiftClient();
|
|
2496
|
+
const lastSnapshot = useRef();
|
|
2497
|
+
function getSnapshot() {
|
|
2498
|
+
const files2 = fileIds.map((fileId) => client.readFile(fileId));
|
|
2499
|
+
if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
|
|
2500
|
+
return lastSnapshot.current;
|
|
2501
|
+
}
|
|
2502
|
+
return lastSnapshot.current = files2;
|
|
2503
|
+
}
|
|
2504
|
+
const files = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2505
|
+
useEffect(() => {
|
|
2506
|
+
Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
|
|
2507
|
+
}, [client, fileIds]);
|
|
2508
|
+
return files;
|
|
2509
|
+
}
|
|
2510
|
+
function useTypography(typographyId) {
|
|
2511
|
+
const client = useMakeswiftClient();
|
|
2512
|
+
const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
|
|
2513
|
+
const typography = useSyncExternalStore(client.subscribe, readTypography, readTypography);
|
|
2514
|
+
useEffect(() => {
|
|
2515
|
+
if (typographyId != null)
|
|
2516
|
+
client.fetchTypography(typographyId).catch(console.error);
|
|
2517
|
+
}, [client, typographyId]);
|
|
2518
|
+
return typography;
|
|
2519
|
+
}
|
|
2520
|
+
function useGlobalElement(globalElementId) {
|
|
2521
|
+
const client = useMakeswiftClient();
|
|
2522
|
+
const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
|
|
2523
|
+
const globalElement = useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
|
|
2524
|
+
useEffect(() => {
|
|
2525
|
+
if (globalElementId != null)
|
|
2526
|
+
client.fetchGlobalElement(globalElementId).catch(console.error);
|
|
2527
|
+
}, [client, globalElementId]);
|
|
2528
|
+
return globalElement;
|
|
2529
|
+
}
|
|
2530
|
+
function usePagePathnameSlice(pageId) {
|
|
2531
|
+
const client = useMakeswiftClient();
|
|
2532
|
+
const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
|
|
2533
|
+
const pagePathnameSlice = useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
|
|
2534
|
+
useEffect(() => {
|
|
2535
|
+
if (pageId != null)
|
|
2536
|
+
client.fetchPagePathnameSlice(pageId).catch(console.error);
|
|
2537
|
+
}, [client, pageId]);
|
|
2538
|
+
return pagePathnameSlice;
|
|
2539
|
+
}
|
|
2540
|
+
function useTable(tableId) {
|
|
2541
|
+
const client = useMakeswiftClient();
|
|
2542
|
+
const readTable = () => tableId == null ? null : client.readTable(tableId);
|
|
2543
|
+
const table = useSyncExternalStore(client.subscribe, readTable, readTable);
|
|
2544
|
+
useEffect(() => {
|
|
2545
|
+
if (tableId != null)
|
|
2546
|
+
client.fetchTable(tableId).catch(console.error);
|
|
2547
|
+
}, [client, tableId]);
|
|
2548
|
+
return table;
|
|
2549
|
+
}
|
|
2550
|
+
function mapSideColor(swatches, _d) {
|
|
2551
|
+
var _e = _d, { color } = _e, restOfSide = __objRest(_e, ["color"]);
|
|
1957
2552
|
return __spreadProps(__spreadValues({}, restOfSide), {
|
|
1958
2553
|
color: color && {
|
|
1959
2554
|
alpha: color.alpha,
|
|
@@ -2029,34 +2624,235 @@ function useResponsiveColor(color) {
|
|
|
2029
2624
|
return swatch == null ? null : __spreadProps(__spreadValues({}, rest), { value: { swatch, alpha } });
|
|
2030
2625
|
}).filter(isNonNullable);
|
|
2031
2626
|
}
|
|
2032
|
-
const
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2627
|
+
const getIndexes = (spans, index) => {
|
|
2628
|
+
const flattened = spans.reduce((a, s) => a.concat(s), []);
|
|
2629
|
+
if (index < 0 || index > flattened.length)
|
|
2630
|
+
throw new RangeError();
|
|
2631
|
+
let remainder = index;
|
|
2632
|
+
let rowIndex = 0;
|
|
2633
|
+
while (rowIndex < spans.length - 1 && remainder >= spans[rowIndex].length) {
|
|
2634
|
+
remainder -= spans[rowIndex].length;
|
|
2635
|
+
rowIndex += 1;
|
|
2636
|
+
}
|
|
2637
|
+
return [rowIndex, remainder];
|
|
2638
|
+
};
|
|
2639
|
+
function lengthDataToString(data) {
|
|
2640
|
+
if (typeof data === "object")
|
|
2641
|
+
return `${data.value}${data.unit}`;
|
|
2642
|
+
if (typeof data === "number")
|
|
2643
|
+
return `${data}px`;
|
|
2644
|
+
return data;
|
|
2645
|
+
}
|
|
2646
|
+
function paddingPropertyDataToStyle(data, defaultValue = {}) {
|
|
2647
|
+
var _a, _b, _c2, _d;
|
|
2648
|
+
const paddingTop = (_a = data.paddingTop) != null ? _a : defaultValue.paddingTop;
|
|
2649
|
+
const paddingRight = (_b = data.paddingRight) != null ? _b : defaultValue.paddingRight;
|
|
2650
|
+
const paddingBottom = (_c2 = data.paddingBottom) != null ? _c2 : defaultValue.paddingBottom;
|
|
2651
|
+
const paddingLeft = (_d = data.paddingLeft) != null ? _d : defaultValue.paddingLeft;
|
|
2652
|
+
const style = {};
|
|
2653
|
+
if (paddingTop != null)
|
|
2654
|
+
style.paddingTop = lengthDataToString(paddingTop);
|
|
2655
|
+
if (paddingRight != null)
|
|
2656
|
+
style.paddingRight = lengthDataToString(paddingRight);
|
|
2657
|
+
if (paddingBottom != null)
|
|
2658
|
+
style.paddingBottom = lengthDataToString(paddingBottom);
|
|
2659
|
+
if (paddingLeft != null)
|
|
2660
|
+
style.paddingLeft = lengthDataToString(paddingLeft);
|
|
2661
|
+
return style;
|
|
2662
|
+
}
|
|
2663
|
+
function marginPropertyDataToStyle(data, defaultValue = {}) {
|
|
2664
|
+
var _a, _b, _c2, _d;
|
|
2665
|
+
const marginTop = (_a = data.marginTop) != null ? _a : defaultValue.marginTop;
|
|
2666
|
+
const marginRight = (_b = data.marginRight) != null ? _b : defaultValue.marginRight;
|
|
2667
|
+
const marginBottom = (_c2 = data.marginBottom) != null ? _c2 : defaultValue.marginBottom;
|
|
2668
|
+
const marginLeft = (_d = data.marginLeft) != null ? _d : defaultValue.marginLeft;
|
|
2669
|
+
const style = {};
|
|
2670
|
+
if (marginTop != null)
|
|
2671
|
+
style.marginTop = lengthDataToString(marginTop);
|
|
2672
|
+
if (marginRight != null)
|
|
2673
|
+
style.marginRight = lengthDataToString(marginRight);
|
|
2674
|
+
if (marginBottom != null)
|
|
2675
|
+
style.marginBottom = lengthDataToString(marginBottom);
|
|
2676
|
+
if (marginLeft != null)
|
|
2677
|
+
style.marginLeft = lengthDataToString(marginLeft);
|
|
2678
|
+
return style;
|
|
2679
|
+
}
|
|
2680
|
+
function lengthPercentageDataToString(data) {
|
|
2681
|
+
if (typeof data === "object")
|
|
2682
|
+
return `${data.value}${data.unit}`;
|
|
2683
|
+
if (typeof data === "number")
|
|
2684
|
+
return `${data}px`;
|
|
2685
|
+
return data;
|
|
2686
|
+
}
|
|
2687
|
+
function borderRadiusPropertyDataToStyle(data, defaultValue = {}) {
|
|
2688
|
+
var _a, _b, _c2, _d;
|
|
2689
|
+
const borderTopLeftRadius = (_a = data.borderTopLeftRadius) != null ? _a : defaultValue.borderTopLeftRadius;
|
|
2690
|
+
const borderTopRightRadius = (_b = data.borderTopRightRadius) != null ? _b : defaultValue.borderTopRightRadius;
|
|
2691
|
+
const borderBottomRightRadius = (_c2 = data.borderBottomRightRadius) != null ? _c2 : defaultValue.borderBottomRightRadius;
|
|
2692
|
+
const borderBottomLeftRadius = (_d = data.borderBottomLeftRadius) != null ? _d : defaultValue.borderBottomLeftRadius;
|
|
2693
|
+
const style = {};
|
|
2694
|
+
if (borderTopLeftRadius != null) {
|
|
2695
|
+
style.borderTopLeftRadius = lengthPercentageDataToString(borderTopLeftRadius);
|
|
2696
|
+
}
|
|
2697
|
+
if (borderTopRightRadius != null) {
|
|
2698
|
+
style.borderTopRightRadius = lengthPercentageDataToString(borderTopRightRadius);
|
|
2699
|
+
}
|
|
2700
|
+
if (borderBottomRightRadius != null) {
|
|
2701
|
+
style.borderBottomRightRadius = lengthPercentageDataToString(borderBottomRightRadius);
|
|
2702
|
+
}
|
|
2703
|
+
if (borderBottomLeftRadius != null) {
|
|
2704
|
+
style.borderBottomLeftRadius = lengthPercentageDataToString(borderBottomLeftRadius);
|
|
2705
|
+
}
|
|
2706
|
+
return style;
|
|
2707
|
+
}
|
|
2708
|
+
function colorToString(color) {
|
|
2709
|
+
return color && color.swatch ? `hsla(${color.swatch.hue},${color.swatch.saturation}%,${color.swatch.lightness}%,${color.alpha})` : "";
|
|
2710
|
+
}
|
|
2711
|
+
function borderPropertyDataToStyle(data, defaultValue = {}) {
|
|
2712
|
+
var _a, _b, _c2, _d;
|
|
2713
|
+
const borderTop = (_a = data.borderTop) != null ? _a : defaultValue.borderTop;
|
|
2714
|
+
const borderRight = (_b = data.borderRight) != null ? _b : defaultValue.borderRight;
|
|
2715
|
+
const borderBottom = (_c2 = data.borderBottom) != null ? _c2 : defaultValue.borderBottom;
|
|
2716
|
+
const borderLeft = (_d = data.borderLeft) != null ? _d : defaultValue.borderLeft;
|
|
2717
|
+
const style = {};
|
|
2718
|
+
if (borderTop != null)
|
|
2719
|
+
style.borderTop = borderSideToString(borderTop);
|
|
2720
|
+
if (borderRight != null)
|
|
2721
|
+
style.borderRight = borderSideToString(borderRight);
|
|
2722
|
+
if (borderBottom != null)
|
|
2723
|
+
style.borderBottom = borderSideToString(borderBottom);
|
|
2724
|
+
if (borderLeft != null)
|
|
2725
|
+
style.borderLeft = borderSideToString(borderLeft);
|
|
2726
|
+
return style;
|
|
2727
|
+
}
|
|
2728
|
+
function borderSideToString(borderSide) {
|
|
2729
|
+
if (typeof borderSide === "string")
|
|
2730
|
+
return borderSide;
|
|
2731
|
+
if (typeof borderSide === "number")
|
|
2732
|
+
return `${borderSide}px`;
|
|
2733
|
+
const { width, color, style } = borderSide;
|
|
2734
|
+
return `${width != null ? width : 0}px ${style} ${color != null ? colorToString(color) : "black"}`;
|
|
2735
|
+
}
|
|
2736
|
+
function responsiveStyle(breakpoints, responsiveValues, join$1, strategy) {
|
|
2737
|
+
return join(breakpoints, responsiveValues, join$1, strategy).reduce((acc, { deviceId, value }) => {
|
|
2738
|
+
const breakpoint = getBreakpoint(breakpoints, deviceId);
|
|
2739
|
+
const mediaQuery = getBreakpointMediaQuery(breakpoint);
|
|
2740
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
2741
|
+
[mediaQuery]: __spreadValues(__spreadValues({}, acc[mediaQuery]), value)
|
|
2742
|
+
});
|
|
2743
|
+
}, {});
|
|
2744
|
+
}
|
|
2745
|
+
function useResponsiveStyle(responsiveValues, join2, strategy) {
|
|
2746
|
+
return responsiveStyle(useBreakpoints(), responsiveValues, join2, strategy);
|
|
2747
|
+
}
|
|
2748
|
+
function responsiveWidth(breakpoints, widthData, defaultValue = "100%") {
|
|
2749
|
+
return __spreadValues({
|
|
2750
|
+
maxWidth: "100%"
|
|
2751
|
+
}, responsiveStyle(breakpoints, [widthData], ([width = defaultValue]) => ({
|
|
2752
|
+
width: typeof width === "object" ? `${width.value}${width.unit}` : width
|
|
2753
|
+
})));
|
|
2754
|
+
}
|
|
2755
|
+
function useResponsiveWidth(...args) {
|
|
2756
|
+
return responsiveWidth(useBreakpoints(), ...args);
|
|
2757
|
+
}
|
|
2758
|
+
function responsivePadding(breakpoints, paddingData, defaultValue = {}) {
|
|
2759
|
+
return responsiveStyle(breakpoints, [paddingData], ([padding = {}]) => paddingPropertyDataToStyle(padding, Object.assign({ paddingTop: 0, paddingRight: 0, paddingBottom: 0, paddingLeft: 0 }, defaultValue)));
|
|
2760
|
+
}
|
|
2761
|
+
function useResponsivePadding(...args) {
|
|
2762
|
+
return responsivePadding(useBreakpoints(), ...args);
|
|
2763
|
+
}
|
|
2764
|
+
function responsiveMargin(breakpoints, marginData, defaultValue = {}) {
|
|
2765
|
+
return responsiveStyle(breakpoints, [marginData], ([margin = {}]) => marginPropertyDataToStyle(margin, Object.assign({ marginTop: 0, marginRight: "auto", marginBottom: 0, marginLeft: "auto" }, defaultValue)));
|
|
2766
|
+
}
|
|
2767
|
+
function useResponsiveMargin(...args) {
|
|
2768
|
+
return responsiveMargin(useBreakpoints(), ...args);
|
|
2769
|
+
}
|
|
2770
|
+
function responsiveBorderRadius(breakpoints, borderRadiusData, defaultValue = {}) {
|
|
2771
|
+
return responsiveStyle(breakpoints, [borderRadiusData], ([borderRadius = {}]) => borderRadiusPropertyDataToStyle(borderRadius, Object.assign({
|
|
2772
|
+
borderTopLeftRadius: 0,
|
|
2773
|
+
borderTopRightRadius: 0,
|
|
2774
|
+
borderBottomRightRadius: 0,
|
|
2775
|
+
borderBottomLeftRadius: 0
|
|
2776
|
+
}, defaultValue)));
|
|
2777
|
+
}
|
|
2778
|
+
function useResponsiveBorderRadius(...args) {
|
|
2779
|
+
return responsiveBorderRadius(useBreakpoints(), ...args);
|
|
2780
|
+
}
|
|
2781
|
+
function useResponsiveBorder(borderData, defaultValue = {}) {
|
|
2782
|
+
return useResponsiveStyle([borderData], ([border = {}]) => borderPropertyDataToStyle(border, Object.assign({
|
|
2783
|
+
borderTop: "0px solid black",
|
|
2784
|
+
borderRight: "0px solid black",
|
|
2785
|
+
borderBottom: "0px solid black",
|
|
2786
|
+
borderLeft: "0px solid black"
|
|
2787
|
+
}, defaultValue)));
|
|
2788
|
+
}
|
|
2789
|
+
const floor = (d) => (v) => Math.floor(10 ** d * v) / 10 ** d;
|
|
2790
|
+
function responsiveGridItem(breakpoints, props) {
|
|
2791
|
+
return __spreadValues({
|
|
2792
|
+
display: "flex"
|
|
2793
|
+
}, responsiveStyle(breakpoints, [props.grid, props.columnGap, props.rowGap], ([
|
|
2794
|
+
{ spans, count } = { spans: [[12]], count: 12 },
|
|
2795
|
+
columnGap = { value: 0, unit: "px" },
|
|
2796
|
+
rowGap = { value: 0, unit: "px" }
|
|
2797
|
+
]) => {
|
|
2798
|
+
const [rowIndex, columnIndex] = getIndexes(spans, props.index);
|
|
2799
|
+
const firstCol = columnIndex === 0;
|
|
2800
|
+
const lastCol = columnIndex === spans[rowIndex].length - 1;
|
|
2801
|
+
const span = spans[rowIndex][columnIndex];
|
|
2802
|
+
const fraction = floor(5)(span / count);
|
|
2803
|
+
const width = `${fraction} * (100% + ${columnGap.value}${columnGap.unit})`;
|
|
2804
|
+
const excessWidth = `${Number(firstCol) + Number(lastCol)} * ${columnGap.value}${columnGap.unit} / 2`;
|
|
2805
|
+
const iePrecisionError = "0.01px";
|
|
2806
|
+
const flexBasis = `calc(${width} - ${excessWidth} - ${iePrecisionError})`;
|
|
2807
|
+
const firstRow = rowIndex === 0;
|
|
2808
|
+
const lastRow = rowIndex === spans.length - 1;
|
|
2809
|
+
return span === 0 ? { display: "none" } : {
|
|
2810
|
+
flexBasis,
|
|
2811
|
+
minWidth: flexBasis,
|
|
2812
|
+
maxWidth: flexBasis,
|
|
2813
|
+
paddingLeft: firstCol ? 0 : `${columnGap.value / 2}${columnGap.unit}`,
|
|
2814
|
+
paddingRight: lastCol ? 0 : `${columnGap.value / 2}${columnGap.unit}`,
|
|
2815
|
+
paddingTop: firstRow ? 0 : `${rowGap.value / 2}${rowGap.unit}`,
|
|
2816
|
+
paddingBottom: lastRow ? 0 : `${rowGap.value / 2}${rowGap.unit}`
|
|
2817
|
+
};
|
|
2818
|
+
}));
|
|
2819
|
+
}
|
|
2820
|
+
function useResponsiveGridItem(...args) {
|
|
2821
|
+
return responsiveGridItem(useBreakpoints(), ...args);
|
|
2822
|
+
}
|
|
2823
|
+
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();
|
|
2824
|
+
function responsiveShadow(breakpoints, value) {
|
|
2825
|
+
return responsiveStyle(breakpoints, [value], ([shadow = []]) => ({
|
|
2826
|
+
boxShadow: getBoxShadow(shadow)
|
|
2827
|
+
}));
|
|
2828
|
+
}
|
|
2829
|
+
function useResponsiveShadow(...args) {
|
|
2830
|
+
return responsiveShadow(useBreakpoints(), ...args);
|
|
2831
|
+
}
|
|
2832
|
+
function responsiveTextStyle(breakpoints, value) {
|
|
2833
|
+
return responsiveStyle(breakpoints, [value], ([
|
|
2834
|
+
textStyle = {
|
|
2835
|
+
fontFamily: null,
|
|
2836
|
+
letterSpacing: null,
|
|
2837
|
+
fontSize: null,
|
|
2838
|
+
fontWeight: null,
|
|
2839
|
+
textTransform: [],
|
|
2840
|
+
fontStyle: []
|
|
2841
|
+
}
|
|
2842
|
+
]) => {
|
|
2843
|
+
const {
|
|
2844
|
+
fontSize,
|
|
2845
|
+
fontWeight,
|
|
2846
|
+
fontStyle = [],
|
|
2847
|
+
textTransform = [],
|
|
2848
|
+
letterSpacing,
|
|
2849
|
+
fontFamily
|
|
2850
|
+
} = textStyle;
|
|
2851
|
+
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
2852
|
});
|
|
2042
|
-
return () => cleanUpFns.forEach((fn) => fn());
|
|
2043
2853
|
}
|
|
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);
|
|
2854
|
+
function useResponsiveTextStyle(...args) {
|
|
2855
|
+
return responsiveTextStyle(useBreakpoints(), ...args);
|
|
2060
2856
|
}
|
|
2061
2857
|
const defaultMargin = {
|
|
2062
2858
|
marginTop: 0,
|
|
@@ -2074,7 +2870,7 @@ function useStyleControlCssObject(style, controlDefinition) {
|
|
|
2074
2870
|
const { properties } = controlDefinition.config;
|
|
2075
2871
|
return __spreadValues(__spreadValues({}, properties.includes(StyleControlProperty.Width) && {
|
|
2076
2872
|
maxWidth: "100%"
|
|
2077
|
-
}),
|
|
2873
|
+
}), useResponsiveStyle([
|
|
2078
2874
|
style == null ? void 0 : style.width,
|
|
2079
2875
|
style == null ? void 0 : style.margin,
|
|
2080
2876
|
style == null ? void 0 : style.padding,
|
|
@@ -2082,14 +2878,14 @@ function useStyleControlCssObject(style, controlDefinition) {
|
|
|
2082
2878
|
style == null ? void 0 : style.borderRadius,
|
|
2083
2879
|
style == null ? void 0 : style.textStyle
|
|
2084
2880
|
], ([width, margin, padding, border, borderRadius, textStyle]) => {
|
|
2085
|
-
var _a, _b,
|
|
2881
|
+
var _a, _b, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2086
2882
|
return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, properties.includes(StyleControlProperty.Width) && {
|
|
2087
2883
|
width: (_a = widthToString(width)) != null ? _a : "100%"
|
|
2088
2884
|
}), 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 =
|
|
2885
|
+
borderTop: (_b = borderSideToString2(border == null ? void 0 : border.borderTop)) != null ? _b : "0 solid black",
|
|
2886
|
+
borderRight: (_c2 = borderSideToString2(border == null ? void 0 : border.borderRight)) != null ? _c2 : "0 solid black",
|
|
2887
|
+
borderBottom: (_d = borderSideToString2(border == null ? void 0 : border.borderBottom)) != null ? _d : "0 solid black",
|
|
2888
|
+
borderLeft: (_e = borderSideToString2(border == null ? void 0 : border.borderLeft)) != null ? _e : "0 solid black"
|
|
2093
2889
|
}), properties.includes(StyleControlProperty.BorderRadius) && {
|
|
2094
2890
|
borderTopLeftRadius: (_f = borderRadiusToString(borderRadius == null ? void 0 : borderRadius.borderTopLeftRadius)) != null ? _f : 0,
|
|
2095
2891
|
borderTopRightRadius: (_g = borderRadiusToString(borderRadius == null ? void 0 : borderRadius.borderTopRightRadius)) != null ? _g : 0,
|
|
@@ -2105,7 +2901,7 @@ function useStyleControlCssObject(style, controlDefinition) {
|
|
|
2105
2901
|
return null;
|
|
2106
2902
|
return lengthPercentageDataToString(widthProperty);
|
|
2107
2903
|
}
|
|
2108
|
-
function
|
|
2904
|
+
function borderSideToString2(borderSide) {
|
|
2109
2905
|
if (borderSide == null)
|
|
2110
2906
|
return null;
|
|
2111
2907
|
const { width, color, style: style2 } = borderSide;
|
|
@@ -2350,13 +3146,13 @@ function useSlot(data, control) {
|
|
|
2350
3146
|
}, element.key))
|
|
2351
3147
|
});
|
|
2352
3148
|
}
|
|
2353
|
-
function Slot(
|
|
2354
|
-
var
|
|
3149
|
+
function Slot(_f) {
|
|
3150
|
+
var _g = _f, {
|
|
2355
3151
|
as,
|
|
2356
3152
|
control,
|
|
2357
3153
|
children,
|
|
2358
3154
|
className
|
|
2359
|
-
} =
|
|
3155
|
+
} = _g, restOfProps = __objRest(_g, [
|
|
2360
3156
|
"as",
|
|
2361
3157
|
"control",
|
|
2362
3158
|
"children",
|
|
@@ -2385,15 +3181,15 @@ function Slot(_e) {
|
|
|
2385
3181
|
}
|
|
2386
3182
|
Slot.Placeholder = SlotPlaceholder;
|
|
2387
3183
|
Slot.Item = SlotItem;
|
|
2388
|
-
function SlotItem(
|
|
2389
|
-
var
|
|
3184
|
+
function SlotItem(_h) {
|
|
3185
|
+
var _i = _h, {
|
|
2390
3186
|
as,
|
|
2391
3187
|
control,
|
|
2392
3188
|
grid,
|
|
2393
3189
|
index,
|
|
2394
3190
|
children,
|
|
2395
3191
|
className
|
|
2396
|
-
} =
|
|
3192
|
+
} = _i, restOfProps = __objRest(_i, [
|
|
2397
3193
|
"as",
|
|
2398
3194
|
"control",
|
|
2399
3195
|
"grid",
|
|
@@ -2405,7 +3201,7 @@ function SlotItem(_g) {
|
|
|
2405
3201
|
const [element, setElement] = useState(null);
|
|
2406
3202
|
const baseClassName = useStyle(__spreadValues({
|
|
2407
3203
|
display: "flex"
|
|
2408
|
-
},
|
|
3204
|
+
}, useResponsiveStyle([grid], ([{
|
|
2409
3205
|
count = 12,
|
|
2410
3206
|
spans = [[12]]
|
|
2411
3207
|
} = {}]) => {
|
|
@@ -2579,24 +3375,24 @@ function ControlValue({
|
|
|
2579
3375
|
}
|
|
2580
3376
|
}
|
|
2581
3377
|
function useWidthStyle(value, descriptor) {
|
|
2582
|
-
return useStyle(
|
|
3378
|
+
return useStyle(useResponsiveWidth(value, descriptor.options.defaultValue));
|
|
2583
3379
|
}
|
|
2584
3380
|
function usePaddingStyle(value) {
|
|
2585
|
-
return useStyle(
|
|
3381
|
+
return useStyle(useResponsivePadding(value));
|
|
2586
3382
|
}
|
|
2587
3383
|
function useMarginStyle(value) {
|
|
2588
|
-
return useStyle(
|
|
3384
|
+
return useStyle(useResponsiveMargin(value));
|
|
2589
3385
|
}
|
|
2590
3386
|
function useBorderRadiusStyle(value) {
|
|
2591
|
-
return useStyle(
|
|
3387
|
+
return useStyle(useResponsiveBorderRadius(value));
|
|
2592
3388
|
}
|
|
2593
3389
|
function useShadowsStyle(value) {
|
|
2594
3390
|
const shadowValue = useBoxShadow(value);
|
|
2595
|
-
return useStyle(
|
|
3391
|
+
return useStyle(useResponsiveShadow(shadowValue != null ? shadowValue : void 0));
|
|
2596
3392
|
}
|
|
2597
3393
|
function useBorderStyle(value) {
|
|
2598
3394
|
const borderData = useBorder(value);
|
|
2599
|
-
return useStyle(
|
|
3395
|
+
return useStyle(useResponsiveBorder(borderData != null ? borderData : void 0));
|
|
2600
3396
|
}
|
|
2601
3397
|
function PropsValue({
|
|
2602
3398
|
element,
|
|
@@ -2613,7 +3409,7 @@ function PropsValue({
|
|
|
2613
3409
|
return getPropControllers(state, documentKey, element.key);
|
|
2614
3410
|
});
|
|
2615
3411
|
return Object.entries(propControllerDescriptorsRef.current).reduceRight((renderFn, [propName, descriptor]) => (propsValue) => {
|
|
2616
|
-
var _a2, _b,
|
|
3412
|
+
var _a2, _b, _c2;
|
|
2617
3413
|
switch (descriptor.type) {
|
|
2618
3414
|
case CheckboxControlType:
|
|
2619
3415
|
case NumberControlType:
|
|
@@ -2655,7 +3451,7 @@ function PropsValue({
|
|
|
2655
3451
|
}, descriptor.type);
|
|
2656
3452
|
}
|
|
2657
3453
|
case SlotControlType: {
|
|
2658
|
-
const control = (
|
|
3454
|
+
const control = (_c2 = propControllers == null ? void 0 : propControllers[propName]) != null ? _c2 : null;
|
|
2659
3455
|
return /* @__PURE__ */ jsx(RenderHook, {
|
|
2660
3456
|
hook: useSlot,
|
|
2661
3457
|
parameters: [props[propName], control],
|
|
@@ -2837,41 +3633,74 @@ function isDomNodeHandle(value) {
|
|
|
2837
3633
|
}
|
|
2838
3634
|
return false;
|
|
2839
3635
|
}
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
3636
|
+
class ReactRuntime {
|
|
3637
|
+
constructor({
|
|
3638
|
+
unstable_breakpoints
|
|
3639
|
+
}) {
|
|
3640
|
+
__publicField(this, "store");
|
|
3641
|
+
this.store = configureStore$1({
|
|
3642
|
+
breakpoints: unstable_breakpoints ? parseBreakpointsInput(unstable_breakpoints) : void 0
|
|
3643
|
+
});
|
|
3644
|
+
registerBuiltinComponents(this);
|
|
3645
|
+
}
|
|
3646
|
+
static registerComponent(component, {
|
|
3647
|
+
type,
|
|
3648
|
+
label,
|
|
3649
|
+
icon = "Cube40",
|
|
3650
|
+
hidden = false,
|
|
3651
|
+
props
|
|
3652
|
+
}) {
|
|
3653
|
+
const unregisterComponent = this.store.dispatch(registerComponentEffect(type, {
|
|
2845
3654
|
label,
|
|
2846
|
-
icon
|
|
2847
|
-
hidden
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
3655
|
+
icon,
|
|
3656
|
+
hidden
|
|
3657
|
+
}, props != null ? props : {}));
|
|
3658
|
+
const unregisterReactComponent = this.store.dispatch(registerReactComponentEffect(type, component));
|
|
3659
|
+
return () => {
|
|
3660
|
+
unregisterComponent();
|
|
3661
|
+
unregisterReactComponent();
|
|
3662
|
+
};
|
|
3663
|
+
}
|
|
3664
|
+
static copyElementTree(elementTree2, replacementContext) {
|
|
3665
|
+
return copyElementTree(this.store.getState(), elementTree2, replacementContext);
|
|
3666
|
+
}
|
|
3667
|
+
static getBreakpoints() {
|
|
3668
|
+
return getBreakpoints(this.store.getState());
|
|
3669
|
+
}
|
|
3670
|
+
registerComponent(component, {
|
|
3671
|
+
type,
|
|
3672
|
+
label,
|
|
3673
|
+
icon = "Cube40",
|
|
3674
|
+
hidden = false,
|
|
3675
|
+
props
|
|
3676
|
+
}) {
|
|
3677
|
+
const unregisterComponent = this.store.dispatch(registerComponentEffect(type, {
|
|
3678
|
+
label,
|
|
3679
|
+
icon,
|
|
3680
|
+
hidden
|
|
3681
|
+
}, props != null ? props : {}));
|
|
3682
|
+
const unregisterReactComponent = this.store.dispatch(registerReactComponentEffect(type, component));
|
|
3683
|
+
return () => {
|
|
3684
|
+
unregisterComponent();
|
|
3685
|
+
unregisterReactComponent();
|
|
3686
|
+
};
|
|
3687
|
+
}
|
|
3688
|
+
copyElementTree(elementTree2, replacementContext) {
|
|
3689
|
+
return copyElementTree(this.store.getState(), elementTree2, replacementContext);
|
|
3690
|
+
}
|
|
3691
|
+
getBreakpoints() {
|
|
3692
|
+
return getBreakpoints(this.store.getState());
|
|
3693
|
+
}
|
|
2865
3694
|
}
|
|
2866
|
-
|
|
3695
|
+
__publicField(ReactRuntime, "store", configureStore$1());
|
|
2867
3696
|
registerBuiltinComponents(ReactRuntime);
|
|
2868
|
-
const StoreContext = createContext(
|
|
3697
|
+
const StoreContext = createContext(ReactRuntime.store);
|
|
2869
3698
|
const PreviewProvider = dynamic(() => import("./PreviewProvider.es.js"));
|
|
2870
3699
|
const LiveProvider = dynamic(() => import("./LiveProvider.es.js"));
|
|
2871
|
-
function RuntimeProvider(
|
|
2872
|
-
var
|
|
3700
|
+
function RuntimeProvider(_j) {
|
|
3701
|
+
var _k = _j, {
|
|
2873
3702
|
preview
|
|
2874
|
-
} =
|
|
3703
|
+
} = _k, props = __objRest(_k, [
|
|
2875
3704
|
"preview"
|
|
2876
3705
|
]);
|
|
2877
3706
|
return preview ? /* @__PURE__ */ jsx(PreviewProvider, __spreadValues({}, props)) : /* @__PURE__ */ jsx(LiveProvider, __spreadValues({}, props));
|
|
@@ -2926,6 +3755,9 @@ function useIsPreview() {
|
|
|
2926
3755
|
function useBuilderEditMode() {
|
|
2927
3756
|
return useSelector((state) => getBuilderEditMode(state));
|
|
2928
3757
|
}
|
|
3758
|
+
function useBreakpoints() {
|
|
3759
|
+
return useSelector((state) => getBreakpoints(state));
|
|
3760
|
+
}
|
|
2929
3761
|
function useDispatch() {
|
|
2930
3762
|
const store = useContext(StoreContext);
|
|
2931
3763
|
return store.dispatch;
|
|
@@ -3069,5 +3901,5 @@ const DocumentReference = memo(forwardRef(function DocumentReference2({
|
|
|
3069
3901
|
document: document2
|
|
3070
3902
|
});
|
|
3071
3903
|
}));
|
|
3072
|
-
export { Alignments as A,
|
|
3904
|
+
export { Document$1 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, StoreContext as N, MakeswiftProvider as O, PageProvider as P, useBuilderEditMode as Q, RuntimeProvider as R, Shapes as S, pollBoxModel as T, useTypography as U, getStaticPaths as V, getStaticProps as W, getServerSideProps as X, Page as Y, Makeswift as Z, PreviewModeScript as _, ReactRuntime as a, MakeswiftApiHandler as a0, 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
3905
|
//# sourceMappingURL=index.es.js.map
|