@dxos/ui-theme 0.8.4-main.9be5663bfe → 0.8.4-main.bc2380dfbc
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.
- package/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/browser/index.mjs +88 -84
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +88 -84
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/plugin/node-cjs/main.css +147 -106
- package/dist/plugin/node-cjs/main.css.map +2 -2
- package/dist/plugin/node-cjs/meta.json +1 -1
- package/dist/plugin/node-esm/main.css +147 -106
- package/dist/plugin/node-esm/main.css.map +2 -2
- package/dist/plugin/node-esm/meta.json +1 -1
- package/dist/plugin/node-esm/plugins/ThemePlugin.mjs.map +2 -2
- package/dist/types/src/Theme.stories.d.ts.map +1 -1
- package/dist/types/src/defs.d.ts +1 -1
- package/dist/types/src/defs.d.ts.map +1 -1
- package/dist/types/src/fragments/density.d.ts +1 -4
- package/dist/types/src/fragments/density.d.ts.map +1 -1
- package/dist/types/src/fragments/hover.d.ts +0 -1
- package/dist/types/src/fragments/hover.d.ts.map +1 -1
- package/dist/types/src/fragments/text.d.ts +0 -1
- package/dist/types/src/fragments/text.d.ts.map +1 -1
- package/dist/types/src/plugins/ThemePlugin.d.ts +1 -1
- package/dist/types/src/plugins/ThemePlugin.d.ts.map +1 -1
- package/dist/types/src/theme/components/button.d.ts +2 -2
- package/dist/types/src/theme/components/button.d.ts.map +1 -1
- package/dist/types/src/theme/components/card.d.ts.map +1 -1
- package/dist/types/src/theme/components/dialog.d.ts.map +1 -1
- package/dist/types/src/theme/components/icon-button.d.ts +1 -0
- package/dist/types/src/theme/components/icon-button.d.ts.map +1 -1
- package/dist/types/src/theme/components/input.d.ts +8 -8
- package/dist/types/src/theme/components/input.d.ts.map +1 -1
- package/dist/types/src/theme/components/main.d.ts.map +1 -1
- package/dist/types/src/theme/components/scroll-area.d.ts.map +1 -1
- package/dist/types/src/theme/primitives/column.d.ts +22 -5
- package/dist/types/src/theme/primitives/column.d.ts.map +1 -1
- package/dist/types/src/theme/primitives/panel.d.ts.map +1 -1
- package/dist/types/src/theme/theme.d.ts.map +1 -1
- package/dist/types/src/util/hash-styles.d.ts +1 -1
- package/dist/types/src/util/hash-styles.d.ts.map +1 -1
- package/dist/types/src/util/mx.d.ts +21 -1
- package/dist/types/src/util/mx.d.ts.map +1 -1
- package/dist/types/src/util/size.d.ts.map +1 -1
- package/dist/types/src/util/valence.d.ts +2 -2
- package/dist/types/src/util/valence.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -19
- package/src/Theme.stories.tsx +5 -5
- package/src/css/DESIGN_SYSTEM.md +159 -0
- package/src/css/base/base.css +2 -2
- package/src/css/components/button.css +3 -3
- package/src/css/components/checkbox.css +1 -1
- package/src/css/components/focus.css +12 -12
- package/src/css/components/panel.css +45 -45
- package/src/css/components/selected.css +61 -15
- package/src/css/components/selected.md +101 -0
- package/src/css/components/surface.css +4 -4
- package/src/css/components/tag.css +25 -23
- package/src/css/layout/size.css +16 -3
- package/src/css/theme/animation.css +31 -0
- package/src/css/theme/semantic.css +36 -40
- package/src/css/theme/spacing.css +7 -8
- package/src/css/theme/styles.css +22 -22
- package/src/css/utilities.css +48 -6
- package/src/defs.ts +1 -1
- package/src/fragments/AUDIT.md +0 -3
- package/src/fragments/density.ts +8 -5
- package/src/fragments/hover.ts +0 -2
- package/src/fragments/text.ts +1 -1
- package/src/main.css +38 -4
- package/src/theme/components/button.ts +2 -2
- package/src/theme/components/card.ts +4 -0
- package/src/theme/components/dialog.ts +5 -3
- package/src/theme/components/focus.ts +2 -2
- package/src/theme/components/icon-button.ts +6 -3
- package/src/theme/components/input.ts +9 -9
- package/src/theme/components/message.ts +5 -5
- package/src/theme/components/popover.ts +1 -1
- package/src/theme/components/scroll-area.ts +10 -5
- package/src/theme/components/select.ts +1 -1
- package/src/theme/components/tooltip.ts +1 -1
- package/src/theme/primitives/column.ts +44 -20
- package/src/util/hash-styles.ts +19 -19
- package/src/util/mx.ts +3 -3
|
@@ -6,42 +6,66 @@ import { type ComponentFunction } from '@dxos/ui-types';
|
|
|
6
6
|
|
|
7
7
|
import { mx } from '../../util';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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]',
|
|
12
31
|
};
|
|
13
32
|
|
|
33
|
+
export type ColumnStyleProps = {};
|
|
34
|
+
|
|
14
35
|
const columnRoot: ComponentFunction<ColumnStyleProps> = (_, ...etc) => {
|
|
15
|
-
return mx('dx-column grid', ...etc);
|
|
36
|
+
return mx('dx-column-root grid', ...etc);
|
|
16
37
|
};
|
|
17
38
|
|
|
18
39
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
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.
|
|
23
44
|
*/
|
|
24
|
-
const
|
|
25
|
-
return mx('col-span-
|
|
45
|
+
const columnRow: ComponentFunction<ColumnStyleProps> = (_, ...etc) => {
|
|
46
|
+
return mx('col-span-3 grid grid-cols-subgrid', ...etc);
|
|
26
47
|
};
|
|
27
48
|
|
|
28
|
-
|
|
29
|
-
|
|
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);
|
|
30
55
|
};
|
|
31
56
|
|
|
32
57
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* NOTE: Must not use overflow-hidden here since it will clip input focus rings.
|
|
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`).
|
|
37
61
|
*/
|
|
38
|
-
const
|
|
39
|
-
return mx(
|
|
62
|
+
const columnCenter: ComponentFunction<ColumnStyleProps> = (_, ...etc) => {
|
|
63
|
+
return mx(withColumn.center(), 'min-h-0', ...etc);
|
|
40
64
|
};
|
|
41
65
|
|
|
42
66
|
export const columnTheme = {
|
|
43
67
|
root: columnRoot,
|
|
44
|
-
content: columnContent,
|
|
45
|
-
viewport: columnViewport,
|
|
46
68
|
row: columnRow,
|
|
69
|
+
bleed: columnBleed,
|
|
70
|
+
center: columnCenter,
|
|
47
71
|
};
|
package/src/util/hash-styles.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type ColorStyles = {
|
|
|
11
11
|
hue: Hue;
|
|
12
12
|
fill: string; // -fill
|
|
13
13
|
surface: string; // -surface
|
|
14
|
-
|
|
14
|
+
foreground: string; // -foreground
|
|
15
15
|
text: string; // -text
|
|
16
16
|
border: string; // -border
|
|
17
17
|
};
|
|
@@ -20,7 +20,7 @@ const neutral: ColorStyles = {
|
|
|
20
20
|
hue: 'neutral',
|
|
21
21
|
fill: 'bg-neutral-fill',
|
|
22
22
|
surface: 'bg-neutral-surface',
|
|
23
|
-
|
|
23
|
+
foreground: 'text-neutral-foreground',
|
|
24
24
|
text: 'text-neutral-text',
|
|
25
25
|
border: 'border-neutral-border',
|
|
26
26
|
};
|
|
@@ -32,7 +32,7 @@ const styles: ColorStyles[] = [
|
|
|
32
32
|
hue: 'red',
|
|
33
33
|
fill: 'bg-red-fill',
|
|
34
34
|
surface: 'bg-red-surface',
|
|
35
|
-
|
|
35
|
+
foreground: 'text-red-foreground',
|
|
36
36
|
text: 'text-red-text',
|
|
37
37
|
border: 'border-red-border',
|
|
38
38
|
},
|
|
@@ -40,7 +40,7 @@ const styles: ColorStyles[] = [
|
|
|
40
40
|
hue: 'orange',
|
|
41
41
|
fill: 'bg-orange-fill',
|
|
42
42
|
surface: 'bg-orange-surface',
|
|
43
|
-
|
|
43
|
+
foreground: 'text-orange-foreground',
|
|
44
44
|
text: 'text-orange-text',
|
|
45
45
|
border: 'border-orange-border',
|
|
46
46
|
},
|
|
@@ -48,7 +48,7 @@ const styles: ColorStyles[] = [
|
|
|
48
48
|
hue: 'amber',
|
|
49
49
|
fill: 'bg-amber-fill',
|
|
50
50
|
surface: 'bg-amber-surface',
|
|
51
|
-
|
|
51
|
+
foreground: 'text-amber-foreground',
|
|
52
52
|
text: 'text-amber-text',
|
|
53
53
|
border: 'border-amber-border',
|
|
54
54
|
},
|
|
@@ -56,7 +56,7 @@ const styles: ColorStyles[] = [
|
|
|
56
56
|
hue: 'yellow',
|
|
57
57
|
fill: 'bg-yellow-fill',
|
|
58
58
|
surface: 'bg-yellow-surface',
|
|
59
|
-
|
|
59
|
+
foreground: 'text-yellow-foreground',
|
|
60
60
|
text: 'text-yellow-text',
|
|
61
61
|
border: 'border-yellow-border',
|
|
62
62
|
},
|
|
@@ -64,7 +64,7 @@ const styles: ColorStyles[] = [
|
|
|
64
64
|
hue: 'lime',
|
|
65
65
|
fill: 'bg-lime-fill',
|
|
66
66
|
surface: 'bg-lime-surface',
|
|
67
|
-
|
|
67
|
+
foreground: 'text-lime-foreground',
|
|
68
68
|
text: 'text-lime-text',
|
|
69
69
|
border: 'border-lime-border',
|
|
70
70
|
},
|
|
@@ -72,7 +72,7 @@ const styles: ColorStyles[] = [
|
|
|
72
72
|
hue: 'green',
|
|
73
73
|
fill: 'bg-green-fill',
|
|
74
74
|
surface: 'bg-green-surface',
|
|
75
|
-
|
|
75
|
+
foreground: 'text-green-foreground',
|
|
76
76
|
text: 'text-green-text',
|
|
77
77
|
border: 'border-green-border',
|
|
78
78
|
},
|
|
@@ -80,7 +80,7 @@ const styles: ColorStyles[] = [
|
|
|
80
80
|
hue: 'emerald',
|
|
81
81
|
fill: 'bg-emerald-fill',
|
|
82
82
|
surface: 'bg-emerald-surface',
|
|
83
|
-
|
|
83
|
+
foreground: 'text-emerald-foreground',
|
|
84
84
|
text: 'text-emerald-text',
|
|
85
85
|
border: 'border-emerald-border',
|
|
86
86
|
},
|
|
@@ -88,7 +88,7 @@ const styles: ColorStyles[] = [
|
|
|
88
88
|
hue: 'teal',
|
|
89
89
|
fill: 'bg-teal-fill',
|
|
90
90
|
surface: 'bg-teal-surface',
|
|
91
|
-
|
|
91
|
+
foreground: 'text-teal-foreground',
|
|
92
92
|
text: 'text-teal-text',
|
|
93
93
|
border: 'border-teal-border',
|
|
94
94
|
},
|
|
@@ -96,7 +96,7 @@ const styles: ColorStyles[] = [
|
|
|
96
96
|
hue: 'cyan',
|
|
97
97
|
fill: 'bg-cyan-fill',
|
|
98
98
|
surface: 'bg-cyan-surface',
|
|
99
|
-
|
|
99
|
+
foreground: 'text-cyan-foreground',
|
|
100
100
|
text: 'text-cyan-text',
|
|
101
101
|
border: 'border-cyan-border',
|
|
102
102
|
},
|
|
@@ -104,7 +104,7 @@ const styles: ColorStyles[] = [
|
|
|
104
104
|
hue: 'sky',
|
|
105
105
|
fill: 'bg-sky-fill',
|
|
106
106
|
surface: 'bg-sky-surface',
|
|
107
|
-
|
|
107
|
+
foreground: 'text-sky-foreground',
|
|
108
108
|
text: 'text-sky-text',
|
|
109
109
|
border: 'border-sky-border',
|
|
110
110
|
},
|
|
@@ -112,7 +112,7 @@ const styles: ColorStyles[] = [
|
|
|
112
112
|
hue: 'blue',
|
|
113
113
|
fill: 'bg-blue-fill',
|
|
114
114
|
surface: 'bg-blue-surface',
|
|
115
|
-
|
|
115
|
+
foreground: 'text-blue-foreground',
|
|
116
116
|
text: 'text-blue-text',
|
|
117
117
|
border: 'border-blue-border',
|
|
118
118
|
},
|
|
@@ -120,7 +120,7 @@ const styles: ColorStyles[] = [
|
|
|
120
120
|
hue: 'indigo',
|
|
121
121
|
fill: 'bg-indigo-fill',
|
|
122
122
|
surface: 'bg-indigo-surface',
|
|
123
|
-
|
|
123
|
+
foreground: 'text-indigo-foreground',
|
|
124
124
|
text: 'text-indigo-text',
|
|
125
125
|
border: 'border-indigo-border',
|
|
126
126
|
},
|
|
@@ -128,7 +128,7 @@ const styles: ColorStyles[] = [
|
|
|
128
128
|
hue: 'violet',
|
|
129
129
|
fill: 'bg-violet-fill',
|
|
130
130
|
surface: 'bg-violet-surface',
|
|
131
|
-
|
|
131
|
+
foreground: 'text-violet-foreground',
|
|
132
132
|
text: 'text-violet-text',
|
|
133
133
|
border: 'border-violet-border',
|
|
134
134
|
},
|
|
@@ -136,7 +136,7 @@ const styles: ColorStyles[] = [
|
|
|
136
136
|
hue: 'purple',
|
|
137
137
|
fill: 'bg-purple-fill',
|
|
138
138
|
surface: 'bg-purple-surface',
|
|
139
|
-
|
|
139
|
+
foreground: 'text-purple-foreground',
|
|
140
140
|
text: 'text-purple-text',
|
|
141
141
|
border: 'border-purple-border',
|
|
142
142
|
},
|
|
@@ -144,7 +144,7 @@ const styles: ColorStyles[] = [
|
|
|
144
144
|
hue: 'fuchsia',
|
|
145
145
|
fill: 'bg-fuchsia-fill',
|
|
146
146
|
surface: 'bg-fuchsia-surface',
|
|
147
|
-
|
|
147
|
+
foreground: 'text-fuchsia-foreground',
|
|
148
148
|
text: 'text-fuchsia-text',
|
|
149
149
|
border: 'border-fuchsia-border',
|
|
150
150
|
},
|
|
@@ -152,7 +152,7 @@ const styles: ColorStyles[] = [
|
|
|
152
152
|
hue: 'pink',
|
|
153
153
|
fill: 'bg-pink-fill',
|
|
154
154
|
surface: 'bg-pink-surface',
|
|
155
|
-
|
|
155
|
+
foreground: 'text-pink-foreground',
|
|
156
156
|
text: 'text-pink-text',
|
|
157
157
|
border: 'border-pink-border',
|
|
158
158
|
},
|
|
@@ -160,7 +160,7 @@ const styles: ColorStyles[] = [
|
|
|
160
160
|
hue: 'rose',
|
|
161
161
|
fill: 'bg-rose-fill',
|
|
162
162
|
surface: 'bg-rose-surface',
|
|
163
|
-
|
|
163
|
+
foreground: 'text-rose-foreground',
|
|
164
164
|
text: 'text-rose-text',
|
|
165
165
|
border: 'border-rose-border',
|
|
166
166
|
},
|
package/src/util/mx.ts
CHANGED
|
@@ -89,6 +89,9 @@ export const composableProps = <P extends HTMLElement = HTMLElement>(
|
|
|
89
89
|
className: mx(defaultClassNames, className, classNames),
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
+
/** Symbol used to mark components created by `composable()` or `slottable()`. */
|
|
93
|
+
const COMPOSABLE = Symbol.for('dxos.composable');
|
|
94
|
+
|
|
92
95
|
/**
|
|
93
96
|
* Factory for slottable components.
|
|
94
97
|
* The implementation receives full `HTMLAttributes<E>` so it can destructure `role`, `style`, etc.
|
|
@@ -109,9 +112,6 @@ export const composableProps = <P extends HTMLElement = HTMLElement>(
|
|
|
109
112
|
* );
|
|
110
113
|
* ```
|
|
111
114
|
*/
|
|
112
|
-
/** Symbol used to mark components created by `composable()` or `slottable()`. */
|
|
113
|
-
const COMPOSABLE = Symbol.for('dxos.composable');
|
|
114
|
-
|
|
115
115
|
export function slottable<E extends HTMLElement, P extends object = {}>(
|
|
116
116
|
render: (props: SlottableProps<P> & HTMLAttributes<E>, forwardedRef: ForwardedRef<E>) => ReactNode,
|
|
117
117
|
): ForwardRefExoticComponent<SlottableProps<P> & RefAttributes<E>> {
|