@dxos/ui-theme 0.0.0 → 0.8.4-main.16b68245aa

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.
Files changed (257) hide show
  1. package/dist/lib/browser/index.mjs +1372 -0
  2. package/dist/lib/browser/index.mjs.map +7 -0
  3. package/dist/lib/browser/meta.json +1 -0
  4. package/dist/lib/node-esm/index.mjs +1374 -0
  5. package/dist/lib/node-esm/index.mjs.map +7 -0
  6. package/dist/lib/node-esm/meta.json +1 -0
  7. package/dist/plugin/node-cjs/main.css +1564 -0
  8. package/dist/plugin/node-cjs/main.css.map +7 -0
  9. package/dist/plugin/node-cjs/meta.json +1 -0
  10. package/dist/plugin/node-cjs/plugins/ThemePlugin.cjs +137 -0
  11. package/dist/plugin/node-cjs/plugins/ThemePlugin.cjs.map +7 -0
  12. package/dist/plugin/node-esm/main.css +1564 -0
  13. package/dist/plugin/node-esm/main.css.map +7 -0
  14. package/dist/plugin/node-esm/meta.json +1 -0
  15. package/dist/plugin/node-esm/plugins/ThemePlugin.mjs +105 -0
  16. package/dist/plugin/node-esm/plugins/ThemePlugin.mjs.map +7 -0
  17. package/dist/types/src/Theme.stories.d.ts +27 -0
  18. package/dist/types/src/Theme.stories.d.ts.map +1 -0
  19. package/dist/types/src/defs.d.ts +21 -0
  20. package/dist/types/src/defs.d.ts.map +1 -0
  21. package/dist/types/src/fragments/density.d.ts +4 -0
  22. package/dist/types/src/fragments/density.d.ts.map +1 -0
  23. package/dist/types/src/fragments/disabled.d.ts +3 -0
  24. package/dist/types/src/fragments/disabled.d.ts.map +1 -0
  25. package/dist/types/src/fragments/hover.d.ts +10 -0
  26. package/dist/types/src/fragments/hover.d.ts.map +1 -0
  27. package/dist/types/src/fragments/index.d.ts +5 -0
  28. package/dist/types/src/fragments/index.d.ts.map +1 -0
  29. package/dist/types/src/fragments/text.d.ts +2 -0
  30. package/dist/types/src/fragments/text.d.ts.map +1 -0
  31. package/dist/types/src/index.d.ts +5 -0
  32. package/dist/types/src/index.d.ts.map +1 -0
  33. package/dist/types/src/plugins/ThemePlugin.d.ts +16 -0
  34. package/dist/types/src/plugins/ThemePlugin.d.ts.map +1 -0
  35. package/dist/types/src/plugins/dark-mode.d.ts +1 -0
  36. package/dist/types/src/plugins/dark-mode.d.ts.map +1 -0
  37. package/dist/types/src/theme/components/avatar.d.ts +21 -0
  38. package/dist/types/src/theme/components/avatar.d.ts.map +1 -0
  39. package/dist/types/src/theme/components/breadcrumb.d.ts +9 -0
  40. package/dist/types/src/theme/components/breadcrumb.d.ts.map +1 -0
  41. package/dist/types/src/theme/components/button.d.ts +15 -0
  42. package/dist/types/src/theme/components/button.d.ts.map +1 -0
  43. package/dist/types/src/theme/components/card.d.ts +12 -0
  44. package/dist/types/src/theme/components/card.d.ts.map +1 -0
  45. package/dist/types/src/theme/components/dialog.d.ts +17 -0
  46. package/dist/types/src/theme/components/dialog.d.ts.map +1 -0
  47. package/dist/types/src/theme/components/focus.d.ts +6 -0
  48. package/dist/types/src/theme/components/focus.d.ts.map +1 -0
  49. package/dist/types/src/theme/components/icon-button.d.ts +9 -0
  50. package/dist/types/src/theme/components/icon-button.d.ts.map +1 -0
  51. package/dist/types/src/theme/components/icon.d.ts +10 -0
  52. package/dist/types/src/theme/components/icon.d.ts.map +1 -0
  53. package/dist/types/src/theme/components/index.d.ts +27 -0
  54. package/dist/types/src/theme/components/index.d.ts.map +1 -0
  55. package/dist/types/src/theme/components/input.d.ts +115 -0
  56. package/dist/types/src/theme/components/input.d.ts.map +1 -0
  57. package/dist/types/src/theme/components/link.d.ts +7 -0
  58. package/dist/types/src/theme/components/link.d.ts.map +1 -0
  59. package/dist/types/src/theme/components/list.d.ts +14 -0
  60. package/dist/types/src/theme/components/list.d.ts.map +1 -0
  61. package/dist/types/src/theme/components/main.d.ts +28 -0
  62. package/dist/types/src/theme/components/main.d.ts.map +1 -0
  63. package/dist/types/src/theme/components/menu.d.ts +13 -0
  64. package/dist/types/src/theme/components/menu.d.ts.map +1 -0
  65. package/dist/types/src/theme/components/message.d.ts +12 -0
  66. package/dist/types/src/theme/components/message.d.ts.map +1 -0
  67. package/dist/types/src/theme/components/popover.d.ts +11 -0
  68. package/dist/types/src/theme/components/popover.d.ts.map +1 -0
  69. package/dist/types/src/theme/components/scroll-area.d.ts +32 -0
  70. package/dist/types/src/theme/components/scroll-area.d.ts.map +1 -0
  71. package/dist/types/src/theme/components/select.d.ts +13 -0
  72. package/dist/types/src/theme/components/select.d.ts.map +1 -0
  73. package/dist/types/src/theme/components/separator.d.ts +8 -0
  74. package/dist/types/src/theme/components/separator.d.ts.map +1 -0
  75. package/dist/types/src/theme/components/skeleton.d.ts +7 -0
  76. package/dist/types/src/theme/components/skeleton.d.ts.map +1 -0
  77. package/dist/types/src/theme/components/splitter.d.ts +4 -0
  78. package/dist/types/src/theme/components/splitter.d.ts.map +1 -0
  79. package/dist/types/src/theme/components/status.d.ts +9 -0
  80. package/dist/types/src/theme/components/status.d.ts.map +1 -0
  81. package/dist/types/src/theme/components/tag.d.ts +7 -0
  82. package/dist/types/src/theme/components/tag.d.ts.map +1 -0
  83. package/dist/types/src/theme/components/toast.d.ts +12 -0
  84. package/dist/types/src/theme/components/toast.d.ts.map +1 -0
  85. package/dist/types/src/theme/components/toolbar.d.ts +11 -0
  86. package/dist/types/src/theme/components/toolbar.d.ts.map +1 -0
  87. package/dist/types/src/theme/components/tooltip.d.ts +8 -0
  88. package/dist/types/src/theme/components/tooltip.d.ts.map +1 -0
  89. package/dist/types/src/theme/components/treegrid.d.ts +10 -0
  90. package/dist/types/src/theme/components/treegrid.d.ts.map +1 -0
  91. package/dist/types/src/theme/index.d.ts +4 -0
  92. package/dist/types/src/theme/index.d.ts.map +1 -0
  93. package/dist/types/src/theme/primitives/column.d.ts +29 -0
  94. package/dist/types/src/theme/primitives/column.d.ts.map +1 -0
  95. package/dist/types/src/theme/primitives/index.d.ts +3 -0
  96. package/dist/types/src/theme/primitives/index.d.ts.map +1 -0
  97. package/dist/types/src/theme/primitives/panel.d.ts +13 -0
  98. package/dist/types/src/theme/primitives/panel.d.ts.map +1 -0
  99. package/dist/types/src/theme/theme.d.ts +5 -0
  100. package/dist/types/src/theme/theme.d.ts.map +1 -0
  101. package/dist/types/src/util/elevation.d.ts +9 -0
  102. package/dist/types/src/util/elevation.d.ts.map +1 -0
  103. package/dist/types/src/util/hash-styles.d.ts +18 -0
  104. package/dist/types/src/util/hash-styles.d.ts.map +1 -0
  105. package/dist/types/src/util/index.d.ts +6 -0
  106. package/dist/types/src/util/index.d.ts.map +1 -0
  107. package/dist/types/src/util/mx.d.ts +58 -0
  108. package/dist/types/src/util/mx.d.ts.map +1 -0
  109. package/dist/types/src/util/size.d.ts +27 -0
  110. package/dist/types/src/util/size.d.ts.map +1 -0
  111. package/dist/types/src/util/valence.d.ts +4 -0
  112. package/dist/types/src/util/valence.d.ts.map +1 -0
  113. package/dist/types/tsconfig.tsbuildinfo +1 -0
  114. package/package.json +30 -36
  115. package/src/Theme.stories.tsx +224 -0
  116. package/src/css/base/base.css +43 -0
  117. package/src/{styles/layers → css/base}/typography.css +21 -3
  118. package/src/{styles/layers → css/components}/button.css +23 -14
  119. package/src/{styles/layers → css/components}/checkbox.css +12 -8
  120. package/src/css/components/dialog.css +78 -0
  121. package/src/{styles/layers/focus-ring.css → css/components/focus.css} +60 -41
  122. package/src/css/components/icon.css +9 -0
  123. package/src/css/components/link.css +9 -0
  124. package/src/css/components/panel.css +117 -0
  125. package/src/css/components/scrollbar.css +24 -0
  126. package/src/css/components/selected.css +35 -0
  127. package/src/css/components/selected.md +101 -0
  128. package/src/css/components/surface.css +34 -0
  129. package/src/css/components/tag.css +132 -0
  130. package/src/css/components/text.css +124 -0
  131. package/src/css/integrations/codemirror.css +34 -0
  132. package/src/css/integrations/tldraw.css +14 -0
  133. package/src/css/layout/main.css +205 -0
  134. package/src/{styles/layers → css/layout}/native.css +6 -4
  135. package/src/css/layout/positioning.css +19 -0
  136. package/src/{styles/layers → css/layout}/size.css +130 -102
  137. package/src/css/theme/animation.css +260 -0
  138. package/src/css/theme/border.css +23 -0
  139. package/src/css/theme/palette.css +36 -0
  140. package/src/css/theme/semantic.css +116 -0
  141. package/src/css/theme/spacing.css +147 -0
  142. package/src/css/theme/styles.css +145 -0
  143. package/src/css/theme/text.css +37 -0
  144. package/src/css/utilities.css +118 -0
  145. package/src/defs.ts +48 -0
  146. package/src/fragments/AUDIT.md +57 -0
  147. package/src/fragments/density.ts +16 -0
  148. package/src/fragments/hover.ts +18 -0
  149. package/src/fragments/index.ts +10 -0
  150. package/src/fragments/text.ts +6 -0
  151. package/src/index.ts +3 -14
  152. package/src/main.css +121 -0
  153. package/src/plugins/ThemePlugin.ts +125 -0
  154. package/src/plugins/dark-mode.ts +22 -0
  155. package/src/plugins/main.css +45 -0
  156. package/src/{styles → theme}/components/avatar.ts +12 -13
  157. package/src/theme/components/button.ts +48 -0
  158. package/src/theme/components/card.ts +102 -0
  159. package/src/theme/components/dialog.ts +61 -0
  160. package/src/theme/components/focus.ts +33 -0
  161. package/src/{styles → theme}/components/icon-button.ts +6 -5
  162. package/src/theme/components/icon.ts +28 -0
  163. package/src/{styles → theme}/components/index.ts +4 -1
  164. package/src/theme/components/input.ts +171 -0
  165. package/src/{styles → theme}/components/link.ts +3 -4
  166. package/src/{styles → theme}/components/list.ts +5 -5
  167. package/src/{styles → theme}/components/main.ts +9 -11
  168. package/src/{styles → theme}/components/menu.ts +11 -21
  169. package/src/{styles → theme}/components/message.ts +11 -7
  170. package/src/{styles → theme}/components/popover.ts +13 -12
  171. package/src/theme/components/scroll-area.ts +115 -0
  172. package/src/{styles → theme}/components/select.ts +8 -16
  173. package/src/{styles → theme}/components/separator.ts +3 -3
  174. package/src/theme/components/skeleton.ts +23 -0
  175. package/src/theme/components/splitter.ts +20 -0
  176. package/src/{styles → theme}/components/status.ts +7 -7
  177. package/src/{styles → theme}/components/tag.ts +1 -1
  178. package/src/{styles → theme}/components/toast.ts +6 -8
  179. package/src/theme/components/toolbar.ts +35 -0
  180. package/src/{styles → theme}/components/tooltip.ts +4 -6
  181. package/src/{styles → theme}/components/treegrid.ts +9 -9
  182. package/src/{styles → theme}/index.ts +2 -2
  183. package/src/theme/primitives/column.ts +71 -0
  184. package/src/theme/primitives/index.ts +6 -0
  185. package/src/theme/primitives/panel.ts +43 -0
  186. package/src/{styles → theme}/theme.ts +27 -9
  187. package/src/typings.d.ts +3 -1
  188. package/src/{styles/fragments → util}/elevation.ts +6 -8
  189. package/src/util/hash-styles.ts +118 -98
  190. package/src/util/index.ts +3 -0
  191. package/src/util/mx.ts +165 -43
  192. package/src/util/size.ts +103 -0
  193. package/src/util/valence.ts +33 -0
  194. package/src/Tokens.stories.tsx +0 -88
  195. package/src/config/index.ts +0 -6
  196. package/src/config/tailwind.ts +0 -250
  197. package/src/config/tokens/alias-colors.ts +0 -39
  198. package/src/config/tokens/index.ts +0 -92
  199. package/src/config/tokens/lengths.ts +0 -97
  200. package/src/config/tokens/physical-colors.ts +0 -125
  201. package/src/config/tokens/semantic-colors.ts +0 -27
  202. package/src/config/tokens/sememes-calls.ts +0 -17
  203. package/src/config/tokens/sememes-codemirror.ts +0 -50
  204. package/src/config/tokens/sememes-hue.ts +0 -54
  205. package/src/config/tokens/sememes-sheet.ts +0 -62
  206. package/src/config/tokens/sememes-system.ts +0 -302
  207. package/src/config/tokens/sizes.ts +0 -7
  208. package/src/config/tokens/types.ts +0 -9
  209. package/src/docs/theme.drawio.svg +0 -635
  210. package/src/plugins/esbuild-plugin.ts +0 -65
  211. package/src/plugins/plugin.ts +0 -130
  212. package/src/plugins/resolveContent.ts +0 -51
  213. package/src/styles/components/README.md +0 -6
  214. package/src/styles/components/anchored-overflow.ts +0 -20
  215. package/src/styles/components/button.ts +0 -48
  216. package/src/styles/components/dialog.ts +0 -36
  217. package/src/styles/components/icon.ts +0 -19
  218. package/src/styles/components/input.ts +0 -177
  219. package/src/styles/components/scroll-area.ts +0 -43
  220. package/src/styles/components/toolbar.ts +0 -29
  221. package/src/styles/fragments/density.ts +0 -17
  222. package/src/styles/fragments/dimension.ts +0 -8
  223. package/src/styles/fragments/focus.ts +0 -16
  224. package/src/styles/fragments/group.ts +0 -12
  225. package/src/styles/fragments/hover.ts +0 -25
  226. package/src/styles/fragments/index.ts +0 -20
  227. package/src/styles/fragments/layout.ts +0 -7
  228. package/src/styles/fragments/motion.ts +0 -6
  229. package/src/styles/fragments/ornament.ts +0 -10
  230. package/src/styles/fragments/selected.ts +0 -45
  231. package/src/styles/fragments/shimmer.ts +0 -9
  232. package/src/styles/fragments/size.ts +0 -117
  233. package/src/styles/fragments/surface.ts +0 -29
  234. package/src/styles/fragments/text.ts +0 -12
  235. package/src/styles/fragments/valence.ts +0 -46
  236. package/src/styles/layers/README.md +0 -15
  237. package/src/styles/layers/anchored-overflow.css +0 -9
  238. package/src/styles/layers/animation.css +0 -17
  239. package/src/styles/layers/attention.css +0 -8
  240. package/src/styles/layers/base.css +0 -25
  241. package/src/styles/layers/can-scroll.css +0 -26
  242. package/src/styles/layers/dialog.css +0 -42
  243. package/src/styles/layers/drag-preview.css +0 -18
  244. package/src/styles/layers/hues.css +0 -110
  245. package/src/styles/layers/index.css +0 -26
  246. package/src/styles/layers/main.css +0 -160
  247. package/src/styles/layers/positioning.css +0 -23
  248. package/src/styles/layers/surfaces.css +0 -31
  249. package/src/styles/layers/tag.css +0 -132
  250. package/src/styles/layers/tldraw.css +0 -91
  251. package/src/styles/layers/tokens.css +0 -45
  252. package/src/tailwind.ts +0 -5
  253. package/src/theme.css +0 -9
  254. package/src/types.ts +0 -7
  255. package/src/util/withLogical.ts +0 -114
  256. /package/src/{styles/fragments → fragments}/disabled.ts +0 -0
  257. /package/src/{styles → theme}/components/breadcrumb.ts +0 -0
@@ -1,88 +0,0 @@
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 = {};
@@ -1,6 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- export * from './tokens';
6
- export * from './tailwind';
@@ -1,250 +0,0 @@
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
- });
@@ -1,39 +0,0 @@
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>;
@@ -1,92 +0,0 @@
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);
@@ -1,97 +0,0 @@
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;
@@ -1,125 +0,0 @@
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
- };