@plasmicapp/react-web 0.2.352 → 0.2.354
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 +28 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/react-web.esm.js +28 -14
- package/dist/react-web.esm.js.map +1 -1
- package/package.json +2 -2
- package/skinny/dist/index.js +28 -14
- package/skinny/dist/index.js.map +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1592,7 +1592,8 @@ function PlasmicSlot(props) {
|
|
|
1592
1592
|
function renderPlasmicSlot(opts) {
|
|
1593
1593
|
var as = opts.as, defaultContents = opts.defaultContents, value = opts.value, rest = __rest(opts, ["as", "defaultContents", "value"]);
|
|
1594
1594
|
var content = value === undefined ? defaultContents : value;
|
|
1595
|
-
if (
|
|
1595
|
+
if (typeof content !== "number" &&
|
|
1596
|
+
(!content || (Array.isArray(content) && content.length === 0))) {
|
|
1596
1597
|
return null;
|
|
1597
1598
|
}
|
|
1598
1599
|
// If the content is a raw string, then we need to wrap the raw string
|
|
@@ -2155,12 +2156,23 @@ function initializeStateValue($$state, initialStateCell, proxyRoot) {
|
|
|
2155
2156
|
});
|
|
2156
2157
|
});
|
|
2157
2158
|
var initialValue = invokeInitFuncBackwardsCompatible(initialStateCell.initFunc, __assign({ $state: $state }, ((_a = initialStateCell.overrideEnv) !== null && _a !== void 0 ? _a : $$state.env)));
|
|
2158
|
-
initialStateCell.initialValue = clone(initialValue);
|
|
2159
2159
|
var initialSpec = initialStateCell.node.getSpec();
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2160
|
+
// Try to clone initialValue. It can fail if it's a PlasmicUndefinedDataProxy
|
|
2161
|
+
// and we still want to clear some states and return the initialValue.
|
|
2162
|
+
try {
|
|
2163
|
+
var clonedValue = clone(initialValue);
|
|
2164
|
+
initialStateCell.initialValue = clonedValue;
|
|
2165
|
+
var value = initialSpec.isImmutable
|
|
2166
|
+
? mkUntrackedValue(initialValue)
|
|
2167
|
+
: clonedValue;
|
|
2168
|
+
set(proxyRoot, initialStateCell.path, value);
|
|
2169
|
+
}
|
|
2170
|
+
catch (_d) {
|
|
2171
|
+
// Setting the state to undefined to make sure it gets re-initialized
|
|
2172
|
+
// in case it changes values.
|
|
2173
|
+
initialStateCell.initialValue = undefined;
|
|
2174
|
+
set(proxyRoot, initialStateCell.path, undefined);
|
|
2175
|
+
}
|
|
2164
2176
|
//immediately fire onChange
|
|
2165
2177
|
if (initialSpec.onChangeProp) {
|
|
2166
2178
|
(_c = (_b = $$state.env.$props)[initialSpec.onChangeProp]) === null || _c === void 0 ? void 0 : _c.call(_b, initialValue);
|
|
@@ -2332,7 +2344,9 @@ function useDollarState(specs) {
|
|
|
2332
2344
|
var isMounted = React.useCallback(function () { return mountedRef.current; }, []);
|
|
2333
2345
|
React.useEffect(function () {
|
|
2334
2346
|
mountedRef.current = true;
|
|
2335
|
-
return function () {
|
|
2347
|
+
return function () {
|
|
2348
|
+
mountedRef.current = false;
|
|
2349
|
+
};
|
|
2336
2350
|
}, []);
|
|
2337
2351
|
var pendingUpdate = React.useRef(false);
|
|
2338
2352
|
var forceUpdate = React.useCallback(function () {
|
|
@@ -2370,9 +2384,9 @@ function useDollarState(specs) {
|
|
|
2370
2384
|
}
|
|
2371
2385
|
return {
|
|
2372
2386
|
get: function () {
|
|
2373
|
-
var
|
|
2374
|
-
if (
|
|
2375
|
-
var valueProp = $$state.env.$props[
|
|
2387
|
+
var currSpec = stateCell.node.getSpec();
|
|
2388
|
+
if (currSpec.valueProp) {
|
|
2389
|
+
var valueProp = $$state.env.$props[currSpec.valueProp];
|
|
2376
2390
|
subscribeToValtio($$state, stateCell.path, stateCell.node);
|
|
2377
2391
|
return valueProp;
|
|
2378
2392
|
}
|
|
@@ -2384,10 +2398,10 @@ function useDollarState(specs) {
|
|
|
2384
2398
|
}), __assign({ registerInitFunc: function (pathStr, f, repetitionIndex, overrideEnv) {
|
|
2385
2399
|
var _a = findStateCell($$state.rootSpecTree, pathStr, repetitionIndex), node = _a.node, realPath = _a.realPath;
|
|
2386
2400
|
var stateCell = getStateCellFrom$StateRoot($state, realPath);
|
|
2387
|
-
var
|
|
2401
|
+
var innerEnv = overrideEnv
|
|
2388
2402
|
? envFieldsAreNonNill(overrideEnv)
|
|
2389
2403
|
: $$state.env;
|
|
2390
|
-
if (!deepEqual(stateCell.initialValue, f(__assign({ $state: $state },
|
|
2404
|
+
if (!deepEqual(stateCell.initialValue, f(__assign({ $state: $state }, innerEnv)))) {
|
|
2391
2405
|
$$state.registrationsQueue.push({
|
|
2392
2406
|
node: node,
|
|
2393
2407
|
path: realPath,
|
|
@@ -2403,7 +2417,7 @@ function useDollarState(specs) {
|
|
|
2403
2417
|
}
|
|
2404
2418
|
} }, ((opts === null || opts === void 0 ? void 0 : opts.inCanvas)
|
|
2405
2419
|
? {
|
|
2406
|
-
eagerInitializeStates: function (
|
|
2420
|
+
eagerInitializeStates: function (stateSpecs) {
|
|
2407
2421
|
// we need to eager initialize all states in canvas to populate the data picker
|
|
2408
2422
|
$$state.specTreeLeaves.forEach(function (node) {
|
|
2409
2423
|
var _a, _b;
|
|
@@ -2412,7 +2426,7 @@ function useDollarState(specs) {
|
|
|
2412
2426
|
return;
|
|
2413
2427
|
}
|
|
2414
2428
|
var stateCell = getStateCellFrom$StateRoot($state, spec.pathObj);
|
|
2415
|
-
var newSpec =
|
|
2429
|
+
var newSpec = stateSpecs.find(function (sp) { return sp.path === spec.path; });
|
|
2416
2430
|
if (!newSpec ||
|
|
2417
2431
|
(stateCell.initFuncHash === ((_a = newSpec === null || newSpec === void 0 ? void 0 : newSpec.initFuncHash) !== null && _a !== void 0 ? _a : "") &&
|
|
2418
2432
|
stateCell.initialValue !== UNINITIALIZED)) {
|