@makeswift/runtime 0.11.2 → 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 +32 -4
- 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 +33 -5
- 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 +1 -0
- 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";
|
|
@@ -1109,6 +1112,9 @@ Received "${apiKey}" instead.`);
|
|
|
1109
1112
|
getTranslatableData(elementTree2) {
|
|
1110
1113
|
return this.runtime.getTranslatableData(elementTree2);
|
|
1111
1114
|
}
|
|
1115
|
+
mergeTranslatedData(elementTree2, translatedData) {
|
|
1116
|
+
return this.runtime.mergeTranslatedData(elementTree2, translatedData);
|
|
1117
|
+
}
|
|
1112
1118
|
}
|
|
1113
1119
|
class Document$1 extends NextDocument {
|
|
1114
1120
|
static async getInitialProps(ctx) {
|
|
@@ -1164,7 +1170,7 @@ async function fonts(_req, res, { getFonts } = {}) {
|
|
|
1164
1170
|
const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
|
|
1165
1171
|
return res.json(fonts2);
|
|
1166
1172
|
}
|
|
1167
|
-
const version = "0.11.
|
|
1173
|
+
const version = "0.11.3";
|
|
1168
1174
|
async function handler(req, res, { apiKey, siteVersions }) {
|
|
1169
1175
|
if (req.query.secret !== apiKey) {
|
|
1170
1176
|
return res.status(401).json({ message: "Unauthorized" });
|
|
@@ -1271,11 +1277,24 @@ async function translatableData(req, res, client) {
|
|
|
1271
1277
|
const translatableData2 = client.getTranslatableData(elementTree2);
|
|
1272
1278
|
return res.json({ translatableData: translatableData2 });
|
|
1273
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
|
+
}
|
|
1274
1292
|
function MakeswiftApiHandler(apiKey, {
|
|
1275
1293
|
appOrigin = "https://app.makeswift.com",
|
|
1276
1294
|
apiOrigin = "https://api.makeswift.com",
|
|
1277
1295
|
getFonts,
|
|
1278
|
-
siteVersions = false
|
|
1296
|
+
siteVersions = false,
|
|
1297
|
+
runtime = ReactRuntime
|
|
1279
1298
|
} = {}) {
|
|
1280
1299
|
const cors = Cors({ origin: appOrigin });
|
|
1281
1300
|
if (typeof apiKey !== "string") {
|
|
@@ -1299,7 +1318,8 @@ Read more about dynamic catch-all routes here: https://nextjs.org/docs/routing/d
|
|
|
1299
1318
|
}
|
|
1300
1319
|
const client = new Makeswift(apiKey, {
|
|
1301
1320
|
apiOrigin,
|
|
1302
|
-
siteVersion: siteVersions ? Makeswift.getSiteVersion(req.previewData) : void 0
|
|
1321
|
+
siteVersion: siteVersions ? Makeswift.getSiteVersion(req.previewData) : void 0,
|
|
1322
|
+
runtime
|
|
1303
1323
|
});
|
|
1304
1324
|
const action = "/" + makeswift.join("/");
|
|
1305
1325
|
const matches = (pattern) => match(pattern, { decode: decodeURIComponent })(action);
|
|
@@ -1316,6 +1336,8 @@ Read more about dynamic catch-all routes here: https://nextjs.org/docs/routing/d
|
|
|
1316
1336
|
return elementTree(req, res);
|
|
1317
1337
|
if (matches("/translatable-data"))
|
|
1318
1338
|
return translatableData(req, res, client);
|
|
1339
|
+
if (matches("/merge-translated-data"))
|
|
1340
|
+
return mergeTranslatedData(req, res, client);
|
|
1319
1341
|
const handleResource = (resource) => resource === null ? res.status(404).json({ message: "Not Found" }) : res.json(resource);
|
|
1320
1342
|
if (m = matches("/swatches/:id")) {
|
|
1321
1343
|
return client.getSwatch(m.params.id).then(handleResource);
|
|
@@ -3941,6 +3963,9 @@ class ReactRuntime {
|
|
|
3941
3963
|
static getTranslatableData(elementTree2) {
|
|
3942
3964
|
return getElementTreeTranslatableData(this.store.getState(), elementTree2);
|
|
3943
3965
|
}
|
|
3966
|
+
static mergeTranslatedData(elementTree2, translatedData) {
|
|
3967
|
+
return mergeElementTreeTranslatedData(this.store.getState(), elementTree2, translatedData);
|
|
3968
|
+
}
|
|
3944
3969
|
registerComponent(component, {
|
|
3945
3970
|
type,
|
|
3946
3971
|
label,
|
|
@@ -3968,6 +3993,9 @@ class ReactRuntime {
|
|
|
3968
3993
|
getTranslatableData(elementTree2) {
|
|
3969
3994
|
return getElementTreeTranslatableData(this.store.getState(), elementTree2);
|
|
3970
3995
|
}
|
|
3996
|
+
mergeTranslatedData(elementTree2, translatedData) {
|
|
3997
|
+
return mergeElementTreeTranslatedData(this.store.getState(), elementTree2, translatedData);
|
|
3998
|
+
}
|
|
3971
3999
|
}
|
|
3972
4000
|
__publicField(ReactRuntime, "store", configureStore$1());
|
|
3973
4001
|
registerBuiltinComponents(ReactRuntime);
|