@dxos/ui-theme 0.16.0 → 0.17.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/ui-theme",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "A set of design system tokens to use with DXOS UI.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -35,6 +35,8 @@
35
35
  "src"
36
36
  ],
37
37
  "dependencies": {
38
+ "@dxos/node-std": "0.17.0",
39
+ "@dxos/ui-types": "0.17.0",
38
40
  "@fontsource-variable/inter": "5.2.8",
39
41
  "@fontsource-variable/jetbrains-mono": "5.0.21",
40
42
  "@fontsource-variable/nunito": "5.2.7",
@@ -49,24 +51,24 @@
49
51
  "tailwind-merge": "^3.5.0",
50
52
  "tailwind-scrollbar": "^4.0.0",
51
53
  "tailwind-variants": "^3.2.2",
52
- "tailwindcss": "^4.3.0",
53
- "@dxos/node-std": "0.16.0",
54
- "@dxos/ui-types": "0.16.0"
54
+ "tailwindcss": "^4.3.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@storybook/react-vite": "^10.6.0",
58
58
  "@types/postcss-import": "^14.0.3",
59
59
  "esbuild": "0.28.2",
60
+ "typedoc": "0.28.1",
60
61
  "vite": "^8.3.4"
61
62
  },
62
63
  "peerDependencies": {
63
- "react": "~19.2.7"
64
+ "react": "~19.3.1"
64
65
  },
65
66
  "publishConfig": {
66
67
  "access": "public"
67
68
  },
68
69
  "scripts": {
69
70
  "audit-classes": "npx tsx bin/audit-classes.mts",
70
- "tailwind-check": "tailwindcss -i ./dist/plugin/theme.css --config ./src/tailwind.ts --content \"./src/**/*.{js,ts,jsx,tsx,vue}\" --check"
71
+ "tailwind-check": "tailwindcss -i ./dist/plugin/theme.css --config ./src/tailwind.ts --content \"./src/**/*.{js,ts,jsx,tsx,vue}\" --check",
72
+ "typedoc": "typedoc --out typedoc"
71
73
  }
72
74
  }
@@ -71,7 +71,7 @@
71
71
  --color-r1-surface: light-dark(oklch(0.986 0.001 190), var(--dx-surface-chrome));
72
72
  /* The sidebars' landmark edges, lifted from the expanded sidebar tone and fixed rather than
73
73
  surface-derived, so a collapsed sidebar (which wears the rail's darker tone) keeps the same line
74
- as the expanded one. L1 takes `subdued-separator`'s lift; R1, `separator`'s. */
74
+ as the expanded one. L1 takes `separator-subtle`'s lift; R1, `separator`'s. */
75
75
  --color-l1-separator: oklch(
76
76
  from var(--color-l1-surface) calc(l + var(--dx-lift) * var(--dx-attenuate-separator) * 0.089) c h
77
77
  );
@@ -169,7 +169,7 @@
169
169
  /*
170
170
  * Separators. Fixed neutrals collided with the surfaces they divide once the ladder inverted:
171
171
  * in light mode `separator` was neutral-200, the same value as the base canvas, and
172
- * `subdued-separator` matched the sidebar exactly — both invisible. The offsets below reproduce
172
+ * `separator-subtle` matched the sidebar exactly — both invisible. The offsets below reproduce
173
173
  * the dark-mode appearance they had (0.166 / 0.115 / 0.089 / 0.064 above the base surface) and
174
174
  * mirror it in light.
175
175
  */
package/src/index.ts CHANGED
@@ -4,5 +4,4 @@
4
4
 
5
5
  export * from './defs.ts';
6
6
  export * from './fragments/index.ts';
7
-
8
7
  export * from './util/index.ts';
@@ -132,8 +132,9 @@ const writeConsumerTheme = ({
132
132
  /**
133
133
  * Vite plugin to configure theme.
134
134
  * Returns the official Tailwind Vite plugin (persistent incremental scanner) alongside the theme plugin.
135
+ * Every option has a default, so a consumer of the published package can call `ThemePlugin()`.
135
136
  */
136
- export const ThemePlugin = (options: ThemePluginOptions): Plugin[] => {
137
+ export const ThemePlugin = (options: ThemePluginOptions = {}): Plugin[] => {
137
138
  // `src` is published too, so only the location tells a workspace checkout from an installed copy.
138
139
  const packageRoot = realpathSync(resolve(import.meta.dirname, ROOT));
139
140
  const isMonorepo = !packageRoot.split(sep).includes('node_modules');
@@ -32,3 +32,15 @@ export const applyAccent = (element: HTMLElement, hue: AccentHue | undefined): v
32
32
  }
33
33
  }
34
34
  };
35
+
36
+ /**
37
+ * Sets the keyboard focus colour for an element's subtree, or clears it back to the stylesheet's default when `hue`
38
+ * is undefined.
39
+ */
40
+ export const applyFocusHue = (element: HTMLElement, hue: AccentHue | undefined): void => {
41
+ if (hue) {
42
+ element.style.setProperty('--color-focus', `var(--color-${hue}-500)`);
43
+ } else {
44
+ element.style.removeProperty('--color-focus');
45
+ }
46
+ };