@ponchia/ui 0.11.0 → 0.12.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 +47 -0
- package/MIGRATIONS.json +24 -0
- package/README.md +3 -3
- package/behaviors/forms.d.ts +1 -1
- package/behaviors/internal.d.ts +1 -1
- package/css/dataviz.css +117 -64
- package/css/legend.css +1 -2
- package/dist/css/analytical.css +1 -1
- package/dist/css/dataviz.css +1 -1
- package/dist/css/legend.css +1 -1
- package/dist/css/report-kit.css +1 -1
- package/docs/adr/0001-color-system.md +29 -0
- package/docs/architecture.md +1 -1
- package/docs/compositions.md +2 -2
- package/docs/contrast.md +24 -24
- package/docs/frontier-primitives.md +5 -0
- package/docs/mermaid.md +1 -1
- package/docs/migrations/0.11-to-0.12.md +47 -0
- package/docs/package-contract.md +7 -1
- package/docs/renderer.md +100 -0
- package/docs/reporting.md +9 -9
- package/docs/stability.md +3 -2
- package/docs/theming.md +29 -19
- package/docs/usage.md +12 -8
- package/docs/vega.md +24 -23
- package/llms.txt +8 -4
- package/package.json +12 -3
- package/renderer/index.d.ts +203 -0
- package/renderer/index.d.ts.map +1 -0
- package/renderer/index.js +650 -0
- package/tokens/charts.d.ts +16 -10
- package/tokens/charts.js +65 -49
- package/tokens/charts.json +77 -29
- package/tokens/mermaid.js +56 -56
- package/tokens/mermaid.json +56 -56
- package/tokens/vega.d.ts +3 -3
- package/tokens/vega.js +111 -72
- package/tokens/vega.json +198 -126
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse a resolved CSS colour to sRGB, gamut-clipped: hex, `rgb()`, `hsl()`,
|
|
3
|
+
* `oklch()`, `oklab()`, `lab()`, `lch()`, `color(srgb | srgb-linear |
|
|
4
|
+
* display-p3 | xyz | xyz-d65 | xyz-d50 …)` and `transparent`. Anything else —
|
|
5
|
+
* `var()`, `color-mix()`, `light-dark()`, a named colour — returns null; use
|
|
6
|
+
* `resolveColor()` to have the browser compute it first.
|
|
7
|
+
* @param {string} value
|
|
8
|
+
* @returns {Rgba | null}
|
|
9
|
+
*/
|
|
10
|
+
export function parseColor(value: string): Rgba | null;
|
|
11
|
+
/**
|
|
12
|
+
* Serialize for a renderer: `#rrggbb` when opaque, `rgba(r, g, b, a)` when
|
|
13
|
+
* not — the two forms canvas, SVG, d3-color, xterm, three.js and MapLibre
|
|
14
|
+
* all accept.
|
|
15
|
+
* @param {Rgba} color
|
|
16
|
+
*/
|
|
17
|
+
export function formatColor({ r, g, b, alpha }: Rgba): string;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve any CSS colour expression to a renderer literal, using the browser
|
|
20
|
+
* for what `parseColor()` cannot compute (`var()`, `color-mix()`,
|
|
21
|
+
* `light-dark()`, named colours). Returns null for an invalid colour or when no
|
|
22
|
+
* document is available.
|
|
23
|
+
* @param {string} value
|
|
24
|
+
* @param {{ element?: Element }} [options] Context for `var()` and `light-dark()`.
|
|
25
|
+
*/
|
|
26
|
+
export function resolveColor(value: string, options?: {
|
|
27
|
+
element?: Element;
|
|
28
|
+
}): string | null;
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the page's bronto tokens for a renderer. Reads custom properties as
|
|
31
|
+
* computed on `element` (default: the root), so a subtree that re-points them
|
|
32
|
+
* is honoured. When the categorical leaf (`css/dataviz.css`) is not loaded,
|
|
33
|
+
* the categorical, sequential and diverging sets fall back to the packaged
|
|
34
|
+
* palette for the resolved scheme. Without a DOM it returns the packaged light
|
|
35
|
+
* (or `options.scheme`) values.
|
|
36
|
+
* @param {Element} [element]
|
|
37
|
+
* @param {{ scheme?: 'light' | 'dark' }} [options] Force the scheme instead of reading the background.
|
|
38
|
+
* @returns {RendererTokens}
|
|
39
|
+
*/
|
|
40
|
+
export function readTokens(element?: Element, options?: {
|
|
41
|
+
scheme?: "light" | "dark";
|
|
42
|
+
}): RendererTokens;
|
|
43
|
+
/**
|
|
44
|
+
* Call `callback` with fresh tokens whenever they change: after an attribute
|
|
45
|
+
* on the root changes (`data-theme`, `data-bronto-skin`, `data-contrast`,
|
|
46
|
+
* `data-surface`, `data-density`, `class`, `style`) and a token's value moved
|
|
47
|
+
* with it, or when the system colour scheme or contrast preference changes.
|
|
48
|
+
* A host that writes unrelated inline styles on the root every frame costs one
|
|
49
|
+
* computed-style read per frame, not a re-resolution. Calls are coalesced to
|
|
50
|
+
* one per animation frame. Returns a function that stops observing.
|
|
51
|
+
* @param {(tokens: RendererTokens) => void} callback
|
|
52
|
+
* @param {{ element?: Element, signal?: AbortSignal }} [options]
|
|
53
|
+
* @returns {() => void}
|
|
54
|
+
*/
|
|
55
|
+
export function observeTokens(callback: (tokens: RendererTokens) => void, options?: {
|
|
56
|
+
element?: Element;
|
|
57
|
+
signal?: AbortSignal;
|
|
58
|
+
}): () => void;
|
|
59
|
+
/**
|
|
60
|
+
* A Vega-Lite (default) or Vega `config` from resolved tokens: quiet chrome in
|
|
61
|
+
* the bronto inks, the categorical palette as `range.category` (a single
|
|
62
|
+
* series takes its first hue), the sequential ramp for ordinal/ramp/heatmap
|
|
63
|
+
* scales and the diverging ramp for diverging ones. A spec's own `config`
|
|
64
|
+
* still wins where Vega merges it over this one.
|
|
65
|
+
* @param {RendererTokens} tokens
|
|
66
|
+
* @param {{ mode?: 'vega-lite' | 'vega', narrow?: boolean, background?: string }} [options]
|
|
67
|
+
* `narrow` moves the legend under the plot and thins ticks for a small
|
|
68
|
+
* container; `background` defaults to transparent so the host surface shows.
|
|
69
|
+
* @returns {Record<string, any>}
|
|
70
|
+
*/
|
|
71
|
+
export function vegaConfig(tokens: RendererTokens, options?: {
|
|
72
|
+
mode?: "vega-lite" | "vega";
|
|
73
|
+
narrow?: boolean;
|
|
74
|
+
background?: string;
|
|
75
|
+
}): Record<string, any>;
|
|
76
|
+
/**
|
|
77
|
+
* An xterm.js `ITheme` from resolved tokens: page ink on the page background,
|
|
78
|
+
* the accent as the cursor, status colours for red/green/yellow/blue and the
|
|
79
|
+
* categorical magenta and aqua for magenta/cyan, so all six ANSI hues differ.
|
|
80
|
+
* @param {RendererTokens} tokens
|
|
81
|
+
* @returns {Record<string, string>}
|
|
82
|
+
*/
|
|
83
|
+
export function xtermTheme(tokens: RendererTokens): Record<string, string>;
|
|
84
|
+
/**
|
|
85
|
+
* A colour as sRGB channels (0–255) and alpha (0–1).
|
|
86
|
+
*/
|
|
87
|
+
export type Rgba = {
|
|
88
|
+
r: number;
|
|
89
|
+
g: number;
|
|
90
|
+
b: number;
|
|
91
|
+
alpha: number;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* The bronto roles a renderer draws with, resolved to literals: opaque colours
|
|
95
|
+
* as `#rrggbb`, translucent ones as `rgba(r, g, b, a)`.
|
|
96
|
+
*/
|
|
97
|
+
export type RendererTokens = {
|
|
98
|
+
/**
|
|
99
|
+
* The resolved scheme of the page background.
|
|
100
|
+
*/
|
|
101
|
+
scheme: "light" | "dark";
|
|
102
|
+
/**
|
|
103
|
+
* Page background (`--bg`).
|
|
104
|
+
*/
|
|
105
|
+
bg: string;
|
|
106
|
+
/**
|
|
107
|
+
* A lifted page background (`--bg-elevated`).
|
|
108
|
+
*/
|
|
109
|
+
bgElevated: string;
|
|
110
|
+
/**
|
|
111
|
+
* The surface a renderer usually draws on (`--panel`).
|
|
112
|
+
*/
|
|
113
|
+
panel: string;
|
|
114
|
+
/**
|
|
115
|
+
* A raised surface (`--panel-strong`).
|
|
116
|
+
*/
|
|
117
|
+
panelStrong: string;
|
|
118
|
+
/**
|
|
119
|
+
* Primary ink (`--text`).
|
|
120
|
+
*/
|
|
121
|
+
text: string;
|
|
122
|
+
/**
|
|
123
|
+
* Secondary ink (`--text-soft`).
|
|
124
|
+
*/
|
|
125
|
+
textSoft: string;
|
|
126
|
+
/**
|
|
127
|
+
* Tertiary ink (`--text-dim`).
|
|
128
|
+
*/
|
|
129
|
+
textDim: string;
|
|
130
|
+
/**
|
|
131
|
+
* Hairline and grid (`--line`).
|
|
132
|
+
*/
|
|
133
|
+
line: string;
|
|
134
|
+
/**
|
|
135
|
+
* Axis, domain and rule (`--line-strong`).
|
|
136
|
+
*/
|
|
137
|
+
lineStrong: string;
|
|
138
|
+
/**
|
|
139
|
+
* The one accent (`--accent`).
|
|
140
|
+
*/
|
|
141
|
+
accent: string;
|
|
142
|
+
/**
|
|
143
|
+
* Accent as text on the page (`--accent-text`).
|
|
144
|
+
*/
|
|
145
|
+
accentText: string;
|
|
146
|
+
/**
|
|
147
|
+
* Ink on an accent fill (`--on-accent`).
|
|
148
|
+
*/
|
|
149
|
+
onAccent: string;
|
|
150
|
+
/**
|
|
151
|
+
* Focus ring (`--focus-ring`).
|
|
152
|
+
*/
|
|
153
|
+
focus: string;
|
|
154
|
+
/**
|
|
155
|
+
* A translucent selection wash over `panel`.
|
|
156
|
+
*/
|
|
157
|
+
selection: string;
|
|
158
|
+
/**
|
|
159
|
+
* Status: success.
|
|
160
|
+
*/
|
|
161
|
+
success: string;
|
|
162
|
+
/**
|
|
163
|
+
* Status: warning.
|
|
164
|
+
*/
|
|
165
|
+
warning: string;
|
|
166
|
+
/**
|
|
167
|
+
* Status: danger.
|
|
168
|
+
*/
|
|
169
|
+
danger: string;
|
|
170
|
+
/**
|
|
171
|
+
* Status: info.
|
|
172
|
+
*/
|
|
173
|
+
info: string;
|
|
174
|
+
/**
|
|
175
|
+
* The sans font stack.
|
|
176
|
+
*/
|
|
177
|
+
sans: string;
|
|
178
|
+
/**
|
|
179
|
+
* The monospace font stack.
|
|
180
|
+
*/
|
|
181
|
+
mono: string;
|
|
182
|
+
/**
|
|
183
|
+
* Eight categorical hues, fixed order.
|
|
184
|
+
*/
|
|
185
|
+
categorical: string[];
|
|
186
|
+
/**
|
|
187
|
+
* Each hue's wash over `panel`.
|
|
188
|
+
*/
|
|
189
|
+
categoricalTint: string[];
|
|
190
|
+
/**
|
|
191
|
+
* Each hue as text on `panel` and its tint.
|
|
192
|
+
*/
|
|
193
|
+
categoricalInk: string[];
|
|
194
|
+
/**
|
|
195
|
+
* One-hue ramp; step 1 nearest the surface.
|
|
196
|
+
*/
|
|
197
|
+
sequential: string[];
|
|
198
|
+
/**
|
|
199
|
+
* Negative … neutral … positive ramp.
|
|
200
|
+
*/
|
|
201
|
+
diverging: string[];
|
|
202
|
+
};
|
|
203
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAkOA;;;;;;;;GAQG;AACH,kCAHW,MAAM,GACJ,IAAI,GAAG,IAAI,CAcvB;AAED;;;;;GAKG;AACH,gDAFW,IAAI,UAMd;AAED;;;;;;;GAOG;AACH,oCAHW,MAAM,YACN;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,iBAqB/B;AAkCD;;;;;;;;;;GAUG;AACH,qCAJW,OAAO,YACP;IAAE,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAAE,GAC3B,cAAc,CA6E1B;AAqDD;;;;;;;;;;;GAWG;AACH,wCAJW,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,YAChC;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,GACzC,MAAM,IAAI,CAqDtB;AAID;;;;;;;;;;;GAWG;AACH,mCANW,cAAc,YACd;IAAE,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAGpE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CA6E/B;AAED;;;;;;GAMG;AACH,mCAHW,cAAc,GACZ,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA2BlC;;;;mBAjnBY;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;;;;;;;;;YAOjD,OAAO,GAAG,MAAM;;;;QAChB,MAAM;;;;gBACN,MAAM;;;;WACN,MAAM;;;;iBACN,MAAM;;;;UACN,MAAM;;;;cACN,MAAM;;;;aACN,MAAM;;;;UACN,MAAM;;;;gBACN,MAAM;;;;YACN,MAAM;;;;gBACN,MAAM;;;;cACN,MAAM;;;;WACN,MAAM;;;;eACN,MAAM;;;;aACN,MAAM;;;;aACN,MAAM;;;;YACN,MAAM;;;;UACN,MAAM;;;;UACN,MAAM;;;;UACN,MAAM;;;;iBACN,MAAM,EAAE;;;;qBACR,MAAM,EAAE;;;;oBACR,MAAM,EAAE;;;;gBACR,MAAM,EAAE;;;;eACR,MAAM,EAAE"}
|