@uniweb/build 1.17.2 → 1.18.1

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.1",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -56,15 +56,15 @@
56
56
  "js-yaml": "^4.3.2",
57
57
  "sharp": "^0.35.5",
58
58
  "yaml": "^2.5.0",
59
+ "@uniweb/schemas": "~1.6.11",
60
+ "@uniweb/theming": "~1.3.1",
59
61
  "@uniweb/content-reader": "~1.5.9",
60
- "@uniweb/semantic-parser": "~1.13.2",
61
- "@uniweb/schemas": "~1.6.10",
62
- "@uniweb/theming": "~1.2.1",
63
62
  "@uniweb/content-writer": "~1.3.1",
64
- "@uniweb/projections": "~1.2.12"
63
+ "@uniweb/semantic-parser": "~1.13.2",
64
+ "@uniweb/projections": "~1.2.13"
65
65
  },
66
66
  "optionalDependencies": {
67
- "@uniweb/runtime": "~1.4.6"
67
+ "@uniweb/runtime": "~1.5.1"
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.7",
77
+ "@uniweb/runtime": "~1.5.1"
78
78
  },
79
79
  "peerDependenciesMeta": {
80
80
  "vite": {
@@ -15,6 +15,9 @@
15
15
  * `meta` contains only properties needed at runtime (`runtime-schema.js`):
16
16
  * - `background` - 'self' opt-out when component handles its own background
17
17
  * - `sticky` - whether the section stays in view unless its author says otherwise
18
+ * - `underHeader` - whether the header lies over the section when it opens a page
19
+ * - `height` - a header type's height, for that page's first paint
20
+ * - `header` - whether the component draws the parser's header itself
18
21
  * - `data` - the `content.data` keys the component declares, with their schema refs
19
22
  * - `vars` - the CSS variables the component declares, with their defaults
20
23
  * - `defaults` - Param default values
@@ -207,7 +210,7 @@ function generateEntrySource(components, options = {}) {
207
210
  lines.push('const capabilities = null')
208
211
  }
209
212
 
210
- // Per-component runtime metadata (defaults, context, initialState, background, data, vars)
213
+ // Per-component runtime metadata (`runtime-schema.js`)
211
214
  lines.push('')
212
215
  const metaJson = JSON.stringify(Object.keys(meta).length > 0 ? meta : {}, null, 2)
213
216
  lines.push(`const meta = ${metaJson}`)
@@ -6,6 +6,9 @@
6
6
  *
7
7
  * - background: 'self' when component handles its own background
8
8
  * - sticky: { default, top? } — whether the section stays in view unless its author says
9
+ * - underHeader: true when the header lies over a section of this type that opens a page
10
+ * - height: a header type's height, a CSS length, for the first paint of a page whose opening
11
+ * section lies under the header
9
12
  * - data: { <key>: <schema ref> | { schema, single?, whole? } | null } — every `content.data`
10
13
  * key the component declares, in order, with its schema ref and the flags set on it (null for
11
14
  * an inline shape)
@@ -39,7 +42,7 @@
39
42
 
40
43
  import { describeContent, lowerData } from '@uniweb/schemas/content'
41
44
  import { schemaDeclarationOf } from '@uniweb/schemas/foundation'
42
- import { stickyDeclaration } from '@uniweb/schemas/section'
45
+ import { stickyDeclaration, underHeaderDeclaration, heightDeclaration } from '@uniweb/schemas/section'
43
46
 
44
47
  /**
45
48
  * A `data:` entry as the runtime reads it: its schema ref, with the flags set on it — or null for an
@@ -147,6 +150,16 @@ export function extractRuntimeSchema(fullMeta) {
147
150
  }
148
151
  }
149
152
 
153
+ // Whether the header lies over the section when it opens a page, unless its author says
154
+ // otherwise (`Block#initComponent`), and a header type's height for that page's first paint,
155
+ // before the browser measures it. The runtime reads both in each renderer (`under-header.js`).
156
+ try {
157
+ if (fullMeta.underHeader !== undefined) runtime.underHeader = underHeaderDeclaration(fullMeta.underHeader)
158
+ if (fullMeta.height !== undefined) runtime.height = heightDeclaration(fullMeta.height)
159
+ } catch (err) {
160
+ throw new Error(`[uniweb] ${err.message}`)
161
+ }
162
+
150
163
  // Data. `data:` is the single declaration surface for a section's structured
151
164
  // data: it maps each `content.data` key to its schema. A value is a named ref
152
165
  // (`'@/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