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