@plasmicapp/react-web 0.2.100 → 0.2.103

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.
@@ -25,6 +25,8 @@ var listbox = require('@react-aria/listbox');
25
25
  var select$1 = require('@react-stately/select');
26
26
  var _switch = require('@react-aria/switch');
27
27
  var overlays = require('@react-aria/overlays');
28
+ var _get = _interopDefault(require('dlv'));
29
+ var dset = require('dset');
28
30
 
29
31
  function _extends() {
30
32
  _extends = Object.assign || function (target) {
@@ -852,7 +854,7 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
852
854
  fullHeight = _ref.fullHeight,
853
855
  aspectRatio = _ref.aspectRatio;
854
856
 
855
- var srcStr = src ? typeof src === "string" ? src : src.src : ""; // Assume external image if either dimension is null and use usual <img>
857
+ var srcStr = src ? typeof src === "string" ? src : typeof src.src === "string" ? src.src : src.src.src : ""; // Assume external image if either dimension is null and use usual <img>
856
858
 
857
859
  if (fullHeight == null || fullWidth == null) {
858
860
  return React__default.createElement("img", Object.assign({
@@ -869,6 +871,8 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
869
871
  displayWidth = "100%";
870
872
  }
871
873
 
874
+ var computedDisplayWidth = displayWidth;
875
+
872
876
  if (fullWidth && fullHeight && (!displayWidth || displayWidth === "auto") && !!getPixelLength(displayHeight)) {
873
877
  // If there's a pixel length specified for displayHeight but not displayWidth,
874
878
  // then we can derive the pixel length for displayWidth. Having an explicit
@@ -878,7 +882,7 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
878
882
  // We shouldn't do it for SVGs though, because `fullWidth` and
879
883
  // `fullHeight` might have rounded values so the final
880
884
  // `displayWidth` could differ by 1px or so.
881
- displayWidth = getPixelLength(displayHeight) * fullWidth / fullHeight;
885
+ computedDisplayWidth = getPixelLength(displayHeight) * fullWidth / fullHeight;
882
886
  }
883
887
  }
884
888
 
@@ -894,7 +898,7 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
894
898
  spacerHeight = Math.round(spacerWidth / aspectRatio);
895
899
  }
896
900
 
897
- var _getWidths = getWidths(displayWidth, fullWidth, {
901
+ var _getWidths = getWidths(computedDisplayWidth, fullWidth, {
898
902
  minWidth: displayMinWidth
899
903
  }),
900
904
  sizes = _getWidths.sizes,
@@ -1202,6 +1206,96 @@ function isInternalHref(href) {
1202
1206
  return /^\/(?!\/)/.test(href);
1203
1207
  }
1204
1208
 
1209
+ var PlasmicTranslatorContext = /*#__PURE__*/React__default.createContext(undefined);
1210
+
1211
+ function isIterable(val) {
1212
+ return val != null && typeof val[Symbol.iterator] === "function";
1213
+ }
1214
+
1215
+ function genTranslatableString(elt) {
1216
+ var components = {};
1217
+ var componentsCount = 0;
1218
+
1219
+ var getText = function getText(node) {
1220
+ if (!node) {
1221
+ return "";
1222
+ }
1223
+
1224
+ if (typeof node === "number" || typeof node === "boolean" || typeof node === "string") {
1225
+ return node.toString();
1226
+ }
1227
+
1228
+ if (typeof node !== "object") {
1229
+ return "";
1230
+ }
1231
+
1232
+ if (Array.isArray(node) || isIterable(node)) {
1233
+ return Array.from(node).map(function (child) {
1234
+ return getText(child);
1235
+ }).filter(function (child) {
1236
+ return !!child;
1237
+ }).join("");
1238
+ }
1239
+
1240
+ var nodeChildren = hasKey(node, "props") && hasKey(node.props, "children") && node.props.children || hasKey(node, "children") && node.children || [];
1241
+ var contents = "" + React__default.Children.toArray(nodeChildren).map(function (child) {
1242
+ return getText(child);
1243
+ }).filter(function (child) {
1244
+ return !!child;
1245
+ }).join("");
1246
+
1247
+ if (React__default.isValidElement(node) && node.type === React__default.Fragment) {
1248
+ return contents;
1249
+ }
1250
+
1251
+ var componentId = componentsCount + 1;
1252
+ componentsCount++;
1253
+ components[componentId] = React__default.isValidElement(node) ? React__default.cloneElement(node, {
1254
+ key: componentId,
1255
+ children: undefined
1256
+ }) : node;
1257
+ return "<" + componentId + ">" + contents + "</" + componentId + ">";
1258
+ };
1259
+
1260
+ var str = getText(elt);
1261
+ return {
1262
+ str: str,
1263
+ components: components,
1264
+ componentsCount: componentsCount
1265
+ };
1266
+ }
1267
+ function Trans(_ref) {
1268
+ var children = _ref.children;
1269
+
1270
+ var _t = React__default.useContext(PlasmicTranslatorContext);
1271
+
1272
+ if (!_t) {
1273
+ warnNoTranslationFunctionAtMostOnce();
1274
+ return children;
1275
+ }
1276
+
1277
+ var _genTranslatableStrin = genTranslatableString(children),
1278
+ str = _genTranslatableStrin.str,
1279
+ components = _genTranslatableStrin.components,
1280
+ componentsCount = _genTranslatableStrin.componentsCount;
1281
+
1282
+ return _t(str, componentsCount > 0 ? {
1283
+ components: components
1284
+ } : undefined);
1285
+ }
1286
+ var hasWarned = false;
1287
+
1288
+ function warnNoTranslationFunctionAtMostOnce() {
1289
+ if (!hasWarned) {
1290
+ console.warn("Using Plasmic Translation but no translation function has been provided");
1291
+ hasWarned = true;
1292
+ }
1293
+ }
1294
+
1295
+ function hasKey(v, key) {
1296
+ return typeof v === "object" && v !== null && key in v;
1297
+ }
1298
+
1205
1299
  function PlasmicSlot(props) {
1206
1300
  return renderPlasmicSlot(props);
1207
1301
  }
@@ -1245,7 +1339,8 @@ function renderPlasmicSlot(opts) {
1245
1339
 
1246
1340
  function maybeAsString(node) {
1247
1341
  // Unwrap fragments
1248
- if (React.isValidElement(node) && node.type === React.Fragment) {
1342
+ if (React.isValidElement(node) && ( // Fragment and Trans don't render DOM elements
1343
+ node.type === React.Fragment || node.type === Trans)) {
1249
1344
  return maybeAsString(node.props.children);
1250
1345
  }
1251
1346
 
@@ -1356,96 +1451,6 @@ function createUseScreenVariants(isMulti, screenQueries) {
1356
1451
  };
1357
1452
  }
1358
1453
 
1359
- var PlasmicTranslatorContext = /*#__PURE__*/React__default.createContext(undefined);
1360
-
1361
- function isIterable(val) {
1362
- return val != null && typeof val[Symbol.iterator] === "function";
1363
- }
1364
-
1365
- function genTranslatableString(elt) {
1366
- var components = {};
1367
- var componentsCount = 0;
1368
-
1369
- var getText = function getText(node) {
1370
- if (!node) {
1371
- return "";
1372
- }
1373
-
1374
- if (typeof node === "number" || typeof node === "boolean" || typeof node === "string") {
1375
- return node.toString();
1376
- }
1377
-
1378
- if (typeof node !== "object") {
1379
- return "";
1380
- }
1381
-
1382
- if (Array.isArray(node) || isIterable(node)) {
1383
- return Array.from(node).map(function (child) {
1384
- return getText(child);
1385
- }).filter(function (child) {
1386
- return !!child;
1387
- }).join("");
1388
- }
1389
-
1390
- var nodeChildren = hasKey(node, "props") && hasKey(node.props, "children") && node.props.children || hasKey(node, "children") && node.children || [];
1391
- var contents = "" + React__default.Children.toArray(nodeChildren).map(function (child) {
1392
- return getText(child);
1393
- }).filter(function (child) {
1394
- return !!child;
1395
- }).join("");
1396
-
1397
- if (React__default.isValidElement(node) && node.type === React__default.Fragment) {
1398
- return contents;
1399
- }
1400
-
1401
- var componentId = componentsCount + 1;
1402
- componentsCount++;
1403
- components[componentId] = React__default.isValidElement(node) ? React__default.cloneElement(node, {
1404
- key: componentId,
1405
- children: undefined
1406
- }) : node;
1407
- return "<" + componentId + ">" + contents + "</" + componentId + ">";
1408
- };
1409
-
1410
- var str = getText(elt);
1411
- return {
1412
- str: str,
1413
- components: components,
1414
- componentsCount: componentsCount
1415
- };
1416
- }
1417
- function Trans(_ref) {
1418
- var children = _ref.children;
1419
-
1420
- var _t = React__default.useContext(PlasmicTranslatorContext);
1421
-
1422
- if (!_t) {
1423
- warnNoTranslationFunctionAtMostOnce();
1424
- return children;
1425
- }
1426
-
1427
- var _genTranslatableStrin = genTranslatableString(children),
1428
- str = _genTranslatableStrin.str,
1429
- components = _genTranslatableStrin.components,
1430
- componentsCount = _genTranslatableStrin.componentsCount;
1431
-
1432
- return _t(str, componentsCount > 0 ? {
1433
- components: components
1434
- } : undefined);
1435
- }
1436
- var hasWarned = false;
1437
-
1438
- function warnNoTranslationFunctionAtMostOnce() {
1439
- if (!hasWarned) {
1440
- console.warn("Using Plasmic Translation but no translation function has been provided");
1441
- hasWarned = true;
1442
- }
1443
- }
1444
-
1445
- function hasKey(v, key) {
1446
- return typeof v === "object" && v !== null && key in v;
1447
- }
1448
-
1449
1454
  var PlasmicRootContext = /*#__PURE__*/React.createContext(undefined);
1450
1455
  function PlasmicRootProvider(props) {
1451
1456
  var platform = props.platform,
@@ -3120,6 +3125,383 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef) {
3120
3125
  };
3121
3126
  }
3122
3127
 
3128
+ function generateStateOnChangeProp($state, stateName, dataReps) {
3129
+ return function (val, path) {
3130
+ return dset.dset($state, [stateName].concat(dataReps, path), val);
3131
+ };
3132
+ }
3133
+ /**
3134
+ * This function generate the state value prop for repeated states
3135
+ * Example:
3136
+ * - parent[][].counter[].count
3137
+ * We need to pass `parent[index1][index2].counter to the child component
3138
+ */
3139
+
3140
+ function generateStateValueProp($state, path // ["parent", 0, 1, "counter"]
3141
+ ) {
3142
+ return _get($state, path);
3143
+ }
3144
+
3145
+ var UNINITIALIZED = /*#__PURE__*/Symbol("plasmic.unitialized");
3146
+
3147
+ function shallowEqual(a1, a2) {
3148
+ if (a1.length !== a2.length) {
3149
+ return false;
3150
+ }
3151
+
3152
+ for (var i = 0; i < a1.length; i++) {
3153
+ if (a1[i] !== a2[i]) {
3154
+ return false;
3155
+ }
3156
+ }
3157
+
3158
+ return true;
3159
+ }
3160
+
3161
+ var isNum = function isNum(value) {
3162
+ return typeof value === "symbol" ? false : !isNaN(+value);
3163
+ };
3164
+
3165
+ function mkProxy(specs, maybeHandlers) {
3166
+ var handlers = maybeHandlers != null ? maybeHandlers : function () {
3167
+ return {
3168
+ get: function get(target, property) {
3169
+ return target[property];
3170
+ },
3171
+ set: function set(target, property, value) {
3172
+ return (target[property] = value) || true;
3173
+ }
3174
+ };
3175
+ };
3176
+
3177
+ var rec = function rec(currPath) {
3178
+ var nextParts = Object.fromEntries(specs.filter(function (spec) {
3179
+ return shallowEqual(currPath.map(function (p) {
3180
+ return isNum(p) ? "[]" : p;
3181
+ }), spec.path.slice(0, currPath.length));
3182
+ }).map(function (spec) {
3183
+ var nextPart = spec.path[currPath.length];
3184
+
3185
+ if (spec.path.length === currPath.length + 1) {
3186
+ return [nextPart, {
3187
+ isLast: true,
3188
+ spec: spec
3189
+ }];
3190
+ } else {
3191
+ return [nextPart, {
3192
+ isLast: false,
3193
+ spec: spec
3194
+ }];
3195
+ }
3196
+ }));
3197
+ return new Proxy("[]" in nextParts ? [] : {}, {
3198
+ get: function get(target, property, receiver) {
3199
+ if ("[]" in nextParts && isNum(property)) {
3200
+ if (!(property in target)) {
3201
+ target[property] = rec([].concat(currPath, [+property]));
3202
+ }
3203
+ } else if (property in nextParts) {
3204
+ if (nextParts[property].isLast) {
3205
+ var _handlers$get, _handlers;
3206
+
3207
+ return handlers == null ? void 0 : (_handlers$get = (_handlers = handlers({
3208
+ path: [].concat(currPath, [property]),
3209
+ spec: nextParts[property].spec
3210
+ })).get) == null ? void 0 : _handlers$get.call(_handlers, target, property, receiver);
3211
+ } else if (!(property in target)) {
3212
+ target[property] = rec([].concat(currPath, [property]));
3213
+ }
3214
+ }
3215
+
3216
+ return target[property];
3217
+ },
3218
+ set: function set(target, property, value, receiver) {
3219
+ if (!(property in target) && property in nextParts) {
3220
+ if (nextParts[property].isLast) {
3221
+ var _handlers$set, _handlers$set2, _handlers2;
3222
+
3223
+ return (_handlers$set = (_handlers$set2 = (_handlers2 = handlers({
3224
+ path: [].concat(currPath, [property]),
3225
+ spec: nextParts[property].spec
3226
+ })).set) == null ? void 0 : _handlers$set2.call(_handlers2, target, property, value, receiver)) != null ? _handlers$set : false;
3227
+ } else {
3228
+ throw new Error("You can't set a value in the middle of the path");
3229
+ }
3230
+ } else {
3231
+ target[property] = value;
3232
+ return true;
3233
+ }
3234
+ }
3235
+ });
3236
+ };
3237
+
3238
+ return rec([]);
3239
+ }
3240
+
3241
+ function cloneProxy(specs, states, obj) {
3242
+ var newObj = mkProxy(specs);
3243
+ Object.values(states).forEach(function (_ref) {
3244
+ var path = _ref.path;
3245
+
3246
+ dset.dset(newObj, path, _get(obj, path));
3247
+ });
3248
+ return newObj;
3249
+ }
3250
+
3251
+ function saveState(state, states) {
3252
+ states[JSON.stringify(state.path)] = state;
3253
+ }
3254
+
3255
+ function hasState(state, states) {
3256
+ return JSON.stringify(state.path) in states;
3257
+ }
3258
+
3259
+ var transformPathStringToObj = function transformPathStringToObj(str) {
3260
+ // "c[][]" -> ["c", "[]", "[]"]
3261
+ var splitStatePathPart = function splitStatePathPart(state) {
3262
+ return state.endsWith("[]") ? [].concat(splitStatePathPart(state.slice(0, -2)), ["[]"]) : [state];
3263
+ };
3264
+
3265
+ return str.split(".").flatMap(splitStatePathPart);
3266
+ };
3267
+
3268
+ function useVanillaDollarState(_specs, props) {
3269
+ var specs = _specs.map(function (_ref2) {
3270
+ var pathStr = _ref2.path,
3271
+ spec = _objectWithoutPropertiesLoose(_ref2, ["path"]);
3272
+
3273
+ return _extends({}, spec, {
3274
+ pathStr: pathStr,
3275
+ path: transformPathStringToObj(pathStr),
3276
+ isRepeated: pathStr.split(".").some(function (part) {
3277
+ return part.endsWith("[]");
3278
+ })
3279
+ });
3280
+ });
3281
+
3282
+ var _React$useState = React__default.useState(function () {
3283
+ var stateValues = mkProxy(specs);
3284
+ var initStates = {};
3285
+
3286
+ for (var _iterator = _createForOfIteratorHelperLoose(specs), _step; !(_step = _iterator()).done;) {
3287
+ var spec = _step.value;
3288
+
3289
+ if (spec.valueProp || spec.isRepeated) {
3290
+ continue;
3291
+ } else if (spec.initFunc) {
3292
+ dset.dset(stateValues, spec.path, UNINITIALIZED);
3293
+ } else {
3294
+ var _spec$initVal;
3295
+
3296
+ dset.dset(stateValues, spec.path, (_spec$initVal = spec.initVal) != null ? _spec$initVal : undefined);
3297
+ }
3298
+
3299
+ saveState({
3300
+ path: spec.path,
3301
+ spec: spec
3302
+ }, initStates);
3303
+ }
3304
+
3305
+ var deps = fillUninitializedStateValues(specs, props, stateValues, initStates);
3306
+ return {
3307
+ stateValues: stateValues,
3308
+ initStateDeps: deps,
3309
+ initStateValues: cloneProxy(specs, initStates, stateValues),
3310
+ states: initStates
3311
+ };
3312
+ }),
3313
+ $$state = _React$useState[0],
3314
+ set$$State = _React$useState[1];
3315
+
3316
+ var $state = mkProxy(specs, function (state) {
3317
+ return {
3318
+ get: function get(_target, _property) {
3319
+ if (state.spec.valueProp) {
3320
+ if (!state.spec.isRepeated) {
3321
+ return props[state.spec.valueProp];
3322
+ } else {
3323
+ return _get(props[state.spec.valueProp], state.path.slice(1));
3324
+ }
3325
+ }
3326
+
3327
+ if (!hasState(state, $$state.states)) {
3328
+ var _state$spec$initVal;
3329
+
3330
+ saveState(state, $$state.states);
3331
+
3332
+ dset.dset($$state.stateValues, state.path, state.spec.initFunc ? UNINITIALIZED : (_state$spec$initVal = state.spec.initVal) != null ? _state$spec$initVal : undefined);
3333
+
3334
+ var deps = state.spec.initFunc ? fillUninitializedStateValues(specs, props, $$state.stateValues, $$state.states) : {};
3335
+
3336
+ dset.dset($$state.initStateValues, state.path, _get($$state.stateValues, state.path));
3337
+
3338
+ set$$State(function (prev) {
3339
+ return {
3340
+ initStateValues: cloneProxy(specs, prev.states, prev.stateValues),
3341
+ stateValues: cloneProxy(specs, prev.states, prev.initStateValues),
3342
+ initStateDeps: _extends({}, prev.initStateDeps, deps),
3343
+ states: _extends({}, prev.states)
3344
+ };
3345
+ });
3346
+ }
3347
+
3348
+ return _get($$state.stateValues, state.path);
3349
+ },
3350
+ set: function set(_target, _property, newValue) {
3351
+ saveState(state, $$state.states);
3352
+
3353
+ if (newValue !== _get($$state.stateValues, state.path)) {
3354
+ dset.dset($$state.stateValues, state.path, newValue);
3355
+
3356
+ for (var _i = 0, _Object$entries = Object.entries($$state.initStateDeps); _i < _Object$entries.length; _i++) {
3357
+ var _Object$entries$_i = _Object$entries[_i],
3358
+ key = _Object$entries$_i[0],
3359
+ deps = _Object$entries$_i[1];
3360
+
3361
+ if (deps.includes(JSON.stringify(state.path))) {
3362
+ dset.dset($$state.stateValues, JSON.parse(key), UNINITIALIZED);
3363
+ }
3364
+ }
3365
+
3366
+ var newDeps = fillUninitializedStateValues(specs, props, $$state.stateValues, $$state.states);
3367
+ set$$State(function (prev) {
3368
+ return {
3369
+ initStateValues: _extends({}, prev.initStateValues),
3370
+ stateValues: cloneProxy(specs, prev.states, prev.stateValues),
3371
+ initStateDeps: _extends({}, prev.initStateDeps, newDeps),
3372
+ states: _extends({}, prev.states)
3373
+ };
3374
+ });
3375
+
3376
+ if (state.spec.onChangeProp) {
3377
+ var _props$state$spec$onC;
3378
+
3379
+ (_props$state$spec$onC = props[state.spec.onChangeProp]) == null ? void 0 : _props$state$spec$onC.call(props, newValue, state.path);
3380
+ }
3381
+ }
3382
+
3383
+ return true;
3384
+ }
3385
+ };
3386
+ }); // For each spec with an initFunc, evaluate it and see if
3387
+ // the init value has changed. If so, reset its state.
3388
+
3389
+ var newStateValues = undefined;
3390
+ var resetSpecs = [];
3391
+
3392
+ for (var _i2 = 0, _Object$values = Object.values($$state.states); _i2 < _Object$values.length; _i2++) {
3393
+ var _Object$values$_i = _Object$values[_i2],
3394
+ path = _Object$values$_i.path,
3395
+ spec = _Object$values$_i.spec;
3396
+
3397
+ if (spec.initFunc) {
3398
+ var newInit = spec.initFunc(props, $state);
3399
+
3400
+ if (newInit !== _get($$state.initStateValues, path)) {
3401
+ console.log("init changed for " + JSON.stringify(path) + " from " + _get($$state.initStateValues, path) + " to " + newInit + "; resetting state");
3402
+ resetSpecs.push({
3403
+ path: path,
3404
+ spec: spec
3405
+ });
3406
+
3407
+ if (!newStateValues) {
3408
+ newStateValues = cloneProxy(specs, $$state.states, $$state.stateValues);
3409
+ }
3410
+
3411
+ dset.dset(newStateValues, path, UNINITIALIZED);
3412
+ }
3413
+ }
3414
+ }
3415
+
3416
+ React__default.useLayoutEffect(function () {
3417
+ if (newStateValues !== undefined) {
3418
+ var newDeps = fillUninitializedStateValues(specs, props, newStateValues, $$state.states);
3419
+ set$$State(function (prev) {
3420
+ var initStateValues = cloneProxy(specs, prev.states, prev.initStateValues);
3421
+ resetSpecs.forEach(function (_ref3) {
3422
+ var path = _ref3.path;
3423
+
3424
+ dset.dset(initStateValues, path, _get(newStateValues, path));
3425
+ });
3426
+ return {
3427
+ stateValues: cloneProxy(specs, prev.states, newStateValues),
3428
+ initStateDeps: _extends({}, prev.initStateDeps, newDeps),
3429
+ initStateValues: initStateValues,
3430
+ states: _extends({}, prev.states)
3431
+ };
3432
+ });
3433
+
3434
+ for (var _iterator2 = _createForOfIteratorHelperLoose(resetSpecs), _step2; !(_step2 = _iterator2()).done;) {
3435
+ var _step2$value = _step2.value,
3436
+ _path = _step2$value.path,
3437
+ _spec = _step2$value.spec;
3438
+
3439
+ if (_spec.onChangeProp) {
3440
+ var _props$_spec$onChange;
3441
+
3442
+ console.log("Firing onChange for reset init value: " + _spec.path, _get(newStateValues, _path));
3443
+ (_props$_spec$onChange = props[_spec.onChangeProp]) == null ? void 0 : _props$_spec$onChange.call(props, _get(newStateValues, _path));
3444
+ }
3445
+ }
3446
+ }
3447
+ }, [newStateValues, props, resetSpecs, specs]);
3448
+ return $state;
3449
+ }
3450
+
3451
+ function fillUninitializedStateValues(specs, props, stateValues, states) {
3452
+ var stateAccessStack = [new Set()];
3453
+ var initFuncDeps = {};
3454
+ var $state = mkProxy(specs, function (state) {
3455
+ return {
3456
+ get: function get(_target, _property) {
3457
+ if (state.spec.valueProp) {
3458
+ if (!state.spec.isRepeated) {
3459
+ return props[state.spec.valueProp];
3460
+ } else {
3461
+ return _get(props[state.spec.valueProp], state.path.slice(1));
3462
+ }
3463
+ }
3464
+
3465
+ var value = _get(stateValues, state.path);
3466
+
3467
+ if (value === UNINITIALIZED) {
3468
+ // This value has a init expression; need to be evaluated.
3469
+ value = tracked(state);
3470
+
3471
+ dset.dset(stateValues, state.path, value);
3472
+ } // Record that this field had just been accessed; for
3473
+ // trackInit() to know what fields were used to compute
3474
+ // the init value
3475
+
3476
+
3477
+ stateAccessStack[stateAccessStack.length - 1].add(JSON.stringify(state.path));
3478
+ return value;
3479
+ },
3480
+ set: function set() {
3481
+ throw new Error("Cannot update state values during initialization");
3482
+ }
3483
+ };
3484
+ });
3485
+
3486
+ function tracked(state) {
3487
+ stateAccessStack.push(new Set());
3488
+ var res = state.spec.initFunc(props, $state);
3489
+ var deps = stateAccessStack.pop();
3490
+ initFuncDeps[JSON.stringify(state.path)] = [].concat(deps.values());
3491
+ return res;
3492
+ }
3493
+
3494
+ for (var _i3 = 0, _Object$values2 = Object.values(states); _i3 < _Object$values2.length; _i3++) {
3495
+ var path = _Object$values2[_i3].path;
3496
+
3497
+ if (_get(stateValues, path) === UNINITIALIZED) {
3498
+ _get($state, path);
3499
+ }
3500
+ }
3501
+
3502
+ return initFuncDeps;
3503
+ }
3504
+
3123
3505
  exports.DropdownMenu = DropdownMenu;
3124
3506
  exports.PlasmicIcon = PlasmicIcon;
3125
3507
  exports.PlasmicImg = PlasmicImg;
@@ -3134,6 +3516,8 @@ exports.createUseScreenVariants = createUseScreenVariants;
3134
3516
  exports.deriveRenderOpts = deriveRenderOpts;
3135
3517
  exports.ensureGlobalVariants = ensureGlobalVariants;
3136
3518
  exports.genTranslatableString = genTranslatableString;
3519
+ exports.generateStateOnChangeProp = generateStateOnChangeProp;
3520
+ exports.generateStateValueProp = generateStateValueProp;
3137
3521
  exports.getDataProps = getDataProps;
3138
3522
  exports.hasVariant = hasVariant;
3139
3523
  exports.makeFragment = makeFragment;
@@ -3143,6 +3527,7 @@ exports.renderPlasmicSlot = renderPlasmicSlot;
3143
3527
  exports.setPlumeStrictMode = setPlumeStrictMode;
3144
3528
  exports.useButton = useButton;
3145
3529
  exports.useCheckbox = useCheckbox;
3530
+ exports.useDollarState = useVanillaDollarState;
3146
3531
  exports.useIsSSR = useIsSSR;
3147
3532
  exports.useMenu = useMenu;
3148
3533
  exports.useMenuButton = useMenuButton;