@uniweb/core 0.33.0 → 0.34.0

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.33.0",
3
+ "version": "0.34.0",
4
4
  "description": "Core classes for the Uniweb platform - Uniweb, Website, Page, Block",
5
5
  "type": "module",
6
6
  "exports": {
package/src/block.js CHANGED
@@ -34,10 +34,11 @@ export default class Block {
34
34
  // at build time is deliberate: what the author wrote is the canonical STORED
35
35
  // shape, so the content that syncs and round-trips keeps carrying it.
36
36
  // `blockData.content` is left untouched — the lift produces a new tree and only
37
- // this Block's view of it changes. Leaves are numbered after a stored `insets[]`
38
- // (content from before the lift moved here), so the two cannot share a refId.
39
- const storedInsets = Array.isArray(blockData.insets) ? blockData.insets : []
40
- const lifted = liftInsets(blockData.content, storedInsets.length)
37
+ // this Block's view of it changes. ⛔ A stored `insets[]` — what the build extracted
38
+ // before 2026-09-27 — is no longer read: no store serves one since the site-content
39
+ // Model dropped the field (2026-09-28), and a site pushed again carries its insets in
40
+ // its content.
41
+ const lifted = liftInsets(blockData.content)
41
42
  this.rawContent = lifted.content || {}
42
43
  this.parsedContent = this.parseContent(lifted.content)
43
44
 
@@ -68,11 +69,12 @@ export default class Block {
68
69
  this.items = this.parsedContent.items || []
69
70
 
70
71
  // Block configuration
72
+ // ⛔ No `block.preset`: a section's `preset:` was stored and never read, and neither the build
73
+ // nor a store keeps one any more (2026-09-28).
71
74
  const blockConfig = blockData.params || blockData.config || {}
72
- this.preset = blockData.preset
73
75
 
74
76
  // ⭐ THE SECTION'S OWN SETTINGS — the names framework reserves in its params
75
- // (`@uniweb/schemas/section`): `theme`, `background`, `grid`, `vars`. Framework applies
77
+ // (`@uniweb/schemas/section`): `theme`, `background`, `grid`, `vars`, `fetch`. Framework applies
76
78
  // each — the runtime paints the background and the color context around the component,
77
79
  // the page stylesheet applies the section's theme and its component's variables, kit's
78
80
  // `ChildGrid` lays out the child sections — so each is lifted onto the block, normalized
@@ -86,9 +88,10 @@ export default class Block {
86
88
  const rawBg = setting('background')
87
89
  const gridParam = setting('grid')
88
90
  const varsParam = setting('vars')
91
+ const fetchParam = setting('fetch')
89
92
  const standardOptions = blockConfig.standardOptions
90
93
  const {
91
- theme: _theme, background: _background, grid: _grid, vars: _vars,
94
+ theme: _theme, background: _background, grid: _grid, vars: _vars, fetch: _fetch,
92
95
  standardOptions: _standardOptions, properties: _properties,
93
96
  ...componentParams
94
97
  } = own
@@ -134,11 +137,11 @@ export default class Block {
134
137
  ? blockData.subsections.map((block, i) => new Block(block, `${id}_${i}`, this.page))
135
138
  : []
136
139
 
137
- // Insets — inline @-referenced components positioned in content flow: a stored
138
- // `insets[]` first, then the leaves lifted from the content, in document order.
139
- // Each receives its `[…]` text as `content.title` and its `{…}` as params.
140
+ // Insets — inline @-referenced components positioned in content flow: the leaves
141
+ // lifted from the content, in document order. Each receives its `[…]` text as
142
+ // `content.title` and its `{…}` as params.
140
143
  this.insets = []
141
- const insetData = [...storedInsets, ...lifted.leaves]
144
+ const insetData = lifted.leaves
142
145
  for (let i = 0; i < insetData.length; i++) {
143
146
  const ref = insetData[i]
144
147
  const title = ref.title || ''
@@ -180,9 +183,10 @@ export default class Block {
180
183
  )
181
184
  }
182
185
 
183
- // Fetch configuration (from section frontmatter)
184
- // Supports local files (path) or remote URLs (url)
185
- this.fetch = blockData.fetch || null
186
+ // The section's own data — what its `query:` / `fetch:` declares. A stored section carries it
187
+ // in `params.fetch` [Diego, 2026-09-28], which wins when present; the `fetch` beside the params
188
+ // is framework's own build output, and a store's older field.
189
+ this.fetch = fetchParam || blockData.fetch || null
186
190
 
187
191
  // The layout the author chose for this section's child sections — the reserved
188
192
  // `grid:` section key [Diego, 2026-09-27]: `3` (equal columns) or `'40/60'`
@@ -818,7 +818,10 @@ export function sectionFetches(sections) {
818
818
  const walk = (list) => {
819
819
  for (const s of list || []) {
820
820
  if (!s || typeof s !== 'object') continue
821
- if (s.fetch) out.push(s.fetch)
821
+ // A stored section carries its fetch in `params.fetch` (2026-09-28); framework's own build
822
+ // output beside the params — the same order as the Block's.
823
+ const own = s.params?.fetch || s.fetch
824
+ if (own) out.push(own)
822
825
  if (Array.isArray(s.subsections)) walk(s.subsections)
823
826
  }
824
827
  }
package/src/insets.js CHANGED
@@ -26,9 +26,8 @@
26
26
  * never went through a build — a record body, a free-form translation — resolves its
27
27
  * insets the same way. ⛔ *Until 2026-09-27 only containers were lifted here; leaf
28
28
  * insets were extracted by the site build into the section's `insets[]`, so any
29
- * document the build did not extract rendered none of them.* A stored `insets[]` is
30
- * still read (the constructor below), and `leafStart` numbers the lifted leaves after
31
- * it so their refIds cannot collide.
29
+ * document the build did not extract rendered none of them.* `leafStart` offsets the
30
+ * leaves' refIds for a caller that numbers other insets first.
32
31
  *
33
32
  * PURE with respect to the input: nodes on the path to an inset are cloned; everything
34
33
  * else is passed through by reference, so a document with no insets costs one walk and