@plasmicapp/react-web 0.2.248 → 0.2.250

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicapp/react-web",
3
- "version": "0.2.248",
3
+ "version": "0.2.250",
4
4
  "description": "plasmic library for rendering in the presentational style",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
@@ -88,12 +88,12 @@
88
88
  },
89
89
  "prettier": {},
90
90
  "dependencies": {
91
- "@plasmicapp/auth-react": "0.0.6",
92
- "@plasmicapp/data-sources": "0.1.106",
91
+ "@plasmicapp/auth-react": "0.0.7",
92
+ "@plasmicapp/data-sources": "0.1.108",
93
93
  "@plasmicapp/data-sources-context": "0.1.11",
94
- "@plasmicapp/host": "1.0.160",
95
- "@plasmicapp/prepass": "1.0.2",
96
- "@plasmicapp/query": "0.1.67",
94
+ "@plasmicapp/host": "1.0.162",
95
+ "@plasmicapp/prepass": "1.0.3",
96
+ "@plasmicapp/query": "0.1.68",
97
97
  "@react-aria/checkbox": "^3.5.0",
98
98
  "@react-aria/focus": "^3.7.0",
99
99
  "@react-aria/interactions": "^3.10.0",
@@ -158,5 +158,5 @@
158
158
  "react": ">=16.8.0",
159
159
  "react-dom": ">=16.8.0"
160
160
  },
161
- "gitHead": "cd709d627ae388ad77010119787ecef6d555362b"
161
+ "gitHead": "bf12f2268d3e2794698bee0996d4e2008b6827c5"
162
162
  }
@@ -1110,7 +1110,9 @@ function create$StateProxy($$state, leafHandlers) {
1110
1110
  var nextPath = getNextPath(property);
1111
1111
  var nextNode = currNode.makeTransition(property);
1112
1112
  var nextSpec = nextNode === null || nextNode === void 0 ? void 0 : nextNode.getSpec();
1113
- if (property === "registerInitFunc" && currPath.length === 0) {
1113
+ if ((property === "registerInitFunc" ||
1114
+ property === "eagerInitializeStates") &&
1115
+ currPath.length === 0) {
1114
1116
  return Reflect.set(target, property, value, receiver);
1115
1117
  }
1116
1118
  if (!nextNode && currNode.hasArrayTransition()) {
@@ -1257,8 +1259,7 @@ function useDollarState(specs) {
1257
1259
  }
1258
1260
  },
1259
1261
  };
1260
- }), {
1261
- registerInitFunc: function (pathStr, f, repetitionIndex, overrideEnv) {
1262
+ }), __assign({ registerInitFunc: function (pathStr, f, repetitionIndex, overrideEnv) {
1262
1263
  var _a = findStateCell($$state.rootSpecTree, pathStr, repetitionIndex), node = _a.node, realPath = _a.realPath;
1263
1264
  var stateCell = getStateCellFrom$StateRoot($state, realPath);
1264
1265
  var env = overrideEnv
@@ -1274,10 +1275,37 @@ function useDollarState(specs) {
1274
1275
  : undefined,
1275
1276
  }));
1276
1277
  }
1277
- },
1278
- });
1278
+ } }, ((opts === null || opts === void 0 ? void 0 : opts.inCanvas)
1279
+ ? {
1280
+ eagerInitializeStates: function (specs) {
1281
+ // we need to eager initialize all states in canvas to populate the data picker
1282
+ $$state.specTreeLeaves.forEach(function (node) {
1283
+ var _a, _b;
1284
+ var spec = node.getSpec();
1285
+ if (spec.isRepeated) {
1286
+ return;
1287
+ }
1288
+ var stateCell = getStateCellFrom$StateRoot($state, spec.pathObj);
1289
+ var newSpec = specs.find(function (sp) { return sp.path === spec.path; });
1290
+ if (!newSpec ||
1291
+ (stateCell.initFuncHash === ((_a = newSpec === null || newSpec === void 0 ? void 0 : newSpec.initFuncHash) !== null && _a !== void 0 ? _a : "") &&
1292
+ stateCell.initialValue !== UNINITIALIZED)) {
1293
+ return;
1294
+ }
1295
+ stateCell.initFunc = newSpec.initFunc;
1296
+ stateCell.initFuncHash = (_b = newSpec.initFuncHash) !== null && _b !== void 0 ? _b : "";
1297
+ var init = spec.valueProp
1298
+ ? $$state.env.$props[spec.valueProp]
1299
+ : spec.initFunc
1300
+ ? initializeStateValue($$state, stateCell, $state)
1301
+ : spec.initVal;
1302
+ set($state, spec.pathObj, init);
1303
+ });
1304
+ },
1305
+ }
1306
+ : {})));
1279
1307
  return $state;
1280
- }, []);
1308
+ }, [opts === null || opts === void 0 ? void 0 : opts.inCanvas]);
1281
1309
  var ref = React__default.useRef(undefined);
1282
1310
  if (!ref.current) {
1283
1311
  ref.current = create$State();
@@ -1300,29 +1328,6 @@ function useDollarState(specs) {
1300
1328
  }
1301
1329
  });
1302
1330
  }
1303
- // we need to eager initialize all states in canvas to populate the data picker
1304
- $$state.specTreeLeaves.forEach(function (node) {
1305
- var _a, _b;
1306
- var spec = node.getSpec();
1307
- if (spec.isRepeated) {
1308
- return;
1309
- }
1310
- var stateCell = getStateCellFrom$StateRoot($state, spec.pathObj);
1311
- var newSpec = specs.find(function (sp) { return sp.path === spec.path; });
1312
- if (!newSpec ||
1313
- (stateCell.initFuncHash === ((_a = newSpec === null || newSpec === void 0 ? void 0 : newSpec.initFuncHash) !== null && _a !== void 0 ? _a : "") &&
1314
- stateCell.initialValue !== UNINITIALIZED)) {
1315
- return;
1316
- }
1317
- stateCell.initFunc = newSpec.initFunc;
1318
- stateCell.initFuncHash = (_b = newSpec.initFuncHash) !== null && _b !== void 0 ? _b : "";
1319
- var init = spec.valueProp
1320
- ? $$state.env.$props[spec.valueProp]
1321
- : spec.initFunc
1322
- ? initializeStateValue($$state, stateCell, $state)
1323
- : spec.initVal;
1324
- set($state, spec.pathObj, init);
1325
- });
1326
1331
  }
1327
1332
  // For each spec with an initFunc, evaluate it and see if
1328
1333
  // the init value has changed. If so, reset its state.