@uniformdev/canvas-react 18.22.0 → 18.23.1-alpha.25

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.esm.js CHANGED
@@ -28,7 +28,7 @@ function DefaultNotImplementedComponent(props) {
28
28
  "enable localization in your front-end application."
29
29
  )));
30
30
  }
31
- return /* @__PURE__ */ React.createElement("div", { style: wrapperStyles }, /* @__PURE__ */ React.createElement("h2", null, "Component: ", /* @__PURE__ */ React.createElement("code", null, componentType)), /* @__PURE__ */ React.createElement("p", null, /* @__PURE__ */ React.createElement("code", null, /* @__PURE__ */ React.createElement("strong", null, componentType)), " ", "has no React implementation. It may need to be added to your ", /* @__PURE__ */ React.createElement("code", null, "resolveRenderer()"), " function."), /* @__PURE__ */ React.createElement("details", null, /* @__PURE__ */ React.createElement("summary", { style: { cursor: "pointer" } }, "Props"), /* @__PURE__ */ React.createElement("pre", null, JSON.stringify(props, null, 2))));
31
+ return /* @__PURE__ */ React.createElement("div", { style: wrapperStyles }, /* @__PURE__ */ React.createElement("h2", null, "Component: ", /* @__PURE__ */ React.createElement("code", null, componentType)), /* @__PURE__ */ React.createElement("p", null, /* @__PURE__ */ React.createElement("code", null, /* @__PURE__ */ React.createElement("strong", null, componentType)), " ", "has no React implementation. It may need to be added to your ", /* @__PURE__ */ React.createElement("code", null, "resolveRenderer()"), " function."), /* @__PURE__ */ React.createElement("details", null, /* @__PURE__ */ React.createElement("summary", { style: { cursor: "pointer" } }, "Data"), /* @__PURE__ */ React.createElement("pre", null, JSON.stringify(props, null, 2))));
32
32
  }
33
33
 
34
34
  // src/components/UniformComponent.tsx
@@ -276,10 +276,6 @@ var UniformComponentContext = createContext({});
276
276
  function useUniformCurrentComponent() {
277
277
  return useContext(UniformComponentContext);
278
278
  }
279
- var componentStoreResolver2 = (component) => {
280
- const resolved = componentStore.get(component.type, component.variant);
281
- return resolved || null;
282
- };
283
279
  function UniformComponent({
284
280
  data,
285
281
  resolveRenderer,
@@ -297,7 +293,7 @@ function UniformComponent({
297
293
  }
298
294
  const contextValue = {
299
295
  data,
300
- resolveRenderer: resolveRenderer || (parentData == null ? void 0 : parentData.resolveRenderer) || componentStoreResolver2,
296
+ resolveRenderer: resolveRenderer || parentData.resolveRenderer || componentStoreResolver,
301
297
  behaviorTracking: (_a = behaviorTracking != null ? behaviorTracking : parentData == null ? void 0 : parentData.behaviorTracking) != null ? _a : "onView"
302
298
  };
303
299
  const enrichmentTags = (_c = (_b = data.parameters) == null ? void 0 : _b[CANVAS_ENRICHMENT_TAG_PARAM]) == null ? void 0 : _c.value;
@@ -305,7 +301,8 @@ function UniformComponent({
305
301
  const resolvedChildren = resolveChildren({
306
302
  children,
307
303
  data,
308
- hasParentLayout: Boolean(parentData.data)
304
+ hasParentLayout: Boolean(parentData.data),
305
+ resolveRenderer: contextValue.resolveRenderer
309
306
  });
310
307
  return /* @__PURE__ */ React4.createElement(UniformComponentContext.Provider, { value: contextValue }, contextContextProviderPresent ? (
311
308
  /* auto-track behavior signals when in a Canvas context */
@@ -315,13 +312,14 @@ function UniformComponent({
315
312
  function resolveChildren({
316
313
  children,
317
314
  data,
318
- hasParentLayout
315
+ hasParentLayout,
316
+ resolveRenderer
319
317
  }) {
320
318
  var _a;
321
319
  if (!children && !hasParentLayout) {
322
- const rootComponent = componentStore.get(data.type);
323
- if (rootComponent) {
324
- children = React4.createElement(rootComponent, convertComponentToProps(data));
320
+ const topLevelComponent = resolveRenderer({ type: data.type });
321
+ if (topLevelComponent) {
322
+ children = React4.createElement(topLevelComponent, convertComponentToProps(data));
325
323
  } else {
326
324
  if (Object.keys((_a = data.slots) != null ? _a : {}).length > 1 && process.env.NODE_ENV === "development") {
327
325
  console.warn(
package/dist/index.js CHANGED
@@ -83,7 +83,7 @@ function DefaultNotImplementedComponent(props) {
83
83
  "enable localization in your front-end application."
84
84
  )));
85
85
  }
86
- return /* @__PURE__ */ import_react.default.createElement("div", { style: wrapperStyles }, /* @__PURE__ */ import_react.default.createElement("h2", null, "Component: ", /* @__PURE__ */ import_react.default.createElement("code", null, componentType)), /* @__PURE__ */ import_react.default.createElement("p", null, /* @__PURE__ */ import_react.default.createElement("code", null, /* @__PURE__ */ import_react.default.createElement("strong", null, componentType)), " ", "has no React implementation. It may need to be added to your ", /* @__PURE__ */ import_react.default.createElement("code", null, "resolveRenderer()"), " function."), /* @__PURE__ */ import_react.default.createElement("details", null, /* @__PURE__ */ import_react.default.createElement("summary", { style: { cursor: "pointer" } }, "Props"), /* @__PURE__ */ import_react.default.createElement("pre", null, JSON.stringify(props, null, 2))));
86
+ return /* @__PURE__ */ import_react.default.createElement("div", { style: wrapperStyles }, /* @__PURE__ */ import_react.default.createElement("h2", null, "Component: ", /* @__PURE__ */ import_react.default.createElement("code", null, componentType)), /* @__PURE__ */ import_react.default.createElement("p", null, /* @__PURE__ */ import_react.default.createElement("code", null, /* @__PURE__ */ import_react.default.createElement("strong", null, componentType)), " ", "has no React implementation. It may need to be added to your ", /* @__PURE__ */ import_react.default.createElement("code", null, "resolveRenderer()"), " function."), /* @__PURE__ */ import_react.default.createElement("details", null, /* @__PURE__ */ import_react.default.createElement("summary", { style: { cursor: "pointer" } }, "Data"), /* @__PURE__ */ import_react.default.createElement("pre", null, JSON.stringify(props, null, 2))));
87
87
  }
88
88
 
89
89
  // src/components/UniformComponent.tsx
@@ -318,10 +318,6 @@ var UniformComponentContext = (0, import_react3.createContext)({});
318
318
  function useUniformCurrentComponent() {
319
319
  return (0, import_react3.useContext)(UniformComponentContext);
320
320
  }
321
- var componentStoreResolver2 = (component) => {
322
- const resolved = componentStore.get(component.type, component.variant);
323
- return resolved || null;
324
- };
325
321
  function UniformComponent({
326
322
  data,
327
323
  resolveRenderer,
@@ -339,7 +335,7 @@ function UniformComponent({
339
335
  }
340
336
  const contextValue = {
341
337
  data,
342
- resolveRenderer: resolveRenderer || (parentData == null ? void 0 : parentData.resolveRenderer) || componentStoreResolver2,
338
+ resolveRenderer: resolveRenderer || parentData.resolveRenderer || componentStoreResolver,
343
339
  behaviorTracking: (_a = behaviorTracking != null ? behaviorTracking : parentData == null ? void 0 : parentData.behaviorTracking) != null ? _a : "onView"
344
340
  };
345
341
  const enrichmentTags = (_c = (_b = data.parameters) == null ? void 0 : _b[import_canvas4.CANVAS_ENRICHMENT_TAG_PARAM]) == null ? void 0 : _c.value;
@@ -347,7 +343,8 @@ function UniformComponent({
347
343
  const resolvedChildren = resolveChildren({
348
344
  children,
349
345
  data,
350
- hasParentLayout: Boolean(parentData.data)
346
+ hasParentLayout: Boolean(parentData.data),
347
+ resolveRenderer: contextValue.resolveRenderer
351
348
  });
352
349
  return /* @__PURE__ */ import_react3.default.createElement(UniformComponentContext.Provider, { value: contextValue }, contextContextProviderPresent ? (
353
350
  /* auto-track behavior signals when in a Canvas context */
@@ -357,13 +354,14 @@ function UniformComponent({
357
354
  function resolveChildren({
358
355
  children,
359
356
  data,
360
- hasParentLayout
357
+ hasParentLayout,
358
+ resolveRenderer
361
359
  }) {
362
360
  var _a;
363
361
  if (!children && !hasParentLayout) {
364
- const rootComponent = componentStore.get(data.type);
365
- if (rootComponent) {
366
- children = import_react3.default.createElement(rootComponent, convertComponentToProps(data));
362
+ const topLevelComponent = resolveRenderer({ type: data.type });
363
+ if (topLevelComponent) {
364
+ children = import_react3.default.createElement(topLevelComponent, convertComponentToProps(data));
367
365
  } else {
368
366
  if (Object.keys((_a = data.slots) != null ? _a : {}).length > 1 && process.env.NODE_ENV === "development") {
369
367
  console.warn(
package/dist/index.mjs CHANGED
@@ -28,7 +28,7 @@ function DefaultNotImplementedComponent(props) {
28
28
  "enable localization in your front-end application."
29
29
  )));
30
30
  }
31
- return /* @__PURE__ */ React.createElement("div", { style: wrapperStyles }, /* @__PURE__ */ React.createElement("h2", null, "Component: ", /* @__PURE__ */ React.createElement("code", null, componentType)), /* @__PURE__ */ React.createElement("p", null, /* @__PURE__ */ React.createElement("code", null, /* @__PURE__ */ React.createElement("strong", null, componentType)), " ", "has no React implementation. It may need to be added to your ", /* @__PURE__ */ React.createElement("code", null, "resolveRenderer()"), " function."), /* @__PURE__ */ React.createElement("details", null, /* @__PURE__ */ React.createElement("summary", { style: { cursor: "pointer" } }, "Props"), /* @__PURE__ */ React.createElement("pre", null, JSON.stringify(props, null, 2))));
31
+ return /* @__PURE__ */ React.createElement("div", { style: wrapperStyles }, /* @__PURE__ */ React.createElement("h2", null, "Component: ", /* @__PURE__ */ React.createElement("code", null, componentType)), /* @__PURE__ */ React.createElement("p", null, /* @__PURE__ */ React.createElement("code", null, /* @__PURE__ */ React.createElement("strong", null, componentType)), " ", "has no React implementation. It may need to be added to your ", /* @__PURE__ */ React.createElement("code", null, "resolveRenderer()"), " function."), /* @__PURE__ */ React.createElement("details", null, /* @__PURE__ */ React.createElement("summary", { style: { cursor: "pointer" } }, "Data"), /* @__PURE__ */ React.createElement("pre", null, JSON.stringify(props, null, 2))));
32
32
  }
33
33
 
34
34
  // src/components/UniformComponent.tsx
@@ -276,10 +276,6 @@ var UniformComponentContext = createContext({});
276
276
  function useUniformCurrentComponent() {
277
277
  return useContext(UniformComponentContext);
278
278
  }
279
- var componentStoreResolver2 = (component) => {
280
- const resolved = componentStore.get(component.type, component.variant);
281
- return resolved || null;
282
- };
283
279
  function UniformComponent({
284
280
  data,
285
281
  resolveRenderer,
@@ -297,7 +293,7 @@ function UniformComponent({
297
293
  }
298
294
  const contextValue = {
299
295
  data,
300
- resolveRenderer: resolveRenderer || (parentData == null ? void 0 : parentData.resolveRenderer) || componentStoreResolver2,
296
+ resolveRenderer: resolveRenderer || parentData.resolveRenderer || componentStoreResolver,
301
297
  behaviorTracking: (_a = behaviorTracking != null ? behaviorTracking : parentData == null ? void 0 : parentData.behaviorTracking) != null ? _a : "onView"
302
298
  };
303
299
  const enrichmentTags = (_c = (_b = data.parameters) == null ? void 0 : _b[CANVAS_ENRICHMENT_TAG_PARAM]) == null ? void 0 : _c.value;
@@ -305,7 +301,8 @@ function UniformComponent({
305
301
  const resolvedChildren = resolveChildren({
306
302
  children,
307
303
  data,
308
- hasParentLayout: Boolean(parentData.data)
304
+ hasParentLayout: Boolean(parentData.data),
305
+ resolveRenderer: contextValue.resolveRenderer
309
306
  });
310
307
  return /* @__PURE__ */ React4.createElement(UniformComponentContext.Provider, { value: contextValue }, contextContextProviderPresent ? (
311
308
  /* auto-track behavior signals when in a Canvas context */
@@ -315,13 +312,14 @@ function UniformComponent({
315
312
  function resolveChildren({
316
313
  children,
317
314
  data,
318
- hasParentLayout
315
+ hasParentLayout,
316
+ resolveRenderer
319
317
  }) {
320
318
  var _a;
321
319
  if (!children && !hasParentLayout) {
322
- const rootComponent = componentStore.get(data.type);
323
- if (rootComponent) {
324
- children = React4.createElement(rootComponent, convertComponentToProps(data));
320
+ const topLevelComponent = resolveRenderer({ type: data.type });
321
+ if (topLevelComponent) {
322
+ children = React4.createElement(topLevelComponent, convertComponentToProps(data));
325
323
  } else {
326
324
  if (Object.keys((_a = data.slots) != null ? _a : {}).length > 1 && process.env.NODE_ENV === "development") {
327
325
  console.warn(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-react",
3
- "version": "18.22.0",
3
+ "version": "18.23.1-alpha.25+6ae528b11",
4
4
  "description": "React SDK for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -24,9 +24,9 @@
24
24
  "document": "api-extractor run --local"
25
25
  },
26
26
  "dependencies": {
27
- "@uniformdev/canvas": "18.22.0",
28
- "@uniformdev/context": "18.22.0",
29
- "@uniformdev/context-react": "18.22.0"
27
+ "@uniformdev/canvas": "18.23.1-alpha.25+6ae528b11",
28
+ "@uniformdev/context": "18.23.1-alpha.25+6ae528b11",
29
+ "@uniformdev/context-react": "18.23.1-alpha.25+6ae528b11"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": ">= 16 || 17 || 18",
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "55125ebbd2e43c65946984dbd1cea417e089f75d"
46
+ "gitHead": "6ae528b111d6948dbc768a06f57f349d95b69b96"
47
47
  }