@ohos-ports/dxos-react-ui-theme 0.8.3-beta.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/README.yml +1 -0
- package/dist/lib/browser/index.mjs +3199 -0
- package/dist/lib/browser/index.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -0
- package/dist/plugin/node/chunk-3IKFINB6.cjs +1500 -0
- package/dist/plugin/node/chunk-3IKFINB6.cjs.map +7 -0
- package/dist/plugin/node/chunk-QA5KMUXP.cjs +70 -0
- package/dist/plugin/node/chunk-QA5KMUXP.cjs.map +7 -0
- package/dist/plugin/node/config/tailwind.cjs +29 -0
- package/dist/plugin/node/config/tailwind.cjs.map +7 -0
- package/dist/plugin/node/meta.json +1 -0
- package/dist/plugin/node/plugins/esbuild-plugin.cjs +90 -0
- package/dist/plugin/node/plugins/esbuild-plugin.cjs.map +7 -0
- package/dist/plugin/node/plugins/plugin.cjs +123 -0
- package/dist/plugin/node/plugins/plugin.cjs.map +7 -0
- package/dist/plugin/node/theme.css +1223 -0
- package/dist/plugin/node/theme.css.map +7 -0
- package/dist/plugin/node-esm/chunk-LNTZCFPD.mjs +1493 -0
- package/dist/plugin/node-esm/chunk-LNTZCFPD.mjs.map +7 -0
- package/dist/plugin/node-esm/chunk-TFKSVC5U.mjs +50 -0
- package/dist/plugin/node-esm/chunk-TFKSVC5U.mjs.map +7 -0
- package/dist/plugin/node-esm/config/tailwind.mjs +8 -0
- package/dist/plugin/node-esm/config/tailwind.mjs.map +7 -0
- package/dist/plugin/node-esm/meta.json +1 -0
- package/dist/plugin/node-esm/plugins/esbuild-plugin.mjs +63 -0
- package/dist/plugin/node-esm/plugins/esbuild-plugin.mjs.map +7 -0
- package/dist/plugin/node-esm/plugins/plugin.mjs +97 -0
- package/dist/plugin/node-esm/plugins/plugin.mjs.map +7 -0
- package/dist/plugin/node-esm/theme.css +1223 -0
- package/dist/plugin/node-esm/theme.css.map +7 -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/tailwind.d.ts +9 -0
- package/dist/types/src/config/tailwind.d.ts.map +1 -0
- package/dist/types/src/config/tokens/Tokens.stories.d.ts +7 -0
- package/dist/types/src/config/tokens/Tokens.stories.d.ts.map +1 -0
- package/dist/types/src/config/tokens/alias-colors.d.ts +14 -0
- package/dist/types/src/config/tokens/alias-colors.d.ts.map +1 -0
- package/dist/types/src/config/tokens/index.d.ts +438 -0
- package/dist/types/src/config/tokens/index.d.ts.map +1 -0
- package/dist/types/src/config/tokens/lengths.d.ts +116 -0
- package/dist/types/src/config/tokens/lengths.d.ts.map +1 -0
- package/dist/types/src/config/tokens/physical-colors.d.ts +23 -0
- package/dist/types/src/config/tokens/physical-colors.d.ts.map +1 -0
- package/dist/types/src/config/tokens/semantic-colors.d.ts +179 -0
- package/dist/types/src/config/tokens/semantic-colors.d.ts.map +1 -0
- package/dist/types/src/config/tokens/sememes-calls.d.ts +3 -0
- package/dist/types/src/config/tokens/sememes-calls.d.ts.map +1 -0
- package/dist/types/src/config/tokens/sememes-codemirror.d.ts +43 -0
- package/dist/types/src/config/tokens/sememes-codemirror.d.ts.map +1 -0
- package/dist/types/src/config/tokens/sememes-hue.d.ts +4 -0
- package/dist/types/src/config/tokens/sememes-hue.d.ts.map +1 -0
- package/dist/types/src/config/tokens/sememes-sheet.d.ts +52 -0
- package/dist/types/src/config/tokens/sememes-sheet.d.ts.map +1 -0
- package/dist/types/src/config/tokens/sememes-system.d.ts +91 -0
- package/dist/types/src/config/tokens/sememes-system.d.ts.map +1 -0
- package/dist/types/src/config/tokens/types.d.ts +5 -0
- package/dist/types/src/config/tokens/types.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +8 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/plugins/esbuild-plugin.d.ts +9 -0
- package/dist/types/src/plugins/esbuild-plugin.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin.d.ts +17 -0
- package/dist/types/src/plugins/plugin.d.ts.map +1 -0
- package/dist/types/src/plugins/resolveContent.d.ts +2 -0
- package/dist/types/src/plugins/resolveContent.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/icon-button.d.ts +5 -0
- package/dist/types/src/styles/components/icon-button.d.ts.map +1 -0
- package/dist/types/src/styles/components/icon.d.ts +7 -0
- package/dist/types/src/styles/components/icon.d.ts.map +1 -0
- package/dist/types/src/styles/components/index.d.ts +24 -0
- package/dist/types/src/styles/components/index.d.ts.map +1 -0
- package/dist/types/src/styles/components/input.d.ts +111 -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 +28 -0
- package/dist/types/src/styles/components/main.d.ts.map +1 -0
- package/dist/types/src/styles/components/menu.d.ts +13 -0
- package/dist/types/src/styles/components/menu.d.ts.map +1 -0
- package/dist/types/src/styles/components/message.d.ts +11 -0
- package/dist/types/src/styles/components/message.d.ts.map +1 -0
- package/dist/types/src/styles/components/popover.d.ts +11 -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 +14 -0
- package/dist/types/src/styles/components/select.d.ts.map +1 -0
- package/dist/types/src/styles/components/separator.d.ts +8 -0
- package/dist/types/src/styles/components/separator.d.ts.map +1 -0
- package/dist/types/src/styles/components/status.d.ts +9 -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 +8 -0
- package/dist/types/src/styles/components/toolbar.d.ts.map +1 -0
- package/dist/types/src/styles/components/tooltip.d.ts +8 -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/density.d.ts +13 -0
- package/dist/types/src/styles/fragments/density.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/dimension.d.ts +5 -0
- package/dist/types/src/styles/fragments/dimension.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 +15 -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 +16 -0
- package/dist/types/src/styles/fragments/hover.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/index.d.ts +17 -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 +2 -0
- package/dist/types/src/styles/fragments/motion.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/ornament.d.ts +5 -0
- package/dist/types/src/styles/fragments/ornament.d.ts.map +1 -0
- package/dist/types/src/styles/fragments/selected.d.ts +13 -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 +7 -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/types.d.ts +3 -0
- package/dist/types/src/types.d.ts.map +1 -0
- package/dist/types/src/util/hash.d.ts +8 -0
- package/dist/types/src/util/hash.d.ts.map +1 -0
- package/dist/types/src/util/index.d.ts +3 -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/withLogical.d.ts +164 -0
- package/dist/types/src/util/withLogical.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +58 -0
- package/plugin.d.ts +7 -0
- package/plugin.js +10 -0
- package/src/config/index.ts +6 -0
- package/src/config/tailwind.ts +236 -0
- package/src/config/tokens/Tokens.stories.tsx +94 -0
- package/src/config/tokens/alias-colors.ts +38 -0
- package/src/config/tokens/index.ts +90 -0
- package/src/config/tokens/lengths.ts +87 -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 +60 -0
- package/src/config/tokens/sememes-system.ts +255 -0
- package/src/config/tokens/types.ts +9 -0
- package/src/index.ts +15 -0
- package/src/plugins/esbuild-plugin.ts +60 -0
- package/src/plugins/plugin.ts +127 -0
- package/src/plugins/resolveContent.ts +55 -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 +17 -0
- package/src/styles/components/icon.ts +19 -0
- package/src/styles/components/index.ts +27 -0
- package/src/styles/components/input.ts +176 -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 +42 -0
- package/src/styles/components/select.ts +64 -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 +20 -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 +24 -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 +13 -0
- package/src/styles/fragments/valence.ts +48 -0
- package/src/styles/index.ts +7 -0
- package/src/styles/layers/anchored-overflow.css +9 -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 +129 -0
- package/src/styles/layers/hues.css +110 -0
- package/src/styles/layers/index.css +21 -0
- package/src/styles/layers/main.css +162 -0
- package/src/styles/layers/native.css +14 -0
- package/src/styles/layers/positioning.css +23 -0
- package/src/styles/layers/size.css +299 -0
- package/src/styles/layers/surfaces.css +31 -0
- package/src/styles/layers/tag.css +123 -0
- package/src/styles/layers/tldraw.css +91 -0
- package/src/styles/layers/tokens.css +44 -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 +5 -0
- package/src/types.ts +7 -0
- package/src/typings.d.ts +8 -0
- package/src/util/hash.ts +39 -0
- package/src/util/index.ts +6 -0
- package/src/util/mx.ts +34 -0
- package/src/util/withLogical.ts +114 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2022 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import tailwindContainers 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
|
+
popoverMaxWidth: 'var(--dx-popoverMaxWidth)',
|
|
43
|
+
},
|
|
44
|
+
borderRadius: {
|
|
45
|
+
none: '0',
|
|
46
|
+
sm: '0.25rem',
|
|
47
|
+
DEFAULT: '0.5rem',
|
|
48
|
+
md: '.75rem',
|
|
49
|
+
lg: '1rem',
|
|
50
|
+
},
|
|
51
|
+
screens: {
|
|
52
|
+
'pointer-fine': { raw: '(pointer: fine)' },
|
|
53
|
+
'hover-hover': { raw: '(hover: hover)' },
|
|
54
|
+
},
|
|
55
|
+
fontSize: {
|
|
56
|
+
// Base size 16px
|
|
57
|
+
// Scale 1.125
|
|
58
|
+
xs: ['0.790rem', { lineHeight: '1rem' }],
|
|
59
|
+
sm: ['0.889rem', { lineHeight: '1.25rem' }],
|
|
60
|
+
base: ['1rem', { lineHeight: '1.5rem' }],
|
|
61
|
+
lg: ['1.125rem', { lineHeight: '1.75rem' }],
|
|
62
|
+
xl: ['1.266rem', { lineHeight: '1.75rem' }],
|
|
63
|
+
'2xl': ['1.424rem', { lineHeight: '2rem' }],
|
|
64
|
+
'3xl': ['1.602rem', { lineHeight: '2.25rem' }],
|
|
65
|
+
'4xl': ['1.802rem', { lineHeight: '2.5rem' }],
|
|
66
|
+
'5xl': ['2.027rem', { lineHeight: '2.5rem' }],
|
|
67
|
+
'6xl': ['2.281rem', { lineHeight: '2.5rem' }],
|
|
68
|
+
'7xl': ['2.566rem', { lineHeight: '2.75rem' }],
|
|
69
|
+
'8xl': ['2.887rem', { lineHeight: '3rem' }],
|
|
70
|
+
'9xl': ['3.247rem', { lineHeight: '3.25rem' }],
|
|
71
|
+
},
|
|
72
|
+
boxShadow: {
|
|
73
|
+
slider: '0 0 0 5px rgba(0, 0, 0, 0.3)',
|
|
74
|
+
},
|
|
75
|
+
transitionProperty: {
|
|
76
|
+
'max-height': 'max-height',
|
|
77
|
+
},
|
|
78
|
+
transitionTimingFunction: {
|
|
79
|
+
'in-out-symmetric': 'cubic-bezier(0.5,0,0.5,1)',
|
|
80
|
+
},
|
|
81
|
+
keyframes: {
|
|
82
|
+
// Popper chrome
|
|
83
|
+
slideDownAndFade: {
|
|
84
|
+
from: { opacity: 0, transform: 'translateY(-2px)' },
|
|
85
|
+
to: { opacity: 1, transform: 'translateY(0)' },
|
|
86
|
+
},
|
|
87
|
+
slideLeftAndFade: {
|
|
88
|
+
from: { opacity: 0, transform: 'translateX(2px)' },
|
|
89
|
+
to: { opacity: 1, transform: 'translateX(0)' },
|
|
90
|
+
},
|
|
91
|
+
slideUpAndFade: {
|
|
92
|
+
from: { opacity: 0, transform: 'translateY(2px)' },
|
|
93
|
+
to: { opacity: 1, transform: 'translateY(0)' },
|
|
94
|
+
},
|
|
95
|
+
slideRightAndFade: {
|
|
96
|
+
from: { opacity: 0, transform: 'translateX(-2px)' },
|
|
97
|
+
to: { opacity: 1, transform: 'translateX(0)' },
|
|
98
|
+
},
|
|
99
|
+
fadeIn: {
|
|
100
|
+
from: { opacity: 0 },
|
|
101
|
+
to: { opacity: 1 },
|
|
102
|
+
},
|
|
103
|
+
// Accordion
|
|
104
|
+
slideDown: {
|
|
105
|
+
from: { height: '0px' },
|
|
106
|
+
to: { height: 'var(--radix-accordion-content-height)' },
|
|
107
|
+
},
|
|
108
|
+
slideUp: {
|
|
109
|
+
from: { height: 'var(--radix-accordion-content-height)' },
|
|
110
|
+
to: { height: '0px' },
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
// Toast
|
|
114
|
+
'toast-hide': {
|
|
115
|
+
'0%': { opacity: '1' },
|
|
116
|
+
'100%': { opacity: '0' },
|
|
117
|
+
},
|
|
118
|
+
'toast-slide-in-right': {
|
|
119
|
+
'0%': { transform: 'translateX(calc(100% + 1rem))' },
|
|
120
|
+
'100%': { transform: 'translateX(0)' },
|
|
121
|
+
},
|
|
122
|
+
'toast-slide-in-bottom': {
|
|
123
|
+
'0%': { transform: 'translateY(calc(100% + 1rem))' },
|
|
124
|
+
'100%': { transform: 'translateY(0)' },
|
|
125
|
+
},
|
|
126
|
+
'toast-swipe-out': {
|
|
127
|
+
'0%': {
|
|
128
|
+
transform: 'translateX(var(--radix-toast-swipe-end-x))',
|
|
129
|
+
},
|
|
130
|
+
'100%': {
|
|
131
|
+
transform: 'translateX(calc(100% + 1rem))',
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
// Shimmer
|
|
136
|
+
'shimmer-loop': {
|
|
137
|
+
'100%': {
|
|
138
|
+
transform: 'translateX(100%)',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
'halo-pulse': {
|
|
143
|
+
'0%': {
|
|
144
|
+
opacity: 0.3,
|
|
145
|
+
},
|
|
146
|
+
'5%': {
|
|
147
|
+
opacity: 1,
|
|
148
|
+
},
|
|
149
|
+
'100%': {
|
|
150
|
+
opacity: 0.3,
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
'progress-indeterminate': {
|
|
155
|
+
'0%': {
|
|
156
|
+
left: 0,
|
|
157
|
+
width: '0%',
|
|
158
|
+
},
|
|
159
|
+
'25%': {
|
|
160
|
+
left: '25%',
|
|
161
|
+
width: '50%',
|
|
162
|
+
},
|
|
163
|
+
'75%': {
|
|
164
|
+
left: '50%',
|
|
165
|
+
width: '100%',
|
|
166
|
+
},
|
|
167
|
+
'100%': {
|
|
168
|
+
left: '100%',
|
|
169
|
+
width: '0%',
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
'progress-linear': {
|
|
174
|
+
'0%': {
|
|
175
|
+
transform: 'translateX(-100%)',
|
|
176
|
+
},
|
|
177
|
+
'85%, 100%': {
|
|
178
|
+
transform: `translateX(${(100 / 28) * 100}%)`,
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
animation: {
|
|
183
|
+
'fade-in': 'fadeIn 100ms ease-in forwards',
|
|
184
|
+
|
|
185
|
+
// Popper chrome
|
|
186
|
+
slideDownAndFade: 'slideDownAndFade 400ms cubic-bezier(0.16, 1, 0.3, 1)',
|
|
187
|
+
slideLeftAndFade: 'slideLeftAndFade 400ms cubic-bezier(0.16, 1, 0.3, 1)',
|
|
188
|
+
slideUpAndFade: 'slideUpAndFade 400ms cubic-bezier(0.16, 1, 0.3, 1)',
|
|
189
|
+
slideRightAndFade: 'slideRightAndFade 400ms cubic-bezier(0.16, 1, 0.3, 1)',
|
|
190
|
+
|
|
191
|
+
// Toast
|
|
192
|
+
'toast-hide': 'toast-hide 100ms ease-in forwards',
|
|
193
|
+
'toast-slide-in-right': 'toast-slide-in-right 150ms cubic-bezier(0.16, 1, 0.3, 1)',
|
|
194
|
+
'toast-slide-in-bottom': 'toast-slide-in-bottom 150ms cubic-bezier(0.16, 1, 0.3, 1)',
|
|
195
|
+
'toast-swipe-out': 'toast-swipe-out 100ms ease-out forwards',
|
|
196
|
+
|
|
197
|
+
// Accordion
|
|
198
|
+
slideDown: 'slideDown 300ms cubic-bezier(0.87, 0, 0.13, 1)',
|
|
199
|
+
slideUp: 'slideUp 300ms cubic-bezier(0.87, 0, 0.13, 1)',
|
|
200
|
+
|
|
201
|
+
spin: 'spin 1.5s linear infinite',
|
|
202
|
+
'spin-slow': 'spin 3s linear infinite',
|
|
203
|
+
|
|
204
|
+
shimmer: 'shimmer-loop 2s infinite',
|
|
205
|
+
'halo-pulse': 'halo-pulse 2s ease-out infinite',
|
|
206
|
+
'progress-indeterminate': 'progress-indeterminate 2s ease-out infinite',
|
|
207
|
+
'progress-linear': 'progress-linear 2s ease-out infinite',
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
extendTokens,
|
|
211
|
+
...extensions,
|
|
212
|
+
),
|
|
213
|
+
...overrideTokens,
|
|
214
|
+
colors: {
|
|
215
|
+
...overrideTokens.colors,
|
|
216
|
+
inherit: 'inherit',
|
|
217
|
+
current: 'currentColor',
|
|
218
|
+
transparent: 'transparent',
|
|
219
|
+
black: 'black',
|
|
220
|
+
white: 'white',
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
plugins: [
|
|
224
|
+
tailwindcssLogical,
|
|
225
|
+
tailwindcssForms,
|
|
226
|
+
tailwindcssRadix(),
|
|
227
|
+
tailwindContainers,
|
|
228
|
+
// https://adoxography.github.io/tailwind-scrollbar/utilities
|
|
229
|
+
tailwindScrollbar,
|
|
230
|
+
],
|
|
231
|
+
...(env === 'development' && { mode: 'jit' }),
|
|
232
|
+
content,
|
|
233
|
+
future: {
|
|
234
|
+
hoverOnlyWhenSupported: true,
|
|
235
|
+
},
|
|
236
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
import { auditFacet, type HelicalArcSeries, type TokenAudit, parseAlphaLuminosity } from '@ch-ui/tokens';
|
|
7
|
+
import { type Meta } from '@storybook/react';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
import { tokenSet } from './index';
|
|
11
|
+
|
|
12
|
+
const colorAudit = auditFacet(tokenSet.colors, { condition: 'p3' });
|
|
13
|
+
|
|
14
|
+
const Swatch = ({ variableName, value, semantic, physical }: TokenAudit<HelicalArcSeries>) => {
|
|
15
|
+
const [luminosity, alpha] = parseAlphaLuminosity(value);
|
|
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 meta: Meta = {
|
|
40
|
+
title: 'ui/react-ui-theme/Tokens',
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default meta;
|
|
44
|
+
|
|
45
|
+
export const Tokens = () => {
|
|
46
|
+
if (typeof colorAudit === 'string') {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return (
|
|
50
|
+
<>
|
|
51
|
+
<style>{`html{
|
|
52
|
+
background-color: #888;
|
|
53
|
+
background-image: linear-gradient(45deg, #777 25%, transparent 25%, transparent 75%, #777 75%, #777),
|
|
54
|
+
linear-gradient(45deg, #777 25%, transparent 25%, transparent 75%, #777 75%, #777);
|
|
55
|
+
background-size: 32px 32px;
|
|
56
|
+
background-position: 0 0, 16px 16px;
|
|
57
|
+
}`}</style>
|
|
58
|
+
<div className='flex'>
|
|
59
|
+
<div className='p-2 bg-baseSurface rounded'>
|
|
60
|
+
<h1 className='text-lg mbe-2'>Physical color token audit</h1>
|
|
61
|
+
<pre className='text-xs'>
|
|
62
|
+
Luminosity (/ alpha)?
|
|
63
|
+
<br />
|
|
64
|
+
value // (whether added directly as a physical value)
|
|
65
|
+
<br />
|
|
66
|
+
naming // (whether added as a named physical value)
|
|
67
|
+
<br />
|
|
68
|
+
...`semantic token name / theme`[]
|
|
69
|
+
</pre>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
{Object.entries(colorAudit).map(([seriesId, audits]) => {
|
|
73
|
+
return (
|
|
74
|
+
<>
|
|
75
|
+
<h2 className='mbs-12 mbe-4'>
|
|
76
|
+
<span className='pli-2 plb-1 bg-baseSurface rounded'>{seriesId}</span>
|
|
77
|
+
</h2>
|
|
78
|
+
<dl className='flex flex-wrap gap-2'>
|
|
79
|
+
{audits
|
|
80
|
+
.sort((a, b) => {
|
|
81
|
+
const [aL, aA] = parseAlphaLuminosity(a.value);
|
|
82
|
+
const [bL, bA] = parseAlphaLuminosity(b.value);
|
|
83
|
+
return aL - bL - (Number.isFinite(aA) && Number.isFinite(bA) ? aA! - bA! : 0);
|
|
84
|
+
})
|
|
85
|
+
.map((audit) => (
|
|
86
|
+
<Swatch key={audit.variableName} {...audit} />
|
|
87
|
+
))}
|
|
88
|
+
</dl>
|
|
89
|
+
</>
|
|
90
|
+
);
|
|
91
|
+
})}
|
|
92
|
+
</>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
},
|
|
31
|
+
aliases: {
|
|
32
|
+
// TODO(thure): Aliases should be merged more elegantly, this causes overwrites.
|
|
33
|
+
...sheetAliases,
|
|
34
|
+
...systemAliases,
|
|
35
|
+
...valenceAliases,
|
|
36
|
+
},
|
|
37
|
+
namespace: 'dx-',
|
|
38
|
+
} satisfies AliasLayer<string>;
|
|
@@ -0,0 +1,90 @@
|
|
|
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 const tokenSet = {
|
|
16
|
+
colors: {
|
|
17
|
+
physical: physicalColors,
|
|
18
|
+
semantic: semanticColors,
|
|
19
|
+
alias: aliasColors,
|
|
20
|
+
},
|
|
21
|
+
lengths: lengthsFacet,
|
|
22
|
+
maxSizes: maxSizesFacet,
|
|
23
|
+
} satisfies TokenSet;
|
|
24
|
+
|
|
25
|
+
export const hues = Object.keys(huePalettes);
|
|
26
|
+
|
|
27
|
+
const adapterConfig: TailwindAdapterConfig = {
|
|
28
|
+
colors: {
|
|
29
|
+
facet: 'colors',
|
|
30
|
+
disposition: 'overwrite',
|
|
31
|
+
tokenization: 'recursive',
|
|
32
|
+
},
|
|
33
|
+
borderWidth: {
|
|
34
|
+
facet: 'lengths',
|
|
35
|
+
disposition: 'extend',
|
|
36
|
+
tokenization: 'omit-series',
|
|
37
|
+
},
|
|
38
|
+
ringWidth: {
|
|
39
|
+
facet: 'lengths',
|
|
40
|
+
disposition: 'extend',
|
|
41
|
+
tokenization: 'omit-series',
|
|
42
|
+
},
|
|
43
|
+
ringOffsetWidth: {
|
|
44
|
+
facet: 'lengths',
|
|
45
|
+
disposition: 'extend',
|
|
46
|
+
tokenization: 'omit-series',
|
|
47
|
+
},
|
|
48
|
+
outlineWidth: {
|
|
49
|
+
facet: 'lengths',
|
|
50
|
+
disposition: 'extend',
|
|
51
|
+
tokenization: 'omit-series',
|
|
52
|
+
},
|
|
53
|
+
spacing: {
|
|
54
|
+
facet: 'lengths',
|
|
55
|
+
disposition: 'extend',
|
|
56
|
+
tokenization: 'keep-series',
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const userDefaultTokenSet = {
|
|
61
|
+
colors: {
|
|
62
|
+
physical: {
|
|
63
|
+
definitions: {
|
|
64
|
+
series: {
|
|
65
|
+
neutral: physicalColors.definitions!.series!.neutral,
|
|
66
|
+
primary: physicalColors.definitions!.series!.primary,
|
|
67
|
+
},
|
|
68
|
+
accompanyingSeries: physicalColors.definitions!.accompanyingSeries,
|
|
69
|
+
},
|
|
70
|
+
conditions: physicalColors.conditions,
|
|
71
|
+
series: {
|
|
72
|
+
neutral: physicalColors.series.neutral,
|
|
73
|
+
primary: physicalColors.series.primary,
|
|
74
|
+
},
|
|
75
|
+
namespace: physicalColors.namespace,
|
|
76
|
+
},
|
|
77
|
+
semantic: {
|
|
78
|
+
conditions: semanticColors.conditions,
|
|
79
|
+
sememes: systemSememes,
|
|
80
|
+
namespace: semanticColors.namespace,
|
|
81
|
+
},
|
|
82
|
+
alias: {
|
|
83
|
+
conditions: aliasColors.conditions,
|
|
84
|
+
aliases: systemAliases,
|
|
85
|
+
namespace: aliasColors.namespace,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
} satisfies TokenSet;
|
|
89
|
+
|
|
90
|
+
export const tokensTailwindConfig = adapter(tokenSet, adapterConfig);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
//
|
|
2
|
+
|
|
3
|
+
// Copyright 2025 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
import { type Facet, type LinearPhysicalLayer } from '@ch-ui/tokens';
|
|
7
|
+
|
|
8
|
+
export const lengthsFacet = {
|
|
9
|
+
physical: {
|
|
10
|
+
namespace: 'dx-',
|
|
11
|
+
conditions: { root: [':root'] },
|
|
12
|
+
series: {
|
|
13
|
+
line: {
|
|
14
|
+
root: {
|
|
15
|
+
unit: 'px',
|
|
16
|
+
initial: 0,
|
|
17
|
+
slope: 1,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
lacuna: {
|
|
21
|
+
root: {
|
|
22
|
+
unit: 'rem',
|
|
23
|
+
initial: 0,
|
|
24
|
+
slope: 0.125,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
} satisfies LinearPhysicalLayer,
|
|
29
|
+
|
|
30
|
+
semantic: {
|
|
31
|
+
namespace: 'dx-',
|
|
32
|
+
conditions: { root: [':root'] },
|
|
33
|
+
sememes: {
|
|
34
|
+
noLine: { root: ['line', 0] },
|
|
35
|
+
hairLine: { root: ['line', 1] },
|
|
36
|
+
thickLine: { root: ['line', 2] },
|
|
37
|
+
// TODO(burdon): Can/should these be hyphenated?
|
|
38
|
+
trimXs: { root: ['lacuna', 3] },
|
|
39
|
+
trimSm: { root: ['lacuna', 6] },
|
|
40
|
+
trimMd: { root: ['lacuna', 9] },
|
|
41
|
+
trimLg: { root: ['lacuna', 12] },
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
alias: {
|
|
46
|
+
namespace: 'dx-',
|
|
47
|
+
conditions: {
|
|
48
|
+
fine: [':root, .density-fine, [data-density="fine"]'],
|
|
49
|
+
coarse: ['.density-coarse, [data-density="coarse"]'],
|
|
50
|
+
flush: ['.density-flush, [data-density="flush"]'],
|
|
51
|
+
},
|
|
52
|
+
aliases: {
|
|
53
|
+
noLine: { fine: ['focusOffset'] },
|
|
54
|
+
hairLine: { fine: ['modalLine', 'landmarkLine', 'positionedLine', 'gridGap'] },
|
|
55
|
+
thickLine: { fine: ['focusLine'] },
|
|
56
|
+
trimXs: { fine: ['cardSpacingChrome', 'labelSpacingBlock'] },
|
|
57
|
+
trimSm: { fine: ['cardSpacingInline', 'cardSpacingBlock', 'inputSpacingBlock'] },
|
|
58
|
+
trimMd: { coarse: ['cardSpacingInline', 'cardSpacingBlock'] },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
} satisfies Facet;
|
|
62
|
+
|
|
63
|
+
export const maxSizesFacet = {
|
|
64
|
+
physical: {
|
|
65
|
+
namespace: 'dx-',
|
|
66
|
+
conditions: { root: [':root'] },
|
|
67
|
+
series: {
|
|
68
|
+
size: {
|
|
69
|
+
root: {
|
|
70
|
+
unit: 'rem',
|
|
71
|
+
initial: 0,
|
|
72
|
+
slope: 10,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
} satisfies LinearPhysicalLayer,
|
|
77
|
+
|
|
78
|
+
semantic: {
|
|
79
|
+
namespace: 'dx-',
|
|
80
|
+
conditions: { root: [':root'] },
|
|
81
|
+
sememes: {
|
|
82
|
+
prose: { root: ['size', 5] },
|
|
83
|
+
containerMaxWidth: { root: ['size', 5] },
|
|
84
|
+
popoverMaxWidth: { root: ['size', 2] },
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
} satisfies Facet;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import type { AccompanyingSeries, ColorsPhysicalLayer, Gamut, HelicalArcSeries, PhysicalSeries } from '@ch-ui/tokens';
|
|
6
|
+
|
|
7
|
+
import { type PhysicalPalette } from './types';
|
|
8
|
+
|
|
9
|
+
const reflectiveRelation = {
|
|
10
|
+
initial: 1_000,
|
|
11
|
+
slope: -1_000,
|
|
12
|
+
method: 'floor',
|
|
13
|
+
} satisfies AccompanyingSeries;
|
|
14
|
+
|
|
15
|
+
const gamuts: (Gamut & string)[] = ['srgb', 'p3', 'rec2020'];
|
|
16
|
+
|
|
17
|
+
const DEG_RAD = Math.PI / 180;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Creates a color palette configuration for a given hue value.
|
|
21
|
+
*
|
|
22
|
+
* @param hue - A number from 0-16 representing different hue angles
|
|
23
|
+
* @returns A PhysicalPalette configuration with:
|
|
24
|
+
* - keyPoint: [lightness, chroma, hue] in LCH color space
|
|
25
|
+
* - lightness: Fixed at 0.5 (50%)
|
|
26
|
+
* - chroma: Varies sinusoidally around 0.13 based on hue angle
|
|
27
|
+
* - hue: Calculated by mapping input 0-16 to 26-386 degrees
|
|
28
|
+
* - Control points and torsion for color interpolation
|
|
29
|
+
*/
|
|
30
|
+
const hueKeyPoint = (hue: number): PhysicalPalette => {
|
|
31
|
+
const hueDeg = (360 * (hue / 17) + 26) % 360;
|
|
32
|
+
return {
|
|
33
|
+
keyPoint: [0.5, 0.13 + 0.024 * Math.sin((hueDeg - 15) * DEG_RAD), hueDeg],
|
|
34
|
+
lowerCp: 1,
|
|
35
|
+
upperCp: 1,
|
|
36
|
+
torsion: 0,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const huePalettes = {
|
|
41
|
+
red: hueKeyPoint(0),
|
|
42
|
+
orange: hueKeyPoint(1),
|
|
43
|
+
amber: hueKeyPoint(2),
|
|
44
|
+
yellow: hueKeyPoint(3),
|
|
45
|
+
lime: hueKeyPoint(4),
|
|
46
|
+
green: hueKeyPoint(5),
|
|
47
|
+
emerald: hueKeyPoint(6),
|
|
48
|
+
teal: hueKeyPoint(7),
|
|
49
|
+
cyan: hueKeyPoint(8),
|
|
50
|
+
sky: hueKeyPoint(9),
|
|
51
|
+
blue: hueKeyPoint(10),
|
|
52
|
+
indigo: hueKeyPoint(11),
|
|
53
|
+
violet: hueKeyPoint(12),
|
|
54
|
+
purple: hueKeyPoint(13),
|
|
55
|
+
fuchsia: hueKeyPoint(14),
|
|
56
|
+
pink: hueKeyPoint(15),
|
|
57
|
+
rose: hueKeyPoint(16),
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The keyPoint represents the LCH value:
|
|
62
|
+
* - Lightness: 0-1, should usually set the keyPoint at or near 0.5
|
|
63
|
+
* - Chroma: min 0, max 0.08–0.5 depending on hue and gamut, theme will clamp final value to within gamut’s range
|
|
64
|
+
* - Hue: 0-360 (~26 “red”, ~141 “green”, ~262 “blue”)
|
|
65
|
+
*
|
|
66
|
+
* NOTE: Rebuild the theme and restart the dev server to see changes.
|
|
67
|
+
*
|
|
68
|
+
* Theme references:
|
|
69
|
+
* https://oklch.com
|
|
70
|
+
* https://colorsublime.github.io
|
|
71
|
+
* https://github.com/microsoft/vscode-docs/blob/main/api/extension-guides/color-theme.md#create-a-new-color-theme
|
|
72
|
+
* https://raw.githubusercontent.com/microsoft/vscode/main/src/vs/workbench/services/themes/common/colorThemeSchema.ts
|
|
73
|
+
* https://tailwindcss.com/docs/colors
|
|
74
|
+
*/
|
|
75
|
+
const systemPalettes = {
|
|
76
|
+
neutral: {
|
|
77
|
+
keyPoint: [0.5, 0.001, 260],
|
|
78
|
+
lowerCp: 0,
|
|
79
|
+
upperCp: 0,
|
|
80
|
+
torsion: 0,
|
|
81
|
+
// Values used directly.
|
|
82
|
+
// TODO(burdon): Audit.
|
|
83
|
+
values: [25, 50, 75, 100, 150, 200, 250, 300, 400, 500, 600, 700, 750, 800, 850, 900],
|
|
84
|
+
} satisfies PhysicalPalette,
|
|
85
|
+
|
|
86
|
+
// https://oklch.com/#0.5,0.2,260,100 (#0559d2)
|
|
87
|
+
primary: {
|
|
88
|
+
keyPoint: [0.5, 0.2, 260],
|
|
89
|
+
lowerCp: 0.86,
|
|
90
|
+
upperCp: 1,
|
|
91
|
+
torsion: -30,
|
|
92
|
+
// Values used directly.
|
|
93
|
+
// TODO(burdon): Audit.
|
|
94
|
+
values: [100, 150, 200, 350, 400, 450, 500, 750, 800, 850],
|
|
95
|
+
} satisfies PhysicalPalette,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const physicalSeries = {
|
|
99
|
+
...huePalettes,
|
|
100
|
+
...systemPalettes,
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const physicalColors: ColorsPhysicalLayer = {
|
|
104
|
+
namespace: 'dx-',
|
|
105
|
+
definitions: {
|
|
106
|
+
// @ts-ignore
|
|
107
|
+
series: physicalSeries,
|
|
108
|
+
accompanyingSeries: { reflectiveRelation },
|
|
109
|
+
},
|
|
110
|
+
conditions: {
|
|
111
|
+
srgb: [':root, .dark'],
|
|
112
|
+
p3: ['@media (color-gamut: p3)', ':root, .dark'],
|
|
113
|
+
rec2020: ['@media (color-gamut: rec2020)', ':root, .dark'],
|
|
114
|
+
},
|
|
115
|
+
series: Object.entries(physicalSeries).reduce((acc: ColorsPhysicalLayer['series'], [id]) => {
|
|
116
|
+
acc[id] = gamuts.reduce((acc: PhysicalSeries<Gamut & string, HelicalArcSeries>, gamut) => {
|
|
117
|
+
acc[gamut] = {
|
|
118
|
+
extends: id,
|
|
119
|
+
physicalValueRelation: { extends: 'reflectiveRelation' },
|
|
120
|
+
};
|
|
121
|
+
return acc;
|
|
122
|
+
}, {});
|
|
123
|
+
return acc;
|
|
124
|
+
}, {}),
|
|
125
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import type { HelicalArcValue, SemanticLayer } from '@ch-ui/tokens';
|
|
6
|
+
|
|
7
|
+
import { callsSememes } from './sememes-calls';
|
|
8
|
+
import { codemirrorSememes } from './sememes-codemirror';
|
|
9
|
+
import { hueSememes } from './sememes-hue';
|
|
10
|
+
import { sheetSememes } from './sememes-sheet';
|
|
11
|
+
import { systemSememes } from './sememes-system';
|
|
12
|
+
|
|
13
|
+
export const semanticColors = {
|
|
14
|
+
conditions: {
|
|
15
|
+
light: [':root'],
|
|
16
|
+
dark: ['.dark'],
|
|
17
|
+
},
|
|
18
|
+
sememes: {
|
|
19
|
+
// Please define each set of sememes in its own file.
|
|
20
|
+
...callsSememes,
|
|
21
|
+
...codemirrorSememes,
|
|
22
|
+
...sheetSememes,
|
|
23
|
+
...hueSememes,
|
|
24
|
+
...systemSememes,
|
|
25
|
+
},
|
|
26
|
+
namespace: 'dx-',
|
|
27
|
+
} satisfies SemanticLayer<string, string, HelicalArcValue>;
|