@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/react-web.esm.js
CHANGED
|
@@ -1573,7 +1573,8 @@ function PlasmicSlot(props) {
|
|
|
1573
1573
|
function renderPlasmicSlot(opts) {
|
|
1574
1574
|
var as = opts.as, defaultContents = opts.defaultContents, value = opts.value, rest = __rest(opts, ["as", "defaultContents", "value"]);
|
|
1575
1575
|
var content = value === undefined ? defaultContents : value;
|
|
1576
|
-
if (
|
|
1576
|
+
if (typeof content !== "number" &&
|
|
1577
|
+
(!content || (Array.isArray(content) && content.length === 0))) {
|
|
1577
1578
|
return null;
|
|
1578
1579
|
}
|
|
1579
1580
|
// If the content is a raw string, then we need to wrap the raw string
|
|
@@ -2136,12 +2137,23 @@ function initializeStateValue($$state, initialStateCell, proxyRoot) {
|
|
|
2136
2137
|
});
|
|
2137
2138
|
});
|
|
2138
2139
|
var initialValue = invokeInitFuncBackwardsCompatible(initialStateCell.initFunc, __assign({ $state: $state }, ((_a = initialStateCell.overrideEnv) !== null && _a !== void 0 ? _a : $$state.env)));
|
|
2139
|
-
initialStateCell.initialValue = clone(initialValue);
|
|
2140
2140
|
var initialSpec = initialStateCell.node.getSpec();
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2141
|
+
// Try to clone initialValue. It can fail if it's a PlasmicUndefinedDataProxy
|
|
2142
|
+
// and we still want to clear some states and return the initialValue.
|
|
2143
|
+
try {
|
|
2144
|
+
var clonedValue = clone(initialValue);
|
|
2145
|
+
initialStateCell.initialValue = clonedValue;
|
|
2146
|
+
var value = initialSpec.isImmutable
|
|
2147
|
+
? mkUntrackedValue(initialValue)
|
|
2148
|
+
: clonedValue;
|
|
2149
|
+
set(proxyRoot, initialStateCell.path, value);
|
|
2150
|
+
}
|
|
2151
|
+
catch (_d) {
|
|
2152
|
+
// Setting the state to undefined to make sure it gets re-initialized
|
|
2153
|
+
// in case it changes values.
|
|
2154
|
+
initialStateCell.initialValue = undefined;
|
|
2155
|
+
set(proxyRoot, initialStateCell.path, undefined);
|
|
2156
|
+
}
|
|
2145
2157
|
//immediately fire onChange
|
|
2146
2158
|
if (initialSpec.onChangeProp) {
|
|
2147
2159
|
(_c = (_b = $$state.env.$props)[initialSpec.onChangeProp]) === null || _c === void 0 ? void 0 : _c.call(_b, initialValue);
|
|
@@ -2313,7 +2325,9 @@ function useDollarState(specs) {
|
|
|
2313
2325
|
var isMounted = React__default.useCallback(function () { return mountedRef.current; }, []);
|
|
2314
2326
|
React__default.useEffect(function () {
|
|
2315
2327
|
mountedRef.current = true;
|
|
2316
|
-
return function () {
|
|
2328
|
+
return function () {
|
|
2329
|
+
mountedRef.current = false;
|
|
2330
|
+
};
|
|
2317
2331
|
}, []);
|
|
2318
2332
|
var pendingUpdate = React__default.useRef(false);
|
|
2319
2333
|
var forceUpdate = React__default.useCallback(function () {
|
|
@@ -2351,9 +2365,9 @@ function useDollarState(specs) {
|
|
|
2351
2365
|
}
|
|
2352
2366
|
return {
|
|
2353
2367
|
get: function () {
|
|
2354
|
-
var
|
|
2355
|
-
if (
|
|
2356
|
-
var valueProp = $$state.env.$props[
|
|
2368
|
+
var currSpec = stateCell.node.getSpec();
|
|
2369
|
+
if (currSpec.valueProp) {
|
|
2370
|
+
var valueProp = $$state.env.$props[currSpec.valueProp];
|
|
2357
2371
|
subscribeToValtio($$state, stateCell.path, stateCell.node);
|
|
2358
2372
|
return valueProp;
|
|
2359
2373
|
}
|
|
@@ -2365,10 +2379,10 @@ function useDollarState(specs) {
|
|
|
2365
2379
|
}), __assign({ registerInitFunc: function (pathStr, f, repetitionIndex, overrideEnv) {
|
|
2366
2380
|
var _a = findStateCell($$state.rootSpecTree, pathStr, repetitionIndex), node = _a.node, realPath = _a.realPath;
|
|
2367
2381
|
var stateCell = getStateCellFrom$StateRoot($state, realPath);
|
|
2368
|
-
var
|
|
2382
|
+
var innerEnv = overrideEnv
|
|
2369
2383
|
? envFieldsAreNonNill(overrideEnv)
|
|
2370
2384
|
: $$state.env;
|
|
2371
|
-
if (!deepEqual(stateCell.initialValue, f(__assign({ $state: $state },
|
|
2385
|
+
if (!deepEqual(stateCell.initialValue, f(__assign({ $state: $state }, innerEnv)))) {
|
|
2372
2386
|
$$state.registrationsQueue.push({
|
|
2373
2387
|
node: node,
|
|
2374
2388
|
path: realPath,
|
|
@@ -2384,7 +2398,7 @@ function useDollarState(specs) {
|
|
|
2384
2398
|
}
|
|
2385
2399
|
} }, ((opts === null || opts === void 0 ? void 0 : opts.inCanvas)
|
|
2386
2400
|
? {
|
|
2387
|
-
eagerInitializeStates: function (
|
|
2401
|
+
eagerInitializeStates: function (stateSpecs) {
|
|
2388
2402
|
// we need to eager initialize all states in canvas to populate the data picker
|
|
2389
2403
|
$$state.specTreeLeaves.forEach(function (node) {
|
|
2390
2404
|
var _a, _b;
|
|
@@ -2393,7 +2407,7 @@ function useDollarState(specs) {
|
|
|
2393
2407
|
return;
|
|
2394
2408
|
}
|
|
2395
2409
|
var stateCell = getStateCellFrom$StateRoot($state, spec.pathObj);
|
|
2396
|
-
var newSpec =
|
|
2410
|
+
var newSpec = stateSpecs.find(function (sp) { return sp.path === spec.path; });
|
|
2397
2411
|
if (!newSpec ||
|
|
2398
2412
|
(stateCell.initFuncHash === ((_a = newSpec === null || newSpec === void 0 ? void 0 : newSpec.initFuncHash) !== null && _a !== void 0 ? _a : "") &&
|
|
2399
2413
|
stateCell.initialValue !== UNINITIALIZED)) {
|