@plasmicapp/react-web 0.2.109 → 0.2.112

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.
Files changed (77) hide show
  1. package/dist/all.d.ts +30 -13
  2. package/dist/index-common.d.ts +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/react-web.cjs.development.js +378 -349
  5. package/dist/react-web.cjs.development.js.map +1 -1
  6. package/dist/react-web.cjs.production.min.js +1 -1
  7. package/dist/react-web.cjs.production.min.js.map +1 -1
  8. package/dist/react-web.esm.js +375 -349
  9. package/dist/react-web.esm.js.map +1 -1
  10. package/dist/render/elements.d.ts +5 -0
  11. package/dist/states/helpers.d.ts +5 -0
  12. package/dist/states/index.d.ts +1 -1
  13. package/dist/states/valtio.d.ts +16 -0
  14. package/dist/stories/UseDollarState.stories.d.ts +11 -0
  15. package/package.json +6 -2
  16. package/skinny/dist/collection-utils-42de4441.js +244 -0
  17. package/skinny/dist/collection-utils-42de4441.js.map +1 -0
  18. package/skinny/dist/{collection-utils-3487dd27.js → collection-utils-bf37b8fb.js} +5 -5
  19. package/skinny/dist/collection-utils-bf37b8fb.js.map +1 -0
  20. package/skinny/dist/common-98719219.js +68 -0
  21. package/skinny/dist/common-98719219.js.map +1 -0
  22. package/skinny/dist/common-9efbae57.js +201 -0
  23. package/skinny/dist/common-9efbae57.js.map +1 -0
  24. package/skinny/dist/context-4ca6f5cd.js +6 -0
  25. package/skinny/dist/context-4ca6f5cd.js.map +1 -0
  26. package/skinny/dist/index-common.d.ts +1 -1
  27. package/skinny/dist/index.d.ts +1 -1
  28. package/skinny/dist/index.js +17 -4
  29. package/skinny/dist/index.js.map +1 -1
  30. package/skinny/dist/plume/checkbox/index.js +2 -1
  31. package/skinny/dist/plume/checkbox/index.js.map +1 -1
  32. package/skinny/dist/plume/menu/index.js +2 -1
  33. package/skinny/dist/plume/menu/index.js.map +1 -1
  34. package/skinny/dist/plume/menu-button/index.js +2 -1
  35. package/skinny/dist/plume/menu-button/index.js.map +1 -1
  36. package/skinny/dist/plume/select/index.js +2 -1
  37. package/skinny/dist/plume/select/index.js.map +1 -1
  38. package/skinny/dist/plume/switch/index.js +2 -1
  39. package/skinny/dist/plume/switch/index.js.map +1 -1
  40. package/skinny/dist/plume-utils-1e225de5.js +25 -0
  41. package/skinny/dist/plume-utils-1e225de5.js.map +1 -0
  42. package/skinny/dist/plume-utils-d2476af1.js +35 -0
  43. package/skinny/dist/plume-utils-d2476af1.js.map +1 -0
  44. package/skinny/dist/props-utils-c60d3105.js +8 -0
  45. package/skinny/dist/props-utils-c60d3105.js.map +1 -0
  46. package/skinny/dist/props-utils-cac0cccf.js +8 -0
  47. package/skinny/dist/props-utils-cac0cccf.js.map +1 -0
  48. package/skinny/dist/react-utils-6050fadc.js +201 -0
  49. package/skinny/dist/react-utils-6050fadc.js.map +1 -0
  50. package/skinny/dist/react-utils-b5dc6320.js +155 -0
  51. package/skinny/dist/react-utils-b5dc6320.js.map +1 -0
  52. package/skinny/dist/render/PlasmicHead/index.js +14 -9
  53. package/skinny/dist/render/PlasmicHead/index.js.map +1 -1
  54. package/skinny/dist/render/elements.d.ts +5 -0
  55. package/skinny/dist/ssr-68913b60.js +107 -0
  56. package/skinny/dist/ssr-68913b60.js.map +1 -0
  57. package/skinny/dist/{ssr-84e27ffb.js → ssr-d3321868.js} +9 -4
  58. package/skinny/dist/ssr-d3321868.js.map +1 -0
  59. package/skinny/dist/{ssr-b1615b80.js → ssr-f4053cdd.js} +1 -1
  60. package/skinny/dist/{ssr-84e27ffb.js.map → ssr-f4053cdd.js.map} +1 -1
  61. package/skinny/dist/states/helpers.d.ts +5 -0
  62. package/skinny/dist/states/index.d.ts +1 -1
  63. package/skinny/dist/states/valtio copy.d.ts +15 -0
  64. package/skinny/dist/states/valtio.d.ts +16 -0
  65. package/skinny/dist/stories/UseDollarState.stories.d.ts +11 -0
  66. package/skinny/dist/stories/UseDollarState.test.d.ts +11 -0
  67. package/skinny/dist/stories/UseDollarState2.stories.d.ts +7 -0
  68. package/skinny/dist/collection-utils-3487dd27.js.map +0 -1
  69. package/skinny/dist/ssr-14264281.js +0 -158
  70. package/skinny/dist/ssr-14264281.js.map +0 -1
  71. package/skinny/dist/ssr-5141fc77.js +0 -158
  72. package/skinny/dist/ssr-5141fc77.js.map +0 -1
  73. package/skinny/dist/ssr-579df58f.js +0 -158
  74. package/skinny/dist/ssr-579df58f.js.map +0 -1
  75. package/skinny/dist/ssr-b1615b80.js.map +0 -1
  76. package/skinny/dist/ssr-d2fd94f2.js +0 -31
  77. package/skinny/dist/ssr-d2fd94f2.js.map +0 -1
@@ -1,7 +1,9 @@
1
1
  import classNames$1 from 'classnames';
2
+ import _get from 'dlv';
2
3
  import * as React from 'react';
3
4
  import React__default, { forwardRef, createElement, Fragment, isValidElement, useContext, createContext, useState, useRef, useMemo, useImperativeHandle, useCallback, cloneElement } from 'react';
4
5
  import ReactDOM__default, { createPortal } from 'react-dom';
6
+ import { PlasmicDataSourceContextProvider } from '@plasmicapp/data-sources-context';
5
7
  import { SSRProvider, useIsSSR as useIsSSR$1 } from '@react-aria/ssr';
6
8
  import { useFocusRing, useFocusable, FocusScope } from '@react-aria/focus';
7
9
  import { useCheckbox as useCheckbox$1 } from '@react-aria/checkbox';
@@ -18,8 +20,9 @@ import { useListBox, useOption, useListBoxSection } from '@react-aria/listbox';
18
20
  import { useSelectState } from '@react-stately/select';
19
21
  import { useSwitch as useSwitch$1 } from '@react-aria/switch';
20
22
  import { useOverlay, useOverlayPosition, DismissButton } from '@react-aria/overlays';
21
- import _get from 'dlv';
22
- import { dset } from 'dset';
23
+ import deepEqual from 'fast-deep-equal';
24
+ import { proxy, ref, useSnapshot } from 'valtio';
25
+ import { subscribeKey } from 'valtio/utils';
23
26
 
24
27
  function _extends() {
25
28
  _extends = Object.assign || function (target) {
@@ -685,6 +688,14 @@ function mergeVariants(v1, v2) {
685
688
  return _extends({}, v1, v2);
686
689
  }
687
690
 
691
+ function mergeVariantsWithStates(variants, $state, linkedStates) {
692
+ return _extends({}, variants, Object.fromEntries(linkedStates.map(function (_ref) {
693
+ var variantGroup = _ref.variantGroup,
694
+ statePath = _ref.statePath;
695
+ return [variantGroup, _get($state, statePath)];
696
+ })));
697
+ }
698
+
688
699
  function mergeArgs(a1, a2) {
689
700
  if (!a1 || !a2) {
690
701
  return a1 || a2 || {};
@@ -710,7 +721,7 @@ function mergeFlexOverrides(o1, o2) {
710
721
  }
711
722
 
712
723
  function mergeFlexOverride(fo1, fo2) {
713
- var _o1$props, _ref;
724
+ var _o1$props, _ref2;
714
725
 
715
726
  if (!fo1) {
716
727
  return fo2;
@@ -746,7 +757,7 @@ function mergeFlexOverride(fo1, fo2) {
746
757
  } // "as" will take precedence
747
758
 
748
759
 
749
- var as = (_ref = o2.type === "as" ? o2.as : undefined) != null ? _ref : o1.type === "as" ? o1.as : undefined;
760
+ var as = (_ref2 = o2.type === "as" ? o2.as : undefined) != null ? _ref2 : o1.type === "as" ? o1.as : undefined;
750
761
  return _extends({
751
762
  props: props,
752
763
  wrap: wrap,
@@ -812,9 +823,12 @@ function PlasmicHead(props) {
812
823
  console.warn("Plasmic: Head meta tags are being ignored. To make them work, pass a Head component into PlasmicRootProvider."); // TODO: Link to doc about Head.
813
824
 
814
825
  return null;
815
- }
826
+ } // Helmet does not support React.Fragments, so we need to use `[<meta />,
827
+ // <meta />]` instead of `<><meta /><meta /></>`.
816
828
 
817
- return createElement(Head, null, props.image ? createElement(Fragment, null, createElement("meta", {
829
+
830
+ return createElement(Head, null, props.image ? [createElement("meta", {
831
+ key: "twitter:card",
818
832
  name: "twitter:card",
819
833
  content: "summary_large_image"
820
834
  }), createElement("meta", {
@@ -825,10 +839,11 @@ function PlasmicHead(props) {
825
839
  key: "twitter:image",
826
840
  name: "twitter:image",
827
841
  content: props.image
828
- })) : createElement("meta", {
842
+ })] : createElement("meta", {
843
+ key: "twitter:card",
829
844
  name: "twitter:card",
830
845
  content: "summary"
831
- }), props.title && createElement(Fragment, null, createElement("title", {
846
+ }), props.title && [createElement("title", {
832
847
  key: "title"
833
848
  }, props.title), createElement("meta", {
834
849
  key: "og:title",
@@ -838,7 +853,7 @@ function PlasmicHead(props) {
838
853
  key: "twitter:title",
839
854
  property: "twitter:title",
840
855
  content: props.title
841
- })), props.description && createElement(Fragment, null, createElement("meta", {
856
+ })], props.description && [createElement("meta", {
842
857
  key: "description",
843
858
  name: "description",
844
859
  content: props.description
@@ -850,7 +865,8 @@ function PlasmicHead(props) {
850
865
  key: "twitter:description",
851
866
  name: "twitter:description",
852
867
  content: props.description
853
- })), props.canonical && createElement("link", {
868
+ })], props.canonical && createElement("link", {
869
+ key: "canonical",
854
870
  ref: "canonical",
855
871
  href: props.canonical
856
872
  }));
@@ -858,7 +874,7 @@ function PlasmicHead(props) {
858
874
  var plasmicHeadMeta = {
859
875
  name: "hostless-plasmic-head",
860
876
  displayName: "Head",
861
- description: "Used to add page metadata to HEAD tag",
877
+ description: "Used to add page metadata to HTML <head />.",
862
878
  importName: "PlasmicHead",
863
879
  importPath: "@plasmicapp/react-web",
864
880
  isRepeatable: false,
@@ -1526,19 +1542,27 @@ function createUseScreenVariants(isMulti, screenQueries) {
1526
1542
  var PlasmicRootContext = /*#__PURE__*/createContext(undefined);
1527
1543
  function PlasmicRootProvider(props) {
1528
1544
  var platform = props.platform,
1529
- children = props.children;
1545
+ children = props.children,
1546
+ userAuthToken = props.userAuthToken;
1530
1547
  var context = useMemo(function () {
1531
1548
  return {
1532
1549
  platform: platform
1533
1550
  };
1534
1551
  }, [platform]);
1552
+ var dataSourceContextValue = useMemo(function () {
1553
+ return {
1554
+ userAuthToken: userAuthToken
1555
+ };
1556
+ }, [userAuthToken]);
1535
1557
  return createElement(PlasmicRootContext.Provider, {
1536
1558
  value: context
1537
- }, createElement(SSRProvider, null, createElement(PlasmicTranslatorContext.Provider, {
1559
+ }, createElement(SSRProvider, null, createElement(PlasmicDataSourceContextProvider, {
1560
+ value: dataSourceContextValue
1561
+ }, createElement(PlasmicTranslatorContext.Provider, {
1538
1562
  value: props.translator
1539
1563
  }, createElement(PlasmicHeadContext.Provider, {
1540
1564
  value: props.Head
1541
- }, children))));
1565
+ }, children)))));
1542
1566
  }
1543
1567
  var useIsSSR = useIsSSR$1;
1544
1568
  function useHasPlasmicRoot() {
@@ -3205,7 +3229,7 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissabl
3205
3229
 
3206
3230
  function generateStateOnChangeProp($state, stateName, dataReps) {
3207
3231
  return function (val, path) {
3208
- return dset($state, [stateName].concat(dataReps, path), val);
3232
+ return set($state, [stateName].concat(dataReps, path), val);
3209
3233
  };
3210
3234
  }
3211
3235
  /**
@@ -3219,8 +3243,51 @@ function generateStateValueProp($state, path // ["parent", 0, 1, "counter"]
3219
3243
  ) {
3220
3244
  return _get($state, path);
3221
3245
  }
3246
+ /**
3247
+ * Forked from https://github.com/lukeed/dset
3248
+ * Changes: fixed setting a deep value to a proxy object
3249
+ */
3250
+
3251
+ function set(obj, keys, val) {
3252
+ keys = keys.split ? keys.split(".") : keys;
3253
+ var i = 0,
3254
+ l = keys.length,
3255
+ t = obj,
3256
+ x,
3257
+ k;
3258
+
3259
+ while (i < l) {
3260
+ k = keys[i++];
3261
+ if (k === "__proto__" || k === "constructor" || k === "prototype") break;
3262
+
3263
+ if (i === l) {
3264
+ t[k] = val;
3265
+ t = t[k];
3266
+ } else {
3267
+ if (typeof (x = t[k]) === typeof keys) {
3268
+ t = t[k] = x;
3269
+ } else if (keys[i] * 0 !== 0 || !!~("" + keys[i]).indexOf(".")) {
3270
+ t[k] = {};
3271
+ t = t[k];
3272
+ } else {
3273
+ t[k] = [];
3274
+ t = t[k];
3275
+ }
3276
+ }
3277
+ }
3278
+ }
3279
+
3280
+ var mkUntrackedValue = function mkUntrackedValue(o) {
3281
+ return typeof o === "object" ? ref(o) : o;
3282
+ };
3283
+
3284
+ var transformPathStringToObj = function transformPathStringToObj(str) {
3285
+ var splitStatePathPart = function splitStatePathPart(state) {
3286
+ return state.endsWith("[]") ? [].concat(splitStatePathPart(state.slice(0, -2)), ["[]"]) : [state];
3287
+ };
3222
3288
 
3223
- var UNINITIALIZED = /*#__PURE__*/Symbol("plasmic.unitialized");
3289
+ return str.split(".").flatMap(splitStatePathPart);
3290
+ };
3224
3291
 
3225
3292
  function shallowEqual(a1, a2) {
3226
3293
  if (a1.length !== a2.length) {
@@ -3236,145 +3303,144 @@ function shallowEqual(a1, a2) {
3236
3303
  return true;
3237
3304
  }
3238
3305
 
3239
- var isNum = function isNum(value) {
3306
+ function isNum(value) {
3240
3307
  return typeof value === "symbol" ? false : !isNaN(+value);
3241
- };
3308
+ }
3242
3309
 
3243
- function mkProxy(specs, maybeHandlers) {
3244
- var handlers = maybeHandlers != null ? maybeHandlers : function () {
3245
- return {
3246
- get: function get(target, property) {
3247
- return target[property];
3248
- },
3249
- set: function set(target, property, value) {
3250
- return (target[property] = value) || true;
3251
- }
3252
- };
3253
- };
3310
+ function saveNewState($$state, path, spec) {
3311
+ var key = JSON.stringify(path);
3312
+ $$state.existingStates.set(key, {
3313
+ path: path,
3314
+ specKey: spec.path
3315
+ });
3316
+
3317
+ if (!$$state.statesInstanceBySpec.has(spec.path)) {
3318
+ $$state.statesInstanceBySpec.set(spec.path, []);
3319
+ }
3254
3320
 
3255
- var getNextParts = function getNextParts(currPath) {
3256
- return Object.fromEntries(Object.values(specs).filter(function (spec) {
3321
+ $$state.statesInstanceBySpec.get(spec.path).push({
3322
+ path: path,
3323
+ specKey: spec.path
3324
+ });
3325
+ }
3326
+
3327
+ function create$StateProxy($$state, handlers) {
3328
+ var getNextKeyToSpecMap = function getNextKeyToSpecMap(currPath) {
3329
+ return new Map(Object.entries(Object.values($$state.specsByKey).filter(function (spec) {
3257
3330
  return shallowEqual(currPath.map(function (p) {
3258
3331
  return isNum(p) ? "[]" : p;
3259
- }), spec.path.slice(0, currPath.length));
3260
- }).map(function (spec) {
3261
- var nextPart = spec.path[currPath.length];
3262
-
3263
- if (spec.path.length === currPath.length + 1) {
3264
- return [nextPart, {
3265
- isLast: true,
3266
- specKey: spec.pathStr
3267
- }];
3268
- } else {
3269
- return [nextPart, {
3270
- isLast: false,
3271
- specKey: spec.pathStr
3272
- }];
3332
+ }), spec.pathObj.slice(0, currPath.length));
3333
+ }).reduce(function (agg, spec) {
3334
+ var nextKey = spec.pathObj[currPath.length];
3335
+
3336
+ if (!(nextKey in agg)) {
3337
+ agg[nextKey] = [];
3273
3338
  }
3274
- }));
3275
- };
3276
- /**
3277
- * We use this function when we're setting a value in the middle of the state path.
3278
- * We can't just set the value, because we need to keep the proxy properties, so
3279
- * we use the specs to walk through the object and just set the value in the end of the path
3280
- **/
3281
3339
 
3340
+ agg[nextKey].push(spec);
3341
+ return agg;
3342
+ }, {})));
3343
+ };
3282
3344
 
3283
- var cloneValue = function cloneValue(target, currPath, value) {
3284
- if (typeof value !== "object") {
3285
- return;
3286
- }
3345
+ var rec = function rec(currPath) {
3346
+ var nextKeyToSpecs = getNextKeyToSpecMap(currPath);
3287
3347
 
3288
- var nextParts = getNextParts(currPath);
3348
+ var getSpecForProperty = function getSpecForProperty(property) {
3349
+ var _nextKeyToSpecs$get, _nextKeyToSpecs$get2;
3289
3350
 
3290
- for (var _i = 0, _Object$entries = Object.entries(nextParts); _i < _Object$entries.length; _i++) {
3291
- var _Object$entries$_i = _Object$entries[_i],
3292
- nextPart = _Object$entries$_i[0],
3293
- _Object$entries$_i$ = _Object$entries$_i[1],
3294
- isLast = _Object$entries$_i$.isLast,
3295
- specKey = _Object$entries$_i$.specKey;
3351
+ return nextKeyToSpecs.has("[]") && isNum(property) ? (_nextKeyToSpecs$get = nextKeyToSpecs.get("[]")) == null ? void 0 : _nextKeyToSpecs$get[0] : typeof property === "string" && nextKeyToSpecs.has(property) ? (_nextKeyToSpecs$get2 = nextKeyToSpecs.get(property)) == null ? void 0 : _nextKeyToSpecs$get2[0] : undefined;
3352
+ };
3296
3353
 
3297
- if (nextPart === "[]" && Array.isArray(value)) {
3298
- for (var i = 0; i < value.length; i++) {
3299
- cloneValue(target[i], [].concat(currPath, [i]), value[i]);
3300
- }
3301
- } else if (nextPart in value) {
3302
- if (isLast) {
3303
- var _handlers$set, _handlers;
3304
-
3305
- handlers == null ? void 0 : (_handlers$set = (_handlers = handlers({
3306
- specKey: specKey,
3307
- path: [].concat(currPath, [nextPart])
3308
- })).set) == null ? void 0 : _handlers$set.call(_handlers, target, nextPart, value[nextPart], undefined);
3309
- } else {
3310
- cloneValue(target[nextPart], [].concat(currPath, [nextPart]), value[nextPart]);
3311
- }
3312
- }
3313
- }
3314
- };
3354
+ var getNextPath = function getNextPath(property) {
3355
+ return [].concat(currPath, [isNum(property) ? +property : property]);
3356
+ };
3315
3357
 
3316
- var rec = function rec(currPath) {
3317
- var nextParts = getNextParts(currPath);
3318
- return new Proxy("[]" in nextParts ? [] : {}, {
3358
+ return new Proxy(nextKeyToSpecs.has("[]") ? [] : {}, {
3319
3359
  deleteProperty: function deleteProperty(target, property) {
3320
- if ("[]" in nextParts && isNum(property)) {
3321
- var _handlers$deletePrope, _handlers2;
3322
-
3323
- delete target[property];
3324
- handlers == null ? void 0 : (_handlers$deletePrope = (_handlers2 = handlers({
3325
- path: [].concat(currPath, [+property]),
3326
- specKey: nextParts["[]"].specKey
3327
- })).deleteProperty) == null ? void 0 : _handlers$deletePrope.call(_handlers2, target, property);
3328
- } else {
3329
- throw new Error("You can't delete a non-repeated property in the middle of the path");
3330
- }
3360
+ var prefixPath = getNextPath(property);
3361
+ var specKeysToUpdate = new Set();
3362
+ $$state.existingStates.forEach(function (_ref) {
3363
+ var path = _ref.path,
3364
+ specKey = _ref.specKey;
3365
+
3366
+ if (path.length >= prefixPath.length && shallowEqual(path.slice(0, prefixPath.length), prefixPath)) {
3367
+ deleteState($$state, path);
3368
+ specKeysToUpdate.add(specKey);
3369
+ }
3370
+ });
3371
+ specKeysToUpdate.forEach(function (specKey) {
3372
+ var spec = $$state.specsByKey[specKey];
3331
3373
 
3332
- return true;
3374
+ if (spec.onChangeProp) {
3375
+ var _$$state$props$spec$o, _$$state$props;
3376
+
3377
+ (_$$state$props$spec$o = (_$$state$props = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o.call(_$$state$props, _get($$state.stateValues, currPath), currPath);
3378
+ }
3379
+ });
3380
+ return Reflect.deleteProperty(target, property);
3333
3381
  },
3334
3382
  get: function get(target, property, receiver) {
3335
- if ("[]" in nextParts && isNum(property)) {
3336
- if (!(property in target)) {
3337
- target[property] = rec([].concat(currPath, [+property]));
3338
- }
3339
- } else if (property in nextParts) {
3340
- if (nextParts[property].isLast) {
3341
- var _handlers$get, _handlers3;
3342
-
3343
- return target[property] = handlers == null ? void 0 : (_handlers$get = (_handlers3 = handlers({
3344
- path: [].concat(currPath, [property]),
3345
- specKey: nextParts[property].specKey
3346
- })).get) == null ? void 0 : _handlers$get.call(_handlers3, target, property, receiver);
3383
+ var spec = getSpecForProperty(property);
3384
+
3385
+ if (spec && typeof property !== "symbol") {
3386
+ var nextPath = getNextPath(property);
3387
+
3388
+ if (spec.pathObj.length === currPath.length + 1) {
3389
+ var _handlers$get, _handlers;
3390
+
3391
+ // reached the end of the spec
3392
+ target[property] = (_handlers$get = (_handlers = handlers(nextPath, spec)).get) == null ? void 0 : _handlers$get.call(_handlers, target, property, receiver);
3347
3393
  } else if (!(property in target)) {
3348
- target[property] = rec([].concat(currPath, [property]));
3394
+ target[property] = rec(nextPath);
3349
3395
  }
3350
3396
  }
3351
3397
 
3352
- return target[property];
3398
+ return Reflect.get(target, property, receiver);
3353
3399
  },
3354
- set: function set(target, property, value, receiver) {
3355
- if ("[]" in nextParts && isNum(property)) {
3356
- if (!(property in target)) {
3357
- target[property] = rec([].concat(currPath, [+property]));
3358
- }
3359
- } else if (property in nextParts) {
3360
- if (nextParts[property].isLast) {
3361
- var _handlers$set2, _handlers$set3, _handlers4;
3362
-
3363
- target[property] = value;
3364
- return (_handlers$set2 = (_handlers$set3 = (_handlers4 = handlers({
3365
- path: [].concat(currPath, [property]),
3366
- specKey: nextParts[property].specKey
3367
- })).set) == null ? void 0 : _handlers$set3.call(_handlers4, target, property, value, receiver)) != null ? _handlers$set2 : false;
3400
+ set: function set$1(target, property, value, receiver) {
3401
+ var spec = getSpecForProperty(property);
3402
+ var nextPath = getNextPath(property);
3403
+
3404
+ if (spec && typeof property !== "symbol") {
3405
+ if (spec.pathObj.length === currPath.length + 1) {
3406
+ var _handlers$set, _handlers2;
3407
+
3408
+ // reached the end of the spec
3409
+ target[property] = (_handlers$set = (_handlers2 = handlers(nextPath, spec)).set) == null ? void 0 : _handlers$set.call(_handlers2, target, property, value, receiver);
3410
+ return Reflect.set(target, property, value, receiver);
3411
+ } else if (typeof value === "object") {
3412
+ target[property] = rec(nextPath);
3413
+
3414
+ for (var _i = 0, _Object$keys = Object.keys(value); _i < _Object$keys.length; _i++) {
3415
+ var key = _Object$keys[_i];
3416
+ target[property][key] = value[key];
3417
+ }
3418
+
3419
+ return true;
3368
3420
  }
3369
3421
  }
3370
3422
 
3371
- if (property === "registerInitFunc") {
3372
- target[property] = value;
3373
- } else if (typeof value === "object") {
3374
- cloneValue(target[property], [].concat(currPath, [isNum(property) ? +property : property]), value);
3423
+ if (property === "registerInitFunc" && currPath.length === 0) {
3424
+ return Reflect.set(target, property, value, receiver);
3375
3425
  }
3376
3426
 
3377
- return true;
3427
+ if (nextKeyToSpecs.has("[]")) {
3428
+ var _nextKeyToSpecs$get3;
3429
+
3430
+ set($$state.stateValues, nextPath, value);
3431
+
3432
+ (_nextKeyToSpecs$get3 = nextKeyToSpecs.get("[]")) == null ? void 0 : _nextKeyToSpecs$get3.forEach(function (spec) {
3433
+ if (spec != null && spec.onChangeProp) {
3434
+ var _$$state$props$spec$o2, _$$state$props2;
3435
+
3436
+ (_$$state$props$spec$o2 = (_$$state$props2 = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o2.call(_$$state$props2, value, nextPath);
3437
+ }
3438
+ });
3439
+ return Reflect.set(target, property, value, receiver);
3440
+ } // invalid setting a value that doesn't make part of the spec
3441
+
3442
+
3443
+ return false;
3378
3444
  }
3379
3445
  });
3380
3446
  };
@@ -3382,136 +3448,136 @@ function mkProxy(specs, maybeHandlers) {
3382
3448
  return rec([]);
3383
3449
  }
3384
3450
 
3385
- function cloneProxy(specs, states, obj) {
3386
- var newObj = mkProxy(specs);
3387
- Object.values(states).forEach(function (_ref) {
3388
- var path = _ref.path;
3451
+ var deleteState = function deleteState($$state, path) {
3452
+ var _$$state$unsubscripti;
3389
3453
 
3390
- dset(newObj, path, _get(obj, path));
3454
+ var key = JSON.stringify(path);
3455
+ (_$$state$unsubscripti = $$state.unsubscriptionsByState[key]) == null ? void 0 : _$$state$unsubscripti.forEach(function (f) {
3456
+ return f();
3391
3457
  });
3392
- return newObj;
3393
- }
3458
+ delete $$state.unsubscriptionsByState[key];
3459
+ $$state.existingStates["delete"](key); // delete get($$state.stateValues, path.slice(-1))[path.slice(-1)[0]];
3460
+ // delete get($$state.initStateValues, path.slice(-1))[path.slice(-1)[0]];
3461
+ };
3394
3462
 
3395
- function saveState(state, states) {
3396
- states[JSON.stringify(state.path)] = state;
3397
- }
3463
+ var getIndexes = function getIndexes(path, spec) {
3464
+ var indexes = [];
3398
3465
 
3399
- function hasState(state, states) {
3400
- return JSON.stringify(state.path) in states;
3401
- }
3466
+ if (path.length !== spec.pathObj.length) {
3467
+ throw new Error("Unexpected error: state path and spec path have different lengths");
3468
+ }
3402
3469
 
3403
- var transformPathStringToObj = function transformPathStringToObj(str) {
3404
- // "c[][]" -> ["c", "[]", "[]"]
3405
- var splitStatePathPart = function splitStatePathPart(state) {
3406
- return state.endsWith("[]") ? [].concat(splitStatePathPart(state.slice(0, -2)), ["[]"]) : [state];
3407
- };
3470
+ for (var i = 0; i < spec.pathObj.length; i++) {
3471
+ if (spec.pathObj[i] === "[]") {
3472
+ indexes.push(path[i]);
3473
+ }
3474
+ }
3408
3475
 
3409
- return str.split(".").flatMap(splitStatePathPart);
3476
+ return indexes;
3410
3477
  };
3411
3478
 
3412
- function useVanillaDollarState(_specs, props) {
3413
- var forceRender = React__default.useState(0)[1];
3414
- var $$state = React__default.useMemo(function () {
3415
- var specs = Object.fromEntries(_specs.map(function (_ref2) {
3416
- var pathStr = _ref2.path,
3417
- spec = _objectWithoutPropertiesLoose(_ref2, ["path"]);
3418
-
3419
- return [pathStr, _extends({}, spec, {
3420
- pathStr: pathStr,
3421
- path: transformPathStringToObj(pathStr),
3422
- isRepeated: pathStr.split(".").some(function (part) {
3423
- return part.endsWith("[]");
3424
- })
3425
- })];
3426
- }));
3427
- return {
3428
- stateValues: mkProxy(specs),
3429
- initStateDeps: {},
3430
- initStateValues: mkProxy(specs),
3431
- states: {},
3432
- specs: specs
3433
- };
3434
- }, []);
3435
- var $state = Object.assign(mkProxy($$state.specs, function (state) {
3436
- return {
3437
- deleteProperty: function deleteProperty(_target, _property) {
3438
- var prefixPath = state.path;
3439
-
3440
- for (var _i2 = 0, _Object$entries2 = Object.entries($$state.states); _i2 < _Object$entries2.length; _i2++) {
3441
- var _Object$entries2$_i = _Object$entries2[_i2],
3442
- key = _Object$entries2$_i[0],
3443
- existingState = _Object$entries2$_i[1];
3479
+ function initializeStateValue($$state, initialStatePath, initialSpec) {
3480
+ var _$$state$unsubscripti2;
3444
3481
 
3445
- if (existingState.path.length >= prefixPath.length && shallowEqual(existingState.path.slice(0, prefixPath.length), prefixPath)) {
3446
- delete $$state.states[key];
3447
- }
3448
- }
3449
-
3450
- forceRender(function (r) {
3451
- return r + 1;
3482
+ var initialStateKey = JSON.stringify(initialStatePath);
3483
+ var stateAccess = new Set();
3484
+ var $state = create$StateProxy($$state, function (path, spec) {
3485
+ return {
3486
+ get: function get() {
3487
+ var key = JSON.stringify(path);
3488
+ stateAccess.add({
3489
+ path: path,
3490
+ spec: spec
3452
3491
  });
3453
- return true;
3454
- },
3455
- get: function get(_target, _property) {
3456
- var spec = $$state.specs[state.specKey];
3457
3492
 
3458
3493
  if (spec.valueProp) {
3459
- if (!spec.isRepeated) {
3460
- return props[spec.valueProp];
3461
- } else {
3462
- return _get(props[spec.valueProp], state.path.slice(1));
3463
- }
3494
+ return !spec.isRepeated ? $$state.props[spec.valueProp] : _get($$state.props[spec.valueProp], path.slice(1));
3464
3495
  }
3465
3496
 
3466
- if (!hasState(state, $$state.states)) {
3467
- var _spec$initVal;
3497
+ if ($$state.existingStates.has(key)) {
3498
+ // is already initialized
3499
+ return _get($$state.stateValues, path);
3500
+ } else if (spec.initFunc) {
3501
+ initializeStateValue($$state, path, spec);
3502
+ }
3468
3503
 
3469
- saveState(state, $$state.states);
3504
+ return _get($$state.stateValues, path);
3505
+ },
3506
+ set: function set() {
3507
+ throw new Error("Cannot update state values during initialization");
3508
+ }
3509
+ };
3510
+ });
3511
+ (_$$state$unsubscripti2 = $$state.unsubscriptionsByState[initialStateKey]) == null ? void 0 : _$$state$unsubscripti2.forEach(function (f) {
3512
+ return f();
3513
+ });
3514
+ $$state.unsubscriptionsByState[initialStateKey] = [];
3515
+ stateAccess.forEach(function (_ref2) {
3516
+ var path = _ref2.path,
3517
+ spec = _ref2.spec;
3518
+ var unsubscribe = subscribeKey(_get($$state.stateValues, path.slice(-1)), path.slice(-1)[0], function () {
3519
+ return set($$state.stateValues, initialStatePath, mkUntrackedValue(initialSpec.initFunc($$state.props, $state, getIndexes(path, spec))));
3520
+ });
3521
+ $$state.unsubscriptionsByState[initialStateKey].push(unsubscribe);
3522
+ });
3523
+ var untrackedInitialValue = mkUntrackedValue(initialSpec.initFunc($$state.props, $state, getIndexes(initialStatePath, initialSpec)));
3470
3524
 
3471
- dset($$state.stateValues, state.path, spec.initFunc ? UNINITIALIZED : (_spec$initVal = spec.initVal) != null ? _spec$initVal : undefined);
3525
+ set($$state.initStateValues, initialStatePath, untrackedInitialValue);
3472
3526
 
3473
- var deps = spec.initFunc ? fillUninitializedStateValues($$state.specs, props, $$state.stateValues, $$state.states) : {};
3527
+ set($$state.stateValues, initialStatePath, untrackedInitialValue);
3474
3528
 
3475
- dset($$state.initStateValues, state.path, _get($$state.stateValues, state.path));
3529
+ return untrackedInitialValue;
3530
+ }
3476
3531
 
3477
- $$state.initStateDeps = _extends({}, $$state.initStateDeps, deps);
3478
- forceRender(function (r) {
3479
- return r + 1;
3480
- });
3481
- return spec.initFunc ? spec.initFunc(props, $state) : spec.initVal;
3482
- }
3532
+ function useDollarState(specs, props) {
3533
+ var $$state = React__default.useRef(proxy({
3534
+ stateValues: {},
3535
+ initStateValues: {},
3536
+ specsByKey: Object.fromEntries(specs.map(function (spec) {
3537
+ return [spec.path, _extends({}, spec, {
3538
+ pathObj: transformPathStringToObj(spec.path),
3539
+ isRepeated: spec.path.split(".").some(function (part) {
3540
+ return part.endsWith("[]");
3541
+ })
3542
+ })];
3543
+ })),
3544
+ statesInstanceBySpec: new Map(),
3545
+ existingStates: new Map(),
3546
+ unsubscriptionsByState: {},
3547
+ props: undefined,
3548
+ registrationsQueue: []
3549
+ })).current;
3550
+ $$state.props = mkUntrackedValue(props);
3551
+ var $state = React__default.useRef(Object.assign(create$StateProxy($$state, function (path, spec) {
3552
+ var key = JSON.stringify(path);
3483
3553
 
3484
- return _get($$state.stateValues, state.path);
3485
- },
3486
- set: function set(_target, _property, newValue) {
3487
- if (newValue !== _get($$state.stateValues, state.path)) {
3488
- saveState(state, $$state.states);
3554
+ if (!$$state.existingStates.has(key)) {
3555
+ var _spec$initVal;
3489
3556
 
3490
- dset($$state.stateValues, state.path, newValue);
3557
+ saveNewState($$state, path, spec);
3558
+ var untrackedValue = !spec.initFunc ? mkUntrackedValue((_spec$initVal = spec.initVal) != null ? _spec$initVal : undefined) : initializeStateValue($$state, path, spec);
3491
3559
 
3492
- for (var _i3 = 0, _Object$entries3 = Object.entries($$state.initStateDeps); _i3 < _Object$entries3.length; _i3++) {
3493
- var _Object$entries3$_i = _Object$entries3[_i3],
3494
- key = _Object$entries3$_i[0],
3495
- deps = _Object$entries3$_i[1];
3560
+ set($$state.stateValues, path, untrackedValue);
3496
3561
 
3497
- if (deps.includes(JSON.stringify(state.path))) {
3498
- dset($$state.stateValues, JSON.parse(key), UNINITIALIZED);
3499
- }
3500
- }
3562
+ set($$state.initStateValues, path, untrackedValue);
3563
+ }
3501
3564
 
3502
- var newDeps = fillUninitializedStateValues($$state.specs, props, $$state.stateValues, $$state.states);
3503
- $$state.initStateDeps = _extends({}, $$state.initStateDeps, newDeps);
3504
- forceRender(function (r) {
3505
- return r + 1;
3506
- });
3565
+ return {
3566
+ get: function get() {
3567
+ if (spec.valueProp) {
3568
+ var value = !spec.isRepeated ? $$state.props[spec.valueProp] : _get($$state.props[spec.valueProp], path.slice(1));
3569
+ return value;
3570
+ } else {
3571
+ return _get($$state.stateValues, path);
3507
3572
  }
3508
-
3509
- var spec = $$state.specs[state.specKey];
3573
+ },
3574
+ set: function set$1(_t, _p, value) {
3575
+ set($$state.stateValues, path, mkUntrackedValue(value));
3510
3576
 
3511
3577
  if (spec.onChangeProp) {
3512
- var _props$spec$onChangeP;
3578
+ var _$$state$props$spec$o3, _$$state$props3;
3513
3579
 
3514
- (_props$spec$onChangeP = props[spec.onChangeProp]) == null ? void 0 : _props$spec$onChangeP.call(props, newValue, state.path);
3580
+ (_$$state$props$spec$o3 = (_$$state$props3 = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o3.call(_$$state$props3, value, path);
3515
3581
  }
3516
3582
 
3517
3583
  return true;
@@ -3519,158 +3585,118 @@ function useVanillaDollarState(_specs, props) {
3519
3585
  };
3520
3586
  }), {
3521
3587
  registerInitFunc: function registerInitFunc(pathStr, f) {
3522
- if (Object.values($$state.states).filter(function (_ref3) {
3523
- var specKey = _ref3.specKey;
3524
- return specKey === pathStr;
3525
- }).some(function (_ref4) {
3526
- var path = _ref4.path;
3527
- return _get($$state.stateValues, path) !== f(props, $state);
3588
+ var _$$state$statesInstan;
3589
+
3590
+ if ((_$$state$statesInstan = $$state.statesInstanceBySpec.get(pathStr)) != null && _$$state$statesInstan.some(function (_ref3) {
3591
+ var path = _ref3.path,
3592
+ specKey = _ref3.specKey;
3593
+ return !deepEqual(_get($$state.initStateValues, path), f(props, $state, getIndexes(path, $$state.specsByKey[specKey])));
3528
3594
  })) {
3529
- $$state.specs[pathStr] = _extends({}, $$state.specs[pathStr], {
3530
- initFunc: f
3531
- });
3532
- forceRender(function (r) {
3533
- return r + 1;
3595
+ $$state.registrationsQueue.push({
3596
+ pathStr: pathStr,
3597
+ f: f
3534
3598
  });
3535
3599
  }
3536
3600
  }
3537
- }); // For each spec with an initFunc, evaluate it and see if
3601
+ })).current; // For each spec with an initFunc, evaluate it and see if
3538
3602
  // the init value has changed. If so, reset its state.
3539
3603
 
3540
- var newStateValues = undefined;
3541
3604
  var resetSpecs = [];
3542
-
3543
- for (var _i4 = 0, _Object$values = Object.values($$state.states); _i4 < _Object$values.length; _i4++) {
3544
- var _Object$values$_i = _Object$values[_i4],
3545
- path = _Object$values$_i.path,
3546
- specKey = _Object$values$_i.specKey;
3547
- var spec = $$state.specs[specKey];
3605
+ $$state.existingStates.forEach(function (_ref4) {
3606
+ var path = _ref4.path,
3607
+ specKey = _ref4.specKey;
3608
+ var spec = $$state.specsByKey[specKey];
3548
3609
 
3549
3610
  if (spec.initFunc) {
3550
- var newInit = spec.initFunc(props, $state);
3611
+ var newInit = spec.initFunc(props, $state, getIndexes(path, spec));
3551
3612
 
3552
- if (newInit !== _get($$state.initStateValues, path)) {
3553
- console.log("init changed for " + JSON.stringify(path) + " from " + _get($$state.initStateValues, path) + " to " + newInit + "; resetting state");
3613
+ if (!deepEqual(newInit, _get($$state.initStateValues, path))) {
3554
3614
  resetSpecs.push({
3555
3615
  path: path,
3556
- specKey: specKey
3616
+ spec: spec
3557
3617
  });
3558
-
3559
- if (!newStateValues) {
3560
- newStateValues = cloneProxy($$state.specs, $$state.states, $$state.stateValues);
3561
- }
3562
-
3563
- dset(newStateValues, path, UNINITIALIZED);
3564
3618
  }
3565
3619
  }
3566
- }
3567
-
3620
+ });
3568
3621
  React__default.useLayoutEffect(function () {
3569
- if (newStateValues !== undefined) {
3570
- var newDeps = fillUninitializedStateValues($$state.specs, props, newStateValues, $$state.states);
3571
- var initStateValues = cloneProxy($$state.specs, $$state.states, $$state.initStateValues);
3572
- resetSpecs.forEach(function (_ref5) {
3573
- var path = _ref5.path;
3574
-
3575
- dset(initStateValues, path, _get(newStateValues, path));
3576
- });
3577
- $$state.stateValues = cloneProxy($$state.specs, $$state.states, newStateValues);
3578
- $$state.initStateValues = initStateValues;
3579
- $$state.initStateDeps = _extends({}, $$state.initStateDeps, newDeps);
3580
- forceRender(function (r) {
3581
- return r + 1;
3582
- });
3583
-
3584
- for (var _iterator = _createForOfIteratorHelperLoose(resetSpecs), _step; !(_step = _iterator()).done;) {
3585
- var _step$value = _step.value,
3586
- _path = _step$value.path,
3587
- _specKey = _step$value.specKey;
3588
- var _spec = $$state.specs[_specKey];
3622
+ resetSpecs.forEach(function (_ref5) {
3623
+ var path = _ref5.path,
3624
+ spec = _ref5.spec;
3625
+ var newInit = initializeStateValue($$state, path, spec);
3589
3626
 
3590
- if (_spec.onChangeProp) {
3591
- var _props$_spec$onChange;
3627
+ if (spec.onChangeProp) {
3628
+ var _$$state$props$spec$o4, _$$state$props4;
3592
3629
 
3593
- console.log("Firing onChange for reset init value: " + _spec.path, _get(newStateValues, _path));
3594
- (_props$_spec$onChange = props[_spec.onChangeProp]) == null ? void 0 : _props$_spec$onChange.call(props, _get(newStateValues, _path));
3595
- }
3630
+ (_$$state$props$spec$o4 = (_$$state$props4 = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o4.call(_$$state$props4, newInit, path);
3596
3631
  }
3597
- }
3598
- }, [newStateValues, props, resetSpecs, $$state.specs]);
3599
- /* *
3600
- * Initialize all known states. (we need to do it for repeated states
3601
- * because they're created only after the first get/set operation)
3602
- * If we don't initialize them, we won't be able to consume the repeated states properly.
3603
- * For example, let's say the consumer is just mapping the repeated states. The first operation
3604
- * is to get the length of the array which will always be 0 because the existing states
3605
- * weren't allocated yet -- they're only stored in internal state)
3606
- * */
3607
-
3608
- for (var _i5 = 0, _Object$values2 = Object.values($$state.states); _i5 < _Object$values2.length; _i5++) {
3609
- var _path2 = _Object$values2[_i5].path;
3610
-
3611
- _get($state, _path2);
3612
- }
3632
+ });
3633
+ }, [props, resetSpecs]);
3634
+ React__default.useLayoutEffect(function () {
3635
+ $$state.registrationsQueue.forEach(function (_ref6) {
3636
+ var f = _ref6.f,
3637
+ pathStr = _ref6.pathStr;
3638
+ $$state.specsByKey[pathStr].initFunc = f;
3639
+ });
3640
+ $$state.registrationsQueue = [];
3641
+ }, [$$state.registrationsQueue]); // Re-render if any value changed in one of these objects
3613
3642
 
3643
+ useSnapshot($$state.stateValues, {
3644
+ sync: true
3645
+ });
3646
+ useSnapshot($$state.specsByKey, {
3647
+ sync: true
3648
+ });
3614
3649
  return $state;
3615
3650
  }
3616
3651
 
3617
- function fillUninitializedStateValues(specs, props, stateValues, states) {
3618
- var stateAccessStack = [new Set()];
3619
- var initFuncDeps = {};
3620
- var $state = Object.assign(mkProxy(specs, function (state) {
3652
+ function useCanvasDollarState(specs, props) {
3653
+ var $$state = proxy({
3654
+ stateValues: {},
3655
+ initStateValues: {},
3656
+ specsByKey: Object.fromEntries(specs.map(function (spec) {
3657
+ return [spec.path, _extends({}, spec, {
3658
+ pathObj: transformPathStringToObj(spec.path),
3659
+ isRepeated: spec.path.split(".").some(function (part) {
3660
+ return part.endsWith("[]");
3661
+ })
3662
+ })];
3663
+ })),
3664
+ statesInstanceBySpec: new Map(),
3665
+ existingStates: new Map(),
3666
+ unsubscriptionsByState: {},
3667
+ props: undefined,
3668
+ registrationsQueue: []
3669
+ });
3670
+ $$state.props = mkUntrackedValue(props);
3671
+ var $state = create$StateProxy($$state, function (path, spec) {
3621
3672
  return {
3622
- get: function get(_target, _property) {
3623
- var spec = specs[state.specKey];
3624
-
3625
- if (spec.valueProp) {
3626
- if (!spec.isRepeated) {
3627
- return props[spec.valueProp];
3628
- } else {
3629
- return _get(props[spec.valueProp], state.path.slice(1));
3630
- }
3631
- }
3632
-
3633
- var value = _get(stateValues, state.path);
3634
-
3635
- if (value === UNINITIALIZED) {
3636
- // This value has a init expression; need to be evaluated.
3637
- value = tracked(state);
3673
+ get: function get() {
3674
+ return _get($$state.stateValues, path);
3675
+ },
3676
+ set: function set$1(_t, _p, value) {
3677
+ set($$state.stateValues, path, mkUntrackedValue(value));
3638
3678
 
3639
- dset(stateValues, state.path, value);
3640
- } // Record that this field had just been accessed; for
3641
- // trackInit() to know what fields were used to compute
3642
- // the init value
3679
+ if (spec.onChangeProp) {
3680
+ var _$$state$props$spec$o5, _$$state$props5;
3643
3681
 
3682
+ (_$$state$props$spec$o5 = (_$$state$props5 = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o5.call(_$$state$props5, value, path);
3683
+ }
3644
3684
 
3645
- stateAccessStack[stateAccessStack.length - 1].add(JSON.stringify(state.path));
3646
- return value;
3647
- },
3648
- set: function set() {
3649
- throw new Error("Cannot update state values during initialization");
3685
+ return true;
3650
3686
  }
3651
3687
  };
3652
- }), {
3653
- registerInitFunc: function registerInitFunc() {}
3654
3688
  });
3655
3689
 
3656
- function tracked(state) {
3657
- stateAccessStack.push(new Set());
3658
- var res = specs[state.specKey].initFunc(props, $state);
3659
- var deps = stateAccessStack.pop();
3660
- initFuncDeps[JSON.stringify(state.path)] = [].concat(deps.values());
3661
- return res;
3662
- }
3663
-
3664
- for (var _i6 = 0, _Object$values3 = Object.values(states); _i6 < _Object$values3.length; _i6++) {
3665
- var path = _Object$values3[_i6].path;
3690
+ for (var _iterator = _createForOfIteratorHelperLoose(specs), _step; !(_step = _iterator()).done;) {
3691
+ var spec = _step.value;
3692
+ var path = transformPathStringToObj(spec.path);
3693
+ var init = spec.valueProp ? $$state.props[spec.valueProp] : spec.initVal ? spec.initVal : spec.initFunc ? initializeStateValue($$state, path, $$state.specsByKey[spec.path]) : undefined;
3666
3694
 
3667
- if (_get(stateValues, path) === UNINITIALIZED) {
3668
- _get($state, path);
3669
- }
3695
+ set($state, path, init);
3670
3696
  }
3671
3697
 
3672
- return initFuncDeps;
3698
+ return $state;
3673
3699
  }
3674
3700
 
3675
- export { DropdownMenu, PlasmicHead, PlasmicIcon, PlasmicImg, PlasmicLink, PlasmicRootProvider, PlasmicSlot, SelectContext, Stack, Trans, TriggeredOverlayContext, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, genTranslatableString, generateStateOnChangeProp, generateStateValueProp, getDataProps, hasVariant, makeFragment, omit, pick, plasmicHeadMeta, renderPlasmicSlot, setPlumeStrictMode, useButton, useCheckbox, useVanillaDollarState as useDollarState, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, wrapWithClassName };
3701
+ export { DropdownMenu, PlasmicHead, PlasmicIcon, PlasmicImg, PlasmicLink, PlasmicRootProvider, PlasmicSlot, SelectContext, Stack, Trans, TriggeredOverlayContext, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, genTranslatableString, generateStateOnChangeProp, generateStateValueProp, getDataProps, hasVariant, makeFragment, mergeVariantsWithStates, omit, pick, plasmicHeadMeta, renderPlasmicSlot, set, setPlumeStrictMode, useButton, useCanvasDollarState, useCheckbox, useDollarState, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, wrapWithClassName };
3676
3702
  //# sourceMappingURL=react-web.esm.js.map