@vmz/core 0.1.31 → 0.1.32

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.
@@ -173,11 +173,11 @@ export declare const directApi: {
173
173
  /**
174
174
  * Nested component (sync Direct child or island schedule).
175
175
  * @param {object} hostInst
176
- * @param {string} name
176
+ * @param {string | Function} nameOrCtor — PascalCase tag string, or static Ctor import
177
177
  * @param {Record<string, any>} props
178
178
  * @param {string | null} client
179
179
  */
180
- component(hostInst: any, name: any, props: any, client: any): any;
180
+ component(hostInst: any, nameOrCtor: any, props: any, client: any): any;
181
181
  /**
182
182
  * Subscribe to a child component event (`@submit` → event name `submit`).
183
183
  * Orthogonal to function props (`:on-submit` → prop `onSubmit`).
package/dist/dom-core.js CHANGED
@@ -537,11 +537,12 @@ export const directApi = {
537
537
  /**
538
538
  * Nested component (sync Direct child or island schedule).
539
539
  * @param {object} hostInst
540
- * @param {string} name
540
+ * @param {string | Function} nameOrCtor — PascalCase tag string, or static Ctor import
541
541
  * @param {Record<string, any>} props
542
542
  * @param {string | null} client
543
543
  */
544
- component(hostInst, name, props, client) {
544
+ component(hostInst, nameOrCtor, props, client) {
545
+ const name = typeof nameOrCtor === 'function' ? nameOrCtor.__vmzTag || nameOrCtor.name || 'Component' : nameOrCtor;
545
546
  /** @type {HTMLElement | null} */
546
547
  let host = null;
547
548
  if (directApi._resumeAdopt && typeof directApi._resumeAdopt.componentHost === 'function') {
@@ -574,7 +575,7 @@ export const directApi = {
574
575
  }
575
576
  // resume: resume on schedule; EventEntry may lazy-load chunk via __vmzLoadComponent.
576
577
  scheduleClientOn(host, String(client), async () => {
577
- const Ctor = await resolveComponent(name);
578
+ const Ctor = typeof nameOrCtor === 'function' ? nameOrCtor : await resolveComponent(name);
578
579
  if (!Ctor) {
579
580
  // Replace placeholder island with leaf error node (do not throw page).
580
581
  const err = createUnknownComponentElement(name, 'island');
@@ -585,7 +586,8 @@ export const directApi = {
585
586
  });
586
587
  return host;
587
588
  }
588
- const Ctor = components[name];
589
+ // Static Ctor import path: use Function directly (no registry lookup).
590
+ const Ctor = typeof nameOrCtor === 'function' ? nameOrCtor : components[name];
589
591
  if (!Ctor) {
590
592
  return createUnknownComponentElement(name, 'client');
591
593
  }
package/dist/dom-ssr.js CHANGED
@@ -755,8 +755,9 @@ const serializeApi = {
755
755
  }
756
756
  return frag;
757
757
  },
758
- component(hostInst, name, props, client) {
759
- const Ctor = getRegisteredComponent(name);
758
+ component(hostInst, nameOrCtor, props, client) {
759
+ const name = typeof nameOrCtor === 'function' ? nameOrCtor.__vmzTag || nameOrCtor.name || 'Component' : nameOrCtor;
760
+ const Ctor = typeof nameOrCtor === 'function' ? nameOrCtor : getRegisteredComponent(name);
760
761
  if (!Ctor) {
761
762
  return serializeUnknownComponentNode(name);
762
763
  }
@@ -522,26 +522,11 @@ async function* emitPageHtml(Page, chunkId, eventOnlyShell, props = {}, opts = {
522
522
  hideOverlay();
523
523
  if (msg.mode === "island") {
524
524
  try {
525
- const { registerComponents, hydrate } = await import("/dom.browser.js?t=" + msg.token);
526
- const names = (msg.affectedChunks || [])
527
- .map((c) => String(c))
528
- .filter((c) => c.startsWith("components/") || !c.includes("/"))
529
- .map((c) => c.split("/").pop())
530
- .filter(Boolean);
531
- const map = {};
532
- for (const name of names) {
533
- let mod;
534
- try {
535
- mod = await import("/components/" + name + ".client.js?t=" + msg.token);
536
- } catch {
537
- mod = await import("/" + name + ".client.js?t=" + msg.token);
538
- }
539
- map[name] = mod.default;
540
- }
541
- if (Object.keys(map).length) registerComponents(map);
525
+ const { hydrate } = await import("/dom.browser.js?t=" + msg.token);
542
526
  const root = document.getElementById("app");
543
527
  const pageChunk = root && root.getAttribute("data-vmz-page");
544
528
  if (root && pageChunk) {
529
+ // Child Ctors come from page static imports after reload with cache token.
545
530
  const pageMod = await import("/" + pageChunk + ".client.js?t=" + msg.token);
546
531
  let hmrProps = {};
547
532
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vmz/core",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "type": "module",
5
5
  "description": "VMZ production runtime core — DOM / SSR / HTTP / WriteBarrier (no compiler)",
6
6
  "exports": {
@@ -70,12 +70,12 @@
70
70
  "linkedom": "^0.18.13"
71
71
  },
72
72
  "optionalDependencies": {
73
- "@vmz/vmz-win32-x64": "0.1.31",
74
- "@vmz/vmz-win32-arm64": "0.1.31",
75
- "@vmz/vmz-darwin-x64": "0.1.31",
76
- "@vmz/vmz-darwin-arm64": "0.1.31",
77
- "@vmz/vmz-linux-x64": "0.1.31",
78
- "@vmz/vmz-linux-arm64": "0.1.31"
73
+ "@vmz/vmz-win32-x64": "0.1.32",
74
+ "@vmz/vmz-win32-arm64": "0.1.32",
75
+ "@vmz/vmz-darwin-x64": "0.1.32",
76
+ "@vmz/vmz-darwin-arm64": "0.1.32",
77
+ "@vmz/vmz-linux-x64": "0.1.32",
78
+ "@vmz/vmz-linux-arm64": "0.1.32"
79
79
  },
80
80
  "publishConfig": {
81
81
  "access": "public"