@dxos/ui-theme 0.8.4-staging.ac66bdf99f → 0.9.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 (169) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +1 -1
  3. package/dist/lib/browser/index.mjs +89 -867
  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 +89 -867
  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/main.css +252 -119
  10. package/dist/plugin/node-cjs/main.css.map +3 -3
  11. package/dist/plugin/node-cjs/meta.json +1 -1
  12. package/dist/plugin/node-cjs/plugins/ThemePlugin.cjs +82 -10
  13. package/dist/plugin/node-cjs/plugins/ThemePlugin.cjs.map +3 -3
  14. package/dist/plugin/node-esm/main.css +252 -119
  15. package/dist/plugin/node-esm/main.css.map +3 -3
  16. package/dist/plugin/node-esm/meta.json +1 -1
  17. package/dist/plugin/node-esm/plugins/ThemePlugin.mjs +84 -12
  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 +2 -2
  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/index.d.ts +0 -1
  27. package/dist/types/src/index.d.ts.map +1 -1
  28. package/dist/types/src/plugins/ThemePlugin.d.ts +3 -2
  29. package/dist/types/src/plugins/ThemePlugin.d.ts.map +1 -1
  30. package/dist/types/src/util/hash-styles.d.ts +12 -2
  31. package/dist/types/src/util/hash-styles.d.ts.map +1 -1
  32. package/dist/types/src/util/mx.d.ts +0 -36
  33. package/dist/types/src/util/mx.d.ts.map +1 -1
  34. package/dist/types/src/util/size.d.ts.map +1 -1
  35. package/dist/types/src/util/valence.d.ts +8 -2
  36. package/dist/types/src/util/valence.d.ts.map +1 -1
  37. package/dist/types/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +14 -21
  39. package/src/Theme.stories.tsx +94 -27
  40. package/src/css/DESIGN_SYSTEM.md +187 -0
  41. package/src/css/base/base.css +2 -2
  42. package/src/css/components/button.css +63 -13
  43. package/src/css/components/card.css +14 -0
  44. package/src/css/components/checkbox.css +3 -3
  45. package/src/css/components/focus.css +12 -12
  46. package/src/css/components/link.css +4 -1
  47. package/src/css/components/panel.css +45 -45
  48. package/src/css/components/state.css +99 -0
  49. package/src/css/components/state.md +101 -0
  50. package/src/css/components/surface.css +33 -11
  51. package/src/css/components/tag.css +25 -24
  52. package/src/css/integrations/codemirror.css +4 -3
  53. package/src/css/integrations/tldraw.css +1 -1
  54. package/src/css/layout/main.css +6 -0
  55. package/src/css/layout/size.css +16 -3
  56. package/src/css/theme/animation.css +31 -0
  57. package/src/css/theme/palette.css +34 -0
  58. package/src/css/theme/semantic.css +101 -60
  59. package/src/css/theme/spacing.css +29 -12
  60. package/src/css/theme/styles.css +172 -119
  61. package/src/css/utilities.css +42 -0
  62. package/src/defs.ts +3 -1
  63. package/src/fragments/AUDIT.md +0 -2
  64. package/src/fragments/density.ts +34 -7
  65. package/src/fragments/hover.ts +0 -2
  66. package/src/index.ts +1 -1
  67. package/src/main.css +68 -9
  68. package/src/plugins/ThemePlugin.ts +102 -14
  69. package/src/plugins/main.css +10 -7
  70. package/src/util/hash-styles.ts +54 -42
  71. package/src/util/mx.ts +1 -126
  72. package/src/util/valence.ts +15 -5
  73. package/dist/types/src/theme/components/avatar.d.ts +0 -21
  74. package/dist/types/src/theme/components/avatar.d.ts.map +0 -1
  75. package/dist/types/src/theme/components/breadcrumb.d.ts +0 -9
  76. package/dist/types/src/theme/components/breadcrumb.d.ts.map +0 -1
  77. package/dist/types/src/theme/components/button.d.ts +0 -15
  78. package/dist/types/src/theme/components/button.d.ts.map +0 -1
  79. package/dist/types/src/theme/components/card.d.ts +0 -12
  80. package/dist/types/src/theme/components/card.d.ts.map +0 -1
  81. package/dist/types/src/theme/components/dialog.d.ts +0 -17
  82. package/dist/types/src/theme/components/dialog.d.ts.map +0 -1
  83. package/dist/types/src/theme/components/focus.d.ts +0 -6
  84. package/dist/types/src/theme/components/focus.d.ts.map +0 -1
  85. package/dist/types/src/theme/components/icon-button.d.ts +0 -8
  86. package/dist/types/src/theme/components/icon-button.d.ts.map +0 -1
  87. package/dist/types/src/theme/components/icon.d.ts +0 -10
  88. package/dist/types/src/theme/components/icon.d.ts.map +0 -1
  89. package/dist/types/src/theme/components/index.d.ts +0 -27
  90. package/dist/types/src/theme/components/index.d.ts.map +0 -1
  91. package/dist/types/src/theme/components/input.d.ts +0 -115
  92. package/dist/types/src/theme/components/input.d.ts.map +0 -1
  93. package/dist/types/src/theme/components/link.d.ts +0 -7
  94. package/dist/types/src/theme/components/link.d.ts.map +0 -1
  95. package/dist/types/src/theme/components/list.d.ts +0 -14
  96. package/dist/types/src/theme/components/list.d.ts.map +0 -1
  97. package/dist/types/src/theme/components/main.d.ts +0 -28
  98. package/dist/types/src/theme/components/main.d.ts.map +0 -1
  99. package/dist/types/src/theme/components/menu.d.ts +0 -13
  100. package/dist/types/src/theme/components/menu.d.ts.map +0 -1
  101. package/dist/types/src/theme/components/message.d.ts +0 -12
  102. package/dist/types/src/theme/components/message.d.ts.map +0 -1
  103. package/dist/types/src/theme/components/popover.d.ts +0 -11
  104. package/dist/types/src/theme/components/popover.d.ts.map +0 -1
  105. package/dist/types/src/theme/components/scroll-area.d.ts +0 -32
  106. package/dist/types/src/theme/components/scroll-area.d.ts.map +0 -1
  107. package/dist/types/src/theme/components/select.d.ts +0 -13
  108. package/dist/types/src/theme/components/select.d.ts.map +0 -1
  109. package/dist/types/src/theme/components/separator.d.ts +0 -8
  110. package/dist/types/src/theme/components/separator.d.ts.map +0 -1
  111. package/dist/types/src/theme/components/skeleton.d.ts +0 -7
  112. package/dist/types/src/theme/components/skeleton.d.ts.map +0 -1
  113. package/dist/types/src/theme/components/splitter.d.ts +0 -4
  114. package/dist/types/src/theme/components/splitter.d.ts.map +0 -1
  115. package/dist/types/src/theme/components/status.d.ts +0 -9
  116. package/dist/types/src/theme/components/status.d.ts.map +0 -1
  117. package/dist/types/src/theme/components/tag.d.ts +0 -7
  118. package/dist/types/src/theme/components/tag.d.ts.map +0 -1
  119. package/dist/types/src/theme/components/toast.d.ts +0 -12
  120. package/dist/types/src/theme/components/toast.d.ts.map +0 -1
  121. package/dist/types/src/theme/components/toolbar.d.ts +0 -11
  122. package/dist/types/src/theme/components/toolbar.d.ts.map +0 -1
  123. package/dist/types/src/theme/components/tooltip.d.ts +0 -8
  124. package/dist/types/src/theme/components/tooltip.d.ts.map +0 -1
  125. package/dist/types/src/theme/components/treegrid.d.ts +0 -10
  126. package/dist/types/src/theme/components/treegrid.d.ts.map +0 -1
  127. package/dist/types/src/theme/index.d.ts +0 -4
  128. package/dist/types/src/theme/index.d.ts.map +0 -1
  129. package/dist/types/src/theme/primitives/column.d.ts +0 -29
  130. package/dist/types/src/theme/primitives/column.d.ts.map +0 -1
  131. package/dist/types/src/theme/primitives/index.d.ts +0 -3
  132. package/dist/types/src/theme/primitives/index.d.ts.map +0 -1
  133. package/dist/types/src/theme/primitives/panel.d.ts +0 -13
  134. package/dist/types/src/theme/primitives/panel.d.ts.map +0 -1
  135. package/dist/types/src/theme/theme.d.ts +0 -5
  136. package/dist/types/src/theme/theme.d.ts.map +0 -1
  137. package/src/css/components/selected.css +0 -30
  138. package/src/theme/components/avatar.ts +0 -95
  139. package/src/theme/components/breadcrumb.ts +0 -29
  140. package/src/theme/components/button.ts +0 -48
  141. package/src/theme/components/card.ts +0 -102
  142. package/src/theme/components/dialog.ts +0 -61
  143. package/src/theme/components/focus.ts +0 -33
  144. package/src/theme/components/icon-button.ts +0 -18
  145. package/src/theme/components/icon.ts +0 -28
  146. package/src/theme/components/index.ts +0 -30
  147. package/src/theme/components/input.ts +0 -171
  148. package/src/theme/components/link.ts +0 -25
  149. package/src/theme/components/list.ts +0 -46
  150. package/src/theme/components/main.ts +0 -34
  151. package/src/theme/components/menu.ts +0 -50
  152. package/src/theme/components/message.ts +0 -40
  153. package/src/theme/components/popover.ts +0 -41
  154. package/src/theme/components/scroll-area.ts +0 -115
  155. package/src/theme/components/select.ts +0 -52
  156. package/src/theme/components/separator.ts +0 -24
  157. package/src/theme/components/skeleton.ts +0 -23
  158. package/src/theme/components/splitter.ts +0 -20
  159. package/src/theme/components/status.ts +0 -32
  160. package/src/theme/components/tag.ts +0 -23
  161. package/src/theme/components/toast.ts +0 -53
  162. package/src/theme/components/toolbar.ts +0 -35
  163. package/src/theme/components/tooltip.ts +0 -27
  164. package/src/theme/components/treegrid.ts +0 -37
  165. package/src/theme/index.ts +0 -7
  166. package/src/theme/primitives/column.ts +0 -71
  167. package/src/theme/primitives/index.ts +0 -6
  168. package/src/theme/primitives/panel.ts +0 -43
  169. package/src/theme/theme.ts +0 -87
@@ -1,37 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import type { ComponentFunction, Theme } from '@dxos/ui-types';
6
-
7
- import { mx } from '../../util';
8
-
9
- export type TreegridStyleProps = Partial<{
10
- level: number;
11
- indent: boolean;
12
- }>;
13
-
14
- const levelStyles = new Map<number, string>([
15
- [1, '[&>.indent:first-of-type]:pl-0 font-medium'],
16
- [2, '[&>.indent:first-of-type]:pl-0'],
17
- [3, '[&>.indent:first-of-type]:pl-1'],
18
- [4, '[&>.indent:first-of-type]:pl-2'],
19
- [5, '[&>.indent:first-of-type]:pl-3'],
20
- [6, '[&>.indent:first-of-type]:pl-4'],
21
- [7, '[&>.indent:first-of-type]:pl-5'],
22
- [8, '[&>.indent:first-of-type]:pl-6'],
23
- ]);
24
-
25
- export const treegridRoot: ComponentFunction<TreegridStyleProps> = (_, ...etc) => mx('grid', ...etc);
26
-
27
- export const treegridRow: ComponentFunction<TreegridStyleProps> = ({ level = 1 }, ...etc) =>
28
- mx(levelStyles.get(Math.min(Math.max(Math.round(level), 1), 8)), ...etc);
29
-
30
- export const treegridCell: ComponentFunction<TreegridStyleProps> = ({ indent }, ...etc) =>
31
- mx(indent && 'indent', ...etc);
32
-
33
- export const treegridTheme: Theme<TreegridStyleProps> = {
34
- root: treegridRoot,
35
- row: treegridRow,
36
- cell: treegridCell,
37
- };
@@ -1,7 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- export * from './components';
6
- export * from './primitives';
7
- export * from './theme';
@@ -1,71 +0,0 @@
1
- //
2
- // Copyright 2026 DXOS.org
3
- //
4
-
5
- import { type ComponentFunction } from '@dxos/ui-types';
6
-
7
- import { mx } from '../../util';
8
-
9
- /**
10
- * Column-aware theme utilities.
11
- * Components apply these in their theme functions to participate in the Column grid
12
- * without importing Column React components.
13
- *
14
- * CSS custom property cascade:
15
- * - Column.Root sets `--dx-col: 2 / span 1` (center column placement).
16
- * - ScrollArea.Viewport resets `--dx-col: auto` after consuming `--gutter`.
17
- * - Components apply `grid-column: var(--dx-col, auto)` to auto-center in Column
18
- * or do nothing outside Column / inside ScrollArea.
19
- */
20
- export const withColumn = {
21
- /** Centers element in the Column grid via --dx-col. No-op outside Column or inside ScrollArea. */
22
- center: () => '[grid-column:var(--dx-col,auto)]',
23
-
24
- /** Propagates the Column grid to children via subgrid. No-op outside Column.
25
- * Direct children default to center column unless they are a dx-container (ScrollArea). */
26
- propagate: () =>
27
- '[.dx-column-root_&]:col-span-full [.dx-column-root_&]:grid [.dx-column-root_&]:grid-cols-subgrid [.dx-column-root_&]:[&>*:not(.dx-container)]:[grid-column:var(--dx-col,auto)]',
28
-
29
- /** Resets --dx-col after consuming --gutter. Applied by ScrollArea.Viewport. */
30
- consumed: () => '[--dx-col:auto]',
31
- };
32
-
33
- export type ColumnStyleProps = {};
34
-
35
- const columnRoot: ComponentFunction<ColumnStyleProps> = (_, ...etc) => {
36
- return mx('dx-column-root grid', ...etc);
37
- };
38
-
39
- /**
40
- * Three-column icon-slot row: spans all 3 columns of the parent Column.Root grid.
41
- * Uses CSS subgrid to inherit column sizing from the parent Column.
42
- * Children map to: [col-1: icon/slot] [col-2: content] [col-3: icon/action].
43
- * NOTE: Must not use overflow-hidden here since it will clip input focus rings.
44
- */
45
- const columnRow: ComponentFunction<ColumnStyleProps> = (_, ...etc) => {
46
- return mx('col-span-3 grid grid-cols-subgrid', ...etc);
47
- };
48
-
49
- /**
50
- * Bleed placement: spans all 3 columns of the parent Column.Root grid (gutter-to-gutter).
51
- * Use for `ScrollArea`, full-width dividers, tables, or any content that should ignore gutters.
52
- */
53
- const columnBleed: ComponentFunction<ColumnStyleProps> = (_, ...etc) => {
54
- return mx('col-span-full grid grid-cols-subgrid min-h-0', ...etc);
55
- };
56
-
57
- /**
58
- * Center placement: places the element in column 2 (the central track between gutters) of the
59
- * parent Column.Root grid. Does NOT use subgrid — placement is explicit on this element only.
60
- * Safe to nest arbitrary compound components (including those that render `display: contents`).
61
- */
62
- const columnCenter: ComponentFunction<ColumnStyleProps> = (_, ...etc) => {
63
- return mx(withColumn.center(), 'min-h-0', ...etc);
64
- };
65
-
66
- export const columnTheme = {
67
- root: columnRoot,
68
- row: columnRow,
69
- bleed: columnBleed,
70
- center: columnCenter,
71
- };
@@ -1,6 +0,0 @@
1
- //
2
- // Copyright 2026 DXOS.org
3
- //
4
-
5
- export * from './column';
6
- export * from './panel';
@@ -1,43 +0,0 @@
1
- //
2
- // Copyright 2026 DXOS.org
3
- //
4
-
5
- import { type ComponentFunction } from '@dxos/ui-types';
6
-
7
- import { mx } from '../../util';
8
-
9
- type Size = 'lg' | 'md' | 'sm';
10
-
11
- export type PanelStyleProps = {
12
- size?: Size;
13
- };
14
-
15
- const sizes: Record<Size, string> = {
16
- lg: 'h-(--dx-topbar-size)',
17
- md: 'h-(--dx-toolbar-size)',
18
- sm: 'h-(--dx-statusbar-size)',
19
- };
20
-
21
- const panelRoot: ComponentFunction<PanelStyleProps> = (_, ...etc) =>
22
- mx(
23
- // prettier-ignore
24
- 'dx-container grid grid-cols-[100%] overflow-hidden',
25
- // Add uncategorized children to content slot.
26
- '[&>*:not([data-slot])]:[grid-area:content]',
27
- ...etc,
28
- );
29
-
30
- const panelToolbar: ComponentFunction<PanelStyleProps> = ({ size = 'md' }, ...etc) =>
31
- mx('[grid-area:toolbar]', 'shrink-0', sizes[size], ...etc);
32
-
33
- const panelContent: ComponentFunction<PanelStyleProps> = (_, ...etc) => mx('[grid-area:content] min-h-0', ...etc);
34
-
35
- const panelStatusbar: ComponentFunction<PanelStyleProps> = ({ size = 'md' }, ...etc) =>
36
- mx('[grid-area:statusbar]', 'shrink-0', sizes[size], ...etc);
37
-
38
- export const panelTheme = {
39
- root: panelRoot,
40
- toolbar: panelToolbar,
41
- content: panelContent,
42
- statusbar: panelStatusbar,
43
- };
@@ -1,87 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import { type ClassNameArray, type ComponentFunction, type Theme, type ThemeFunction } from '@dxos/ui-types';
6
- import { getDeep } from '@dxos/util';
7
-
8
- import {
9
- avatarTheme,
10
- breadcrumbTheme,
11
- buttonTheme,
12
- cardTheme,
13
- dialogTheme,
14
- focusTheme,
15
- iconButtonTheme,
16
- iconTheme,
17
- inputTheme,
18
- linkTheme,
19
- listTheme,
20
- mainTheme,
21
- menuTheme,
22
- messageTheme,
23
- popoverTheme,
24
- scrollAreaTheme,
25
- selectTheme,
26
- separatorTheme,
27
- skeletonTheme,
28
- splitterTheme,
29
- statusTheme,
30
- tagTheme,
31
- toastTheme,
32
- toolbarTheme,
33
- tooltipTheme,
34
- treegridTheme,
35
- } from './components';
36
- import { columnTheme, panelTheme } from './primitives';
37
-
38
- export const defaultTheme: Theme<Record<string, any>> = {
39
- themeName: () => 'default',
40
-
41
- //
42
- // Primitives
43
- //
44
-
45
- column: columnTheme,
46
- panel: panelTheme,
47
-
48
- //
49
- // Components
50
- //
51
-
52
- avatar: avatarTheme,
53
- breadcrumb: breadcrumbTheme,
54
- button: buttonTheme,
55
- card: cardTheme,
56
- dialog: dialogTheme,
57
- focus: focusTheme,
58
- icon: iconTheme,
59
- iconButton: iconButtonTheme,
60
- input: inputTheme,
61
- link: linkTheme,
62
- list: listTheme,
63
- main: mainTheme,
64
- message: messageTheme,
65
- menu: menuTheme,
66
- popover: popoverTheme,
67
- scrollArea: scrollAreaTheme,
68
- select: selectTheme,
69
- separator: separatorTheme,
70
- skeleton: skeletonTheme,
71
- splitter: splitterTheme,
72
- status: statusTheme,
73
- tag: tagTheme,
74
- toast: toastTheme,
75
- toolbar: toolbarTheme,
76
- tooltip: tooltipTheme,
77
- treegrid: treegridTheme,
78
- };
79
-
80
- export const bindTheme = <P extends Record<string, any>>(theme: Theme<Record<string, any>>): ThemeFunction<P> => {
81
- return (path: string, styleProps?: P, ...etc: ClassNameArray) => {
82
- const result = getDeep<Theme<P> | ComponentFunction<P>>(theme, path.split('.'));
83
- return typeof result === 'function' ? result(styleProps ?? ({} as P), ...etc) : undefined;
84
- };
85
- };
86
-
87
- export const defaultTx = bindTheme(defaultTheme);