@uniweb/build 1.17.2 → 1.18.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/build",
3
- "version": "1.17.2",
3
+ "version": "1.18.0",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -57,14 +57,14 @@
57
57
  "sharp": "^0.35.5",
58
58
  "yaml": "^2.5.0",
59
59
  "@uniweb/content-reader": "~1.5.9",
60
+ "@uniweb/schemas": "~1.6.11",
61
+ "@uniweb/theming": "~1.3.0",
60
62
  "@uniweb/semantic-parser": "~1.13.2",
61
- "@uniweb/schemas": "~1.6.10",
62
- "@uniweb/theming": "~1.2.1",
63
- "@uniweb/content-writer": "~1.3.1",
64
- "@uniweb/projections": "~1.2.12"
63
+ "@uniweb/projections": "~1.2.12",
64
+ "@uniweb/content-writer": "~1.3.1"
65
65
  },
66
66
  "optionalDependencies": {
67
- "@uniweb/runtime": "~1.4.6"
67
+ "@uniweb/runtime": "~1.5.0"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
@@ -73,8 +73,8 @@
73
73
  "@tailwindcss/vite": "^4.0.0",
74
74
  "@vitejs/plugin-react": "^4.0.0 || ^5.0.0",
75
75
  "vite-plugin-svgr": "^4.0.0",
76
- "@uniweb/core": "~1.6.5",
77
- "@uniweb/runtime": "~1.4.6"
76
+ "@uniweb/core": "~1.6.6",
77
+ "@uniweb/runtime": "~1.5.0"
78
78
  },
79
79
  "peerDependenciesMeta": {
80
80
  "vite": {
@@ -39,7 +39,7 @@
39
39
 
40
40
  import { describeContent, lowerData } from '@uniweb/schemas/content'
41
41
  import { schemaDeclarationOf } from '@uniweb/schemas/foundation'
42
- import { stickyDeclaration } from '@uniweb/schemas/section'
42
+ import { stickyDeclaration, underHeaderDeclaration, heightDeclaration } from '@uniweb/schemas/section'
43
43
 
44
44
  /**
45
45
  * A `data:` entry as the runtime reads it: its schema ref, with the flags set on it — or null for an
@@ -147,6 +147,16 @@ export function extractRuntimeSchema(fullMeta) {
147
147
  }
148
148
  }
149
149
 
150
+ // Whether the header lies over the section when it opens a page, unless its author says
151
+ // otherwise (`Block#initComponent`), and a header type's height for that page's first paint,
152
+ // before the browser measures it. The runtime reads both in each renderer (`under-header.js`).
153
+ try {
154
+ if (fullMeta.underHeader !== undefined) runtime.underHeader = underHeaderDeclaration(fullMeta.underHeader)
155
+ if (fullMeta.height !== undefined) runtime.height = heightDeclaration(fullMeta.height)
156
+ } catch (err) {
157
+ throw new Error(`[uniweb] ${err.message}`)
158
+ }
159
+
150
160
  // Data. `data:` is the single declaration surface for a section's structured
151
161
  // data: it maps each `content.data` key to its schema. A value is a named ref
152
162
  // (`'@/member'`), an inline field map, or an inline rich-form (`{ fields: [...] }`,
package/src/schema.js CHANGED
@@ -21,7 +21,7 @@ import { areaNames, describeChildren, describePlacement, describeVisuals, lowerC
21
21
  import { describeContent, lowerData } from '@uniweb/schemas/content'
22
22
  import { normalizeData, schemaDeclarationOf } from '@uniweb/schemas/foundation'
23
23
  import { rootListSection } from '@uniweb/schemas/conform'
24
- import { SECTION_PARAMS, SECTION_KEYS, stickyDeclaration } from '@uniweb/schemas/section'
24
+ import { SECTION_PARAMS, SECTION_KEYS, stickyDeclaration, underHeaderDeclaration, heightDeclaration } from '@uniweb/schemas/section'
25
25
  import { collectSchemaRefs, buildDataSchemaMap, ownSchemaRefs } from './resolve-data-schema.js'
26
26
  import {
27
27
  composeSupports,
@@ -653,6 +653,8 @@ function buildComponentEntry(name, relativePath, meta) {
653
653
  if (meta.data !== undefined) entry.data = lowerData(meta.data)
654
654
  refuseDataDeclarations(`${name} (meta.js)`, entry.data)
655
655
  refuseStickyDeclaration(`${name} (meta.js)`, meta.sticky)
656
+ refuseDeclaration(`${name} (meta.js)`, underHeaderDeclaration, meta.underHeader)
657
+ refuseDeclaration(`${name} (meta.js)`, heightDeclaration, meta.height)
656
658
  refuseAreaDeclaration(`${name} (meta.js)`, meta.area)
657
659
 
658
660
  const problems = [...content.problems, ...describeChildren(meta).problems]
@@ -677,6 +679,23 @@ function refuseStickyDeclaration(owner, sticky) {
677
679
  }
678
680
  }
679
681
 
682
+ /**
683
+ * Refuse a declaration its one rule cannot read — `underHeader`, `height` (`@uniweb/schemas/section`) —
684
+ * naming the component. Nothing declared, nothing checked.
685
+ *
686
+ * @param {string} owner - who declares it, for the message
687
+ * @param {(declared: *) => *} rule
688
+ * @param {*} declared - the value, as written
689
+ */
690
+ function refuseDeclaration(owner, rule, declared) {
691
+ if (declared === undefined) return
692
+ try {
693
+ rule(declared)
694
+ } catch (err) {
695
+ throw new Error(`[uniweb] ${owner}: ${err.message}`)
696
+ }
697
+ }
698
+
680
699
  /**
681
700
  * Refuse a section type's `area:` that `areaNames` cannot read — anything but `true`, `false`, an
682
701
  * area's name or a list of names. A refusal, not a warning: an editor reads such a value as no