@uniweb/core 0.7.6 → 0.7.8

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/core",
3
- "version": "0.7.6",
3
+ "version": "0.7.8",
4
4
  "description": "Core classes for the Uniweb platform - Uniweb, Website, Page, Block",
5
5
  "type": "module",
6
6
  "exports": {
@@ -30,7 +30,7 @@
30
30
  "jest": "^29.7.0"
31
31
  },
32
32
  "dependencies": {
33
- "@uniweb/semantic-parser": "1.1.14",
33
+ "@uniweb/semantic-parser": "1.1.15",
34
34
  "@uniweb/theming": "0.1.3"
35
35
  },
36
36
  "scripts": {
package/src/page.js CHANGED
@@ -480,6 +480,34 @@ export default class Page {
480
480
  return this.route // Fallback to own route
481
481
  }
482
482
 
483
+ /**
484
+ * Resolve which Page should actually be rendered when this one is
485
+ * requested. If the page has its own content, it renders itself. If
486
+ * it's a content-less folder with a designated index child, that
487
+ * child renders in its place. Otherwise, returns `this` so the caller
488
+ * can decide what to do with an empty page (typically an empty
489
+ * <main>, not a 404 — the route exists, it just has no body).
490
+ *
491
+ * Distinct from `getNavigableRoute()`, which recursively walks
492
+ * descendants to find a navigation target. `getRenderableSelf()` only
493
+ * looks one level down (to the immediate index child) — the contract
494
+ * is "give me the page to render *here*," not "give me the next URL
495
+ * with content."
496
+ *
497
+ * Used by SSR paths (Cloudflare Worker isolate today; framework SSG
498
+ * pre-handles this differently via expandDynamicPages) to avoid
499
+ * rendering nothing when an author requests `/docs` and the page is
500
+ * a folder whose actual landing content lives in `/docs/intro` flagged
501
+ * as `isIndex: true`.
502
+ *
503
+ * @returns {Page} The page to render — `this` or its index child.
504
+ */
505
+ getRenderableSelf() {
506
+ if (this.hasContent()) return this
507
+ const indexChild = this.children?.find((c) => c.isIndex)
508
+ return indexChild || this
509
+ }
510
+
483
511
  /**
484
512
  * Get route without leading/trailing slashes.
485
513
  * Delegates to Website.normalizeRoute() for consistent normalization.
package/src/website.js CHANGED
@@ -74,7 +74,6 @@ export default class Website {
74
74
  this.pageRoutes = []
75
75
  this.themeData = {}
76
76
  this.config = {}
77
- this.xref = null
78
77
  this.siteDefaultLocale = 'en'
79
78
  this.defaultLocale = 'en'
80
79
  this.activeLocale = 'en'
@@ -108,7 +107,6 @@ export default class Website {
108
107
  notFound,
109
108
  versionedScopes = {},
110
109
  assets = {},
111
- xref = null,
112
110
  } = content || {}
113
111
 
114
112
  this.name = config.name || ''
@@ -167,10 +165,6 @@ export default class Website {
167
165
  this._routeTranslations = this._buildRouteTranslations(config)
168
166
  this.versionedScopes = versionedScopes
169
167
  this.assets = assets
170
- // Cross-reference registry — populated by content-loader from {#id}
171
- // attributes on labeled block elements. Read by kit's <Ref>
172
- // component to resolve `[#id]` cross-reference insets.
173
- this.xref = xref || null
174
168
  }
175
169
 
176
170
  /**