@uniweb/build 1.7.1 → 1.7.3
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 +8 -8
- package/src/generate-entry.js +4 -2
- package/src/runtime-schema.js +7 -30
- package/src/schema.js +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/build",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
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.1.0",
|
|
57
57
|
"sharp": "^0.35.3",
|
|
58
58
|
"yaml": "^2.5.0",
|
|
59
|
+
"@uniweb/schemas": "~1.6.2",
|
|
59
60
|
"@uniweb/content-reader": "~1.5.4",
|
|
60
|
-
"@uniweb/semantic-parser": "~1.12.2",
|
|
61
61
|
"@uniweb/theming": "~1.2.1",
|
|
62
|
-
"@uniweb/
|
|
63
|
-
"@uniweb/
|
|
64
|
-
"@uniweb/
|
|
62
|
+
"@uniweb/content-writer": "~1.3.0",
|
|
63
|
+
"@uniweb/semantic-parser": "~1.12.2",
|
|
64
|
+
"@uniweb/projections": "~1.1.6"
|
|
65
65
|
},
|
|
66
66
|
"optionalDependencies": {
|
|
67
|
-
"@uniweb/runtime": "~1.1.
|
|
67
|
+
"@uniweb/runtime": "~1.1.15"
|
|
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/
|
|
77
|
-
"@uniweb/
|
|
76
|
+
"@uniweb/runtime": "~1.1.15",
|
|
77
|
+
"@uniweb/core": "~1.4.0"
|
|
78
78
|
},
|
|
79
79
|
"peerDependenciesMeta": {
|
|
80
80
|
"vite": {
|
package/src/generate-entry.js
CHANGED
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
* - `context` - Static capabilities for cross-block coordination
|
|
18
18
|
* - `initialState` - Initial values for mutable block state
|
|
19
19
|
*
|
|
20
|
-
* Full component metadata lives in schema.json (for the visual editor)
|
|
21
|
-
*
|
|
20
|
+
* Full component metadata lives in schema.json (for the visual editor), and so does the
|
|
21
|
+
* foundation's identity, as `_self` (`buildSchema`): its name by `foundationNameOf`
|
|
22
|
+
* (`foundation-name.js`) — `main.js`'s `name`, else `package.json`'s — and its description
|
|
23
|
+
* `main.js`'s, else `package.json`'s. ⛔ *Until 2026-10-20 this said both came from package.json.*
|
|
22
24
|
*/
|
|
23
25
|
|
|
24
26
|
import { writeFile, readFile, mkdir } from 'node:fs/promises'
|
package/src/runtime-schema.js
CHANGED
|
@@ -37,35 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
import { lowerData } from '@uniweb/schemas/content'
|
|
39
39
|
import { schemaDeclarationOf } from '@uniweb/schemas/foundation'
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* A section type's `sticky`, checked: `true` or `false`, or `{ default, top }`. `top` is how far
|
|
43
|
-
* below the top the section stays — one CSS value, `4rem` or `var(--header-height)` — and is
|
|
44
|
-
* written into the style of the box that sticks, so a declaration (`;`, a brace) is refused.
|
|
45
|
-
*
|
|
46
|
-
* @param {*} declared - `meta.js`'s `sticky`
|
|
47
|
-
* @returns {{ default: boolean, top?: string }}
|
|
48
|
-
* @throws {Error} for any other shape
|
|
49
|
-
*/
|
|
50
|
-
export function stickyDeclaration(declared) {
|
|
51
|
-
if (typeof declared === 'boolean') return { default: declared }
|
|
52
|
-
if (!declared || typeof declared !== 'object' || Array.isArray(declared)) {
|
|
53
|
-
throw new Error(`[uniweb] Invalid 'sticky': write true, false or { default, top } — got ${JSON.stringify(declared)}`)
|
|
54
|
-
}
|
|
55
|
-
const unknown = Object.keys(declared).filter((key) => key !== 'default' && key !== 'top')
|
|
56
|
-
if (unknown.length) throw new Error(`[uniweb] Invalid 'sticky': ${unknown.join(', ')} — it takes default and top`)
|
|
57
|
-
if (declared.default !== undefined && typeof declared.default !== 'boolean') {
|
|
58
|
-
throw new Error(`[uniweb] Invalid 'sticky.default': write true or false`)
|
|
59
|
-
}
|
|
60
|
-
const out = { default: declared.default === true }
|
|
61
|
-
if (declared.top !== undefined) {
|
|
62
|
-
if (typeof declared.top !== 'string' || !declared.top.trim() || /[;{}]/.test(declared.top)) {
|
|
63
|
-
throw new Error(`[uniweb] Invalid 'sticky.top': one CSS length, such as '4rem' or 'var(--header-height)'`)
|
|
64
|
-
}
|
|
65
|
-
out.top = declared.top.trim()
|
|
66
|
-
}
|
|
67
|
-
return out
|
|
68
|
-
}
|
|
40
|
+
import { stickyDeclaration } from '@uniweb/schemas/section'
|
|
69
41
|
|
|
70
42
|
/**
|
|
71
43
|
* A `data:` entry as the runtime reads it: its schema ref, with the flags set on it — or null for an
|
|
@@ -164,8 +136,13 @@ export function extractRuntimeSchema(fullMeta) {
|
|
|
164
136
|
|
|
165
137
|
// Whether the section stays in view by default: core reads it, and the author's
|
|
166
138
|
// `sticky:` wins (`Block#initComponent`). The runtime makes sticky the box that can.
|
|
139
|
+
// `{ default }`, with `top` when the type has one — the shape a registered entry holds too.
|
|
167
140
|
if (fullMeta.sticky !== undefined) {
|
|
168
|
-
|
|
141
|
+
try {
|
|
142
|
+
runtime.sticky = stickyDeclaration(fullMeta.sticky)
|
|
143
|
+
} catch (err) {
|
|
144
|
+
throw new Error(`[uniweb] ${err.message}`)
|
|
145
|
+
}
|
|
169
146
|
}
|
|
170
147
|
|
|
171
148
|
// Data. `data:` is the single declaration surface for a section's structured
|
package/src/schema.js
CHANGED
|
@@ -21,8 +21,7 @@ import { describeChildren, describeVisuals, lowerChildren } from '@uniweb/schema
|
|
|
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 } from '@uniweb/schemas/section'
|
|
25
|
-
import { stickyDeclaration } from './runtime-schema.js'
|
|
24
|
+
import { SECTION_PARAMS, SECTION_KEYS, stickyDeclaration } from '@uniweb/schemas/section'
|
|
26
25
|
import { collectSchemaRefs, buildDataSchemaMap, ownSchemaRefs } from './resolve-data-schema.js'
|
|
27
26
|
import {
|
|
28
27
|
composeSupports,
|
|
@@ -661,8 +660,9 @@ function buildComponentEntry(name, relativePath, meta) {
|
|
|
661
660
|
}
|
|
662
661
|
|
|
663
662
|
/**
|
|
664
|
-
* Refuse a `sticky` that is not `true`, `false` or `{ default, top }` (`stickyDeclaration
|
|
665
|
-
* the component — the lean runtime schema checks it too,
|
|
663
|
+
* Refuse a `sticky` that is not `true`, `false` or `{ default, top }` (`stickyDeclaration`,
|
|
664
|
+
* `@uniweb/schemas/section`), naming the component — the lean runtime schema checks it too,
|
|
665
|
+
* without the name. The entry keeps it as written; `register` writes it in one shape (format 3).
|
|
666
666
|
*
|
|
667
667
|
* @param {string} owner - who declares it, for the message
|
|
668
668
|
* @param {*} sticky - `meta.js`'s `sticky`
|
|
@@ -672,7 +672,7 @@ function refuseStickyDeclaration(owner, sticky) {
|
|
|
672
672
|
try {
|
|
673
673
|
stickyDeclaration(sticky)
|
|
674
674
|
} catch (err) {
|
|
675
|
-
throw new Error(`[uniweb] ${owner}: ${err.message
|
|
675
|
+
throw new Error(`[uniweb] ${owner}: ${err.message}`)
|
|
676
676
|
}
|
|
677
677
|
}
|
|
678
678
|
|