@makeswift/runtime 0.9.12 → 0.10.0
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 +6 -3
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +5 -2
- 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/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 +276 -213
- 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 +270 -206
- 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/client.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/modules/locales.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
|
});
|
|
@@ -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.0";
|
|
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" });
|
|
@@ -1653,7 +1626,7 @@ function registerComponent$b(runtime) {
|
|
|
1653
1626
|
props: {
|
|
1654
1627
|
id: ElementID(),
|
|
1655
1628
|
children: TextInput({ placeholder: "Button text" }),
|
|
1656
|
-
link: Link({
|
|
1629
|
+
link: Link$1({
|
|
1657
1630
|
defaultValue: {
|
|
1658
1631
|
type: "OPEN_PAGE",
|
|
1659
1632
|
payload: {
|
|
@@ -1978,7 +1951,7 @@ function registerComponent$6(runtime) {
|
|
|
1978
1951
|
id: ElementID(),
|
|
1979
1952
|
tableId: Table(),
|
|
1980
1953
|
fields: TableFormFields(),
|
|
1981
|
-
submitLink: Link((props) => ({
|
|
1954
|
+
submitLink: Link$1((props) => ({
|
|
1982
1955
|
label: "Redirect to",
|
|
1983
1956
|
options: [
|
|
1984
1957
|
{ value: "OPEN_PAGE", label: "Open page" },
|
|
@@ -2103,7 +2076,7 @@ function registerComponent$5(runtime) {
|
|
|
2103
2076
|
id: ElementID(),
|
|
2104
2077
|
file: Image(),
|
|
2105
2078
|
altText: TextInput({ label: "Alt text" }),
|
|
2106
|
-
link: Link({ label: "On click" }),
|
|
2079
|
+
link: Link$1({ label: "On click" }),
|
|
2107
2080
|
width: Width(),
|
|
2108
2081
|
margin: Margin({ format: Margin.Format.ClassName }),
|
|
2109
2082
|
padding: Padding({ format: Padding.Format.ClassName }),
|
|
@@ -2151,7 +2124,7 @@ function registerComponent$4(runtime) {
|
|
|
2151
2124
|
label: "Logo alt text",
|
|
2152
2125
|
hidden: props.showLogo === false
|
|
2153
2126
|
})),
|
|
2154
|
-
logoLink: Link((props) => ({
|
|
2127
|
+
logoLink: Link$1((props) => ({
|
|
2155
2128
|
label: "Logo on click",
|
|
2156
2129
|
hidden: props.showLogo === false
|
|
2157
2130
|
})),
|
|
@@ -2360,58 +2333,247 @@ function registerComponent$2(runtime) {
|
|
|
2360
2333
|
}
|
|
2361
2334
|
});
|
|
2362
2335
|
}
|
|
2336
|
+
function useSwatch(swatchId) {
|
|
2337
|
+
const client = useMakeswiftClient();
|
|
2338
|
+
const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
|
|
2339
|
+
const swatch = useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
|
|
2340
|
+
useEffect(() => {
|
|
2341
|
+
if (swatchId != null)
|
|
2342
|
+
client.fetchSwatch(swatchId).catch(console.error);
|
|
2343
|
+
}, [client, swatchId]);
|
|
2344
|
+
return swatch;
|
|
2345
|
+
}
|
|
2346
|
+
function useSwatches(swatchIds) {
|
|
2347
|
+
const client = useMakeswiftClient();
|
|
2348
|
+
const lastSnapshot = useRef();
|
|
2349
|
+
function getSnapshot() {
|
|
2350
|
+
const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
|
|
2351
|
+
if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
|
|
2352
|
+
return lastSnapshot.current;
|
|
2353
|
+
}
|
|
2354
|
+
return lastSnapshot.current = swatches2;
|
|
2355
|
+
}
|
|
2356
|
+
const swatches = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2357
|
+
useEffect(() => {
|
|
2358
|
+
Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
|
|
2359
|
+
}, [client, swatchIds]);
|
|
2360
|
+
return swatches;
|
|
2361
|
+
}
|
|
2362
|
+
function useFile(fileId) {
|
|
2363
|
+
const client = useMakeswiftClient();
|
|
2364
|
+
const readFile = () => fileId == null ? null : client.readFile(fileId);
|
|
2365
|
+
const file = useSyncExternalStore(client.subscribe, readFile, readFile);
|
|
2366
|
+
useEffect(() => {
|
|
2367
|
+
if (fileId != null)
|
|
2368
|
+
client.fetchFile(fileId);
|
|
2369
|
+
}, [client, fileId]);
|
|
2370
|
+
return file;
|
|
2371
|
+
}
|
|
2372
|
+
function useFiles(fileIds) {
|
|
2373
|
+
const client = useMakeswiftClient();
|
|
2374
|
+
const lastSnapshot = useRef();
|
|
2375
|
+
function getSnapshot() {
|
|
2376
|
+
const files2 = fileIds.map((fileId) => client.readFile(fileId));
|
|
2377
|
+
if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
|
|
2378
|
+
return lastSnapshot.current;
|
|
2379
|
+
}
|
|
2380
|
+
return lastSnapshot.current = files2;
|
|
2381
|
+
}
|
|
2382
|
+
const files = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2383
|
+
useEffect(() => {
|
|
2384
|
+
Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
|
|
2385
|
+
}, [client, fileIds]);
|
|
2386
|
+
return files;
|
|
2387
|
+
}
|
|
2388
|
+
function useTypography(typographyId) {
|
|
2389
|
+
const client = useMakeswiftClient();
|
|
2390
|
+
const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
|
|
2391
|
+
const typography = useSyncExternalStore(client.subscribe, readTypography, readTypography);
|
|
2392
|
+
useEffect(() => {
|
|
2393
|
+
if (typographyId != null)
|
|
2394
|
+
client.fetchTypography(typographyId).catch(console.error);
|
|
2395
|
+
}, [client, typographyId]);
|
|
2396
|
+
return typography;
|
|
2397
|
+
}
|
|
2398
|
+
function useGlobalElement(globalElementId) {
|
|
2399
|
+
const client = useMakeswiftClient();
|
|
2400
|
+
const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
|
|
2401
|
+
const globalElement = useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
|
|
2402
|
+
useEffect(() => {
|
|
2403
|
+
if (globalElementId != null)
|
|
2404
|
+
client.fetchGlobalElement(globalElementId).catch(console.error);
|
|
2405
|
+
}, [client, globalElementId]);
|
|
2406
|
+
return globalElement;
|
|
2407
|
+
}
|
|
2408
|
+
function useLocalizedGlobalElement(globalElementId) {
|
|
2409
|
+
const client = useMakeswiftClient();
|
|
2410
|
+
const readLocalizedGlobalElement = () => globalElementId == null ? null : client.readLocalizedGlobalElement(globalElementId);
|
|
2411
|
+
const localizedGlobalElement = useSyncExternalStore(client.subscribe, readLocalizedGlobalElement, readLocalizedGlobalElement);
|
|
2412
|
+
useEffect(() => {
|
|
2413
|
+
if (globalElementId != null) {
|
|
2414
|
+
client.fetchLocalizedGlobalElement(globalElementId).catch(console.error);
|
|
2415
|
+
}
|
|
2416
|
+
}, [client, globalElementId]);
|
|
2417
|
+
return localizedGlobalElement;
|
|
2418
|
+
}
|
|
2419
|
+
function usePagePathnameSlice(pageId) {
|
|
2420
|
+
const client = useMakeswiftClient();
|
|
2421
|
+
const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
|
|
2422
|
+
const pagePathnameSlice = useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
|
|
2423
|
+
useEffect(() => {
|
|
2424
|
+
if (pageId != null)
|
|
2425
|
+
client.fetchPagePathnameSlice(pageId).catch(console.error);
|
|
2426
|
+
}, [client, pageId]);
|
|
2427
|
+
return pagePathnameSlice;
|
|
2428
|
+
}
|
|
2429
|
+
function useTable(tableId) {
|
|
2430
|
+
const client = useMakeswiftClient();
|
|
2431
|
+
const readTable = () => tableId == null ? null : client.readTable(tableId);
|
|
2432
|
+
const table = useSyncExternalStore(client.subscribe, readTable, readTable);
|
|
2433
|
+
useEffect(() => {
|
|
2434
|
+
if (tableId != null)
|
|
2435
|
+
client.fetchTable(tableId).catch(console.error);
|
|
2436
|
+
}, [client, tableId]);
|
|
2437
|
+
return table;
|
|
2438
|
+
}
|
|
2439
|
+
const Link = forwardRef(function Link2(_e, ref) {
|
|
2440
|
+
var _f = _e, {
|
|
2441
|
+
link,
|
|
2442
|
+
onClick = () => {
|
|
2443
|
+
}
|
|
2444
|
+
} = _f, restOfProps = __objRest(_f, [
|
|
2445
|
+
"link",
|
|
2446
|
+
"onClick"
|
|
2447
|
+
]);
|
|
2448
|
+
var _a;
|
|
2449
|
+
const pageId = link && link.type === "OPEN_PAGE" ? link.payload.pageId : null;
|
|
2450
|
+
const page = usePagePathnameSlice(pageId != null ? pageId : null);
|
|
2451
|
+
const elementKey = (link == null ? void 0 : link.type) === "SCROLL_TO_ELEMENT" ? (_a = link.payload.elementIdConfig) == null ? void 0 : _a.elementKey : null;
|
|
2452
|
+
const elementId = useElementId(elementKey);
|
|
2453
|
+
let useNextLink;
|
|
2454
|
+
let href;
|
|
2455
|
+
let target;
|
|
2456
|
+
let block;
|
|
2457
|
+
if (link) {
|
|
2458
|
+
switch (link.type) {
|
|
2459
|
+
case "OPEN_PAGE": {
|
|
2460
|
+
if (page) {
|
|
2461
|
+
useNextLink = true;
|
|
2462
|
+
href = `/${page.pathname}`;
|
|
2463
|
+
}
|
|
2464
|
+
target = link.payload.openInNewTab ? "_blank" : "_self";
|
|
2465
|
+
break;
|
|
2466
|
+
}
|
|
2467
|
+
case "OPEN_URL": {
|
|
2468
|
+
useNextLink = true;
|
|
2469
|
+
href = link.payload.url;
|
|
2470
|
+
target = link.payload.openInNewTab ? "_blank" : "_self";
|
|
2471
|
+
break;
|
|
2472
|
+
}
|
|
2473
|
+
case "SEND_EMAIL": {
|
|
2474
|
+
useNextLink = false;
|
|
2475
|
+
const {
|
|
2476
|
+
to,
|
|
2477
|
+
subject = "",
|
|
2478
|
+
body = ""
|
|
2479
|
+
} = link.payload;
|
|
2480
|
+
if (to != null)
|
|
2481
|
+
href = `mailto:${to}?subject=${subject}&body=${body}`;
|
|
2482
|
+
break;
|
|
2483
|
+
}
|
|
2484
|
+
case "CALL_PHONE": {
|
|
2485
|
+
useNextLink = false;
|
|
2486
|
+
href = `tel:${link.payload.phoneNumber}`;
|
|
2487
|
+
break;
|
|
2488
|
+
}
|
|
2489
|
+
case "SCROLL_TO_ELEMENT": {
|
|
2490
|
+
useNextLink = false;
|
|
2491
|
+
href = `#${elementId != null ? elementId : ""}`;
|
|
2492
|
+
block = link.payload.block;
|
|
2493
|
+
break;
|
|
2494
|
+
}
|
|
2495
|
+
default:
|
|
2496
|
+
throw new RangeError(`Invalid link type "${link.type}."`);
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
function handleClick(event) {
|
|
2500
|
+
onClick(event);
|
|
2501
|
+
if (event.defaultPrevented)
|
|
2502
|
+
return;
|
|
2503
|
+
if (event.currentTarget.isContentEditable)
|
|
2504
|
+
return event.preventDefault();
|
|
2505
|
+
if (link && link.type === "SCROLL_TO_ELEMENT") {
|
|
2506
|
+
let hash;
|
|
2507
|
+
try {
|
|
2508
|
+
if (href != null)
|
|
2509
|
+
hash = new URL(`http://www.example.com/${href}`).hash;
|
|
2510
|
+
} catch (error) {
|
|
2511
|
+
console.error(`Link received invalid href: ${href}`, error);
|
|
2512
|
+
}
|
|
2513
|
+
if (href != null && hash != null && href === hash) {
|
|
2514
|
+
event.preventDefault();
|
|
2515
|
+
const view = event.view;
|
|
2516
|
+
scrollIntoView(view.document.querySelector(hash), {
|
|
2517
|
+
behavior: "smooth",
|
|
2518
|
+
block
|
|
2519
|
+
});
|
|
2520
|
+
if (view.location.hash !== hash)
|
|
2521
|
+
view.history.pushState({}, "", hash);
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
if (useNextLink && href != null) {
|
|
2526
|
+
return /* @__PURE__ */ jsx(NextLink, __spreadProps(__spreadValues({}, restOfProps), {
|
|
2527
|
+
ref,
|
|
2528
|
+
target,
|
|
2529
|
+
onClick: handleClick,
|
|
2530
|
+
href,
|
|
2531
|
+
legacyBehavior: false
|
|
2532
|
+
}));
|
|
2533
|
+
}
|
|
2534
|
+
return /* @__PURE__ */ jsx("a", __spreadProps(__spreadValues({}, restOfProps), {
|
|
2535
|
+
ref,
|
|
2536
|
+
href,
|
|
2537
|
+
target,
|
|
2538
|
+
onClick: handleClick
|
|
2539
|
+
}));
|
|
2540
|
+
});
|
|
2363
2541
|
function registerComponent$1(runtime) {
|
|
2364
2542
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic(() => patch(import("./Text.es.js")))), {
|
|
2365
2543
|
type: MakeswiftComponentType.Text,
|
|
2366
2544
|
label: "Text",
|
|
2367
2545
|
props: {
|
|
2368
2546
|
id: ElementID(),
|
|
2369
|
-
text: RichText(
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2547
|
+
text: RichText({
|
|
2548
|
+
unstable_defaultValue: [
|
|
2549
|
+
{
|
|
2550
|
+
type: BlockType.Default,
|
|
2551
|
+
children: [
|
|
2374
2552
|
{
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2553
|
+
text: ipsum(3),
|
|
2554
|
+
typography: {
|
|
2555
|
+
style: [
|
|
2556
|
+
{
|
|
2557
|
+
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2558
|
+
value: {
|
|
2559
|
+
fontWeight: 400,
|
|
2560
|
+
fontSize: { value: 18, unit: "px" },
|
|
2561
|
+
lineHeight: 1.5
|
|
2562
|
+
}
|
|
2563
|
+
},
|
|
2564
|
+
...runtime.getBreakpoints().some(({ id }) => id === DefaultBreakpointID.Mobile) ? [
|
|
2382
2565
|
{
|
|
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
|
-
}
|
|
2566
|
+
deviceId: DefaultBreakpointID.Mobile,
|
|
2567
|
+
value: { fontSize: { value: 16, unit: "px" } }
|
|
2406
2568
|
}
|
|
2407
|
-
]
|
|
2408
|
-
|
|
2409
|
-
|
|
2569
|
+
] : []
|
|
2570
|
+
]
|
|
2571
|
+
}
|
|
2410
2572
|
}
|
|
2411
2573
|
]
|
|
2412
2574
|
}
|
|
2413
|
-
|
|
2414
|
-
})
|
|
2575
|
+
]
|
|
2576
|
+
}),
|
|
2415
2577
|
width: Width({
|
|
2416
2578
|
format: Width.Format.ClassName,
|
|
2417
2579
|
preset: [
|
|
@@ -2540,111 +2702,8 @@ const FallbackComponent = forwardRef(function FallbackComponent2({
|
|
|
2540
2702
|
function isNonNullable(value) {
|
|
2541
2703
|
return value != null;
|
|
2542
2704
|
}
|
|
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"]);
|
|
2705
|
+
function mapSideColor(swatches, _g) {
|
|
2706
|
+
var _h = _g, { color } = _h, restOfSide = __objRest(_h, ["color"]);
|
|
2648
2707
|
return __spreadProps(__spreadValues({}, restOfSide), {
|
|
2649
2708
|
color: color && {
|
|
2650
2709
|
alpha: color.alpha,
|
|
@@ -3176,7 +3235,8 @@ function ListControlValue({
|
|
|
3176
3235
|
function useNumber(numberControlData, controlDefinition) {
|
|
3177
3236
|
return numberControlData != null ? numberControlData : controlDefinition.config.defaultValue;
|
|
3178
3237
|
}
|
|
3179
|
-
const
|
|
3238
|
+
const EditableText$1 = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es7.js"))));
|
|
3239
|
+
const ReadOnlyText$1 = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyText.es.js"))));
|
|
3180
3240
|
function useRichText(data, control) {
|
|
3181
3241
|
const textCallbackRef = useCallback((handle) => {
|
|
3182
3242
|
var _a;
|
|
@@ -3185,12 +3245,16 @@ function useRichText(data, control) {
|
|
|
3185
3245
|
text: control
|
|
3186
3246
|
});
|
|
3187
3247
|
}, [control]);
|
|
3188
|
-
|
|
3248
|
+
const isPreview = useIsPreview();
|
|
3249
|
+
return isPreview ? /* @__PURE__ */ jsx(EditableText$1, {
|
|
3250
|
+
text: data,
|
|
3251
|
+
ref: textCallbackRef
|
|
3252
|
+
}) : /* @__PURE__ */ jsx(ReadOnlyText$1, {
|
|
3189
3253
|
text: data,
|
|
3190
3254
|
ref: textCallbackRef
|
|
3191
3255
|
});
|
|
3192
3256
|
}
|
|
3193
|
-
const EditableText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.
|
|
3257
|
+
const EditableText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es8.js"))));
|
|
3194
3258
|
const ReadOnlyText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyTextV2.es.js"))));
|
|
3195
3259
|
const ReadOnlyTextV1 = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyText.es.js"))));
|
|
3196
3260
|
function useRichTextV2(data, definition, control) {
|
|
@@ -3264,13 +3328,13 @@ function useSlot(data, control) {
|
|
|
3264
3328
|
}, element.key))
|
|
3265
3329
|
});
|
|
3266
3330
|
}
|
|
3267
|
-
function Slot(
|
|
3268
|
-
var
|
|
3331
|
+
function Slot(_i) {
|
|
3332
|
+
var _j = _i, {
|
|
3269
3333
|
as,
|
|
3270
3334
|
control,
|
|
3271
3335
|
children,
|
|
3272
3336
|
className
|
|
3273
|
-
} =
|
|
3337
|
+
} = _j, restOfProps = __objRest(_j, [
|
|
3274
3338
|
"as",
|
|
3275
3339
|
"control",
|
|
3276
3340
|
"children",
|
|
@@ -3299,15 +3363,15 @@ function Slot(_g) {
|
|
|
3299
3363
|
}
|
|
3300
3364
|
Slot.Placeholder = SlotPlaceholder;
|
|
3301
3365
|
Slot.Item = SlotItem;
|
|
3302
|
-
function SlotItem(
|
|
3303
|
-
var
|
|
3366
|
+
function SlotItem(_k) {
|
|
3367
|
+
var _l = _k, {
|
|
3304
3368
|
as,
|
|
3305
3369
|
control,
|
|
3306
3370
|
grid,
|
|
3307
3371
|
index,
|
|
3308
3372
|
children,
|
|
3309
3373
|
className
|
|
3310
|
-
} =
|
|
3374
|
+
} = _l, restOfProps = __objRest(_l, [
|
|
3311
3375
|
"as",
|
|
3312
3376
|
"control",
|
|
3313
3377
|
"grid",
|
|
@@ -4021,10 +4085,10 @@ registerBuiltinComponents(ReactRuntime);
|
|
|
4021
4085
|
const StoreContext = createContext(ReactRuntime.store);
|
|
4022
4086
|
const PreviewProvider = dynamic(() => import("./PreviewProvider.es.js"));
|
|
4023
4087
|
const LiveProvider = dynamic(() => import("./LiveProvider.es.js"));
|
|
4024
|
-
function RuntimeProvider(
|
|
4025
|
-
var
|
|
4088
|
+
function RuntimeProvider(_m) {
|
|
4089
|
+
var _n = _m, {
|
|
4026
4090
|
preview
|
|
4027
|
-
} =
|
|
4091
|
+
} = _n, props = __objRest(_n, [
|
|
4028
4092
|
"preview"
|
|
4029
4093
|
]);
|
|
4030
4094
|
return preview ? /* @__PURE__ */ jsx(PreviewProvider, __spreadValues({}, props)) : /* @__PURE__ */ jsx(LiveProvider, __spreadValues({}, props));
|
|
@@ -4227,5 +4291,5 @@ const DocumentReference = memo(forwardRef(function DocumentReference2({
|
|
|
4227
4291
|
document: document2
|
|
4228
4292
|
});
|
|
4229
4293
|
}));
|
|
4230
|
-
export {
|
|
4294
|
+
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
4295
|
//# sourceMappingURL=index.es.js.map
|