@dxos/ui-theme 0.0.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.
- package/LICENSE +8 -0
- package/README.md +25 -0
- package/package.json +80 -0
- package/src/Tokens.stories.tsx +88 -0
- package/src/config/index.ts +6 -0
- package/src/config/tailwind.ts +250 -0
- package/src/config/tokens/alias-colors.ts +39 -0
- package/src/config/tokens/index.ts +92 -0
- package/src/config/tokens/lengths.ts +97 -0
- package/src/config/tokens/physical-colors.ts +125 -0
- package/src/config/tokens/semantic-colors.ts +27 -0
- package/src/config/tokens/sememes-calls.ts +17 -0
- package/src/config/tokens/sememes-codemirror.ts +50 -0
- package/src/config/tokens/sememes-hue.ts +54 -0
- package/src/config/tokens/sememes-sheet.ts +62 -0
- package/src/config/tokens/sememes-system.ts +302 -0
- package/src/config/tokens/sizes.ts +7 -0
- package/src/config/tokens/types.ts +9 -0
- package/src/docs/theme.drawio.svg +635 -0
- package/src/index.ts +19 -0
- package/src/plugins/esbuild-plugin.ts +65 -0
- package/src/plugins/plugin.ts +130 -0
- package/src/plugins/resolveContent.ts +51 -0
- package/src/styles/components/README.md +6 -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 +48 -0
- package/src/styles/components/dialog.ts +36 -0
- package/src/styles/components/icon-button.ts +20 -0
- package/src/styles/components/icon.ts +19 -0
- package/src/styles/components/index.ts +27 -0
- package/src/styles/components/input.ts +177 -0
- package/src/styles/components/link.ts +26 -0
- package/src/styles/components/list.ts +46 -0
- package/src/styles/components/main.ts +36 -0
- package/src/styles/components/menu.ts +60 -0
- package/src/styles/components/message.ts +36 -0
- package/src/styles/components/popover.ts +40 -0
- package/src/styles/components/scroll-area.ts +43 -0
- package/src/styles/components/select.ts +60 -0
- package/src/styles/components/separator.ts +24 -0
- package/src/styles/components/status.ts +32 -0
- package/src/styles/components/tag.ts +23 -0
- package/src/styles/components/toast.ts +55 -0
- package/src/styles/components/toolbar.ts +29 -0
- package/src/styles/components/tooltip.ts +29 -0
- package/src/styles/components/treegrid.ts +37 -0
- package/src/styles/fragments/density.ts +17 -0
- package/src/styles/fragments/dimension.ts +8 -0
- package/src/styles/fragments/disabled.ts +6 -0
- package/src/styles/fragments/elevation.ts +29 -0
- package/src/styles/fragments/focus.ts +16 -0
- package/src/styles/fragments/group.ts +12 -0
- package/src/styles/fragments/hover.ts +25 -0
- package/src/styles/fragments/index.ts +20 -0
- package/src/styles/fragments/layout.ts +7 -0
- package/src/styles/fragments/motion.ts +6 -0
- package/src/styles/fragments/ornament.ts +10 -0
- package/src/styles/fragments/selected.ts +45 -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 +12 -0
- package/src/styles/fragments/valence.ts +46 -0
- package/src/styles/index.ts +7 -0
- package/src/styles/layers/README.md +15 -0
- package/src/styles/layers/anchored-overflow.css +9 -0
- package/src/styles/layers/animation.css +17 -0
- package/src/styles/layers/attention.css +8 -0
- package/src/styles/layers/base.css +25 -0
- package/src/styles/layers/button.css +76 -0
- package/src/styles/layers/can-scroll.css +26 -0
- package/src/styles/layers/checkbox.css +50 -0
- package/src/styles/layers/dialog.css +42 -0
- package/src/styles/layers/drag-preview.css +18 -0
- package/src/styles/layers/focus-ring.css +224 -0
- package/src/styles/layers/hues.css +110 -0
- package/src/styles/layers/index.css +26 -0
- package/src/styles/layers/main.css +160 -0
- package/src/styles/layers/native.css +20 -0
- package/src/styles/layers/positioning.css +23 -0
- package/src/styles/layers/size.css +397 -0
- package/src/styles/layers/surfaces.css +31 -0
- package/src/styles/layers/tag.css +132 -0
- package/src/styles/layers/tldraw.css +91 -0
- package/src/styles/layers/tokens.css +45 -0
- package/src/styles/layers/typography.css +157 -0
- package/src/styles/theme.ts +69 -0
- package/src/tailwind.ts +5 -0
- package/src/theme.css +9 -0
- package/src/types.ts +7 -0
- package/src/typings.d.ts +8 -0
- package/src/util/hash-styles.ts +168 -0
- package/src/util/index.ts +6 -0
- package/src/util/mx.ts +51 -0
- package/src/util/withLogical.ts +114 -0
package/src/util/mx.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2022 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { extendTailwindMerge, validators } from 'tailwind-merge';
|
|
6
|
+
|
|
7
|
+
import { type WithLogicalClassGroups, withLogical } from './withLogical';
|
|
8
|
+
|
|
9
|
+
type AdditionalClassGroups = 'density' | 'dx-focus-ring' | WithLogicalClassGroups;
|
|
10
|
+
|
|
11
|
+
export const mx = extendTailwindMerge<AdditionalClassGroups>(
|
|
12
|
+
{
|
|
13
|
+
extend: {
|
|
14
|
+
classGroups: {
|
|
15
|
+
'font-family': ['font-body', 'font-mono'],
|
|
16
|
+
'font-weight': [
|
|
17
|
+
// App weights
|
|
18
|
+
'font-thin',
|
|
19
|
+
'font-extralight',
|
|
20
|
+
'font-light',
|
|
21
|
+
'font-normal',
|
|
22
|
+
'font-medium',
|
|
23
|
+
'font-semibold',
|
|
24
|
+
'font-bold',
|
|
25
|
+
'font-extrabold',
|
|
26
|
+
'font-black',
|
|
27
|
+
// Arbitrary numbers
|
|
28
|
+
validators.isArbitraryNumber,
|
|
29
|
+
],
|
|
30
|
+
density: ['density-fine', 'density-coarse'],
|
|
31
|
+
'dx-focus-ring': [
|
|
32
|
+
'dx-focus-ring',
|
|
33
|
+
'dx-focus-ring-inset',
|
|
34
|
+
'dx-focus-ring-always',
|
|
35
|
+
'dx-focus-ring-inset-always',
|
|
36
|
+
'dx-focus-ring-group',
|
|
37
|
+
'dx-focus-ring-group-x',
|
|
38
|
+
'dx-focus-ring-group-y',
|
|
39
|
+
'dx-focus-ring-group-always',
|
|
40
|
+
'dx-focus-ring-group-x-always',
|
|
41
|
+
'dx-focus-ring-group-y-always',
|
|
42
|
+
'dx-focus-ring-inset-over-all',
|
|
43
|
+
'dx-focus-ring-inset-over-all-always',
|
|
44
|
+
'dx-focus-ring-main',
|
|
45
|
+
'dx-focus-ring-main-always',
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
withLogical,
|
|
51
|
+
);
|
|
@@ -0,0 +1,114 @@
|
|
|
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: getAny() }],
|
|
29
|
+
'logical.mli': [{ mli: getAny() }],
|
|
30
|
+
'logical.mbs': [{ mbs: getAny() }],
|
|
31
|
+
'logical.mbe': [{ mbe: getAny() }],
|
|
32
|
+
'logical.mis': [{ mis: getAny() }],
|
|
33
|
+
'logical.mie': [{ mie: getAny() }],
|
|
34
|
+
'logical.plb': [{ plb: getAny() }],
|
|
35
|
+
'logical.pli': [{ pli: getAny() }],
|
|
36
|
+
'logical.pbs': [{ pbs: getAny() }],
|
|
37
|
+
'logical.pbe': [{ pbe: getAny() }],
|
|
38
|
+
'logical.pis': [{ pis: getAny() }],
|
|
39
|
+
'logical.pie': [{ pie: getAny() }],
|
|
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-li': [{ 'border-li': getLengthWithEmpty() }],
|
|
49
|
+
'logical.border-lb': [{ 'border-lb': getLengthWithEmpty() }],
|
|
50
|
+
'logical.border-bs': [{ 'border-bs': getLengthWithEmpty() }],
|
|
51
|
+
'logical.border-be': [{ 'border-be': getLengthWithEmpty() }],
|
|
52
|
+
'logical.border-is': [{ 'border-is': getLengthWithEmpty() }],
|
|
53
|
+
'logical.border-ie': [{ 'border-ie': getLengthWithEmpty() }],
|
|
54
|
+
'logical.border-color-bs': [{ 'border-bs': getAny() }],
|
|
55
|
+
'logical.border-color-be': [{ 'border-be': getAny() }],
|
|
56
|
+
'logical.border-color-is': [{ 'border-is': getAny() }],
|
|
57
|
+
'logical.border-color-ie': [{ 'border-ie': getAny() }],
|
|
58
|
+
'logical.rounded-bs': [{ 'rounded-bs': getRounded() }],
|
|
59
|
+
'logical.rounded-be': [{ 'rounded-be': getRounded() }],
|
|
60
|
+
'logical.rounded-is': [{ 'rounded-is': getRounded() }],
|
|
61
|
+
'logical.rounded-ie': [{ 'rounded-ie': getRounded() }],
|
|
62
|
+
'logical.rounded-ss': [{ 'rounded-ss': getRounded() }],
|
|
63
|
+
'logical.rounded-se': [{ 'rounded-se': getRounded() }],
|
|
64
|
+
'logical.rounded-es': [{ 'rounded-es': getRounded() }],
|
|
65
|
+
'logical.rounded-ee': [{ 'rounded-ee': getRounded() }],
|
|
66
|
+
'logical.divide-b': [{ 'divide-b': getLengthWithEmpty() }],
|
|
67
|
+
'logical.divide-i': [{ 'divide-i': getLengthWithEmpty() }],
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export type WithLogicalClassGroups = keyof typeof classGroupsConfig;
|
|
71
|
+
|
|
72
|
+
type WithLogicalConfig = Config<WithLogicalClassGroups, string>;
|
|
73
|
+
|
|
74
|
+
export const withLogical = (prevConfig: WithLogicalConfig): WithLogicalConfig => {
|
|
75
|
+
return mergeConfigs(prevConfig, {
|
|
76
|
+
extend: {
|
|
77
|
+
classGroups: classGroupsConfig,
|
|
78
|
+
conflictingClassGroups: {
|
|
79
|
+
'inset-block': ['logical.block-start', 'logical.block-end'],
|
|
80
|
+
'inset-inline': ['logical.inline-start', 'logical.inline-end'],
|
|
81
|
+
p: ['logical.plb', 'logical.pli', 'logical.pbs', 'logical.pbe', 'logical.pis', 'logical.pie'],
|
|
82
|
+
pli: ['logical.pis', 'logical.pie'],
|
|
83
|
+
plb: ['logical.pbs', 'logical.pbe'],
|
|
84
|
+
m: ['logical.mlb', 'logical.mli', 'logical.mbs', 'logical.mbe', 'logical.mis', 'logical.mie'],
|
|
85
|
+
mli: ['logical.mis', 'logical.mie'],
|
|
86
|
+
mlb: ['logical.mbs', 'logical.mbe'],
|
|
87
|
+
overscroll: ['overscroll-i', 'overscroll-b'],
|
|
88
|
+
rounded: [
|
|
89
|
+
'logical.rounded-bs',
|
|
90
|
+
'logical.rounded-be',
|
|
91
|
+
'logical.rounded-is',
|
|
92
|
+
'logical.rounded-ie',
|
|
93
|
+
'logical.rounded-ss',
|
|
94
|
+
'logical.rounded-se',
|
|
95
|
+
'logical.rounded-es',
|
|
96
|
+
'logical.rounded-ee',
|
|
97
|
+
],
|
|
98
|
+
'logical.rounded-bs': ['logical.rounded-ss', 'logical.rounded-se'],
|
|
99
|
+
'logical.rounded-be': ['logical.rounded-es', 'logical.rounded-ee'],
|
|
100
|
+
'logical.rounded-is': ['logical.rounded-ss', 'logical.rounded-es'],
|
|
101
|
+
'logical.rounded-ie': ['logical.rounded-ee', 'logical.rounded-se'],
|
|
102
|
+
'logical.border-li': ['logical.border-is', 'logical.border-ie'],
|
|
103
|
+
'logical.border-lb': ['logical.border-bs', 'logical.border-be'],
|
|
104
|
+
'border-color': [
|
|
105
|
+
'logical.border-color-bs',
|
|
106
|
+
'logical.border-color-be',
|
|
107
|
+
'logical.border-color-is',
|
|
108
|
+
'logical.border-color-ie',
|
|
109
|
+
],
|
|
110
|
+
border: ['logical.border-bs', 'logical.border-be', 'logical.border-is', 'logical.border-ie'],
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
};
|