basalt-ui 2.16.0 → 2.18.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 +165 -124
- package/MIGRATING.md +133 -15
- package/agent/agents/basalt-design-reviewer.md +2 -2
- package/agent/skills/basalt-design/SKILL.md +3 -3
- package/configs/oxlint-plugin.js +2 -2
- package/dist/charts/Donut.d.ts.map +1 -1
- package/dist/charts/Donut.js +2 -2
- package/dist/charts/DualPanel.js +2 -2
- package/dist/charts/Heatmap.d.ts.map +1 -1
- package/dist/charts/Heatmap.js +2 -2
- package/dist/charts/MirroredBars.js +2 -2
- package/dist/charts/Sparkline.d.ts +4 -2
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +3 -3
- package/dist/charts/compile.d.ts +8 -3
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +19 -9
- package/dist/charts/cursor.d.ts +14 -1
- package/dist/charts/cursor.d.ts.map +1 -1
- package/dist/charts/cursor.js +29 -3
- package/dist/charts/date-tick-format.d.ts +17 -0
- package/dist/charts/date-tick-format.d.ts.map +1 -0
- package/dist/charts/date-tick-format.js +81 -0
- package/dist/charts/panel.d.ts +2 -1
- package/dist/charts/panel.d.ts.map +1 -1
- package/dist/charts/panel.js +3 -2
- package/dist/charts/types.d.ts +5 -1
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/cli/help.d.ts +1 -0
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +8 -2
- package/dist/cli/shot/capture.d.ts +28 -1
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +96 -13
- package/dist/cli/shot/index.d.ts +10 -1
- package/dist/cli/shot/index.d.ts.map +1 -1
- package/dist/cli/shot/index.js +40 -5
- package/dist/cli/shot/playwright.d.ts +4 -0
- package/dist/cli/shot/playwright.d.ts.map +1 -1
- package/dist/cli/shot/real-data.d.ts +35 -0
- package/dist/cli/shot/real-data.d.ts.map +1 -0
- package/dist/cli/shot/real-data.js +120 -0
- package/dist/cli/shot/serve.d.ts +2 -2
- package/dist/cli/shot/serve.d.ts.map +1 -1
- package/dist/cli/shot/serve.js +16 -2
- package/dist/dashboard/bar-list.d.ts +29 -0
- package/dist/dashboard/bar-list.d.ts.map +1 -0
- package/dist/dashboard/bar-list.js +52 -0
- package/dist/dashboard/bar-list.module.css +73 -0
- package/dist/dashboard/bar-list.module.css.d.ts +16 -0
- package/dist/dashboard/delta-badge.d.ts +2 -2
- package/dist/dashboard/delta-badge.d.ts.map +1 -1
- package/dist/dashboard/delta-badge.js +12 -14
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +4 -0
- package/dist/dashboard/meter-model.d.ts +78 -0
- package/dist/dashboard/meter-model.d.ts.map +1 -0
- package/dist/dashboard/meter-model.js +91 -0
- package/dist/dashboard/meter-parts.d.ts +42 -0
- package/dist/dashboard/meter-parts.d.ts.map +1 -0
- package/dist/dashboard/meter-parts.js +163 -0
- package/dist/dashboard/meter.d.ts +112 -0
- package/dist/dashboard/meter.d.ts.map +1 -0
- package/dist/dashboard/meter.js +43 -0
- package/dist/dashboard/meter.module.css +150 -0
- package/dist/dashboard/meter.module.css.d.ts +28 -0
- package/dist/dashboard/query-state.d.ts +35 -0
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +12 -1
- package/dist/dashboard/scale.d.ts +9 -0
- package/dist/dashboard/scale.d.ts.map +1 -0
- package/dist/dashboard/scale.js +10 -0
- package/dist/dashboard/stat-card-parts.d.ts +40 -0
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -0
- package/dist/dashboard/stat-card-parts.js +55 -0
- package/dist/dashboard/stat-card.d.ts +46 -34
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +148 -79
- package/dist/dashboard/stat-card.module.css +220 -7
- package/dist/dashboard/stat-card.module.css.d.ts +20 -0
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +73 -9
- package/dist/dashboard/widget-header.module.css +25 -17
- package/dist/guard/index.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/theme/chrome-vars.d.ts +82 -0
- package/dist/theme/chrome-vars.d.ts.map +1 -0
- package/dist/theme/chrome-vars.js +36 -0
- package/dist/theme/controls.module.css +20 -1
- package/dist/theme/controls.module.css.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +30 -33
- package/dist/tokens/derive.d.ts +11 -1
- package/dist/tokens/derive.d.ts.map +1 -1
- package/dist/tokens/derive.js +9 -24
- package/dist/tokens/status-text.d.ts +26 -0
- package/dist/tokens/status-text.d.ts.map +1 -0
- package/dist/tokens/status-text.js +68 -0
- package/llms.txt +36 -4
- package/package.json +1 -1
- package/src/charts/Donut.tsx +2 -2
- package/src/charts/DualPanel.tsx +2 -2
- package/src/charts/Heatmap.tsx +2 -2
- package/src/charts/MirroredBars.tsx +2 -2
- package/src/charts/Sparkline.tsx +7 -5
- package/src/charts/compile.ts +31 -11
- package/src/charts/cursor.ts +48 -3
- package/src/charts/date-tick-format.ts +132 -0
- package/src/charts/panel.tsx +5 -3
- package/src/charts/types.ts +5 -1
- package/src/cli/help.ts +22 -2
- package/src/cli/shot/capture.ts +133 -12
- package/src/cli/shot/index.ts +50 -4
- package/src/cli/shot/playwright.ts +1 -1
- package/src/cli/shot/real-data.ts +165 -0
- package/src/cli/shot/serve.ts +28 -3
- package/src/dashboard/bar-list.module.css +73 -0
- package/src/dashboard/bar-list.module.css.d.ts +16 -0
- package/src/dashboard/bar-list.tsx +112 -0
- package/src/dashboard/delta-badge.tsx +24 -18
- package/src/dashboard/index.ts +2 -0
- package/src/dashboard/meter-model.ts +161 -0
- package/src/dashboard/meter-parts.tsx +223 -0
- package/src/dashboard/meter.module.css +150 -0
- package/src/dashboard/meter.module.css.d.ts +28 -0
- package/src/dashboard/meter.tsx +162 -0
- package/src/dashboard/query-state.tsx +38 -0
- package/src/dashboard/scale.ts +13 -0
- package/src/dashboard/stat-card-parts.tsx +108 -0
- package/src/dashboard/stat-card.module.css +220 -7
- package/src/dashboard/stat-card.module.css.d.ts +20 -0
- package/src/dashboard/stat-card.tsx +282 -174
- package/src/dashboard/widget-header.module.css +25 -17
- package/src/dashboard/widget-header.tsx +103 -7
- package/src/guard/index.ts +2 -2
- package/src/index.ts +4 -0
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +128 -40
- package/src/theme/chrome-vars.ts +111 -0
- package/src/theme/controls.module.css +20 -1
- package/src/theme/controls.module.css.d.ts +1 -0
- package/src/theme/index.ts +39 -101
- package/src/tokens/derive.ts +19 -26
- package/src/tokens/status-text.ts +85 -0
|
@@ -1,9 +1,48 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useId, useRef, useState } from "react";
|
|
3
|
+
import { useIsomorphicLayoutEffect } from "../common/isomorphic-layout-effect.js";
|
|
3
4
|
import { cx } from "../common/props.js";
|
|
4
5
|
import { IconSlot } from "../theme/icon-slot.js";
|
|
5
6
|
import { DeltaBadge } from "./delta-badge.js";
|
|
6
7
|
import classes from "./widget-header.module.css";
|
|
8
|
+
const BUBBLE_GAP = 7;
|
|
9
|
+
const BUBBLE_EDGE = 8;
|
|
10
|
+
function useBubblePosition(open, triggerRef, bubbleRef) {
|
|
11
|
+
const [pos, setPos] = useState(null);
|
|
12
|
+
useIsomorphicLayoutEffect(() => {
|
|
13
|
+
if (!open) return;
|
|
14
|
+
const bubbleEl = bubbleRef.current;
|
|
15
|
+
if (bubbleEl !== null && typeof bubbleEl.showPopover === "function") bubbleEl.showPopover();
|
|
16
|
+
const place = () => {
|
|
17
|
+
const trigger = triggerRef.current;
|
|
18
|
+
const bubble = bubbleRef.current;
|
|
19
|
+
if (trigger === null || bubble === null) return;
|
|
20
|
+
const t = trigger.getBoundingClientRect();
|
|
21
|
+
const b = bubble.getBoundingClientRect();
|
|
22
|
+
const viewW = document.documentElement.clientWidth;
|
|
23
|
+
const viewH = document.documentElement.clientHeight;
|
|
24
|
+
const below = t.bottom + BUBBLE_GAP;
|
|
25
|
+
const above = t.top - BUBBLE_GAP - b.height;
|
|
26
|
+
const top = below + b.height > viewH - BUBBLE_EDGE && above >= BUBBLE_EDGE ? above : below;
|
|
27
|
+
const left = Math.max(BUBBLE_EDGE, Math.min(t.left, viewW - BUBBLE_EDGE - b.width));
|
|
28
|
+
setPos((prev) => prev?.top === top && prev.left === left ? prev : { top, left });
|
|
29
|
+
};
|
|
30
|
+
place();
|
|
31
|
+
window.addEventListener("scroll", place, true);
|
|
32
|
+
window.addEventListener("resize", place);
|
|
33
|
+
const observer = typeof ResizeObserver === "undefined" || bubbleRef.current === null ? void 0 : new ResizeObserver(place);
|
|
34
|
+
if (observer !== void 0 && bubbleRef.current !== null) observer.observe(bubbleRef.current);
|
|
35
|
+
return () => {
|
|
36
|
+
window.removeEventListener("scroll", place, true);
|
|
37
|
+
window.removeEventListener("resize", place);
|
|
38
|
+
observer?.disconnect();
|
|
39
|
+
if (bubbleEl !== null && typeof bubbleEl.hidePopover === "function" && bubbleEl.matches(":popover-open")) {
|
|
40
|
+
bubbleEl.hidePopover();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}, [open, triggerRef, bubbleRef]);
|
|
44
|
+
return { pos, setPos };
|
|
45
|
+
}
|
|
7
46
|
function InfoGlyph({
|
|
8
47
|
text,
|
|
9
48
|
note,
|
|
@@ -13,15 +52,24 @@ function InfoGlyph({
|
|
|
13
52
|
const [open, setOpen] = useState(false);
|
|
14
53
|
const tipId = useId();
|
|
15
54
|
const triggerRef = useRef(null);
|
|
55
|
+
const bubbleRef = useRef(null);
|
|
56
|
+
const { pos, setPos } = useBubblePosition(open, triggerRef, bubbleRef);
|
|
57
|
+
const close = () => {
|
|
58
|
+
setOpen(false);
|
|
59
|
+
setPos(null);
|
|
60
|
+
};
|
|
16
61
|
useEffect(() => {
|
|
17
62
|
if (!open) return;
|
|
18
63
|
const handlePointerDown = (event) => {
|
|
19
|
-
|
|
64
|
+
const target = event.target;
|
|
65
|
+
if (!(target instanceof Node)) return;
|
|
66
|
+
if (triggerRef.current?.contains(target) || bubbleRef.current?.contains(target)) return;
|
|
20
67
|
setOpen(false);
|
|
68
|
+
setPos(null);
|
|
21
69
|
};
|
|
22
70
|
document.addEventListener("pointerdown", handlePointerDown);
|
|
23
71
|
return () => document.removeEventListener("pointerdown", handlePointerDown);
|
|
24
|
-
}, [open]);
|
|
72
|
+
}, [open, setPos]);
|
|
25
73
|
return /* @__PURE__ */ jsxs("span", { className: cx(classes.info, className), children: [
|
|
26
74
|
/* @__PURE__ */ jsx(
|
|
27
75
|
"button",
|
|
@@ -34,20 +82,36 @@ function InfoGlyph({
|
|
|
34
82
|
"aria-describedby": open ? tipId : void 0,
|
|
35
83
|
"data-open": open,
|
|
36
84
|
onMouseEnter: () => setOpen(true),
|
|
37
|
-
onMouseLeave:
|
|
85
|
+
onMouseLeave: close,
|
|
38
86
|
onFocus: () => setOpen(true),
|
|
39
|
-
onBlur:
|
|
87
|
+
onBlur: close,
|
|
40
88
|
onClick: () => setOpen(true),
|
|
41
89
|
onKeyDown: (event) => {
|
|
42
|
-
if (event.key === "Escape")
|
|
90
|
+
if (event.key === "Escape") close();
|
|
43
91
|
},
|
|
44
92
|
children: /* @__PURE__ */ jsx("svg", { width: 11, height: 11, viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm0 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3zm0 5a1 1 0 0 1 1 1v7a1 1 0 1 1-2 0v-7a1 1 0 0 1 1-1z" }) })
|
|
45
93
|
}
|
|
46
94
|
),
|
|
47
|
-
open &&
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
95
|
+
open && // Rendered IN PLACE as a manual popover, shown into the top layer by `useBubblePosition`: the top
|
|
96
|
+
// layer escapes every ancestor's `overflow: hidden` and `container-type` (a card's), so the
|
|
97
|
+
// bubble needs no portal — `react-dom` is outside `./charts`' allowed import set
|
|
98
|
+
// (`scripts/check-dist-layering.mjs`, V2-SPEC § 9.8). Hidden until the first measure lands: a
|
|
99
|
+
// bubble painted at 0,0 for one frame is a flash in the corner.
|
|
100
|
+
/* @__PURE__ */ jsxs(
|
|
101
|
+
"span",
|
|
102
|
+
{
|
|
103
|
+
ref: bubbleRef,
|
|
104
|
+
id: tipId,
|
|
105
|
+
role: "tooltip",
|
|
106
|
+
popover: "manual",
|
|
107
|
+
className: classes.infoBubble,
|
|
108
|
+
style: pos === null ? { top: 0, left: 0, visibility: "hidden" } : { top: pos.top, left: pos.left },
|
|
109
|
+
children: [
|
|
110
|
+
text,
|
|
111
|
+
note !== void 0 && /* @__PURE__ */ jsx("span", { className: classes.foldNote, children: note })
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
)
|
|
51
115
|
] });
|
|
52
116
|
}
|
|
53
117
|
function WidgetHeader({
|
|
@@ -267,7 +267,9 @@
|
|
|
267
267
|
color: var(--vx-muted);
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
/* Folded-subtitle pieces: hidden until a `basalt-card` narrower than 480px shows them (below).
|
|
270
|
+
/* Folded-subtitle pieces: hidden until a `basalt-card` narrower than 480px shows them (below). The
|
|
271
|
+
* bubble is a top-layer popover but stays in the card's DOM subtree, so these ancestor-based rules
|
|
272
|
+
* (container query, short-card flag) still reach `.foldNote` inside it. */
|
|
271
273
|
.foldGlyph,
|
|
272
274
|
.foldNote {
|
|
273
275
|
display: none;
|
|
@@ -275,19 +277,25 @@
|
|
|
275
277
|
|
|
276
278
|
/*
|
|
277
279
|
* The tooltip bubble reads like every other floating surface — panel bg + `shadow-card` + card
|
|
278
|
-
* radius (docs/DESIGN-SPEC.md §5). It opens DOWNWARD
|
|
279
|
-
*
|
|
280
|
-
*
|
|
280
|
+
* radius (docs/DESIGN-SPEC.md §5). It opens DOWNWARD and flips up at the viewport edge.
|
|
281
|
+
* `pointer-events: none` so it can never swallow the pointer on its way back to the trigger's
|
|
282
|
+
* `mouseleave`. Mantine-free by design (this whole folder is), so it is a plain
|
|
281
283
|
* state-driven bubble rather than a Mantine Tooltip — which is also what makes it composable from
|
|
282
284
|
* inside the `charts/` boundary.
|
|
283
285
|
*/
|
|
284
286
|
.infoBubble {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
/* A `popover="manual"` element in the top layer, so no card's `overflow: hidden` or
|
|
288
|
+
* `container-type` clips it; placed from the trigger's rect (`useBubblePosition`), `top`/`left`
|
|
289
|
+
* arrive inline. The UA popover styles (centred, bordered, padded, Canvas background) are reset. */
|
|
290
|
+
position: fixed;
|
|
291
|
+
inset: auto;
|
|
292
|
+
margin: 0;
|
|
293
|
+
border: 0;
|
|
294
|
+
overflow: visible;
|
|
295
|
+
z-index: var(--mantine-z-index-popover, 300);
|
|
289
296
|
width: max-content;
|
|
290
|
-
|
|
297
|
+
/* 100% of the viewport (fixed): 2 × BUBBLE_EDGE in widget-header.tsx. */
|
|
298
|
+
max-width: min(260px, calc(100% - 16px));
|
|
291
299
|
padding: var(--vx-space-stack-sm) var(--vx-space-row-inset-x);
|
|
292
300
|
border-radius: var(--vx-radius-card);
|
|
293
301
|
background-color: var(--vx-surface-panel);
|
|
@@ -306,24 +314,24 @@
|
|
|
306
314
|
display: inline-flex;
|
|
307
315
|
flex: none;
|
|
308
316
|
white-space: nowrap;
|
|
309
|
-
align-items:
|
|
317
|
+
align-items: baseline;
|
|
310
318
|
gap: 3px;
|
|
311
|
-
border-radius: var(--vx-radius-ctrl);
|
|
312
|
-
padding: var(--vx-space-badge-inset-y) var(--vx-space-badge-inset-x);
|
|
313
319
|
font-family: var(--basalt-font-mono);
|
|
314
|
-
font-size: var(--vx-text-
|
|
315
|
-
font-weight:
|
|
320
|
+
font-size: var(--vx-text-sm);
|
|
321
|
+
font-weight: 500;
|
|
316
322
|
line-height: 1;
|
|
317
323
|
}
|
|
318
324
|
|
|
325
|
+
/* The glyph is direction, not a figure: the `micro` rung, so it never lands between two sizes. */
|
|
319
326
|
.deltaGlyph {
|
|
320
|
-
font-size:
|
|
327
|
+
font-size: var(--vx-text-micro);
|
|
321
328
|
}
|
|
322
329
|
|
|
323
330
|
.deltaPeriod {
|
|
324
331
|
margin-inline-start: 4px;
|
|
325
|
-
font-
|
|
326
|
-
|
|
332
|
+
font-size: var(--vx-text-micro);
|
|
333
|
+
font-weight: 400;
|
|
334
|
+
color: var(--vx-muted);
|
|
327
335
|
}
|
|
328
336
|
|
|
329
337
|
/* Card narrower than 480px: the subtitle folds into the info glyph (`InfoGlyph`'s `note`, or
|
package/dist/guard/index.js
CHANGED
|
@@ -259,12 +259,12 @@ const DEFAULT_GUARD_CONFIG = {
|
|
|
259
259
|
const GRACE_PERIOD_KINDS = {
|
|
260
260
|
"raw-spacing": {
|
|
261
261
|
since: "2.16.0",
|
|
262
|
-
promote: "2.
|
|
262
|
+
promote: "2.24.0",
|
|
263
263
|
why: "The spacing scale moved to 8/12/16/20/24 in 2.16.0: a prop value equal to a NEW step (p={16}) is newly a finding."
|
|
264
264
|
},
|
|
265
265
|
"inline-spacing": {
|
|
266
266
|
since: "2.16.0",
|
|
267
|
-
promote: "2.
|
|
267
|
+
promote: "2.24.0",
|
|
268
268
|
why: "The scale moved to 8/12/16/20/24 and the CSS micro ceiling dropped 10 \u2192 7 in 2.16.0: a literal 8px/10px in CSS is newly a finding."
|
|
269
269
|
}
|
|
270
270
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { scrollParentOf, useCoarsePointer, type Tone } from './common/index.js';
|
|
|
13
13
|
export { createBasaltTheme } from './theme/index.js';
|
|
14
14
|
export { ThemeToggle } from './theme/theme-toggle.js';
|
|
15
15
|
export { BasaltShell, PageBar, PageAside, useSizeClass, PageTitle, type ShellBaseProps, type SidebarBlock, type SettingsMenuItem, } from './shell/index.js';
|
|
16
|
-
export { WidgetHeader, DeltaBadge, Section, StatCard, type StatCardBreakdownRow, type StatCardSparklineSize, StatGroup, EmptyState, SettingsSection, SettingsRow, DangerZone, } from './dashboard/index.js';
|
|
16
|
+
export { WidgetHeader, DeltaBadge, Section, StatCard, type StatCardBreakdownRow, type StatCardSparklineSize, StatGroup, EmptyState, SettingsSection, SettingsRow, DangerZone, Meter, type MeterProps, BarList, type BarListProps, } from './dashboard/index.js';
|
|
17
17
|
export { unwrap } from './unwrap.js';
|
|
18
18
|
export type { BasaltRegister, SeriesKey } from './register.js';
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB,MAAM,0BAA0B,CAAA;AACjC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACnG,OAAO,EACL,SAAS,EACT,QAAQ,EACR,SAAS,EACT,UAAU,EACV,YAAY,EACZ,KAAK,SAAS,GACf,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,KAAK,IAAI,EAAE,MAAM,UAAU,CAAA;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EACL,WAAW,EACX,OAAO,EACP,SAAS,EACT,YAAY,EACZ,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,gBAAgB,GACtB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,YAAY,EACZ,UAAU,EACV,OAAO,EACP,QAAQ,EACR,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,EACX,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB,MAAM,0BAA0B,CAAA;AACjC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACnG,OAAO,EACL,SAAS,EACT,QAAQ,EACR,SAAS,EACT,UAAU,EACV,YAAY,EACZ,KAAK,SAAS,GACf,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,KAAK,IAAI,EAAE,MAAM,UAAU,CAAA;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EACL,WAAW,EACX,OAAO,EACP,SAAS,EACT,YAAY,EACZ,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,gBAAgB,GACtB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,YAAY,EACZ,UAAU,EACV,OAAO,EACP,QAAQ,EACR,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,EACX,UAAU,EACV,KAAK,EACL,KAAK,UAAU,EACf,OAAO,EACP,KAAK,YAAY,GAClB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAMjC,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -29,15 +29,19 @@ import {
|
|
|
29
29
|
EmptyState,
|
|
30
30
|
SettingsSection,
|
|
31
31
|
SettingsRow,
|
|
32
|
-
DangerZone
|
|
32
|
+
DangerZone,
|
|
33
|
+
Meter,
|
|
34
|
+
BarList
|
|
33
35
|
} from "./dashboard/index.js";
|
|
34
36
|
import { unwrap } from "./unwrap.js";
|
|
35
37
|
export {
|
|
38
|
+
BarList,
|
|
36
39
|
BasaltProvider,
|
|
37
40
|
BasaltShell,
|
|
38
41
|
DangerZone,
|
|
39
42
|
DeltaBadge,
|
|
40
43
|
EmptyState,
|
|
44
|
+
Meter,
|
|
41
45
|
PageAside,
|
|
42
46
|
PageBar,
|
|
43
47
|
PageTitle,
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component `vars` that carry the Wave 33 chrome (`docs/waves/design-parity/SPEC.md` § 6.12) and the
|
|
3
|
+
* ON-COLOR re-point they sit beside. Pure functions of theme + props, kept out of `theme/index.ts`
|
|
4
|
+
* so the tests can call them directly.
|
|
5
|
+
*/
|
|
6
|
+
import type { MantineTheme } from '@mantine/core';
|
|
7
|
+
/**
|
|
8
|
+
* ON-COLOR: the foreground for a filled surface, decided in CSS. THE fix for Mantine's
|
|
9
|
+
* scheme-blind, contrast-blind `autoContrast`.
|
|
10
|
+
*
|
|
11
|
+
* Mantine picks the filled-variant text color ONCE, in JS, via `parseThemeColor({ color, theme })`
|
|
12
|
+
* — with NO `colorScheme` argument, so it resolves against the LIGHT `primaryShade` and bakes a
|
|
13
|
+
* static `color: var(--mantine-color-white)` into the element, while the BACKGROUND it pairs that
|
|
14
|
+
* with (`--mantine-color-{c}-filled`) stays a scheme-reactive CSS var. It gets away with it
|
|
15
|
+
* upstream only because Mantine's default `primaryShade` is `{ light: 6, dark: 8 }` — DARKER on
|
|
16
|
+
* dark, so white happens to stay right. It is luck, not logic: point `primaryShade.dark` at a
|
|
17
|
+
* lighter shade (as Basalt originally did) and every filled control in dark mode turns white-on-
|
|
18
|
+
* light. And even in one scheme the pick is wrong, because `isLightColor` is a BT.601 BRIGHTNESS
|
|
19
|
+
* test that does not track WCAG contrast — it handed white to lime `#97ba2e` at 2.24:1.
|
|
20
|
+
*
|
|
21
|
+
* Basalt removes the JS decision entirely. A fill is now scheme-INDEPENDENT and sits in a
|
|
22
|
+
* luminance band chosen so a WHITE label always clears AA (see `FILL` / `ACCENT` in
|
|
23
|
+
* tokens/palette.ts), so the on-color is a token, not a computation. `--vx-on-{color}` is emitted
|
|
24
|
+
* per color and resolves in pure CSS at paint time — the same discipline the rest of the `--vx-*`
|
|
25
|
+
* system follows. It is still MEASURED here (`legibleOn`) rather than hardcoded to white, so a
|
|
26
|
+
* consumer that retunes a family outside the band still gets the legible foreground.
|
|
27
|
+
*
|
|
28
|
+
* The palette already KNEW the answer: `ACCENT.onAccent` ("text on an accent fill") existed, and
|
|
29
|
+
* `Composer`'s send button hand-wired `color: var(--vx-on-accent)` — which was the ONLY reason that
|
|
30
|
+
* one control stayed legible while every generic Mantine control did not. The token was right;
|
|
31
|
+
* nothing bound the chrome to it. It is bound now (see `accentBridge` / `familyBridge`), and the
|
|
32
|
+
* Composer no longer needs the override.
|
|
33
|
+
*
|
|
34
|
+
* Fix: never let a foreground be decided in JS. `--vx-on-{color}` is emitted per color under BOTH
|
|
35
|
+
* scheme blocks of `cssVariablesResolver` (each resolved against the shade that scheme actually
|
|
36
|
+
* paints), so the foreground resolves in pure CSS at paint time — the same discipline the rest of
|
|
37
|
+
* the `--vx-*` system already follows. `basaltVariantColorResolver` re-points every filled variant
|
|
38
|
+
* at it, and the components that bypass the variant resolver (Checkbox / Radio / Tabs / Pagination /
|
|
39
|
+
* Stepper / Indicator / Timeline all call Mantine's `getContrastColor` directly) are re-pointed at
|
|
40
|
+
* it too, in `components` below. Regression-locked by `contrast.test.ts`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function onColor(theme: MantineTheme, color: string | undefined): string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The on-color for a component that bypasses the variant resolver and calls Mantine's
|
|
45
|
+
* `getContrastColor` directly. `undefined` (autoContrast off, or a hex / indexed color) leaves
|
|
46
|
+
* Mantine's own value in place — `mergeVars` strips undefined before merging.
|
|
47
|
+
*/
|
|
48
|
+
export declare function onColorFor(theme: MantineTheme, props: {
|
|
49
|
+
color?: string | undefined;
|
|
50
|
+
autoContrast?: boolean | undefined;
|
|
51
|
+
}): string | undefined;
|
|
52
|
+
/** The chrome opt-out: a call site that names a colour (even the primary one) keeps its hue. */
|
|
53
|
+
export declare function hasExplicitColor(color: string | undefined): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* A `subtle` Button / ActionIcon that names no colour takes neutral ink for its label and an
|
|
56
|
+
* ink-6% hover (`docs/DESIGN-SPEC.md` §5 ghost idiom). An explicit `color=` — the primary one
|
|
57
|
+
* included — keeps Mantine's tinted label and hover: `color="red"` on a destructive text action
|
|
58
|
+
* carries its hue as the whole signal. Mantine hands the variant resolver `color || primaryColor`,
|
|
59
|
+
* so only the component props can tell "unnamed" from "primary" — hence vars, not the resolver.
|
|
60
|
+
*/
|
|
61
|
+
export declare function subtleInkVars(props: {
|
|
62
|
+
color?: string | undefined;
|
|
63
|
+
variant?: string | undefined;
|
|
64
|
+
}): {
|
|
65
|
+
color: string | undefined;
|
|
66
|
+
hover: string | undefined;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Tabs vars: the on-color re-point plus the active underline in ink (SPEC § 6.12). Only the
|
|
70
|
+
* underline `default` variant takes ink (`pills` fills with the colour); an explicit `color=` opts
|
|
71
|
+
* out. The return type lists `--tabs-text-color` and `--tabs-radius` because Mantine's
|
|
72
|
+
* `TabsCssVariables` type declares only `--tabs-color` / `--tabs-radius` while Tabs' OWN
|
|
73
|
+
* varsResolver writes `--tabs-text-color` (an upstream type gap).
|
|
74
|
+
*/
|
|
75
|
+
export declare function tabsVars(theme: MantineTheme, props: {
|
|
76
|
+
color?: string | undefined;
|
|
77
|
+
variant?: string | undefined;
|
|
78
|
+
autoContrast?: boolean | undefined;
|
|
79
|
+
}): {
|
|
80
|
+
root: Record<'--tabs-color' | '--tabs-radius' | '--tabs-text-color', string | undefined>;
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=chrome-vars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chrome-vars.d.ts","sourceRoot":"","sources":["../../src/theme/chrome-vars.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAI1F;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,GACxE,MAAM,GAAG,SAAS,CAGpB;AAED,gGAAgG;AAChG,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEnE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B,GAAG;IACF,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAC1B,CAMA;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE;IACL,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACnC,GACA;IAAE,IAAI,EAAE,MAAM,CAAC,cAAc,GAAG,eAAe,GAAG,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;CAAE,CAS9F"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
function onColor(theme, color) {
|
|
2
|
+
const name = color ?? theme.primaryColor;
|
|
3
|
+
if (!Object.prototype.hasOwnProperty.call(theme.colors, name)) return void 0;
|
|
4
|
+
return `var(--vx-on-${name})`;
|
|
5
|
+
}
|
|
6
|
+
function onColorFor(theme, props) {
|
|
7
|
+
const autoContrast = props.autoContrast ?? theme.autoContrast;
|
|
8
|
+
return autoContrast ? onColor(theme, props.color) : void 0;
|
|
9
|
+
}
|
|
10
|
+
function hasExplicitColor(color) {
|
|
11
|
+
return color !== void 0;
|
|
12
|
+
}
|
|
13
|
+
function subtleInkVars(props) {
|
|
14
|
+
const ink = props.variant === "subtle" && !hasExplicitColor(props.color);
|
|
15
|
+
return {
|
|
16
|
+
color: ink ? "var(--vx-ink)" : void 0,
|
|
17
|
+
hover: ink ? "color-mix(in srgb, var(--vx-ink) 6%, transparent)" : void 0
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function tabsVars(theme, props) {
|
|
21
|
+
const underline = !hasExplicitColor(props.color) && (props.variant ?? "default") === "default";
|
|
22
|
+
return {
|
|
23
|
+
root: {
|
|
24
|
+
"--tabs-text-color": onColorFor(theme, props),
|
|
25
|
+
"--tabs-color": underline ? "var(--vx-ink)" : void 0,
|
|
26
|
+
"--tabs-radius": void 0
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
hasExplicitColor,
|
|
32
|
+
onColor,
|
|
33
|
+
onColorFor,
|
|
34
|
+
subtleInkVars,
|
|
35
|
+
tabsVars
|
|
36
|
+
};
|
|
@@ -276,7 +276,7 @@ html .accordionItem {
|
|
|
276
276
|
/*
|
|
277
277
|
* Tabs: the tab-list rule (and the inactive-tab hover underline) is a layout separator — the
|
|
278
278
|
* divider token, not the heavy gray-3/dark-4 line. Mantine's scheme rules sit at (0,2,0); the
|
|
279
|
-
* `html[...]` prefix lands (0,2,1). The active underline
|
|
279
|
+
* `html[...]` prefix lands (0,2,1). The active underline's colour is set in the theme's Tabs `vars`.
|
|
280
280
|
*/
|
|
281
281
|
html[data-mantine-color-scheme] .tabsRoot {
|
|
282
282
|
--tab-border-color: var(--vx-divider);
|
|
@@ -304,3 +304,22 @@ html .tableRoot {
|
|
|
304
304
|
html .tableRoot tbody tr:last-of-type {
|
|
305
305
|
border-bottom: none;
|
|
306
306
|
}
|
|
307
|
+
|
|
308
|
+
/*
|
|
309
|
+
* Badge leading glyph (`leftSection`): the state encoded by shape. 12px on a 20px chip, 4px gap
|
|
310
|
+
* (Mantine's own section margin is spacing.xs / 2 = 4), centred on the label.
|
|
311
|
+
*/
|
|
312
|
+
.badgeSection {
|
|
313
|
+
--badge-section-margin: calc(0.25rem * var(--mantine-scale));
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.badgeSection svg,
|
|
317
|
+
.badgeSection img {
|
|
318
|
+
width: calc(0.75rem * var(--mantine-scale));
|
|
319
|
+
height: calc(0.75rem * var(--mantine-scale));
|
|
320
|
+
flex-shrink: 0;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.badgeSection img {
|
|
324
|
+
object-fit: contain;
|
|
325
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EA0CV,oBAAoB,EAGpB,oBAAoB,EAErB,MAAM,eAAe,CAAA;AAStB,OAAO,KAAK,EAAe,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAKpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EA0CV,oBAAoB,EAGpB,oBAAoB,EAErB,MAAM,eAAe,CAAA;AAStB,OAAO,KAAK,EAAe,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAKpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAUvD;;;;;GAKG;AACH,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAIvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAMvD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAenE,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,iBAAiB;QACzB,YAAY,CAAC,EAAE,YAAY,CAAA;QAC3B,WAAW,CAAC,EAAE,iBAAiB,CAAA;QAC/B,YAAY,CAAC,EAAE,YAAY,CAAA;QAC3B,aAAa,CAAC,EAAE,WAAW,CAAA;KAC5B;CACF;AAm/BD;+EAC+E;AAC/E,eAAO,MAAM,SAAS,EAAE,oBAAuD,CAAA;AA0P/E,6FAA6F;AAC7F,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAE9E,8FAA8F;AAC9F,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAsF7D;;8FAE8F;AAC9F,eAAO,MAAM,oBAAoB,EAAE,oBACc,CAAA;AAEjD,kEAAkE;AAClE,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;IAE9B;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,EAAE,iBAAiB,CAAA;IAEzB;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAE1B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAA;CAC7B,CAAA;AAYD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,aAAa,CAAC,EACrD,OAAO,CAAC,EAAE,wBAAwB,GACjC,oBAAoB,CAiCtB"}
|
package/dist/theme/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import { DEFAULT_DERIVE_CONFIG, isDefaultDeriveConfig, resolveDeriveConfig } fro
|
|
|
17
17
|
import { pxRem, TEXT_LINE, VX } from "../tokens/core.js";
|
|
18
18
|
import { CTL_HEIGHT_VARS } from "../tokens/ctl-vars.js";
|
|
19
19
|
import { SIZE_CLASS_BREAKPOINTS } from "../tokens/size-classes.js";
|
|
20
|
+
import { onColor, onColorFor, subtleInkVars, tabsVars } from "./chrome-vars.js";
|
|
20
21
|
import controlsClasses from "./controls.module.css";
|
|
21
22
|
import floatingClasses from "./floating.module.css";
|
|
22
23
|
import navLinkClasses from "./nav-link.module.css";
|
|
@@ -70,15 +71,6 @@ function buildDarkTuple(data) {
|
|
|
70
71
|
"#09090b"
|
|
71
72
|
];
|
|
72
73
|
}
|
|
73
|
-
function onColor(theme, color) {
|
|
74
|
-
const name = color ?? theme.primaryColor;
|
|
75
|
-
if (!Object.prototype.hasOwnProperty.call(theme.colors, name)) return void 0;
|
|
76
|
-
return `var(--vx-on-${name})`;
|
|
77
|
-
}
|
|
78
|
-
function onColorFor(theme, props) {
|
|
79
|
-
const autoContrast = props.autoContrast ?? theme.autoContrast;
|
|
80
|
-
return autoContrast ? onColor(theme, props.color) : void 0;
|
|
81
|
-
}
|
|
82
74
|
function relativeLuminance(hex) {
|
|
83
75
|
const channels = hexToRgb(hex).map((c) => {
|
|
84
76
|
const s = c / 255;
|
|
@@ -113,10 +105,6 @@ const basaltVariantColorResolver = (input) => {
|
|
|
113
105
|
const autoContrast = input.autoContrast ?? input.theme.autoContrast;
|
|
114
106
|
return autoContrast ? { ...resolved, color: on } : resolved;
|
|
115
107
|
}
|
|
116
|
-
if (input.variant === "subtle") {
|
|
117
|
-
const isDefaultColor = input.color === void 0 || input.color === input.theme.primaryColor;
|
|
118
|
-
return isDefaultColor ? { ...resolved, hover: `color-mix(in srgb, var(--vx-ink) 6%, transparent)` } : resolved;
|
|
119
|
-
}
|
|
120
108
|
if (input.variant === "outline") {
|
|
121
109
|
return { ...resolved, color: `color-mix(in srgb, ${resolved.color} 70%, var(--vx-ink))` };
|
|
122
110
|
}
|
|
@@ -259,10 +247,12 @@ function buildTheme(data, options = {}) {
|
|
|
259
247
|
}
|
|
260
248
|
}
|
|
261
249
|
}),
|
|
262
|
-
//
|
|
263
|
-
//
|
|
264
|
-
|
|
265
|
-
|
|
250
|
+
// Status chip (SPEC § 6.10): `light` + `tight`, neutral until `color=` opts in (the accent is
|
|
251
|
+
// never a status chip's default); a `leftSection` glyph is sized in `badgeSection`.
|
|
252
|
+
Badge: ext({
|
|
253
|
+
defaultProps: { variant: "light", color: "gray", radius: radius.tight },
|
|
254
|
+
classNames: { section: controlsClasses.badgeSection }
|
|
255
|
+
}),
|
|
266
256
|
// Alert renders its title in the body font by default; bring it onto the head-font idiom
|
|
267
257
|
// (docs/DESIGN-SPEC.md §5) like every other titled surface. Radius/padding/color tint are
|
|
268
258
|
// already on-system (defaultRadius 'md' control tier + the variant color resolver), so only
|
|
@@ -425,19 +415,29 @@ function buildTheme(data, options = {}) {
|
|
|
425
415
|
// `size="xs"`) on Mantine's own static height.
|
|
426
416
|
Button: ext({
|
|
427
417
|
classNames: { root: controlsClasses.buttonRoot },
|
|
428
|
-
vars: (_theme, props) =>
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
418
|
+
vars: (_theme, props) => {
|
|
419
|
+
const ink = subtleInkVars(props);
|
|
420
|
+
return {
|
|
421
|
+
root: {
|
|
422
|
+
"--button-height": props.size === "md" ? "calc(var(--vx-space-control-height) * var(--mantine-scale))" : void 0,
|
|
423
|
+
"--button-color": ink.color,
|
|
424
|
+
"--button-hover": ink.hover
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
}
|
|
433
428
|
}),
|
|
434
429
|
ActionIcon: ext({
|
|
435
430
|
classNames: { root: controlsClasses.actionIconRoot },
|
|
436
|
-
vars: (_theme, props) =>
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
431
|
+
vars: (_theme, props) => {
|
|
432
|
+
const ink = subtleInkVars(props);
|
|
433
|
+
return {
|
|
434
|
+
root: {
|
|
435
|
+
"--ai-size": props.size === "md" ? "calc(var(--vx-space-control-height) * var(--mantine-scale))" : void 0,
|
|
436
|
+
"--ai-color": ink.color,
|
|
437
|
+
"--ai-hover": ink.hover
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
441
|
}),
|
|
442
442
|
// CheckboxCard / RadioCard (`withBorder`, true by default): same live regression as Button/
|
|
443
443
|
// ActionIcon before this pass — Mantine ships `border: 1px solid transparent` as the BASE
|
|
@@ -799,14 +799,11 @@ function buildTheme(data, options = {}) {
|
|
|
799
799
|
// The tab-list bottom rule (and the inactive-tab hover underline) is a layout separator, not
|
|
800
800
|
// control chrome — it reads the divider token instead of the heavy gray-3/dark-4 line
|
|
801
801
|
// (controls.module.css; custom properties are stripped from `styles` objects). The active tab
|
|
802
|
-
// underline
|
|
802
|
+
// underline takes ink, not the accent (SPEC § 6.12; DESIGN-CORE § Accent discipline);
|
|
803
|
+
// `color=` opts back in. Only the underline `default` variant — `pills` fills with the colour.
|
|
803
804
|
Tabs: ext({
|
|
804
805
|
classNames: { root: controlsClasses.tabsRoot },
|
|
805
|
-
|
|
806
|
-
// `--tabs-color` / `--tabs-radius`, yet Tabs' OWN varsResolver writes `--tabs-text-color` —
|
|
807
|
-
// an upstream type gap, so the var it actually paints the active tab with is otherwise
|
|
808
|
-
// unreachable from the theme.
|
|
809
|
-
vars: (theme, props) => ({ root: { "--tabs-text-color": onColorFor(theme, props) } })
|
|
806
|
+
vars: tabsVars
|
|
810
807
|
}),
|
|
811
808
|
// ── ON-COLOR re-points (see the ON-COLOR doctrine above) ────────────────────────────────
|
|
812
809
|
// These components never reach `variantColorResolver` — each calls Mantine's `getContrastColor`
|
package/dist/tokens/derive.d.ts
CHANGED
|
@@ -80,9 +80,19 @@ export type DerivedPalette = {
|
|
|
80
80
|
ink: Record<InkKey, ColorPair>;
|
|
81
81
|
status: Record<StatusKey, ColorPair>;
|
|
82
82
|
};
|
|
83
|
+
/** The accepted `lightLevel` / `darkLevel` range; `deriveTokens` clamps to it. */
|
|
84
|
+
export declare const DERIVE_LEVEL_RANGE: {
|
|
85
|
+
readonly min: -5;
|
|
86
|
+
readonly max: 5;
|
|
87
|
+
};
|
|
83
88
|
/** Derive the full palette from a seed accent + neutral family + surface levels.
|
|
84
89
|
* Public level-based entry: maps the -5..5 sliders onto `DeriveParams` (vibrancy x0.72 center,
|
|
85
|
-
* surface +2 baseline) and delegates to `deriveTokensRaw`.
|
|
90
|
+
* surface +2 baseline) and delegates to `deriveTokensRaw`.
|
|
91
|
+
*
|
|
92
|
+
* `lightLevel` / `darkLevel` are clamped to {@link DERIVE_LEVEL_RANGE} (non-finite → 0).
|
|
93
|
+
* @throws Error when no status tone clears 4.5:1 on every text surface — unreachable for clamped
|
|
94
|
+
* levels (the test grid proves it); only a raw shift outside the slider range gets there.
|
|
95
|
+
*/
|
|
86
96
|
export declare function deriveTokens(config: DeriveConfig): DerivedPalette;
|
|
87
97
|
/** Derivation core over continuous params — see `DeriveParams` for the calibration contract. */
|
|
88
98
|
export declare function deriveTokensRaw(config: Pick<DeriveConfig, 'accent' | 'neutral'>, params: DeriveParams): DerivedPalette;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../src/tokens/derive.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../src/tokens/derive.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvC,MAAM,MAAM,YAAY,GAAG;IACzB;;;;;;;;OAQG;IACH,MAAM,EAAE,MAAM,CAAA;IACd,sEAAsE;IACtE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;IAC/C;kGAC8F;IAC9F,UAAU,EAAE,MAAM,CAAA;IAClB;mDAC+C;IAC/C,SAAS,EAAE,MAAM,CAAA;IACjB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;;;OAMG;IACH,gBAAgB,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,8FAA8F;AAC9F,eAAO,MAAM,qBAAqB,EAAE,YAOnC,CAAA;AAID;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAEjF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAEnE;AAuHD,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,KAAK,GACL,MAAM,GACN,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,GACN,QAAQ,GACR,QAAQ,CAAA;AA6DZ,MAAM,MAAM,UAAU,GAClB,IAAI,GACJ,OAAO,GACP,YAAY,GACZ,UAAU,GACV,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,UAAU,CAAA;AA2Bd,MAAM,MAAM,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;AAUvD,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAA;AAE/C;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,6FAA6F;IAC7F,UAAU,EAAE,MAAM,CAAA;IAClB,0EAA0E;IAC1E,eAAe,EAAE,MAAM,CAAA;IACvB,6EAA6E;IAC7E,iBAAiB,EAAE,MAAM,CAAA;IACzB,4EAA4E;IAC5E,gBAAgB,EAAE,MAAM,CAAA;CACzB,CAAA;AAED;8BAC8B;AAC9B,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,SAAS,CAAA;IACjB,WAAW,EAAE,SAAS,CAAA;IACtB,UAAU,EAAE,SAAS,CAAA;IACrB,eAAe,EAAE,SAAS,CAAA;IAC1B,QAAQ,EAAE,SAAS,CAAA;IACnB,IAAI,EAAE,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,CAAA;IACnC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,CAAA;IACtC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;CACrC,CAAA;AAED,kFAAkF;AAClF,eAAO,MAAM,kBAAkB;;;CAA+B,CAAA;AAM9D;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,cAAc,CAUjE;AAED,gGAAgG;AAChG,wBAAgB,eAAe,CAC7B,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,GAAG,SAAS,CAAC,EAChD,MAAM,EAAE,YAAY,GACnB,cAAc,CAgGhB"}
|
package/dist/tokens/derive.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { contrastRatio, hctToHex, hexToHct, yToTone } from "./hct.js";
|
|
2
|
+
import { deriveStatusHexes } from "./status-text.js";
|
|
2
3
|
const DEFAULT_DERIVE_CONFIG = {
|
|
3
4
|
accent: "#0077bd",
|
|
4
5
|
neutral: "zinc",
|
|
@@ -132,19 +133,17 @@ const INK_TONE = {
|
|
|
132
133
|
light: { ink: 15.16, ink2: 27.09, muted: 34.88, faint: 44.5 },
|
|
133
134
|
dark: { ink: 90.94, ink2: 88.12, muted: 84.91, faint: 66.24 }
|
|
134
135
|
};
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
bad: { light: { tone: 43.86, chroma: 54.46 }, dark: { tone: 58.58, chroma: 53.79 } }
|
|
140
|
-
};
|
|
136
|
+
const DERIVE_LEVEL_RANGE = { min: -5, max: 5 };
|
|
137
|
+
function clampLevel(level) {
|
|
138
|
+
return Number.isFinite(level) ? clamp(level, DERIVE_LEVEL_RANGE.min, DERIVE_LEVEL_RANGE.max) : 0;
|
|
139
|
+
}
|
|
141
140
|
function deriveTokens(config) {
|
|
142
141
|
assertValidAccentHex(config.accent);
|
|
143
142
|
return deriveTokensRaw(config, {
|
|
144
143
|
chromaMult: vibrancyChromaMult(config.vibrancy),
|
|
145
144
|
accentToneShift: config.accentBrightness * ACCENT_BRIGHTNESS_TONE_STEP,
|
|
146
|
-
lightSurfaceShift: SURFACE_LEVEL_TONE_STEP * config.lightLevel + SURFACE_BASELINE_TONE_SHIFT,
|
|
147
|
-
darkSurfaceShift: SURFACE_LEVEL_TONE_STEP * config.darkLevel + SURFACE_BASELINE_TONE_SHIFT
|
|
145
|
+
lightSurfaceShift: SURFACE_LEVEL_TONE_STEP * clampLevel(config.lightLevel) + SURFACE_BASELINE_TONE_SHIFT,
|
|
146
|
+
darkSurfaceShift: SURFACE_LEVEL_TONE_STEP * clampLevel(config.darkLevel) + SURFACE_BASELINE_TONE_SHIFT
|
|
148
147
|
});
|
|
149
148
|
}
|
|
150
149
|
function deriveTokensRaw(config, params) {
|
|
@@ -215,22 +214,7 @@ function deriveTokensRaw(config, params) {
|
|
|
215
214
|
dark: hctToHex({ hue: neutral.hue, chroma: neutral.chroma, tone: INK_TONE.dark[key] })
|
|
216
215
|
};
|
|
217
216
|
}
|
|
218
|
-
const status =
|
|
219
|
-
for (const key of Object.keys(STATUS_HUE)) {
|
|
220
|
-
const hue = STATUS_HUE[key];
|
|
221
|
-
status[key] = {
|
|
222
|
-
light: hctToHex({
|
|
223
|
-
hue,
|
|
224
|
-
chroma: STATUS_STOP[key].light.chroma,
|
|
225
|
-
tone: STATUS_STOP[key].light.tone
|
|
226
|
-
}),
|
|
227
|
-
dark: hctToHex({
|
|
228
|
-
hue,
|
|
229
|
-
chroma: STATUS_STOP[key].dark.chroma,
|
|
230
|
-
tone: STATUS_STOP[key].dark.tone
|
|
231
|
-
})
|
|
232
|
-
};
|
|
233
|
-
}
|
|
217
|
+
const status = deriveStatusHexes(surface);
|
|
234
218
|
return {
|
|
235
219
|
accent: { light: accentFill, dark: accentInkDark },
|
|
236
220
|
accentHover: { light: accentFillHover, dark: accentHoverDark },
|
|
@@ -245,6 +229,7 @@ function deriveTokensRaw(config, params) {
|
|
|
245
229
|
}
|
|
246
230
|
export {
|
|
247
231
|
DEFAULT_DERIVE_CONFIG,
|
|
232
|
+
DERIVE_LEVEL_RANGE,
|
|
248
233
|
deriveTokens,
|
|
249
234
|
deriveTokensRaw,
|
|
250
235
|
isDefaultDeriveConfig,
|