@makeswift/runtime 0.10.3 → 0.10.4
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 +1 -3
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +2 -4
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +4 -4
- package/dist/Button.es.js +5 -5
- package/dist/Carousel.cjs.js +3 -3
- package/dist/Carousel.es.js +4 -4
- package/dist/Countdown.cjs.js +1 -3
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +2 -4
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +1 -3
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +2 -4
- 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 -13
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +5 -5
- package/dist/Image.cjs.js +13 -13
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +13 -13
- package/dist/LiveProvider.cjs.js +1 -3
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +3 -5
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +12 -12
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +12 -12
- package/dist/PreviewProvider.cjs.js +1 -3
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +3 -5
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +7 -6
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +4 -3
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +7 -60
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +9 -62
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +1 -3
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +2 -4
- package/dist/Root.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +6 -6
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +7 -7
- 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 +1 -0
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +1 -0
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +3 -3
- package/dist/components.es.js +3 -3
- package/dist/control-serialization.es.js +1 -1
- package/dist/controls.cjs.js +1 -0
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +2 -1
- package/dist/controls.es.js.map +1 -1
- package/dist/index.cjs.js +120 -256
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs3.js +107 -21
- package/dist/index.cjs3.js.map +1 -1
- package/dist/index.cjs4.js +57 -16
- package/dist/index.cjs4.js.map +1 -1
- package/dist/index.cjs5.js +42 -81
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs6.js +82 -17
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +18 -377
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.cjs8.js +258 -181
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.cjs9.js +343 -0
- package/dist/index.cjs9.js.map +1 -0
- package/dist/index.es.js +125 -260
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js +1 -1
- package/dist/index.es3.js +103 -22
- package/dist/index.es3.js.map +1 -1
- package/dist/index.es4.js +57 -16
- package/dist/index.es4.js.map +1 -1
- package/dist/index.es5.js +42 -80
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es6.js +81 -17
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es7.js +18 -371
- package/dist/index.es7.js.map +1 -1
- package/dist/index.es8.js +259 -182
- package/dist/index.es8.js.map +1 -1
- package/dist/index.es9.js +336 -0
- package/dist/index.es9.js.map +1 -0
- package/dist/main.cjs.js +1 -0
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +1 -0
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +1 -3
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +2 -4
- package/dist/next.es.js.map +1 -1
- package/dist/prop-controllers.cjs.js +1 -0
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +1 -0
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/react-page.cjs.js +26 -6
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +26 -7
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +1 -3
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +1 -3
- package/dist/react.es.js.map +1 -1
- package/dist/slate.cjs.js +9 -6
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +9 -7
- package/dist/slate.es.js.map +1 -1
- package/dist/toText.cjs.js +67 -0
- package/dist/toText.cjs.js.map +1 -0
- package/dist/toText.es.js +66 -0
- package/dist/toText.es.js.map +1 -0
- package/dist/types/src/components/builtin/Text/register.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +2 -4
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/usePresetValue.d.ts +10 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/usePresetValue.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
- package/dist/types/src/slate/BuilderPlugin/index.d.ts +2 -1
- package/dist/types/src/slate/BuilderPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlineModePlugin/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/utils/index.d.ts +2 -0
- package/dist/types/src/slate/utils/index.d.ts.map +1 -0
- package/dist/types/src/slate/utils/toText.d.ts +4 -0
- package/dist/types/src/slate/utils/toText.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -38,7 +38,7 @@ 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 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
|
|
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, y as ResponsiveColor, z as TextStyle, C as ComponentIcon, I as Images, N as Number$1, D as Date$1, F as Font, A as ResponsiveLength, H as TextArea, J as Table, K as TableFormFields, O as Image, Q as ResponsiveOpacity, U as NavigationLinks, V as SocialLinks, X as RichText, Y as Video, Z as useStyle, _ as getBorderSwatchIds, $ as getBoxShadowsSwatchIds, a0 as getResponsiveColorSwatchIds, a1 as StyleControlProperty, a2 as ImageControlValueFormat, a3 as isPropControllersHandle, a4 as isRichTextV1Data, a5 as isNonNullable$1, a6 as TypographyControlType, a7 as StyleControlType, a8 as RichTextV2ControlType, a9 as RichTextControlType, aa as SlotControlType, ab as StyleV2ControlType, ac as ListControlType, ad as ShapeControlType, ae as LinkControlType, af as ImageControlType, ag as IconRadioGroupControlType, ah as ColorControlType, ai as SelectControlType, aj as getComponentPropControllerDescriptors, ak as getPropControllers, al as Types, am as BorderPropControllerFormat, an as ShadowsPropControllerFormat, ao as BorderRadiusPropControllerFormat, ap as MarginPropControllerFormat, aq as PaddingPropControllerFormat, ar as WidthPropControllerFormat, as as configureStore$1, at as copyElementTree, au as getBreakpoints, av as parseLocalesInput, aw as getDocument, ax as getElementId, ay as getIsInBuilder, az as getReactComponent, aA as getBuilderEditMode, aB 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
44
|
import { T as TextAreaControlType, a as TextInputControlType, N as NumberControlType, C as CheckboxControlType } from "./text-input.es.js";
|
|
@@ -49,7 +49,7 @@ import { useSyncExternalStore } from "use-sync-external-store/shim";
|
|
|
49
49
|
import { createStore, applyMiddleware } from "redux";
|
|
50
50
|
import thunk from "redux-thunk";
|
|
51
51
|
import { A as APIResourceType } from "./types.es.js";
|
|
52
|
-
import { getBaseBreakpoint, findBreakpointOverride,
|
|
52
|
+
import { getBaseBreakpoint, findBreakpointOverride, join, getBreakpoint, getBreakpointMediaQuery, mergeOrCoalesceFallbacks, shallowMergeFallbacks, parseBreakpointsInput } from "./state/breakpoints.es.js";
|
|
53
53
|
import { g as getBox, i as isMeasurable, m as measure } from "./box-models.es.js";
|
|
54
54
|
import ColorHelper from "color";
|
|
55
55
|
import scrollIntoView from "scroll-into-view-if-needed";
|
|
@@ -66,10 +66,6 @@ import { serialize } from "cookie";
|
|
|
66
66
|
import { createProxyServer } from "http-proxy";
|
|
67
67
|
import { parse as parse$1 } from "set-cookie-parser";
|
|
68
68
|
import { M as MakeswiftComponentType } from "./constants.es.js";
|
|
69
|
-
import ipsum from "corporate-ipsum";
|
|
70
|
-
import "is-hotkey";
|
|
71
|
-
import "slate-react";
|
|
72
|
-
import NextLink from "next/link";
|
|
73
69
|
const SCRIPT_TAG = "script";
|
|
74
70
|
function BodySnippet({
|
|
75
71
|
code,
|
|
@@ -1179,7 +1175,7 @@ async function fonts(_req, res, { getFonts } = {}) {
|
|
|
1179
1175
|
const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
|
|
1180
1176
|
return res.json(fonts2);
|
|
1181
1177
|
}
|
|
1182
|
-
const version = "0.10.
|
|
1178
|
+
const version = "0.10.4";
|
|
1183
1179
|
async function handler(req, res, { apiKey, unstable_siteVersions }) {
|
|
1184
1180
|
if (req.query.secret !== apiKey) {
|
|
1185
1181
|
return res.status(401).json({ message: "Unauthorized" });
|
|
@@ -1627,7 +1623,7 @@ function registerComponent$b(runtime) {
|
|
|
1627
1623
|
props: {
|
|
1628
1624
|
id: ElementID(),
|
|
1629
1625
|
children: TextInput({ placeholder: "Button text" }),
|
|
1630
|
-
link: Link
|
|
1626
|
+
link: Link({
|
|
1631
1627
|
defaultValue: {
|
|
1632
1628
|
type: "OPEN_PAGE",
|
|
1633
1629
|
payload: {
|
|
@@ -1952,7 +1948,7 @@ function registerComponent$6(runtime) {
|
|
|
1952
1948
|
id: ElementID(),
|
|
1953
1949
|
tableId: Table(),
|
|
1954
1950
|
fields: TableFormFields(),
|
|
1955
|
-
submitLink: Link
|
|
1951
|
+
submitLink: Link((props) => ({
|
|
1956
1952
|
label: "Redirect to",
|
|
1957
1953
|
options: [
|
|
1958
1954
|
{ value: "OPEN_PAGE", label: "Open page" },
|
|
@@ -2077,7 +2073,7 @@ function registerComponent$5(runtime) {
|
|
|
2077
2073
|
id: ElementID(),
|
|
2078
2074
|
file: Image(),
|
|
2079
2075
|
altText: TextInput({ label: "Alt text" }),
|
|
2080
|
-
link: Link
|
|
2076
|
+
link: Link({ label: "On click" }),
|
|
2081
2077
|
width: Width(),
|
|
2082
2078
|
margin: Margin({ format: Margin.Format.ClassName }),
|
|
2083
2079
|
padding: Padding({ format: Padding.Format.ClassName }),
|
|
@@ -2125,7 +2121,7 @@ function registerComponent$4(runtime) {
|
|
|
2125
2121
|
label: "Logo alt text",
|
|
2126
2122
|
hidden: props.showLogo === false
|
|
2127
2123
|
})),
|
|
2128
|
-
logoLink: Link
|
|
2124
|
+
logoLink: Link((props) => ({
|
|
2129
2125
|
label: "Logo on click",
|
|
2130
2126
|
hidden: props.showLogo === false
|
|
2131
2127
|
})),
|
|
@@ -2334,247 +2330,13 @@ function registerComponent$2(runtime) {
|
|
|
2334
2330
|
}
|
|
2335
2331
|
});
|
|
2336
2332
|
}
|
|
2337
|
-
function useSwatch(swatchId) {
|
|
2338
|
-
const client = useMakeswiftClient();
|
|
2339
|
-
const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
|
|
2340
|
-
const swatch = useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
|
|
2341
|
-
useEffect(() => {
|
|
2342
|
-
if (swatchId != null)
|
|
2343
|
-
client.fetchSwatch(swatchId).catch(console.error);
|
|
2344
|
-
}, [client, swatchId]);
|
|
2345
|
-
return swatch;
|
|
2346
|
-
}
|
|
2347
|
-
function useSwatches(swatchIds) {
|
|
2348
|
-
const client = useMakeswiftClient();
|
|
2349
|
-
const lastSnapshot = useRef();
|
|
2350
|
-
function getSnapshot() {
|
|
2351
|
-
const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
|
|
2352
|
-
if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
|
|
2353
|
-
return lastSnapshot.current;
|
|
2354
|
-
}
|
|
2355
|
-
return lastSnapshot.current = swatches2;
|
|
2356
|
-
}
|
|
2357
|
-
const swatches = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2358
|
-
useEffect(() => {
|
|
2359
|
-
Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
|
|
2360
|
-
}, [client, swatchIds]);
|
|
2361
|
-
return swatches;
|
|
2362
|
-
}
|
|
2363
|
-
function useFile(fileId) {
|
|
2364
|
-
const client = useMakeswiftClient();
|
|
2365
|
-
const readFile = () => fileId == null ? null : client.readFile(fileId);
|
|
2366
|
-
const file = useSyncExternalStore(client.subscribe, readFile, readFile);
|
|
2367
|
-
useEffect(() => {
|
|
2368
|
-
if (fileId != null)
|
|
2369
|
-
client.fetchFile(fileId);
|
|
2370
|
-
}, [client, fileId]);
|
|
2371
|
-
return file;
|
|
2372
|
-
}
|
|
2373
|
-
function useFiles(fileIds) {
|
|
2374
|
-
const client = useMakeswiftClient();
|
|
2375
|
-
const lastSnapshot = useRef();
|
|
2376
|
-
function getSnapshot() {
|
|
2377
|
-
const files2 = fileIds.map((fileId) => client.readFile(fileId));
|
|
2378
|
-
if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
|
|
2379
|
-
return lastSnapshot.current;
|
|
2380
|
-
}
|
|
2381
|
-
return lastSnapshot.current = files2;
|
|
2382
|
-
}
|
|
2383
|
-
const files = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2384
|
-
useEffect(() => {
|
|
2385
|
-
Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
|
|
2386
|
-
}, [client, fileIds]);
|
|
2387
|
-
return files;
|
|
2388
|
-
}
|
|
2389
|
-
function useTypography(typographyId) {
|
|
2390
|
-
const client = useMakeswiftClient();
|
|
2391
|
-
const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
|
|
2392
|
-
const typography = useSyncExternalStore(client.subscribe, readTypography, readTypography);
|
|
2393
|
-
useEffect(() => {
|
|
2394
|
-
if (typographyId != null)
|
|
2395
|
-
client.fetchTypography(typographyId).catch(console.error);
|
|
2396
|
-
}, [client, typographyId]);
|
|
2397
|
-
return typography;
|
|
2398
|
-
}
|
|
2399
|
-
function useGlobalElement(globalElementId) {
|
|
2400
|
-
const client = useMakeswiftClient();
|
|
2401
|
-
const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
|
|
2402
|
-
const globalElement = useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
|
|
2403
|
-
useEffect(() => {
|
|
2404
|
-
if (globalElementId != null)
|
|
2405
|
-
client.fetchGlobalElement(globalElementId).catch(console.error);
|
|
2406
|
-
}, [client, globalElementId]);
|
|
2407
|
-
return globalElement;
|
|
2408
|
-
}
|
|
2409
|
-
function useLocalizedGlobalElement(globalElementId) {
|
|
2410
|
-
const client = useMakeswiftClient();
|
|
2411
|
-
const readLocalizedGlobalElement = () => globalElementId == null ? null : client.readLocalizedGlobalElement(globalElementId);
|
|
2412
|
-
const localizedGlobalElement = useSyncExternalStore(client.subscribe, readLocalizedGlobalElement, readLocalizedGlobalElement);
|
|
2413
|
-
useEffect(() => {
|
|
2414
|
-
if (globalElementId != null) {
|
|
2415
|
-
client.fetchLocalizedGlobalElement(globalElementId).catch(console.error);
|
|
2416
|
-
}
|
|
2417
|
-
}, [client, globalElementId]);
|
|
2418
|
-
return localizedGlobalElement;
|
|
2419
|
-
}
|
|
2420
|
-
function usePagePathnameSlice(pageId) {
|
|
2421
|
-
const client = useMakeswiftClient();
|
|
2422
|
-
const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
|
|
2423
|
-
const pagePathnameSlice = useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
|
|
2424
|
-
useEffect(() => {
|
|
2425
|
-
if (pageId != null)
|
|
2426
|
-
client.fetchPagePathnameSlice(pageId).catch(console.error);
|
|
2427
|
-
}, [client, pageId]);
|
|
2428
|
-
return pagePathnameSlice;
|
|
2429
|
-
}
|
|
2430
|
-
function useTable(tableId) {
|
|
2431
|
-
const client = useMakeswiftClient();
|
|
2432
|
-
const readTable = () => tableId == null ? null : client.readTable(tableId);
|
|
2433
|
-
const table = useSyncExternalStore(client.subscribe, readTable, readTable);
|
|
2434
|
-
useEffect(() => {
|
|
2435
|
-
if (tableId != null)
|
|
2436
|
-
client.fetchTable(tableId).catch(console.error);
|
|
2437
|
-
}, [client, tableId]);
|
|
2438
|
-
return table;
|
|
2439
|
-
}
|
|
2440
|
-
const Link = forwardRef(function Link2(_e, ref) {
|
|
2441
|
-
var _f = _e, {
|
|
2442
|
-
link,
|
|
2443
|
-
onClick = () => {
|
|
2444
|
-
}
|
|
2445
|
-
} = _f, restOfProps = __objRest(_f, [
|
|
2446
|
-
"link",
|
|
2447
|
-
"onClick"
|
|
2448
|
-
]);
|
|
2449
|
-
var _a;
|
|
2450
|
-
const pageId = link && link.type === "OPEN_PAGE" ? link.payload.pageId : null;
|
|
2451
|
-
const page = usePagePathnameSlice(pageId != null ? pageId : null);
|
|
2452
|
-
const elementKey = (link == null ? void 0 : link.type) === "SCROLL_TO_ELEMENT" ? (_a = link.payload.elementIdConfig) == null ? void 0 : _a.elementKey : null;
|
|
2453
|
-
const elementId = useElementId(elementKey);
|
|
2454
|
-
let useNextLink;
|
|
2455
|
-
let href;
|
|
2456
|
-
let target;
|
|
2457
|
-
let block;
|
|
2458
|
-
if (link) {
|
|
2459
|
-
switch (link.type) {
|
|
2460
|
-
case "OPEN_PAGE": {
|
|
2461
|
-
if (page) {
|
|
2462
|
-
useNextLink = true;
|
|
2463
|
-
href = `/${page.pathname}`;
|
|
2464
|
-
}
|
|
2465
|
-
target = link.payload.openInNewTab ? "_blank" : "_self";
|
|
2466
|
-
break;
|
|
2467
|
-
}
|
|
2468
|
-
case "OPEN_URL": {
|
|
2469
|
-
useNextLink = true;
|
|
2470
|
-
href = link.payload.url;
|
|
2471
|
-
target = link.payload.openInNewTab ? "_blank" : "_self";
|
|
2472
|
-
break;
|
|
2473
|
-
}
|
|
2474
|
-
case "SEND_EMAIL": {
|
|
2475
|
-
useNextLink = false;
|
|
2476
|
-
const {
|
|
2477
|
-
to,
|
|
2478
|
-
subject = "",
|
|
2479
|
-
body = ""
|
|
2480
|
-
} = link.payload;
|
|
2481
|
-
if (to != null)
|
|
2482
|
-
href = `mailto:${to}?subject=${subject}&body=${body}`;
|
|
2483
|
-
break;
|
|
2484
|
-
}
|
|
2485
|
-
case "CALL_PHONE": {
|
|
2486
|
-
useNextLink = false;
|
|
2487
|
-
href = `tel:${link.payload.phoneNumber}`;
|
|
2488
|
-
break;
|
|
2489
|
-
}
|
|
2490
|
-
case "SCROLL_TO_ELEMENT": {
|
|
2491
|
-
useNextLink = false;
|
|
2492
|
-
href = `#${elementId != null ? elementId : ""}`;
|
|
2493
|
-
block = link.payload.block;
|
|
2494
|
-
break;
|
|
2495
|
-
}
|
|
2496
|
-
default:
|
|
2497
|
-
throw new RangeError(`Invalid link type "${link.type}."`);
|
|
2498
|
-
}
|
|
2499
|
-
}
|
|
2500
|
-
function handleClick(event) {
|
|
2501
|
-
onClick(event);
|
|
2502
|
-
if (event.defaultPrevented)
|
|
2503
|
-
return;
|
|
2504
|
-
if (event.currentTarget.isContentEditable)
|
|
2505
|
-
return event.preventDefault();
|
|
2506
|
-
if (link && link.type === "SCROLL_TO_ELEMENT") {
|
|
2507
|
-
let hash;
|
|
2508
|
-
try {
|
|
2509
|
-
if (href != null)
|
|
2510
|
-
hash = new URL(`http://www.example.com/${href}`).hash;
|
|
2511
|
-
} catch (error) {
|
|
2512
|
-
console.error(`Link received invalid href: ${href}`, error);
|
|
2513
|
-
}
|
|
2514
|
-
if (href != null && hash != null && href === hash) {
|
|
2515
|
-
event.preventDefault();
|
|
2516
|
-
const view = event.view;
|
|
2517
|
-
scrollIntoView(view.document.querySelector(hash), {
|
|
2518
|
-
behavior: "smooth",
|
|
2519
|
-
block
|
|
2520
|
-
});
|
|
2521
|
-
if (view.location.hash !== hash)
|
|
2522
|
-
view.history.pushState({}, "", hash);
|
|
2523
|
-
}
|
|
2524
|
-
}
|
|
2525
|
-
}
|
|
2526
|
-
if (useNextLink && href != null) {
|
|
2527
|
-
return /* @__PURE__ */ jsx(NextLink, __spreadProps(__spreadValues({}, restOfProps), {
|
|
2528
|
-
ref,
|
|
2529
|
-
target,
|
|
2530
|
-
onClick: handleClick,
|
|
2531
|
-
href,
|
|
2532
|
-
legacyBehavior: false
|
|
2533
|
-
}));
|
|
2534
|
-
}
|
|
2535
|
-
return /* @__PURE__ */ jsx("a", __spreadProps(__spreadValues({}, restOfProps), {
|
|
2536
|
-
ref,
|
|
2537
|
-
href,
|
|
2538
|
-
target,
|
|
2539
|
-
onClick: handleClick
|
|
2540
|
-
}));
|
|
2541
|
-
});
|
|
2542
2333
|
function registerComponent$1(runtime) {
|
|
2543
2334
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic(() => patch(import("./Text.es.js")))), {
|
|
2544
2335
|
type: MakeswiftComponentType.Text,
|
|
2545
2336
|
label: "Text",
|
|
2546
2337
|
props: {
|
|
2547
2338
|
id: ElementID(),
|
|
2548
|
-
text: RichText(
|
|
2549
|
-
unstable_defaultValue: [
|
|
2550
|
-
{
|
|
2551
|
-
type: BlockType.Default,
|
|
2552
|
-
children: [
|
|
2553
|
-
{
|
|
2554
|
-
text: ipsum(3),
|
|
2555
|
-
typography: {
|
|
2556
|
-
style: [
|
|
2557
|
-
{
|
|
2558
|
-
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2559
|
-
value: {
|
|
2560
|
-
fontWeight: 400,
|
|
2561
|
-
fontSize: { value: 18, unit: "px" },
|
|
2562
|
-
lineHeight: 1.5
|
|
2563
|
-
}
|
|
2564
|
-
},
|
|
2565
|
-
...runtime.getBreakpoints().some(({ id }) => id === DefaultBreakpointID.Mobile) ? [
|
|
2566
|
-
{
|
|
2567
|
-
deviceId: DefaultBreakpointID.Mobile,
|
|
2568
|
-
value: { fontSize: { value: 16, unit: "px" } }
|
|
2569
|
-
}
|
|
2570
|
-
] : []
|
|
2571
|
-
]
|
|
2572
|
-
}
|
|
2573
|
-
}
|
|
2574
|
-
]
|
|
2575
|
-
}
|
|
2576
|
-
]
|
|
2577
|
-
}),
|
|
2339
|
+
text: RichText(),
|
|
2578
2340
|
width: Width({
|
|
2579
2341
|
format: Width.Format.ClassName,
|
|
2580
2342
|
preset: [
|
|
@@ -2703,8 +2465,111 @@ const FallbackComponent = forwardRef(function FallbackComponent2({
|
|
|
2703
2465
|
function isNonNullable(value) {
|
|
2704
2466
|
return value != null;
|
|
2705
2467
|
}
|
|
2706
|
-
function
|
|
2707
|
-
|
|
2468
|
+
function useSwatch(swatchId) {
|
|
2469
|
+
const client = useMakeswiftClient();
|
|
2470
|
+
const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
|
|
2471
|
+
const swatch = useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
|
|
2472
|
+
useEffect(() => {
|
|
2473
|
+
if (swatchId != null)
|
|
2474
|
+
client.fetchSwatch(swatchId).catch(console.error);
|
|
2475
|
+
}, [client, swatchId]);
|
|
2476
|
+
return swatch;
|
|
2477
|
+
}
|
|
2478
|
+
function useSwatches(swatchIds) {
|
|
2479
|
+
const client = useMakeswiftClient();
|
|
2480
|
+
const lastSnapshot = useRef();
|
|
2481
|
+
function getSnapshot() {
|
|
2482
|
+
const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
|
|
2483
|
+
if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
|
|
2484
|
+
return lastSnapshot.current;
|
|
2485
|
+
}
|
|
2486
|
+
return lastSnapshot.current = swatches2;
|
|
2487
|
+
}
|
|
2488
|
+
const swatches = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2489
|
+
useEffect(() => {
|
|
2490
|
+
Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
|
|
2491
|
+
}, [client, swatchIds]);
|
|
2492
|
+
return swatches;
|
|
2493
|
+
}
|
|
2494
|
+
function useFile(fileId) {
|
|
2495
|
+
const client = useMakeswiftClient();
|
|
2496
|
+
const readFile = () => fileId == null ? null : client.readFile(fileId);
|
|
2497
|
+
const file = useSyncExternalStore(client.subscribe, readFile, readFile);
|
|
2498
|
+
useEffect(() => {
|
|
2499
|
+
if (fileId != null)
|
|
2500
|
+
client.fetchFile(fileId);
|
|
2501
|
+
}, [client, fileId]);
|
|
2502
|
+
return file;
|
|
2503
|
+
}
|
|
2504
|
+
function useFiles(fileIds) {
|
|
2505
|
+
const client = useMakeswiftClient();
|
|
2506
|
+
const lastSnapshot = useRef();
|
|
2507
|
+
function getSnapshot() {
|
|
2508
|
+
const files2 = fileIds.map((fileId) => client.readFile(fileId));
|
|
2509
|
+
if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
|
|
2510
|
+
return lastSnapshot.current;
|
|
2511
|
+
}
|
|
2512
|
+
return lastSnapshot.current = files2;
|
|
2513
|
+
}
|
|
2514
|
+
const files = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2515
|
+
useEffect(() => {
|
|
2516
|
+
Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
|
|
2517
|
+
}, [client, fileIds]);
|
|
2518
|
+
return files;
|
|
2519
|
+
}
|
|
2520
|
+
function useTypography(typographyId) {
|
|
2521
|
+
const client = useMakeswiftClient();
|
|
2522
|
+
const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
|
|
2523
|
+
const typography = useSyncExternalStore(client.subscribe, readTypography, readTypography);
|
|
2524
|
+
useEffect(() => {
|
|
2525
|
+
if (typographyId != null)
|
|
2526
|
+
client.fetchTypography(typographyId).catch(console.error);
|
|
2527
|
+
}, [client, typographyId]);
|
|
2528
|
+
return typography;
|
|
2529
|
+
}
|
|
2530
|
+
function useGlobalElement(globalElementId) {
|
|
2531
|
+
const client = useMakeswiftClient();
|
|
2532
|
+
const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
|
|
2533
|
+
const globalElement = useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
|
|
2534
|
+
useEffect(() => {
|
|
2535
|
+
if (globalElementId != null)
|
|
2536
|
+
client.fetchGlobalElement(globalElementId).catch(console.error);
|
|
2537
|
+
}, [client, globalElementId]);
|
|
2538
|
+
return globalElement;
|
|
2539
|
+
}
|
|
2540
|
+
function useLocalizedGlobalElement(globalElementId) {
|
|
2541
|
+
const client = useMakeswiftClient();
|
|
2542
|
+
const readLocalizedGlobalElement = () => globalElementId == null ? null : client.readLocalizedGlobalElement(globalElementId);
|
|
2543
|
+
const localizedGlobalElement = useSyncExternalStore(client.subscribe, readLocalizedGlobalElement, readLocalizedGlobalElement);
|
|
2544
|
+
useEffect(() => {
|
|
2545
|
+
if (globalElementId != null) {
|
|
2546
|
+
client.fetchLocalizedGlobalElement(globalElementId).catch(console.error);
|
|
2547
|
+
}
|
|
2548
|
+
}, [client, globalElementId]);
|
|
2549
|
+
return localizedGlobalElement;
|
|
2550
|
+
}
|
|
2551
|
+
function usePagePathnameSlice(pageId) {
|
|
2552
|
+
const client = useMakeswiftClient();
|
|
2553
|
+
const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
|
|
2554
|
+
const pagePathnameSlice = useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
|
|
2555
|
+
useEffect(() => {
|
|
2556
|
+
if (pageId != null)
|
|
2557
|
+
client.fetchPagePathnameSlice(pageId).catch(console.error);
|
|
2558
|
+
}, [client, pageId]);
|
|
2559
|
+
return pagePathnameSlice;
|
|
2560
|
+
}
|
|
2561
|
+
function useTable(tableId) {
|
|
2562
|
+
const client = useMakeswiftClient();
|
|
2563
|
+
const readTable = () => tableId == null ? null : client.readTable(tableId);
|
|
2564
|
+
const table = useSyncExternalStore(client.subscribe, readTable, readTable);
|
|
2565
|
+
useEffect(() => {
|
|
2566
|
+
if (tableId != null)
|
|
2567
|
+
client.fetchTable(tableId).catch(console.error);
|
|
2568
|
+
}, [client, tableId]);
|
|
2569
|
+
return table;
|
|
2570
|
+
}
|
|
2571
|
+
function mapSideColor(swatches, _e) {
|
|
2572
|
+
var _f = _e, { color } = _f, restOfSide = __objRest(_f, ["color"]);
|
|
2708
2573
|
return __spreadProps(__spreadValues({}, restOfSide), {
|
|
2709
2574
|
color: color && {
|
|
2710
2575
|
alpha: color.alpha,
|
|
@@ -3236,7 +3101,7 @@ function ListControlValue({
|
|
|
3236
3101
|
function useNumber(numberControlData, controlDefinition) {
|
|
3237
3102
|
return numberControlData != null ? numberControlData : controlDefinition.config.defaultValue;
|
|
3238
3103
|
}
|
|
3239
|
-
const EditableText$1 = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.
|
|
3104
|
+
const EditableText$1 = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es8.js"))));
|
|
3240
3105
|
const ReadOnlyText$1 = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyText.es.js"))));
|
|
3241
3106
|
function useRichText(data, control) {
|
|
3242
3107
|
const textCallbackRef = useCallback((handle) => {
|
|
@@ -3255,7 +3120,7 @@ function useRichText(data, control) {
|
|
|
3255
3120
|
ref: textCallbackRef
|
|
3256
3121
|
});
|
|
3257
3122
|
}
|
|
3258
|
-
const EditableText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.
|
|
3123
|
+
const EditableText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es9.js"))));
|
|
3259
3124
|
const ReadOnlyText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyTextV2.es.js"))));
|
|
3260
3125
|
const ReadOnlyTextV1 = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyText.es.js"))));
|
|
3261
3126
|
function useRichTextV2(data, definition, control) {
|
|
@@ -3329,13 +3194,13 @@ function useSlot(data, control) {
|
|
|
3329
3194
|
}, element.key))
|
|
3330
3195
|
});
|
|
3331
3196
|
}
|
|
3332
|
-
function Slot(
|
|
3333
|
-
var
|
|
3197
|
+
function Slot(_g) {
|
|
3198
|
+
var _h = _g, {
|
|
3334
3199
|
as,
|
|
3335
3200
|
control,
|
|
3336
3201
|
children,
|
|
3337
3202
|
className
|
|
3338
|
-
} =
|
|
3203
|
+
} = _h, restOfProps = __objRest(_h, [
|
|
3339
3204
|
"as",
|
|
3340
3205
|
"control",
|
|
3341
3206
|
"children",
|
|
@@ -3364,15 +3229,15 @@ function Slot(_i) {
|
|
|
3364
3229
|
}
|
|
3365
3230
|
Slot.Placeholder = SlotPlaceholder;
|
|
3366
3231
|
Slot.Item = SlotItem;
|
|
3367
|
-
function SlotItem(
|
|
3368
|
-
var
|
|
3232
|
+
function SlotItem(_i) {
|
|
3233
|
+
var _j = _i, {
|
|
3369
3234
|
as,
|
|
3370
3235
|
control,
|
|
3371
3236
|
grid,
|
|
3372
3237
|
index,
|
|
3373
3238
|
children,
|
|
3374
3239
|
className
|
|
3375
|
-
} =
|
|
3240
|
+
} = _j, restOfProps = __objRest(_j, [
|
|
3376
3241
|
"as",
|
|
3377
3242
|
"control",
|
|
3378
3243
|
"grid",
|
|
@@ -4086,10 +3951,10 @@ registerBuiltinComponents(ReactRuntime);
|
|
|
4086
3951
|
const StoreContext = createContext(ReactRuntime.store);
|
|
4087
3952
|
const PreviewProvider = dynamic(() => import("./PreviewProvider.es.js"));
|
|
4088
3953
|
const LiveProvider = dynamic(() => import("./LiveProvider.es.js"));
|
|
4089
|
-
function RuntimeProvider(
|
|
4090
|
-
var
|
|
3954
|
+
function RuntimeProvider(_k) {
|
|
3955
|
+
var _l = _k, {
|
|
4091
3956
|
preview
|
|
4092
|
-
} =
|
|
3957
|
+
} = _l, props = __objRest(_l, [
|
|
4093
3958
|
"preview"
|
|
4094
3959
|
]);
|
|
4095
3960
|
return preview ? /* @__PURE__ */ jsx(PreviewProvider, __spreadValues({}, props)) : /* @__PURE__ */ jsx(LiveProvider, __spreadValues({}, props));
|
|
@@ -4292,5 +4157,5 @@ const DocumentReference = memo(forwardRef(function DocumentReference2({
|
|
|
4292
4157
|
document: document2
|
|
4293
4158
|
});
|
|
4294
4159
|
}));
|
|
4295
|
-
export {
|
|
4160
|
+
export { MakeswiftApiHandler as $, Alignments as A, isNonNullable as B, Contrasts as C, DocumentReference as D, Element$1 as E, useFiles as F, useSwatches as G, usePagePathnameSlice as H, useElementId as I, ElementImperativeHandle as J, StoreContext as K, useEnhancedTypography as L, MakeswiftProvider as M, useTypographyClassName as N, useBuilderEditMode as O, PageProvider as P, pollBoxModel as Q, RuntimeProvider as R, Shapes as S, ControlValue as T, getStaticPaths as U, getStaticProps as V, getServerSideProps as W, Page as X, Makeswift as Y, PreviewModeScript as Z, Document$1 as _, ReactRuntime as a, forwardNextDynamicRef as a0, usePageId as b, DEFAULT_BOX_ANIMATE_TYPE as c, DEFAULT_BOX_ANIMATE_DELAY as d, DEFAULT_BOX_ANIMATE_DURATION as e, DEFAULT_ITEM_ANIMATE_TYPE as f, DEFAULT_ITEM_ANIMATE_DELAY as g, DEFAULT_ITEM_ANIMATE_DURATION as h, DEFAULT_ITEM_STAGGER_DURATION as i, useBorder as j, useBoxShadow as k, useResponsiveColor as l, Page$1 as m, 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 };
|
|
4296
4161
|
//# sourceMappingURL=index.es.js.map
|