@uniweb/core 1.6.5 → 1.6.7

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.5",
3
+ "version": "1.6.7",
4
4
  "description": "Core classes for the Uniweb platform - Uniweb, Website, Page, Block",
5
5
  "type": "module",
6
6
  "exports": {
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@uniweb/semantic-parser": "~1.13.2",
57
- "@uniweb/theming": "~1.2.1"
57
+ "@uniweb/theming": "~1.3.1"
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
@@ -108,7 +109,7 @@ export default class Block {
108
109
  // publishes the envelope. Either name is an ordinary param now.
109
110
  const {
110
111
  theme: rawTheme, background: rawBg, grid: gridParam, vars: varsParam, fetch: fetchParam,
111
- sticky: stickyParam,
112
+ sticky: stickyParam, underHeader: underHeaderParam,
112
113
  ...componentParams
113
114
  } = blockConfig
114
115
  this.properties = componentParams
@@ -123,6 +124,14 @@ export default class Block {
123
124
  // How far below the top it stays — its type's `top`, a CSS length; null is the very top.
124
125
  this.stickyTop = null
125
126
 
127
+ // Whether the header lies over the section when it opens a page — what the author wrote
128
+ // (`true` or `false`), else its type's `underHeader` from `meta.js`, which `initComponent`
129
+ // reads. The runtime lays the header's box over it (`under-header.js`, 2026-11-06).
130
+ this.underHeaderSetting = typeof underHeaderParam === 'boolean' ? underHeaderParam : null
131
+ this.underHeader = this.underHeaderSetting ?? false
132
+ // A header type's height before the browser measures it — its `meta.js` `height`, a CSS length.
133
+ this.height = null
134
+
126
135
  // The section's theme: `theme.yml`'s own keys scoped to the section — `colors`,
127
136
  // `contexts`, `vars` — plus `mode`, the color context it pins. `theme: dark` is the
128
137
  // shorthand for `{ mode: dark }`, and a token written beside `mode` applies to the section
@@ -544,6 +553,10 @@ export default class Block {
544
553
  this.sticky = this.stickySetting ?? sticky.default
545
554
  this.stickyTop = sticky.top
546
555
 
556
+ // The type's `underHeader` and `height` — the author's `underHeader` wins.
557
+ this.underHeader = this.underHeaderSetting ?? meta.underHeader === true
558
+ this.height = typeof meta.height === 'string' && meta.height.trim() ? meta.height.trim() : null
559
+
547
560
  return this.Component
548
561
  }
549
562
 
@@ -639,7 +652,7 @@ export default class Block {
639
652
  * Get information about this block for cross-component communication.
640
653
  * Other components (like NavBar) can use this to adapt their behavior.
641
654
  *
642
- * @returns {Object} Block info: { type, theme, state, context }
655
+ * @returns {Object} Block info: { type, theme, contextOverrides, state, context, underHeader }
643
656
  */
644
657
  getBlockInfo() {
645
658
  return {
@@ -647,7 +660,10 @@ export default class Block {
647
660
  theme: this.themeName,
648
661
  contextOverrides: this.contextOverrides,
649
662
  state: this.state,
650
- context: this.context
663
+ context: this.context,
664
+ // Whether the header lies over this section when it opens a page: a header reads it on its
665
+ // next block, the page's first section, to paint itself see-through.
666
+ underHeader: this.underHeader
651
667
  }
652
668
  }
653
669
 
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
  }