@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.cjs.js
CHANGED
|
@@ -47,8 +47,8 @@ var ssr = require("@apollo/client/react/ssr");
|
|
|
47
47
|
var slate = require("slate");
|
|
48
48
|
var uuid = require("uuid/v4");
|
|
49
49
|
var jsxRuntime = require("react/jsx-runtime");
|
|
50
|
-
require("html-react-parser");
|
|
51
|
-
require("next/head");
|
|
50
|
+
var parse = require("html-react-parser");
|
|
51
|
+
var Head = require("next/head");
|
|
52
52
|
var descriptors = require("./descriptors.cjs.js");
|
|
53
53
|
var ColorHelper = require("color");
|
|
54
54
|
var scrollIntoView = require("scroll-into-view-if-needed");
|
|
@@ -62,6 +62,7 @@ var polished = require("polished");
|
|
|
62
62
|
var ReactPlayer = require("react-player");
|
|
63
63
|
var Hotkeys = require("slate-hotkeys");
|
|
64
64
|
var ipsum = require("corporate-ipsum");
|
|
65
|
+
var isHotkey = require("is-hotkey");
|
|
65
66
|
var slateReact = require("slate-react");
|
|
66
67
|
var Lists = require("@convertkit/slate-lists");
|
|
67
68
|
var textInput = require("./text-input.cjs.js");
|
|
@@ -94,6 +95,8 @@ function _interopNamespace(e) {
|
|
|
94
95
|
var React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
95
96
|
var styled__default = /* @__PURE__ */ _interopDefaultLegacy(styled);
|
|
96
97
|
var uuid__default = /* @__PURE__ */ _interopDefaultLegacy(uuid);
|
|
98
|
+
var parse__default = /* @__PURE__ */ _interopDefaultLegacy(parse);
|
|
99
|
+
var Head__default = /* @__PURE__ */ _interopDefaultLegacy(Head);
|
|
97
100
|
var ColorHelper__default = /* @__PURE__ */ _interopDefaultLegacy(ColorHelper);
|
|
98
101
|
var scrollIntoView__default = /* @__PURE__ */ _interopDefaultLegacy(scrollIntoView);
|
|
99
102
|
var NextLink__default = /* @__PURE__ */ _interopDefaultLegacy(NextLink);
|
|
@@ -317,6 +320,24 @@ const typePolicies = {
|
|
|
317
320
|
__typename: "Table",
|
|
318
321
|
id: args == null ? void 0 : args.id
|
|
319
322
|
}, true);
|
|
323
|
+
},
|
|
324
|
+
page(existingData, {
|
|
325
|
+
args,
|
|
326
|
+
toReference
|
|
327
|
+
}) {
|
|
328
|
+
return existingData != null ? existingData : toReference({
|
|
329
|
+
__typename: "Page",
|
|
330
|
+
id: args == null ? void 0 : args.id
|
|
331
|
+
}, true);
|
|
332
|
+
},
|
|
333
|
+
site(existingData, {
|
|
334
|
+
args,
|
|
335
|
+
toReference
|
|
336
|
+
}) {
|
|
337
|
+
return existingData != null ? existingData : toReference({
|
|
338
|
+
__typename: "Site",
|
|
339
|
+
id: args == null ? void 0 : args.id
|
|
340
|
+
}, true);
|
|
320
341
|
}
|
|
321
342
|
}
|
|
322
343
|
}
|
|
@@ -2169,7 +2190,8 @@ const Button$1 = React.forwardRef(function Button2(_m, ref) {
|
|
|
2169
2190
|
color,
|
|
2170
2191
|
textStyle,
|
|
2171
2192
|
width,
|
|
2172
|
-
margin
|
|
2193
|
+
margin,
|
|
2194
|
+
className
|
|
2173
2195
|
} = _n, restOfProps = __objRest(_n, [
|
|
2174
2196
|
"id",
|
|
2175
2197
|
"children",
|
|
@@ -2181,12 +2203,13 @@ const Button$1 = React.forwardRef(function Button2(_m, ref) {
|
|
|
2181
2203
|
"color",
|
|
2182
2204
|
"textStyle",
|
|
2183
2205
|
"width",
|
|
2184
|
-
"margin"
|
|
2206
|
+
"margin",
|
|
2207
|
+
"className"
|
|
2185
2208
|
]);
|
|
2186
2209
|
return /* @__PURE__ */ jsxRuntime.jsx(StyledButton$1, __spreadProps(__spreadValues({}, restOfProps), {
|
|
2187
2210
|
ref,
|
|
2188
2211
|
id,
|
|
2189
|
-
className: css.cx(css.css(responsiveWidth(width, "auto"))),
|
|
2212
|
+
className: css.cx(css.css(responsiveWidth(width, "auto")), className),
|
|
2190
2213
|
color,
|
|
2191
2214
|
link,
|
|
2192
2215
|
margin,
|
|
@@ -2547,7 +2570,7 @@ const Reel = styled__default["default"](framerMotion.motion.div)`
|
|
|
2547
2570
|
}
|
|
2548
2571
|
`)}
|
|
2549
2572
|
`;
|
|
2550
|
-
const Page = styled__default["default"](framerMotion.motion.div)`
|
|
2573
|
+
const Page$1 = styled__default["default"](framerMotion.motion.div)`
|
|
2551
2574
|
position: relative;
|
|
2552
2575
|
width: 100%;
|
|
2553
2576
|
`;
|
|
@@ -2760,7 +2783,7 @@ const Carousel = React.forwardRef(function Carousel2({
|
|
|
2760
2783
|
},
|
|
2761
2784
|
children: [/* @__PURE__ */ jsxRuntime.jsxs(Container$b, {
|
|
2762
2785
|
children: [/* @__PURE__ */ jsxRuntime.jsx(ClipMask, {
|
|
2763
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Page, __spreadProps(__spreadValues({}, bindPage()), {
|
|
2786
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Page$1, __spreadProps(__spreadValues({}, bindPage()), {
|
|
2764
2787
|
animate: animation,
|
|
2765
2788
|
children: /* @__PURE__ */ jsxRuntime.jsx(Reel, {
|
|
2766
2789
|
gap,
|
|
@@ -3549,7 +3572,7 @@ const defaultHtml = `<div style="padding: 24px; background-color: rgba(161, 168,
|
|
|
3549
3572
|
<rect y="160" width="40" height="8" rx="2" fill="#A1A8C2" fill-opacity="0.5"/>
|
|
3550
3573
|
</svg>
|
|
3551
3574
|
</div>`;
|
|
3552
|
-
const SCRIPT_TAG = "script";
|
|
3575
|
+
const SCRIPT_TAG$1 = "script";
|
|
3553
3576
|
const Embed = React.forwardRef(function Embed2({
|
|
3554
3577
|
id,
|
|
3555
3578
|
width,
|
|
@@ -3567,7 +3590,7 @@ const Embed = React.forwardRef(function Embed2({
|
|
|
3567
3590
|
return;
|
|
3568
3591
|
const walker = container.ownerDocument.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
3569
3592
|
acceptNode(node) {
|
|
3570
|
-
return node.tagName.toLowerCase() === SCRIPT_TAG ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
|
|
3593
|
+
return node.tagName.toLowerCase() === SCRIPT_TAG$1 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
|
|
3571
3594
|
}
|
|
3572
3595
|
});
|
|
3573
3596
|
const nodes = [];
|
|
@@ -3578,7 +3601,7 @@ const Embed = React.forwardRef(function Embed2({
|
|
|
3578
3601
|
await new Promise((resolve) => {
|
|
3579
3602
|
var _a, _b;
|
|
3580
3603
|
const node = nodes[i];
|
|
3581
|
-
const script = node.ownerDocument.createElement(SCRIPT_TAG);
|
|
3604
|
+
const script = node.ownerDocument.createElement(SCRIPT_TAG$1);
|
|
3582
3605
|
script.textContent = node.textContent;
|
|
3583
3606
|
Array.from(node.attributes).forEach(({
|
|
3584
3607
|
name,
|
|
@@ -4907,7 +4930,7 @@ function useTableFormFieldRefs(propController, { fieldsCount }) {
|
|
|
4907
4930
|
}
|
|
4908
4931
|
}, [propController, container, items, isInBuilder]);
|
|
4909
4932
|
const itemRefs = React.useMemo(() => Array.from({ length: fieldsCount + 1 }).map((_, index) => (item) => {
|
|
4910
|
-
setItems((
|
|
4933
|
+
setItems((is2) => [...is2.slice(0, index), item, ...is2.slice(index + 1)]);
|
|
4911
4934
|
}), [fieldsCount, setItems]);
|
|
4912
4935
|
return { container: setContainer, items: itemRefs };
|
|
4913
4936
|
}
|
|
@@ -7612,7 +7635,7 @@ const Text = React.forwardRef(function Text2({
|
|
|
7612
7635
|
(_a = lastController.current) == null ? void 0 : _a.focus();
|
|
7613
7636
|
}, []);
|
|
7614
7637
|
const handleKeyDown = React.useCallback((event, _editor, next) => {
|
|
7615
|
-
var _a, _b;
|
|
7638
|
+
var _a, _b, _c;
|
|
7616
7639
|
if (Hotkeys__default["default"].isUndo(event)) {
|
|
7617
7640
|
(_a = lastController.current) == null ? void 0 : _a.undo();
|
|
7618
7641
|
return true;
|
|
@@ -7621,6 +7644,10 @@ const Text = React.forwardRef(function Text2({
|
|
|
7621
7644
|
(_b = lastController.current) == null ? void 0 : _b.redo();
|
|
7622
7645
|
return true;
|
|
7623
7646
|
}
|
|
7647
|
+
if (isHotkey.isHotkey("escape")(event)) {
|
|
7648
|
+
(_c = lastController.current) == null ? void 0 : _c.blur();
|
|
7649
|
+
return true;
|
|
7650
|
+
}
|
|
7624
7651
|
return next();
|
|
7625
7652
|
}, []);
|
|
7626
7653
|
const isInBuilder = useIsInBuilder();
|
|
@@ -7633,7 +7660,8 @@ const Text = React.forwardRef(function Text2({
|
|
|
7633
7660
|
value,
|
|
7634
7661
|
onChange: handleChange,
|
|
7635
7662
|
onFocus: handleFocus,
|
|
7636
|
-
onKeyDown: handleKeyDown
|
|
7663
|
+
onKeyDown: handleKeyDown,
|
|
7664
|
+
onBlur: (e) => e.preventDefault()
|
|
7637
7665
|
});
|
|
7638
7666
|
});
|
|
7639
7667
|
function registerComponent$1(runtime) {
|
|
@@ -7829,6 +7857,325 @@ function registerBuiltinComponents(runtime) {
|
|
|
7829
7857
|
unregisterVideoComponent();
|
|
7830
7858
|
};
|
|
7831
7859
|
}
|
|
7860
|
+
const SCRIPT_TAG = "script";
|
|
7861
|
+
function BodySnippet({
|
|
7862
|
+
code,
|
|
7863
|
+
cleanup
|
|
7864
|
+
}) {
|
|
7865
|
+
React.useEffect(() => {
|
|
7866
|
+
const container = document.createElement("div");
|
|
7867
|
+
container.innerHTML = code;
|
|
7868
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT);
|
|
7869
|
+
const scripts = [];
|
|
7870
|
+
while (walker.nextNode()) {
|
|
7871
|
+
if (walker.currentNode instanceof HTMLScriptElement)
|
|
7872
|
+
scripts.push(walker.currentNode);
|
|
7873
|
+
}
|
|
7874
|
+
scripts.forEach((inlineScript) => {
|
|
7875
|
+
var _a;
|
|
7876
|
+
const executableScript = document.createElement(SCRIPT_TAG);
|
|
7877
|
+
executableScript.textContent = inlineScript.textContent;
|
|
7878
|
+
Array.from(inlineScript.attributes).forEach(({
|
|
7879
|
+
name,
|
|
7880
|
+
value
|
|
7881
|
+
}) => {
|
|
7882
|
+
executableScript.setAttribute(name, value);
|
|
7883
|
+
});
|
|
7884
|
+
(_a = inlineScript.parentNode) == null ? void 0 : _a.replaceChild(executableScript, inlineScript);
|
|
7885
|
+
});
|
|
7886
|
+
const nodes = Array.from(container.childNodes);
|
|
7887
|
+
document.body.append(...nodes);
|
|
7888
|
+
return () => {
|
|
7889
|
+
nodes.forEach((node) => {
|
|
7890
|
+
var _a;
|
|
7891
|
+
(_a = node.parentNode) == null ? void 0 : _a.removeChild(node);
|
|
7892
|
+
});
|
|
7893
|
+
if (cleanup == null)
|
|
7894
|
+
return;
|
|
7895
|
+
const cleanUp = new Function(cleanup);
|
|
7896
|
+
try {
|
|
7897
|
+
cleanUp();
|
|
7898
|
+
} catch {
|
|
7899
|
+
}
|
|
7900
|
+
};
|
|
7901
|
+
}, [code, cleanup]);
|
|
7902
|
+
return null;
|
|
7903
|
+
}
|
|
7904
|
+
function is(x, y) {
|
|
7905
|
+
if (x === y)
|
|
7906
|
+
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
7907
|
+
return x !== x && y !== y;
|
|
7908
|
+
}
|
|
7909
|
+
const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
|
|
7910
|
+
const shallowEqual = (a, b) => {
|
|
7911
|
+
if (is(a, b))
|
|
7912
|
+
return true;
|
|
7913
|
+
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
7914
|
+
return false;
|
|
7915
|
+
const keysA = Object.keys(a);
|
|
7916
|
+
const keysB = Object.keys(b);
|
|
7917
|
+
if (keysA.length !== keysB.length)
|
|
7918
|
+
return false;
|
|
7919
|
+
for (let i = 0; i < keysA.length; i += 1) {
|
|
7920
|
+
if (!hasOwnProperty$1.call(b, keysA[i]) || !is(a[keysA[i]], b[keysA[i]]))
|
|
7921
|
+
return false;
|
|
7922
|
+
}
|
|
7923
|
+
return true;
|
|
7924
|
+
};
|
|
7925
|
+
const { hasOwnProperty } = Object.prototype;
|
|
7926
|
+
const deepEqual = (a, b) => {
|
|
7927
|
+
if (shallowEqual(a, b))
|
|
7928
|
+
return true;
|
|
7929
|
+
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
7930
|
+
return false;
|
|
7931
|
+
const keysA = Object.keys(a);
|
|
7932
|
+
const keysB = Object.keys(b);
|
|
7933
|
+
if (keysA.length !== keysB.length)
|
|
7934
|
+
return false;
|
|
7935
|
+
for (let i = 0; i < keysA.length; i += 1) {
|
|
7936
|
+
if (!hasOwnProperty.call(b, keysA[i]) || !deepEqual(a[keysA[i]], b[keysA[i]]))
|
|
7937
|
+
return false;
|
|
7938
|
+
}
|
|
7939
|
+
return true;
|
|
7940
|
+
};
|
|
7941
|
+
const defaultFavicon = {
|
|
7942
|
+
mimetype: "image/png",
|
|
7943
|
+
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"
|
|
7944
|
+
};
|
|
7945
|
+
const VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_.\-\d]*$/;
|
|
7946
|
+
const VALID_HEAD_ELEMENT_TYPES = ["title", "base", "link", "style", "meta", "script", "noscript", "template"];
|
|
7947
|
+
function snippetToElement(snippet) {
|
|
7948
|
+
return React.Children.map(parse__default["default"](snippet.code), (element) => {
|
|
7949
|
+
if (typeof element === "string")
|
|
7950
|
+
return element;
|
|
7951
|
+
if (!VALID_TAG_REGEX.test(element.type))
|
|
7952
|
+
return null;
|
|
7953
|
+
const key = element.key ? `${snippet.id}:${element.key}` : snippet.id;
|
|
7954
|
+
return React.createElement(element.type, __spreadProps(__spreadValues({}, element.props), {
|
|
7955
|
+
key
|
|
7956
|
+
}));
|
|
7957
|
+
});
|
|
7958
|
+
}
|
|
7959
|
+
const filterUsedSnippetProperties = ({
|
|
7960
|
+
code,
|
|
7961
|
+
builderEnabled,
|
|
7962
|
+
liveEnabled,
|
|
7963
|
+
location,
|
|
7964
|
+
cleanup
|
|
7965
|
+
}) => ({
|
|
7966
|
+
code,
|
|
7967
|
+
builderEnabled,
|
|
7968
|
+
liveEnabled,
|
|
7969
|
+
location,
|
|
7970
|
+
cleanup
|
|
7971
|
+
});
|
|
7972
|
+
const PAGE_SNIPPETS_QUERY = client.gql`
|
|
7973
|
+
query PageById($id: ID!) {
|
|
7974
|
+
page(id: $id) {
|
|
7975
|
+
__typename
|
|
7976
|
+
id
|
|
7977
|
+
snippets {
|
|
7978
|
+
__typename
|
|
7979
|
+
id
|
|
7980
|
+
name
|
|
7981
|
+
code
|
|
7982
|
+
cleanup
|
|
7983
|
+
location
|
|
7984
|
+
shouldAddToNewPages
|
|
7985
|
+
liveEnabled
|
|
7986
|
+
builderEnabled
|
|
7987
|
+
}
|
|
7988
|
+
}
|
|
7989
|
+
}
|
|
7990
|
+
`;
|
|
7991
|
+
const SITE_FONTS_QUERY = client.gql`
|
|
7992
|
+
query SiteById($id: ID!) {
|
|
7993
|
+
site(id: $id) {
|
|
7994
|
+
id
|
|
7995
|
+
googleFonts {
|
|
7996
|
+
edges {
|
|
7997
|
+
activeVariants {
|
|
7998
|
+
specifier
|
|
7999
|
+
}
|
|
8000
|
+
node {
|
|
8001
|
+
family
|
|
8002
|
+
variants {
|
|
8003
|
+
specifier
|
|
8004
|
+
}
|
|
8005
|
+
}
|
|
8006
|
+
}
|
|
8007
|
+
}
|
|
8008
|
+
}
|
|
8009
|
+
}
|
|
8010
|
+
`;
|
|
8011
|
+
function Page({
|
|
8012
|
+
page,
|
|
8013
|
+
preview = false
|
|
8014
|
+
}) {
|
|
8015
|
+
var _a;
|
|
8016
|
+
const isInBuilder = useIsInBuilder();
|
|
8017
|
+
const [snippets, setSnippets] = React.useState(page.snippets);
|
|
8018
|
+
useQuery(PAGE_SNIPPETS_QUERY, {
|
|
8019
|
+
variables: {
|
|
8020
|
+
id: page.id
|
|
8021
|
+
},
|
|
8022
|
+
skip: isInBuilder === false,
|
|
8023
|
+
fetchPolicy: "cache-only",
|
|
8024
|
+
onCompleted(data) {
|
|
8025
|
+
if (data == null)
|
|
8026
|
+
return;
|
|
8027
|
+
const oldSnippets = snippets.map(filterUsedSnippetProperties);
|
|
8028
|
+
const newSnippets = data.page.snippets.map(filterUsedSnippetProperties);
|
|
8029
|
+
if (deepEqual(newSnippets, oldSnippets))
|
|
8030
|
+
return;
|
|
8031
|
+
setSnippets(data.page.snippets);
|
|
8032
|
+
}
|
|
8033
|
+
});
|
|
8034
|
+
const {
|
|
8035
|
+
data: siteData
|
|
8036
|
+
} = useQuery(SITE_FONTS_QUERY, {
|
|
8037
|
+
variables: {
|
|
8038
|
+
id: page.site.id
|
|
8039
|
+
},
|
|
8040
|
+
skip: isInBuilder === false,
|
|
8041
|
+
fetchPolicy: "cache-only"
|
|
8042
|
+
});
|
|
8043
|
+
const favicon = (_a = page.meta.favicon) != null ? _a : defaultFavicon;
|
|
8044
|
+
const {
|
|
8045
|
+
title,
|
|
8046
|
+
description,
|
|
8047
|
+
keywords,
|
|
8048
|
+
socialImage
|
|
8049
|
+
} = page.meta;
|
|
8050
|
+
const {
|
|
8051
|
+
canonicalUrl,
|
|
8052
|
+
isIndexingBlocked
|
|
8053
|
+
} = page.seo;
|
|
8054
|
+
const fontFamilyParamValue = React.useMemo(() => {
|
|
8055
|
+
if ((siteData == null ? void 0 : siteData.site) == null) {
|
|
8056
|
+
return page.fonts.map(({
|
|
8057
|
+
family,
|
|
8058
|
+
variants
|
|
8059
|
+
}) => {
|
|
8060
|
+
return `${family.replace(/ /g, "+")}:${variants.join()}`;
|
|
8061
|
+
}).join("|");
|
|
8062
|
+
}
|
|
8063
|
+
return siteData.site.googleFonts.edges.filter((edge) => edge != null).map(({
|
|
8064
|
+
activeVariants,
|
|
8065
|
+
node: {
|
|
8066
|
+
family,
|
|
8067
|
+
variants
|
|
8068
|
+
}
|
|
8069
|
+
}) => {
|
|
8070
|
+
const activeVariantSpecifiers = variants.filter((variant) => activeVariants.some((activeVariant) => activeVariant.specifier === variant.specifier)).map((variant) => variant.specifier).join();
|
|
8071
|
+
return `${family.replace(/ /g, "+")}:${activeVariantSpecifiers}`;
|
|
8072
|
+
}).join("|");
|
|
8073
|
+
}, [siteData, page]);
|
|
8074
|
+
const filteredSnippets = React.useMemo(() => snippets.filter((snippet) => preview ? snippet.builderEnabled : snippet.liveEnabled), [snippets]);
|
|
8075
|
+
const headSnippets = React.useMemo(() => filteredSnippets.filter((snippet) => snippet.location === "HEAD"), [filteredSnippets]);
|
|
8076
|
+
const previousHeadSnippets = React.useRef(null);
|
|
8077
|
+
React.useEffect(() => {
|
|
8078
|
+
var _a2;
|
|
8079
|
+
const headSnippetsToCleanUp = ((_a2 = previousHeadSnippets.current) != null ? _a2 : []).filter((previousSnippet) => previousSnippet.cleanup != null).filter((previousSnippet) => !headSnippets.some((snippet) => previousSnippet.id === snippet.id));
|
|
8080
|
+
headSnippetsToCleanUp.forEach((snippetToCleanUp) => {
|
|
8081
|
+
if (snippetToCleanUp.cleanup == null)
|
|
8082
|
+
return;
|
|
8083
|
+
const cleanUp = new Function(snippetToCleanUp.cleanup);
|
|
8084
|
+
try {
|
|
8085
|
+
cleanUp();
|
|
8086
|
+
} catch {
|
|
8087
|
+
}
|
|
8088
|
+
});
|
|
8089
|
+
previousHeadSnippets.current = headSnippets;
|
|
8090
|
+
}, [headSnippets]);
|
|
8091
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
8092
|
+
children: [/* @__PURE__ */ jsxRuntime.jsxs(Head__default["default"], {
|
|
8093
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx("style", {
|
|
8094
|
+
children: `
|
|
8095
|
+
html {
|
|
8096
|
+
font-family: sans-serif;
|
|
8097
|
+
}
|
|
8098
|
+
div#__next {
|
|
8099
|
+
overflow: hidden;
|
|
8100
|
+
}
|
|
8101
|
+
`
|
|
8102
|
+
}), /* @__PURE__ */ jsxRuntime.jsx("link", {
|
|
8103
|
+
rel: "icon",
|
|
8104
|
+
type: favicon.mimetype,
|
|
8105
|
+
href: favicon.publicUrl
|
|
8106
|
+
}), canonicalUrl && /* @__PURE__ */ jsxRuntime.jsx("link", {
|
|
8107
|
+
rel: "canonical",
|
|
8108
|
+
href: canonicalUrl
|
|
8109
|
+
}), isIndexingBlocked && /* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
8110
|
+
name: "robots",
|
|
8111
|
+
content: "noindex"
|
|
8112
|
+
}), title && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
8113
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx("title", {
|
|
8114
|
+
children: title
|
|
8115
|
+
}), /* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
8116
|
+
property: "og:title",
|
|
8117
|
+
content: title
|
|
8118
|
+
}), /* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
8119
|
+
name: "twitter:title",
|
|
8120
|
+
content: title
|
|
8121
|
+
}), /* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
8122
|
+
itemProp: "name",
|
|
8123
|
+
content: title
|
|
8124
|
+
})]
|
|
8125
|
+
}), description && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
8126
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
8127
|
+
name: "description",
|
|
8128
|
+
content: description
|
|
8129
|
+
}), /* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
8130
|
+
property: "og:description",
|
|
8131
|
+
content: description
|
|
8132
|
+
}), /* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
8133
|
+
name: "twitter:description",
|
|
8134
|
+
content: description
|
|
8135
|
+
}), /* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
8136
|
+
itemProp: "description",
|
|
8137
|
+
content: description
|
|
8138
|
+
})]
|
|
8139
|
+
}), keywords && /* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
8140
|
+
name: "keywords",
|
|
8141
|
+
content: keywords
|
|
8142
|
+
}), socialImage && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
8143
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
8144
|
+
property: "og:image",
|
|
8145
|
+
content: socialImage.publicUrl
|
|
8146
|
+
}), /* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
8147
|
+
property: "og:image:type",
|
|
8148
|
+
content: socialImage.publicUrl
|
|
8149
|
+
}), /* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
8150
|
+
name: "twitter:image",
|
|
8151
|
+
content: socialImage.publicUrl
|
|
8152
|
+
}), /* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
8153
|
+
name: "twitter:card",
|
|
8154
|
+
content: socialImage.publicUrl
|
|
8155
|
+
}), /* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
8156
|
+
itemProp: "image",
|
|
8157
|
+
content: socialImage.publicUrl
|
|
8158
|
+
})]
|
|
8159
|
+
}), fontFamilyParamValue !== "" && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
8160
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("link", {
|
|
8161
|
+
rel: "stylesheet",
|
|
8162
|
+
href: `https://fonts.googleapis.com/css?family=${fontFamilyParamValue}&display=swap`
|
|
8163
|
+
})
|
|
8164
|
+
}), headSnippets.map(snippetToElement).map((children) => React.Children.map(children, (child) => {
|
|
8165
|
+
if (typeof child === "string")
|
|
8166
|
+
return child;
|
|
8167
|
+
if (VALID_HEAD_ELEMENT_TYPES.includes(child.type))
|
|
8168
|
+
return child;
|
|
8169
|
+
return null;
|
|
8170
|
+
}))]
|
|
8171
|
+
}), /* @__PURE__ */ jsxRuntime.jsx(DocumentReference, {
|
|
8172
|
+
documentReference: reactPage.createDocumentReference(page.id)
|
|
8173
|
+
}), filteredSnippets.filter((snippet) => snippet.location === "BODY").map((snippet) => /* @__PURE__ */ jsxRuntime.jsx(BodySnippet, {
|
|
8174
|
+
code: snippet.code,
|
|
8175
|
+
cleanup: snippet.cleanup
|
|
8176
|
+
}, snippet.id))]
|
|
8177
|
+
});
|
|
8178
|
+
}
|
|
7832
8179
|
var _path;
|
|
7833
8180
|
function _extends() {
|
|
7834
8181
|
_extends = Object.assign || function(target) {
|
|
@@ -8270,7 +8617,7 @@ function ShapeControlValue({
|
|
|
8270
8617
|
data,
|
|
8271
8618
|
children
|
|
8272
8619
|
}) {
|
|
8273
|
-
return Object.entries(definition.config.type).
|
|
8620
|
+
return Object.entries(definition.config.type).reduceRight((renderFn, [key, controlDefinition]) => (shapeControlValue) => /* @__PURE__ */ jsxRuntime.jsx(ControlValue, {
|
|
8274
8621
|
definition: controlDefinition,
|
|
8275
8622
|
data: data == null ? void 0 : data[key],
|
|
8276
8623
|
children: (value) => renderFn(__spreadProps(__spreadValues({}, shapeControlValue), {
|
|
@@ -8416,11 +8763,9 @@ function PropsValue({
|
|
|
8416
8763
|
function suppressWarningAndFindDomNode(instance) {
|
|
8417
8764
|
const error = console.error;
|
|
8418
8765
|
console.error = (...args) => {
|
|
8419
|
-
|
|
8420
|
-
|
|
8421
|
-
|
|
8422
|
-
error.apply(console, args);
|
|
8423
|
-
}
|
|
8766
|
+
if (typeof args[0] === "string" && args[0].includes("%s is deprecated in StrictMode."))
|
|
8767
|
+
return;
|
|
8768
|
+
return error.apply(console, args);
|
|
8424
8769
|
};
|
|
8425
8770
|
const foundDomNode = reactDom.findDOMNode(instance);
|
|
8426
8771
|
console.error = error;
|
|
@@ -8580,11 +8925,10 @@ function useSuppressRefWarning(ownerName) {
|
|
|
8580
8925
|
const patchedRef = React.useRef(false);
|
|
8581
8926
|
if (patchedRef.current === false) {
|
|
8582
8927
|
console.error = (...args) => {
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
if (!text.includes("Function components cannot be given refs.") || !text.includes(`Check the render method of \`${ownerName}\`.`)) {
|
|
8586
|
-
originalErrorRef.current(...args);
|
|
8928
|
+
if (typeof args[0] === "string" && args[0].includes("Function components cannot be given refs.") && args[0].includes(`Check the render method of \`${ownerName}\`.`)) {
|
|
8929
|
+
return;
|
|
8587
8930
|
}
|
|
8931
|
+
return originalErrorRef.current(...args);
|
|
8588
8932
|
};
|
|
8589
8933
|
patchedRef.current = true;
|
|
8590
8934
|
}
|
|
@@ -8614,6 +8958,7 @@ const ElementData = React.memo(React.forwardRef(function ElementData2({
|
|
|
8614
8958
|
})
|
|
8615
8959
|
});
|
|
8616
8960
|
}));
|
|
8961
|
+
const DisableRegisterElement = React.createContext(false);
|
|
8617
8962
|
const ElementReference = React.memo(React.forwardRef(function ElementReference2({
|
|
8618
8963
|
elementReference
|
|
8619
8964
|
}, ref) {
|
|
@@ -8650,9 +8995,12 @@ const ElementReference = React.memo(React.forwardRef(function ElementReference2(
|
|
|
8650
8995
|
return elementReferenceDocument != null ? /* @__PURE__ */ jsxRuntime.jsx(Document, {
|
|
8651
8996
|
document: elementReferenceDocument,
|
|
8652
8997
|
ref
|
|
8653
|
-
}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
8654
|
-
|
|
8655
|
-
|
|
8998
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(DisableRegisterElement.Provider, {
|
|
8999
|
+
value: true,
|
|
9000
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ElementData, {
|
|
9001
|
+
elementData: globalElementData,
|
|
9002
|
+
ref
|
|
9003
|
+
})
|
|
8656
9004
|
});
|
|
8657
9005
|
}));
|
|
8658
9006
|
const Element$1 = React.memo(React.forwardRef(function Element2({
|
|
@@ -8662,17 +9010,18 @@ const Element$1 = React.memo(React.forwardRef(function Element2({
|
|
|
8662
9010
|
const dispatch = useDispatch();
|
|
8663
9011
|
const documentKey = useDocumentKey();
|
|
8664
9012
|
const [handle, setHandle] = React.useState(null);
|
|
9013
|
+
const isRegisterElementDisabled = React.useContext(DisableRegisterElement);
|
|
8665
9014
|
React.useImperativeHandle(ref, () => handle, [handle]);
|
|
8666
9015
|
React.useEffect(() => {
|
|
8667
|
-
if (documentKey == null)
|
|
9016
|
+
if (documentKey == null || isRegisterElementDisabled)
|
|
8668
9017
|
return;
|
|
8669
9018
|
return dispatch(actions.registerComponentHandleEffect(documentKey, elementKey, handle));
|
|
8670
|
-
}, [dispatch, documentKey, elementKey, handle]);
|
|
9019
|
+
}, [dispatch, documentKey, elementKey, handle, isRegisterElementDisabled]);
|
|
8671
9020
|
React.useEffect(() => {
|
|
8672
|
-
if (documentKey == null)
|
|
9021
|
+
if (documentKey == null || isRegisterElementDisabled)
|
|
8673
9022
|
return;
|
|
8674
9023
|
return dispatch(actions.mountComponentEffect(documentKey, elementKey));
|
|
8675
|
-
}, [dispatch, documentKey, elementKey]);
|
|
9024
|
+
}, [dispatch, documentKey, elementKey, isRegisterElementDisabled]);
|
|
8676
9025
|
return reactPage.isElementReference(element) ? /* @__PURE__ */ jsxRuntime.jsx(ElementReference, {
|
|
8677
9026
|
ref: setHandle,
|
|
8678
9027
|
elementReference: element
|
|
@@ -8682,21 +9031,21 @@ const Element$1 = React.memo(React.forwardRef(function Element2({
|
|
|
8682
9031
|
}, elementKey);
|
|
8683
9032
|
}));
|
|
8684
9033
|
const Document = React.memo(React.forwardRef(function Document2({
|
|
8685
|
-
document
|
|
9034
|
+
document: document2
|
|
8686
9035
|
}, ref) {
|
|
8687
9036
|
return /* @__PURE__ */ jsxRuntime.jsx(DocumentContext.Provider, {
|
|
8688
|
-
value:
|
|
9037
|
+
value: document2.key,
|
|
8689
9038
|
children: /* @__PURE__ */ jsxRuntime.jsx(Element$1, {
|
|
8690
9039
|
ref,
|
|
8691
|
-
element:
|
|
9040
|
+
element: document2.rootElement
|
|
8692
9041
|
})
|
|
8693
9042
|
});
|
|
8694
9043
|
}));
|
|
8695
9044
|
const DocumentReference = React.memo(React.forwardRef(function DocumentReference2({
|
|
8696
9045
|
documentReference
|
|
8697
9046
|
}, ref) {
|
|
8698
|
-
const
|
|
8699
|
-
if (
|
|
9047
|
+
const document2 = useDocument(documentReference.key);
|
|
9048
|
+
if (document2 == null) {
|
|
8700
9049
|
return /* @__PURE__ */ jsxRuntime.jsx(FallbackComponent, {
|
|
8701
9050
|
ref,
|
|
8702
9051
|
text: "Document not found"
|
|
@@ -8704,7 +9053,7 @@ const DocumentReference = React.memo(React.forwardRef(function DocumentReference
|
|
|
8704
9053
|
}
|
|
8705
9054
|
return /* @__PURE__ */ jsxRuntime.jsx(Document, {
|
|
8706
9055
|
ref,
|
|
8707
|
-
document
|
|
9056
|
+
document: document2
|
|
8708
9057
|
});
|
|
8709
9058
|
}));
|
|
8710
9059
|
exports.Box = Box;
|
|
@@ -8726,10 +9075,13 @@ exports.Form = Form;
|
|
|
8726
9075
|
exports.ImageComponent = ImageComponent;
|
|
8727
9076
|
exports.MakeswiftClient = MakeswiftClient;
|
|
8728
9077
|
exports.Navigation = Navigation;
|
|
9078
|
+
exports.PAGE_SNIPPETS_QUERY = PAGE_SNIPPETS_QUERY;
|
|
9079
|
+
exports.Page = Page;
|
|
8729
9080
|
exports.PageProvider = PageProvider;
|
|
8730
9081
|
exports.ReactRuntime = ReactRuntime;
|
|
8731
9082
|
exports.Root = Root;
|
|
8732
9083
|
exports.RuntimeProvider = RuntimeProvider;
|
|
9084
|
+
exports.SITE_FONTS_QUERY = SITE_FONTS_QUERY;
|
|
8733
9085
|
exports.SocialLinks = SocialLinks;
|
|
8734
9086
|
exports.Text = Text;
|
|
8735
9087
|
exports.cssBorder = cssBorder;
|
|
@@ -8741,6 +9093,7 @@ exports.cssMediaRules = cssMediaRules;
|
|
|
8741
9093
|
exports.cssPadding = cssPadding;
|
|
8742
9094
|
exports.cssTextStyle = cssTextStyle;
|
|
8743
9095
|
exports.cssWidth = cssWidth;
|
|
9096
|
+
exports.deepEqual = deepEqual;
|
|
8744
9097
|
exports.registerBuiltinComponents = registerBuiltinComponents;
|
|
8745
9098
|
exports.registerComponent = registerComponent$c;
|
|
8746
9099
|
exports.useBackgrounds = useBackgrounds;
|