@plasmicapp/react-web 0.2.133 → 0.2.134
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 +1 -0
- package/dist/react-web.cjs.development.js +20 -21
- 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 +20 -21
- package/dist/react-web.esm.js.map +1 -1
- package/dist/states/valtio.d.ts +1 -0
- package/dist/stories/UseDollarState.stories.d.ts +5 -2
- package/package.json +7 -5
- package/skinny/dist/index.js +17 -15
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/states/valtio.d.ts +1 -0
- package/skinny/dist/stories/UseDollarState.stories.d.ts +5 -2
package/dist/all.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ var ReactDOM__default = _interopDefault(ReactDOM);
|
|
|
13
13
|
var dataSourcesContext = require('@plasmicapp/data-sources-context');
|
|
14
14
|
var ssr = require('@react-aria/ssr');
|
|
15
15
|
var focus = require('@react-aria/focus');
|
|
16
|
+
var clone = _interopDefault(require('clone'));
|
|
16
17
|
var deepEqual = _interopDefault(require('fast-deep-equal'));
|
|
17
18
|
var valtio = require('valtio');
|
|
18
19
|
var utils = require('valtio/utils');
|
|
@@ -1979,7 +1980,7 @@ function initializeStateValue($$state, initialStatePath, initialSpec) {
|
|
|
1979
1980
|
var path = _ref2.path,
|
|
1980
1981
|
spec = _ref2.spec;
|
|
1981
1982
|
var unsubscribe = utils.subscribeKey(_get($$state.stateValues, path.slice(-1)), path.slice(-1)[0], function () {
|
|
1982
|
-
return
|
|
1983
|
+
return saveValue($$state, initialStatePath, initialSpec, initialSpec.initFunc($$state.props, $state, $$state.ctx, getIndexes(path, spec)));
|
|
1983
1984
|
});
|
|
1984
1985
|
$$state.unsubscriptionsByState[initialStateKey].push(unsubscribe);
|
|
1985
1986
|
});
|
|
@@ -1988,27 +1989,25 @@ function initializeStateValue($$state, initialStatePath, initialSpec) {
|
|
|
1988
1989
|
return initialValue;
|
|
1989
1990
|
}
|
|
1990
1991
|
|
|
1991
|
-
function
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
// that's why we need to track the array object
|
|
1995
|
-
if (spec.isArray && Array.isArray(initialValue)) {
|
|
1996
|
-
var array = initialValue.map(function (val) {
|
|
1997
|
-
return mkUntrackedValue(val);
|
|
1998
|
-
});
|
|
1999
|
-
|
|
2000
|
-
set($$state.stateValues, path, array); // we need to make the array untracked for initStateValues
|
|
2001
|
-
// so we can distinguish between stateValue and initStateValue.
|
|
2002
|
-
// otherwise they would reference the same array.
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
set($$state.initStateValues, path, mkUntrackedValue(array));
|
|
1992
|
+
function saveValue($$state, path, spec, value) {
|
|
1993
|
+
if (spec.isImmutable) {
|
|
1994
|
+
set($$state.stateValues, path, mkUntrackedValue(value));
|
|
2006
1995
|
} else {
|
|
1996
|
+
set($$state.stateValues, path, value);
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
function saveStateInitialValue($$state, path, spec, initialValue) {
|
|
2001
|
+
if (spec.isImmutable) {
|
|
2007
2002
|
var untrackedValue = mkUntrackedValue(initialValue);
|
|
2008
2003
|
|
|
2009
2004
|
set($$state.stateValues, path, untrackedValue);
|
|
2010
2005
|
|
|
2011
|
-
set($$state.initStateValues, path, untrackedValue);
|
|
2006
|
+
set($$state.initStateValues, path, clone(untrackedValue));
|
|
2007
|
+
} else {
|
|
2008
|
+
set($$state.stateValues, path, clone(initialValue));
|
|
2009
|
+
|
|
2010
|
+
set($$state.initStateValues, path, clone(initialValue));
|
|
2012
2011
|
}
|
|
2013
2012
|
}
|
|
2014
2013
|
|
|
@@ -2053,8 +2052,8 @@ function useDollarState(specs, props, $ctx) {
|
|
|
2053
2052
|
return _get($$state.stateValues, path);
|
|
2054
2053
|
}
|
|
2055
2054
|
},
|
|
2056
|
-
set: function set
|
|
2057
|
-
|
|
2055
|
+
set: function set(_t, _p, value) {
|
|
2056
|
+
saveValue($$state, path, spec, value);
|
|
2058
2057
|
|
|
2059
2058
|
if (spec.onChangeProp) {
|
|
2060
2059
|
var _$$state$props$spec$o3, _$$state$props3;
|
|
@@ -2157,8 +2156,8 @@ function useCanvasDollarState(specs, props, $ctx) {
|
|
|
2157
2156
|
get: function get() {
|
|
2158
2157
|
return _get($$state.stateValues, path);
|
|
2159
2158
|
},
|
|
2160
|
-
set: function set
|
|
2161
|
-
|
|
2159
|
+
set: function set(_t, _p, value) {
|
|
2160
|
+
saveValue($$state, path, spec, value);
|
|
2162
2161
|
|
|
2163
2162
|
if (spec.onChangeProp) {
|
|
2164
2163
|
var _$$state$props$spec$o5, _$$state$props5;
|