basalt-ui 2.23.0 → 2.24.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 +41 -0
- package/MIGRATING.md +225 -12
- package/agent/agents/basalt-design-reviewer.md +2 -2
- package/agent/skills/basalt-design/SKILL.md +1 -1
- package/agent/skills/basalt-design/references/catalogue.md +22 -19
- package/agent/skills/basalt-design/references/states.md +39 -0
- package/dist/charts/Bars.d.ts.map +1 -1
- package/dist/charts/Bars.js +17 -2
- package/dist/charts/CartesianChart.d.ts.map +1 -1
- package/dist/charts/CartesianChart.js +7 -3
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +32 -6
- package/dist/charts/StackedArea.d.ts.map +1 -1
- package/dist/charts/StackedArea.js +5 -1
- package/dist/charts/chart-legend.module.css +16 -0
- package/dist/charts/compile.d.ts +2 -0
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +47 -3
- package/dist/charts/legend.d.ts +0 -6
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +87 -35
- package/dist/charts/sparkline.module.css +59 -6
- package/dist/charts/sparkline.module.css.d.ts +1 -0
- package/dist/charts/state.js +1 -1
- package/dist/charts/types.d.ts +11 -0
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/cli/shot/measure.js +19 -23
- package/dist/dashboard/bar-list.module.css +3 -15
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/meter-model.d.ts +30 -1
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +74 -5
- package/dist/dashboard/meter-parts.d.ts +8 -1
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +64 -21
- package/dist/dashboard/meter.d.ts +8 -1
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +14 -3
- package/dist/dashboard/meter.module.css +42 -2
- package/dist/dashboard/meter.module.css.d.ts +4 -0
- package/dist/dashboard/query-state.d.ts +7 -3
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +14 -6
- package/dist/dashboard/section.d.ts +2 -1
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.module.css +12 -0
- package/dist/dashboard/settings-section.d.ts +1 -1
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +3 -3
- package/dist/dashboard/stat-card.module.css +24 -10
- package/dist/dashboard/stat-group.module.css +8 -0
- package/dist/dashboard/stat-strip.d.ts +3 -2
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +83 -73
- package/dist/dashboard/stat-strip.module.css +22 -38
- package/dist/dashboard/stat-strip.module.css.d.ts +1 -0
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +19 -1
- package/dist/dashboard/widget-header.module.css +6 -0
- package/dist/guard/index.d.ts +2 -2
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +1 -12
- package/dist/table/data-table.js +1 -1
- package/dist/theme/controls.module.css +7 -2
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +7 -5
- package/dist/tokens/palette.d.ts +2 -2
- package/dist/tokens/palette.d.ts.map +1 -1
- package/dist/tokens/palette.js +2 -2
- package/llms.txt +3 -2
- package/package.json +1 -1
- package/src/charts/Bars.tsx +29 -2
- package/src/charts/CartesianChart.tsx +7 -3
- package/src/charts/Sparkline.tsx +66 -21
- package/src/charts/StackedArea.tsx +12 -1
- package/src/charts/chart-legend.module.css +16 -0
- package/src/charts/compile.ts +84 -2
- package/src/charts/legend.tsx +70 -3
- package/src/charts/sparkline.module.css +59 -6
- package/src/charts/sparkline.module.css.d.ts +1 -0
- package/src/charts/state.tsx +1 -1
- package/src/charts/types.ts +9 -0
- package/src/cli/shot/measure.ts +27 -27
- package/src/dashboard/bar-list.module.css +3 -15
- package/src/dashboard/empty-state.tsx +4 -2
- package/src/dashboard/meter-model.ts +124 -7
- package/src/dashboard/meter-parts.tsx +127 -31
- package/src/dashboard/meter.module.css +42 -2
- package/src/dashboard/meter.module.css.d.ts +4 -0
- package/src/dashboard/meter.tsx +22 -3
- package/src/dashboard/query-state.tsx +19 -8
- package/src/dashboard/section.module.css +12 -0
- package/src/dashboard/section.tsx +2 -1
- package/src/dashboard/settings-section.tsx +4 -4
- package/src/dashboard/stat-card.module.css +24 -10
- package/src/dashboard/stat-group.module.css +8 -0
- package/src/dashboard/stat-strip.module.css +22 -38
- package/src/dashboard/stat-strip.module.css.d.ts +1 -0
- package/src/dashboard/stat-strip.tsx +63 -43
- package/src/dashboard/widget-header.module.css +6 -0
- package/src/dashboard/widget-header.tsx +28 -1
- package/src/guard/index.ts +3 -14
- package/src/table/data-table.tsx +1 -1
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +6 -6
- package/src/theme/controls.module.css +7 -2
- package/src/theme/index.ts +7 -5
- package/src/tokens/palette.ts +2 -2
package/dist/cli/shot/measure.js
CHANGED
|
@@ -42,12 +42,11 @@ function finishMeasurement({ texts, radius, nested, ...rest }) {
|
|
|
42
42
|
}
|
|
43
43
|
function measureAnchor(root) {
|
|
44
44
|
const px = (v) => Math.round(parseFloat(String(v)) * 100) / 100;
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
right
|
|
48
|
-
bottom:
|
|
49
|
-
|
|
50
|
-
});
|
|
45
|
+
const edges = (s, p, x = "") => ["top", "right", "bottom", "left"].map((e) => px(s.getPropertyValue(`${p}-${e}${x}`)));
|
|
46
|
+
const sides = (s) => {
|
|
47
|
+
const [top2 = 0, right = 0, bottom2 = 0, left = 0] = edges(s, "padding");
|
|
48
|
+
return { top: top2, right, bottom: bottom2, left };
|
|
49
|
+
};
|
|
51
50
|
const ctx = document.createElement("canvas").getContext("2d", { willReadFrequently: true });
|
|
52
51
|
if (!ctx) throw new Error("no 2d canvas context: cannot read colours");
|
|
53
52
|
const parsed = /* @__PURE__ */ new Map();
|
|
@@ -72,10 +71,11 @@ function measureAnchor(root) {
|
|
|
72
71
|
const a = top2[3] ?? 1;
|
|
73
72
|
return [0, 1, 2, 3].map((i) => i === 3 ? 1 : (top2[i] ?? 0) * a + (under[i] ?? 0) * (1 - a));
|
|
74
73
|
};
|
|
74
|
+
const shown = (s) => s.visibility !== "hidden" && s.display !== "none" && s.opacity !== "0";
|
|
75
|
+
const fills = (s) => shown(s) && s.content !== "none" && (rgba(s.backgroundColor)[3] ?? 0) > 0;
|
|
75
76
|
const visible = (el) => {
|
|
76
77
|
const s = getComputedStyle(el);
|
|
77
|
-
|
|
78
|
-
return s.visibility === "hidden" || s.display === "none" || s.opacity === "0" || r.width === 0 ? null : s;
|
|
78
|
+
return shown(s) && el.getBoundingClientRect().width !== 0 ? s : null;
|
|
79
79
|
};
|
|
80
80
|
const backdrop = (el) => {
|
|
81
81
|
const layers = [];
|
|
@@ -90,16 +90,11 @@ function measureAnchor(root) {
|
|
|
90
90
|
};
|
|
91
91
|
const cs = getComputedStyle(root);
|
|
92
92
|
const rect = root.getBoundingClientRect();
|
|
93
|
-
const widest = Math.max(
|
|
94
|
-
...["Top", "Right", "Bottom", "Left"].map(
|
|
95
|
-
(e) => px(cs.getPropertyValue(`border-${e.toLowerCase()}-width`))
|
|
96
|
-
)
|
|
97
|
-
);
|
|
93
|
+
const widest = Math.max(...edges(cs, "border", "-width"));
|
|
98
94
|
let gap = { row: 0, column: 0 };
|
|
99
95
|
const queue = [root];
|
|
100
96
|
for (let i = 0; i < queue.length && i < 80; i++) {
|
|
101
97
|
const item = queue[i];
|
|
102
|
-
if (!item) break;
|
|
103
98
|
const s = getComputedStyle(item);
|
|
104
99
|
const row = px(s.rowGap) || 0;
|
|
105
100
|
const column = px(s.columnGap) || 0;
|
|
@@ -126,18 +121,20 @@ function measureAnchor(root) {
|
|
|
126
121
|
const s = visible(el);
|
|
127
122
|
if (!s) continue;
|
|
128
123
|
const r = el.getBoundingClientRect();
|
|
129
|
-
const hasBg = (
|
|
130
|
-
const hasBorder =
|
|
131
|
-
(e) => px(s.getPropertyValue(`border-${e.toLowerCase()}-width`)) > 0
|
|
132
|
-
);
|
|
124
|
+
const hasBg = fills(s);
|
|
125
|
+
const hasBorder = edges(s, "border", "-width").some((w) => w > 0);
|
|
133
126
|
if (el !== root && (hasBg || hasBorder) && nested.length < 60) {
|
|
134
127
|
nested.push({
|
|
135
128
|
path: pathOf(el),
|
|
136
129
|
radius: { value: s.borderTopLeftRadius, width: px(r.width), height: px(r.height) },
|
|
137
|
-
padding: sides(s
|
|
130
|
+
padding: sides(s)
|
|
138
131
|
});
|
|
139
132
|
}
|
|
140
|
-
|
|
133
|
+
const pseudo = ["::before", "::after"].some((p) => {
|
|
134
|
+
const ps = getComputedStyle(el, p);
|
|
135
|
+
return fills(ps) && [px(ps.width) - r.width, px(ps.height) - r.height].every((d) => Math.abs(d) <= 2);
|
|
136
|
+
});
|
|
137
|
+
if (el !== root && (/^(svg|img|canvas|video|input|textarea)$/i.test(el.tagName) || (hasBg || hasBorder || pseudo) && r.height < rect.height * 0.9)) {
|
|
141
138
|
painted.push([r.top, r.bottom]);
|
|
142
139
|
}
|
|
143
140
|
const text = Array.from(el.childNodes).filter(
|
|
@@ -162,8 +159,7 @@ function measureAnchor(root) {
|
|
|
162
159
|
bold: parseInt(s.fontWeight, 10) >= 700
|
|
163
160
|
});
|
|
164
161
|
}
|
|
165
|
-
const top = rect
|
|
166
|
-
const bottom = rect.bottom;
|
|
162
|
+
const { top, bottom } = rect;
|
|
167
163
|
let cursor = top;
|
|
168
164
|
let longest = 0;
|
|
169
165
|
for (const [a, b] of painted.toSorted((x, y) => x[0] - y[0])) {
|
|
@@ -174,7 +170,7 @@ function measureAnchor(root) {
|
|
|
174
170
|
const emptyRatio = rect.height > 0 ? Math.round(Math.max(longest, 0) / rect.height * 1e3) / 1e3 : 1;
|
|
175
171
|
return {
|
|
176
172
|
box: { width: px(rect.width), height: px(rect.height) },
|
|
177
|
-
padding: sides(cs
|
|
173
|
+
padding: sides(cs),
|
|
178
174
|
gap,
|
|
179
175
|
radius: { value: cs.borderTopLeftRadius, width: px(rect.width), height: px(rect.height) },
|
|
180
176
|
borderWidth: widest,
|
|
@@ -228,22 +228,10 @@
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
/*
|
|
231
|
-
* A column of DeltaBadges:
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
* a hero metric has no column to line up with (D33: tabular figures only in a table-like column).
|
|
231
|
+
* A column of DeltaBadges: glyph and figure are ONE unit, end-aligned as a whole, so the glyph never drifts
|
|
232
|
+
* from its figure however wide the column ("▲ 9%" and "▲13%" share their right edge and keep the badge's own
|
|
233
|
+
* gap). Tabular figures keep the right edges even (D33: only in a table-like column, not a hero metric).
|
|
235
234
|
*/
|
|
236
235
|
.secondary [data-delta] {
|
|
237
|
-
display: inline-grid;
|
|
238
|
-
grid-template-columns: 1em minmax(4ch, auto);
|
|
239
|
-
justify-items: end;
|
|
240
236
|
font-variant-numeric: tabular-nums;
|
|
241
237
|
}
|
|
242
|
-
|
|
243
|
-
.secondary [data-delta]:not(:has([data-delta-glyph]))::before {
|
|
244
|
-
content: '';
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
.secondary [data-delta-glyph] {
|
|
248
|
-
justify-self: center;
|
|
249
|
-
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../../src/dashboard/empty-state.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../../src/dashboard/empty-state.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEnE,oGAAoG;AACpG,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,QAAQ,CAAA;AAEjF,MAAM,MAAM,eAAe,GAAG,WAAW,GACvC,eAAe,CAAC,cAAc,CAAC,GAAG;IAChC,uFAAuF;IACvF,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB;gCAC4B;IAC5B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC1B,CAAA;AAaH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,KAAK,EACL,WAAW,EACX,MAAM,EACN,IAAI,EACJ,SAAS,EACT,KAAK,EACL,UAAU,GACX,EAAE,eAAe,+BAkDjB"}
|
|
@@ -212,6 +212,8 @@ export type BarModel = {
|
|
|
212
212
|
zoneLabels: readonly ZoneLabel[];
|
|
213
213
|
ticks: readonly TickMark[];
|
|
214
214
|
markerPct: number | undefined;
|
|
215
|
+
/** Percent where the committed fill ends: the reading caption's anchor. Absent on a marked track. */
|
|
216
|
+
fillEndPct: number | undefined;
|
|
215
217
|
targetPct: number | undefined;
|
|
216
218
|
/** The default start caption (the zone is named on the band, so it is the bare reading); `startCaption` decides whether it shows. */
|
|
217
219
|
startText: string;
|
|
@@ -225,11 +227,17 @@ export declare function startCaptionText(model: BarModel, override: ReactNode |
|
|
|
225
227
|
export declare function modelBar(input: BarInput): BarModel;
|
|
226
228
|
/** The ring's one arc, as a fraction of the circumference. */
|
|
227
229
|
export declare const ringFraction: (reading: number, min: number, max: number) => number;
|
|
228
|
-
/**
|
|
230
|
+
/**
|
|
231
|
+
* One caption on the marks row: its natural width and where it is anchored (`pct`), else its edge.
|
|
232
|
+
* `align` is which edge of the caption sits on the mark (default: its centre). `drop` ranks it for
|
|
233
|
+
* dropping when the row is too narrow: the lowest rank goes first, none never drops.
|
|
234
|
+
*/
|
|
229
235
|
export type MarkItem = {
|
|
230
236
|
width: number;
|
|
231
237
|
pct?: number;
|
|
232
238
|
edge?: 'end';
|
|
239
|
+
align?: 'start' | 'center' | 'end';
|
|
240
|
+
drop?: number;
|
|
233
241
|
};
|
|
234
242
|
/**
|
|
235
243
|
* Where each caption of the marks row starts (px, logical start edge), index-aligned with `items`: an
|
|
@@ -240,6 +248,27 @@ export type MarkItem = {
|
|
|
240
248
|
* inside the row: the row then flows and wraps instead.
|
|
241
249
|
*/
|
|
242
250
|
export declare function placeMarkCaptions(items: readonly MarkItem[], rowWidth: number, gap: number): number[] | null;
|
|
251
|
+
/** The furthest a droppable caption may sit from its own mark (Wave 37 r2's "not far"); past it, it drops. */
|
|
252
|
+
export declare const MAX_CAPTION_SHIFT = 24;
|
|
253
|
+
/**
|
|
254
|
+
* `placeMarkCaptions` with dropping: when the captions cannot all clear each other on one line, the
|
|
255
|
+
* droppable ones go one at a time in `drop` rank order (a caption without a rank never goes) until
|
|
256
|
+
* the rest fit. A droppable caption stays while it sits within `MAX_CAPTION_SHIFT` of its mark and
|
|
257
|
+
* moves no undroppable caption (the reading, the target) further than those move with every droppable
|
|
258
|
+
* one dropped: two undroppables that collide on their own are not a reason to drop anything.
|
|
259
|
+
* `starts[i]` is the start of caption `i`, `undefined` when it dropped; `dropped[i]` marks the drop.
|
|
260
|
+
* `null` when even the undroppable ones do not fit, so the row flows instead.
|
|
261
|
+
*/
|
|
262
|
+
export declare function placeCaptionRow(items: readonly MarkItem[], rowWidth: number, gap: number): {
|
|
263
|
+
starts: (number | undefined)[];
|
|
264
|
+
dropped: boolean[];
|
|
265
|
+
} | null;
|
|
266
|
+
/**
|
|
267
|
+
* How many columns the categorical part captions take when they do not fit under their segments:
|
|
268
|
+
* the most columns whose widest-per-column entries fit the row, with no lone entry on the last row
|
|
269
|
+
* (`n % cols === 1`). All in one row when they fit; one column is always valid.
|
|
270
|
+
*/
|
|
271
|
+
export declare function partColumns(widths: readonly number[], rowWidth: number, gap: number): number;
|
|
243
272
|
/**
|
|
244
273
|
* Whether every categorical part's caption fits under its own segment: left-aligned at the part's
|
|
245
274
|
* start and ending before the next part's start (less `gap`) or the row's end. A zero-width part never fits.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meter-model.d.ts","sourceRoot":"","sources":["../../src/dashboard/meter-model.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AACD,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AACD;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAExE,qGAAqG;AACrG,KAAK,SAAS,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAE9C,wGAAwG;AACxG,eAAO,MAAM,SAAS;;;;CAAiC,CAAA;AAIvD,iHAAiH;AACjH,eAAO,MAAM,aAAa,KAAK,CAAA;AAC/B,eAAO,MAAM,QAAQ,KAAK,CAAA;AA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AG,EAAE,MAAM,GACV,OAAO,CAQT"}
|
|
@@ -122,6 +122,11 @@ function placeRowLabels(labels, rowWidth, gap = 0) {
|
|
|
122
122
|
short[i] = useShort;
|
|
123
123
|
kept.push({ box, tick });
|
|
124
124
|
}
|
|
125
|
+
if (short.some(Boolean)) {
|
|
126
|
+
for (const [i, label] of labels.entries()) {
|
|
127
|
+
if (shown[i] && !label.holding && label.short !== void 0) short[i] = true;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
125
130
|
return { shown, short, shift };
|
|
126
131
|
}
|
|
127
132
|
function zoneBand(zone, min, span) {
|
|
@@ -203,6 +208,9 @@ function modelBar(input) {
|
|
|
203
208
|
}),
|
|
204
209
|
ticks,
|
|
205
210
|
markerPct: zoned || striped ? toPct((reading - min) / span) : void 0,
|
|
211
|
+
fillEndPct: zoned || striped ? void 0 : toPct(
|
|
212
|
+
parts.filter((p) => !p.forecast).reduce((end, p) => Math.max(end, p.start + p.size), 0)
|
|
213
|
+
),
|
|
206
214
|
targetPct: target === void 0 ? void 0 : toPct((target - min) / span),
|
|
207
215
|
startText: format(reading),
|
|
208
216
|
endText: endCaptionText(reading, target, format),
|
|
@@ -210,14 +218,18 @@ function modelBar(input) {
|
|
|
210
218
|
};
|
|
211
219
|
}
|
|
212
220
|
const ringFraction = (reading, min, max) => clamp01((reading - min) / spanOf(min, max).span);
|
|
221
|
+
function idealLeft(i, rowWidth) {
|
|
222
|
+
if (i.pct === void 0) return i.edge === "end" ? rowWidth - i.width : 0;
|
|
223
|
+
const at = rowWidth * i.pct / 100;
|
|
224
|
+
const left = i.align === "end" ? at - i.width : i.align === "start" ? at : at - i.width / 2;
|
|
225
|
+
return Math.max(0, Math.min(left, rowWidth - i.width));
|
|
226
|
+
}
|
|
213
227
|
function placeMarkCaptions(items, rowWidth, gap) {
|
|
214
228
|
if (rowWidth <= 0 || !items.some((i) => i.pct !== void 0)) return null;
|
|
215
229
|
if (items.some((i) => i.width > rowWidth)) return null;
|
|
216
|
-
const lefts = items.map((i) =>
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
});
|
|
220
|
-
const order = lefts.map((_, i) => i).toSorted((a, b) => (lefts[a] ?? 0) - (lefts[b] ?? 0));
|
|
230
|
+
const lefts = items.map((i) => idealLeft(i, rowWidth));
|
|
231
|
+
const markAt = (i) => i.pct ?? (i.edge === "end" ? 100 : 0);
|
|
232
|
+
const order = lefts.map((_, i) => i).toSorted((a, b) => markAt(items[a]) - markAt(items[b]) || a - b);
|
|
221
233
|
const widthOf = (i) => items[i]?.width ?? 0;
|
|
222
234
|
for (const [n, i] of order.entries()) {
|
|
223
235
|
const prev = order[n - 1];
|
|
@@ -232,6 +244,60 @@ function placeMarkCaptions(items, rowWidth, gap) {
|
|
|
232
244
|
const first = order[0];
|
|
233
245
|
return first !== void 0 && (lefts[first] ?? 0) < -LABEL_SUBPIXEL ? null : lefts;
|
|
234
246
|
}
|
|
247
|
+
const MAX_CAPTION_SHIFT = 24;
|
|
248
|
+
function placeCaptionRow(items, rowWidth, gap) {
|
|
249
|
+
const fixed = items.map((_, i) => i).filter((i) => items[i]?.drop === void 0);
|
|
250
|
+
const baseline = placeMarkCaptions(
|
|
251
|
+
fixed.map((i) => items[i]),
|
|
252
|
+
rowWidth,
|
|
253
|
+
gap
|
|
254
|
+
);
|
|
255
|
+
if (baseline === null) return null;
|
|
256
|
+
const allowed = new Map(
|
|
257
|
+
fixed.map((i, n) => [
|
|
258
|
+
i,
|
|
259
|
+
Math.abs((baseline[n] ?? 0) - idealLeft(items[i], rowWidth)) + LABEL_SUBPIXEL
|
|
260
|
+
])
|
|
261
|
+
);
|
|
262
|
+
const dropped = items.map(() => false);
|
|
263
|
+
const order = items.map((item, i) => ({ rank: item.drop, i })).filter((d) => d.rank !== void 0).toSorted((a, b) => a.rank - b.rank);
|
|
264
|
+
for (let step = 0; step <= order.length; step++) {
|
|
265
|
+
const kept = items.map((_, i) => i).filter((i) => !dropped[i]);
|
|
266
|
+
const lefts = placeMarkCaptions(
|
|
267
|
+
kept.map((i) => items[i]),
|
|
268
|
+
rowWidth,
|
|
269
|
+
gap
|
|
270
|
+
);
|
|
271
|
+
const settled = lefts !== null && (step === order.length || kept.every((i, n) => {
|
|
272
|
+
const item = items[i];
|
|
273
|
+
const moved = Math.abs((lefts[n] ?? 0) - idealLeft(item, rowWidth));
|
|
274
|
+
if (item.drop === void 0) return moved <= (allowed.get(i) ?? 0);
|
|
275
|
+
return item.pct === void 0 || moved <= MAX_CAPTION_SHIFT;
|
|
276
|
+
}));
|
|
277
|
+
if (lefts !== null && settled) {
|
|
278
|
+
const starts = items.map(() => void 0);
|
|
279
|
+
for (const [n, i] of kept.entries()) starts[i] = lefts[n];
|
|
280
|
+
return { starts, dropped };
|
|
281
|
+
}
|
|
282
|
+
const next = order[step];
|
|
283
|
+
if (next === void 0) return null;
|
|
284
|
+
dropped[next.i] = true;
|
|
285
|
+
}
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
function partColumns(widths, rowWidth, gap) {
|
|
289
|
+
const n = widths.length;
|
|
290
|
+
for (let cols = n; cols > 1; cols--) {
|
|
291
|
+
if (n > cols && n % cols === 1) continue;
|
|
292
|
+
const widest = Array.from(
|
|
293
|
+
{ length: cols },
|
|
294
|
+
(_, c) => Math.max(0, ...widths.filter((_w, i) => i % cols === c))
|
|
295
|
+
);
|
|
296
|
+
const total = widest.reduce((a, b) => a + b, 0) + gap * (cols - 1);
|
|
297
|
+
if (total <= rowWidth + LABEL_SUBPIXEL) return cols;
|
|
298
|
+
}
|
|
299
|
+
return 1;
|
|
300
|
+
}
|
|
235
301
|
function partsFitUnder(parts, rowWidth, gap) {
|
|
236
302
|
if (rowWidth <= 0) return false;
|
|
237
303
|
return parts.every((p, i) => {
|
|
@@ -243,6 +309,7 @@ function partsFitUnder(parts, rowWidth, gap) {
|
|
|
243
309
|
}
|
|
244
310
|
export {
|
|
245
311
|
LABEL_SUBPIXEL,
|
|
312
|
+
MAX_CAPTION_SHIFT,
|
|
246
313
|
RAMP_MAX,
|
|
247
314
|
RAMP_MIN_STEP,
|
|
248
315
|
RAMP_ZONE,
|
|
@@ -252,7 +319,9 @@ export {
|
|
|
252
319
|
layoutSegments,
|
|
253
320
|
modelBar,
|
|
254
321
|
normalizeSegments,
|
|
322
|
+
partColumns,
|
|
255
323
|
partsFitUnder,
|
|
324
|
+
placeCaptionRow,
|
|
256
325
|
placeMarkCaptions,
|
|
257
326
|
placeRowLabels,
|
|
258
327
|
rampStrength,
|
|
@@ -6,15 +6,21 @@ export type Shell = {
|
|
|
6
6
|
/** `size="row"`: one text line tall, no caption rows. */
|
|
7
7
|
row: boolean;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The loaded Meter's footprint at its loaded height: a zoned track keeps the figure row above and the
|
|
11
|
+
* zone-name row below, a plain bar the caption row below, so the card does not jump when data lands.
|
|
12
|
+
*/
|
|
13
|
+
export declare function MeterLoading({ label, ring, zoned, shell, }: {
|
|
10
14
|
label: string;
|
|
11
15
|
ring: boolean;
|
|
16
|
+
zoned: boolean;
|
|
12
17
|
shell: Shell;
|
|
13
18
|
}): import("react").JSX.Element;
|
|
14
19
|
export declare function MeterEmpty(props: {
|
|
15
20
|
label: string;
|
|
16
21
|
text: string | undefined;
|
|
17
22
|
ring: boolean;
|
|
23
|
+
zoned: boolean;
|
|
18
24
|
shell: Shell;
|
|
19
25
|
}): import("react").JSX.Element;
|
|
20
26
|
export declare function MeterRing(props: {
|
|
@@ -49,6 +55,7 @@ export declare function MeterBar(props: {
|
|
|
49
55
|
forecastCaption: string | undefined;
|
|
50
56
|
startCaption: ReactNode;
|
|
51
57
|
endCaption: ReactNode;
|
|
58
|
+
readingAt: 'fill' | 'start' | undefined;
|
|
52
59
|
shell: Shell;
|
|
53
60
|
}): import("react").JSX.Element;
|
|
54
61
|
//# sourceMappingURL=meter-parts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meter-parts.d.ts","sourceRoot":"","sources":["../../src/dashboard/meter-parts.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAa,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"meter-parts.d.ts","sourceRoot":"","sources":["../../src/dashboard/meter-parts.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAa,MAAM,OAAO,CAAA;AAgBhE,OAAO,KAAK,EAEV,YAAY,EACZ,SAAS,EACT,SAAS,EAMV,MAAM,eAAe,CAAA;AAKtB,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,KAAK,EAAE,aAAa,GAAG,SAAS,CAAA;IAChC,yDAAyD;IACzD,GAAG,EAAE,OAAO,CAAA;CACb,CAAA;AAsGD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,GACN,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,OAAO,CAAA;IACd,KAAK,EAAE,KAAK,CAAA;CACb,+BAqBA;AAID,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACxB,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,OAAO,CAAA;IACd,KAAK,EAAE,KAAK,CAAA;CACb,+BAgCA;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,KAAK,EAAE,SAAS,SAAS,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eRowLabels,
|
|
12
13
|
ringFraction,
|
|
13
14
|
ringMarks,
|
|
@@ -82,28 +83,39 @@ const UNIT_AFTER_NUMBER = new RegExp(`(\\d) (?=(?:${UNITS})(?![\\p{L}\\d]))`, "g
|
|
|
82
83
|
const SHORT_LAST_WORD = /([^ ]) ([^ ]{1,6})$/u;
|
|
83
84
|
const glueUnits = (text) => typeof text === "string" ? text.replace(UNIT_AFTER_NUMBER, "$1\xA0") : text;
|
|
84
85
|
const glue = (text) => typeof text === "string" ? String(glueUnits(text)).replace(SHORT_LAST_WORD, "$1\xA0$2") : text;
|
|
86
|
+
function Line({ zoned, children }) {
|
|
87
|
+
return /* @__PURE__ */ jsx("div", { className: cx(classes.line, zoned && classes.lineZoned), "data-meter-line": true, "aria-hidden": true, children });
|
|
88
|
+
}
|
|
85
89
|
function MeterLoading({
|
|
86
90
|
label,
|
|
87
91
|
ring,
|
|
92
|
+
zoned,
|
|
88
93
|
shell
|
|
89
94
|
}) {
|
|
90
95
|
return /* @__PURE__ */ jsxs("div", { ...rootProps(shell), "aria-busy": "true", children: [
|
|
91
96
|
/* @__PURE__ */ jsx(VisuallyHidden, { className: classes.summary, children: `Loading ${label}` }),
|
|
92
97
|
ring ? /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonRing, circle: true }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
98
|
+
zoned && /* @__PURE__ */ jsx(Line, { zoned, children: /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonCaption, radius: "sm" }) }),
|
|
93
99
|
/* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonTrack }),
|
|
94
|
-
/* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonCaption, radius: "sm" })
|
|
100
|
+
/* @__PURE__ */ jsx(Line, { zoned, children: /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonCaption, radius: "sm" }) })
|
|
95
101
|
] })
|
|
96
102
|
] });
|
|
97
103
|
}
|
|
98
104
|
const EMPTY_READING = "\u2014";
|
|
99
105
|
function MeterEmpty(props) {
|
|
100
|
-
const { label, text, ring, shell } = props;
|
|
106
|
+
const { label, text, ring, zoned, shell } = props;
|
|
101
107
|
return /* @__PURE__ */ jsxs("output", { ...rootProps(shell), "aria-label": label, children: [
|
|
102
108
|
ring ? /* @__PURE__ */ jsxs("span", { className: classes.ringBox, children: [
|
|
103
109
|
/* @__PURE__ */ jsx(RingSvg, {}),
|
|
104
110
|
/* @__PURE__ */ jsx("span", { className: classes.ringValue, children: EMPTY_READING })
|
|
105
|
-
] }) : /* @__PURE__ */
|
|
106
|
-
|
|
111
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
112
|
+
zoned && !shell.row && /* @__PURE__ */ jsx(Line, { zoned: true }),
|
|
113
|
+
/* @__PURE__ */ jsx("div", { className: classes.trackBox, children: /* @__PURE__ */ jsx("div", { className: classes.track, "data-meter-track": true }) })
|
|
114
|
+
] }),
|
|
115
|
+
text !== void 0 ? /* @__PURE__ */ jsx("span", { className: classes.empty, children: text }) : !ring && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
116
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { className: classes.summary, children: "No reading" }),
|
|
117
|
+
!shell.row && /* @__PURE__ */ jsx(Line, { zoned })
|
|
118
|
+
] })
|
|
107
119
|
] });
|
|
108
120
|
}
|
|
109
121
|
function MeterRing(props) {
|
|
@@ -308,12 +320,14 @@ function LabelRow({ zones, ticks }) {
|
|
|
308
320
|
function measureItems(row) {
|
|
309
321
|
const kids = [...row.children];
|
|
310
322
|
const widths = kids.map((kid) => {
|
|
311
|
-
const { whiteSpace, flex } = kid.style;
|
|
323
|
+
const { whiteSpace, flex, width: inline } = kid.style;
|
|
312
324
|
kid.style.whiteSpace = "nowrap";
|
|
313
325
|
kid.style.flex = "none";
|
|
326
|
+
kid.style.width = "max-content";
|
|
314
327
|
const width = kid.offsetWidth;
|
|
315
328
|
kid.style.whiteSpace = whiteSpace;
|
|
316
329
|
kid.style.flex = flex;
|
|
330
|
+
kid.style.width = inline;
|
|
317
331
|
return width;
|
|
318
332
|
});
|
|
319
333
|
return { widths, rowWidth: row.clientWidth, gap: columnGapOf(row) };
|
|
@@ -339,10 +353,10 @@ function useMeasured(rowRef, measure, key) {
|
|
|
339
353
|
};
|
|
340
354
|
}, [rowRef, key]);
|
|
341
355
|
}
|
|
342
|
-
const
|
|
356
|
+
const samePlacement = (a, b) => a === b || a !== null && b !== null && a.starts.length === b.starts.length && a.starts.every((v, i) => v === b.starts[i] && a.dropped[i] === b.dropped[i]);
|
|
343
357
|
function CaptionRow({ items }) {
|
|
344
358
|
const rowRef = useRef(null);
|
|
345
|
-
const [
|
|
359
|
+
const [placed, setPlaced] = useState(null);
|
|
346
360
|
useMeasured(
|
|
347
361
|
rowRef,
|
|
348
362
|
(row) => {
|
|
@@ -350,25 +364,32 @@ function CaptionRow({ items }) {
|
|
|
350
364
|
const marks = items.map((item, i) => ({
|
|
351
365
|
width: widths[i] ?? 0,
|
|
352
366
|
...item.pct !== void 0 && { pct: item.pct },
|
|
353
|
-
...item.edge !== void 0 && { edge: item.edge }
|
|
367
|
+
...item.edge !== void 0 && { edge: item.edge },
|
|
368
|
+
...item.align !== void 0 && { align: item.align },
|
|
369
|
+
...item.drop !== void 0 && { drop: item.drop }
|
|
354
370
|
}));
|
|
355
|
-
const next =
|
|
356
|
-
|
|
371
|
+
const next = placeCaptionRow(marks, rowWidth, gap);
|
|
372
|
+
setPlaced((prev) => samePlacement(prev, next) ? prev : next);
|
|
357
373
|
},
|
|
358
|
-
items.map(
|
|
374
|
+
items.map(
|
|
375
|
+
(i) => `${i.key}@${i.pct ?? i.edge ?? ""}${i.align ?? ""}${i.drop ?? ""}:${typeof i.node === "string" ? i.node : ""}`
|
|
376
|
+
).join("\0")
|
|
359
377
|
);
|
|
360
378
|
return /* @__PURE__ */ jsx(
|
|
361
379
|
"div",
|
|
362
380
|
{
|
|
363
381
|
ref: rowRef,
|
|
364
|
-
className: cx(classes.captions,
|
|
382
|
+
className: cx(classes.captions, placed !== null && classes.captionsAnchored),
|
|
365
383
|
"data-meter-captions": true,
|
|
366
|
-
"data-anchored":
|
|
384
|
+
"data-anchored": placed === null ? void 0 : "",
|
|
367
385
|
children: items.map((item, i) => /* @__PURE__ */ jsx(
|
|
368
386
|
"span",
|
|
369
387
|
{
|
|
370
|
-
className: item.end ? classes.captionEnd : classes.caption,
|
|
371
|
-
|
|
388
|
+
className: item.target ? classes.captionTarget : item.end ? classes.captionEnd : classes.caption,
|
|
389
|
+
"data-hidden": placed?.dropped[i] ? "" : void 0,
|
|
390
|
+
...placed?.starts[i] !== void 0 && {
|
|
391
|
+
style: { insetInlineStart: `${placed.starts[i]}px` }
|
|
392
|
+
},
|
|
372
393
|
children: item.node
|
|
373
394
|
},
|
|
374
395
|
item.key
|
|
@@ -380,6 +401,7 @@ function PartCaptions({ captions }) {
|
|
|
380
401
|
const rowRef = useRef(null);
|
|
381
402
|
const [under, setUnder] = useState(false);
|
|
382
403
|
const [overwide, setOverwide] = useState(false);
|
|
404
|
+
const [cols, setCols] = useState(0);
|
|
383
405
|
useMeasured(
|
|
384
406
|
rowRef,
|
|
385
407
|
(row) => {
|
|
@@ -391,6 +413,7 @@ function PartCaptions({ captions }) {
|
|
|
391
413
|
gap
|
|
392
414
|
);
|
|
393
415
|
setUnder(fits);
|
|
416
|
+
setCols(fits ? 0 : partColumns(widths, rowWidth, gap));
|
|
394
417
|
},
|
|
395
418
|
captions.map((c) => `${c.label} ${c.text}@${c.startPct}`).join("\0")
|
|
396
419
|
);
|
|
@@ -401,8 +424,10 @@ function PartCaptions({ captions }) {
|
|
|
401
424
|
className: cx(
|
|
402
425
|
classes.partCaptions,
|
|
403
426
|
under && classes.partCaptionsUnder,
|
|
404
|
-
overwide && classes.partCaptionsWrap
|
|
427
|
+
overwide && classes.partCaptionsWrap,
|
|
428
|
+
cols > 0 && classes.partCaptionsGrid
|
|
405
429
|
),
|
|
430
|
+
style: cols > 0 ? { gridTemplateColumns: `repeat(${cols}, minmax(0, max-content))` } : void 0,
|
|
406
431
|
role: "list",
|
|
407
432
|
"data-meter-parts": true,
|
|
408
433
|
"data-anchored": under ? "" : void 0,
|
|
@@ -456,16 +481,32 @@ function MeterBar(props) {
|
|
|
456
481
|
...labelled
|
|
457
482
|
];
|
|
458
483
|
const zoneLabels = compact ? [] : model.zoneLabels;
|
|
484
|
+
const isEnd = (t) => t.pct <= 0 || t.pct >= 100;
|
|
485
|
+
const aboveTicks = zoneLabels.length > 0 ? tickLabels.filter(isEnd) : tickLabels;
|
|
486
|
+
const belowTicks = zoneLabels.length > 0 ? tickLabels.filter((t) => !isEnd(t)) : [];
|
|
459
487
|
const describedBy = model.describedByText === null ? {} : { "aria-describedby": describedId };
|
|
460
488
|
const endOverride = props.endCaption !== void 0;
|
|
461
489
|
const targetHere = !endOverride && model.targetPct !== void 0 && model.endText !== null;
|
|
462
490
|
const end = compact ? null : endOverride ? props.endCaption : model.endText;
|
|
463
491
|
const items = compact ? [] : [
|
|
464
|
-
...start !== null && !anchored ? [
|
|
492
|
+
...start !== null && !anchored ? [
|
|
493
|
+
{
|
|
494
|
+
key: "start",
|
|
495
|
+
node: glue(start),
|
|
496
|
+
// The reading sits at its fill's end (clamped inside the track); `readingAt="start"` keeps the old start edge.
|
|
497
|
+
...props.readingAt !== "start" && model.fillEndPct !== void 0 && {
|
|
498
|
+
pct: model.fillEndPct,
|
|
499
|
+
align: "end"
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
] : [],
|
|
465
503
|
...model.forecastText !== null ? [
|
|
466
504
|
{
|
|
467
505
|
key: "forecast",
|
|
468
506
|
node: glue(model.forecastText),
|
|
507
|
+
drop: 2,
|
|
508
|
+
// The reading ends at the boundary, the forecast begins there.
|
|
509
|
+
...props.readingAt !== "start" && start !== null && { align: "start" },
|
|
469
510
|
...model.boundaryPct !== void 0 && { pct: model.boundaryPct }
|
|
470
511
|
}
|
|
471
512
|
] : [],
|
|
@@ -474,7 +515,8 @@ function MeterBar(props) {
|
|
|
474
515
|
{
|
|
475
516
|
key: `tick${t.key}`,
|
|
476
517
|
node: glue(t.caption),
|
|
477
|
-
pct: t.pct
|
|
518
|
+
pct: t.pct,
|
|
519
|
+
drop: 1
|
|
478
520
|
}
|
|
479
521
|
]
|
|
480
522
|
),
|
|
@@ -483,13 +525,14 @@ function MeterBar(props) {
|
|
|
483
525
|
key: "end",
|
|
484
526
|
node: glue(end),
|
|
485
527
|
end: true,
|
|
528
|
+
...targetHere && { target: true },
|
|
486
529
|
...targetHere && model.targetPct !== void 0 ? { pct: model.targetPct } : { edge: "end" }
|
|
487
530
|
}
|
|
488
531
|
] : []
|
|
489
532
|
];
|
|
490
533
|
const root = rootProps(shell);
|
|
491
534
|
return /* @__PURE__ */ jsxs("div", { ...root, className: root.className, children: [
|
|
492
|
-
|
|
535
|
+
aboveTicks.length > 0 && /* @__PURE__ */ jsx(LabelRow, { zones: [], ticks: aboveTicks }),
|
|
493
536
|
/* @__PURE__ */ jsxs(
|
|
494
537
|
"div",
|
|
495
538
|
{
|
|
@@ -543,7 +586,7 @@ function MeterBar(props) {
|
|
|
543
586
|
]
|
|
544
587
|
}
|
|
545
588
|
),
|
|
546
|
-
zoneLabels.length > 0 && /* @__PURE__ */ jsx(LabelRow, { zones: zoneLabels, ticks:
|
|
589
|
+
zoneLabels.length > 0 && /* @__PURE__ */ jsx(LabelRow, { zones: zoneLabels, ticks: belowTicks }),
|
|
547
590
|
anchored && /* @__PURE__ */ jsx(ZoneReading, { pct: model.markerPct ?? 0, children: start }),
|
|
548
591
|
model.describedByText !== null && /* @__PURE__ */ jsx(VisuallyHidden, { id: describedId, className: classes.summary, children: model.describedByText }),
|
|
549
592
|
hasParts && /* @__PURE__ */ jsx(PartCaptions, { captions: model.partCaptions }),
|
|
@@ -12,7 +12,7 @@ type Common = BasaltProps & {
|
|
|
12
12
|
format?: (value: number) => string;
|
|
13
13
|
/** Renders a skeleton with the meter's footprint. */
|
|
14
14
|
loading?: boolean;
|
|
15
|
-
/** Muted line shown when there is no reading; none by default (the
|
|
15
|
+
/** Muted line shown when there is no reading; none by default (the muted track stands alone, caption rows blank). */
|
|
16
16
|
emptyText?: string;
|
|
17
17
|
};
|
|
18
18
|
type BarCommon = Common & {
|
|
@@ -61,6 +61,12 @@ type BarCommon = Common & {
|
|
|
61
61
|
* to print it inside a host. A `stops` track prints it only when `true`.
|
|
62
62
|
*/
|
|
63
63
|
reading?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Where the reading caption sits under a plain or segmented bar. `'fill'` (default): at the end of
|
|
66
|
+
* the fill, clamped inside the track (at the start when the fill is too short to hold it).
|
|
67
|
+
* `'start'`: at the track's start, as before 2.24.
|
|
68
|
+
*/
|
|
69
|
+
readingAt?: 'fill' | 'start';
|
|
64
70
|
};
|
|
65
71
|
/**
|
|
66
72
|
* One of four forms; mixing them is a compile error.
|
|
@@ -129,6 +135,7 @@ export type MeterProps = (BarCommon & {
|
|
|
129
135
|
startCaption?: never;
|
|
130
136
|
endCaption?: never;
|
|
131
137
|
reading?: never;
|
|
138
|
+
readingAt?: never;
|
|
132
139
|
stops?: never;
|
|
133
140
|
track?: never;
|
|
134
141
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meter.d.ts","sourceRoot":"","sources":["../../src/dashboard/meter.tsx"],"names":[],"mappings":"AAsDA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAKvE,KAAK,MAAM,GAAG,WAAW,GAAG;IAC1B,mGAAmG;IACnG,KAAK,EAAE,MAAM,CAAA;IACb,8BAA8B;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,8BAA8B;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ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