@makeswift/runtime 0.9.12 → 0.10.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 +3 -0
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +4 -1
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +3 -2
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +4 -3
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +3 -2
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +4 -3
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +3 -0
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +4 -1
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +3 -0
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +4 -1
- package/dist/Divider.es.js.map +1 -1
- package/dist/Embed.cjs.js +1 -0
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +2 -1
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +13 -12
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +5 -4
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +11 -10
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +11 -10
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +3 -0
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +5 -2
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +11 -10
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +11 -10
- package/dist/Navigation.es.js.map +1 -1
- package/dist/PreviewProvider.cjs.js +10 -6
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +9 -5
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +19 -26
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +15 -22
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +29 -26
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +28 -25
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +3 -0
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +4 -1
- package/dist/Root.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +6 -5
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +7 -6
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Text.cjs.js +12 -71
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +13 -64
- package/dist/Text.es.js.map +1 -1
- package/dist/Video.cjs.js +1 -0
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +2 -1
- package/dist/Video.es.js.map +1 -1
- package/dist/actions.cjs.js +2 -2
- package/dist/actions.cjs.js.map +1 -1
- package/dist/actions.es.js +2 -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 +2 -0
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +3 -2
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +3 -2
- package/dist/components.es.js.map +1 -1
- package/dist/control-serialization.es.js +1 -1
- package/dist/controls.cjs.js +8 -8
- package/dist/controls.es.js +4 -2
- package/dist/controls.es.js.map +1 -1
- package/dist/index.cjs.js +280 -216
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs3.js +21 -107
- package/dist/index.cjs3.js.map +1 -1
- package/dist/index.cjs4.js +16 -57
- package/dist/index.cjs4.js.map +1 -1
- package/dist/index.cjs5.js +53 -242
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs6.js +0 -41
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +376 -14
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.cjs8.js +275 -11
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.es.js +274 -209
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js +2 -2
- package/dist/index.es3.js +22 -103
- package/dist/index.es3.js.map +1 -1
- package/dist/index.es4.js +16 -57
- package/dist/index.es4.js.map +1 -1
- package/dist/index.es5.js +53 -240
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es6.js +1 -36
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es7.js +372 -16
- package/dist/index.es7.js.map +1 -1
- package/dist/index.es8.js +270 -10
- package/dist/index.es8.js.map +1 -1
- package/dist/main.cjs.js +2 -0
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +2 -0
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +3 -0
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +4 -1
- package/dist/next.es.js.map +1 -1
- package/dist/prop-controllers.cjs.js +2 -0
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +2 -0
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/react-page.cjs.js +1450 -65
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +1427 -66
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +3 -0
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +3 -0
- package/dist/react.es.js.map +1 -1
- package/dist/slate.cjs.js +33 -391
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +15 -376
- package/dist/slate.es.js.map +1 -1
- package/dist/text-input.cjs.js +0 -22
- package/dist/text-input.cjs.js.map +1 -1
- package/dist/text-input.es.js +1 -18
- package/dist/text-input.es.js.map +1 -1
- package/dist/types/src/components/builtin/Text/Text.d.ts +3 -4
- package/dist/types/src/components/builtin/Text/Text.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/register.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/fixtures/v2-data-types.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/rich-text.d.ts +0 -1
- package/dist/types/src/controls/rich-text/rich-text.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/translation.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/plugin.d.ts +29 -0
- package/dist/types/src/controls/rich-text-v2/plugin.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +17 -31
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/index.d.ts.map +1 -1
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/next/index.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/introspection.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/editable-text.d.ts +4 -3
- package/dist/types/src/runtimes/react/controls/rich-text/EditableText/editable-text.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/EditableText/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/EditableText/useSyncDOMSelection.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/useSyncWithBuilder.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/ReadOnlyText.d.ts +2 -2
- package/dist/types/src/runtimes/react/controls/rich-text/ReadOnlyText.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/block.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text/components/Element/block.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/Element/element.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/Element/index.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/inline.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text/components/Element/inline.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/Leaf/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/Leaf/leaf.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/index.d.ts +2 -0
- package/dist/types/src/runtimes/react/controls/rich-text/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/{rich-text.d.ts → rich-text/rich-text.d.ts} +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text/rich-text.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts +2 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts +2 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/useRemoteChanges.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts +2 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlineModePlugin/index.d.ts +6 -4
- package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlinePlugin/index.d.ts +3 -3
- package/dist/types/src/slate/InlinePlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlinePlugin/types.d.ts +1 -1
- package/dist/types/src/slate/InlinePlugin/types.d.ts.map +1 -1
- package/dist/types/src/slate/LinkPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/LinkPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/LinkPlugin/linkPluginWithoutRenderElement.d.ts +16 -0
- package/dist/types/src/slate/LinkPlugin/linkPluginWithoutRenderElement.d.ts.map +1 -0
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/TypographyPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/types.d.ts +1 -10
- package/dist/types/src/slate/types.d.ts.map +1 -1
- package/dist/types/src/slate/utils/element.d.ts.map +1 -1
- package/dist/types/src/state/actions.d.ts +2 -1
- package/dist/types/src/state/actions.d.ts.map +1 -1
- package/dist/types/src/state/modules/locales.d.ts.map +1 -1
- package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index.cjs10.js +0 -390
- package/dist/index.cjs10.js.map +0 -1
- package/dist/index.cjs9.js +0 -295
- package/dist/index.cjs9.js.map +0 -1
- package/dist/index.es10.js +0 -383
- package/dist/index.es10.js.map +0 -1
- package/dist/index.es9.js +0 -288
- package/dist/index.es9.js.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/index.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/useSyncDOMSelection.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/useSyncWithBuilder.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Element/block.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Element/element.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Element/index.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Element/inline.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Leaf/index.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/index.d.ts.map +0 -1
- package/dist/types/src/runtimes/react/controls/rich-text.d.ts.map +0 -1
- package/dist/types.cjs2.js +0 -765
- package/dist/types.cjs2.js.map +0 -1
- package/dist/types.es2.js +0 -748
- package/dist/types.es2.js.map +0 -1
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/index.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/useSyncDOMSelection.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/element.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/index.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Leaf/index.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Leaf/leaf.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/index.d.ts +0 -0
package/dist/index.cjs.js
CHANGED
|
@@ -67,6 +67,9 @@ var setCookieParser = require("set-cookie-parser");
|
|
|
67
67
|
var constants = require("./constants.cjs.js");
|
|
68
68
|
var uuid = require("uuid");
|
|
69
69
|
var ipsum = require("corporate-ipsum");
|
|
70
|
+
require("is-hotkey");
|
|
71
|
+
require("slate-react");
|
|
72
|
+
var NextLink = require("next/link");
|
|
70
73
|
function _interopDefaultLegacy(e) {
|
|
71
74
|
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
72
75
|
}
|
|
@@ -101,6 +104,7 @@ var createEmotionServer__default = /* @__PURE__ */ _interopDefaultLegacy(createE
|
|
|
101
104
|
var NextDocument__default = /* @__PURE__ */ _interopDefaultLegacy(NextDocument);
|
|
102
105
|
var Cors__default = /* @__PURE__ */ _interopDefaultLegacy(Cors);
|
|
103
106
|
var ipsum__default = /* @__PURE__ */ _interopDefaultLegacy(ipsum);
|
|
107
|
+
var NextLink__default = /* @__PURE__ */ _interopDefaultLegacy(NextLink);
|
|
104
108
|
const SCRIPT_TAG = "script";
|
|
105
109
|
function BodySnippet({
|
|
106
110
|
code,
|
|
@@ -145,43 +149,6 @@ function BodySnippet({
|
|
|
145
149
|
}, [code, cleanup]);
|
|
146
150
|
return null;
|
|
147
151
|
}
|
|
148
|
-
function is(x, y) {
|
|
149
|
-
if (x === y)
|
|
150
|
-
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
151
|
-
return x !== x && y !== y;
|
|
152
|
-
}
|
|
153
|
-
const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
|
|
154
|
-
const shallowEqual = (a, b) => {
|
|
155
|
-
if (is(a, b))
|
|
156
|
-
return true;
|
|
157
|
-
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
158
|
-
return false;
|
|
159
|
-
const keysA = Object.keys(a);
|
|
160
|
-
const keysB = Object.keys(b);
|
|
161
|
-
if (keysA.length !== keysB.length)
|
|
162
|
-
return false;
|
|
163
|
-
for (let i = 0; i < keysA.length; i += 1) {
|
|
164
|
-
if (!hasOwnProperty$1.call(b, keysA[i]) || !is(a[keysA[i]], b[keysA[i]]))
|
|
165
|
-
return false;
|
|
166
|
-
}
|
|
167
|
-
return true;
|
|
168
|
-
};
|
|
169
|
-
const { hasOwnProperty } = Object.prototype;
|
|
170
|
-
const deepEqual = (a, b) => {
|
|
171
|
-
if (shallowEqual(a, b))
|
|
172
|
-
return true;
|
|
173
|
-
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
174
|
-
return false;
|
|
175
|
-
const keysA = Object.keys(a);
|
|
176
|
-
const keysB = Object.keys(b);
|
|
177
|
-
if (keysA.length !== keysB.length)
|
|
178
|
-
return false;
|
|
179
|
-
for (let i = 0; i < keysA.length; i += 1) {
|
|
180
|
-
if (!hasOwnProperty.call(b, keysA[i]) || !deepEqual(a[keysA[i]], b[keysA[i]]))
|
|
181
|
-
return false;
|
|
182
|
-
}
|
|
183
|
-
return true;
|
|
184
|
-
};
|
|
185
152
|
function getInitialState(serializedState = {
|
|
186
153
|
Swatch: [],
|
|
187
154
|
File: [],
|
|
@@ -216,7 +183,7 @@ function reducer$1(state = getInitialState(), action) {
|
|
|
216
183
|
}
|
|
217
184
|
case actions.ActionTypes.CHANGE_API_RESOURCE: {
|
|
218
185
|
const existingApiResource = getAPIResource$1(state, action.payload.resource.__typename, action.payload.resource.id);
|
|
219
|
-
if (deepEqual(existingApiResource, action.payload.resource))
|
|
186
|
+
if (reactPage.deepEqual(existingApiResource, action.payload.resource))
|
|
220
187
|
return state;
|
|
221
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));
|
|
222
189
|
}
|
|
@@ -657,7 +624,7 @@ function Page$1({
|
|
|
657
624
|
return;
|
|
658
625
|
const oldSnippets = snippets.map(filterUsedSnippetProperties);
|
|
659
626
|
const newSnippets = cachedPage.snippets.map(filterUsedSnippetProperties);
|
|
660
|
-
if (deepEqual(newSnippets, oldSnippets))
|
|
627
|
+
if (reactPage.deepEqual(newSnippets, oldSnippets))
|
|
661
628
|
return;
|
|
662
629
|
setSnippets(cachedPage.snippets);
|
|
663
630
|
}, [cachedPage]);
|
|
@@ -1121,12 +1088,19 @@ Received "${apiKey}" instead.`);
|
|
|
1121
1088
|
preview: previewOverride = false,
|
|
1122
1089
|
unstable_locale
|
|
1123
1090
|
} = {}) {
|
|
1124
|
-
var _a;
|
|
1091
|
+
var _a, _b;
|
|
1125
1092
|
const isUsingVersioning = this.siteVersion != null;
|
|
1126
1093
|
const siteVersion = (_a = this.siteVersion) != null ? _a : previewOverride ? MakeswiftSiteVersion.Working : MakeswiftSiteVersion.Live;
|
|
1094
|
+
const defaultLocale = (_b = reactPage.getDefaultLocale(this.runtime.store.getState())) == null ? void 0 : _b.toString();
|
|
1095
|
+
const locale = unstable_locale === defaultLocale ? null : unstable_locale;
|
|
1127
1096
|
const searchParams = new URLSearchParams();
|
|
1128
|
-
if (
|
|
1129
|
-
|
|
1097
|
+
if (locale) {
|
|
1098
|
+
const locales = reactPage.getLocales(this.runtime.store.getState()).map((locale2) => locale2.toString());
|
|
1099
|
+
if (!locales.includes(locale)) {
|
|
1100
|
+
throw new Error(`Locale "${locale}" is not included in the locales: ${locales}. Please add the locale to the locales on the ReactRuntime.`);
|
|
1101
|
+
}
|
|
1102
|
+
searchParams.set("locale", locale);
|
|
1103
|
+
}
|
|
1130
1104
|
const response = await this.fetch(`/${isUsingVersioning ? "v3" : "v2"}/pages/${encodeURIComponent(pathname)}/document?${searchParams.toString()}`, {
|
|
1131
1105
|
headers: { "Makeswift-Site-Version": siteVersion }
|
|
1132
1106
|
});
|
|
@@ -1137,7 +1111,7 @@ Received "${apiKey}" instead.`);
|
|
|
1137
1111
|
throw new Error(`Failed to get page snapshot with error: "${response.statusText}"`);
|
|
1138
1112
|
}
|
|
1139
1113
|
const document2 = await response.json();
|
|
1140
|
-
const { cacheData, localizedResourcesMap } = await this.introspect(document2.data, previewOverride,
|
|
1114
|
+
const { cacheData, localizedResourcesMap } = await this.introspect(document2.data, previewOverride, locale != null ? locale : void 0);
|
|
1141
1115
|
const apiOrigin = this.apiOrigin.href;
|
|
1142
1116
|
const preview = siteVersion === MakeswiftSiteVersion.Working;
|
|
1143
1117
|
return {
|
|
@@ -1146,7 +1120,7 @@ Received "${apiKey}" instead.`);
|
|
|
1146
1120
|
apiOrigin,
|
|
1147
1121
|
preview,
|
|
1148
1122
|
localizedResourcesMap,
|
|
1149
|
-
locale:
|
|
1123
|
+
locale: locale != null ? locale : null
|
|
1150
1124
|
};
|
|
1151
1125
|
}
|
|
1152
1126
|
async getSwatch(swatchId) {
|
|
@@ -1240,7 +1214,7 @@ async function fonts(_req, res, { getFonts } = {}) {
|
|
|
1240
1214
|
const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
|
|
1241
1215
|
return res.json(fonts2);
|
|
1242
1216
|
}
|
|
1243
|
-
const version = "0.
|
|
1217
|
+
const version = "0.10.1";
|
|
1244
1218
|
async function handler(req, res, { apiKey, unstable_siteVersions }) {
|
|
1245
1219
|
if (req.query.secret !== apiKey) {
|
|
1246
1220
|
return res.status(401).json({ message: "Unauthorized" });
|
|
@@ -1380,7 +1354,7 @@ Read more about dynamic catch-all routes here: https://nextjs.org/docs/routing/d
|
|
|
1380
1354
|
return client.getGlobalElement(m.params.id).then(handleResource);
|
|
1381
1355
|
}
|
|
1382
1356
|
if (m = matches("/localized-global-elements/:globalElementId/:locale")) {
|
|
1383
|
-
return client.getLocalizedGlobalElement(m.params.globalElementId, m.params.locale).then(
|
|
1357
|
+
return client.getLocalizedGlobalElement(m.params.globalElementId, m.params.locale).then((resource) => resource === null ? res.json({ message: "Not Found" }) : res.json(resource));
|
|
1384
1358
|
}
|
|
1385
1359
|
if (m = matches("/page-pathname-slices/:id")) {
|
|
1386
1360
|
return client.getPagePathnameSlice(m.params.id).then(handleResource);
|
|
@@ -1513,7 +1487,8 @@ const Page = React.memo(({
|
|
|
1513
1487
|
const client = React.useMemo(() => new MakeswiftClient({
|
|
1514
1488
|
uri: new URL("graphql", snapshot.apiOrigin).href,
|
|
1515
1489
|
cacheData: snapshot.cacheData,
|
|
1516
|
-
localizedResourcesMap: snapshot.localizedResourcesMap
|
|
1490
|
+
localizedResourcesMap: snapshot.localizedResourcesMap,
|
|
1491
|
+
locale: snapshot.locale ? new Intl.Locale(snapshot.locale) : void 0
|
|
1517
1492
|
}), [snapshot]);
|
|
1518
1493
|
const rootElements = /* @__PURE__ */ new Map([[snapshot.document.id, snapshot.document.data]]);
|
|
1519
1494
|
snapshot.document.localizedPages.forEach((localizedPage) => {
|
|
@@ -2416,6 +2391,211 @@ function registerComponent$2(runtime) {
|
|
|
2416
2391
|
}
|
|
2417
2392
|
});
|
|
2418
2393
|
}
|
|
2394
|
+
function useSwatch(swatchId) {
|
|
2395
|
+
const client = useMakeswiftClient();
|
|
2396
|
+
const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
|
|
2397
|
+
const swatch = shim.useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
|
|
2398
|
+
React.useEffect(() => {
|
|
2399
|
+
if (swatchId != null)
|
|
2400
|
+
client.fetchSwatch(swatchId).catch(console.error);
|
|
2401
|
+
}, [client, swatchId]);
|
|
2402
|
+
return swatch;
|
|
2403
|
+
}
|
|
2404
|
+
function useSwatches(swatchIds) {
|
|
2405
|
+
const client = useMakeswiftClient();
|
|
2406
|
+
const lastSnapshot = React.useRef();
|
|
2407
|
+
function getSnapshot() {
|
|
2408
|
+
const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
|
|
2409
|
+
if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
|
|
2410
|
+
return lastSnapshot.current;
|
|
2411
|
+
}
|
|
2412
|
+
return lastSnapshot.current = swatches2;
|
|
2413
|
+
}
|
|
2414
|
+
const swatches = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2415
|
+
React.useEffect(() => {
|
|
2416
|
+
Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
|
|
2417
|
+
}, [client, swatchIds]);
|
|
2418
|
+
return swatches;
|
|
2419
|
+
}
|
|
2420
|
+
function useFile(fileId) {
|
|
2421
|
+
const client = useMakeswiftClient();
|
|
2422
|
+
const readFile = () => fileId == null ? null : client.readFile(fileId);
|
|
2423
|
+
const file = shim.useSyncExternalStore(client.subscribe, readFile, readFile);
|
|
2424
|
+
React.useEffect(() => {
|
|
2425
|
+
if (fileId != null)
|
|
2426
|
+
client.fetchFile(fileId);
|
|
2427
|
+
}, [client, fileId]);
|
|
2428
|
+
return file;
|
|
2429
|
+
}
|
|
2430
|
+
function useFiles(fileIds) {
|
|
2431
|
+
const client = useMakeswiftClient();
|
|
2432
|
+
const lastSnapshot = React.useRef();
|
|
2433
|
+
function getSnapshot() {
|
|
2434
|
+
const files2 = fileIds.map((fileId) => client.readFile(fileId));
|
|
2435
|
+
if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
|
|
2436
|
+
return lastSnapshot.current;
|
|
2437
|
+
}
|
|
2438
|
+
return lastSnapshot.current = files2;
|
|
2439
|
+
}
|
|
2440
|
+
const files = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2441
|
+
React.useEffect(() => {
|
|
2442
|
+
Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
|
|
2443
|
+
}, [client, fileIds]);
|
|
2444
|
+
return files;
|
|
2445
|
+
}
|
|
2446
|
+
function useTypography(typographyId) {
|
|
2447
|
+
const client = useMakeswiftClient();
|
|
2448
|
+
const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
|
|
2449
|
+
const typography = shim.useSyncExternalStore(client.subscribe, readTypography, readTypography);
|
|
2450
|
+
React.useEffect(() => {
|
|
2451
|
+
if (typographyId != null)
|
|
2452
|
+
client.fetchTypography(typographyId).catch(console.error);
|
|
2453
|
+
}, [client, typographyId]);
|
|
2454
|
+
return typography;
|
|
2455
|
+
}
|
|
2456
|
+
function useGlobalElement(globalElementId) {
|
|
2457
|
+
const client = useMakeswiftClient();
|
|
2458
|
+
const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
|
|
2459
|
+
const globalElement = shim.useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
|
|
2460
|
+
React.useEffect(() => {
|
|
2461
|
+
if (globalElementId != null)
|
|
2462
|
+
client.fetchGlobalElement(globalElementId).catch(console.error);
|
|
2463
|
+
}, [client, globalElementId]);
|
|
2464
|
+
return globalElement;
|
|
2465
|
+
}
|
|
2466
|
+
function useLocalizedGlobalElement(globalElementId) {
|
|
2467
|
+
const client = useMakeswiftClient();
|
|
2468
|
+
const readLocalizedGlobalElement = () => globalElementId == null ? null : client.readLocalizedGlobalElement(globalElementId);
|
|
2469
|
+
const localizedGlobalElement = shim.useSyncExternalStore(client.subscribe, readLocalizedGlobalElement, readLocalizedGlobalElement);
|
|
2470
|
+
React.useEffect(() => {
|
|
2471
|
+
if (globalElementId != null) {
|
|
2472
|
+
client.fetchLocalizedGlobalElement(globalElementId).catch(console.error);
|
|
2473
|
+
}
|
|
2474
|
+
}, [client, globalElementId]);
|
|
2475
|
+
return localizedGlobalElement;
|
|
2476
|
+
}
|
|
2477
|
+
function usePagePathnameSlice(pageId) {
|
|
2478
|
+
const client = useMakeswiftClient();
|
|
2479
|
+
const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
|
|
2480
|
+
const pagePathnameSlice = shim.useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
|
|
2481
|
+
React.useEffect(() => {
|
|
2482
|
+
if (pageId != null)
|
|
2483
|
+
client.fetchPagePathnameSlice(pageId).catch(console.error);
|
|
2484
|
+
}, [client, pageId]);
|
|
2485
|
+
return pagePathnameSlice;
|
|
2486
|
+
}
|
|
2487
|
+
function useTable(tableId) {
|
|
2488
|
+
const client = useMakeswiftClient();
|
|
2489
|
+
const readTable = () => tableId == null ? null : client.readTable(tableId);
|
|
2490
|
+
const table = shim.useSyncExternalStore(client.subscribe, readTable, readTable);
|
|
2491
|
+
React.useEffect(() => {
|
|
2492
|
+
if (tableId != null)
|
|
2493
|
+
client.fetchTable(tableId).catch(console.error);
|
|
2494
|
+
}, [client, tableId]);
|
|
2495
|
+
return table;
|
|
2496
|
+
}
|
|
2497
|
+
const Link = React.forwardRef(function Link2(_e, ref) {
|
|
2498
|
+
var _f = _e, {
|
|
2499
|
+
link,
|
|
2500
|
+
onClick = () => {
|
|
2501
|
+
}
|
|
2502
|
+
} = _f, restOfProps = __objRest(_f, [
|
|
2503
|
+
"link",
|
|
2504
|
+
"onClick"
|
|
2505
|
+
]);
|
|
2506
|
+
var _a;
|
|
2507
|
+
const pageId = link && link.type === "OPEN_PAGE" ? link.payload.pageId : null;
|
|
2508
|
+
const page = usePagePathnameSlice(pageId != null ? pageId : null);
|
|
2509
|
+
const elementKey = (link == null ? void 0 : link.type) === "SCROLL_TO_ELEMENT" ? (_a = link.payload.elementIdConfig) == null ? void 0 : _a.elementKey : null;
|
|
2510
|
+
const elementId = useElementId(elementKey);
|
|
2511
|
+
let useNextLink;
|
|
2512
|
+
let href;
|
|
2513
|
+
let target;
|
|
2514
|
+
let block;
|
|
2515
|
+
if (link) {
|
|
2516
|
+
switch (link.type) {
|
|
2517
|
+
case "OPEN_PAGE": {
|
|
2518
|
+
if (page) {
|
|
2519
|
+
useNextLink = true;
|
|
2520
|
+
href = `/${page.pathname}`;
|
|
2521
|
+
}
|
|
2522
|
+
target = link.payload.openInNewTab ? "_blank" : "_self";
|
|
2523
|
+
break;
|
|
2524
|
+
}
|
|
2525
|
+
case "OPEN_URL": {
|
|
2526
|
+
useNextLink = true;
|
|
2527
|
+
href = link.payload.url;
|
|
2528
|
+
target = link.payload.openInNewTab ? "_blank" : "_self";
|
|
2529
|
+
break;
|
|
2530
|
+
}
|
|
2531
|
+
case "SEND_EMAIL": {
|
|
2532
|
+
useNextLink = false;
|
|
2533
|
+
const {
|
|
2534
|
+
to,
|
|
2535
|
+
subject = "",
|
|
2536
|
+
body = ""
|
|
2537
|
+
} = link.payload;
|
|
2538
|
+
if (to != null)
|
|
2539
|
+
href = `mailto:${to}?subject=${subject}&body=${body}`;
|
|
2540
|
+
break;
|
|
2541
|
+
}
|
|
2542
|
+
case "CALL_PHONE": {
|
|
2543
|
+
useNextLink = false;
|
|
2544
|
+
href = `tel:${link.payload.phoneNumber}`;
|
|
2545
|
+
break;
|
|
2546
|
+
}
|
|
2547
|
+
case "SCROLL_TO_ELEMENT": {
|
|
2548
|
+
useNextLink = false;
|
|
2549
|
+
href = `#${elementId != null ? elementId : ""}`;
|
|
2550
|
+
block = link.payload.block;
|
|
2551
|
+
break;
|
|
2552
|
+
}
|
|
2553
|
+
default:
|
|
2554
|
+
throw new RangeError(`Invalid link type "${link.type}."`);
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
function handleClick(event) {
|
|
2558
|
+
onClick(event);
|
|
2559
|
+
if (event.defaultPrevented)
|
|
2560
|
+
return;
|
|
2561
|
+
if (event.currentTarget.isContentEditable)
|
|
2562
|
+
return event.preventDefault();
|
|
2563
|
+
if (link && link.type === "SCROLL_TO_ELEMENT") {
|
|
2564
|
+
let hash;
|
|
2565
|
+
try {
|
|
2566
|
+
if (href != null)
|
|
2567
|
+
hash = new URL(`http://www.example.com/${href}`).hash;
|
|
2568
|
+
} catch (error) {
|
|
2569
|
+
console.error(`Link received invalid href: ${href}`, error);
|
|
2570
|
+
}
|
|
2571
|
+
if (href != null && hash != null && href === hash) {
|
|
2572
|
+
event.preventDefault();
|
|
2573
|
+
const view = event.view;
|
|
2574
|
+
scrollIntoView__default["default"](view.document.querySelector(hash), {
|
|
2575
|
+
behavior: "smooth",
|
|
2576
|
+
block
|
|
2577
|
+
});
|
|
2578
|
+
if (view.location.hash !== hash)
|
|
2579
|
+
view.history.pushState({}, "", hash);
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
if (useNextLink && href != null) {
|
|
2584
|
+
return /* @__PURE__ */ jsxRuntime.jsx(NextLink__default["default"], __spreadProps(__spreadValues({}, restOfProps), {
|
|
2585
|
+
ref,
|
|
2586
|
+
target,
|
|
2587
|
+
onClick: handleClick,
|
|
2588
|
+
href,
|
|
2589
|
+
legacyBehavior: false
|
|
2590
|
+
}));
|
|
2591
|
+
}
|
|
2592
|
+
return /* @__PURE__ */ jsxRuntime.jsx("a", __spreadProps(__spreadValues({}, restOfProps), {
|
|
2593
|
+
ref,
|
|
2594
|
+
href,
|
|
2595
|
+
target,
|
|
2596
|
+
onClick: handleClick
|
|
2597
|
+
}));
|
|
2598
|
+
});
|
|
2419
2599
|
function registerComponent$1(runtime) {
|
|
2420
2600
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
2421
2601
|
return require("./Text.cjs.js");
|
|
@@ -2424,52 +2604,36 @@ function registerComponent$1(runtime) {
|
|
|
2424
2604
|
label: "Text",
|
|
2425
2605
|
props: {
|
|
2426
2606
|
id: reactPage.ElementID(),
|
|
2427
|
-
text: reactPage.RichText(
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2607
|
+
text: reactPage.RichText({
|
|
2608
|
+
unstable_defaultValue: [
|
|
2609
|
+
{
|
|
2610
|
+
type: reactPage.BlockType.Default,
|
|
2611
|
+
children: [
|
|
2432
2612
|
{
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2613
|
+
text: ipsum__default["default"](3),
|
|
2614
|
+
typography: {
|
|
2615
|
+
style: [
|
|
2616
|
+
{
|
|
2617
|
+
deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2618
|
+
value: {
|
|
2619
|
+
fontWeight: 400,
|
|
2620
|
+
fontSize: { value: 18, unit: "px" },
|
|
2621
|
+
lineHeight: 1.5
|
|
2622
|
+
}
|
|
2623
|
+
},
|
|
2624
|
+
...runtime.getBreakpoints().some(({ id }) => id === state_breakpoints.DefaultBreakpointID.Mobile) ? [
|
|
2440
2625
|
{
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
data: {
|
|
2444
|
-
value: {
|
|
2445
|
-
id: null,
|
|
2446
|
-
style: [
|
|
2447
|
-
{
|
|
2448
|
-
deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2449
|
-
value: {
|
|
2450
|
-
fontWeight: 400,
|
|
2451
|
-
fontSize: { value: 18, unit: "px" },
|
|
2452
|
-
lineHeight: 1.5
|
|
2453
|
-
}
|
|
2454
|
-
},
|
|
2455
|
-
...runtime.getBreakpoints().some(({ id }) => id === state_breakpoints.DefaultBreakpointID.Mobile) ? [
|
|
2456
|
-
{
|
|
2457
|
-
deviceId: state_breakpoints.DefaultBreakpointID.Mobile,
|
|
2458
|
-
value: { fontSize: { value: 16, unit: "px" } }
|
|
2459
|
-
}
|
|
2460
|
-
] : []
|
|
2461
|
-
]
|
|
2462
|
-
}
|
|
2463
|
-
}
|
|
2626
|
+
deviceId: state_breakpoints.DefaultBreakpointID.Mobile,
|
|
2627
|
+
value: { fontSize: { value: 16, unit: "px" } }
|
|
2464
2628
|
}
|
|
2465
|
-
]
|
|
2466
|
-
|
|
2467
|
-
|
|
2629
|
+
] : []
|
|
2630
|
+
]
|
|
2631
|
+
}
|
|
2468
2632
|
}
|
|
2469
2633
|
]
|
|
2470
2634
|
}
|
|
2471
|
-
|
|
2472
|
-
})
|
|
2635
|
+
]
|
|
2636
|
+
}),
|
|
2473
2637
|
width: reactPage.Width({
|
|
2474
2638
|
format: reactPage.Width.Format.ClassName,
|
|
2475
2639
|
preset: [
|
|
@@ -2600,111 +2764,8 @@ const FallbackComponent = React.forwardRef(function FallbackComponent2({
|
|
|
2600
2764
|
function isNonNullable(value) {
|
|
2601
2765
|
return value != null;
|
|
2602
2766
|
}
|
|
2603
|
-
function
|
|
2604
|
-
|
|
2605
|
-
const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
|
|
2606
|
-
const swatch = shim.useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
|
|
2607
|
-
React.useEffect(() => {
|
|
2608
|
-
if (swatchId != null)
|
|
2609
|
-
client.fetchSwatch(swatchId).catch(console.error);
|
|
2610
|
-
}, [client, swatchId]);
|
|
2611
|
-
return swatch;
|
|
2612
|
-
}
|
|
2613
|
-
function useSwatches(swatchIds) {
|
|
2614
|
-
const client = useMakeswiftClient();
|
|
2615
|
-
const lastSnapshot = React.useRef();
|
|
2616
|
-
function getSnapshot() {
|
|
2617
|
-
const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
|
|
2618
|
-
if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
|
|
2619
|
-
return lastSnapshot.current;
|
|
2620
|
-
}
|
|
2621
|
-
return lastSnapshot.current = swatches2;
|
|
2622
|
-
}
|
|
2623
|
-
const swatches = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2624
|
-
React.useEffect(() => {
|
|
2625
|
-
Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
|
|
2626
|
-
}, [client, swatchIds]);
|
|
2627
|
-
return swatches;
|
|
2628
|
-
}
|
|
2629
|
-
function useFile(fileId) {
|
|
2630
|
-
const client = useMakeswiftClient();
|
|
2631
|
-
const readFile = () => fileId == null ? null : client.readFile(fileId);
|
|
2632
|
-
const file = shim.useSyncExternalStore(client.subscribe, readFile, readFile);
|
|
2633
|
-
React.useEffect(() => {
|
|
2634
|
-
if (fileId != null)
|
|
2635
|
-
client.fetchFile(fileId);
|
|
2636
|
-
}, [client, fileId]);
|
|
2637
|
-
return file;
|
|
2638
|
-
}
|
|
2639
|
-
function useFiles(fileIds) {
|
|
2640
|
-
const client = useMakeswiftClient();
|
|
2641
|
-
const lastSnapshot = React.useRef();
|
|
2642
|
-
function getSnapshot() {
|
|
2643
|
-
const files2 = fileIds.map((fileId) => client.readFile(fileId));
|
|
2644
|
-
if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
|
|
2645
|
-
return lastSnapshot.current;
|
|
2646
|
-
}
|
|
2647
|
-
return lastSnapshot.current = files2;
|
|
2648
|
-
}
|
|
2649
|
-
const files = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2650
|
-
React.useEffect(() => {
|
|
2651
|
-
Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
|
|
2652
|
-
}, [client, fileIds]);
|
|
2653
|
-
return files;
|
|
2654
|
-
}
|
|
2655
|
-
function useTypography(typographyId) {
|
|
2656
|
-
const client = useMakeswiftClient();
|
|
2657
|
-
const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
|
|
2658
|
-
const typography = shim.useSyncExternalStore(client.subscribe, readTypography, readTypography);
|
|
2659
|
-
React.useEffect(() => {
|
|
2660
|
-
if (typographyId != null)
|
|
2661
|
-
client.fetchTypography(typographyId).catch(console.error);
|
|
2662
|
-
}, [client, typographyId]);
|
|
2663
|
-
return typography;
|
|
2664
|
-
}
|
|
2665
|
-
function useGlobalElement(globalElementId) {
|
|
2666
|
-
const client = useMakeswiftClient();
|
|
2667
|
-
const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
|
|
2668
|
-
const globalElement = shim.useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
|
|
2669
|
-
React.useEffect(() => {
|
|
2670
|
-
if (globalElementId != null)
|
|
2671
|
-
client.fetchGlobalElement(globalElementId).catch(console.error);
|
|
2672
|
-
}, [client, globalElementId]);
|
|
2673
|
-
return globalElement;
|
|
2674
|
-
}
|
|
2675
|
-
function useLocalizedGlobalElement(globalElementId) {
|
|
2676
|
-
const client = useMakeswiftClient();
|
|
2677
|
-
const readLocalizedGlobalElement = () => globalElementId == null ? null : client.readLocalizedGlobalElement(globalElementId);
|
|
2678
|
-
const localizedGlobalElement = shim.useSyncExternalStore(client.subscribe, readLocalizedGlobalElement, readLocalizedGlobalElement);
|
|
2679
|
-
React.useEffect(() => {
|
|
2680
|
-
if (globalElementId != null) {
|
|
2681
|
-
client.fetchLocalizedGlobalElement(globalElementId).catch(console.error);
|
|
2682
|
-
}
|
|
2683
|
-
}, [client, globalElementId]);
|
|
2684
|
-
return localizedGlobalElement;
|
|
2685
|
-
}
|
|
2686
|
-
function usePagePathnameSlice(pageId) {
|
|
2687
|
-
const client = useMakeswiftClient();
|
|
2688
|
-
const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
|
|
2689
|
-
const pagePathnameSlice = shim.useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
|
|
2690
|
-
React.useEffect(() => {
|
|
2691
|
-
if (pageId != null)
|
|
2692
|
-
client.fetchPagePathnameSlice(pageId).catch(console.error);
|
|
2693
|
-
}, [client, pageId]);
|
|
2694
|
-
return pagePathnameSlice;
|
|
2695
|
-
}
|
|
2696
|
-
function useTable(tableId) {
|
|
2697
|
-
const client = useMakeswiftClient();
|
|
2698
|
-
const readTable = () => tableId == null ? null : client.readTable(tableId);
|
|
2699
|
-
const table = shim.useSyncExternalStore(client.subscribe, readTable, readTable);
|
|
2700
|
-
React.useEffect(() => {
|
|
2701
|
-
if (tableId != null)
|
|
2702
|
-
client.fetchTable(tableId).catch(console.error);
|
|
2703
|
-
}, [client, tableId]);
|
|
2704
|
-
return table;
|
|
2705
|
-
}
|
|
2706
|
-
function mapSideColor(swatches, _e) {
|
|
2707
|
-
var _f = _e, { color } = _f, restOfSide = __objRest(_f, ["color"]);
|
|
2767
|
+
function mapSideColor(swatches, _g) {
|
|
2768
|
+
var _h = _g, { color } = _h, restOfSide = __objRest(_h, ["color"]);
|
|
2708
2769
|
return __spreadProps(__spreadValues({}, restOfSide), {
|
|
2709
2770
|
color: color && {
|
|
2710
2771
|
alpha: color.alpha,
|
|
@@ -3084,7 +3145,7 @@ function useFormattedStyle(styleControlData, controlDefinition, control) {
|
|
|
3084
3145
|
return;
|
|
3085
3146
|
const element = document.querySelector(`.${guid}`);
|
|
3086
3147
|
const measuredBoxModel = element == null ? null : boxModels.getBox(element);
|
|
3087
|
-
if (!deepEqual(currentBoxModel, measuredBoxModel)) {
|
|
3148
|
+
if (!reactPage.deepEqual(currentBoxModel, measuredBoxModel)) {
|
|
3088
3149
|
currentBoxModel = measuredBoxModel;
|
|
3089
3150
|
control.changeBoxModel(currentBoxModel);
|
|
3090
3151
|
}
|
|
@@ -3236,8 +3297,11 @@ function ListControlValue({
|
|
|
3236
3297
|
function useNumber(numberControlData, controlDefinition) {
|
|
3237
3298
|
return numberControlData != null ? numberControlData : controlDefinition.config.defaultValue;
|
|
3238
3299
|
}
|
|
3239
|
-
const
|
|
3240
|
-
return require("./index.
|
|
3300
|
+
const EditableText$1 = forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
3301
|
+
return require("./index.cjs7.js");
|
|
3302
|
+
}))));
|
|
3303
|
+
const ReadOnlyText$1 = forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
3304
|
+
return require("./ReadOnlyText.cjs.js");
|
|
3241
3305
|
}))));
|
|
3242
3306
|
function useRichText(data, control) {
|
|
3243
3307
|
const textCallbackRef = React.useCallback((handle) => {
|
|
@@ -3247,13 +3311,17 @@ function useRichText(data, control) {
|
|
|
3247
3311
|
text: control
|
|
3248
3312
|
});
|
|
3249
3313
|
}, [control]);
|
|
3250
|
-
|
|
3314
|
+
const isPreview = useIsPreview();
|
|
3315
|
+
return isPreview ? /* @__PURE__ */ jsxRuntime.jsx(EditableText$1, {
|
|
3316
|
+
text: data,
|
|
3317
|
+
ref: textCallbackRef
|
|
3318
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(ReadOnlyText$1, {
|
|
3251
3319
|
text: data,
|
|
3252
3320
|
ref: textCallbackRef
|
|
3253
3321
|
});
|
|
3254
3322
|
}
|
|
3255
3323
|
const EditableText = forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
3256
|
-
return require("./index.
|
|
3324
|
+
return require("./index.cjs8.js");
|
|
3257
3325
|
}))));
|
|
3258
3326
|
const ReadOnlyText = forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
3259
3327
|
return require("./ReadOnlyTextV2.cjs.js");
|
|
@@ -3302,7 +3370,7 @@ function pollBoxModel({
|
|
|
3302
3370
|
let currentBoxModel = null;
|
|
3303
3371
|
const handleAnimationFrameRequest = () => {
|
|
3304
3372
|
const measuredBoxModel = boxModels.getBox(element);
|
|
3305
|
-
if (!deepEqual(currentBoxModel, measuredBoxModel)) {
|
|
3373
|
+
if (!reactPage.deepEqual(currentBoxModel, measuredBoxModel)) {
|
|
3306
3374
|
currentBoxModel = measuredBoxModel;
|
|
3307
3375
|
onBoxModelChange(currentBoxModel);
|
|
3308
3376
|
}
|
|
@@ -3332,13 +3400,13 @@ function useSlot(data, control) {
|
|
|
3332
3400
|
}, element.key))
|
|
3333
3401
|
});
|
|
3334
3402
|
}
|
|
3335
|
-
function Slot(
|
|
3336
|
-
var
|
|
3403
|
+
function Slot(_i) {
|
|
3404
|
+
var _j = _i, {
|
|
3337
3405
|
as,
|
|
3338
3406
|
control,
|
|
3339
3407
|
children,
|
|
3340
3408
|
className
|
|
3341
|
-
} =
|
|
3409
|
+
} = _j, restOfProps = __objRest(_j, [
|
|
3342
3410
|
"as",
|
|
3343
3411
|
"control",
|
|
3344
3412
|
"children",
|
|
@@ -3367,15 +3435,15 @@ function Slot(_g) {
|
|
|
3367
3435
|
}
|
|
3368
3436
|
Slot.Placeholder = SlotPlaceholder;
|
|
3369
3437
|
Slot.Item = SlotItem;
|
|
3370
|
-
function SlotItem(
|
|
3371
|
-
var
|
|
3438
|
+
function SlotItem(_k) {
|
|
3439
|
+
var _l = _k, {
|
|
3372
3440
|
as,
|
|
3373
3441
|
control,
|
|
3374
3442
|
grid,
|
|
3375
3443
|
index,
|
|
3376
3444
|
children,
|
|
3377
3445
|
className
|
|
3378
|
-
} =
|
|
3446
|
+
} = _l, restOfProps = __objRest(_l, [
|
|
3379
3447
|
"as",
|
|
3380
3448
|
"control",
|
|
3381
3449
|
"grid",
|
|
@@ -3660,7 +3728,7 @@ function ControlValue({
|
|
|
3660
3728
|
parameters: [data, definition],
|
|
3661
3729
|
children: (value) => children(value)
|
|
3662
3730
|
}, definition.type);
|
|
3663
|
-
case
|
|
3731
|
+
case reactPage.SelectControlType:
|
|
3664
3732
|
return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
|
|
3665
3733
|
hook: useSelectControlValue,
|
|
3666
3734
|
parameters: [data, definition],
|
|
@@ -3672,7 +3740,7 @@ function ControlValue({
|
|
|
3672
3740
|
parameters: [data, definition],
|
|
3673
3741
|
children: (value) => children(value)
|
|
3674
3742
|
}, definition.type);
|
|
3675
|
-
case
|
|
3743
|
+
case reactPage.IconRadioGroupControlType:
|
|
3676
3744
|
return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
|
|
3677
3745
|
hook: useIconRadioGroupValue,
|
|
3678
3746
|
parameters: [data, definition],
|
|
@@ -3792,9 +3860,9 @@ function PropsValue({
|
|
|
3792
3860
|
case textInput.NumberControlType:
|
|
3793
3861
|
case textInput.TextInputControlType:
|
|
3794
3862
|
case textInput.TextAreaControlType:
|
|
3795
|
-
case
|
|
3863
|
+
case reactPage.SelectControlType:
|
|
3796
3864
|
case reactPage.ColorControlType:
|
|
3797
|
-
case
|
|
3865
|
+
case reactPage.IconRadioGroupControlType:
|
|
3798
3866
|
case reactPage.ImageControlType:
|
|
3799
3867
|
case combobox.ComboboxControlType:
|
|
3800
3868
|
case reactPage.ShapeControlType:
|
|
@@ -4093,10 +4161,10 @@ const PreviewProvider = dynamic__default["default"](() => Promise.resolve().then
|
|
|
4093
4161
|
const LiveProvider = dynamic__default["default"](() => Promise.resolve().then(function() {
|
|
4094
4162
|
return require("./LiveProvider.cjs.js");
|
|
4095
4163
|
}));
|
|
4096
|
-
function RuntimeProvider(
|
|
4097
|
-
var
|
|
4164
|
+
function RuntimeProvider(_m) {
|
|
4165
|
+
var _n = _m, {
|
|
4098
4166
|
preview
|
|
4099
|
-
} =
|
|
4167
|
+
} = _n, props = __objRest(_n, [
|
|
4100
4168
|
"preview"
|
|
4101
4169
|
]);
|
|
4102
4170
|
return preview ? /* @__PURE__ */ jsxRuntime.jsx(PreviewProvider, __spreadValues({}, props)) : /* @__PURE__ */ jsxRuntime.jsx(LiveProvider, __spreadValues({}, props));
|
|
@@ -4313,6 +4381,7 @@ exports.Document = Document$1;
|
|
|
4313
4381
|
exports.DocumentReference = DocumentReference;
|
|
4314
4382
|
exports.Element = Element$1;
|
|
4315
4383
|
exports.ElementImperativeHandle = ElementImperativeHandle;
|
|
4384
|
+
exports.Link = Link;
|
|
4316
4385
|
exports.Makeswift = Makeswift;
|
|
4317
4386
|
exports.MakeswiftApiHandler = MakeswiftApiHandler;
|
|
4318
4387
|
exports.MakeswiftProvider = MakeswiftProvider;
|
|
@@ -4327,28 +4396,23 @@ exports.Shapes = Shapes;
|
|
|
4327
4396
|
exports.Sizes = Sizes;
|
|
4328
4397
|
exports.StoreContext = StoreContext;
|
|
4329
4398
|
exports.colorToString = colorToString;
|
|
4330
|
-
exports.deepEqual = deepEqual;
|
|
4331
4399
|
exports.forwardNextDynamicRef = forwardNextDynamicRef;
|
|
4332
4400
|
exports.getServerSideProps = getServerSideProps;
|
|
4333
4401
|
exports.getStaticPaths = getStaticPaths;
|
|
4334
4402
|
exports.getStaticProps = getStaticProps;
|
|
4335
4403
|
exports.isNonNullable = isNonNullable;
|
|
4336
4404
|
exports.pollBoxModel = pollBoxModel;
|
|
4337
|
-
exports.shallowEqual = shallowEqual;
|
|
4338
4405
|
exports.useBorder = useBorder;
|
|
4339
4406
|
exports.useBoxShadow = useBoxShadow;
|
|
4340
4407
|
exports.useBreakpoints = useBreakpoints;
|
|
4341
4408
|
exports.useBuilderEditMode = useBuilderEditMode;
|
|
4342
|
-
exports.useElementId = useElementId;
|
|
4343
4409
|
exports.useEnhancedTypography = useEnhancedTypography;
|
|
4344
4410
|
exports.useFile = useFile;
|
|
4345
4411
|
exports.useFiles = useFiles;
|
|
4346
4412
|
exports.useFormContext = useFormContext;
|
|
4347
4413
|
exports.useIsInBuilder = useIsInBuilder;
|
|
4348
|
-
exports.useIsPreview = useIsPreview;
|
|
4349
4414
|
exports.useMakeswiftClient = useMakeswiftClient;
|
|
4350
4415
|
exports.usePageId = usePageId;
|
|
4351
|
-
exports.usePagePathnameSlice = usePagePathnameSlice;
|
|
4352
4416
|
exports.useResponsiveColor = useResponsiveColor;
|
|
4353
4417
|
exports.useResponsiveGridItem = useResponsiveGridItem;
|
|
4354
4418
|
exports.useResponsiveStyle = useResponsiveStyle;
|