@uniweb/core 1.3.1 → 1.3.2
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/package.json +3 -3
- package/src/route-match.js +15 -1
- package/src/website.js +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/core",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Core classes for the Uniweb platform - Uniweb, Website, Page, Block",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"vitest": "^4.1.7"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@uniweb/
|
|
53
|
-
"@uniweb/
|
|
52
|
+
"@uniweb/theming": "~1.2.0",
|
|
53
|
+
"@uniweb/semantic-parser": "~1.12.2"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"test": "vitest run"
|
package/src/route-match.js
CHANGED
|
@@ -527,6 +527,13 @@ export function routeParamName(pattern, declared = null) {
|
|
|
527
527
|
* included — when a page holds that route. A top-level page has none: the homepage
|
|
528
528
|
* is not everyone's parent.
|
|
529
529
|
*
|
|
530
|
+
* ⭐ Past a version folder, the versioned section. In `docs/v1/` + `docs/v2/` the latest
|
|
531
|
+
* version's pages sit at `/docs/…` and hang from `/docs`; an older one's sit at
|
|
532
|
+
* `/docs/v1/…`, and `/docs/v1` is a folder, never a page — so they hang from `/docs` too.
|
|
533
|
+
* The segment is a version by the build's own convention (`v1`, `v2.1`). ⛔ Until
|
|
534
|
+
* 2026-10-19 they had no parent: every menu listed them as top-level pages, and no
|
|
535
|
+
* branch of the tree held them.
|
|
536
|
+
*
|
|
530
537
|
* ⛔ Measured 2026-09-11, before this existed: the prefetch read the declared field
|
|
531
538
|
* only, so on a payload without it `/members/alice` resolved no configs at all,
|
|
532
539
|
* while the SPA inferred `/members` and fetched the list and the record itself.
|
|
@@ -544,9 +551,16 @@ export function parentRouteOf(route, { declared = null, has } = {}) {
|
|
|
544
551
|
const cut = r.lastIndexOf('/')
|
|
545
552
|
if (cut <= 0) return null
|
|
546
553
|
const up = r.slice(0, cut)
|
|
547
|
-
|
|
554
|
+
if (has(up)) return up
|
|
555
|
+
const versionCut = up.lastIndexOf('/')
|
|
556
|
+
if (versionCut <= 0 || !VERSION_SEGMENT.test(up.slice(versionCut + 1))) return null
|
|
557
|
+
const section = up.slice(0, versionCut)
|
|
558
|
+
return has(section) ? section : null
|
|
548
559
|
}
|
|
549
560
|
|
|
561
|
+
/** A version folder's name — `v1`, `v2.1` — the build's convention for a versioned section. */
|
|
562
|
+
const VERSION_SEGMENT = /^v\d+(\.\d+)?$/
|
|
563
|
+
|
|
550
564
|
/**
|
|
551
565
|
* The base route a record's URL composes onto, for a page that ADDRESSES ONE RECORD —
|
|
552
566
|
* or null when the page is not one.
|
package/src/website.js
CHANGED
|
@@ -1275,6 +1275,11 @@ export default class Website {
|
|
|
1275
1275
|
// These are templates for generating pages, not actual navigable pages
|
|
1276
1276
|
if (page.route.includes(':')) return false
|
|
1277
1277
|
|
|
1278
|
+
// ⭐ And the pages made from one — a record's own page (/blog/my-post). The SPA keeps
|
|
1279
|
+
// those out of `this.pages` (`_dynamicPageCache`), but a static build expands them into
|
|
1280
|
+
// ordinary pages, and they joined every menu there: a blog's menu listed each article.
|
|
1281
|
+
if (page.dynamicContext) return false
|
|
1282
|
+
|
|
1278
1283
|
// Exclude index pages (route ends in /index) from navigation — they are
|
|
1279
1284
|
// represented by their parent folder entry which links to them via navigableRoute
|
|
1280
1285
|
if (page.isIndex && page.route.endsWith('/index')) return false
|