reifyui 0.7.3 → 0.8.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
@@ -57,6 +57,8 @@ A production-grade surface for rendering and interacting with a live agent turn:
57
57
  | **Rich blocks** | `CodeBlock` (highlight.js + mermaid + charts), `useResizablePane`, `PaneResizer` |
58
58
  | **Task list** | `TaskList`, `taskStatusGroup` — the master list beside a conversation: live status, filtering, cursor pagination. Transport-agnostic: you supply `fetchPage(cursor)` |
59
59
  | **Dialogs** | `DialogHost`, `useDialog` — awaited in-app `alert` / `confirm` / `prompt`, so a destructive tool call or a "name this" step never falls back to a browser popup |
60
+ | **Boards** | `Panel`, `PanelGrid`, `packLayout` — a drag-and-resize grid of panels whose read-only mode is the default, and the panel chrome for the two states a live panel actually has: loading, and failed with the error shown verbatim |
61
+ | **Charts** (`reifyui/chart`) | `Chart`, `chartTokens`, `useChartTokens` — render an ECharts option (created once, disposed, resized with its box) and read your `--uic-*` theme as the colours a chart option can hold |
60
62
  | **Slides** (`reifyui/slides`) | `SlideView`, `SlideStage`, `EditorCanvas`, `Presentation`, `ElementView`, `themeVars` — render a JSON deck, edit it by direct manipulation, present it |
61
63
  | **Spreadsheet** | `SheetGrid`, `sheetToDelimited`, `sheetToAoA` — an AI-editable grid, extensible with your own column types |
62
64
  | **HarnessRouter** (`reifyui/harness`) | `configureKit`, `kitHarness`, `listSessions`, `readFile`, `writeFile`, `createResponse`, `streamTurn`, `turnsToMessages`, `fileToInputBlock` — the transport for apps served by a HarnessRouter console |
@@ -150,6 +152,7 @@ import 'reifyui/styles/chip.css'; // Chip + Popover
150
152
  import 'reifyui/styles/preview.css'; // Modal
151
153
  import 'reifyui/styles/slides.css'; // slides
152
154
  import 'reifyui/styles/sheet.css'; // spreadsheet grid
155
+ import 'reifyui/styles/panels.css'; // panel + panel grid, stat tile, result table
153
156
  import 'reifyui/styles/tasks.css'; // task list
154
157
  import 'reifyui/styles/dialog.css'; // alert / confirm / prompt dialogs
155
158
  ```
@@ -260,6 +263,69 @@ pass `cellText` so a custom column exports as something a person wants rather th
260
263
  All colours come from `--uic-*` tokens — apply `styles/themes/light.css` or `dark.css`, or set the
261
264
  same tokens in your own layer.
262
265
 
266
+ ## Boards
267
+
268
+ A board is a layout array and a panel per entry. `PanelGrid` proposes the next layout; you own it.
269
+ Read-only is the default, so a board that is only read never ships a drag handler.
270
+
271
+ ```jsx
272
+ import { Panel, PanelGrid, packLayout } from 'reifyui';
273
+ import { Chart, useChartTokens } from 'reifyui/chart';
274
+ import 'reifyui/styles/panels.css';
275
+
276
+ const [tokens, boardRef] = useChartTokens(); // re-reads when the theme flips
277
+
278
+ <div ref={boardRef}>
279
+ <PanelGrid
280
+ layout={board.layout}
281
+ editable={arranging}
282
+ onLayoutChange={(next) => save({ ...board, layout: next })}
283
+ resizeLabel={(id) => `Resize ${titleOf(id)}`}
284
+ >
285
+ {board.panels.map((p) => (
286
+ <Panel
287
+ key={p.id} // matched to the layout entry's `i`
288
+ title={p.title}
289
+ meta={result[p.id]?.ranAt}
290
+ loading={!result[p.id]} // nothing yet: hold the box
291
+ busy={refreshing} // something already: keep it readable
292
+ error={result[p.id]?.error} // shown verbatim — it is what fixes the query
293
+ errorDetail={<pre>{p.query}</pre>}
294
+ onRetry={() => run(p)}
295
+ >
296
+ <Chart option={optionFor(p, result[p.id], tokens)} label={p.title} />
297
+ </Panel>
298
+ ))}
299
+ </PanelGrid>
300
+ </div>
301
+ ```
302
+
303
+ `Chart` renders an ECharts option and nothing else — no series props, no data shape of its own, so
304
+ anything ECharts can draw it can draw. It creates the instance once, disposes it, and resizes it
305
+ when its box changes; build the option in a `useMemo`, because it re-applies whenever that
306
+ reference changes. It lives at **`reifyui/chart`** rather than the root for the same reason as
307
+ slides: echarts loads lazily inside it, and a root re-export would put a charting library in the
308
+ dependency graph of every app that imports a `Button`. The panel and the grid have no such
309
+ dependency and stay in the root.
310
+
311
+ `chartTokens` / `useChartTokens` hand you the `--uic-*` theme as strings a chart option can hold —
312
+ CSS custom properties do not reach inside a canvas, which is why charts are usually the one part of
313
+ a product that ignores the theme. `palette` is eight categorical colours: assign them **in order**,
314
+ one per series, and never cycle. The order is what makes them safe under colour-blind vision, and
315
+ past eight, colour has stopped encoding identity — fold the tail into one series or split the
316
+ chart. On a light surface three of the eight fall below 3:1 against white, so keep the legend or
317
+ label series directly rather than resting identity on colour alone.
318
+
319
+ Below `stackAt` (640px by default) the grid becomes one column in layout order and stops being
320
+ arrangeable: twelve columns across a phone is 32px each, and dragging a panel between cells nobody
321
+ can see is not an interaction worth keeping. Where it *is* arrangeable, the resize handle is a real
322
+ button — arrow keys resize, shift with arrow keys moves — because a board that can only be arranged
323
+ by dragging cannot be arranged by everyone.
324
+
325
+ Three pieces a board needs are stylesheet-only, with no component to import: `.uic-stat` for a
326
+ headline number, `.uic-dtable` for a result table that scrolls inside its own box, and `.uic-note`
327
+ for a panel that ran and found nothing. Compose them directly.
328
+
263
329
  ## Optional: auth client
264
330
 
265
331
  ReifyUI includes a small, framework-agnostic auth client for products whose backend exposes a JSON
package/dist/chart.cjs ADDED
@@ -0,0 +1,170 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/chart/index.js
30
+ var chart_exports = {};
31
+ __export(chart_exports, {
32
+ Chart: () => Chart,
33
+ chartTokens: () => chartTokens,
34
+ useChartTokens: () => useChartTokens
35
+ });
36
+ module.exports = __toCommonJS(chart_exports);
37
+
38
+ // src/chart/Chart.jsx
39
+ var import_react = require("react");
40
+ var import_jsx_runtime = require("react/jsx-runtime");
41
+ function Chart(props) {
42
+ const { option, renderer = "canvas", notMerge = true, onInit, label, fallback = null, className = "" } = props;
43
+ const host = (0, import_react.useRef)(null);
44
+ const inst = (0, import_react.useRef)(null);
45
+ const applied = (0, import_react.useRef)(null);
46
+ const [failed, setFailed] = (0, import_react.useState)(false);
47
+ const latest = (0, import_react.useRef)({ option, notMerge, onInit });
48
+ latest.current = { option, notMerge, onInit };
49
+ (0, import_react.useEffect)(() => {
50
+ let dead = false;
51
+ (async () => {
52
+ try {
53
+ const mod = await import("echarts");
54
+ const echarts = typeof mod.init === "function" ? mod : mod.default || mod;
55
+ if (dead || !host.current) return;
56
+ const chart = echarts.init(host.current, null, { renderer });
57
+ inst.current = chart;
58
+ const { option: opt, notMerge: nm, onInit: cb } = latest.current;
59
+ if (opt) {
60
+ chart.setOption(opt, nm);
61
+ applied.current = opt;
62
+ }
63
+ if (cb) cb(chart);
64
+ } catch {
65
+ if (!dead) setFailed(true);
66
+ }
67
+ })();
68
+ return () => {
69
+ dead = true;
70
+ try {
71
+ inst.current?.dispose();
72
+ } catch {
73
+ }
74
+ inst.current = null;
75
+ applied.current = null;
76
+ };
77
+ }, [renderer]);
78
+ (0, import_react.useEffect)(() => {
79
+ if (!inst.current || !option || applied.current === option) return;
80
+ inst.current.setOption(option, notMerge);
81
+ applied.current = option;
82
+ }, [option, notMerge]);
83
+ (0, import_react.useEffect)(() => {
84
+ const el = host.current;
85
+ if (!el || typeof ResizeObserver !== "function") return void 0;
86
+ let frame = 0;
87
+ const ro = new ResizeObserver(() => {
88
+ cancelAnimationFrame(frame);
89
+ frame = requestAnimationFrame(() => inst.current?.resize());
90
+ });
91
+ ro.observe(el);
92
+ return () => {
93
+ cancelAnimationFrame(frame);
94
+ ro.disconnect();
95
+ };
96
+ }, []);
97
+ if (failed) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: ["uic-chart", "is-unavailable", className].filter(Boolean).join(" "), children: fallback });
98
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
99
+ "div",
100
+ {
101
+ ref: host,
102
+ className: ["uic-chart", className].filter(Boolean).join(" "),
103
+ role: label ? "img" : void 0,
104
+ "aria-label": label
105
+ }
106
+ );
107
+ }
108
+
109
+ // src/chart/tokens.js
110
+ var FALLBACK = {
111
+ cat: ["#2a78d6", "#eb6834", "#1baf7a", "#eda100", "#e87ba4", "#008300", "#4a3aa7", "#e34948"],
112
+ ink: "#111317",
113
+ ink2: "#3A3D45",
114
+ mute: "#5B5D66",
115
+ line: "#DDDFE6",
116
+ lineSoft: "#EFF1F4",
117
+ surface: "#FFFFFF",
118
+ brand: "#285AFF",
119
+ ok: "#16a34a",
120
+ warn: "#F59E0B",
121
+ bad: "#b91c1c",
122
+ font: "inherit"
123
+ };
124
+ function read(style, name, fallback) {
125
+ const v = style.getPropertyValue(name).trim();
126
+ return v || fallback;
127
+ }
128
+ function chartTokens(el) {
129
+ const target = (el && el.nodeType === 1 ? el : null) || (typeof document !== "undefined" ? document.documentElement : null);
130
+ if (!target || typeof getComputedStyle !== "function") return { ...FALLBACK, palette: FALLBACK.cat };
131
+ const s = getComputedStyle(target);
132
+ return {
133
+ palette: FALLBACK.cat.map((hex, i) => read(s, `--uic-cat-${i + 1}`, hex)),
134
+ ink: read(s, "--uic-ink", FALLBACK.ink),
135
+ ink2: read(s, "--uic-ink-2", FALLBACK.ink2),
136
+ mute: read(s, "--uic-mute", FALLBACK.mute),
137
+ line: read(s, "--uic-line", FALLBACK.line),
138
+ lineSoft: read(s, "--uic-line-soft", FALLBACK.lineSoft),
139
+ surface: read(s, "--uic-surface", FALLBACK.surface),
140
+ brand: read(s, "--uic-brand", FALLBACK.brand),
141
+ ok: read(s, "--uic-ok", FALLBACK.ok),
142
+ warn: read(s, "--uic-warn", FALLBACK.warn),
143
+ bad: read(s, "--uic-fail-ink", FALLBACK.bad),
144
+ font: read(s, "--uic-font", FALLBACK.font)
145
+ };
146
+ }
147
+
148
+ // src/chart/useChartTokens.js
149
+ var import_react2 = require("react");
150
+ function useChartTokens() {
151
+ const ref = (0, import_react2.useRef)(null);
152
+ const [tokens, setTokens] = (0, import_react2.useState)(() => chartTokens(null));
153
+ const reread = (0, import_react2.useCallback)(() => setTokens(chartTokens(ref.current)), []);
154
+ (0, import_react2.useEffect)(() => {
155
+ reread();
156
+ if (typeof MutationObserver !== "function") return void 0;
157
+ const obs = new MutationObserver(reread);
158
+ const opts = { attributes: true, attributeFilter: ["class", "style", "data-theme"] };
159
+ obs.observe(document.documentElement, opts);
160
+ if (document.body) obs.observe(document.body, opts);
161
+ const mq = typeof matchMedia === "function" ? matchMedia("(prefers-color-scheme: dark)") : null;
162
+ mq?.addEventListener?.("change", reread);
163
+ return () => {
164
+ obs.disconnect();
165
+ mq?.removeEventListener?.("change", reread);
166
+ };
167
+ }, [reread]);
168
+ return [tokens, ref];
169
+ }
170
+ //# sourceMappingURL=chart.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/chart/index.js","../src/chart/Chart.jsx","../src/chart/tokens.js","../src/chart/useChartTokens.js"],"sourcesContent":["// The chart entry — IMPORT VIA SUBPATH ONLY ('reifyui/chart'), never from the root index.\n//\n// echarts is an optional peer and loads lazily inside Chart. A root re-export would put it in the\n// dependency graph of every consumer, so an app that renders a Button and no chart would have to\n// resolve a charting library to build. Same rule, same reason, as 'reifyui/slides'.\nexport { Chart } from './Chart.jsx';\n// The theme as strings a chart option can hold — series colours, axis ink, tooltip chrome. CSS\n// variables do not reach inside a canvas; these do.\nexport { chartTokens } from './tokens.js';\nexport { useChartTokens } from './useChartTokens.js';\n","// Chart — an ECharts option, drawn. That is the whole component.\n//\n// It deliberately knows nothing about series, axes or data shape: the option IS the contract, so\n// anything ECharts can draw, this draws, and the thing that decides what a chart should look like\n// (a person, or an agent writing the option) is not limited by a props table. What it does own is\n// the part every hand-rolled wrapper gets wrong: creating the instance once, disposing it on\n// unmount, and resizing it when its box changes — a chart inside a resizable panel that never\n// hears about the resize is the most common broken dashboard there is.\n//\n// echarts is an OPTIONAL peer, loaded lazily here, which is why this lives at `reifyui/chart` and\n// not in the root index — the same reason `reifyui/slides` is its own entry. An app that imports\n// a Button must not resolve a charting library.\nimport { useEffect, useRef, useState } from 'react';\n\n/**\n * option the ECharts option. Applied whenever the REFERENCE changes, so build it in a\n * useMemo — a fresh object every render redraws the chart every render\n * renderer 'canvas' (default) or 'svg'; svg stays crisp when the page is printed or scaled\n * notMerge replace the previous option rather than merging into it (default true: a redraw\n * after new data should not inherit last query's series)\n * onInit the instance, once, for the things only the instance can do (export an image)\n * label the chart's accessible name; a canvas has no text for a screen reader to find\n * fallback drawn instead when the chart code cannot be loaded at all\n */\nexport function Chart(props) {\n const { option, renderer = 'canvas', notMerge = true, onInit, label, fallback = null, className = '' } = props;\n const host = useRef(null);\n const inst = useRef(null);\n const applied = useRef(null); // the option the instance is currently showing\n const [failed, setFailed] = useState(false);\n // Read through refs inside the init effect so a new option or callback does not tear the\n // instance down and rebuild it.\n const latest = useRef({ option, notMerge, onInit });\n latest.current = { option, notMerge, onInit };\n\n useEffect(() => {\n let dead = false;\n (async () => {\n try {\n const mod = await import('echarts');\n const echarts = typeof mod.init === 'function' ? mod : (mod.default || mod);\n if (dead || !host.current) return;\n const chart = echarts.init(host.current, null, { renderer });\n inst.current = chart;\n const { option: opt, notMerge: nm, onInit: cb } = latest.current;\n if (opt) { chart.setOption(opt, nm); applied.current = opt; }\n if (cb) cb(chart);\n } catch {\n if (!dead) setFailed(true); // no chart code: say so, never draw a fake one\n }\n })();\n return () => {\n dead = true;\n try { inst.current?.dispose(); } catch { /* already gone with the DOM */ }\n inst.current = null;\n applied.current = null;\n };\n }, [renderer]);\n\n // `applied` keeps this from redrawing the option the init above just drew — the instance\n // arrives asynchronously, so both paths run on the first render that has one.\n useEffect(() => {\n if (!inst.current || !option || applied.current === option) return;\n inst.current.setOption(option, notMerge);\n applied.current = option;\n }, [option, notMerge]);\n\n useEffect(() => {\n const el = host.current;\n if (!el || typeof ResizeObserver !== 'function') return undefined;\n let frame = 0;\n const ro = new ResizeObserver(() => {\n // One resize per frame: a drag on a panel corner fires the observer on every pointer move.\n cancelAnimationFrame(frame);\n frame = requestAnimationFrame(() => inst.current?.resize());\n });\n ro.observe(el);\n return () => { cancelAnimationFrame(frame); ro.disconnect(); };\n }, []);\n\n if (failed) return <div className={['uic-chart', 'is-unavailable', className].filter(Boolean).join(' ')}>{fallback}</div>;\n return (\n <div\n ref={host}\n className={['uic-chart', className].filter(Boolean).join(' ')}\n role={label ? 'img' : undefined}\n aria-label={label}\n />\n );\n}\n","// The theme, as values a chart library can use.\n//\n// A chart draws into a canvas, where CSS custom properties do not reach: series colours, axis\n// labels and tooltip chrome all arrive as strings in an option object. Without this, every app\n// hardcodes hex in its chart code and the charts are the one part of the product that does not\n// follow the theme. Reading the same --uic-* tokens the stylesheets read keeps them together.\n\n// Same policy as the `var(--uic-x, …)` fallbacks in the stylesheets: a host that never loaded a\n// token layer still gets the library's own light palette rather than whatever the chart library\n// defaults to. Values are themes/light.css verbatim.\nconst FALLBACK = {\n cat: ['#2a78d6', '#eb6834', '#1baf7a', '#eda100', '#e87ba4', '#008300', '#4a3aa7', '#e34948'],\n ink: '#111317', ink2: '#3A3D45', mute: '#5B5D66',\n line: '#DDDFE6', lineSoft: '#EFF1F4', surface: '#FFFFFF',\n brand: '#285AFF', ok: '#16a34a', warn: '#F59E0B', bad: '#b91c1c',\n font: 'inherit',\n};\n\nfunction read(style, name, fallback) {\n const v = style.getPropertyValue(name).trim();\n return v || fallback;\n}\n\n/**\n * Resolve the chart tokens in effect for `el` — pass the element the chart lives in, so a panel\n * inside a dark region resolves the dark values even when the page is light.\n *\n * `palette` is a categorical scale: assign it IN ORDER, one colour per series, and never cycle\n * it. Past eight series, colour has stopped being an encoding — fold the tail into one \"other\"\n * series or split the chart. On a light surface three of the eight sit below 3:1 against white,\n * so identity must not rest on colour alone: keep the legend, or label the series directly.\n */\nexport function chartTokens(el) {\n const target = (el && el.nodeType === 1 ? el : null)\n || (typeof document !== 'undefined' ? document.documentElement : null);\n if (!target || typeof getComputedStyle !== 'function') return { ...FALLBACK, palette: FALLBACK.cat };\n const s = getComputedStyle(target);\n return {\n palette: FALLBACK.cat.map((hex, i) => read(s, `--uic-cat-${i + 1}`, hex)),\n ink: read(s, '--uic-ink', FALLBACK.ink),\n ink2: read(s, '--uic-ink-2', FALLBACK.ink2),\n mute: read(s, '--uic-mute', FALLBACK.mute),\n line: read(s, '--uic-line', FALLBACK.line),\n lineSoft: read(s, '--uic-line-soft', FALLBACK.lineSoft),\n surface: read(s, '--uic-surface', FALLBACK.surface),\n brand: read(s, '--uic-brand', FALLBACK.brand),\n ok: read(s, '--uic-ok', FALLBACK.ok),\n warn: read(s, '--uic-warn', FALLBACK.warn),\n bad: read(s, '--uic-fail-ink', FALLBACK.bad),\n font: read(s, '--uic-font', FALLBACK.font),\n };\n}\n","import { useCallback, useEffect, useRef, useState } from 'react';\nimport { chartTokens } from './tokens.js';\n\n/**\n * chartTokens(), re-read when the theme changes.\n *\n * A chart's colours are baked into its option at build time, so flipping light↔dark leaves every\n * chart on the page painted for the theme that is gone until something re-renders it. There is no\n * event for \"the tokens changed\", so this watches the two things that change them: the attributes\n * a theme is switched with (a class or data-* on <html>/<body>), and the OS preference.\n *\n * Returns [tokens, ref] — put the ref on the element the chart lives in, or leave it unused and\n * the document's own tokens are read.\n */\nexport function useChartTokens() {\n const ref = useRef(null);\n const [tokens, setTokens] = useState(() => chartTokens(null));\n const reread = useCallback(() => setTokens(chartTokens(ref.current)), []);\n\n useEffect(() => {\n reread();\n if (typeof MutationObserver !== 'function') return undefined;\n const obs = new MutationObserver(reread);\n const opts = { attributes: true, attributeFilter: ['class', 'style', 'data-theme'] };\n obs.observe(document.documentElement, opts);\n if (document.body) obs.observe(document.body, opts);\n const mq = typeof matchMedia === 'function' ? matchMedia('(prefers-color-scheme: dark)') : null;\n mq?.addEventListener?.('change', reread);\n return () => { obs.disconnect(); mq?.removeEventListener?.('change', reread); };\n }, [reread]);\n\n return [tokens, ref];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACYA,mBAA4C;AAoEvB;AAxDd,SAAS,MAAM,OAAO;AAC3B,QAAM,EAAE,QAAQ,WAAW,UAAU,WAAW,MAAM,QAAQ,OAAO,WAAW,MAAM,YAAY,GAAG,IAAI;AACzG,QAAM,WAAO,qBAAO,IAAI;AACxB,QAAM,WAAO,qBAAO,IAAI;AACxB,QAAM,cAAU,qBAAO,IAAI;AAC3B,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAS,KAAK;AAG1C,QAAM,aAAS,qBAAO,EAAE,QAAQ,UAAU,OAAO,CAAC;AAClD,SAAO,UAAU,EAAE,QAAQ,UAAU,OAAO;AAE5C,8BAAU,MAAM;AACd,QAAI,OAAO;AACX,KAAC,YAAY;AACX,UAAI;AACF,cAAM,MAAM,MAAM,OAAO,SAAS;AAClC,cAAM,UAAU,OAAO,IAAI,SAAS,aAAa,MAAO,IAAI,WAAW;AACvE,YAAI,QAAQ,C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AA,IAClD,OAAO,KAAK,GAAG,eAAe,SAAS,KAAK;AAAA,IAC5C,IAAI,KAAK,GAAG,YAAY,SAAS,EAAE;AAAA,IACnC,MAAM,KAAK,GAAG,cAAc,SAAS,IAAI;AAAA,IACzC,KAAK,KAAK,GAAG,kBAAkB,SAAS,GAAG;AAAA,IAC3C,MAAM,KAAK,GAAG,cAAc,SAAS,IAAI;AAAA,EAC3C;AACF;;;ACnDA,IAAAA,gBAAyD;AAclD,SAAS,iBAAiB;AAC/B,QAAM,UAAM,sBAAO,IAAI;AACvB,QAAM,CAAC,QAAQ,SAAS,QAAI,wBAAS,MAAM,YAAY,IAAI,CAAC;AAC5D,QAAM,aAAS,2BAAY,MAAM,UAAU,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;AAExE,+BAAU,MAAM;AACd,WAAO;AACP,QAAI,OAAO,qBAAqB,WAAY,QAAO;AACnD,UAAM,MAAM,IAAI,iBAAiB,MAAM;AACvC,UAAM,OAAO,EAAE,YAAY,MAAM,iBAAiB,CAAC,SAAS,SAAS,YAAY,EAAE;AACnF,QAAI,QAAQ,SAAS,iBAAiB,IAAI;AAC1C,QAAI,SAAS,KAAM,KAAI,QAAQ,SAAS,MAAM,IAAI;AAClD,UAAM,KAAK,OAAO,eAAe,aAAa,WAAW,8BAA8B,IAAI;AAC3F,QAAI,mBAAmB,UAAU,MAAM;AACvC,WAAO,MAAM;AAAE,UAAI,WAAW;AAAG,UAAI,sBAAsB,UAAU,MAAM;AAAA,IAAG;AAAA,EAChF,GAAG,CAAC,MAAM,CAAC;AAEX,SAAO,CAAC,QAAQ,GAAG;AACrB;","names":["import_react"]}
@@ -0,0 +1,57 @@
1
+ // Type declarations for `reifyui/chart`.
2
+ //
3
+ // Hand-authored, like the root index: the source is plain JSX, so there is nothing to infer from.
4
+ // The option type is deliberately open — it is ECharts' own object, and narrowing it here would
5
+ // only describe the subset that existed the day this was written.
6
+ import type { ComponentType, ReactNode, RefObject } from 'react';
7
+
8
+ /** An ECharts option object. Typed as-is: install echarts and annotate your own builders with
9
+ * `EChartsOption` if you want the full shape checked at the call site. */
10
+ export type ChartOption = Record<string, unknown>;
11
+
12
+ export interface ChartProps {
13
+ /** Applied whenever the REFERENCE changes — build it in a useMemo, or the chart redraws on
14
+ * every render of the parent. */
15
+ option: ChartOption;
16
+ /** 'svg' stays crisp when the page is printed or scaled; 'canvas' (default) draws faster. */
17
+ renderer?: 'canvas' | 'svg';
18
+ /** Replace the previous option rather than merge into it. Default true. */
19
+ notMerge?: boolean;
20
+ /** The instance, once — for what only the instance can do (getDataURL, connect, …). */
21
+ onInit?: (instance: any) => void;
22
+ /** The chart's accessible name. A canvas has no text for a screen reader to find. */
23
+ label?: string;
24
+ /** Drawn instead when the chart code cannot be loaded at all. */
25
+ fallback?: ReactNode;
26
+ className?: string;
27
+ }
28
+ /** Renders an ECharts option and nothing else: it creates the instance, disposes it, and resizes
29
+ * it with its box. Fills its container, so give it one with a height. */
30
+ export const Chart: ComponentType<ChartProps>;
31
+
32
+ /** The --uic-* theme, as strings a chart option can hold. */
33
+ export interface ChartTokens {
34
+ /** Eight categorical colours. Assign IN ORDER, one per series, and never cycle: past eight,
35
+ * colour has stopped encoding identity — fold the tail into one series or split the chart.
36
+ * On a light surface three of the eight fall below 3:1 against white, so keep the legend or
37
+ * label series directly rather than resting identity on colour alone. */
38
+ palette: string[];
39
+ ink: string;
40
+ ink2: string;
41
+ mute: string;
42
+ line: string;
43
+ lineSoft: string;
44
+ surface: string;
45
+ brand: string;
46
+ ok: string;
47
+ warn: string;
48
+ bad: string;
49
+ font: string;
50
+ }
51
+ /** Resolve the tokens in effect for `el` — pass the element the chart lives in, so a panel inside
52
+ * a dark region resolves the dark values even on a light page. */
53
+ export function chartTokens(el?: Element | null): ChartTokens;
54
+
55
+ /** chartTokens(), re-read when the theme changes (a class/data-* flip on <html> or <body>, or the
56
+ * OS preference). Put the returned ref on the element the chart lives in. */
57
+ export function useChartTokens(): [ChartTokens, RefObject<HTMLElement | null>];
package/dist/chart.js ADDED
@@ -0,0 +1,138 @@
1
+ // src/chart/Chart.jsx
2
+ import { useEffect, useRef, useState } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ function Chart(props) {
5
+ const { option, renderer = "canvas", notMerge = true, onInit, label, fallback = null, className = "" } = props;
6
+ const host = useRef(null);
7
+ const inst = useRef(null);
8
+ const applied = useRef(null);
9
+ const [failed, setFailed] = useState(false);
10
+ const latest = useRef({ option, notMerge, onInit });
11
+ latest.current = { option, notMerge, onInit };
12
+ useEffect(() => {
13
+ let dead = false;
14
+ (async () => {
15
+ try {
16
+ const mod = await import("echarts");
17
+ const echarts = typeof mod.init === "function" ? mod : mod.default || mod;
18
+ if (dead || !host.current) return;
19
+ const chart = echarts.init(host.current, null, { renderer });
20
+ inst.current = chart;
21
+ const { option: opt, notMerge: nm, onInit: cb } = latest.current;
22
+ if (opt) {
23
+ chart.setOption(opt, nm);
24
+ applied.current = opt;
25
+ }
26
+ if (cb) cb(chart);
27
+ } catch {
28
+ if (!dead) setFailed(true);
29
+ }
30
+ })();
31
+ return () => {
32
+ dead = true;
33
+ try {
34
+ inst.current?.dispose();
35
+ } catch {
36
+ }
37
+ inst.current = null;
38
+ applied.current = null;
39
+ };
40
+ }, [renderer]);
41
+ useEffect(() => {
42
+ if (!inst.current || !option || applied.current === option) return;
43
+ inst.current.setOption(option, notMerge);
44
+ applied.current = option;
45
+ }, [option, notMerge]);
46
+ useEffect(() => {
47
+ const el = host.current;
48
+ if (!el || typeof ResizeObserver !== "function") return void 0;
49
+ let frame = 0;
50
+ const ro = new ResizeObserver(() => {
51
+ cancelAnimationFrame(frame);
52
+ frame = requestAnimationFrame(() => inst.current?.resize());
53
+ });
54
+ ro.observe(el);
55
+ return () => {
56
+ cancelAnimationFrame(frame);
57
+ ro.disconnect();
58
+ };
59
+ }, []);
60
+ if (failed) return /* @__PURE__ */ jsx("div", { className: ["uic-chart", "is-unavailable", className].filter(Boolean).join(" "), children: fallback });
61
+ return /* @__PURE__ */ jsx(
62
+ "div",
63
+ {
64
+ ref: host,
65
+ className: ["uic-chart", className].filter(Boolean).join(" "),
66
+ role: label ? "img" : void 0,
67
+ "aria-label": label
68
+ }
69
+ );
70
+ }
71
+
72
+ // src/chart/tokens.js
73
+ var FALLBACK = {
74
+ cat: ["#2a78d6", "#eb6834", "#1baf7a", "#eda100", "#e87ba4", "#008300", "#4a3aa7", "#e34948"],
75
+ ink: "#111317",
76
+ ink2: "#3A3D45",
77
+ mute: "#5B5D66",
78
+ line: "#DDDFE6",
79
+ lineSoft: "#EFF1F4",
80
+ surface: "#FFFFFF",
81
+ brand: "#285AFF",
82
+ ok: "#16a34a",
83
+ warn: "#F59E0B",
84
+ bad: "#b91c1c",
85
+ font: "inherit"
86
+ };
87
+ function read(style, name, fallback) {
88
+ const v = style.getPropertyValue(name).trim();
89
+ return v || fallback;
90
+ }
91
+ function chartTokens(el) {
92
+ const target = (el && el.nodeType === 1 ? el : null) || (typeof document !== "undefined" ? document.documentElement : null);
93
+ if (!target || typeof getComputedStyle !== "function") return { ...FALLBACK, palette: FALLBACK.cat };
94
+ const s = getComputedStyle(target);
95
+ return {
96
+ palette: FALLBACK.cat.map((hex, i) => read(s, `--uic-cat-${i + 1}`, hex)),
97
+ ink: read(s, "--uic-ink", FALLBACK.ink),
98
+ ink2: read(s, "--uic-ink-2", FALLBACK.ink2),
99
+ mute: read(s, "--uic-mute", FALLBACK.mute),
100
+ line: read(s, "--uic-line", FALLBACK.line),
101
+ lineSoft: read(s, "--uic-line-soft", FALLBACK.lineSoft),
102
+ surface: read(s, "--uic-surface", FALLBACK.surface),
103
+ brand: read(s, "--uic-brand", FALLBACK.brand),
104
+ ok: read(s, "--uic-ok", FALLBACK.ok),
105
+ warn: read(s, "--uic-warn", FALLBACK.warn),
106
+ bad: read(s, "--uic-fail-ink", FALLBACK.bad),
107
+ font: read(s, "--uic-font", FALLBACK.font)
108
+ };
109
+ }
110
+
111
+ // src/chart/useChartTokens.js
112
+ import { useCallback, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
113
+ function useChartTokens() {
114
+ const ref = useRef2(null);
115
+ const [tokens, setTokens] = useState2(() => chartTokens(null));
116
+ const reread = useCallback(() => setTokens(chartTokens(ref.current)), []);
117
+ useEffect2(() => {
118
+ reread();
119
+ if (typeof MutationObserver !== "function") return void 0;
120
+ const obs = new MutationObserver(reread);
121
+ const opts = { attributes: true, attributeFilter: ["class", "style", "data-theme"] };
122
+ obs.observe(document.documentElement, opts);
123
+ if (document.body) obs.observe(document.body, opts);
124
+ const mq = typeof matchMedia === "function" ? matchMedia("(prefers-color-scheme: dark)") : null;
125
+ mq?.addEventListener?.("change", reread);
126
+ return () => {
127
+ obs.disconnect();
128
+ mq?.removeEventListener?.("change", reread);
129
+ };
130
+ }, [reread]);
131
+ return [tokens, ref];
132
+ }
133
+ export {
134
+ Chart,
135
+ chartTokens,
136
+ useChartTokens
137
+ };
138
+ //# sourceMappingURL=chart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/chart/Chart.jsx","../src/chart/tokens.js","../src/chart/useChartTokens.js"],"sourcesContent":["// Chart — an ECharts option, drawn. That is the whole component.\n//\n// It deliberately knows nothing about series, axes or data shape: the option IS the contract, so\n// anything ECharts can draw, this draws, and the thing that decides what a chart should look like\n// (a person, or an agent writing the option) is not limited by a props table. What it does own is\n// the part every hand-rolled wrapper gets wrong: creating the instance once, disposing it on\n// unmount, and resizing it when its box changes — a chart inside a resizable panel that never\n// hears about the resize is the most common broken dashboard there is.\n//\n// echarts is an OPTIONAL peer, loaded lazily here, which is why this lives at `reifyui/chart` and\n// not in the root index — the same reason `reifyui/slides` is its own entry. An app that imports\n// a Button must not resolve a charting library.\nimport { useEffect, useRef, useState } from 'react';\n\n/**\n * option the ECharts option. Applied whenever the REFERENCE changes, so build it in a\n * useMemo — a fresh object every render redraws the chart every render\n * renderer 'canvas' (default) or 'svg'; svg stays crisp when the page is printed or scaled\n * notMerge replace the previous option rather than merging into it (default true: a redraw\n * after new data should not inherit last query's series)\n * onInit the instance, once, for the things only the instance can do (export an image)\n * label the chart's accessible name; a canvas has no text for a screen reader to find\n * fallback drawn instead when the chart code cannot be loaded at all\n */\nexport function Chart(props) {\n const { option, renderer = 'canvas', notMerge = true, onInit, label, fallback = null, className = '' } = props;\n const host = useRef(null);\n const inst = useRef(null);\n const applied = useRef(null); // the option the instance is currently showing\n const [failed, setFailed] = useState(false);\n // Read through refs inside the init effect so a new option or callback does not tear the\n // instance down and rebuild it.\n const latest = useRef({ option, notMerge, onInit });\n latest.current = { option, notMerge, onInit };\n\n useEffect(() => {\n let dead = false;\n (async () => {\n try {\n const mod = await import('echarts');\n const echarts = typeof mod.init === 'function' ? mod : (mod.default || mod);\n if (dead || !host.current) return;\n const chart = echarts.init(host.current, null, { renderer });\n inst.current = chart;\n const { option: opt, notMerge: nm, onInit: cb } = latest.current;\n if (opt) { chart.setOption(opt, nm); applied.current = opt; }\n if (cb) cb(chart);\n } catch {\n if (!dead) setFailed(true); // no chart code: say so, never draw a fake one\n }\n })();\n return () => {\n dead = true;\n try { inst.current?.dispose(); } catch { /* already gone with the DOM */ }\n inst.current = null;\n applied.current = null;\n };\n }, [renderer]);\n\n // `applied` keeps this from redrawing the option the init above just drew — the instance\n // arrives asynchronously, so both paths run on the first render that has one.\n useEffect(() => {\n if (!inst.current || !option || applied.current === option) return;\n inst.current.setOption(option, notMerge);\n applied.current = option;\n }, [option, notMerge]);\n\n useEffect(() => {\n const el = host.current;\n if (!el || typeof ResizeObserver !== 'function') return undefined;\n let frame = 0;\n const ro = new ResizeObserver(() => {\n // One resize per frame: a drag on a panel corner fires the observer on every pointer move.\n cancelAnimationFrame(frame);\n frame = requestAnimationFrame(() => inst.current?.resize());\n });\n ro.observe(el);\n return () => { cancelAnimationFrame(frame); ro.disconnect(); };\n }, []);\n\n if (failed) return <div className={['uic-chart', 'is-unavailable', className].filter(Boolean).join(' ')}>{fallback}</div>;\n return (\n <div\n ref={host}\n className={['uic-chart', className].filter(Boolean).join(' ')}\n role={label ? 'img' : undefined}\n aria-label={label}\n />\n );\n}\n","// The theme, as values a chart library can use.\n//\n// A chart draws into a canvas, where CSS custom properties do not reach: series colours, axis\n// labels and tooltip chrome all arrive as strings in an option object. Without this, every app\n// hardcodes hex in its chart code and the charts are the one part of the product that does not\n// follow the theme. Reading the same --uic-* tokens the stylesheets read keeps them together.\n\n// Same policy as the `var(--uic-x, …)` fallbacks in the stylesheets: a host that never loaded a\n// token layer still gets the library's own light palette rather than whatever the chart library\n// defaults to. Values are themes/light.css verbatim.\nconst FALLBACK = {\n cat: ['#2a78d6', '#eb6834', '#1baf7a', '#eda100', '#e87ba4', '#008300', '#4a3aa7', '#e34948'],\n ink: '#111317', ink2: '#3A3D45', mute: '#5B5D66',\n line: '#DDDFE6', lineSoft: '#EFF1F4', surface: '#FFFFFF',\n brand: '#285AFF', ok: '#16a34a', warn: '#F59E0B', bad: '#b91c1c',\n font: 'inherit',\n};\n\nfunction read(style, name, fallback) {\n const v = style.getPropertyValue(name).trim();\n return v || fallback;\n}\n\n/**\n * Resolve the chart tokens in effect for `el` — pass the element the chart lives in, so a panel\n * inside a dark region resolves the dark values even when the page is light.\n *\n * `palette` is a categorical scale: assign it IN ORDER, one colour per series, and never cycle\n * it. Past eight series, colour has stopped being an encoding — fold the tail into one \"other\"\n * series or split the chart. On a light surface three of the eight sit below 3:1 against white,\n * so identity must not rest on colour alone: keep the legend, or label the series directly.\n */\nexport function chartTokens(el) {\n const target = (el && el.nodeType === 1 ? el : null)\n || (typeof document !== 'undefined' ? document.documentElement : null);\n if (!target || typeof getComputedStyle !== 'function') return { ...FALLBACK, palette: FALLBACK.cat };\n const s = getComputedStyle(target);\n return {\n palette: FALLBACK.cat.map((hex, i) => read(s, `--uic-cat-${i + 1}`, hex)),\n ink: read(s, '--uic-ink', FALLBACK.ink),\n ink2: read(s, '--uic-ink-2', FALLBACK.ink2),\n mute: read(s, '--uic-mute', FALLBACK.mute),\n line: read(s, '--uic-line', FALLBACK.line),\n lineSoft: read(s, '--uic-line-soft', FALLBACK.lineSoft),\n surface: read(s, '--uic-surface', FALLBACK.surface),\n brand: read(s, '--uic-brand', FALLBACK.brand),\n ok: read(s, '--uic-ok', FALLBACK.ok),\n warn: read(s, '--uic-warn', FALLBACK.warn),\n bad: read(s, '--uic-fail-ink', FALLBACK.bad),\n font: read(s, '--uic-font', FALLBACK.font),\n };\n}\n","import { useCallback, useEffect, useRef, useState } from 'react';\nimport { chartTokens } from './tokens.js';\n\n/**\n * chartTokens(), re-read when the theme changes.\n *\n * A chart's colours are baked into its option at build time, so flipping light↔dark leaves every\n * chart on the page painted for the theme that is gone until something re-renders it. There is no\n * event for \"the tokens changed\", so this watches the two things that change them: the attributes\n * a theme is switched with (a class or data-* on <html>/<body>), and the OS preference.\n *\n * Returns [tokens, ref] — put the ref on the element the chart lives in, or leave it unused and\n * the document's own tokens are read.\n */\nexport function useChartTokens() {\n const ref = useRef(null);\n const [tokens, setTokens] = useState(() => chartTokens(null));\n const reread = useCallback(() => setTokens(chartTokens(ref.current)), []);\n\n useEffect(() => {\n reread();\n if (typeof MutationObserver !== 'function') return undefined;\n const obs = new MutationObserver(reread);\n const opts = { attributes: true, attributeFilter: ['class', 'style', 'data-theme'] };\n obs.observe(document.documentElement, opts);\n if (document.body) obs.observe(document.body, opts);\n const mq = typeof matchMedia === 'function' ? matchMedia('(prefers-color-scheme: dark)') : null;\n mq?.addEventListener?.('change', reread);\n return () => { obs.disconnect(); mq?.removeEventListener?.('change', reread); };\n }, [reread]);\n\n return [tokens, ref];\n}\n"],"mappings":";AAYA,SAAS,WAAW,QAAQ,gBAAgB;AAoEvB;AAxDd,SAAS,MAAM,OAAO;AAC3B,QAAM,EAAE,QAAQ,WAAW,UAAU,WAAW,MAAM,QAAQ,OAAO,WAAW,MAAM,YAAY,GAAG,IAAI;AACzG,QAAM,OAAO,OAAO,IAAI;AACxB,QAAM,OAAO,OAAO,IAAI;AACxB,QAAM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