@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/all.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -9,5 +9,3 @@ export * from "./plume/select";
|
|
|
9
9
|
export * from "./plume/switch";
|
|
10
10
|
export * from "./plume/text-input";
|
|
11
11
|
export * from "./plume/triggered-overlay";
|
|
12
|
-
export * from "./states/helpers";
|
|
13
|
-
export { $State, default as useDollarState, useCanvasDollarState, } from "./states/valtio";
|
|
@@ -1982,13 +1982,33 @@ function initializeStateValue($$state, initialStatePath, initialSpec) {
|
|
|
1982
1982
|
});
|
|
1983
1983
|
$$state.unsubscriptionsByState[initialStateKey].push(unsubscribe);
|
|
1984
1984
|
});
|
|
1985
|
-
var
|
|
1985
|
+
var initialValue = initialSpec.initFunc($$state.props, $state, getIndexes(initialStatePath, initialSpec));
|
|
1986
|
+
saveStateInitialValue($$state, initialStatePath, initialSpec, initialValue);
|
|
1987
|
+
return initialValue;
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
function saveStateInitialValue($$state, path, spec, initialValue) {
|
|
1991
|
+
// array states are a special case.Wwe listen for changes in the array and in the array cells.
|
|
1992
|
+
// for example: $state.people.push(...), $state.people.splice(...), $state.people[0] = ...
|
|
1993
|
+
// that's why we need to track the array object
|
|
1994
|
+
if (spec.isArray && Array.isArray(initialValue)) {
|
|
1995
|
+
var array = initialValue.map(function (val) {
|
|
1996
|
+
return mkUntrackedValue(val);
|
|
1997
|
+
});
|
|
1998
|
+
|
|
1999
|
+
set($$state.stateValues, path, array); // we need to make the array untracked for initStateValues
|
|
2000
|
+
// so we can distinguish between stateValue and initStateValue.
|
|
2001
|
+
// otherwise they would reference the same array.
|
|
1986
2002
|
|
|
1987
|
-
set($$state.initStateValues, initialStatePath, untrackedInitialValue);
|
|
1988
2003
|
|
|
1989
|
-
|
|
2004
|
+
set($$state.initStateValues, path, mkUntrackedValue(array));
|
|
2005
|
+
} else {
|
|
2006
|
+
var untrackedValue = mkUntrackedValue(initialValue);
|
|
2007
|
+
|
|
2008
|
+
set($$state.stateValues, path, untrackedValue);
|
|
1990
2009
|
|
|
1991
|
-
|
|
2010
|
+
set($$state.initStateValues, path, untrackedValue);
|
|
2011
|
+
}
|
|
1992
2012
|
}
|
|
1993
2013
|
|
|
1994
2014
|
function useDollarState(specs, props) {
|
|
@@ -2017,11 +2037,8 @@ function useDollarState(specs, props) {
|
|
|
2017
2037
|
var _spec$initVal;
|
|
2018
2038
|
|
|
2019
2039
|
saveNewState($$state, path, spec);
|
|
2020
|
-
var
|
|
2021
|
-
|
|
2022
|
-
set($$state.stateValues, path, untrackedValue);
|
|
2023
|
-
|
|
2024
|
-
set($$state.initStateValues, path, untrackedValue);
|
|
2040
|
+
var initialValue = !spec.initFunc ? (_spec$initVal = spec.initVal) != null ? _spec$initVal : undefined : initializeStateValue($$state, path, spec);
|
|
2041
|
+
saveStateInitialValue($$state, path, spec, initialValue);
|
|
2025
2042
|
}
|
|
2026
2043
|
|
|
2027
2044
|
return {
|
|
@@ -2318,9 +2335,7 @@ function useCheckbox(plasmicClass, props, config, ref) {
|
|
|
2318
2335
|
ref: rootRef
|
|
2319
2336
|
}),
|
|
2320
2337
|
wrapChildren: function wrapChildren(children) {
|
|
2321
|
-
return React.createElement(React.Fragment, null, React.createElement(visuallyHidden.VisuallyHidden, {
|
|
2322
|
-
isFocusable: true
|
|
2323
|
-
}, React.createElement("input", Object.assign({}, inputProps, {
|
|
2338
|
+
return React.createElement(React.Fragment, null, React.createElement(visuallyHidden.VisuallyHidden, null, React.createElement("input", Object.assign({}, inputProps, {
|
|
2324
2339
|
ref: inputRef
|
|
2325
2340
|
}))), children);
|
|
2326
2341
|
}
|
|
@@ -3461,9 +3476,7 @@ function useSwitch(plasmicClass, props, config, ref) {
|
|
|
3461
3476
|
ref: rootRef
|
|
3462
3477
|
}),
|
|
3463
3478
|
wrapChildren: function wrapChildren(children) {
|
|
3464
|
-
return React.createElement(React.Fragment, null, React.createElement(visuallyHidden.VisuallyHidden, {
|
|
3465
|
-
isFocusable: true
|
|
3466
|
-
}, React.createElement("input", Object.assign({}, inputProps, {
|
|
3479
|
+
return React.createElement(React.Fragment, null, React.createElement(visuallyHidden.VisuallyHidden, null, React.createElement("input", Object.assign({}, inputProps, {
|
|
3467
3480
|
ref: inputRef
|
|
3468
3481
|
}))), children);
|
|
3469
3482
|
}
|