@makeswift/runtime 0.8.11 → 0.9.1
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 +16 -15
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +11 -10
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +13 -12
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +11 -10
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +28 -27
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +7 -6
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +16 -15
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +8 -7
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +13 -12
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +11 -10
- package/dist/Divider.es.js.map +1 -1
- package/dist/Embed.cjs.js +4 -29
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +3 -28
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +52 -51
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +8 -7
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +9 -8
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +8 -7
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +6 -5
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +8 -7
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +28 -27
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +7 -6
- package/dist/Navigation.es.js.map +1 -1
- package/dist/PreviewProvider.cjs.js +23 -7
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +24 -8
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +22 -20
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +18 -16
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +19 -17
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +16 -14
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +8 -7
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +6 -5
- package/dist/Root.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +15 -14
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +11 -10
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Text.cjs.js +5 -4
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +6 -5
- package/dist/Text.es.js.map +1 -1
- package/dist/Video.cjs.js +4 -29
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +3 -28
- package/dist/Video.es.js.map +1 -1
- package/dist/actions.cjs.js +16 -1
- package/dist/actions.cjs.js.map +1 -1
- package/dist/actions.es.js +14 -2
- package/dist/actions.es.js.map +1 -1
- package/dist/builder.cjs.js +5 -0
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +5 -0
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +10 -9
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +10 -9
- package/dist/components.es.js.map +1 -1
- package/dist/control-serialization.cjs.js +89 -10
- package/dist/control-serialization.cjs.js.map +1 -1
- package/dist/control-serialization.es.js +90 -11
- package/dist/control-serialization.es.js.map +1 -1
- package/dist/controls.cjs.js +12 -3
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +6 -2
- package/dist/controls.es.js.map +1 -1
- package/dist/deepEqual.cjs.js +40 -0
- package/dist/deepEqual.cjs.js.map +1 -0
- package/dist/deepEqual.es.js +39 -0
- package/dist/deepEqual.es.js.map +1 -0
- package/dist/index.cjs.js +298 -292
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs10.js +18 -16
- package/dist/index.cjs10.js.map +1 -1
- package/dist/index.cjs2.js +14 -14
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs4.js +2 -1
- package/dist/index.cjs4.js.map +1 -1
- package/dist/index.cjs5.js +0 -522
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs6.js +1 -2
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +0 -52
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.cjs8.js +5 -4
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.cjs9.js +72 -69
- package/dist/index.cjs9.js.map +1 -1
- package/dist/index.es.js +282 -275
- package/dist/index.es.js.map +1 -1
- package/dist/index.es10.js +16 -14
- package/dist/index.es10.js.map +1 -1
- package/dist/index.es2.js +3 -3
- package/dist/index.es3.js +1 -1
- package/dist/index.es4.js +2 -1
- package/dist/index.es4.js.map +1 -1
- package/dist/index.es5.js +2 -514
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es6.js +1 -2
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es7.js +2 -53
- package/dist/index.es7.js.map +1 -1
- package/dist/index.es8.js +5 -4
- package/dist/index.es8.js.map +1 -1
- package/dist/index.es9.js +74 -71
- package/dist/index.es9.js.map +1 -1
- package/dist/leaf.cjs.js +1 -1
- package/dist/leaf.cjs.js.map +1 -1
- package/dist/leaf.es.js +2 -2
- package/dist/main.cjs.js +8 -0
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +7 -2
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +5 -4
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +6 -5
- package/dist/next.es.js.map +1 -1
- package/dist/prop-controllers.cjs.js +5 -0
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +5 -0
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/react-page.cjs.js +1013 -190
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +968 -185
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +5 -4
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +5 -4
- package/dist/react.es.js.map +1 -1
- package/dist/slate.cjs.js +96 -14
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +89 -6
- package/dist/slate.es.js.map +1 -1
- package/dist/types/src/api/graphql/documents/queries.d.ts.map +1 -1
- package/dist/types/src/api/graphql/generated/types.d.ts +0 -8
- package/dist/types/src/api/graphql/generated/types.d.ts.map +1 -1
- package/dist/types/src/builder/serialization/control-serialization.d.ts +3 -3
- package/dist/types/src/builder/serialization/control-serialization.d.ts.map +1 -1
- package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts +2 -2
- package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/builder/serialization/controls/style-v2.d.ts +5 -0
- package/dist/types/src/builder/serialization/controls/style-v2.d.ts.map +1 -0
- package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
- package/dist/types/src/components/builtin/Carousel/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Countdown/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Divider/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Embed/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Navigation/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/SocialLinks/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/components/Element/block.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Video/register.d.ts.map +1 -1
- package/dist/types/src/components/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
- package/dist/types/src/components/hooks/useIsomorphicLayoutEffect.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/index.d.ts +1 -0
- package/dist/types/src/controls/index.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +10 -5
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/controls/style-v2.d.ts +55 -0
- package/dist/types/src/controls/style-v2.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/handlers/manifest.d.ts +3 -1
- package/dist/types/src/next/api-handler/handlers/manifest.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/handlers/proxy-preview-mode.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/index.d.ts +2 -1
- package/dist/types/src/next/api-handler/index.d.ts.map +1 -1
- package/dist/types/src/next/client.d.ts +7 -7
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/next/index.d.ts +8 -5
- package/dist/types/src/next/index.d.ts.map +1 -1
- package/dist/types/src/next/preview-mode.d.ts +17 -3
- package/dist/types/src/next/preview-mode.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts +4 -3
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/instances.d.ts +2 -2
- package/dist/types/src/prop-controllers/instances.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/EditableTextV2/editable-text-v2.d.ts +2 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/style-v2.d.ts +4 -0
- package/dist/types/src/runtimes/react/controls/style-v2.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/index.d.ts +3 -1
- package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/constants.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/dedent.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/indent.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/index.d.ts +29 -3
- package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/toggleList.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/unwrapList.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/utils/filterForSubtreeRoots.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/utils/getSelectedListItems.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/utils/location.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/wrapList.d.ts.map +1 -0
- package/dist/types/src/slate/InlineModePlugin/index.d.ts +2 -1
- package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts +9 -0
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/index.d.ts +1 -1
- package/dist/types/src/slate/index.d.ts.map +1 -1
- package/dist/types/src/slate/types.d.ts +18 -0
- package/dist/types/src/slate/types.d.ts.map +1 -1
- package/dist/types/src/slate/utils/element.d.ts +1 -2
- package/dist/types/src/slate/utils/element.d.ts.map +1 -1
- package/dist/types/src/state/actions.d.ts +26 -1
- package/dist/types/src/state/actions.d.ts.map +1 -1
- package/dist/types/src/state/modules/components-meta.d.ts +25 -1
- package/dist/types/src/state/modules/components-meta.d.ts.map +1 -1
- package/dist/types/src/state/modules/locales.d.ts +16 -0
- package/dist/types/src/state/modules/locales.d.ts.map +1 -0
- package/dist/types/src/state/react-builder-preview.d.ts +2 -0
- package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
- package/dist/types/src/state/react-page.d.ts +5 -1
- package/dist/types/src/state/react-page.d.ts.map +1 -1
- package/dist/useMediaQuery.es.js +1 -1
- package/package.json +6 -3
- package/dist/select.cjs.js +0 -8
- package/dist/select.cjs.js.map +0 -1
- package/dist/select.es.js +0 -6
- package/dist/select.es.js.map +0 -1
- package/dist/types/src/slate/ListPlugin/constants.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/dedent.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/indent.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/index.d.ts +0 -17
- package/dist/types/src/slate/ListPlugin/index.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/toggleList.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/unwrapList.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/utils/filterForSubtreeRoots.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/utils/getSelectedListItems.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/utils/location.d.ts.map +0 -1
- package/dist/types/src/slate/ListPlugin/wrapList.d.ts.map +0 -1
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/constants.d.ts +0 -0
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/dedent.d.ts +0 -0
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/indent.d.ts +0 -0
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/toggleList.d.ts +0 -0
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/unwrapList.d.ts +0 -0
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/utils/filterForSubtreeRoots.d.ts +0 -0
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/utils/getSelectedListItems.d.ts +0 -0
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/utils/location.d.ts +0 -0
- /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/wrapList.d.ts +0 -0
package/dist/index.cjs.js
CHANGED
|
@@ -35,33 +35,33 @@ var __publicField = (obj, key, value) => {
|
|
|
35
35
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
36
36
|
return value;
|
|
37
37
|
};
|
|
38
|
-
var _c;
|
|
39
38
|
var React = require("react");
|
|
40
39
|
var withSelector = require("use-sync-external-store/shim/with-selector");
|
|
41
40
|
var dynamic = require("next/dynamic");
|
|
42
41
|
var reactPage = require("./react-page.cjs.js");
|
|
43
42
|
var actions = require("./actions.cjs.js");
|
|
44
|
-
var css = require("@emotion/css");
|
|
45
|
-
var serialize = require("@emotion/serialize");
|
|
46
|
-
var utils = require("@emotion/utils");
|
|
47
43
|
var jsxRuntime = require("react/jsx-runtime");
|
|
48
44
|
var textInput = require("./text-input.cjs.js");
|
|
49
45
|
var combobox = require("./combobox.cjs.js");
|
|
50
|
-
var select = require("./select.cjs.js");
|
|
51
46
|
require("slate");
|
|
52
|
-
require("is-hotkey");
|
|
53
47
|
var state_breakpoints = require("./state/breakpoints.cjs.js");
|
|
48
|
+
require("is-hotkey");
|
|
54
49
|
require("slate-react");
|
|
55
50
|
var shim = require("use-sync-external-store/shim");
|
|
56
51
|
var redux = require("redux");
|
|
57
52
|
var thunk = require("redux-thunk");
|
|
58
53
|
var types = require("./types.cjs.js");
|
|
54
|
+
var deepEqual = require("./deepEqual.cjs.js");
|
|
59
55
|
var boxModels = require("./box-models.cjs.js");
|
|
60
56
|
var ColorHelper = require("color");
|
|
57
|
+
var css = require("@emotion/css");
|
|
58
|
+
require("@emotion/serialize");
|
|
59
|
+
require("@emotion/utils");
|
|
61
60
|
var scrollIntoView = require("scroll-into-view-if-needed");
|
|
62
61
|
var reactDom = require("react-dom");
|
|
63
62
|
var parse = require("html-react-parser");
|
|
64
63
|
var Head = require("next/head");
|
|
64
|
+
var zod = require("zod");
|
|
65
65
|
var createEmotionServer = require("@emotion/server/create-instance");
|
|
66
66
|
var NextDocument = require("next/document");
|
|
67
67
|
var Cors = require("cors");
|
|
@@ -106,43 +106,6 @@ var createEmotionServer__default = /* @__PURE__ */ _interopDefaultLegacy(createE
|
|
|
106
106
|
var NextDocument__default = /* @__PURE__ */ _interopDefaultLegacy(NextDocument);
|
|
107
107
|
var Cors__default = /* @__PURE__ */ _interopDefaultLegacy(Cors);
|
|
108
108
|
var ipsum__default = /* @__PURE__ */ _interopDefaultLegacy(ipsum);
|
|
109
|
-
function is(x, y) {
|
|
110
|
-
if (x === y)
|
|
111
|
-
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
112
|
-
return x !== x && y !== y;
|
|
113
|
-
}
|
|
114
|
-
const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
|
|
115
|
-
const shallowEqual = (a, b) => {
|
|
116
|
-
if (is(a, b))
|
|
117
|
-
return true;
|
|
118
|
-
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
119
|
-
return false;
|
|
120
|
-
const keysA = Object.keys(a);
|
|
121
|
-
const keysB = Object.keys(b);
|
|
122
|
-
if (keysA.length !== keysB.length)
|
|
123
|
-
return false;
|
|
124
|
-
for (let i = 0; i < keysA.length; i += 1) {
|
|
125
|
-
if (!hasOwnProperty$1.call(b, keysA[i]) || !is(a[keysA[i]], b[keysA[i]]))
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
return true;
|
|
129
|
-
};
|
|
130
|
-
const { hasOwnProperty } = Object.prototype;
|
|
131
|
-
const deepEqual = (a, b) => {
|
|
132
|
-
if (shallowEqual(a, b))
|
|
133
|
-
return true;
|
|
134
|
-
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
135
|
-
return false;
|
|
136
|
-
const keysA = Object.keys(a);
|
|
137
|
-
const keysB = Object.keys(b);
|
|
138
|
-
if (keysA.length !== keysB.length)
|
|
139
|
-
return false;
|
|
140
|
-
for (let i = 0; i < keysA.length; i += 1) {
|
|
141
|
-
if (!hasOwnProperty.call(b, keysA[i]) || !deepEqual(a[keysA[i]], b[keysA[i]]))
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
return true;
|
|
145
|
-
};
|
|
146
109
|
const SCRIPT_TAG = "script";
|
|
147
110
|
function BodySnippet({
|
|
148
111
|
code,
|
|
@@ -220,7 +183,7 @@ function reducer$1(state = getInitialState(), action) {
|
|
|
220
183
|
}
|
|
221
184
|
case actions.ActionTypes.CHANGE_API_RESOURCE: {
|
|
222
185
|
const existingApiResource = getAPIResource$1(state, action.payload.resource.__typename, action.payload.resource.id);
|
|
223
|
-
if (deepEqual(existingApiResource, action.payload.resource))
|
|
186
|
+
if (deepEqual.deepEqual(existingApiResource, action.payload.resource))
|
|
224
187
|
return state;
|
|
225
188
|
return new Map(state).set(action.payload.resource.__typename, new Map(state.get(action.payload.resource.__typename)).set(action.payload.resource.id, action.payload.resource));
|
|
226
189
|
}
|
|
@@ -315,15 +278,6 @@ class GraphQLClient {
|
|
|
315
278
|
return body.data;
|
|
316
279
|
}
|
|
317
280
|
}
|
|
318
|
-
const SwatchFragment = `
|
|
319
|
-
fragment Swatch on Swatch {
|
|
320
|
-
__typename
|
|
321
|
-
id
|
|
322
|
-
hue
|
|
323
|
-
saturation
|
|
324
|
-
lightness
|
|
325
|
-
}
|
|
326
|
-
`;
|
|
327
281
|
const FileFragment = `
|
|
328
282
|
fragment File on File {
|
|
329
283
|
__typename
|
|
@@ -407,16 +361,7 @@ const TableFragment = `
|
|
|
407
361
|
}
|
|
408
362
|
`;
|
|
409
363
|
const IntrospectedResourcesQuery = `
|
|
410
|
-
query IntrospectedResources(
|
|
411
|
-
$swatchIds: [ID!]!
|
|
412
|
-
$fileIds: [ID!]!
|
|
413
|
-
$pageIds: [ID!]!
|
|
414
|
-
$tableIds: [ID!]!
|
|
415
|
-
) {
|
|
416
|
-
swatches(ids: $swatchIds) {
|
|
417
|
-
...Swatch
|
|
418
|
-
}
|
|
419
|
-
|
|
364
|
+
query IntrospectedResources($fileIds: [ID!]!, $pageIds: [ID!]!, $tableIds: [ID!]!) {
|
|
420
365
|
files(ids: $fileIds) {
|
|
421
366
|
...File
|
|
422
367
|
}
|
|
@@ -430,20 +375,10 @@ const IntrospectedResourcesQuery = `
|
|
|
430
375
|
}
|
|
431
376
|
}
|
|
432
377
|
|
|
433
|
-
${SwatchFragment}
|
|
434
378
|
${FileFragment}
|
|
435
379
|
${PagePathnameSliceFragment}
|
|
436
380
|
${TableFragment}
|
|
437
381
|
`;
|
|
438
|
-
const SwatchQuery = `
|
|
439
|
-
query Swatch($swatchId: ID!) {
|
|
440
|
-
swatch(id: $swatchId) {
|
|
441
|
-
...Swatch
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
${SwatchFragment}
|
|
446
|
-
`;
|
|
447
382
|
const FileQuery = `
|
|
448
383
|
query File($fileId: ID!) {
|
|
449
384
|
file(id: $fileId) {
|
|
@@ -639,7 +574,7 @@ function Page$1({
|
|
|
639
574
|
return;
|
|
640
575
|
const oldSnippets = snippets.map(filterUsedSnippetProperties);
|
|
641
576
|
const newSnippets = cachedPage.snippets.map(filterUsedSnippetProperties);
|
|
642
|
-
if (deepEqual(newSnippets, oldSnippets))
|
|
577
|
+
if (deepEqual.deepEqual(newSnippets, oldSnippets))
|
|
643
578
|
return;
|
|
644
579
|
setSnippets(cachedPage.snippets);
|
|
645
580
|
}, [cachedPage]);
|
|
@@ -792,12 +727,120 @@ function useCachedSite(siteId) {
|
|
|
792
727
|
const site = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
793
728
|
return site;
|
|
794
729
|
}
|
|
730
|
+
const makeswiftSiteVersionSchema = zod.z.enum(["Live", "Working"]);
|
|
731
|
+
const MakeswiftSiteVersion = makeswiftSiteVersionSchema.Enum;
|
|
732
|
+
const makeswiftPreviewDataSchema = zod.z.object({
|
|
733
|
+
makeswift: zod.z.literal(true),
|
|
734
|
+
unstable_siteVersion: makeswiftSiteVersionSchema
|
|
735
|
+
});
|
|
736
|
+
function getMakeswiftSiteVersion(previewData) {
|
|
737
|
+
const result = makeswiftPreviewDataSchema.safeParse(previewData);
|
|
738
|
+
if (result.success)
|
|
739
|
+
return result.data.unstable_siteVersion;
|
|
740
|
+
return null;
|
|
741
|
+
}
|
|
742
|
+
function PreviewModeScript({
|
|
743
|
+
isPreview = false,
|
|
744
|
+
appOrigin = "https://app.makeswift.com"
|
|
745
|
+
}) {
|
|
746
|
+
const previewModeScript = `
|
|
747
|
+
const isPreview = ${isPreview}
|
|
748
|
+
const appOrigin = '${appOrigin.replace("'", "\\'")}'
|
|
749
|
+
const searchParamName = 'x-makeswift-preview-mode'
|
|
750
|
+
const headerName = 'X-Makeswift-Preview-Mode'
|
|
751
|
+
const originalUrl = new URL(window.location.href)
|
|
752
|
+
|
|
753
|
+
if (window.parent !== window) {
|
|
754
|
+
window.addEventListener('message', event => {
|
|
755
|
+
if (event.origin === appOrigin && event.data.type === 'makeswift_preview_mode') {
|
|
756
|
+
const { secret } = event.data
|
|
757
|
+
|
|
758
|
+
if (!isPreview && !originalUrl.searchParams.has(searchParamName)) {
|
|
759
|
+
const url = new URL(originalUrl)
|
|
760
|
+
|
|
761
|
+
url.searchParams.set(searchParamName, secret)
|
|
762
|
+
|
|
763
|
+
window.location.replace(url)
|
|
764
|
+
} else {
|
|
765
|
+
const originalFetch = window.fetch
|
|
766
|
+
|
|
767
|
+
window.fetch = function patchedFetch(resource, options) {
|
|
768
|
+
const request = new Request(resource, options)
|
|
769
|
+
|
|
770
|
+
if (new URL(request.url).origin !== window.location.origin) {
|
|
771
|
+
return originalFetch.call(this, resource, options)
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
return originalFetch.call(
|
|
775
|
+
this,
|
|
776
|
+
new Request(request, { headers: { [headerName]: secret } }),
|
|
777
|
+
)
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
})
|
|
782
|
+
|
|
783
|
+
window.parent.postMessage({ type: 'makeswift_preview_mode' }, appOrigin)
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
if (originalUrl.searchParams.has(searchParamName)) {
|
|
787
|
+
const url = new URL(originalUrl)
|
|
788
|
+
|
|
789
|
+
url.searchParams.delete(searchParamName)
|
|
790
|
+
|
|
791
|
+
window.history.replaceState(null, '', url)
|
|
792
|
+
}
|
|
793
|
+
`;
|
|
794
|
+
const makeswiftConnectionCheckScript = `
|
|
795
|
+
const appOrigin = '${appOrigin.replace("'", "\\'")}'
|
|
796
|
+
|
|
797
|
+
if (window.parent !== window) {
|
|
798
|
+
window.addEventListener('message', event => {
|
|
799
|
+
if (
|
|
800
|
+
event.origin === appOrigin &&
|
|
801
|
+
event.data.type === '${actions.ActionTypes.MAKESWIFT_CONNECTION_INIT}'
|
|
802
|
+
) {
|
|
803
|
+
setInterval(() => {
|
|
804
|
+
window.parent.postMessage({
|
|
805
|
+
type: '${actions.ActionTypes.MAKESWIFT_CONNECTION_CHECK}',
|
|
806
|
+
payload: {
|
|
807
|
+
currentUrl: window.location.href
|
|
808
|
+
}
|
|
809
|
+
}, appOrigin)
|
|
810
|
+
}, 20)
|
|
811
|
+
}
|
|
812
|
+
})
|
|
813
|
+
|
|
814
|
+
window.parent.postMessage({ type: '${actions.ActionTypes.MAKESWIFT_CONNECTION_INIT}' }, appOrigin)
|
|
815
|
+
}
|
|
816
|
+
`;
|
|
817
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
818
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx("script", {
|
|
819
|
+
id: "makeswift-preview-mode",
|
|
820
|
+
type: "module",
|
|
821
|
+
dangerouslySetInnerHTML: {
|
|
822
|
+
__html: previewModeScript
|
|
823
|
+
}
|
|
824
|
+
}), /* @__PURE__ */ jsxRuntime.jsx("script", {
|
|
825
|
+
id: "makeswift-connection-check",
|
|
826
|
+
type: "module",
|
|
827
|
+
dangerouslySetInnerHTML: {
|
|
828
|
+
__html: makeswiftConnectionCheckScript
|
|
829
|
+
}
|
|
830
|
+
})]
|
|
831
|
+
});
|
|
832
|
+
}
|
|
795
833
|
class Makeswift {
|
|
796
|
-
constructor(apiKey, {
|
|
834
|
+
constructor(apiKey, {
|
|
835
|
+
apiOrigin = "https://api.makeswift.com",
|
|
836
|
+
runtime = ReactRuntime,
|
|
837
|
+
unstable_previewData
|
|
838
|
+
} = {}) {
|
|
797
839
|
__publicField(this, "apiKey");
|
|
798
840
|
__publicField(this, "apiOrigin");
|
|
799
841
|
__publicField(this, "graphqlClient");
|
|
800
842
|
__publicField(this, "runtime");
|
|
843
|
+
__publicField(this, "siteVersion");
|
|
801
844
|
if (typeof apiKey !== "string") {
|
|
802
845
|
throw new Error(`The Makeswift client must be passed a valid Makeswift site API key: \`new Makeswift('<makeswift_site_api_key>')\`
|
|
803
846
|
Received "${apiKey}" instead.`);
|
|
@@ -810,17 +853,27 @@ Received "${apiKey}" instead.`);
|
|
|
810
853
|
}
|
|
811
854
|
this.graphqlClient = new GraphQLClient(new URL("graphql", apiOrigin).href);
|
|
812
855
|
this.runtime = runtime;
|
|
856
|
+
this.siteVersion = getMakeswiftSiteVersion(unstable_previewData);
|
|
813
857
|
}
|
|
814
858
|
async fetch(path, init) {
|
|
859
|
+
var _a;
|
|
815
860
|
const response = await fetch(new URL(path, this.apiOrigin).toString(), __spreadProps(__spreadValues({}, init), {
|
|
816
|
-
headers:
|
|
861
|
+
headers: __spreadValues({
|
|
862
|
+
["X-API-Key"]: this.apiKey,
|
|
863
|
+
"Makeswift-Site-API-Key": this.apiKey,
|
|
864
|
+
"Makeswift-Site-Version": (_a = this.siteVersion) != null ? _a : MakeswiftSiteVersion.Live
|
|
865
|
+
}, init == null ? void 0 : init.headers)
|
|
817
866
|
}));
|
|
818
867
|
return response;
|
|
819
868
|
}
|
|
820
|
-
async getPages(
|
|
821
|
-
const
|
|
822
|
-
|
|
869
|
+
async getPages() {
|
|
870
|
+
const response = await this.fetch(`/v2/pages`, {
|
|
871
|
+
headers: {
|
|
872
|
+
"Makeswift-Site-Version": MakeswiftSiteVersion.Live
|
|
873
|
+
}
|
|
874
|
+
});
|
|
823
875
|
if (!response.ok) {
|
|
876
|
+
console.error("Failed to get pages", await response.json());
|
|
824
877
|
throw new Error(`Failed to get pages with error: "${response.statusText}"`);
|
|
825
878
|
}
|
|
826
879
|
const json = await response.json();
|
|
@@ -830,13 +883,35 @@ Received "${apiKey}" instead.`);
|
|
|
830
883
|
const result = await this.graphqlClient.request(TypographiesQuery, { typographyIds });
|
|
831
884
|
return result.typographies;
|
|
832
885
|
}
|
|
833
|
-
async
|
|
886
|
+
async getSwatches(ids, preview) {
|
|
887
|
+
var _a;
|
|
888
|
+
const url = new URL(`v1/swatches/bulk`, this.apiOrigin);
|
|
889
|
+
ids.forEach((id) => {
|
|
890
|
+
url.searchParams.append("ids", id);
|
|
891
|
+
});
|
|
892
|
+
const response = await this.fetch(url.pathname + url.search, {
|
|
893
|
+
headers: {
|
|
894
|
+
"Makeswift-Site-Version": (_a = this.siteVersion) != null ? _a : preview ? MakeswiftSiteVersion.Working : MakeswiftSiteVersion.Live
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
if (!response.ok) {
|
|
898
|
+
console.error("Failed to get swatches", await response.json());
|
|
899
|
+
return [];
|
|
900
|
+
}
|
|
901
|
+
return await response.json();
|
|
902
|
+
}
|
|
903
|
+
async getIntrospectedResources(_a, preview) {
|
|
904
|
+
var _b = _a, {
|
|
905
|
+
swatchIds
|
|
906
|
+
} = _b, introspectedResourceIds = __objRest(_b, [
|
|
907
|
+
"swatchIds"
|
|
908
|
+
]);
|
|
834
909
|
const result = await this.graphqlClient.request(IntrospectedResourcesQuery, introspectedResourceIds);
|
|
835
|
-
|
|
910
|
+
const swatches = await this.getSwatches(swatchIds, preview);
|
|
911
|
+
return __spreadProps(__spreadValues({}, result), { swatches });
|
|
836
912
|
}
|
|
837
|
-
async introspect(element) {
|
|
838
|
-
|
|
839
|
-
const runtime = (_a = this.runtime) != null ? _a : ReactRuntime;
|
|
913
|
+
async introspect(element, preview) {
|
|
914
|
+
const runtime = this.runtime;
|
|
840
915
|
const descriptors = reactPage.getPropControllerDescriptors(runtime.store.getState());
|
|
841
916
|
const swatchIds = /* @__PURE__ */ new Set();
|
|
842
917
|
const fileIds = /* @__PURE__ */ new Set();
|
|
@@ -912,8 +987,8 @@ Received "${apiKey}" instead.`);
|
|
|
912
987
|
const typographies = await this.getTypographies([...typographyIds]);
|
|
913
988
|
typographies.forEach((typography) => {
|
|
914
989
|
typography == null ? void 0 : typography.style.forEach((style) => {
|
|
915
|
-
var
|
|
916
|
-
const swatchId = (
|
|
990
|
+
var _a;
|
|
991
|
+
const swatchId = (_a = style.value.color) == null ? void 0 : _a.swatchId;
|
|
917
992
|
if (swatchId != null)
|
|
918
993
|
swatchIds.add(swatchId);
|
|
919
994
|
});
|
|
@@ -923,44 +998,44 @@ Received "${apiKey}" instead.`);
|
|
|
923
998
|
fileIds: [...fileIds],
|
|
924
999
|
tableIds: [...tableIds],
|
|
925
1000
|
pageIds: [...pageIds]
|
|
926
|
-
});
|
|
1001
|
+
}, preview);
|
|
927
1002
|
const pagePathnameSlices = pagePathnamesById.map((pagePathnameSlice) => pagePathnameSlice && __spreadProps(__spreadValues({}, pagePathnameSlice), {
|
|
928
1003
|
id: Buffer.from(`Page:${pagePathnameSlice.id}`).toString("base64")
|
|
929
1004
|
}));
|
|
930
1005
|
return {
|
|
931
1006
|
[types.APIResourceType.Swatch]: [...swatchIds].map((id) => {
|
|
932
|
-
var
|
|
1007
|
+
var _a;
|
|
933
1008
|
return {
|
|
934
1009
|
id,
|
|
935
|
-
value: (
|
|
1010
|
+
value: (_a = swatches.find((swatch) => (swatch == null ? void 0 : swatch.id) === id)) != null ? _a : null
|
|
936
1011
|
};
|
|
937
1012
|
}),
|
|
938
1013
|
[types.APIResourceType.File]: [...fileIds].map((id) => {
|
|
939
|
-
var
|
|
1014
|
+
var _a;
|
|
940
1015
|
return {
|
|
941
1016
|
id,
|
|
942
|
-
value: (
|
|
1017
|
+
value: (_a = files.find((file) => (file == null ? void 0 : file.id) === id)) != null ? _a : null
|
|
943
1018
|
};
|
|
944
1019
|
}),
|
|
945
1020
|
[types.APIResourceType.Typography]: [...typographyIds].map((id) => {
|
|
946
|
-
var
|
|
1021
|
+
var _a;
|
|
947
1022
|
return {
|
|
948
1023
|
id,
|
|
949
|
-
value: (
|
|
1024
|
+
value: (_a = typographies.find((typography) => (typography == null ? void 0 : typography.id) === id)) != null ? _a : null
|
|
950
1025
|
};
|
|
951
1026
|
}),
|
|
952
1027
|
[types.APIResourceType.Table]: [...tableIds].map((id) => {
|
|
953
|
-
var
|
|
1028
|
+
var _a;
|
|
954
1029
|
return {
|
|
955
1030
|
id,
|
|
956
|
-
value: (
|
|
1031
|
+
value: (_a = tables.find((table) => (table == null ? void 0 : table.id) === id)) != null ? _a : null
|
|
957
1032
|
};
|
|
958
1033
|
}),
|
|
959
1034
|
[types.APIResourceType.PagePathnameSlice]: [...pageIds].map((id) => {
|
|
960
|
-
var
|
|
1035
|
+
var _a;
|
|
961
1036
|
return {
|
|
962
1037
|
id,
|
|
963
|
-
value: (
|
|
1038
|
+
value: (_a = pagePathnameSlices.find((pagePathnameSlice) => (pagePathnameSlice == null ? void 0 : pagePathnameSlice.id) === id)) != null ? _a : null
|
|
964
1039
|
};
|
|
965
1040
|
}),
|
|
966
1041
|
[types.APIResourceType.GlobalElement]: [...globalElements.entries()].map(([id, value]) => ({
|
|
@@ -969,31 +1044,33 @@ Received "${apiKey}" instead.`);
|
|
|
969
1044
|
}))
|
|
970
1045
|
};
|
|
971
1046
|
}
|
|
972
|
-
async
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
const response = await this.fetch(`/v1/pages/${pageId}/document?${searchParams}`);
|
|
1047
|
+
async getPageSnapshot(pathname, { preview: previewOverride = false } = {}) {
|
|
1048
|
+
var _a;
|
|
1049
|
+
const siteVersion = (_a = this.siteVersion) != null ? _a : previewOverride ? MakeswiftSiteVersion.Working : MakeswiftSiteVersion.Live;
|
|
1050
|
+
const response = await this.fetch(`/v2/pages/${encodeURIComponent(pathname)}/document`, {
|
|
1051
|
+
headers: { "Makeswift-Site-Version": siteVersion }
|
|
1052
|
+
});
|
|
979
1053
|
if (!response.ok) {
|
|
980
1054
|
if (response.status === 404)
|
|
981
1055
|
return null;
|
|
982
|
-
|
|
1056
|
+
console.error("Failed to get page snapshot", await response.json());
|
|
1057
|
+
throw new Error(`Failed to get page snapshot with error: "${response.statusText}"`);
|
|
983
1058
|
}
|
|
984
1059
|
const document2 = await response.json();
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
if (page == null)
|
|
990
|
-
return null;
|
|
991
|
-
const snapshot = this.getPageSnapshotByPageId(page.id, { preview });
|
|
992
|
-
return snapshot;
|
|
1060
|
+
const cacheData = await this.introspect(document2.data, previewOverride);
|
|
1061
|
+
const apiOrigin = this.apiOrigin.href;
|
|
1062
|
+
const preview = siteVersion === MakeswiftSiteVersion.Working;
|
|
1063
|
+
return { document: document2, cacheData, apiOrigin, preview };
|
|
993
1064
|
}
|
|
994
1065
|
async getSwatch(swatchId) {
|
|
995
|
-
const
|
|
996
|
-
|
|
1066
|
+
const response = await this.fetch(`v1/swatches/${swatchId}`);
|
|
1067
|
+
if (!response.ok) {
|
|
1068
|
+
if (response.status !== 404)
|
|
1069
|
+
console.error("Failed to get swatch", await response.json());
|
|
1070
|
+
return null;
|
|
1071
|
+
}
|
|
1072
|
+
const swatch = await response.json();
|
|
1073
|
+
return swatch;
|
|
997
1074
|
}
|
|
998
1075
|
async getFile(fileId) {
|
|
999
1076
|
const result = await this.graphqlClient.request(FileQuery, { fileId });
|
|
@@ -1017,97 +1094,6 @@ Received "${apiKey}" instead.`);
|
|
|
1017
1094
|
return result.table;
|
|
1018
1095
|
}
|
|
1019
1096
|
}
|
|
1020
|
-
function PreviewModeScript({
|
|
1021
|
-
isPreview = false,
|
|
1022
|
-
appOrigin = "https://app.makeswift.com"
|
|
1023
|
-
}) {
|
|
1024
|
-
const previewModeScript = `
|
|
1025
|
-
const isPreview = ${isPreview}
|
|
1026
|
-
const appOrigin = '${appOrigin.replace("'", "\\'")}'
|
|
1027
|
-
const searchParamName = 'x-makeswift-preview-mode'
|
|
1028
|
-
const headerName = 'X-Makeswift-Preview-Mode'
|
|
1029
|
-
const originalUrl = new URL(window.location.href)
|
|
1030
|
-
|
|
1031
|
-
if (window.parent !== window) {
|
|
1032
|
-
window.addEventListener('message', event => {
|
|
1033
|
-
if (event.origin === appOrigin && event.data.type === 'makeswift_preview_mode') {
|
|
1034
|
-
const { secret } = event.data
|
|
1035
|
-
|
|
1036
|
-
if (!isPreview && !originalUrl.searchParams.has(searchParamName)) {
|
|
1037
|
-
const url = new URL(originalUrl)
|
|
1038
|
-
|
|
1039
|
-
url.searchParams.set(searchParamName, secret)
|
|
1040
|
-
|
|
1041
|
-
window.location.replace(url)
|
|
1042
|
-
} else {
|
|
1043
|
-
const originalFetch = window.fetch
|
|
1044
|
-
|
|
1045
|
-
window.fetch = function patchedFetch(resource, options) {
|
|
1046
|
-
const request = new Request(resource, options)
|
|
1047
|
-
|
|
1048
|
-
if (new URL(request.url).origin !== window.location.origin) {
|
|
1049
|
-
return originalFetch.call(this, resource, options)
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
return originalFetch.call(
|
|
1053
|
-
this,
|
|
1054
|
-
new Request(request, { headers: { [headerName]: secret } }),
|
|
1055
|
-
)
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
})
|
|
1060
|
-
|
|
1061
|
-
window.parent.postMessage({ type: 'makeswift_preview_mode' }, appOrigin)
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
if (originalUrl.searchParams.has(searchParamName)) {
|
|
1065
|
-
const url = new URL(originalUrl)
|
|
1066
|
-
|
|
1067
|
-
url.searchParams.delete(searchParamName)
|
|
1068
|
-
|
|
1069
|
-
window.history.replaceState(null, '', url)
|
|
1070
|
-
}
|
|
1071
|
-
`;
|
|
1072
|
-
const makeswiftConnectionCheckScript = `
|
|
1073
|
-
const appOrigin = '${appOrigin.replace("'", "\\'")}'
|
|
1074
|
-
|
|
1075
|
-
if (window.parent !== window) {
|
|
1076
|
-
window.addEventListener('message', event => {
|
|
1077
|
-
if (
|
|
1078
|
-
event.origin === appOrigin &&
|
|
1079
|
-
event.data.type === '${actions.ActionTypes.MAKESWIFT_CONNECTION_INIT}'
|
|
1080
|
-
) {
|
|
1081
|
-
setInterval(() => {
|
|
1082
|
-
window.parent.postMessage({
|
|
1083
|
-
type: '${actions.ActionTypes.MAKESWIFT_CONNECTION_CHECK}',
|
|
1084
|
-
payload: {
|
|
1085
|
-
currentUrl: window.location.href
|
|
1086
|
-
}
|
|
1087
|
-
}, appOrigin)
|
|
1088
|
-
}, 20)
|
|
1089
|
-
}
|
|
1090
|
-
})
|
|
1091
|
-
|
|
1092
|
-
window.parent.postMessage({ type: '${actions.ActionTypes.MAKESWIFT_CONNECTION_INIT}' }, appOrigin)
|
|
1093
|
-
}
|
|
1094
|
-
`;
|
|
1095
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1096
|
-
children: [/* @__PURE__ */ jsxRuntime.jsx("script", {
|
|
1097
|
-
id: "makeswift-preview-mode",
|
|
1098
|
-
type: "module",
|
|
1099
|
-
dangerouslySetInnerHTML: {
|
|
1100
|
-
__html: previewModeScript
|
|
1101
|
-
}
|
|
1102
|
-
}), /* @__PURE__ */ jsxRuntime.jsx("script", {
|
|
1103
|
-
id: "makeswift-connection-check",
|
|
1104
|
-
type: "module",
|
|
1105
|
-
dangerouslySetInnerHTML: {
|
|
1106
|
-
__html: makeswiftConnectionCheckScript
|
|
1107
|
-
}
|
|
1108
|
-
})]
|
|
1109
|
-
});
|
|
1110
|
-
}
|
|
1111
1097
|
class Document$1 extends NextDocument__default["default"] {
|
|
1112
1098
|
static async getInitialProps(ctx) {
|
|
1113
1099
|
const initialProps = await NextDocument__default["default"].getInitialProps(ctx);
|
|
@@ -1162,8 +1148,8 @@ async function fonts(_req, res, { getFonts } = {}) {
|
|
|
1162
1148
|
const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
|
|
1163
1149
|
return res.json(fonts2);
|
|
1164
1150
|
}
|
|
1165
|
-
const version = "0.
|
|
1166
|
-
async function handler(req, res, { apiKey }) {
|
|
1151
|
+
const version = "0.9.1";
|
|
1152
|
+
async function handler(req, res, { apiKey, unstable_siteVersions }) {
|
|
1167
1153
|
if (req.query.secret !== apiKey) {
|
|
1168
1154
|
return res.status(401).json({ message: "Unauthorized" });
|
|
1169
1155
|
}
|
|
@@ -1173,7 +1159,8 @@ async function handler(req, res, { apiKey }) {
|
|
|
1173
1159
|
interactionMode: true,
|
|
1174
1160
|
clientSideNavigation: true,
|
|
1175
1161
|
elementFromPoint: false,
|
|
1176
|
-
customBreakpoints: true
|
|
1162
|
+
customBreakpoints: true,
|
|
1163
|
+
unstable_siteVersions
|
|
1177
1164
|
});
|
|
1178
1165
|
}
|
|
1179
1166
|
async function proxyPreviewMode(req, res, { apiKey }) {
|
|
@@ -1204,7 +1191,11 @@ async function proxyPreviewMode(req, res, { apiKey }) {
|
|
|
1204
1191
|
const proto = isForwardedProtoHttps || isForwardedSSL ? "https" : "http";
|
|
1205
1192
|
let target = `${proto}://${host}`;
|
|
1206
1193
|
const secure = process.env["NODE_ENV"] === "production";
|
|
1207
|
-
const
|
|
1194
|
+
const previewData = {
|
|
1195
|
+
makeswift: true,
|
|
1196
|
+
unstable_siteVersion: MakeswiftSiteVersion.Working
|
|
1197
|
+
};
|
|
1198
|
+
const setCookie = res.setPreviewData(previewData).getHeader("Set-Cookie");
|
|
1208
1199
|
res.removeHeader("Set-Cookie");
|
|
1209
1200
|
if (!Array.isArray(setCookie))
|
|
1210
1201
|
return res.status(500).send("Internal Server Error");
|
|
@@ -1246,7 +1237,8 @@ Read more here: https://nextjs.org/blog/next-12-2#on-demand-incremental-static-r
|
|
|
1246
1237
|
function MakeswiftApiHandler(apiKey, {
|
|
1247
1238
|
appOrigin = "https://app.makeswift.com",
|
|
1248
1239
|
apiOrigin = "https://api.makeswift.com",
|
|
1249
|
-
getFonts
|
|
1240
|
+
getFonts,
|
|
1241
|
+
unstable_siteVersions = false
|
|
1250
1242
|
} = {}) {
|
|
1251
1243
|
const cors = Cors__default["default"]({ origin: appOrigin });
|
|
1252
1244
|
if (typeof apiKey !== "string") {
|
|
@@ -1268,12 +1260,12 @@ Received "${apiKey}" instead.`);
|
|
|
1268
1260
|
Received "${makeswift}" for the \`makeswift\` param instead.
|
|
1269
1261
|
Read more about dynamic catch-all routes here: https://nextjs.org/docs/routing/dynamic-routes#catch-all-routes`);
|
|
1270
1262
|
}
|
|
1271
|
-
const client = new Makeswift(apiKey, { apiOrigin });
|
|
1263
|
+
const client = new Makeswift(apiKey, { apiOrigin, unstable_previewData: req.previewData });
|
|
1272
1264
|
const action = "/" + makeswift.join("/");
|
|
1273
1265
|
const matches = (pattern) => pathToRegexp.match(pattern, { decode: decodeURIComponent })(action);
|
|
1274
1266
|
let m;
|
|
1275
1267
|
if (matches("/manifest"))
|
|
1276
|
-
return handler(req, res, { apiKey });
|
|
1268
|
+
return handler(req, res, { apiKey, unstable_siteVersions });
|
|
1277
1269
|
if (matches("/revalidate"))
|
|
1278
1270
|
return revalidate(req, res, { apiKey });
|
|
1279
1271
|
if (matches("/proxy-preview-mode"))
|
|
@@ -1310,10 +1302,10 @@ function saveForwardedRef(props, ref) {
|
|
|
1310
1302
|
[FORWARDED_NEXT_DYNAMIC_REF_KEY]: ref
|
|
1311
1303
|
});
|
|
1312
1304
|
}
|
|
1313
|
-
function loadForwardedRef(
|
|
1314
|
-
var
|
|
1305
|
+
function loadForwardedRef(_c) {
|
|
1306
|
+
var _d = _c, {
|
|
1315
1307
|
[FORWARDED_NEXT_DYNAMIC_REF_KEY]: ref
|
|
1316
|
-
} =
|
|
1308
|
+
} = _d, props = __objRest(_d, [
|
|
1317
1309
|
__restKey(FORWARDED_NEXT_DYNAMIC_REF_KEY)
|
|
1318
1310
|
]);
|
|
1319
1311
|
return __spreadProps(__spreadValues({}, props), {
|
|
@@ -1376,14 +1368,15 @@ async function getStaticPaths() {
|
|
|
1376
1368
|
}
|
|
1377
1369
|
const REVALIDATE_SECONDS = 1;
|
|
1378
1370
|
async function getStaticProps(ctx) {
|
|
1379
|
-
var _a, _b,
|
|
1371
|
+
var _a, _b, _c;
|
|
1380
1372
|
deprecationWarning("getStaticProps");
|
|
1381
1373
|
const makeswift = new Makeswift(getApiKey(), {
|
|
1382
|
-
apiOrigin: getApiOrigin()
|
|
1374
|
+
apiOrigin: getApiOrigin(),
|
|
1375
|
+
unstable_previewData: ctx.previewData
|
|
1383
1376
|
});
|
|
1384
1377
|
const path = "/" + ((_b = (_a = ctx.params) == null ? void 0 : _a.path) != null ? _b : []).join("/");
|
|
1385
1378
|
const snapshot = await makeswift.getPageSnapshot(path, {
|
|
1386
|
-
preview: ((
|
|
1379
|
+
preview: ((_c = ctx.previewData) == null ? void 0 : _c.makeswift) === true
|
|
1387
1380
|
});
|
|
1388
1381
|
if (snapshot == null)
|
|
1389
1382
|
return {
|
|
@@ -1401,7 +1394,8 @@ async function getServerSideProps(ctx) {
|
|
|
1401
1394
|
var _a, _b;
|
|
1402
1395
|
deprecationWarning("getServerSideProps");
|
|
1403
1396
|
const makeswift = new Makeswift(getApiKey(), {
|
|
1404
|
-
apiOrigin: getApiOrigin()
|
|
1397
|
+
apiOrigin: getApiOrigin(),
|
|
1398
|
+
unstable_previewData: ctx.previewData
|
|
1405
1399
|
});
|
|
1406
1400
|
const path = "/" + ((_b = (_a = ctx.params) == null ? void 0 : _a.path) != null ? _b : []).join("/");
|
|
1407
1401
|
const snapshot = await makeswift.getPageSnapshot(path, {
|
|
@@ -1660,7 +1654,7 @@ function registerComponent$a(runtime) {
|
|
|
1660
1654
|
})))), {
|
|
1661
1655
|
type: constants.MakeswiftComponentType.Carousel,
|
|
1662
1656
|
label: "Carousel",
|
|
1663
|
-
icon:
|
|
1657
|
+
icon: reactPage.ComponentIcon.Carousel,
|
|
1664
1658
|
props: {
|
|
1665
1659
|
id: reactPage.ElementID(),
|
|
1666
1660
|
images: reactPage.Images({
|
|
@@ -1760,7 +1754,7 @@ function registerComponent$9(runtime) {
|
|
|
1760
1754
|
})))), {
|
|
1761
1755
|
type: constants.MakeswiftComponentType.Countdown,
|
|
1762
1756
|
label: "Countdown",
|
|
1763
|
-
icon:
|
|
1757
|
+
icon: reactPage.ComponentIcon.Countdown,
|
|
1764
1758
|
props: {
|
|
1765
1759
|
id: reactPage.ElementID(),
|
|
1766
1760
|
date: reactPage.Date(() => ({
|
|
@@ -1854,7 +1848,7 @@ function registerComponent$8(runtime) {
|
|
|
1854
1848
|
})))), {
|
|
1855
1849
|
type: constants.MakeswiftComponentType.Divider,
|
|
1856
1850
|
label: "Divider",
|
|
1857
|
-
icon:
|
|
1851
|
+
icon: reactPage.ComponentIcon.Divider,
|
|
1858
1852
|
props: {
|
|
1859
1853
|
id: reactPage.ElementID(),
|
|
1860
1854
|
variant: reactPage.ResponsiveSelect({
|
|
@@ -1888,7 +1882,7 @@ function registerComponent$7(runtime) {
|
|
|
1888
1882
|
})))), {
|
|
1889
1883
|
type: constants.MakeswiftComponentType.Embed,
|
|
1890
1884
|
label: "Embed",
|
|
1891
|
-
icon:
|
|
1885
|
+
icon: reactPage.ComponentIcon.Code,
|
|
1892
1886
|
props: {
|
|
1893
1887
|
id: reactPage.ElementID(),
|
|
1894
1888
|
html: reactPage.TextArea({ label: "Code", rows: 20 }),
|
|
@@ -1927,7 +1921,7 @@ function registerComponent$6(runtime) {
|
|
|
1927
1921
|
})))), {
|
|
1928
1922
|
type: constants.MakeswiftComponentType.Form,
|
|
1929
1923
|
label: "Form",
|
|
1930
|
-
icon:
|
|
1924
|
+
icon: reactPage.ComponentIcon.Form,
|
|
1931
1925
|
props: {
|
|
1932
1926
|
id: reactPage.ElementID(),
|
|
1933
1927
|
tableId: reactPage.Table(),
|
|
@@ -2076,7 +2070,7 @@ function registerComponent$4(runtime) {
|
|
|
2076
2070
|
})))), {
|
|
2077
2071
|
type: constants.MakeswiftComponentType.Navigation,
|
|
2078
2072
|
label: "Navigation",
|
|
2079
|
-
icon:
|
|
2073
|
+
icon: reactPage.ComponentIcon.Navigation,
|
|
2080
2074
|
props: {
|
|
2081
2075
|
id: reactPage.ElementID(),
|
|
2082
2076
|
links: reactPage.NavigationLinks(),
|
|
@@ -2198,7 +2192,7 @@ function registerComponent$2(runtime) {
|
|
|
2198
2192
|
})))), {
|
|
2199
2193
|
type: constants.MakeswiftComponentType.SocialLinks,
|
|
2200
2194
|
label: "Social Links",
|
|
2201
|
-
icon:
|
|
2195
|
+
icon: reactPage.ComponentIcon.SocialLinks,
|
|
2202
2196
|
props: {
|
|
2203
2197
|
id: reactPage.ElementID(),
|
|
2204
2198
|
links: reactPage.SocialLinks({
|
|
@@ -2409,7 +2403,7 @@ function registerComponent(runtime) {
|
|
|
2409
2403
|
})))), {
|
|
2410
2404
|
type: constants.MakeswiftComponentType.Video,
|
|
2411
2405
|
label: "Video",
|
|
2412
|
-
icon:
|
|
2406
|
+
icon: reactPage.ComponentIcon.Video,
|
|
2413
2407
|
props: {
|
|
2414
2408
|
id: reactPage.ElementID(),
|
|
2415
2409
|
video: reactPage.Video({ preset: { controls: true } }),
|
|
@@ -2452,19 +2446,6 @@ function registerBuiltinComponents(runtime) {
|
|
|
2452
2446
|
unregisterVideoComponent();
|
|
2453
2447
|
};
|
|
2454
2448
|
}
|
|
2455
|
-
const isServer = typeof window === "undefined";
|
|
2456
|
-
const useInsertionEffectSpecifier = "useInsertionEffect";
|
|
2457
|
-
const useInsertionEffect = (_c = React__namespace[useInsertionEffectSpecifier]) != null ? _c : React__namespace.useLayoutEffect;
|
|
2458
|
-
function useStyle(style) {
|
|
2459
|
-
const serialized = serialize.serializeStyles([style], css.cache.registered);
|
|
2460
|
-
utils.registerStyles(css.cache, serialized, false);
|
|
2461
|
-
useInsertionEffect(() => {
|
|
2462
|
-
utils.insertStyles(css.cache, serialized, false);
|
|
2463
|
-
});
|
|
2464
|
-
if (isServer)
|
|
2465
|
-
utils.insertStyles(css.cache, serialized, false);
|
|
2466
|
-
return `${css.cache.key}-${serialized.name}`;
|
|
2467
|
-
}
|
|
2468
2449
|
var _path;
|
|
2469
2450
|
function _extends() {
|
|
2470
2451
|
_extends = Object.assign || function(target) {
|
|
@@ -2497,7 +2478,7 @@ const FallbackComponent = React.forwardRef(function FallbackComponent2({
|
|
|
2497
2478
|
}, ref) {
|
|
2498
2479
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
2499
2480
|
ref,
|
|
2500
|
-
className: useStyle({
|
|
2481
|
+
className: reactPage.useStyle({
|
|
2501
2482
|
width: "100%",
|
|
2502
2483
|
height: 54,
|
|
2503
2484
|
backgroundColor: "#fcedf2",
|
|
@@ -2608,8 +2589,8 @@ function useTable(tableId) {
|
|
|
2608
2589
|
}, [client, tableId]);
|
|
2609
2590
|
return table;
|
|
2610
2591
|
}
|
|
2611
|
-
function mapSideColor(swatches,
|
|
2612
|
-
var
|
|
2592
|
+
function mapSideColor(swatches, _e) {
|
|
2593
|
+
var _f = _e, { color } = _f, restOfSide = __objRest(_f, ["color"]);
|
|
2613
2594
|
return __spreadProps(__spreadValues({}, restOfSide), {
|
|
2614
2595
|
color: color && {
|
|
2615
2596
|
alpha: color.alpha,
|
|
@@ -2705,10 +2686,10 @@ function lengthDataToString(data) {
|
|
|
2705
2686
|
return data;
|
|
2706
2687
|
}
|
|
2707
2688
|
function paddingPropertyDataToStyle(data, defaultValue = {}) {
|
|
2708
|
-
var _a, _b,
|
|
2689
|
+
var _a, _b, _c, _d;
|
|
2709
2690
|
const paddingTop = (_a = data.paddingTop) != null ? _a : defaultValue.paddingTop;
|
|
2710
2691
|
const paddingRight = (_b = data.paddingRight) != null ? _b : defaultValue.paddingRight;
|
|
2711
|
-
const paddingBottom = (
|
|
2692
|
+
const paddingBottom = (_c = data.paddingBottom) != null ? _c : defaultValue.paddingBottom;
|
|
2712
2693
|
const paddingLeft = (_d = data.paddingLeft) != null ? _d : defaultValue.paddingLeft;
|
|
2713
2694
|
const style = {};
|
|
2714
2695
|
if (paddingTop != null)
|
|
@@ -2722,10 +2703,10 @@ function paddingPropertyDataToStyle(data, defaultValue = {}) {
|
|
|
2722
2703
|
return style;
|
|
2723
2704
|
}
|
|
2724
2705
|
function marginPropertyDataToStyle(data, defaultValue = {}) {
|
|
2725
|
-
var _a, _b,
|
|
2706
|
+
var _a, _b, _c, _d;
|
|
2726
2707
|
const marginTop = (_a = data.marginTop) != null ? _a : defaultValue.marginTop;
|
|
2727
2708
|
const marginRight = (_b = data.marginRight) != null ? _b : defaultValue.marginRight;
|
|
2728
|
-
const marginBottom = (
|
|
2709
|
+
const marginBottom = (_c = data.marginBottom) != null ? _c : defaultValue.marginBottom;
|
|
2729
2710
|
const marginLeft = (_d = data.marginLeft) != null ? _d : defaultValue.marginLeft;
|
|
2730
2711
|
const style = {};
|
|
2731
2712
|
if (marginTop != null)
|
|
@@ -2746,10 +2727,10 @@ function lengthPercentageDataToString(data) {
|
|
|
2746
2727
|
return data;
|
|
2747
2728
|
}
|
|
2748
2729
|
function borderRadiusPropertyDataToStyle(data, defaultValue = {}) {
|
|
2749
|
-
var _a, _b,
|
|
2730
|
+
var _a, _b, _c, _d;
|
|
2750
2731
|
const borderTopLeftRadius = (_a = data.borderTopLeftRadius) != null ? _a : defaultValue.borderTopLeftRadius;
|
|
2751
2732
|
const borderTopRightRadius = (_b = data.borderTopRightRadius) != null ? _b : defaultValue.borderTopRightRadius;
|
|
2752
|
-
const borderBottomRightRadius = (
|
|
2733
|
+
const borderBottomRightRadius = (_c = data.borderBottomRightRadius) != null ? _c : defaultValue.borderBottomRightRadius;
|
|
2753
2734
|
const borderBottomLeftRadius = (_d = data.borderBottomLeftRadius) != null ? _d : defaultValue.borderBottomLeftRadius;
|
|
2754
2735
|
const style = {};
|
|
2755
2736
|
if (borderTopLeftRadius != null) {
|
|
@@ -2770,10 +2751,10 @@ function colorToString(color) {
|
|
|
2770
2751
|
return color && color.swatch ? `hsla(${color.swatch.hue},${color.swatch.saturation}%,${color.swatch.lightness}%,${color.alpha})` : "";
|
|
2771
2752
|
}
|
|
2772
2753
|
function borderPropertyDataToStyle(data, defaultValue = {}) {
|
|
2773
|
-
var _a, _b,
|
|
2754
|
+
var _a, _b, _c, _d;
|
|
2774
2755
|
const borderTop = (_a = data.borderTop) != null ? _a : defaultValue.borderTop;
|
|
2775
2756
|
const borderRight = (_b = data.borderRight) != null ? _b : defaultValue.borderRight;
|
|
2776
|
-
const borderBottom = (
|
|
2757
|
+
const borderBottom = (_c = data.borderBottom) != null ? _c : defaultValue.borderBottom;
|
|
2777
2758
|
const borderLeft = (_d = data.borderLeft) != null ? _d : defaultValue.borderLeft;
|
|
2778
2759
|
const style = {};
|
|
2779
2760
|
if (borderTop != null)
|
|
@@ -2927,7 +2908,7 @@ const defaultPadding = {
|
|
|
2927
2908
|
paddingBottom: 0,
|
|
2928
2909
|
paddingLeft: 0
|
|
2929
2910
|
};
|
|
2930
|
-
function useStyleControlCssObject(style, controlDefinition) {
|
|
2911
|
+
function useStyleControlCssObject$1(style, controlDefinition) {
|
|
2931
2912
|
const { properties } = controlDefinition.config;
|
|
2932
2913
|
return __spreadValues(__spreadValues({}, properties.includes(reactPage.StyleControlProperty.Width) && {
|
|
2933
2914
|
maxWidth: "100%"
|
|
@@ -2939,12 +2920,12 @@ function useStyleControlCssObject(style, controlDefinition) {
|
|
|
2939
2920
|
style == null ? void 0 : style.borderRadius,
|
|
2940
2921
|
style == null ? void 0 : style.textStyle
|
|
2941
2922
|
], ([width, margin, padding, border, borderRadius, textStyle]) => {
|
|
2942
|
-
var _a, _b,
|
|
2923
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2943
2924
|
return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, properties.includes(reactPage.StyleControlProperty.Width) && {
|
|
2944
2925
|
width: (_a = widthToString(width)) != null ? _a : "100%"
|
|
2945
2926
|
}), properties.includes(reactPage.StyleControlProperty.Margin) && marginPropertyDataToStyle(margin != null ? margin : defaultMargin, defaultMargin)), properties.includes(reactPage.StyleControlProperty.Padding) && paddingPropertyDataToStyle(padding != null ? padding : defaultPadding, defaultPadding)), properties.includes(reactPage.StyleControlProperty.Border) && {
|
|
2946
2927
|
borderTop: (_b = borderSideToString2(border == null ? void 0 : border.borderTop)) != null ? _b : "0 solid black",
|
|
2947
|
-
borderRight: (
|
|
2928
|
+
borderRight: (_c = borderSideToString2(border == null ? void 0 : border.borderRight)) != null ? _c : "0 solid black",
|
|
2948
2929
|
borderBottom: (_d = borderSideToString2(border == null ? void 0 : border.borderBottom)) != null ? _d : "0 solid black",
|
|
2949
2930
|
borderLeft: (_e = borderSideToString2(border == null ? void 0 : border.borderLeft)) != null ? _e : "0 solid black"
|
|
2950
2931
|
}), properties.includes(reactPage.StyleControlProperty.BorderRadius) && {
|
|
@@ -2978,9 +2959,9 @@ function useStyleControlCssObject(style, controlDefinition) {
|
|
|
2978
2959
|
}
|
|
2979
2960
|
}
|
|
2980
2961
|
function useFormattedStyle(styleControlData, controlDefinition, control) {
|
|
2981
|
-
const style = useStyleControlCssObject(styleControlData, controlDefinition);
|
|
2962
|
+
const style = useStyleControlCssObject$1(styleControlData, controlDefinition);
|
|
2982
2963
|
const guid = React.useId().replaceAll(":", "");
|
|
2983
|
-
const styleClassName = useStyle(style);
|
|
2964
|
+
const styleClassName = reactPage.useStyle(style);
|
|
2984
2965
|
const classNames = `${styleClassName} ${guid}`;
|
|
2985
2966
|
React.useEffect(() => {
|
|
2986
2967
|
let currentBoxModel = null;
|
|
@@ -2989,7 +2970,7 @@ function useFormattedStyle(styleControlData, controlDefinition, control) {
|
|
|
2989
2970
|
return;
|
|
2990
2971
|
const element = document.querySelector(`.${guid}`);
|
|
2991
2972
|
const measuredBoxModel = element == null ? null : boxModels.getBox(element);
|
|
2992
|
-
if (!deepEqual(currentBoxModel, measuredBoxModel)) {
|
|
2973
|
+
if (!deepEqual.deepEqual(currentBoxModel, measuredBoxModel)) {
|
|
2993
2974
|
currentBoxModel = measuredBoxModel;
|
|
2994
2975
|
control.changeBoxModel(currentBoxModel);
|
|
2995
2976
|
}
|
|
@@ -3160,10 +3141,11 @@ const EditableText = forwardNextDynamicRef((patch) => dynamic__default["default"
|
|
|
3160
3141
|
const ReadOnlyText = forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
3161
3142
|
return require("./ReadOnlyTextV2.cjs.js");
|
|
3162
3143
|
}))));
|
|
3163
|
-
function useRichTextV2(data, control) {
|
|
3144
|
+
function useRichTextV2(data, definition, control) {
|
|
3164
3145
|
const isPreview = useIsPreview();
|
|
3165
3146
|
return isPreview ? /* @__PURE__ */ jsxRuntime.jsx(EditableText, {
|
|
3166
3147
|
text: data,
|
|
3148
|
+
definition,
|
|
3167
3149
|
control
|
|
3168
3150
|
}) : /* @__PURE__ */ jsxRuntime.jsx(ReadOnlyText, {
|
|
3169
3151
|
text: data,
|
|
@@ -3195,7 +3177,7 @@ function pollBoxModel({
|
|
|
3195
3177
|
let currentBoxModel = null;
|
|
3196
3178
|
const handleAnimationFrameRequest = () => {
|
|
3197
3179
|
const measuredBoxModel = boxModels.getBox(element);
|
|
3198
|
-
if (!deepEqual(currentBoxModel, measuredBoxModel)) {
|
|
3180
|
+
if (!deepEqual.deepEqual(currentBoxModel, measuredBoxModel)) {
|
|
3199
3181
|
currentBoxModel = measuredBoxModel;
|
|
3200
3182
|
onBoxModelChange(currentBoxModel);
|
|
3201
3183
|
}
|
|
@@ -3225,13 +3207,13 @@ function useSlot(data, control) {
|
|
|
3225
3207
|
}, element.key))
|
|
3226
3208
|
});
|
|
3227
3209
|
}
|
|
3228
|
-
function Slot(
|
|
3229
|
-
var
|
|
3210
|
+
function Slot(_g) {
|
|
3211
|
+
var _h = _g, {
|
|
3230
3212
|
as,
|
|
3231
3213
|
control,
|
|
3232
3214
|
children,
|
|
3233
3215
|
className
|
|
3234
|
-
} =
|
|
3216
|
+
} = _h, restOfProps = __objRest(_h, [
|
|
3235
3217
|
"as",
|
|
3236
3218
|
"control",
|
|
3237
3219
|
"children",
|
|
@@ -3239,7 +3221,7 @@ function Slot(_f) {
|
|
|
3239
3221
|
]);
|
|
3240
3222
|
const As = as != null ? as : "div";
|
|
3241
3223
|
const [element, setElement] = React.useState(null);
|
|
3242
|
-
const baseClassName = useStyle({
|
|
3224
|
+
const baseClassName = reactPage.useStyle({
|
|
3243
3225
|
display: "flex",
|
|
3244
3226
|
flexWrap: "wrap",
|
|
3245
3227
|
width: "100%"
|
|
@@ -3260,15 +3242,15 @@ function Slot(_f) {
|
|
|
3260
3242
|
}
|
|
3261
3243
|
Slot.Placeholder = SlotPlaceholder;
|
|
3262
3244
|
Slot.Item = SlotItem;
|
|
3263
|
-
function SlotItem(
|
|
3264
|
-
var
|
|
3245
|
+
function SlotItem(_i) {
|
|
3246
|
+
var _j = _i, {
|
|
3265
3247
|
as,
|
|
3266
3248
|
control,
|
|
3267
3249
|
grid,
|
|
3268
3250
|
index,
|
|
3269
3251
|
children,
|
|
3270
3252
|
className
|
|
3271
|
-
} =
|
|
3253
|
+
} = _j, restOfProps = __objRest(_j, [
|
|
3272
3254
|
"as",
|
|
3273
3255
|
"control",
|
|
3274
3256
|
"grid",
|
|
@@ -3278,7 +3260,7 @@ function SlotItem(_h) {
|
|
|
3278
3260
|
]);
|
|
3279
3261
|
const As = as != null ? as : "div";
|
|
3280
3262
|
const [element, setElement] = React.useState(null);
|
|
3281
|
-
const baseClassName = useStyle(__spreadValues({
|
|
3263
|
+
const baseClassName = reactPage.useStyle(__spreadValues({
|
|
3282
3264
|
display: "flex"
|
|
3283
3265
|
}, useResponsiveStyle([grid], ([{
|
|
3284
3266
|
count = 12,
|
|
@@ -3322,7 +3304,7 @@ function SlotPlaceholder({
|
|
|
3322
3304
|
}, [element, control]);
|
|
3323
3305
|
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
3324
3306
|
ref: setElement,
|
|
3325
|
-
className: useStyle({
|
|
3307
|
+
className: reactPage.useStyle({
|
|
3326
3308
|
width: "100%",
|
|
3327
3309
|
background: "rgba(161, 168, 194, 0.18)",
|
|
3328
3310
|
height: "80px"
|
|
@@ -3331,7 +3313,7 @@ function SlotPlaceholder({
|
|
|
3331
3313
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3332
3314
|
width: "100%",
|
|
3333
3315
|
height: "100%",
|
|
3334
|
-
className: useStyle({
|
|
3316
|
+
className: reactPage.useStyle({
|
|
3335
3317
|
overflow: "visible",
|
|
3336
3318
|
padding: 8
|
|
3337
3319
|
}),
|
|
@@ -3350,6 +3332,20 @@ function SlotPlaceholder({
|
|
|
3350
3332
|
})
|
|
3351
3333
|
});
|
|
3352
3334
|
}
|
|
3335
|
+
function useStyleControlCssObject(styleControlData, controlDefinition) {
|
|
3336
|
+
var _a;
|
|
3337
|
+
const breakpoints = useBreakpoints();
|
|
3338
|
+
return __spreadValues(__spreadValues({}, controlDefinition.config.getStyle((_a = state_breakpoints.findBreakpointOverride(breakpoints, styleControlData, state_breakpoints.getBaseBreakpoint(breakpoints).id)) == null ? void 0 : _a.value)), breakpoints.reduce((styles, breakpoint) => {
|
|
3339
|
+
var _a2;
|
|
3340
|
+
return __spreadProps(__spreadValues({}, styles), {
|
|
3341
|
+
[state_breakpoints.getBreakpointMediaQuery(breakpoint)]: controlDefinition.config.getStyle((_a2 = state_breakpoints.findBreakpointOverride(breakpoints, styleControlData, breakpoint.id)) == null ? void 0 : _a2.value)
|
|
3342
|
+
});
|
|
3343
|
+
}, {}));
|
|
3344
|
+
}
|
|
3345
|
+
function useFormattedStyleV2(styleControlData, controlDefinition) {
|
|
3346
|
+
const styles = useStyleControlCssObject(styleControlData, controlDefinition);
|
|
3347
|
+
return reactPage.useStyle(styles);
|
|
3348
|
+
}
|
|
3353
3349
|
function useTextAreaValue(data, definition) {
|
|
3354
3350
|
return data != null ? data : definition.config.defaultValue;
|
|
3355
3351
|
}
|
|
@@ -3387,7 +3383,7 @@ function ControlValue({
|
|
|
3387
3383
|
parameters: [data, definition],
|
|
3388
3384
|
children: (value) => children(value)
|
|
3389
3385
|
}, definition.type);
|
|
3390
|
-
case
|
|
3386
|
+
case reactPage.SelectControlType:
|
|
3391
3387
|
return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
|
|
3392
3388
|
hook: useSelectControlValue,
|
|
3393
3389
|
parameters: [data, definition],
|
|
@@ -3446,7 +3442,7 @@ function ControlValue({
|
|
|
3446
3442
|
case reactPage.RichTextV2ControlType:
|
|
3447
3443
|
return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
|
|
3448
3444
|
hook: useRichTextV2,
|
|
3449
|
-
parameters: [data, control],
|
|
3445
|
+
parameters: [data, definition, control],
|
|
3450
3446
|
children: (value) => children(value)
|
|
3451
3447
|
}, definition.type);
|
|
3452
3448
|
case reactPage.StyleControlType:
|
|
@@ -3455,29 +3451,35 @@ function ControlValue({
|
|
|
3455
3451
|
parameters: [data, definition, control],
|
|
3456
3452
|
children: (value) => children(value)
|
|
3457
3453
|
}, definition.type);
|
|
3454
|
+
case reactPage.StyleV2ControlType:
|
|
3455
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
|
|
3456
|
+
hook: useFormattedStyleV2,
|
|
3457
|
+
parameters: [data, definition],
|
|
3458
|
+
children: (value) => children(value)
|
|
3459
|
+
}, definition.type);
|
|
3458
3460
|
default:
|
|
3459
3461
|
return children(data);
|
|
3460
3462
|
}
|
|
3461
3463
|
}
|
|
3462
3464
|
function useWidthStyle(value, descriptor) {
|
|
3463
|
-
return useStyle(useResponsiveWidth(value, descriptor.options.defaultValue));
|
|
3465
|
+
return reactPage.useStyle(useResponsiveWidth(value, descriptor.options.defaultValue));
|
|
3464
3466
|
}
|
|
3465
3467
|
function usePaddingStyle(value) {
|
|
3466
|
-
return useStyle(useResponsivePadding(value));
|
|
3468
|
+
return reactPage.useStyle(useResponsivePadding(value));
|
|
3467
3469
|
}
|
|
3468
3470
|
function useMarginStyle(value) {
|
|
3469
|
-
return useStyle(useResponsiveMargin(value));
|
|
3471
|
+
return reactPage.useStyle(useResponsiveMargin(value));
|
|
3470
3472
|
}
|
|
3471
3473
|
function useBorderRadiusStyle(value) {
|
|
3472
|
-
return useStyle(useResponsiveBorderRadius(value));
|
|
3474
|
+
return reactPage.useStyle(useResponsiveBorderRadius(value));
|
|
3473
3475
|
}
|
|
3474
3476
|
function useShadowsStyle(value) {
|
|
3475
3477
|
const shadowValue = useBoxShadow(value);
|
|
3476
|
-
return useStyle(useResponsiveShadow(shadowValue != null ? shadowValue : void 0));
|
|
3478
|
+
return reactPage.useStyle(useResponsiveShadow(shadowValue != null ? shadowValue : void 0));
|
|
3477
3479
|
}
|
|
3478
3480
|
function useBorderStyle(value) {
|
|
3479
3481
|
const borderData = useBorder(value);
|
|
3480
|
-
return useStyle(useResponsiveBorder(borderData != null ? borderData : void 0));
|
|
3482
|
+
return reactPage.useStyle(useResponsiveBorder(borderData != null ? borderData : void 0));
|
|
3481
3483
|
}
|
|
3482
3484
|
function PropsValue({
|
|
3483
3485
|
element,
|
|
@@ -3494,19 +3496,20 @@ function PropsValue({
|
|
|
3494
3496
|
return reactPage.getPropControllers(state, documentKey, element.key);
|
|
3495
3497
|
});
|
|
3496
3498
|
return Object.entries(propControllerDescriptorsRef.current).reduceRight((renderFn, [propName, descriptor]) => (propsValue) => {
|
|
3497
|
-
var _a2, _b,
|
|
3499
|
+
var _a2, _b, _c, _d;
|
|
3498
3500
|
switch (descriptor.type) {
|
|
3499
3501
|
case textInput.CheckboxControlType:
|
|
3500
3502
|
case textInput.NumberControlType:
|
|
3501
3503
|
case textInput.TextInputControlType:
|
|
3502
3504
|
case textInput.TextAreaControlType:
|
|
3503
|
-
case
|
|
3505
|
+
case reactPage.SelectControlType:
|
|
3504
3506
|
case reactPage.ColorControlType:
|
|
3505
3507
|
case reactPage.ImageControlType:
|
|
3506
3508
|
case combobox.ComboboxControlType:
|
|
3507
3509
|
case reactPage.ShapeControlType:
|
|
3508
3510
|
case reactPage.ListControlType:
|
|
3509
3511
|
case reactPage.LinkControlType:
|
|
3512
|
+
case reactPage.StyleV2ControlType:
|
|
3510
3513
|
return /* @__PURE__ */ jsxRuntime.jsx(ControlValue, {
|
|
3511
3514
|
definition: descriptor,
|
|
3512
3515
|
data: props[propName],
|
|
@@ -3536,10 +3539,10 @@ function PropsValue({
|
|
|
3536
3539
|
}, descriptor.type);
|
|
3537
3540
|
}
|
|
3538
3541
|
case reactPage.RichTextV2ControlType: {
|
|
3539
|
-
const control = (
|
|
3542
|
+
const control = (_c = propControllers == null ? void 0 : propControllers[propName]) != null ? _c : null;
|
|
3540
3543
|
return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
|
|
3541
3544
|
hook: useRichTextV2,
|
|
3542
|
-
parameters: [props[propName], control],
|
|
3545
|
+
parameters: [props[propName], descriptor, control],
|
|
3543
3546
|
children: (value) => renderFn(__spreadProps(__spreadValues({}, propsValue), {
|
|
3544
3547
|
[propName]: value
|
|
3545
3548
|
}))
|
|
@@ -3730,18 +3733,22 @@ function isDomNodeHandle(value) {
|
|
|
3730
3733
|
}
|
|
3731
3734
|
class ReactRuntime {
|
|
3732
3735
|
constructor({
|
|
3733
|
-
breakpoints
|
|
3734
|
-
|
|
3736
|
+
breakpoints,
|
|
3737
|
+
unstable_i18n
|
|
3738
|
+
} = {}) {
|
|
3735
3739
|
__publicField(this, "store");
|
|
3736
3740
|
this.store = reactPage.configureStore({
|
|
3737
|
-
breakpoints: breakpoints ? state_breakpoints.parseBreakpointsInput(breakpoints) : void 0
|
|
3741
|
+
breakpoints: breakpoints ? state_breakpoints.parseBreakpointsInput(breakpoints) : void 0,
|
|
3742
|
+
locales: unstable_i18n ? __spreadProps(__spreadValues({}, unstable_i18n), {
|
|
3743
|
+
locale: null
|
|
3744
|
+
}) : void 0
|
|
3738
3745
|
});
|
|
3739
3746
|
registerBuiltinComponents(this);
|
|
3740
3747
|
}
|
|
3741
3748
|
static registerComponent(component, {
|
|
3742
3749
|
type,
|
|
3743
3750
|
label,
|
|
3744
|
-
icon =
|
|
3751
|
+
icon = reactPage.ComponentIcon.Code,
|
|
3745
3752
|
hidden = false,
|
|
3746
3753
|
props
|
|
3747
3754
|
}) {
|
|
@@ -3765,7 +3772,7 @@ class ReactRuntime {
|
|
|
3765
3772
|
registerComponent(component, {
|
|
3766
3773
|
type,
|
|
3767
3774
|
label,
|
|
3768
|
-
icon =
|
|
3775
|
+
icon = reactPage.ComponentIcon.Cube,
|
|
3769
3776
|
hidden = false,
|
|
3770
3777
|
props
|
|
3771
3778
|
}) {
|
|
@@ -3796,10 +3803,10 @@ const PreviewProvider = dynamic__default["default"](() => Promise.resolve().then
|
|
|
3796
3803
|
const LiveProvider = dynamic__default["default"](() => Promise.resolve().then(function() {
|
|
3797
3804
|
return require("./LiveProvider.cjs.js");
|
|
3798
3805
|
}));
|
|
3799
|
-
function RuntimeProvider(
|
|
3800
|
-
var
|
|
3806
|
+
function RuntimeProvider(_k) {
|
|
3807
|
+
var _l = _k, {
|
|
3801
3808
|
preview
|
|
3802
|
-
} =
|
|
3809
|
+
} = _l, props = __objRest(_l, [
|
|
3803
3810
|
"preview"
|
|
3804
3811
|
]);
|
|
3805
3812
|
return preview ? /* @__PURE__ */ jsxRuntime.jsx(PreviewProvider, __spreadValues({}, props)) : /* @__PURE__ */ jsxRuntime.jsx(LiveProvider, __spreadValues({}, props));
|
|
@@ -4002,6 +4009,7 @@ const DocumentReference = React.memo(React.forwardRef(function DocumentReference
|
|
|
4002
4009
|
}));
|
|
4003
4010
|
exports.Alignments = Alignments;
|
|
4004
4011
|
exports.Contrasts = Contrasts;
|
|
4012
|
+
exports.ControlValue = ControlValue;
|
|
4005
4013
|
exports.DEFAULT_BOX_ANIMATE_DELAY = DEFAULT_BOX_ANIMATE_DELAY;
|
|
4006
4014
|
exports.DEFAULT_BOX_ANIMATE_DURATION = DEFAULT_BOX_ANIMATE_DURATION;
|
|
4007
4015
|
exports.DEFAULT_BOX_ANIMATE_TYPE = DEFAULT_BOX_ANIMATE_TYPE;
|
|
@@ -4027,7 +4035,6 @@ exports.Shapes = Shapes;
|
|
|
4027
4035
|
exports.Sizes = Sizes;
|
|
4028
4036
|
exports.StoreContext = StoreContext;
|
|
4029
4037
|
exports.colorToString = colorToString;
|
|
4030
|
-
exports.deepEqual = deepEqual;
|
|
4031
4038
|
exports.forwardNextDynamicRef = forwardNextDynamicRef;
|
|
4032
4039
|
exports.getServerSideProps = getServerSideProps;
|
|
4033
4040
|
exports.getStaticPaths = getStaticPaths;
|
|
@@ -4051,7 +4058,6 @@ exports.useResponsiveGridItem = useResponsiveGridItem;
|
|
|
4051
4058
|
exports.useResponsiveStyle = useResponsiveStyle;
|
|
4052
4059
|
exports.useResponsiveTextStyle = useResponsiveTextStyle;
|
|
4053
4060
|
exports.useResponsiveWidth = useResponsiveWidth;
|
|
4054
|
-
exports.useStyle = useStyle;
|
|
4055
4061
|
exports.useSwatches = useSwatches;
|
|
4056
4062
|
exports.useTable = useTable;
|
|
4057
4063
|
exports.useTypography = useTypography;
|