@kithinji/orca 1.0.3 → 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 -22
- package/dist/browser/index.iife.js.map +3 -3
- package/dist/browser/index.mjs +30 -22
- package/dist/browser/index.mjs.map +3 -3
- package/dist/node/index.cjs +30 -21
- package/dist/node/index.cjs.map +3 -3
- package/dist/node/index.mjs +30 -21
- package/dist/node/index.mjs.map +3 -3
- package/dist/types/browser/dom/dom.d.ts.map +1 -1
- 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,35 +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 injector = getCurrentInjector();
|
|
1814
|
-
if (injector == null) {
|
|
1815
|
-
throw new Error(`Couldn't find an injector`);
|
|
1816
|
-
}
|
|
1817
1827
|
if (!ComponentClass) {
|
|
1818
1828
|
throw new Error(`Component ${name} not found in ${path}`);
|
|
1819
1829
|
}
|
|
1820
|
-
injector
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
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);
|
|
1826
1836
|
const cleanProps = { ...props };
|
|
1827
1837
|
delete cleanProps.__clientComponent;
|
|
1828
|
-
const
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
if (typeof
|
|
1832
|
-
|
|
1833
|
-
container.parentNode?.replaceChild(rendered, container);
|
|
1834
|
-
} else {
|
|
1835
|
-
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()`);
|
|
1836
1843
|
}
|
|
1844
|
+
const rendered = instance.build();
|
|
1845
|
+
container.replaceWith(rendered);
|
|
1837
1846
|
} catch (error) {
|
|
1838
1847
|
console.error(`Failed to load client component ${name}:`, error);
|
|
1839
1848
|
container.textContent = `Error loading component: ${name}`;
|
|
@@ -2025,7 +2034,6 @@ var kithinjiorca = (() => {
|
|
|
2025
2034
|
try {
|
|
2026
2035
|
instance = injector.resolve(ComponentClass);
|
|
2027
2036
|
} catch (e) {
|
|
2028
|
-
console.log(e);
|
|
2029
2037
|
throw new Error(e.message);
|
|
2030
2038
|
}
|
|
2031
2039
|
const localProviders = Reflect.getMetadata(COMPONENT_PROVIDERS, ComponentClass) || [];
|