@makeswift/runtime 0.10.16 → 0.11.0
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.es.js +1 -1
- package/dist/Button.es.js +1 -1
- package/dist/Carousel.es.js +1 -1
- package/dist/Countdown.es.js +1 -1
- package/dist/Divider.es.js +1 -1
- package/dist/Embed.es.js +1 -1
- package/dist/Form.es.js +1 -1
- package/dist/Image.es.js +1 -1
- package/dist/LiveProvider.es.js +1 -1
- package/dist/Navigation.es.js +1 -1
- package/dist/PreviewProvider.cjs.js +8 -11
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +10 -13
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.es.js +1 -1
- package/dist/ReadOnlyTextV2.es.js +1 -1
- package/dist/Root.es.js +1 -1
- package/dist/SocialLinks.es.js +1 -1
- package/dist/Video.es.js +1 -1
- package/dist/actions.cjs.js +8 -14
- package/dist/actions.cjs.js.map +1 -1
- package/dist/actions.es.js +8 -12
- package/dist/actions.es.js.map +1 -1
- package/dist/control-serialization.es.js +1 -1
- package/dist/controls.es.js +1 -1
- package/dist/index.cjs.js +18 -19
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +20 -21
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js +1 -1
- package/dist/index.es4.js +1 -1
- package/dist/index.es5.js +1 -1
- package/dist/index.es6.js +1 -1
- package/dist/index.es8.js +1 -1
- package/dist/index.es9.js +1 -1
- package/dist/main.cjs.js +1 -1
- package/dist/main.es.js +1 -1
- package/dist/react-page.cjs.js +38 -92
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +31 -81
- package/dist/react-page.es.js.map +1 -1
- package/dist/slate.es.js +1 -1
- package/dist/toText.es.js +1 -1
- package/dist/types/src/api/react.d.ts +4 -1
- package/dist/types/src/api/react.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/next/client.d.ts +3 -2
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/index.d.ts +1 -3
- package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
- package/dist/types/src/state/actions.d.ts +10 -14
- package/dist/types/src/state/actions.d.ts.map +1 -1
- package/dist/types/src/state/react-builder-preview.d.ts +1 -3
- package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
- package/dist/types/src/state/react-page.d.ts +1 -7
- package/dist/types/src/state/react-page.d.ts.map +1 -1
- package/dist/types/types/locale.d.ts +1 -1
- package/package.json +1 -1
- package/dist/types/src/state/modules/locales.d.ts +0 -15
- package/dist/types/src/state/modules/locales.d.ts.map +0 -1
package/dist/index.es.js
CHANGED
|
@@ -38,8 +38,8 @@ import * as React from "react";
|
|
|
38
38
|
import { useEffect, createContext, useContext, useState, useMemo, useRef, Children, createElement, forwardRef, memo, useId, useCallback, useImperativeHandle, Component, Suspense } from "react";
|
|
39
39
|
import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector";
|
|
40
40
|
import dynamic from "next/dynamic";
|
|
41
|
-
import { f as deepEqual, g as createDocumentReference, h as getPropControllerDescriptors, j as isElementReference, k as
|
|
42
|
-
import { A as ActionTypes,
|
|
41
|
+
import { f as deepEqual, g as createDocumentReference, h as getPropControllerDescriptors, j as isElementReference, k as getSwatchIds, l as getFileIds, m as getTypographyIds, n as getTableIds, o as getPageIds, p as getElementChildren, E as ElementID, B as Backgrounds, W as Width, q as ResponsiveIconRadioGroup, M as Margin, P as Padding, r as Border, s as BorderRadius, S as Shadows, G as GapY, t as GapX, u as ResponsiveSelect, v as ResponsiveNumber, w as Checkbox, x as Grid, y as TextInput, L as Link, z as ResponsiveColor, A as TextStyle, C as ComponentIcon, I as Images, N as Number$1, D as Date$1, F as Font, H as ResponsiveLength, J as TextArea, K as Table, O as TableFormFields, Q as Image, U as ResponsiveOpacity, V as NavigationLinks, X as SocialLinks, Y as RichText, Z as Video, _ as useStyle, $ as getBorderSwatchIds, a0 as getBoxShadowsSwatchIds, a1 as getResponsiveColorSwatchIds, a2 as StyleControlProperty, a3 as ImageControlValueFormat, a4 as isPropControllersHandle, a5 as isRichTextV1Data, a6 as isNonNullable$1, a7 as TypographyControlType, a8 as StyleControlType, a9 as RichTextV2ControlType, aa as RichTextControlType, ab as SlotControlType, ac as StyleV2ControlType, ad as ListControlType, ae as ShapeControlType, af as LinkControlType, ag as ImageControlType, ah as IconRadioGroupControlType, ai as ColorControlType, aj as SelectControlType, ak as TextAreaControlType, al as TextInputControlType, am as getComponentPropControllerDescriptors, an as getPropControllers, ao as Types, ap as BorderPropControllerFormat, aq as ShadowsPropControllerFormat, ar as BorderRadiusPropControllerFormat, as as MarginPropControllerFormat, at as PaddingPropControllerFormat, au as WidthPropControllerFormat, av as configureStore$1, aw as copyElementTree, ax as getBreakpoints, ay as getElementTreeTranslatableData, az as getDocument, aA as getElementId, aB as getIsInBuilder, aC as getReactComponent, aD as getBuilderEditMode, aE as getIsPreview } from "./react-page.es.js";
|
|
42
|
+
import { A as ActionTypes, n as apiResourceFulfilled, o as registerComponentEffect, p as registerReactComponentEffect, q as registerComponentHandleEffect, t as mountComponentEffect } from "./actions.es.js";
|
|
43
43
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
44
44
|
import { N as NumberControlType, C as CheckboxControlType } from "./number.es.js";
|
|
45
45
|
import { C as ComboboxControlType } from "./combobox.es.js";
|
|
@@ -410,7 +410,10 @@ class MakeswiftClient {
|
|
|
410
410
|
if (cacheResult)
|
|
411
411
|
return cacheResult;
|
|
412
412
|
const result = await this.makeswiftApiClient.dispatch(fetchAPIResource(APIResourceType.LocalizedGlobalElement, globalElementId, locale));
|
|
413
|
-
this.setLocalizedResourceId(
|
|
413
|
+
this.setLocalizedResourceId({
|
|
414
|
+
resourceId: globalElementId,
|
|
415
|
+
localizedResourceId: (_a = result == null ? void 0 : result.id) != null ? _a : null
|
|
416
|
+
});
|
|
414
417
|
return result;
|
|
415
418
|
}
|
|
416
419
|
readPagePathnameSlice(pageId) {
|
|
@@ -448,7 +451,10 @@ class MakeswiftClient {
|
|
|
448
451
|
var _a;
|
|
449
452
|
return (_a = this.localizedResourcesMap) == null ? void 0 : _a.get(resourceId);
|
|
450
453
|
}
|
|
451
|
-
setLocalizedResourceId(
|
|
454
|
+
setLocalizedResourceId({
|
|
455
|
+
resourceId,
|
|
456
|
+
localizedResourceId
|
|
457
|
+
}) {
|
|
452
458
|
this.localizedResourcesMap.set(resourceId, localizedResourceId);
|
|
453
459
|
}
|
|
454
460
|
}
|
|
@@ -993,19 +999,13 @@ Received "${apiKey}" instead.`);
|
|
|
993
999
|
}
|
|
994
1000
|
async getPageSnapshot(pathname, {
|
|
995
1001
|
preview: previewOverride = false,
|
|
996
|
-
|
|
1002
|
+
locale: localeInput
|
|
997
1003
|
} = {}) {
|
|
998
|
-
var _a, _b
|
|
1004
|
+
var _a, _b;
|
|
999
1005
|
const siteVersion = (_a = this.siteVersion) != null ? _a : previewOverride ? MakeswiftSiteVersion.Working : MakeswiftSiteVersion.Live;
|
|
1000
|
-
const defaultLocale = (_b = getDefaultLocale(this.runtime.store.getState())) == null ? void 0 : _b.toString();
|
|
1001
|
-
const locale = unstable_locale === defaultLocale ? null : unstable_locale;
|
|
1002
1006
|
const searchParams = new URLSearchParams();
|
|
1003
|
-
if (
|
|
1004
|
-
|
|
1005
|
-
if (!locales.includes(locale)) {
|
|
1006
|
-
throw new Error(`Locale "${locale}" is not included in the locales: ${locales}. Please add the locale to the locales on the ReactRuntime.`);
|
|
1007
|
-
}
|
|
1008
|
-
searchParams.set("locale", locale);
|
|
1007
|
+
if (localeInput) {
|
|
1008
|
+
searchParams.set("locale", localeInput);
|
|
1009
1009
|
}
|
|
1010
1010
|
const response = await this.fetch(`/${this.siteVersion == null ? "v2" : "v3"}/pages/${encodeURIComponent(pathname)}/document?${searchParams.toString()}`, {
|
|
1011
1011
|
headers: { "Makeswift-Site-Version": siteVersion }
|
|
@@ -1018,7 +1018,8 @@ Received "${apiKey}" instead.`);
|
|
|
1018
1018
|
}
|
|
1019
1019
|
const document2 = await response.json();
|
|
1020
1020
|
const baseLocalizedPage = document2.localizedPages.find(({ parentId }) => parentId == null);
|
|
1021
|
-
const
|
|
1021
|
+
const locale = document2.locale;
|
|
1022
|
+
const { cacheData, localizedResourcesMap } = await this.introspect((_b = baseLocalizedPage == null ? void 0 : baseLocalizedPage.data) != null ? _b : document2.data, previewOverride, locale != null ? locale : void 0);
|
|
1022
1023
|
const apiOrigin = this.apiOrigin.href;
|
|
1023
1024
|
const preview = siteVersion === MakeswiftSiteVersion.Working;
|
|
1024
1025
|
return {
|
|
@@ -1027,7 +1028,7 @@ Received "${apiKey}" instead.`);
|
|
|
1027
1028
|
apiOrigin,
|
|
1028
1029
|
preview,
|
|
1029
1030
|
localizedResourcesMap,
|
|
1030
|
-
locale
|
|
1031
|
+
locale
|
|
1031
1032
|
};
|
|
1032
1033
|
}
|
|
1033
1034
|
async getSwatch(swatchId) {
|
|
@@ -1160,7 +1161,7 @@ async function fonts(_req, res, { getFonts } = {}) {
|
|
|
1160
1161
|
const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
|
|
1161
1162
|
return res.json(fonts2);
|
|
1162
1163
|
}
|
|
1163
|
-
const version = "0.
|
|
1164
|
+
const version = "0.11.0";
|
|
1164
1165
|
async function handler(req, res, { apiKey, siteVersions }) {
|
|
1165
1166
|
if (req.query.secret !== apiKey) {
|
|
1166
1167
|
return res.status(401).json({ message: "Unauthorized" });
|
|
@@ -3902,13 +3903,11 @@ function isDomNodeHandle(value) {
|
|
|
3902
3903
|
}
|
|
3903
3904
|
class ReactRuntime {
|
|
3904
3905
|
constructor({
|
|
3905
|
-
breakpoints
|
|
3906
|
-
unstable_i18n
|
|
3906
|
+
breakpoints
|
|
3907
3907
|
} = {}) {
|
|
3908
3908
|
__publicField(this, "store");
|
|
3909
3909
|
this.store = configureStore$1({
|
|
3910
|
-
breakpoints: breakpoints ? parseBreakpointsInput(breakpoints) : void 0
|
|
3911
|
-
locales: unstable_i18n ? parseLocalesInput(unstable_i18n) : void 0
|
|
3910
|
+
breakpoints: breakpoints ? parseBreakpointsInput(breakpoints) : void 0
|
|
3912
3911
|
});
|
|
3913
3912
|
registerBuiltinComponents(this);
|
|
3914
3913
|
}
|