@plasmicapp/react-web 0.2.142 → 0.2.144
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/react-web.cjs.development.js +23 -8
- package/dist/react-web.cjs.development.js.map +1 -1
- package/dist/react-web.cjs.production.min.js +1 -1
- package/dist/react-web.cjs.production.min.js.map +1 -1
- package/dist/react-web.esm.js +23 -8
- package/dist/react-web.esm.js.map +1 -1
- package/dist/states/graph.d.ts +4 -1
- package/package.json +4 -4
- package/skinny/dist/index.js +20 -2
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/states/graph.d.ts +4 -1
|
@@ -2425,7 +2425,14 @@ var StateSpecNode = /*#__PURE__*/function () {
|
|
|
2425
2425
|
this._state = {};
|
|
2426
2426
|
};
|
|
2427
2427
|
_proto.states = function states() {
|
|
2428
|
-
return Object.
|
|
2428
|
+
return Object.entries(this._state).map(function (_ref) {
|
|
2429
|
+
var key = _ref[0],
|
|
2430
|
+
stateCell = _ref[1];
|
|
2431
|
+
return {
|
|
2432
|
+
path: JSON.parse(key),
|
|
2433
|
+
stateCell: stateCell
|
|
2434
|
+
};
|
|
2435
|
+
});
|
|
2429
2436
|
};
|
|
2430
2437
|
_proto.hasState = function hasState(path) {
|
|
2431
2438
|
var key = JSON.stringify(path);
|
|
@@ -2770,8 +2777,15 @@ function useDollarState(specs, props, $ctx, opts) {
|
|
|
2770
2777
|
$$state.rootSpecTree = updateTree($$state.rootSpecTree, specs);
|
|
2771
2778
|
var newLeaves = getStateCells($$state.rootSpecTree);
|
|
2772
2779
|
if (!arrayEq(newLeaves, $$state.specTreeLeaves)) {
|
|
2780
|
+
var old$State = $state;
|
|
2773
2781
|
$state = ref.current = create$State();
|
|
2774
2782
|
$$state.specTreeLeaves = newLeaves;
|
|
2783
|
+
$$state.specTreeLeaves.flatMap(function (node) {
|
|
2784
|
+
return node.states();
|
|
2785
|
+
}).forEach(function (_ref2) {
|
|
2786
|
+
var path = _ref2.path;
|
|
2787
|
+
set($state, path, _get(old$State, path));
|
|
2788
|
+
});
|
|
2775
2789
|
}
|
|
2776
2790
|
// we need to eager initialize all states in canvas to populate the data picker
|
|
2777
2791
|
$$state.specTreeLeaves.forEach(function (node) {
|
|
@@ -2788,15 +2802,16 @@ function useDollarState(specs, props, $ctx, opts) {
|
|
|
2788
2802
|
// the init value has changed. If so, reset its state.
|
|
2789
2803
|
var resetSpecs = [];
|
|
2790
2804
|
$$state.specTreeLeaves.flatMap(function (node) {
|
|
2791
|
-
return node.states().map(function (
|
|
2805
|
+
return node.states().map(function (_ref3) {
|
|
2806
|
+
var stateCell = _ref3.stateCell;
|
|
2792
2807
|
return {
|
|
2793
2808
|
stateCell: stateCell,
|
|
2794
2809
|
node: node
|
|
2795
2810
|
};
|
|
2796
2811
|
});
|
|
2797
|
-
}).forEach(function (
|
|
2798
|
-
var node =
|
|
2799
|
-
stateCell =
|
|
2812
|
+
}).forEach(function (_ref4) {
|
|
2813
|
+
var node = _ref4.node,
|
|
2814
|
+
stateCell = _ref4.stateCell;
|
|
2800
2815
|
var initFunc = node.getInitFunc(stateCell);
|
|
2801
2816
|
if (initFunc) {
|
|
2802
2817
|
var newInit = initFunc(props, $state, $ctx != null ? $ctx : {});
|
|
@@ -2817,9 +2832,9 @@ function useDollarState(specs, props, $ctx, opts) {
|
|
|
2817
2832
|
}
|
|
2818
2833
|
};
|
|
2819
2834
|
useIsomorphicLayoutEffect$1(function () {
|
|
2820
|
-
resetSpecs.forEach(function (
|
|
2821
|
-
var stateCell =
|
|
2822
|
-
node =
|
|
2835
|
+
resetSpecs.forEach(function (_ref5) {
|
|
2836
|
+
var stateCell = _ref5.stateCell,
|
|
2837
|
+
node = _ref5.node;
|
|
2823
2838
|
reInitializeState(node, stateCell);
|
|
2824
2839
|
});
|
|
2825
2840
|
}, [props, resetSpecs]);
|