@makeswift/runtime 0.9.11 → 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 +4 -1
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +5 -2
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +4 -3
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +5 -4
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +4 -3
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +5 -4
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +4 -1
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +5 -2
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +4 -1
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +5 -2
- 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 +14 -13
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +6 -5
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +12 -11
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +12 -11
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +4 -1
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +6 -3
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +12 -11
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +12 -11
- package/dist/Navigation.es.js.map +1 -1
- package/dist/PreviewProvider.cjs.js +7 -4
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +6 -3
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +34 -26
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +30 -22
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +125 -246
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +126 -246
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +4 -1
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +5 -2
- package/dist/Root.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +7 -6
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +8 -7
- 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 +4 -3
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +4 -3
- package/dist/components.es.js.map +1 -1
- package/dist/control-serialization.es.js +1 -1
- package/dist/controls.cjs.js +31 -21
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +4 -2
- package/dist/controls.es.js.map +1 -1
- package/dist/index.cjs.js +307 -243
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs2.js +3 -3
- package/dist/index.cjs2.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 -243
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs6.js +16 -37
- 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 +276 -12
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.es.js +279 -215
- 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 -241
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es6.js +16 -32
- 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 +271 -11
- 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 +4 -1
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +5 -2
- 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 +1731 -183
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +1694 -182
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +4 -1
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +4 -1
- package/dist/react.es.js.map +1 -1
- package/dist/slate.cjs.js +32 -377
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +14 -363
- package/dist/slate.es.js.map +1 -1
- package/dist/text-input.cjs.js +26 -0
- package/dist/text-input.cjs.js.map +1 -0
- package/dist/text-input.es.js +18 -0
- package/dist/text-input.es.js.map +1 -0
- 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/list.d.ts +5 -2
- package/dist/types/src/controls/list.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/introspection.d.ts +5 -0
- package/dist/types/src/controls/rich-text/introspection.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text/introspection.test.d.ts +2 -0
- package/dist/types/src/controls/rich-text/introspection.test.d.ts.map +1 -0
- 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/introspection.d.ts +5 -0
- package/dist/types/src/controls/rich-text-v2/introspection.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/introspection.test.d.ts +2 -0
- package/dist/types/src/controls/rich-text-v2/introspection.test.d.ts.map +1 -0
- 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 +32 -34
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/translation.d.ts +1 -1
- package/dist/types/src/controls/rich-text-v2/translation.d.ts.map +1 -1
- package/dist/types/src/controls/shape.d.ts +5 -2
- package/dist/types/src/controls/shape.d.ts.map +1 -1
- package/dist/types/src/controls/typography.d.ts +2 -0
- package/dist/types/src/controls/typography.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 +11 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/introspection.d.ts +0 -2
- 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 +3 -2
- 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 +4 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/useRemoteChanges.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts +8 -16
- 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/LocalChangesPlugin/index.d.ts +16 -0
- package/dist/types/src/slate/LocalChangesPlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -1
- 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/index.d.ts +1 -0
- package/dist/types/src/slate/index.d.ts.map +1 -1
- package/dist/types/src/slate/types.d.ts +3 -12
- 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 -2
- package/dist/index.cjs10.js +0 -390
- package/dist/index.cjs10.js.map +0 -1
- package/dist/index.cjs9.js +0 -299
- 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 -292
- 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 -746
- package/dist/types.cjs2.js.map +0 -1
- package/dist/types.es2.js +0 -729
- package/dist/types.es2.js.map +0 -1
- package/dist/typography.cjs.js +0 -56
- package/dist/typography.cjs.js.map +0 -1
- package/dist/typography.es.js +0 -41
- package/dist/typography.es.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 { T as
|
|
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: [
|
|
@@ -2537,115 +2699,15 @@ const FallbackComponent = forwardRef(function FallbackComponent2({
|
|
|
2537
2699
|
})]
|
|
2538
2700
|
});
|
|
2539
2701
|
});
|
|
2540
|
-
function
|
|
2541
|
-
|
|
2542
|
-
const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
|
|
2543
|
-
const swatch = useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
|
|
2544
|
-
useEffect(() => {
|
|
2545
|
-
if (swatchId != null)
|
|
2546
|
-
client.fetchSwatch(swatchId).catch(console.error);
|
|
2547
|
-
}, [client, swatchId]);
|
|
2548
|
-
return swatch;
|
|
2549
|
-
}
|
|
2550
|
-
function useSwatches(swatchIds) {
|
|
2551
|
-
const client = useMakeswiftClient();
|
|
2552
|
-
const lastSnapshot = useRef();
|
|
2553
|
-
function getSnapshot() {
|
|
2554
|
-
const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
|
|
2555
|
-
if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
|
|
2556
|
-
return lastSnapshot.current;
|
|
2557
|
-
}
|
|
2558
|
-
return lastSnapshot.current = swatches2;
|
|
2559
|
-
}
|
|
2560
|
-
const swatches = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2561
|
-
useEffect(() => {
|
|
2562
|
-
Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
|
|
2563
|
-
}, [client, swatchIds]);
|
|
2564
|
-
return swatches;
|
|
2565
|
-
}
|
|
2566
|
-
function useFile(fileId) {
|
|
2567
|
-
const client = useMakeswiftClient();
|
|
2568
|
-
const readFile = () => fileId == null ? null : client.readFile(fileId);
|
|
2569
|
-
const file = useSyncExternalStore(client.subscribe, readFile, readFile);
|
|
2570
|
-
useEffect(() => {
|
|
2571
|
-
if (fileId != null)
|
|
2572
|
-
client.fetchFile(fileId);
|
|
2573
|
-
}, [client, fileId]);
|
|
2574
|
-
return file;
|
|
2575
|
-
}
|
|
2576
|
-
function useFiles(fileIds) {
|
|
2577
|
-
const client = useMakeswiftClient();
|
|
2578
|
-
const lastSnapshot = useRef();
|
|
2579
|
-
function getSnapshot() {
|
|
2580
|
-
const files2 = fileIds.map((fileId) => client.readFile(fileId));
|
|
2581
|
-
if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
|
|
2582
|
-
return lastSnapshot.current;
|
|
2583
|
-
}
|
|
2584
|
-
return lastSnapshot.current = files2;
|
|
2585
|
-
}
|
|
2586
|
-
const files = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2587
|
-
useEffect(() => {
|
|
2588
|
-
Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
|
|
2589
|
-
}, [client, fileIds]);
|
|
2590
|
-
return files;
|
|
2591
|
-
}
|
|
2592
|
-
function useTypography(typographyId) {
|
|
2593
|
-
const client = useMakeswiftClient();
|
|
2594
|
-
const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
|
|
2595
|
-
const typography = useSyncExternalStore(client.subscribe, readTypography, readTypography);
|
|
2596
|
-
useEffect(() => {
|
|
2597
|
-
if (typographyId != null)
|
|
2598
|
-
client.fetchTypography(typographyId).catch(console.error);
|
|
2599
|
-
}, [client, typographyId]);
|
|
2600
|
-
return typography;
|
|
2601
|
-
}
|
|
2602
|
-
function useGlobalElement(globalElementId) {
|
|
2603
|
-
const client = useMakeswiftClient();
|
|
2604
|
-
const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
|
|
2605
|
-
const globalElement = useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
|
|
2606
|
-
useEffect(() => {
|
|
2607
|
-
if (globalElementId != null)
|
|
2608
|
-
client.fetchGlobalElement(globalElementId).catch(console.error);
|
|
2609
|
-
}, [client, globalElementId]);
|
|
2610
|
-
return globalElement;
|
|
2611
|
-
}
|
|
2612
|
-
function useLocalizedGlobalElement(globalElementId) {
|
|
2613
|
-
const client = useMakeswiftClient();
|
|
2614
|
-
const readLocalizedGlobalElement = () => globalElementId == null ? null : client.readLocalizedGlobalElement(globalElementId);
|
|
2615
|
-
const localizedGlobalElement = useSyncExternalStore(client.subscribe, readLocalizedGlobalElement, readLocalizedGlobalElement);
|
|
2616
|
-
useEffect(() => {
|
|
2617
|
-
if (globalElementId != null) {
|
|
2618
|
-
client.fetchLocalizedGlobalElement(globalElementId).catch(console.error);
|
|
2619
|
-
}
|
|
2620
|
-
}, [client, globalElementId]);
|
|
2621
|
-
return localizedGlobalElement;
|
|
2622
|
-
}
|
|
2623
|
-
function usePagePathnameSlice(pageId) {
|
|
2624
|
-
const client = useMakeswiftClient();
|
|
2625
|
-
const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
|
|
2626
|
-
const pagePathnameSlice = useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
|
|
2627
|
-
useEffect(() => {
|
|
2628
|
-
if (pageId != null)
|
|
2629
|
-
client.fetchPagePathnameSlice(pageId).catch(console.error);
|
|
2630
|
-
}, [client, pageId]);
|
|
2631
|
-
return pagePathnameSlice;
|
|
2632
|
-
}
|
|
2633
|
-
function useTable(tableId) {
|
|
2634
|
-
const client = useMakeswiftClient();
|
|
2635
|
-
const readTable = () => tableId == null ? null : client.readTable(tableId);
|
|
2636
|
-
const table = useSyncExternalStore(client.subscribe, readTable, readTable);
|
|
2637
|
-
useEffect(() => {
|
|
2638
|
-
if (tableId != null)
|
|
2639
|
-
client.fetchTable(tableId).catch(console.error);
|
|
2640
|
-
}, [client, tableId]);
|
|
2641
|
-
return table;
|
|
2702
|
+
function isNonNullable(value) {
|
|
2703
|
+
return value != null;
|
|
2642
2704
|
}
|
|
2643
|
-
function mapSideColor(swatches,
|
|
2644
|
-
var
|
|
2705
|
+
function mapSideColor(swatches, _g) {
|
|
2706
|
+
var _h = _g, { color } = _h, restOfSide = __objRest(_h, ["color"]);
|
|
2645
2707
|
return __spreadProps(__spreadValues({}, restOfSide), {
|
|
2646
2708
|
color: color && {
|
|
2647
2709
|
alpha: color.alpha,
|
|
2648
|
-
swatch: swatches.filter(isNonNullable
|
|
2710
|
+
swatch: swatches.filter(isNonNullable).find((s) => s && s.id === color.swatchId)
|
|
2649
2711
|
}
|
|
2650
2712
|
});
|
|
2651
2713
|
}
|
|
@@ -2691,7 +2753,7 @@ function useBoxShadow(value) {
|
|
|
2691
2753
|
return __spreadProps(__spreadValues({}, restOfShadow), {
|
|
2692
2754
|
payload: {
|
|
2693
2755
|
color: color != null ? {
|
|
2694
|
-
swatch: swatches.filter(isNonNullable
|
|
2756
|
+
swatch: swatches.filter(isNonNullable).find((s) => s && s.id === color.swatchId),
|
|
2695
2757
|
alpha: color.alpha
|
|
2696
2758
|
} : null,
|
|
2697
2759
|
inset: inset != null ? inset : ShadowDefaultValue.inset,
|
|
@@ -2715,7 +2777,7 @@ function useResponsiveColor(color) {
|
|
|
2715
2777
|
const { swatchId, alpha } = v;
|
|
2716
2778
|
const swatch = swatches.find((s) => s && s.id === swatchId);
|
|
2717
2779
|
return swatch == null ? null : __spreadProps(__spreadValues({}, rest), { value: { swatch, alpha } });
|
|
2718
|
-
}).filter(isNonNullable
|
|
2780
|
+
}).filter(isNonNullable);
|
|
2719
2781
|
}
|
|
2720
2782
|
const getIndexes = (spans, index) => {
|
|
2721
2783
|
const flattened = spans.reduce((a, s) => a.concat(s), []);
|
|
@@ -3173,7 +3235,8 @@ function ListControlValue({
|
|
|
3173
3235
|
function useNumber(numberControlData, controlDefinition) {
|
|
3174
3236
|
return numberControlData != null ? numberControlData : controlDefinition.config.defaultValue;
|
|
3175
3237
|
}
|
|
3176
|
-
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"))));
|
|
3177
3240
|
function useRichText(data, control) {
|
|
3178
3241
|
const textCallbackRef = useCallback((handle) => {
|
|
3179
3242
|
var _a;
|
|
@@ -3182,12 +3245,16 @@ function useRichText(data, control) {
|
|
|
3182
3245
|
text: control
|
|
3183
3246
|
});
|
|
3184
3247
|
}, [control]);
|
|
3185
|
-
|
|
3248
|
+
const isPreview = useIsPreview();
|
|
3249
|
+
return isPreview ? /* @__PURE__ */ jsx(EditableText$1, {
|
|
3250
|
+
text: data,
|
|
3251
|
+
ref: textCallbackRef
|
|
3252
|
+
}) : /* @__PURE__ */ jsx(ReadOnlyText$1, {
|
|
3186
3253
|
text: data,
|
|
3187
3254
|
ref: textCallbackRef
|
|
3188
3255
|
});
|
|
3189
3256
|
}
|
|
3190
|
-
const EditableText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.
|
|
3257
|
+
const EditableText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es8.js"))));
|
|
3191
3258
|
const ReadOnlyText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyTextV2.es.js"))));
|
|
3192
3259
|
const ReadOnlyTextV1 = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyText.es.js"))));
|
|
3193
3260
|
function useRichTextV2(data, definition, control) {
|
|
@@ -3203,7 +3270,7 @@ function useRichTextV2(data, definition, control) {
|
|
|
3203
3270
|
control
|
|
3204
3271
|
}) : /* @__PURE__ */ jsx(ReadOnlyText, {
|
|
3205
3272
|
text: data,
|
|
3206
|
-
|
|
3273
|
+
definition
|
|
3207
3274
|
});
|
|
3208
3275
|
}
|
|
3209
3276
|
function useSelectControlValue(data, definition) {
|
|
@@ -3261,13 +3328,13 @@ function useSlot(data, control) {
|
|
|
3261
3328
|
}, element.key))
|
|
3262
3329
|
});
|
|
3263
3330
|
}
|
|
3264
|
-
function Slot(
|
|
3265
|
-
var
|
|
3331
|
+
function Slot(_i) {
|
|
3332
|
+
var _j = _i, {
|
|
3266
3333
|
as,
|
|
3267
3334
|
control,
|
|
3268
3335
|
children,
|
|
3269
3336
|
className
|
|
3270
|
-
} =
|
|
3337
|
+
} = _j, restOfProps = __objRest(_j, [
|
|
3271
3338
|
"as",
|
|
3272
3339
|
"control",
|
|
3273
3340
|
"children",
|
|
@@ -3296,15 +3363,15 @@ function Slot(_g) {
|
|
|
3296
3363
|
}
|
|
3297
3364
|
Slot.Placeholder = SlotPlaceholder;
|
|
3298
3365
|
Slot.Item = SlotItem;
|
|
3299
|
-
function SlotItem(
|
|
3300
|
-
var
|
|
3366
|
+
function SlotItem(_k) {
|
|
3367
|
+
var _l = _k, {
|
|
3301
3368
|
as,
|
|
3302
3369
|
control,
|
|
3303
3370
|
grid,
|
|
3304
3371
|
index,
|
|
3305
3372
|
children,
|
|
3306
3373
|
className
|
|
3307
|
-
} =
|
|
3374
|
+
} = _l, restOfProps = __objRest(_l, [
|
|
3308
3375
|
"as",
|
|
3309
3376
|
"control",
|
|
3310
3377
|
"grid",
|
|
@@ -3429,9 +3496,6 @@ function useTextAreaValue(data, definition) {
|
|
|
3429
3496
|
function useTextInputValue(data, definition) {
|
|
3430
3497
|
return data != null ? data : definition.config.defaultValue;
|
|
3431
3498
|
}
|
|
3432
|
-
function isNonNullable(value) {
|
|
3433
|
-
return value != null;
|
|
3434
|
-
}
|
|
3435
3499
|
function typographyFragementToTypographyControlData(typography) {
|
|
3436
3500
|
if (typography == null)
|
|
3437
3501
|
return void 0;
|
|
@@ -3463,7 +3527,7 @@ function getTypographyStyleSwatchIds(style) {
|
|
|
3463
3527
|
return (_a = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
|
|
3464
3528
|
var _a2;
|
|
3465
3529
|
return (_a2 = typographyStyle.color) == null ? void 0 : _a2.swatchId;
|
|
3466
|
-
}).filter(isNonNullable)) != null ? _a : [];
|
|
3530
|
+
}).filter(isNonNullable$1)) != null ? _a : [];
|
|
3467
3531
|
}
|
|
3468
3532
|
const withColor = (swatches) => (deviceRawTypographyValue) => {
|
|
3469
3533
|
var _b, _c;
|
|
@@ -3499,7 +3563,7 @@ function useEnhancedTypography(value) {
|
|
|
3499
3563
|
...getTypographyStyleSwatchIds(value == null ? void 0 : value.style),
|
|
3500
3564
|
...getTypographyStyleSwatchIds(typography == null ? void 0 : typography.style)
|
|
3501
3565
|
];
|
|
3502
|
-
const swatches = useSwatches(swatchIds).filter(isNonNullable);
|
|
3566
|
+
const swatches = useSwatches(swatchIds).filter(isNonNullable$1);
|
|
3503
3567
|
const enhancedSource = source.map(withColor(swatches));
|
|
3504
3568
|
const enhancedOverride = override.map(withColor(swatches));
|
|
3505
3569
|
const devices = [
|
|
@@ -3526,7 +3590,7 @@ function useEnhancedTypography(value) {
|
|
|
3526
3590
|
};
|
|
3527
3591
|
}
|
|
3528
3592
|
return null;
|
|
3529
|
-
}).filter(isNonNullable);
|
|
3593
|
+
}).filter(isNonNullable$1);
|
|
3530
3594
|
}
|
|
3531
3595
|
function useTypographyClassName(value) {
|
|
3532
3596
|
return useStyle(useResponsiveStyle([value], ([value2]) => {
|
|
@@ -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
|