@uniweb/core 1.6.6 → 1.6.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": "1.6.6",
3
+ "version": "1.6.8",
4
4
  "description": "Core classes for the Uniweb platform - Uniweb, Website, Page, Block",
5
5
  "type": "module",
6
6
  "exports": {
@@ -53,8 +53,8 @@
53
53
  "vitest": "^4.1.7"
54
54
  },
55
55
  "dependencies": {
56
- "@uniweb/semantic-parser": "~1.13.2",
57
- "@uniweb/theming": "~1.3.0"
56
+ "@uniweb/theming": "~1.3.2",
57
+ "@uniweb/semantic-parser": "~1.13.2"
58
58
  },
59
59
  "scripts": {
60
60
  "test": "vitest run"
package/src/block.js CHANGED
@@ -95,7 +95,8 @@ export default class Block {
95
95
  const blockConfig = blockData.params || blockData.config || {}
96
96
 
97
97
  // ⭐ THE SECTION'S OWN SETTINGS — the names framework reserves in its params
98
- // (`@uniweb/schemas/section`): `theme`, `background`, `grid`, `vars`, `fetch`, `sticky`.
98
+ // (`@uniweb/schemas/section`): `theme`, `background`, `grid`, `vars`, `fetch`, `sticky`,
99
+ // `underHeader`.
99
100
  // Framework applies each — the runtime paints the background and the color context around
100
101
  // the component and makes sticky the box that can stick, the page stylesheet applies the
101
102
  // section's theme and its component's variables, kit's `ChildGrid` lays out the child
@@ -660,12 +661,31 @@ export default class Block {
660
661
  contextOverrides: this.contextOverrides,
661
662
  state: this.state,
662
663
  context: this.context,
663
- // Whether the header lies over this section when it opens a page: a header reads it on its
664
- // next block, the page's first section, to paint itself see-through.
665
- underHeader: this.underHeader
664
+ // Whether the header lies over this section on its page (`liesUnderHeader`): a header reads
665
+ // it on its next block, the page's first section, to paint itself see-through.
666
+ underHeader: this.liesUnderHeader()
666
667
  }
667
668
  }
668
669
 
670
+ /**
671
+ * Whether the header lies over this section on its page: the section asks (`underHeader`, its
672
+ * author's setting or its type's default), it opens the page, and the page has a header — its
673
+ * layout's area named `header`, holding sections. One rule for the runtime, which lays the
674
+ * header over the section, and for a header, which reads it on its next block
675
+ * (`getBlockInfo().underHeader`) to paint itself see-through.
676
+ *
677
+ * ⛔ Until 2026-11-06 a header read the section's setting alone, so a header in an area named
678
+ * otherwise, which the runtime never lays over anything, painted itself see-through in the flow.
679
+ *
680
+ * @returns {boolean}
681
+ */
682
+ liesUnderHeader() {
683
+ const page = this.page
684
+ if (!this.underHeader || !page || page.getBodyBlocks?.()?.[0] !== this) return false
685
+ const header = page.getLayoutAreas?.()?.header
686
+ return Array.isArray(header) && header.length > 0
687
+ }
688
+
669
689
  /**
670
690
  * Get information about the next block in the page.
671
691
  * Commonly used by headers/navbars to adapt to the first content section.
package/src/website.js CHANGED
@@ -717,11 +717,21 @@ export default class Website {
717
717
  }
718
718
 
719
719
  /**
720
- * Set active page by route
721
- * @param {string} route
720
+ * Make a page the active one: the page on screen, which whatever adapts to the page reads — a
721
+ * header's next block, the language switcher, page state, a contents rail. A renderer hands in
722
+ * the Page it renders; a route is looked up.
723
+ *
724
+ * ⭐ By the Page, where the caller holds it. The site's not-found page has no route of its own
725
+ * (a parametric page can match `/404`), and a parametric page whose records are not held yet is
726
+ * made anew by each lookup, so a route could name another Page than the one rendered. ⛔ Until
727
+ * 2026-11-06 both renderers set it by route: the not-found page rendered with another page
728
+ * active, and a header read that page's opening section while the runtime laid the header over
729
+ * this one's.
730
+ *
731
+ * @param {Page|string} pageOrRoute
722
732
  */
723
- setActivePage(route) {
724
- const page = this.getPage(route)
733
+ setActivePage(pageOrRoute) {
734
+ const page = pageOrRoute instanceof Page ? pageOrRoute : this.getPage(pageOrRoute)
725
735
  if (page) {
726
736
  this.activePage = page
727
737
  }