@plasmicapp/loader-react 1.0.48 → 1.0.52

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.
@@ -1428,6 +1428,19 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
1428
1428
  }));
1429
1429
  };
1430
1430
 
1431
+ _proto.registerContext = function registerContext(context, meta) {
1432
+ var _meta$importPath2;
1433
+
1434
+ this.substituteComponent(context, {
1435
+ name: meta.name,
1436
+ isCode: true
1437
+ }); // Import path is not used as we will use component substitution
1438
+
1439
+ host.registerContext(context, _extends({}, meta, {
1440
+ importPath: (_meta$importPath2 = meta.importPath) != null ? _meta$importPath2 : ''
1441
+ }));
1442
+ };
1443
+
1431
1444
  _proto.registerPrefetchedBundle = function registerPrefetchedBundle(bundle) {
1432
1445
  this.mergeBundle(bundle);
1433
1446
  };
@@ -1885,6 +1898,10 @@ var PlasmicComponentLoader = /*#__PURE__*/function () {
1885
1898
 
1886
1899
  this.substituteComponent(component, metaOrName);
1887
1900
  }
1901
+ };
1902
+
1903
+ _proto2.registerContext = function registerContext(context, meta) {
1904
+ this.__internal.registerContext(context, meta);
1888
1905
  }
1889
1906
  /**
1890
1907
  * Pre-fetches component data needed to for PlasmicLoader to render
@@ -2202,12 +2219,12 @@ function _extractPlasmicQueryData() {
2202
2219
  console.warn("PLASMIC: Error encountered while pre-rendering", _context.t0);
2203
2220
 
2204
2221
  case 9:
2205
- return _context.abrupt("return", Object.fromEntries(Array.from(Object.entries(cache)).map(function (_ref4) {
2206
- var key = _ref4[0],
2207
- data = _ref4[1].data;
2222
+ return _context.abrupt("return", Object.fromEntries(Array.from(Object.entries(cache)).map(function (_ref3) {
2223
+ var key = _ref3[0],
2224
+ data = _ref3[1].data;
2208
2225
  return [key, data];
2209
- }).filter(function (_ref5) {
2210
- var data = _ref5[1];
2226
+ }).filter(function (_ref4) {
2227
+ var data = _ref4[1];
2211
2228
  return !!data;
2212
2229
  })));
2213
2230
 
@@ -2267,32 +2284,10 @@ function processComponentProps(props) {
2267
2284
  return props;
2268
2285
  }
2269
2286
 
2270
- var processValue = function processValue(value, depth) {
2271
- if (depth > 2) {
2272
- return value;
2273
- }
2274
-
2275
- if (React__default.isValidElement(value)) {
2276
- return processReactElement(value);
2277
- } else if (Array.isArray(value)) {
2278
- return value.map(function (v) {
2279
- return processValue(v, depth + 1);
2280
- });
2281
- } else if (isLiteralObject(value)) {
2282
- return Object.fromEntries(Object.entries(value).map(function (_ref) {
2283
- var k = _ref[0],
2284
- v = _ref[1];
2285
- return [k, processValue(v, depth + 1)];
2286
- }));
2287
- } else {
2288
- return value;
2289
- }
2290
- };
2291
-
2292
- return Object.fromEntries(Object.entries(props).map(function (_ref2) {
2293
- var k = _ref2[0],
2294
- v = _ref2[1];
2295
- return [k, processValue(v, 1)];
2287
+ return Object.fromEntries(Object.entries(props).map(function (_ref) {
2288
+ var k = _ref[0],
2289
+ v = _ref[1];
2290
+ return [k, React__default.isValidElement(v) ? processReactElement(v) : v];
2296
2291
  }));
2297
2292
  }
2298
2293
 
@@ -2331,9 +2326,9 @@ function processPlasmicComponentProps(x) {
2331
2326
  } else if (Array.isArray(x)) {
2332
2327
  return x.map(processPlasmicComponentProps);
2333
2328
  } else if (isLiteralObject(x)) {
2334
- return Object.fromEntries(Object.entries(x).map(function (_ref3) {
2335
- var key = _ref3[0],
2336
- val = _ref3[1];
2329
+ return Object.fromEntries(Object.entries(x).map(function (_ref2) {
2330
+ var key = _ref2[0],
2331
+ val = _ref2[1];
2337
2332
  return [key, processPlasmicComponentProps(val)];
2338
2333
  }));
2339
2334
  } else {