@umriss-ui/charts 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 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. As long as the first digit is `0`, no number
8
- promises compatibility — which is why a rule stronger than the figure applies as
9
- well: **whatever changes existing behaviour stands under a heading "Changed" of
10
- its own**, no matter which digit rose. Whoever reads only one section before an
11
- upgrade reads that one.
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
 
@@ -29,6 +30,23 @@ interface was still expected to move before `0.3.0`.
29
30
 
30
31
  ---
31
32
 
33
+ ## 0.42.0 – A chart under test in jsdom (Oct. 2026)
34
+
35
+ ### Added
36
+
37
+ - **A chart is testable in jsdom.** The new "Testing" section gives the Vitest and Jest lines in full - a charts-only application installs no core - with a setup file whose ResizeObserver reports a fixed size and whose `getContext` stub keeps jsdom quiet; `.` and `./wording/de` carry a `default` condition for Jest's resolver. The release check runs a test of a legend and the data table from those blocks under both runners.
38
+ - **The README names `--u-chart-1` to `--u-chart-6`** as the palette a brand changes, beside core's brand file.
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
+ ## 0.41.1 – The documentation runs where the code is (Oct. 2026)
42
+
43
+ ### Changed
44
+
45
+ - **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 `charts-v0.41.1` with `pnpm install` and `pnpm start`, at `http://localhost:4170/umriss-ui/` - the repository README says how, under "See it running".
46
+ - 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.
47
+ - **`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.
48
+ - 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.
49
+
32
50
  ## 0.41.0 – Limits read as values, and Jest loads the charts (Oct. 2026)
33
51
 
34
52
  ### Fixed
package/README.md CHANGED
@@ -16,7 +16,7 @@ lint rule over `packages/charts/src/**` holds that fast.
16
16
  pnpm add @umriss-ui/charts
17
17
  ```
18
18
 
19
- React 19 or newer as a peer, and nothing else. `@umriss-ui/core` is **not** a
19
+ React 19 or newer as a peer, and nothing else. TypeScript 5.4 or newer (the declarations use `NoInfer`). `@umriss-ui/core` is **not** a
20
20
  dependency and not a peer dependency — if an application uses both packages, it
21
21
  does so because it chose to, not because this one required it (ADR-0020).
22
22
 
@@ -24,8 +24,11 @@ The package ships ES2022 syntax; an application that serves older browsers
24
24
  transpiles it itself.
25
25
 
26
26
  Every entry, `./wording/de` included, begins with `"use client"`, the directive a framework
27
- with Server Components reads to treat a module as client code. No test runs
28
- inside such a framework: the charts are rendered to a string in a test.
27
+ with Server Components reads to treat a module as client code. A chart is declared by its hook,
28
+ `useChart`, so the declaration lives in a Client Component file: a Server Component renders that
29
+ file and hands it the rows. On a server a chart gives its labelled frame and an empty canvas; the
30
+ drawing arrives after mount. No test runs inside such a framework: the charts are rendered to a
31
+ string in a test.
29
32
 
30
33
  ## The smallest chart that runs
31
34
 
@@ -98,7 +101,8 @@ wins. `@umriss-ui/charts/styles.css` stays exported for setups that link
98
101
  stylesheets by hand.
99
102
 
100
103
  **Colours** come from `--uc-*` variables that fall back to the tokens of
101
- `@umriss-ui/core` where they exist and to literals where they do not. **Light and
104
+ `@umriss-ui/core` where they exist and to literals where they do not. The palette is `--u-chart-1` to
105
+ `--u-chart-6`; core's README holds a brand file that sets them, light and dark. **Light and
102
106
  dark** follow the application's `color-scheme`: the canvas colours are resolved
103
107
  anew when the root element's attributes or the system preference change;
104
108
  `invalidateTheme()` covers a switch made on another ancestor. **Fonts** are not
@@ -150,8 +154,7 @@ next kind to come (ADR-0059).
150
154
 
151
155
  ## More
152
156
 
153
- * The demo: <https://romanhaendler.github.io/umriss-ui/charts/>, or locally
154
- `pnpm dev:charts` (port 4174). It is the documentation — every page
157
+ * The demo, in a checkout: `pnpm dev:charts` (port 4174). It is the documentation — every page
155
158
  shows running examples with their source and the props table generated from
156
159
  `src/`, each prop linked to the examples that show it. An API index lists
157
160
  every export, and one search finds across all five packages.
@@ -159,14 +162,86 @@ next kind to come (ADR-0059).
159
162
  * **For a coding agent**: `docs/llms-full.md` inside the installed package —
160
163
  the demo as one Markdown file, pinned to the installed version: every page
161
164
  with its examples' source, its props tables and why it is built as it is,
162
- and an index of every export with its comment and its declaration. Each
163
- page also has a Markdown twin online; for the latest version:
164
- <https://romanhaendler.github.io/umriss-ui/charts/llms.txt>.
165
+ and 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`.
165
166
  * [`docs/capabilities.md`](docs/capabilities.md) — every capability with the
166
167
  level at which it is proved.
167
168
  * [`../../docs/design-language.md`](../../docs/design-language.md) — the design
168
169
  language all five packages share.
169
170
 
171
+ ## Testing
172
+
173
+ Tested: Vitest 5 and Jest 30 (with babel-jest), both on jsdom. happy-dom and Jest 29 may work and are
174
+ not promised. `check:dist` runs a test of the installed package in a Vitest project and a Jest project
175
+ that hold exactly the files below. A chart-only application installs no core, so the lines are given in
176
+ full here.
177
+
178
+ **Vitest** needs one line, `server.deps.inline`: Vitest hands a dependency to Node, and Node cannot
179
+ import the stylesheet that the package's JavaScript imports (`Unknown file extension ".css"`). Inlined,
180
+ Vitest's own pipeline handles it.
181
+
182
+ ```ts vitest.config.ts
183
+ import { defineConfig } from "vitest/config";
184
+
185
+ export default defineConfig({
186
+ test: {
187
+ environment: "jsdom",
188
+ globals: true,
189
+ setupFiles: ["./umriss.setup.js"],
190
+ server: { deps: { inline: [/@umriss-ui/] } },
191
+ },
192
+ });
193
+ ```
194
+
195
+ **Jest** needs two settings: `moduleNameMapper` maps every stylesheet to an empty module, and
196
+ `transformIgnorePatterns` lets babel-jest compile the package, which ships ES modules. Babel's config
197
+ must apply to `node_modules`, so it is a root `babel.config.*`, not a `.babelrc`.
198
+
199
+ ```js jest.config.cjs
200
+ module.exports = {
201
+ testEnvironment: "jsdom",
202
+ setupFilesAfterEnv: ["<rootDir>/umriss.setup.js"],
203
+ moduleNameMapper: { "\\.css$": "<rootDir>/css-stub.cjs" },
204
+ transformIgnorePatterns: ["/node_modules/(?!(@umriss-ui)/)"],
205
+ };
206
+ ```
207
+
208
+ ```js css-stub.cjs
209
+ module.exports = {};
210
+ ```
211
+
212
+ ```js babel.config.cjs
213
+ module.exports = {
214
+ presets: [
215
+ ["@babel/preset-env", { targets: { node: "current" } }],
216
+ ["@babel/preset-react", { runtime: "automatic" }],
217
+ ],
218
+ };
219
+ ```
220
+
221
+ **Next.js** with `next/jest`: put the umriss packages in `transpilePackages`; the preset stubs the
222
+ stylesheets and compiles the packages itself.
223
+
224
+ **The setup file** gives jsdom what a chart needs to lay out. jsdom measures nothing, so the
225
+ `ResizeObserver` reports a fixed size (600 x 280) for whatever it observes; without a size the chart
226
+ stays empty, and neither the legend nor "Show data" appears. jsdom has no canvas, so `getContext`
227
+ returns `null`, which a chart copes with. The file is the same for both runners:
228
+
229
+ ```js umriss.setup.js
230
+ globalThis.ResizeObserver = class {
231
+ constructor(callback) {
232
+ this.callback = callback;
233
+ }
234
+ observe(target) {
235
+ const box = { inlineSize: 600, blockSize: 280 };
236
+ this.callback([{ target, contentRect: { width: 600, height: 280 }, contentBoxSize: [box] }], this);
237
+ }
238
+ unobserve() {}
239
+ disconnect() {}
240
+ };
241
+
242
+ HTMLCanvasElement.prototype.getContext = () => null;
243
+ ```
244
+
170
245
  ## Licence
171
246
 
172
247
  MIT — see [`LICENSE`](LICENSE).