@vitreajs/vitrea 0.1.1 → 0.2.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/README.md CHANGED
@@ -25,15 +25,24 @@ selectable, focusable, IME-capable, and announced by a screen reader as a button
25
25
  ## Install
26
26
 
27
27
  ```bash
28
- npm install @vitreajs/vitrea @vitreajs/vitrea-react
28
+ npm install @vitreajs/vitrea-react # React
29
+ npm install @vitreajs/vitrea-web # plain JS, or your own adapter
29
30
  ```
30
31
 
31
- The library is called vitrea and publishes under the npm scope `@vitreajs`.
32
- `@vitreajs/vitrea` is the framework-agnostic runtime, `@vitreajs/vitrea-react`
33
- the declarative surface. These two are the only published packages: the
34
- geometry kernel, the motion kernel, the DOM host layer and the WebGPU renderer
35
- are internal and bundled into them at publish time, so an app installs two
36
- packages and gets zero transitive runtime dependencies beyond React itself.
32
+ The library is called vitrea and publishes under the npm scope `@vitreajs`, in
33
+ three packages that layer the way React's own do — a pure runtime, a DOM host
34
+ over it, framework bindings over that:
35
+
36
+ | Package | What it is | Depends on |
37
+ | --- | --- | --- |
38
+ | `@vitreajs/vitrea` | the framework-agnostic runtime: scene model, capability and tier resolution, material and accessibility policy. No DOM code at all. | nothing |
39
+ | `@vitreajs/vitrea-web` | the browser host: element registration, plane management, backdrop proxies, the CSS-tier renderer, the WebGPU lifecycle. **Mounts a root from any framework, or none.** | `@vitreajs/vitrea` |
40
+ | `@vitreajs/vitrea-react` | the declarative surface: `GlassRoot`, `GlassGroup`, `GlassSurface` and the v1 controls. | both of the above |
41
+
42
+ Installing the React bindings pulls the other two in, so a React app still runs
43
+ one `npm install` and gets no transitive runtime dependency outside this project
44
+ beyond React itself. The geometry kernel, the motion kernel and the WebGPU
45
+ renderer stay internal and are bundled in at publish time.
37
46
 
38
47
  **TypeScript.** The published declarations resolve on their own, on any
39
48
  TypeScript version, with no `types` entry and nothing extra installed —
@@ -46,20 +55,23 @@ competing with them.
46
55
 
47
56
  | You are… | Install | Import |
48
57
  | --- | --- | --- |
49
- | writing a React app | `@vitreajs/vitrea @vitreajs/vitrea-react` | `@vitreajs/vitrea-react` for components, `@vitreajs/vitrea` for types |
50
- | reading the resolved capability state | either | `@vitreajs/vitrea` |
51
- | writing a Vue/Svelte/WC adapter | `@vitreajs/vitrea` | not yet supported — see below |
58
+ | writing a React app | `@vitreajs/vitrea-react` | `@vitreajs/vitrea-react` for components, `@vitreajs/vitrea` for types |
59
+ | writing plain JavaScript, or a Vue/Svelte/Web-Components adapter | `@vitreajs/vitrea-web` | `@vitreajs/vitrea-web` for `createGlassRoot`, `@vitreajs/vitrea` for types |
60
+ | reading the resolved capability state | any of them | `@vitreajs/vitrea` |
52
61
 
53
- **One honest limit up front.** `vitrea` contains no DOM code at all, by design
62
+ **Which one has the DOM in it.** `vitrea` contains no DOM code at all, by design
54
63
  (the purity law: the core, geometry and motion packages never touch `window`,
55
- `document` or `HTMLElement`). The browser host layer element registration,
56
- plane management, backdrop proxies, the CSS-tier renderer, the WebGPU lifecycle
57
- ships bundled *inside* `vitrea-react`. So in v1 the only way to render glass in a
58
- browser is through the React bindings. `vitrea` on its own gives you the scene
59
- model, the capability and tier resolver, the material and accessibility policy,
60
- and the frame-scheduler contract; it does not give you a mounted root. A
61
- framework-agnostic host entry point is post-v1 work, not a thing you can reach
62
- today by installing `vitrea` alone.
64
+ `document` or `HTMLElement`). So `vitrea` on its own gives you the scene model,
65
+ the capability and tier resolver, the material and accessibility policy, and the
66
+ frame-scheduler contract but not a mounted root. `vitrea-web` is the package
67
+ that mounts one, and it is a peer of the React bindings rather than something
68
+ hidden inside them: the same `createGlassRoot` the bindings use is the one a
69
+ vanilla page calls. See [`@vitreajs/vitrea-web`](../platform-web/README.md) for
70
+ the imperative quickstart.
71
+
72
+ > Until 0.2 the host layer shipped bundled *inside* `vitrea-react`, so React was
73
+ > the only way to render glass in a browser. That is what publishing this package
74
+ > retired.
63
75
 
64
76
  ---
65
77
 
@@ -109,6 +121,38 @@ it will be exactly as big as you made it. This is also why press compression and
109
121
  morph deformation are composed transforms rather than shape changes: a transform
110
122
  cannot dirty the rect it is animating.
111
123
 
124
+ ### Glass is a controls-layer material
125
+
126
+ There is one placement rule, and Apple states it as a prohibition rather than as
127
+ advice: **"Don't use Liquid Glass in the content layer."** The material exists to
128
+ separate the things you can act on from the things you are reading; putting it on
129
+ both collapses that distinction. Apple names both failure modes: "including it in
130
+ the content layer can result in unnecessary complexity and a confusing visual
131
+ hierarchy", and, for stacking, "avoid applying the material to both layers.
132
+ Instead, use fills, transparency, and vibrancy for the top elements."
133
+
134
+ So: glass on the toolbar, not on the article you are reading through it. Glass on
135
+ the row's button, not on the row. And glass on the control, never on the control *and* its
136
+ container. Lists and tables are the case Apple calls out by name, and they are
137
+ the case a web glass library gets wrong most often, because `asChild` will glass
138
+ a `<tr>` as readily as a `<button>`.
139
+
140
+ vitrea now checks the two compositions that are decidable from structure, at
141
+ registration, in dev mode only:
142
+
143
+ | code | fires when | what it tells you |
144
+ | --- | --- | --- |
145
+ | `glass-inside-glass` | a registered host sits inside another registered host's subtree | which pair, and to keep the material on whichever of the two is the control while the other takes a fill, a translucency or a vibrant foreground |
146
+ | `glass-in-content-layer` | a host is registered on an element whose resolved ARIA role is a list or table structure | which element and which role, and either to move the glass onto the control the row holds or — if it really is a controls-layer container — to give it the role it means, at which point the check stands down |
147
+
148
+ Both are advisory findings on the diagnostics channel rather than throws, and
149
+ both are `devMode`-only: the check runs once per `registerHost` call and never
150
+ from a frame, so a production build pays nothing for it. What vitrea does *not*
151
+ check is the rest of the rule — whether anything is actually scrolling under a
152
+ surface, whether a non-interactive label has been glassed, whether glass and
153
+ content intersect at rest. Those need judgement or a per-frame observation, and a
154
+ diagnostic that fires on a correct page is worse than no diagnostic.
155
+
112
156
  And to see what the runtime actually resolved to, rather than what you asked for:
113
157
 
114
158
  ```tsx
@@ -189,6 +233,18 @@ There is a built-in best-effort estimator that reads known background colours an
189
233
  images where CORS permits, and it is documented as an estimator every place it
190
234
  appears — not as pixel analysis, because that is not what it is.
191
235
 
236
+ **The backdrop reading decides the material's own appearance too, not only the
237
+ foreground.** Apple's material stops being a lighter thing in front of a dark
238
+ enough backdrop and takes that backdrop's tone; vitrea does the same, size-gated,
239
+ so a 44 px control disappears into a near-black backdrop while a large panel over
240
+ the same one keeps most of its own appearance. Read the table above with that in
241
+ mind: **texture + exact** measures the tone from the pixels you supplied,
242
+ **dom + hint** adapts to the tone your hint declares, and **dom + none** does not
243
+ adapt at all — it will not guess a backdrop it has not been shown, on either tier.
244
+ Nothing happens above roughly a fifth of the luminance range, so an ordinary page
245
+ is untouched. Measured against the macOS 26.5 reference; the law and its numbers
246
+ are in `docs/doperpowers/specs/c9a-fidelity-claims.md` §5.8.
247
+
192
248
  ### Registering a texture backdrop
193
249
 
194
250
  The texture path is two steps, and it is two because of the purity law above:
@@ -346,6 +402,14 @@ check.
346
402
  - **Tier coherence is a Chromium measurement of a material's level**, on one
347
403
  profile, at 1×. It does not say the two tiers are identical, and it does not
348
404
  hold on Gecko or WebKit — nothing measurable does there.
405
+ - **No fidelity claim for the author tint.** `GlassSurface`'s `tint` prop is
406
+ implemented on both tiers and visually verified on both, but every constant in
407
+ the tone curve that turns an author's colour into "a range of tones mapped to
408
+ content brightness underneath" is an advisory default. The tinted native
409
+ captures that would fit them were taken on 2026-08-30 and could not be used:
410
+ they carry the tint's strength but not its colour, so two scenes declaring
411
+ different seeds came back byte-identical (claims §5.10). Until a re-captured
412
+ bed exists the tint's appearance is designed, not calibrated.
349
413
 
350
414
  ---
351
415
 
@@ -383,6 +447,12 @@ errors. Asking for the GPU tier is not the same as getting it, and
383
447
  a support query.
384
448
  - v1 corner radii are uniform. The `radii` API keeps its four-component shape,
385
449
  but a non-uniform set is a dev-mode error; per-corner algebra is post-v1.
450
+ - **One author tint seed per group.** A tint is declared per surface and its
451
+ strength is honoured per surface, but a group is one optics pass and carries
452
+ one seed, so two *different* tint colours in one group raise a dev-mode warning
453
+ and the WebGPU tier draws them all in the first surface's colour. One coloured
454
+ control among plain ones — Apple's own guidance for tinting — is the supported
455
+ composition.
386
456
 
387
457
  ---
388
458