@makeswift/runtime 0.8.11 → 0.9.1
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 +16 -15
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +11 -10
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +13 -12
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +11 -10
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +28 -27
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +7 -6
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +16 -15
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +8 -7
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +13 -12
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +11 -10
- package/dist/Divider.es.js.map +1 -1
- package/dist/Embed.cjs.js +4 -29
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +3 -28
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +52 -51
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +8 -7
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +9 -8
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +8 -7
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +6 -5
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +8 -7
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +28 -27
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +7 -6
- package/dist/Navigation.es.js.map +1 -1
- package/dist/PreviewProvider.cjs.js +23 -7
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +24 -8
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +22 -20
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +18 -16
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +19 -17
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +16 -14
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +8 -7
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +6 -5
- package/dist/Root.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +15 -14
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +11 -10
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Text.cjs.js +5 -4
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +6 -5
- package/dist/Text.es.js.map +1 -1
- package/dist/Video.cjs.js +4 -29
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +3 -28
- package/dist/Video.es.js.map +1 -1
- package/dist/actions.cjs.js +16 -1
- package/dist/actions.cjs.js.map +1 -1
- package/dist/actions.es.js +14 -2
- package/dist/actions.es.js.map +1 -1
- package/dist/builder.cjs.js +5 -0
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +5 -0
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +10 -9
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +10 -9
- package/dist/components.es.js.map +1 -1
- package/dist/control-serialization.cjs.js +89 -10
- package/dist/control-serialization.cjs.js.map +1 -1
- package/dist/control-serialization.es.js +90 -11
- package/dist/control-serialization.es.js.map +1 -1
- package/dist/controls.cjs.js +12 -3
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +6 -2
- package/dist/controls.es.js.map +1 -1
- package/dist/deepEqual.cjs.js +40 -0
- package/dist/deepEqual.cjs.js.map +1 -0
- package/dist/deepEqual.es.js +39 -0
- package/dist/deepEqual.es.js.map +1 -0
- package/dist/index.cjs.js +298 -292
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs10.js +18 -16
- package/dist/index.cjs10.js.map +1 -1
- package/dist/index.cjs2.js +14 -14
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs4.js +2 -1
- package/dist/index.cjs4.js.map +1 -1
- package/dist/index.cjs5.js +0 -522
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs6.js +1 -2
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +0 -52
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.cjs8.js +5 -4
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.cjs9.js +72 -69
- package/dist/index.cjs9.js.map +1 -1
- package/dist/index.es.js +282 -275
- package/dist/index.es.js.map +1 -1
- package/dist/index.es10.js +16 -14
- package/dist/index.es10.js.map +1 -1
- package/dist/index.es2.js +3 -3
- package/dist/index.es3.js +1 -1
- package/dist/index.es4.js +2 -1
- package/dist/index.es4.js.map +1 -1
- package/dist/index.es5.js +2 -514
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es6.js +1 -2
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es7.js +2 -53
- package/dist/index.es7.js.map +1 -1
- package/dist/index.es8.js +5 -4
- package/dist/index.es8.js.map +1 -1
- package/dist/index.es9.js +74 -71
- package/dist/index.es9.js.map +1 -1
- package/dist/leaf.cjs.js +1 -1
- package/dist/leaf.cjs.js.map +1 -1
- package/dist/leaf.es.js +2 -2
- package/dist/main.cjs.js +8 -0
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +7 -2
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +5 -4
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +6 -5
- package/dist/next.es.js.map +1 -1
- package/dist/prop-controllers.cjs.js +5 -0
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +5 -0
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/react-page.cjs.js +1013 -190
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +968 -185
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +5 -4
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +5 -4
- package/dist/react.es.js.map +1 -1
- package/dist/slate.cjs.js +96 -14
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +89 -6
- package/dist/slate.es.js.map +1 -1
- package/dist/types/src/api/graphql/documents/queries.d.ts.map +1 -1
- package/dist/types/src/api/graphql/generated/types.d.ts +0 -8
- package/dist/types/src/api/graphql/generated/types.d.ts.map +1 -1
- package/dist/types/src/builder/serialization/control-serialization.d.ts +3 -3
- package/dist/types/src/builder/serialization/control-serialization.d.ts.map +1 -1
- package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts +2 -2
- package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/builder/serialization/controls/style-v2.d.ts +5 -0
- package/dist/types/src/builder/serialization/controls/style-v2.d.ts.map +1 -0
- package/dist/types/src/components/builtin/Button/Button.d.ts +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/Divider/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Embed/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/register.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/ReadOnlyText.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/components/Element/block.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Video/register.d.ts.map +1 -1
- package/dist/types/src/components/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
- package/dist/types/src/components/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -1
- package/dist/types/src/controls/control.d.ts +3 -2
- package/dist/types/src/controls/control.d.ts.map +1 -1
- package/dist/types/src/controls/index.d.ts +1 -0
- package/dist/types/src/controls/index.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +10 -5
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/controls/style-v2.d.ts +55 -0
- package/dist/types/src/controls/style-v2.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/handlers/manifest.d.ts +3 -1
- package/dist/types/src/next/api-handler/handlers/manifest.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/handlers/proxy-preview-mode.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/index.d.ts +2 -1
- package/dist/types/src/next/api-handler/index.d.ts.map +1 -1
- package/dist/types/src/next/client.d.ts +7 -7
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/next/index.d.ts +8 -5
- package/dist/types/src/next/index.d.ts.map +1 -1
- package/dist/types/src/next/preview-mode.d.ts +17 -3
- package/dist/types/src/next/preview-mode.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts +4 -3
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/instances.d.ts +2 -2
- package/dist/types/src/prop-controllers/instances.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts +3 -2
- package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts +2 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/style-v2.d.ts +4 -0
- package/dist/types/src/runtimes/react/controls/style-v2.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/index.d.ts +3 -1
- package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/constants.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/dedent.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/indent.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/index.d.ts +29 -3
- package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/toggleList.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/unwrapList.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/utils/filterForSubtreeRoots.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/utils/getSelectedListItems.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/utils/location.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/wrapList.d.ts.map +1 -0
- package/dist/types/src/slate/InlineModePlugin/index.d.ts +2 -1
- package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts +9 -0
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/index.d.ts +1 -1
- package/dist/types/src/slate/index.d.ts.map +1 -1
- package/dist/types/src/slate/types.d.ts +18 -0
- package/dist/types/src/slate/types.d.ts.map +1 -1
- package/dist/types/src/slate/utils/element.d.ts +1 -2
- package/dist/types/src/slate/utils/element.d.ts.map +1 -1
- package/dist/types/src/state/actions.d.ts +26 -1
- package/dist/types/src/state/actions.d.ts.map +1 -1
- package/dist/types/src/state/modules/components-meta.d.ts +25 -1
- package/dist/types/src/state/modules/components-meta.d.ts.map +1 -1
- package/dist/types/src/state/modules/locales.d.ts +16 -0
- package/dist/types/src/state/modules/locales.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/useMediaQuery.es.js +1 -1
- package/package.json +6 -3
- package/dist/select.cjs.js +0 -8
- package/dist/select.cjs.js.map +0 -1
- package/dist/select.es.js +0 -6
- package/dist/select.es.js.map +0 -1
- package/dist/types/src/slate/ListPlugin/constants.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/dedent.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/indent.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/index.d.ts +0 -17
- package/dist/types/src/slate/ListPlugin/index.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/toggleList.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/unwrapList.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/utils/filterForSubtreeRoots.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/utils/getSelectedListItems.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/utils/location.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/wrapList.d.ts.map +0 -1
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/constants.d.ts +0 -0
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/dedent.d.ts +0 -0
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/indent.d.ts +0 -0
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/toggleList.d.ts +0 -0
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/unwrapList.d.ts +0 -0
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/utils/filterForSubtreeRoots.d.ts +0 -0
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/utils/getSelectedListItems.d.ts +0 -0
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/utils/location.d.ts +0 -0
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/wrapList.d.ts +0 -0
package/dist/index.es.js
CHANGED
|
@@ -34,34 +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;
|
|
38
37
|
import * as React from "react";
|
|
39
38
|
import { useEffect, createContext, useContext, useState, useMemo, useRef, Children, createElement, forwardRef, memo, useId, useCallback, useImperativeHandle, Component, Suspense } from "react";
|
|
40
39
|
import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector";
|
|
41
40
|
import dynamic from "next/dynamic";
|
|
42
|
-
import { a as createDocumentReference, g as getPropControllerDescriptors, b as isElementReference, e as getElementSwatchIds, f as getFileIds, h as getTypographyIds, j as getTableIds, k as getPageIds, l as getElementChildren, S as ShapeControlType, L as ListControlType, m as Types, E as ElementID, B as Backgrounds, W as Width, n as ResponsiveIconRadioGroup, M as Margin, P as Padding, o as Border, p as BorderRadius, q as Shadows, G as GapY, r as GapX, s as ResponsiveSelect, t as ResponsiveNumber,
|
|
43
|
-
import { A as ActionTypes,
|
|
44
|
-
import { cache, cx } from "@emotion/css";
|
|
45
|
-
import { serializeStyles } from "@emotion/serialize";
|
|
46
|
-
import { registerStyles, insertStyles } from "@emotion/utils";
|
|
41
|
+
import { a as createDocumentReference, g as getPropControllerDescriptors, b as isElementReference, e as getElementSwatchIds, f as getFileIds, h as getTypographyIds, j as getTableIds, k as getPageIds, l as getElementChildren, S as ShapeControlType, L as ListControlType, m as Types, E as ElementID, B as Backgrounds, W as Width, n as ResponsiveIconRadioGroup, M as Margin, P as Padding, o as Border, p as BorderRadius, q as Shadows, G as GapY, r as GapX, s as ResponsiveSelect, t as ResponsiveNumber, u as Checkbox, v as Grid, w as TextInput, x as Link, y as ResponsiveColor, z as TextStyle, C as ComponentIcon, I as Images, N as Number$1, D as Date$1, F as Font, A as ResponsiveLength, H as TextArea, J as Table, K as TableFormFields, O as Image, Q as ResponsiveOpacity, U as NavigationLinks, V as SocialLinks, X as RichText, Y as Video, Z as useStyle, _ as getBorderSwatchIds, $ as isNonNullable, a0 as getBoxShadowsSwatchIds, a1 as getResponsiveColorSwatchIds, a2 as StyleControlProperty, a3 as ImageControlValueFormat, a4 as isPropControllersHandle, a5 as StyleV2ControlType, a6 as StyleControlType, a7 as RichTextV2ControlType, a8 as RichTextControlType, a9 as SlotControlType, aa as LinkControlType, ab as ImageControlType, ac as ColorControlType, ad as SelectControlType, ae as getComponentPropControllerDescriptors, af as getPropControllers, ag as BorderPropControllerFormat, ah as ShadowsPropControllerFormat, ai as BorderRadiusPropControllerFormat, aj as MarginPropControllerFormat, ak as PaddingPropControllerFormat, al as WidthPropControllerFormat, am as configureStore$1, an as copyElementTree, ao as getBreakpoints, ap as getDocument, aq as getElementId, ar as getIsPreview, as as getIsInBuilder, at as getReactComponent, au as getBuilderEditMode } from "./react-page.es.js";
|
|
42
|
+
import { A as ActionTypes, n as apiResourceFulfilled, o as registerComponentEffect, p as registerReactComponentEffect, q as registerComponentHandleEffect, t as mountComponentEffect } from "./actions.es.js";
|
|
47
43
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
48
44
|
import { T as TextAreaControlType, a as TextInputControlType, N as NumberControlType, C as CheckboxControlType } from "./text-input.es.js";
|
|
49
45
|
import { C as ComboboxControlType } from "./combobox.es.js";
|
|
50
|
-
import { S as SelectControlType } from "./select.es.js";
|
|
51
46
|
import "slate";
|
|
52
|
-
import "is-hotkey";
|
|
53
47
|
import { getBaseBreakpoint, findBreakpointOverride, DefaultBreakpointID, join, getBreakpoint, getBreakpointMediaQuery, parseBreakpointsInput } from "./state/breakpoints.es.js";
|
|
48
|
+
import "is-hotkey";
|
|
54
49
|
import "slate-react";
|
|
55
50
|
import { useSyncExternalStore } from "use-sync-external-store/shim";
|
|
56
51
|
import { createStore, applyMiddleware } from "redux";
|
|
57
52
|
import thunk from "redux-thunk";
|
|
58
53
|
import { A as APIResourceType } from "./types.es.js";
|
|
54
|
+
import { d as deepEqual } from "./deepEqual.es.js";
|
|
59
55
|
import { g as getBox, i as isMeasurable, m as measure } from "./box-models.es.js";
|
|
60
56
|
import ColorHelper from "color";
|
|
57
|
+
import { cache, cx } from "@emotion/css";
|
|
58
|
+
import "@emotion/serialize";
|
|
59
|
+
import "@emotion/utils";
|
|
61
60
|
import scrollIntoView from "scroll-into-view-if-needed";
|
|
62
61
|
import { findDOMNode } from "react-dom";
|
|
63
62
|
import parse from "html-react-parser";
|
|
64
63
|
import Head from "next/head";
|
|
64
|
+
import { z } from "zod";
|
|
65
65
|
import createEmotionServer from "@emotion/server/create-instance";
|
|
66
66
|
import NextDocument, { Html, Head as Head$1, Main, NextScript } from "next/document";
|
|
67
67
|
import Cors from "cors";
|
|
@@ -72,43 +72,6 @@ import { parse as parse$1 } from "set-cookie-parser";
|
|
|
72
72
|
import { M as MakeswiftComponentType } from "./constants.es.js";
|
|
73
73
|
import { v4 } from "uuid";
|
|
74
74
|
import ipsum from "corporate-ipsum";
|
|
75
|
-
function is(x, y) {
|
|
76
|
-
if (x === y)
|
|
77
|
-
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
78
|
-
return x !== x && y !== y;
|
|
79
|
-
}
|
|
80
|
-
const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
|
|
81
|
-
const shallowEqual = (a, b) => {
|
|
82
|
-
if (is(a, b))
|
|
83
|
-
return true;
|
|
84
|
-
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
85
|
-
return false;
|
|
86
|
-
const keysA = Object.keys(a);
|
|
87
|
-
const keysB = Object.keys(b);
|
|
88
|
-
if (keysA.length !== keysB.length)
|
|
89
|
-
return false;
|
|
90
|
-
for (let i = 0; i < keysA.length; i += 1) {
|
|
91
|
-
if (!hasOwnProperty$1.call(b, keysA[i]) || !is(a[keysA[i]], b[keysA[i]]))
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
return true;
|
|
95
|
-
};
|
|
96
|
-
const { hasOwnProperty } = Object.prototype;
|
|
97
|
-
const deepEqual = (a, b) => {
|
|
98
|
-
if (shallowEqual(a, b))
|
|
99
|
-
return true;
|
|
100
|
-
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
101
|
-
return false;
|
|
102
|
-
const keysA = Object.keys(a);
|
|
103
|
-
const keysB = Object.keys(b);
|
|
104
|
-
if (keysA.length !== keysB.length)
|
|
105
|
-
return false;
|
|
106
|
-
for (let i = 0; i < keysA.length; i += 1) {
|
|
107
|
-
if (!hasOwnProperty.call(b, keysA[i]) || !deepEqual(a[keysA[i]], b[keysA[i]]))
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
return true;
|
|
111
|
-
};
|
|
112
75
|
const SCRIPT_TAG = "script";
|
|
113
76
|
function BodySnippet({
|
|
114
77
|
code,
|
|
@@ -281,15 +244,6 @@ class GraphQLClient {
|
|
|
281
244
|
return body.data;
|
|
282
245
|
}
|
|
283
246
|
}
|
|
284
|
-
const SwatchFragment = `
|
|
285
|
-
fragment Swatch on Swatch {
|
|
286
|
-
__typename
|
|
287
|
-
id
|
|
288
|
-
hue
|
|
289
|
-
saturation
|
|
290
|
-
lightness
|
|
291
|
-
}
|
|
292
|
-
`;
|
|
293
247
|
const FileFragment = `
|
|
294
248
|
fragment File on File {
|
|
295
249
|
__typename
|
|
@@ -373,16 +327,7 @@ const TableFragment = `
|
|
|
373
327
|
}
|
|
374
328
|
`;
|
|
375
329
|
const IntrospectedResourcesQuery = `
|
|
376
|
-
query IntrospectedResources(
|
|
377
|
-
$swatchIds: [ID!]!
|
|
378
|
-
$fileIds: [ID!]!
|
|
379
|
-
$pageIds: [ID!]!
|
|
380
|
-
$tableIds: [ID!]!
|
|
381
|
-
) {
|
|
382
|
-
swatches(ids: $swatchIds) {
|
|
383
|
-
...Swatch
|
|
384
|
-
}
|
|
385
|
-
|
|
330
|
+
query IntrospectedResources($fileIds: [ID!]!, $pageIds: [ID!]!, $tableIds: [ID!]!) {
|
|
386
331
|
files(ids: $fileIds) {
|
|
387
332
|
...File
|
|
388
333
|
}
|
|
@@ -396,20 +341,10 @@ const IntrospectedResourcesQuery = `
|
|
|
396
341
|
}
|
|
397
342
|
}
|
|
398
343
|
|
|
399
|
-
${SwatchFragment}
|
|
400
344
|
${FileFragment}
|
|
401
345
|
${PagePathnameSliceFragment}
|
|
402
346
|
${TableFragment}
|
|
403
347
|
`;
|
|
404
|
-
const SwatchQuery = `
|
|
405
|
-
query Swatch($swatchId: ID!) {
|
|
406
|
-
swatch(id: $swatchId) {
|
|
407
|
-
...Swatch
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
${SwatchFragment}
|
|
412
|
-
`;
|
|
413
348
|
const FileQuery = `
|
|
414
349
|
query File($fileId: ID!) {
|
|
415
350
|
file(id: $fileId) {
|
|
@@ -758,12 +693,120 @@ function useCachedSite(siteId) {
|
|
|
758
693
|
const site = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
759
694
|
return site;
|
|
760
695
|
}
|
|
696
|
+
const makeswiftSiteVersionSchema = z.enum(["Live", "Working"]);
|
|
697
|
+
const MakeswiftSiteVersion = makeswiftSiteVersionSchema.Enum;
|
|
698
|
+
const makeswiftPreviewDataSchema = z.object({
|
|
699
|
+
makeswift: z.literal(true),
|
|
700
|
+
unstable_siteVersion: makeswiftSiteVersionSchema
|
|
701
|
+
});
|
|
702
|
+
function getMakeswiftSiteVersion(previewData) {
|
|
703
|
+
const result = makeswiftPreviewDataSchema.safeParse(previewData);
|
|
704
|
+
if (result.success)
|
|
705
|
+
return result.data.unstable_siteVersion;
|
|
706
|
+
return null;
|
|
707
|
+
}
|
|
708
|
+
function PreviewModeScript({
|
|
709
|
+
isPreview = false,
|
|
710
|
+
appOrigin = "https://app.makeswift.com"
|
|
711
|
+
}) {
|
|
712
|
+
const previewModeScript = `
|
|
713
|
+
const isPreview = ${isPreview}
|
|
714
|
+
const appOrigin = '${appOrigin.replace("'", "\\'")}'
|
|
715
|
+
const searchParamName = 'x-makeswift-preview-mode'
|
|
716
|
+
const headerName = 'X-Makeswift-Preview-Mode'
|
|
717
|
+
const originalUrl = new URL(window.location.href)
|
|
718
|
+
|
|
719
|
+
if (window.parent !== window) {
|
|
720
|
+
window.addEventListener('message', event => {
|
|
721
|
+
if (event.origin === appOrigin && event.data.type === 'makeswift_preview_mode') {
|
|
722
|
+
const { secret } = event.data
|
|
723
|
+
|
|
724
|
+
if (!isPreview && !originalUrl.searchParams.has(searchParamName)) {
|
|
725
|
+
const url = new URL(originalUrl)
|
|
726
|
+
|
|
727
|
+
url.searchParams.set(searchParamName, secret)
|
|
728
|
+
|
|
729
|
+
window.location.replace(url)
|
|
730
|
+
} else {
|
|
731
|
+
const originalFetch = window.fetch
|
|
732
|
+
|
|
733
|
+
window.fetch = function patchedFetch(resource, options) {
|
|
734
|
+
const request = new Request(resource, options)
|
|
735
|
+
|
|
736
|
+
if (new URL(request.url).origin !== window.location.origin) {
|
|
737
|
+
return originalFetch.call(this, resource, options)
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
return originalFetch.call(
|
|
741
|
+
this,
|
|
742
|
+
new Request(request, { headers: { [headerName]: secret } }),
|
|
743
|
+
)
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
})
|
|
748
|
+
|
|
749
|
+
window.parent.postMessage({ type: 'makeswift_preview_mode' }, appOrigin)
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
if (originalUrl.searchParams.has(searchParamName)) {
|
|
753
|
+
const url = new URL(originalUrl)
|
|
754
|
+
|
|
755
|
+
url.searchParams.delete(searchParamName)
|
|
756
|
+
|
|
757
|
+
window.history.replaceState(null, '', url)
|
|
758
|
+
}
|
|
759
|
+
`;
|
|
760
|
+
const makeswiftConnectionCheckScript = `
|
|
761
|
+
const appOrigin = '${appOrigin.replace("'", "\\'")}'
|
|
762
|
+
|
|
763
|
+
if (window.parent !== window) {
|
|
764
|
+
window.addEventListener('message', event => {
|
|
765
|
+
if (
|
|
766
|
+
event.origin === appOrigin &&
|
|
767
|
+
event.data.type === '${ActionTypes.MAKESWIFT_CONNECTION_INIT}'
|
|
768
|
+
) {
|
|
769
|
+
setInterval(() => {
|
|
770
|
+
window.parent.postMessage({
|
|
771
|
+
type: '${ActionTypes.MAKESWIFT_CONNECTION_CHECK}',
|
|
772
|
+
payload: {
|
|
773
|
+
currentUrl: window.location.href
|
|
774
|
+
}
|
|
775
|
+
}, appOrigin)
|
|
776
|
+
}, 20)
|
|
777
|
+
}
|
|
778
|
+
})
|
|
779
|
+
|
|
780
|
+
window.parent.postMessage({ type: '${ActionTypes.MAKESWIFT_CONNECTION_INIT}' }, appOrigin)
|
|
781
|
+
}
|
|
782
|
+
`;
|
|
783
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
784
|
+
children: [/* @__PURE__ */ jsx("script", {
|
|
785
|
+
id: "makeswift-preview-mode",
|
|
786
|
+
type: "module",
|
|
787
|
+
dangerouslySetInnerHTML: {
|
|
788
|
+
__html: previewModeScript
|
|
789
|
+
}
|
|
790
|
+
}), /* @__PURE__ */ jsx("script", {
|
|
791
|
+
id: "makeswift-connection-check",
|
|
792
|
+
type: "module",
|
|
793
|
+
dangerouslySetInnerHTML: {
|
|
794
|
+
__html: makeswiftConnectionCheckScript
|
|
795
|
+
}
|
|
796
|
+
})]
|
|
797
|
+
});
|
|
798
|
+
}
|
|
761
799
|
class Makeswift {
|
|
762
|
-
constructor(apiKey, {
|
|
800
|
+
constructor(apiKey, {
|
|
801
|
+
apiOrigin = "https://api.makeswift.com",
|
|
802
|
+
runtime = ReactRuntime,
|
|
803
|
+
unstable_previewData
|
|
804
|
+
} = {}) {
|
|
763
805
|
__publicField(this, "apiKey");
|
|
764
806
|
__publicField(this, "apiOrigin");
|
|
765
807
|
__publicField(this, "graphqlClient");
|
|
766
808
|
__publicField(this, "runtime");
|
|
809
|
+
__publicField(this, "siteVersion");
|
|
767
810
|
if (typeof apiKey !== "string") {
|
|
768
811
|
throw new Error(`The Makeswift client must be passed a valid Makeswift site API key: \`new Makeswift('<makeswift_site_api_key>')\`
|
|
769
812
|
Received "${apiKey}" instead.`);
|
|
@@ -776,17 +819,27 @@ Received "${apiKey}" instead.`);
|
|
|
776
819
|
}
|
|
777
820
|
this.graphqlClient = new GraphQLClient(new URL("graphql", apiOrigin).href);
|
|
778
821
|
this.runtime = runtime;
|
|
822
|
+
this.siteVersion = getMakeswiftSiteVersion(unstable_previewData);
|
|
779
823
|
}
|
|
780
824
|
async fetch(path, init) {
|
|
825
|
+
var _a;
|
|
781
826
|
const response = await fetch(new URL(path, this.apiOrigin).toString(), __spreadProps(__spreadValues({}, init), {
|
|
782
|
-
headers:
|
|
827
|
+
headers: __spreadValues({
|
|
828
|
+
["X-API-Key"]: this.apiKey,
|
|
829
|
+
"Makeswift-Site-API-Key": this.apiKey,
|
|
830
|
+
"Makeswift-Site-Version": (_a = this.siteVersion) != null ? _a : MakeswiftSiteVersion.Live
|
|
831
|
+
}, init == null ? void 0 : init.headers)
|
|
783
832
|
}));
|
|
784
833
|
return response;
|
|
785
834
|
}
|
|
786
|
-
async getPages(
|
|
787
|
-
const
|
|
788
|
-
|
|
835
|
+
async getPages() {
|
|
836
|
+
const response = await this.fetch(`/v2/pages`, {
|
|
837
|
+
headers: {
|
|
838
|
+
"Makeswift-Site-Version": MakeswiftSiteVersion.Live
|
|
839
|
+
}
|
|
840
|
+
});
|
|
789
841
|
if (!response.ok) {
|
|
842
|
+
console.error("Failed to get pages", await response.json());
|
|
790
843
|
throw new Error(`Failed to get pages with error: "${response.statusText}"`);
|
|
791
844
|
}
|
|
792
845
|
const json = await response.json();
|
|
@@ -796,13 +849,35 @@ Received "${apiKey}" instead.`);
|
|
|
796
849
|
const result = await this.graphqlClient.request(TypographiesQuery, { typographyIds });
|
|
797
850
|
return result.typographies;
|
|
798
851
|
}
|
|
799
|
-
async
|
|
852
|
+
async getSwatches(ids, preview) {
|
|
853
|
+
var _a;
|
|
854
|
+
const url = new URL(`v1/swatches/bulk`, this.apiOrigin);
|
|
855
|
+
ids.forEach((id) => {
|
|
856
|
+
url.searchParams.append("ids", id);
|
|
857
|
+
});
|
|
858
|
+
const response = await this.fetch(url.pathname + url.search, {
|
|
859
|
+
headers: {
|
|
860
|
+
"Makeswift-Site-Version": (_a = this.siteVersion) != null ? _a : preview ? MakeswiftSiteVersion.Working : MakeswiftSiteVersion.Live
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
if (!response.ok) {
|
|
864
|
+
console.error("Failed to get swatches", await response.json());
|
|
865
|
+
return [];
|
|
866
|
+
}
|
|
867
|
+
return await response.json();
|
|
868
|
+
}
|
|
869
|
+
async getIntrospectedResources(_a, preview) {
|
|
870
|
+
var _b = _a, {
|
|
871
|
+
swatchIds
|
|
872
|
+
} = _b, introspectedResourceIds = __objRest(_b, [
|
|
873
|
+
"swatchIds"
|
|
874
|
+
]);
|
|
800
875
|
const result = await this.graphqlClient.request(IntrospectedResourcesQuery, introspectedResourceIds);
|
|
801
|
-
|
|
876
|
+
const swatches = await this.getSwatches(swatchIds, preview);
|
|
877
|
+
return __spreadProps(__spreadValues({}, result), { swatches });
|
|
802
878
|
}
|
|
803
|
-
async introspect(element) {
|
|
804
|
-
|
|
805
|
-
const runtime = (_a = this.runtime) != null ? _a : ReactRuntime;
|
|
879
|
+
async introspect(element, preview) {
|
|
880
|
+
const runtime = this.runtime;
|
|
806
881
|
const descriptors = getPropControllerDescriptors(runtime.store.getState());
|
|
807
882
|
const swatchIds = /* @__PURE__ */ new Set();
|
|
808
883
|
const fileIds = /* @__PURE__ */ new Set();
|
|
@@ -878,8 +953,8 @@ Received "${apiKey}" instead.`);
|
|
|
878
953
|
const typographies = await this.getTypographies([...typographyIds]);
|
|
879
954
|
typographies.forEach((typography) => {
|
|
880
955
|
typography == null ? void 0 : typography.style.forEach((style) => {
|
|
881
|
-
var
|
|
882
|
-
const swatchId = (
|
|
956
|
+
var _a;
|
|
957
|
+
const swatchId = (_a = style.value.color) == null ? void 0 : _a.swatchId;
|
|
883
958
|
if (swatchId != null)
|
|
884
959
|
swatchIds.add(swatchId);
|
|
885
960
|
});
|
|
@@ -889,44 +964,44 @@ Received "${apiKey}" instead.`);
|
|
|
889
964
|
fileIds: [...fileIds],
|
|
890
965
|
tableIds: [...tableIds],
|
|
891
966
|
pageIds: [...pageIds]
|
|
892
|
-
});
|
|
967
|
+
}, preview);
|
|
893
968
|
const pagePathnameSlices = pagePathnamesById.map((pagePathnameSlice) => pagePathnameSlice && __spreadProps(__spreadValues({}, pagePathnameSlice), {
|
|
894
969
|
id: Buffer.from(`Page:${pagePathnameSlice.id}`).toString("base64")
|
|
895
970
|
}));
|
|
896
971
|
return {
|
|
897
972
|
[APIResourceType.Swatch]: [...swatchIds].map((id) => {
|
|
898
|
-
var
|
|
973
|
+
var _a;
|
|
899
974
|
return {
|
|
900
975
|
id,
|
|
901
|
-
value: (
|
|
976
|
+
value: (_a = swatches.find((swatch) => (swatch == null ? void 0 : swatch.id) === id)) != null ? _a : null
|
|
902
977
|
};
|
|
903
978
|
}),
|
|
904
979
|
[APIResourceType.File]: [...fileIds].map((id) => {
|
|
905
|
-
var
|
|
980
|
+
var _a;
|
|
906
981
|
return {
|
|
907
982
|
id,
|
|
908
|
-
value: (
|
|
983
|
+
value: (_a = files.find((file) => (file == null ? void 0 : file.id) === id)) != null ? _a : null
|
|
909
984
|
};
|
|
910
985
|
}),
|
|
911
986
|
[APIResourceType.Typography]: [...typographyIds].map((id) => {
|
|
912
|
-
var
|
|
987
|
+
var _a;
|
|
913
988
|
return {
|
|
914
989
|
id,
|
|
915
|
-
value: (
|
|
990
|
+
value: (_a = typographies.find((typography) => (typography == null ? void 0 : typography.id) === id)) != null ? _a : null
|
|
916
991
|
};
|
|
917
992
|
}),
|
|
918
993
|
[APIResourceType.Table]: [...tableIds].map((id) => {
|
|
919
|
-
var
|
|
994
|
+
var _a;
|
|
920
995
|
return {
|
|
921
996
|
id,
|
|
922
|
-
value: (
|
|
997
|
+
value: (_a = tables.find((table) => (table == null ? void 0 : table.id) === id)) != null ? _a : null
|
|
923
998
|
};
|
|
924
999
|
}),
|
|
925
1000
|
[APIResourceType.PagePathnameSlice]: [...pageIds].map((id) => {
|
|
926
|
-
var
|
|
1001
|
+
var _a;
|
|
927
1002
|
return {
|
|
928
1003
|
id,
|
|
929
|
-
value: (
|
|
1004
|
+
value: (_a = pagePathnameSlices.find((pagePathnameSlice) => (pagePathnameSlice == null ? void 0 : pagePathnameSlice.id) === id)) != null ? _a : null
|
|
930
1005
|
};
|
|
931
1006
|
}),
|
|
932
1007
|
[APIResourceType.GlobalElement]: [...globalElements.entries()].map(([id, value]) => ({
|
|
@@ -935,31 +1010,33 @@ Received "${apiKey}" instead.`);
|
|
|
935
1010
|
}))
|
|
936
1011
|
};
|
|
937
1012
|
}
|
|
938
|
-
async
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
const response = await this.fetch(`/v1/pages/${pageId}/document?${searchParams}`);
|
|
1013
|
+
async getPageSnapshot(pathname, { preview: previewOverride = false } = {}) {
|
|
1014
|
+
var _a;
|
|
1015
|
+
const siteVersion = (_a = this.siteVersion) != null ? _a : previewOverride ? MakeswiftSiteVersion.Working : MakeswiftSiteVersion.Live;
|
|
1016
|
+
const response = await this.fetch(`/v2/pages/${encodeURIComponent(pathname)}/document`, {
|
|
1017
|
+
headers: { "Makeswift-Site-Version": siteVersion }
|
|
1018
|
+
});
|
|
945
1019
|
if (!response.ok) {
|
|
946
1020
|
if (response.status === 404)
|
|
947
1021
|
return null;
|
|
948
|
-
|
|
1022
|
+
console.error("Failed to get page snapshot", await response.json());
|
|
1023
|
+
throw new Error(`Failed to get page snapshot with error: "${response.statusText}"`);
|
|
949
1024
|
}
|
|
950
1025
|
const document2 = await response.json();
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
if (page == null)
|
|
956
|
-
return null;
|
|
957
|
-
const snapshot = this.getPageSnapshotByPageId(page.id, { preview });
|
|
958
|
-
return snapshot;
|
|
1026
|
+
const cacheData = await this.introspect(document2.data, previewOverride);
|
|
1027
|
+
const apiOrigin = this.apiOrigin.href;
|
|
1028
|
+
const preview = siteVersion === MakeswiftSiteVersion.Working;
|
|
1029
|
+
return { document: document2, cacheData, apiOrigin, preview };
|
|
959
1030
|
}
|
|
960
1031
|
async getSwatch(swatchId) {
|
|
961
|
-
const
|
|
962
|
-
|
|
1032
|
+
const response = await this.fetch(`v1/swatches/${swatchId}`);
|
|
1033
|
+
if (!response.ok) {
|
|
1034
|
+
if (response.status !== 404)
|
|
1035
|
+
console.error("Failed to get swatch", await response.json());
|
|
1036
|
+
return null;
|
|
1037
|
+
}
|
|
1038
|
+
const swatch = await response.json();
|
|
1039
|
+
return swatch;
|
|
963
1040
|
}
|
|
964
1041
|
async getFile(fileId) {
|
|
965
1042
|
const result = await this.graphqlClient.request(FileQuery, { fileId });
|
|
@@ -983,97 +1060,6 @@ Received "${apiKey}" instead.`);
|
|
|
983
1060
|
return result.table;
|
|
984
1061
|
}
|
|
985
1062
|
}
|
|
986
|
-
function PreviewModeScript({
|
|
987
|
-
isPreview = false,
|
|
988
|
-
appOrigin = "https://app.makeswift.com"
|
|
989
|
-
}) {
|
|
990
|
-
const previewModeScript = `
|
|
991
|
-
const isPreview = ${isPreview}
|
|
992
|
-
const appOrigin = '${appOrigin.replace("'", "\\'")}'
|
|
993
|
-
const searchParamName = 'x-makeswift-preview-mode'
|
|
994
|
-
const headerName = 'X-Makeswift-Preview-Mode'
|
|
995
|
-
const originalUrl = new URL(window.location.href)
|
|
996
|
-
|
|
997
|
-
if (window.parent !== window) {
|
|
998
|
-
window.addEventListener('message', event => {
|
|
999
|
-
if (event.origin === appOrigin && event.data.type === 'makeswift_preview_mode') {
|
|
1000
|
-
const { secret } = event.data
|
|
1001
|
-
|
|
1002
|
-
if (!isPreview && !originalUrl.searchParams.has(searchParamName)) {
|
|
1003
|
-
const url = new URL(originalUrl)
|
|
1004
|
-
|
|
1005
|
-
url.searchParams.set(searchParamName, secret)
|
|
1006
|
-
|
|
1007
|
-
window.location.replace(url)
|
|
1008
|
-
} else {
|
|
1009
|
-
const originalFetch = window.fetch
|
|
1010
|
-
|
|
1011
|
-
window.fetch = function patchedFetch(resource, options) {
|
|
1012
|
-
const request = new Request(resource, options)
|
|
1013
|
-
|
|
1014
|
-
if (new URL(request.url).origin !== window.location.origin) {
|
|
1015
|
-
return originalFetch.call(this, resource, options)
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
return originalFetch.call(
|
|
1019
|
-
this,
|
|
1020
|
-
new Request(request, { headers: { [headerName]: secret } }),
|
|
1021
|
-
)
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
})
|
|
1026
|
-
|
|
1027
|
-
window.parent.postMessage({ type: 'makeswift_preview_mode' }, appOrigin)
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
if (originalUrl.searchParams.has(searchParamName)) {
|
|
1031
|
-
const url = new URL(originalUrl)
|
|
1032
|
-
|
|
1033
|
-
url.searchParams.delete(searchParamName)
|
|
1034
|
-
|
|
1035
|
-
window.history.replaceState(null, '', url)
|
|
1036
|
-
}
|
|
1037
|
-
`;
|
|
1038
|
-
const makeswiftConnectionCheckScript = `
|
|
1039
|
-
const appOrigin = '${appOrigin.replace("'", "\\'")}'
|
|
1040
|
-
|
|
1041
|
-
if (window.parent !== window) {
|
|
1042
|
-
window.addEventListener('message', event => {
|
|
1043
|
-
if (
|
|
1044
|
-
event.origin === appOrigin &&
|
|
1045
|
-
event.data.type === '${ActionTypes.MAKESWIFT_CONNECTION_INIT}'
|
|
1046
|
-
) {
|
|
1047
|
-
setInterval(() => {
|
|
1048
|
-
window.parent.postMessage({
|
|
1049
|
-
type: '${ActionTypes.MAKESWIFT_CONNECTION_CHECK}',
|
|
1050
|
-
payload: {
|
|
1051
|
-
currentUrl: window.location.href
|
|
1052
|
-
}
|
|
1053
|
-
}, appOrigin)
|
|
1054
|
-
}, 20)
|
|
1055
|
-
}
|
|
1056
|
-
})
|
|
1057
|
-
|
|
1058
|
-
window.parent.postMessage({ type: '${ActionTypes.MAKESWIFT_CONNECTION_INIT}' }, appOrigin)
|
|
1059
|
-
}
|
|
1060
|
-
`;
|
|
1061
|
-
return /* @__PURE__ */ jsxs(Fragment, {
|
|
1062
|
-
children: [/* @__PURE__ */ jsx("script", {
|
|
1063
|
-
id: "makeswift-preview-mode",
|
|
1064
|
-
type: "module",
|
|
1065
|
-
dangerouslySetInnerHTML: {
|
|
1066
|
-
__html: previewModeScript
|
|
1067
|
-
}
|
|
1068
|
-
}), /* @__PURE__ */ jsx("script", {
|
|
1069
|
-
id: "makeswift-connection-check",
|
|
1070
|
-
type: "module",
|
|
1071
|
-
dangerouslySetInnerHTML: {
|
|
1072
|
-
__html: makeswiftConnectionCheckScript
|
|
1073
|
-
}
|
|
1074
|
-
})]
|
|
1075
|
-
});
|
|
1076
|
-
}
|
|
1077
1063
|
class Document$1 extends NextDocument {
|
|
1078
1064
|
static async getInitialProps(ctx) {
|
|
1079
1065
|
const initialProps = await NextDocument.getInitialProps(ctx);
|
|
@@ -1128,8 +1114,8 @@ async function fonts(_req, res, { getFonts } = {}) {
|
|
|
1128
1114
|
const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
|
|
1129
1115
|
return res.json(fonts2);
|
|
1130
1116
|
}
|
|
1131
|
-
const version = "0.
|
|
1132
|
-
async function handler(req, res, { apiKey }) {
|
|
1117
|
+
const version = "0.9.1";
|
|
1118
|
+
async function handler(req, res, { apiKey, unstable_siteVersions }) {
|
|
1133
1119
|
if (req.query.secret !== apiKey) {
|
|
1134
1120
|
return res.status(401).json({ message: "Unauthorized" });
|
|
1135
1121
|
}
|
|
@@ -1139,7 +1125,8 @@ async function handler(req, res, { apiKey }) {
|
|
|
1139
1125
|
interactionMode: true,
|
|
1140
1126
|
clientSideNavigation: true,
|
|
1141
1127
|
elementFromPoint: false,
|
|
1142
|
-
customBreakpoints: true
|
|
1128
|
+
customBreakpoints: true,
|
|
1129
|
+
unstable_siteVersions
|
|
1143
1130
|
});
|
|
1144
1131
|
}
|
|
1145
1132
|
async function proxyPreviewMode(req, res, { apiKey }) {
|
|
@@ -1170,7 +1157,11 @@ async function proxyPreviewMode(req, res, { apiKey }) {
|
|
|
1170
1157
|
const proto = isForwardedProtoHttps || isForwardedSSL ? "https" : "http";
|
|
1171
1158
|
let target = `${proto}://${host}`;
|
|
1172
1159
|
const secure = process.env["NODE_ENV"] === "production";
|
|
1173
|
-
const
|
|
1160
|
+
const previewData = {
|
|
1161
|
+
makeswift: true,
|
|
1162
|
+
unstable_siteVersion: MakeswiftSiteVersion.Working
|
|
1163
|
+
};
|
|
1164
|
+
const setCookie = res.setPreviewData(previewData).getHeader("Set-Cookie");
|
|
1174
1165
|
res.removeHeader("Set-Cookie");
|
|
1175
1166
|
if (!Array.isArray(setCookie))
|
|
1176
1167
|
return res.status(500).send("Internal Server Error");
|
|
@@ -1212,7 +1203,8 @@ Read more here: https://nextjs.org/blog/next-12-2#on-demand-incremental-static-r
|
|
|
1212
1203
|
function MakeswiftApiHandler(apiKey, {
|
|
1213
1204
|
appOrigin = "https://app.makeswift.com",
|
|
1214
1205
|
apiOrigin = "https://api.makeswift.com",
|
|
1215
|
-
getFonts
|
|
1206
|
+
getFonts,
|
|
1207
|
+
unstable_siteVersions = false
|
|
1216
1208
|
} = {}) {
|
|
1217
1209
|
const cors = Cors({ origin: appOrigin });
|
|
1218
1210
|
if (typeof apiKey !== "string") {
|
|
@@ -1234,12 +1226,12 @@ Received "${apiKey}" instead.`);
|
|
|
1234
1226
|
Received "${makeswift}" for the \`makeswift\` param instead.
|
|
1235
1227
|
Read more about dynamic catch-all routes here: https://nextjs.org/docs/routing/dynamic-routes#catch-all-routes`);
|
|
1236
1228
|
}
|
|
1237
|
-
const client = new Makeswift(apiKey, { apiOrigin });
|
|
1229
|
+
const client = new Makeswift(apiKey, { apiOrigin, unstable_previewData: req.previewData });
|
|
1238
1230
|
const action = "/" + makeswift.join("/");
|
|
1239
1231
|
const matches = (pattern) => match(pattern, { decode: decodeURIComponent })(action);
|
|
1240
1232
|
let m;
|
|
1241
1233
|
if (matches("/manifest"))
|
|
1242
|
-
return handler(req, res, { apiKey });
|
|
1234
|
+
return handler(req, res, { apiKey, unstable_siteVersions });
|
|
1243
1235
|
if (matches("/revalidate"))
|
|
1244
1236
|
return revalidate(req, res, { apiKey });
|
|
1245
1237
|
if (matches("/proxy-preview-mode"))
|
|
@@ -1276,10 +1268,10 @@ function saveForwardedRef(props, ref) {
|
|
|
1276
1268
|
[FORWARDED_NEXT_DYNAMIC_REF_KEY]: ref
|
|
1277
1269
|
});
|
|
1278
1270
|
}
|
|
1279
|
-
function loadForwardedRef(
|
|
1280
|
-
var
|
|
1271
|
+
function loadForwardedRef(_c) {
|
|
1272
|
+
var _d = _c, {
|
|
1281
1273
|
[FORWARDED_NEXT_DYNAMIC_REF_KEY]: ref
|
|
1282
|
-
} =
|
|
1274
|
+
} = _d, props = __objRest(_d, [
|
|
1283
1275
|
__restKey(FORWARDED_NEXT_DYNAMIC_REF_KEY)
|
|
1284
1276
|
]);
|
|
1285
1277
|
return __spreadProps(__spreadValues({}, props), {
|
|
@@ -1342,14 +1334,15 @@ async function getStaticPaths() {
|
|
|
1342
1334
|
}
|
|
1343
1335
|
const REVALIDATE_SECONDS = 1;
|
|
1344
1336
|
async function getStaticProps(ctx) {
|
|
1345
|
-
var _a, _b,
|
|
1337
|
+
var _a, _b, _c;
|
|
1346
1338
|
deprecationWarning("getStaticProps");
|
|
1347
1339
|
const makeswift = new Makeswift(getApiKey(), {
|
|
1348
|
-
apiOrigin: getApiOrigin()
|
|
1340
|
+
apiOrigin: getApiOrigin(),
|
|
1341
|
+
unstable_previewData: ctx.previewData
|
|
1349
1342
|
});
|
|
1350
1343
|
const path = "/" + ((_b = (_a = ctx.params) == null ? void 0 : _a.path) != null ? _b : []).join("/");
|
|
1351
1344
|
const snapshot = await makeswift.getPageSnapshot(path, {
|
|
1352
|
-
preview: ((
|
|
1345
|
+
preview: ((_c = ctx.previewData) == null ? void 0 : _c.makeswift) === true
|
|
1353
1346
|
});
|
|
1354
1347
|
if (snapshot == null)
|
|
1355
1348
|
return {
|
|
@@ -1367,7 +1360,8 @@ async function getServerSideProps(ctx) {
|
|
|
1367
1360
|
var _a, _b;
|
|
1368
1361
|
deprecationWarning("getServerSideProps");
|
|
1369
1362
|
const makeswift = new Makeswift(getApiKey(), {
|
|
1370
|
-
apiOrigin: getApiOrigin()
|
|
1363
|
+
apiOrigin: getApiOrigin(),
|
|
1364
|
+
unstable_previewData: ctx.previewData
|
|
1371
1365
|
});
|
|
1372
1366
|
const path = "/" + ((_b = (_a = ctx.params) == null ? void 0 : _a.path) != null ? _b : []).join("/");
|
|
1373
1367
|
const snapshot = await makeswift.getPageSnapshot(path, {
|
|
@@ -1620,7 +1614,7 @@ function registerComponent$a(runtime) {
|
|
|
1620
1614
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic(() => patch(import("./Carousel.es.js")))), {
|
|
1621
1615
|
type: MakeswiftComponentType.Carousel,
|
|
1622
1616
|
label: "Carousel",
|
|
1623
|
-
icon:
|
|
1617
|
+
icon: ComponentIcon.Carousel,
|
|
1624
1618
|
props: {
|
|
1625
1619
|
id: ElementID(),
|
|
1626
1620
|
images: Images({
|
|
@@ -1718,7 +1712,7 @@ function registerComponent$9(runtime) {
|
|
|
1718
1712
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic(() => patch(import("./Countdown.es.js")))), {
|
|
1719
1713
|
type: MakeswiftComponentType.Countdown,
|
|
1720
1714
|
label: "Countdown",
|
|
1721
|
-
icon:
|
|
1715
|
+
icon: ComponentIcon.Countdown,
|
|
1722
1716
|
props: {
|
|
1723
1717
|
id: ElementID(),
|
|
1724
1718
|
date: Date$1(() => ({
|
|
@@ -1810,7 +1804,7 @@ function registerComponent$8(runtime) {
|
|
|
1810
1804
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic(() => patch(import("./Divider.es.js")))), {
|
|
1811
1805
|
type: MakeswiftComponentType.Divider,
|
|
1812
1806
|
label: "Divider",
|
|
1813
|
-
icon:
|
|
1807
|
+
icon: ComponentIcon.Divider,
|
|
1814
1808
|
props: {
|
|
1815
1809
|
id: ElementID(),
|
|
1816
1810
|
variant: ResponsiveSelect({
|
|
@@ -1842,7 +1836,7 @@ function registerComponent$7(runtime) {
|
|
|
1842
1836
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic(() => patch(import("./Embed.es.js")))), {
|
|
1843
1837
|
type: MakeswiftComponentType.Embed,
|
|
1844
1838
|
label: "Embed",
|
|
1845
|
-
icon:
|
|
1839
|
+
icon: ComponentIcon.Code,
|
|
1846
1840
|
props: {
|
|
1847
1841
|
id: ElementID(),
|
|
1848
1842
|
html: TextArea({ label: "Code", rows: 20 }),
|
|
@@ -1879,7 +1873,7 @@ function registerComponent$6(runtime) {
|
|
|
1879
1873
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic(() => patch(import("./Form.es.js")))), {
|
|
1880
1874
|
type: MakeswiftComponentType.Form,
|
|
1881
1875
|
label: "Form",
|
|
1882
|
-
icon:
|
|
1876
|
+
icon: ComponentIcon.Form,
|
|
1883
1877
|
props: {
|
|
1884
1878
|
id: ElementID(),
|
|
1885
1879
|
tableId: Table(),
|
|
@@ -2024,7 +2018,7 @@ function registerComponent$4(runtime) {
|
|
|
2024
2018
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic(() => patch(import("./Navigation.es.js")))), {
|
|
2025
2019
|
type: MakeswiftComponentType.Navigation,
|
|
2026
2020
|
label: "Navigation",
|
|
2027
|
-
icon:
|
|
2021
|
+
icon: ComponentIcon.Navigation,
|
|
2028
2022
|
props: {
|
|
2029
2023
|
id: ElementID(),
|
|
2030
2024
|
links: NavigationLinks(),
|
|
@@ -2142,7 +2136,7 @@ function registerComponent$2(runtime) {
|
|
|
2142
2136
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic(() => patch(import("./SocialLinks.es.js")))), {
|
|
2143
2137
|
type: MakeswiftComponentType.SocialLinks,
|
|
2144
2138
|
label: "Social Links",
|
|
2145
|
-
icon:
|
|
2139
|
+
icon: ComponentIcon.SocialLinks,
|
|
2146
2140
|
props: {
|
|
2147
2141
|
id: ElementID(),
|
|
2148
2142
|
links: SocialLinks({
|
|
@@ -2349,7 +2343,7 @@ function registerComponent(runtime) {
|
|
|
2349
2343
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic(() => patch(import("./Video.es.js")))), {
|
|
2350
2344
|
type: MakeswiftComponentType.Video,
|
|
2351
2345
|
label: "Video",
|
|
2352
|
-
icon:
|
|
2346
|
+
icon: ComponentIcon.Video,
|
|
2353
2347
|
props: {
|
|
2354
2348
|
id: ElementID(),
|
|
2355
2349
|
video: Video({ preset: { controls: true } }),
|
|
@@ -2392,19 +2386,6 @@ function registerBuiltinComponents(runtime) {
|
|
|
2392
2386
|
unregisterVideoComponent();
|
|
2393
2387
|
};
|
|
2394
2388
|
}
|
|
2395
|
-
const isServer = typeof window === "undefined";
|
|
2396
|
-
const useInsertionEffectSpecifier = "useInsertionEffect";
|
|
2397
|
-
const useInsertionEffect = (_c = React[useInsertionEffectSpecifier]) != null ? _c : React.useLayoutEffect;
|
|
2398
|
-
function useStyle(style) {
|
|
2399
|
-
const serialized = serializeStyles([style], cache.registered);
|
|
2400
|
-
registerStyles(cache, serialized, false);
|
|
2401
|
-
useInsertionEffect(() => {
|
|
2402
|
-
insertStyles(cache, serialized, false);
|
|
2403
|
-
});
|
|
2404
|
-
if (isServer)
|
|
2405
|
-
insertStyles(cache, serialized, false);
|
|
2406
|
-
return `${cache.key}-${serialized.name}`;
|
|
2407
|
-
}
|
|
2408
2389
|
var _path;
|
|
2409
2390
|
function _extends() {
|
|
2410
2391
|
_extends = Object.assign || function(target) {
|
|
@@ -2548,8 +2529,8 @@ function useTable(tableId) {
|
|
|
2548
2529
|
}, [client, tableId]);
|
|
2549
2530
|
return table;
|
|
2550
2531
|
}
|
|
2551
|
-
function mapSideColor(swatches,
|
|
2552
|
-
var
|
|
2532
|
+
function mapSideColor(swatches, _e) {
|
|
2533
|
+
var _f = _e, { color } = _f, restOfSide = __objRest(_f, ["color"]);
|
|
2553
2534
|
return __spreadProps(__spreadValues({}, restOfSide), {
|
|
2554
2535
|
color: color && {
|
|
2555
2536
|
alpha: color.alpha,
|
|
@@ -2645,10 +2626,10 @@ function lengthDataToString(data) {
|
|
|
2645
2626
|
return data;
|
|
2646
2627
|
}
|
|
2647
2628
|
function paddingPropertyDataToStyle(data, defaultValue = {}) {
|
|
2648
|
-
var _a, _b,
|
|
2629
|
+
var _a, _b, _c, _d;
|
|
2649
2630
|
const paddingTop = (_a = data.paddingTop) != null ? _a : defaultValue.paddingTop;
|
|
2650
2631
|
const paddingRight = (_b = data.paddingRight) != null ? _b : defaultValue.paddingRight;
|
|
2651
|
-
const paddingBottom = (
|
|
2632
|
+
const paddingBottom = (_c = data.paddingBottom) != null ? _c : defaultValue.paddingBottom;
|
|
2652
2633
|
const paddingLeft = (_d = data.paddingLeft) != null ? _d : defaultValue.paddingLeft;
|
|
2653
2634
|
const style = {};
|
|
2654
2635
|
if (paddingTop != null)
|
|
@@ -2662,10 +2643,10 @@ function paddingPropertyDataToStyle(data, defaultValue = {}) {
|
|
|
2662
2643
|
return style;
|
|
2663
2644
|
}
|
|
2664
2645
|
function marginPropertyDataToStyle(data, defaultValue = {}) {
|
|
2665
|
-
var _a, _b,
|
|
2646
|
+
var _a, _b, _c, _d;
|
|
2666
2647
|
const marginTop = (_a = data.marginTop) != null ? _a : defaultValue.marginTop;
|
|
2667
2648
|
const marginRight = (_b = data.marginRight) != null ? _b : defaultValue.marginRight;
|
|
2668
|
-
const marginBottom = (
|
|
2649
|
+
const marginBottom = (_c = data.marginBottom) != null ? _c : defaultValue.marginBottom;
|
|
2669
2650
|
const marginLeft = (_d = data.marginLeft) != null ? _d : defaultValue.marginLeft;
|
|
2670
2651
|
const style = {};
|
|
2671
2652
|
if (marginTop != null)
|
|
@@ -2686,10 +2667,10 @@ function lengthPercentageDataToString(data) {
|
|
|
2686
2667
|
return data;
|
|
2687
2668
|
}
|
|
2688
2669
|
function borderRadiusPropertyDataToStyle(data, defaultValue = {}) {
|
|
2689
|
-
var _a, _b,
|
|
2670
|
+
var _a, _b, _c, _d;
|
|
2690
2671
|
const borderTopLeftRadius = (_a = data.borderTopLeftRadius) != null ? _a : defaultValue.borderTopLeftRadius;
|
|
2691
2672
|
const borderTopRightRadius = (_b = data.borderTopRightRadius) != null ? _b : defaultValue.borderTopRightRadius;
|
|
2692
|
-
const borderBottomRightRadius = (
|
|
2673
|
+
const borderBottomRightRadius = (_c = data.borderBottomRightRadius) != null ? _c : defaultValue.borderBottomRightRadius;
|
|
2693
2674
|
const borderBottomLeftRadius = (_d = data.borderBottomLeftRadius) != null ? _d : defaultValue.borderBottomLeftRadius;
|
|
2694
2675
|
const style = {};
|
|
2695
2676
|
if (borderTopLeftRadius != null) {
|
|
@@ -2710,10 +2691,10 @@ function colorToString(color) {
|
|
|
2710
2691
|
return color && color.swatch ? `hsla(${color.swatch.hue},${color.swatch.saturation}%,${color.swatch.lightness}%,${color.alpha})` : "";
|
|
2711
2692
|
}
|
|
2712
2693
|
function borderPropertyDataToStyle(data, defaultValue = {}) {
|
|
2713
|
-
var _a, _b,
|
|
2694
|
+
var _a, _b, _c, _d;
|
|
2714
2695
|
const borderTop = (_a = data.borderTop) != null ? _a : defaultValue.borderTop;
|
|
2715
2696
|
const borderRight = (_b = data.borderRight) != null ? _b : defaultValue.borderRight;
|
|
2716
|
-
const borderBottom = (
|
|
2697
|
+
const borderBottom = (_c = data.borderBottom) != null ? _c : defaultValue.borderBottom;
|
|
2717
2698
|
const borderLeft = (_d = data.borderLeft) != null ? _d : defaultValue.borderLeft;
|
|
2718
2699
|
const style = {};
|
|
2719
2700
|
if (borderTop != null)
|
|
@@ -2867,7 +2848,7 @@ const defaultPadding = {
|
|
|
2867
2848
|
paddingBottom: 0,
|
|
2868
2849
|
paddingLeft: 0
|
|
2869
2850
|
};
|
|
2870
|
-
function useStyleControlCssObject(style, controlDefinition) {
|
|
2851
|
+
function useStyleControlCssObject$1(style, controlDefinition) {
|
|
2871
2852
|
const { properties } = controlDefinition.config;
|
|
2872
2853
|
return __spreadValues(__spreadValues({}, properties.includes(StyleControlProperty.Width) && {
|
|
2873
2854
|
maxWidth: "100%"
|
|
@@ -2879,12 +2860,12 @@ function useStyleControlCssObject(style, controlDefinition) {
|
|
|
2879
2860
|
style == null ? void 0 : style.borderRadius,
|
|
2880
2861
|
style == null ? void 0 : style.textStyle
|
|
2881
2862
|
], ([width, margin, padding, border, borderRadius, textStyle]) => {
|
|
2882
|
-
var _a, _b,
|
|
2863
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2883
2864
|
return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, properties.includes(StyleControlProperty.Width) && {
|
|
2884
2865
|
width: (_a = widthToString(width)) != null ? _a : "100%"
|
|
2885
2866
|
}), properties.includes(StyleControlProperty.Margin) && marginPropertyDataToStyle(margin != null ? margin : defaultMargin, defaultMargin)), properties.includes(StyleControlProperty.Padding) && paddingPropertyDataToStyle(padding != null ? padding : defaultPadding, defaultPadding)), properties.includes(StyleControlProperty.Border) && {
|
|
2886
2867
|
borderTop: (_b = borderSideToString2(border == null ? void 0 : border.borderTop)) != null ? _b : "0 solid black",
|
|
2887
|
-
borderRight: (
|
|
2868
|
+
borderRight: (_c = borderSideToString2(border == null ? void 0 : border.borderRight)) != null ? _c : "0 solid black",
|
|
2888
2869
|
borderBottom: (_d = borderSideToString2(border == null ? void 0 : border.borderBottom)) != null ? _d : "0 solid black",
|
|
2889
2870
|
borderLeft: (_e = borderSideToString2(border == null ? void 0 : border.borderLeft)) != null ? _e : "0 solid black"
|
|
2890
2871
|
}), properties.includes(StyleControlProperty.BorderRadius) && {
|
|
@@ -2918,7 +2899,7 @@ function useStyleControlCssObject(style, controlDefinition) {
|
|
|
2918
2899
|
}
|
|
2919
2900
|
}
|
|
2920
2901
|
function useFormattedStyle(styleControlData, controlDefinition, control) {
|
|
2921
|
-
const style = useStyleControlCssObject(styleControlData, controlDefinition);
|
|
2902
|
+
const style = useStyleControlCssObject$1(styleControlData, controlDefinition);
|
|
2922
2903
|
const guid = useId().replaceAll(":", "");
|
|
2923
2904
|
const styleClassName = useStyle(style);
|
|
2924
2905
|
const classNames = `${styleClassName} ${guid}`;
|
|
@@ -3094,10 +3075,11 @@ function useRichText(data, control) {
|
|
|
3094
3075
|
}
|
|
3095
3076
|
const EditableText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es9.js"))));
|
|
3096
3077
|
const ReadOnlyText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyTextV2.es.js"))));
|
|
3097
|
-
function useRichTextV2(data, control) {
|
|
3078
|
+
function useRichTextV2(data, definition, control) {
|
|
3098
3079
|
const isPreview = useIsPreview();
|
|
3099
3080
|
return isPreview ? /* @__PURE__ */ jsx(EditableText, {
|
|
3100
3081
|
text: data,
|
|
3082
|
+
definition,
|
|
3101
3083
|
control
|
|
3102
3084
|
}) : /* @__PURE__ */ jsx(ReadOnlyText, {
|
|
3103
3085
|
text: data,
|
|
@@ -3159,13 +3141,13 @@ function useSlot(data, control) {
|
|
|
3159
3141
|
}, element.key))
|
|
3160
3142
|
});
|
|
3161
3143
|
}
|
|
3162
|
-
function Slot(
|
|
3163
|
-
var
|
|
3144
|
+
function Slot(_g) {
|
|
3145
|
+
var _h = _g, {
|
|
3164
3146
|
as,
|
|
3165
3147
|
control,
|
|
3166
3148
|
children,
|
|
3167
3149
|
className
|
|
3168
|
-
} =
|
|
3150
|
+
} = _h, restOfProps = __objRest(_h, [
|
|
3169
3151
|
"as",
|
|
3170
3152
|
"control",
|
|
3171
3153
|
"children",
|
|
@@ -3194,15 +3176,15 @@ function Slot(_f) {
|
|
|
3194
3176
|
}
|
|
3195
3177
|
Slot.Placeholder = SlotPlaceholder;
|
|
3196
3178
|
Slot.Item = SlotItem;
|
|
3197
|
-
function SlotItem(
|
|
3198
|
-
var
|
|
3179
|
+
function SlotItem(_i) {
|
|
3180
|
+
var _j = _i, {
|
|
3199
3181
|
as,
|
|
3200
3182
|
control,
|
|
3201
3183
|
grid,
|
|
3202
3184
|
index,
|
|
3203
3185
|
children,
|
|
3204
3186
|
className
|
|
3205
|
-
} =
|
|
3187
|
+
} = _j, restOfProps = __objRest(_j, [
|
|
3206
3188
|
"as",
|
|
3207
3189
|
"control",
|
|
3208
3190
|
"grid",
|
|
@@ -3284,6 +3266,20 @@ function SlotPlaceholder({
|
|
|
3284
3266
|
})
|
|
3285
3267
|
});
|
|
3286
3268
|
}
|
|
3269
|
+
function useStyleControlCssObject(styleControlData, controlDefinition) {
|
|
3270
|
+
var _a;
|
|
3271
|
+
const breakpoints = useBreakpoints();
|
|
3272
|
+
return __spreadValues(__spreadValues({}, controlDefinition.config.getStyle((_a = findBreakpointOverride(breakpoints, styleControlData, getBaseBreakpoint(breakpoints).id)) == null ? void 0 : _a.value)), breakpoints.reduce((styles, breakpoint) => {
|
|
3273
|
+
var _a2;
|
|
3274
|
+
return __spreadProps(__spreadValues({}, styles), {
|
|
3275
|
+
[getBreakpointMediaQuery(breakpoint)]: controlDefinition.config.getStyle((_a2 = findBreakpointOverride(breakpoints, styleControlData, breakpoint.id)) == null ? void 0 : _a2.value)
|
|
3276
|
+
});
|
|
3277
|
+
}, {}));
|
|
3278
|
+
}
|
|
3279
|
+
function useFormattedStyleV2(styleControlData, controlDefinition) {
|
|
3280
|
+
const styles = useStyleControlCssObject(styleControlData, controlDefinition);
|
|
3281
|
+
return useStyle(styles);
|
|
3282
|
+
}
|
|
3287
3283
|
function useTextAreaValue(data, definition) {
|
|
3288
3284
|
return data != null ? data : definition.config.defaultValue;
|
|
3289
3285
|
}
|
|
@@ -3380,7 +3376,7 @@ function ControlValue({
|
|
|
3380
3376
|
case RichTextV2ControlType:
|
|
3381
3377
|
return /* @__PURE__ */ jsx(RenderHook, {
|
|
3382
3378
|
hook: useRichTextV2,
|
|
3383
|
-
parameters: [data, control],
|
|
3379
|
+
parameters: [data, definition, control],
|
|
3384
3380
|
children: (value) => children(value)
|
|
3385
3381
|
}, definition.type);
|
|
3386
3382
|
case StyleControlType:
|
|
@@ -3389,6 +3385,12 @@ function ControlValue({
|
|
|
3389
3385
|
parameters: [data, definition, control],
|
|
3390
3386
|
children: (value) => children(value)
|
|
3391
3387
|
}, definition.type);
|
|
3388
|
+
case StyleV2ControlType:
|
|
3389
|
+
return /* @__PURE__ */ jsx(RenderHook, {
|
|
3390
|
+
hook: useFormattedStyleV2,
|
|
3391
|
+
parameters: [data, definition],
|
|
3392
|
+
children: (value) => children(value)
|
|
3393
|
+
}, definition.type);
|
|
3392
3394
|
default:
|
|
3393
3395
|
return children(data);
|
|
3394
3396
|
}
|
|
@@ -3428,7 +3430,7 @@ function PropsValue({
|
|
|
3428
3430
|
return getPropControllers(state, documentKey, element.key);
|
|
3429
3431
|
});
|
|
3430
3432
|
return Object.entries(propControllerDescriptorsRef.current).reduceRight((renderFn, [propName, descriptor]) => (propsValue) => {
|
|
3431
|
-
var _a2, _b,
|
|
3433
|
+
var _a2, _b, _c, _d;
|
|
3432
3434
|
switch (descriptor.type) {
|
|
3433
3435
|
case CheckboxControlType:
|
|
3434
3436
|
case NumberControlType:
|
|
@@ -3441,6 +3443,7 @@ function PropsValue({
|
|
|
3441
3443
|
case ShapeControlType:
|
|
3442
3444
|
case ListControlType:
|
|
3443
3445
|
case LinkControlType:
|
|
3446
|
+
case StyleV2ControlType:
|
|
3444
3447
|
return /* @__PURE__ */ jsx(ControlValue, {
|
|
3445
3448
|
definition: descriptor,
|
|
3446
3449
|
data: props[propName],
|
|
@@ -3470,10 +3473,10 @@ function PropsValue({
|
|
|
3470
3473
|
}, descriptor.type);
|
|
3471
3474
|
}
|
|
3472
3475
|
case RichTextV2ControlType: {
|
|
3473
|
-
const control = (
|
|
3476
|
+
const control = (_c = propControllers == null ? void 0 : propControllers[propName]) != null ? _c : null;
|
|
3474
3477
|
return /* @__PURE__ */ jsx(RenderHook, {
|
|
3475
3478
|
hook: useRichTextV2,
|
|
3476
|
-
parameters: [props[propName], control],
|
|
3479
|
+
parameters: [props[propName], descriptor, control],
|
|
3477
3480
|
children: (value) => renderFn(__spreadProps(__spreadValues({}, propsValue), {
|
|
3478
3481
|
[propName]: value
|
|
3479
3482
|
}))
|
|
@@ -3664,18 +3667,22 @@ function isDomNodeHandle(value) {
|
|
|
3664
3667
|
}
|
|
3665
3668
|
class ReactRuntime {
|
|
3666
3669
|
constructor({
|
|
3667
|
-
breakpoints
|
|
3668
|
-
|
|
3670
|
+
breakpoints,
|
|
3671
|
+
unstable_i18n
|
|
3672
|
+
} = {}) {
|
|
3669
3673
|
__publicField(this, "store");
|
|
3670
3674
|
this.store = configureStore$1({
|
|
3671
|
-
breakpoints: breakpoints ? parseBreakpointsInput(breakpoints) : void 0
|
|
3675
|
+
breakpoints: breakpoints ? parseBreakpointsInput(breakpoints) : void 0,
|
|
3676
|
+
locales: unstable_i18n ? __spreadProps(__spreadValues({}, unstable_i18n), {
|
|
3677
|
+
locale: null
|
|
3678
|
+
}) : void 0
|
|
3672
3679
|
});
|
|
3673
3680
|
registerBuiltinComponents(this);
|
|
3674
3681
|
}
|
|
3675
3682
|
static registerComponent(component, {
|
|
3676
3683
|
type,
|
|
3677
3684
|
label,
|
|
3678
|
-
icon =
|
|
3685
|
+
icon = ComponentIcon.Code,
|
|
3679
3686
|
hidden = false,
|
|
3680
3687
|
props
|
|
3681
3688
|
}) {
|
|
@@ -3699,7 +3706,7 @@ class ReactRuntime {
|
|
|
3699
3706
|
registerComponent(component, {
|
|
3700
3707
|
type,
|
|
3701
3708
|
label,
|
|
3702
|
-
icon =
|
|
3709
|
+
icon = ComponentIcon.Cube,
|
|
3703
3710
|
hidden = false,
|
|
3704
3711
|
props
|
|
3705
3712
|
}) {
|
|
@@ -3726,10 +3733,10 @@ registerBuiltinComponents(ReactRuntime);
|
|
|
3726
3733
|
const StoreContext = createContext(ReactRuntime.store);
|
|
3727
3734
|
const PreviewProvider = dynamic(() => import("./PreviewProvider.es.js"));
|
|
3728
3735
|
const LiveProvider = dynamic(() => import("./LiveProvider.es.js"));
|
|
3729
|
-
function RuntimeProvider(
|
|
3730
|
-
var
|
|
3736
|
+
function RuntimeProvider(_k) {
|
|
3737
|
+
var _l = _k, {
|
|
3731
3738
|
preview
|
|
3732
|
-
} =
|
|
3739
|
+
} = _l, props = __objRest(_l, [
|
|
3733
3740
|
"preview"
|
|
3734
3741
|
]);
|
|
3735
3742
|
return preview ? /* @__PURE__ */ jsx(PreviewProvider, __spreadValues({}, props)) : /* @__PURE__ */ jsx(LiveProvider, __spreadValues({}, props));
|
|
@@ -3930,5 +3937,5 @@ const DocumentReference = memo(forwardRef(function DocumentReference2({
|
|
|
3930
3937
|
document: document2
|
|
3931
3938
|
});
|
|
3932
3939
|
}));
|
|
3933
|
-
export {
|
|
3940
|
+
export { MakeswiftApiHandler as $, Alignments as A, forwardNextDynamicRef as B, Contrasts as C, DocumentReference as D, Element$1 as E, useIsPreview as F, useFiles as G, useSwatches as H, usePagePathnameSlice as I, useElementId as J, ElementImperativeHandle as K, StoreContext as L, MakeswiftProvider as M, useBuilderEditMode as N, pollBoxModel as O, PageProvider as P, ControlValue as Q, RuntimeProvider as R, Shapes as S, useTypography as T, getStaticPaths as U, getStaticProps as V, getServerSideProps as W, Page as X, Makeswift as Y, PreviewModeScript as Z, Document$1 as _, ReactRuntime as a, 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, useResponsiveStyle as n, useResponsiveWidth as o, useResponsiveTextStyle as p, colorToString as q, useBreakpoints as r, Sizes as s, useFormContext as t, useIsInBuilder as u, useResponsiveGridItem as v, useTable as w, useMakeswiftClient as x, Provider as y, useFile as z };
|
|
3934
3941
|
//# sourceMappingURL=index.es.js.map
|