@plasmicapp/react-web 0.2.116 → 0.2.117
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/index.d.ts +0 -2
- package/dist/react-web.cjs.development.js +28 -15
- 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 +28 -15
- package/dist/react-web.esm.js.map +1 -1
- package/dist/states/valtio.d.ts +1 -0
- package/dist/stories/UseDollarState.stories.d.ts +3 -0
- package/package.json +2 -2
- package/skinny/dist/index.d.ts +0 -2
- package/skinny/dist/index.js +24 -8
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/plume/checkbox/index.js +2 -2
- package/skinny/dist/plume/checkbox/index.js.map +1 -1
- package/skinny/dist/plume/switch/index.js +2 -2
- package/skinny/dist/plume/switch/index.js.map +1 -1
- package/skinny/dist/states/valtio.d.ts +1 -0
- package/skinny/dist/stories/UseDollarState.stories.d.ts +3 -0
package/dist/react-web.esm.js
CHANGED
|
@@ -1977,13 +1977,33 @@ function initializeStateValue($$state, initialStatePath, initialSpec) {
|
|
|
1977
1977
|
});
|
|
1978
1978
|
$$state.unsubscriptionsByState[initialStateKey].push(unsubscribe);
|
|
1979
1979
|
});
|
|
1980
|
-
var
|
|
1980
|
+
var initialValue = initialSpec.initFunc($$state.props, $state, getIndexes(initialStatePath, initialSpec));
|
|
1981
|
+
saveStateInitialValue($$state, initialStatePath, initialSpec, initialValue);
|
|
1982
|
+
return initialValue;
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
function saveStateInitialValue($$state, path, spec, initialValue) {
|
|
1986
|
+
// array states are a special case.Wwe listen for changes in the array and in the array cells.
|
|
1987
|
+
// for example: $state.people.push(...), $state.people.splice(...), $state.people[0] = ...
|
|
1988
|
+
// that's why we need to track the array object
|
|
1989
|
+
if (spec.isArray && Array.isArray(initialValue)) {
|
|
1990
|
+
var array = initialValue.map(function (val) {
|
|
1991
|
+
return mkUntrackedValue(val);
|
|
1992
|
+
});
|
|
1993
|
+
|
|
1994
|
+
set($$state.stateValues, path, array); // we need to make the array untracked for initStateValues
|
|
1995
|
+
// so we can distinguish between stateValue and initStateValue.
|
|
1996
|
+
// otherwise they would reference the same array.
|
|
1981
1997
|
|
|
1982
|
-
set($$state.initStateValues, initialStatePath, untrackedInitialValue);
|
|
1983
1998
|
|
|
1984
|
-
|
|
1999
|
+
set($$state.initStateValues, path, mkUntrackedValue(array));
|
|
2000
|
+
} else {
|
|
2001
|
+
var untrackedValue = mkUntrackedValue(initialValue);
|
|
2002
|
+
|
|
2003
|
+
set($$state.stateValues, path, untrackedValue);
|
|
1985
2004
|
|
|
1986
|
-
|
|
2005
|
+
set($$state.initStateValues, path, untrackedValue);
|
|
2006
|
+
}
|
|
1987
2007
|
}
|
|
1988
2008
|
|
|
1989
2009
|
function useDollarState(specs, props) {
|
|
@@ -2012,11 +2032,8 @@ function useDollarState(specs, props) {
|
|
|
2012
2032
|
var _spec$initVal;
|
|
2013
2033
|
|
|
2014
2034
|
saveNewState($$state, path, spec);
|
|
2015
|
-
var
|
|
2016
|
-
|
|
2017
|
-
set($$state.stateValues, path, untrackedValue);
|
|
2018
|
-
|
|
2019
|
-
set($$state.initStateValues, path, untrackedValue);
|
|
2035
|
+
var initialValue = !spec.initFunc ? (_spec$initVal = spec.initVal) != null ? _spec$initVal : undefined : initializeStateValue($$state, path, spec);
|
|
2036
|
+
saveStateInitialValue($$state, path, spec, initialValue);
|
|
2020
2037
|
}
|
|
2021
2038
|
|
|
2022
2039
|
return {
|
|
@@ -2313,9 +2330,7 @@ function useCheckbox(plasmicClass, props, config, ref) {
|
|
|
2313
2330
|
ref: rootRef
|
|
2314
2331
|
}),
|
|
2315
2332
|
wrapChildren: function wrapChildren(children) {
|
|
2316
|
-
return createElement(Fragment, null, createElement(VisuallyHidden, {
|
|
2317
|
-
isFocusable: true
|
|
2318
|
-
}, createElement("input", Object.assign({}, inputProps, {
|
|
2333
|
+
return createElement(Fragment, null, createElement(VisuallyHidden, null, createElement("input", Object.assign({}, inputProps, {
|
|
2319
2334
|
ref: inputRef
|
|
2320
2335
|
}))), children);
|
|
2321
2336
|
}
|
|
@@ -3456,9 +3471,7 @@ function useSwitch(plasmicClass, props, config, ref) {
|
|
|
3456
3471
|
ref: rootRef
|
|
3457
3472
|
}),
|
|
3458
3473
|
wrapChildren: function wrapChildren(children) {
|
|
3459
|
-
return createElement(Fragment, null, createElement(VisuallyHidden, {
|
|
3460
|
-
isFocusable: true
|
|
3461
|
-
}, createElement("input", Object.assign({}, inputProps, {
|
|
3474
|
+
return createElement(Fragment, null, createElement(VisuallyHidden, null, createElement("input", Object.assign({}, inputProps, {
|
|
3462
3475
|
ref: inputRef
|
|
3463
3476
|
}))), children);
|
|
3464
3477
|
}
|