@makeswift/runtime 0.0.9 → 0.0.12
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/actions.cjs.js +6 -1
- package/dist/actions.cjs.js.map +1 -1
- package/dist/actions.es.js +6 -2
- package/dist/actions.es.js.map +1 -1
- package/dist/builder.cjs.js +2 -0
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +1 -1
- package/dist/components.cjs.js +4 -2
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +2 -2
- package/dist/constants.cjs.js +128 -1
- package/dist/constants.cjs.js.map +1 -1
- package/dist/constants.es.js +128 -1
- package/dist/constants.es.js.map +1 -1
- package/dist/control-serialization.cjs.js +11 -3
- package/dist/control-serialization.cjs.js.map +1 -1
- package/dist/control-serialization.es.js +10 -4
- package/dist/control-serialization.es.js.map +1 -1
- package/dist/index.cjs.js +389 -36
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +385 -38
- package/dist/index.es.js.map +1 -1
- package/dist/next.cjs.js +10 -6
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +11 -7
- package/dist/next.es.js.map +1 -1
- package/dist/react-builder-preview.cjs.js +45 -45
- package/dist/react-builder-preview.cjs.js.map +1 -1
- package/dist/react-builder-preview.es.js +45 -45
- package/dist/react-builder-preview.es.js.map +1 -1
- package/dist/react.cjs.js +1 -0
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +1 -0
- package/dist/react.es.js.map +1 -1
- package/dist/text-input.cjs.js.map +1 -1
- package/dist/text-input.es.js.map +1 -1
- package/dist/types/api/constants.d.ts.map +1 -1
- package/dist/types/api/generated/graphql.d.ts +55 -0
- package/dist/types/api/generated/graphql.d.ts.map +1 -1
- package/dist/types/api/react.d.ts.map +1 -1
- package/dist/types/api/types.d.ts +2 -2
- package/dist/types/api/types.d.ts.map +1 -1
- package/dist/types/builder/serialization/control-serialization.d.ts +2 -0
- package/dist/types/builder/serialization/control-serialization.d.ts.map +1 -1
- package/dist/types/builder/serialization/controls/list.d.ts.map +1 -1
- package/dist/types/components/builtin/Button/Button.d.ts.map +1 -1
- package/dist/types/components/builtin/Text/Text.d.ts.map +1 -1
- package/dist/types/components/page/Page.d.ts +23 -0
- package/dist/types/components/page/Page.d.ts.map +1 -1
- package/dist/types/controls/shape.d.ts +0 -1
- package/dist/types/controls/shape.d.ts.map +1 -1
- package/dist/types/next.d.ts +2 -1
- package/dist/types/next.d.ts.map +1 -1
- package/dist/types/runtimes/react/index.d.ts.map +1 -1
- package/dist/types/state/actions.d.ts +13 -1
- package/dist/types/state/actions.d.ts.map +1 -1
- package/dist/types/state/react-builder-preview.d.ts.map +1 -1
- package/package.json +4 -1
- package/dist/Page.cjs.js +0 -222
- package/dist/Page.cjs.js.map +0 -1
- package/dist/Page.es.js +0 -216
- package/dist/Page.es.js.map +0 -1
package/dist/index.es.js
CHANGED
|
@@ -47,8 +47,8 @@ import { getDataFromTree } from "@apollo/client/react/ssr";
|
|
|
47
47
|
import { KeyUtils, Value } from "slate";
|
|
48
48
|
import uuid from "uuid/v4";
|
|
49
49
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
50
|
-
import "html-react-parser";
|
|
51
|
-
import "next/head";
|
|
50
|
+
import parse$1 from "html-react-parser";
|
|
51
|
+
import Head from "next/head";
|
|
52
52
|
import { E as ElementID, B as Backgrounds$1, W as Width, R as ResponsiveIconRadioGroup, M as Margin, P as Padding, a as Border, b as BorderRadius, S as Shadows, G as GapY, c as GapX, e as ResponsiveSelect, f as ResponsiveNumber, C as Checkbox$1, g as Grid$2, h as TextInput, L as Link$1, i as ResponsiveColor, j as TextStyle, I as Image$1, k as ResponsiveOpacity, l as Images, N as Number$1, D as Date$1, F as Font, m as ResponsiveLength, n as TextArea$1, o as Table, p as TableFormFields, q as NavigationLinks, r as SocialLinks$1, s as RichText, V as Video$1, T as Types, t as WidthControlValueFormats } from "./descriptors.es.js";
|
|
53
53
|
import ColorHelper from "color";
|
|
54
54
|
import scrollIntoView from "scroll-into-view-if-needed";
|
|
@@ -62,6 +62,7 @@ import { normalize } from "polished";
|
|
|
62
62
|
import ReactPlayer from "react-player";
|
|
63
63
|
import Hotkeys from "slate-hotkeys";
|
|
64
64
|
import ipsum from "corporate-ipsum";
|
|
65
|
+
import { isHotkey } from "is-hotkey";
|
|
65
66
|
import { Editor } from "slate-react";
|
|
66
67
|
import Lists from "@convertkit/slate-lists";
|
|
67
68
|
import { S as ShapeControlType, I as ImageControlType, C as ColorControlType, a as SelectControlType, T as TextAreaControlType, b as TextInputControlType, N as NumberControlType, c as CheckboxControlType } from "./text-input.es.js";
|
|
@@ -283,6 +284,24 @@ const typePolicies = {
|
|
|
283
284
|
__typename: "Table",
|
|
284
285
|
id: args == null ? void 0 : args.id
|
|
285
286
|
}, true);
|
|
287
|
+
},
|
|
288
|
+
page(existingData, {
|
|
289
|
+
args,
|
|
290
|
+
toReference
|
|
291
|
+
}) {
|
|
292
|
+
return existingData != null ? existingData : toReference({
|
|
293
|
+
__typename: "Page",
|
|
294
|
+
id: args == null ? void 0 : args.id
|
|
295
|
+
}, true);
|
|
296
|
+
},
|
|
297
|
+
site(existingData, {
|
|
298
|
+
args,
|
|
299
|
+
toReference
|
|
300
|
+
}) {
|
|
301
|
+
return existingData != null ? existingData : toReference({
|
|
302
|
+
__typename: "Site",
|
|
303
|
+
id: args == null ? void 0 : args.id
|
|
304
|
+
}, true);
|
|
286
305
|
}
|
|
287
306
|
}
|
|
288
307
|
}
|
|
@@ -2135,7 +2154,8 @@ const Button$1 = forwardRef(function Button2(_m, ref) {
|
|
|
2135
2154
|
color,
|
|
2136
2155
|
textStyle,
|
|
2137
2156
|
width,
|
|
2138
|
-
margin
|
|
2157
|
+
margin,
|
|
2158
|
+
className
|
|
2139
2159
|
} = _n, restOfProps = __objRest(_n, [
|
|
2140
2160
|
"id",
|
|
2141
2161
|
"children",
|
|
@@ -2147,12 +2167,13 @@ const Button$1 = forwardRef(function Button2(_m, ref) {
|
|
|
2147
2167
|
"color",
|
|
2148
2168
|
"textStyle",
|
|
2149
2169
|
"width",
|
|
2150
|
-
"margin"
|
|
2170
|
+
"margin",
|
|
2171
|
+
"className"
|
|
2151
2172
|
]);
|
|
2152
2173
|
return /* @__PURE__ */ jsx(StyledButton$1, __spreadProps(__spreadValues({}, restOfProps), {
|
|
2153
2174
|
ref,
|
|
2154
2175
|
id,
|
|
2155
|
-
className: cx(css$1(responsiveWidth(width, "auto"))),
|
|
2176
|
+
className: cx(css$1(responsiveWidth(width, "auto")), className),
|
|
2156
2177
|
color,
|
|
2157
2178
|
link,
|
|
2158
2179
|
margin,
|
|
@@ -2513,7 +2534,7 @@ const Reel = styled(motion.div)`
|
|
|
2513
2534
|
}
|
|
2514
2535
|
`)}
|
|
2515
2536
|
`;
|
|
2516
|
-
const Page = styled(motion.div)`
|
|
2537
|
+
const Page$1 = styled(motion.div)`
|
|
2517
2538
|
position: relative;
|
|
2518
2539
|
width: 100%;
|
|
2519
2540
|
`;
|
|
@@ -2726,7 +2747,7 @@ const Carousel = forwardRef(function Carousel2({
|
|
|
2726
2747
|
},
|
|
2727
2748
|
children: [/* @__PURE__ */ jsxs(Container$b, {
|
|
2728
2749
|
children: [/* @__PURE__ */ jsx(ClipMask, {
|
|
2729
|
-
children: /* @__PURE__ */ jsx(Page, __spreadProps(__spreadValues({}, bindPage()), {
|
|
2750
|
+
children: /* @__PURE__ */ jsx(Page$1, __spreadProps(__spreadValues({}, bindPage()), {
|
|
2730
2751
|
animate: animation,
|
|
2731
2752
|
children: /* @__PURE__ */ jsx(Reel, {
|
|
2732
2753
|
gap,
|
|
@@ -3515,7 +3536,7 @@ const defaultHtml = `<div style="padding: 24px; background-color: rgba(161, 168,
|
|
|
3515
3536
|
<rect y="160" width="40" height="8" rx="2" fill="#A1A8C2" fill-opacity="0.5"/>
|
|
3516
3537
|
</svg>
|
|
3517
3538
|
</div>`;
|
|
3518
|
-
const SCRIPT_TAG = "script";
|
|
3539
|
+
const SCRIPT_TAG$1 = "script";
|
|
3519
3540
|
const Embed = forwardRef(function Embed2({
|
|
3520
3541
|
id,
|
|
3521
3542
|
width,
|
|
@@ -3533,7 +3554,7 @@ const Embed = forwardRef(function Embed2({
|
|
|
3533
3554
|
return;
|
|
3534
3555
|
const walker = container.ownerDocument.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
3535
3556
|
acceptNode(node) {
|
|
3536
|
-
return node.tagName.toLowerCase() === SCRIPT_TAG ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
|
|
3557
|
+
return node.tagName.toLowerCase() === SCRIPT_TAG$1 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
|
|
3537
3558
|
}
|
|
3538
3559
|
});
|
|
3539
3560
|
const nodes = [];
|
|
@@ -3544,7 +3565,7 @@ const Embed = forwardRef(function Embed2({
|
|
|
3544
3565
|
await new Promise((resolve) => {
|
|
3545
3566
|
var _a, _b;
|
|
3546
3567
|
const node = nodes[i];
|
|
3547
|
-
const script = node.ownerDocument.createElement(SCRIPT_TAG);
|
|
3568
|
+
const script = node.ownerDocument.createElement(SCRIPT_TAG$1);
|
|
3548
3569
|
script.textContent = node.textContent;
|
|
3549
3570
|
Array.from(node.attributes).forEach(({
|
|
3550
3571
|
name,
|
|
@@ -4873,7 +4894,7 @@ function useTableFormFieldRefs(propController, { fieldsCount }) {
|
|
|
4873
4894
|
}
|
|
4874
4895
|
}, [propController, container, items, isInBuilder]);
|
|
4875
4896
|
const itemRefs = useMemo(() => Array.from({ length: fieldsCount + 1 }).map((_, index) => (item) => {
|
|
4876
|
-
setItems((
|
|
4897
|
+
setItems((is2) => [...is2.slice(0, index), item, ...is2.slice(index + 1)]);
|
|
4877
4898
|
}), [fieldsCount, setItems]);
|
|
4878
4899
|
return { container: setContainer, items: itemRefs };
|
|
4879
4900
|
}
|
|
@@ -6199,7 +6220,7 @@ const GridItem = styled.div`
|
|
|
6199
6220
|
align-items: flex-start;
|
|
6200
6221
|
${cssGridItem()}
|
|
6201
6222
|
`;
|
|
6202
|
-
const Root = forwardRef(function
|
|
6223
|
+
const Root = forwardRef(function Page({
|
|
6203
6224
|
children,
|
|
6204
6225
|
backgrounds,
|
|
6205
6226
|
rowGap,
|
|
@@ -7578,7 +7599,7 @@ const Text = forwardRef(function Text2({
|
|
|
7578
7599
|
(_a = lastController.current) == null ? void 0 : _a.focus();
|
|
7579
7600
|
}, []);
|
|
7580
7601
|
const handleKeyDown = useCallback((event, _editor, next) => {
|
|
7581
|
-
var _a, _b;
|
|
7602
|
+
var _a, _b, _c;
|
|
7582
7603
|
if (Hotkeys.isUndo(event)) {
|
|
7583
7604
|
(_a = lastController.current) == null ? void 0 : _a.undo();
|
|
7584
7605
|
return true;
|
|
@@ -7587,6 +7608,10 @@ const Text = forwardRef(function Text2({
|
|
|
7587
7608
|
(_b = lastController.current) == null ? void 0 : _b.redo();
|
|
7588
7609
|
return true;
|
|
7589
7610
|
}
|
|
7611
|
+
if (isHotkey("escape")(event)) {
|
|
7612
|
+
(_c = lastController.current) == null ? void 0 : _c.blur();
|
|
7613
|
+
return true;
|
|
7614
|
+
}
|
|
7590
7615
|
return next();
|
|
7591
7616
|
}, []);
|
|
7592
7617
|
const isInBuilder = useIsInBuilder();
|
|
@@ -7599,7 +7624,8 @@ const Text = forwardRef(function Text2({
|
|
|
7599
7624
|
value,
|
|
7600
7625
|
onChange: handleChange,
|
|
7601
7626
|
onFocus: handleFocus,
|
|
7602
|
-
onKeyDown: handleKeyDown
|
|
7627
|
+
onKeyDown: handleKeyDown,
|
|
7628
|
+
onBlur: (e) => e.preventDefault()
|
|
7603
7629
|
});
|
|
7604
7630
|
});
|
|
7605
7631
|
function registerComponent$1(runtime) {
|
|
@@ -7795,6 +7821,325 @@ function registerBuiltinComponents(runtime) {
|
|
|
7795
7821
|
unregisterVideoComponent();
|
|
7796
7822
|
};
|
|
7797
7823
|
}
|
|
7824
|
+
const SCRIPT_TAG = "script";
|
|
7825
|
+
function BodySnippet({
|
|
7826
|
+
code,
|
|
7827
|
+
cleanup
|
|
7828
|
+
}) {
|
|
7829
|
+
useEffect(() => {
|
|
7830
|
+
const container = document.createElement("div");
|
|
7831
|
+
container.innerHTML = code;
|
|
7832
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT);
|
|
7833
|
+
const scripts = [];
|
|
7834
|
+
while (walker.nextNode()) {
|
|
7835
|
+
if (walker.currentNode instanceof HTMLScriptElement)
|
|
7836
|
+
scripts.push(walker.currentNode);
|
|
7837
|
+
}
|
|
7838
|
+
scripts.forEach((inlineScript) => {
|
|
7839
|
+
var _a;
|
|
7840
|
+
const executableScript = document.createElement(SCRIPT_TAG);
|
|
7841
|
+
executableScript.textContent = inlineScript.textContent;
|
|
7842
|
+
Array.from(inlineScript.attributes).forEach(({
|
|
7843
|
+
name,
|
|
7844
|
+
value
|
|
7845
|
+
}) => {
|
|
7846
|
+
executableScript.setAttribute(name, value);
|
|
7847
|
+
});
|
|
7848
|
+
(_a = inlineScript.parentNode) == null ? void 0 : _a.replaceChild(executableScript, inlineScript);
|
|
7849
|
+
});
|
|
7850
|
+
const nodes = Array.from(container.childNodes);
|
|
7851
|
+
document.body.append(...nodes);
|
|
7852
|
+
return () => {
|
|
7853
|
+
nodes.forEach((node) => {
|
|
7854
|
+
var _a;
|
|
7855
|
+
(_a = node.parentNode) == null ? void 0 : _a.removeChild(node);
|
|
7856
|
+
});
|
|
7857
|
+
if (cleanup == null)
|
|
7858
|
+
return;
|
|
7859
|
+
const cleanUp = new Function(cleanup);
|
|
7860
|
+
try {
|
|
7861
|
+
cleanUp();
|
|
7862
|
+
} catch {
|
|
7863
|
+
}
|
|
7864
|
+
};
|
|
7865
|
+
}, [code, cleanup]);
|
|
7866
|
+
return null;
|
|
7867
|
+
}
|
|
7868
|
+
function is(x, y) {
|
|
7869
|
+
if (x === y)
|
|
7870
|
+
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
7871
|
+
return x !== x && y !== y;
|
|
7872
|
+
}
|
|
7873
|
+
const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
|
|
7874
|
+
const shallowEqual = (a, b) => {
|
|
7875
|
+
if (is(a, b))
|
|
7876
|
+
return true;
|
|
7877
|
+
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
7878
|
+
return false;
|
|
7879
|
+
const keysA = Object.keys(a);
|
|
7880
|
+
const keysB = Object.keys(b);
|
|
7881
|
+
if (keysA.length !== keysB.length)
|
|
7882
|
+
return false;
|
|
7883
|
+
for (let i = 0; i < keysA.length; i += 1) {
|
|
7884
|
+
if (!hasOwnProperty$1.call(b, keysA[i]) || !is(a[keysA[i]], b[keysA[i]]))
|
|
7885
|
+
return false;
|
|
7886
|
+
}
|
|
7887
|
+
return true;
|
|
7888
|
+
};
|
|
7889
|
+
const { hasOwnProperty } = Object.prototype;
|
|
7890
|
+
const deepEqual = (a, b) => {
|
|
7891
|
+
if (shallowEqual(a, b))
|
|
7892
|
+
return true;
|
|
7893
|
+
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
7894
|
+
return false;
|
|
7895
|
+
const keysA = Object.keys(a);
|
|
7896
|
+
const keysB = Object.keys(b);
|
|
7897
|
+
if (keysA.length !== keysB.length)
|
|
7898
|
+
return false;
|
|
7899
|
+
for (let i = 0; i < keysA.length; i += 1) {
|
|
7900
|
+
if (!hasOwnProperty.call(b, keysA[i]) || !deepEqual(a[keysA[i]], b[keysA[i]]))
|
|
7901
|
+
return false;
|
|
7902
|
+
}
|
|
7903
|
+
return true;
|
|
7904
|
+
};
|
|
7905
|
+
const defaultFavicon = {
|
|
7906
|
+
mimetype: "image/png",
|
|
7907
|
+
publicUrl: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAABcRAAAXEQHKJvM/AAABjElEQVRYhc2XzU3EMBCFB8TddAAXn6EE6GCpgNABZ1/IXnymBOgAOmA7YM8+ABVsXEHQQFaKQryeN3Yk3ilKJtEnv/nLUd/3pFG0riGi88yrnQn+UfJ5FUi0riWiB2H4nQn+KRd0DFP8agXEfkqCYJBoHdtxIQxfm+DfFgEhoith3NYE30o/qgGR2BJB+xY7kdYEL8oNFUi0jiFMJuxVWrJqEMFxsyUNCsE6AeNztvBp7aJ143vXksoRnwhYtmNdSoIQa6RlO9YXEWW7KgoCleOgxgTf1QZBT+RZ2lXFING6UxCCq+ceeUE8fYdknY599v9sJvzGBP+yCEgC7GPmETc0OJ+0awAlkhe2pAbIXAeFZ8xe2g2Nk3c3ub0xwWt6zY9qbmiqGVMbZK21ZC/YmhlbeBMTzZNDQqcvDb1kM1x32iqZSt1HaqukfKvq34BAOTLsrH+ETNmUkKHHA+428RgeclPVWozeSyAI2EdWB34jtqXNTAySOY3i/KgFIlqOa4GkFmBegorzg4joG07he/M7zl6jAAAAAElFTkSuQmCC"
|
|
7908
|
+
};
|
|
7909
|
+
const VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_.\-\d]*$/;
|
|
7910
|
+
const VALID_HEAD_ELEMENT_TYPES = ["title", "base", "link", "style", "meta", "script", "noscript", "template"];
|
|
7911
|
+
function snippetToElement(snippet) {
|
|
7912
|
+
return Children.map(parse$1(snippet.code), (element) => {
|
|
7913
|
+
if (typeof element === "string")
|
|
7914
|
+
return element;
|
|
7915
|
+
if (!VALID_TAG_REGEX.test(element.type))
|
|
7916
|
+
return null;
|
|
7917
|
+
const key = element.key ? `${snippet.id}:${element.key}` : snippet.id;
|
|
7918
|
+
return createElement(element.type, __spreadProps(__spreadValues({}, element.props), {
|
|
7919
|
+
key
|
|
7920
|
+
}));
|
|
7921
|
+
});
|
|
7922
|
+
}
|
|
7923
|
+
const filterUsedSnippetProperties = ({
|
|
7924
|
+
code,
|
|
7925
|
+
builderEnabled,
|
|
7926
|
+
liveEnabled,
|
|
7927
|
+
location,
|
|
7928
|
+
cleanup
|
|
7929
|
+
}) => ({
|
|
7930
|
+
code,
|
|
7931
|
+
builderEnabled,
|
|
7932
|
+
liveEnabled,
|
|
7933
|
+
location,
|
|
7934
|
+
cleanup
|
|
7935
|
+
});
|
|
7936
|
+
const PAGE_SNIPPETS_QUERY = gql`
|
|
7937
|
+
query PageById($id: ID!) {
|
|
7938
|
+
page(id: $id) {
|
|
7939
|
+
__typename
|
|
7940
|
+
id
|
|
7941
|
+
snippets {
|
|
7942
|
+
__typename
|
|
7943
|
+
id
|
|
7944
|
+
name
|
|
7945
|
+
code
|
|
7946
|
+
cleanup
|
|
7947
|
+
location
|
|
7948
|
+
shouldAddToNewPages
|
|
7949
|
+
liveEnabled
|
|
7950
|
+
builderEnabled
|
|
7951
|
+
}
|
|
7952
|
+
}
|
|
7953
|
+
}
|
|
7954
|
+
`;
|
|
7955
|
+
const SITE_FONTS_QUERY = gql`
|
|
7956
|
+
query SiteById($id: ID!) {
|
|
7957
|
+
site(id: $id) {
|
|
7958
|
+
id
|
|
7959
|
+
googleFonts {
|
|
7960
|
+
edges {
|
|
7961
|
+
activeVariants {
|
|
7962
|
+
specifier
|
|
7963
|
+
}
|
|
7964
|
+
node {
|
|
7965
|
+
family
|
|
7966
|
+
variants {
|
|
7967
|
+
specifier
|
|
7968
|
+
}
|
|
7969
|
+
}
|
|
7970
|
+
}
|
|
7971
|
+
}
|
|
7972
|
+
}
|
|
7973
|
+
}
|
|
7974
|
+
`;
|
|
7975
|
+
function Page2({
|
|
7976
|
+
page,
|
|
7977
|
+
preview = false
|
|
7978
|
+
}) {
|
|
7979
|
+
var _a;
|
|
7980
|
+
const isInBuilder = useIsInBuilder();
|
|
7981
|
+
const [snippets, setSnippets] = useState(page.snippets);
|
|
7982
|
+
useQuery(PAGE_SNIPPETS_QUERY, {
|
|
7983
|
+
variables: {
|
|
7984
|
+
id: page.id
|
|
7985
|
+
},
|
|
7986
|
+
skip: isInBuilder === false,
|
|
7987
|
+
fetchPolicy: "cache-only",
|
|
7988
|
+
onCompleted(data) {
|
|
7989
|
+
if (data == null)
|
|
7990
|
+
return;
|
|
7991
|
+
const oldSnippets = snippets.map(filterUsedSnippetProperties);
|
|
7992
|
+
const newSnippets = data.page.snippets.map(filterUsedSnippetProperties);
|
|
7993
|
+
if (deepEqual(newSnippets, oldSnippets))
|
|
7994
|
+
return;
|
|
7995
|
+
setSnippets(data.page.snippets);
|
|
7996
|
+
}
|
|
7997
|
+
});
|
|
7998
|
+
const {
|
|
7999
|
+
data: siteData
|
|
8000
|
+
} = useQuery(SITE_FONTS_QUERY, {
|
|
8001
|
+
variables: {
|
|
8002
|
+
id: page.site.id
|
|
8003
|
+
},
|
|
8004
|
+
skip: isInBuilder === false,
|
|
8005
|
+
fetchPolicy: "cache-only"
|
|
8006
|
+
});
|
|
8007
|
+
const favicon = (_a = page.meta.favicon) != null ? _a : defaultFavicon;
|
|
8008
|
+
const {
|
|
8009
|
+
title,
|
|
8010
|
+
description,
|
|
8011
|
+
keywords,
|
|
8012
|
+
socialImage
|
|
8013
|
+
} = page.meta;
|
|
8014
|
+
const {
|
|
8015
|
+
canonicalUrl,
|
|
8016
|
+
isIndexingBlocked
|
|
8017
|
+
} = page.seo;
|
|
8018
|
+
const fontFamilyParamValue = useMemo(() => {
|
|
8019
|
+
if ((siteData == null ? void 0 : siteData.site) == null) {
|
|
8020
|
+
return page.fonts.map(({
|
|
8021
|
+
family,
|
|
8022
|
+
variants
|
|
8023
|
+
}) => {
|
|
8024
|
+
return `${family.replace(/ /g, "+")}:${variants.join()}`;
|
|
8025
|
+
}).join("|");
|
|
8026
|
+
}
|
|
8027
|
+
return siteData.site.googleFonts.edges.filter((edge) => edge != null).map(({
|
|
8028
|
+
activeVariants,
|
|
8029
|
+
node: {
|
|
8030
|
+
family,
|
|
8031
|
+
variants
|
|
8032
|
+
}
|
|
8033
|
+
}) => {
|
|
8034
|
+
const activeVariantSpecifiers = variants.filter((variant) => activeVariants.some((activeVariant) => activeVariant.specifier === variant.specifier)).map((variant) => variant.specifier).join();
|
|
8035
|
+
return `${family.replace(/ /g, "+")}:${activeVariantSpecifiers}`;
|
|
8036
|
+
}).join("|");
|
|
8037
|
+
}, [siteData, page]);
|
|
8038
|
+
const filteredSnippets = useMemo(() => snippets.filter((snippet) => preview ? snippet.builderEnabled : snippet.liveEnabled), [snippets]);
|
|
8039
|
+
const headSnippets = useMemo(() => filteredSnippets.filter((snippet) => snippet.location === "HEAD"), [filteredSnippets]);
|
|
8040
|
+
const previousHeadSnippets = useRef(null);
|
|
8041
|
+
useEffect(() => {
|
|
8042
|
+
var _a2;
|
|
8043
|
+
const headSnippetsToCleanUp = ((_a2 = previousHeadSnippets.current) != null ? _a2 : []).filter((previousSnippet) => previousSnippet.cleanup != null).filter((previousSnippet) => !headSnippets.some((snippet) => previousSnippet.id === snippet.id));
|
|
8044
|
+
headSnippetsToCleanUp.forEach((snippetToCleanUp) => {
|
|
8045
|
+
if (snippetToCleanUp.cleanup == null)
|
|
8046
|
+
return;
|
|
8047
|
+
const cleanUp = new Function(snippetToCleanUp.cleanup);
|
|
8048
|
+
try {
|
|
8049
|
+
cleanUp();
|
|
8050
|
+
} catch {
|
|
8051
|
+
}
|
|
8052
|
+
});
|
|
8053
|
+
previousHeadSnippets.current = headSnippets;
|
|
8054
|
+
}, [headSnippets]);
|
|
8055
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
8056
|
+
children: [/* @__PURE__ */ jsxs(Head, {
|
|
8057
|
+
children: [/* @__PURE__ */ jsx("style", {
|
|
8058
|
+
children: `
|
|
8059
|
+
html {
|
|
8060
|
+
font-family: sans-serif;
|
|
8061
|
+
}
|
|
8062
|
+
div#__next {
|
|
8063
|
+
overflow: hidden;
|
|
8064
|
+
}
|
|
8065
|
+
`
|
|
8066
|
+
}), /* @__PURE__ */ jsx("link", {
|
|
8067
|
+
rel: "icon",
|
|
8068
|
+
type: favicon.mimetype,
|
|
8069
|
+
href: favicon.publicUrl
|
|
8070
|
+
}), canonicalUrl && /* @__PURE__ */ jsx("link", {
|
|
8071
|
+
rel: "canonical",
|
|
8072
|
+
href: canonicalUrl
|
|
8073
|
+
}), isIndexingBlocked && /* @__PURE__ */ jsx("meta", {
|
|
8074
|
+
name: "robots",
|
|
8075
|
+
content: "noindex"
|
|
8076
|
+
}), title && /* @__PURE__ */ jsxs(Fragment, {
|
|
8077
|
+
children: [/* @__PURE__ */ jsx("title", {
|
|
8078
|
+
children: title
|
|
8079
|
+
}), /* @__PURE__ */ jsx("meta", {
|
|
8080
|
+
property: "og:title",
|
|
8081
|
+
content: title
|
|
8082
|
+
}), /* @__PURE__ */ jsx("meta", {
|
|
8083
|
+
name: "twitter:title",
|
|
8084
|
+
content: title
|
|
8085
|
+
}), /* @__PURE__ */ jsx("meta", {
|
|
8086
|
+
itemProp: "name",
|
|
8087
|
+
content: title
|
|
8088
|
+
})]
|
|
8089
|
+
}), description && /* @__PURE__ */ jsxs(Fragment, {
|
|
8090
|
+
children: [/* @__PURE__ */ jsx("meta", {
|
|
8091
|
+
name: "description",
|
|
8092
|
+
content: description
|
|
8093
|
+
}), /* @__PURE__ */ jsx("meta", {
|
|
8094
|
+
property: "og:description",
|
|
8095
|
+
content: description
|
|
8096
|
+
}), /* @__PURE__ */ jsx("meta", {
|
|
8097
|
+
name: "twitter:description",
|
|
8098
|
+
content: description
|
|
8099
|
+
}), /* @__PURE__ */ jsx("meta", {
|
|
8100
|
+
itemProp: "description",
|
|
8101
|
+
content: description
|
|
8102
|
+
})]
|
|
8103
|
+
}), keywords && /* @__PURE__ */ jsx("meta", {
|
|
8104
|
+
name: "keywords",
|
|
8105
|
+
content: keywords
|
|
8106
|
+
}), socialImage && /* @__PURE__ */ jsxs(Fragment, {
|
|
8107
|
+
children: [/* @__PURE__ */ jsx("meta", {
|
|
8108
|
+
property: "og:image",
|
|
8109
|
+
content: socialImage.publicUrl
|
|
8110
|
+
}), /* @__PURE__ */ jsx("meta", {
|
|
8111
|
+
property: "og:image:type",
|
|
8112
|
+
content: socialImage.publicUrl
|
|
8113
|
+
}), /* @__PURE__ */ jsx("meta", {
|
|
8114
|
+
name: "twitter:image",
|
|
8115
|
+
content: socialImage.publicUrl
|
|
8116
|
+
}), /* @__PURE__ */ jsx("meta", {
|
|
8117
|
+
name: "twitter:card",
|
|
8118
|
+
content: socialImage.publicUrl
|
|
8119
|
+
}), /* @__PURE__ */ jsx("meta", {
|
|
8120
|
+
itemProp: "image",
|
|
8121
|
+
content: socialImage.publicUrl
|
|
8122
|
+
})]
|
|
8123
|
+
}), fontFamilyParamValue !== "" && /* @__PURE__ */ jsx(Fragment, {
|
|
8124
|
+
children: /* @__PURE__ */ jsx("link", {
|
|
8125
|
+
rel: "stylesheet",
|
|
8126
|
+
href: `https://fonts.googleapis.com/css?family=${fontFamilyParamValue}&display=swap`
|
|
8127
|
+
})
|
|
8128
|
+
}), headSnippets.map(snippetToElement).map((children) => Children.map(children, (child) => {
|
|
8129
|
+
if (typeof child === "string")
|
|
8130
|
+
return child;
|
|
8131
|
+
if (VALID_HEAD_ELEMENT_TYPES.includes(child.type))
|
|
8132
|
+
return child;
|
|
8133
|
+
return null;
|
|
8134
|
+
}))]
|
|
8135
|
+
}), /* @__PURE__ */ jsx(DocumentReference, {
|
|
8136
|
+
documentReference: createDocumentReference(page.id)
|
|
8137
|
+
}), filteredSnippets.filter((snippet) => snippet.location === "BODY").map((snippet) => /* @__PURE__ */ jsx(BodySnippet, {
|
|
8138
|
+
code: snippet.code,
|
|
8139
|
+
cleanup: snippet.cleanup
|
|
8140
|
+
}, snippet.id))]
|
|
8141
|
+
});
|
|
8142
|
+
}
|
|
7798
8143
|
var _path;
|
|
7799
8144
|
function _extends() {
|
|
7800
8145
|
_extends = Object.assign || function(target) {
|
|
@@ -8236,7 +8581,7 @@ function ShapeControlValue({
|
|
|
8236
8581
|
data,
|
|
8237
8582
|
children
|
|
8238
8583
|
}) {
|
|
8239
|
-
return Object.entries(definition.config.type).
|
|
8584
|
+
return Object.entries(definition.config.type).reduceRight((renderFn, [key, controlDefinition]) => (shapeControlValue) => /* @__PURE__ */ jsx(ControlValue, {
|
|
8240
8585
|
definition: controlDefinition,
|
|
8241
8586
|
data: data == null ? void 0 : data[key],
|
|
8242
8587
|
children: (value) => renderFn(__spreadProps(__spreadValues({}, shapeControlValue), {
|
|
@@ -8382,11 +8727,9 @@ function PropsValue({
|
|
|
8382
8727
|
function suppressWarningAndFindDomNode(instance) {
|
|
8383
8728
|
const error = console.error;
|
|
8384
8729
|
console.error = (...args) => {
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
error.apply(console, args);
|
|
8389
|
-
}
|
|
8730
|
+
if (typeof args[0] === "string" && args[0].includes("%s is deprecated in StrictMode."))
|
|
8731
|
+
return;
|
|
8732
|
+
return error.apply(console, args);
|
|
8390
8733
|
};
|
|
8391
8734
|
const foundDomNode = findDOMNode(instance);
|
|
8392
8735
|
console.error = error;
|
|
@@ -8544,11 +8887,10 @@ function useSuppressRefWarning(ownerName) {
|
|
|
8544
8887
|
const patchedRef = useRef(false);
|
|
8545
8888
|
if (patchedRef.current === false) {
|
|
8546
8889
|
console.error = (...args) => {
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
if (!text.includes("Function components cannot be given refs.") || !text.includes(`Check the render method of \`${ownerName}\`.`)) {
|
|
8550
|
-
originalErrorRef.current(...args);
|
|
8890
|
+
if (typeof args[0] === "string" && args[0].includes("Function components cannot be given refs.") && args[0].includes(`Check the render method of \`${ownerName}\`.`)) {
|
|
8891
|
+
return;
|
|
8551
8892
|
}
|
|
8893
|
+
return originalErrorRef.current(...args);
|
|
8552
8894
|
};
|
|
8553
8895
|
patchedRef.current = true;
|
|
8554
8896
|
}
|
|
@@ -8578,6 +8920,7 @@ const ElementData = memo(forwardRef(function ElementData2({
|
|
|
8578
8920
|
})
|
|
8579
8921
|
});
|
|
8580
8922
|
}));
|
|
8923
|
+
const DisableRegisterElement = createContext(false);
|
|
8581
8924
|
const ElementReference = memo(forwardRef(function ElementReference2({
|
|
8582
8925
|
elementReference
|
|
8583
8926
|
}, ref) {
|
|
@@ -8614,9 +8957,12 @@ const ElementReference = memo(forwardRef(function ElementReference2({
|
|
|
8614
8957
|
return elementReferenceDocument != null ? /* @__PURE__ */ jsx(Document, {
|
|
8615
8958
|
document: elementReferenceDocument,
|
|
8616
8959
|
ref
|
|
8617
|
-
}) : /* @__PURE__ */ jsx(
|
|
8618
|
-
|
|
8619
|
-
|
|
8960
|
+
}) : /* @__PURE__ */ jsx(DisableRegisterElement.Provider, {
|
|
8961
|
+
value: true,
|
|
8962
|
+
children: /* @__PURE__ */ jsx(ElementData, {
|
|
8963
|
+
elementData: globalElementData,
|
|
8964
|
+
ref
|
|
8965
|
+
})
|
|
8620
8966
|
});
|
|
8621
8967
|
}));
|
|
8622
8968
|
const Element$1 = memo(forwardRef(function Element2({
|
|
@@ -8626,17 +8972,18 @@ const Element$1 = memo(forwardRef(function Element2({
|
|
|
8626
8972
|
const dispatch = useDispatch();
|
|
8627
8973
|
const documentKey = useDocumentKey();
|
|
8628
8974
|
const [handle, setHandle] = useState(null);
|
|
8975
|
+
const isRegisterElementDisabled = useContext(DisableRegisterElement);
|
|
8629
8976
|
useImperativeHandle(ref, () => handle, [handle]);
|
|
8630
8977
|
useEffect(() => {
|
|
8631
|
-
if (documentKey == null)
|
|
8978
|
+
if (documentKey == null || isRegisterElementDisabled)
|
|
8632
8979
|
return;
|
|
8633
8980
|
return dispatch(registerComponentHandleEffect(documentKey, elementKey, handle));
|
|
8634
|
-
}, [dispatch, documentKey, elementKey, handle]);
|
|
8981
|
+
}, [dispatch, documentKey, elementKey, handle, isRegisterElementDisabled]);
|
|
8635
8982
|
useEffect(() => {
|
|
8636
|
-
if (documentKey == null)
|
|
8983
|
+
if (documentKey == null || isRegisterElementDisabled)
|
|
8637
8984
|
return;
|
|
8638
8985
|
return dispatch(mountComponentEffect(documentKey, elementKey));
|
|
8639
|
-
}, [dispatch, documentKey, elementKey]);
|
|
8986
|
+
}, [dispatch, documentKey, elementKey, isRegisterElementDisabled]);
|
|
8640
8987
|
return isElementReference(element) ? /* @__PURE__ */ jsx(ElementReference, {
|
|
8641
8988
|
ref: setHandle,
|
|
8642
8989
|
elementReference: element
|
|
@@ -8646,21 +8993,21 @@ const Element$1 = memo(forwardRef(function Element2({
|
|
|
8646
8993
|
}, elementKey);
|
|
8647
8994
|
}));
|
|
8648
8995
|
const Document = memo(forwardRef(function Document2({
|
|
8649
|
-
document
|
|
8996
|
+
document: document2
|
|
8650
8997
|
}, ref) {
|
|
8651
8998
|
return /* @__PURE__ */ jsx(DocumentContext.Provider, {
|
|
8652
|
-
value:
|
|
8999
|
+
value: document2.key,
|
|
8653
9000
|
children: /* @__PURE__ */ jsx(Element$1, {
|
|
8654
9001
|
ref,
|
|
8655
|
-
element:
|
|
9002
|
+
element: document2.rootElement
|
|
8656
9003
|
})
|
|
8657
9004
|
});
|
|
8658
9005
|
}));
|
|
8659
9006
|
const DocumentReference = memo(forwardRef(function DocumentReference2({
|
|
8660
9007
|
documentReference
|
|
8661
9008
|
}, ref) {
|
|
8662
|
-
const
|
|
8663
|
-
if (
|
|
9009
|
+
const document2 = useDocument(documentReference.key);
|
|
9010
|
+
if (document2 == null) {
|
|
8664
9011
|
return /* @__PURE__ */ jsx(FallbackComponent, {
|
|
8665
9012
|
ref,
|
|
8666
9013
|
text: "Document not found"
|
|
@@ -8668,8 +9015,8 @@ const DocumentReference = memo(forwardRef(function DocumentReference2({
|
|
|
8668
9015
|
}
|
|
8669
9016
|
return /* @__PURE__ */ jsx(Document, {
|
|
8670
9017
|
ref,
|
|
8671
|
-
document
|
|
9018
|
+
document: document2
|
|
8672
9019
|
});
|
|
8673
9020
|
}));
|
|
8674
|
-
export { useBackgrounds as A, Box as B, Carousel as C, DocumentReference as D, Element$1 as E, Form as F, useBorder as G, useBoxShadow as H, ImageComponent as I, useResponsiveColor as J, useFile as K, useMediaQuery as L, usePage as M, Navigation as N, useTable as O, PageProvider as P,
|
|
9021
|
+
export { useBackgrounds as A, Box as B, Carousel as C, DocumentReference as D, Element$1 as E, Form as F, useBorder as G, useBoxShadow as H, ImageComponent as I, useResponsiveColor as J, useFile as K, useMediaQuery as L, usePage as M, Navigation as N, useTable as O, PageProvider as P, PAGE_SNIPPETS_QUERY as Q, RuntimeProvider as R, SocialLinks as S, Text as T, SITE_FONTS_QUERY as U, Page2 as V, MakeswiftClient as W, deepEqual as X, ReactRuntime as a, usePageId as b, Button$1 as c, Countdown as d, Divider as e, Embed as f, Root as g, registerComponent$c as h, DEFAULT_BOX_ANIMATE_TYPE as i, DEFAULT_BOX_ANIMATE_DELAY as j, DEFAULT_BOX_ANIMATE_DURATION as k, DEFAULT_ITEM_ANIMATE_TYPE as l, DEFAULT_ITEM_ANIMATE_DELAY as m, DEFAULT_ITEM_ANIMATE_DURATION as n, DEFAULT_ITEM_STAGGER_DURATION as o, cssMediaRules as p, cssWidth as q, registerBuiltinComponents as r, cssMargin as s, cssPadding as t, useIsInBuilder as u, cssBorder as v, cssBorderRadius as w, cssBoxShadow as x, cssGridItem as y, cssTextStyle as z };
|
|
8675
9022
|
//# sourceMappingURL=index.es.js.map
|