@aceshooting/lyra-ui 1.0.1 → 1.2.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 +9 -10
- package/custom-elements.json +15118 -8342
- package/dist/components/chart/chart.d.ts +57 -1
- package/dist/components/chart/chart.js +202 -12
- package/dist/components/chart/chart.stories.d.ts +32 -0
- package/dist/components/chart/chart.stories.js +141 -0
- package/dist/components/chart/chart.styles.js +16 -0
- package/dist/components/chart/histogram.d.ts +2 -0
- package/dist/components/chart/histogram.js +18 -2
- package/dist/components/chart/line-chart.stories.d.ts +17 -0
- package/dist/components/chart/line-chart.stories.js +75 -0
- package/dist/components/chart/lite-chart.d.ts +83 -0
- package/dist/components/chart/lite-chart.js +424 -0
- package/dist/components/chart/lite-chart.stories.d.ts +14 -0
- package/dist/components/chart/lite-chart.stories.js +114 -0
- package/dist/components/chart/lite-chart.styles.d.ts +1 -0
- package/dist/components/chart/lite-chart.styles.js +83 -0
- package/dist/components/combobox/combobox.d.ts +9 -0
- package/dist/components/combobox/combobox.js +76 -13
- package/dist/components/combobox/combobox.stories.d.ts +18 -0
- package/dist/components/combobox/combobox.stories.js +75 -0
- package/dist/components/date-picker/calendar-core.js +13 -2
- package/dist/components/date-picker/date-input.d.ts +9 -1
- package/dist/components/date-picker/date-input.js +55 -7
- package/dist/components/date-picker/date-input.stories.d.ts +5 -0
- package/dist/components/date-picker/date-input.stories.js +36 -0
- package/dist/components/date-picker/date-picker.d.ts +11 -3
- package/dist/components/date-picker/date-picker.js +87 -37
- package/dist/components/date-picker/date-picker.stories.d.ts +4 -0
- package/dist/components/date-picker/date-picker.stories.js +12 -0
- package/dist/components/date-picker/date-picker.styles.js +1 -1
- package/dist/components/empty/empty.d.ts +12 -1
- package/dist/components/empty/empty.js +20 -3
- package/dist/components/empty/empty.stories.d.ts +2 -0
- package/dist/components/empty/empty.stories.js +20 -0
- package/dist/components/empty/empty.styles.js +11 -0
- package/dist/components/export-button/csv.js +6 -2
- package/dist/components/export-button/export-button.d.ts +15 -1
- package/dist/components/export-button/export-button.js +89 -12
- package/dist/components/export-button/export-button.stories.d.ts +1 -0
- package/dist/components/export-button/export-button.stories.js +5 -0
- package/dist/components/export-button/export-button.styles.js +11 -3
- package/dist/components/file-input/accept.d.ts +8 -2
- package/dist/components/file-input/accept.js +9 -3
- package/dist/components/file-input/file-input.d.ts +5 -2
- package/dist/components/file-input/file-input.js +23 -8
- package/dist/components/file-input/file-input.stories.d.ts +2 -0
- package/dist/components/file-input/file-input.stories.js +9 -0
- package/dist/components/flag/flag.d.ts +69 -3
- package/dist/components/flag/flag.js +107 -30
- package/dist/components/flag/flag.stories.d.ts +1 -0
- package/dist/components/flag/flag.stories.js +14 -0
- package/dist/components/flag/flag.styles.js +1 -1
- package/dist/components/flag/language-map.d.ts +11 -0
- package/dist/components/flag/language-map.js +12 -1
- package/dist/components/gauge/gauge.d.ts +2 -0
- package/dist/components/gauge/gauge.js +19 -5
- package/dist/components/gauge/gauge.stories.d.ts +2 -0
- package/dist/components/gauge/gauge.stories.js +6 -0
- package/dist/components/graph/graph-loader.d.ts +28 -0
- package/dist/components/graph/graph-loader.js +44 -0
- package/dist/components/graph/graph.d.ts +41 -15
- package/dist/components/graph/graph.js +146 -71
- package/dist/components/graph/graph.stories.d.ts +3 -0
- package/dist/components/graph/graph.stories.js +38 -0
- package/dist/components/graph/graph.styles.js +6 -1
- package/dist/components/heatmap/calendar-grid.d.ts +7 -0
- package/dist/components/heatmap/calendar-grid.js +27 -10
- package/dist/components/heatmap/heatmap.d.ts +149 -12
- package/dist/components/heatmap/heatmap.js +445 -28
- package/dist/components/heatmap/heatmap.stories.d.ts +22 -0
- package/dist/components/heatmap/heatmap.stories.js +155 -0
- package/dist/components/heatmap/heatmap.styles.js +60 -2
- package/dist/components/map/map.d.ts +17 -1
- package/dist/components/map/map.js +68 -21
- package/dist/components/map/map.stories.d.ts +10 -0
- package/dist/components/map/map.stories.js +107 -12
- package/dist/components/map/map.styles.js +2 -2
- package/dist/components/playback/playback.d.ts +6 -2
- package/dist/components/playback/playback.js +36 -12
- package/dist/components/playback/playback.stories.d.ts +2 -0
- package/dist/components/playback/playback.stories.js +6 -0
- package/dist/components/playback/playback.styles.js +10 -2
- package/dist/components/select/select.d.ts +125 -0
- package/dist/components/select/select.js +480 -0
- package/dist/components/select/select.stories.d.ts +21 -0
- package/dist/components/select/select.stories.js +91 -0
- package/dist/components/select/select.styles.d.ts +1 -0
- package/dist/components/select/select.styles.js +212 -0
- package/dist/components/skeleton/skeleton.js +4 -7
- package/dist/components/sparkline/sparkline.d.ts +1 -1
- package/dist/components/sparkline/sparkline.js +40 -13
- package/dist/components/sparkline/sparkline.stories.d.ts +4 -0
- package/dist/components/sparkline/sparkline.stories.js +22 -0
- package/dist/components/split/split.d.ts +24 -3
- package/dist/components/split/split.js +155 -31
- package/dist/components/split/split.stories.d.ts +2 -0
- package/dist/components/split/split.stories.js +20 -0
- package/dist/components/stat/stat.d.ts +43 -1
- package/dist/components/stat/stat.js +97 -4
- package/dist/components/stat/stat.stories.d.ts +4 -0
- package/dist/components/stat/stat.stories.js +66 -1
- package/dist/components/stat/stat.styles.js +64 -0
- package/dist/components/table/table.d.ts +64 -2
- package/dist/components/table/table.js +213 -17
- package/dist/components/table/table.stories.d.ts +6 -0
- package/dist/components/table/table.stories.js +45 -0
- package/dist/components/table/table.styles.js +51 -4
- package/dist/components/time-range/time-range.d.ts +34 -5
- package/dist/components/time-range/time-range.js +217 -36
- package/dist/components/time-range/time-range.stories.d.ts +2 -0
- package/dist/components/time-range/time-range.stories.js +13 -0
- package/dist/components/time-range/time-range.styles.js +44 -2
- package/dist/components/toast/toast-item.d.ts +14 -2
- package/dist/components/toast/toast-item.js +134 -17
- package/dist/components/toast/toast-item.styles.js +28 -2
- package/dist/components/toast/toast.stories.d.ts +3 -0
- package/dist/components/toast/toast.stories.js +41 -1
- package/dist/components/toast/toast.styles.js +11 -11
- package/dist/components/toast/toaster.d.ts +1 -1
- package/dist/components/toast/toaster.js +13 -6
- package/dist/components/tree/tree-node.d.ts +13 -7
- package/dist/components/tree/tree-node.js +24 -10
- package/dist/components/tree/tree.d.ts +64 -15
- package/dist/components/tree/tree.js +113 -22
- package/dist/components/tree/tree.stories.d.ts +4 -0
- package/dist/components/tree/tree.stories.js +31 -1
- package/dist/components/tree/update-cascade.d.ts +13 -0
- package/dist/components/tree/update-cascade.js +13 -0
- package/dist/components/widget/widget.d.ts +25 -1
- package/dist/components/widget/widget.js +164 -6
- package/dist/components/widget/widget.stories.d.ts +3 -0
- package/dist/components/widget/widget.stories.js +43 -0
- package/dist/components/widget/widget.styles.js +20 -3
- package/dist/components/word-cloud/word-cloud-layout.d.ts +63 -0
- package/dist/components/word-cloud/word-cloud-layout.js +145 -0
- package/dist/components/word-cloud/word-cloud.d.ts +65 -0
- package/dist/components/word-cloud/word-cloud.js +255 -0
- package/dist/components/word-cloud/word-cloud.stories.d.ts +10 -0
- package/dist/components/word-cloud/word-cloud.stories.js +55 -0
- package/dist/components/word-cloud/word-cloud.styles.d.ts +1 -0
- package/dist/components/word-cloud/word-cloud.styles.js +55 -0
- package/dist/internal/a11y.js +2 -1
- package/dist/internal/rtl.d.ts +7 -0
- package/dist/internal/rtl.js +9 -0
- package/dist/lyra.d.ts +9 -1
- package/dist/lyra.js +6 -0
- package/llms-full.txt +962 -276
- package/llms.txt +12 -9
- package/package.json +6 -4
|
@@ -1,6 +1,29 @@
|
|
|
1
|
-
import { type TemplateResult } from 'lit';
|
|
1
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
2
2
|
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
3
|
import { type CalendarDay } from './calendar-grid.js';
|
|
4
|
+
/** A cell cursor in matrix mode. */
|
|
5
|
+
export interface MatrixCellPos {
|
|
6
|
+
row: number;
|
|
7
|
+
col: number;
|
|
8
|
+
}
|
|
9
|
+
/** A cell cursor in calendar mode — a grid position, not necessarily one with
|
|
10
|
+
* a matching entry in `days` (see `calendarCellAt()`). */
|
|
11
|
+
export interface CalendarCellPos {
|
|
12
|
+
week: number;
|
|
13
|
+
weekday: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A marker drawn as a stroked ring over a matching cell (matrix mode:
|
|
17
|
+
* `row`/`col`; calendar mode: `date` — whichever pair matches the active
|
|
18
|
+
* `mode`; the other fields are simply ignored). An optional `label`
|
|
19
|
+
* additionally surfaces the annotation in the legend.
|
|
20
|
+
*/
|
|
21
|
+
export interface HeatmapAnnotation {
|
|
22
|
+
row?: number;
|
|
23
|
+
col?: number;
|
|
24
|
+
date?: string;
|
|
25
|
+
label?: string;
|
|
26
|
+
}
|
|
4
27
|
/**
|
|
5
28
|
* Parses a strict `#rgb` or `#rrggbb` hex string into an `[r, g, b]` triple,
|
|
6
29
|
* or `null` if `hex` isn't one (rather than silently coercing an unparsable
|
|
@@ -25,16 +48,44 @@ export declare function resolveRgb(color: string, fallbackHex: string): [number,
|
|
|
25
48
|
/** Linearly interpolates between two CSS colors (any valid syntax) at `t` in `[0, 1]`. */
|
|
26
49
|
export declare function mixColor(fromColor: string, toColor: string, t: number): string;
|
|
27
50
|
/**
|
|
28
|
-
* `<lyra-heatmap>` — a Canvas
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* via `
|
|
34
|
-
*
|
|
51
|
+
* `<lyra-heatmap>` — a Canvas heatmap with a DPR-aware, resize-aware redraw
|
|
52
|
+
* loop, in one of two `mode`s:
|
|
53
|
+
*
|
|
54
|
+
* - `"matrix"` (default): a `rowLabels` x `colLabels` grid of `values`. `-1`
|
|
55
|
+
* (or any non-finite value) is treated as "no data". `scale="sqrt"`
|
|
56
|
+
* compresses the ramp via `sqrtStep()` so one heavy cell doesn't wash out
|
|
57
|
+
* the rest; the default `"linear"` scale maps linearly instead. `scale`
|
|
58
|
+
* only affects matrix mode — calendar mode always buckets by quartile.
|
|
59
|
+
* - `"calendar"`: a GitHub-style Sunday-Saturday x week grid built from
|
|
60
|
+
* `days`, colored by `quartileBucket()` into `bucketCount` buckets. As in
|
|
61
|
+
* matrix mode, a cell whose `value` is negative or non-finite is treated
|
|
62
|
+
* as "no data" rather than being bucketed.
|
|
63
|
+
*
|
|
64
|
+
* The sequential color ramp's endpoints are read from the
|
|
65
|
+
* `--lyra-heatmap-scale-lo`/`-hi` custom properties (declared in
|
|
66
|
+
* `heatmap.styles.ts`) so hosts can retheme it — canvas can't consume
|
|
67
|
+
* `var()` directly, so they're resolved once per draw via
|
|
68
|
+
* `getComputedStyle`, then normalized to RGB by `resolveRgb()` (any valid
|
|
69
|
+
* CSS color syntax, not just hex — see its doc comment).
|
|
70
|
+
*
|
|
71
|
+
* Every cell is independently addressable: a `pointermove` hit test over the
|
|
72
|
+
* canvas shows `[part="tooltip"]` with that cell's label + value (hidden on
|
|
73
|
+
* `pointerleave`); the canvas is `tabindex="0"` with arrow-key roving focus
|
|
74
|
+
* (a stroked ring redrawn over the focused cell on every draw, plus a
|
|
75
|
+
* visually-hidden `aria-live="polite"` status announcement — avoids a
|
|
76
|
+
* DOM-node-per-cell overlay, which would be hundreds of nodes for a year
|
|
77
|
+
* calendar); and a click, or Enter/Space on the focused cell, fires
|
|
78
|
+
* `lyra-cell-click`. `annotations` additionally strokes a ring around
|
|
79
|
+
* specific cells (e.g. to call out an anomaly), each one optionally
|
|
80
|
+
* surfaced in the legend too via `[part="legend-annotation"]`.
|
|
35
81
|
*
|
|
36
82
|
* @customElement lyra-heatmap
|
|
37
|
-
* @
|
|
83
|
+
* @event lyra-cell-click - Fired on click, or Enter/Space on the
|
|
84
|
+
* focused/hovered cell. `detail: { row, col, value }` in matrix mode,
|
|
85
|
+
* `detail: { date, value }` in calendar mode. `cellText` overrides the
|
|
86
|
+
* built-in English "Row X, Col Y: value" / "Mon DD: value" template used for
|
|
87
|
+
* both the hover tooltip and the keyboard live-region announcement.
|
|
88
|
+
* @csspart base, canvas, tooltip, live-region, legend, legend-lo, legend-hi, legend-annotation
|
|
38
89
|
*/
|
|
39
90
|
export declare class LyraHeatmap extends LyraElement {
|
|
40
91
|
static styles: import("lit").CSSResultGroup[];
|
|
@@ -56,26 +107,112 @@ export declare class LyraHeatmap extends LyraElement {
|
|
|
56
107
|
mode: 'matrix' | 'calendar';
|
|
57
108
|
days: CalendarDay[];
|
|
58
109
|
bucketCount: number;
|
|
110
|
+
/** Cells to ring-highlight — `row`/`col` in matrix mode, `date` in calendar mode. See `HeatmapAnnotation`. */
|
|
111
|
+
annotations: HeatmapAnnotation[];
|
|
112
|
+
/** Formats the per-cell tooltip and keyboard live-region text — receives the cell position
|
|
113
|
+
* (`MatrixCellPos` in matrix mode, `CalendarCellPos` in calendar mode) and its value. Falls back to
|
|
114
|
+
* the built-in English "Row X, Col Y: value" / "Mon DD: value" template when unset. */
|
|
115
|
+
cellText?: (pos: MatrixCellPos | CalendarCellPos, value: number) => string;
|
|
59
116
|
private canvas?;
|
|
60
117
|
private resizeObserver?;
|
|
61
118
|
private dprQuery?;
|
|
119
|
+
/** The current value range, refreshed once per update cycle by `willUpdate()`. See `computeValueRange()`. */
|
|
120
|
+
private cachedValueRange;
|
|
121
|
+
/** The cell currently under the pointer (`null` when not hovering one) — drives `[part="tooltip"]`. */
|
|
122
|
+
private hoverCell;
|
|
123
|
+
/** The roving keyboard-focus cell cursor, moved by arrow keys — drives the
|
|
124
|
+
* canvas-drawn focus ring and the `[part="live-region"]` announcement. */
|
|
125
|
+
private focusedCell;
|
|
126
|
+
/** Text of the visually-hidden `aria-live="polite"` status announcement, refreshed on every focus move. */
|
|
127
|
+
private liveText;
|
|
62
128
|
connectedCallback(): void;
|
|
63
129
|
disconnectedCallback(): void;
|
|
64
130
|
private watchDpr;
|
|
65
131
|
private onDprChange;
|
|
66
|
-
protected willUpdate(): void;
|
|
67
|
-
/**
|
|
68
|
-
|
|
132
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
133
|
+
/**
|
|
134
|
+
* The real (non-no-data) value range across `values` (or `days` in
|
|
135
|
+
* calendar mode), or `null` if there is none. Only called from
|
|
136
|
+
* `willUpdate()`, which caches the result in `cachedValueRange` for
|
|
137
|
+
* `render()` and `drawMatrix()` to reuse — `willUpdate()`, `render()`, and
|
|
138
|
+
* `updated()` (which triggers `draw()`) all run within the same Lit update
|
|
139
|
+
* cycle against the same `values`/`days`, so a single scan per cycle
|
|
140
|
+
* suffices instead of one per consumer.
|
|
141
|
+
*/
|
|
142
|
+
private computeValueRange;
|
|
69
143
|
protected updated(): void;
|
|
70
144
|
/** Reads the customizable ramp endpoints off the host's computed style. */
|
|
71
145
|
private scaleEndpoints;
|
|
72
146
|
/** Resolves the `--lyra-color-text-quiet` chrome token for axis labels. */
|
|
73
147
|
private labelColor;
|
|
148
|
+
/** Reads the customizable canvas axis/label font off the host's computed style. */
|
|
149
|
+
private labelFont;
|
|
74
150
|
/** Reads the customizable no-data cell fill off the host's computed style. */
|
|
75
151
|
private noDataFill;
|
|
152
|
+
/** Reads the customizable canvas-drawn keyboard-focus-ring stroke color off the host's computed style. */
|
|
153
|
+
private focusRingColor;
|
|
154
|
+
/** Reads the customizable canvas-drawn annotation-ring stroke color off the host's computed style. */
|
|
155
|
+
private annotationColor;
|
|
76
156
|
private draw;
|
|
77
157
|
private drawCalendar;
|
|
158
|
+
/**
|
|
159
|
+
* Effective per-cell size in matrix mode — `fitToWidth` derives it from
|
|
160
|
+
* the host's measured width, otherwise it's the fixed `cellSize`
|
|
161
|
+
* property. Shared by `drawMatrix()` and the pointer/keyboard hit-testing
|
|
162
|
+
* below (`hitTestMatrix()`, `cellRect()`) so they always agree on exactly
|
|
163
|
+
* the same geometry as what's actually painted.
|
|
164
|
+
*/
|
|
165
|
+
private matrixCellSize;
|
|
78
166
|
private drawMatrix;
|
|
167
|
+
/**
|
|
168
|
+
* Maps a pointer position, in canvas-local CSS px (e.g.
|
|
169
|
+
* `PointerEvent.offsetX/offsetY`), to the cell underneath it — or `null`
|
|
170
|
+
* if the pointer is outside the grid. Dispatches on `mode` so callers
|
|
171
|
+
* don't have to.
|
|
172
|
+
*/
|
|
173
|
+
private hitTest;
|
|
174
|
+
private hitTestMatrix;
|
|
175
|
+
private hitTestCalendar;
|
|
176
|
+
/**
|
|
177
|
+
* Resolves a (week, weekday) grid position to its real calendar date and
|
|
178
|
+
* value. Computed from grid geometry (`firstWeekStart` + offset), not
|
|
179
|
+
* just looked up in `cells` — so a position with no matching entry in
|
|
180
|
+
* `days` (a gap in a sparse calendar) still resolves to a real ISO date,
|
|
181
|
+
* with a `-1` "no data" sentinel value (the same convention `values`' `-1`
|
|
182
|
+
* sentinel uses in matrix mode), instead of being unresolvable.
|
|
183
|
+
*/
|
|
184
|
+
private calendarCellAt;
|
|
185
|
+
/**
|
|
186
|
+
* Pixel rect (canvas-local CSS px) of a cell — shared by `tooltipStyle()`
|
|
187
|
+
* so the tooltip's position always agrees with the same geometry
|
|
188
|
+
* `drawMatrix()`/`drawCalendar()`/`hitTest*()` use.
|
|
189
|
+
*/
|
|
190
|
+
private cellRect;
|
|
191
|
+
/**
|
|
192
|
+
* Human-readable "<label>: <value>" text for a cell — shared by the hover
|
|
193
|
+
* tooltip and the keyboard-focus live-region announcement, so both always
|
|
194
|
+
* describe a cell the same way. This is the built-in English fallback used
|
|
195
|
+
* when `cellText` isn't set — see `resolveCellText()`.
|
|
196
|
+
*/
|
|
197
|
+
private defaultCellText;
|
|
198
|
+
private matrixCellText;
|
|
199
|
+
private calendarCellText;
|
|
200
|
+
/** The raw numeric value at a cell position, in either mode — shared by `resolveCellText()`
|
|
201
|
+
* so a custom `cellText` formatter receives the same value the built-in template would use. */
|
|
202
|
+
private valueAt;
|
|
203
|
+
/** Dispatches to the host-provided `cellText` formatter when set, otherwise the built-in template. */
|
|
204
|
+
private resolveCellText;
|
|
205
|
+
/** Refreshes the visually-hidden live-region text for a newly-focused cell. */
|
|
206
|
+
private announce;
|
|
207
|
+
private emitCellClick;
|
|
208
|
+
/** Inline `style` for `[part="tooltip"]`, centered above the given cell. */
|
|
209
|
+
private tooltipStyle;
|
|
210
|
+
private onPointerMove;
|
|
211
|
+
private onPointerLeave;
|
|
212
|
+
private onCanvasClick;
|
|
213
|
+
private onKeyDown;
|
|
214
|
+
private onMatrixKeyDown;
|
|
215
|
+
private onCalendarKeyDown;
|
|
79
216
|
render(): TemplateResult;
|
|
80
217
|
}
|
|
81
218
|
declare global {
|