@ponchia/ui 0.4.1 → 0.6.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 +552 -8
- package/MIGRATIONS.json +106 -0
- package/README.md +34 -8
- package/annotations/index.d.ts +402 -0
- package/annotations/index.d.ts.map +1 -0
- package/annotations/index.js +792 -0
- package/behaviors/carousel.js +198 -0
- package/behaviors/combobox.js +226 -0
- package/behaviors/command.js +190 -0
- package/behaviors/connectors.js +95 -0
- package/behaviors/crosshair.js +57 -0
- package/behaviors/dialog.js +74 -0
- package/behaviors/disclosure.js +26 -0
- package/behaviors/dismissible.js +25 -0
- package/behaviors/forms.js +186 -0
- package/behaviors/glyph.js +108 -0
- package/behaviors/index.d.ts +79 -0
- package/behaviors/index.js +18 -1409
- package/behaviors/internal.js +97 -0
- package/behaviors/legend.js +67 -0
- package/behaviors/menu.js +47 -0
- package/behaviors/popover.js +179 -0
- package/behaviors/spotlight.js +52 -0
- package/behaviors/table.js +136 -0
- package/behaviors/tabs.js +103 -0
- package/behaviors/theme.js +84 -0
- package/behaviors/toast.js +164 -0
- package/classes/classes.json +1857 -0
- package/classes/index.d.ts +306 -13
- package/classes/index.js +339 -12
- package/classes/vscode.css-custom-data.json +12 -0
- package/connectors/index.d.ts +191 -0
- package/connectors/index.d.ts.map +1 -0
- package/connectors/index.js +275 -0
- package/css/analytical.css +21 -0
- package/css/annotations.css +292 -0
- package/css/app.css +43 -13
- package/css/base.css +15 -10
- package/css/command.css +97 -0
- package/css/connectors.css +110 -0
- package/css/content.css +7 -1
- package/css/crosshair.css +100 -0
- package/css/dataviz.css +5 -1
- package/css/disclosure.css +38 -6
- package/css/dots.css +57 -0
- package/css/feedback.css +111 -2
- package/css/fonts.css +11 -7
- package/css/forms.css +42 -1
- package/css/generated.css +117 -0
- package/css/legend.css +272 -0
- package/css/marks.css +174 -0
- package/css/motion.css +24 -44
- package/css/navigation.css +7 -0
- package/css/overlay.css +31 -1
- package/css/primitives.css +109 -5
- package/css/report.css +39 -81
- package/css/selection.css +46 -0
- package/css/site.css +16 -2
- package/css/sources.css +221 -0
- package/css/spotlight.css +104 -0
- package/css/state.css +121 -0
- package/css/tokens.css +60 -37
- package/css/workbench.css +83 -0
- package/dist/bronto.css +1 -1
- package/dist/css/analytical.css +1 -0
- package/dist/css/annotations.css +1 -0
- package/dist/css/app.css +1 -1
- package/dist/css/base.css +1 -1
- package/dist/css/command.css +1 -0
- package/dist/css/connectors.css +1 -0
- package/dist/css/content.css +1 -1
- package/dist/css/crosshair.css +1 -0
- package/dist/css/disclosure.css +1 -1
- package/dist/css/dots.css +1 -1
- package/dist/css/feedback.css +1 -1
- package/dist/css/fonts.css +1 -1
- package/dist/css/forms.css +1 -1
- package/dist/css/generated.css +1 -0
- package/dist/css/legend.css +1 -0
- package/dist/css/marks.css +1 -0
- package/dist/css/motion.css +1 -1
- package/dist/css/navigation.css +1 -1
- package/dist/css/overlay.css +1 -1
- package/dist/css/primitives.css +1 -1
- package/dist/css/report.css +1 -1
- package/dist/css/selection.css +1 -0
- package/dist/css/site.css +1 -1
- package/dist/css/sources.css +1 -0
- package/dist/css/spotlight.css +1 -0
- package/dist/css/state.css +1 -0
- package/dist/css/tokens.css +1 -1
- package/dist/css/workbench.css +1 -0
- package/docs/adr/0003-theme-model.md +7 -4
- package/docs/annotations.md +425 -0
- package/docs/architecture.md +246 -0
- package/docs/command.md +95 -0
- package/docs/connectors.md +91 -0
- package/docs/contrast.md +116 -92
- package/docs/crosshair.md +63 -0
- package/docs/d2.md +195 -0
- package/docs/generated.md +91 -0
- package/docs/legends.md +184 -0
- package/docs/marks.md +93 -0
- package/docs/mermaid.md +152 -0
- package/docs/reference.md +385 -23
- package/docs/reporting.md +436 -63
- package/docs/selection.md +40 -0
- package/docs/sources.md +137 -0
- package/docs/spotlight.md +78 -0
- package/docs/stability.md +24 -2
- package/docs/state.md +85 -0
- package/docs/usage.md +123 -4
- package/docs/vega.md +225 -0
- package/docs/workbench.md +78 -0
- package/fonts/doto-400.woff2 +0 -0
- package/fonts/doto-500.woff2 +0 -0
- package/fonts/doto-600.woff2 +0 -0
- package/fonts/doto-700.woff2 +0 -0
- package/fonts/doto-800.woff2 +0 -0
- package/fonts/doto-900.woff2 +0 -0
- package/glyphs/glyphs.js +6 -4
- package/llms.txt +362 -14
- package/package.json +115 -12
- package/qwik/index.d.ts +42 -54
- package/qwik/index.d.ts.map +1 -0
- package/qwik/index.js +75 -3
- package/react/index.d.ts +39 -56
- package/react/index.d.ts.map +1 -0
- package/react/index.js +67 -3
- package/solid/index.d.ts +64 -56
- package/solid/index.d.ts.map +1 -0
- package/solid/index.js +70 -3
- package/tokens/d2.d.ts +38 -0
- package/tokens/d2.js +71 -0
- package/tokens/d2.json +43 -0
- package/tokens/index.d.ts +5 -5
- package/tokens/index.js +23 -5
- package/tokens/index.json +9 -0
- package/tokens/mermaid.d.ts +23 -0
- package/tokens/mermaid.js +181 -0
- package/tokens/mermaid.json +163 -0
- package/tokens/resolved.json +45 -1
- package/tokens/skins.js +3 -2
- package/tokens/tokens.dtcg.json +26 -0
- package/tokens/vega.d.ts +34 -0
- package/tokens/vega.js +155 -0
- package/tokens/vega.json +179 -0
- package/fonts/doto-400.ttf +0 -0
- package/fonts/doto-500.ttf +0 -0
- package/fonts/doto-600.ttf +0 -0
- package/fonts/doto-700.ttf +0 -0
- package/fonts/doto-800.ttf +0 -0
- package/fonts/doto-900.ttf +0 -0
package/docs/reporting.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Static reports
|
|
2
2
|
|
|
3
3
|
`@ponchia/ui` can dress static, LLM-authored HTML reports without a component
|
|
4
|
-
runtime. Load the normal bundle, then opt in to the report layer
|
|
5
|
-
|
|
4
|
+
runtime. Load the normal bundle, then opt in to the report layer, chart palette,
|
|
5
|
+
and annotation layer only when the report needs them.
|
|
6
6
|
|
|
7
7
|
In a bundled app, package specifiers are fine because Vite or another bundler
|
|
8
8
|
rewrites them:
|
|
@@ -11,26 +11,73 @@ rewrites them:
|
|
|
11
11
|
@import '@ponchia/ui';
|
|
12
12
|
@import '@ponchia/ui/css/report.css';
|
|
13
13
|
@import '@ponchia/ui/css/dataviz.css';
|
|
14
|
+
@import '@ponchia/ui/css/annotations.css';
|
|
15
|
+
@import '@ponchia/ui/css/legend.css';
|
|
14
16
|
```
|
|
15
17
|
|
|
18
|
+
**`dist/bronto.css` is the standard component set only — it does NOT contain
|
|
19
|
+
the report, chart, annotation, or legend layers.** Those are opt-in leaves
|
|
20
|
+
under `dist/css/`; a report links the default bundle *and* each leaf it uses.
|
|
21
|
+
Forgetting them is the most common way an LLM-emitted report renders unstyled.
|
|
22
|
+
|
|
16
23
|
For standalone browser HTML, use real stylesheet URLs. Package specifiers like
|
|
17
|
-
`@ponchia/ui/css/report.css` do not resolve in a saved `.html` file
|
|
24
|
+
`@ponchia/ui/css/report.css` do not resolve in a saved `.html` file — and note
|
|
25
|
+
the path is `dist/css/`, the built leaf, not the source `css/`:
|
|
18
26
|
|
|
19
27
|
```html
|
|
28
|
+
<!-- installed locally -->
|
|
20
29
|
<link rel="stylesheet" href="./node_modules/@ponchia/ui/dist/bronto.css" />
|
|
21
30
|
<link rel="stylesheet" href="./node_modules/@ponchia/ui/dist/css/report.css" />
|
|
22
31
|
<link rel="stylesheet" href="./node_modules/@ponchia/ui/dist/css/dataviz.css" />
|
|
32
|
+
<link rel="stylesheet" href="./node_modules/@ponchia/ui/dist/css/annotations.css" />
|
|
33
|
+
<link rel="stylesheet" href="./node_modules/@ponchia/ui/dist/css/legend.css" />
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
No install? Link the same files from a CDN. Pin the version — pre-1.0, breaking
|
|
37
|
+
changes ship in the minor (see [stability.md](./stability.md)):
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ponchia/ui@0.6.0/dist/bronto.css" />
|
|
41
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ponchia/ui@0.6.0/dist/css/report.css" />
|
|
42
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ponchia/ui@0.6.0/dist/css/dataviz.css" />
|
|
43
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ponchia/ui@0.6.0/dist/css/annotations.css" />
|
|
44
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ponchia/ui@0.6.0/dist/css/legend.css" />
|
|
23
45
|
```
|
|
24
46
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
47
|
+
The CDN serves the package's own `fonts/` next to the CSS, so font URLs resolve
|
|
48
|
+
with no extra setup. If instead you copy the built CSS next to the report, keep
|
|
49
|
+
the same relationship between `dist/bronto.css`, the `dist/css/*` leaves, and
|
|
50
|
+
`fonts/` so the relative font URLs continue to resolve.
|
|
28
51
|
|
|
29
52
|
The report layer is static and PDF-first. It does not initialize behaviors and
|
|
30
53
|
does not sanitize content. If a report includes arbitrary LLM, CMS, or user HTML,
|
|
31
54
|
sanitize that content before rendering it and do not initialize
|
|
32
55
|
`data-bronto-*` behaviors on the generated region.
|
|
33
56
|
|
|
57
|
+
## The analytical toolbox in a report
|
|
58
|
+
|
|
59
|
+
`css/report.css` gives you the document grammar (covers, sections, findings,
|
|
60
|
+
evidence). The _content_ inside those sections is where the rest of the
|
|
61
|
+
analytical layer earns its place. Each one is an opt-in import that stays out of
|
|
62
|
+
the default bundle — add the leaves a given report actually needs, or pull the
|
|
63
|
+
whole set with `@ponchia/ui/css/analytical.css`. Reach for:
|
|
64
|
+
|
|
65
|
+
| Layer | Import | Reach for it when… |
|
|
66
|
+
| --- | --- | --- |
|
|
67
|
+
| **Marks** (`.ui-mark`, `.ui-bracket-note`) | `css/marks.css` | You want to emphasise a phrase _in prose_ — a highlight on the finding, an underline on a risk, or a bracket around an evidence/caveat passage. The inline counterpart to annotations. See [marks.md](./marks.md). |
|
|
68
|
+
| **Sources / provenance** (`.ui-citation`, `.ui-source-card`, `.ui-source-list`, `.ui-provenance`) | `css/sources.css` | The report makes claims a reader will question — "where did this come from?". A CSS-only trust layer whose cross-cutting state modifier (`.ui-src--verified`, plus reviewed / generated / unverified / stale / conflict) sets a rationed tone, always paired with a written label, never colour alone. See [sources.md](./sources.md). |
|
|
69
|
+
| **Annotations** (`.ui-annotation*`) | `css/annotations.css` | A figure needs an explicit callout — a peak, a limit, a watched region — or a small decorative margin mark. SVG only. See [annotations.md](./annotations.md) and the [off-chart + scaling notes](./annotations.md#using-annotations-off-chart) before you size one. |
|
|
70
|
+
| **Legends / data keys** (`.ui-legend*`) | `css/legend.css` | A chart figure needs a colour key. WCAG 1.4.1 by construction. See [legends.md](./legends.md). |
|
|
71
|
+
| **Mermaid theme** (`@ponchia/ui/mermaid`) | _(JS/JSON, no CSS)_ | The report embeds a [Mermaid](https://mermaid.js.org) diagram (flowchart, sequence, pie…) and you want it on-brand instead of generic. A resolved `base` theme projected from the same tokens as `charts.json`; annotate the rendered SVG with the annotation layer. See [mermaid.md](./mermaid.md). |
|
|
72
|
+
| **D2 theme** (`@ponchia/ui/d2`) | _(JS/JSON, no CSS)_ | The report embeds a [D2](https://d2lang.com) diagram and you want it on-brand. Resolved theme-override slots (monochrome base + one rationed accent) projected from the same tokens; annotate the rendered SVG. See [d2.md](./d2.md). |
|
|
73
|
+
| **Generated-content trust** (`.ui-generated`, `.ui-origin-label`, `.ui-reasoning`, `.ui-tool-log`) | `css/generated.css` | The report (or a section of it) is AI/system-authored and should _say so_ — an origin label plus quiet, collapsible reasoning / tool-call logs. Pairs with the sources layer. See [generated.md](./generated.md). |
|
|
74
|
+
| **Lifecycle / system state** (`.ui-state`, `.ui-syncbar`) | `css/state.css` | A status report needs to show the state a thing is in — saving / queued / stale / conflict / reviewed — as a labelled object, not a bare coloured dot. See [state.md](./state.md). |
|
|
75
|
+
|
|
76
|
+
These compose with the report-native primitives already called out in
|
|
77
|
+
[Composition rules](#composition-rules): `ui-statgrid`, `ui-alert`, `ui-table`,
|
|
78
|
+
`ui-timeline`, `ui-meter`, and `ui-num`. None of them require behavior JS, so
|
|
79
|
+
they are all safe in the static, PDF-first report path.
|
|
80
|
+
|
|
34
81
|
## Canonical skeleton
|
|
35
82
|
|
|
36
83
|
```html
|
|
@@ -89,7 +136,7 @@ sanitize that content before rendering it and do not initialize
|
|
|
89
136
|
below, which only shrinks the cover.
|
|
90
137
|
- Use `ui-report__cover` for title, subtitle, author/date, and generation
|
|
91
138
|
metadata. Add `ui-report__cover--compact` for short screen-first reports.
|
|
92
|
-
Use `ui-
|
|
139
|
+
Use `ui-report__head` for a compact in-page header instead of a full cover
|
|
93
140
|
(same role, no tall hero block). Author `ui-report__meta` as a `<ul>` — the
|
|
94
141
|
facts it lists are unordered.
|
|
95
142
|
- Use `ui-report__section` and `ui-report__section-head` for report chapters.
|
|
@@ -120,77 +167,278 @@ sanitize that content before rendering it and do not initialize
|
|
|
120
167
|
inside `ui-prose`; use `.ui-table` for curated evidence tables. If a
|
|
121
168
|
`ui-report__evidence` block contains only a `ui-table-wrap`, the report layer
|
|
122
169
|
removes the inner frame so evidence tables do not look double-boxed.
|
|
123
|
-
- Every `<figure>` should include a `figcaption` using
|
|
124
|
-
`ui-chart__caption` (chart figures) or `ui-report__caption` (any other
|
|
125
|
-
report figure); the two are interchangeable in style.
|
|
170
|
+
- Every `<figure>` should include a `figcaption` using `ui-report__caption`.
|
|
126
171
|
- Do not use raw color values. Theme with `--accent`; use status tones for
|
|
127
172
|
status; use chart tokens only in chart figures.
|
|
128
173
|
|
|
174
|
+
## Numbers and dates
|
|
175
|
+
|
|
176
|
+
The framework **aligns** figures; it does not **format** them. `.is-num` (table
|
|
177
|
+
cells) and `ui-num` (standalone) give tabular figures and end-alignment so a
|
|
178
|
+
column lines up — but a raw `1240` or `2026-6-1` still reads as machine output.
|
|
179
|
+
Format the values yourself, before they reach the markup:
|
|
180
|
+
|
|
181
|
+
- **Numbers** — group thousands and fix the precision. In JS,
|
|
182
|
+
`new Intl.NumberFormat('en-US').format(1240)` → `1,240`;
|
|
183
|
+
`{ style: 'currency', currency: 'USD' }` → `$1,240.00`;
|
|
184
|
+
`{ style: 'percent', maximumFractionDigits: 1 }` for rates;
|
|
185
|
+
`{ notation: 'compact' }` → `1.2M` for headline KPIs. Pick one locale and
|
|
186
|
+
precision per report and apply it consistently.
|
|
187
|
+
- **Dates** — render a human label but keep the machine value in a
|
|
188
|
+
`<time datetime="…">` (ISO-8601), as the report skeleton and `ui-timeline`
|
|
189
|
+
already do. `new Intl.DateTimeFormat('en-US', { dateStyle: 'medium' })`
|
|
190
|
+
→ `Jun 1, 2026`.
|
|
191
|
+
- **Signs and units** — write the sign and unit into the text (`+1`, `−3.2%`,
|
|
192
|
+
`18 h`); never rely on a tone or arrow alone to say "down" (WCAG 1.4.1).
|
|
193
|
+
- Keep a column's precision uniform so the tabular alignment actually reads.
|
|
194
|
+
|
|
195
|
+
A non-JS host formats with its own locale library (Python `babel`, Go
|
|
196
|
+
`golang.org/x/text/message`, etc.) and emits the finished strings — bronto only
|
|
197
|
+
styles them.
|
|
198
|
+
|
|
199
|
+
## Trend deltas
|
|
200
|
+
|
|
201
|
+
For a standalone change indicator (a KPI's movement, a row's quarter-over-quarter
|
|
202
|
+
shift), use `ui-delta`. A direction modifier sets both the arrow glyph — the
|
|
203
|
+
non-colour channel — and the conventional tone:
|
|
204
|
+
|
|
205
|
+
```html
|
|
206
|
+
<span class="ui-delta ui-delta--up">+12.4%</span>
|
|
207
|
+
<span class="ui-delta ui-delta--down">−3</span>
|
|
208
|
+
<span class="ui-delta ui-delta--flat">0</span>
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Direction tone follows the common case (up = good, green; down = bad, red). When
|
|
212
|
+
**up is the bad direction** — latency, error rate, cost, churn — add
|
|
213
|
+
`ui-delta--invert` to swap only the tone; the arrow still reports real direction:
|
|
214
|
+
|
|
215
|
+
```html
|
|
216
|
+
<span class="ui-delta ui-delta--up ui-delta--invert">+48 ms p95</span>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
The arrow is visual; always include the number and unit in the text.
|
|
220
|
+
|
|
221
|
+
A stat card's own `ui-stat__delta is-pos` / `is-neg` carries **tone only** (good
|
|
222
|
+
vs bad, as colour). That is fine on screen, but tone is a single channel: in a
|
|
223
|
+
greyscale PDF or for a colour-blind reader a positive and a negative delta look
|
|
224
|
+
identical, and the tone is deliberately decoupled from direction (a *dropped*
|
|
225
|
+
latency is `is-pos`). When the change must read without colour — most printed
|
|
226
|
+
reports — prefer `ui-delta` for the card's delta line, because its `--up`/`--down`
|
|
227
|
+
arrow is a real non-colour channel:
|
|
228
|
+
|
|
229
|
+
```html
|
|
230
|
+
<span class="ui-stat__label">p95 latency</span>
|
|
231
|
+
<span class="ui-stat__value">172 ms</span>
|
|
232
|
+
<span class="ui-delta ui-delta--down ui-delta--invert">−48 ms</span>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Here the arrow points **down** (latency fell) while `--invert` keeps the tone
|
|
236
|
+
green (down is good) — both channels stay honest. Reach for `ui-stat__delta` only
|
|
237
|
+
when a bare tonal accent is enough.
|
|
238
|
+
|
|
239
|
+
## Comparison layout
|
|
240
|
+
|
|
241
|
+
For an "A vs B" or before/after section, use `ui-compare` — a fluid grid that
|
|
242
|
+
wraps to a single stack on a narrow screen, so two panels never overflow.
|
|
243
|
+
`ui-compare__col` is one side; label it with `ui-compare__head`. Add
|
|
244
|
+
`ui-compare--2up` to pin exactly two equal columns for a hard pairing.
|
|
245
|
+
|
|
246
|
+
```html
|
|
247
|
+
<div class="ui-compare ui-compare--2up">
|
|
248
|
+
<div class="ui-compare__col">
|
|
249
|
+
<p class="ui-compare__head">Before</p>
|
|
250
|
+
<div class="ui-statgrid">
|
|
251
|
+
<div class="ui-stat">
|
|
252
|
+
<span class="ui-stat__label">p95 latency</span>
|
|
253
|
+
<span class="ui-stat__value">220 ms</span>
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
<div class="ui-compare__col">
|
|
258
|
+
<p class="ui-compare__head">After</p>
|
|
259
|
+
<div class="ui-statgrid">
|
|
260
|
+
<div class="ui-stat">
|
|
261
|
+
<span class="ui-stat__label">p95 latency</span>
|
|
262
|
+
<span class="ui-stat__value">172 ms</span>
|
|
263
|
+
<span class="ui-stat__delta is-pos">−48 ms</span>
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
```
|
|
269
|
+
|
|
129
270
|
## Chart figure recipe
|
|
130
271
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
272
|
+
bronto ships **no chart component** — a chart needs scales and data binding, the
|
|
273
|
+
two things the analytical layer [refuses to own](./architecture.md). It supplies
|
|
274
|
+
the figure frame, the data key, and the colour palette; the chart itself comes
|
|
275
|
+
from one of two routes:
|
|
276
|
+
|
|
277
|
+
- **Live, interactive, or many-series** — theme [Vega-Lite](./vega.md):
|
|
278
|
+
`brontoVegaConfig(theme)` (from `@ponchia/ui/vega`) returns an on-brand
|
|
279
|
+
Vega-Lite `config` you spread into a spec and hand to vega-embed. Vega renders
|
|
280
|
+
the SVG/canvas; bronto only paints it. See [vega.md](./vega.md) for the full
|
|
281
|
+
recipe and the resolved `@ponchia/ui/vega.json` for non-JS hosts.
|
|
282
|
+
- **Frozen, print, or zero-JS** — hand-author a token-themed inline `<svg>`,
|
|
283
|
+
painting marks from the `--chart-N` palette so the figure prints exactly and
|
|
284
|
+
carries no runtime.
|
|
285
|
+
|
|
286
|
+
Whichever route, the figure frame is the same: wrap it in `ui-report__figure`,
|
|
287
|
+
caption it with `ui-report__caption`, give it the standalone, portable
|
|
288
|
+
`.ui-legend` data key (`@ponchia/ui/css/legend.css` — see
|
|
289
|
+
[legends.md](./legends.md)), and pair every colour with a direct label, a
|
|
290
|
+
pattern, **and** a fallback `ui-table` so the figure survives mono print and
|
|
291
|
+
colour-vision deficiency.
|
|
292
|
+
|
|
293
|
+
A Vega-Lite figure. The live mount is **`ui-screen-only`** and the fallback
|
|
294
|
+
`ui-table` carries the data into print — a live chart bakes the on-screen theme
|
|
295
|
+
into its SVG/canvas at render time, so printing it would emit a dark-baked chart
|
|
296
|
+
on white paper. Print the table; keep the chart for screen:
|
|
134
297
|
|
|
135
298
|
```html
|
|
136
|
-
<figure class="ui-report__figure
|
|
137
|
-
<figcaption id="chart-title" class="ui-
|
|
299
|
+
<figure class="ui-report__figure" role="group" aria-labelledby="chart-title">
|
|
300
|
+
<figcaption id="chart-title" class="ui-report__caption">
|
|
138
301
|
Fig 1 - Weekly focus split
|
|
139
302
|
</figcaption>
|
|
140
|
-
<
|
|
141
|
-
<
|
|
303
|
+
<div id="focus-chart" class="ui-screen-only" style="min-block-size: 240px">
|
|
304
|
+
<noscript>Chart needs JavaScript — the data is in the table below.</noscript>
|
|
305
|
+
</div>
|
|
306
|
+
<div class="ui-table-wrap">
|
|
307
|
+
<table class="ui-table ui-table--dense">
|
|
308
|
+
<caption>Chart source data</caption>
|
|
309
|
+
<thead>
|
|
310
|
+
<tr><th>Series</th><th class="is-num">Hours</th></tr>
|
|
311
|
+
</thead>
|
|
312
|
+
<tbody>
|
|
313
|
+
<tr><td>Research</td><td class="is-num">18</td></tr>
|
|
314
|
+
<tr><td>Delivery</td><td class="is-num">11</td></tr>
|
|
315
|
+
</tbody>
|
|
316
|
+
</table>
|
|
317
|
+
</div>
|
|
318
|
+
</figure>
|
|
319
|
+
<script type="module">
|
|
320
|
+
import vegaEmbed from 'vega-embed';
|
|
321
|
+
import { brontoVegaConfig } from '@ponchia/ui/vega';
|
|
322
|
+
const theme = document.documentElement.dataset.theme === 'dark' ? 'dark' : 'light';
|
|
323
|
+
vegaEmbed('#focus-chart', {
|
|
324
|
+
data: { values: [
|
|
325
|
+
{ series: 'Research', hours: 18 },
|
|
326
|
+
{ series: 'Delivery', hours: 11 },
|
|
327
|
+
] },
|
|
328
|
+
mark: 'bar',
|
|
329
|
+
encoding: {
|
|
330
|
+
x: { field: 'series', type: 'nominal' },
|
|
331
|
+
y: { field: 'hours', type: 'quantitative' },
|
|
332
|
+
},
|
|
333
|
+
}, { config: brontoVegaConfig(theme), renderer: 'svg', actions: false });
|
|
334
|
+
</script>
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Give the mount a `min-block-size` so the figure is not a collapsed blank band
|
|
338
|
+
before the chart paints (or while JS is blocked), and pass **`renderer: 'svg'`**
|
|
339
|
+
(vega-embed defaults to `canvas`, which doesn't theme-inspect and prints as a
|
|
340
|
+
raster).
|
|
341
|
+
|
|
342
|
+
> The bare-specifier `import`s above assume a **build step** (or an import map),
|
|
343
|
+
> and even then `import`/`fetch` of the config only works over an `http(s)`
|
|
344
|
+
> origin. A static report **opened from disk (`file://`) cannot import the module
|
|
345
|
+
> nor fetch `vega.json`** (CORS) — load Vega + Vega-Lite + vega-embed from pinned
|
|
346
|
+
> `/build/*.min.js` CDN tags and **inline the resolved `config` object**, the
|
|
347
|
+
> file://-safe recipe in [vega.md](./vega.md#from-a-cdn-no-bundler). For a report
|
|
348
|
+
> you intend to **print/PDF**, prefer the frozen inline `<svg>` below — it has no
|
|
349
|
+
> runtime, prints exactly, and sidesteps all of this.
|
|
350
|
+
|
|
351
|
+
A frozen, token-themed inline `<svg>` for the same data — no runtime, prints
|
|
352
|
+
exactly, with a `.ui-legend` key and the fallback table:
|
|
353
|
+
|
|
354
|
+
```html
|
|
355
|
+
<figure class="ui-report__figure ui-print-exact" role="group" aria-labelledby="chart-title">
|
|
356
|
+
<figcaption id="chart-title" class="ui-report__caption">
|
|
357
|
+
Fig 1 - Weekly focus split
|
|
358
|
+
</figcaption>
|
|
359
|
+
<ul class="ui-legend" aria-label="Series">
|
|
360
|
+
<li class="ui-legend__item">
|
|
142
361
|
<span
|
|
143
|
-
class="ui-
|
|
362
|
+
class="ui-legend__swatch"
|
|
144
363
|
style="--chart-color: var(--chart-1); --chart-pattern: var(--chart-pattern-1)"
|
|
145
364
|
aria-hidden="true"
|
|
146
365
|
></span>
|
|
147
|
-
Research
|
|
366
|
+
<span class="ui-legend__label">Research</span>
|
|
148
367
|
</li>
|
|
149
|
-
<li>
|
|
368
|
+
<li class="ui-legend__item">
|
|
150
369
|
<span
|
|
151
|
-
class="ui-
|
|
370
|
+
class="ui-legend__swatch"
|
|
152
371
|
style="--chart-color: var(--chart-2); --chart-pattern: var(--chart-pattern-2)"
|
|
153
372
|
aria-hidden="true"
|
|
154
373
|
></span>
|
|
155
|
-
Delivery
|
|
374
|
+
<span class="ui-legend__label">Delivery</span>
|
|
156
375
|
</li>
|
|
157
376
|
</ul>
|
|
158
|
-
<
|
|
159
|
-
<
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
<
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
<div class="ui-table-wrap">
|
|
176
|
-
<table class="ui-table ui-table--dense">
|
|
177
|
-
<caption>Chart source data</caption>
|
|
178
|
-
<thead>
|
|
179
|
-
<tr><th>Series</th><th class="is-num">Hours</th></tr>
|
|
180
|
-
</thead>
|
|
181
|
-
<tbody>
|
|
182
|
-
<tr><td>Research</td><td class="is-num">18</td></tr>
|
|
183
|
-
<tr><td>Delivery</td><td class="is-num">11</td></tr>
|
|
184
|
-
</tbody>
|
|
185
|
-
</table>
|
|
186
|
-
</div>
|
|
377
|
+
<svg viewBox="0 0 360 160" role="img" aria-labelledby="focus-svg-title">
|
|
378
|
+
<title id="focus-svg-title">Weekly focus split</title>
|
|
379
|
+
<line x1="36" y1="132" x2="324" y2="132" stroke="var(--line)" />
|
|
380
|
+
<rect x="72" y="42" width="96" height="90" fill="var(--chart-1)" />
|
|
381
|
+
<rect x="200" y="77" width="96" height="55" fill="var(--chart-2)" />
|
|
382
|
+
</svg>
|
|
383
|
+
<div class="ui-table-wrap">
|
|
384
|
+
<table class="ui-table ui-table--dense">
|
|
385
|
+
<caption>Chart source data</caption>
|
|
386
|
+
<thead>
|
|
387
|
+
<tr><th>Series</th><th class="is-num">Hours</th></tr>
|
|
388
|
+
</thead>
|
|
389
|
+
<tbody>
|
|
390
|
+
<tr><td>Research</td><td class="is-num">18</td></tr>
|
|
391
|
+
<tr><td>Delivery</td><td class="is-num">11</td></tr>
|
|
392
|
+
</tbody>
|
|
393
|
+
</table>
|
|
187
394
|
</div>
|
|
188
395
|
</figure>
|
|
189
396
|
```
|
|
190
397
|
|
|
191
|
-
For
|
|
192
|
-
|
|
193
|
-
|
|
398
|
+
For a frozen figure, drive the SVG fills from the `--chart-N` palette tokens
|
|
399
|
+
directly; for a Vega chart, the same colours arrive through
|
|
400
|
+
`brontoVegaConfig`'s `range.*` ramps, projected from `@ponchia/ui/charts.json`.
|
|
401
|
+
|
|
402
|
+
For a **sequential** figure (a heatmap, a choropleth, a magnitude ramp) fill the
|
|
403
|
+
cells from the single-hue ramp tokens `--chart-seq-1` … `--chart-seq-6`
|
|
404
|
+
(low → high); for a **diverging** figure (−…0…+) use `--chart-div-1` …
|
|
405
|
+
`--chart-div-7` (the middle band is the neutral midpoint). Both ramps live in
|
|
406
|
+
`css/dataviz.css`, and their resolved per-theme hexes are in
|
|
407
|
+
`@ponchia/ui/charts.json` (`sequential` / `diverging`) for a non-JS or `file://`
|
|
408
|
+
host that needs literal values. The same ramps back Vega's
|
|
409
|
+
`range.heatmap`/`ramp`/`diverging`, so a frozen sequential figure and a live Vega
|
|
410
|
+
heatmap read identically — but note the ramp **runs pale→deep in light theme and
|
|
411
|
+
deep→pale in dark** (it flips to stay legible against the background), so don't
|
|
412
|
+
print a colour key that assumes one direction, and don't bake a fixed ink colour
|
|
413
|
+
onto the cells. Pair the figure with a stepped legend and the fallback table.
|
|
414
|
+
|
|
415
|
+
## Annotation recipe
|
|
416
|
+
|
|
417
|
+
When a report chart needs an explicit callout, import
|
|
418
|
+
`@ponchia/ui/css/annotations.css` and layer SVG annotations inside the same
|
|
419
|
+
`ui-report__figure`. Keep the subject/connector/note text visible in the SVG or
|
|
420
|
+
represented by the figure caption/fallback data.
|
|
421
|
+
|
|
422
|
+
```html
|
|
423
|
+
<svg viewBox="0 0 360 160" role="img" aria-labelledby="annotated-title annotated-desc">
|
|
424
|
+
<title id="annotated-title">Weekly focus chart with peak callout</title>
|
|
425
|
+
<desc id="annotated-desc">The annotation marks the research peak.</desc>
|
|
426
|
+
<g class="ui-annotation ui-annotation--circle ui-annotation--accent" transform="translate(210, 58)">
|
|
427
|
+
<path class="ui-annotation__subject" d="M0,-18A18,18 0 1 1 0,18A18,18 0 1 1 0,-18Z" />
|
|
428
|
+
<path class="ui-annotation__connector" d="M15.556,-7.424L84,-40" />
|
|
429
|
+
<g class="ui-annotation__note" transform="translate(84, -40)">
|
|
430
|
+
<path class="ui-annotation__note-line" d="M0,0H92" />
|
|
431
|
+
<text class="ui-annotation__title" y="-8">Peak</text>
|
|
432
|
+
<text class="ui-annotation__label" y="12">18 research hours</text>
|
|
433
|
+
</g>
|
|
434
|
+
</g>
|
|
435
|
+
</svg>
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
For generated SVG, use `@ponchia/ui/annotations` to compute connector and
|
|
439
|
+
subject path strings. Full annotation recipes and the complete variant list are
|
|
440
|
+
in `docs/annotations.md`; the shipped `demo/annotations.html` page is the
|
|
441
|
+
visual specimen.
|
|
194
442
|
|
|
195
443
|
## Timeline recipe
|
|
196
444
|
|
|
@@ -211,6 +459,95 @@ style itself.
|
|
|
211
459
|
</ol>
|
|
212
460
|
```
|
|
213
461
|
|
|
462
|
+
## Meters and quotes
|
|
463
|
+
|
|
464
|
+
Two more report-native primitives. A **meter** shows a measured value as a
|
|
465
|
+
proportion — set the percentage on the `--value` custom property of
|
|
466
|
+
`ui-meter__fill` (a number 0–100, see `classes.json` `customProperties`); a tone
|
|
467
|
+
modifier picks the fill colour, and the readable label is yours to write beside
|
|
468
|
+
it (never rely on the bar alone — WCAG 1.4.1):
|
|
469
|
+
|
|
470
|
+
```html
|
|
471
|
+
<div class="ui-meter ui-meter--accent">
|
|
472
|
+
<span class="ui-meter__fill" style="--value: 72"></span>
|
|
473
|
+
</div>
|
|
474
|
+
<span class="ui-num">72% of quota</span>
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
`--value` is a percentage and the fill **clamps at 100**, so an over-target
|
|
478
|
+
reading (e.g. 112 % of plan) shows a full bar — put the true figure in the
|
|
479
|
+
written label beside it (`ui-num`), which is the data of record anyway.
|
|
480
|
+
|
|
481
|
+
A **pull-quote** lifts a source sentence out of the prose — `ui-quote` is the
|
|
482
|
+
block, `ui-quote__cite` attributes it:
|
|
483
|
+
|
|
484
|
+
```html
|
|
485
|
+
<blockquote class="ui-quote">
|
|
486
|
+
<p>The migration paid for itself within the first billing cycle.</p>
|
|
487
|
+
<cite class="ui-quote__cite">Q2 finance review</cite>
|
|
488
|
+
</blockquote>
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
## Theming a live report
|
|
492
|
+
|
|
493
|
+
The report layer is static, but a screen report often offers a light/dark
|
|
494
|
+
**toggle**. The chart palette is the one piece that does not re-skin from CSS
|
|
495
|
+
alone: Vega and Mermaid/D2 bake resolved colours into their SVG at render time
|
|
496
|
+
(they can't read `var()`), so on a theme flip you must **re-render** the foreign
|
|
497
|
+
figures. Set the theme on the root and re-embed:
|
|
498
|
+
|
|
499
|
+
```html
|
|
500
|
+
<button type="button" class="ui-button ui-button--ghost ui-button--sm" id="theme-toggle">
|
|
501
|
+
Toggle theme
|
|
502
|
+
</button>
|
|
503
|
+
<script type="module">
|
|
504
|
+
import { brontoVegaConfig } from '@ponchia/ui/vega'; // http(s) origin only
|
|
505
|
+
const root = document.documentElement;
|
|
506
|
+
let view; // the previous Vega view, so we can tear it down before re-embedding
|
|
507
|
+
const renderChart = async () => {
|
|
508
|
+
const theme = root.dataset.theme === 'dark' ? 'dark' : 'light';
|
|
509
|
+
const host = document.querySelector('#focus-chart');
|
|
510
|
+
view?.finalize(); // 1. finalize the old view first — frees its listeners/RAF (see below)
|
|
511
|
+
host.replaceChildren(); // 2. clear the host — re-embedding into a non-empty node stacks SVGs
|
|
512
|
+
const res = await vegaEmbed(host, spec, {
|
|
513
|
+
config: brontoVegaConfig(theme),
|
|
514
|
+
renderer: 'svg',
|
|
515
|
+
actions: false,
|
|
516
|
+
});
|
|
517
|
+
view = res.view;
|
|
518
|
+
};
|
|
519
|
+
document.querySelector('#theme-toggle').addEventListener('click', () => {
|
|
520
|
+
root.dataset.theme = root.dataset.theme === 'dark' ? 'light' : 'dark';
|
|
521
|
+
renderChart(); // 2. re-render on every flip — the baked SVG does not follow CSS
|
|
522
|
+
});
|
|
523
|
+
renderChart();
|
|
524
|
+
</script>
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
Four foot-guns, each verified while dogfooding:
|
|
528
|
+
|
|
529
|
+
- **Finalize the previous view before re-embedding.** `vegaEmbed` resolves to
|
|
530
|
+
`{ view }`; a Vega view registers event listeners and an animation frame loop
|
|
531
|
+
that `replaceChildren()` does **not** unwind. Call `view.finalize()` on the
|
|
532
|
+
prior view before each re-render (as above), or a report that toggles theme
|
|
533
|
+
repeatedly leaks a view per toggle.
|
|
534
|
+
- **Clear the host before re-embedding.** vega-embed appends; embedding twice
|
|
535
|
+
into the same node stacks a second chart under the first. `replaceChildren()`
|
|
536
|
+
(or `host.innerHTML = ''`) first.
|
|
537
|
+
- **Avoid `width: 'container'` if the chart can be re-rendered while hidden.** A
|
|
538
|
+
container-sized Vega chart measures its parent at embed time; if that parent is
|
|
539
|
+
`display: none` (a collapsed section, an inactive tab) it measures `0` and
|
|
540
|
+
renders empty. Give the spec an explicit `width`, or re-embed when the section
|
|
541
|
+
becomes visible.
|
|
542
|
+
- **Mermaid: don't `innerHTML = svg` over the source.** `mermaid.render()`
|
|
543
|
+
returns the SVG string — write it to a *separate* mount, not back into the
|
|
544
|
+
`<pre class="mermaid">` that still holds the diagram source, or a re-theme has
|
|
545
|
+
nothing to re-render from. Keep the source and the rendered output in different
|
|
546
|
+
nodes.
|
|
547
|
+
|
|
548
|
+
For a report you will only ever **print/PDF**, skip all of this: render once in
|
|
549
|
+
the target theme, or use the frozen inline `<svg>` route, which has no runtime.
|
|
550
|
+
|
|
214
551
|
## Common templates
|
|
215
552
|
|
|
216
553
|
- Executive brief: compact cover, one summary block, KPI `ui-statgrid`, short
|
|
@@ -224,8 +561,9 @@ style itself.
|
|
|
224
561
|
|
|
225
562
|
## Print and PDF
|
|
226
563
|
|
|
227
|
-
The supported export target is modern Chromium print/PDF.
|
|
228
|
-
the
|
|
564
|
+
The supported export target is modern Chromium print/PDF. A bronto report is
|
|
565
|
+
static and zero-JS, so producing the PDF is just _load → print_ — you do not
|
|
566
|
+
need a full automatable browser, only a Chromium-class layout+print pass.
|
|
229
567
|
|
|
230
568
|
- **By hand:** open the report in Chrome/Edge → Print (Cmd/Ctrl+P) → "Save as
|
|
231
569
|
PDF". In **More settings**, enable **Background graphics** (the dialog's
|
|
@@ -233,13 +571,45 @@ the file:
|
|
|
233
571
|
out), and pick the paper size there. Paper size is a browser print setting,
|
|
234
572
|
not a token; the layer only themes the page _margin_ via
|
|
235
573
|
`--report-page-margin`.
|
|
236
|
-
- **Headless
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
574
|
+
- **Headless, lightweight:** use **`chrome-headless-shell`** — the minimal
|
|
575
|
+
headless-Chromium binary built for exactly this, a fraction of a full
|
|
576
|
+
browser's weight. Drive it through Playwright/Puppeteer (or raw CDP) and
|
|
577
|
+
always pass `printBackground: true`, or chart fills and legend swatches drop
|
|
578
|
+
out:
|
|
579
|
+
|
|
580
|
+
```js
|
|
581
|
+
import { chromium } from 'playwright'; // or puppeteer
|
|
582
|
+
const browser = await chromium.launch({ channel: 'chromium-headless-shell' });
|
|
583
|
+
const page = await browser.newPage();
|
|
584
|
+
await page.goto('file:///abs/path/report.html', { waitUntil: 'networkidle' });
|
|
585
|
+
await page.pdf({ path: 'report.pdf', format: 'A4', printBackground: true });
|
|
586
|
+
await browser.close();
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
Install the binary with `npx playwright install chromium-headless-shell`
|
|
590
|
+
(Puppeteer ships its own). The repo's `scripts/render-pdf.mjs` is a working
|
|
591
|
+
copy of this (`npm run report:pdf -- report.html`); it is a dev/example
|
|
592
|
+
helper, not part of the published API — bronto does not own rendering.
|
|
593
|
+
- **As a service / from another language:** run Chromium-as-a-service
|
|
594
|
+
(e.g. **Gotenberg**'s `POST /forms/chromium/convert/html`, or a hosted CDP
|
|
595
|
+
endpoint) and POST the HTML + the `dist/css/*` assets. A Python/Go/any host
|
|
596
|
+
then needs no local browser. This is the natural fit for reports generated
|
|
597
|
+
by an LLM or service in another system.
|
|
598
|
+
|
|
599
|
+
The report prints ink-on-white regardless of the on-screen theme. The chart
|
|
600
|
+
fills and swatches carry `print-color-adjust: exact`, but the engine still
|
|
601
|
+
needs background printing enabled (`printBackground: true` headless, or
|
|
602
|
+
"Background graphics" by hand). The bare `chrome --headless --print-to-pdf`
|
|
603
|
+
CLI flag does **not** print backgrounds — use the scripted CDP/`page.pdf()`
|
|
604
|
+
path above for any report with charts.
|
|
605
|
+
|
|
606
|
+
A browserless engine (WeasyPrint, Prince, …) can work for text-and-table
|
|
607
|
+
reports if you feed it the **unlayered** CSS (`@ponchia/ui/css/unlayered/*` —
|
|
608
|
+
no `@layer`) and resolve colours from `tokens/resolved.json`; but `:has()` and
|
|
609
|
+
modern paged-media are not universally supported, so charts and edge cases may
|
|
610
|
+
degrade. For faithful output, stay on a Chromium-class engine. Older
|
|
240
611
|
HTML-to-PDF engines are not part of the browser floor and may not support
|
|
241
|
-
cascade layers, `oklch()`, `color-mix()`, `:has()`, or modern paged-media
|
|
242
|
-
behavior.
|
|
612
|
+
cascade layers, `oklch()`, `color-mix()`, `:has()`, or modern paged-media.
|
|
243
613
|
|
|
244
614
|
- Use `ui-print-only` for content that should appear only in print.
|
|
245
615
|
- Use `ui-screen-only` for navigation or helper content that should not print.
|
|
@@ -261,7 +631,10 @@ fake page numbers with inert markup.
|
|
|
261
631
|
|
|
262
632
|
Before returning a report, an LLM should verify:
|
|
263
633
|
|
|
264
|
-
- All `ui-*` classes exist in `@ponchia/ui/classes
|
|
634
|
+
- All `ui-*` classes exist in `@ponchia/ui/classes` (or `classes/classes.json`).
|
|
635
|
+
The `is-*` state hooks (`is-num`/`is-pos`/`is-neg`/`is-key` in `.ui-table`
|
|
636
|
+
cells and `.ui-stat` deltas, `is-open`/`is-active`) are valid but live
|
|
637
|
+
outside `cls` by design — keep them.
|
|
265
638
|
- The document has one `h1`, ordered headings, and a single main report region.
|
|
266
639
|
- Tables have captions and header cells.
|
|
267
640
|
- Charts have captions, direct labels or legends, and fallback data.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Selection states
|
|
2
|
+
|
|
3
|
+
`@ponchia/ui/css/selection.css` is a tiny, **cross-cutting selection-emphasis
|
|
4
|
+
vocabulary** — the carve-out from "brush/lasso". Bronto does **not** do region
|
|
5
|
+
selection or hit-testing (that needs your scales and geometry). It ships only
|
|
6
|
+
the *states* an item can be in once your code has decided what's selected, so
|
|
7
|
+
the same emphasis works on a chart mark, a table row, a list item, or a map
|
|
8
|
+
region.
|
|
9
|
+
|
|
10
|
+
```css
|
|
11
|
+
@import '@ponchia/ui';
|
|
12
|
+
@import '@ponchia/ui/css/selection.css';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
| Class | State |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| `ui-sel` | Base — opt the element into the emphasis transitions. |
|
|
18
|
+
| `ui-sel--on` | In the selection (accent outline). |
|
|
19
|
+
| `ui-sel--off` | Excluded / filtered out (dimmed). |
|
|
20
|
+
| `ui-sel--maybe` | A live-brush candidate (dashed outline). |
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<rect class="ui-sel ui-sel--on" … />
|
|
24
|
+
<tr class="ui-sel ui-sel--off">…</tr>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
import { ui } from '@ponchia/ui/classes';
|
|
29
|
+
el.className = ui.sel({ state: inBrush ? 'maybe' : selected ? 'on' : 'off' });
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Your code adds/removes these classes from its own brush, filter, or selection
|
|
33
|
+
logic — Bronto only styles them. `--off` uses `opacity` (which survives
|
|
34
|
+
forced-colors), and `--on` falls back to the system `Highlight` color in
|
|
35
|
+
forced-colors so the selection stays visible.
|
|
36
|
+
|
|
37
|
+
> **Why no brush behavior?** A rectangular brush or lasso must translate a
|
|
38
|
+
> dragged region into a data domain (or test points against a polygon), which
|
|
39
|
+
> requires owning the chart's scales/geometry — across Bronto's line. Bring your
|
|
40
|
+
> own selection logic; use these classes to render the result.
|