basalt-ui 2.8.1 → 2.9.1

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.
Files changed (153) hide show
  1. package/AGENTS.md +2 -2
  2. package/CHANGELOG.md +33 -0
  3. package/MIGRATING.md +81 -27
  4. package/README.md +7 -8
  5. package/agent/rules/basalt-controls.md +1 -1
  6. package/agent/rules/basalt-state.md +1 -1
  7. package/agent/skills/basalt-design/SKILL.md +1 -1
  8. package/agent/templates/AGENTS-block.md.tpl +2 -2
  9. package/configs/oxlint-plugin.js +25 -68
  10. package/configs/oxlint-plugin.test.ts +19 -27
  11. package/configs/oxlint.json +4 -0
  12. package/dist/charts/BandStrip.d.ts +1 -1
  13. package/dist/charts/BandStrip.d.ts.map +1 -1
  14. package/dist/charts/BandStrip.js +1 -10
  15. package/dist/charts/MirroredBars.d.ts.map +1 -1
  16. package/dist/charts/MirroredBars.js +2 -9
  17. package/dist/charts/band-fold.d.ts +15 -0
  18. package/dist/charts/band-fold.d.ts.map +1 -0
  19. package/dist/charts/band-fold.js +19 -0
  20. package/dist/charts/index.d.ts +1 -0
  21. package/dist/charts/index.d.ts.map +1 -1
  22. package/dist/charts/index.js +3 -1
  23. package/dist/cli/audit-allows.d.ts.map +1 -1
  24. package/dist/cli/audit-allows.js +1 -1
  25. package/dist/cli/check-theme.d.ts.map +1 -1
  26. package/dist/cli/check-theme.js +4 -1
  27. package/dist/cli/config.d.ts +14 -4
  28. package/dist/cli/config.d.ts.map +1 -1
  29. package/dist/cli/config.js +7 -2
  30. package/dist/cli/doctor-upgrade.d.ts +9 -0
  31. package/dist/cli/doctor-upgrade.d.ts.map +1 -1
  32. package/dist/cli/doctor-upgrade.js +14 -1
  33. package/dist/cli/doctor.d.ts.map +1 -1
  34. package/dist/cli/doctor.js +10 -12
  35. package/dist/cli/help.d.ts.map +1 -1
  36. package/dist/cli/help.js +2 -3
  37. package/dist/cli/index.d.ts +3 -2
  38. package/dist/cli/index.d.ts.map +1 -1
  39. package/dist/cli/index.js +4 -2
  40. package/dist/cli/init.d.ts.map +1 -1
  41. package/dist/cli/init.js +6 -0
  42. package/dist/cli/install-root.d.ts +10 -0
  43. package/dist/cli/install-root.d.ts.map +1 -0
  44. package/dist/cli/install-root.js +32 -0
  45. package/dist/cli/router-wiring.d.ts +4 -2
  46. package/dist/cli/router-wiring.d.ts.map +1 -1
  47. package/dist/cli/router-wiring.js +2 -0
  48. package/dist/cli/sync.d.ts +0 -2
  49. package/dist/cli/sync.d.ts.map +1 -1
  50. package/dist/cli/sync.js +19 -15
  51. package/dist/cli/tokens-css.d.ts.map +1 -1
  52. package/dist/cli/tokens-css.js +1 -6
  53. package/dist/common/errors.d.ts +1 -6
  54. package/dist/common/errors.d.ts.map +1 -1
  55. package/dist/common/errors.js +0 -7
  56. package/dist/common/index.d.ts +1 -1
  57. package/dist/common/index.d.ts.map +1 -1
  58. package/dist/common/index.js +1 -9
  59. package/dist/common/props.d.ts +2 -2
  60. package/dist/common/vx-family.d.ts +1 -1
  61. package/dist/content/toc-click-pin.d.ts +45 -0
  62. package/dist/content/toc-click-pin.d.ts.map +1 -0
  63. package/dist/content/toc-click-pin.js +111 -0
  64. package/dist/content/toc-spy.d.ts +25 -0
  65. package/dist/content/toc-spy.d.ts.map +1 -0
  66. package/dist/content/toc-spy.js +43 -0
  67. package/dist/content/toc.d.ts +1 -4
  68. package/dist/content/toc.d.ts.map +1 -1
  69. package/dist/content/toc.js +38 -49
  70. package/dist/controls/number-filter.d.ts.map +1 -1
  71. package/dist/controls/number-filter.js +1 -1
  72. package/dist/dashboard/index.d.ts +1 -1
  73. package/dist/dashboard/index.d.ts.map +1 -1
  74. package/dist/dashboard/index.js +1 -3
  75. package/dist/dashboard/section.d.ts +10 -2
  76. package/dist/dashboard/section.d.ts.map +1 -1
  77. package/dist/dashboard/section.js +20 -3
  78. package/dist/dashboard/stat-card.d.ts +2 -8
  79. package/dist/dashboard/stat-card.d.ts.map +1 -1
  80. package/dist/dashboard/stat-card.js +1 -1
  81. package/dist/guard/index.d.ts +13 -9
  82. package/dist/guard/index.d.ts.map +1 -1
  83. package/dist/guard/index.js +74 -37
  84. package/dist/guard/types.d.ts +8 -7
  85. package/dist/guard/types.d.ts.map +1 -1
  86. package/dist/guard/vx-names.d.ts +1 -1
  87. package/dist/guard/vx-names.d.ts.map +1 -1
  88. package/dist/guard/vx-names.js +1 -33
  89. package/dist/index.d.ts +2 -2
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/router-tanstack/search-store.d.ts +1 -11
  92. package/dist/router-tanstack/search-store.d.ts.map +1 -1
  93. package/dist/router-tanstack/search-store.js +1 -2
  94. package/dist/shell/index.d.ts +1 -0
  95. package/dist/shell/index.d.ts.map +1 -1
  96. package/dist/shell/index.js +3 -0
  97. package/dist/shell/nav-types.d.ts +1 -1
  98. package/dist/shell/page-bar.d.ts +6 -0
  99. package/dist/shell/page-bar.d.ts.map +1 -1
  100. package/dist/shell/page-bar.js +12 -2
  101. package/dist/state/fields.d.ts +1 -1
  102. package/dist/state/fields.d.ts.map +1 -1
  103. package/dist/state/fields.js +3 -1
  104. package/dist/surfaces.d.ts +1 -1
  105. package/dist/surfaces.d.ts.map +1 -1
  106. package/dist/surfaces.js +5 -11
  107. package/dist/table/data-table.d.ts +2 -2
  108. package/dist/tokens/core.d.ts +0 -10
  109. package/dist/tokens/core.d.ts.map +1 -1
  110. package/dist/tokens/core.js +6 -44
  111. package/llms.txt +24 -8
  112. package/package.json +8 -5
  113. package/src/charts/BandStrip.tsx +4 -16
  114. package/src/charts/MirroredBars.tsx +2 -11
  115. package/src/charts/band-fold.ts +26 -0
  116. package/src/charts/index.ts +1 -0
  117. package/src/cli/audit-allows.ts +1 -3
  118. package/src/cli/check-theme.ts +7 -1
  119. package/src/cli/config.ts +21 -5
  120. package/src/cli/doctor-upgrade.ts +23 -1
  121. package/src/cli/doctor.ts +10 -17
  122. package/src/cli/help.ts +1 -4
  123. package/src/cli/index.ts +9 -6
  124. package/src/cli/init.ts +7 -0
  125. package/src/cli/install-root.ts +40 -0
  126. package/src/cli/router-wiring.ts +6 -2
  127. package/src/cli/sync.ts +28 -17
  128. package/src/cli/tokens-css.ts +0 -5
  129. package/src/common/errors.ts +1 -18
  130. package/src/common/index.ts +1 -8
  131. package/src/common/props.ts +2 -2
  132. package/src/common/vx-family.ts +1 -1
  133. package/src/content/toc-click-pin.ts +156 -0
  134. package/src/content/toc-spy.ts +61 -0
  135. package/src/content/toc.tsx +47 -95
  136. package/src/controls/form-layout.tsx +1 -1
  137. package/src/controls/number-filter.tsx +6 -1
  138. package/src/dashboard/index.ts +1 -6
  139. package/src/dashboard/section.tsx +39 -8
  140. package/src/dashboard/stat-card.tsx +4 -11
  141. package/src/guard/index.ts +114 -89
  142. package/src/guard/types.ts +8 -7
  143. package/src/guard/vx-names.ts +1 -33
  144. package/src/index.ts +1 -2
  145. package/src/router-tanstack/search-store.ts +2 -14
  146. package/src/shell/index.tsx +2 -0
  147. package/src/shell/nav-types.ts +1 -1
  148. package/src/shell/page-bar.tsx +21 -2
  149. package/src/state/fields.ts +7 -2
  150. package/src/surfaces.ts +5 -11
  151. package/src/table/data-table.tsx +2 -2
  152. package/src/tokens/core.ts +6 -67
  153. package/dist/tokens.css +0 -331
@@ -313,17 +313,58 @@ const VX_VAR_REF = /var\(\s*(--vx-[A-Za-z0-9-]*[A-Za-z0-9])(?![A-Za-z0-9-]|\$\{)
313
313
  const VX_LOCAL_DECLARATION =
314
314
  /(?:^|[{;])\s*(--vx-[A-Za-z0-9-]*[A-Za-z0-9])\s*:|[{,]\s*(['"])(--vx-[A-Za-z0-9-]*[A-Za-z0-9])\2\s*:(?!\s*(?:string|number)\b)|\bsetProperty\(\s*['"](--vx-[A-Za-z0-9-]*[A-Za-z0-9])['"]/gm
315
315
 
316
+ /** The twelve fill families `--vx-fill-<family>` / `--vx-fill-hover-<family>` are emitted for. */
317
+ const VX_FILL_FAMILIES = [
318
+ 'gray',
319
+ 'red',
320
+ 'pink',
321
+ 'grape',
322
+ 'violet',
323
+ 'indigo',
324
+ 'cyan',
325
+ 'teal',
326
+ 'green',
327
+ 'lime',
328
+ 'yellow',
329
+ 'orange',
330
+ ] as const
331
+
316
332
  /**
317
333
  * `--vx-*` names basalt once emitted and no longer does, with the replacement MIGRATING names
318
334
  * (`null`: deleted with no replacement). Hand-kept on purpose: it is history, it only grows, and
319
- * `vx-names.test.ts` pins that none of these is live and every replacement is.
335
+ * `vx-names.test.ts` pins that none of these is live and every replacement is. Exported so tests
336
+ * derive their fixtures from it instead of keeping a second copy.
320
337
  */
321
- const REMOVED_VX_NAMES: Readonly<Record<string, string | null>> = {
338
+ export const REMOVED_VX_NAMES: Readonly<Record<string, string | null>> = {
322
339
  '--vx-space-touch-target': '--vx-hit',
323
340
  '--vx-space-touch-control-height': '--vx-hit',
324
341
  '--vx-space-app-header-mobile-actions-height': '--vx-space-sticky-header-clearance',
325
342
  '--vx-space-sticky-header-clearance-mobile': '--vx-space-sticky-header-clearance',
326
343
  '--vx-space-sidebar-brand-inset-top': null,
344
+ // The 1.4.0 camelCase aliases, deleted from 2.x — each names its kebab canonical.
345
+ '--vx-goodSolid': '--vx-good-solid',
346
+ '--vx-badSolid': '--vx-bad-solid',
347
+ '--vx-warnSolid': '--vx-warn-solid',
348
+ '--vx-axisStroke': '--vx-axis-stroke',
349
+ '--vx-dotStroke': '--vx-dot-stroke',
350
+ '--vx-tooltipBg': '--vx-tooltip-bg',
351
+ '--vx-tooltipText': '--vx-tooltip-text',
352
+ '--vx-tooltipMuted': '--vx-tooltip-muted',
353
+ '--vx-tooltipBorder': '--vx-tooltip-border',
354
+ '--vx-tooltipShadow': '--vx-tooltip-shadow',
355
+ '--vx-legendText': '--vx-legend-text',
356
+ '--vx-accentHover': '--vx-accent-hover',
357
+ '--vx-accentFill': '--vx-accent-fill',
358
+ '--vx-accentFillHover': '--vx-accent-fill-hover',
359
+ '--vx-onAccent': '--vx-on-accent',
360
+ '--vx-surface-panelHover': '--vx-surface-panel-hover',
361
+ '--vx-goodSoft': '--vx-good-soft',
362
+ '--vx-goodRef': '--vx-good-ref',
363
+ '--vx-badRef': '--vx-bad-ref',
364
+ '--vx-warnRef': '--vx-warn-ref',
365
+ ...Object.fromEntries(
366
+ VX_FILL_FAMILIES.map((family) => [`--vx-fillHover-${family}`, `--vx-fill-hover-${family}`]),
367
+ ),
327
368
  }
328
369
 
329
370
  const KNOWN_VX_NAMES: ReadonlySet<string> = new Set(BASALT_VX_NAMES)
@@ -654,29 +695,49 @@ const PROSE_CONTEXT_TAG = /<(?:Prose|ArticleLayout|Modal|Drawer)(?![\w])/
654
695
  const CONTROL_HOST_TAG =
655
696
  /<(?:SettingsRow|FormRow|FormGroup|Modal|Drawer|Popover\.Dropdown|Menu\.Dropdown|Composer|FilterSet|PageAside|PanelRow)(?![\w])/
656
697
 
657
- /**
658
- * Open and close tags of the same host names, for the ancestry walk in {@link insideHostTag}. The
659
- * opening alternative tolerates `=>` inside props (`onChange={(v) => …}`) like
660
- * {@link RAW_SELECTION_CONTROL_TAG} does, and a `/>` ending marks a self-closing host, which opens
661
- * nothing.
662
- */
663
- const CONTROL_HOST_TAG_SCAN = new RegExp(
664
- `<(/?)(?:${/\(\?:([^)]*)\)/.exec(CONTROL_HOST_TAG.source)?.[1] ?? ''})(?![\\w])(?:=>|[^>])*?>`,
698
+ /** An opening or closing host tag's name — the anchor of the walk in {@link insideHostTag}. */
699
+ const CONTROL_HOST_TAG_NAME = new RegExp(
700
+ `<(/?)(?:${/\(\?:([^)]*)\)/.exec(CONTROL_HOST_TAG.source)?.[1] ?? ''})(?![\\w])`,
665
701
  'g',
666
702
  )
667
703
 
668
704
  /**
669
- * Whether `offset` sits inside a host tag — one opened before it and not yet closed. The text lane
670
- * has no AST, but the nesting of host tags in plain JSX is countable: +1 per opening tag, −1 per
671
- * closing one, self-closing tags neither. That is what the plugin's `control-outside-home` answers
672
- * by walking ancestors, so a control 40 lines under its `<SettingsRow>` is as homed here as there,
673
- * and one after the row closed is not — the cases a fixed line window got wrong in both directions.
705
+ * The index of the `>` that ends the opening tag whose attributes start at `from`, or -1 when the
706
+ * text stops first. A `>` inside `{…}` (`=>`, a nested `<Select />`) or a quoted attribute value
707
+ * does not end it, which is what a lazy `[^>]*?>` got wrong: `control={<Select />}` ended at the
708
+ * Select's own `/>`.
709
+ */
710
+ function openingTagEnd(codeText: string, from: number): number {
711
+ let braces = 0
712
+ let quote = ''
713
+ for (let i = from; i < codeText.length; i++) {
714
+ const ch = codeText[i]
715
+ if (quote !== '') {
716
+ if (ch === quote) quote = ''
717
+ } else if (braces === 0 && (ch === '"' || ch === "'")) quote = ch
718
+ else if (ch === '{') braces += 1
719
+ else if (ch === '}') braces -= 1
720
+ else if (ch === '>' && braces === 0) return i
721
+ }
722
+ return -1
723
+ }
724
+
725
+ /**
726
+ * Whether `offset` sits inside a host tag — in its attributes (`control={<Select />}`) or between
727
+ * its open and close tags. The text lane has no AST, but the nesting of host tags in plain JSX is
728
+ * countable: +1 per opening tag, −1 per closing one, self-closing tags neither. That is what the
729
+ * plugin's `control-outside-home` answers by walking ancestors (a `control=` prop and the children
730
+ * are both descendants of the row), so a control 40 lines under its `<SettingsRow>` is as homed here
731
+ * as there, and one after the row closed is not.
674
732
  */
675
733
  function insideHostTag(codeText: string, offset: number): boolean {
676
734
  let depth = 0
677
- for (const m of codeText.slice(0, offset).matchAll(CONTROL_HOST_TAG_SCAN)) {
735
+ for (const m of codeText.matchAll(CONTROL_HOST_TAG_NAME)) {
736
+ if (m.index >= offset) break
737
+ const end = openingTagEnd(codeText, m.index + m[0].length)
738
+ if (end === -1 || end >= offset) return m[1] !== '/'
678
739
  if (m[1] === '/') depth = Math.max(0, depth - 1)
679
- else if (!m[0].endsWith('/>')) depth += 1
740
+ else if (codeText[end - 1] !== '/') depth += 1
680
741
  }
681
742
  return depth > 0
682
743
  }
@@ -864,18 +925,6 @@ function isChartFile(relPath: string): boolean {
864
925
  return relPath.includes('/charts/')
865
926
  }
866
927
 
867
- /**
868
- * Kinds that inherit another kind's `exemptRules` entry. A grace-minor kind that exists only to
869
- * carry a WIDENING of an established kind is the same rule to a consumer, so an exemption written
870
- * for the parent must cover it — otherwise the widening arrives as noise in exactly the paths
871
- * someone already decided the rule does not apply to. The entry disappears with the merge.
872
- */
873
- const EXEMPT_RULE_ALIASES: Partial<Record<GuardKind, GuardKind>> = {
874
- 'hidden-inline-style': 'raw-html-layout',
875
- 'surface-shadow-override': 'raw-surface',
876
- 'css-raw-surface': 'raw-surface',
877
- }
878
-
879
928
  /** `./` and any trailing `/` are noise — `'agent'`, `'agent/'` and `'./agent'` are one pattern. */
880
929
  function normalizeExemptPattern(pattern: string): string {
881
930
  return pattern.trim().replace(/^\.\//, '').replace(/\/+$/, '')
@@ -899,30 +948,22 @@ function exemptGlobToRegExp(pattern: string): RegExp {
899
948
  /**
900
949
  * Does one `exemptRules` pattern match `relPath`?
901
950
  *
902
- * Three shapes, tried in the order a consumer reaches for them:
951
+ * Two shapes, tried in the order a consumer reaches for them:
903
952
  *
904
953
  * 1. **A relative path** — `public/site.webmanifest` for one file, `public` or `src/agent` for
905
954
  * everything under a directory.
906
955
  * 2. **A glob** — `public/*.webmanifest`, `**\/*.module.css`; a glob with no `/` in it is also
907
956
  * tried against the BASENAME, so `*.module.css` works the way `site.webmanifest` does.
908
- * 3. **A bare path segment** — the legacy shape, matching a whole segment anywhere in the path.
909
- *
910
- * Only (3) existed, and it was the one shape nobody guesses: rollhook wrote the obvious, correct
911
- * `"public/site.webmanifest"`, matched nothing, got no diagnostic, and kept reporting. That is a
912
- * silent no-op exemption, and it became load-bearing the minute `.webmanifest`/`.json` entered the
913
- * scan — see {@link unmatchedExemptPatterns} for the other half of the fix.
957
+ * A bare segment (`agent`) is not a shape: it matches only a root-level path. A pattern that
958
+ * matches nothing is reported by {@link unmatchedExemptPatterns}, never silently ignored.
914
959
  */
915
960
  function exemptPatternMatches(pattern: string, relPath: string): boolean {
916
961
  const p = normalizeExemptPattern(pattern)
917
962
  if (p === '') return false
918
963
  if (relPath === p || relPath.startsWith(`${p}/`)) return true
919
- if (/[*?]/.test(p)) {
920
- const re = exemptGlobToRegExp(p)
921
- if (re.test(relPath)) return true
922
- if (!p.includes('/') && re.test(relPath.split('/').pop() ?? '')) return true
923
- return false
924
- }
925
- return !p.includes('/') && relPath.split('/').includes(p)
964
+ if (!/[*?]/.test(p)) return false
965
+ const re = exemptGlobToRegExp(p)
966
+ return re.test(relPath) || (!p.includes('/') && re.test(relPath.split('/').pop() ?? ''))
926
967
  }
927
968
 
928
969
  /**
@@ -934,8 +975,6 @@ function isRuleExempt(
934
975
  relPath: string,
935
976
  exemptRules: GuardConfig['exemptRules'],
936
977
  ): boolean {
937
- const alias = EXEMPT_RULE_ALIASES[kind]
938
- if (alias !== undefined && isRuleExempt(alias, relPath, exemptRules)) return true
939
978
  const patterns = exemptRules?.[kind]
940
979
  if (patterns === undefined || patterns.length === 0) return false
941
980
  return patterns.some((pattern) => exemptPatternMatches(pattern, relPath))
@@ -1109,8 +1148,8 @@ type AllowScope = 'line' | 'file'
1109
1148
  /**
1110
1149
  * One parsed `theme-allow` annotation.
1111
1150
  *
1112
- * `rules` empty AND `unknownRules` empty is the legacy bare form, and only that covers every kind —
1113
- * and only at `line` scope, never `file` (see {@link annotationCovers}).
1151
+ * `rules` empty AND `unknownRules` empty is the bare form: it covers nothing (see
1152
+ * {@link annotationCovers}).
1114
1153
  * `unknownRules` holds words that occupied the rule-id slot but name no rule — a typo. Its presence
1115
1154
  * is what makes the parse FAIL CLOSED: `theme-allow raw-hexx — reason` used to consume no id, fall
1116
1155
  * through to `rules: []`, and be read as the blanket form, so one mistyped character escalated a
@@ -1488,18 +1527,16 @@ function collectAllowAnnotations(
1488
1527
  /**
1489
1528
  * Does one annotation cover `kind`?
1490
1529
  *
1491
- * Only a BARE **line** annotation (no ids at all, known or unknown) covers every kind. One that
1492
- * reached for a rule id and missed covers exactly the ids it got right — nothing widens on a typo.
1493
- *
1494
- * A bare `theme-allow-file` covers NOTHING. The blanket form is tolerable on one line, where a
1495
- * reader sees what it sits on; over a whole file it is `exemptRules` without the config review, and
1496
- * the widest waiver in the contract must be the one that has to name what it waives.
1530
+ * Only the ids an annotation names (or their {@link WAIVER_ID_ALIASES}) are covered. A bare
1531
+ * annotation, or one whose ids all missed, waives nothing and is reported as `theme-allow-unscoped`;
1532
+ * one that reached for several ids and missed some covers exactly the ids it got right — nothing
1533
+ * widens on a typo.
1497
1534
  */
1498
1535
  function annotationCovers(annotation: AllowAnnotation, kind: GuardKind): boolean {
1499
- if (annotation.rules.includes(kind)) return true
1500
- if ((WAIVER_ID_ALIASES[kind] ?? []).some((alias) => annotation.rules.includes(alias))) return true
1501
- if (annotation.scope === 'file') return false
1502
- return annotation.rules.length === 0 && annotation.unknownRules.length === 0
1536
+ return (
1537
+ annotation.rules.includes(kind) ||
1538
+ (WAIVER_ID_ALIASES[kind] ?? []).some((alias) => annotation.rules.includes(alias))
1539
+ )
1503
1540
  }
1504
1541
 
1505
1542
  /** Does any annotation on this line cover `kind`? */
@@ -1697,8 +1734,8 @@ export const TOKENS_ONLY_DISABLED_KINDS: ReadonlySet<GuardKind> = new Set([
1697
1734
  'off-system-surface-var',
1698
1735
  'raw-html-layout',
1699
1736
  // Same remedy as raw-html-layout, word for word ("use a Mantine layout primitive") — it is that
1700
- // kind's widening, so it has to share its gate here exactly as it shares it in
1701
- // EXEMPT_RULE_ALIASES. Splitting them told a Mantine-free consumer to import Box/Flex.
1737
+ // kind's widening, so it has to share its gate here. Splitting them told a Mantine-free
1738
+ // consumer to import Box/Flex.
1702
1739
  'hidden-inline-style',
1703
1740
  'inline-spacing',
1704
1741
  'inline-display',
@@ -2096,7 +2133,7 @@ export const GUARD_RULES = {
2096
2133
  kind: 'theme-allow-unscoped',
2097
2134
  pattern: /theme-allow/, // handled inline (annotation pass); entry keeps the registry complete
2098
2135
  message:
2099
- 'theme-allow without a usable rule id and a reason. Write `theme-allow <rule-id> — <why>`: the id scopes the exception to that one kind (a bare comment waives EVERY kind on the line, including ones added later), and the reason is what makes it reviewable in a diff. An id that names no rule is a typo, not a blanket waiver — it suppresses nothing. `theme-allow-file <rule-id> — <why>` declares the whole file, and must name its ids: a bare one waives nothing.',
2136
+ 'theme-allow without a usable rule id and a reason. Write `theme-allow <rule-id> — <why>`: the id scopes the exception to that one kind (a bare comment waives nothing), and the reason is what makes it reviewable in a diff. An id that names no rule is a typo, not a blanket waiver — it suppresses nothing. `theme-allow-file <rule-id> — <why>` declares the whole file, and must name its ids: a bare one waives nothing.',
2100
2137
  },
2101
2138
  'surface-shadow-override': {
2102
2139
  kind: 'surface-shadow-override',
@@ -2136,7 +2173,7 @@ export const GUARD_RULES = {
2136
2173
  // JSX-tag-shaped (`<Select …>`) — never appears in CSS text.
2137
2174
  appliesTo: (relPath) => !relPath.endsWith('.css'),
2138
2175
  message:
2139
- 'Raw selection control with no home — a filter or tab belongs in a PageBar / Section / WidgetHeader slot and takes a `field` (a FieldHandle), so it owns the URL write and the localStorage mirror instead of carrying value/onChange (docs/CONTROLS-SPEC.md laws C1–C3). Use the bound control from basalt-ui/controls. A settings row, a FormRow / FormGroup, an overlay and an @mantine/form file are the declared non-homes and never report. No shell? PageBar needs no BasaltShell: outside one it renders in flow, sticky, with its own title — so its slots are a reachable home for a provider-only app. This is the TEXT lane of basalt/control-outside-home, which answers the same question against the real AST — where the two disagree, the plugin is right.',
2176
+ 'Raw selection control with no store field — bind its state to one: in a page slot (PageBar / Section / WidgetHeader) use the basalt filter with `field={store.field.x}` (`createSearchStore` for URL state); in a `SettingsRow control=` keep the Mantine control and take `[value, setValue]` from a `createLocalStore` field .use(), never useState. Rule: basalt-controls.md. No shell? PageBar needs no BasaltShell: outside one it renders in flow, sticky, with its own title — so its slots are a reachable home for a provider-only app.',
2140
2177
  },
2141
2178
  'inline-font-size': {
2142
2179
  kind: 'inline-font-size',
@@ -2155,13 +2192,7 @@ export const GUARD_RULES = {
2155
2192
  'unknown-vx-token': {
2156
2193
  kind: 'unknown-vx-token',
2157
2194
  pattern: VX_VAR_REF, // handled inline (basalt-owned families); entry keeps the registry complete
2158
- message: `var() names a --vx-* token basalt does not emit, so it resolves to its fallback (or to nothing) with no error anywhere. Judged: every name inside a basalt-owned family (${[...BASALT_VX_FAMILY_SET].join(', ')}) — pick the token from basalt-ui/tokens.css; your own series belong in a family of their own (groupTokens throws on one inside basalt's, in dev builds). Removed names and their replacements: ${Object.entries(
2159
- REMOVED_VX_NAMES,
2160
- )
2161
- .map(([from, to]) => `${from} → ${to ?? '(deleted, no replacement)'}`)
2162
- .join(
2163
- '; ',
2164
- )}. A name in any other family is never judged, because groupTokens may declare it in a file this scan cannot see.`,
2195
+ message: `var() names a --vx-* token basalt does not emit, so it resolves to its fallback (or to nothing) with no error anywhere. Judged: every name inside a basalt-owned family (${[...BASALT_VX_FAMILY_SET].join(', ')}), plus any name basalt used to emit in any family — pick the token from the stylesheet basalt-ui tokens:css emits; your own series belong in a family of their own (groupTokens throws on one inside basalt's, in dev builds). A removed name is reported with its replacement on the finding line (MIGRATING.md has the table). Any other name outside a basalt family is never judged, because groupTokens may declare it in a file this scan cannot see.`,
2165
2196
  },
2166
2197
  } as const satisfies Record<GuardKind, GuardRule>
2167
2198
 
@@ -2342,13 +2373,16 @@ export function checkSource(text: string, relPath: string, cfg: GuardConfig): Fi
2342
2373
  [...codeText.matchAll(VX_LOCAL_DECLARATION)].map((m) => m[1] ?? m[3] ?? m[4] ?? ''),
2343
2374
  )
2344
2375
 
2345
- // unknown-vx-token: any unemitted name inside a basalt-owned family — see BASALT_VX_FAMILY_SET.
2376
+ // unknown-vx-token: any unemitted name inside a basalt-owned family (BASALT_VX_FAMILY_SET), or any
2377
+ // removed name in ANY family (REMOVED_VX_NAMES).
2346
2378
  // Scanned over the whole comment-stripped text rather than per line, so a formatter-wrapped
2347
2379
  // `var(\n --vx-x\n)` is seen; the finding lands on the line the NAME is on.
2348
2380
  for (const m of codeText.matchAll(VX_VAR_REF)) {
2349
2381
  const name = m[1] ?? ''
2350
2382
  if (locallyDeclaredVx.has(name)) continue
2351
- if (KNOWN_VX_NAMES.has(name) || !BASALT_VX_FAMILY_SET.has(vxFamilyOf(name))) continue
2383
+ if (KNOWN_VX_NAMES.has(name)) continue
2384
+ if (!BASALT_VX_FAMILY_SET.has(vxFamilyOf(name)) && !Object.hasOwn(REMOVED_VX_NAMES, name))
2385
+ continue
2352
2386
  const at = (m.index ?? 0) + m[0].length - name.length
2353
2387
  push('unknown-vx-token', lineStarts.findLastIndex((start) => start <= at) + 1, name)
2354
2388
  }
@@ -2695,7 +2729,7 @@ export function checkSource(text: string, relPath: string, cfg: GuardConfig): Fi
2695
2729
  *
2696
2730
  * `guardKinds` is what `checkSource` can judge by re-running itself with the annotation
2697
2731
  * neutralized. `pluginRules` is what only an `oxlint` run can judge. `unknownRules` names no rule
2698
- * at all. All three empty with `bare: true` is the legacy blanket form.
2732
+ * at all. All three empty is a bare annotation, which waives nothing.
2699
2733
  */
2700
2734
  export type AllowAnnotationSite = {
2701
2735
  /** 1-based line the annotation is written on. */
@@ -2712,17 +2746,14 @@ export type AllowAnnotationSite = {
2712
2746
  * Every id an `oxlint` run can prove live: `pluginRules`, plus a guard kind that is ALSO a plugin
2713
2747
  * rule (`in-body-page-title`) or aliases one ({@link WAIVER_ID_ALIASES}). A waiver is live if
2714
2748
  * EITHER lane still needs it — judging only `pluginRules` called rb's live `in-body-page-title`
2715
- * waivers dead, and deleting them made oxlint exit 1. A bare LINE-scope annotation covers every
2716
- * plugin rule (the plugin's `allowCovers`), so it lists all of them; a bare file-scope one waives
2717
- * nothing in either lane and lists none.
2749
+ * waivers dead, and deleting them made oxlint exit 1. A bare annotation waives nothing in either
2750
+ * lane and lists none.
2718
2751
  */
2719
2752
  readonly oxlintRules: readonly string[]
2720
2753
  /** Words that occupied the id slot but name no rule. Their presence makes the parse fail closed. */
2721
2754
  readonly unknownRules: readonly string[]
2722
2755
  /** A written reason follows the ids. */
2723
2756
  readonly hasReason: boolean
2724
- /** The legacy blanket form — no ids at all, known or unknown. Only covers anything at line scope. */
2725
- readonly bare: boolean
2726
2757
  /** The source line, verbatim. */
2727
2758
  readonly text: string
2728
2759
  }
@@ -2755,9 +2786,7 @@ export function findAllowAnnotations(
2755
2786
  cfg.allowComment,
2756
2787
  syntax,
2757
2788
  )
2758
- const everyOxlintRule = [...PLUGIN_RULE_IDS, ...DUAL_LANE_IDS]
2759
2789
  return declared.map(({ line, annotation }) => {
2760
- const bare = annotation.rules.length === 0 && annotation.unknownRules.length === 0
2761
2790
  return {
2762
2791
  line,
2763
2792
  scope: annotation.scope,
@@ -2766,19 +2795,15 @@ export function findAllowAnnotations(
2766
2795
  pluginRules: annotation.rules.filter(
2767
2796
  (id) => !Object.hasOwn(GUARD_RULES, id) && PLUGIN_RULE_IDS.has(id),
2768
2797
  ),
2769
- oxlintRules:
2770
- bare && annotation.scope === 'line'
2771
- ? everyOxlintRule
2772
- : [
2773
- ...new Set(
2774
- annotation.rules
2775
- .flatMap((id) => [id, ...(WAIVER_ID_ALIASES[id] ?? [])])
2776
- .filter((id) => PLUGIN_RULE_IDS.has(id) || DUAL_LANE_IDS.has(id)),
2777
- ),
2778
- ],
2798
+ oxlintRules: [
2799
+ ...new Set(
2800
+ annotation.rules
2801
+ .flatMap((id) => [id, ...(WAIVER_ID_ALIASES[id] ?? [])])
2802
+ .filter((id) => PLUGIN_RULE_IDS.has(id) || DUAL_LANE_IDS.has(id)),
2803
+ ),
2804
+ ],
2779
2805
  unknownRules: [...annotation.unknownRules],
2780
2806
  hasReason: annotation.hasReason,
2781
- bare,
2782
2807
  text: lines[line - 1] ?? '',
2783
2808
  }
2784
2809
  })
@@ -174,19 +174,20 @@ export type GuardConfig = {
174
174
  * raw-html-layout → non-chart files). This is the config-driven counterpart: a consumer can say
175
175
  * "kind K does not apply under path P" without exempting the whole file or forking the rule.
176
176
  *
177
- * Each value is a list of path-segment patterns matched against a finding's `relPath`. A pattern
178
- * matches when `relPath.split('/')` includes it as a WHOLE segment — `'agent'` matches
179
- * `src/agent/part-list.tsx` but not `src/agenting.ts`. A trailing `/` is stripped before
180
- * matching, so `'agent'` and `'agent/'` behave identically. Applied as a post-filter over the
181
- * final findings, so it uniformly covers every kind — both the GUARD_RULES registry loop and the
182
- * inline-handled kinds (raw-surface, raw-html-layout, sub-16-input-font, …).
177
+ * Each value is a list of relative-path or glob patterns matched against a finding's `relPath`:
178
+ * `'src/agent'` matches everything under it, `'public/site.webmanifest'` one file, `'**\/agent/**'`
179
+ * any `agent` directory. A bare segment (`'agent'`) matches only a root-level path. A trailing
180
+ * `/` is stripped before matching, so `'src/agent'` and `'src/agent/'` behave identically.
181
+ * Applied as a post-filter over the final findings, so it uniformly covers every kind — both the
182
+ * GUARD_RULES registry loop and the inline-handled kinds (raw-surface, raw-html-layout,
183
+ * sub-16-input-font, …).
183
184
  *
184
185
  * Required (like every other GuardConfig field, defaulted via DEFAULT_GUARD_CONFIG to `{}`) —
185
186
  * `exactOptionalPropertyTypes` rejects the `?? DEFAULT_GUARD_CONFIG.x` pattern used to build a
186
187
  * GuardConfig from BasaltConfig (where the field IS optional) if this were optional too.
187
188
  *
188
189
  * @example
189
- * { exemptRules: { 'inline-display': ['agent'] } } // inline-display never fires under src/agent/**
190
+ * { exemptRules: { 'inline-display': ['src/agent'] } } // inline-display never fires under src/agent/**
190
191
  */
191
192
  readonly exemptRules: Partial<Record<GuardKind, string[]>>
192
193
  /**
@@ -1,28 +1,21 @@
1
1
  // GENERATED by scripts/gen-vx-names.ts — do not edit. `vx-names.test.ts` fails on drift.
2
2
 
3
- /** Every `--vx-*` name basalt emits: `dist/tokens.css` plus its component-scoped names. */
3
+ /** Every `--vx-*` name basalt emits: `buildPaletteCss()` plus its component-scoped names. */
4
4
  export const BASALT_VX_NAMES: readonly string[] = [
5
5
  '--vx-accent',
6
6
  '--vx-accent-fill',
7
7
  '--vx-accent-fill-hover',
8
8
  '--vx-accent-hover',
9
- '--vx-accentFill',
10
- '--vx-accentFillHover',
11
- '--vx-accentHover',
12
9
  '--vx-area-bottom',
13
10
  '--vx-area-top',
14
11
  '--vx-axis',
15
12
  '--vx-axis-stroke',
16
- '--vx-axisStroke',
17
13
  '--vx-bad',
18
14
  '--vx-bad-ref',
19
15
  '--vx-bad-solid',
20
- '--vx-badRef',
21
- '--vx-badSolid',
22
16
  '--vx-crosshair',
23
17
  '--vx-divider',
24
18
  '--vx-dot-stroke',
25
- '--vx-dotStroke',
26
19
  '--vx-faint',
27
20
  '--vx-fill-cyan',
28
21
  '--vx-fill-grape',
@@ -48,25 +41,10 @@ export const BASALT_VX_NAMES: readonly string[] = [
48
41
  '--vx-fill-teal',
49
42
  '--vx-fill-violet',
50
43
  '--vx-fill-yellow',
51
- '--vx-fillHover-cyan',
52
- '--vx-fillHover-grape',
53
- '--vx-fillHover-gray',
54
- '--vx-fillHover-green',
55
- '--vx-fillHover-indigo',
56
- '--vx-fillHover-lime',
57
- '--vx-fillHover-orange',
58
- '--vx-fillHover-pink',
59
- '--vx-fillHover-red',
60
- '--vx-fillHover-teal',
61
- '--vx-fillHover-violet',
62
- '--vx-fillHover-yellow',
63
44
  '--vx-good',
64
45
  '--vx-good-ref',
65
46
  '--vx-good-soft',
66
47
  '--vx-good-solid',
67
- '--vx-goodRef',
68
- '--vx-goodSoft',
69
- '--vx-goodSolid',
70
48
  '--vx-grid',
71
49
  '--vx-hit',
72
50
  '--vx-hit-gap',
@@ -74,13 +52,11 @@ export const BASALT_VX_NAMES: readonly string[] = [
74
52
  '--vx-ink2',
75
53
  '--vx-keyboard-inset',
76
54
  '--vx-legend-text',
77
- '--vx-legendText',
78
55
  '--vx-line',
79
56
  '--vx-line2',
80
57
  '--vx-muted',
81
58
  '--vx-neutral',
82
59
  '--vx-on-accent',
83
- '--vx-onAccent',
84
60
  '--vx-prose-measure',
85
61
  '--vx-radius-card',
86
62
  '--vx-radius-ctrl',
@@ -226,7 +202,6 @@ export const BASALT_VX_NAMES: readonly string[] = [
226
202
  '--vx-surface-overlay',
227
203
  '--vx-surface-panel',
228
204
  '--vx-surface-panel-hover',
229
- '--vx-surface-panelHover',
230
205
  '--vx-surface-subtle',
231
206
  '--vx-text-display',
232
207
  '--vx-text-h1',
@@ -244,14 +219,7 @@ export const BASALT_VX_NAMES: readonly string[] = [
244
219
  '--vx-tooltip-muted',
245
220
  '--vx-tooltip-shadow',
246
221
  '--vx-tooltip-text',
247
- '--vx-tooltipBg',
248
- '--vx-tooltipBorder',
249
- '--vx-tooltipMuted',
250
- '--vx-tooltipShadow',
251
- '--vx-tooltipText',
252
222
  '--vx-warn',
253
223
  '--vx-warn-ref',
254
224
  '--vx-warn-solid',
255
- '--vx-warnRef',
256
- '--vx-warnSolid',
257
225
  ]
package/src/index.ts CHANGED
@@ -21,7 +21,7 @@ export {
21
21
  useBasaltNav,
22
22
  type NavItemId,
23
23
  } from './router-tanstack'
24
- export { scrollParentOf, useCoarsePointer } from './common'
24
+ export { scrollParentOf, useCoarsePointer, type Tone } from './common'
25
25
  export { createBasaltTheme } from './theme'
26
26
  export { ThemeToggle } from './theme/theme-toggle'
27
27
  export {
@@ -41,7 +41,6 @@ export {
41
41
  StatCard,
42
42
  type StatCardBreakdownRow,
43
43
  type StatCardSparklineSize,
44
- type StatCardTone,
45
44
  StatGroup,
46
45
  EmptyState,
47
46
  SettingsSection,
@@ -200,17 +200,6 @@ function warnPatchDropped(input: { key: string; name: string; param: string }):
200
200
  )
201
201
  }
202
202
 
203
- /**
204
- * The public store plus the one member only the deprecated wrappers need: `markReaderWired`, so a
205
- * consumer whose only reader is the wrapper's own `useStore()` still counts as wired and never sees
206
- * the pinned-link warning it never used to see.
207
- *
208
- * @internal — absent from `SearchStore`, so it is invisible on `createSearchStore`'s return type.
209
- */
210
- export type InternalSearchStore<S extends Record<string, AnyField>> = SearchStore<S> & {
211
- markReaderWired: () => void
212
- }
213
-
214
203
  /**
215
204
  * A thunk fallback belongs to the LOCAL and MEMORY lanes only. On the URL lane `validateSearch`
216
205
  * would evaluate it on every navigation and write the result into the URL, so a deep link would
@@ -264,7 +253,7 @@ function isMemoryLane(entry: StoreEntry): boolean {
264
253
  */
265
254
  export function buildSearchStore<const S extends Record<string, AnyField>>(
266
255
  o: CreateSearchStoreOptions<S>,
267
- ): InternalSearchStore<S> {
256
+ ): SearchStore<S> {
268
257
  assertNoLazyUrlFallback(o.key, o.fields)
269
258
  const core = createStoreCore(o)
270
259
 
@@ -570,7 +559,7 @@ export function buildSearchStore<const S extends Record<string, AnyField>>(
570
559
  }
571
560
  }
572
561
 
573
- const store: InternalSearchStore<S> = {
562
+ const store: SearchStore<S> = {
574
563
  validateSearch,
575
564
  linkSearch,
576
565
  readStored,
@@ -582,7 +571,6 @@ export function buildSearchStore<const S extends Record<string, AnyField>>(
582
571
  useValues,
583
572
  useActiveCount,
584
573
  useReset,
585
- markReaderWired,
586
574
  }
587
575
 
588
576
  return store
@@ -87,6 +87,8 @@ export {
87
87
  } from './mobile-nav-model'
88
88
  export { AppBreadcrumbs, type AppBreadcrumbsProps } from './app-breadcrumbs'
89
89
  export { PageBar, type PageBarProps, type PageBarSlot } from './page-bar'
90
+ // Internal (not listed in `src/index.ts`): `Section` clears a shell-less bar with these.
91
+ export { PAGE_BAR_HEIGHT_VAR, useInPageBarShell } from './page-bar'
90
92
  export { PageAside, type PageAsideProps, type PageAsideSlot } from './page-aside'
91
93
  export { useSizeClass, type SizeClass } from './use-size-class'
92
94
  export { PageTitle, type PageTitleProps, type PageTitleSlot } from './page-title'
@@ -76,7 +76,7 @@ export type SidebarSection = {
76
76
 
77
77
  /**
78
78
  * Status tone on a sidebar-block item — byte-identical to the common `Tone` vocabulary
79
- * (`common/props.ts`, audit A13) and to `StatCardTone`, whose members are `VX.status` keys by
79
+ * (`common/props.ts`, audit A13) and to `StatCard`'s `tone`, whose members are `VX.status` keys by
80
80
  * construction. Declared here rather than aliased to `common`'s `Tone`: this module is the one
81
81
  * `./router-tanstack` reads, and `common/props.ts` re-exports `Tier` (type-only) from
82
82
  * `../widget-header/widget-header`, a Mantine-coupled file — importing anything from `common/props`
@@ -199,6 +199,15 @@ export function PageBarBandOutlet({ className }: { className?: string }) {
199
199
  return <div ref={setBandTarget} className={className} />
200
200
  }
201
201
 
202
+ /**
203
+ * Internal — whether a `BasaltShell` provides this tree. `Section` reads it: inside the shell the
204
+ * bars sit outside the scrollport, so an anchor needs no bar offset; without one `PageBar` is
205
+ * sticky in the document and `Section` must clear it.
206
+ */
207
+ export function useInPageBarShell(): boolean {
208
+ return useContext(PageBarContext).inShell
209
+ }
210
+
202
211
  /** Internal — `true` while a page's `ActionGroup` owns the header's one mobile kebab. */
203
212
  export function usePageKebabClaimed(): boolean {
204
213
  return useContext(PageBarContext).kebabClaims > 0
@@ -300,8 +309,18 @@ export type PageBarProps = BasaltProps &
300
309
  */
301
310
  function publishBarHeight(node: HTMLElement): void {
302
311
  const { height } = node.getBoundingClientRect()
303
- if (height > 0) {
304
- document.documentElement.style.setProperty(PAGE_BAR_HEIGHT_VAR, `${height}px`)
312
+ if (height <= 0) return
313
+ const root = document.documentElement
314
+ const first = root.style.getPropertyValue(PAGE_BAR_HEIGHT_VAR) === ''
315
+ root.style.setProperty(PAGE_BAR_HEIGHT_VAR, `${height}px`)
316
+ // The browser's native fragment scroll on a cold `/page#anchor` load ran BEFORE this first
317
+ // publish, so `Section`'s scroll-margin read the 0px fallback and the heading sits under the bar.
318
+ // Re-aim it once, instantly (never a smooth scroll the reader would watch). Only the FIRST
319
+ // publish: later height changes must not yank a reader who has since scrolled away.
320
+ if (first && location.hash.length > 1) {
321
+ document.getElementById(decodeURIComponent(location.hash.slice(1)))?.scrollIntoView({
322
+ behavior: 'instant',
323
+ })
305
324
  }
306
325
  }
307
326
 
@@ -305,7 +305,7 @@ export type LocalFieldHandle<F extends AnyField> = FieldHandle<F> & {
305
305
  export type FieldHandle<F extends AnyField> = {
306
306
  readonly kind: F['kind']
307
307
  readonly fallback: FieldValue<F>
308
- /** enum / multi / range options, labelled by `labels()`. Empty for the other kinds. */
308
+ /** enum / multi / range options, labelled by `labels()`. A number lists only the values `labels()` names; empty for the other kinds. */
309
309
  readonly options: readonly FieldOption[]
310
310
  /**
311
311
  * Read + write. Reads the URL when the field is on the URL lane (`useSearch({ strict: false })`,
@@ -986,7 +986,12 @@ export function createStoreCore(o: StoreCoreOptions): StoreCore {
986
986
  const readRecord = (): StoreRecord => toRecord(readPersistedValue(o.key, version))
987
987
 
988
988
  const optionsFor = (entry: StoreEntry): readonly FieldOption[] => {
989
- return labelledOptions(entry.codec.optionValues, labels.get(entry.name))
989
+ const named = labels.get(entry.name)
990
+ // A number has no closed value set, so its options are exactly the values `labels()` names —
991
+ // `{ 0: 'Any' }` names the unset state of a threshold, and `NumberFilter`'s pill reads it.
992
+ const values =
993
+ entry.codec.kind === 'number' ? Object.keys(named ?? {}) : entry.codec.optionValues
994
+ return labelledOptions(values, named)
990
995
  }
991
996
 
992
997
  const clearField = (name: string): void => {