@makeswift/runtime 0.10.12 → 0.10.13
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 +1 -1
- package/dist/Box.es.js +2 -2
- package/dist/Button.cjs.js +1 -1
- package/dist/Button.es.js +2 -2
- package/dist/Carousel.cjs.js +1 -1
- package/dist/Carousel.es.js +2 -2
- package/dist/Countdown.cjs.js +1 -1
- package/dist/Countdown.es.js +2 -2
- package/dist/Divider.cjs.js +1 -1
- package/dist/Divider.es.js +2 -2
- package/dist/Embed.es.js +1 -1
- package/dist/Form.cjs.js +1 -1
- package/dist/Form.es.js +2 -2
- package/dist/Image.cjs.js +1 -1
- package/dist/Image.es.js +2 -2
- package/dist/LiveProvider.cjs.js +1 -1
- package/dist/LiveProvider.es.js +2 -2
- package/dist/Navigation.cjs.js +1 -1
- package/dist/Navigation.es.js +2 -2
- package/dist/PreviewProvider.cjs.js +1 -1
- package/dist/PreviewProvider.es.js +2 -2
- package/dist/ReadOnlyText.cjs.js +1 -1
- package/dist/ReadOnlyText.es.js +2 -2
- package/dist/ReadOnlyTextV2.cjs.js +1 -1
- package/dist/ReadOnlyTextV2.es.js +2 -2
- package/dist/Root.cjs.js +1 -1
- package/dist/Root.es.js +2 -2
- package/dist/SocialLinks.cjs.js +1 -1
- package/dist/SocialLinks.es.js +2 -2
- package/dist/Video.es.js +1 -1
- package/dist/components.cjs.js +1 -1
- package/dist/components.es.js +1 -1
- package/dist/control-serialization.es.js +1 -1
- package/dist/controls.cjs.js +13 -10
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +2 -2
- package/dist/index.cjs.js +29 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs8.js +1 -1
- package/dist/index.cjs9.js +1 -1
- package/dist/index.es.js +22 -3
- 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 +2 -2
- package/dist/index.es9.js +2 -2
- package/dist/next.cjs.js +1 -1
- package/dist/next.es.js +1 -1
- package/dist/number.cjs.js +14 -0
- package/dist/number.cjs.js.map +1 -0
- package/dist/number.es.js +10 -0
- package/dist/number.es.js.map +1 -0
- package/dist/prop-controllers.cjs.js +1 -0
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +1 -1
- package/dist/react-page.cjs.js +94 -16
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +83 -14
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +1 -1
- package/dist/react.es.js +1 -1
- package/dist/slate.cjs.js +1 -1
- package/dist/slate.es.js +2 -2
- package/dist/toText.es.js +1 -1
- package/dist/types/src/controls/control.d.ts +1 -0
- package/dist/types/src/controls/control.d.ts.map +1 -1
- package/dist/types/src/controls/list.d.ts +3 -0
- package/dist/types/src/controls/list.d.ts.map +1 -1
- package/dist/types/src/controls/shape.d.ts +3 -0
- package/dist/types/src/controls/shape.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/handlers/translatable-data.d.ts +13 -0
- package/dist/types/src/next/api-handler/handlers/translatable-data.d.ts.map +1 -0
- package/dist/types/src/next/api-handler/index.d.ts +2 -1
- package/dist/types/src/next/api-handler/index.d.ts.map +1 -1
- package/dist/types/src/next/client.d.ts +2 -1
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/copy/images.d.ts +2 -2
- package/dist/types/src/prop-controllers/copy/images.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts +16 -4
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/index.d.ts +2 -1
- package/dist/types/src/prop-controllers/index.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/introspection.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/state/react-page.d.ts +1 -0
- package/dist/types/src/state/react-page.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/text-input.cjs.js +0 -26
- package/dist/text-input.cjs.js.map +0 -1
- package/dist/text-input.es.js +0 -18
- package/dist/text-input.es.js.map +0 -1
package/dist/react-page.es.js
CHANGED
|
@@ -609,7 +609,7 @@ function Image$1(options = {}) {
|
|
|
609
609
|
return { type: Types.Image, version: 1, options };
|
|
610
610
|
}
|
|
611
611
|
function Images(options = {}) {
|
|
612
|
-
return { type: Types.Images, options };
|
|
612
|
+
return { type: Types.Images, version: 1, options };
|
|
613
613
|
}
|
|
614
614
|
function Link$1(options = {}) {
|
|
615
615
|
return { type: Types.Link, options };
|
|
@@ -723,10 +723,10 @@ function TableFormFields(options = {}) {
|
|
|
723
723
|
function Typeahead(options) {
|
|
724
724
|
return { type: Types.Typeahead, options };
|
|
725
725
|
}
|
|
726
|
-
function TextArea(options = {}) {
|
|
726
|
+
function TextArea$1(options = {}) {
|
|
727
727
|
return { type: Types.TextArea, options };
|
|
728
728
|
}
|
|
729
|
-
function TextInput(options = {}) {
|
|
729
|
+
function TextInput$1(options = {}) {
|
|
730
730
|
return { type: Types.TextInput, options };
|
|
731
731
|
}
|
|
732
732
|
function TextStyle(options = {}) {
|
|
@@ -794,8 +794,8 @@ var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
794
794
|
Table,
|
|
795
795
|
TableFormFields,
|
|
796
796
|
Typeahead,
|
|
797
|
-
TextArea,
|
|
798
|
-
TextInput,
|
|
797
|
+
TextArea: TextArea$1,
|
|
798
|
+
TextInput: TextInput$1,
|
|
799
799
|
TextStyle,
|
|
800
800
|
Video,
|
|
801
801
|
WidthPropControllerFormat,
|
|
@@ -1087,6 +1087,9 @@ function getListTypographyIds(definition2, value) {
|
|
|
1087
1087
|
function getListPageIds(definition2, value) {
|
|
1088
1088
|
return introspectListData(definition2, value, getPageIds);
|
|
1089
1089
|
}
|
|
1090
|
+
function getListTranslatableData(definition2, data) {
|
|
1091
|
+
return Object.fromEntries(data.map((item) => [item.id, getTranslatableData(definition2.config.type, item.value)]));
|
|
1092
|
+
}
|
|
1090
1093
|
const ShapeControlType = "makeswift::controls::shape";
|
|
1091
1094
|
function Shape(config) {
|
|
1092
1095
|
return { type: ShapeControlType, config };
|
|
@@ -1160,6 +1163,20 @@ function getShapePageIds(definition2, data) {
|
|
|
1160
1163
|
function getShapeFileIds(definition2, data) {
|
|
1161
1164
|
return introspectShapeData(definition2, data, getFileIds);
|
|
1162
1165
|
}
|
|
1166
|
+
function getShapeTranslatableData(definition2, data) {
|
|
1167
|
+
return Object.fromEntries(Object.entries(definition2.config.type).map(([key, definition22]) => [
|
|
1168
|
+
key,
|
|
1169
|
+
getTranslatableData(definition22, data[key])
|
|
1170
|
+
]));
|
|
1171
|
+
}
|
|
1172
|
+
const TextAreaControlType = "makeswift::controls::text-area";
|
|
1173
|
+
function TextArea(config = {}) {
|
|
1174
|
+
return { type: TextAreaControlType, config };
|
|
1175
|
+
}
|
|
1176
|
+
const TextInputControlType = "makeswift::controls::text-input";
|
|
1177
|
+
function TextInput(config = {}) {
|
|
1178
|
+
return { type: TextInputControlType, config };
|
|
1179
|
+
}
|
|
1163
1180
|
const SlotControlType = "makeswift::controls::slot";
|
|
1164
1181
|
function Slot() {
|
|
1165
1182
|
return { type: SlotControlType };
|
|
@@ -1448,18 +1465,23 @@ if (import_meta.vitest) {
|
|
|
1448
1465
|
});
|
|
1449
1466
|
});
|
|
1450
1467
|
}
|
|
1451
|
-
function copy$8(value, context) {
|
|
1468
|
+
function copy$8(descriptor, value, context) {
|
|
1452
1469
|
if (value == null)
|
|
1453
1470
|
return value;
|
|
1454
1471
|
return value.map(copyImagesPanelItem);
|
|
1455
1472
|
function copyImagesPanelItem(imagesPanelItem) {
|
|
1456
|
-
var _a;
|
|
1457
1473
|
const { file } = imagesPanelItem.props;
|
|
1458
1474
|
if (file == null)
|
|
1459
1475
|
return imagesPanelItem;
|
|
1460
1476
|
return __spreadProps(__spreadValues({}, imagesPanelItem), {
|
|
1461
1477
|
props: __spreadProps(__spreadValues({}, imagesPanelItem.props), {
|
|
1462
|
-
file: (
|
|
1478
|
+
file: match([descriptor, file]).with([P.any, P.string], ([, f]) => {
|
|
1479
|
+
var _a;
|
|
1480
|
+
return (_a = context.replacementContext.fileIds.get(f)) != null ? _a : f;
|
|
1481
|
+
}).with([{ version: 1 }, { type: "makeswift-file", version: 1 }], ([, f]) => {
|
|
1482
|
+
var _a;
|
|
1483
|
+
return (_a = context.replacementContext.fileIds.get(f.id)) != null ? _a : f.id;
|
|
1484
|
+
}).otherwise(([, f]) => f)
|
|
1463
1485
|
})
|
|
1464
1486
|
});
|
|
1465
1487
|
}
|
|
@@ -1495,9 +1517,8 @@ if (import_meta.vitest) {
|
|
|
1495
1517
|
globalElementIds: /* @__PURE__ */ new Map(),
|
|
1496
1518
|
globalElementData: /* @__PURE__ */ new Map()
|
|
1497
1519
|
};
|
|
1498
|
-
const result = copy$8(data, {
|
|
1499
|
-
replacementContext
|
|
1500
|
-
copyElement: (node) => node
|
|
1520
|
+
const result = copy$8({ type: "Images", options: {} }, data, {
|
|
1521
|
+
replacementContext
|
|
1501
1522
|
});
|
|
1502
1523
|
expect(result).toMatchObject(expected);
|
|
1503
1524
|
});
|
|
@@ -1938,7 +1959,7 @@ function copy$1(descriptor, value, context) {
|
|
|
1938
1959
|
case "Image":
|
|
1939
1960
|
return copy$9(descriptor, value, context);
|
|
1940
1961
|
case "Images":
|
|
1941
|
-
return copy$8(value, context);
|
|
1962
|
+
return copy$8(descriptor, value, context);
|
|
1942
1963
|
case "ResponsiveColor":
|
|
1943
1964
|
return copy$7(value, context);
|
|
1944
1965
|
case "TableFormFields":
|
|
@@ -3989,6 +4010,21 @@ function merge(definition2, a, b = a, context) {
|
|
|
3989
4010
|
return b;
|
|
3990
4011
|
}
|
|
3991
4012
|
}
|
|
4013
|
+
function getTranslatableData(definition2, data) {
|
|
4014
|
+
switch (definition2.type) {
|
|
4015
|
+
case Types.TextInput:
|
|
4016
|
+
case Types.TextArea:
|
|
4017
|
+
case TextInputControlType:
|
|
4018
|
+
case TextAreaControlType:
|
|
4019
|
+
return data;
|
|
4020
|
+
case ListControlType:
|
|
4021
|
+
return getListTranslatableData(definition2, data);
|
|
4022
|
+
case ShapeControlType:
|
|
4023
|
+
return getShapeTranslatableData(definition2, data);
|
|
4024
|
+
default:
|
|
4025
|
+
return null;
|
|
4026
|
+
}
|
|
4027
|
+
}
|
|
3992
4028
|
const StyleV2ControlType = "makeswift::controls::style-v2";
|
|
3993
4029
|
const unstable_useStyleV2ClassName = useStyle;
|
|
3994
4030
|
function unstable_StyleV2(config) {
|
|
@@ -4327,7 +4363,7 @@ function getFileIds(descriptor, prop) {
|
|
|
4327
4363
|
}
|
|
4328
4364
|
case Types.Images: {
|
|
4329
4365
|
const value = prop;
|
|
4330
|
-
return (_a = value == null ? void 0 : value.flatMap((item) => item.props.file
|
|
4366
|
+
return (_a = value == null ? void 0 : value.flatMap((item) => match(item.props.file).with(P.string, (f) => [f]).with({ type: "makeswift-file", version: 1 }, (f) => [f.id]).with({ type: "external-file", version: 1 }, () => []).with(P.nullish, () => []).otherwise(() => []))) != null ? _a : [];
|
|
4331
4367
|
}
|
|
4332
4368
|
case ImageControlType: {
|
|
4333
4369
|
const value = prop;
|
|
@@ -4635,6 +4671,39 @@ function copyElementTree(state, elementTree, replacementContext) {
|
|
|
4635
4671
|
const copy$12 = JSON.parse(JSON.stringify(elementTree));
|
|
4636
4672
|
return copyElementTreeNode(state, createReplacementContext(replacementContext))(copy$12);
|
|
4637
4673
|
}
|
|
4674
|
+
function* traverseElementTree(state, elementTree) {
|
|
4675
|
+
yield elementTree;
|
|
4676
|
+
if (isElementReference(elementTree))
|
|
4677
|
+
return;
|
|
4678
|
+
const descriptors2 = getComponentPropControllerDescriptors(state, elementTree.type);
|
|
4679
|
+
if (descriptors2 == null)
|
|
4680
|
+
return;
|
|
4681
|
+
for (const [propKey, descriptor] of Object.entries(descriptors2)) {
|
|
4682
|
+
const children = getElementChildren(descriptor, elementTree.props[propKey]);
|
|
4683
|
+
for (const child of children) {
|
|
4684
|
+
if (!isElementReference(child))
|
|
4685
|
+
yield* traverseElementTree(state, child);
|
|
4686
|
+
yield child;
|
|
4687
|
+
}
|
|
4688
|
+
}
|
|
4689
|
+
}
|
|
4690
|
+
function getElementTreeTranslatableData(state, elementTree) {
|
|
4691
|
+
const translatableData = {};
|
|
4692
|
+
for (const element of traverseElementTree(state, elementTree)) {
|
|
4693
|
+
if (isElementReference(element))
|
|
4694
|
+
continue;
|
|
4695
|
+
const descriptors2 = getComponentPropControllerDescriptors(state, element.type);
|
|
4696
|
+
if (descriptors2 == null)
|
|
4697
|
+
continue;
|
|
4698
|
+
Object.entries(descriptors2).forEach(([propName, descriptor]) => {
|
|
4699
|
+
const translatablePropData = getTranslatableData(descriptor, element.props[propName]);
|
|
4700
|
+
if (translatablePropData != null) {
|
|
4701
|
+
translatableData[`${element.key}:${propName}`] = translatablePropData;
|
|
4702
|
+
}
|
|
4703
|
+
});
|
|
4704
|
+
}
|
|
4705
|
+
return translatableData;
|
|
4706
|
+
}
|
|
4638
4707
|
function getIsInBuilder(state) {
|
|
4639
4708
|
return state.isInBuilder;
|
|
4640
4709
|
}
|
|
@@ -4665,5 +4734,5 @@ function configureStore({
|
|
|
4665
4734
|
locales: getInitialState(locales != null ? locales : preloadedState == null ? void 0 : preloadedState.locales)
|
|
4666
4735
|
}), applyMiddleware(thunk));
|
|
4667
4736
|
}
|
|
4668
|
-
export {
|
|
4737
|
+
export { useStyle as $, ResponsiveColor as A, Backgrounds as B, ComponentIcon as C, TextStyle as D, ElementID as E, Date as F, GapY as G, Font as H, Images as I, ResponsiveLength as J, TextArea$1 as K, Link$1 as L, Margin as M, Number as N, Table as O, Padding as P, TableFormFields as Q, RichTextPropControllerMessageType as R, Shadows as S, TableFormFieldsMessageType as T, Image$1 as U, ResponsiveOpacity as V, Width as W, NavigationLinks as X, SocialLinks as Y, RichText as Z, Video as _, copy$9 as a, getListTypographyIds as a$, getBorderSwatchIds as a0, getBoxShadowsSwatchIds as a1, getResponsiveColorSwatchIds as a2, StyleControlProperty as a3, ImageControlValueFormat as a4, isPropControllersHandle as a5, isRichTextV1Data as a6, isNonNullable as a7, TypographyControlType as a8, StyleControlType as a9, parseLocalesInput as aA, getDocument as aB, getElementId as aC, getIsInBuilder as aD, getReactComponent as aE, getBuilderEditMode as aF, getIsPreview as aG, getBackgroundsFileIds as aH, getBackgroundsSwatchIds as aI, Color as aJ, copyColorData as aK, copy as aL, merge as aM, getTranslatableData as aN, unstable_IconRadioGroupIcon as aO, unstable_IconRadioGroup as aP, Image as aQ, copyImageData as aR, Link as aS, copyLinkData as aT, List as aU, ListControlMessageType as aV, ListControl as aW, copyListData as aX, getListElementChildren as aY, getListSwatchIds as aZ, getListFileIds as a_, RichTextV2ControlType as aa, RichTextControlType as ab, SlotControlType as ac, StyleV2ControlType as ad, ListControlType as ae, ShapeControlType as af, LinkControlType as ag, ImageControlType as ah, IconRadioGroupControlType as ai, ColorControlType as aj, SelectControlType as ak, TextAreaControlType as al, TextInputControlType as am, getComponentPropControllerDescriptors as an, getPropControllers as ao, Types as ap, BorderPropControllerFormat as aq, ShadowsPropControllerFormat as ar, BorderRadiusPropControllerFormat as as, MarginPropControllerFormat as at, PaddingPropControllerFormat as au, WidthPropControllerFormat as av, configureStore as aw, copyElementTree as ax, getBreakpoints as ay, getElementTreeTranslatableData as az, copy$8 as b, InlinePlugin as b$, getListPageIds as b0, getListTranslatableData as b1, Select as b2, Shape as b3, ShapeControlMessageType as b4, ShapeControl as b5, copyShapeData as b6, getShapeElementChildren as b7, getShapeSwatchIds as b8, getShapeTypographyIds as b9, RichTextV2Mode as bA, RichTextV2ControlMessageType as bB, RichTextV2Control as bC, richTextV2DataToDescendents as bD, richTextV2DescendentsToData as bE, createRichTextV2Plugin as bF, unstable_Typography as bG, getTypographySwatchIds as bH, getTypographyTypographyIds as bI, TypographyActions as bJ, TYPOGRAPHY_KEY as bK, withTypography as bL, TypographyPlugin as bM, BlockActions as bN, ListActions as bO, onKeyDown as bP, withBlock as bQ, BlockPlugin as bR, withInlineMode as bS, InlineModePlugin as bT, withTextAlign as bU, TextAlignPlugin as bV, RootBlockType as bW, BlockType as bX, InlineType as bY, BlockTextAlignment as bZ, withInline as b_, getShapePageIds as ba, getShapeFileIds as bb, getShapeTranslatableData as bc, Slot as bd, SlotControlMessageType as be, SlotControl as bf, copySlotData as bg, mergeSlotData as bh, Style as bi, StyleControlMessageType as bj, StyleControl as bk, copyStyleData as bl, unstable_useStyleV2ClassName as bm, unstable_StyleV2 as bn, StyleV2ControlMessageType as bo, StyleV2Control as bp, TextArea as bq, TextInput as br, copyRichTextData as bs, ObjectType as bt, RichTextControlMessageType as bu, RichTextControl as bv, richTextDTOtoSelection as bw, richTextDTOtoDAO as bx, toSelectionDTO as by, richTextDAOToDTO as bz, createDocument as c, ElementUtils as c0, onChange$1 as c1, getValue$3 as c2, isLinkElement as c3, getInitialState$7 as c4, reducer$8 as c5, getDocument$1 as c6, getComponentsMeta as c7, getComponentPropControllerDescriptors$1 as c8, BuilderEditMode as c9, getDocumentKeysSortedByDepth as ca, getPropController as cb, getPropControllersHandle as cc, getElement as cd, getElementPropControllerDescriptors as ce, createPropController as cf, reducer$7 as cg, reducer$9 as ch, reducer$6 as ci, reducer$5 as cj, reducer$4 as ck, reducer$3 as cl, reducer$2 as cm, reducer$1 as cn, getInitialState$2 as co, descriptors as d, deepEqual as e, createDocumentReference as f, getPropControllerDescriptors as g, isElementReference as h, introspection as i, getDefaultLocale as j, getLocales as k, getSwatchIds as l, getFileIds as m, getTypographyIds as n, getTableIds as o, getPageIds as p, getElementChildren as q, ResponsiveIconRadioGroup as r, Border as s, BorderRadius as t, GapX as u, ResponsiveSelect as v, ResponsiveNumber as w, Checkbox as x, Grid as y, TextInput$1 as z };
|
|
4669
4738
|
//# sourceMappingURL=react-page.es.js.map
|