@makeswift/runtime 0.11.1 → 0.11.3
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 +4 -2
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +4 -2
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +4 -2
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +4 -2
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +5 -3
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +5 -3
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +3 -1
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +3 -1
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +4 -2
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +4 -2
- package/dist/Divider.es.js.map +1 -1
- package/dist/Embed.cjs.js +3 -1
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +3 -1
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +3 -1
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +3 -1
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +3 -1
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +3 -1
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +4 -2
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +4 -2
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +3 -1
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +3 -1
- package/dist/Navigation.es.js.map +1 -1
- package/dist/PreviewProvider.cjs.js +3 -1
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +4 -2
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +3 -1
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +4 -2
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +3 -1
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +4 -2
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +2 -0
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +2 -0
- package/dist/Root.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +4 -2
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +4 -2
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Video.cjs.js +3 -1
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +3 -1
- package/dist/Video.es.js.map +1 -1
- package/dist/builder.cjs.js +4 -2
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +4 -2
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +4 -2
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +4 -2
- package/dist/components.es.js.map +1 -1
- package/dist/control-serialization.cjs.js +5 -0
- package/dist/control-serialization.cjs.js.map +1 -1
- package/dist/control-serialization.es.js +5 -0
- package/dist/control-serialization.es.js.map +1 -1
- package/dist/controls.cjs.js +8 -2
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +5 -3
- package/dist/controls.es.js.map +1 -1
- package/dist/index.cjs.js +36 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs2.js +5 -2
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs8.js +3 -1
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.cjs9.js +2 -0
- package/dist/index.cjs9.js.map +1 -1
- package/dist/index.es.js +37 -6
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js +6 -3
- package/dist/index.es2.js.map +1 -1
- package/dist/index.es5.js +1 -1
- package/dist/index.es6.js +1 -1
- package/dist/index.es8.js +4 -2
- package/dist/index.es8.js.map +1 -1
- package/dist/index.es9.js +3 -1
- package/dist/index.es9.js.map +1 -1
- package/dist/main.cjs.js +4 -2
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +4 -2
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +3 -1
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +3 -1
- package/dist/next.es.js.map +1 -1
- package/dist/prop-controllers.cjs.js +4 -2
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +4 -2
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/react-page.cjs.js +207 -28
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +203 -29
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +4 -2
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +4 -2
- package/dist/react.es.js.map +1 -1
- package/dist/slate.cjs.js +4 -2
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +5 -3
- package/dist/slate.es.js.map +1 -1
- package/dist/toText.cjs.js +5 -0
- package/dist/toText.cjs.js.map +1 -1
- package/dist/toText.es.js +6 -1
- package/dist/toText.es.js.map +1 -1
- package/dist/types/src/controls/control.d.ts +2 -1
- package/dist/types/src/controls/control.d.ts.map +1 -1
- package/dist/types/src/controls/list.d.ts +7 -1
- package/dist/types/src/controls/list.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/__test__/dto.test.d.ts +2 -0
- package/dist/types/src/controls/rich-text/__test__/dto.test.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text/{translation.d.ts → dto.d.ts} +1 -1
- package/dist/types/src/controls/rich-text/dto.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text/index.d.ts +1 -1
- package/dist/types/src/controls/rich-text/index.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/__test__/fixtures/rearranged.d.ts +10 -0
- package/dist/types/src/controls/rich-text-v2/__test__/fixtures/rearranged.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/__test__/fixtures/simple.d.ts +20 -0
- package/dist/types/src/controls/rich-text-v2/__test__/fixtures/simple.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/__test__/translation.test.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/dto.d.ts +5 -0
- package/dist/types/src/controls/rich-text-v2/dto.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/index.d.ts +1 -1
- package/dist/types/src/controls/rich-text-v2/index.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/translation.d.ts +4 -4
- package/dist/types/src/controls/rich-text-v2/translation.d.ts.map +1 -1
- package/dist/types/src/controls/shape.d.ts +5 -1
- package/dist/types/src/controls/shape.d.ts.map +1 -1
- package/dist/types/src/controls/slot.d.ts +5 -1
- package/dist/types/src/controls/slot.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/handlers/merge-translated-data.d.ts +13 -0
- package/dist/types/src/next/api-handler/handlers/merge-translated-data.d.ts.map +1 -0
- package/dist/types/src/next/api-handler/index.d.ts +5 -2
- package/dist/types/src/next/api-handler/index.d.ts.map +1 -1
- package/dist/types/src/next/client.d.ts +3 -1
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts +5 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/index.d.ts +2 -0
- package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
- package/dist/types/src/slate/types.d.ts +5 -0
- package/dist/types/src/slate/types.d.ts.map +1 -1
- package/dist/types/src/slate/utils/element.d.ts +1 -1
- package/dist/types/src/slate/utils/element.d.ts.map +1 -1
- package/dist/types/src/state/react-page.d.ts +6 -0
- package/dist/types/src/state/react-page.d.ts.map +1 -1
- package/package.json +2 -1
- package/dist/types/src/controls/rich-text/__test__/translation.test.d.ts.map +0 -1
- package/dist/types/src/controls/rich-text/translation.d.ts.map +0 -1
- package/dist/types/src/controls/rich-text-v2/translatableData.d.ts +0 -3
- package/dist/types/src/controls/rich-text-v2/translatableData.d.ts.map +0 -1
- /package/dist/types/src/controls/{rich-text → rich-text-v2}/__test__/translation.test.d.ts +0 -0
package/dist/index.es.js
CHANGED
|
@@ -38,7 +38,7 @@ 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 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
|
|
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 mergeElementTreeTranslatedData, aA as getDocument, aB as getElementId, aC as getIsInBuilder, aD as getReactComponent, aE as getBuilderEditMode, aF as getIsPreview } from "./react-page.es.js";
|
|
42
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";
|
|
@@ -47,11 +47,14 @@ import { match as match$1, P } from "ts-pattern";
|
|
|
47
47
|
import { v4 } from "uuid";
|
|
48
48
|
import "slate";
|
|
49
49
|
import "escape-html";
|
|
50
|
+
import "slate-hyperscript";
|
|
51
|
+
import "parse5";
|
|
52
|
+
import "is-hotkey";
|
|
53
|
+
import { getBaseBreakpoint, findBreakpointOverride, join, getBreakpoint, getBreakpointMediaQuery, mergeOrCoalesceFallbacks, shallowMergeFallbacks, parseBreakpointsInput } from "./state/breakpoints.es.js";
|
|
50
54
|
import { useSyncExternalStore } from "use-sync-external-store/shim";
|
|
51
55
|
import { createStore, applyMiddleware } from "redux";
|
|
52
56
|
import thunk from "redux-thunk";
|
|
53
57
|
import { A as APIResourceType } from "./types.es.js";
|
|
54
|
-
import { getBaseBreakpoint, findBreakpointOverride, join, getBreakpoint, getBreakpointMediaQuery, mergeOrCoalesceFallbacks, shallowMergeFallbacks, parseBreakpointsInput } from "./state/breakpoints.es.js";
|
|
55
58
|
import { g as getBox, i as isMeasurable, m as measure } from "./box-models.es.js";
|
|
56
59
|
import ColorHelper from "color";
|
|
57
60
|
import scrollIntoView from "scroll-into-view-if-needed";
|
|
@@ -1087,7 +1090,8 @@ Received "${apiKey}" instead.`);
|
|
|
1087
1090
|
async getSitemap({
|
|
1088
1091
|
limit = 50,
|
|
1089
1092
|
after,
|
|
1090
|
-
pathnamePrefix
|
|
1093
|
+
pathnamePrefix,
|
|
1094
|
+
locale
|
|
1091
1095
|
} = {}) {
|
|
1092
1096
|
const url = new URL("v1/sitemap", this.apiOrigin);
|
|
1093
1097
|
url.searchParams.set("limit", limit.toString());
|
|
@@ -1095,6 +1099,8 @@ Received "${apiKey}" instead.`);
|
|
|
1095
1099
|
url.searchParams.set("after", after);
|
|
1096
1100
|
if (pathnamePrefix != null)
|
|
1097
1101
|
url.searchParams.set("pathnamePrefix", pathnamePrefix);
|
|
1102
|
+
if (locale != null)
|
|
1103
|
+
url.searchParams.set("locale", locale);
|
|
1098
1104
|
const response = await this.fetch(url.pathname + url.search);
|
|
1099
1105
|
if (!response.ok) {
|
|
1100
1106
|
console.error("Failed to get sitemap", await response.json());
|
|
@@ -1106,6 +1112,9 @@ Received "${apiKey}" instead.`);
|
|
|
1106
1112
|
getTranslatableData(elementTree2) {
|
|
1107
1113
|
return this.runtime.getTranslatableData(elementTree2);
|
|
1108
1114
|
}
|
|
1115
|
+
mergeTranslatedData(elementTree2, translatedData) {
|
|
1116
|
+
return this.runtime.mergeTranslatedData(elementTree2, translatedData);
|
|
1117
|
+
}
|
|
1109
1118
|
}
|
|
1110
1119
|
class Document$1 extends NextDocument {
|
|
1111
1120
|
static async getInitialProps(ctx) {
|
|
@@ -1161,7 +1170,7 @@ async function fonts(_req, res, { getFonts } = {}) {
|
|
|
1161
1170
|
const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
|
|
1162
1171
|
return res.json(fonts2);
|
|
1163
1172
|
}
|
|
1164
|
-
const version = "0.11.
|
|
1173
|
+
const version = "0.11.3";
|
|
1165
1174
|
async function handler(req, res, { apiKey, siteVersions }) {
|
|
1166
1175
|
if (req.query.secret !== apiKey) {
|
|
1167
1176
|
return res.status(401).json({ message: "Unauthorized" });
|
|
@@ -1268,11 +1277,24 @@ async function translatableData(req, res, client) {
|
|
|
1268
1277
|
const translatableData2 = client.getTranslatableData(elementTree2);
|
|
1269
1278
|
return res.json({ translatableData: translatableData2 });
|
|
1270
1279
|
}
|
|
1280
|
+
async function mergeTranslatedData(req, res, client) {
|
|
1281
|
+
const translatedData = req.body.translatedData;
|
|
1282
|
+
const elementTree2 = req.body.elementTree;
|
|
1283
|
+
if (translatedData == null) {
|
|
1284
|
+
return res.status(400).json({ message: "translatedData must be defined" });
|
|
1285
|
+
}
|
|
1286
|
+
if (elementTree2 == null) {
|
|
1287
|
+
return res.status(400).json({ message: "elementTree must be defined" });
|
|
1288
|
+
}
|
|
1289
|
+
const translatedElementTree = client.mergeTranslatedData(elementTree2, translatedData);
|
|
1290
|
+
return res.json({ elementTree: translatedElementTree });
|
|
1291
|
+
}
|
|
1271
1292
|
function MakeswiftApiHandler(apiKey, {
|
|
1272
1293
|
appOrigin = "https://app.makeswift.com",
|
|
1273
1294
|
apiOrigin = "https://api.makeswift.com",
|
|
1274
1295
|
getFonts,
|
|
1275
|
-
siteVersions = false
|
|
1296
|
+
siteVersions = false,
|
|
1297
|
+
runtime = ReactRuntime
|
|
1276
1298
|
} = {}) {
|
|
1277
1299
|
const cors = Cors({ origin: appOrigin });
|
|
1278
1300
|
if (typeof apiKey !== "string") {
|
|
@@ -1296,7 +1318,8 @@ Read more about dynamic catch-all routes here: https://nextjs.org/docs/routing/d
|
|
|
1296
1318
|
}
|
|
1297
1319
|
const client = new Makeswift(apiKey, {
|
|
1298
1320
|
apiOrigin,
|
|
1299
|
-
siteVersion: siteVersions ? Makeswift.getSiteVersion(req.previewData) : void 0
|
|
1321
|
+
siteVersion: siteVersions ? Makeswift.getSiteVersion(req.previewData) : void 0,
|
|
1322
|
+
runtime
|
|
1300
1323
|
});
|
|
1301
1324
|
const action = "/" + makeswift.join("/");
|
|
1302
1325
|
const matches = (pattern) => match(pattern, { decode: decodeURIComponent })(action);
|
|
@@ -1313,6 +1336,8 @@ Read more about dynamic catch-all routes here: https://nextjs.org/docs/routing/d
|
|
|
1313
1336
|
return elementTree(req, res);
|
|
1314
1337
|
if (matches("/translatable-data"))
|
|
1315
1338
|
return translatableData(req, res, client);
|
|
1339
|
+
if (matches("/merge-translated-data"))
|
|
1340
|
+
return mergeTranslatedData(req, res, client);
|
|
1316
1341
|
const handleResource = (resource) => resource === null ? res.status(404).json({ message: "Not Found" }) : res.json(resource);
|
|
1317
1342
|
if (m = matches("/swatches/:id")) {
|
|
1318
1343
|
return client.getSwatch(m.params.id).then(handleResource);
|
|
@@ -3938,6 +3963,9 @@ class ReactRuntime {
|
|
|
3938
3963
|
static getTranslatableData(elementTree2) {
|
|
3939
3964
|
return getElementTreeTranslatableData(this.store.getState(), elementTree2);
|
|
3940
3965
|
}
|
|
3966
|
+
static mergeTranslatedData(elementTree2, translatedData) {
|
|
3967
|
+
return mergeElementTreeTranslatedData(this.store.getState(), elementTree2, translatedData);
|
|
3968
|
+
}
|
|
3941
3969
|
registerComponent(component, {
|
|
3942
3970
|
type,
|
|
3943
3971
|
label,
|
|
@@ -3965,6 +3993,9 @@ class ReactRuntime {
|
|
|
3965
3993
|
getTranslatableData(elementTree2) {
|
|
3966
3994
|
return getElementTreeTranslatableData(this.store.getState(), elementTree2);
|
|
3967
3995
|
}
|
|
3996
|
+
mergeTranslatedData(elementTree2, translatedData) {
|
|
3997
|
+
return mergeElementTreeTranslatedData(this.store.getState(), elementTree2, translatedData);
|
|
3998
|
+
}
|
|
3968
3999
|
}
|
|
3969
4000
|
__publicField(ReactRuntime, "store", configureStore$1());
|
|
3970
4001
|
registerBuiltinComponents(ReactRuntime);
|