@makeswift/runtime 0.9.2 → 0.9.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 +1 -3
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +2 -4
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +1 -3
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +2 -4
- package/dist/Carousel.es.js.map +1 -1
- 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.es.js +1 -1
- package/dist/Form.cjs.js +1 -3
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +2 -4
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +1 -3
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +2 -4
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +1 -3
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +2 -4
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +1 -3
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +2 -4
- package/dist/Navigation.es.js.map +1 -1
- package/dist/PreviewProvider.cjs.js +3 -5
- 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 +4 -7
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +4 -7
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +11 -14
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +10 -13
- 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 +1 -3
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +2 -4
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Text.cjs.js +2 -4
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +2 -4
- package/dist/Text.es.js.map +1 -1
- package/dist/Video.es.js +1 -1
- package/dist/components.cjs.js +1 -3
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +1 -3
- package/dist/components.es.js.map +1 -1
- package/dist/control-serialization.es.js +1 -1
- package/dist/controls.cjs.js +18 -15
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +2 -3
- package/dist/controls.es.js.map +1 -1
- package/dist/index.cjs.js +205 -57
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs10.js +261 -172
- package/dist/index.cjs10.js.map +1 -1
- package/dist/index.cjs5.js +99 -5
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs6.js +23 -700
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +13 -37
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.cjs8.js +39 -17
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.cjs9.js +269 -16
- package/dist/index.cjs9.js.map +1 -1
- package/dist/index.es.js +187 -41
- package/dist/index.es.js.map +1 -1
- package/dist/index.es10.js +262 -173
- package/dist/index.es10.js.map +1 -1
- package/dist/index.es2.js +1 -1
- package/dist/index.es4.js +1 -1
- package/dist/index.es5.js +91 -2
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es6.js +23 -695
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es7.js +14 -33
- package/dist/index.es7.js.map +1 -1
- package/dist/index.es8.js +37 -17
- package/dist/index.es8.js.map +1 -1
- package/dist/index.es9.js +264 -15
- package/dist/index.es9.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/react-page.cjs.js +97 -9
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +95 -9
- 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 +260 -97
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +249 -92
- package/dist/slate.es.js.map +1 -1
- package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts +0 -17
- package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts.map +1 -1
- package/dist/types/src/controls/control.d.ts +3 -2
- package/dist/types/src/controls/control.d.ts.map +1 -1
- package/dist/types/src/controls/icon-radio-group.d.ts +5 -2
- package/dist/types/src/controls/icon-radio-group.d.ts.map +1 -1
- package/dist/types/src/controls/index.d.ts +1 -0
- package/dist/types/src/controls/index.d.ts.map +1 -1
- package/dist/types/src/controls/list.d.ts +2 -0
- package/dist/types/src/controls/list.d.ts.map +1 -1
- package/dist/types/src/controls/shape.d.ts +2 -0
- package/dist/types/src/controls/shape.d.ts.map +1 -1
- package/dist/types/src/controls/style-v2.d.ts.map +1 -1
- package/dist/types/src/controls/typography.d.ts +31 -0
- package/dist/types/src/controls/typography.d.ts.map +1 -0
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts +6 -3
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/introspection.d.ts +1 -1
- package/dist/types/src/prop-controllers/introspection.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts +3 -2
- package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/typography.d.ts +21 -0
- package/dist/types/src/runtimes/react/controls/typography.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
- package/dist/types/src/slate/InlinePlugin/getValue.d.ts +5 -0
- package/dist/types/src/slate/InlinePlugin/getValue.d.ts.map +1 -0
- package/dist/types/src/slate/InlinePlugin/index.d.ts +16 -0
- package/dist/types/src/slate/InlinePlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/InlinePlugin/onChange.d.ts +4 -0
- package/dist/types/src/slate/InlinePlugin/onChange.d.ts.map +1 -0
- package/dist/types/src/slate/InlinePlugin/types.d.ts +9 -0
- package/dist/types/src/slate/InlinePlugin/types.d.ts.map +1 -0
- package/dist/types/src/slate/LinkPlugin/getValue.d.ts +5 -0
- package/dist/types/src/slate/LinkPlugin/getValue.d.ts.map +1 -0
- package/dist/types/src/slate/LinkPlugin/index.d.ts +15 -0
- package/dist/types/src/slate/LinkPlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/LinkPlugin/onChange.d.ts +4 -0
- package/dist/types/src/slate/LinkPlugin/onChange.d.ts.map +1 -0
- package/dist/types/src/slate/LinkPlugin/types.d.ts +5 -0
- package/dist/types/src/slate/LinkPlugin/types.d.ts.map +1 -0
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts +2 -0
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/index.d.ts +9 -0
- package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/index.d.ts +2 -0
- package/dist/types/src/slate/index.d.ts.map +1 -1
- package/dist/types.cjs2.js +753 -0
- package/dist/types.cjs2.js.map +1 -0
- package/dist/types.es2.js +736 -0
- package/dist/types.es2.js.map +1 -0
- package/dist/typography.cjs.js +56 -0
- package/dist/typography.cjs.js.map +1 -0
- package/dist/typography.es.js +41 -0
- package/dist/typography.es.js.map +1 -0
- package/package.json +1 -1
- package/dist/deepEqual.cjs.js +0 -40
- package/dist/deepEqual.cjs.js.map +0 -1
- package/dist/deepEqual.es.js +0 -39
- package/dist/deepEqual.es.js.map +0 -1
- package/dist/index.cjs11.js +0 -375
- package/dist/index.cjs11.js.map +0 -1
- package/dist/index.es11.js +0 -368
- package/dist/index.es11.js.map +0 -1
- package/dist/leaf.cjs.js +0 -182
- package/dist/leaf.cjs.js.map +0 -1
- package/dist/leaf.es.js +0 -179
- package/dist/leaf.es.js.map +0 -1
- package/dist/select.cjs.js +0 -21
- package/dist/select.cjs.js.map +0 -1
- package/dist/select.es.js +0 -16
- package/dist/select.es.js.map +0 -1
- package/dist/text-input.cjs.js +0 -26
- package/dist/text-input.cjs.js.map +0 -1
- package/dist/text-input.es.js +0 -18
- package/dist/text-input.es.js.map +0 -1
package/dist/index.es.js
CHANGED
|
@@ -38,19 +38,17 @@ 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, b as isElementReference, e as
|
|
41
|
+
import { a as createDocumentReference, g as getPropControllerDescriptors, b as isElementReference, e as getSwatchIds, f as getFileIds, h as getTypographyIds, j as getTableIds, k as getPageIds, l as getElementChildren, E as ElementID, B as Backgrounds, W as Width, m as ResponsiveIconRadioGroup, M as Margin, P as Padding, n as Border, o as BorderRadius, S as Shadows, G as GapY, p as GapX, q as ResponsiveSelect, r as ResponsiveNumber, s as Checkbox, t as Grid, u as TextInput, L as Link, v as ResponsiveColor, w as TextStyle, C as ComponentIcon, I as Images, N as Number$1, D as Date$1, F as Font, x as ResponsiveLength, y as TextArea, z as Table, A as TableFormFields, H as Image, J as ResponsiveOpacity, K as NavigationLinks, O as SocialLinks, Q as RichText, V as Video, U as useStyle, X as getBorderSwatchIds, Y as isNonNullable$1, Z as getBoxShadowsSwatchIds, _ as getResponsiveColorSwatchIds, $ as StyleControlProperty, a0 as ImageControlValueFormat, a1 as isPropControllersHandle, a2 as StyleControlType, a3 as RichTextV2ControlType, a4 as RichTextControlType, a5 as SlotControlType, a6 as StyleV2ControlType, a7 as ListControlType, a8 as ShapeControlType, a9 as LinkControlType, aa as ImageControlType, ab as ColorControlType, ac as getComponentPropControllerDescriptors, ad as getPropControllers, ae as Types, af as BorderPropControllerFormat, ag as ShadowsPropControllerFormat, ah as BorderRadiusPropControllerFormat, ai as MarginPropControllerFormat, aj as PaddingPropControllerFormat, ak as WidthPropControllerFormat, al as configureStore$1, am as copyElementTree, an as getBreakpoints, ao as getDocument, ap as getElementId, aq as getIsPreview, ar as getIsInBuilder, as as getReactComponent, at as getBuilderEditMode } from "./react-page.es.js";
|
|
42
42
|
import { A as ActionTypes, n as apiResourceFulfilled, o as registerComponentEffect, p as registerReactComponentEffect, q as registerComponentHandleEffect, t as mountComponentEffect } from "./actions.es.js";
|
|
43
43
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
44
|
-
import { T as
|
|
44
|
+
import { T as TypographyControlType, I as IconRadioGroupControlType, S as SelectControlType, a as TextAreaControlType, b as TextInputControlType, N as NumberControlType, C as CheckboxControlType } from "./typography.es.js";
|
|
45
45
|
import { C as ComboboxControlType } from "./combobox.es.js";
|
|
46
|
-
import { I as IconRadioGroupControlType, S as SelectControlType } from "./select.es.js";
|
|
47
46
|
import "slate";
|
|
48
47
|
import { useSyncExternalStore } from "use-sync-external-store/shim";
|
|
49
48
|
import { createStore, applyMiddleware } from "redux";
|
|
50
49
|
import thunk from "redux-thunk";
|
|
51
50
|
import { A as APIResourceType } from "./types.es.js";
|
|
52
|
-
import {
|
|
53
|
-
import { getBaseBreakpoint, findBreakpointOverride, DefaultBreakpointID, join, getBreakpoint, getBreakpointMediaQuery, parseBreakpointsInput } from "./state/breakpoints.es.js";
|
|
51
|
+
import { getBaseBreakpoint, findBreakpointOverride, DefaultBreakpointID, join, getBreakpoint, getBreakpointMediaQuery, shallowMergeFallbacks, parseBreakpointsInput } from "./state/breakpoints.es.js";
|
|
54
52
|
import { g as getBox, i as isMeasurable, m as measure } from "./box-models.es.js";
|
|
55
53
|
import ColorHelper from "color";
|
|
56
54
|
import { cache, cx } from "@emotion/css";
|
|
@@ -115,6 +113,43 @@ function BodySnippet({
|
|
|
115
113
|
}, [code, cleanup]);
|
|
116
114
|
return null;
|
|
117
115
|
}
|
|
116
|
+
function is(x, y) {
|
|
117
|
+
if (x === y)
|
|
118
|
+
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
119
|
+
return x !== x && y !== y;
|
|
120
|
+
}
|
|
121
|
+
const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
|
|
122
|
+
const shallowEqual = (a, b) => {
|
|
123
|
+
if (is(a, b))
|
|
124
|
+
return true;
|
|
125
|
+
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
126
|
+
return false;
|
|
127
|
+
const keysA = Object.keys(a);
|
|
128
|
+
const keysB = Object.keys(b);
|
|
129
|
+
if (keysA.length !== keysB.length)
|
|
130
|
+
return false;
|
|
131
|
+
for (let i = 0; i < keysA.length; i += 1) {
|
|
132
|
+
if (!hasOwnProperty$1.call(b, keysA[i]) || !is(a[keysA[i]], b[keysA[i]]))
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
};
|
|
137
|
+
const { hasOwnProperty } = Object.prototype;
|
|
138
|
+
const deepEqual = (a, b) => {
|
|
139
|
+
if (shallowEqual(a, b))
|
|
140
|
+
return true;
|
|
141
|
+
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
142
|
+
return false;
|
|
143
|
+
const keysA = Object.keys(a);
|
|
144
|
+
const keysB = Object.keys(b);
|
|
145
|
+
if (keysA.length !== keysB.length)
|
|
146
|
+
return false;
|
|
147
|
+
for (let i = 0; i < keysA.length; i += 1) {
|
|
148
|
+
if (!hasOwnProperty.call(b, keysA[i]) || !deepEqual(a[keysA[i]], b[keysA[i]]))
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
return true;
|
|
152
|
+
};
|
|
118
153
|
function getInitialState(serializedState = {
|
|
119
154
|
Swatch: [],
|
|
120
155
|
File: [],
|
|
@@ -890,7 +925,7 @@ Received "${apiKey}" instead.`);
|
|
|
890
925
|
while (current = remaining.pop()) {
|
|
891
926
|
let getResourcesFromElementDescriptors = function(elementDescriptors2, props) {
|
|
892
927
|
Object.entries(elementDescriptors2).forEach(([propName, descriptor]) => {
|
|
893
|
-
|
|
928
|
+
getSwatchIds(descriptor, props[propName]).forEach((swatchId) => {
|
|
894
929
|
swatchIds.add(swatchId);
|
|
895
930
|
});
|
|
896
931
|
getFileIds(descriptor, props[propName]).forEach((fileId) => fileIds.add(fileId));
|
|
@@ -903,34 +938,6 @@ Received "${apiKey}" instead.`);
|
|
|
903
938
|
remaining.push(child);
|
|
904
939
|
}
|
|
905
940
|
});
|
|
906
|
-
if (descriptor.type === ShapeControlType) {
|
|
907
|
-
const prop = props[propName];
|
|
908
|
-
if (prop == null)
|
|
909
|
-
return;
|
|
910
|
-
getResourcesFromElementDescriptors(descriptor.config.type, prop);
|
|
911
|
-
}
|
|
912
|
-
if (descriptor.type === ListControlType) {
|
|
913
|
-
const prop = props[propName];
|
|
914
|
-
if (prop == null)
|
|
915
|
-
return;
|
|
916
|
-
prop.forEach((item) => {
|
|
917
|
-
getResourcesFromElementDescriptors({ propName: descriptor.config.type }, { propName: item.value });
|
|
918
|
-
});
|
|
919
|
-
}
|
|
920
|
-
if (descriptor.type === Types.Shape) {
|
|
921
|
-
const prop = props[propName];
|
|
922
|
-
if (prop == null)
|
|
923
|
-
return;
|
|
924
|
-
getResourcesFromElementDescriptors(descriptor.options.type, prop);
|
|
925
|
-
}
|
|
926
|
-
if (descriptor.type === Types.List) {
|
|
927
|
-
const prop = props[propName];
|
|
928
|
-
if (prop == null)
|
|
929
|
-
return;
|
|
930
|
-
prop.forEach((item) => {
|
|
931
|
-
getResourcesFromElementDescriptors({ propName: descriptor.options.type }, { propName: item.value });
|
|
932
|
-
});
|
|
933
|
-
}
|
|
934
941
|
});
|
|
935
942
|
};
|
|
936
943
|
let element2;
|
|
@@ -1113,7 +1120,7 @@ async function fonts(_req, res, { getFonts } = {}) {
|
|
|
1113
1120
|
const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
|
|
1114
1121
|
return res.json(fonts2);
|
|
1115
1122
|
}
|
|
1116
|
-
const version = "0.9.
|
|
1123
|
+
const version = "0.9.4";
|
|
1117
1124
|
async function handler(req, res, { apiKey, unstable_siteVersions }) {
|
|
1118
1125
|
if (req.query.secret !== apiKey) {
|
|
1119
1126
|
return res.status(401).json({ message: "Unauthorized" });
|
|
@@ -2533,7 +2540,7 @@ function mapSideColor(swatches, _e) {
|
|
|
2533
2540
|
return __spreadProps(__spreadValues({}, restOfSide), {
|
|
2534
2541
|
color: color && {
|
|
2535
2542
|
alpha: color.alpha,
|
|
2536
|
-
swatch: swatches.filter(isNonNullable).find((s) => s && s.id === color.swatchId)
|
|
2543
|
+
swatch: swatches.filter(isNonNullable$1).find((s) => s && s.id === color.swatchId)
|
|
2537
2544
|
}
|
|
2538
2545
|
});
|
|
2539
2546
|
}
|
|
@@ -2579,7 +2586,7 @@ function useBoxShadow(value) {
|
|
|
2579
2586
|
return __spreadProps(__spreadValues({}, restOfShadow), {
|
|
2580
2587
|
payload: {
|
|
2581
2588
|
color: color != null ? {
|
|
2582
|
-
swatch: swatches.filter(isNonNullable).find((s) => s && s.id === color.swatchId),
|
|
2589
|
+
swatch: swatches.filter(isNonNullable$1).find((s) => s && s.id === color.swatchId),
|
|
2583
2590
|
alpha: color.alpha
|
|
2584
2591
|
} : null,
|
|
2585
2592
|
inset: inset != null ? inset : ShadowDefaultValue.inset,
|
|
@@ -2603,7 +2610,7 @@ function useResponsiveColor(color) {
|
|
|
2603
2610
|
const { swatchId, alpha } = v;
|
|
2604
2611
|
const swatch = swatches.find((s) => s && s.id === swatchId);
|
|
2605
2612
|
return swatch == null ? null : __spreadProps(__spreadValues({}, rest), { value: { swatch, alpha } });
|
|
2606
|
-
}).filter(isNonNullable);
|
|
2613
|
+
}).filter(isNonNullable$1);
|
|
2607
2614
|
}
|
|
2608
2615
|
const getIndexes = (spans, index) => {
|
|
2609
2616
|
const flattened = spans.reduce((a, s) => a.concat(s), []);
|
|
@@ -3061,7 +3068,7 @@ function ListControlValue({
|
|
|
3061
3068
|
function useNumber(numberControlData, controlDefinition) {
|
|
3062
3069
|
return numberControlData != null ? numberControlData : controlDefinition.config.defaultValue;
|
|
3063
3070
|
}
|
|
3064
|
-
const Text = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.
|
|
3071
|
+
const Text = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es8.js"))));
|
|
3065
3072
|
function useRichText(data, control) {
|
|
3066
3073
|
const textCallbackRef = useCallback((handle) => {
|
|
3067
3074
|
var _a;
|
|
@@ -3075,7 +3082,7 @@ function useRichText(data, control) {
|
|
|
3075
3082
|
ref: textCallbackRef
|
|
3076
3083
|
});
|
|
3077
3084
|
}
|
|
3078
|
-
const EditableText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.
|
|
3085
|
+
const EditableText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es9.js"))));
|
|
3079
3086
|
const ReadOnlyText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyTextV2.es.js"))));
|
|
3080
3087
|
function useRichTextV2(data, definition, control) {
|
|
3081
3088
|
const isPreview = useIsPreview();
|
|
@@ -3311,6 +3318,138 @@ function useTextAreaValue(data, definition) {
|
|
|
3311
3318
|
function useTextInputValue(data, definition) {
|
|
3312
3319
|
return data != null ? data : definition.config.defaultValue;
|
|
3313
3320
|
}
|
|
3321
|
+
function isNonNullable(value) {
|
|
3322
|
+
return value != null;
|
|
3323
|
+
}
|
|
3324
|
+
function typographyFragementToTypographyControlData(typography) {
|
|
3325
|
+
if (typography == null)
|
|
3326
|
+
return void 0;
|
|
3327
|
+
return {
|
|
3328
|
+
id: typography.id,
|
|
3329
|
+
style: typography.style.map(({ deviceId, value }) => {
|
|
3330
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
3331
|
+
return {
|
|
3332
|
+
deviceId,
|
|
3333
|
+
value: {
|
|
3334
|
+
fontFamily: (_a = value.fontFamily) != null ? _a : void 0,
|
|
3335
|
+
lineHeight: (_b = value.lineHeight) != null ? _b : void 0,
|
|
3336
|
+
letterSpacing: (_c = value.letterSpacing) != null ? _c : void 0,
|
|
3337
|
+
fontWeight: (_d = value.fontWeight) != null ? _d : void 0,
|
|
3338
|
+
textAlign: (_e = value.textAlign) != null ? _e : void 0,
|
|
3339
|
+
uppercase: (_f = value.uppercase) != null ? _f : void 0,
|
|
3340
|
+
underline: (_g = value.underline) != null ? _g : void 0,
|
|
3341
|
+
strikethrough: (_h = value.strikethrough) != null ? _h : void 0,
|
|
3342
|
+
italic: (_i = value.italic) != null ? _i : void 0,
|
|
3343
|
+
fontSize: (_j = value.fontSize) != null ? _j : void 0,
|
|
3344
|
+
color: (_k = value.color) != null ? _k : void 0
|
|
3345
|
+
}
|
|
3346
|
+
};
|
|
3347
|
+
})
|
|
3348
|
+
};
|
|
3349
|
+
}
|
|
3350
|
+
function getTypographyStyleSwatchIds(style) {
|
|
3351
|
+
var _a;
|
|
3352
|
+
return (_a = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
|
|
3353
|
+
var _a2;
|
|
3354
|
+
return (_a2 = typographyStyle.color) == null ? void 0 : _a2.swatchId;
|
|
3355
|
+
}).filter(isNonNullable)) != null ? _a : [];
|
|
3356
|
+
}
|
|
3357
|
+
const withColor = (swatches) => (deviceRawTypographyValue) => {
|
|
3358
|
+
var _b, _c;
|
|
3359
|
+
const { value, deviceId } = deviceRawTypographyValue;
|
|
3360
|
+
if (value.color == null) {
|
|
3361
|
+
const _a = value, { color } = _a, nextValue = __objRest(_a, ["color"]);
|
|
3362
|
+
return {
|
|
3363
|
+
deviceId,
|
|
3364
|
+
value: nextValue
|
|
3365
|
+
};
|
|
3366
|
+
}
|
|
3367
|
+
return {
|
|
3368
|
+
deviceId,
|
|
3369
|
+
value: __spreadProps(__spreadValues({}, value), {
|
|
3370
|
+
color: {
|
|
3371
|
+
swatch: swatches.find((s) => {
|
|
3372
|
+
var _a2;
|
|
3373
|
+
return s && s.id === ((_a2 = value.color) == null ? void 0 : _a2.swatchId);
|
|
3374
|
+
}),
|
|
3375
|
+
alpha: (_c = (_b = value.color) == null ? void 0 : _b.alpha) != null ? _c : void 0
|
|
3376
|
+
}
|
|
3377
|
+
})
|
|
3378
|
+
};
|
|
3379
|
+
};
|
|
3380
|
+
const getDeviceId = ({ deviceId }) => deviceId;
|
|
3381
|
+
function useEnhancedTypography(value) {
|
|
3382
|
+
var _a, _b, _c;
|
|
3383
|
+
const typography = typographyFragementToTypographyControlData(useTypography((_a = value == null ? void 0 : value.id) != null ? _a : null));
|
|
3384
|
+
const source = (_b = typography == null ? void 0 : typography.style) != null ? _b : [];
|
|
3385
|
+
const override = (_c = value == null ? void 0 : value.style) != null ? _c : [];
|
|
3386
|
+
const breakpoints = useBreakpoints();
|
|
3387
|
+
const swatchIds = [
|
|
3388
|
+
...getTypographyStyleSwatchIds(value == null ? void 0 : value.style),
|
|
3389
|
+
...getTypographyStyleSwatchIds(typography == null ? void 0 : typography.style)
|
|
3390
|
+
];
|
|
3391
|
+
const swatches = useSwatches(swatchIds).filter(isNonNullable);
|
|
3392
|
+
const enhancedSource = source.map(withColor(swatches));
|
|
3393
|
+
const enhancedOverride = override.map(withColor(swatches));
|
|
3394
|
+
const devices = [
|
|
3395
|
+
...new Set(enhancedSource.map(getDeviceId).concat(enhancedOverride.map(getDeviceId)))
|
|
3396
|
+
];
|
|
3397
|
+
return devices.map((deviceId) => {
|
|
3398
|
+
var _a2, _b2;
|
|
3399
|
+
const deviceSource = (_a2 = findBreakpointOverride(breakpoints, enhancedSource, deviceId)) == null ? void 0 : _a2.value;
|
|
3400
|
+
const deviceOverride = (_b2 = findBreakpointOverride(breakpoints, enhancedOverride, deviceId, (v) => v)) == null ? void 0 : _b2.value;
|
|
3401
|
+
if (deviceSource && deviceOverride) {
|
|
3402
|
+
return {
|
|
3403
|
+
deviceId,
|
|
3404
|
+
value: __spreadValues(__spreadValues({}, deviceSource), deviceOverride)
|
|
3405
|
+
};
|
|
3406
|
+
} else if (deviceOverride) {
|
|
3407
|
+
return {
|
|
3408
|
+
deviceId,
|
|
3409
|
+
value: deviceOverride
|
|
3410
|
+
};
|
|
3411
|
+
} else if (deviceSource) {
|
|
3412
|
+
return {
|
|
3413
|
+
deviceId,
|
|
3414
|
+
value: deviceSource
|
|
3415
|
+
};
|
|
3416
|
+
}
|
|
3417
|
+
return null;
|
|
3418
|
+
}).filter(isNonNullable);
|
|
3419
|
+
}
|
|
3420
|
+
function useTypographyClassName(value) {
|
|
3421
|
+
return useStyle(useResponsiveStyle([value], ([value2]) => {
|
|
3422
|
+
if (value2 === void 0)
|
|
3423
|
+
return {};
|
|
3424
|
+
let styles = {};
|
|
3425
|
+
if (value2.color != null)
|
|
3426
|
+
styles.color = colorToString(value2.color);
|
|
3427
|
+
if (value2.fontFamily != null)
|
|
3428
|
+
styles.fontFamily = value2.fontFamily;
|
|
3429
|
+
if (value2.fontSize != null && value2.fontSize.value != null && value2.fontSize.unit != null)
|
|
3430
|
+
styles.fontSize = `${value2.fontSize.value}${value2.fontSize.unit}`;
|
|
3431
|
+
if (value2.fontWeight != null)
|
|
3432
|
+
styles.fontWeight = value2.fontWeight;
|
|
3433
|
+
if (value2.lineHeight != null)
|
|
3434
|
+
styles.lineHeight = value2.lineHeight;
|
|
3435
|
+
if (value2.letterSpacing != null)
|
|
3436
|
+
styles.letterSpacing = `${value2.letterSpacing / 10}em`;
|
|
3437
|
+
if (value2.uppercase != null)
|
|
3438
|
+
styles.textTransform = value2.uppercase === true ? "uppercase" : "initial";
|
|
3439
|
+
if (value2.underline != null || value2.strikethrough != null)
|
|
3440
|
+
styles.textDecoration = [
|
|
3441
|
+
Boolean(value2.underline) && "underline",
|
|
3442
|
+
Boolean(value2.strikethrough) && "line-through"
|
|
3443
|
+
].filter(Boolean).join(" ");
|
|
3444
|
+
if (value2.italic != null)
|
|
3445
|
+
styles.fontStyle = value2.italic === true ? "italic" : "initial";
|
|
3446
|
+
return styles;
|
|
3447
|
+
}, shallowMergeFallbacks));
|
|
3448
|
+
}
|
|
3449
|
+
function useTypographyValue(data) {
|
|
3450
|
+
const enhancedTypography = useEnhancedTypography(data);
|
|
3451
|
+
return useTypographyClassName(enhancedTypography);
|
|
3452
|
+
}
|
|
3314
3453
|
function ControlValue({
|
|
3315
3454
|
data,
|
|
3316
3455
|
definition,
|
|
@@ -3423,6 +3562,12 @@ function ControlValue({
|
|
|
3423
3562
|
parameters: [data, definition, control],
|
|
3424
3563
|
children: (value) => children(value)
|
|
3425
3564
|
}, definition.type);
|
|
3565
|
+
case TypographyControlType:
|
|
3566
|
+
return /* @__PURE__ */ jsx(RenderHook, {
|
|
3567
|
+
hook: useTypographyValue,
|
|
3568
|
+
parameters: [data],
|
|
3569
|
+
children: (value) => children(value)
|
|
3570
|
+
}, definition.type);
|
|
3426
3571
|
default:
|
|
3427
3572
|
return children(data);
|
|
3428
3573
|
}
|
|
@@ -3477,6 +3622,7 @@ function PropsValue({
|
|
|
3477
3622
|
case ListControlType:
|
|
3478
3623
|
case LinkControlType:
|
|
3479
3624
|
case StyleV2ControlType:
|
|
3625
|
+
case TypographyControlType:
|
|
3480
3626
|
return /* @__PURE__ */ jsx(ControlValue, {
|
|
3481
3627
|
definition: descriptor,
|
|
3482
3628
|
data: props[propName],
|
|
@@ -3970,5 +4116,5 @@ const DocumentReference = memo(forwardRef(function DocumentReference2({
|
|
|
3970
4116
|
document: document2
|
|
3971
4117
|
});
|
|
3972
4118
|
}));
|
|
3973
|
-
export {
|
|
4119
|
+
export { PreviewModeScript as $, Alignments as A, forwardNextDynamicRef as B, Contrasts as C, DocumentReference as D, Element$1 as E, useIsPreview as F, useFiles as G, useSwatches as H, usePagePathnameSlice as I, useElementId as J, deepEqual as K, ElementImperativeHandle as L, StoreContext as M, MakeswiftProvider as N, ControlValue as O, PageProvider as P, useBuilderEditMode as Q, RuntimeProvider as R, Shapes as S, pollBoxModel as T, useEnhancedTypography as U, useTypographyClassName as V, getStaticPaths as W, getStaticProps as X, getServerSideProps as Y, Page as Z, Makeswift as _, ReactRuntime as a, Document$1 as a0, MakeswiftApiHandler as a1, 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 };
|
|
3974
4120
|
//# sourceMappingURL=index.es.js.map
|