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