@dxos/ui-theme 0.10.0 → 0.11.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 (57) hide show
  1. package/dist/lib/browser/index.mjs +0 -62
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +0 -62
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/plugin/node-cjs/main.css +311 -189
  8. package/dist/plugin/node-cjs/main.css.map +3 -3
  9. package/dist/plugin/node-cjs/meta.json +1 -1
  10. package/dist/plugin/node-cjs/plugins/ThemePlugin.cjs +2 -1
  11. package/dist/plugin/node-cjs/plugins/ThemePlugin.cjs.map +3 -3
  12. package/dist/plugin/node-esm/main.css +311 -189
  13. package/dist/plugin/node-esm/main.css.map +3 -3
  14. package/dist/plugin/node-esm/meta.json +1 -1
  15. package/dist/plugin/node-esm/plugins/ThemePlugin.mjs +2 -1
  16. package/dist/plugin/node-esm/plugins/ThemePlugin.mjs.map +3 -3
  17. package/dist/types/src/Theme.stories.d.ts.map +1 -1
  18. package/dist/types/src/defs.d.ts +0 -5
  19. package/dist/types/src/defs.d.ts.map +1 -1
  20. package/dist/types/src/fragments/hover.d.ts +0 -2
  21. package/dist/types/src/fragments/hover.d.ts.map +1 -1
  22. package/dist/types/src/fragments/index.d.ts +0 -1
  23. package/dist/types/src/fragments/index.d.ts.map +1 -1
  24. package/dist/types/src/plugins/ThemePlugin.d.ts.map +1 -1
  25. package/dist/types/tsconfig.tsbuildinfo +1 -1
  26. package/package.json +11 -6
  27. package/src/Theme.stories.tsx +3 -1
  28. package/src/css/DESIGN_SYSTEM.md +89 -51
  29. package/src/css/base/base.css +39 -0
  30. package/src/css/components/button.css +21 -16
  31. package/src/css/components/callout.css +140 -0
  32. package/src/css/components/input.css +36 -0
  33. package/src/css/components/state.css +1 -11
  34. package/src/css/components/state.md +1 -1
  35. package/src/css/components/surface.css +165 -58
  36. package/src/css/components/tag.css +13 -1
  37. package/src/css/integrations/codemirror.css +15 -0
  38. package/src/css/layout/main.css +26 -2
  39. package/src/css/layout/native.css +1 -0
  40. package/src/css/theme/roles.css +92 -0
  41. package/src/css/theme/spacing.css +63 -54
  42. package/src/css/theme/surfaces.css +215 -0
  43. package/src/css/theme/text.css +6 -2
  44. package/src/css/utilities.css +13 -9
  45. package/src/defs.ts +0 -25
  46. package/src/fragments/hover.ts +0 -3
  47. package/src/fragments/index.ts +0 -1
  48. package/src/main.css +8 -10
  49. package/src/plugins/ThemePlugin.ts +50 -40
  50. package/src/plugins/main.css +1 -1
  51. package/src/tokens.css +22 -0
  52. package/dist/types/src/fragments/density.d.ts +0 -4
  53. package/dist/types/src/fragments/density.d.ts.map +0 -1
  54. package/src/css/components/panel.css +0 -117
  55. package/src/css/theme/semantic.css +0 -244
  56. package/src/fragments/AUDIT.md +0 -55
  57. package/src/fragments/density.ts +0 -43
@@ -1,244 +0,0 @@
1
- /**
2
- * Tokens
3
- *
4
- * Naming convention: --color-{name}-{part}[-{state}]
5
- * part : surface | fg | border | bg | text
6
- * state : hover | active (optional)
7
- *
8
- * See DESIGN_SYSTEM.md.
9
- */
10
-
11
- @theme {
12
- /*
13
- * Elevation ladder — strictly monotonic, z-order low → high.
14
- * Dark: darker = lower. Light: lighter = higher (inverted toward white).
15
- *
16
- * Level Name Roles
17
- * 0 void deck, scrim base
18
- * 1 base base content, L0 icon rail
19
- * 2 chrome L1/R sidebars, header
20
- * 3 card card
21
- * 4 raised group, input, focus/attention
22
- * 5 bar dialog/modal, toolbar (sticky, drop-shadowed)
23
- * 6 modal popover, menu, toast, tooltip
24
- * 7 float
25
- *
26
- * These are private (--dx-*) knobs — use named surface tokens in components, not these directly.
27
- */
28
- --dx-elevation-0: light-dark(var(--color-neutral-300), var(--color-neutral-950));
29
- --dx-elevation-1: light-dark(var(--color-neutral-300), var(--color-neutral-925));
30
- --dx-elevation-2: light-dark(var(--color-neutral-200), var(--color-neutral-900));
31
- --dx-elevation-3: light-dark(var(--color-neutral-125), var(--color-neutral-875));
32
- --dx-elevation-4: light-dark(var(--color-neutral-125), var(--color-neutral-850));
33
- --dx-elevation-5: light-dark(var(--color-neutral-100), var(--color-neutral-825));
34
- --dx-elevation-6: light-dark(var(--color-neutral-75), var(--color-neutral-800));
35
- --dx-elevation-7: light-dark(var(--color-neutral-50), var(--color-neutral-775));
36
- --dx-elevation-8: light-dark(white, var(--color-neutral-750));
37
-
38
- /**
39
- * Elevation 0
40
- */
41
-
42
- --color-deck-surface: var(--dx-elevation-0);
43
-
44
- /* Translucent dimming layer; tracks the lowest elevation (void) rather than a raw neutral. */
45
- --color-scrim-surface: light-dark(
46
- oklch(from var(--dx-elevation-0) l c h / 0.5),
47
- oklch(from var(--dx-elevation-0) l c h / 0.25)
48
- );
49
-
50
- /**
51
- * Elevation 1
52
- */
53
-
54
- --color-card-surface: var(--dx-elevation-1);
55
-
56
- /**
57
- * Elevation 2
58
- */
59
-
60
- --color-base-surface: var(--dx-elevation-2);
61
- --color-base-fg: light-dark(var(--color-neutral-950), var(--color-neutral-150));
62
-
63
- /* Map attention to focus-surface logic so that elements acting as active attention zones highlight correctly on focus. */
64
- --color-attention-surface: var(--dx-elevation-2);
65
- --color-attention-contains: oklch(from var(--color-accent-bg) l c h / 0.3);
66
-
67
- /**
68
- * Elevation 3
69
- */
70
-
71
- --color-header-surface: var(--dx-elevation-3);
72
-
73
- --color-sidebar-surface: var(--dx-elevation-3);
74
- /* Sidebar body text. Default sits one ramp stop below the current/selected emphasis. */
75
- --color-sidebar-fg: light-dark(var(--color-neutral-700), var(--color-neutral-250));
76
- --color-sidebar-current-fg: light-dark(var(--color-neutral-950), var(--color-neutral-75));
77
-
78
- /* Sidebar / panel layout levels */
79
- --color-l0-surface: var(--dx-elevation-2);
80
- --color-l1-surface: var(--dx-elevation-3);
81
- --color-r0-surface: var(--dx-elevation-3);
82
- --color-r1-surface: var(--dx-elevation-3);
83
-
84
- /**
85
- * Elevation 4
86
- */
87
-
88
- --color-toolbar-surface: var(--dx-elevation-4);
89
-
90
- /**
91
- * Elevation 5
92
- */
93
-
94
- /* Focus — a raised content surface (one level above card) so an attended pane reads as lifted. */
95
- --color-focus-surface: var(--dx-elevation-5);
96
- --color-focus-ring: light-dark(var(--color-blue-400), var(--color-blue-600));
97
- --color-focus-ring-subtle: light-dark(var(--color-neutral-300), var(--color-neutral-600));
98
-
99
- --color-group-surface: var(--dx-elevation-5);
100
- /* Subtle alternate of group-surface for zebra striping (e.g. calendar months) — offset off
101
- * elevation-4 via relative oklch so it tracks the ramp: darker in light mode, lighter in dark. */
102
- --color-group-alt-surface: light-dark(
103
- oklch(from var(--dx-elevation-5) calc(l - 0.03) c h),
104
- oklch(from var(--dx-elevation-5) calc(l + 0.03) c h)
105
- );
106
-
107
- --color-input-surface: var(--dx-elevation-5);
108
-
109
- /**
110
- * Elevation 6
111
- */
112
-
113
- --color-modal-surface: var(--dx-elevation-6);
114
-
115
- /**
116
- * Elevation 7
117
- */
118
-
119
- --color-popover-surface: var(--dx-elevation-7);
120
-
121
- /**
122
- * Elevation 8
123
- */
124
-
125
- /**
126
- * Misc
127
- */
128
-
129
- --color-inverse-surface: light-dark(var(--color-neutral-800), var(--color-neutral-200));
130
- --color-inverse-fg: light-dark(var(--color-neutral-50), var(--color-neutral-950));
131
-
132
- /*
133
- * Text emphasis — foregrounds at decreasing emphasis, anchored on --color-base-fg (strongest):
134
- * base-fg → description → subdued → placeholder (weakest).
135
- * Tuned for legibility against the surfaces rather than mapped to the elevation ladder (which
136
- * governs backgrounds, not text contrast), so these stay explicit neutrals.
137
- */
138
- --color-description: light-dark(var(--color-neutral-600), var(--color-neutral-400));
139
- --color-subdued: light-dark(var(--color-neutral-500), var(--color-neutral-600));
140
- --color-placeholder: light-dark(var(--color-neutral-400), var(--color-neutral-600));
141
-
142
- /*
143
- * Controls — the input/control fill is a deliberate off-ladder token (cf. the grid "paper"
144
- * surfaces). It backs text inputs and the default/ghost button (bg-input-bg) and must contrast
145
- * whatever surface it sits on: a subtle inset well in light mode, a raised fill in dark mode that
146
- * reads lighter than the topmost surface. Do not map it to an elevation level.
147
- */
148
- --color-input-bg: light-dark(var(--color-neutral-250), var(--color-neutral-700));
149
- --color-input-fg: var(--color-base-fg);
150
-
151
- /*
152
- * State surfaces (hover, current, selected) are derived from the host surface (--surface-bg) via
153
- * relative oklch — darker in light mode, lighter in dark — so a highlight stays visible at any
154
- * elevation. The values here resolve against the root --surface-bg (= base-surface, set in
155
- * base.css), giving the correct default for content outside any surface zone. Surface zones
156
- * publish their own --surface-bg and re-derive these tokens in surface.css, which is where the
157
- * substitution re-runs for that subtree.
158
- *
159
- * Offset magnitudes (lightness): hover ∓0.08, subtle ∓0.02, current ∓0.10, current-hover ∓0.12.
160
- * Keep these in sync with the per-zone re-derivation in components/surface.css.
161
- */
162
- --color-hover-surface: light-dark(
163
- oklch(from var(--surface-bg, var(--color-base-surface)) calc(l - 0.08) c h),
164
- oklch(from var(--surface-bg, var(--color-base-surface)) calc(l + 0.08) c h)
165
- );
166
- --color-hover-fg: light-dark(var(--color-neutral-950), var(--color-neutral-150));
167
-
168
- /*
169
- * Subtle region hover for large highlight targets (list rows, tiles) where the full
170
- * control-strength hover reads as too heavy. Consumed by `.dx-hover` / `.dx-hover-row`;
171
- * controls (buttons) keep --color-hover-surface.
172
- */
173
- --color-hover-surface-subtle: light-dark(
174
- oklch(from var(--surface-bg, var(--color-base-surface)) calc(l - 0.02) c h),
175
- oklch(from var(--surface-bg, var(--color-base-surface)) calc(l + 0.02) c h)
176
- );
177
-
178
- /* current (aria-current) */
179
- --color-current-surface: light-dark(
180
- oklch(from var(--surface-bg, var(--color-base-surface)) calc(l - 0.1) c h),
181
- oklch(from var(--surface-bg, var(--color-base-surface)) calc(l + 0.1) c h)
182
- );
183
- --color-current-surface-hover: light-dark(
184
- oklch(from var(--surface-bg, var(--color-base-surface)) calc(l - 0.12) c h),
185
- oklch(from var(--surface-bg, var(--color-base-surface)) calc(l + 0.12) c h)
186
- );
187
- --color-current-fg: light-dark(var(--color-neutral-950), var(--color-neutral-50));
188
-
189
- /* selected (aria-selected) tracks current */
190
- --color-selected-surface: var(--color-current-surface);
191
- --color-selected-surface-hover: var(--color-current-surface-hover);
192
- --color-selected-fg: var(--color-current-fg);
193
-
194
- /* Accent (primary) */
195
- --color-accent-bg: light-dark(var(--color-blue-600), var(--color-blue-700));
196
- --color-accent-bg-hover: light-dark(var(--color-blue-700), var(--color-blue-800));
197
- --color-accent-fg: var(--color-blue-100);
198
- --color-accent-text: light-dark(var(--color-blue-600), var(--color-blue-400));
199
- --color-accent-text-hover: light-dark(var(--color-blue-500), var(--color-blue-500));
200
-
201
- /* Unaccented */
202
- --color-un-accent: var(--color-neutral-400);
203
- --color-un-accent-hover: var(--color-neutral-500);
204
-
205
- /* Separator */
206
- --color-primary-separator: light-dark(var(--color-neutral-200), var(--color-neutral-800));
207
- --color-separator: light-dark(var(--color-neutral-200), var(--color-neutral-700));
208
- --color-input-separator: light-dark(var(--color-neutral-250), var(--color-neutral-750));
209
- --color-subdued-separator: light-dark(var(--color-neutral-250), var(--color-neutral-775));
210
- --color-active-separator: light-dark(var(--color-blue-500), var(--color-blue-500));
211
-
212
- /* Scrollbar */
213
- --color-scrollbar-track: light-dark(var(--color-neutral-50), var(--color-neutral-950));
214
- --color-scrollbar-thumb: light-dark(var(--color-neutral-200), var(--color-neutral-600));
215
- --color-scrollbar-thumb-active: light-dark(var(--color-neutral-200), var(--color-neutral-600));
216
- --color-scrollbar-thumb-hover: light-dark(var(--color-neutral-200), var(--color-neutral-600));
217
-
218
- /*
219
- * Sheet / Grid — intentionally OFF the elevation ladder.
220
- * NOTE: Update main.css when changing grid tokens (and restart dev server).
221
- *
222
- * These are "paper" surfaces for the data grid: maximum-contrast canvases (near-white in light,
223
- * near-black in dark) plus saturated selection/comment accents. The elevation ladder is
224
- * monotonic (light: lighter = higher), so it cannot express a surface that is simultaneously the
225
- * lightest in light mode and the darkest in dark mode. Keep these as explicit neutrals/accents;
226
- * do not fold them into --dx-elevation-*.
227
- */
228
- --color-axis-surface: light-dark(var(--color-neutral-100), var(--color-neutral-900));
229
- --color-axis-text: light-dark(var(--color-neutral-700), var(--color-neutral-300));
230
- --color-axis-selected-surface: light-dark(var(--color-neutral-100), var(--color-neutral-900));
231
- --color-axis-selected-text: light-dark(var(--color-neutral-100), var(--color-neutral-900));
232
-
233
- --color-grid-surface: light-dark(var(--color-neutral-50), var(--color-neutral-950));
234
- --color-grid-fg: light-dark(var(--color-neutral-950), var(--color-neutral-50));
235
- --color-grid-line: light-dark(var(--color-neutral-200), var(--color-neutral-800));
236
- --color-grid-highlight: oklch(from var(--color-emerald-500) l c h / 0.5);
237
- --color-grid-selection-surface: light-dark(var(--color-blue-500), var(--color-blue-400));
238
- --color-grid-selection-fg: light-dark(var(--color-neutral-50), var(--color-neutral-950));
239
- --color-grid-comment: light-dark(var(--color-green-400), var(--color-green-600));
240
- --color-grid-comment-active: light-dark(
241
- oklch(from var(--color-green-400) l c h / 0.5),
242
- oklch(from var(--color-green-600) l c h / 0.5)
243
- );
244
- }
@@ -1,55 +0,0 @@
1
- # Fragment Definitions Audit
2
-
3
- External packages importing fragment definitions from `ui-theme/src/fragments`.
4
-
5
- ## Current Fragment Exports
6
-
7
- | File | Definition | External | Internal |
8
- | ------------- | ------------------------------------- | -------- | -------- |
9
- | `density.ts` | `densityBlockSize` | - | 1 |
10
- | `density.ts` | `coarseBlockSize` | - | 1 |
11
- | `density.ts` | `coarseDimensions` | - | 1 |
12
- | `density.ts` | `fineBlockSize` | - | 1 |
13
- | `density.ts` | `fineDimensions` | - | 1 |
14
- | `disabled.ts` | `staticDisabled` | - | 1 |
15
- | `disabled.ts` | `dataDisabled` | - | 1 |
16
- | `focus.ts` | `focusRing` | 2 | 5 |
17
- | `focus.ts` | `subduedFocus` | - | 2 |
18
- | `focus.ts` | `staticFocusRing` | - | 1 |
19
- | `hover.ts` | `ghostHover` | 8 | 2 |
20
- | `hover.ts` | `ghostFocusWithin` | 1 | - |
21
- | `hover.ts` | `hoverableControls` | 9 | - |
22
- | `hover.ts` | `groupHoverControlItemWithTransition` | 2 | - |
23
- | `hover.ts` | `hoverableFocusedKeyboardControls` | 1 | - |
24
- | `hover.ts` | `hoverableFocusedWithinControls` | 9 | - |
25
- | `hover.ts` | `hoverableOpenControlItem` | 3 | - |
26
- | `hover.ts` | `hoverableControlItem` | 7 | - |
27
- | `text.ts` | `descriptionTextPrimary` | 1 | - |
28
- | `text.ts` | `descriptionMessage` | 5 | - |
29
-
30
- ## Summary
31
-
32
- **Total fragments:** 21
33
- **Total imports (external + internal):** 96
34
-
35
- - **External:** 63
36
- - **Internal:** 33
37
-
38
- **Most imported overall:**
39
-
40
- - `hoverableControls` (9 external)
41
- - `hoverableFocusedWithinControls` (9 external)
42
- - `ghostHover` (8 external + 2 internal = 10 total)
43
- - `hoverableControlItem` (7 external)
44
- - `focusRing` (2 external + 5 internal = 7 total)
45
-
46
- **Internal imports by file:**
47
-
48
- - `input.ts`: 8 definitions (coarseBlockSize, coarseDimensions, fineBlockSize, fineDimensions, focusRing, staticDisabled, staticFocusRing, subduedFocus)
49
- - `list.ts`: 3 definitions (densityBlockSize, focusRing, ghostHover)
50
- - `menu.ts`: 2 definitions (dataDisabled, subduedFocus)
51
- - `button.ts`, `link.ts`, `popover.ts`, `toast.ts`: 1 definition each (ghostHover, focusRing, focusRing, focusRing)
52
-
53
- **Completely unused:** 7 fragments
54
-
55
- - `hoverableOpenControlItem`, `groupHoverControlItemWithTransition` from `hover.ts` (only 2-3 uses)
@@ -1,43 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import { type Density } from '@dxos/ui-types';
6
-
7
- const lgBlockSize = 'min-h-[2.5rem]';
8
- const mdBlockSize = 'min-h-[2.5rem] pointer-fine:min-h-[2rem]';
9
- const smBlockSize = 'min-h-[1.75rem]';
10
- const xsBlockSize = 'min-h-[1.5rem]';
11
-
12
- const lgDimensions = `${lgBlockSize} px-3`;
13
- const mdDimensions = `${mdBlockSize} px-2`;
14
- const smDimensions = `${smBlockSize} px-1.5`;
15
- const xsDimensions = `${xsBlockSize} px-1`;
16
-
17
- export const densityDimensions = (density: Density = 'md') => {
18
- switch (density) {
19
- case 'lg':
20
- return lgDimensions;
21
- case 'sm':
22
- return smDimensions;
23
- case 'xs':
24
- return xsDimensions;
25
- case 'md':
26
- default:
27
- return mdDimensions;
28
- }
29
- };
30
-
31
- export const densityBlockSize = (density: Density = 'md') => {
32
- switch (density) {
33
- case 'lg':
34
- return lgBlockSize;
35
- case 'sm':
36
- return smBlockSize;
37
- case 'xs':
38
- return xsBlockSize;
39
- case 'md':
40
- default:
41
- return mdBlockSize;
42
- }
43
- };