@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/LICENSE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
Copyright (c) 2022 DXOS
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
5
|
+
|
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @dxos/ui-theme
|
|
2
|
+
|
|
3
|
+
A set of design system tokens to use with DXOS UI.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm i @dxos/ui-theme
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Documentation
|
|
12
|
+
|
|
13
|
+
- [📖 Developer Guide](https://docs.dxos.org/guide/react/aurora/)
|
|
14
|
+
|
|
15
|
+
## DXOS Resources
|
|
16
|
+
|
|
17
|
+
- [Website](https://dxos.org)
|
|
18
|
+
- [Developer Documentation](https://docs.dxos.org)
|
|
19
|
+
- Talk to us on [Discord](https://dxos.org/discord)
|
|
20
|
+
|
|
21
|
+
## Contributions
|
|
22
|
+
|
|
23
|
+
Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
|
|
24
|
+
|
|
25
|
+
License: [MIT](./LICENSE) Copyright 2022 © DXOS
|
package/package.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dxos/ui-theme",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "A set of design system tokens to use with DXOS UI.",
|
|
5
|
+
"homepage": "https://dxos.org",
|
|
6
|
+
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "DXOS.org",
|
|
9
|
+
"sideEffects": [
|
|
10
|
+
"*.css"
|
|
11
|
+
],
|
|
12
|
+
"type": "module",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"source": "./src/index.ts",
|
|
16
|
+
"types": "./dist/types/src/index.d.ts",
|
|
17
|
+
"default": "./dist/lib/browser/index.mjs"
|
|
18
|
+
},
|
|
19
|
+
"./esbuild-plugin": {
|
|
20
|
+
"source": "./src/plugins/esbuild-plugin.ts",
|
|
21
|
+
"types": "./dist/types/src/plugins/esbuild-plugin.d.ts",
|
|
22
|
+
"import": "./dist/plugin/node-esm/plugins/esbuild-plugin.mjs",
|
|
23
|
+
"require": "./dist/plugin/node-cjs/plugins/esbuild-plugin.cjs"
|
|
24
|
+
},
|
|
25
|
+
"./plugin": {
|
|
26
|
+
"source": "./src/plugins/plugin.ts",
|
|
27
|
+
"types": "./dist/types/src/plugins/plugin.d.ts",
|
|
28
|
+
"import": "./dist/plugin/node-esm/plugins/plugin.mjs",
|
|
29
|
+
"require": "./dist/plugin/node-cjs/plugins/plugin.cjs"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"typesVersions": {
|
|
33
|
+
"*": {
|
|
34
|
+
"plugin": [
|
|
35
|
+
"dist/types/src/plugins/plugin.d.ts"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"src"
|
|
42
|
+
],
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@ch-ui/tailwind-tokens": "2.8.1",
|
|
45
|
+
"@ch-ui/tokens": "3.0.1",
|
|
46
|
+
"@fontsource-variable/inter": "5.0.16",
|
|
47
|
+
"@fontsource-variable/jetbrains-mono": "5.0.21",
|
|
48
|
+
"@fontsource/poiret-one": "^5.0.20",
|
|
49
|
+
"@tailwindcss/container-queries": "^0.1.1",
|
|
50
|
+
"@tailwindcss/forms": "^0.5.3",
|
|
51
|
+
"autoprefixer": "^10.4.12",
|
|
52
|
+
"esbuild-style-plugin": "^1.6.1",
|
|
53
|
+
"glob": "^7.2.3",
|
|
54
|
+
"globby": "14.1.0",
|
|
55
|
+
"lodash.merge": "^4.6.2",
|
|
56
|
+
"postcss": "^8.4.41",
|
|
57
|
+
"postcss-import": "^16.1.0",
|
|
58
|
+
"tailwind-merge": "^2.2.1",
|
|
59
|
+
"tailwind-scrollbar": "^3.1.0",
|
|
60
|
+
"tailwindcss": "~3.4.1",
|
|
61
|
+
"tailwindcss-logical": "^3.0.0",
|
|
62
|
+
"tailwindcss-radix": "^2.8.0",
|
|
63
|
+
"@dxos/node-std": "0.8.3",
|
|
64
|
+
"@dxos/util": "0.8.3"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@ch-ui/colors": "1.2.1",
|
|
68
|
+
"@types/lodash.merge": "^4.6.6",
|
|
69
|
+
"@types/postcss-import": "^14.0.3",
|
|
70
|
+
"esbuild": "0.25.10",
|
|
71
|
+
"vite": "7.1.9",
|
|
72
|
+
"@dxos/ui-types": "0.0.0"
|
|
73
|
+
},
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public"
|
|
76
|
+
},
|
|
77
|
+
"scripts": {
|
|
78
|
+
"tailwind-check": "tailwindcss -i ./dist/plugin/node-esm/theme.css --config ./src/tailwind.ts --content \"./src/**/*.{js,ts,jsx,tsx,vue}\" --check"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type HelicalArcSeries, type TokenAudit, auditFacet, parseAlphaLuminosity } from '@ch-ui/tokens';
|
|
6
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
|
+
import React, { Fragment } from 'react';
|
|
8
|
+
|
|
9
|
+
import { tokenSet } from './config';
|
|
10
|
+
|
|
11
|
+
const colorAudit = auditFacet(tokenSet.colors, { condition: 'p3' });
|
|
12
|
+
|
|
13
|
+
const Swatch = ({ variableName, value, semantic, physical }: TokenAudit<HelicalArcSeries>) => {
|
|
14
|
+
const [luminosity, alpha] = parseAlphaLuminosity(value);
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div className='shrink-0 is-40 flex flex-col rounded overflow-hidden'>
|
|
18
|
+
<dd className='aspect-video' style={{ background: `var(${variableName})` }}></dd>
|
|
19
|
+
<dt className='text-xs bg-baseSurface grow pli-2 plb-1'>
|
|
20
|
+
<p className='text-sm'>
|
|
21
|
+
{luminosity}
|
|
22
|
+
{typeof alpha !== 'undefined' && ` / ${alpha}`}
|
|
23
|
+
</p>
|
|
24
|
+
{physical.includes('values') && <p>values</p>}
|
|
25
|
+
{physical.includes('naming') && <p>naming</p>}
|
|
26
|
+
{semantic.length > 0 && (
|
|
27
|
+
<ul>
|
|
28
|
+
{semantic.map(({ sememeName, conditionId }) => {
|
|
29
|
+
const sememeCondition = `${sememeName} / ${conditionId}`;
|
|
30
|
+
return <li key={sememeCondition}>{sememeCondition}</li>;
|
|
31
|
+
})}
|
|
32
|
+
</ul>
|
|
33
|
+
)}
|
|
34
|
+
</dt>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const DefaultStory = () => {
|
|
40
|
+
return (
|
|
41
|
+
<>
|
|
42
|
+
<div className='flex'>
|
|
43
|
+
<div className='p-2 bg-baseSurface rounded'>
|
|
44
|
+
<h1 className='text-lg mbe-2'>Physical color tokens</h1>
|
|
45
|
+
<pre className='text-xs'>
|
|
46
|
+
Luminosity (/ alpha)?
|
|
47
|
+
<br />
|
|
48
|
+
value // (whether added directly as a physical value)
|
|
49
|
+
<br />
|
|
50
|
+
naming // (whether added as a named physical value)
|
|
51
|
+
<br />
|
|
52
|
+
...`semantic token name / theme`[]
|
|
53
|
+
</pre>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
{Object.entries(colorAudit).map(([seriesId, audits], i) => (
|
|
58
|
+
<Fragment key={i}>
|
|
59
|
+
<h2 className='mbs-12 mbe-4'>
|
|
60
|
+
<span className='pli-2 plb-1 bg-baseSurface rounded'>{seriesId}</span>
|
|
61
|
+
</h2>
|
|
62
|
+
<dl className='flex flex-wrap gap-2'>
|
|
63
|
+
{audits
|
|
64
|
+
.sort((a, b) => {
|
|
65
|
+
const [aL, aA] = parseAlphaLuminosity(a.value);
|
|
66
|
+
const [bL, bA] = parseAlphaLuminosity(b.value);
|
|
67
|
+
return aL - bL - (Number.isFinite(aA) && Number.isFinite(bA) ? aA! - bA! : 0);
|
|
68
|
+
})
|
|
69
|
+
.map((audit, i) => (
|
|
70
|
+
<Swatch key={i} {...audit} />
|
|
71
|
+
))}
|
|
72
|
+
</dl>
|
|
73
|
+
</Fragment>
|
|
74
|
+
))}
|
|
75
|
+
</>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const meta = {
|
|
80
|
+
title: 'ui/react-ui-theme/Tokens',
|
|
81
|
+
render: DefaultStory,
|
|
82
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
83
|
+
|
|
84
|
+
export default meta;
|
|
85
|
+
|
|
86
|
+
type Story = StoryObj<typeof meta>;
|
|
87
|
+
|
|
88
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2022 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import tailwindcssContainerQueries from '@tailwindcss/container-queries';
|
|
6
|
+
import tailwindcssForms from '@tailwindcss/forms';
|
|
7
|
+
import merge from 'lodash.merge';
|
|
8
|
+
import tailwindScrollbar from 'tailwind-scrollbar';
|
|
9
|
+
import defaultConfig from 'tailwindcss/stubs/config.full.js';
|
|
10
|
+
import { type Config, type ThemeConfig } from 'tailwindcss/types/config';
|
|
11
|
+
import tailwindcssLogical from 'tailwindcss-logical';
|
|
12
|
+
import tailwindcssRadix from 'tailwindcss-radix';
|
|
13
|
+
|
|
14
|
+
import { tokensTailwindConfig } from './tokens';
|
|
15
|
+
|
|
16
|
+
export type TailwindConfig = Config;
|
|
17
|
+
export type TailwindThemeConfig = ThemeConfig;
|
|
18
|
+
|
|
19
|
+
const { extend: extendTokens, ...overrideTokens } = tokensTailwindConfig;
|
|
20
|
+
|
|
21
|
+
export const tailwindConfig = ({
|
|
22
|
+
env = 'production',
|
|
23
|
+
content = [],
|
|
24
|
+
extensions = [],
|
|
25
|
+
}: {
|
|
26
|
+
env?: string;
|
|
27
|
+
content?: string[];
|
|
28
|
+
extensions?: Partial<TailwindThemeConfig>[];
|
|
29
|
+
}): TailwindConfig => ({
|
|
30
|
+
darkMode: 'class',
|
|
31
|
+
theme: {
|
|
32
|
+
// Configure fonts in theme.css and package.json.
|
|
33
|
+
fontFamily: {
|
|
34
|
+
body: ['Inter Variable', ...defaultConfig.theme.fontFamily.sans],
|
|
35
|
+
mono: ['JetBrains Mono Variable', ...defaultConfig.theme.fontFamily.mono],
|
|
36
|
+
},
|
|
37
|
+
extend: merge(
|
|
38
|
+
{
|
|
39
|
+
spacing: {
|
|
40
|
+
prose: 'var(--dx-prose)',
|
|
41
|
+
containerMaxWidth: 'var(--dx-containerMaxWidth)',
|
|
42
|
+
cardDefaultWidth: 'var(--dx-cardDefaultWidth)',
|
|
43
|
+
cardMinWidth: 'var(--dx-cardMinWidth)',
|
|
44
|
+
cardMaxWidth: 'var(--dx-cardMaxWidth)',
|
|
45
|
+
popoverMaxWidth: 'var(--dx-popoverMaxWidth)',
|
|
46
|
+
},
|
|
47
|
+
backgroundImage: {
|
|
48
|
+
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
|
|
49
|
+
'gradient-conic': 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
|
|
50
|
+
},
|
|
51
|
+
borderRadius: {
|
|
52
|
+
none: '0',
|
|
53
|
+
sm: '0.25rem',
|
|
54
|
+
DEFAULT: '0.5rem',
|
|
55
|
+
md: '.75rem',
|
|
56
|
+
lg: '1rem',
|
|
57
|
+
},
|
|
58
|
+
screens: {
|
|
59
|
+
'pointer-fine': { raw: '(pointer: fine)' },
|
|
60
|
+
'hover-hover': { raw: '(hover: hover)' },
|
|
61
|
+
md: '768px',
|
|
62
|
+
lg: '1024px',
|
|
63
|
+
},
|
|
64
|
+
fontSize: {
|
|
65
|
+
// Base size 16px
|
|
66
|
+
// Scale 1.125
|
|
67
|
+
xs: ['0.790rem', { lineHeight: '1rem' }],
|
|
68
|
+
sm: ['0.889rem', { lineHeight: '1.25rem' }],
|
|
69
|
+
base: ['1rem', { lineHeight: '1.5rem' }],
|
|
70
|
+
lg: ['1.125rem', { lineHeight: '1.75rem' }],
|
|
71
|
+
xl: ['1.266rem', { lineHeight: '1.75rem' }],
|
|
72
|
+
'2xl': ['1.424rem', { lineHeight: '2rem' }],
|
|
73
|
+
'3xl': ['1.602rem', { lineHeight: '2.25rem' }],
|
|
74
|
+
'4xl': ['1.802rem', { lineHeight: '2.5rem' }],
|
|
75
|
+
'5xl': ['2.027rem', { lineHeight: '2.5rem' }],
|
|
76
|
+
'6xl': ['2.281rem', { lineHeight: '2.5rem' }],
|
|
77
|
+
'7xl': ['2.566rem', { lineHeight: '2.75rem' }],
|
|
78
|
+
'8xl': ['2.887rem', { lineHeight: '3rem' }],
|
|
79
|
+
'9xl': ['3.247rem', { lineHeight: '3.25rem' }],
|
|
80
|
+
},
|
|
81
|
+
boxShadow: {
|
|
82
|
+
slider: '0 0 0 5px rgba(0, 0, 0, 0.3)',
|
|
83
|
+
},
|
|
84
|
+
transitionProperty: {
|
|
85
|
+
'max-height': 'max-height',
|
|
86
|
+
},
|
|
87
|
+
transitionTimingFunction: {
|
|
88
|
+
'in-out-symmetric': 'cubic-bezier(0.5,0,0.5,1)',
|
|
89
|
+
},
|
|
90
|
+
keyframes: {
|
|
91
|
+
// Popper chrome
|
|
92
|
+
slideDownAndFade: {
|
|
93
|
+
from: { opacity: 0, transform: 'translateY(-2px)' },
|
|
94
|
+
to: { opacity: 1, transform: 'translateY(0)' },
|
|
95
|
+
},
|
|
96
|
+
slideLeftAndFade: {
|
|
97
|
+
from: { opacity: 0, transform: 'translateX(2px)' },
|
|
98
|
+
to: { opacity: 1, transform: 'translateX(0)' },
|
|
99
|
+
},
|
|
100
|
+
slideUpAndFade: {
|
|
101
|
+
from: { opacity: 0, transform: 'translateY(2px)' },
|
|
102
|
+
to: { opacity: 1, transform: 'translateY(0)' },
|
|
103
|
+
},
|
|
104
|
+
slideRightAndFade: {
|
|
105
|
+
from: { opacity: 0, transform: 'translateX(-2px)' },
|
|
106
|
+
to: { opacity: 1, transform: 'translateX(0)' },
|
|
107
|
+
},
|
|
108
|
+
fadeIn: {
|
|
109
|
+
from: { opacity: 0 },
|
|
110
|
+
to: { opacity: 1 },
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
// Accordion
|
|
114
|
+
slideDown: {
|
|
115
|
+
from: { height: '0px' },
|
|
116
|
+
to: { height: 'var(--radix-accordion-content-height)' },
|
|
117
|
+
},
|
|
118
|
+
slideUp: {
|
|
119
|
+
from: { height: 'var(--radix-accordion-content-height)' },
|
|
120
|
+
to: { height: '0px' },
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
// Toast
|
|
124
|
+
'toast-hide': {
|
|
125
|
+
'0%': { opacity: '1' },
|
|
126
|
+
'100%': { opacity: '0' },
|
|
127
|
+
},
|
|
128
|
+
'toast-slide-in-right': {
|
|
129
|
+
'0%': { transform: 'translateX(calc(100% + 1rem))' },
|
|
130
|
+
'100%': { transform: 'translateX(0)' },
|
|
131
|
+
},
|
|
132
|
+
'toast-slide-in-bottom': {
|
|
133
|
+
'0%': { transform: 'translateY(calc(100% + 1rem))' },
|
|
134
|
+
'100%': { transform: 'translateY(0)' },
|
|
135
|
+
},
|
|
136
|
+
'toast-swipe-out': {
|
|
137
|
+
'0%': {
|
|
138
|
+
transform: 'translateX(var(--radix-toast-swipe-end-x))',
|
|
139
|
+
},
|
|
140
|
+
'100%': {
|
|
141
|
+
transform: 'translateX(calc(100% + 1rem))',
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
// Shimmer
|
|
146
|
+
'shimmer-loop': {
|
|
147
|
+
'100%': {
|
|
148
|
+
transform: 'translateX(100%)',
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
'halo-pulse': {
|
|
153
|
+
'0%': {
|
|
154
|
+
opacity: 0.3,
|
|
155
|
+
},
|
|
156
|
+
'5%': {
|
|
157
|
+
opacity: 1,
|
|
158
|
+
},
|
|
159
|
+
'100%': {
|
|
160
|
+
opacity: 0.3,
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
'progress-indeterminate': {
|
|
165
|
+
'0%': {
|
|
166
|
+
left: 0,
|
|
167
|
+
width: '0%',
|
|
168
|
+
},
|
|
169
|
+
'25%': {
|
|
170
|
+
left: '25%',
|
|
171
|
+
width: '50%',
|
|
172
|
+
},
|
|
173
|
+
'75%': {
|
|
174
|
+
left: '50%',
|
|
175
|
+
width: '100%',
|
|
176
|
+
},
|
|
177
|
+
'100%': {
|
|
178
|
+
left: '100%',
|
|
179
|
+
width: '0%',
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
// Border trail
|
|
184
|
+
['trail']: {
|
|
185
|
+
to: { 'offset-distance': '100%' },
|
|
186
|
+
},
|
|
187
|
+
['trail-offset']: {
|
|
188
|
+
'0%': { 'offset-distance': '50%' },
|
|
189
|
+
'100%': { 'offset-distance': '150%' },
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
animation: {
|
|
193
|
+
['fade-in']: 'fadeIn 100ms ease-in forwards',
|
|
194
|
+
|
|
195
|
+
// Border trail
|
|
196
|
+
['trail']: 'trail 6s linear infinite',
|
|
197
|
+
['trail-offset']: 'trail-offset 6s linear infinite',
|
|
198
|
+
|
|
199
|
+
// Popper chrome
|
|
200
|
+
['slideDownAndFade']: 'slideDownAndFade 400ms cubic-bezier(0.16, 1, 0.3, 1)',
|
|
201
|
+
['slideLeftAndFade']: 'slideLeftAndFade 400ms cubic-bezier(0.16, 1, 0.3, 1)',
|
|
202
|
+
['slideUpAndFade']: 'slideUpAndFade 400ms cubic-bezier(0.16, 1, 0.3, 1)',
|
|
203
|
+
['slideRightAndFade']: 'slideRightAndFade 400ms cubic-bezier(0.16, 1, 0.3, 1)',
|
|
204
|
+
|
|
205
|
+
// Toast
|
|
206
|
+
['toast-hide']: 'toast-hide 100ms ease-in forwards',
|
|
207
|
+
['toast-slide-in-right']: 'toast-slide-in-right 150ms cubic-bezier(0.16, 1, 0.3, 1)',
|
|
208
|
+
['toast-slide-in-bottom']: 'toast-slide-in-bottom 150ms cubic-bezier(0.16, 1, 0.3, 1)',
|
|
209
|
+
['toast-swipe-out']: 'toast-swipe-out 100ms ease-out forwards',
|
|
210
|
+
|
|
211
|
+
// Accordion
|
|
212
|
+
['slideDown']: 'slideDown 300ms cubic-bezier(0.87, 0, 0.13, 1)',
|
|
213
|
+
['slideUp']: 'slideUp 300ms cubic-bezier(0.87, 0, 0.13, 1)',
|
|
214
|
+
|
|
215
|
+
['spin']: 'spin 1.5s linear infinite',
|
|
216
|
+
['spin-slow']: 'spin 3s linear infinite',
|
|
217
|
+
|
|
218
|
+
['shimmer']: 'shimmer-loop 2s infinite',
|
|
219
|
+
['halo-pulse']: 'halo-pulse 2s ease-out infinite',
|
|
220
|
+
['progress-indeterminate']: 'progress-indeterminate 2s ease-out infinite',
|
|
221
|
+
['progress-linear']: 'progress-linear 2s ease-out infinite',
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
extendTokens,
|
|
225
|
+
...extensions,
|
|
226
|
+
),
|
|
227
|
+
...overrideTokens,
|
|
228
|
+
colors: {
|
|
229
|
+
...overrideTokens.colors,
|
|
230
|
+
inherit: 'inherit',
|
|
231
|
+
current: 'currentColor',
|
|
232
|
+
transparent: 'transparent',
|
|
233
|
+
black: 'black',
|
|
234
|
+
white: 'white',
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
plugins: [
|
|
238
|
+
tailwindcssContainerQueries,
|
|
239
|
+
tailwindcssForms,
|
|
240
|
+
tailwindcssLogical,
|
|
241
|
+
tailwindcssRadix(),
|
|
242
|
+
// https://adoxography.github.io/tailwind-scrollbar/utilities
|
|
243
|
+
tailwindScrollbar,
|
|
244
|
+
],
|
|
245
|
+
...(env === 'development' && { mode: 'jit' }),
|
|
246
|
+
content,
|
|
247
|
+
future: {
|
|
248
|
+
hoverOnlyWhenSupported: true,
|
|
249
|
+
},
|
|
250
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type AliasLayer } from '@ch-ui/tokens';
|
|
6
|
+
|
|
7
|
+
import { valenceAliases } from './sememes-hue';
|
|
8
|
+
import { sheetAliases } from './sememes-sheet';
|
|
9
|
+
import { systemAliases } from './sememes-system';
|
|
10
|
+
|
|
11
|
+
const groupAliases = ['groupSurface', ...(systemAliases.groupSurface?.root ?? [])];
|
|
12
|
+
const modalAliases = ['modalSurface', ...(systemAliases.modalSurface?.root ?? [])];
|
|
13
|
+
|
|
14
|
+
export const aliasColors = {
|
|
15
|
+
conditions: {
|
|
16
|
+
root: [':root, .dark'],
|
|
17
|
+
group: [
|
|
18
|
+
[
|
|
19
|
+
'.sidebar-surface, .dark .sidebar-surface',
|
|
20
|
+
...groupAliases.map((alias) => `.bg-${alias}, .dark .bg-${alias}`),
|
|
21
|
+
].join(', '),
|
|
22
|
+
],
|
|
23
|
+
modal: [
|
|
24
|
+
[
|
|
25
|
+
'.modal-surface, .dark .modal-surface',
|
|
26
|
+
...modalAliases.map((alias) => `.bg-${alias}, .dark .bg-${alias}`),
|
|
27
|
+
//
|
|
28
|
+
].join(', '),
|
|
29
|
+
],
|
|
30
|
+
gridFocusStack: ['[data-grid-focus-indicator-variant="stack"]'],
|
|
31
|
+
},
|
|
32
|
+
aliases: {
|
|
33
|
+
// TODO(thure): Aliases should be merged more elegantly, this causes overwrites.
|
|
34
|
+
...sheetAliases,
|
|
35
|
+
...systemAliases,
|
|
36
|
+
...valenceAliases,
|
|
37
|
+
},
|
|
38
|
+
namespace: 'dx-',
|
|
39
|
+
} satisfies AliasLayer<string>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type TailwindAdapterConfig } from '@ch-ui/tailwind-tokens';
|
|
6
|
+
import adapter from '@ch-ui/tailwind-tokens';
|
|
7
|
+
import { type TokenSet } from '@ch-ui/tokens';
|
|
8
|
+
|
|
9
|
+
import { aliasColors } from './alias-colors';
|
|
10
|
+
import { lengthsFacet, maxSizesFacet } from './lengths';
|
|
11
|
+
import { huePalettes, physicalColors } from './physical-colors';
|
|
12
|
+
import { semanticColors } from './semantic-colors';
|
|
13
|
+
import { systemAliases, systemSememes } from './sememes-system';
|
|
14
|
+
|
|
15
|
+
export * from './sizes';
|
|
16
|
+
|
|
17
|
+
export const hues = Object.keys(huePalettes);
|
|
18
|
+
|
|
19
|
+
export const tokenSet = {
|
|
20
|
+
colors: {
|
|
21
|
+
physical: physicalColors,
|
|
22
|
+
semantic: semanticColors,
|
|
23
|
+
alias: aliasColors,
|
|
24
|
+
},
|
|
25
|
+
lengths: lengthsFacet,
|
|
26
|
+
maxSizes: maxSizesFacet,
|
|
27
|
+
} satisfies TokenSet;
|
|
28
|
+
|
|
29
|
+
const adapterConfig: TailwindAdapterConfig = {
|
|
30
|
+
colors: {
|
|
31
|
+
facet: 'colors',
|
|
32
|
+
disposition: 'overwrite',
|
|
33
|
+
tokenization: 'recursive',
|
|
34
|
+
},
|
|
35
|
+
borderWidth: {
|
|
36
|
+
facet: 'lengths',
|
|
37
|
+
disposition: 'extend',
|
|
38
|
+
tokenization: 'omit-series',
|
|
39
|
+
},
|
|
40
|
+
ringWidth: {
|
|
41
|
+
facet: 'lengths',
|
|
42
|
+
disposition: 'extend',
|
|
43
|
+
tokenization: 'omit-series',
|
|
44
|
+
},
|
|
45
|
+
ringOffsetWidth: {
|
|
46
|
+
facet: 'lengths',
|
|
47
|
+
disposition: 'extend',
|
|
48
|
+
tokenization: 'omit-series',
|
|
49
|
+
},
|
|
50
|
+
outlineWidth: {
|
|
51
|
+
facet: 'lengths',
|
|
52
|
+
disposition: 'extend',
|
|
53
|
+
tokenization: 'omit-series',
|
|
54
|
+
},
|
|
55
|
+
spacing: {
|
|
56
|
+
facet: 'lengths',
|
|
57
|
+
disposition: 'extend',
|
|
58
|
+
tokenization: 'keep-series',
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const userDefaultTokenSet = {
|
|
63
|
+
colors: {
|
|
64
|
+
physical: {
|
|
65
|
+
definitions: {
|
|
66
|
+
series: {
|
|
67
|
+
neutral: physicalColors.definitions!.series!.neutral,
|
|
68
|
+
primary: physicalColors.definitions!.series!.primary,
|
|
69
|
+
},
|
|
70
|
+
accompanyingSeries: physicalColors.definitions!.accompanyingSeries,
|
|
71
|
+
},
|
|
72
|
+
conditions: physicalColors.conditions,
|
|
73
|
+
series: {
|
|
74
|
+
neutral: physicalColors.series.neutral,
|
|
75
|
+
primary: physicalColors.series.primary,
|
|
76
|
+
},
|
|
77
|
+
namespace: physicalColors.namespace,
|
|
78
|
+
},
|
|
79
|
+
semantic: {
|
|
80
|
+
conditions: semanticColors.conditions,
|
|
81
|
+
sememes: systemSememes,
|
|
82
|
+
namespace: semanticColors.namespace,
|
|
83
|
+
},
|
|
84
|
+
alias: {
|
|
85
|
+
conditions: aliasColors.conditions,
|
|
86
|
+
aliases: systemAliases,
|
|
87
|
+
namespace: aliasColors.namespace,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
} satisfies TokenSet;
|
|
91
|
+
|
|
92
|
+
export const tokensTailwindConfig = adapter(tokenSet, adapterConfig);
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
//
|
|
2
|
+
|
|
3
|
+
// Copyright 2025 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
import { type Facet, type LinearPhysicalLayer } from '@ch-ui/tokens';
|
|
7
|
+
|
|
8
|
+
import { cardDefaultInlineSize, cardMaxInlineSize, cardMinInlineSize } from './sizes';
|
|
9
|
+
|
|
10
|
+
export const lengthsFacet = {
|
|
11
|
+
physical: {
|
|
12
|
+
namespace: 'dx-',
|
|
13
|
+
conditions: { root: [':root'] },
|
|
14
|
+
series: {
|
|
15
|
+
line: {
|
|
16
|
+
root: {
|
|
17
|
+
unit: 'px',
|
|
18
|
+
initial: 0,
|
|
19
|
+
slope: 1,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
// "gap"
|
|
23
|
+
lacuna: {
|
|
24
|
+
root: {
|
|
25
|
+
unit: 'rem',
|
|
26
|
+
initial: 0,
|
|
27
|
+
slope: 0.125,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
} satisfies LinearPhysicalLayer,
|
|
32
|
+
|
|
33
|
+
semantic: {
|
|
34
|
+
namespace: 'dx-',
|
|
35
|
+
conditions: { root: [':root'] },
|
|
36
|
+
sememes: {
|
|
37
|
+
noLine: { root: ['line', 0] },
|
|
38
|
+
hairLine: { root: ['line', 1] },
|
|
39
|
+
thickLine: { root: ['line', 2] },
|
|
40
|
+
trimXs: { root: ['lacuna', 3] },
|
|
41
|
+
trimSm: { root: ['lacuna', 4] },
|
|
42
|
+
trimMd: { root: ['lacuna', 6] },
|
|
43
|
+
trimLg: { root: ['lacuna', 12] },
|
|
44
|
+
inputFine: { root: ['lacuna', 3] },
|
|
45
|
+
inputCoarse: { root: ['lacuna', 4] },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
alias: {
|
|
50
|
+
namespace: 'dx-',
|
|
51
|
+
conditions: {
|
|
52
|
+
fine: [':root, .density-fine'],
|
|
53
|
+
coarse: ['.density-coarse'],
|
|
54
|
+
flush: ['.density-flush'],
|
|
55
|
+
gridFocusStack: ['[data-grid-focus-indicator-variant="stack"]'],
|
|
56
|
+
},
|
|
57
|
+
aliases: {
|
|
58
|
+
noLine: { fine: ['focusOffset'] },
|
|
59
|
+
hairLine: { fine: ['modalLine', 'landmarkLine', 'positionedLine', 'gridGap', 'gridFocusIndicatorWidth'] },
|
|
60
|
+
thickLine: { fine: ['focusLine'], gridFocusStack: ['gridFocusIndicatorWidth'] },
|
|
61
|
+
trimXs: { fine: ['cardSpacingChrome', 'labelSpacingBlock', 'inputSpacingBlock'] }, // TODO(burdon): Remove need for this.
|
|
62
|
+
trimSm: { fine: ['cardSpacingInline', 'cardSpacingBlock', 'cardSpacingGap'] },
|
|
63
|
+
trimMd: { coarse: ['cardSpacingInline', 'cardSpacingBlock', 'cardSpacingGap'] },
|
|
64
|
+
inputFine: { fine: ['iconButtonPadding'] },
|
|
65
|
+
inputCoarse: { coarse: ['iconButtonPadding'] },
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
} satisfies Facet;
|
|
69
|
+
|
|
70
|
+
export const maxSizesFacet = {
|
|
71
|
+
physical: {
|
|
72
|
+
namespace: 'dx-',
|
|
73
|
+
conditions: { root: [':root'] },
|
|
74
|
+
series: {
|
|
75
|
+
size: {
|
|
76
|
+
root: {
|
|
77
|
+
unit: 'rem',
|
|
78
|
+
initial: 0,
|
|
79
|
+
slope: 1,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
} satisfies LinearPhysicalLayer,
|
|
84
|
+
|
|
85
|
+
semantic: {
|
|
86
|
+
namespace: 'dx-',
|
|
87
|
+
conditions: { root: [':root'] },
|
|
88
|
+
sememes: {
|
|
89
|
+
prose: { root: ['size', 50] },
|
|
90
|
+
containerMaxWidth: { root: ['size', 50] },
|
|
91
|
+
popoverMaxWidth: { root: ['size', cardDefaultInlineSize] },
|
|
92
|
+
cardDefaultWidth: { root: ['size', cardDefaultInlineSize] },
|
|
93
|
+
cardMinWidth: { root: ['size', cardMinInlineSize] },
|
|
94
|
+
cardMaxWidth: { root: ['size', cardMaxInlineSize] },
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
} satisfies Facet;
|