@umriss-ui/core 0.41.0 → 0.42.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/CHANGELOG.md +31 -5
- package/README.md +200 -10
- package/dist/core.css +1 -1
- package/dist/core.js +2697 -2678
- package/dist/index.d.ts +2 -2
- package/docs/llms-full.md +955 -1071
- package/package.json +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,12 @@ This document describes what changes for **callers** of the package: exports,
|
|
|
4
4
|
props, behaviour.
|
|
5
5
|
|
|
6
6
|
**The numbers.** The middle digit rises when something is added; the last one
|
|
7
|
-
when something is repaired.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
when something is repaired. The six packages are released in step, and a rename
|
|
8
|
+
keeps its old name for one further minor, with a warning, before the minor after
|
|
9
|
+
it removes the name ([the upgrade promise, ADR-0066](../../docs/adr/0066-one-number-peers-over-the-minor-a-rename-lives-one-minor.md)).
|
|
10
|
+
**Whatever changes existing behaviour stands under a heading "Changed" of its
|
|
11
|
+
own**, no matter which digit rose, with a `Migration:` line. Whoever reads only
|
|
12
|
+
one section before an upgrade reads that one.
|
|
12
13
|
|
|
13
14
|
From 0.34.0 the packages share one number - five, and six from 0.40.0, when the dashboard joined: they are released together, and a package without a change of its own still gets a heading for it.
|
|
14
15
|
|
|
@@ -26,6 +27,31 @@ package stood at `0.1.0` the whole time, because it had exactly one caller and t
|
|
|
26
27
|
caller lay in the same repository — and are grouped by unit of delivery, not by
|
|
27
28
|
commit.
|
|
28
29
|
|
|
30
|
+
## 0.42.0 – Tested in Vitest and Jest, themed from one file (Oct. 2026)
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- **Core loads in Vitest and Jest with the lines its README gives.** The new "Testing" section holds `vitest.config.ts`, `jest.config.cjs` with its CSS stub and Babel config, and `umriss.setup.js` with the five polyfills jsdom lacks; `.` and `./wording/de` carry a `default` condition for Jest's resolver. The release check installs the packed package into a scratch project and runs a test from those very blocks under both runners.
|
|
35
|
+
- **Six tokens where a value was written into a component:** `--u-modal-width-sm`, `--u-modal-width-md` and `--u-modal-width-lg` (400, 520 and 720 px), `--u-transform-caps` (`uppercase`, read by every text in spaced capitals - Card's eyebrow, Divider's label, the caps style, the DatePicker's weekdays, the CommandPalette, the table's head and the dashboard's mode label), `--u-button-press-scale` (0.98) and `--u-label-size` (a FormField label's size, `--u-text-sm`). Each defaults to the value it replaces.
|
|
36
|
+
- **A brand file to copy** in the README's Styles section: the font, the six accent tokens and the charts' palette, each light and dark; a unit test holds it to the stylesheets and the contrast pairs. Type on the accent surface joins the contrast pairs at 4.5:1.
|
|
37
|
+
- **The layer order for Tailwind v4 and for a wrapper library** stands in the Styles section, with the one declaration each needs; it holds in either load order.
|
|
38
|
+
- **A "Server Components" section** says what a Server Component may do with core: render its components with props React can serialise (ADR-0067).
|
|
39
|
+
- **TypeScript 5.4 or newer**, stated in the Install section (the declarations use `NoInfer`); the release check compiles a strict consumer under 5.4 as well as the current TypeScript.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- **`useFormats()` writes no date or time until the page has hydrated.** On a server and in the hydration render its instant formats (`date`, `dateShort`, `month`, `dateLong`, `time`, `dateTime`, `offset`) return an empty text; a client-only render never sees them empty. A server in another zone than the reader's no longer raises React's hydration error #418 (ADR-0060, amended). The pickers measure their field with the real formats, so their width does not jump.
|
|
44
|
+
- Migration: nothing to change in an application that renders in the browser; a test that renders to a string and expects a date finds an empty text - render it in the DOM instead.
|
|
45
|
+
|
|
46
|
+
## 0.41.1 – The documentation runs where the code is (Oct. 2026)
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
|
|
50
|
+
- **The documentation is no longer hosted.** The site on GitHub Pages is gone, and the package's `homepage` now names its README on GitHub. The running documentation of this version opens from a checkout of the tag `core-v0.41.1` with `pnpm install` and `pnpm start`, at `http://localhost:4170/umriss-ui/` - the repository README says how, under "See it running".
|
|
51
|
+
- Migration: nothing to change; a bookmark or link to the old hosted site no longer resolves - open the documentation from a checkout of the tag, as described above.
|
|
52
|
+
- **`docs/llms-full.md` in the package stands on its own:** a link to another page points at that page's heading in the same file, a link to a place on the site that the file does not hold keeps only its text, and ADR-0032 is linked at this version's tag.
|
|
53
|
+
- Migration: nothing to change; look at any tool that read `docs/llms-full.md` and followed its links to the site, which now find the heading in the same file.
|
|
54
|
+
|
|
29
55
|
## 0.41.0 – Colours survive a modern build (Oct. 2026)
|
|
30
56
|
|
|
31
57
|
### Fixed
|
package/README.md
CHANGED
|
@@ -14,31 +14,72 @@ once for all five packages in [`../../docs/design-language.md`](../../docs/desig
|
|
|
14
14
|
pnpm add @umriss-ui/core
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
The demo is the documentation
|
|
17
|
+
The demo is the documentation.
|
|
18
18
|
Every prop of a props table is linked to the examples that show it, 27 pages
|
|
19
19
|
open with a configurator, an API index lists every export, one search finds
|
|
20
20
|
across all five packages, and the header switches the examples to German.
|
|
21
21
|
For a coding agent the same material stands as one Markdown file inside the
|
|
22
22
|
installed package, `docs/llms-full.md`, pinned to that version — every page
|
|
23
23
|
with its examples' source, its props tables and why it is built as it is, and
|
|
24
|
-
an index of every export with its comment and its declaration
|
|
25
|
-
has a Markdown twin; online, for the latest version,
|
|
26
|
-
<https://romanhaendler.github.io/umriss-ui/core/llms.txt>.
|
|
24
|
+
an index of every export with its comment and its declaration. The running documentation of a version is opened as [the repository README describes](https://github.com/romanhaendler/umriss-ui#see-it-running): check out the tag `<package>-v<version>`, then `pnpm start`.
|
|
27
25
|
In an application:
|
|
28
26
|
|
|
29
27
|
```tsx
|
|
30
28
|
import { Button, Card } from "@umriss-ui/core";
|
|
31
29
|
```
|
|
32
30
|
|
|
33
|
-
Nothing else is required. React 19 or newer as a peer.
|
|
31
|
+
Nothing else is required. React 19 or newer as a peer. TypeScript 5.4 or newer (the declarations use `NoInfer`).
|
|
34
32
|
|
|
35
33
|
The package ships ES2022 syntax; an application that serves older browsers
|
|
36
34
|
transpiles it itself.
|
|
37
35
|
|
|
38
36
|
Every entry, `./wording/de` included, begins with `"use client"`, the directive a framework
|
|
39
|
-
with Server Components reads to treat a module as client code.
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
with Server Components reads to treat a module as client code. Core's components render from a
|
|
38
|
+
Server Component with props React can serialise; a function prop (a handler, a render prop) is
|
|
39
|
+
callable only in a client file. No test runs inside such a framework: the package is rendered to a
|
|
40
|
+
string in a test, and the fields' widths a server writes into the markup are checked there.
|
|
41
|
+
|
|
42
|
+
### Server Components
|
|
43
|
+
|
|
44
|
+
A Server Component fetches the data and hands it to a Client Component. The views - table, chart,
|
|
45
|
+
schedule, dashboard - are declared by their hook, so the declaration stays in a client file next to
|
|
46
|
+
them, with its `rowKey`, columns and formatters. Only the rows cross the boundary:
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
// app/orders/page.tsx - a Server Component
|
|
50
|
+
import { OrdersTable } from "./orders-table";
|
|
51
|
+
import { loadOrders } from "@/lib/orders";
|
|
52
|
+
|
|
53
|
+
export default async function Page() {
|
|
54
|
+
return <OrdersTable rows={await loadOrders()} />;
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
// app/orders/orders-table.tsx
|
|
60
|
+
"use client";
|
|
61
|
+
import { useTable } from "@umriss-ui/table";
|
|
62
|
+
import type { Order } from "@/lib/orders";
|
|
63
|
+
|
|
64
|
+
export function OrdersTable({ rows }: { rows: Order[] }) {
|
|
65
|
+
const { Table, Column } = useTable(rows, { rowKey: (o) => o.number });
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Table ariaLabel="Orders">
|
|
69
|
+
<Column value="number" label="Order" rowHeader />
|
|
70
|
+
<Column value="customer" label="Customer" />
|
|
71
|
+
<Column value="quantity" label="Quantity" />
|
|
72
|
+
</Table>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
On a server, and until the page has hydrated, a date or time is empty, because only the browser
|
|
78
|
+
knows the reader's zone.
|
|
79
|
+
|
|
80
|
+
The calculation is the one view a Server Component writes itself: its tree is read where it is
|
|
81
|
+
written (see `@umriss-ui/calculation`). The reasons are in
|
|
82
|
+
[ADR-0067](../../docs/adr/0067-a-server-component-hands-umriss-its-data-and-writes-only-a-calculation.md).
|
|
42
83
|
|
|
43
84
|
### What an import costs
|
|
44
85
|
|
|
@@ -67,13 +108,60 @@ elements, a focus ring on what it makes focusable. A caller's content inside
|
|
|
67
108
|
layers, `umriss.tokens`, `umriss.base` and `umriss.components`, and CSS written
|
|
68
109
|
outside a layer wins over all of them, whatever the order of loading:
|
|
69
110
|
|
|
70
|
-
|
|
111
|
+
A brand is one file to copy and edit. It sets the font, the whole accent and
|
|
112
|
+
the charts' palette, each colour with a light and a dark value, so that no part
|
|
113
|
+
of the interface stays petrol; the values are an example (indigo), not the
|
|
114
|
+
defaults:
|
|
115
|
+
|
|
116
|
+
```css brand.css
|
|
71
117
|
:root {
|
|
72
118
|
--u-font-sans: "Inter", system-ui, sans-serif;
|
|
73
|
-
|
|
119
|
+
|
|
120
|
+
--u-color-accent: light-dark(#4338ca, #818cf8);
|
|
121
|
+
--u-color-accent-hover: light-dark(#3730a3, #a5b4fc);
|
|
122
|
+
--u-color-accent-subtle: light-dark(#eef0fb, #1e1f3d);
|
|
123
|
+
--u-color-accent-subtle-pressed: light-dark(#dfe2f7, #282a52);
|
|
124
|
+
--u-color-accent-text: light-dark(#4338ca, #a5b4fc);
|
|
125
|
+
--u-color-on-accent: light-dark(#ffffff, #1e1b4b);
|
|
126
|
+
|
|
127
|
+
--u-chart-1: light-dark(#4338ca, #818cf8);
|
|
128
|
+
--u-chart-2: light-dark(#db2777, #f472b6);
|
|
129
|
+
--u-chart-3: light-dark(#059669, #34d399);
|
|
130
|
+
--u-chart-4: light-dark(#d97706, #fbbf24);
|
|
131
|
+
--u-chart-5: light-dark(#0891b2, #22d3ee);
|
|
132
|
+
--u-chart-6: light-dark(#7c3aed, #a78bfa);
|
|
74
133
|
}
|
|
75
134
|
```
|
|
76
135
|
|
|
136
|
+
A brand may also change the neutrals, the radius, `--u-transform-caps` with
|
|
137
|
+
`--u-tracking-caps`, `--u-button-press-scale`, `--u-label-size` and the modal
|
|
138
|
+
widths; the Theming page's table lists every token.
|
|
139
|
+
|
|
140
|
+
**Denser or roomier.** An application sets the type steps, the spaces and the
|
|
141
|
+
small control heights. A table and a calculation follow them, and the
|
|
142
|
+
provider's `density` chooses regular or compact on top.
|
|
143
|
+
|
|
144
|
+
**Layered CSS of your own.** The order of the layers decides who wins, so
|
|
145
|
+
declare it before anything else is read.
|
|
146
|
+
|
|
147
|
+
- Tailwind v4: this line as the first CSS the page reads, before
|
|
148
|
+
`@import "tailwindcss"`. Utilities then win over umriss, and Tailwind's
|
|
149
|
+
preflight stays below it.
|
|
150
|
+
|
|
151
|
+
```css
|
|
152
|
+
@layer theme, base, umriss.tokens, umriss.base, umriss.components, components, utilities;
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
- A wrapper library: this line as the first statement of its stylesheet,
|
|
156
|
+
with its own layer in place of `acme`. It holds in either load order.
|
|
157
|
+
|
|
158
|
+
```css
|
|
159
|
+
@layer umriss.tokens, umriss.base, umriss.components, acme;
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Unlayered CSS always wins. A classic unlayered reset (Bootstrap and the like) is
|
|
163
|
+
not fixed by layer order.
|
|
164
|
+
|
|
77
165
|
**Light and dark follow the application's `color-scheme`.** Every token with
|
|
78
166
|
two values is written `light-dark(<light>, <dark>)`. An application that
|
|
79
167
|
switches its mode with a theme library usually sets `color-scheme` already;
|
|
@@ -106,6 +194,108 @@ token away.
|
|
|
106
194
|
older nowhere; an older browser discards the tokens and shows the interface
|
|
107
195
|
unstyled.
|
|
108
196
|
|
|
197
|
+
## Testing
|
|
198
|
+
|
|
199
|
+
Tested: Vitest 5 and Jest 30 (with babel-jest), both on jsdom. happy-dom and Jest 29 may work and are
|
|
200
|
+
not promised. `check:dist` runs a test of the installed package in a Vitest project and a Jest project
|
|
201
|
+
that hold exactly the files below.
|
|
202
|
+
|
|
203
|
+
**Vitest** needs one line, `server.deps.inline`: Vitest hands a dependency to Node, and Node cannot
|
|
204
|
+
import the stylesheet that the package's JavaScript imports (`Unknown file extension ".css"`). Inlined,
|
|
205
|
+
Vitest's own pipeline handles it.
|
|
206
|
+
|
|
207
|
+
```ts vitest.config.ts
|
|
208
|
+
import { defineConfig } from "vitest/config";
|
|
209
|
+
|
|
210
|
+
export default defineConfig({
|
|
211
|
+
test: {
|
|
212
|
+
environment: "jsdom",
|
|
213
|
+
globals: true,
|
|
214
|
+
setupFiles: ["./umriss.setup.js"],
|
|
215
|
+
server: { deps: { inline: [/@umriss-ui/] } },
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**Jest** needs two settings: `moduleNameMapper` maps every stylesheet to an empty module, and
|
|
221
|
+
`transformIgnorePatterns` lets babel-jest compile the package, which ships ES modules. Babel's config
|
|
222
|
+
must apply to `node_modules`, so it is a root `babel.config.*`, not a `.babelrc`.
|
|
223
|
+
|
|
224
|
+
```js jest.config.cjs
|
|
225
|
+
module.exports = {
|
|
226
|
+
testEnvironment: "jsdom",
|
|
227
|
+
setupFilesAfterEnv: ["<rootDir>/umriss.setup.js"],
|
|
228
|
+
moduleNameMapper: { "\\.css$": "<rootDir>/css-stub.cjs" },
|
|
229
|
+
transformIgnorePatterns: ["/node_modules/(?!(@umriss-ui)/)"],
|
|
230
|
+
};
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
```js css-stub.cjs
|
|
234
|
+
module.exports = {};
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
```js babel.config.cjs
|
|
238
|
+
module.exports = {
|
|
239
|
+
presets: [
|
|
240
|
+
["@babel/preset-env", { targets: { node: "current" } }],
|
|
241
|
+
["@babel/preset-react", { runtime: "automatic" }],
|
|
242
|
+
],
|
|
243
|
+
};
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Next.js** with `next/jest`: put the umriss packages in `transpilePackages`; the preset stubs the
|
|
247
|
+
stylesheets and compiles the packages itself.
|
|
248
|
+
|
|
249
|
+
**The setup file** gives jsdom the five browser APIs that core's components use. It is the same file
|
|
250
|
+
for both runners:
|
|
251
|
+
|
|
252
|
+
```js umriss.setup.js
|
|
253
|
+
globalThis.ResizeObserver ??= class {
|
|
254
|
+
observe() {}
|
|
255
|
+
unobserve() {}
|
|
256
|
+
disconnect() {}
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
globalThis.IntersectionObserver ??= class {
|
|
260
|
+
observe() {}
|
|
261
|
+
unobserve() {}
|
|
262
|
+
disconnect() {}
|
|
263
|
+
takeRecords() {
|
|
264
|
+
return [];
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
window.matchMedia ??= (query) => ({
|
|
269
|
+
matches: false,
|
|
270
|
+
media: query,
|
|
271
|
+
onchange: null,
|
|
272
|
+
addEventListener() {},
|
|
273
|
+
removeEventListener() {},
|
|
274
|
+
addListener() {},
|
|
275
|
+
removeListener() {},
|
|
276
|
+
dispatchEvent: () => false,
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
Element.prototype.scrollIntoView ??= function () {};
|
|
280
|
+
|
|
281
|
+
/* jsdom knows <dialog> but not showModal() and close(). */
|
|
282
|
+
HTMLDialogElement.prototype.showModal ??= function () {
|
|
283
|
+
this.setAttribute("open", "");
|
|
284
|
+
};
|
|
285
|
+
HTMLDialogElement.prototype.close ??= function (value) {
|
|
286
|
+
if (!this.hasAttribute("open")) return;
|
|
287
|
+
this.removeAttribute("open");
|
|
288
|
+
if (value !== undefined) this.returnValue = value;
|
|
289
|
+
this.dispatchEvent(new Event("close"));
|
|
290
|
+
};
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
**End-to-end suites.** The motion follows `prefers-reduced-motion`, so a Playwright suite turns it off
|
|
294
|
+
with `reducedMotion: 'reduce'` in `use`. A tool without that switch sets, on `:root`, the tokens the
|
|
295
|
+
reduced-motion block sets to `0ms`: `--u-transition`, `--u-duration-press`, `--u-duration-fast`,
|
|
296
|
+
`--u-duration-medium`, `--u-duration-draw`, `--u-delay-draw`, `--u-duration-exit-fast`,
|
|
297
|
+
`--u-duration-exit` and `--u-duration-exit-collapse`.
|
|
298
|
+
|
|
109
299
|
## Wording
|
|
110
300
|
|
|
111
301
|
English is the default wording. German ships as well, as the subpath export
|