@uniweb/build 1.11.3 → 1.11.4

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/build",
3
- "version": "1.11.3",
3
+ "version": "1.11.4",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -56,11 +56,11 @@
56
56
  "js-yaml": "^4.3.2",
57
57
  "sharp": "^0.35.5",
58
58
  "yaml": "^2.5.0",
59
+ "@uniweb/schemas": "~1.6.7",
59
60
  "@uniweb/content-reader": "~1.5.7",
60
- "@uniweb/schemas": "~1.6.6",
61
61
  "@uniweb/theming": "~1.2.1",
62
- "@uniweb/semantic-parser": "~1.13.0",
63
62
  "@uniweb/content-writer": "~1.3.1",
63
+ "@uniweb/semantic-parser": "~1.13.0",
64
64
  "@uniweb/projections": "~1.2.7"
65
65
  },
66
66
  "optionalDependencies": {
@@ -206,10 +206,23 @@ function referencedModels(model) {
206
206
  return out
207
207
  }
208
208
 
209
- /** The fields of a model's brief — what a reference to one of its records is delivered as. */
209
+ /**
210
+ * The fields of a model's brief — what a reference to one of its records is delivered as: the
211
+ * section the declaration marks `brief: true`, at any depth (inside a group, say), else the one
212
+ * section of a model that has a single one.
213
+ */
210
214
  function briefFields(model) {
215
+ const marked = (sections) => {
216
+ for (const section of Object.values(sections || {})) {
217
+ if (section?.brief) return section
218
+ const nested = Object.fromEntries(Object.entries(section?.fields || {}).filter(([, f]) => f?.type === 'section'))
219
+ const found = marked(nested)
220
+ if (found) return found
221
+ }
222
+ return null
223
+ }
211
224
  const sections = Object.values(model?.sections || {})
212
- const brief = sections.find((s) => s?.brief) ?? (sections.length === 1 && !sections[0]?.multiple ? sections[0] : null)
225
+ const brief = marked(model?.sections) ?? (sections.length === 1 && !sections[0]?.multiple ? sections[0] : null)
213
226
  return brief?.fields ?? null
214
227
  }
215
228
 
@@ -22,6 +22,7 @@
22
22
  */
23
23
 
24
24
  import { parseOptionsRef, FIELD_RULES } from '@uniweb/schemas/format'
25
+ import { markedBriefPath } from '@uniweb/schemas/conform'
25
26
  import { qualifyRef } from '@uniweb/schemas/refs'
26
27
 
27
28
  // Text kinds carry per-locale values when localized.
@@ -159,7 +160,7 @@ export function toDataSchemaDeclaration(normalized, { name, resolveName, resolve
159
160
  // The model-level sort axis is inline: `sort_date: true` on the brief's named
160
161
  // date field (replaces the old schema-level `sort_date_field` back-reference).
161
162
  if (normalized.sortDate && brief) {
162
- const f = sections[brief]?.fields?.[normalized.sortDate]
163
+ const f = sectionAt(sections, brief)?.fields?.[normalized.sortDate]
163
164
  if (f) f.sort_date = true
164
165
  }
165
166
 
@@ -291,24 +292,25 @@ function lowerFieldsForm(fields, resolve, optResolve, constraints) {
291
292
  }
292
293
  }
293
294
 
294
- // The explicit `sections:` map → a map of lowered section bodies. The brief is the
295
- // section marked `brief: true`, else the first `single` (the framework's inference).
295
+ // The explicit `sections:` map → a map of lowered section bodies. The brief is the section
296
+ // marked `brief: true` at any depth (`markedBriefPath`, `@uniweb/schemas/conform`), else the
297
+ // first top-level `single` not marked `brief: false` (the framework's inference).
296
298
  function lowerSectionsForm(sectionsMap, resolve, optResolve) {
297
299
  const sections = {}
298
- let explicit = null
299
300
  let firstSingle = null
300
301
  for (const [secName, def] of Object.entries(sectionsMap)) {
301
302
  sections[secName] = lowerSection(def, resolve, optResolve, secName)
302
- if (def.brief === true) explicit = secName
303
- if (!firstSingle && (def.kind || 'single') === 'single') firstSingle = secName
303
+ if (!firstSingle && (def.kind || 'single') === 'single' && def.brief !== false) firstSingle = secName
304
304
  }
305
- // The brief is the section marked `brief: true`, else the first `single` (the
306
- // framework's inference). Stamp it inline so the wire and the producer's own
307
- // consumers (entity-shaping, back-fill render) find it the same way — the
308
- // sections-tree has no schema-level `brief:` back-reference.
309
- const brief = explicit || firstSingle
310
- if (brief && sections[brief] && !sections[brief].brief) sections[brief].brief = true
311
- return { sections, brief }
305
+ // A marked brief is lowered where it sits, marked; only with none is the inferred one stamped,
306
+ // inline, so the wire and the producer's own consumers (entity-shaping, back-fill render) find
307
+ // it the same way — the sections-tree has no schema-level `brief:` back-reference. ⛔ Until
308
+ // 2026-10-29 only a top-level mark was seen here, so a brief marked inside a group went out
309
+ // beside the first top-level single, stamped too, and a register refused the two.
310
+ const marked = markedBriefPath({ sections: sectionsMap })
311
+ if (marked) return { sections, brief: marked }
312
+ if (firstSingle) sections[firstSingle].brief = true
313
+ return { sections, brief: firstSingle }
312
314
  }
313
315
 
314
316
  // Lower one section to its declaration body (the caller keys it by name; a nested