@uniweb/core 0.33.0 → 0.35.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.35.0",
4
4
  "description": "Core classes for the Uniweb platform - Uniweb, Website, Page, Block",
5
5
  "type": "module",
6
6
  "exports": {
@@ -48,7 +48,7 @@
48
48
  "vitest": "^4.1.7"
49
49
  },
50
50
  "dependencies": {
51
- "@uniweb/theming": "^0.1.16",
51
+ "@uniweb/theming": "^0.2.0",
52
52
  "@uniweb/semantic-parser": "^1.4.1"
53
53
  },
54
54
  "scripts": {
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,30 +69,25 @@ 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
79
81
  // once for every renderer, and a component NEVER receives one as a param [Diego,
80
82
  // 2026-09-28]. It reads them from the block, or through kit. ⛔ Until then a component
81
83
  // also received `theme` (the mode), `background` and `vars` as params, and nothing read
82
- // them there. `standardOptions` and `properties` are the older editor envelopes.
83
- const own = blockConfig.properties || blockConfig
84
- const setting = (name) => (blockConfig[name] !== undefined ? blockConfig[name] : own[name])
85
- const rawTheme = setting('theme')
86
- const rawBg = setting('background')
87
- const gridParam = setting('grid')
88
- const varsParam = setting('vars')
89
- const standardOptions = blockConfig.standardOptions
84
+ // them there. ⛔ An editor's older envelope — `params.standardOptions` and `params.properties`
85
+ // — is no longer read (2026-09-28): an editor's preview sends a section's params as stored,
86
+ // and no store publishes the envelope. Either name is an ordinary param now.
90
87
  const {
91
- theme: _theme, background: _background, grid: _grid, vars: _vars,
92
- standardOptions: _standardOptions, properties: _properties,
88
+ theme: rawTheme, background: rawBg, grid: gridParam, vars: varsParam, fetch: fetchParam,
93
89
  ...componentParams
94
- } = own
90
+ } = blockConfig
95
91
  this.properties = componentParams
96
92
 
97
93
  // The section's theme: `theme.yml`'s own keys scoped to the section — `colors`,
@@ -112,18 +108,10 @@ export default class Block {
112
108
  // them inline on the section, and a neighbour reads them through `getBlockInfo()`.
113
109
  this.contextOverrides = theme.effectiveTokens
114
110
 
115
- // ⚠️ The older editor envelope: `colors` (a section palette, and tokens per context) and
116
- // `foundationStyles`, read by the page stylesheet until an editor writes the section's
117
- // `theme` instead (uwx-format.md § A page section's fields). Nothing else reads it.
118
- this.standardOptions = standardOptions || {}
119
-
120
111
  // What the runtime draws behind the section — normalized once (its shape, and store-held
121
112
  // assets resolved to URLs) for every renderer, and for a component that draws it itself
122
- // (`background: 'self'` in `meta.js`, with kit's `SectionBackground`). An editor's preview
123
- // may still send it inside the older envelope, which wins while it does.
124
- this.background =
125
- this.standardOptions.background ||
126
- (rawBg ? Block.normalizeBackground(rawBg, this.parseOptions()) : null)
113
+ // (`background: 'self'` in `meta.js`, with kit's `SectionBackground`).
114
+ this.background = rawBg ? Block.normalizeBackground(rawBg, this.parseOptions()) : null
127
115
 
128
116
  // Values for the CSS variables the component declares in `meta.js` `vars:` — merged into
129
117
  // `componentVars` when the component is known (`initComponent`).
@@ -134,11 +122,11 @@ export default class Block {
134
122
  ? blockData.subsections.map((block, i) => new Block(block, `${id}_${i}`, this.page))
135
123
  : []
136
124
 
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.
125
+ // Insets — inline @-referenced components positioned in content flow: the leaves
126
+ // lifted from the content, in document order. Each receives its `[…]` text as
127
+ // `content.title` and its `{…}` as params.
140
128
  this.insets = []
141
- const insetData = [...storedInsets, ...lifted.leaves]
129
+ const insetData = lifted.leaves
142
130
  for (let i = 0; i < insetData.length; i++) {
143
131
  const ref = insetData[i]
144
132
  const title = ref.title || ''
@@ -180,9 +168,10 @@ export default class Block {
180
168
  )
181
169
  }
182
170
 
183
- // Fetch configuration (from section frontmatter)
184
- // Supports local files (path) or remote URLs (url)
185
- this.fetch = blockData.fetch || null
171
+ // The section's own data — what its `query:` / `fetch:` declares. A stored section carries it
172
+ // in `params.fetch` [Diego, 2026-09-28], which wins when present; the `fetch` beside the params
173
+ // is framework's own build output, and a store's older field.
174
+ this.fetch = fetchParam || blockData.fetch || null
186
175
 
187
176
  // The layout the author chose for this section's child sections — the reserved
188
177
  // `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