@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/dist/index.cjs.js +34 -29
- package/dist/index.cjs.js.map +1 -1
- package/dist/react-web.esm.js +34 -29
- package/dist/react-web.esm.js.map +1 -1
- package/package.json +7 -7
- package/skinny/dist/index.js +34 -29
- package/skinny/dist/index.js.map +1 -1
package/dist/react-web.esm.js
CHANGED
|
@@ -2142,7 +2142,9 @@ function create$StateProxy($$state, leafHandlers) {
|
|
|
2142
2142
|
var nextPath = getNextPath(property);
|
|
2143
2143
|
var nextNode = currNode.makeTransition(property);
|
|
2144
2144
|
var nextSpec = nextNode === null || nextNode === void 0 ? void 0 : nextNode.getSpec();
|
|
2145
|
-
if (property === "registerInitFunc"
|
|
2145
|
+
if ((property === "registerInitFunc" ||
|
|
2146
|
+
property === "eagerInitializeStates") &&
|
|
2147
|
+
currPath.length === 0) {
|
|
2146
2148
|
return Reflect.set(target, property, value, receiver);
|
|
2147
2149
|
}
|
|
2148
2150
|
if (!nextNode && currNode.hasArrayTransition()) {
|
|
@@ -2289,8 +2291,7 @@ function useDollarState(specs) {
|
|
|
2289
2291
|
}
|
|
2290
2292
|
},
|
|
2291
2293
|
};
|
|
2292
|
-
}), {
|
|
2293
|
-
registerInitFunc: function (pathStr, f, repetitionIndex, overrideEnv) {
|
|
2294
|
+
}), __assign({ registerInitFunc: function (pathStr, f, repetitionIndex, overrideEnv) {
|
|
2294
2295
|
var _a = findStateCell($$state.rootSpecTree, pathStr, repetitionIndex), node = _a.node, realPath = _a.realPath;
|
|
2295
2296
|
var stateCell = getStateCellFrom$StateRoot($state, realPath);
|
|
2296
2297
|
var env = overrideEnv
|
|
@@ -2306,10 +2307,37 @@ function useDollarState(specs) {
|
|
|
2306
2307
|
: undefined,
|
|
2307
2308
|
}));
|
|
2308
2309
|
}
|
|
2309
|
-
},
|
|
2310
|
-
|
|
2310
|
+
} }, ((opts === null || opts === void 0 ? void 0 : opts.inCanvas)
|
|
2311
|
+
? {
|
|
2312
|
+
eagerInitializeStates: function (specs) {
|
|
2313
|
+
// we need to eager initialize all states in canvas to populate the data picker
|
|
2314
|
+
$$state.specTreeLeaves.forEach(function (node) {
|
|
2315
|
+
var _a, _b;
|
|
2316
|
+
var spec = node.getSpec();
|
|
2317
|
+
if (spec.isRepeated) {
|
|
2318
|
+
return;
|
|
2319
|
+
}
|
|
2320
|
+
var stateCell = getStateCellFrom$StateRoot($state, spec.pathObj);
|
|
2321
|
+
var newSpec = specs.find(function (sp) { return sp.path === spec.path; });
|
|
2322
|
+
if (!newSpec ||
|
|
2323
|
+
(stateCell.initFuncHash === ((_a = newSpec === null || newSpec === void 0 ? void 0 : newSpec.initFuncHash) !== null && _a !== void 0 ? _a : "") &&
|
|
2324
|
+
stateCell.initialValue !== UNINITIALIZED)) {
|
|
2325
|
+
return;
|
|
2326
|
+
}
|
|
2327
|
+
stateCell.initFunc = newSpec.initFunc;
|
|
2328
|
+
stateCell.initFuncHash = (_b = newSpec.initFuncHash) !== null && _b !== void 0 ? _b : "";
|
|
2329
|
+
var init = spec.valueProp
|
|
2330
|
+
? $$state.env.$props[spec.valueProp]
|
|
2331
|
+
: spec.initFunc
|
|
2332
|
+
? initializeStateValue($$state, stateCell, $state)
|
|
2333
|
+
: spec.initVal;
|
|
2334
|
+
set($state, spec.pathObj, init);
|
|
2335
|
+
});
|
|
2336
|
+
},
|
|
2337
|
+
}
|
|
2338
|
+
: {})));
|
|
2311
2339
|
return $state;
|
|
2312
|
-
}, []);
|
|
2340
|
+
}, [opts === null || opts === void 0 ? void 0 : opts.inCanvas]);
|
|
2313
2341
|
var ref = React__default.useRef(undefined);
|
|
2314
2342
|
if (!ref.current) {
|
|
2315
2343
|
ref.current = create$State();
|
|
@@ -2332,29 +2360,6 @@ function useDollarState(specs) {
|
|
|
2332
2360
|
}
|
|
2333
2361
|
});
|
|
2334
2362
|
}
|
|
2335
|
-
// we need to eager initialize all states in canvas to populate the data picker
|
|
2336
|
-
$$state.specTreeLeaves.forEach(function (node) {
|
|
2337
|
-
var _a, _b;
|
|
2338
|
-
var spec = node.getSpec();
|
|
2339
|
-
if (spec.isRepeated) {
|
|
2340
|
-
return;
|
|
2341
|
-
}
|
|
2342
|
-
var stateCell = getStateCellFrom$StateRoot($state, spec.pathObj);
|
|
2343
|
-
var newSpec = specs.find(function (sp) { return sp.path === spec.path; });
|
|
2344
|
-
if (!newSpec ||
|
|
2345
|
-
(stateCell.initFuncHash === ((_a = newSpec === null || newSpec === void 0 ? void 0 : newSpec.initFuncHash) !== null && _a !== void 0 ? _a : "") &&
|
|
2346
|
-
stateCell.initialValue !== UNINITIALIZED)) {
|
|
2347
|
-
return;
|
|
2348
|
-
}
|
|
2349
|
-
stateCell.initFunc = newSpec.initFunc;
|
|
2350
|
-
stateCell.initFuncHash = (_b = newSpec.initFuncHash) !== null && _b !== void 0 ? _b : "";
|
|
2351
|
-
var init = spec.valueProp
|
|
2352
|
-
? $$state.env.$props[spec.valueProp]
|
|
2353
|
-
: spec.initFunc
|
|
2354
|
-
? initializeStateValue($$state, stateCell, $state)
|
|
2355
|
-
: spec.initVal;
|
|
2356
|
-
set($state, spec.pathObj, init);
|
|
2357
|
-
});
|
|
2358
2363
|
}
|
|
2359
2364
|
// For each spec with an initFunc, evaluate it and see if
|
|
2360
2365
|
// the init value has changed. If so, reset its state.
|