@makeswift/runtime 0.5.2 → 0.5.4
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 +1 -1
- package/dist/Button.cjs.js +1 -1
- package/dist/Button.es.js +1 -1
- package/dist/Carousel.cjs.js +1 -1
- package/dist/Carousel.es.js +1 -1
- package/dist/Countdown.cjs.js +1 -1
- package/dist/Countdown.es.js +1 -1
- package/dist/Divider.cjs.js +1 -1
- package/dist/Divider.es.js +1 -1
- package/dist/Embed.cjs.js +1 -1
- package/dist/Embed.es.js +1 -1
- package/dist/Form.cjs.js +1 -1
- package/dist/Form.es.js +1 -1
- package/dist/Image.cjs.js +1 -1
- package/dist/Image.es.js +1 -1
- package/dist/LiveProvider.cjs.js +3 -3
- package/dist/LiveProvider.es.js +3 -3
- package/dist/Navigation.cjs.js +1 -1
- package/dist/Navigation.es.js +1 -1
- package/dist/PreviewProvider.cjs.js +18 -18
- package/dist/PreviewProvider.es.js +3 -3
- package/dist/Root.cjs.js +1 -1
- package/dist/Root.es.js +1 -1
- package/dist/SocialLinks.cjs.js +1 -1
- package/dist/SocialLinks.es.js +1 -1
- package/dist/Text.cjs.js +4 -4
- package/dist/Text.es.js +1 -1
- package/dist/Video.cjs.js +6 -2
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +7 -3
- package/dist/Video.es.js.map +1 -1
- package/dist/actions.cjs.js +1 -6
- package/dist/actions.cjs.js.map +1 -1
- package/dist/actions.es.js +2 -6
- package/dist/actions.es.js.map +1 -1
- package/dist/components.cjs.js +1 -2
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +2 -2
- package/dist/{react-page.cjs.js → constants.cjs.js} +17 -1
- package/dist/constants.cjs.js.map +1 -0
- package/dist/{react-page.es.js → constants.es.js} +17 -2
- package/dist/constants.es.js.map +1 -0
- package/dist/index.cjs.js +42 -66
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs2.js +6 -6
- package/dist/index.es.js +7 -30
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js +2 -2
- package/dist/index.es3.js +1 -1
- package/dist/main.cjs.js +3 -2
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +1 -1
- package/dist/next.cjs.js +1 -1
- package/dist/next.es.js +2 -2
- package/dist/react.cjs.js +1 -1
- package/dist/react.es.js +1 -1
- package/dist/types/src/api/react.d.ts +0 -1
- package/dist/types/src/api/react.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Video/Video.d.ts.map +1 -1
- package/dist/types/src/components/builtin/index.d.ts +0 -1
- package/dist/types/src/components/builtin/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/next/index.d.ts.map +1 -1
- package/dist/types/src/state/actions.d.ts +1 -10
- package/dist/types/src/state/actions.d.ts.map +1 -1
- package/dist/types/src/state/makeswift-api-client.d.ts +2 -2
- 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/package.json +1 -1
- package/dist/react-page.cjs.js.map +0 -1
- package/dist/react-page.es.js.map +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -39,7 +39,7 @@ var _c;
|
|
|
39
39
|
var React = require("react");
|
|
40
40
|
var withSelector = require("use-sync-external-store/shim/with-selector");
|
|
41
41
|
var dynamic = require("next/dynamic");
|
|
42
|
-
var
|
|
42
|
+
var constants = require("./constants.cjs.js");
|
|
43
43
|
var actions = require("./actions.cjs.js");
|
|
44
44
|
var css = require("@emotion/css");
|
|
45
45
|
var jsxRuntime = require("react/jsx-runtime");
|
|
@@ -146,7 +146,7 @@ function BodySnippet({
|
|
|
146
146
|
return null;
|
|
147
147
|
}
|
|
148
148
|
async function introspect(element, client, store) {
|
|
149
|
-
const descriptors =
|
|
149
|
+
const descriptors = constants.getPropControllerDescriptors(store.getState());
|
|
150
150
|
const swatchIds = /* @__PURE__ */ new Set();
|
|
151
151
|
const fileIds = /* @__PURE__ */ new Set();
|
|
152
152
|
const typographyIds = /* @__PURE__ */ new Set();
|
|
@@ -157,14 +157,14 @@ async function introspect(element, client, store) {
|
|
|
157
157
|
while (current = remaining.pop()) {
|
|
158
158
|
let getResourcesFromElementDescriptors = function(elementDescriptors2, props) {
|
|
159
159
|
Object.entries(elementDescriptors2).forEach(([propName, descriptor]) => {
|
|
160
|
-
|
|
160
|
+
constants.getElementSwatchIds(descriptor, props[propName]).forEach((swatchId) => {
|
|
161
161
|
swatchIds.add(swatchId);
|
|
162
162
|
});
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
constants.getFileIds(descriptor, props[propName]).forEach((fileId) => fileIds.add(fileId));
|
|
164
|
+
constants.getTypographyIds(descriptor, props[propName]).forEach((typographyId) => typographyIds.add(typographyId));
|
|
165
|
+
constants.getTableIds(descriptor, props[propName]).forEach((tableId) => tableIds.add(tableId));
|
|
166
|
+
constants.getPageIds(descriptor, props[propName]).forEach((pageId) => pageIds.add(pageId));
|
|
167
|
+
constants.getElementChildren(descriptor, props[propName]).forEach((child) => remaining.push(child));
|
|
168
168
|
if (descriptor.type === control.ShapeControlType) {
|
|
169
169
|
const prop = props[propName];
|
|
170
170
|
if (prop == null)
|
|
@@ -196,7 +196,7 @@ async function introspect(element, client, store) {
|
|
|
196
196
|
});
|
|
197
197
|
};
|
|
198
198
|
let element2;
|
|
199
|
-
if (
|
|
199
|
+
if (constants.isElementReference(current)) {
|
|
200
200
|
const globalElement = await client.fetchGlobalElement(current.value);
|
|
201
201
|
const elementData = globalElement == null ? void 0 : globalElement.data;
|
|
202
202
|
if (elementData == null)
|
|
@@ -284,8 +284,6 @@ function getAPIResource$1(state, resourceType, resourceId) {
|
|
|
284
284
|
}
|
|
285
285
|
function reducer$1(state = getInitialState(), action) {
|
|
286
286
|
switch (action.type) {
|
|
287
|
-
case actions.ActionTypes.RESTORE_API_RESOURCES_CACHE:
|
|
288
|
-
return getInitialState(action.payload.serializedState);
|
|
289
287
|
case actions.ActionTypes.API_RESOURCE_FULFILLED: {
|
|
290
288
|
const { resourceType, resourceId, resource } = action.payload;
|
|
291
289
|
return new Map(state).set(resourceType, new Map(state.get(resourceType)).set(resourceId, resource));
|
|
@@ -661,9 +659,6 @@ class MakeswiftClient {
|
|
|
661
659
|
slate.KeyUtils.resetGenerator();
|
|
662
660
|
return getSerializedState(this.makeswiftApiClient.getState());
|
|
663
661
|
}
|
|
664
|
-
updateCacheData(cacheData) {
|
|
665
|
-
this.makeswiftApiClient.dispatch(actions.restoreAPIResourcesCache(cacheData));
|
|
666
|
-
}
|
|
667
662
|
readSwatch(swatchId) {
|
|
668
663
|
return getAPIResource(this.makeswiftApiClient.getState(), types.APIResourceType.Swatch, swatchId);
|
|
669
664
|
}
|
|
@@ -919,7 +914,7 @@ function Page$1({
|
|
|
919
914
|
return null;
|
|
920
915
|
}))]
|
|
921
916
|
}), /* @__PURE__ */ jsxRuntime.jsx(DocumentReference, {
|
|
922
|
-
documentReference:
|
|
917
|
+
documentReference: constants.createDocumentReference(page.id)
|
|
923
918
|
}), filteredSnippets.filter((snippet) => snippet.location === SnippetLocation.Body).map((snippet) => /* @__PURE__ */ jsxRuntime.jsx(BodySnippet, {
|
|
924
919
|
code: snippet.code,
|
|
925
920
|
cleanup: snippet.cleanup
|
|
@@ -1089,7 +1084,7 @@ class Document$1 extends NextDocument__default["default"] {
|
|
|
1089
1084
|
});
|
|
1090
1085
|
}
|
|
1091
1086
|
}
|
|
1092
|
-
const version = "0.5.
|
|
1087
|
+
const version = "0.5.4";
|
|
1093
1088
|
function isErrorWithMessage(error) {
|
|
1094
1089
|
return typeof error === "object" && error !== null && "message" in error && typeof error.message === "string";
|
|
1095
1090
|
}
|
|
@@ -1323,20 +1318,17 @@ async function getServerSideProps(ctx) {
|
|
|
1323
1318
|
const Page = React.memo(({
|
|
1324
1319
|
snapshot
|
|
1325
1320
|
}) => {
|
|
1326
|
-
const
|
|
1321
|
+
const client = React.useMemo(() => new MakeswiftClient({
|
|
1327
1322
|
uri: new URL("graphql", snapshot.apiOrigin).href,
|
|
1328
1323
|
cacheData: snapshot.cacheData
|
|
1329
|
-
}));
|
|
1330
|
-
React.useEffect(() => {
|
|
1331
|
-
client.updateCacheData(snapshot.cacheData);
|
|
1332
|
-
}, [client, snapshot]);
|
|
1324
|
+
}), [snapshot]);
|
|
1333
1325
|
return /* @__PURE__ */ jsxRuntime.jsx(RuntimeProvider, {
|
|
1334
1326
|
client,
|
|
1335
1327
|
rootElements: /* @__PURE__ */ new Map([[snapshot.document.id, snapshot.document.data]]),
|
|
1336
1328
|
preview: snapshot.preview,
|
|
1337
1329
|
children: /* @__PURE__ */ jsxRuntime.jsx(Page$1, {
|
|
1338
1330
|
document: snapshot.document
|
|
1339
|
-
})
|
|
1331
|
+
}, snapshot.document.data.key)
|
|
1340
1332
|
});
|
|
1341
1333
|
});
|
|
1342
1334
|
const keys = (o) => Object.keys(o);
|
|
@@ -1402,21 +1394,6 @@ const getDeviceMediaQuery = (device) => {
|
|
|
1402
1394
|
}
|
|
1403
1395
|
return parts.join(" and ");
|
|
1404
1396
|
};
|
|
1405
|
-
const MakeswiftComponentType = {
|
|
1406
|
-
Box: "./components/Box/index.js",
|
|
1407
|
-
Button: "./components/Button/index.js",
|
|
1408
|
-
Carousel: "./components/Carousel/index.js",
|
|
1409
|
-
Countdown: "./components/Countdown/index.js",
|
|
1410
|
-
Divider: "./components/Divider/index.js",
|
|
1411
|
-
Embed: "./components/Embed/index.js",
|
|
1412
|
-
Form: "./components/Form/index.js",
|
|
1413
|
-
Image: "./components/Image/index.js",
|
|
1414
|
-
Navigation: "./components/Navigation/index.js",
|
|
1415
|
-
Root: "./components/Root/index.js",
|
|
1416
|
-
SocialLinks: "./components/SocialLinks/index.js",
|
|
1417
|
-
Text: "./components/Text/index.js",
|
|
1418
|
-
Video: "./components/Video/index.js"
|
|
1419
|
-
};
|
|
1420
1397
|
const DEFAULT_BOX_ANIMATE_TYPE = "none";
|
|
1421
1398
|
const DEFAULT_BOX_ANIMATE_DELAY = 0;
|
|
1422
1399
|
const DEFAULT_BOX_ANIMATE_DURATION = 0.75;
|
|
@@ -1435,7 +1412,7 @@ function registerComponent$c(runtime) {
|
|
|
1435
1412
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
1436
1413
|
return require("./Box.cjs.js");
|
|
1437
1414
|
})))), {
|
|
1438
|
-
type: MakeswiftComponentType.Box,
|
|
1415
|
+
type: constants.MakeswiftComponentType.Box,
|
|
1439
1416
|
label: "Box",
|
|
1440
1417
|
props: {
|
|
1441
1418
|
id: slot.ElementID(),
|
|
@@ -1571,7 +1548,7 @@ function registerComponent$b(runtime) {
|
|
|
1571
1548
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
1572
1549
|
return require("./Button.cjs.js");
|
|
1573
1550
|
})))), {
|
|
1574
|
-
type: MakeswiftComponentType.Button,
|
|
1551
|
+
type: constants.MakeswiftComponentType.Button,
|
|
1575
1552
|
label: "Button",
|
|
1576
1553
|
props: {
|
|
1577
1554
|
id: slot.ElementID(),
|
|
@@ -1637,7 +1614,7 @@ function registerComponent$a(runtime) {
|
|
|
1637
1614
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
1638
1615
|
return require("./Carousel.cjs.js");
|
|
1639
1616
|
})))), {
|
|
1640
|
-
type: MakeswiftComponentType.Carousel,
|
|
1617
|
+
type: constants.MakeswiftComponentType.Carousel,
|
|
1641
1618
|
label: "Carousel",
|
|
1642
1619
|
icon: "Carousel40",
|
|
1643
1620
|
props: {
|
|
@@ -1737,7 +1714,7 @@ function registerComponent$9(runtime) {
|
|
|
1737
1714
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
1738
1715
|
return require("./Countdown.cjs.js");
|
|
1739
1716
|
})))), {
|
|
1740
|
-
type: MakeswiftComponentType.Countdown,
|
|
1717
|
+
type: constants.MakeswiftComponentType.Countdown,
|
|
1741
1718
|
label: "Countdown",
|
|
1742
1719
|
icon: "Countdown40",
|
|
1743
1720
|
props: {
|
|
@@ -1826,7 +1803,7 @@ function registerComponent$8(runtime) {
|
|
|
1826
1803
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
1827
1804
|
return require("./Divider.cjs.js");
|
|
1828
1805
|
})))), {
|
|
1829
|
-
type: MakeswiftComponentType.Divider,
|
|
1806
|
+
type: constants.MakeswiftComponentType.Divider,
|
|
1830
1807
|
label: "Divider",
|
|
1831
1808
|
icon: "Divider40",
|
|
1832
1809
|
props: {
|
|
@@ -1860,7 +1837,7 @@ function registerComponent$7(runtime) {
|
|
|
1860
1837
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
1861
1838
|
return require("./Embed.cjs.js");
|
|
1862
1839
|
})))), {
|
|
1863
|
-
type: MakeswiftComponentType.Embed,
|
|
1840
|
+
type: constants.MakeswiftComponentType.Embed,
|
|
1864
1841
|
label: "Embed",
|
|
1865
1842
|
icon: "Code40",
|
|
1866
1843
|
props: {
|
|
@@ -1899,7 +1876,7 @@ function registerComponent$6(runtime) {
|
|
|
1899
1876
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
1900
1877
|
return require("./Form.cjs.js");
|
|
1901
1878
|
})))), {
|
|
1902
|
-
type: MakeswiftComponentType.Form,
|
|
1879
|
+
type: constants.MakeswiftComponentType.Form,
|
|
1903
1880
|
label: "Form",
|
|
1904
1881
|
icon: "Form40",
|
|
1905
1882
|
props: {
|
|
@@ -2017,7 +1994,7 @@ function registerComponent$5(runtime) {
|
|
|
2017
1994
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
2018
1995
|
return require("./Image.cjs.js");
|
|
2019
1996
|
})))), {
|
|
2020
|
-
type: MakeswiftComponentType.Image,
|
|
1997
|
+
type: constants.MakeswiftComponentType.Image,
|
|
2021
1998
|
label: "Image",
|
|
2022
1999
|
props: {
|
|
2023
2000
|
id: slot.ElementID(),
|
|
@@ -2038,7 +2015,7 @@ function registerComponent$4(runtime) {
|
|
|
2038
2015
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
2039
2016
|
return require("./Navigation.cjs.js");
|
|
2040
2017
|
})))), {
|
|
2041
|
-
type: MakeswiftComponentType.Navigation,
|
|
2018
|
+
type: constants.MakeswiftComponentType.Navigation,
|
|
2042
2019
|
label: "Navigation",
|
|
2043
2020
|
icon: "Navigation40",
|
|
2044
2021
|
props: {
|
|
@@ -2135,7 +2112,7 @@ function registerComponent$3(runtime) {
|
|
|
2135
2112
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
2136
2113
|
return require("./Root.cjs.js");
|
|
2137
2114
|
})))), {
|
|
2138
|
-
type: MakeswiftComponentType.Root,
|
|
2115
|
+
type: constants.MakeswiftComponentType.Root,
|
|
2139
2116
|
label: "Page",
|
|
2140
2117
|
hidden: true,
|
|
2141
2118
|
props: {
|
|
@@ -2150,7 +2127,7 @@ function registerComponent$2(runtime) {
|
|
|
2150
2127
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
2151
2128
|
return require("./SocialLinks.cjs.js");
|
|
2152
2129
|
})))), {
|
|
2153
|
-
type: MakeswiftComponentType.SocialLinks,
|
|
2130
|
+
type: constants.MakeswiftComponentType.SocialLinks,
|
|
2154
2131
|
label: "Social Links",
|
|
2155
2132
|
icon: "SocialLinks40",
|
|
2156
2133
|
props: {
|
|
@@ -2275,7 +2252,7 @@ function registerComponent$1(runtime) {
|
|
|
2275
2252
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
2276
2253
|
return require("./Text.cjs.js");
|
|
2277
2254
|
})))), {
|
|
2278
|
-
type: MakeswiftComponentType.Text,
|
|
2255
|
+
type: constants.MakeswiftComponentType.Text,
|
|
2279
2256
|
label: "Text",
|
|
2280
2257
|
props: {
|
|
2281
2258
|
id: slot.ElementID(),
|
|
@@ -2348,7 +2325,7 @@ function registerComponent(runtime) {
|
|
|
2348
2325
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
2349
2326
|
return require("./Video.cjs.js");
|
|
2350
2327
|
})))), {
|
|
2351
|
-
type: MakeswiftComponentType.Video,
|
|
2328
|
+
type: constants.MakeswiftComponentType.Video,
|
|
2352
2329
|
label: "Video",
|
|
2353
2330
|
icon: "Video40",
|
|
2354
2331
|
props: {
|
|
@@ -2813,12 +2790,12 @@ function mapSideColor(swatches, _d) {
|
|
|
2813
2790
|
return __spreadProps(__spreadValues({}, restOfSide), {
|
|
2814
2791
|
color: color && {
|
|
2815
2792
|
alpha: color.alpha,
|
|
2816
|
-
swatch: swatches.filter(
|
|
2793
|
+
swatch: swatches.filter(constants.isNonNullable).find((s) => s && s.id === color.swatchId)
|
|
2817
2794
|
}
|
|
2818
2795
|
});
|
|
2819
2796
|
}
|
|
2820
2797
|
function useBorder(value) {
|
|
2821
|
-
const swatchIds =
|
|
2798
|
+
const swatchIds = constants.getBorderSwatchIds(value);
|
|
2822
2799
|
const swatches = useSwatches(swatchIds);
|
|
2823
2800
|
if (value == null)
|
|
2824
2801
|
return null;
|
|
@@ -2843,7 +2820,7 @@ const ShadowDefaultValue = {
|
|
|
2843
2820
|
color: null
|
|
2844
2821
|
};
|
|
2845
2822
|
function useBoxShadow(value) {
|
|
2846
|
-
const swatchIds =
|
|
2823
|
+
const swatchIds = constants.getBoxShadowsSwatchIds(value);
|
|
2847
2824
|
const swatches = useSwatches(swatchIds);
|
|
2848
2825
|
if (value == null)
|
|
2849
2826
|
return null;
|
|
@@ -2859,7 +2836,7 @@ function useBoxShadow(value) {
|
|
|
2859
2836
|
return __spreadProps(__spreadValues({}, restOfShadow), {
|
|
2860
2837
|
payload: {
|
|
2861
2838
|
color: color != null ? {
|
|
2862
|
-
swatch: swatches.filter(
|
|
2839
|
+
swatch: swatches.filter(constants.isNonNullable).find((s) => s && s.id === color.swatchId),
|
|
2863
2840
|
alpha: color.alpha
|
|
2864
2841
|
} : null,
|
|
2865
2842
|
inset: inset != null ? inset : ShadowDefaultValue.inset,
|
|
@@ -2874,7 +2851,7 @@ function useBoxShadow(value) {
|
|
|
2874
2851
|
});
|
|
2875
2852
|
}
|
|
2876
2853
|
function useResponsiveColor(color) {
|
|
2877
|
-
const swatchIds =
|
|
2854
|
+
const swatchIds = constants.getResponsiveColorSwatchIds(color);
|
|
2878
2855
|
const swatches = useSwatches(swatchIds);
|
|
2879
2856
|
if (color == null)
|
|
2880
2857
|
return null;
|
|
@@ -2883,7 +2860,7 @@ function useResponsiveColor(color) {
|
|
|
2883
2860
|
const { swatchId, alpha } = v;
|
|
2884
2861
|
const swatch = swatches.find((s) => s && s.id === swatchId);
|
|
2885
2862
|
return swatch == null ? null : __spreadProps(__spreadValues({}, rest), { value: { swatch, alpha } });
|
|
2886
|
-
}).filter(
|
|
2863
|
+
}).filter(constants.isNonNullable);
|
|
2887
2864
|
}
|
|
2888
2865
|
const DEVICE_QUERIES = DEVICES.map((device) => ({
|
|
2889
2866
|
id: device.id,
|
|
@@ -3599,13 +3576,13 @@ function PropsValue({
|
|
|
3599
3576
|
}) {
|
|
3600
3577
|
var _a;
|
|
3601
3578
|
const store = useStore();
|
|
3602
|
-
const propControllerDescriptorsRef = React.useRef((_a =
|
|
3579
|
+
const propControllerDescriptorsRef = React.useRef((_a = constants.getComponentPropControllerDescriptors(store.getState(), element.type)) != null ? _a : {});
|
|
3603
3580
|
const props = element.props;
|
|
3604
3581
|
const documentKey = useDocumentKey();
|
|
3605
3582
|
const propControllers = useSelector((state) => {
|
|
3606
3583
|
if (documentKey == null)
|
|
3607
3584
|
return null;
|
|
3608
|
-
return
|
|
3585
|
+
return constants.getPropControllers(state, documentKey, element.key);
|
|
3609
3586
|
});
|
|
3610
3587
|
return Object.entries(propControllerDescriptorsRef.current).reduceRight((renderFn, [propName, descriptor]) => (propsValue) => {
|
|
3611
3588
|
var _a2;
|
|
@@ -3791,7 +3768,7 @@ const FindDomNode = React.forwardRef(function FindDomNode2(props, ref) {
|
|
|
3791
3768
|
innerRef: ref
|
|
3792
3769
|
}));
|
|
3793
3770
|
});
|
|
3794
|
-
const storeContextDefaultValue =
|
|
3771
|
+
const storeContextDefaultValue = constants.configureStore();
|
|
3795
3772
|
function createReactRuntime(store) {
|
|
3796
3773
|
return {
|
|
3797
3774
|
registerComponent(component, {
|
|
@@ -3813,7 +3790,7 @@ function createReactRuntime(store) {
|
|
|
3813
3790
|
};
|
|
3814
3791
|
},
|
|
3815
3792
|
copyElementTree(elementTree, replacementContext) {
|
|
3816
|
-
return
|
|
3793
|
+
return constants.copyElementTree(store.getState(), elementTree, replacementContext);
|
|
3817
3794
|
}
|
|
3818
3795
|
};
|
|
3819
3796
|
}
|
|
@@ -3865,17 +3842,17 @@ function useSelector(selector) {
|
|
|
3865
3842
|
return withSelector.useSyncExternalStoreWithSelector(store.subscribe, store.getState, store.getState, selector);
|
|
3866
3843
|
}
|
|
3867
3844
|
function useComponent(type) {
|
|
3868
|
-
return useSelector((state) =>
|
|
3845
|
+
return useSelector((state) => constants.getReactComponent(state, type));
|
|
3869
3846
|
}
|
|
3870
3847
|
function useElementId(elementKey) {
|
|
3871
3848
|
const documentKey = useDocumentKey();
|
|
3872
|
-
return useSelector((state) => documentKey == null || elementKey == null ? null :
|
|
3849
|
+
return useSelector((state) => documentKey == null || elementKey == null ? null : constants.getElementId(state, documentKey, elementKey));
|
|
3873
3850
|
}
|
|
3874
3851
|
function useDocument(documentKey) {
|
|
3875
|
-
return useSelector((state) =>
|
|
3852
|
+
return useSelector((state) => constants.getDocument(state, documentKey));
|
|
3876
3853
|
}
|
|
3877
3854
|
function useIsInBuilder() {
|
|
3878
|
-
return useSelector((state) =>
|
|
3855
|
+
return useSelector((state) => constants.getIsInBuilder(state));
|
|
3879
3856
|
}
|
|
3880
3857
|
function useDispatch() {
|
|
3881
3858
|
const store = React.useContext(StoreContext);
|
|
@@ -3964,7 +3941,7 @@ const Element = React.memo(React.forwardRef(function Element2({
|
|
|
3964
3941
|
return;
|
|
3965
3942
|
return dispatch(actions.mountComponentEffect(documentKey, elementKey));
|
|
3966
3943
|
}, [dispatch, documentKey, elementKey, isRegisterElementDisabled]);
|
|
3967
|
-
return
|
|
3944
|
+
return constants.isElementReference(element) ? /* @__PURE__ */ jsxRuntime.jsx(ElementReference, {
|
|
3968
3945
|
ref: setHandle,
|
|
3969
3946
|
elementReference: element
|
|
3970
3947
|
}, elementKey) : /* @__PURE__ */ jsxRuntime.jsx(ElementData, {
|
|
@@ -4014,7 +3991,6 @@ exports.Element = Element;
|
|
|
4014
3991
|
exports.Makeswift = Makeswift;
|
|
4015
3992
|
exports.MakeswiftApiHandler = MakeswiftApiHandler;
|
|
4016
3993
|
exports.MakeswiftClient = MakeswiftClient;
|
|
4017
|
-
exports.MakeswiftComponentType = MakeswiftComponentType;
|
|
4018
3994
|
exports.MakeswiftProvider = MakeswiftProvider;
|
|
4019
3995
|
exports.Page = Page$1;
|
|
4020
3996
|
exports.Page$1 = Page;
|