basalt-ui 2.15.0 → 2.17.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 +157 -105
- package/MIGRATING.md +160 -12
- package/agent/agents/basalt-design-reviewer.md +3 -3
- package/agent/rules/basalt-mantine.md +1 -1
- package/agent/skills/basalt-design/SKILL.md +2 -2
- package/configs/card-inset.test.ts +57 -0
- package/configs/oxlint-basalt.json +1 -1
- package/configs/oxlint-plugin.js +42 -18
- package/configs/oxlint-plugin.test.ts +37 -6
- package/dist/agent/chat/thread-message.js +1 -1
- package/dist/agent/chat/thread-outcome-card.js +1 -1
- package/dist/charts/ChartCard.js +1 -1
- 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/chart-card.module.css +2 -2
- 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/shot/board.js +1 -1
- package/dist/cli/shot/capture.d.ts +16 -0
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +24 -3
- package/dist/cli/shot/measure.d.ts +21 -2
- package/dist/cli/shot/measure.d.ts.map +1 -1
- package/dist/cli/shot/measure.js +20 -5
- package/dist/cli/shot/playwright.d.ts +4 -0
- package/dist/cli/shot/playwright.d.ts.map +1 -1
- package/dist/cli/shot/types.d.ts +3 -2
- package/dist/cli/shot/types.d.ts.map +1 -1
- 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/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/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +5 -2
- 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 +157 -88
- package/dist/dashboard/stat-card.module.css +222 -9
- 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 +28 -20
- package/dist/guard/guard-hook.d.ts.map +1 -1
- package/dist/guard/index.d.ts +4 -2
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +18 -4
- package/dist/guard/vx-names.d.ts.map +1 -1
- package/dist/guard/vx-names.js +1 -0
- package/dist/shell/app-mobile-nav.module.css +2 -2
- package/dist/shell/app-sidebar-account.js +1 -1
- package/dist/shell/app-sidebar.js +2 -2
- package/dist/shell/app-sidebar.module.css +8 -8
- package/dist/shell/index.js +5 -1
- package/dist/shell/page-bar.js +1 -1
- package/dist/table/data-table.d.ts.map +1 -1
- package/dist/table/data-table.js +3 -0
- 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 +61 -54
- package/dist/tokens/core.d.ts +10 -4
- package/dist/tokens/core.d.ts.map +1 -1
- package/dist/tokens/core.js +16 -10
- package/dist/tokens/ctl-vars.d.ts +15 -0
- package/dist/tokens/ctl-vars.d.ts.map +1 -0
- package/dist/tokens/ctl-vars.js +22 -0
- package/dist/tokens/derive.d.ts.map +1 -1
- package/dist/tokens/derive.js +2 -2
- package/dist/tokens/palette.d.ts +37 -29
- package/dist/tokens/palette.d.ts.map +1 -1
- package/dist/tokens/palette.js +32 -21
- package/dist/tokens/space-scale.d.ts +14 -0
- package/dist/tokens/space-scale.d.ts.map +1 -0
- package/dist/tokens/space-scale.js +10 -0
- package/llms.txt +6 -3
- package/package.json +1 -1
- package/src/agent/chat/thread-message.tsx +1 -1
- package/src/agent/chat/thread-outcome-card.tsx +2 -2
- package/src/charts/ChartCard.tsx +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/chart-card.module.css +2 -2
- 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/shot/board.ts +1 -1
- package/src/cli/shot/capture.ts +35 -3
- package/src/cli/shot/measure.ts +33 -6
- package/src/cli/shot/playwright.ts +1 -1
- package/src/cli/shot/types.ts +3 -2
- package/src/dashboard/delta-badge.tsx +24 -18
- package/src/dashboard/query-state.tsx +38 -0
- package/src/dashboard/settings-section.tsx +5 -2
- package/src/dashboard/stat-card-parts.tsx +108 -0
- package/src/dashboard/stat-card.module.css +222 -9
- package/src/dashboard/stat-card.module.css.d.ts +20 -0
- package/src/dashboard/stat-card.tsx +291 -183
- package/src/dashboard/widget-header.module.css +28 -20
- package/src/dashboard/widget-header.tsx +103 -7
- package/src/guard/guard-hook.ts +3 -1
- package/src/guard/index.ts +27 -13
- package/src/guard/vx-names.ts +1 -0
- package/src/shell/app-mobile-nav.module.css +2 -2
- package/src/shell/app-sidebar-account.tsx +1 -1
- package/src/shell/app-sidebar.module.css +8 -8
- package/src/shell/app-sidebar.tsx +2 -2
- package/src/shell/index.tsx +10 -4
- package/src/shell/page-bar.tsx +1 -1
- package/src/table/data-table.tsx +10 -4
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +185 -85
- 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/ctl-theme.tsx +1 -1
- package/src/theme/index.ts +82 -124
- package/src/tokens/core.ts +16 -8
- package/src/tokens/ctl-vars.ts +32 -0
- package/src/tokens/derive.ts +7 -2
- package/src/tokens/palette.ts +40 -29
- package/src/tokens/space-scale.ts +13 -0
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
|
|
103
103
|
/*
|
|
104
104
|
* The icon slot PINS its glyph's box. A consumer's icon arrives at whatever size its own component
|
|
105
|
-
* chose (the playground's is 18px), and an 18px mark beside a
|
|
105
|
+
* chose (the playground's is 18px), and an 18px mark beside a 13px title is a bullet, not a label
|
|
106
106
|
* icon — so the tier states the size here rather than asking every call site to pass one.
|
|
107
107
|
*/
|
|
108
108
|
/*
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
overflow-wrap: anywhere;
|
|
175
175
|
font-family: var(--basalt-font-mono);
|
|
176
176
|
font-size: var(--vx-text-kpi);
|
|
177
|
-
font-weight:
|
|
177
|
+
font-weight: 500;
|
|
178
178
|
letter-spacing: -0.02em;
|
|
179
179
|
color: var(--vx-ink);
|
|
180
180
|
}
|
|
@@ -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,20 +277,26 @@
|
|
|
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
|
-
|
|
291
|
-
|
|
297
|
+
/* 100% of the viewport (fixed): 2 × BUBBLE_EDGE in widget-header.tsx. */
|
|
298
|
+
max-width: min(260px, calc(100% - 16px));
|
|
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);
|
|
294
302
|
box-shadow: var(--vx-shadow-card);
|
|
@@ -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
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
* />
|
|
31
31
|
*/
|
|
32
32
|
import { useEffect, useId, useRef, useState } from 'react'
|
|
33
|
-
import type { ReactNode } from 'react'
|
|
33
|
+
import type { ReactNode, RefObject } from 'react'
|
|
34
|
+
import { useIsomorphicLayoutEffect } from '../common/isomorphic-layout-effect'
|
|
34
35
|
import { cx } from '../common/props'
|
|
35
36
|
import type { BasaltProps, SlotStylesProps } from '../common/props'
|
|
36
37
|
import { IconSlot } from '../theme/icon-slot'
|
|
@@ -162,6 +163,75 @@ export type WidgetHeaderDeltaProps = Pick<
|
|
|
162
163
|
'delta' | 'deltaPeriod' | 'deltaPolarity' | 'deltaFormat' | 'deltaGlyph'
|
|
163
164
|
>
|
|
164
165
|
|
|
166
|
+
/** Gap between the glyph and its bubble, and the least air the bubble keeps from a viewport edge. */
|
|
167
|
+
const BUBBLE_GAP = 7
|
|
168
|
+
/** Keep in step with `.infoBubble`'s `max-width` (`calc(100% - 2 × BUBBLE_EDGE)`, in CSS). */
|
|
169
|
+
const BUBBLE_EDGE = 8
|
|
170
|
+
|
|
171
|
+
type BubblePos = { top: number; left: number }
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Places the bubble in the VIEWPORT: below the glyph, flipped above when it would overflow the
|
|
175
|
+
* bottom edge, shifted sideways to stay inside the left and right edges. Re-places on scroll, resize
|
|
176
|
+
* and when the bubble's own box changes while open. The bubble is a top-layer popover and
|
|
177
|
+
* `position: fixed`, so a card's `overflow: hidden` (every basalt card has one) can never clip it —
|
|
178
|
+
* the W32 round 0-3 defect at 390. `clear` forgets the position on close, so a reopen starts hidden.
|
|
179
|
+
*/
|
|
180
|
+
function useBubblePosition(
|
|
181
|
+
open: boolean,
|
|
182
|
+
triggerRef: RefObject<HTMLButtonElement | null>,
|
|
183
|
+
bubbleRef: RefObject<HTMLSpanElement | null>,
|
|
184
|
+
): { pos: BubblePos | null; setPos: (pos: BubblePos | null) => void } {
|
|
185
|
+
const [pos, setPos] = useState<BubblePos | null>(null)
|
|
186
|
+
|
|
187
|
+
useIsomorphicLayoutEffect(() => {
|
|
188
|
+
if (!open) return
|
|
189
|
+
// Into the top layer before the first measure. A DOM without the Popover API (happy-dom, an old
|
|
190
|
+
// engine) ignores the attribute and the element stays visible in place, `position: fixed`, which
|
|
191
|
+
// is the same box the placement maths below positions.
|
|
192
|
+
const bubbleEl = bubbleRef.current
|
|
193
|
+
if (bubbleEl !== null && typeof bubbleEl.showPopover === 'function') bubbleEl.showPopover()
|
|
194
|
+
const place = () => {
|
|
195
|
+
const trigger = triggerRef.current
|
|
196
|
+
const bubble = bubbleRef.current
|
|
197
|
+
if (trigger === null || bubble === null) return
|
|
198
|
+
const t = trigger.getBoundingClientRect()
|
|
199
|
+
const b = bubble.getBoundingClientRect()
|
|
200
|
+
// The documentElement's client box is the viewport minus classic scrollbars.
|
|
201
|
+
const viewW = document.documentElement.clientWidth
|
|
202
|
+
const viewH = document.documentElement.clientHeight
|
|
203
|
+
const below = t.bottom + BUBBLE_GAP
|
|
204
|
+
const above = t.top - BUBBLE_GAP - b.height
|
|
205
|
+
const top = below + b.height > viewH - BUBBLE_EDGE && above >= BUBBLE_EDGE ? above : below
|
|
206
|
+
const left = Math.max(BUBBLE_EDGE, Math.min(t.left, viewW - BUBBLE_EDGE - b.width))
|
|
207
|
+
setPos((prev) => (prev?.top === top && prev.left === left ? prev : { top, left }))
|
|
208
|
+
}
|
|
209
|
+
place()
|
|
210
|
+
window.addEventListener('scroll', place, true)
|
|
211
|
+
window.addEventListener('resize', place)
|
|
212
|
+
// The bubble's box changes after open (a late font, the folded note appearing): re-place then too.
|
|
213
|
+
const observer =
|
|
214
|
+
typeof ResizeObserver === 'undefined' || bubbleRef.current === null
|
|
215
|
+
? undefined
|
|
216
|
+
: new ResizeObserver(place)
|
|
217
|
+
if (observer !== undefined && bubbleRef.current !== null) observer.observe(bubbleRef.current)
|
|
218
|
+
return () => {
|
|
219
|
+
window.removeEventListener('scroll', place, true)
|
|
220
|
+
window.removeEventListener('resize', place)
|
|
221
|
+
observer?.disconnect()
|
|
222
|
+
if (
|
|
223
|
+
bubbleEl !== null &&
|
|
224
|
+
typeof bubbleEl.hidePopover === 'function' &&
|
|
225
|
+
bubbleEl.matches(':popover-open')
|
|
226
|
+
) {
|
|
227
|
+
bubbleEl.hidePopover()
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}, [open, triggerRef, bubbleRef])
|
|
231
|
+
|
|
232
|
+
return { pos, setPos }
|
|
233
|
+
}
|
|
234
|
+
|
|
165
235
|
/**
|
|
166
236
|
* The info affordance. A `title` attribute alone was never enough — it renders on hover only, so a
|
|
167
237
|
* keyboard user focusing the glyph saw nothing at all. This is the bubble `ChartCard` used to own
|
|
@@ -193,16 +263,26 @@ export function InfoGlyph({
|
|
|
193
263
|
const [open, setOpen] = useState(false)
|
|
194
264
|
const tipId = useId()
|
|
195
265
|
const triggerRef = useRef<HTMLButtonElement>(null)
|
|
266
|
+
const bubbleRef = useRef<HTMLSpanElement>(null)
|
|
267
|
+
const { pos, setPos } = useBubblePosition(open, triggerRef, bubbleRef)
|
|
268
|
+
const close = () => {
|
|
269
|
+
setOpen(false)
|
|
270
|
+
setPos(null)
|
|
271
|
+
}
|
|
196
272
|
|
|
197
273
|
useEffect(() => {
|
|
198
274
|
if (!open) return
|
|
199
275
|
const handlePointerDown = (event: PointerEvent) => {
|
|
200
|
-
|
|
276
|
+
const target = event.target
|
|
277
|
+
if (!(target instanceof Node)) return
|
|
278
|
+
// The bubble is the trigger's sibling, not inside it, so it needs its own exemption.
|
|
279
|
+
if (triggerRef.current?.contains(target) || bubbleRef.current?.contains(target)) return
|
|
201
280
|
setOpen(false)
|
|
281
|
+
setPos(null)
|
|
202
282
|
}
|
|
203
283
|
document.addEventListener('pointerdown', handlePointerDown)
|
|
204
284
|
return () => document.removeEventListener('pointerdown', handlePointerDown)
|
|
205
|
-
}, [open])
|
|
285
|
+
}, [open, setPos])
|
|
206
286
|
|
|
207
287
|
return (
|
|
208
288
|
<span className={cx(classes.info, className)}>
|
|
@@ -217,12 +297,12 @@ export function InfoGlyph({
|
|
|
217
297
|
aria-describedby={open ? tipId : undefined}
|
|
218
298
|
data-open={open}
|
|
219
299
|
onMouseEnter={() => setOpen(true)}
|
|
220
|
-
onMouseLeave={
|
|
300
|
+
onMouseLeave={close}
|
|
221
301
|
onFocus={() => setOpen(true)}
|
|
222
|
-
onBlur={
|
|
302
|
+
onBlur={close}
|
|
223
303
|
onClick={() => setOpen(true)}
|
|
224
304
|
onKeyDown={(event) => {
|
|
225
|
-
if (event.key === 'Escape')
|
|
305
|
+
if (event.key === 'Escape') close()
|
|
226
306
|
}}
|
|
227
307
|
>
|
|
228
308
|
<svg width={11} height={11} viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
@@ -230,7 +310,23 @@ export function InfoGlyph({
|
|
|
230
310
|
</svg>
|
|
231
311
|
</button>
|
|
232
312
|
{open && (
|
|
233
|
-
|
|
313
|
+
// Rendered IN PLACE as a manual popover, shown into the top layer by `useBubblePosition`: the top
|
|
314
|
+
// layer escapes every ancestor's `overflow: hidden` and `container-type` (a card's), so the
|
|
315
|
+
// bubble needs no portal — `react-dom` is outside `./charts`' allowed import set
|
|
316
|
+
// (`scripts/check-dist-layering.mjs`, V2-SPEC § 9.8). Hidden until the first measure lands: a
|
|
317
|
+
// bubble painted at 0,0 for one frame is a flash in the corner.
|
|
318
|
+
<span
|
|
319
|
+
ref={bubbleRef}
|
|
320
|
+
id={tipId}
|
|
321
|
+
role="tooltip"
|
|
322
|
+
popover="manual"
|
|
323
|
+
className={classes.infoBubble}
|
|
324
|
+
style={
|
|
325
|
+
pos === null
|
|
326
|
+
? { top: 0, left: 0, visibility: 'hidden' }
|
|
327
|
+
: { top: pos.top, left: pos.left }
|
|
328
|
+
}
|
|
329
|
+
>
|
|
234
330
|
{text}
|
|
235
331
|
{note !== undefined && <span className={classes.foldNote}>{note}</span>}
|
|
236
332
|
</span>
|
package/src/guard/guard-hook.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* guard-hook — pure helpers for the Claude Code PreToolUse hook adapter.
|
|
3
|
-
* Mantine-free
|
|
3
|
+
* Mantine-free and light: no non-type imports beyond guard internals and dependency-free leaves
|
|
4
|
+
* (`tokens/space-scale`), never `tokens/palette` or `derive` (their colour math would load on every
|
|
5
|
+
* Write/Edit).
|
|
4
6
|
*/
|
|
5
7
|
import { checkSource } from './index'
|
|
6
8
|
import type { GuardConfig } from './types'
|
package/src/guard/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ./guard — headless policy core. Mantine-free
|
|
2
|
+
* ./guard — headless policy core. Mantine-free and light: it may import dependency-free leaves
|
|
3
|
+
* (`tokens/space-scale`, `common/*`), never `tokens/palette` or `derive` (colour math on every
|
|
4
|
+
* Write/Edit).
|
|
3
5
|
*
|
|
4
6
|
* GUARD_RULES: the closed registry of all 26 violation kinds.
|
|
5
7
|
* checkSource: pure (text, relPath, cfg) → Finding[]. No FS, no walk, no console.
|
|
@@ -9,6 +11,7 @@ import { vxFamilyOf } from '../common/vx-family'
|
|
|
9
11
|
import { BASALT_VX_FAMILIES } from '../common/vx-families'
|
|
10
12
|
import { FONTS_CSS_HINT } from './fonts-hint'
|
|
11
13
|
import { BASALT_VX_NAMES } from './vx-names'
|
|
14
|
+
import { SPACE_SCALE_LEVEL0 } from '../tokens/space-scale'
|
|
12
15
|
|
|
13
16
|
export type { Finding, GuardConfig, GuardKind, GuardSeverity }
|
|
14
17
|
|
|
@@ -192,7 +195,7 @@ const DECLARED_CONTAINER_NAMES = new Set(['basalt-card', 'basalt-form', 'basalt-
|
|
|
192
195
|
|
|
193
196
|
/**
|
|
194
197
|
* `CONTAINER_CLASSES` (`src/tokens/size-classes.ts`) boundaries, duplicated per the `CTL_THEME_TAGS`
|
|
195
|
-
* convention in the oxlint plugin — this module
|
|
198
|
+
* convention in the oxlint plugin — this module keeps to the leaves its file header names and
|
|
196
199
|
* must not import `../tokens`. Pinned against the real table by `check-source.test.ts`. Judged only
|
|
197
200
|
* against `basalt-card` and unnamed queries: the other declared names have no shipped numeric table
|
|
198
201
|
* yet. `0` is the container's own floor, not a class boundary, but `(width >= 0px)` is a legitimate
|
|
@@ -494,7 +497,7 @@ const INLINE_SPACING = new RegExp(
|
|
|
494
497
|
* `exemptPatternMatches`; the escape stays because a per-file exemption is still the wrong shape
|
|
495
498
|
* for a value that has no token).
|
|
496
499
|
*/
|
|
497
|
-
const MICRO_SPACING_CEILING_PX =
|
|
500
|
+
const MICRO_SPACING_CEILING_PX = SPACE_SCALE_LEVEL0.xs - 1
|
|
498
501
|
|
|
499
502
|
/**
|
|
500
503
|
* Object-literal openers that make the properties under them CSS.
|
|
@@ -812,19 +815,19 @@ const SUB_16_FONT_SIZE = /font-?[Ss]ize\s*:\s*['"]?(-?\d+(?:\.\d+)?)(?:px)?['"]?
|
|
|
812
815
|
/** Default spacing steps (px) flagged as raw spacing props. */
|
|
813
816
|
/**
|
|
814
817
|
* The `xs…xl` spacing scale, as raw numbers — what `raw-spacing` flags, because a prop value that
|
|
815
|
-
* EQUALS a step should be written as the token (`p="md"`, not `p={
|
|
818
|
+
* EQUALS a step should be written as the token (`p="md"`, not `p={16}`).
|
|
816
819
|
*
|
|
817
|
-
*
|
|
818
|
-
* the
|
|
819
|
-
*
|
|
820
|
-
*
|
|
821
|
-
* still read `[10, 12, 16, 20, 32]` after the level-0 retune, telling consumers to replace `p={16}`
|
|
822
|
-
* with a `p="md"` that resolves to 18.
|
|
820
|
+
* Read from `tokens/space-scale` — the dependency-free module the token layer's scale is defined
|
|
821
|
+
* from — so the guard cannot drift from it (a separate copy once did: it read `[10, 12, 16, 20, 32]`
|
|
822
|
+
* after a retune and told consumers to replace `p={16}` with a `p="md"` worth 18). The palette itself
|
|
823
|
+
* stays out of the hook: it would drag `derive.ts` + `hct.ts`'s colour math along.
|
|
823
824
|
*
|
|
824
825
|
* A consumer whose theme moves the scale (`createBasaltTheme({ density })`, or its own overrides)
|
|
825
826
|
* sets `basalt.spacingSteps` in package.json rather than living with this default.
|
|
826
827
|
*/
|
|
827
|
-
const DEFAULT_SPACING_STEPS: readonly number[] =
|
|
828
|
+
const DEFAULT_SPACING_STEPS: readonly number[] = Object.values(SPACE_SCALE_LEVEL0).toSorted(
|
|
829
|
+
(a, b) => a - b,
|
|
830
|
+
)
|
|
828
831
|
/** Default off-identity Mantine accent families. */
|
|
829
832
|
const DEFAULT_FORBIDDEN_ACCENTS: readonly string[] = ['teal', 'violet', 'grape', 'indigo', 'pink']
|
|
830
833
|
|
|
@@ -897,7 +900,18 @@ export type GraceEntry = { since: string; promote: string; why: string }
|
|
|
897
900
|
* 'raw-font-family': { since: '1.4.0', promote: '1.5.0', why: 'introduced 1.4.0 — …' },
|
|
898
901
|
* }
|
|
899
902
|
*/
|
|
900
|
-
export const GRACE_PERIOD_KINDS: Partial<Record<GuardKind, GraceEntry>> = {
|
|
903
|
+
export const GRACE_PERIOD_KINDS: Partial<Record<GuardKind, GraceEntry>> = {
|
|
904
|
+
'raw-spacing': {
|
|
905
|
+
since: '2.16.0',
|
|
906
|
+
promote: '2.24.0',
|
|
907
|
+
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.',
|
|
908
|
+
},
|
|
909
|
+
'inline-spacing': {
|
|
910
|
+
since: '2.16.0',
|
|
911
|
+
promote: '2.24.0',
|
|
912
|
+
why: 'The scale moved to 8/12/16/20/24 and the CSS micro ceiling dropped 10 → 7 in 2.16.0: a literal 8px/10px in CSS is newly a finding.',
|
|
913
|
+
},
|
|
914
|
+
}
|
|
901
915
|
|
|
902
916
|
/** A kind's effective severity: consumer override first, then the grace table, then `error`. */
|
|
903
917
|
function severityOf(kind: GuardKind, cfg: GuardConfig): GuardSeverity {
|
|
@@ -2058,7 +2072,7 @@ export const GUARD_RULES = {
|
|
|
2058
2072
|
// JSX-tag-shaped (`<Card withBorder>`) — never appears in CSS text.
|
|
2059
2073
|
appliesTo: (relPath) => !relPath.endsWith('.css'),
|
|
2060
2074
|
message:
|
|
2061
|
-
'withBorder on a Card/Paper double-draws the edge — card depth is --vx-shadow-card, which already bakes a 1px ring into the shadow. Drop the prop (docs/DESIGN-SPEC.md doctrine inversion #1) — and fix the inset in the same edit: an explicit p/padding or radius on that Card/Paper is the other half of the idiom, which only the oxlint lane sees (basalt/card-inset); leave both to the theme or use py="
|
|
2075
|
+
'withBorder on a Card/Paper double-draws the edge — card depth is --vx-shadow-card, which already bakes a 1px ring into the shadow. Drop the prop (docs/DESIGN-SPEC.md doctrine inversion #1) — and fix the inset in the same edit: an explicit p/padding or radius on that Card/Paper is the other half of the idiom, which only the oxlint lane sees (basalt/card-inset); leave both to the theme or use py="sm" px="md".',
|
|
2062
2076
|
},
|
|
2063
2077
|
'off-system-surface-var': {
|
|
2064
2078
|
kind: 'off-system-surface-var',
|
package/src/guard/vx-names.ts
CHANGED
|
@@ -111,6 +111,7 @@ export const BASALT_VX_NAMES: readonly string[] = [
|
|
|
111
111
|
'--vx-space-control-gap',
|
|
112
112
|
'--vx-space-control-height',
|
|
113
113
|
'--vx-space-control-height-ctl',
|
|
114
|
+
'--vx-space-control-height-dense',
|
|
114
115
|
'--vx-space-control-height-tag',
|
|
115
116
|
'--vx-space-control-height-widget',
|
|
116
117
|
'--vx-space-guide-body-gap-bottom',
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
.menuItem :global(.mantine-Menu-itemLabel) {
|
|
161
|
-
font-size: var(--mantine-font-size-
|
|
161
|
+
font-size: var(--mantine-font-size-sm) !important;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
/* An active destination reads the same in the More surface as it does in the sheet. */
|
|
@@ -245,7 +245,7 @@
|
|
|
245
245
|
* touch target with a `min-height` floor and symmetric inset, so growing one side of it would make
|
|
246
246
|
* that row read as a different size from its siblings. */
|
|
247
247
|
.menuDropdown .menuSectionStart {
|
|
248
|
-
margin-top:
|
|
248
|
+
margin-top: var(--vx-space-stack-sm);
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
/*
|
|
@@ -113,7 +113,7 @@ export function SidebarAccount(props: BasaltAccountProps & BasaltProps) {
|
|
|
113
113
|
<span className={classes.footerIconSlot}>
|
|
114
114
|
<IconUser />
|
|
115
115
|
</span>
|
|
116
|
-
<Text className={classes.accountText} fz={VX.text.
|
|
116
|
+
<Text className={classes.accountText} fz={VX.text.sm}>
|
|
117
117
|
Sign in
|
|
118
118
|
</Text>
|
|
119
119
|
</UnstyledButton>
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
.link {
|
|
38
|
-
font-size: var(--vx-text-
|
|
38
|
+
font-size: var(--vx-text-sm);
|
|
39
39
|
border-radius: var(--vx-radius-ctrl) !important;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.link :global(.mantine-NavLink-label) {
|
|
43
|
-
font-size: var(--vx-text-
|
|
43
|
+
font-size: var(--vx-text-sm);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
.link :global(.mantine-NavLink-section[data-position='left']) {
|
|
@@ -229,8 +229,8 @@
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
/*
|
|
232
|
-
* Footer settings row — IDENTICAL geometry to a nav row (
|
|
233
|
-
*
|
|
232
|
+
* Footer settings row — IDENTICAL geometry to a nav row (the row inset tokens, control radius, nav
|
|
233
|
+
* icon gap, `sm` type): muted text + faint icon at rest, ink-6% tint + ink on hover, exactly like an inactive
|
|
234
234
|
* nav item, so the footer never reads as a separate control family.
|
|
235
235
|
*/
|
|
236
236
|
.footerBtn {
|
|
@@ -241,7 +241,7 @@
|
|
|
241
241
|
gap: var(--vx-space-nav-icon-gap);
|
|
242
242
|
padding: var(--vx-space-row-inset-y) var(--vx-space-row-inset-x);
|
|
243
243
|
border-radius: var(--vx-radius-ctrl);
|
|
244
|
-
font-size: var(--vx-text-
|
|
244
|
+
font-size: var(--vx-text-sm);
|
|
245
245
|
/* The nav row's line-height, so a footer row is exactly as tall as a nav row (Mantine's `Text`
|
|
246
246
|
* would otherwise bring its own 1.55 and add ~3px). */
|
|
247
247
|
line-height: var(--vx-space-row-line-height);
|
|
@@ -329,7 +329,7 @@
|
|
|
329
329
|
|
|
330
330
|
/* Identity name — weight 600, ink. */
|
|
331
331
|
.accountName {
|
|
332
|
-
font-size: var(--vx-text-
|
|
332
|
+
font-size: var(--vx-text-sm);
|
|
333
333
|
font-weight: 600;
|
|
334
334
|
color: var(--vx-ink);
|
|
335
335
|
}
|
|
@@ -644,7 +644,7 @@
|
|
|
644
644
|
}
|
|
645
645
|
|
|
646
646
|
.childList :global(.mantine-NavLink-label) {
|
|
647
|
-
font-size: var(--vx-text-
|
|
647
|
+
font-size: var(--vx-text-xs);
|
|
648
648
|
}
|
|
649
649
|
|
|
650
650
|
/*
|
|
@@ -689,7 +689,7 @@
|
|
|
689
689
|
}
|
|
690
690
|
|
|
691
691
|
.subnavDropdown :global(.mantine-NavLink-label) {
|
|
692
|
-
font-size: var(--vx-text-
|
|
692
|
+
font-size: var(--vx-text-sm);
|
|
693
693
|
}
|
|
694
694
|
|
|
695
695
|
/*
|
|
@@ -519,7 +519,7 @@ export function AppSidebar(props: AppSidebarProps) {
|
|
|
519
519
|
target. `SettingsMenuItem.icon` stays optional; supply one per row in the flat form
|
|
520
520
|
and the gear never appears. */}
|
|
521
521
|
<span className={classes.footerIconSlot}>{entry.icon ?? <IconGear />}</span>
|
|
522
|
-
<Text className={classes.footerText} fz={VX.text.
|
|
522
|
+
<Text className={classes.footerText} fz={VX.text.sm}>
|
|
523
523
|
{entry.label}
|
|
524
524
|
</Text>
|
|
525
525
|
{/* The rail ring rides the FIRST row only — one progress block is one mark. */}
|
|
@@ -539,7 +539,7 @@ export function AppSidebar(props: AppSidebarProps) {
|
|
|
539
539
|
<Menu.Target>
|
|
540
540
|
<UnstyledButton className={classes.footerBtn} aria-label="Settings">
|
|
541
541
|
<IconGear />
|
|
542
|
-
<Text className={classes.footerText} fz={VX.text.
|
|
542
|
+
<Text className={classes.footerText} fz={VX.text.sm}>
|
|
543
543
|
Settings
|
|
544
544
|
</Text>
|
|
545
545
|
{ringMark}
|
package/src/shell/index.tsx
CHANGED
|
@@ -390,9 +390,9 @@ function ShellBody({
|
|
|
390
390
|
// `appShellInset` / `appShellInsetMobile` pair (see their entries in `tokens/palette.ts`).
|
|
391
391
|
//
|
|
392
392
|
// On a 390px phone that is 8 a side instead of 13 — 10px more line width, and 10px less vertical
|
|
393
|
-
// chrome, since `padding` is Main's vertical inset too. From `sm` up it is
|
|
394
|
-
//
|
|
395
|
-
//
|
|
393
|
+
// chrome, since `padding` is Main's vertical inset too. From `sm` up it is 16, and 24 from the
|
|
394
|
+
// expanded class (`appShellInsetExpanded`, a trial: SPEC D7). The gutter is not aligned to the
|
|
395
|
+
// sidebar's nav-icon column (x=20); the header's brand zone aligns to that column on its own.
|
|
396
396
|
//
|
|
397
397
|
// VERIFIED against the installed Mantine 9.3 source, because both props take the object by a
|
|
398
398
|
// DIFFERENT road and both had to be checked:
|
|
@@ -406,7 +406,13 @@ function ShellBody({
|
|
|
406
406
|
// `calc(0.5rem * var(--mantine-scale))` — rather than looked up, which is exactly why these are
|
|
407
407
|
// numbers: a spacing KEY resolves to `var(--mantine-spacing-sm)` and hands the gutter back to
|
|
408
408
|
// Mantine's own scale, which is where the 13px came from.
|
|
409
|
-
|
|
409
|
+
//
|
|
410
|
+
// `md` is the expanded class's boundary (`SIZE_CLASS_BREAKPOINTS`): the gutter widens there only.
|
|
411
|
+
const inset = {
|
|
412
|
+
base: step.appShellInsetMobile,
|
|
413
|
+
sm: step.appShellInset,
|
|
414
|
+
md: step.appShellInsetExpanded,
|
|
415
|
+
}
|
|
410
416
|
const aside = useAsideRegion()
|
|
411
417
|
const sizeClass = useSizeClass()
|
|
412
418
|
const [storedCollapsed, setStoredCollapsed, collapseIsSet] = collapseStore(storageKey)()
|
package/src/shell/page-bar.tsx
CHANGED
|
@@ -486,7 +486,7 @@ export function PageBar({
|
|
|
486
486
|
</div>
|
|
487
487
|
)}
|
|
488
488
|
{hasPills && (
|
|
489
|
-
<div className={classes.pills} data-basalt-page-bar-line="pills">
|
|
489
|
+
<div className={classes.pills} data-basalt-page-bar-line="pills" data-basalt-dense>
|
|
490
490
|
{filters !== undefined && (
|
|
491
491
|
<div className={classes.filters}>
|
|
492
492
|
<CtlSlot>{filters}</CtlSlot>
|
package/src/table/data-table.tsx
CHANGED
|
@@ -1008,15 +1008,20 @@ const TABLE_TOOLBAR_STYLE: CSSProperties = { flex: '0 1 auto', minWidth: 0 }
|
|
|
1008
1008
|
* narrow one, for the same one-word query. A stated width also makes the toolbar's own minimum width
|
|
1009
1009
|
* knowable, which is what lets it wrap under the title below `sm` with no media query.
|
|
1010
1010
|
*
|
|
1011
|
-
*
|
|
1012
|
-
* is available and lets it shrink where it is not, floored at `12ch` (a legible
|
|
1013
|
-
* search glyph) and capped at `100%` so it can never be the box that outgrows its
|
|
1014
|
-
* `
|
|
1011
|
+
* The field states a BASIS and a `width`, both `SEARCH_WIDTH`: `flex: 0 1 <SEARCH_WIDTH>px` holds it
|
|
1012
|
+
* at 220px wherever 220 is available and lets it shrink where it is not, floored at `12ch` (a legible
|
|
1013
|
+
* query plus the search glyph) and capped at `100%` so it can never be the box that outgrows its
|
|
1014
|
+
* column. The `width` is the field's intrinsic contribution: the toolbar is sized by its items'
|
|
1015
|
+
* max-content, and an input's own (~196px) came out short of the basis, which wrapped the facet pills
|
|
1016
|
+
* under the search at 1440. It is no floor — `min-width: 12ch` is. A literal `w={220}` in a 302px
|
|
1017
|
+
* column was half of the overflow above.
|
|
1015
1018
|
*/
|
|
1016
1019
|
const SEARCH_WIDTH = 220
|
|
1017
1020
|
/** How long the global search waits after the last keystroke before filtering. */
|
|
1018
1021
|
const SEARCH_DEBOUNCE_MS = 250
|
|
1019
1022
|
const TABLE_SEARCH_STYLE: CSSProperties = {
|
|
1023
|
+
// `width` as well as the basis — see the `SEARCH_WIDTH` JSDoc.
|
|
1024
|
+
width: SEARCH_WIDTH,
|
|
1020
1025
|
flex: `0 1 ${SEARCH_WIDTH}px`,
|
|
1021
1026
|
minWidth: '12ch',
|
|
1022
1027
|
maxWidth: '100%',
|
|
@@ -2022,6 +2027,7 @@ export function BasaltDataTable<T extends RowData>(props: BasaltDataTableProps<T
|
|
|
2022
2027
|
<CtlSlot>
|
|
2023
2028
|
<Group
|
|
2024
2029
|
className={cx(classNames?.toolbar)}
|
|
2030
|
+
data-basalt-dense
|
|
2025
2031
|
gap="xs"
|
|
2026
2032
|
wrap="wrap"
|
|
2027
2033
|
align="center"
|