@uniweb/core 0.7.14 → 0.7.15
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/block.js +15 -0
- package/src/page.js +12 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.15",
|
|
4
4
|
"description": "Core classes for the Uniweb platform - Uniweb, Website, Page, Block",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"vitest": "^4.1.7"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@uniweb/
|
|
34
|
-
"@uniweb/
|
|
33
|
+
"@uniweb/semantic-parser": "1.1.17",
|
|
34
|
+
"@uniweb/theming": "0.1.4"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"test": "vitest run"
|
package/src/block.js
CHANGED
|
@@ -437,6 +437,15 @@ export default class Block {
|
|
|
437
437
|
* @returns {Object|null} Next block's info or null
|
|
438
438
|
*/
|
|
439
439
|
getNextBlockInfo() {
|
|
440
|
+
// Layout-area blocks (header/footer/panels) live on a shared, contentless
|
|
441
|
+
// area page — not the content page being rendered — so walking their own
|
|
442
|
+
// page's sequence never reaches the content. Their "next block" is the
|
|
443
|
+
// first content section of the active page (a header adapting to the
|
|
444
|
+
// section it floats over). Resolve against the active page instead.
|
|
445
|
+
const active = this.website?.activePage
|
|
446
|
+
if (active && active !== this.page) {
|
|
447
|
+
return active.getFirstBodyBlockInfo()
|
|
448
|
+
}
|
|
440
449
|
const index = this.getIndex()
|
|
441
450
|
if (index < 0 || !this.page) return null
|
|
442
451
|
return this.page.getBlockInfo(index + 1)
|
|
@@ -448,6 +457,12 @@ export default class Block {
|
|
|
448
457
|
* @returns {Object|null} Previous block's info or null
|
|
449
458
|
*/
|
|
450
459
|
getPrevBlockInfo() {
|
|
460
|
+
// See getNextBlockInfo: from a shared layout-area block, "previous" is the
|
|
461
|
+
// last content section of the active page (e.g. a footer adapting to it).
|
|
462
|
+
const active = this.website?.activePage
|
|
463
|
+
if (active && active !== this.page) {
|
|
464
|
+
return active.getLastBodyBlockInfo()
|
|
465
|
+
}
|
|
451
466
|
const index = this.getIndex()
|
|
452
467
|
if (index <= 0 || !this.page) return null
|
|
453
468
|
return this.page.getBlockInfo(index - 1)
|
package/src/page.js
CHANGED
|
@@ -265,6 +265,18 @@ export default class Page {
|
|
|
265
265
|
return this.bodyBlocks?.[0]?.getBlockInfo() || null
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
+
/**
|
|
269
|
+
* Get the last body block's info.
|
|
270
|
+
* Symmetric to getFirstBodyBlockInfo — e.g. a footer adapting to the
|
|
271
|
+
* content section directly above it.
|
|
272
|
+
*
|
|
273
|
+
* @returns {Object|null} Last body block's info or null
|
|
274
|
+
*/
|
|
275
|
+
getLastBodyBlockInfo() {
|
|
276
|
+
const blocks = this.bodyBlocks
|
|
277
|
+
return blocks?.[blocks.length - 1]?.getBlockInfo() || null
|
|
278
|
+
}
|
|
279
|
+
|
|
268
280
|
/**
|
|
269
281
|
* Get all blocks (header, body, footer) as flat array
|
|
270
282
|
* Respects page layout preferences (hide list)
|