@dxos/ui-theme 0.8.4-main.8360d9e660 → 0.8.4-main.8baae0fced

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 (157) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +1 -1
  3. package/dist/lib/browser/index.mjs +414 -479
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/node-esm/index.mjs +414 -479
  7. package/dist/lib/node-esm/index.mjs.map +4 -4
  8. package/dist/lib/node-esm/meta.json +1 -1
  9. package/dist/plugin/node-cjs/{theme.css → main.css} +189 -122
  10. package/dist/plugin/node-cjs/main.css.map +7 -0
  11. package/dist/plugin/node-cjs/meta.json +1 -1
  12. package/dist/plugin/node-cjs/plugins/ThemePlugin.cjs +8 -15
  13. package/dist/plugin/node-cjs/plugins/ThemePlugin.cjs.map +3 -3
  14. package/dist/plugin/node-esm/{theme.css → main.css} +189 -122
  15. package/dist/plugin/node-esm/main.css.map +7 -0
  16. package/dist/plugin/node-esm/meta.json +1 -1
  17. package/dist/plugin/node-esm/plugins/ThemePlugin.mjs +8 -15
  18. package/dist/plugin/node-esm/plugins/ThemePlugin.mjs.map +3 -3
  19. package/dist/types/src/Theme.stories.d.ts.map +1 -1
  20. package/dist/types/src/defs.d.ts +1 -1
  21. package/dist/types/src/defs.d.ts.map +1 -1
  22. package/dist/types/src/fragments/density.d.ts +1 -4
  23. package/dist/types/src/fragments/density.d.ts.map +1 -1
  24. package/dist/types/src/fragments/hover.d.ts +0 -1
  25. package/dist/types/src/fragments/hover.d.ts.map +1 -1
  26. package/dist/types/src/fragments/index.d.ts +0 -4
  27. package/dist/types/src/fragments/index.d.ts.map +1 -1
  28. package/dist/types/src/fragments/text.d.ts +0 -1
  29. package/dist/types/src/fragments/text.d.ts.map +1 -1
  30. package/dist/types/src/index.d.ts +1 -1
  31. package/dist/types/src/index.d.ts.map +1 -1
  32. package/dist/types/src/plugins/ThemePlugin.d.ts +1 -1
  33. package/dist/types/src/plugins/ThemePlugin.d.ts.map +1 -1
  34. package/dist/types/src/theme/components/avatar.d.ts.map +1 -1
  35. package/dist/types/src/theme/components/button.d.ts +2 -2
  36. package/dist/types/src/theme/components/button.d.ts.map +1 -1
  37. package/dist/types/src/theme/components/card.d.ts +1 -0
  38. package/dist/types/src/theme/components/card.d.ts.map +1 -1
  39. package/dist/types/src/theme/components/dialog.d.ts.map +1 -1
  40. package/dist/types/src/theme/components/focus.d.ts +6 -0
  41. package/dist/types/src/theme/components/focus.d.ts.map +1 -0
  42. package/dist/types/src/theme/components/icon-button.d.ts +1 -0
  43. package/dist/types/src/theme/components/icon-button.d.ts.map +1 -1
  44. package/dist/types/src/theme/components/icon.d.ts.map +1 -1
  45. package/dist/types/src/theme/components/index.d.ts +1 -0
  46. package/dist/types/src/theme/components/index.d.ts.map +1 -1
  47. package/dist/types/src/theme/components/input.d.ts +8 -8
  48. package/dist/types/src/theme/components/input.d.ts.map +1 -1
  49. package/dist/types/src/theme/components/link.d.ts.map +1 -1
  50. package/dist/types/src/theme/components/list.d.ts.map +1 -1
  51. package/dist/types/src/theme/components/main.d.ts.map +1 -1
  52. package/dist/types/src/theme/components/message.d.ts.map +1 -1
  53. package/dist/types/src/theme/components/popover.d.ts.map +1 -1
  54. package/dist/types/src/theme/components/scroll-area.d.ts +12 -2
  55. package/dist/types/src/theme/components/scroll-area.d.ts.map +1 -1
  56. package/dist/types/src/theme/components/select.d.ts.map +1 -1
  57. package/dist/types/src/theme/components/status.d.ts +1 -1
  58. package/dist/types/src/theme/components/status.d.ts.map +1 -1
  59. package/dist/types/src/theme/components/toast.d.ts.map +1 -1
  60. package/dist/types/src/theme/components/tooltip.d.ts.map +1 -1
  61. package/dist/types/src/theme/components/treegrid.d.ts.map +1 -1
  62. package/dist/types/src/theme/index.d.ts +1 -0
  63. package/dist/types/src/theme/index.d.ts.map +1 -1
  64. package/dist/types/src/theme/primitives/column.d.ts +25 -3
  65. package/dist/types/src/theme/primitives/column.d.ts.map +1 -1
  66. package/dist/types/src/theme/primitives/panel.d.ts +9 -5
  67. package/dist/types/src/theme/primitives/panel.d.ts.map +1 -1
  68. package/dist/types/src/theme/theme.d.ts.map +1 -1
  69. package/dist/types/src/util/elevation.d.ts.map +1 -0
  70. package/dist/types/src/util/hash-styles.d.ts +1 -1
  71. package/dist/types/src/util/hash-styles.d.ts.map +1 -1
  72. package/dist/types/src/util/index.d.ts +3 -0
  73. package/dist/types/src/util/index.d.ts.map +1 -1
  74. package/dist/types/src/util/mx.d.ts +49 -284
  75. package/dist/types/src/util/mx.d.ts.map +1 -1
  76. package/dist/types/src/util/size.d.ts +27 -0
  77. package/dist/types/src/util/size.d.ts.map +1 -0
  78. package/dist/types/src/util/valence.d.ts +4 -0
  79. package/dist/types/src/util/valence.d.ts.map +1 -0
  80. package/dist/types/tsconfig.tsbuildinfo +1 -1
  81. package/package.json +14 -18
  82. package/src/Theme.stories.tsx +5 -5
  83. package/src/css/DESIGN_SYSTEM.md +159 -0
  84. package/src/css/base/base.css +2 -2
  85. package/src/css/components/button.css +4 -3
  86. package/src/css/components/checkbox.css +1 -1
  87. package/src/css/components/{focus-ring.css → focus.css} +27 -13
  88. package/src/css/components/icon.css +9 -0
  89. package/src/css/components/link.css +3 -0
  90. package/src/css/components/panel.css +45 -45
  91. package/src/css/components/selected.css +63 -10
  92. package/src/css/components/selected.md +101 -0
  93. package/src/css/components/surface.css +4 -4
  94. package/src/css/components/tag.css +25 -23
  95. package/src/css/integrations/codemirror.css +5 -3
  96. package/src/css/integrations/tldraw.css +1 -0
  97. package/src/css/layout/main.css +0 -7
  98. package/src/css/layout/size.css +16 -26
  99. package/src/css/theme/animation.css +31 -0
  100. package/src/css/theme/palette.css +6 -0
  101. package/src/css/theme/semantic.css +47 -46
  102. package/src/css/theme/spacing.css +31 -17
  103. package/src/css/theme/styles.css +22 -22
  104. package/src/css/utilities.css +114 -3
  105. package/src/defs.ts +1 -1
  106. package/src/fragments/AUDIT.md +55 -0
  107. package/src/fragments/density.ts +8 -5
  108. package/src/fragments/hover.ts +0 -2
  109. package/src/fragments/index.ts +1 -5
  110. package/src/fragments/text.ts +1 -1
  111. package/src/index.ts +1 -1
  112. package/src/{theme.css → main.css} +47 -10
  113. package/src/plugins/ThemePlugin.ts +12 -24
  114. package/src/plugins/main.css +45 -0
  115. package/src/theme/components/avatar.ts +3 -4
  116. package/src/theme/components/button.ts +2 -2
  117. package/src/theme/components/card.ts +15 -6
  118. package/src/theme/components/dialog.ts +4 -3
  119. package/src/theme/components/focus.ts +33 -0
  120. package/src/theme/components/icon-button.ts +6 -5
  121. package/src/theme/components/icon.ts +7 -5
  122. package/src/theme/components/index.ts +1 -0
  123. package/src/theme/components/input.ts +18 -33
  124. package/src/theme/components/link.ts +1 -2
  125. package/src/theme/components/list.ts +4 -4
  126. package/src/theme/components/menu.ts +4 -4
  127. package/src/theme/components/message.ts +6 -7
  128. package/src/theme/components/popover.ts +4 -5
  129. package/src/theme/components/scroll-area.ts +58 -46
  130. package/src/theme/components/select.ts +2 -3
  131. package/src/theme/components/status.ts +5 -5
  132. package/src/theme/components/toast.ts +2 -3
  133. package/src/theme/components/tooltip.ts +2 -3
  134. package/src/theme/components/treegrid.ts +1 -1
  135. package/src/theme/index.ts +1 -0
  136. package/src/theme/primitives/column.ts +49 -8
  137. package/src/theme/primitives/panel.ts +18 -25
  138. package/src/theme/theme.ts +2 -0
  139. package/src/typings.d.ts +3 -0
  140. package/src/util/hash-styles.ts +19 -19
  141. package/src/util/index.ts +3 -0
  142. package/src/util/mx.ts +112 -7
  143. package/src/util/size.ts +103 -0
  144. package/dist/plugin/node-cjs/theme.css.map +0 -7
  145. package/dist/plugin/node-esm/theme.css.map +0 -7
  146. package/dist/types/src/fragments/elevation.d.ts.map +0 -1
  147. package/dist/types/src/fragments/focus.d.ts +0 -4
  148. package/dist/types/src/fragments/focus.d.ts.map +0 -1
  149. package/dist/types/src/fragments/size.d.ts +0 -9
  150. package/dist/types/src/fragments/size.d.ts.map +0 -1
  151. package/dist/types/src/fragments/valence.d.ts +0 -4
  152. package/dist/types/src/fragments/valence.d.ts.map +0 -1
  153. package/src/fragments/focus.ts +0 -11
  154. package/src/fragments/size.ts +0 -123
  155. /package/dist/types/src/{fragments → util}/elevation.d.ts +0 -0
  156. /package/src/{fragments → util}/elevation.ts +0 -0
  157. /package/src/{fragments → util}/valence.ts +0 -0
@@ -2,5 +2,5 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- export const descriptionTextPrimary = 'text-sm font-normal text-base-surface-text';
5
+ // TODO(burdon): Replace with Message component.
6
6
  export const descriptionMessage = 'text-description border border-dashed border-separator rounded-sm p-4';
package/src/index.ts CHANGED
@@ -4,5 +4,5 @@
4
4
 
5
5
  export * from './defs';
6
6
  export * from './fragments';
7
- export * from './theme/index';
7
+ export * from './theme';
8
8
  export * from './util';
@@ -11,7 +11,17 @@
11
11
  */
12
12
  @layer properties, theme, dx-tokens, user-tokens, base, tw-base, dx-base, components, tw-components, dx-components, utilities;
13
13
 
14
- @import 'tailwindcss';
14
+ /**
15
+ * `source(none)` disables Tailwind 4's automatic content discovery (which
16
+ * scans the project root, including `publicDir`). With auto-detection on,
17
+ * every write to `public/icons.svg` from `vite-plugin-icons` triggers a
18
+ * Tailwind CSS regeneration, which invalidates `main.css` through its
19
+ * import graph and produces a 3–5-ping HMR storm per icon-sprite write
20
+ * during cold-start (icons land in tight bursts as plugin chunks stream
21
+ * in). Explicit `@source` directives below replace the auto-scan with a
22
+ * stable, source-only set.
23
+ */
24
+ @import 'tailwindcss' source(none);
15
25
 
16
26
  /* @theme extensions */
17
27
  @import './css/theme/animation.css';
@@ -30,7 +40,8 @@
30
40
  @import './css/components/button.css';
31
41
  @import './css/components/checkbox.css';
32
42
  @import './css/components/dialog.css';
33
- @import './css/components/focus-ring.css';
43
+ @import './css/components/focus.css';
44
+ @import './css/components/icon.css';
34
45
  @import './css/components/panel.css';
35
46
  @import './css/components/link.css';
36
47
  @import './css/components/scrollbar.css';
@@ -53,16 +64,40 @@
53
64
  @import './css/integrations/tldraw.css';
54
65
 
55
66
  /**
56
- * Force-emit CSS variables for the full color palette for all:
67
+ * With `source(none)` on the Tailwind import above, these are the *only*
68
+ * paths Tailwind scans for utility classes. Cover every workspace source
69
+ * directory so lazy-loaded plugin / UI / SDK chunks don't surface new
70
+ * utilities mid-session, and root-level HTML entrypoints (index.html,
71
+ * internal.html, …) are visible too.
72
+ *
73
+ * Paths are relative to this file (`packages/ui/ui-theme/src/main.css`):
74
+ * ../../../ → `packages/`
75
+ * ../../../../tools/ → `tools/`
76
+ *
77
+ * Tailwind ignores `node_modules` and common build/output dirs by default,
78
+ * so a broad workspace glob is safe.
79
+ */
80
+ @source "../../../**/*.{ts,tsx,html}";
81
+ @source "../../../../tools/**/*.{ts,tsx,html}";
82
+
83
+ /**
84
+ * Force-emit CSS variables for the full color palette for all:
57
85
  * --color-{hue}-{shade}
58
86
  * --color-{hue}-{style}
59
87
  */
60
88
  @source inline("bg-{neutral,red,orange,amber,yellow,lime,green,emerald,teal,cyan,sky,blue,indigo,violet,purple,fuchsia,pink,rose}-{50,100,200,300,400,500,600,700,800,900,950}");
61
- @source inline("bg-{neutral,red,orange,amber,yellow,lime,green,emerald,teal,cyan,sky,blue,indigo,violet,purple,fuchsia,pink,rose}-{fill,surface,surface-text,text,border}");
89
+ @source inline("bg-{neutral,red,orange,amber,yellow,lime,green,emerald,teal,cyan,sky,blue,indigo,violet,purple,fuchsia,pink,rose}-{fill,surface,foreground,text,border}");
62
90
  @source inline("border-{neutral,red,orange,amber,yellow,lime,green,emerald,teal,cyan,sky,blue,indigo,violet,purple,fuchsia,pink,rose}-border");
63
- @source inline("bg-{info,success,warning,error}-{fill,surface,surface-text,text,border}");
91
+ @source inline("bg-{info,success,warning,error}-{fill,surface,foreground,text,border}");
64
92
  @source inline("border-{info,success,warning,error}-border");
65
93
 
94
+ /**
95
+ * Force-emit tokens consumed by web components / .pcss files outside the
96
+ * Tailwind source-scan graph (e.g. lit-grid's dx-grid.pcss uses
97
+ * var(--color-grid-line)).
98
+ */
99
+ @source inline("bg-grid-{surface,foreground,line,highlight,comment,comment-active,selection-surface,selection-foreground}");
100
+
66
101
  /**
67
102
  * Plugins must come after all imports.
68
103
  */
@@ -76,9 +111,11 @@
76
111
  */
77
112
  @variant dark (&:where(.dark, .dark *));
78
113
 
79
- /**
80
- * Custom variants.
81
- */
82
- @custom-variant is-current (&[aria-current]:not([aria-current="false"]));
83
- @custom-variant hover-hover (@media (hover: hover));
114
+ /** Mobile */
115
+ @custom-variant pointer-coarse (@media (pointer: coarse));
116
+ /** Web */
84
117
  @custom-variant pointer-fine (@media (pointer: fine));
118
+ /** Supports mouse/trackpad (Web) */
119
+ @custom-variant hover-hover (@media (hover: hover));
120
+ /** Active navigation */
121
+ @custom-variant is-current (&[aria-current]:not([aria-current="false"]));
@@ -4,11 +4,10 @@
4
4
 
5
5
  /* eslint-disable no-console */
6
6
 
7
- import { existsSync, readFileSync } from 'node:fs';
8
- import { dirname, resolve } from 'node:path';
9
-
10
7
  import tailwindcss from '@tailwindcss/postcss';
11
8
  import autoprefixer from 'autoprefixer';
9
+ import { existsSync, readFileSync } from 'node:fs';
10
+ import { dirname, resolve } from 'node:path';
12
11
  import postcssImport from 'postcss-import';
13
12
  import postcssNesting from 'postcss-nesting';
14
13
  import { type HtmlTagDescriptor, type Plugin, type UserConfig } from 'vite';
@@ -44,16 +43,15 @@ export type ThemePluginOptions = {
44
43
  */
45
44
  export const ThemePlugin = (options: ThemePluginOptions): Plugin => {
46
45
  // Prefer source CSS if available (monorepo dev), fall back to dist for installed package.
47
- const srcThemePath = resolve(import.meta.dirname, ROOT, 'src/theme.css');
48
- const distThemePath = resolve(import.meta.dirname, '../theme.css');
46
+ const srcThemePath = resolve(import.meta.dirname, ROOT, 'src/main.css');
47
+ const distThemePath = resolve(import.meta.dirname, '../main.css');
49
48
  const isMonorepo = existsSync(srcThemePath);
50
49
 
51
- // dark-mode.ts is always read from src (ships via "files": ["src"] in package.json).
52
- // In monorepo: import.meta.dirname = src/plugins/, so the file is right here.
53
- // In installed package: import.meta.dirname = dist/plugin/{format}/plugins/, so go up 4 levels.
54
- const srcDarkModePath = resolve(import.meta.dirname, ROOT, 'src/plugins/dark-mode.ts');
55
- const distDarkModePath = resolve(import.meta.dirname, ROOT, 'src/plugins/dark-mode.ts');
56
- const darkModeScriptPath = existsSync(srcDarkModePath) ? srcDarkModePath : distDarkModePath;
50
+ // Static assets shipped via "files": ["src"] in package.json.
51
+ // Both monorepo and installed package resolve to the same src/plugins/ directory.
52
+ const pluginsDir = resolve(import.meta.dirname, ROOT, 'src/plugins');
53
+ const darkModeScriptPath = resolve(pluginsDir, 'dark-mode.ts');
54
+ const mainCssPath = resolve(pluginsDir, 'main.css');
57
55
 
58
56
  const config: ThemePluginOptions = {
59
57
  srcCssPath: isMonorepo ? srcThemePath : distThemePath,
@@ -112,23 +110,13 @@ export const ThemePlugin = (options: ThemePluginOptions): Plugin => {
112
110
  injectTo: 'head-prepend',
113
111
  };
114
112
 
115
- // Critical pre-CSS fallbacks so text is readable before (and during) Vite HMR.
116
- // In dev mode Vite injects CSS via JS; when an HMR update fires the old style tag is
117
- // removed before the new one is inserted, briefly leaving all --color-* vars undefined.
118
- // These static approximations of neutral-50/950 survive that gap.
119
- // Values are intentionally kept in sync with @theme tokens in semantic.css.
113
+ // Critical styles: font sizing, overscroll, color fallbacks.
114
+ // Loaded from critical.css to keep styles maintainable and out of index.html.
120
115
  const criticalTag: HtmlTagDescriptor = {
121
116
  tag: 'style',
122
117
  attrs: { 'data-dxos-critical': '' },
123
118
  injectTo: 'head-prepend',
124
- children: [
125
- ':root { color-scheme: light; }',
126
- 'html { color: oklch(0.145 0 0); background-color: oklch(0.985 0 0); }', // ≈ neutral-950 / neutral-50
127
- 'html.dark { color-scheme: dark; color: oklch(0.985 0 0); background-color: oklch(0.145 0 0); }',
128
- '@media (prefers-color-scheme: dark) {',
129
- ' html:not(.dark) { color: oklch(0.985 0 0); background-color: oklch(0.145 0 0); }',
130
- '}',
131
- ].join('\n'),
119
+ children: readFileSync(mainCssPath, 'utf-8'),
132
120
  };
133
121
 
134
122
  return [darkModeTag, layersTag, criticalTag];
@@ -0,0 +1,45 @@
1
+ /*
2
+ * Critical styles injected into <head> by the Vite ThemePlugin before any stylesheets load.
3
+ * Ensures text is readable and layout is stable on the very first paint.
4
+ */
5
+
6
+ /* Base font size: larger default for touch devices, smaller for precision pointers. */
7
+ html {
8
+ font-size: 20px;
9
+ }
10
+ @media (pointer: fine) {
11
+ html {
12
+ font-size: 16px;
13
+ }
14
+ }
15
+
16
+ /* Prevent overscroll bounce and ensure full viewport height. */
17
+ html,
18
+ body {
19
+ overscroll-behavior: none;
20
+ -webkit-overflow-scrolling: touch;
21
+ }
22
+ body {
23
+ height: 100vh;
24
+ }
25
+
26
+ /* Pre-CSS color fallbacks so text is readable before and during Vite HMR. */
27
+ /* Values are intentionally kept in sync with @theme tokens in semantic.css. */
28
+ :root {
29
+ color-scheme: light;
30
+ }
31
+ html {
32
+ color: oklch(0.145 0 0);
33
+ background-color: oklch(0.985 0 0);
34
+ }
35
+ html.dark {
36
+ color-scheme: dark;
37
+ color: oklch(0.985 0 0);
38
+ background-color: oklch(0.145 0 0);
39
+ }
40
+ @media (prefers-color-scheme: dark) {
41
+ html:not(.dark) {
42
+ color: oklch(0.985 0 0);
43
+ background-color: oklch(0.145 0 0);
44
+ }
45
+ }
@@ -4,8 +4,7 @@
4
4
 
5
5
  import { type ComponentFunction, type Size, type Theme } from '@dxos/ui-types';
6
6
 
7
- import { getSize, getSizeHeight } from '../../fragments';
8
- import { mx } from '../../util';
7
+ import { mx, getSize, getHeight } from '../../util';
9
8
 
10
9
  export type AvatarStyleProps = Partial<{
11
10
  size: Size;
@@ -30,7 +29,7 @@ export const avatarDescription: ComponentFunction<AvatarStyleProps> = ({ srOnly
30
29
  mx('text-description', srOnly && 'sr-only', ...etc);
31
30
 
32
31
  export const avatarFrame: ComponentFunction<AvatarStyleProps> = ({ variant }, ...etc) =>
33
- mx('w-full h-full bg-(--surface-bg)', variant === 'circle' ? 'rounded-full' : 'rounded-sm', ...etc);
32
+ mx('h-full w-full bg-(--surface-bg)', variant === 'circle' ? 'rounded-full' : 'rounded-sm', ...etc);
34
33
 
35
34
  export const avatarStatusIcon: ComponentFunction<AvatarStyleProps> = ({ status, size = 3 }, ...etc) =>
36
35
  mx(
@@ -75,7 +74,7 @@ export const avatarGroupLabel: ComponentFunction<AvatarStyleProps> = ({ size, sr
75
74
  srOnly
76
75
  ? 'sr-only'
77
76
  : 'rounded-full truncate text-sm leading-none py-1 px-2 relative z-[1] flex items-center justify-center',
78
- size && getSizeHeight(size),
77
+ size && getHeight(size),
79
78
  ...etc,
80
79
  );
81
80
 
@@ -8,9 +8,9 @@ import { ghostHover } from '../../fragments';
8
8
  import { mx } from '../../util';
9
9
 
10
10
  export const primaryButtonColors =
11
- 'text-accent-surface-text bg-accent-surface hover:bg-accent-surface-hover aria-pressed:bg-primary-500 dark:aria-pressed:bg-primary-500 data-[state=open]:bg-primary-500 dark:data-[state=open]:bg-primary-500 aria-checked:bg-primary-500 dark:aria-checked:bg-primary-500 aria-checked:text-primary-100';
11
+ 'text-accent-foreground bg-accent-surface hover:bg-accent-surface-hover aria-pressed:bg-primary-500 dark:aria-pressed:bg-primary-500 data-[state=open]:bg-primary-500 dark:data-[state=open]:bg-primary-500 aria-checked:bg-primary-500 dark:aria-checked:bg-primary-500 aria-checked:text-primary-100';
12
12
 
13
- export const staticDefaultButtonColors = 'bg-input-surface text-input-surface-text';
13
+ export const staticDefaultButtonColors = 'bg-input-surface text-input-foreground';
14
14
 
15
15
  export const defaultButtonColors = mx(
16
16
  staticDefaultButtonColors,
@@ -13,11 +13,12 @@ export type CardStyleProps = {
13
13
  variant?: 'default' | 'subtitle' | 'description';
14
14
  density?: Density;
15
15
  truncate?: boolean;
16
+ padding?: boolean;
16
17
  };
17
18
 
18
19
  const cardRoot: ComponentFunction<CardStyleProps> = ({ border, fullWidth }, ...etc) =>
19
20
  mx(
20
- 'dx-card group/card relative flex flex-col w-full min-h-(--dx-rail-item) dx-card-min-width overflow-hidden',
21
+ 'dx-card dx-card-min-width dx-card-max-width min-h-(--dx-rail-item) group/card relative overflow-hidden',
21
22
  border &&
22
23
  'bg-card-surface border border-separator dark:border-subdued-separator rounded-xs dx-focus-ring-group-y-indicator',
23
24
  fullWidth && 'max-w-none!',
@@ -33,7 +34,7 @@ const cardToolbar: ComponentFunction<CardStyleProps> = (_, ...etc) =>
33
34
  const cardTitle: ComponentFunction<CardStyleProps> = (_props, ...etc) => mx('dx-card__title grow truncate', ...etc);
34
35
 
35
36
  const cardContent: ComponentFunction<CardStyleProps> = (_props, ...etc) =>
36
- mx('dx-card__content contents [&>:last-child]:pb-1', ...etc);
37
+ mx('dx-card__content contents pb-1 last:pb-0', ...etc);
37
38
 
38
39
  const cardHeading: ComponentFunction<CardStyleProps> = ({ variant = 'default' }, ...etc) =>
39
40
  mx(
@@ -45,9 +46,9 @@ const cardHeading: ComponentFunction<CardStyleProps> = ({ variant = 'default' },
45
46
 
46
47
  const cardText: ComponentFunction<CardStyleProps> = ({ variant = 'default', truncate: _truncate }, ...etc) =>
47
48
  mx(
48
- 'dx-card__text flex overflow-hidden',
49
+ 'dx-card__text items-center overflow-hidden',
49
50
  variant === 'default' && 'py-1',
50
- variant === 'description' && 'py-1.5',
51
+ variant === 'description' && 'py-1.5 text-description',
51
52
  ...etc,
52
53
  );
53
54
 
@@ -72,14 +73,22 @@ const cardLink: ComponentFunction<CardStyleProps> = (_props, ...etc) =>
72
73
  const cardLinkLabel: ComponentFunction<CardStyleProps> = (_props, ...etc) =>
73
74
  mx('dx-card__link-label min-w-0 flex-1 truncate', ...etc);
74
75
 
75
- const cardIconBlock: ComponentFunction<CardStyleProps> = (_props, ...etc) =>
76
- mx('dx-card__icon-block grid h-[var(--dx-rail-item)] w-[var(--dx-rail-item)] place-items-center [&>*]:p-1', ...etc);
76
+ const cardRow: ComponentFunction<CardStyleProps> = (_, ...etc) =>
77
+ mx('dx-card__row col-span-3 grid grid-cols-subgrid', ...etc);
78
+
79
+ const cardIconBlock: ComponentFunction<CardStyleProps> = ({ padding }, ...etc) =>
80
+ mx(
81
+ 'dx-card__icon-block grid h-[var(--dx-rail-item)] w-[var(--dx-rail-item)] place-items-center',
82
+ padding && '[&>*]:p-1',
83
+ ...etc,
84
+ );
77
85
 
78
86
  export const cardTheme: Theme<CardStyleProps> = {
79
87
  root: cardRoot,
80
88
  toolbar: cardToolbar,
81
89
  title: cardTitle,
82
90
  content: cardContent,
91
+ row: cardRow,
83
92
  heading: cardHeading,
84
93
  text: cardText,
85
94
  'text-span': cardTextSpan,
@@ -5,6 +5,7 @@
5
5
  import { type ComponentFunction, type Elevation, type Theme } from '@dxos/ui-types';
6
6
 
7
7
  import { mx } from '../../util';
8
+ import { withColumn } from '../primitives/column';
8
9
 
9
10
  export type DialogSize = 'sm' | 'md' | 'lg' | 'xl';
10
11
 
@@ -35,13 +36,13 @@ export const dialogContent: ComponentFunction<DialogStyleProps> = ({ inOverlayLa
35
36
  };
36
37
 
37
38
  export const dialogHeader: ComponentFunction<DialogStyleProps> = (_props, ...etc) =>
38
- mx('dx-dialog__header flex pb-4 items-center justify-between', ...etc);
39
+ mx('dx-dialog__header flex pb-4 items-center justify-between', withColumn.center(), ...etc);
39
40
 
40
41
  export const dialogBody: ComponentFunction<DialogStyleProps> = (_props, ...etc) =>
41
- mx('dx-dialog__body flex flex-col h-full py-2 gap-2', ...etc);
42
+ mx('dx-dialog__body dx-expander', withColumn.propagate(), ...etc);
42
43
 
43
44
  export const dialogActionBar: ComponentFunction<DialogStyleProps> = (_props, ...etc) =>
44
- mx('dx-dialog__actionbar flex items-center pt-4 gap-2 dx-density-coarse', ...etc);
45
+ mx('dx-dialog__actionbar flex items-center pt-4 gap-2 dx-density-coarse', withColumn.center(), ...etc);
45
46
 
46
47
  export const dialogTitle: ComponentFunction<DialogStyleProps> = ({ srOnly }, ...etc) =>
47
48
  mx('dx-dialog__title', srOnly && 'sr-only', ...etc);
@@ -0,0 +1,33 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { type ComponentFunction, type Theme } from '@dxos/ui-types';
6
+
7
+ import { mx } from '../../util';
8
+
9
+ export type FocusStyleProps = {
10
+ border?: boolean;
11
+ };
12
+
13
+ /**
14
+ * Focus ring styles shared by Focus.Group and Focus.Item.
15
+ * Uses a `::after` pseudo-element overlay so the ring paints above child content
16
+ * (inset box-shadow alone is obscured by children with backgrounds).
17
+ * The pseudo-element is `pointer-events-none` and absolutely positioned over the element.
18
+ * When `border` is true, a subdued CSS border is always visible (e.g., for grid cell edges).
19
+ */
20
+ const focusRing: ComponentFunction<FocusStyleProps> = ({ border }, ...etc) =>
21
+ mx(
22
+ 'dx-ring-pseudo outline-hidden',
23
+ 'focus:after:ring-focus-ring-subtle',
24
+ 'data-[focus-state=active]:after:ring-focus-ring-subtle',
25
+ 'data-[focus-state=error]:after:ring-rose-500',
26
+ border && 'border border-separator',
27
+ ...etc,
28
+ );
29
+
30
+ export const focusTheme: Theme<FocusStyleProps> = {
31
+ group: focusRing,
32
+ item: focusRing,
33
+ };
@@ -5,14 +5,15 @@
5
5
  import type { ComponentFunction, Theme } from '@dxos/ui-types';
6
6
 
7
7
  import { mx } from '../../util';
8
-
9
8
  import { type ButtonStyleProps } from './button';
10
9
 
11
- export type IconButtonStyleProps = ButtonStyleProps & { iconOnly?: boolean };
10
+ export type IconButtonStyleProps = ButtonStyleProps & {
11
+ iconOnly?: boolean;
12
+ square?: boolean;
13
+ };
12
14
 
13
- // TODO(burdon): Gap/font size should depend on density.
14
- export const iconButtonRoot: ComponentFunction<IconButtonStyleProps> = ({ iconOnly }, ...etc) => {
15
- return mx('gap-2', iconOnly && 'p-icon-button-padding min-h-0', ...etc);
15
+ export const iconButtonRoot: ComponentFunction<IconButtonStyleProps> = ({ iconOnly, square }, ...etc) => {
16
+ return mx('px-1.5', !iconOnly && 'gap-1.5', square && 'aspect-square', ...etc);
16
17
  };
17
18
 
18
19
  export const iconButtonTheme: Theme<IconButtonStyleProps> = {
@@ -4,8 +4,7 @@
4
4
 
5
5
  import { type ComponentFunction, type Size, type Theme } from '@dxos/ui-types';
6
6
 
7
- import { getSize } from '../../fragments';
8
- import { mx } from '../../util';
7
+ import { getSize, mx } from '../../util';
9
8
 
10
9
  export type IconStyleProps = {
11
10
  size?: Size;
@@ -14,12 +13,15 @@ export type IconStyleProps = {
14
13
  /**
15
14
  * Size can be specified directly, or inherited from a container (e.g., toolbar).
16
15
  */
17
- export const iconRoot: ComponentFunction<IconStyleProps> = ({ size }, etc) =>
18
- mx(
16
+ export const iconRoot: ComponentFunction<IconStyleProps> = ({ size }, etc) => {
17
+ return mx(
19
18
  'shrink-0 text-[var(--icons-color,currentColor)]',
20
- size ? getSize(size) : '[width:var(--icon-size,1em)] [height:var(--icon-size,1em)]',
19
+ size
20
+ ? getSize(size)
21
+ : '[width:var(--icon-size,var(--dx-default-icons-size))] [height:var(--icon-size,var(--dx-default-icons-size))]',
21
22
  etc,
22
23
  );
24
+ };
23
25
 
24
26
  export const iconTheme: Theme<IconStyleProps> = {
25
27
  root: iconRoot,
@@ -7,6 +7,7 @@ export * from './breadcrumb';
7
7
  export * from './card';
8
8
  export * from './button';
9
9
  export * from './dialog';
10
+ export * from './focus';
10
11
  export * from './icon';
11
12
  export * from './icon-button';
12
13
  export * from './input';
@@ -11,23 +11,8 @@ import {
11
11
  type Size,
12
12
  } from '@dxos/ui-types';
13
13
 
14
- import {
15
- coarseBlockSize,
16
- coarseDimensions,
17
- computeSize,
18
- fineBlockSize,
19
- fineDimensions,
20
- focusRing,
21
- getSize,
22
- getSizeHeight,
23
- getSizeWidth,
24
- sizeValue,
25
- staticDisabled,
26
- staticFocusRing,
27
- subduedFocus,
28
- textValence,
29
- } from '../../fragments';
30
- import { mx } from '../../util';
14
+ import { densityDimensions, staticDisabled } from '../../fragments';
15
+ import { getSize, getHeight, getWidth, mx, snapSize, sizeValue, textValence } from '../../util';
31
16
 
32
17
  export type InputStyleProps = Partial<{
33
18
  variant: 'default' | 'subdued' | 'static';
@@ -73,30 +58,30 @@ const inputValence = (valence?: MessageValence) => {
73
58
  };
74
59
 
75
60
  const sharedSubduedInputStyles: ComponentFragment<InputStyleProps> = (props) => [
76
- 'py-0 w-full bg-transparent text-current placeholder-placeholder',
77
61
  '[[data-drag-autoscroll="active"]_&]:pointer-events-none',
78
- props.density === 'fine' ? fineBlockSize : coarseBlockSize,
79
- subduedFocus,
62
+ 'py-0 w-full bg-transparent text-current placeholder-placeholder',
63
+ 'dx-focus-subdued',
64
+ densityDimensions(props.density),
80
65
  props.disabled && staticDisabled,
81
66
  ];
82
67
 
83
68
  const sharedDefaultInputStyles: ComponentFragment<InputStyleProps> = (props) => [
84
- 'py-0 w-full text-base-surface-text rounded-xs placeholder-placeholder',
85
69
  '[[data-drag-autoscroll="active"]_&]:pointer-events-none',
70
+ 'py-0 w-full text-base-foreground rounded-xs placeholder-placeholder',
86
71
  textInputSurfaceFocus,
87
- props.density === 'fine' ? fineDimensions : coarseDimensions,
72
+ densityDimensions(props.density),
88
73
  props.disabled ? staticDisabled : textInputSurfaceHover,
89
74
  ];
90
75
 
91
76
  const sharedStaticInputStyles: ComponentFragment<InputStyleProps> = (props) => [
92
- 'py-0 w-full text-base-surface-text rounded-xs placeholder-placeholder',
93
77
  '[[data-drag-autoscroll="active"]_&]:pointer-events-none',
78
+ 'py-0 w-full text-base-foreground rounded-xs placeholder-placeholder',
94
79
  textInputSurfaceFocus,
95
80
  textInputSurfaceHover,
96
81
  props.focused && 'bg-attention-surface',
97
82
  inputValence(props.validationValence),
98
83
  props.disabled && staticDisabled,
99
- props.focused && staticFocusRing,
84
+ props.focused && 'dx-focus-static',
100
85
  ];
101
86
 
102
87
  const inputInput: ComponentFunction<InputStyleProps> = (props, ...etc) =>
@@ -106,28 +91,28 @@ const inputInput: ComponentFunction<InputStyleProps> = (props, ...etc) =>
106
91
  ? mx(...sharedStaticInputStyles(props), ...etc)
107
92
  : mx(
108
93
  ...sharedDefaultInputStyles(props),
109
- !props.disabled && focusRing,
94
+ !props.disabled && 'dx-focus-ring',
110
95
  inputValence(props.validationValence),
111
96
  ...etc,
112
97
  );
113
98
 
114
- const inputTextArea: ComponentFunction<InputStyleProps> = (props, ...etc) => inputInput(props, ...['-mb-1.5', ...etc]);
99
+ const inputTextArea: ComponentFunction<InputStyleProps> = (props, ...etc) => inputInput(props, ...etc);
115
100
 
116
101
  const inputCheckbox: ComponentFunction<InputStyleProps> = ({ size = 5 }, ...etc) =>
117
102
  mx('dx-checkbox dx-focus-ring', getSize(size), ...etc);
118
103
 
119
104
  const inputCheckboxIndicator: ComponentFunction<InputStyleProps> = ({ size = 5, checked }, ...etc) =>
120
- mx(getSize(computeSize(sizeValue(size) * 0.65, 4)), !checked && 'invisible', ...etc);
105
+ mx(getSize(snapSize(sizeValue(size) * 0.65, 4)), !checked && 'invisible', ...etc);
121
106
 
122
107
  const inputSwitch: ComponentFunction<InputStyleProps> = ({ size = 5, disabled }, ...etc) =>
123
108
  mx(
124
- getSizeHeight(size),
125
- getSizeWidth(computeSize(sizeValue(size) * 1.75, 9)),
109
+ getHeight(size),
110
+ getWidth(snapSize(sizeValue(size) * 1.75, 9)),
126
111
  booleanInputSurface,
127
112
  !disabled && booleanInputSurfaceHover,
128
113
  // TODO(burdon): Added m-1 margin to make 40px width to align with 40px icon button.
129
114
  'cursor-pointer shrink-0 rounded-full px-1 mx-1 relative',
130
- focusRing,
115
+ 'dx-focus-ring',
131
116
  ...etc,
132
117
  );
133
118
 
@@ -150,9 +135,9 @@ const inputSegment: ComponentFunction<InputStyleProps> = (props, ...etc) =>
150
135
  mx(
151
136
  'flex items-center justify-center font-mono',
152
137
  props.density === 'fine' ? 'size-10 pointer-fine:size-8 rounded-xs' : 'size-12 rounded-xs',
153
- 'bg-input-surface text-base-surface-text transition-colors border border-separator',
154
- 'data-[focused]:bg-attention-surface data-[focused]:border-neutral-focus-indicator',
155
- 'data-[focused]:ring-2 data-[focused]:ring-offset-0 data-[focused]:ring-neutral-focus-indicator',
138
+ 'bg-input-surface text-base-foreground transition-colors border border-separator',
139
+ 'data-[focused]:bg-attention-surface data-[focused]:border-focus-ring-subtle',
140
+ 'data-[focused]:ring-2 data-[focused]:ring-offset-0 data-[focused]:ring-focus-ring-subtle',
156
141
  inputValence(props.validationValence),
157
142
  props.disabled && staticDisabled,
158
143
  ...etc,
@@ -4,7 +4,6 @@
4
4
 
5
5
  import { type ComponentFunction, type Theme } from '@dxos/ui-types';
6
6
 
7
- import { focusRing } from '../../fragments';
8
7
  import { mx } from '../../util';
9
8
 
10
9
  export type LinkStyleProps = {
@@ -17,7 +16,7 @@ export const linkRoot: ComponentFunction<LinkStyleProps> = ({ variant }, ...etc)
17
16
  variant === 'neutral'
18
17
  ? 'text-inherit hover:opacity-90 visited:text-inherit visited:hover:opacity-90'
19
18
  : 'text-accent-text hover:text-accent-text-hover visited:text-accent-text visited:hover:text-accent-text-hover',
20
- focusRing,
19
+ 'dx-focus-ring',
21
20
  ...etc,
22
21
  );
23
22
 
@@ -4,8 +4,8 @@
4
4
 
5
5
  import { type ComponentFunction, type Density, type Theme } from '@dxos/ui-types';
6
6
 
7
- import { densityBlockSize, focusRing, getSize, ghostHover } from '../../fragments';
8
- import { mx } from '../../util';
7
+ import { densityBlockSize, ghostHover } from '../../fragments';
8
+ import { getSize, mx } from '../../util';
9
9
 
10
10
  export type ListStyleProps = Partial<{
11
11
  density: Density;
@@ -21,13 +21,13 @@ export const listItemEndcap: ComponentFunction<ListStyleProps> = ({ density }, .
21
21
  mx(density === 'fine' ? getSize(8) : getSize(10), 'shrink-0 flex items-center justify-center', ...etc);
22
22
 
23
23
  export const listItemHeading: ComponentFunction<ListStyleProps> = ({ density }, ...etc) =>
24
- mx(densityBlockSize(density), 'flex items-center', ...etc);
24
+ mx(densityBlockSize(density), 'flex items-center overflow-hidden [&>span]:truncate', ...etc);
25
25
 
26
26
  export const listItemDragHandleIcon: ComponentFunction<ListStyleProps> = (_props, ...etc) =>
27
27
  mx(getSize(5), 'mt-2.5', ...etc);
28
28
 
29
29
  export const listItemOpenTrigger: ComponentFunction<ListStyleProps> = ({ density }, ...etc) =>
30
- mx('w-5 rounded-sm flex justify-center items-center', densityBlockSize(density), ghostHover, focusRing, ...etc);
30
+ mx('w-5 rounded-sm flex justify-center items-center', densityBlockSize(density), ghostHover, 'dx-focus-ring', ...etc);
31
31
 
32
32
  export const listItemOpenTriggerIcon: ComponentFunction<ListStyleProps> = (_props, ...etc) => {
33
33
  return mx(getSize(5), ...etc);
@@ -4,8 +4,8 @@
4
4
 
5
5
  import { type ComponentFunction, type Elevation, type Theme } from '@dxos/ui-types';
6
6
 
7
- import { dataDisabled, subduedFocus, surfaceShadow, surfaceZIndex } from '../../fragments';
8
- import { mx } from '../../util';
7
+ import { dataDisabled } from '../../fragments';
8
+ import { mx, surfaceShadow, surfaceZIndex } from '../../util';
9
9
 
10
10
  export type MenuStyleProps = Partial<{
11
11
  constrainBlockSize: boolean;
@@ -26,8 +26,8 @@ export const menuViewport: ComponentFunction<MenuStyleProps> = (_props, ...etc)
26
26
  export const menuItem: ComponentFunction<MenuStyleProps> = (_props, ...etc) =>
27
27
  mx(
28
28
  'flex cursor-pointer select-none items-center gap-2 rounded-xs px-2 py-2 text-sm',
29
- 'data-[highlighted]:bg-hover-surface',
30
- subduedFocus,
29
+ 'hover:bg-hover-surface data-[highlighted]:bg-hover-surface',
30
+ 'dx-focus-subdued',
31
31
  dataDisabled,
32
32
  ...etc,
33
33
  );