uniweb 1.28.2 → 1.29.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",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.1",
|
|
4
4
|
"description": "Create structured Vite + React sites with content/code separation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"js-yaml": "^4.3.2",
|
|
42
42
|
"prompts": "^2.4.2",
|
|
43
43
|
"tar": "^7.5.21",
|
|
44
|
+
"@uniweb/core": "~1.6.7",
|
|
45
|
+
"@uniweb/semantic-parser": "~1.13.2",
|
|
44
46
|
"@uniweb/content-writer": "~1.3.1",
|
|
45
|
-
"@uniweb/
|
|
46
|
-
"@uniweb/schemas": "~1.6.10",
|
|
47
|
-
"@uniweb/semantic-parser": "~1.13.2"
|
|
47
|
+
"@uniweb/schemas": "~1.6.11"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@uniweb/build": "~1.17.2",
|
|
51
50
|
"@uniweb/semantic-parser": "~1.13.2",
|
|
52
|
-
"@uniweb/content-reader": "~1.5.9"
|
|
51
|
+
"@uniweb/content-reader": "~1.5.9",
|
|
52
|
+
"@uniweb/build": "~1.18.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
55
55
|
"@uniweb/build": {
|
package/partials/agents.md
CHANGED
|
@@ -95,6 +95,7 @@ When a rule in §2 feels like friction, that is the moment you are about to take
|
|
|
95
95
|
| `<h2><H2 text=… /></h2>` | Kit text components render their own tag. | double tag |
|
|
96
96
|
| `content.items?.map`, `content.title ?? ''` | Never null — strings and arrays, always. | — |
|
|
97
97
|
| `className="sticky top-0"` | `sticky: true` in the type's `meta.js`. | `uniweb dev` names it |
|
|
98
|
+
| A header floated over the hero with `absolute` or `fixed` | `underHeader: true` on the hero's type, `height` and `background: 'self'` on the header's; the bar stays in the flow (foundation guide). | silent — section links land under the bar |
|
|
98
99
|
| `fixed inset-0 z-[9999]` for a modal | `<Overlay>` from kit — layout areas are stacking contexts, no z-index escapes one. | silent — under the header |
|
|
99
100
|
| `typeof window`, `localStorage.theme`, a theme `useEffect` | `useAppearance()`; the scheme is resolved before first paint; kit hooks are SSR-safe. | theme flash |
|
|
100
101
|
| `<a href="/about">` | `<Link to="page:about">` (an `id:` survives moves) or `<Link href="/about">`. A bare `<a>` still routes but resolves no `page:` and adds no base path or locale. | silent |
|
|
@@ -275,7 +276,7 @@ src/
|
|
|
275
276
|
|---|---|---|
|
|
276
277
|
| `type`, `id`, `hidden` | the section itself | — |
|
|
277
278
|
| `query`, `fetch` | its data | `content.data[key]`, for keys declared in `data:` |
|
|
278
|
-
| `theme`, `background`, `grid`, `vars`, `sticky` | settings the runtime applies | `block` — `useColorContext(block)`, `<SectionBackground block>`, `<ChildGrid from={block}>`, `block.sticky` |
|
|
279
|
+
| `theme`, `background`, `grid`, `vars`, `sticky`, `underHeader` | settings the runtime applies | `block` — `useColorContext(block)`, `<SectionBackground block>`, `<ChildGrid from={block}>`, `block.sticky`, `block.underHeader` |
|
|
279
280
|
| `props` | params as one map | merged into `params` |
|
|
280
281
|
| `data`, `preset`, `input` | `data:` stops the build (it was `query:`); the others warn and do nothing | — |
|
|
281
282
|
|
|
@@ -292,7 +293,7 @@ import { H1, P, Prose, Visual, Icon, Link, ChildBlocks, Overlay, PlainText } fro
|
|
|
292
293
|
export default {
|
|
293
294
|
title: 'Feature Grid', description: 'Grid of feature cards with icons',
|
|
294
295
|
family: 'features', // the standard kind it is (`uniweb families`); a name like `Hero` resolves on its own
|
|
295
|
-
// hidden: true · inset: true · area: 'header' · section: true · children: true · background: 'self' · sticky: true
|
|
296
|
+
// hidden: true · inset: true · area: 'header' · section: true · children: true · background: 'self' · sticky: true · underHeader: true · height: '4rem'
|
|
296
297
|
content: { title: 'Heading', paragraphs: 'Intro [0-1]', media: 'Photo [1]',
|
|
297
298
|
items: { label: 'Cards [3-6]', content: { icon: 'Icon [1]', title: 'Name', paragraphs: 'Text' } } },
|
|
298
299
|
params: { columns: { type: 'number', default: 3 },
|
|
@@ -193,11 +193,19 @@ background: primary-900 # palette token (bare n
|
|
|
193
193
|
background:
|
|
194
194
|
image: { src: /img.jpg, position: center top }
|
|
195
195
|
overlay: { enabled: true, type: dark, opacity: 0.5 }
|
|
196
|
+
background:
|
|
197
|
+
image: /img.jpg
|
|
198
|
+
overlay: # a fading overlay; every gradient field optional
|
|
199
|
+
enabled: true
|
|
200
|
+
opacity: 1 # 0.5 when left out, on the gradient too
|
|
201
|
+
gradient: { angle: 90, start: 'rgba(0,0,0,0.8)', startPosition: 0, end: 'rgba(0,0,0,0)', endPosition: 60 }
|
|
196
202
|
background:
|
|
197
203
|
video: { src: /videos/hero.mp4, poster: /images/hero.jpg }
|
|
198
204
|
```
|
|
199
205
|
|
|
200
|
-
|
|
206
|
+
An overlay is drawn only with `enabled: true` (the number shorthand, `overlay: 0.5`, sets it).
|
|
207
|
+
|
|
208
|
+
Components that draw their own declare `background: 'self'` in `meta.js`. They then paint everything behind their content, the section's surface color included (`bg-section` where they want it), and can still render the author's background with `<SectionBackground block={block} />`.
|
|
201
209
|
|
|
202
210
|
## Pages
|
|
203
211
|
|
|
@@ -68,10 +68,10 @@ Skip it and prose is unstyled (lists lose bullets) while the markup looks right;
|
|
|
68
68
|
Things you won't discover from exports:
|
|
69
69
|
|
|
70
70
|
- **`<Link>` takes `to` or `href`.** `to="page:about"` resolves a page id (survives moves) or a route, never a folder: the homepage is `page:/`, or `page:home` only when its `page.yml` says `id: home`. External URLs get `target="_blank"`; `reload` forces a full load.
|
|
71
|
-
- **A link back to a list is `<Link to="/store" back>`.** A link opens its page at the top, even the page the visitor just left, since the runtime restores a page's scroll only on back and forward. `back` steps back when the
|
|
71
|
+
- **A link back to a list is `<Link to="/store" back>`.** A link opens its page at the top, even the page the visitor just left, since the runtime restores a page's scroll only on back and forward. `back` steps back when the page before was that page (steps within this page don't count), so the list returns where they left it, and is an ordinary link otherwise. `useGoBack('/store')` does the same for a button. Keep the list's filter in `usePageState`, which stays with the page, so the view comes back too.
|
|
72
72
|
- **A modal needs `<Overlay>`, not a bigger z-index.** Each layout area's wrapper has its own layer, which makes it a stacking context; a `fixed` dialog inside one paints at its area's place in the stack, under the header/footer. `<Overlay onClose={close}>` renders into `document.body`, contains focus (moves it in, cycles Tab, marks the rest `inert`, returns it), handles Escape, scrim click, scroll lock; a dimmed scrim you override with `className` (`bg-transparent` removes it). `modal={false}` for a toast. Your dialog markup stays yours.
|
|
73
73
|
- **A reader can open a picture larger.** `components={{ image: EnlargeableImage }}` does it for an image in a page's body, and `Mermaid` does it on its own (`enlarge={false}` turns it off). `<Enlargeable>` goes around a picture a section draws itself. It's offered only when opening shows the picture noticeably larger, and the prerendered page doesn't change.
|
|
74
|
-
- **Kit brings no words.** What a reader or a screen reader meets comes from your foundation, so `Media` takes `playLabel`, `Asset` `downloadLabel`, `Disclaimer` `closeLabel` (it has a button at its foot only with one), `Prose` `footnoteBackLabel` and `DataPlaceholder` `label`. Without one it uses what the author wrote, a role or a symbol: a play button with no caption or alt is named `▶`. `<Link>`'s own tooltip is only a social service's name, an address or a number, so a link holding only an icon needs a `title` or `aria-label` from you.
|
|
74
|
+
- **Kit brings no words.** What a reader or a screen reader meets comes from your foundation, so `Media` takes `playLabel`, `Asset` `downloadLabel`, `Disclaimer` `closeLabel` (it has a button at its foot only with one), `Prose` `footnoteBackLabel` and `DataPlaceholder` `label`. Without one it uses what the author wrote, a role or a symbol: a play button with no caption or alt is named `▶`. `<Link>`'s own tooltip is only a social service's name, an address or a number, so a link holding only an icon needs a `title` or `aria-label` from you. Words your own section draws are content: *A section's own words*, below.
|
|
75
75
|
- **A word wider than its box breaks**, so a long heading can't pan a phone's page (`overflow-wrap: break-word`, in kit's base). What must stay whole in a narrow box says `whitespace-nowrap`: a big numeral, a figure, a number with its unit. Without it, `10 min` in a tight box comes out as `10 mi / n`.
|
|
76
76
|
- **Kit hooks are SSR-safe.** "document is not defined" → use the hook, don't add guards.
|
|
77
77
|
- **`cn()` drops an earlier `leading-*` when a `text-<size>` follows**, since Tailwind's size classes set line height too: `cn('leading-[1.1] text-4xl')` → `text-4xl`. Put the size first, or fold the leading into it (`text-[clamp(2rem,5vw,4rem)]/[1.1]`).
|
|
@@ -105,7 +105,9 @@ Header.className = 'border-b'
|
|
|
105
105
|
Header.as = 'div'
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
**Sticky is a setting.** `sticky: true` in the type's `meta.js` (an author turns it off with `sticky: false`); the runtime makes sticky the box that can stay in view. A body section sticks the same way and stays below the stuck header: the runtime publishes the header's reach as `--uw-sticky-top` (a type's `top` overrides: `sticky: { default: true, top: '4rem' }`).
|
|
108
|
+
**Sticky is a setting.** `sticky: true` in the type's `meta.js` (an author turns it off with `sticky: false`); the runtime makes sticky the box that can stay in view. A body section sticks the same way and stays below the stuck header: the runtime publishes the header's reach as `--uw-sticky-top` (a type's `top` overrides: `sticky: { default: true, top: '4rem' }`). Section links land below the stuck header. Keep the bar in the flow: a bar made `absolute` or `fixed` leaves the runtime nothing to measure, and section links land under it.
|
|
109
|
+
|
|
110
|
+
**A header over the opening section is a setting too.** `underHeader: true` in a type's `meta.js` (a hero whose picture reaches the top of the window; an author turns it off with `underHeader: false`) has the runtime lay the header over that section when it opens a page: the header's box takes no room, the section starts at the top, and the header keeps its height, stuck if it sticks. The section pads its content by `var(--uw-header-height)`, which the runtime gives it: the header type's `height` (`height: 'var(--header-height)'` in its `meta.js`) on the first paint, then what the browser measures. The header reads `block.getNextBlockInfo()?.underHeader` to paint itself see-through, and its box carries `data-uw-header="over"`. A header whose bar is ever see-through, there or frosted on scroll, says `background: 'self'` and paints its own bar (`bg-section` where solid): otherwise the theme paints its section's surface behind the bar. A child in `<ChildGrid>` sticks beside its column, and scrolls with the page at one column. A sticky section inside `overflow: hidden` can't stick — use `overflow: clip`. A layout that wraps an area in its own element makes it sticky when `page.isSticky('header')`. `uniweb dev` names a sticky element that cannot move in the console.
|
|
109
111
|
|
|
110
112
|
## meta.js in full
|
|
111
113
|
|
|
@@ -123,6 +125,7 @@ export default {
|
|
|
123
125
|
},
|
|
124
126
|
params: { … }, vars: { … }, data: { … }, presets: { … },
|
|
125
127
|
context: {}, initialState: {},
|
|
128
|
+
// sticky: true, underHeader: true, height: '4rem', background: 'self', area: 'header' — section settings and placement, below
|
|
126
129
|
}
|
|
127
130
|
```
|
|
128
131
|
|
|
@@ -213,6 +216,34 @@ Each entry ships its default as a CSS custom property everywhere, in dev and pro
|
|
|
213
216
|
|
|
214
217
|
Colors, tokens, light and dark, fonts and `styles.css` are in `uniweb guide theme`.
|
|
215
218
|
|
|
219
|
+
## A section's own words
|
|
220
|
+
|
|
221
|
+
The words a section draws itself — a search box's placeholder, an "All" filter, "No results", a menu button's `aria-label` — are content, not params: an author may change them, and a site in several languages translates them with the page. Their home is a tagged data block the type declares with an inline field map. The editor shows its fields, filled in from each `default:`, and `uniweb i18n` and a push translate it like the rest of the page, on a static site and a synced one alike. A param is a choice (a variant, a count) and is never translated.
|
|
222
|
+
|
|
223
|
+
```js
|
|
224
|
+
// sections/Catalog/labels.js — the type's own words, in the foundation's language
|
|
225
|
+
export default { search: 'Search…', all: 'All', empty: 'No results' }
|
|
226
|
+
|
|
227
|
+
// sections/Catalog/meta.js
|
|
228
|
+
import LABELS from './labels.js'
|
|
229
|
+
export default {
|
|
230
|
+
data: { labels: Object.fromEntries(Object.entries(LABELS).map(([key, text]) => [key, { type: 'string', default: text }])) },
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// sections/Catalog/index.jsx — what the section wrote, else the type's words
|
|
234
|
+
import LABELS from './labels.js'
|
|
235
|
+
const labels = { ...LABELS, ...content.data.labels }
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
````markdown
|
|
239
|
+
```yaml:labels
|
|
240
|
+
search: Search solutions…
|
|
241
|
+
empty: No solutions found
|
|
242
|
+
```
|
|
243
|
+
````
|
|
244
|
+
|
|
245
|
+
The runtime fills no default into a data block (`uniweb guide data`), so the component falls back to the same `labels.js` for a section written without the block. A later release that changes a default changes only the sections that never wrote their own.
|
|
246
|
+
|
|
216
247
|
## Composition
|
|
217
248
|
|
|
218
249
|
| Pattern | Authored | Rendered by |
|
|
@@ -294,20 +325,20 @@ function Footer({ content }) {
|
|
|
294
325
|
|
|
295
326
|
## Cross-block communication
|
|
296
327
|
|
|
297
|
-
A Header adapting to
|
|
328
|
+
A Header adapting to the section below it, a light logo over a photograph: the section that **owns** a fact declares it, the one that **adapts** reads it, via `getNextBlockInfo()` / `getPrevBlockInfo()` / `page.getFirstBodyBlockInfo()`. (Whether the header lies over that section at all is `underHeader`, above.)
|
|
298
329
|
|
|
299
330
|
- **`context`** — static, from `meta.js`.
|
|
300
331
|
- **`state`** — dynamic, via `block.useBlockState()`, initial value from `initialState`.
|
|
301
332
|
|
|
302
333
|
```js
|
|
303
334
|
// Hero/meta.js
|
|
304
|
-
export default { context: {
|
|
335
|
+
export default { context: { tone: 'photo' }, initialState: { tone: 'photo' } }
|
|
305
336
|
```
|
|
306
337
|
|
|
307
338
|
```jsx
|
|
308
339
|
const [state, setState] = block.useBlockState(useState) // Hero
|
|
309
340
|
const info = block.getNextBlockInfo() // Header
|
|
310
|
-
const
|
|
341
|
+
const overPhoto = (info?.state?.tone ?? info?.context?.tone) === 'photo'
|
|
311
342
|
```
|
|
312
343
|
|
|
313
344
|
Key names are yours.
|
package/src/framework-index.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-11-
|
|
3
|
+
"generatedAt": "2026-11-06T21:45:24.216Z",
|
|
4
4
|
"packages": {
|
|
5
5
|
"@uniweb/api": {
|
|
6
6
|
"version": "1.6.9"
|
|
7
7
|
},
|
|
8
8
|
"@uniweb/build": {
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.18.1"
|
|
10
10
|
},
|
|
11
11
|
"@uniweb/content-reader": {
|
|
12
12
|
"version": "1.5.9"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"version": "1.3.1"
|
|
16
16
|
},
|
|
17
17
|
"@uniweb/core": {
|
|
18
|
-
"version": "1.6.
|
|
18
|
+
"version": "1.6.7"
|
|
19
19
|
},
|
|
20
20
|
"@uniweb/frame-bridge": {
|
|
21
21
|
"version": "1.0.3"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"version": "1.0.8"
|
|
25
25
|
},
|
|
26
26
|
"@uniweb/kit": {
|
|
27
|
-
"version": "1.7.
|
|
27
|
+
"version": "1.7.13"
|
|
28
28
|
},
|
|
29
29
|
"@uniweb/loom": {
|
|
30
30
|
"version": "1.1.3"
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
"version": "1.2.2"
|
|
34
34
|
},
|
|
35
35
|
"@uniweb/projections": {
|
|
36
|
-
"version": "1.2.
|
|
36
|
+
"version": "1.2.13"
|
|
37
37
|
},
|
|
38
38
|
"@uniweb/runtime": {
|
|
39
|
-
"version": "1.
|
|
39
|
+
"version": "1.5.1"
|
|
40
40
|
},
|
|
41
41
|
"@uniweb/scene": {
|
|
42
42
|
"version": "1.0.1"
|
|
43
43
|
},
|
|
44
44
|
"@uniweb/schemas": {
|
|
45
|
-
"version": "1.6.
|
|
45
|
+
"version": "1.6.11"
|
|
46
46
|
},
|
|
47
47
|
"@uniweb/scholar": {
|
|
48
48
|
"version": "1.1.0"
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
"version": "1.1.2"
|
|
55
55
|
},
|
|
56
56
|
"@uniweb/templates": {
|
|
57
|
-
"version": "1.2.
|
|
57
|
+
"version": "1.2.9"
|
|
58
58
|
},
|
|
59
59
|
"@uniweb/theming": {
|
|
60
|
-
"version": "1.
|
|
60
|
+
"version": "1.3.1"
|
|
61
61
|
},
|
|
62
62
|
"@uniweb/unipress": {
|
|
63
|
-
"version": "1.1.
|
|
63
|
+
"version": "1.1.35"
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"templates": {
|