@uniweb/core 1.6.4 → 1.6.6
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 +2 -2
- package/src/block.js +18 -3
- package/src/route-match.js +27 -0
- package/src/website.js +6 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/core",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.6",
|
|
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.
|
|
57
|
+
"@uniweb/theming": "~1.3.0"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"test": "vitest run"
|
package/src/block.js
CHANGED
|
@@ -108,7 +108,7 @@ export default class Block {
|
|
|
108
108
|
// publishes the envelope. Either name is an ordinary param now.
|
|
109
109
|
const {
|
|
110
110
|
theme: rawTheme, background: rawBg, grid: gridParam, vars: varsParam, fetch: fetchParam,
|
|
111
|
-
sticky: stickyParam,
|
|
111
|
+
sticky: stickyParam, underHeader: underHeaderParam,
|
|
112
112
|
...componentParams
|
|
113
113
|
} = blockConfig
|
|
114
114
|
this.properties = componentParams
|
|
@@ -123,6 +123,14 @@ export default class Block {
|
|
|
123
123
|
// How far below the top it stays — its type's `top`, a CSS length; null is the very top.
|
|
124
124
|
this.stickyTop = null
|
|
125
125
|
|
|
126
|
+
// Whether the header lies over the section when it opens a page — what the author wrote
|
|
127
|
+
// (`true` or `false`), else its type's `underHeader` from `meta.js`, which `initComponent`
|
|
128
|
+
// reads. The runtime lays the header's box over it (`under-header.js`, 2026-11-06).
|
|
129
|
+
this.underHeaderSetting = typeof underHeaderParam === 'boolean' ? underHeaderParam : null
|
|
130
|
+
this.underHeader = this.underHeaderSetting ?? false
|
|
131
|
+
// A header type's height before the browser measures it — its `meta.js` `height`, a CSS length.
|
|
132
|
+
this.height = null
|
|
133
|
+
|
|
126
134
|
// The section's theme: `theme.yml`'s own keys scoped to the section — `colors`,
|
|
127
135
|
// `contexts`, `vars` — plus `mode`, the color context it pins. `theme: dark` is the
|
|
128
136
|
// shorthand for `{ mode: dark }`, and a token written beside `mode` applies to the section
|
|
@@ -544,6 +552,10 @@ export default class Block {
|
|
|
544
552
|
this.sticky = this.stickySetting ?? sticky.default
|
|
545
553
|
this.stickyTop = sticky.top
|
|
546
554
|
|
|
555
|
+
// The type's `underHeader` and `height` — the author's `underHeader` wins.
|
|
556
|
+
this.underHeader = this.underHeaderSetting ?? meta.underHeader === true
|
|
557
|
+
this.height = typeof meta.height === 'string' && meta.height.trim() ? meta.height.trim() : null
|
|
558
|
+
|
|
547
559
|
return this.Component
|
|
548
560
|
}
|
|
549
561
|
|
|
@@ -639,7 +651,7 @@ export default class Block {
|
|
|
639
651
|
* Get information about this block for cross-component communication.
|
|
640
652
|
* Other components (like NavBar) can use this to adapt their behavior.
|
|
641
653
|
*
|
|
642
|
-
* @returns {Object} Block info: { type, theme, state, context }
|
|
654
|
+
* @returns {Object} Block info: { type, theme, contextOverrides, state, context, underHeader }
|
|
643
655
|
*/
|
|
644
656
|
getBlockInfo() {
|
|
645
657
|
return {
|
|
@@ -647,7 +659,10 @@ export default class Block {
|
|
|
647
659
|
theme: this.themeName,
|
|
648
660
|
contextOverrides: this.contextOverrides,
|
|
649
661
|
state: this.state,
|
|
650
|
-
context: this.context
|
|
662
|
+
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
|
|
651
666
|
}
|
|
652
667
|
}
|
|
653
668
|
|
package/src/route-match.js
CHANGED
|
@@ -334,6 +334,33 @@ export function recordImage(record) {
|
|
|
334
334
|
return typeof image === 'string' && image.trim() !== '' ? image : undefined
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
+
/**
|
|
338
|
+
* A record's DESCRIPTION — the line the page about it is described by (its meta description),
|
|
339
|
+
* and the line under it in a search result and in `llms.txt`.
|
|
340
|
+
*
|
|
341
|
+
* ONE RULE, read where `recordTitle` is: the parametric page (`Website._createDynamicPage`), the
|
|
342
|
+
* static build's page expansion, and the record search index (`@uniweb/projections`).
|
|
343
|
+
*
|
|
344
|
+
* description → excerpt
|
|
345
|
+
*
|
|
346
|
+
* Only a non-empty string describes a record. A rich-text field named `description` is a
|
|
347
|
+
* document, which this rule cannot write into a meta tag, so it is passed over for `excerpt`.
|
|
348
|
+
* ⛔ Until 2026-11-06 the page and the build took either field as it came, so a rich-text
|
|
349
|
+
* `description` described the page as `[object Object]`, and the search index never read
|
|
350
|
+
* either: its excerpt was the record's strings run together, icon names and colours included,
|
|
351
|
+
* and `llms.txt` described each record's page with it.
|
|
352
|
+
*
|
|
353
|
+
* @param {Object} record
|
|
354
|
+
* @returns {string|undefined}
|
|
355
|
+
*/
|
|
356
|
+
export function recordDescription(record) {
|
|
357
|
+
if (!record || typeof record !== 'object') return undefined
|
|
358
|
+
for (const value of [record.description, record.excerpt]) {
|
|
359
|
+
if (typeof value === 'string' && value.trim() !== '') return value
|
|
360
|
+
}
|
|
361
|
+
return undefined
|
|
362
|
+
}
|
|
363
|
+
|
|
337
364
|
/**
|
|
338
365
|
* The record field a route param is matched on — ONE MAP, read by the local match
|
|
339
366
|
* (`routeParamValue`, below) and by the records service's record question (`match`,
|
package/src/website.js
CHANGED
|
@@ -12,7 +12,7 @@ import ObservableState from './observable-state.js'
|
|
|
12
12
|
import { normalizeSeo } from './seo.js'
|
|
13
13
|
import { siteAddress, pageUrl } from './site-address.js'
|
|
14
14
|
import { resolveDefaultLocale, localeLabel } from './locale-config.js'
|
|
15
|
-
import { isDynamicRoute, matchDynamicRoute, recordTitle, recordImage, routeBinding, routeParamName, parentRouteOf } from './route-match.js'
|
|
15
|
+
import { isDynamicRoute, matchDynamicRoute, recordTitle, recordImage, recordDescription, routeBinding, routeParamName, parentRouteOf } from './route-match.js'
|
|
16
16
|
import { resolveFetchConfigs, pageRouteQuery, recordPages } from './fetch-config.js'
|
|
17
17
|
import { declaredKeys } from './data-keys.js'
|
|
18
18
|
import { pageRecordConfig, planFor, runPlanSync } from './page-data.js'
|
|
@@ -682,9 +682,11 @@ export default class Website {
|
|
|
682
682
|
// read `title` alone, so a person record kept the template's title — `:slug`.
|
|
683
683
|
const title = recordTitle(currentItem)
|
|
684
684
|
if (title) pageData.title = title
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
685
|
+
// ⭐ And described by its text: `description`, else `excerpt` (`recordDescription`).
|
|
686
|
+
// ⛔ Until 2026-11-06 either was taken as it came, and a rich-text `description`
|
|
687
|
+
// described the page as `[object Object]`.
|
|
688
|
+
const description = recordDescription(currentItem)
|
|
689
|
+
if (description) pageData.description = description
|
|
688
690
|
// ⭐ And by its picture: a link to the page shows the record's image (`recordImage`).
|
|
689
691
|
// ⛔ Until 2026-10-05 it showed the page's or the site's `seo.image`, the same for
|
|
690
692
|
// every record.
|