@makeswift/runtime 0.9.8 → 0.9.10
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/PreviewProvider.es.js +2 -2
- package/dist/ReadOnlyText.es.js +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/api.cjs.js +19 -0
- package/dist/api.cjs.js.map +1 -1
- package/dist/api.es.js +19 -0
- package/dist/api.es.js.map +1 -1
- package/dist/controls.cjs.js +2 -0
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +1 -1
- package/dist/index.cjs.js +119 -28
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs10.js +6 -2
- package/dist/index.cjs10.js.map +1 -1
- package/dist/index.cjs5.js +30 -75
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs9.js +4 -1
- package/dist/index.cjs9.js.map +1 -1
- package/dist/index.es.js +120 -29
- package/dist/index.es.js.map +1 -1
- package/dist/index.es10.js +8 -4
- package/dist/index.es10.js.map +1 -1
- package/dist/index.es5.js +31 -73
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es6.js +1 -1
- package/dist/index.es9.js +5 -2
- package/dist/index.es9.js.map +1 -1
- package/dist/react-page.cjs.js +38 -21
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +37 -22
- package/dist/react-page.es.js.map +1 -1
- package/dist/slate.cjs.js +69 -6
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +69 -7
- package/dist/slate.es.js.map +1 -1
- package/dist/types/src/api/graphql/documents/fragments.d.ts +1 -0
- package/dist/types/src/api/graphql/documents/fragments.d.ts.map +1 -1
- package/dist/types/src/api/graphql/documents/queries.d.ts +1 -0
- package/dist/types/src/api/graphql/documents/queries.d.ts.map +1 -1
- package/dist/types/src/api/graphql/generated/fragment-document-nodes.d.ts +1 -0
- package/dist/types/src/api/graphql/generated/fragment-document-nodes.d.ts.map +1 -1
- package/dist/types/src/api/graphql/generated/types.d.ts +17 -0
- package/dist/types/src/api/graphql/generated/types.d.ts.map +1 -1
- package/dist/types/src/api/graphql/types.d.ts +3 -3
- package/dist/types/src/api/graphql/types.d.ts.map +1 -1
- package/dist/types/src/api/react.d.ts +13 -2
- package/dist/types/src/api/react.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/components/Element/block.d.ts +1 -1
- package/dist/types/src/components/builtin/Text/components/Element/block.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/components/Element/element.d.ts.map +1 -1
- package/dist/types/src/components/page/Page.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/fixtures/empty-blocks.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/fixtures/v2-data-types.d.ts +3 -0
- package/dist/types/src/controls/rich-text/fixtures/v2-data-types.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text/translation.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/index.d.ts +1 -0
- package/dist/types/src/controls/rich-text-v2/index.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +15 -11
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/translation.d.ts +5 -0
- package/dist/types/src/controls/rich-text-v2/translation.d.ts.map +1 -0
- package/dist/types/src/controls/typography.d.ts +2 -2
- package/dist/types/src/controls/typography.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 +7 -2
- 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/introspection.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts +1 -1
- 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/typography.d.ts +5 -5
- package/dist/types/src/runtimes/react/controls/typography.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/hooks/makeswift-api.d.ts +2 -1
- package/dist/types/src/runtimes/react/hooks/makeswift-api.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/getValue.d.ts +1 -1
- package/dist/types/src/slate/TypographyPlugin/getValue.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
- package/dist/types/src/state/makeswift-api-client.d.ts +1 -1
- package/dist/types/src/state/makeswift-api-client.d.ts.map +1 -1
- package/dist/types/src/state/modules/api-resources.d.ts.map +1 -1
- package/dist/types.cjs.js +1 -0
- package/dist/types.cjs.js.map +1 -1
- package/dist/types.cjs2.js +1 -5
- package/dist/types.cjs2.js.map +1 -1
- package/dist/types.es.js +1 -0
- package/dist/types.es.js.map +1 -1
- package/dist/types.es2.js +2 -6
- package/dist/types.es2.js.map +1 -1
- package/dist/typography.cjs.js.map +1 -1
- package/dist/typography.es.js.map +1 -1
- package/package.json +1 -1
package/dist/react-page.es.js
CHANGED
|
@@ -2053,14 +2053,11 @@ function toNodeDAO(node) {
|
|
|
2053
2053
|
case ObjectType.Text:
|
|
2054
2054
|
return toInlineOrTextDAO(node);
|
|
2055
2055
|
case ObjectType.Block:
|
|
2056
|
-
if (node.nodes == null || node.nodes && node.nodes.length === 0) {
|
|
2057
|
-
return [];
|
|
2058
|
-
}
|
|
2059
2056
|
return [
|
|
2060
2057
|
{
|
|
2061
2058
|
type: node.type,
|
|
2062
2059
|
textAlign: (node == null ? void 0 : node.data) && "textAlign" in node.data ? node == null ? void 0 : node.data.textAlign : void 0,
|
|
2063
|
-
children: node.nodes.flatMap(toNodeDAO)
|
|
2060
|
+
children: node.nodes == null || node.nodes && node.nodes.length === 0 ? [{ text: "" }] : node.nodes.flatMap(toNodeDAO)
|
|
2064
2061
|
}
|
|
2065
2062
|
];
|
|
2066
2063
|
default:
|
|
@@ -2141,6 +2138,11 @@ function toNodeDTO(node) {
|
|
|
2141
2138
|
case BlockType.Heading1:
|
|
2142
2139
|
case BlockType.Heading2:
|
|
2143
2140
|
case BlockType.Heading3:
|
|
2141
|
+
case BlockType.Heading4:
|
|
2142
|
+
case BlockType.Heading5:
|
|
2143
|
+
case BlockType.Heading6:
|
|
2144
|
+
case BlockType.Default:
|
|
2145
|
+
case BlockType.Text:
|
|
2144
2146
|
case BlockType.BlockQuote:
|
|
2145
2147
|
case BlockType.Paragraph:
|
|
2146
2148
|
case BlockType.OrderedList:
|
|
@@ -2263,6 +2265,16 @@ class RichTextControl extends PropController {
|
|
|
2263
2265
|
this.send({ type: RichTextControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
|
|
2264
2266
|
}
|
|
2265
2267
|
}
|
|
2268
|
+
function richTextV2DataToDescendents(data) {
|
|
2269
|
+
return data.descendants;
|
|
2270
|
+
}
|
|
2271
|
+
function richTextV2DescendentsToData(descendants) {
|
|
2272
|
+
return {
|
|
2273
|
+
type: RichTextV2ControlType,
|
|
2274
|
+
version: 2,
|
|
2275
|
+
descendants
|
|
2276
|
+
};
|
|
2277
|
+
}
|
|
2266
2278
|
const RichTextV2ControlType = "makeswift::controls::rich-text-v2";
|
|
2267
2279
|
const RichTextV2Mode = {
|
|
2268
2280
|
Inline: "makeswift::controls::rich-text-v2::mode::inline",
|
|
@@ -2281,15 +2293,15 @@ function unstable_RichTextV2(config = {}) {
|
|
|
2281
2293
|
return { type: RichTextV2ControlType, config };
|
|
2282
2294
|
}
|
|
2283
2295
|
const RichTextV2ControlMessageType = {
|
|
2284
|
-
RESET_VALUE: "
|
|
2285
|
-
FOCUS: "
|
|
2286
|
-
RUN_PLUGIN_CONTROL_ACTION: "
|
|
2287
|
-
SET_DEFAULT_VALUE: "
|
|
2288
|
-
SET_PLUGIN_CONTROL_VALUE: "
|
|
2289
|
-
ON_CHANGE: "
|
|
2290
|
-
SELECT: "
|
|
2291
|
-
SWITCH_TO_BUILD_MODE: "
|
|
2292
|
-
CHANGE_BOX_MODEL: "
|
|
2296
|
+
RESET_VALUE: "makeswift::controls::rich-text-v2::control-message::reset-value",
|
|
2297
|
+
FOCUS: "makeswift::controls::rich-text-v2::control-message::focus",
|
|
2298
|
+
RUN_PLUGIN_CONTROL_ACTION: "makeswift::controls::rich-text-v2::control-message::run-plugin-control-action",
|
|
2299
|
+
SET_DEFAULT_VALUE: "makeswift::controls::rich-text-v2::control-message::set-default-value",
|
|
2300
|
+
SET_PLUGIN_CONTROL_VALUE: "makeswift::controls::rich-text-v2::control-message::set-plugin-control-value",
|
|
2301
|
+
ON_CHANGE: "makeswift::controls::rich-text-v2::control-message::on-change",
|
|
2302
|
+
SELECT: "makeswift::controls::rich-text-v2::control-message::select",
|
|
2303
|
+
SWITCH_TO_BUILD_MODE: "makeswift::controls::rich-text-v2::control-message::switch-to-build-mode",
|
|
2304
|
+
CHANGE_BOX_MODEL: "makeswift::controls::rich-text-v2::control-message::change-box-model"
|
|
2293
2305
|
};
|
|
2294
2306
|
class RichTextV2Control extends PropController {
|
|
2295
2307
|
constructor(send, descriptor) {
|
|
@@ -2309,7 +2321,7 @@ class RichTextV2Control extends PropController {
|
|
|
2309
2321
|
case RichTextV2ControlMessageType.RESET_VALUE: {
|
|
2310
2322
|
if (this.defaultValue) {
|
|
2311
2323
|
this.editor.selection = null;
|
|
2312
|
-
this.editor.children = this.defaultValue;
|
|
2324
|
+
this.editor.children = this.defaultValue.descendants;
|
|
2313
2325
|
this.editor.onChange();
|
|
2314
2326
|
}
|
|
2315
2327
|
break;
|
|
@@ -2335,8 +2347,11 @@ class RichTextV2Control extends PropController {
|
|
|
2335
2347
|
});
|
|
2336
2348
|
}
|
|
2337
2349
|
setDefaultValue(defaultValue) {
|
|
2338
|
-
this.defaultValue = defaultValue;
|
|
2339
|
-
this.send({
|
|
2350
|
+
this.defaultValue = richTextV2DescendentsToData(defaultValue);
|
|
2351
|
+
this.send({
|
|
2352
|
+
type: RichTextV2ControlMessageType.SET_DEFAULT_VALUE,
|
|
2353
|
+
value: richTextV2DescendentsToData(defaultValue)
|
|
2354
|
+
});
|
|
2340
2355
|
}
|
|
2341
2356
|
select() {
|
|
2342
2357
|
this.send({ type: RichTextV2ControlMessageType.SELECT });
|
|
@@ -2351,7 +2366,7 @@ class RichTextV2Control extends PropController {
|
|
|
2351
2366
|
return;
|
|
2352
2367
|
this.send({
|
|
2353
2368
|
type: RichTextV2ControlMessageType.ON_CHANGE,
|
|
2354
|
-
value
|
|
2369
|
+
value: richTextV2DescendentsToData(value)
|
|
2355
2370
|
});
|
|
2356
2371
|
this.send({
|
|
2357
2372
|
type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
|
|
@@ -2366,7 +2381,7 @@ class RichTextV2Control extends PropController {
|
|
|
2366
2381
|
}
|
|
2367
2382
|
}
|
|
2368
2383
|
function isRichTextV1Data(value) {
|
|
2369
|
-
return value !== void 0 && typeof value === "object" && !Array.isArray(value);
|
|
2384
|
+
return value !== void 0 && typeof value === "object" && !Array.isArray(value) && "object" in value;
|
|
2370
2385
|
}
|
|
2371
2386
|
function isNonNullable(value) {
|
|
2372
2387
|
return value != null;
|
|
@@ -2533,11 +2548,11 @@ function getSwatchIds(descriptor, prop) {
|
|
|
2533
2548
|
return ((_a4 = plugin.control) == null ? void 0 : _a4.definition) && plugin.control.getLeafValue ? getSwatchIds(plugin.control.definition, plugin.control.getLeafValue(text)) : [];
|
|
2534
2549
|
})) != null ? _a3 : [];
|
|
2535
2550
|
};
|
|
2536
|
-
const
|
|
2551
|
+
const data = prop;
|
|
2537
2552
|
const plugins = descriptor.config.plugins;
|
|
2538
|
-
if (isRichTextV1Data(
|
|
2553
|
+
if (isRichTextV1Data(data))
|
|
2539
2554
|
return [];
|
|
2540
|
-
return descendants.flatMap((d) => getDescendantSwatchIds(d));
|
|
2555
|
+
return data.descendants.flatMap((d) => getDescendantSwatchIds(d));
|
|
2541
2556
|
}
|
|
2542
2557
|
case ShapeControlType: {
|
|
2543
2558
|
return introspectShapeData(descriptor, prop, getSwatchIds);
|
|
@@ -2953,5 +2968,5 @@ function configureStore({
|
|
|
2953
2968
|
locales: getInitialState(locales != null ? locales : preloadedState == null ? void 0 : preloadedState.locales)
|
|
2954
2969
|
}), applyMiddleware(thunk));
|
|
2955
2970
|
}
|
|
2956
|
-
export { StyleControlProperty as $, TableFormFields as A, Backgrounds as B, ComponentIcon as C, Date as D, ElementID as E, Font as F, GapY as G, Image$1 as H, Images as I, ResponsiveOpacity as J, NavigationLinks as K, Link$1 as L, Margin as M, Number as N, SocialLinks as O, Padding as P, RichText$1 as Q, RichTextPropControllerMessageType as R, Shadows as S, TableFormFieldsMessageType as T, useStyle as U, Video as V, Width as W, getBorderSwatchIds as X, isNonNullable as Y, getBoxShadowsSwatchIds as Z, getResponsiveColorSwatchIds as _, createDocumentReference as a, StyleV2ControlMessageType as a$, ImageControlValueFormat as a0, isPropControllersHandle as a1, isRichTextV1Data as a2, StyleControlType as a3, RichTextV2ControlType as a4, RichTextControlType as a5, SlotControlType as a6, StyleV2ControlType as a7, ListControlType as a8, ShapeControlType as a9, copy as aA, merge as aB, Image as aC, copyImageData as aD, Link as aE, copyLinkData as aF, List as aG, ListControlMessageType as aH, ListControl as aI, copyListData as aJ, introspectListData as aK, Shape as aL, ShapeControlMessageType as aM, ShapeControl as aN, copyShapeData as aO, introspectShapeData as aP, Slot as aQ, SlotControlMessageType as aR, SlotControl as aS, copySlotData as aT, mergeSlotData as aU, Style as aV, StyleControlMessageType as aW, StyleControl as aX, copyStyleData as aY, unstable_useStyleV2ClassName as aZ, unstable_StyleV2 as a_, LinkControlType as aa, ImageControlType as ab, ColorControlType as ac, getComponentPropControllerDescriptors as ad, getPropControllers as ae, Types as af, BorderPropControllerFormat as ag, ShadowsPropControllerFormat as ah, BorderRadiusPropControllerFormat as ai, MarginPropControllerFormat as aj, PaddingPropControllerFormat as ak, WidthPropControllerFormat as al, configureStore as am, copyElementTree as an, getBreakpoints as ao, parseLocalesInput as ap, getDocument as aq, getElementId as ar, getIsPreview as as, getIsInBuilder as at, getReactComponent as au, getBuilderEditMode as av, getBackgroundsFileIds as aw, getBackgroundsSwatchIds as ax, Color as ay, copyColorData as az, isElementReference as b, StyleV2Control as b0, ObjectType as b1, RichText as b2, RichTextControlMessageType as b3, RichTextControl as b4, richTextDTOtoSelection as b5, richTextDTOtoDAO as b6, toSelectionDTO as b7, richTextDAOToDTO as b8, RichTextV2Mode as b9, reducer$
|
|
2971
|
+
export { StyleControlProperty as $, TableFormFields as A, Backgrounds as B, ComponentIcon as C, Date as D, ElementID as E, Font as F, GapY as G, Image$1 as H, Images as I, ResponsiveOpacity as J, NavigationLinks as K, Link$1 as L, Margin as M, Number as N, SocialLinks as O, Padding as P, RichText$1 as Q, RichTextPropControllerMessageType as R, Shadows as S, TableFormFieldsMessageType as T, useStyle as U, Video as V, Width as W, getBorderSwatchIds as X, isNonNullable as Y, getBoxShadowsSwatchIds as Z, getResponsiveColorSwatchIds as _, createDocumentReference as a, StyleV2ControlMessageType as a$, ImageControlValueFormat as a0, isPropControllersHandle as a1, isRichTextV1Data as a2, StyleControlType as a3, RichTextV2ControlType as a4, RichTextControlType as a5, SlotControlType as a6, StyleV2ControlType as a7, ListControlType as a8, ShapeControlType as a9, copy as aA, merge as aB, Image as aC, copyImageData as aD, Link as aE, copyLinkData as aF, List as aG, ListControlMessageType as aH, ListControl as aI, copyListData as aJ, introspectListData as aK, Shape as aL, ShapeControlMessageType as aM, ShapeControl as aN, copyShapeData as aO, introspectShapeData as aP, Slot as aQ, SlotControlMessageType as aR, SlotControl as aS, copySlotData as aT, mergeSlotData as aU, Style as aV, StyleControlMessageType as aW, StyleControl as aX, copyStyleData as aY, unstable_useStyleV2ClassName as aZ, unstable_StyleV2 as a_, LinkControlType as aa, ImageControlType as ab, ColorControlType as ac, getComponentPropControllerDescriptors as ad, getPropControllers as ae, Types as af, BorderPropControllerFormat as ag, ShadowsPropControllerFormat as ah, BorderRadiusPropControllerFormat as ai, MarginPropControllerFormat as aj, PaddingPropControllerFormat as ak, WidthPropControllerFormat as al, configureStore as am, copyElementTree as an, getBreakpoints as ao, parseLocalesInput as ap, getDocument as aq, getElementId as ar, getIsPreview as as, getIsInBuilder as at, getReactComponent as au, getBuilderEditMode as av, getBackgroundsFileIds as aw, getBackgroundsSwatchIds as ax, Color as ay, copyColorData as az, isElementReference as b, StyleV2Control as b0, ObjectType as b1, RichText as b2, RichTextControlMessageType as b3, RichTextControl as b4, richTextDTOtoSelection as b5, richTextDTOtoDAO as b6, toSelectionDTO as b7, richTextDAOToDTO as b8, RichTextV2Mode as b9, reducer$6 as bA, reducer$5 as bB, reducer$4 as bC, reducer$3 as bD, reducer$2 as bE, reducer$1 as bF, getInitialState$2 as bG, createRichTextV2Plugin as ba, unstable_RichTextV2 as bb, RichTextV2ControlMessageType as bc, RichTextV2Control as bd, richTextV2DataToDescendents as be, richTextV2DescendentsToData as bf, InlineType as bg, RootBlockType as bh, BlockType as bi, BlockTextAlignment as bj, getInitialState$7 as bk, reducer$8 as bl, getDocument$1 as bm, getComponentsMeta as bn, getComponentPropControllerDescriptors$1 as bo, getLocales as bp, getDefaultLocale as bq, BuilderEditMode as br, getDocumentKeysSortedByDepth as bs, getPropController as bt, getPropControllersHandle as bu, getElement as bv, getElementPropControllerDescriptors as bw, createPropController as bx, reducer$7 as by, reducer$9 as bz, createDocument as c, descriptors as d, getSwatchIds as e, getFileIds as f, getPropControllerDescriptors as g, getTypographyIds as h, introspection as i, getTableIds as j, getPageIds as k, getElementChildren as l, ResponsiveIconRadioGroup as m, Border as n, BorderRadius as o, GapX as p, ResponsiveSelect as q, ResponsiveNumber as r, Checkbox as s, Grid as t, TextInput as u, ResponsiveColor as v, TextStyle as w, ResponsiveLength as x, TextArea as y, Table as z };
|
|
2957
2972
|
//# sourceMappingURL=react-page.es.js.map
|