@xmachines/json-render-react 0.21.0-xm.1 → 0.21.0-xm.2

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.js CHANGED
@@ -914,7 +914,6 @@ var import_core8 = require("@xmachines/json-render-core");
914
914
  var import_react6 = __toESM(require("react"));
915
915
  var import_core6 = require("@xmachines/json-render-core");
916
916
  var import_jsx_runtime6 = require("react/jsx-runtime");
917
- var registryMetadata = /* @__PURE__ */ new WeakMap();
918
917
  var EMPTY_ELEMENT_PROPS = {};
919
918
  function withRenderErrorHandler(registry, onRenderError) {
920
919
  const next = { ...registry };
@@ -923,8 +922,7 @@ function withRenderErrorHandler(registry, onRenderError) {
923
922
  enumerable: false,
924
923
  configurable: true
925
924
  });
926
- const metadata = registryMetadata.get(registry);
927
- if (metadata) registryMetadata.set(next, metadata);
925
+ (0, import_core6.copySlotMetadata)(registry, next);
928
926
  return next;
929
927
  }
930
928
  function useRenderErrorRegistry(registry, onRenderError) {
@@ -1314,21 +1312,7 @@ function ReactiveElementRenderer({
1314
1312
  console.warn(`No renderer for component type: ${resolvedElement.type}`);
1315
1313
  return null;
1316
1314
  }
1317
- const metadata = registryMetadata.get(registry)?.[resolvedElement.type];
1318
- if (resolvedElement.slots && metadata?.slots) {
1319
- const availableSlots = new Set(metadata.slots);
1320
- for (const slotName of Object.keys(resolvedElement.slots)) {
1321
- if (slotName === "default") {
1322
- console.warn(
1323
- `[json-render] Component "${resolvedElement.type}" uses slots.default. Use "children" for default slot content.`
1324
- );
1325
- } else if (!availableSlots.has(slotName)) {
1326
- console.warn(
1327
- `[json-render] Unknown slot "${slotName}" on component "${resolvedElement.type}". Available slots: ${metadata.slots.join(", ")}`
1328
- );
1329
- }
1330
- }
1331
- }
1315
+ (0, import_core6.warnElementSlots)(registry, resolvedElement.type, resolvedElement.slots);
1332
1316
  const renderChildKeys = (childKeys, slotName) => childKeys.map((childKey) => {
1333
1317
  const childElement = spec.elements[childKey];
1334
1318
  if (!childElement) {
@@ -1574,10 +1558,7 @@ function defineRegistry(catalog, options) {
1574
1558
  };
1575
1559
  }
1576
1560
  }
1577
- const catalogComponents = catalog.data.components;
1578
- if (catalogComponents) {
1579
- registryMetadata.set(registry, catalogComponents);
1580
- }
1561
+ (0, import_core6.setCatalogSlotMetadata)(registry, catalog);
1581
1562
  const actionMap = options.actions ? Object.entries(options.actions) : [];
1582
1563
  const handlers = (getSetState, getState) => {
1583
1564
  const result = {};
@@ -1611,10 +1592,7 @@ function defineRegistry(catalog, options) {
1611
1592
  }
1612
1593
  function createRenderer(catalog, components) {
1613
1594
  const registry = components;
1614
- const catalogComponents = catalog.data.components;
1615
- if (catalogComponents) {
1616
- registryMetadata.set(registry, catalogComponents);
1617
- }
1595
+ (0, import_core6.setCatalogSlotMetadata)(registry, catalog);
1618
1596
  return function CatalogRenderer({
1619
1597
  spec,
1620
1598
  store,