@vesk/runtime 0.2.51 → 0.2.52

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.
@@ -23,6 +23,12 @@ export interface RouteNode {
23
23
  export interface RouteMatch {
24
24
  matchChain: RouteNode[];
25
25
  params: Record<string, string>;
26
+ /**
27
+ * The pathname this match was computed FOR — not the pattern that matched.
28
+ * `usePathname()` and `NavLink`'s active state read it, so leaving it unset
29
+ * made every route report `/` (via `pathname || ''`), which is what made
30
+ * NavLink highlighting permanently inert.
31
+ */
26
32
  pathname?: string;
27
33
  }
28
34
  interface CompiledRoute {
@@ -1 +1 @@
1
- {"version":3,"file":"router-match.d.ts","sourceRoot":"","sources":["../src/router-match.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IACvB,MAAM,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IACzB,OAAO,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3B,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAAC;IACnC,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,Q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AU,aAAa;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAiBnE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAE,EAAE,CA6B/G;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAO5E;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAc1F;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,MAAM,GAAE,SAAS,EAAO,GAAG,SAAS,EAAE,CAqFhH;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAwBjF;AAED,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAChC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,SAAS,EAAE,CA0Bb"}
@@ -82,10 +82,30 @@ export function flattenLayoutChain(tree, pathParts, result = []) {
82
82
  for (let i = 0; i < tree.length; i++) {
83
83
  const node = tree[i];
84
84
  if (node.isGroup) {
85
+ // A group contributes its LAYOUT to every route beneath it, so it has
86
+ // to be in the chain even when one of its children is the match.
87
+ // Dropping it meant `app/(public)/layout.vsk` never applied on the
88
+ // client — the framework's own hyd-dbg output showed
89
+ // `layoutNames:["Layout_Index"]` for `/about`, i.e. the root layout
90
+ // only, and the page rendered outside its shell. SSR kept the group
91
+ // (the server routes from the build manifest), which is why the page
92
+ // looked right until the client took over.
93
+ //
94
+ // A group consumes no path segment, so children are matched against
95
+ // the SAME parts.
96
+ const contributes = !!(node.layout || node.page);
97
+ const marker = result.length;
98
+ if (contributes)
99
+ result.push(node);
85
100
  const before = result.length;
86
101
  flattenLayoutChain(node.children || [], pathParts, result);
87
102
  if (result.length > before)
88
- continue;
103
+ break;
104
+ // No child matched at this position; if the group is not itself the
105
+ // page here, it contributes nothing and must not stay in the chain.
106
+ // (If it IS the page, the push above is the match.)
107
+ if (contributes)
108
+ result.length = marker;
89
109
  // A group can BE the page at this position: `app/(public)/page.vsk`
90
110
  // serves `/`. Recursing into its children was the only thing this
91
111
  // branch did, and at `/` none of them match (each carries a path
@@ -172,7 +192,7 @@ export function matchRoute(tree, pathname) {
172
192
  }
173
193
  partIdx += segCount;
174
194
  }
175
- return { matchChain, params };
195
+ return { matchChain, params, pathname };
176
196
  }
177
197
  export function buildTreeFromMap(routes, _options) {
178
198
  const root = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vesk/runtime",
3
- "version": "0.2.51",
3
+ "version": "0.2.52",
4
4
  "type": "module",
5
5
  "description": "Vesk runtime — reactivity, blocks, DOM operations, hydration",
6
6
  "main": "./dist/index-client.js",
@@ -51,7 +51,7 @@
51
51
  }
52
52
  },
53
53
  "dependencies": {
54
- "@vesk/compiler": "^0.2.51"
54
+ "@vesk/compiler": "^0.2.52"
55
55
  },
56
56
  "scripts": {
57
57
  "typecheck": "tsc --noEmit",