@vokality/design-system 3.0.1 → 4.0.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +10 -9
  3. package/dist/components/Alert/Alert.js +1 -1
  4. package/dist/components/AppShell/AppShell.js +4 -1
  5. package/dist/components/Button/Button.d.ts +2 -1
  6. package/dist/components/Button/Button.js +1 -1
  7. package/dist/components/ChatWidget/ChatWidget.js +1 -1
  8. package/dist/components/CommandPalette/CommandPalette.js +2 -2
  9. package/dist/components/ErrorSummary/ErrorSummary.js +3 -1
  10. package/dist/components/Fieldset/Fieldset.d.ts +2 -0
  11. package/dist/components/Fieldset/Fieldset.js +2 -2
  12. package/dist/components/FileUpload/FileUpload.js +1 -1
  13. package/dist/components/IconButton/IconButton.d.ts +2 -1
  14. package/dist/components/IconButton/IconButton.js +2 -2
  15. package/dist/components/Menu/Menu.d.ts +1 -2
  16. package/dist/components/Menu/Menu.js +7 -1
  17. package/dist/components/Popover/Popover.d.ts +1 -1
  18. package/dist/components/Popover/Popover.js +1 -1
  19. package/dist/components/Prose/Prose.d.ts +3 -1
  20. package/dist/components/Prose/Prose.js +2 -2
  21. package/dist/components/RichTextEditor/RichTextEditor.js +20 -7
  22. package/dist/components/SegmentedControl/SegmentedControl.d.ts +1 -1
  23. package/dist/components/SegmentedControl/SegmentedControl.js +1 -1
  24. package/dist/components/ThemeProvider/ThemeProvider.d.ts +13 -0
  25. package/dist/components/ThemeProvider/ThemeProvider.js +11 -0
  26. package/dist/components/TimePicker/TimePicker.js +3 -1
  27. package/dist/components/Toaster/Toaster.js +1 -1
  28. package/dist/components.css +54 -8
  29. package/dist/hooks/useTheme.d.ts +3 -2
  30. package/dist/hooks/useTheme.js +6 -4
  31. package/dist/index.d.ts +4 -4
  32. package/dist/index.js +2 -2
  33. package/dist/internal/ThemeOptionsProvider.d.ts +15 -0
  34. package/dist/internal/ThemeOptionsProvider.js +26 -0
  35. package/dist/internal/themeOptions.d.ts +3 -0
  36. package/dist/internal/themeOptions.js +4 -0
  37. package/dist/lib/theme.d.ts +5 -1
  38. package/dist/lib/theme.js +3 -2
  39. package/dist/tokens.css +1 -0
  40. package/dist/tokens.dtcg.json +5 -0
  41. package/dist/tokens.json +5 -0
  42. package/dist/vokality.css +55 -8
  43. package/dist/vokality.iife.js +483 -434
  44. package/docs/brand.md +2 -2
  45. package/docs/components/Button/README.md +4 -1
  46. package/docs/components/DatePicker/README.md +1 -1
  47. package/docs/components/Fieldset/README.md +3 -1
  48. package/docs/components/FileUpload/README.md +3 -2
  49. package/docs/components/Menu/README.md +3 -3
  50. package/docs/components/NavList/README.md +1 -1
  51. package/docs/components/Popover/README.md +1 -1
  52. package/docs/components/Prose/README.md +4 -0
  53. package/docs/components/RichTextEditor/README.md +1 -1
  54. package/docs/components/SegmentedControl/README.md +1 -1
  55. package/docs/components/{ThemeScript → ThemeProvider}/README.md +16 -11
  56. package/package.json +21 -11
  57. package/skills/vokality-design-system/SKILL.md +1 -1
  58. package/dist/components/ThemeScript/ThemeScript.d.ts +0 -7
  59. package/dist/components/ThemeScript/ThemeScript.js +0 -9
@@ -507,6 +507,8 @@ body {
507
507
  .vk-icon-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
508
508
  .vk-icon-btn:disabled { cursor: not-allowed; opacity: 0.5; }
509
509
 
510
+ /* Dismiss and remove buttons inside alerts, toasts and upload rows keep a 16px glyph. */
511
+ .vk-alert-close .vk-icon, .vk-upload-item .vk-icon-btn .vk-icon { width: 16px; height: 16px; }
510
512
  /* Link */
511
513
  .vk-link {
512
514
  display: inline-flex;
@@ -528,6 +530,8 @@ body {
528
530
  .vk-field { display: grid; gap: 0.4rem; min-width: 0; }
529
531
  .vk-field-optional { font-weight: 500; letter-spacing: 0.04em; text-transform: none; color: var(--muted-subtle); }
530
532
  .vk-field-hint { font-size: var(--text-sm); line-height: 1.5; color: var(--muted-subtle); }
533
+ /* muted-subtle reaches AA only on background and card; raised surfaces use the stronger muted ink. */
534
+ :is(.vk-dialog, .vk-drawer, .vk-popover) .vk-field-hint { color: var(--muted-foreground); }
531
535
  .vk-input:disabled { cursor: not-allowed; color: var(--muted-subtle); background: transparent; border-style: dashed; }
532
536
  /* Only real fields: :read-only also matches every non-editable element, such as the select trigger. */
533
537
  input.vk-input:read-only, textarea.vk-input:read-only { background: transparent; }
@@ -618,7 +622,10 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
618
622
  .vk-field-error { margin: 0; font-size: var(--text-sm); color: var(--primary-hover); }
619
623
 
620
624
  .vk-fieldset { min-width: 0; margin: 0; padding: var(--space-md); border: 1px solid var(--border-subtle); }
621
- .vk-fieldset-legend { padding-inline: var(--space-xs); font-size: var(--text-xs); font-weight: 600; color: var(--foreground); }
625
+ .vk-fieldset-legend { padding-inline: var(--space-xs); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-foreground); }
626
+ /* A plain group sits in the form's own rhythm; its legend lines up with the field labels around it. */
627
+ .vk-fieldset-plain { padding: 0; border: 0; }
628
+ .vk-fieldset-plain > .vk-fieldset-legend { padding: 0; margin-bottom: 0.4rem; }
622
629
  .vk-fieldset-controls { display: grid; gap: var(--space-sm); }
623
630
  /* Hint and error take the shared field styles; only their spacing within the group is set here. */
624
631
  .vk-fieldset-hint { margin: 0 0 var(--space-sm); }
@@ -868,6 +875,8 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
868
875
  max-height: var(--radix-popper-available-height);
869
876
  outline: none;
870
877
  }
878
+ /* muted-subtle keeps its contrast only on background and card: on the elevated panel the weekday row and outside days use muted-foreground */
879
+ .vk-date-popover .vk-calendar-grid th, .vk-date-popover .vk-day-outside { color: var(--muted-foreground); }
871
880
  .vk-date-popover[data-state="open"] { animation: vk-date-popover-in var(--motion-normal) var(--ease-standard); }
872
881
  .vk-date-popover[data-state="closed"] { animation: vk-date-popover-out var(--motion-normal) var(--ease-standard) forwards; pointer-events: none; }
873
882
  @keyframes vk-date-popover-in { from { opacity: 0; transform: translateY(0.5rem); } to { opacity: 1; transform: none; } }
@@ -1025,13 +1034,13 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
1025
1034
  .vk-menu-item:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
1026
1035
  .vk-menu-item-icon { flex-shrink: 0; width: 16px; color: var(--muted-foreground); }
1027
1036
  .vk-menu-item-label { flex: 1; min-width: 0; }
1028
- .vk-menu-shortcut { font-family: var(--font-numeric); font-size: 0.6875rem; letter-spacing: 0.04em; color: var(--muted-subtle); }
1037
+ .vk-menu-shortcut { font-family: var(--font-numeric); font-size: 0.6875rem; letter-spacing: 0.04em; color: var(--muted-foreground); }
1029
1038
  .vk-menu-item-danger, .vk-menu-item-danger .vk-menu-item-icon { color: var(--danger); }
1030
1039
  .vk-menu-item-danger:focus { background: var(--danger-tint); }
1031
1040
  .vk-menu-item[aria-disabled="true"] { color: var(--muted-subtle); cursor: not-allowed; }
1032
1041
  .vk-menu-item[aria-disabled="true"]:focus { background: transparent; }
1033
1042
  .vk-menu-separator { height: 1px; margin: 0.25rem 0; background: var(--border-subtle); }
1034
- .vk-menu-label { padding: 0.5rem 0.75rem 0.25rem; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-subtle); }
1043
+ .vk-menu-label { padding: 0.5rem 0.75rem 0.25rem; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-foreground); }
1035
1044
  .vk-popover-panel { min-width: 16rem; outline: none; }
1036
1045
  .vk-popover-title { margin: 0 0 0.75rem; font-family: var(--font-display); font-size: var(--text-sm); font-weight: 600; color: var(--foreground); }
1037
1046
  .vk-popover-panel > .vk-popover-footer { margin-top: var(--space-md); }
@@ -1239,6 +1248,8 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
1239
1248
  .vk-navlist-item:hover { color: var(--foreground); background: var(--card-fill); }
1240
1249
  .vk-navlist-item-active { color: var(--foreground); background: var(--primary-tint); }
1241
1250
  .vk-navlist-item-active .vk-navlist-icon { color: var(--primary); }
1251
+ /* muted-subtle falls under 4.5:1 on the primary-tint fill. */
1252
+ .vk-navlist-item-active .vk-navlist-count { color: var(--muted-foreground); }
1242
1253
  .vk-navlist-item:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
1243
1254
  .vk-navlist-label { flex: 1; min-width: 0; }
1244
1255
  .vk-navlist-count { font-family: var(--font-numeric); font-variant-numeric: tabular-nums; font-size: 0.75rem; color: var(--muted-subtle); }
@@ -1442,7 +1453,10 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
1442
1453
  .vk-upload { display: grid; gap: 0.75rem; }
1443
1454
  .vk-dropzone { display: flex; align-items: center; gap: 1rem; box-sizing: border-box; padding: 1.25rem 1.25rem; border: 1px dashed var(--muted-subtle); background: var(--card-fill); transition: border-color var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard); }
1444
1455
  .vk-dropzone-active { border-color: var(--primary); border-style: solid; background: var(--primary-tint); }
1445
- .vk-dropzone-disabled { opacity: 0.6; }
1456
+ /* Disabled like Input: transparent and muted-subtle, which keeps the hint readable (an opacity drop took it under 4.5:1) */
1457
+ .vk-dropzone-disabled { background: transparent; cursor: not-allowed; }
1458
+ .vk-dropzone-disabled .vk-dropzone-icon, .vk-dropzone-disabled .vk-dropzone-title, .vk-dropzone-disabled .vk-dropzone-browse { color: var(--muted-subtle); }
1459
+ .vk-dropzone-disabled .vk-dropzone-browse { cursor: not-allowed; }
1446
1460
  .vk-dropzone-icon { flex-shrink: 0; color: var(--muted-foreground); }
1447
1461
  .vk-dropzone-active .vk-dropzone-icon { color: var(--primary); }
1448
1462
  .vk-dropzone-text { display: grid; gap: 0.2rem; }
@@ -1728,6 +1742,8 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
1728
1742
  .vk-list-title { font-size: var(--text-sm); font-weight: 500; color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1729
1743
  .vk-list-description { font-size: 0.8125rem; color: var(--muted-foreground); overflow-wrap: anywhere; }
1730
1744
  .vk-list-meta { flex-shrink: 0; font-family: var(--font-numeric); font-variant-numeric: tabular-nums; font-size: 0.75rem; color: var(--muted-subtle); }
1745
+ /* muted-subtle falls under 4.5:1 on the primary-tint wash. */
1746
+ .vk-list-item-selected .vk-list-meta { color: var(--muted-foreground); }
1731
1747
  .vk-list-trailing { display: inline-flex; align-items: center; gap: 0.25rem; flex-shrink: 0; padding-right: 0.25rem; }
1732
1748
  @media (max-width: 40rem) {
1733
1749
  .vk-list-main { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 0.1rem; }
@@ -1774,6 +1790,8 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
1774
1790
  .vk-tree-row-selected .vk-tree-icon { color: var(--primary); }
1775
1791
  .vk-tree-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1776
1792
  .vk-tree-meta { font-family: var(--font-numeric); font-size: 0.75rem; color: var(--muted-subtle); }
1793
+ /* muted-subtle falls under 4.5:1 on the primary-tint wash. */
1794
+ .vk-tree-row-selected .vk-tree-meta { color: var(--muted-foreground); }
1777
1795
 
1778
1796
  /* Table extras */
1779
1797
  .vk-row-toggle { width: 32px; height: 32px; }
@@ -1800,6 +1818,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
1800
1818
  .vk-code { padding: 0.1em 0.35em; font-family: var(--font-mono); font-size: 0.875em; color: var(--foreground); background: var(--card); border: 1px solid var(--border-subtle); }
1801
1819
  .vk-prose { max-width: var(--prose-max); font-size: var(--text-base); line-height: 1.7; color: var(--muted-foreground); }
1802
1820
  .vk-prose > :first-child { margin-top: 0; }
1821
+ .vk-prose-foreground { color: var(--foreground); }
1803
1822
  .vk-prose h1, .vk-prose h2, .vk-prose h3, .vk-prose h4 { margin: 2em 0 0.6em; font-family: var(--font-display); font-weight: 700; line-height: 1.25; letter-spacing: -0.015em; color: var(--foreground); text-wrap: balance; }
1804
1823
  .vk-prose h1 { font-size: 2rem; }
1805
1824
  .vk-prose h2 { font-size: 1.5rem; }
@@ -1845,10 +1864,11 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
1845
1864
  .vk-rich-minimal { border-top: 1px solid var(--border-subtle); }
1846
1865
  .vk-rich-minimal .vk-rich-toolbar { border-bottom: 0; }
1847
1866
  .vk-rich-minimal-formatting { border-top: 1px solid var(--border-subtle); }
1848
- .vk-rich-minimal .vk-rich-tool[data-state="open"] { color: var(--primary); background: var(--primary-tint); }
1867
+ /* primary text falls under 4.5:1 on the primary-tint fill; the primary-line edge marks the state. */
1868
+ .vk-rich-minimal .vk-rich-tool[data-state="open"] { color: var(--foreground); background: var(--primary-tint); }
1849
1869
  .vk-rich-tool { display: inline-flex; justify-content: center; align-items: center; min-width: 32px; min-height: 32px; padding: var(--space-xs); border: 1px solid transparent; border-radius: 0; background: transparent; color: var(--foreground); font: 500 var(--text-sm)/1 var(--font-sans); cursor: pointer; }
1850
1870
  .vk-rich-tool:hover { background: var(--primary-tint); }
1851
- .vk-rich-tool[aria-pressed="true"] { color: var(--primary); background: var(--primary-tint); border-color: var(--primary-line); }
1871
+ .vk-rich-tool[aria-pressed="true"] { color: var(--foreground); background: var(--primary-tint); border-color: var(--primary-line); }
1852
1872
  .vk-rich-tool:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
1853
1873
  .vk-rich-tool:disabled { color: var(--muted-subtle); cursor: not-allowed; background: transparent; }
1854
1874
  .vk-rich-separator { width: 1px; align-self: stretch; margin: var(--space-xs); background: var(--border-subtle); }
@@ -1900,7 +1920,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
1900
1920
  .vk-cmd-list { max-height: min(22rem, 50vh); overflow-y: auto; padding: 0.25rem 0; }
1901
1921
  .vk-cmd-item { cursor: pointer; }
1902
1922
  .vk-cmd-item-active { background: var(--primary-tint); }
1903
- .vk-cmd-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; padding: 0.55rem 0.85rem; font-size: 0.75rem; color: var(--muted-subtle); border-top: 1px solid var(--border-subtle); }
1923
+ .vk-cmd-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; padding: 0.55rem 0.85rem; font-size: 0.75rem; color: var(--muted-foreground); border-top: 1px solid var(--border-subtle); }
1904
1924
 
1905
1925
  /* Shared chat presentation. Applications supply the rendered content and delivery state. */
1906
1926
  .vk-chat-panel { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; color: var(--foreground); }
@@ -2027,9 +2047,18 @@ html[data-density="compact"] body { font-size: var(--text-sm); }
2027
2047
  [data-density="compact"] .vk-shell-actions .vk-btn { width: auto; min-width: 0; }
2028
2048
  [data-density="compact"] .vk-shell-actions .vk-btn-label { display: block; min-width: 0; align-self: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
2029
2049
  [data-density="compact"] .vk-dialog-title { font-size: var(--text-base); }
2050
+ [data-density="compact"] .vk-alert-title { font-size: var(--text-sm); }
2051
+ /* Compact prose reads at body size: rendered records and messages sit beside 14px interface text. */
2052
+ [data-density="compact"] .vk-prose { font-size: var(--text-sm); line-height: 1.6; }
2053
+ [data-density="compact"] .vk-prose :is(p, ul, ol, blockquote, pre, table, figure) { margin-bottom: 0.75em; }
2054
+ [data-density="compact"] .vk-prose :is(h1, h2, h3, h4) { margin: 1.25em 0 0.5em; }
2055
+ [data-density="compact"] .vk-prose h1 { font-size: var(--text-xl); }
2056
+ [data-density="compact"] .vk-prose h2 { font-size: var(--text-base); }
2057
+ [data-density="compact"] .vk-prose :is(h3, h4) { font-size: var(--text-sm); }
2058
+ [data-density="compact"] .vk-prose > :first-child { margin-top: 0; }
2030
2059
  [data-density="compact"] .vk-accordion-trigger { font-size: var(--text-sm); padding-block: var(--space-sm); }
2031
2060
  [data-density="compact"] .vk-btn-text { font-size: var(--text-sm); }
2032
- [data-density="compact"] .vk-btn:not(.vk-btn-sm, .vk-btn-text) .vk-btn-label { padding: var(--space-xs) var(--space-sm); }
2061
+ [data-density="compact"] .vk-btn:not(.vk-btn-sm, .vk-btn-xs, .vk-btn-text) .vk-btn-label { padding: var(--space-xs) var(--space-sm); }
2033
2062
  [data-density="compact"] .vk-segmented { min-width: 0; max-width: 100%; align-self: flex-start; }
2034
2063
  [data-density="compact"] .vk-segment { min-width: 0; min-height: calc(var(--control-height) - 2px); padding: var(--space-xs) var(--space-sm); font-size: var(--text-sm); overflow-wrap: anywhere; }
2035
2064
  @container (max-width: 40rem) {
@@ -2052,6 +2081,23 @@ html[data-density="compact"] body { font-size: var(--text-sm); }
2052
2081
  @media (pointer: fine) and (not (any-pointer: coarse)) {
2053
2082
  [data-density="compact"] { --control-height: 32px; --control-font-size: var(--text-sm); --control-padding-block: var(--space-xs); }
2054
2083
  }
2084
+
2085
+ /* xs actions sit in rows and toolbars, so they stay content-sized where other buttons stretch on narrow screens. */
2086
+ @media (max-width: 40rem) {
2087
+ .vk-btn-xs { width: auto; justify-content: flex-start; }
2088
+ }
2089
+ /* Extra-small action controls for toolbars, record rows and status lines: size="xs" on Button, IconButton,
2090
+ Menu, Popover and SegmentedControl. Fine pointers only; with any coarse pointer they keep the 44px touch target. */
2091
+ @media (pointer: fine) and (not (any-pointer: coarse)) {
2092
+ .vk-btn-xs { min-height: var(--control-height-xs); font-size: 0.6875rem; }
2093
+ .vk-btn-xs .vk-btn-label, .vk-btn-xs .vk-btn-label:only-child { padding: 0 var(--space-sm); }
2094
+ .vk-btn-xs .vk-btn-glyph { width: var(--control-height-xs); }
2095
+ .vk-btn-text.vk-btn-xs { font-size: var(--text-xs); }
2096
+ .vk-btn-text.vk-btn-xs .vk-btn-label, .vk-btn-text.vk-btn-xs .vk-btn-label:only-child { padding: 0; }
2097
+ .vk-icon-btn-xs { width: var(--control-height-xs); height: var(--control-height-xs); }
2098
+ .vk-icon-btn-xs .vk-icon { width: 16px; height: 16px; }
2099
+ .vk-segmented-xs .vk-segment { min-height: calc(var(--control-height-xs) - 2px); padding: 0 var(--space-sm); font-size: var(--text-xs); }
2100
+ }
2055
2101
  /* Touch: buttons and rows meet a 44px target in every density (WCAG 2.5.5, Apple HIG); density only tightens fine-pointer layouts. */
2056
2102
  @media (any-pointer: coarse) {
2057
2103
  :root { --button-height: var(--control-height); --button-height-sm: var(--control-height); }
@@ -1,4 +1,4 @@
1
- import type { Theme, ThemeOptions } from "../lib/theme.js";
1
+ import type { Theme } from "../lib/theme.js";
2
2
  export declare const THEME_EVENT = "vk-themechange";
3
3
  export declare function systemTheme(): Theme;
4
4
  /** The saved theme, or "system" when none is saved (or storage is unavailable). */
@@ -7,8 +7,9 @@ export declare function readPreference(key: string): Theme | "system";
7
7
  * The theme preference ("system", "dark", "light" or "contrast"), the theme in
8
8
  * effect, and a setter that saves the choice and applies it to <html>.
9
9
  * Renders "system" on the server; the real value arrives after hydration.
10
+ * It uses the nearest ThemeProvider's options, else the defaults.
10
11
  */
11
- export declare function useTheme(options?: ThemeOptions): {
12
+ export declare function useTheme(): {
12
13
  theme: Theme | 'system';
13
14
  resolvedTheme: Theme;
14
15
  setTheme: (theme: Theme | 'system') => void;
@@ -1,6 +1,7 @@
1
1
  "use client";
2
- import { useCallback, useSyncExternalStore } from "react";
2
+ import { useCallback, useContext, useSyncExternalStore } from "react";
3
3
  import { THEMES } from "../lib/theme.js";
4
+ import { ThemeOptionsContext } from "../internal/themeOptions.js";
4
5
  export const THEME_EVENT = "vk-themechange";
5
6
  const isTheme = (value) => THEMES.some((t) => t === value);
6
7
  export function systemTheme() {
@@ -26,9 +27,10 @@ export function readPreference(key) {
26
27
  * The theme preference ("system", "dark", "light" or "contrast"), the theme in
27
28
  * effect, and a setter that saves the choice and applies it to <html>.
28
29
  * Renders "system" on the server; the real value arrives after hydration.
30
+ * It uses the nearest ThemeProvider's options, else the defaults.
29
31
  */
30
- export function useTheme(options) {
31
- const o = options || {};
32
+ export function useTheme() {
33
+ const o = useContext(ThemeOptionsContext) || {};
32
34
  const key = o.storageKey || "vk-theme";
33
35
  const fallback = isTheme(o.defaultTheme) ? o.defaultTheme : "dark";
34
36
  const follow = o.followSystem !== false;
@@ -74,7 +76,7 @@ export function useTheme(options) {
74
76
  }, [key, resolve]);
75
77
  return {
76
78
  theme: isTheme(pref) ? pref : "system",
77
- // Read from <html>'s data-theme, which ThemeScript and setTheme write.
79
+ // Read from <html>'s data-theme, which ThemeProvider and setTheme write.
78
80
  resolvedTheme: isTheme(resolved) ? resolved : fallback,
79
81
  setTheme,
80
82
  themes: THEMES.slice(),
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @vokality/design-system: React components, tokens and helpers for Vokality projects.
3
3
  * Each component is its own module (most are client components with "use client");
4
- * bundlers keep only what an app imports. The helpers and ThemeScript are server-safe.
4
+ * bundlers keep only what an app imports. The helpers and ThemeProvider are server-safe.
5
5
  */
6
6
  export { Button } from "./components/Button/Button.js";
7
7
  export type * from "./components/Button/Button.js";
@@ -168,13 +168,13 @@ export { toast } from "./components/Toaster/Toaster.js";
168
168
  export { useTheme } from "./hooks/useTheme.js";
169
169
  export { LinkProvider } from "./components/LinkProvider/LinkProvider.js";
170
170
  export type * from "./components/LinkProvider/LinkProvider.js";
171
- export { ThemeScript } from "./components/ThemeScript/ThemeScript.js";
172
- export type * from "./components/ThemeScript/ThemeScript.js";
171
+ export { ThemeProvider } from "./components/ThemeProvider/ThemeProvider.js";
172
+ export type * from "./components/ThemeProvider/ThemeProvider.js";
173
173
  export { formatCurrency, formatNumber, formatPercent, formatDate, LOCALES as locales } from "./lib/format.js";
174
174
  export type { NumberOptions, DateOptions } from "./lib/format.js";
175
175
  export { utils } from "./lib/utils.js";
176
176
  export { ICONS as iconData } from "./lib/icons.js";
177
177
  export type { IconDef, IconCircle } from "./lib/icons.js";
178
178
  export { themeScript, THEMES as themes } from "./lib/theme.js";
179
- export type { Theme, ThemeOptions } from "./lib/theme.js";
179
+ export type { Density, Theme, ThemeOptions } from "./lib/theme.js";
180
180
  export type * from "./types.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @vokality/design-system: React components, tokens and helpers for Vokality projects.
3
3
  * Each component is its own module (most are client components with "use client");
4
- * bundlers keep only what an app imports. The helpers and ThemeScript are server-safe.
4
+ * bundlers keep only what an app imports. The helpers and ThemeProvider are server-safe.
5
5
  */
6
6
  export { Button } from "./components/Button/Button.js";
7
7
  export { Icon } from "./components/Icon/Icon.js";
@@ -87,7 +87,7 @@ export { Sparkline } from "./components/Sparkline/Sparkline.js";
87
87
  export { toast } from "./components/Toaster/Toaster.js";
88
88
  export { useTheme } from "./hooks/useTheme.js";
89
89
  export { LinkProvider } from "./components/LinkProvider/LinkProvider.js";
90
- export { ThemeScript } from "./components/ThemeScript/ThemeScript.js";
90
+ export { ThemeProvider } from "./components/ThemeProvider/ThemeProvider.js";
91
91
  export { formatCurrency, formatNumber, formatPercent, formatDate, LOCALES as locales } from "./lib/format.js";
92
92
  export { utils } from "./lib/utils.js";
93
93
  export { ICONS as iconData } from "./lib/icons.js";
@@ -0,0 +1,15 @@
1
+ import { type ReactNode } from "react";
2
+ import { type ThemeOptions } from "../lib/theme.js";
3
+ /** ThemeProvider's client half: shares its options with useTheme and keeps density on <html>. */
4
+ export declare function ThemeOptionsProvider({ options, children }: {
5
+ options: ThemeOptions;
6
+ children?: ReactNode;
7
+ }): import("react/jsx-runtime").JSX.Element;
8
+ /**
9
+ * The no-flash script, in server-rendered HTML and while hydrating it. A client-only render would
10
+ * never run a script, so it renders nothing there (React 19 warns about client-created scripts).
11
+ */
12
+ export declare function ThemeScriptTag({ options, nonce }: {
13
+ options: ThemeOptions;
14
+ nonce?: string;
15
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,26 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useSyncExternalStore } from "react";
4
+ import { themeScript } from "../lib/theme.js";
5
+ import { ThemeOptionsContext } from "./themeOptions.js";
6
+ import { useIsoLayoutEffect } from "./useIsoLayoutEffect.js";
7
+ /** ThemeProvider's client half: shares its options with useTheme and keeps density on <html>. */
8
+ export function ThemeOptionsProvider({ options, children }) {
9
+ const compact = options.density === "compact";
10
+ useIsoLayoutEffect(() => {
11
+ if (compact)
12
+ document.documentElement.setAttribute("data-density", "compact");
13
+ else
14
+ document.documentElement.removeAttribute("data-density");
15
+ }, [compact]);
16
+ return _jsx(ThemeOptionsContext.Provider, { value: options, children: children });
17
+ }
18
+ const noSubscription = () => () => { };
19
+ /**
20
+ * The no-flash script, in server-rendered HTML and while hydrating it. A client-only render would
21
+ * never run a script, so it renders nothing there (React 19 warns about client-created scripts).
22
+ */
23
+ export function ThemeScriptTag({ options, nonce }) {
24
+ const fromServer = useSyncExternalStore(noSubscription, () => false, () => true);
25
+ return fromServer ? _jsx("script", { nonce: nonce, suppressHydrationWarning: true, dangerouslySetInnerHTML: { __html: themeScript(options) } }) : null;
26
+ }
@@ -0,0 +1,3 @@
1
+ import type { ThemeOptions } from "../lib/theme.js";
2
+ /** The options of the nearest ThemeProvider; null outside one, where useTheme uses the defaults. */
3
+ export declare const ThemeOptionsContext: import("react").Context<ThemeOptions | null>;
@@ -0,0 +1,4 @@
1
+ "use client";
2
+ import { createContext } from "react";
3
+ /** The options of the nearest ThemeProvider; null outside one, where useTheme uses the defaults. */
4
+ export const ThemeOptionsContext = createContext(null);
@@ -1,4 +1,5 @@
1
1
  export type Theme = "dark" | "light" | "contrast";
2
+ export type Density = "default" | "compact";
2
3
  export interface ThemeOptions {
3
4
  /** Theme when nothing is saved and the system has no preference (or followSystem is false). Default "dark". */
4
5
  defaultTheme?: Theme;
@@ -6,11 +7,14 @@ export interface ThemeOptions {
6
7
  storageKey?: string;
7
8
  /** Use prefers-contrast and prefers-color-scheme when nothing is saved. Default true. */
8
9
  followSystem?: boolean;
10
+ /** "compact" for dense operational interfaces. Default "default". */
11
+ density?: Density;
9
12
  }
10
13
  export declare const THEMES: Theme[];
11
14
  /**
12
15
  * Source of a tiny blocking script that sets data-theme on <html> before the
13
16
  * page paints: the saved choice, else the system's contrast and color-scheme
14
- * preference, else defaultTheme. Inline it in <head> (ThemeScript does).
17
+ * preference, else defaultTheme, and data-density when compact. ThemeProvider inlines it; pages
18
+ * not rendered by React inline it themselves.
15
19
  */
16
20
  export declare function themeScript(options?: ThemeOptions): string;
package/dist/lib/theme.js CHANGED
@@ -2,7 +2,8 @@ export const THEMES = ["dark", "light", "contrast"];
2
2
  /**
3
3
  * Source of a tiny blocking script that sets data-theme on <html> before the
4
4
  * page paints: the saved choice, else the system's contrast and color-scheme
5
- * preference, else defaultTheme. Inline it in <head> (ThemeScript does).
5
+ * preference, else defaultTheme, and data-density when compact. ThemeProvider inlines it; pages
6
+ * not rendered by React inline it themselves.
6
7
  */
7
8
  export function themeScript(options = {}) {
8
9
  // JSON-quoted, with "<" escaped so the value can never close the inline <script>.
@@ -10,5 +11,5 @@ export function themeScript(options = {}) {
10
11
  const fallback = JSON.stringify(options.defaultTheme && THEMES.includes(options.defaultTheme) ? options.defaultTheme : "dark");
11
12
  const system = options.followSystem === false ? "" :
12
13
  'if(matchMedia("(prefers-contrast: more)").matches)t="contrast";else if(matchMedia("(prefers-color-scheme: light)").matches)t="light";else if(matchMedia("(prefers-color-scheme: dark)").matches)t="dark";';
13
- return "(function(){var t=" + fallback + ";try{var s=localStorage.getItem(" + key + ');if(s==="dark"||s==="light"||s==="contrast")t=s;else{' + system + '}}catch(e){}document.documentElement.setAttribute("data-theme",t)})();';
14
+ return "(function(){var t=" + fallback + ";try{var s=localStorage.getItem(" + key + ');if(s==="dark"||s==="light"||s==="contrast")t=s;else{' + system + '}}catch(e){}document.documentElement.setAttribute("data-theme",t)' + (options.density === "compact" ? ';document.documentElement.setAttribute("data-density","compact")' : "") + '})();';
14
15
  }
package/dist/tokens.css CHANGED
@@ -245,6 +245,7 @@
245
245
  --sidebar-width: 15rem;
246
246
  --topbar-height: 56px;
247
247
  --control-height: 44px;
248
+ --control-height-xs: 24px;
248
249
  --control-font-size: 1rem;
249
250
  --control-padding-block: 0.6rem;
250
251
  --button-height: 40px;
@@ -1186,6 +1186,11 @@
1186
1186
  "$value": "44px",
1187
1187
  "$description": "Inputs, selects, date fields."
1188
1188
  },
1189
+ "control-height-xs": {
1190
+ "$type": "dimension",
1191
+ "$value": "24px",
1192
+ "$description": "Extra-small buttons and fields in toolbars, record rows and status lines, for fine pointers only; touch keeps control-height."
1193
+ },
1189
1194
  "control-font-size": {
1190
1195
  "$type": "dimension",
1191
1196
  "$value": "1rem",
package/dist/tokens.json CHANGED
@@ -1202,6 +1202,11 @@
1202
1202
  "value": "44px",
1203
1203
  "usage": "Inputs, selects, date fields."
1204
1204
  },
1205
+ {
1206
+ "name": "control-height-xs",
1207
+ "value": "24px",
1208
+ "usage": "Extra-small buttons and fields in toolbars, record rows and status lines, for fine pointers only; touch keeps control-height."
1209
+ },
1205
1210
  {
1206
1211
  "name": "control-font-size",
1207
1212
  "value": "1rem",
package/dist/vokality.css CHANGED
@@ -269,6 +269,7 @@
269
269
  --sidebar-width: 15rem;
270
270
  --topbar-height: 56px;
271
271
  --control-height: 44px;
272
+ --control-height-xs: 24px;
272
273
  --control-font-size: 1rem;
273
274
  --control-padding-block: 0.6rem;
274
275
  --button-height: 40px;
@@ -850,6 +851,8 @@ body {
850
851
  .vk-icon-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
851
852
  .vk-icon-btn:disabled { cursor: not-allowed; opacity: 0.5; }
852
853
 
854
+ /* Dismiss and remove buttons inside alerts, toasts and upload rows keep a 16px glyph. */
855
+ .vk-alert-close .vk-icon, .vk-upload-item .vk-icon-btn .vk-icon { width: 16px; height: 16px; }
853
856
  /* Link */
854
857
  .vk-link {
855
858
  display: inline-flex;
@@ -871,6 +874,8 @@ body {
871
874
  .vk-field { display: grid; gap: 0.4rem; min-width: 0; }
872
875
  .vk-field-optional { font-weight: 500; letter-spacing: 0.04em; text-transform: none; color: var(--muted-subtle); }
873
876
  .vk-field-hint { font-size: var(--text-sm); line-height: 1.5; color: var(--muted-subtle); }
877
+ /* muted-subtle reaches AA only on background and card; raised surfaces use the stronger muted ink. */
878
+ :is(.vk-dialog, .vk-drawer, .vk-popover) .vk-field-hint { color: var(--muted-foreground); }
874
879
  .vk-input:disabled { cursor: not-allowed; color: var(--muted-subtle); background: transparent; border-style: dashed; }
875
880
  /* Only real fields: :read-only also matches every non-editable element, such as the select trigger. */
876
881
  input.vk-input:read-only, textarea.vk-input:read-only { background: transparent; }
@@ -961,7 +966,10 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
961
966
  .vk-field-error { margin: 0; font-size: var(--text-sm); color: var(--primary-hover); }
962
967
 
963
968
  .vk-fieldset { min-width: 0; margin: 0; padding: var(--space-md); border: 1px solid var(--border-subtle); }
964
- .vk-fieldset-legend { padding-inline: var(--space-xs); font-size: var(--text-xs); font-weight: 600; color: var(--foreground); }
969
+ .vk-fieldset-legend { padding-inline: var(--space-xs); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-foreground); }
970
+ /* A plain group sits in the form's own rhythm; its legend lines up with the field labels around it. */
971
+ .vk-fieldset-plain { padding: 0; border: 0; }
972
+ .vk-fieldset-plain > .vk-fieldset-legend { padding: 0; margin-bottom: 0.4rem; }
965
973
  .vk-fieldset-controls { display: grid; gap: var(--space-sm); }
966
974
  /* Hint and error take the shared field styles; only their spacing within the group is set here. */
967
975
  .vk-fieldset-hint { margin: 0 0 var(--space-sm); }
@@ -1211,6 +1219,8 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
1211
1219
  max-height: var(--radix-popper-available-height);
1212
1220
  outline: none;
1213
1221
  }
1222
+ /* muted-subtle keeps its contrast only on background and card: on the elevated panel the weekday row and outside days use muted-foreground */
1223
+ .vk-date-popover .vk-calendar-grid th, .vk-date-popover .vk-day-outside { color: var(--muted-foreground); }
1214
1224
  .vk-date-popover[data-state="open"] { animation: vk-date-popover-in var(--motion-normal) var(--ease-standard); }
1215
1225
  .vk-date-popover[data-state="closed"] { animation: vk-date-popover-out var(--motion-normal) var(--ease-standard) forwards; pointer-events: none; }
1216
1226
  @keyframes vk-date-popover-in { from { opacity: 0; transform: translateY(0.5rem); } to { opacity: 1; transform: none; } }
@@ -1368,13 +1378,13 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
1368
1378
  .vk-menu-item:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
1369
1379
  .vk-menu-item-icon { flex-shrink: 0; width: 16px; color: var(--muted-foreground); }
1370
1380
  .vk-menu-item-label { flex: 1; min-width: 0; }
1371
- .vk-menu-shortcut { font-family: var(--font-numeric); font-size: 0.6875rem; letter-spacing: 0.04em; color: var(--muted-subtle); }
1381
+ .vk-menu-shortcut { font-family: var(--font-numeric); font-size: 0.6875rem; letter-spacing: 0.04em; color: var(--muted-foreground); }
1372
1382
  .vk-menu-item-danger, .vk-menu-item-danger .vk-menu-item-icon { color: var(--danger); }
1373
1383
  .vk-menu-item-danger:focus { background: var(--danger-tint); }
1374
1384
  .vk-menu-item[aria-disabled="true"] { color: var(--muted-subtle); cursor: not-allowed; }
1375
1385
  .vk-menu-item[aria-disabled="true"]:focus { background: transparent; }
1376
1386
  .vk-menu-separator { height: 1px; margin: 0.25rem 0; background: var(--border-subtle); }
1377
- .vk-menu-label { padding: 0.5rem 0.75rem 0.25rem; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-subtle); }
1387
+ .vk-menu-label { padding: 0.5rem 0.75rem 0.25rem; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-foreground); }
1378
1388
  .vk-popover-panel { min-width: 16rem; outline: none; }
1379
1389
  .vk-popover-title { margin: 0 0 0.75rem; font-family: var(--font-display); font-size: var(--text-sm); font-weight: 600; color: var(--foreground); }
1380
1390
  .vk-popover-panel > .vk-popover-footer { margin-top: var(--space-md); }
@@ -1582,6 +1592,8 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
1582
1592
  .vk-navlist-item:hover { color: var(--foreground); background: var(--card-fill); }
1583
1593
  .vk-navlist-item-active { color: var(--foreground); background: var(--primary-tint); }
1584
1594
  .vk-navlist-item-active .vk-navlist-icon { color: var(--primary); }
1595
+ /* muted-subtle falls under 4.5:1 on the primary-tint fill. */
1596
+ .vk-navlist-item-active .vk-navlist-count { color: var(--muted-foreground); }
1585
1597
  .vk-navlist-item:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
1586
1598
  .vk-navlist-label { flex: 1; min-width: 0; }
1587
1599
  .vk-navlist-count { font-family: var(--font-numeric); font-variant-numeric: tabular-nums; font-size: 0.75rem; color: var(--muted-subtle); }
@@ -1785,7 +1797,10 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
1785
1797
  .vk-upload { display: grid; gap: 0.75rem; }
1786
1798
  .vk-dropzone { display: flex; align-items: center; gap: 1rem; box-sizing: border-box; padding: 1.25rem 1.25rem; border: 1px dashed var(--muted-subtle); background: var(--card-fill); transition: border-color var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard); }
1787
1799
  .vk-dropzone-active { border-color: var(--primary); border-style: solid; background: var(--primary-tint); }
1788
- .vk-dropzone-disabled { opacity: 0.6; }
1800
+ /* Disabled like Input: transparent and muted-subtle, which keeps the hint readable (an opacity drop took it under 4.5:1) */
1801
+ .vk-dropzone-disabled { background: transparent; cursor: not-allowed; }
1802
+ .vk-dropzone-disabled .vk-dropzone-icon, .vk-dropzone-disabled .vk-dropzone-title, .vk-dropzone-disabled .vk-dropzone-browse { color: var(--muted-subtle); }
1803
+ .vk-dropzone-disabled .vk-dropzone-browse { cursor: not-allowed; }
1789
1804
  .vk-dropzone-icon { flex-shrink: 0; color: var(--muted-foreground); }
1790
1805
  .vk-dropzone-active .vk-dropzone-icon { color: var(--primary); }
1791
1806
  .vk-dropzone-text { display: grid; gap: 0.2rem; }
@@ -2071,6 +2086,8 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
2071
2086
  .vk-list-title { font-size: var(--text-sm); font-weight: 500; color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
2072
2087
  .vk-list-description { font-size: 0.8125rem; color: var(--muted-foreground); overflow-wrap: anywhere; }
2073
2088
  .vk-list-meta { flex-shrink: 0; font-family: var(--font-numeric); font-variant-numeric: tabular-nums; font-size: 0.75rem; color: var(--muted-subtle); }
2089
+ /* muted-subtle falls under 4.5:1 on the primary-tint wash. */
2090
+ .vk-list-item-selected .vk-list-meta { color: var(--muted-foreground); }
2074
2091
  .vk-list-trailing { display: inline-flex; align-items: center; gap: 0.25rem; flex-shrink: 0; padding-right: 0.25rem; }
2075
2092
  @media (max-width: 40rem) {
2076
2093
  .vk-list-main { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 0.1rem; }
@@ -2117,6 +2134,8 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
2117
2134
  .vk-tree-row-selected .vk-tree-icon { color: var(--primary); }
2118
2135
  .vk-tree-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
2119
2136
  .vk-tree-meta { font-family: var(--font-numeric); font-size: 0.75rem; color: var(--muted-subtle); }
2137
+ /* muted-subtle falls under 4.5:1 on the primary-tint wash. */
2138
+ .vk-tree-row-selected .vk-tree-meta { color: var(--muted-foreground); }
2120
2139
 
2121
2140
  /* Table extras */
2122
2141
  .vk-row-toggle { width: 32px; height: 32px; }
@@ -2143,6 +2162,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
2143
2162
  .vk-code { padding: 0.1em 0.35em; font-family: var(--font-mono); font-size: 0.875em; color: var(--foreground); background: var(--card); border: 1px solid var(--border-subtle); }
2144
2163
  .vk-prose { max-width: var(--prose-max); font-size: var(--text-base); line-height: 1.7; color: var(--muted-foreground); }
2145
2164
  .vk-prose > :first-child { margin-top: 0; }
2165
+ .vk-prose-foreground { color: var(--foreground); }
2146
2166
  .vk-prose h1, .vk-prose h2, .vk-prose h3, .vk-prose h4 { margin: 2em 0 0.6em; font-family: var(--font-display); font-weight: 700; line-height: 1.25; letter-spacing: -0.015em; color: var(--foreground); text-wrap: balance; }
2147
2167
  .vk-prose h1 { font-size: 2rem; }
2148
2168
  .vk-prose h2 { font-size: 1.5rem; }
@@ -2188,10 +2208,11 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
2188
2208
  .vk-rich-minimal { border-top: 1px solid var(--border-subtle); }
2189
2209
  .vk-rich-minimal .vk-rich-toolbar { border-bottom: 0; }
2190
2210
  .vk-rich-minimal-formatting { border-top: 1px solid var(--border-subtle); }
2191
- .vk-rich-minimal .vk-rich-tool[data-state="open"] { color: var(--primary); background: var(--primary-tint); }
2211
+ /* primary text falls under 4.5:1 on the primary-tint fill; the primary-line edge marks the state. */
2212
+ .vk-rich-minimal .vk-rich-tool[data-state="open"] { color: var(--foreground); background: var(--primary-tint); }
2192
2213
  .vk-rich-tool { display: inline-flex; justify-content: center; align-items: center; min-width: 32px; min-height: 32px; padding: var(--space-xs); border: 1px solid transparent; border-radius: 0; background: transparent; color: var(--foreground); font: 500 var(--text-sm)/1 var(--font-sans); cursor: pointer; }
2193
2214
  .vk-rich-tool:hover { background: var(--primary-tint); }
2194
- .vk-rich-tool[aria-pressed="true"] { color: var(--primary); background: var(--primary-tint); border-color: var(--primary-line); }
2215
+ .vk-rich-tool[aria-pressed="true"] { color: var(--foreground); background: var(--primary-tint); border-color: var(--primary-line); }
2195
2216
  .vk-rich-tool:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
2196
2217
  .vk-rich-tool:disabled { color: var(--muted-subtle); cursor: not-allowed; background: transparent; }
2197
2218
  .vk-rich-separator { width: 1px; align-self: stretch; margin: var(--space-xs); background: var(--border-subtle); }
@@ -2243,7 +2264,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-bl
2243
2264
  .vk-cmd-list { max-height: min(22rem, 50vh); overflow-y: auto; padding: 0.25rem 0; }
2244
2265
  .vk-cmd-item { cursor: pointer; }
2245
2266
  .vk-cmd-item-active { background: var(--primary-tint); }
2246
- .vk-cmd-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; padding: 0.55rem 0.85rem; font-size: 0.75rem; color: var(--muted-subtle); border-top: 1px solid var(--border-subtle); }
2267
+ .vk-cmd-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; padding: 0.55rem 0.85rem; font-size: 0.75rem; color: var(--muted-foreground); border-top: 1px solid var(--border-subtle); }
2247
2268
 
2248
2269
  /* Shared chat presentation. Applications supply the rendered content and delivery state. */
2249
2270
  .vk-chat-panel { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; color: var(--foreground); }
@@ -2370,9 +2391,18 @@ html[data-density="compact"] body { font-size: var(--text-sm); }
2370
2391
  [data-density="compact"] .vk-shell-actions .vk-btn { width: auto; min-width: 0; }
2371
2392
  [data-density="compact"] .vk-shell-actions .vk-btn-label { display: block; min-width: 0; align-self: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
2372
2393
  [data-density="compact"] .vk-dialog-title { font-size: var(--text-base); }
2394
+ [data-density="compact"] .vk-alert-title { font-size: var(--text-sm); }
2395
+ /* Compact prose reads at body size: rendered records and messages sit beside 14px interface text. */
2396
+ [data-density="compact"] .vk-prose { font-size: var(--text-sm); line-height: 1.6; }
2397
+ [data-density="compact"] .vk-prose :is(p, ul, ol, blockquote, pre, table, figure) { margin-bottom: 0.75em; }
2398
+ [data-density="compact"] .vk-prose :is(h1, h2, h3, h4) { margin: 1.25em 0 0.5em; }
2399
+ [data-density="compact"] .vk-prose h1 { font-size: var(--text-xl); }
2400
+ [data-density="compact"] .vk-prose h2 { font-size: var(--text-base); }
2401
+ [data-density="compact"] .vk-prose :is(h3, h4) { font-size: var(--text-sm); }
2402
+ [data-density="compact"] .vk-prose > :first-child { margin-top: 0; }
2373
2403
  [data-density="compact"] .vk-accordion-trigger { font-size: var(--text-sm); padding-block: var(--space-sm); }
2374
2404
  [data-density="compact"] .vk-btn-text { font-size: var(--text-sm); }
2375
- [data-density="compact"] .vk-btn:not(.vk-btn-sm, .vk-btn-text) .vk-btn-label { padding: var(--space-xs) var(--space-sm); }
2405
+ [data-density="compact"] .vk-btn:not(.vk-btn-sm, .vk-btn-xs, .vk-btn-text) .vk-btn-label { padding: var(--space-xs) var(--space-sm); }
2376
2406
  [data-density="compact"] .vk-segmented { min-width: 0; max-width: 100%; align-self: flex-start; }
2377
2407
  [data-density="compact"] .vk-segment { min-width: 0; min-height: calc(var(--control-height) - 2px); padding: var(--space-xs) var(--space-sm); font-size: var(--text-sm); overflow-wrap: anywhere; }
2378
2408
  @container (max-width: 40rem) {
@@ -2395,6 +2425,23 @@ html[data-density="compact"] body { font-size: var(--text-sm); }
2395
2425
  @media (pointer: fine) and (not (any-pointer: coarse)) {
2396
2426
  [data-density="compact"] { --control-height: 32px; --control-font-size: var(--text-sm); --control-padding-block: var(--space-xs); }
2397
2427
  }
2428
+
2429
+ /* xs actions sit in rows and toolbars, so they stay content-sized where other buttons stretch on narrow screens. */
2430
+ @media (max-width: 40rem) {
2431
+ .vk-btn-xs { width: auto; justify-content: flex-start; }
2432
+ }
2433
+ /* Extra-small action controls for toolbars, record rows and status lines: size="xs" on Button, IconButton,
2434
+ Menu, Popover and SegmentedControl. Fine pointers only; with any coarse pointer they keep the 44px touch target. */
2435
+ @media (pointer: fine) and (not (any-pointer: coarse)) {
2436
+ .vk-btn-xs { min-height: var(--control-height-xs); font-size: 0.6875rem; }
2437
+ .vk-btn-xs .vk-btn-label, .vk-btn-xs .vk-btn-label:only-child { padding: 0 var(--space-sm); }
2438
+ .vk-btn-xs .vk-btn-glyph { width: var(--control-height-xs); }
2439
+ .vk-btn-text.vk-btn-xs { font-size: var(--text-xs); }
2440
+ .vk-btn-text.vk-btn-xs .vk-btn-label, .vk-btn-text.vk-btn-xs .vk-btn-label:only-child { padding: 0; }
2441
+ .vk-icon-btn-xs { width: var(--control-height-xs); height: var(--control-height-xs); }
2442
+ .vk-icon-btn-xs .vk-icon { width: 16px; height: 16px; }
2443
+ .vk-segmented-xs .vk-segment { min-height: calc(var(--control-height-xs) - 2px); padding: 0 var(--space-sm); font-size: var(--text-xs); }
2444
+ }
2398
2445
  /* Touch: buttons and rows meet a 44px target in every density (WCAG 2.5.5, Apple HIG); density only tightens fine-pointer layouts. */
2399
2446
  @media (any-pointer: coarse) {
2400
2447
  :root { --button-height: var(--control-height); --button-height-sm: var(--control-height); }