@kithinji/orca 1.0.4 → 1.0.6

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.
@@ -930,13 +930,15 @@ var kithinjiorca = (() => {
930
930
  return this.renderClassComponent(vnode, injector);
931
931
  }
932
932
  if (isIntrinsicElement(vnode)) {
933
+ const hasDangerousHTML = vnode.props?.dangerouslySetInnerHTML;
933
934
  return {
934
935
  $$typeof: ORCA_ELEMENT_TYPE,
935
936
  type: vnode.type,
936
937
  id: vnode.id,
937
938
  props: {
938
939
  ...vnode.props,
939
- children: this.mapChildren(vnode.props?.children, injector)
940
+ // Only process children if dangerouslySetInnerHTML is not present
941
+ children: hasDangerousHTML ? void 0 : this.mapChildren(vnode.props?.children, injector)
940
942
  },
941
943
  key: vnode.key ?? null
942
944
  };
@@ -1680,7 +1682,7 @@ var kithinjiorca = (() => {
1680
1682
  vnode.setId(jsx2.id);
1681
1683
  }
1682
1684
  parent.addChild(vnode);
1683
- this.loadClientComponent(path, name, jsx2.props, container, vnode);
1685
+ this.loadClientComponent(path, name, jsx2.props, container);
1684
1686
  return { domNode: container, vnode };
1685
1687
  }
1686
1688
  buildPendingReference(jsx2, parent) {
@@ -1805,43 +1807,44 @@ var kithinjiorca = (() => {
1805
1807
  dom.removeAttribute(key);
1806
1808
  }
1807
1809
  }
1808
- async loadClientComponent(path, name, props, container, vnode) {
1810
+ async loadClientComponent(path, name, props, container) {
1809
1811
  try {
1812
+ let register2 = function(Cls, injector2) {
1813
+ if (seen.has(Cls))
1814
+ return;
1815
+ seen.add(Cls);
1816
+ injector2.addProvider({
1817
+ provide: Cls,
1818
+ useClass: Cls,
1819
+ scope: "transient"
1820
+ });
1821
+ const paramDeps = Reflect.getMetadata(DESIGN_PARAMTYPES, Cls) ?? [];
1822
+ const explicitDeps = Reflect.getMetadata(COMPONENT_DEPS, Cls) ?? [];
1823
+ paramDeps.filter((d) => d && d !== Object).forEach((d) => injector2.addProvider(d));
1824
+ explicitDeps.forEach((deps) => register2(deps, injector2));
1825
+ };
1826
+ var register = register2;
1810
1827
  const module = await import(path);
1811
1828
  const ComponentClass = module[name];
1812
- const params = Reflect.getMetadata(DESIGN_PARAMTYPES, ComponentClass) || [];
1813
- const deps = Reflect.getMetadata(COMPONENT_DEPS, ComponentClass) || [];
1814
- const injector = getCurrentInjector();
1815
- if (injector == null) {
1816
- throw new Error(`Couldn't find an injector`);
1817
- }
1818
1829
  if (!ComponentClass) {
1819
1830
  throw new Error(`Component ${name} not found in ${path}`);
1820
1831
  }
1821
- injector.addProvider({
1822
- provide: ComponentClass,
1823
- useClass: ComponentClass,
1824
- scope: "transient"
1825
- });
1826
- deps.forEach(
1827
- (depClass) => injector.addProvider({
1828
- provide: depClass,
1829
- useClass: depClass,
1830
- scope: "transient"
1831
- })
1832
- );
1833
- params.forEach((p) => injector.addProvider(p));
1832
+ const injector = getCurrentInjector();
1833
+ if (injector == null) {
1834
+ throw new Error("Couldn't find an injector");
1835
+ }
1836
+ const seen = /* @__PURE__ */ new Set();
1837
+ register2(ComponentClass, injector);
1834
1838
  const cleanProps = { ...props };
1835
1839
  delete cleanProps.__clientComponent;
1836
- const componentInstance = injector.resolve(ComponentClass);
1837
- componentInstance.__injector = injector;
1838
- componentInstance.props = cleanProps;
1839
- if (typeof componentInstance.build === "function") {
1840
- const rendered = componentInstance.build();
1841
- container.parentNode?.replaceChild(rendered, container);
1842
- } else {
1843
- throw new Error(`Component ${name} does not have a build method`);
1840
+ const instance = injector.resolve(ComponentClass);
1841
+ instance.__injector = injector;
1842
+ instance.props = cleanProps;
1843
+ if (typeof instance.build !== "function") {
1844
+ throw new Error(`Component ${name} does not implement build()`);
1844
1845
  }
1846
+ const rendered = instance.build();
1847
+ container.replaceWith(rendered);
1845
1848
  } catch (error) {
1846
1849
  console.error(`Failed to load client component ${name}:`, error);
1847
1850
  container.textContent = `Error loading component: ${name}`;