@plasmicapp/react-web 0.2.157 → 0.2.159
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/all.d.ts +3 -13
- package/dist/auth/PlasmicPageGuard.d.ts +1 -1
- package/dist/react-web.cjs.development.js +27 -44
- 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 +27 -44
- package/dist/react-web.esm.js.map +1 -1
- package/dist/states/types.d.ts +1 -11
- package/dist/states/valtio.d.ts +2 -2
- package/dist/stories/UseDollarState.stories.d.ts +0 -3
- package/package.json +4 -4
- package/skinny/dist/auth/PlasmicPageGuard.d.ts +1 -1
- package/skinny/dist/index.js +25 -34
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/states/types.d.ts +1 -11
- package/skinny/dist/states/valtio.d.ts +2 -2
- package/skinny/dist/stories/UseDollarState.stories.d.ts +0 -3
package/dist/react-web.esm.js
CHANGED
|
@@ -854,6 +854,9 @@ function PlasmicPageGuard(props) {
|
|
|
854
854
|
}
|
|
855
855
|
}, [dataSourceCtxValue, appId, authorizeEndpoint, canTriggerLogin]);
|
|
856
856
|
function canUserViewPage() {
|
|
857
|
+
if (!minRole) {
|
|
858
|
+
return true;
|
|
859
|
+
}
|
|
857
860
|
if (!dataSourceCtxValue) {
|
|
858
861
|
return false;
|
|
859
862
|
}
|
|
@@ -2617,7 +2620,7 @@ function initializeStateValue($$state, initialSpecNode, initialStatePath, proxyR
|
|
|
2617
2620
|
});
|
|
2618
2621
|
var spec = node.getSpec();
|
|
2619
2622
|
if (spec.valueProp) {
|
|
2620
|
-
return $$state.
|
|
2623
|
+
return $$state.props[spec.valueProp];
|
|
2621
2624
|
} else if (!node.hasState(path) && spec.initFunc) {
|
|
2622
2625
|
node.createStateCell(path);
|
|
2623
2626
|
return initializeStateValue($$state, node, path, proxyRoot);
|
|
@@ -2633,23 +2636,19 @@ function initializeStateValue($$state, initialSpecNode, initialStatePath, proxyR
|
|
|
2633
2636
|
var node = _ref.node,
|
|
2634
2637
|
path = _ref.path;
|
|
2635
2638
|
node.addListener(path, function () {
|
|
2636
|
-
var newValue = initialSpecNode.getSpec().initFunc(
|
|
2637
|
-
$state: $state
|
|
2638
|
-
}, $$state.env));
|
|
2639
|
+
var newValue = initialSpecNode.getSpec().initFunc($$state.props, $state, $$state.ctx);
|
|
2639
2640
|
set(proxyRoot, initialStatePath, newValue);
|
|
2640
2641
|
});
|
|
2641
2642
|
});
|
|
2642
|
-
var initialValue = initialSpecNode.getInitFunc(initialSpecNode.getState(initialStatePath))(
|
|
2643
|
-
$state: $state
|
|
2644
|
-
}, $$state.env));
|
|
2643
|
+
var initialValue = initialSpecNode.getInitFunc(initialSpecNode.getState(initialStatePath))($$state.props, $state, $$state.ctx);
|
|
2645
2644
|
initialSpecNode.setInitialValue(initialStatePath, clone(initialValue));
|
|
2646
2645
|
var initialSpec = initialSpecNode.getSpec();
|
|
2647
2646
|
var value = initialSpec.isImmutable ? mkUntrackedValue(initialValue) : clone(initialValue);
|
|
2648
2647
|
set(proxyRoot, initialStatePath, value);
|
|
2649
2648
|
//immediately fire onChange
|
|
2650
2649
|
if (initialSpec.onChangeProp) {
|
|
2651
|
-
var _$$state$
|
|
2652
|
-
(_$$state$
|
|
2650
|
+
var _$$state$props$initia, _$$state$props;
|
|
2651
|
+
(_$$state$props$initia = (_$$state$props = $$state.props)[initialSpec.onChangeProp]) == null ? void 0 : _$$state$props$initia.call(_$$state$props, initialValue);
|
|
2653
2652
|
}
|
|
2654
2653
|
return initialValue;
|
|
2655
2654
|
}
|
|
@@ -2667,11 +2666,11 @@ function create$StateProxy($$state, leafHandlers) {
|
|
|
2667
2666
|
}
|
|
2668
2667
|
delete _get($$state.stateValues, currPath)[property];
|
|
2669
2668
|
if (spec.onChangeProp) {
|
|
2670
|
-
var _$$state$
|
|
2669
|
+
var _$$state$props$spec$o, _$$state$props2;
|
|
2671
2670
|
//we are always in a leaf, since we only have two cases:
|
|
2672
2671
|
// 1 - delete properties outside the state tree
|
|
2673
2672
|
// 2 - delete indices in repeated implicit states, but these can't be exposed, so they don't have onChangeProp
|
|
2674
|
-
(_$$state$
|
|
2673
|
+
(_$$state$props$spec$o = (_$$state$props2 = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o.call(_$$state$props2, _get(proxyRoot, currPath.slice(spec.pathObj.length)));
|
|
2675
2674
|
}
|
|
2676
2675
|
var nextPath = getNextPath(property);
|
|
2677
2676
|
var nextNode = currNode.makeTransition(property);
|
|
@@ -2735,19 +2734,12 @@ function create$StateProxy($$state, leafHandlers) {
|
|
|
2735
2734
|
} else {
|
|
2736
2735
|
Reflect.set(target, property, value, receiver);
|
|
2737
2736
|
}
|
|
2738
|
-
|
|
2737
|
+
nextNode.getAllSpecs().forEach(function (spec) {
|
|
2739
2738
|
if (spec.onChangeProp) {
|
|
2740
|
-
var _$$state$
|
|
2741
|
-
(_$$state$
|
|
2739
|
+
var _$$state$props$spec$o2, _$$state$props3;
|
|
2740
|
+
(_$$state$props$spec$o2 = (_$$state$props3 = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o2.call(_$$state$props3, value);
|
|
2742
2741
|
}
|
|
2743
|
-
}
|
|
2744
|
-
nextNode.getAllSpecs().forEach(function (spec) {
|
|
2745
|
-
if (spec.onChangeProp) {
|
|
2746
|
-
var _$$state$env$$props$s3, _$$state$env$$props4;
|
|
2747
|
-
(_$$state$env$$props$s3 = (_$$state$env$$props4 = $$state.env.$props)[spec.onChangeProp]) == null ? void 0 : _$$state$env$$props$s3.call(_$$state$env$$props4, value);
|
|
2748
|
-
}
|
|
2749
|
-
});
|
|
2750
|
-
}
|
|
2742
|
+
});
|
|
2751
2743
|
var newValue = (isOutside || currNode.isLeaf()) && currNode.getSpec().isImmutable ? mkUntrackedValue(value) : value;
|
|
2752
2744
|
set($$state.stateValues, nextPath, newValue);
|
|
2753
2745
|
return true;
|
|
@@ -2775,27 +2767,22 @@ function create$StateProxy($$state, leafHandlers) {
|
|
|
2775
2767
|
var mkUntrackedValue = function mkUntrackedValue(o) {
|
|
2776
2768
|
return o != null && typeof o === "object" ? ref(o) : o;
|
|
2777
2769
|
};
|
|
2778
|
-
|
|
2779
|
-
var _env$$ctx, _env$$queries;
|
|
2780
|
-
return {
|
|
2781
|
-
$props: env.$props,
|
|
2782
|
-
$ctx: (_env$$ctx = env.$ctx) != null ? _env$$ctx : {},
|
|
2783
|
-
$queries: (_env$$queries = env.$queries) != null ? _env$$queries : {}
|
|
2784
|
-
};
|
|
2785
|
-
};
|
|
2786
|
-
function useDollarState(specs, env, opts) {
|
|
2770
|
+
function useDollarState(specs, props, $ctx, opts) {
|
|
2787
2771
|
var $$state = React__default.useRef(function () {
|
|
2788
2772
|
var rootSpecTree = buildTree(specs);
|
|
2789
2773
|
return {
|
|
2790
2774
|
rootSpecTree: rootSpecTree,
|
|
2791
2775
|
specTreeLeaves: getStateCells(rootSpecTree),
|
|
2792
2776
|
stateValues: proxy({}),
|
|
2793
|
-
|
|
2777
|
+
props: {},
|
|
2778
|
+
ctx: {},
|
|
2794
2779
|
specs: [],
|
|
2795
2780
|
registrationsQueue: proxy([])
|
|
2796
2781
|
};
|
|
2797
2782
|
}()).current;
|
|
2798
|
-
$$state.
|
|
2783
|
+
$$state.props = props;
|
|
2784
|
+
$$state.ctx = $ctx != null ? $ctx : {};
|
|
2785
|
+
$$state.specs = specs;
|
|
2799
2786
|
var create$State = function create$State() {
|
|
2800
2787
|
var $state = Object.assign(create$StateProxy($$state, function (node, path) {
|
|
2801
2788
|
if (!node.hasState(path)) {
|
|
@@ -2811,7 +2798,7 @@ function useDollarState(specs, env, opts) {
|
|
|
2811
2798
|
get: function get(target, property, receiver) {
|
|
2812
2799
|
var spec = node.getSpec();
|
|
2813
2800
|
if (spec.valueProp) {
|
|
2814
|
-
return $$state.
|
|
2801
|
+
return $$state.props[spec.valueProp];
|
|
2815
2802
|
} else {
|
|
2816
2803
|
return Reflect.get(target, property, receiver);
|
|
2817
2804
|
}
|
|
@@ -2825,9 +2812,7 @@ function useDollarState(specs, env, opts) {
|
|
|
2825
2812
|
if (!node.hasState(realPath)) {
|
|
2826
2813
|
node.createStateCell(realPath);
|
|
2827
2814
|
}
|
|
2828
|
-
if (!deepEqual(node.getState(realPath).initialValue, f(
|
|
2829
|
-
$state: $state
|
|
2830
|
-
}, $$state.env)))) {
|
|
2815
|
+
if (!deepEqual(node.getState(realPath).initialValue, f($$state.props, $state, $$state.ctx))) {
|
|
2831
2816
|
$$state.registrationsQueue.push(mkUntrackedValue({
|
|
2832
2817
|
node: node,
|
|
2833
2818
|
path: realPath,
|
|
@@ -2864,7 +2849,7 @@ function useDollarState(specs, env, opts) {
|
|
|
2864
2849
|
return;
|
|
2865
2850
|
}
|
|
2866
2851
|
node.createStateCell(spec.pathObj);
|
|
2867
|
-
var init = spec.valueProp ? $$state.
|
|
2852
|
+
var init = spec.valueProp ? $$state.props[spec.valueProp] : spec.initFunc ? initializeStateValue($$state, node, spec.pathObj, $state) : spec.initVal;
|
|
2868
2853
|
set($state, spec.pathObj, init);
|
|
2869
2854
|
});
|
|
2870
2855
|
}
|
|
@@ -2883,9 +2868,7 @@ function useDollarState(specs, env, opts) {
|
|
|
2883
2868
|
stateCell = _ref3.stateCell;
|
|
2884
2869
|
var initFunc = node.getInitFunc(stateCell);
|
|
2885
2870
|
if (initFunc) {
|
|
2886
|
-
var newInit = initFunc(
|
|
2887
|
-
$state: $state
|
|
2888
|
-
}, envFieldsAreNonNill(env)));
|
|
2871
|
+
var newInit = initFunc(props, $state, $ctx != null ? $ctx : {});
|
|
2889
2872
|
if (!deepEqual(newInit, stateCell.initialValue)) {
|
|
2890
2873
|
resetSpecs.push({
|
|
2891
2874
|
stateCell: stateCell,
|
|
@@ -2898,8 +2881,8 @@ function useDollarState(specs, env, opts) {
|
|
|
2898
2881
|
var newInit = initializeStateValue($$state, node, stateCell.path, $state);
|
|
2899
2882
|
var spec = node.getSpec();
|
|
2900
2883
|
if (spec.onChangeProp) {
|
|
2901
|
-
var _$$state$
|
|
2902
|
-
(_$$state$
|
|
2884
|
+
var _$$state$props$spec$o3, _$$state$props4;
|
|
2885
|
+
(_$$state$props$spec$o3 = (_$$state$props4 = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o3.call(_$$state$props4, newInit);
|
|
2903
2886
|
}
|
|
2904
2887
|
};
|
|
2905
2888
|
useIsomorphicLayoutEffect$1(function () {
|
|
@@ -2908,7 +2891,7 @@ function useDollarState(specs, env, opts) {
|
|
|
2908
2891
|
node = _ref4.node;
|
|
2909
2892
|
reInitializeState(node, stateCell);
|
|
2910
2893
|
});
|
|
2911
|
-
}, [
|
|
2894
|
+
}, [props, resetSpecs]);
|
|
2912
2895
|
useIsomorphicLayoutEffect$1(function () {
|
|
2913
2896
|
while ($$state.registrationsQueue.length) {
|
|
2914
2897
|
var _$$state$registration = $$state.registrationsQueue.shift(),
|