@kithinji/orca 1.0.4 → 1.0.5
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/browser/index.iife.js +30 -29
- package/dist/browser/index.iife.js.map +3 -3
- package/dist/browser/index.mjs +30 -29
- package/dist/browser/index.mjs.map +3 -3
- package/dist/node/index.cjs +30 -29
- package/dist/node/index.cjs.map +3 -3
- package/dist/node/index.mjs +30 -29
- package/dist/node/index.mjs.map +3 -3
- package/dist/types/shared/dom/osc.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1680,7 +1680,7 @@ var kithinjiorca = (() => {
|
|
|
1680
1680
|
vnode.setId(jsx2.id);
|
|
1681
1681
|
}
|
|
1682
1682
|
parent.addChild(vnode);
|
|
1683
|
-
this.loadClientComponent(path, name, jsx2.props, container
|
|
1683
|
+
this.loadClientComponent(path, name, jsx2.props, container);
|
|
1684
1684
|
return { domNode: container, vnode };
|
|
1685
1685
|
}
|
|
1686
1686
|
buildPendingReference(jsx2, parent) {
|
|
@@ -1805,43 +1805,44 @@ var kithinjiorca = (() => {
|
|
|
1805
1805
|
dom.removeAttribute(key);
|
|
1806
1806
|
}
|
|
1807
1807
|
}
|
|
1808
|
-
async loadClientComponent(path, name, props, container
|
|
1808
|
+
async loadClientComponent(path, name, props, container) {
|
|
1809
1809
|
try {
|
|
1810
|
+
let register2 = function(Cls, injector2) {
|
|
1811
|
+
if (seen.has(Cls))
|
|
1812
|
+
return;
|
|
1813
|
+
seen.add(Cls);
|
|
1814
|
+
injector2.addProvider({
|
|
1815
|
+
provide: Cls,
|
|
1816
|
+
useClass: Cls,
|
|
1817
|
+
scope: "transient"
|
|
1818
|
+
});
|
|
1819
|
+
const paramDeps = Reflect.getMetadata(DESIGN_PARAMTYPES, Cls) ?? [];
|
|
1820
|
+
const explicitDeps = Reflect.getMetadata(COMPONENT_DEPS, Cls) ?? [];
|
|
1821
|
+
paramDeps.filter((d) => d && d !== Object).forEach((d) => injector2.addProvider(d));
|
|
1822
|
+
explicitDeps.forEach((deps) => register2(deps, injector2));
|
|
1823
|
+
};
|
|
1824
|
+
var register = register2;
|
|
1810
1825
|
const module = await import(path);
|
|
1811
1826
|
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
1827
|
if (!ComponentClass) {
|
|
1819
1828
|
throw new Error(`Component ${name} not found in ${path}`);
|
|
1820
1829
|
}
|
|
1821
|
-
injector
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
(depClass) => injector.addProvider({
|
|
1828
|
-
provide: depClass,
|
|
1829
|
-
useClass: depClass,
|
|
1830
|
-
scope: "transient"
|
|
1831
|
-
})
|
|
1832
|
-
);
|
|
1833
|
-
params.forEach((p) => injector.addProvider(p));
|
|
1830
|
+
const injector = getCurrentInjector();
|
|
1831
|
+
if (injector == null) {
|
|
1832
|
+
throw new Error("Couldn't find an injector");
|
|
1833
|
+
}
|
|
1834
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1835
|
+
register2(ComponentClass, injector);
|
|
1834
1836
|
const cleanProps = { ...props };
|
|
1835
1837
|
delete cleanProps.__clientComponent;
|
|
1836
|
-
const
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
if (typeof
|
|
1840
|
-
|
|
1841
|
-
container.parentNode?.replaceChild(rendered, container);
|
|
1842
|
-
} else {
|
|
1843
|
-
throw new Error(`Component ${name} does not have a build method`);
|
|
1838
|
+
const instance = injector.resolve(ComponentClass);
|
|
1839
|
+
instance.__injector = injector;
|
|
1840
|
+
instance.props = cleanProps;
|
|
1841
|
+
if (typeof instance.build !== "function") {
|
|
1842
|
+
throw new Error(`Component ${name} does not implement build()`);
|
|
1844
1843
|
}
|
|
1844
|
+
const rendered = instance.build();
|
|
1845
|
+
container.replaceWith(rendered);
|
|
1845
1846
|
} catch (error) {
|
|
1846
1847
|
console.error(`Failed to load client component ${name}:`, error);
|
|
1847
1848
|
container.textContent = `Error loading component: ${name}`;
|