@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicapp/react-web",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.354",
|
|
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",
|
|
@@ -168,5 +168,5 @@
|
|
|
168
168
|
"react": ">=16.8.0",
|
|
169
169
|
"react-dom": ">=16.8.0"
|
|
170
170
|
},
|
|
171
|
-
"gitHead": "
|
|
171
|
+
"gitHead": "046f09e80966179a1843c4f24b44fbcfa2263319"
|
|
172
172
|
}
|
package/skinny/dist/index.js
CHANGED
|
@@ -555,7 +555,8 @@ function PlasmicSlot(props) {
|
|
|
555
555
|
function renderPlasmicSlot(opts) {
|
|
556
556
|
var as = opts.as, defaultContents = opts.defaultContents, value = opts.value, rest = __rest(opts, ["as", "defaultContents", "value"]);
|
|
557
557
|
var content = value === undefined ? defaultContents : value;
|
|
558
|
-
if (
|
|
558
|
+
if (typeof content !== "number" &&
|
|
559
|
+
(!content || (Array.isArray(content) && content.length === 0))) {
|
|
559
560
|
return null;
|
|
560
561
|
}
|
|
561
562
|
// If the content is a raw string, then we need to wrap the raw string
|
|
@@ -1063,12 +1064,23 @@ function initializeStateValue($$state, initialStateCell, proxyRoot) {
|
|
|
1063
1064
|
});
|
|
1064
1065
|
});
|
|
1065
1066
|
var initialValue = invokeInitFuncBackwardsCompatible(initialStateCell.initFunc, __assign({ $state: $state }, ((_a = initialStateCell.overrideEnv) !== null && _a !== void 0 ? _a : $$state.env)));
|
|
1066
|
-
initialStateCell.initialValue = clone(initialValue);
|
|
1067
1067
|
var initialSpec = initialStateCell.node.getSpec();
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1068
|
+
// Try to clone initialValue. It can fail if it's a PlasmicUndefinedDataProxy
|
|
1069
|
+
// and we still want to clear some states and return the initialValue.
|
|
1070
|
+
try {
|
|
1071
|
+
var clonedValue = clone(initialValue);
|
|
1072
|
+
initialStateCell.initialValue = clonedValue;
|
|
1073
|
+
var value = initialSpec.isImmutable
|
|
1074
|
+
? mkUntrackedValue(initialValue)
|
|
1075
|
+
: clonedValue;
|
|
1076
|
+
set(proxyRoot, initialStateCell.path, value);
|
|
1077
|
+
}
|
|
1078
|
+
catch (_d) {
|
|
1079
|
+
// Setting the state to undefined to make sure it gets re-initialized
|
|
1080
|
+
// in case it changes values.
|
|
1081
|
+
initialStateCell.initialValue = undefined;
|
|
1082
|
+
set(proxyRoot, initialStateCell.path, undefined);
|
|
1083
|
+
}
|
|
1072
1084
|
//immediately fire onChange
|
|
1073
1085
|
if (initialSpec.onChangeProp) {
|
|
1074
1086
|
(_c = (_b = $$state.env.$props)[initialSpec.onChangeProp]) === null || _c === void 0 ? void 0 : _c.call(_b, initialValue);
|
|
@@ -1240,7 +1252,9 @@ function useDollarState(specs) {
|
|
|
1240
1252
|
var isMounted = React__default.useCallback(function () { return mountedRef.current; }, []);
|
|
1241
1253
|
React__default.useEffect(function () {
|
|
1242
1254
|
mountedRef.current = true;
|
|
1243
|
-
return function () {
|
|
1255
|
+
return function () {
|
|
1256
|
+
mountedRef.current = false;
|
|
1257
|
+
};
|
|
1244
1258
|
}, []);
|
|
1245
1259
|
var pendingUpdate = React__default.useRef(false);
|
|
1246
1260
|
var forceUpdate = React__default.useCallback(function () {
|
|
@@ -1278,9 +1292,9 @@ function useDollarState(specs) {
|
|
|
1278
1292
|
}
|
|
1279
1293
|
return {
|
|
1280
1294
|
get: function () {
|
|
1281
|
-
var
|
|
1282
|
-
if (
|
|
1283
|
-
var valueProp = $$state.env.$props[
|
|
1295
|
+
var currSpec = stateCell.node.getSpec();
|
|
1296
|
+
if (currSpec.valueProp) {
|
|
1297
|
+
var valueProp = $$state.env.$props[currSpec.valueProp];
|
|
1284
1298
|
subscribeToValtio($$state, stateCell.path, stateCell.node);
|
|
1285
1299
|
return valueProp;
|
|
1286
1300
|
}
|
|
@@ -1292,10 +1306,10 @@ function useDollarState(specs) {
|
|
|
1292
1306
|
}), __assign({ registerInitFunc: function (pathStr, f, repetitionIndex, overrideEnv) {
|
|
1293
1307
|
var _a = findStateCell($$state.rootSpecTree, pathStr, repetitionIndex), node = _a.node, realPath = _a.realPath;
|
|
1294
1308
|
var stateCell = getStateCellFrom$StateRoot($state, realPath);
|
|
1295
|
-
var
|
|
1309
|
+
var innerEnv = overrideEnv
|
|
1296
1310
|
? envFieldsAreNonNill(overrideEnv)
|
|
1297
1311
|
: $$state.env;
|
|
1298
|
-
if (!deepEqual(stateCell.initialValue, f(__assign({ $state: $state },
|
|
1312
|
+
if (!deepEqual(stateCell.initialValue, f(__assign({ $state: $state }, innerEnv)))) {
|
|
1299
1313
|
$$state.registrationsQueue.push({
|
|
1300
1314
|
node: node,
|
|
1301
1315
|
path: realPath,
|
|
@@ -1311,7 +1325,7 @@ function useDollarState(specs) {
|
|
|
1311
1325
|
}
|
|
1312
1326
|
} }, ((opts === null || opts === void 0 ? void 0 : opts.inCanvas)
|
|
1313
1327
|
? {
|
|
1314
|
-
eagerInitializeStates: function (
|
|
1328
|
+
eagerInitializeStates: function (stateSpecs) {
|
|
1315
1329
|
// we need to eager initialize all states in canvas to populate the data picker
|
|
1316
1330
|
$$state.specTreeLeaves.forEach(function (node) {
|
|
1317
1331
|
var _a, _b;
|
|
@@ -1320,7 +1334,7 @@ function useDollarState(specs) {
|
|
|
1320
1334
|
return;
|
|
1321
1335
|
}
|
|
1322
1336
|
var stateCell = getStateCellFrom$StateRoot($state, spec.pathObj);
|
|
1323
|
-
var newSpec =
|
|
1337
|
+
var newSpec = stateSpecs.find(function (sp) { return sp.path === spec.path; });
|
|
1324
1338
|
if (!newSpec ||
|
|
1325
1339
|
(stateCell.initFuncHash === ((_a = newSpec === null || newSpec === void 0 ? void 0 : newSpec.initFuncHash) !== null && _a !== void 0 ? _a : "") &&
|
|
1326
1340
|
stateCell.initialValue !== UNINITIALIZED)) {
|