@ohos-ports/dxos-react-ui-theme 0.6.7-beta.1
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 +8 -0
- package/README.md +25 -0
- package/README.yml +1 -0
- package/dist/lib/browser/index.mjs +2300 -0
- package/dist/lib/browser/index.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -0
- package/dist/plugin/node/chunk-G3RQ5GOB.cjs +712 -0
- package/dist/plugin/node/chunk-G3RQ5GOB.cjs.map +7 -0
- package/dist/plugin/node/esbuild-plugin.cjs +89 -0
- package/dist/plugin/node/esbuild-plugin.cjs.map +7 -0
- package/dist/plugin/node/meta.json +1 -0
- package/dist/plugin/node/plugin.cjs +77 -0
- package/dist/plugin/node/plugin.cjs.map +7 -0
- package/dist/plugin/node/theme.css +418 -0
- package/dist/plugin/node/theme.css.map +7 -0
- package/dist/types/src/config/colors.d.ts +109 -0
- package/dist/types/src/config/colors.d.ts.map +1 -0
- package/dist/types/src/config/index.d.ts +3 -0
- package/dist/types/src/config/index.d.ts.map +1 -0
- package/dist/types/src/config/resolveContent.d.ts +2 -0
- package/dist/types/src/config/resolveContent.d.ts.map +1 -0
- package/dist/types/src/config/tailwind.d.ts +9 -0
- package/dist/types/src/config/tailwind.d.ts.map +1 -0
- package/dist/types/src/esbuild-plugin.d.ts +9 -0
- package/dist/types/src/esbuild-plugin.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +4 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +13 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/styles/components/anchored-overflow.d.ts +6 -0
- package/dist/types/src/styles/components/anchored-overflow.d.ts.map +1 -0
- package/dist/types/src/styles/components/avatar.d.ts +21 -0
- package/dist/types/src/styles/components/avatar.d.ts.map +1 -0
- package/dist/types/src/styles/components/breadcrumb.d.ts +9 -0
- package/dist/types/src/styles/components/breadcrumb.d.ts.map +1 -0
- package/dist/types/src/styles/components/button.d.ts +19 -0
- package/dist/types/src/styles/components/button.d.ts.map +1 -0
- package/dist/types/src/styles/components/dialog.d.ts +12 -0
- package/dist/types/src/styles/components/dialog.d.ts.map +1 -0
- package/dist/types/src/styles/components/index.d.ts +22 -0
- package/dist/types/src/styles/components/index.d.ts.map +1 -0
- package/dist/types/src/styles/components/input.d.ts +103 -0
- package/dist/types/src/styles/components/input.d.ts.map +1 -0
- package/dist/types/src/styles/components/link.d.ts +7 -0
- package/dist/types/src/styles/components/link.d.ts.map +1 -0
- package/dist/types/src/styles/components/list.d.ts +14 -0
- package/dist/types/src/styles/components/list.d.ts.map +1 -0
- package/dist/types/src/styles/components/main.d.ts +25 -0
- package/dist/types/src/styles/components/main.d.ts.map +1 -0
- package/dist/types/src/styles/components/menu.d.ts +12 -0
- package/dist/types/src/styles/components/menu.d.ts.map +1 -0
- package/dist/types/src/styles/components/message.d.ts +10 -0
- package/dist/types/src/styles/components/message.d.ts.map +1 -0
- package/dist/types/src/styles/components/popover.d.ts +10 -0
- package/dist/types/src/styles/components/popover.d.ts.map +1 -0
- package/dist/types/src/styles/components/scroll-area.d.ts +9 -0
- package/dist/types/src/styles/components/scroll-area.d.ts.map +1 -0
- package/dist/types/src/styles/components/select.d.ts +13 -0
- package/dist/types/src/styles/components/select.d.ts.map +1 -0
- package/dist/types/src/styles/components/separator.d.ts +7 -0
- package/dist/types/src/styles/components/separator.d.ts.map +1 -0
- package/dist/types/src/styles/components/status.d.ts +8 -0
- package/dist/types/src/styles/components/status.d.ts.map +1 -0
- package/dist/types/src/styles/components/tag.d.ts +7 -0
- package/dist/types/src/styles/components/tag.d.ts.map +1 -0
- package/dist/types/src/styles/components/toast.d.ts +12 -0
- package/dist/types/src/styles/components/toast.d.ts.map +1 -0
- package/dist/types/src/styles/components/toolbar.d.ts +5 -0
- package/dist/types/src/styles/components/toolbar.d.ts.map +1 -0
- package/dist/types/src/styles/components/tooltip.d.ts +6 -0
- package/dist/types/src/styles/components/tooltip.d.ts.map +1 -0
- package/dist/types/src/styles/components/treegrid.d.ts +10 -0
- package/dist/types/src/styles/components/treegrid.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/arrow.d.ts +6 -0
- package/dist/types/src/styles/fragments/arrow.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/density.d.ts +13 -0
- package/dist/types/src/styles/fragments/density.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/dimensions.d.ts +2 -0
- package/dist/types/src/styles/fragments/dimensions.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/disabled.d.ts +3 -0
- package/dist/types/src/styles/fragments/disabled.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/elevation.d.ts +11 -0
- package/dist/types/src/styles/fragments/elevation.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/focus.d.ts +6 -0
- package/dist/types/src/styles/fragments/focus.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/group.d.ts +5 -0
- package/dist/types/src/styles/fragments/group.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/hover.d.ts +14 -0
- package/dist/types/src/styles/fragments/hover.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/hue.d.ts +16 -0
- package/dist/types/src/styles/fragments/hue.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/index.d.ts +19 -0
- package/dist/types/src/styles/fragments/index.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/layout.d.ts +3 -0
- package/dist/types/src/styles/fragments/layout.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/motion.d.ts +3 -0
- package/dist/types/src/styles/fragments/motion.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/ornament.d.ts +4 -0
- package/dist/types/src/styles/fragments/ornament.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/selected.d.ts +12 -0
- package/dist/types/src/styles/fragments/selected.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/shimmer.d.ts +3 -0
- package/dist/types/src/styles/fragments/shimmer.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/size.d.ts +9 -0
- package/dist/types/src/styles/fragments/size.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/surface.d.ts +9 -0
- package/dist/types/src/styles/fragments/surface.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/text.d.ts +6 -0
- package/dist/types/src/styles/fragments/text.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/valence.d.ts +13 -0
- package/dist/types/src/styles/fragments/valence.d.ts.map +1 -0
- package/dist/types/src/styles/index.d.ts +4 -0
- package/dist/types/src/styles/index.d.ts.map +1 -0
- package/dist/types/src/styles/theme.d.ts +5 -0
- package/dist/types/src/styles/theme.d.ts.map +1 -0
- package/dist/types/src/tailwind.d.ts +1 -0
- package/dist/types/src/tailwind.d.ts.map +1 -0
- package/dist/types/src/util/index.d.ts +2 -0
- package/dist/types/src/util/index.d.ts.map +1 -0
- package/dist/types/src/util/mx.d.ts +2 -0
- package/dist/types/src/util/mx.d.ts.map +1 -0
- package/dist/types/src/util/semanticColors.d.ts +10 -0
- package/dist/types/src/util/semanticColors.d.ts.map +1 -0
- package/dist/types/src/util/withLogical.d.ts +158 -0
- package/dist/types/src/util/withLogical.d.ts.map +1 -0
- package/package.json +45 -0
- package/plugin.d.ts +7 -0
- package/plugin.js +10 -0
- package/src/config/colors.ts +293 -0
- package/src/config/index.ts +6 -0
- package/src/config/resolveContent.ts +50 -0
- package/src/config/tailwind.ts +200 -0
- package/src/esbuild-plugin.ts +60 -0
- package/src/index.ts +7 -0
- package/src/plugin.ts +63 -0
- package/src/styles/components/anchored-overflow.ts +20 -0
- package/src/styles/components/avatar.ts +96 -0
- package/src/styles/components/breadcrumb.ts +29 -0
- package/src/styles/components/button.ts +47 -0
- package/src/styles/components/dialog.ts +46 -0
- package/src/styles/components/index.ts +25 -0
- package/src/styles/components/input.ts +172 -0
- package/src/styles/components/link.ts +27 -0
- package/src/styles/components/list.ts +46 -0
- package/src/styles/components/main.ts +81 -0
- package/src/styles/components/menu.ts +52 -0
- package/src/styles/components/message.ts +27 -0
- package/src/styles/components/popover.ts +32 -0
- package/src/styles/components/scroll-area.ts +42 -0
- package/src/styles/components/select.ts +55 -0
- package/src/styles/components/separator.ts +19 -0
- package/src/styles/components/status.ts +27 -0
- package/src/styles/components/tag.ts +49 -0
- package/src/styles/components/toast.ts +53 -0
- package/src/styles/components/toolbar.ts +17 -0
- package/src/styles/components/tooltip.ts +27 -0
- package/src/styles/components/treegrid.ts +37 -0
- package/src/styles/fragments/arrow.ts +10 -0
- package/src/styles/fragments/density.ts +17 -0
- package/src/styles/fragments/dimensions.ts +5 -0
- package/src/styles/fragments/disabled.ts +6 -0
- package/src/styles/fragments/elevation.ts +14 -0
- package/src/styles/fragments/focus.ts +18 -0
- package/src/styles/fragments/group.ts +12 -0
- package/src/styles/fragments/hover.ts +22 -0
- package/src/styles/fragments/hue.ts +151 -0
- package/src/styles/fragments/index.ts +22 -0
- package/src/styles/fragments/layout.ts +7 -0
- package/src/styles/fragments/motion.ts +8 -0
- package/src/styles/fragments/ornament.ts +7 -0
- package/src/styles/fragments/selected.ts +39 -0
- package/src/styles/fragments/shimmer.ts +9 -0
- package/src/styles/fragments/size.ts +117 -0
- package/src/styles/fragments/surface.ts +29 -0
- package/src/styles/fragments/text.ts +11 -0
- package/src/styles/fragments/valence.ts +50 -0
- package/src/styles/index.ts +7 -0
- package/src/styles/layers/anchored-overflow.css +9 -0
- package/src/styles/layers/attention.css +50 -0
- package/src/styles/layers/button.css +73 -0
- package/src/styles/layers/can-scroll.css +26 -0
- package/src/styles/layers/checkbox.css +25 -0
- package/src/styles/layers/focus-ring.css +26 -0
- package/src/styles/layers/index.css +10 -0
- package/src/styles/layers/positioning.css +20 -0
- package/src/styles/layers/surfaces.css +39 -0
- package/src/styles/layers/tldraw.css +87 -0
- package/src/styles/layers/typography.css +152 -0
- package/src/styles/theme.ts +69 -0
- package/src/tailwind.ts +5 -0
- package/src/theme.css +52 -0
- package/src/typings.d.ts +7 -0
- package/src/util/index.ts +5 -0
- package/src/util/mx.ts +40 -0
- package/src/util/semanticColors.ts +57 -0
- package/src/util/withLogical.ts +110 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
@import '@fontsource-variable/jetbrains-mono/wght-italic.css';
|
|
2
|
+
@import '@fontsource-variable/jetbrains-mono/wght.css';
|
|
3
|
+
@import '@fontsource-variable/inter/slnt.css';
|
|
4
|
+
|
|
5
|
+
@layer utilities {
|
|
6
|
+
/* Font weights & `italic` handling */
|
|
7
|
+
.not-italic {
|
|
8
|
+
font-variation-settings:
|
|
9
|
+
'wght' 400,
|
|
10
|
+
'slnt' 0;
|
|
11
|
+
}
|
|
12
|
+
.font-thin,
|
|
13
|
+
.not-italic.font-thin,
|
|
14
|
+
.not-italic .font-thin,
|
|
15
|
+
.font-thin .not-italic {
|
|
16
|
+
font-variation-settings:
|
|
17
|
+
'wght' 100,
|
|
18
|
+
'slnt' 0;
|
|
19
|
+
}
|
|
20
|
+
.font-extralight,
|
|
21
|
+
.not-italic.font-extralight,
|
|
22
|
+
.not-italic .font-extralight,
|
|
23
|
+
.font-extralight .not-italic {
|
|
24
|
+
font-variation-settings:
|
|
25
|
+
'wght' 200,
|
|
26
|
+
'slnt' 0;
|
|
27
|
+
}
|
|
28
|
+
.font-light,
|
|
29
|
+
.not-italic.font-light,
|
|
30
|
+
.not-italic .font-light,
|
|
31
|
+
.font-light .not-italic {
|
|
32
|
+
font-variation-settings:
|
|
33
|
+
'wght' 300,
|
|
34
|
+
'slnt' 0;
|
|
35
|
+
}
|
|
36
|
+
.font-normal,
|
|
37
|
+
.not-italic.font-normal,
|
|
38
|
+
.not-italic .font-normal,
|
|
39
|
+
.font-normal .not-italic {
|
|
40
|
+
font-variation-settings:
|
|
41
|
+
'wght' 400,
|
|
42
|
+
'slnt' 0;
|
|
43
|
+
}
|
|
44
|
+
.font-medium,
|
|
45
|
+
.not-italic.font-medium,
|
|
46
|
+
.not-italic .font-medium,
|
|
47
|
+
.font-medium .not-italic {
|
|
48
|
+
font-variation-settings:
|
|
49
|
+
'wght' 500,
|
|
50
|
+
'slnt' 0;
|
|
51
|
+
}
|
|
52
|
+
.font-semibold,
|
|
53
|
+
.not-italic.font-semibold,
|
|
54
|
+
.not-italic .font-semibold,
|
|
55
|
+
.font-semibold .not-italic {
|
|
56
|
+
font-variation-settings:
|
|
57
|
+
'wght' 600,
|
|
58
|
+
'slnt' 0;
|
|
59
|
+
}
|
|
60
|
+
.font-bold,
|
|
61
|
+
.not-italic.font-bold,
|
|
62
|
+
.not-italic .font-bold,
|
|
63
|
+
.font-bold .not-italic {
|
|
64
|
+
font-variation-settings:
|
|
65
|
+
'wght' 700,
|
|
66
|
+
'slnt' 0;
|
|
67
|
+
}
|
|
68
|
+
.font-extrabold,
|
|
69
|
+
.not-italic.font-extrabold,
|
|
70
|
+
.not-italic .font-extrabold,
|
|
71
|
+
.font-extrabold .not-italic {
|
|
72
|
+
font-variation-settings:
|
|
73
|
+
'wght' 800,
|
|
74
|
+
'slnt' 0;
|
|
75
|
+
}
|
|
76
|
+
.font-black,
|
|
77
|
+
.not-italic.font-black,
|
|
78
|
+
.not-italic .font-black,
|
|
79
|
+
.font-black .not-italic {
|
|
80
|
+
font-variation-settings:
|
|
81
|
+
'wght' 900,
|
|
82
|
+
'slnt' 0;
|
|
83
|
+
}
|
|
84
|
+
.italic {
|
|
85
|
+
font-variation-settings:
|
|
86
|
+
'wght' 400,
|
|
87
|
+
'slnt' -10;
|
|
88
|
+
}
|
|
89
|
+
.italic.font-thin,
|
|
90
|
+
.italic .font-thin,
|
|
91
|
+
.font-thin .italic {
|
|
92
|
+
font-variation-settings:
|
|
93
|
+
'wght' 100,
|
|
94
|
+
'slnt' -10;
|
|
95
|
+
}
|
|
96
|
+
.italic.font-extralight,
|
|
97
|
+
.italic .font-extralight,
|
|
98
|
+
.font-extralight .italic {
|
|
99
|
+
font-variation-settings:
|
|
100
|
+
'wght' 200,
|
|
101
|
+
'slnt' -10;
|
|
102
|
+
}
|
|
103
|
+
.italic.font-light,
|
|
104
|
+
.italic .font-light,
|
|
105
|
+
.font-light .italic {
|
|
106
|
+
font-variation-settings:
|
|
107
|
+
'wght' 300,
|
|
108
|
+
'slnt' -10;
|
|
109
|
+
}
|
|
110
|
+
.italic.font-normal,
|
|
111
|
+
.italic .font-normal,
|
|
112
|
+
.font-normal .italic {
|
|
113
|
+
font-variation-settings:
|
|
114
|
+
'wght' 400,
|
|
115
|
+
'slnt' -10;
|
|
116
|
+
}
|
|
117
|
+
.italic.font-medium,
|
|
118
|
+
.italic .font-medium,
|
|
119
|
+
.font-medium .italic {
|
|
120
|
+
font-variation-settings:
|
|
121
|
+
'wght' 500,
|
|
122
|
+
'slnt' -10;
|
|
123
|
+
}
|
|
124
|
+
.italic.font-semibold,
|
|
125
|
+
.italic .font-semibold,
|
|
126
|
+
.font-semibold .italic {
|
|
127
|
+
font-variation-settings:
|
|
128
|
+
'wght' 600,
|
|
129
|
+
'slnt' -10;
|
|
130
|
+
}
|
|
131
|
+
.italic.font-bold,
|
|
132
|
+
.italic .font-bold,
|
|
133
|
+
.font-bold .italic {
|
|
134
|
+
font-variation-settings:
|
|
135
|
+
'wght' 700,
|
|
136
|
+
'slnt' -10;
|
|
137
|
+
}
|
|
138
|
+
.italic.font-extrabold,
|
|
139
|
+
.italic .font-extrabold,
|
|
140
|
+
.font-extrabold .italic {
|
|
141
|
+
font-variation-settings:
|
|
142
|
+
'wght' 800,
|
|
143
|
+
'slnt' -10;
|
|
144
|
+
}
|
|
145
|
+
.italic.font-black,
|
|
146
|
+
.italic .font-black,
|
|
147
|
+
.font-black .italic {
|
|
148
|
+
font-variation-settings:
|
|
149
|
+
'wght' 900,
|
|
150
|
+
'slnt' -10;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import get from 'lodash.get';
|
|
6
|
+
|
|
7
|
+
import { type ComponentFunction, type Theme } from '@dxos/react-ui-types';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
anchoredOverflowTheme,
|
|
11
|
+
avatarTheme,
|
|
12
|
+
breadcrumbTheme,
|
|
13
|
+
buttonTheme,
|
|
14
|
+
dialogTheme,
|
|
15
|
+
menuTheme,
|
|
16
|
+
inputTheme,
|
|
17
|
+
linkTheme,
|
|
18
|
+
listTheme,
|
|
19
|
+
mainTheme,
|
|
20
|
+
messageTheme,
|
|
21
|
+
popoverTheme,
|
|
22
|
+
scrollAreaTheme,
|
|
23
|
+
selectTheme,
|
|
24
|
+
separatorTheme,
|
|
25
|
+
statusTheme,
|
|
26
|
+
tagTheme,
|
|
27
|
+
toastTheme,
|
|
28
|
+
toolbarTheme,
|
|
29
|
+
tooltipTheme,
|
|
30
|
+
treegridTheme,
|
|
31
|
+
} from './components';
|
|
32
|
+
import { hueTheme } from './fragments';
|
|
33
|
+
|
|
34
|
+
export const defaultTheme: Theme<Record<string, any>> = {
|
|
35
|
+
themeName: () => 'default',
|
|
36
|
+
|
|
37
|
+
anchoredOverflow: anchoredOverflowTheme,
|
|
38
|
+
avatar: avatarTheme,
|
|
39
|
+
breadcrumb: breadcrumbTheme,
|
|
40
|
+
button: buttonTheme,
|
|
41
|
+
dialog: dialogTheme,
|
|
42
|
+
menu: menuTheme,
|
|
43
|
+
input: inputTheme,
|
|
44
|
+
link: linkTheme,
|
|
45
|
+
list: listTheme,
|
|
46
|
+
main: mainTheme,
|
|
47
|
+
message: messageTheme,
|
|
48
|
+
popover: popoverTheme,
|
|
49
|
+
select: selectTheme,
|
|
50
|
+
scrollArea: scrollAreaTheme,
|
|
51
|
+
separator: separatorTheme,
|
|
52
|
+
status: statusTheme,
|
|
53
|
+
tag: tagTheme,
|
|
54
|
+
toast: toastTheme,
|
|
55
|
+
toolbar: toolbarTheme,
|
|
56
|
+
tooltip: tooltipTheme,
|
|
57
|
+
treegrid: treegridTheme,
|
|
58
|
+
|
|
59
|
+
hue: hueTheme,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const bindTheme = <P extends Record<string, any>>(theme: Theme<Record<string, any>>) => {
|
|
63
|
+
return (path: string, defaultClassName: string, styleProps: P, ...options: any[]): string => {
|
|
64
|
+
const result: Theme<P> | ComponentFunction<P> = get(theme, path);
|
|
65
|
+
return typeof result === 'function' ? result(styleProps, ...options) : defaultClassName;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const defaultTx = bindTheme(defaultTheme);
|
package/src/tailwind.ts
ADDED
package/src/theme.css
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Variable fonts:
|
|
3
|
+
* https://fontsource.org/?category=sans-serif&variable=true
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@import 'tailwindcss/base';
|
|
7
|
+
@import 'tailwindcss/utilities';
|
|
8
|
+
@import 'tailwindcss/components';
|
|
9
|
+
|
|
10
|
+
@import './styles/layers/index.css';
|
|
11
|
+
|
|
12
|
+
/* Base variables */
|
|
13
|
+
|
|
14
|
+
:root {
|
|
15
|
+
font-synthesis: none;
|
|
16
|
+
font-variation-settings:
|
|
17
|
+
'wght' 400,
|
|
18
|
+
'slnt' 0;
|
|
19
|
+
scroll-padding-block-start: theme(spacing.14);
|
|
20
|
+
scroll-padding-block-end: theme(spacing.2);
|
|
21
|
+
--surface-bg: theme(colors.neutral.25);
|
|
22
|
+
--input-bg: theme(colors.neutral.50);
|
|
23
|
+
--input-bg-hover: theme(colors.neutral.75);
|
|
24
|
+
--surface-text: black;
|
|
25
|
+
--description-text: theme(colors.neutral.300);
|
|
26
|
+
--topbar-size: theme(spacing.12);
|
|
27
|
+
--statusbar-size: theme(spacing.6);
|
|
28
|
+
--sticky-top: 0;
|
|
29
|
+
--rail-size: 48px;
|
|
30
|
+
--rail-action: 40px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@media (pointer: coarse) {
|
|
34
|
+
:root {
|
|
35
|
+
--statusbar-size: theme(spacing.8);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.dark {
|
|
40
|
+
--surface-bg: theme(colors.neutral.850);
|
|
41
|
+
--surface-text: white;
|
|
42
|
+
--input-bg: theme(colors.neutral.825);
|
|
43
|
+
--input-bg-hover: theme(colors.neutral.800);
|
|
44
|
+
--description-text: theme(colors.neutral.500);
|
|
45
|
+
color: var(--surface-text);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
html {
|
|
49
|
+
background-color: var(--surface-bg);
|
|
50
|
+
color: var(--surface-text);
|
|
51
|
+
@apply font-body;
|
|
52
|
+
}
|
package/src/typings.d.ts
ADDED
package/src/util/mx.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2022 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { extendTailwindMerge, validators } from 'tailwind-merge';
|
|
6
|
+
|
|
7
|
+
import { withLogical, type WithLogicalClassGroups } from './withLogical';
|
|
8
|
+
import { semanticColors } from '../config';
|
|
9
|
+
|
|
10
|
+
const semanticColorClasses = Object.keys(semanticColors);
|
|
11
|
+
|
|
12
|
+
type AdditionalClassGroups = 'foreground' | 'surface' | 'separator' | WithLogicalClassGroups;
|
|
13
|
+
|
|
14
|
+
export const mx = extendTailwindMerge<AdditionalClassGroups>(
|
|
15
|
+
{
|
|
16
|
+
extend: {
|
|
17
|
+
classGroups: {
|
|
18
|
+
'font-family': ['font-body', 'font-mono'],
|
|
19
|
+
'font-weight': [
|
|
20
|
+
// App weights
|
|
21
|
+
'font-thin',
|
|
22
|
+
'font-extralight',
|
|
23
|
+
'font-light',
|
|
24
|
+
'font-normal',
|
|
25
|
+
'font-medium',
|
|
26
|
+
'font-semibold',
|
|
27
|
+
'font-bold',
|
|
28
|
+
'font-extrabold',
|
|
29
|
+
'font-black',
|
|
30
|
+
// Arbitrary numbers
|
|
31
|
+
validators.isArbitraryNumber,
|
|
32
|
+
],
|
|
33
|
+
foreground: semanticColorClasses.map((value) => `fg-${value}`),
|
|
34
|
+
surface: semanticColorClasses.map((value) => `surface-${value}`),
|
|
35
|
+
separator: semanticColorClasses.map((value) => `separator-${value}`),
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
withLogical,
|
|
40
|
+
);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// Based upon https://github.com/synw/tailwindcss-semantic-colors/blob/main/index.js retrieved 22 Jan 2024
|
|
6
|
+
|
|
7
|
+
import plugin from 'tailwindcss/plugin.js';
|
|
8
|
+
import { type CSSRuleObject } from 'tailwindcss/types/config';
|
|
9
|
+
|
|
10
|
+
export type SemanticColorValue = {
|
|
11
|
+
light: string;
|
|
12
|
+
dark: string;
|
|
13
|
+
fg?: SemanticColorValue;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// TODO(burdon): Move out of util (should not to be exported as lib).
|
|
17
|
+
export const semanticColors = plugin(({ addUtilities, theme, e }) => {
|
|
18
|
+
const values: Record<string, SemanticColorValue> = theme('semanticColors');
|
|
19
|
+
const semanticColorUtilities = Object.entries(values).map(([key, value]) => {
|
|
20
|
+
return {
|
|
21
|
+
// TODO(thure): Refactor all of these tokens to simply prefix the properties they apply with `s-` as with `s-accent`.
|
|
22
|
+
[`.fg-${e(`${key}`)}`]: {
|
|
23
|
+
color: `${value.fg?.light ?? value.light}`,
|
|
24
|
+
},
|
|
25
|
+
[`.dark .fg-${e(`${key}`)}`]: {
|
|
26
|
+
color: `${value.fg?.dark ?? value.dark}`,
|
|
27
|
+
},
|
|
28
|
+
[`.s-accent-${e(`${key}`)}`]: {
|
|
29
|
+
accentColor: `${value.fg?.light ?? value.light}`,
|
|
30
|
+
},
|
|
31
|
+
[`.dark .s-accent-${e(`${key}`)}`]: {
|
|
32
|
+
accentColor: `${value.fg?.dark ?? value.dark}`,
|
|
33
|
+
},
|
|
34
|
+
[`.surface-${e(`${key}`)}`]: {
|
|
35
|
+
backgroundColor: `${value.light}`,
|
|
36
|
+
'--sticky-bg': `${value.light}`,
|
|
37
|
+
},
|
|
38
|
+
[`.dark .surface-${e(`${key}`)}`]: {
|
|
39
|
+
backgroundColor: `${value.dark}`,
|
|
40
|
+
'--sticky-bg': `${value.dark}`,
|
|
41
|
+
},
|
|
42
|
+
[`.separator-${e(`${key}`)}`]: {
|
|
43
|
+
borderColor: `${value.fg?.light ?? value.light}`,
|
|
44
|
+
},
|
|
45
|
+
[`.dark .separator-${e(`${key}`)}`]: {
|
|
46
|
+
borderColor: `${value.fg?.dark ?? value.dark}`,
|
|
47
|
+
},
|
|
48
|
+
[`.s-outline-${e(`${key}`)}`]: {
|
|
49
|
+
outlineColor: `${value.fg?.light ?? value.light}`,
|
|
50
|
+
},
|
|
51
|
+
[`.dark .s-outline-${e(`${key}`)}`]: {
|
|
52
|
+
outlineColor: `${value.fg?.dark ?? value.dark}`,
|
|
53
|
+
},
|
|
54
|
+
} as CSSRuleObject;
|
|
55
|
+
});
|
|
56
|
+
addUtilities(semanticColorUtilities);
|
|
57
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2022 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// This tailwind-merge plugin is based upon https://github.com/vltansky/tailwind-merge-logical-plugin
|
|
6
|
+
|
|
7
|
+
import { type Config, mergeConfigs, validators } from 'tailwind-merge';
|
|
8
|
+
|
|
9
|
+
const getLength = () => [validators.isLength, validators.isArbitraryLength] as const;
|
|
10
|
+
const getLengthWithAuto = () => ['auto', validators.isLength, validators.isArbitraryLength] as const;
|
|
11
|
+
const getLengthWithEmpty = () => ['', validators.isLength, validators.isArbitraryLength] as const;
|
|
12
|
+
const getAny = () => [validators.isAny] as const;
|
|
13
|
+
const getRounded = () => ['none', '', validators.isTshirtSize, 'full', validators.isArbitraryLength] as const;
|
|
14
|
+
|
|
15
|
+
const classGroupsConfig = {
|
|
16
|
+
float: [{ float: ['start', 'end'] }],
|
|
17
|
+
clear: [{ clear: ['start', 'end'] }],
|
|
18
|
+
resize: [{ resize: ['block ', 'inline'] }],
|
|
19
|
+
'text-alignment': [{ text: ['start', 'end'] }],
|
|
20
|
+
'logical.overscroll-b': [{ 'overscroll-b': ['auto ', 'contain', 'auto'] }],
|
|
21
|
+
'logical.overscroll-i': [{ 'overscroll-b': ['auto ', 'contain', 'auto'] }],
|
|
22
|
+
'logical.bs': [{ bs: getLength() }],
|
|
23
|
+
'logical.min-bs': [{ 'min-bs': getAny() }],
|
|
24
|
+
'logical.max-bs': [{ 'max-bs': getAny() }],
|
|
25
|
+
'logical.is': [{ is: getLength() }],
|
|
26
|
+
'logical.min-is': [{ 'min-is': getAny() }],
|
|
27
|
+
'logical.max-is': [{ 'max-is': getAny() }],
|
|
28
|
+
'logical.mlb': [{ mlb: getLength() }],
|
|
29
|
+
'logical.mli': [{ mli: getLength() }],
|
|
30
|
+
'logical.mbs': [{ mbs: getLength() }],
|
|
31
|
+
'logical.mbe': [{ mbe: getLength() }],
|
|
32
|
+
'logical.mis': [{ mis: getLength() }],
|
|
33
|
+
'logical.mie': [{ mie: getLength() }],
|
|
34
|
+
'logical.plb': [{ plb: getLength() }],
|
|
35
|
+
'logical.pli': [{ pli: getLength() }],
|
|
36
|
+
'logical.pbs': [{ pbs: getLength() }],
|
|
37
|
+
'logical.pbe': [{ pbe: getLength() }],
|
|
38
|
+
'logical.pis': [{ pis: getLength() }],
|
|
39
|
+
'logical.pie': [{ pie: getLength() }],
|
|
40
|
+
'logical.space-b': [{ 'space-b': getLength() }],
|
|
41
|
+
'logical.space-i': [{ 'space-i': getLength() }],
|
|
42
|
+
'logical.inset-block': [{ 'inset-block': getLengthWithAuto() }],
|
|
43
|
+
'logical.inset-inline': [{ 'inset-inline': getLengthWithAuto() }],
|
|
44
|
+
'logical.block-start': [{ 'block-start': getLengthWithAuto() }],
|
|
45
|
+
'logical.block-end': [{ 'block-end': getLengthWithAuto() }],
|
|
46
|
+
'logical.inline-start': [{ 'inline-start': getLengthWithAuto() }],
|
|
47
|
+
'logical.inline-end': [{ 'inline-end': getLengthWithAuto() }],
|
|
48
|
+
'logical.border-bs': [{ 'border-bs': getLengthWithEmpty() }],
|
|
49
|
+
'logical.border-be': [{ 'border-be': getLengthWithEmpty() }],
|
|
50
|
+
'logical.border-is': [{ 'border-is': getLengthWithEmpty() }],
|
|
51
|
+
'logical.border-ie': [{ 'border-ie': getLengthWithEmpty() }],
|
|
52
|
+
'logical.border-color-bs': [{ 'border-bs': getAny() }],
|
|
53
|
+
'logical.border-color-be': [{ 'border-be': getAny() }],
|
|
54
|
+
'logical.border-color-is': [{ 'border-is': getAny() }],
|
|
55
|
+
'logical.border-color-ie': [{ 'border-ie': getAny() }],
|
|
56
|
+
'logical.rounded-bs': [{ 'rounded-bs': getRounded() }],
|
|
57
|
+
'logical.rounded-be': [{ 'rounded-be': getRounded() }],
|
|
58
|
+
'logical.rounded-is': [{ 'rounded-is': getRounded() }],
|
|
59
|
+
'logical.rounded-ie': [{ 'rounded-ie': getRounded() }],
|
|
60
|
+
'logical.rounded-ss': [{ 'rounded-ss': getRounded() }],
|
|
61
|
+
'logical.rounded-se': [{ 'rounded-se': getRounded() }],
|
|
62
|
+
'logical.rounded-es': [{ 'rounded-es': getRounded() }],
|
|
63
|
+
'logical.rounded-ee': [{ 'rounded-ee': getRounded() }],
|
|
64
|
+
'logical.divide-b': [{ 'divide-b': getLengthWithEmpty() }],
|
|
65
|
+
'logical.divide-i': [{ 'divide-i': getLengthWithEmpty() }],
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export type WithLogicalClassGroups = keyof typeof classGroupsConfig;
|
|
69
|
+
|
|
70
|
+
type WithLogicalConfig = Config<WithLogicalClassGroups, string>;
|
|
71
|
+
|
|
72
|
+
export const withLogical = (prevConfig: WithLogicalConfig): WithLogicalConfig => {
|
|
73
|
+
return mergeConfigs(prevConfig, {
|
|
74
|
+
extend: {
|
|
75
|
+
classGroups: classGroupsConfig,
|
|
76
|
+
conflictingClassGroups: {
|
|
77
|
+
'inset-block': ['logical.block-start', 'logical.block-end'],
|
|
78
|
+
'inset-inline': ['logical.inline-start', 'logical.inline-end'],
|
|
79
|
+
p: ['logical.plb', 'logical.pli', 'logical.pbs', 'logical.pbe', 'logical.pis', 'logical.pie'],
|
|
80
|
+
pli: ['logical.pis', 'logical.pie'],
|
|
81
|
+
plb: ['logical.pbs', 'logical.pbe'],
|
|
82
|
+
m: ['logical.mlb', 'logical.mli', 'logical.mbs', 'logical.mbe', 'logical.mis', 'logical.mie'],
|
|
83
|
+
mli: ['logical.mis', 'logical.mie'],
|
|
84
|
+
mlb: ['logical.mbs', 'logical.mbe'],
|
|
85
|
+
overscroll: ['overscroll-i', 'overscroll-b'],
|
|
86
|
+
rounded: [
|
|
87
|
+
'logical.rounded-bs',
|
|
88
|
+
'logical.rounded-be',
|
|
89
|
+
'logical.rounded-is',
|
|
90
|
+
'logical.rounded-ie',
|
|
91
|
+
'logical.rounded-ss',
|
|
92
|
+
'logical.rounded-se',
|
|
93
|
+
'logical.rounded-es',
|
|
94
|
+
'logical.rounded-ee',
|
|
95
|
+
],
|
|
96
|
+
'logical.rounded-bs': ['logical.rounded-ss', 'logical.rounded-se'],
|
|
97
|
+
'logical.rounded-be': ['logical.rounded-es', 'logical.rounded-ee'],
|
|
98
|
+
'logical.rounded-is': ['logical.rounded-ss', 'logical.rounded-es'],
|
|
99
|
+
'logical.rounded-ie': ['logical.rounded-ee', 'logical.rounded-se'],
|
|
100
|
+
'border-color': [
|
|
101
|
+
'logical.border-color-bs',
|
|
102
|
+
'logical.border-color-be',
|
|
103
|
+
'logical.border-color-is',
|
|
104
|
+
'logical.border-color-ie',
|
|
105
|
+
],
|
|
106
|
+
border: ['logical.border-bs', 'logical.border-be', 'logical.border-is', 'logical.border-ie'],
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
};
|