@makeswift/runtime 0.9.12 → 0.10.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 +3 -0
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +4 -1
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +3 -2
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +4 -3
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +3 -2
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +4 -3
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +3 -0
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +4 -1
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +3 -0
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +4 -1
- package/dist/Divider.es.js.map +1 -1
- package/dist/Embed.cjs.js +1 -0
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +2 -1
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +13 -12
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +5 -4
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +11 -10
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +11 -10
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +3 -0
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +5 -2
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +11 -10
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +11 -10
- package/dist/Navigation.es.js.map +1 -1
- package/dist/PreviewProvider.cjs.js +10 -6
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +9 -5
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +19 -26
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +15 -22
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +29 -26
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +28 -25
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +3 -0
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +4 -1
- package/dist/Root.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +6 -5
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +7 -6
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Text.cjs.js +12 -71
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +13 -64
- package/dist/Text.es.js.map +1 -1
- package/dist/Video.cjs.js +1 -0
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +2 -1
- package/dist/Video.es.js.map +1 -1
- package/dist/actions.cjs.js +2 -2
- package/dist/actions.cjs.js.map +1 -1
- package/dist/actions.es.js +2 -2
- package/dist/actions.es.js.map +1 -1
- package/dist/builder.cjs.js +2 -0
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +2 -0
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +3 -2
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +3 -2
- package/dist/components.es.js.map +1 -1
- package/dist/control-serialization.es.js +1 -1
- package/dist/controls.cjs.js +8 -8
- package/dist/controls.es.js +4 -2
- package/dist/controls.es.js.map +1 -1
- package/dist/index.cjs.js +280 -216
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs3.js +21 -107
- package/dist/index.cjs3.js.map +1 -1
- package/dist/index.cjs4.js +16 -57
- package/dist/index.cjs4.js.map +1 -1
- package/dist/index.cjs5.js +53 -242
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs6.js +0 -41
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +376 -14
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.cjs8.js +275 -11
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.es.js +274 -209
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js +2 -2
- package/dist/index.es3.js +22 -103
- package/dist/index.es3.js.map +1 -1
- package/dist/index.es4.js +16 -57
- package/dist/index.es4.js.map +1 -1
- package/dist/index.es5.js +53 -240
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es6.js +1 -36
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es7.js +372 -16
- package/dist/index.es7.js.map +1 -1
- package/dist/index.es8.js +270 -10
- package/dist/index.es8.js.map +1 -1
- package/dist/main.cjs.js +2 -0
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +2 -0
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +3 -0
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +4 -1
- package/dist/next.es.js.map +1 -1
- package/dist/prop-controllers.cjs.js +2 -0
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +2 -0
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/react-page.cjs.js +1450 -65
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +1427 -66
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +3 -0
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +3 -0
- package/dist/react.es.js.map +1 -1
- package/dist/slate.cjs.js +33 -391
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +15 -376
- package/dist/slate.es.js.map +1 -1
- package/dist/text-input.cjs.js +0 -22
- package/dist/text-input.cjs.js.map +1 -1
- package/dist/text-input.es.js +1 -18
- package/dist/text-input.es.js.map +1 -1
- package/dist/types/src/components/builtin/Text/Text.d.ts +3 -4
- package/dist/types/src/components/builtin/Text/Text.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/register.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/fixtures/v2-data-types.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/rich-text.d.ts +0 -1
- package/dist/types/src/controls/rich-text/rich-text.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/translation.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/plugin.d.ts +29 -0
- package/dist/types/src/controls/rich-text-v2/plugin.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +17 -31
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/index.d.ts.map +1 -1
- package/dist/types/src/next/client.d.ts.map +1 -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/prop-controllers/introspection.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/editable-text.d.ts +4 -3
- package/dist/types/src/runtimes/react/controls/rich-text/EditableText/editable-text.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/EditableText/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/EditableText/useSyncDOMSelection.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/useSyncWithBuilder.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/ReadOnlyText.d.ts +2 -2
- package/dist/types/src/runtimes/react/controls/rich-text/ReadOnlyText.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/block.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text/components/Element/block.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/Element/element.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/Element/index.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/inline.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text/components/Element/inline.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/Leaf/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/Leaf/leaf.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/index.d.ts +2 -0
- package/dist/types/src/runtimes/react/controls/rich-text/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/{rich-text.d.ts → rich-text/rich-text.d.ts} +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text/rich-text.d.ts.map +1 -0
- 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/EditableTextV2/render-element.d.ts +2 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts +2 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/useRemoteChanges.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts +2 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlineModePlugin/index.d.ts +6 -4
- package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlinePlugin/index.d.ts +3 -3
- package/dist/types/src/slate/InlinePlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlinePlugin/types.d.ts +1 -1
- package/dist/types/src/slate/InlinePlugin/types.d.ts.map +1 -1
- package/dist/types/src/slate/LinkPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/LinkPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/LinkPlugin/linkPluginWithoutRenderElement.d.ts +16 -0
- package/dist/types/src/slate/LinkPlugin/linkPluginWithoutRenderElement.d.ts.map +1 -0
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/TypographyPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/types.d.ts +1 -10
- package/dist/types/src/slate/types.d.ts.map +1 -1
- package/dist/types/src/slate/utils/element.d.ts.map +1 -1
- package/dist/types/src/state/actions.d.ts +2 -1
- package/dist/types/src/state/actions.d.ts.map +1 -1
- package/dist/types/src/state/modules/locales.d.ts.map +1 -1
- package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index.cjs10.js +0 -390
- package/dist/index.cjs10.js.map +0 -1
- package/dist/index.cjs9.js +0 -295
- package/dist/index.cjs9.js.map +0 -1
- package/dist/index.es10.js +0 -383
- package/dist/index.es10.js.map +0 -1
- package/dist/index.es9.js +0 -288
- package/dist/index.es9.js.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/index.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/useSyncDOMSelection.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/useSyncWithBuilder.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Element/block.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Element/element.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Element/index.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Element/inline.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Leaf/index.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/index.d.ts.map +0 -1
- package/dist/types/src/runtimes/react/controls/rich-text.d.ts.map +0 -1
- package/dist/types.cjs2.js +0 -765
- package/dist/types.cjs2.js.map +0 -1
- package/dist/types.es2.js +0 -748
- package/dist/types.es2.js.map +0 -1
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/index.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/useSyncDOMSelection.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/element.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/index.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Leaf/index.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Leaf/leaf.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/index.d.ts +0 -0
package/dist/index.es.js
CHANGED
|
@@ -38,10 +38,10 @@ import * as React from "react";
|
|
|
38
38
|
import { useEffect, createContext, useContext, useState, useMemo, useRef, Children, createElement, forwardRef, memo, useId, useCallback, useImperativeHandle, Component, Suspense } from "react";
|
|
39
39
|
import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector";
|
|
40
40
|
import dynamic from "next/dynamic";
|
|
41
|
-
import { a as createDocumentReference, g as getPropControllerDescriptors,
|
|
41
|
+
import { a as deepEqual, b as createDocumentReference, g as getPropControllerDescriptors, e as isElementReference, f as getDefaultLocale, h as getLocales, j as getSwatchIds, k as getFileIds, l as getTypographyIds, m as getTableIds, n as getPageIds, o as getElementChildren, E as ElementID, B as Backgrounds, W as Width, p as ResponsiveIconRadioGroup, M as Margin, P as Padding, q as Border, r as BorderRadius, S as Shadows, G as GapY, s as GapX, t as ResponsiveSelect, u as ResponsiveNumber, v as Checkbox, w as Grid, x as TextInput, L as Link$1, 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 BlockType, Z as Video, _ as useStyle, $ as getBorderSwatchIds, a0 as getBoxShadowsSwatchIds, a1 as getResponsiveColorSwatchIds, a2 as StyleControlProperty, a3 as ImageControlValueFormat, a4 as isPropControllersHandle, a5 as isRichTextV1Data, a6 as isNonNullable$1, a7 as TypographyControlType, a8 as StyleControlType, a9 as RichTextV2ControlType, aa as RichTextControlType, ab as SlotControlType, ac as StyleV2ControlType, ad as ListControlType, ae as ShapeControlType, af as LinkControlType, ag as ImageControlType, ah as IconRadioGroupControlType, ai as ColorControlType, aj as SelectControlType, ak as getComponentPropControllerDescriptors, al as getPropControllers, am as Types, an as BorderPropControllerFormat, ao as ShadowsPropControllerFormat, ap as BorderRadiusPropControllerFormat, aq as MarginPropControllerFormat, ar as PaddingPropControllerFormat, as as WidthPropControllerFormat, at as configureStore$1, au as copyElementTree, av as getBreakpoints, aw as parseLocalesInput, ax as getElementId, ay as getReactComponent, az as getDocument, aA as getIsInBuilder, aB as getBuilderEditMode, aC as getIsPreview } from "./react-page.es.js";
|
|
42
42
|
import { A as ActionTypes, o as apiResourceFulfilled, p as registerComponentEffect, q as registerReactComponentEffect, t as registerComponentHandleEffect, v as mountComponentEffect } from "./actions.es.js";
|
|
43
43
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
44
|
-
import {
|
|
44
|
+
import { T as TextAreaControlType, a as TextInputControlType, N as NumberControlType, C as CheckboxControlType } from "./text-input.es.js";
|
|
45
45
|
import { C as ComboboxControlType } from "./combobox.es.js";
|
|
46
46
|
import "slate";
|
|
47
47
|
import { useSyncExternalStore } from "use-sync-external-store/shim";
|
|
@@ -67,6 +67,9 @@ import { parse as parse$1 } from "set-cookie-parser";
|
|
|
67
67
|
import { M as MakeswiftComponentType } from "./constants.es.js";
|
|
68
68
|
import { v4 } from "uuid";
|
|
69
69
|
import ipsum from "corporate-ipsum";
|
|
70
|
+
import "is-hotkey";
|
|
71
|
+
import "slate-react";
|
|
72
|
+
import NextLink from "next/link";
|
|
70
73
|
const SCRIPT_TAG = "script";
|
|
71
74
|
function BodySnippet({
|
|
72
75
|
code,
|
|
@@ -111,43 +114,6 @@ function BodySnippet({
|
|
|
111
114
|
}, [code, cleanup]);
|
|
112
115
|
return null;
|
|
113
116
|
}
|
|
114
|
-
function is(x, y) {
|
|
115
|
-
if (x === y)
|
|
116
|
-
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
117
|
-
return x !== x && y !== y;
|
|
118
|
-
}
|
|
119
|
-
const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
|
|
120
|
-
const shallowEqual = (a, b) => {
|
|
121
|
-
if (is(a, b))
|
|
122
|
-
return true;
|
|
123
|
-
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
124
|
-
return false;
|
|
125
|
-
const keysA = Object.keys(a);
|
|
126
|
-
const keysB = Object.keys(b);
|
|
127
|
-
if (keysA.length !== keysB.length)
|
|
128
|
-
return false;
|
|
129
|
-
for (let i = 0; i < keysA.length; i += 1) {
|
|
130
|
-
if (!hasOwnProperty$1.call(b, keysA[i]) || !is(a[keysA[i]], b[keysA[i]]))
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
133
|
-
return true;
|
|
134
|
-
};
|
|
135
|
-
const { hasOwnProperty } = Object.prototype;
|
|
136
|
-
const deepEqual = (a, b) => {
|
|
137
|
-
if (shallowEqual(a, b))
|
|
138
|
-
return true;
|
|
139
|
-
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
140
|
-
return false;
|
|
141
|
-
const keysA = Object.keys(a);
|
|
142
|
-
const keysB = Object.keys(b);
|
|
143
|
-
if (keysA.length !== keysB.length)
|
|
144
|
-
return false;
|
|
145
|
-
for (let i = 0; i < keysA.length; i += 1) {
|
|
146
|
-
if (!hasOwnProperty.call(b, keysA[i]) || !deepEqual(a[keysA[i]], b[keysA[i]]))
|
|
147
|
-
return false;
|
|
148
|
-
}
|
|
149
|
-
return true;
|
|
150
|
-
};
|
|
151
117
|
function getInitialState(serializedState = {
|
|
152
118
|
Swatch: [],
|
|
153
119
|
File: [],
|
|
@@ -1087,12 +1053,19 @@ Received "${apiKey}" instead.`);
|
|
|
1087
1053
|
preview: previewOverride = false,
|
|
1088
1054
|
unstable_locale
|
|
1089
1055
|
} = {}) {
|
|
1090
|
-
var _a;
|
|
1056
|
+
var _a, _b;
|
|
1091
1057
|
const isUsingVersioning = this.siteVersion != null;
|
|
1092
1058
|
const siteVersion = (_a = this.siteVersion) != null ? _a : previewOverride ? MakeswiftSiteVersion.Working : MakeswiftSiteVersion.Live;
|
|
1059
|
+
const defaultLocale = (_b = getDefaultLocale(this.runtime.store.getState())) == null ? void 0 : _b.toString();
|
|
1060
|
+
const locale = unstable_locale === defaultLocale ? null : unstable_locale;
|
|
1093
1061
|
const searchParams = new URLSearchParams();
|
|
1094
|
-
if (
|
|
1095
|
-
|
|
1062
|
+
if (locale) {
|
|
1063
|
+
const locales = getLocales(this.runtime.store.getState()).map((locale2) => locale2.toString());
|
|
1064
|
+
if (!locales.includes(locale)) {
|
|
1065
|
+
throw new Error(`Locale "${locale}" is not included in the locales: ${locales}. Please add the locale to the locales on the ReactRuntime.`);
|
|
1066
|
+
}
|
|
1067
|
+
searchParams.set("locale", locale);
|
|
1068
|
+
}
|
|
1096
1069
|
const response = await this.fetch(`/${isUsingVersioning ? "v3" : "v2"}/pages/${encodeURIComponent(pathname)}/document?${searchParams.toString()}`, {
|
|
1097
1070
|
headers: { "Makeswift-Site-Version": siteVersion }
|
|
1098
1071
|
});
|
|
@@ -1103,7 +1076,7 @@ Received "${apiKey}" instead.`);
|
|
|
1103
1076
|
throw new Error(`Failed to get page snapshot with error: "${response.statusText}"`);
|
|
1104
1077
|
}
|
|
1105
1078
|
const document2 = await response.json();
|
|
1106
|
-
const { cacheData, localizedResourcesMap } = await this.introspect(document2.data, previewOverride,
|
|
1079
|
+
const { cacheData, localizedResourcesMap } = await this.introspect(document2.data, previewOverride, locale != null ? locale : void 0);
|
|
1107
1080
|
const apiOrigin = this.apiOrigin.href;
|
|
1108
1081
|
const preview = siteVersion === MakeswiftSiteVersion.Working;
|
|
1109
1082
|
return {
|
|
@@ -1112,7 +1085,7 @@ Received "${apiKey}" instead.`);
|
|
|
1112
1085
|
apiOrigin,
|
|
1113
1086
|
preview,
|
|
1114
1087
|
localizedResourcesMap,
|
|
1115
|
-
locale:
|
|
1088
|
+
locale: locale != null ? locale : null
|
|
1116
1089
|
};
|
|
1117
1090
|
}
|
|
1118
1091
|
async getSwatch(swatchId) {
|
|
@@ -1206,7 +1179,7 @@ async function fonts(_req, res, { getFonts } = {}) {
|
|
|
1206
1179
|
const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
|
|
1207
1180
|
return res.json(fonts2);
|
|
1208
1181
|
}
|
|
1209
|
-
const version = "0.
|
|
1182
|
+
const version = "0.10.1";
|
|
1210
1183
|
async function handler(req, res, { apiKey, unstable_siteVersions }) {
|
|
1211
1184
|
if (req.query.secret !== apiKey) {
|
|
1212
1185
|
return res.status(401).json({ message: "Unauthorized" });
|
|
@@ -1346,7 +1319,7 @@ Read more about dynamic catch-all routes here: https://nextjs.org/docs/routing/d
|
|
|
1346
1319
|
return client.getGlobalElement(m.params.id).then(handleResource);
|
|
1347
1320
|
}
|
|
1348
1321
|
if (m = matches("/localized-global-elements/:globalElementId/:locale")) {
|
|
1349
|
-
return client.getLocalizedGlobalElement(m.params.globalElementId, m.params.locale).then(
|
|
1322
|
+
return client.getLocalizedGlobalElement(m.params.globalElementId, m.params.locale).then((resource) => resource === null ? res.json({ message: "Not Found" }) : res.json(resource));
|
|
1350
1323
|
}
|
|
1351
1324
|
if (m = matches("/page-pathname-slices/:id")) {
|
|
1352
1325
|
return client.getPagePathnameSlice(m.params.id).then(handleResource);
|
|
@@ -1479,7 +1452,8 @@ const Page = memo(({
|
|
|
1479
1452
|
const client = useMemo(() => new MakeswiftClient({
|
|
1480
1453
|
uri: new URL("graphql", snapshot.apiOrigin).href,
|
|
1481
1454
|
cacheData: snapshot.cacheData,
|
|
1482
|
-
localizedResourcesMap: snapshot.localizedResourcesMap
|
|
1455
|
+
localizedResourcesMap: snapshot.localizedResourcesMap,
|
|
1456
|
+
locale: snapshot.locale ? new Intl.Locale(snapshot.locale) : void 0
|
|
1483
1457
|
}), [snapshot]);
|
|
1484
1458
|
const rootElements = /* @__PURE__ */ new Map([[snapshot.document.id, snapshot.document.data]]);
|
|
1485
1459
|
snapshot.document.localizedPages.forEach((localizedPage) => {
|
|
@@ -1653,7 +1627,7 @@ function registerComponent$b(runtime) {
|
|
|
1653
1627
|
props: {
|
|
1654
1628
|
id: ElementID(),
|
|
1655
1629
|
children: TextInput({ placeholder: "Button text" }),
|
|
1656
|
-
link: Link({
|
|
1630
|
+
link: Link$1({
|
|
1657
1631
|
defaultValue: {
|
|
1658
1632
|
type: "OPEN_PAGE",
|
|
1659
1633
|
payload: {
|
|
@@ -1978,7 +1952,7 @@ function registerComponent$6(runtime) {
|
|
|
1978
1952
|
id: ElementID(),
|
|
1979
1953
|
tableId: Table(),
|
|
1980
1954
|
fields: TableFormFields(),
|
|
1981
|
-
submitLink: Link((props) => ({
|
|
1955
|
+
submitLink: Link$1((props) => ({
|
|
1982
1956
|
label: "Redirect to",
|
|
1983
1957
|
options: [
|
|
1984
1958
|
{ value: "OPEN_PAGE", label: "Open page" },
|
|
@@ -2103,7 +2077,7 @@ function registerComponent$5(runtime) {
|
|
|
2103
2077
|
id: ElementID(),
|
|
2104
2078
|
file: Image(),
|
|
2105
2079
|
altText: TextInput({ label: "Alt text" }),
|
|
2106
|
-
link: Link({ label: "On click" }),
|
|
2080
|
+
link: Link$1({ label: "On click" }),
|
|
2107
2081
|
width: Width(),
|
|
2108
2082
|
margin: Margin({ format: Margin.Format.ClassName }),
|
|
2109
2083
|
padding: Padding({ format: Padding.Format.ClassName }),
|
|
@@ -2151,7 +2125,7 @@ function registerComponent$4(runtime) {
|
|
|
2151
2125
|
label: "Logo alt text",
|
|
2152
2126
|
hidden: props.showLogo === false
|
|
2153
2127
|
})),
|
|
2154
|
-
logoLink: Link((props) => ({
|
|
2128
|
+
logoLink: Link$1((props) => ({
|
|
2155
2129
|
label: "Logo on click",
|
|
2156
2130
|
hidden: props.showLogo === false
|
|
2157
2131
|
})),
|
|
@@ -2360,58 +2334,247 @@ function registerComponent$2(runtime) {
|
|
|
2360
2334
|
}
|
|
2361
2335
|
});
|
|
2362
2336
|
}
|
|
2337
|
+
function useSwatch(swatchId) {
|
|
2338
|
+
const client = useMakeswiftClient();
|
|
2339
|
+
const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
|
|
2340
|
+
const swatch = useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
|
|
2341
|
+
useEffect(() => {
|
|
2342
|
+
if (swatchId != null)
|
|
2343
|
+
client.fetchSwatch(swatchId).catch(console.error);
|
|
2344
|
+
}, [client, swatchId]);
|
|
2345
|
+
return swatch;
|
|
2346
|
+
}
|
|
2347
|
+
function useSwatches(swatchIds) {
|
|
2348
|
+
const client = useMakeswiftClient();
|
|
2349
|
+
const lastSnapshot = useRef();
|
|
2350
|
+
function getSnapshot() {
|
|
2351
|
+
const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
|
|
2352
|
+
if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
|
|
2353
|
+
return lastSnapshot.current;
|
|
2354
|
+
}
|
|
2355
|
+
return lastSnapshot.current = swatches2;
|
|
2356
|
+
}
|
|
2357
|
+
const swatches = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2358
|
+
useEffect(() => {
|
|
2359
|
+
Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
|
|
2360
|
+
}, [client, swatchIds]);
|
|
2361
|
+
return swatches;
|
|
2362
|
+
}
|
|
2363
|
+
function useFile(fileId) {
|
|
2364
|
+
const client = useMakeswiftClient();
|
|
2365
|
+
const readFile = () => fileId == null ? null : client.readFile(fileId);
|
|
2366
|
+
const file = useSyncExternalStore(client.subscribe, readFile, readFile);
|
|
2367
|
+
useEffect(() => {
|
|
2368
|
+
if (fileId != null)
|
|
2369
|
+
client.fetchFile(fileId);
|
|
2370
|
+
}, [client, fileId]);
|
|
2371
|
+
return file;
|
|
2372
|
+
}
|
|
2373
|
+
function useFiles(fileIds) {
|
|
2374
|
+
const client = useMakeswiftClient();
|
|
2375
|
+
const lastSnapshot = useRef();
|
|
2376
|
+
function getSnapshot() {
|
|
2377
|
+
const files2 = fileIds.map((fileId) => client.readFile(fileId));
|
|
2378
|
+
if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
|
|
2379
|
+
return lastSnapshot.current;
|
|
2380
|
+
}
|
|
2381
|
+
return lastSnapshot.current = files2;
|
|
2382
|
+
}
|
|
2383
|
+
const files = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2384
|
+
useEffect(() => {
|
|
2385
|
+
Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
|
|
2386
|
+
}, [client, fileIds]);
|
|
2387
|
+
return files;
|
|
2388
|
+
}
|
|
2389
|
+
function useTypography(typographyId) {
|
|
2390
|
+
const client = useMakeswiftClient();
|
|
2391
|
+
const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
|
|
2392
|
+
const typography = useSyncExternalStore(client.subscribe, readTypography, readTypography);
|
|
2393
|
+
useEffect(() => {
|
|
2394
|
+
if (typographyId != null)
|
|
2395
|
+
client.fetchTypography(typographyId).catch(console.error);
|
|
2396
|
+
}, [client, typographyId]);
|
|
2397
|
+
return typography;
|
|
2398
|
+
}
|
|
2399
|
+
function useGlobalElement(globalElementId) {
|
|
2400
|
+
const client = useMakeswiftClient();
|
|
2401
|
+
const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
|
|
2402
|
+
const globalElement = useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
|
|
2403
|
+
useEffect(() => {
|
|
2404
|
+
if (globalElementId != null)
|
|
2405
|
+
client.fetchGlobalElement(globalElementId).catch(console.error);
|
|
2406
|
+
}, [client, globalElementId]);
|
|
2407
|
+
return globalElement;
|
|
2408
|
+
}
|
|
2409
|
+
function useLocalizedGlobalElement(globalElementId) {
|
|
2410
|
+
const client = useMakeswiftClient();
|
|
2411
|
+
const readLocalizedGlobalElement = () => globalElementId == null ? null : client.readLocalizedGlobalElement(globalElementId);
|
|
2412
|
+
const localizedGlobalElement = useSyncExternalStore(client.subscribe, readLocalizedGlobalElement, readLocalizedGlobalElement);
|
|
2413
|
+
useEffect(() => {
|
|
2414
|
+
if (globalElementId != null) {
|
|
2415
|
+
client.fetchLocalizedGlobalElement(globalElementId).catch(console.error);
|
|
2416
|
+
}
|
|
2417
|
+
}, [client, globalElementId]);
|
|
2418
|
+
return localizedGlobalElement;
|
|
2419
|
+
}
|
|
2420
|
+
function usePagePathnameSlice(pageId) {
|
|
2421
|
+
const client = useMakeswiftClient();
|
|
2422
|
+
const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
|
|
2423
|
+
const pagePathnameSlice = useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
|
|
2424
|
+
useEffect(() => {
|
|
2425
|
+
if (pageId != null)
|
|
2426
|
+
client.fetchPagePathnameSlice(pageId).catch(console.error);
|
|
2427
|
+
}, [client, pageId]);
|
|
2428
|
+
return pagePathnameSlice;
|
|
2429
|
+
}
|
|
2430
|
+
function useTable(tableId) {
|
|
2431
|
+
const client = useMakeswiftClient();
|
|
2432
|
+
const readTable = () => tableId == null ? null : client.readTable(tableId);
|
|
2433
|
+
const table = useSyncExternalStore(client.subscribe, readTable, readTable);
|
|
2434
|
+
useEffect(() => {
|
|
2435
|
+
if (tableId != null)
|
|
2436
|
+
client.fetchTable(tableId).catch(console.error);
|
|
2437
|
+
}, [client, tableId]);
|
|
2438
|
+
return table;
|
|
2439
|
+
}
|
|
2440
|
+
const Link = forwardRef(function Link2(_e, ref) {
|
|
2441
|
+
var _f = _e, {
|
|
2442
|
+
link,
|
|
2443
|
+
onClick = () => {
|
|
2444
|
+
}
|
|
2445
|
+
} = _f, restOfProps = __objRest(_f, [
|
|
2446
|
+
"link",
|
|
2447
|
+
"onClick"
|
|
2448
|
+
]);
|
|
2449
|
+
var _a;
|
|
2450
|
+
const pageId = link && link.type === "OPEN_PAGE" ? link.payload.pageId : null;
|
|
2451
|
+
const page = usePagePathnameSlice(pageId != null ? pageId : null);
|
|
2452
|
+
const elementKey = (link == null ? void 0 : link.type) === "SCROLL_TO_ELEMENT" ? (_a = link.payload.elementIdConfig) == null ? void 0 : _a.elementKey : null;
|
|
2453
|
+
const elementId = useElementId(elementKey);
|
|
2454
|
+
let useNextLink;
|
|
2455
|
+
let href;
|
|
2456
|
+
let target;
|
|
2457
|
+
let block;
|
|
2458
|
+
if (link) {
|
|
2459
|
+
switch (link.type) {
|
|
2460
|
+
case "OPEN_PAGE": {
|
|
2461
|
+
if (page) {
|
|
2462
|
+
useNextLink = true;
|
|
2463
|
+
href = `/${page.pathname}`;
|
|
2464
|
+
}
|
|
2465
|
+
target = link.payload.openInNewTab ? "_blank" : "_self";
|
|
2466
|
+
break;
|
|
2467
|
+
}
|
|
2468
|
+
case "OPEN_URL": {
|
|
2469
|
+
useNextLink = true;
|
|
2470
|
+
href = link.payload.url;
|
|
2471
|
+
target = link.payload.openInNewTab ? "_blank" : "_self";
|
|
2472
|
+
break;
|
|
2473
|
+
}
|
|
2474
|
+
case "SEND_EMAIL": {
|
|
2475
|
+
useNextLink = false;
|
|
2476
|
+
const {
|
|
2477
|
+
to,
|
|
2478
|
+
subject = "",
|
|
2479
|
+
body = ""
|
|
2480
|
+
} = link.payload;
|
|
2481
|
+
if (to != null)
|
|
2482
|
+
href = `mailto:${to}?subject=${subject}&body=${body}`;
|
|
2483
|
+
break;
|
|
2484
|
+
}
|
|
2485
|
+
case "CALL_PHONE": {
|
|
2486
|
+
useNextLink = false;
|
|
2487
|
+
href = `tel:${link.payload.phoneNumber}`;
|
|
2488
|
+
break;
|
|
2489
|
+
}
|
|
2490
|
+
case "SCROLL_TO_ELEMENT": {
|
|
2491
|
+
useNextLink = false;
|
|
2492
|
+
href = `#${elementId != null ? elementId : ""}`;
|
|
2493
|
+
block = link.payload.block;
|
|
2494
|
+
break;
|
|
2495
|
+
}
|
|
2496
|
+
default:
|
|
2497
|
+
throw new RangeError(`Invalid link type "${link.type}."`);
|
|
2498
|
+
}
|
|
2499
|
+
}
|
|
2500
|
+
function handleClick(event) {
|
|
2501
|
+
onClick(event);
|
|
2502
|
+
if (event.defaultPrevented)
|
|
2503
|
+
return;
|
|
2504
|
+
if (event.currentTarget.isContentEditable)
|
|
2505
|
+
return event.preventDefault();
|
|
2506
|
+
if (link && link.type === "SCROLL_TO_ELEMENT") {
|
|
2507
|
+
let hash;
|
|
2508
|
+
try {
|
|
2509
|
+
if (href != null)
|
|
2510
|
+
hash = new URL(`http://www.example.com/${href}`).hash;
|
|
2511
|
+
} catch (error) {
|
|
2512
|
+
console.error(`Link received invalid href: ${href}`, error);
|
|
2513
|
+
}
|
|
2514
|
+
if (href != null && hash != null && href === hash) {
|
|
2515
|
+
event.preventDefault();
|
|
2516
|
+
const view = event.view;
|
|
2517
|
+
scrollIntoView(view.document.querySelector(hash), {
|
|
2518
|
+
behavior: "smooth",
|
|
2519
|
+
block
|
|
2520
|
+
});
|
|
2521
|
+
if (view.location.hash !== hash)
|
|
2522
|
+
view.history.pushState({}, "", hash);
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
if (useNextLink && href != null) {
|
|
2527
|
+
return /* @__PURE__ */ jsx(NextLink, __spreadProps(__spreadValues({}, restOfProps), {
|
|
2528
|
+
ref,
|
|
2529
|
+
target,
|
|
2530
|
+
onClick: handleClick,
|
|
2531
|
+
href,
|
|
2532
|
+
legacyBehavior: false
|
|
2533
|
+
}));
|
|
2534
|
+
}
|
|
2535
|
+
return /* @__PURE__ */ jsx("a", __spreadProps(__spreadValues({}, restOfProps), {
|
|
2536
|
+
ref,
|
|
2537
|
+
href,
|
|
2538
|
+
target,
|
|
2539
|
+
onClick: handleClick
|
|
2540
|
+
}));
|
|
2541
|
+
});
|
|
2363
2542
|
function registerComponent$1(runtime) {
|
|
2364
2543
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic(() => patch(import("./Text.es.js")))), {
|
|
2365
2544
|
type: MakeswiftComponentType.Text,
|
|
2366
2545
|
label: "Text",
|
|
2367
2546
|
props: {
|
|
2368
2547
|
id: ElementID(),
|
|
2369
|
-
text: RichText(
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2548
|
+
text: RichText({
|
|
2549
|
+
unstable_defaultValue: [
|
|
2550
|
+
{
|
|
2551
|
+
type: BlockType.Default,
|
|
2552
|
+
children: [
|
|
2374
2553
|
{
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2554
|
+
text: ipsum(3),
|
|
2555
|
+
typography: {
|
|
2556
|
+
style: [
|
|
2557
|
+
{
|
|
2558
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2559
|
+
value: {
|
|
2560
|
+
fontWeight: 400,
|
|
2561
|
+
fontSize: { value: 18, unit: "px" },
|
|
2562
|
+
lineHeight: 1.5
|
|
2563
|
+
}
|
|
2564
|
+
},
|
|
2565
|
+
...runtime.getBreakpoints().some(({ id }) => id === DefaultBreakpointID.Mobile) ? [
|
|
2382
2566
|
{
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
data: {
|
|
2386
|
-
value: {
|
|
2387
|
-
id: null,
|
|
2388
|
-
style: [
|
|
2389
|
-
{
|
|
2390
|
-
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2391
|
-
value: {
|
|
2392
|
-
fontWeight: 400,
|
|
2393
|
-
fontSize: { value: 18, unit: "px" },
|
|
2394
|
-
lineHeight: 1.5
|
|
2395
|
-
}
|
|
2396
|
-
},
|
|
2397
|
-
...runtime.getBreakpoints().some(({ id }) => id === DefaultBreakpointID.Mobile) ? [
|
|
2398
|
-
{
|
|
2399
|
-
deviceId: DefaultBreakpointID.Mobile,
|
|
2400
|
-
value: { fontSize: { value: 16, unit: "px" } }
|
|
2401
|
-
}
|
|
2402
|
-
] : []
|
|
2403
|
-
]
|
|
2404
|
-
}
|
|
2405
|
-
}
|
|
2567
|
+
deviceId: DefaultBreakpointID.Mobile,
|
|
2568
|
+
value: { fontSize: { value: 16, unit: "px" } }
|
|
2406
2569
|
}
|
|
2407
|
-
]
|
|
2408
|
-
|
|
2409
|
-
|
|
2570
|
+
] : []
|
|
2571
|
+
]
|
|
2572
|
+
}
|
|
2410
2573
|
}
|
|
2411
2574
|
]
|
|
2412
2575
|
}
|
|
2413
|
-
|
|
2414
|
-
})
|
|
2576
|
+
]
|
|
2577
|
+
}),
|
|
2415
2578
|
width: Width({
|
|
2416
2579
|
format: Width.Format.ClassName,
|
|
2417
2580
|
preset: [
|
|
@@ -2540,111 +2703,8 @@ const FallbackComponent = forwardRef(function FallbackComponent2({
|
|
|
2540
2703
|
function isNonNullable(value) {
|
|
2541
2704
|
return value != null;
|
|
2542
2705
|
}
|
|
2543
|
-
function
|
|
2544
|
-
|
|
2545
|
-
const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
|
|
2546
|
-
const swatch = useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
|
|
2547
|
-
useEffect(() => {
|
|
2548
|
-
if (swatchId != null)
|
|
2549
|
-
client.fetchSwatch(swatchId).catch(console.error);
|
|
2550
|
-
}, [client, swatchId]);
|
|
2551
|
-
return swatch;
|
|
2552
|
-
}
|
|
2553
|
-
function useSwatches(swatchIds) {
|
|
2554
|
-
const client = useMakeswiftClient();
|
|
2555
|
-
const lastSnapshot = useRef();
|
|
2556
|
-
function getSnapshot() {
|
|
2557
|
-
const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
|
|
2558
|
-
if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
|
|
2559
|
-
return lastSnapshot.current;
|
|
2560
|
-
}
|
|
2561
|
-
return lastSnapshot.current = swatches2;
|
|
2562
|
-
}
|
|
2563
|
-
const swatches = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2564
|
-
useEffect(() => {
|
|
2565
|
-
Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
|
|
2566
|
-
}, [client, swatchIds]);
|
|
2567
|
-
return swatches;
|
|
2568
|
-
}
|
|
2569
|
-
function useFile(fileId) {
|
|
2570
|
-
const client = useMakeswiftClient();
|
|
2571
|
-
const readFile = () => fileId == null ? null : client.readFile(fileId);
|
|
2572
|
-
const file = useSyncExternalStore(client.subscribe, readFile, readFile);
|
|
2573
|
-
useEffect(() => {
|
|
2574
|
-
if (fileId != null)
|
|
2575
|
-
client.fetchFile(fileId);
|
|
2576
|
-
}, [client, fileId]);
|
|
2577
|
-
return file;
|
|
2578
|
-
}
|
|
2579
|
-
function useFiles(fileIds) {
|
|
2580
|
-
const client = useMakeswiftClient();
|
|
2581
|
-
const lastSnapshot = useRef();
|
|
2582
|
-
function getSnapshot() {
|
|
2583
|
-
const files2 = fileIds.map((fileId) => client.readFile(fileId));
|
|
2584
|
-
if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
|
|
2585
|
-
return lastSnapshot.current;
|
|
2586
|
-
}
|
|
2587
|
-
return lastSnapshot.current = files2;
|
|
2588
|
-
}
|
|
2589
|
-
const files = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2590
|
-
useEffect(() => {
|
|
2591
|
-
Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
|
|
2592
|
-
}, [client, fileIds]);
|
|
2593
|
-
return files;
|
|
2594
|
-
}
|
|
2595
|
-
function useTypography(typographyId) {
|
|
2596
|
-
const client = useMakeswiftClient();
|
|
2597
|
-
const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
|
|
2598
|
-
const typography = useSyncExternalStore(client.subscribe, readTypography, readTypography);
|
|
2599
|
-
useEffect(() => {
|
|
2600
|
-
if (typographyId != null)
|
|
2601
|
-
client.fetchTypography(typographyId).catch(console.error);
|
|
2602
|
-
}, [client, typographyId]);
|
|
2603
|
-
return typography;
|
|
2604
|
-
}
|
|
2605
|
-
function useGlobalElement(globalElementId) {
|
|
2606
|
-
const client = useMakeswiftClient();
|
|
2607
|
-
const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
|
|
2608
|
-
const globalElement = useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
|
|
2609
|
-
useEffect(() => {
|
|
2610
|
-
if (globalElementId != null)
|
|
2611
|
-
client.fetchGlobalElement(globalElementId).catch(console.error);
|
|
2612
|
-
}, [client, globalElementId]);
|
|
2613
|
-
return globalElement;
|
|
2614
|
-
}
|
|
2615
|
-
function useLocalizedGlobalElement(globalElementId) {
|
|
2616
|
-
const client = useMakeswiftClient();
|
|
2617
|
-
const readLocalizedGlobalElement = () => globalElementId == null ? null : client.readLocalizedGlobalElement(globalElementId);
|
|
2618
|
-
const localizedGlobalElement = useSyncExternalStore(client.subscribe, readLocalizedGlobalElement, readLocalizedGlobalElement);
|
|
2619
|
-
useEffect(() => {
|
|
2620
|
-
if (globalElementId != null) {
|
|
2621
|
-
client.fetchLocalizedGlobalElement(globalElementId).catch(console.error);
|
|
2622
|
-
}
|
|
2623
|
-
}, [client, globalElementId]);
|
|
2624
|
-
return localizedGlobalElement;
|
|
2625
|
-
}
|
|
2626
|
-
function usePagePathnameSlice(pageId) {
|
|
2627
|
-
const client = useMakeswiftClient();
|
|
2628
|
-
const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
|
|
2629
|
-
const pagePathnameSlice = useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
|
|
2630
|
-
useEffect(() => {
|
|
2631
|
-
if (pageId != null)
|
|
2632
|
-
client.fetchPagePathnameSlice(pageId).catch(console.error);
|
|
2633
|
-
}, [client, pageId]);
|
|
2634
|
-
return pagePathnameSlice;
|
|
2635
|
-
}
|
|
2636
|
-
function useTable(tableId) {
|
|
2637
|
-
const client = useMakeswiftClient();
|
|
2638
|
-
const readTable = () => tableId == null ? null : client.readTable(tableId);
|
|
2639
|
-
const table = useSyncExternalStore(client.subscribe, readTable, readTable);
|
|
2640
|
-
useEffect(() => {
|
|
2641
|
-
if (tableId != null)
|
|
2642
|
-
client.fetchTable(tableId).catch(console.error);
|
|
2643
|
-
}, [client, tableId]);
|
|
2644
|
-
return table;
|
|
2645
|
-
}
|
|
2646
|
-
function mapSideColor(swatches, _e) {
|
|
2647
|
-
var _f = _e, { color } = _f, restOfSide = __objRest(_f, ["color"]);
|
|
2706
|
+
function mapSideColor(swatches, _g) {
|
|
2707
|
+
var _h = _g, { color } = _h, restOfSide = __objRest(_h, ["color"]);
|
|
2648
2708
|
return __spreadProps(__spreadValues({}, restOfSide), {
|
|
2649
2709
|
color: color && {
|
|
2650
2710
|
alpha: color.alpha,
|
|
@@ -3176,7 +3236,8 @@ function ListControlValue({
|
|
|
3176
3236
|
function useNumber(numberControlData, controlDefinition) {
|
|
3177
3237
|
return numberControlData != null ? numberControlData : controlDefinition.config.defaultValue;
|
|
3178
3238
|
}
|
|
3179
|
-
const
|
|
3239
|
+
const EditableText$1 = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es7.js"))));
|
|
3240
|
+
const ReadOnlyText$1 = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyText.es.js"))));
|
|
3180
3241
|
function useRichText(data, control) {
|
|
3181
3242
|
const textCallbackRef = useCallback((handle) => {
|
|
3182
3243
|
var _a;
|
|
@@ -3185,12 +3246,16 @@ function useRichText(data, control) {
|
|
|
3185
3246
|
text: control
|
|
3186
3247
|
});
|
|
3187
3248
|
}, [control]);
|
|
3188
|
-
|
|
3249
|
+
const isPreview = useIsPreview();
|
|
3250
|
+
return isPreview ? /* @__PURE__ */ jsx(EditableText$1, {
|
|
3251
|
+
text: data,
|
|
3252
|
+
ref: textCallbackRef
|
|
3253
|
+
}) : /* @__PURE__ */ jsx(ReadOnlyText$1, {
|
|
3189
3254
|
text: data,
|
|
3190
3255
|
ref: textCallbackRef
|
|
3191
3256
|
});
|
|
3192
3257
|
}
|
|
3193
|
-
const EditableText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.
|
|
3258
|
+
const EditableText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es8.js"))));
|
|
3194
3259
|
const ReadOnlyText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyTextV2.es.js"))));
|
|
3195
3260
|
const ReadOnlyTextV1 = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyText.es.js"))));
|
|
3196
3261
|
function useRichTextV2(data, definition, control) {
|
|
@@ -3264,13 +3329,13 @@ function useSlot(data, control) {
|
|
|
3264
3329
|
}, element.key))
|
|
3265
3330
|
});
|
|
3266
3331
|
}
|
|
3267
|
-
function Slot(
|
|
3268
|
-
var
|
|
3332
|
+
function Slot(_i) {
|
|
3333
|
+
var _j = _i, {
|
|
3269
3334
|
as,
|
|
3270
3335
|
control,
|
|
3271
3336
|
children,
|
|
3272
3337
|
className
|
|
3273
|
-
} =
|
|
3338
|
+
} = _j, restOfProps = __objRest(_j, [
|
|
3274
3339
|
"as",
|
|
3275
3340
|
"control",
|
|
3276
3341
|
"children",
|
|
@@ -3299,15 +3364,15 @@ function Slot(_g) {
|
|
|
3299
3364
|
}
|
|
3300
3365
|
Slot.Placeholder = SlotPlaceholder;
|
|
3301
3366
|
Slot.Item = SlotItem;
|
|
3302
|
-
function SlotItem(
|
|
3303
|
-
var
|
|
3367
|
+
function SlotItem(_k) {
|
|
3368
|
+
var _l = _k, {
|
|
3304
3369
|
as,
|
|
3305
3370
|
control,
|
|
3306
3371
|
grid,
|
|
3307
3372
|
index,
|
|
3308
3373
|
children,
|
|
3309
3374
|
className
|
|
3310
|
-
} =
|
|
3375
|
+
} = _l, restOfProps = __objRest(_l, [
|
|
3311
3376
|
"as",
|
|
3312
3377
|
"control",
|
|
3313
3378
|
"grid",
|
|
@@ -4021,10 +4086,10 @@ registerBuiltinComponents(ReactRuntime);
|
|
|
4021
4086
|
const StoreContext = createContext(ReactRuntime.store);
|
|
4022
4087
|
const PreviewProvider = dynamic(() => import("./PreviewProvider.es.js"));
|
|
4023
4088
|
const LiveProvider = dynamic(() => import("./LiveProvider.es.js"));
|
|
4024
|
-
function RuntimeProvider(
|
|
4025
|
-
var
|
|
4089
|
+
function RuntimeProvider(_m) {
|
|
4090
|
+
var _n = _m, {
|
|
4026
4091
|
preview
|
|
4027
|
-
} =
|
|
4092
|
+
} = _n, props = __objRest(_n, [
|
|
4028
4093
|
"preview"
|
|
4029
4094
|
]);
|
|
4030
4095
|
return preview ? /* @__PURE__ */ jsx(PreviewProvider, __spreadValues({}, props)) : /* @__PURE__ */ jsx(LiveProvider, __spreadValues({}, props));
|
|
@@ -4227,5 +4292,5 @@ const DocumentReference = memo(forwardRef(function DocumentReference2({
|
|
|
4227
4292
|
document: document2
|
|
4228
4293
|
});
|
|
4229
4294
|
}));
|
|
4230
|
-
export {
|
|
4295
|
+
export { forwardNextDynamicRef as $, Alignments as A, isNonNullable as B, Contrasts as C, DocumentReference as D, Element$1 as E, useFiles as F, useSwatches as G, ElementImperativeHandle as H, StoreContext as I, useEnhancedTypography as J, useTypographyClassName as K, Link as L, MakeswiftProvider as M, useBuilderEditMode as N, pollBoxModel as O, PageProvider as P, ControlValue as Q, RuntimeProvider as R, Shapes as S, getStaticPaths as T, getStaticProps as U, getServerSideProps as V, Page as W, Makeswift as X, PreviewModeScript as Y, Document$1 as Z, MakeswiftApiHandler 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 };
|
|
4231
4296
|
//# sourceMappingURL=index.es.js.map
|