@knime/kds-styles 4.0.0 → 5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @knime/kds-styles
2
2
 
3
+ ## 5.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 0cc879e: BREAKING CHANGES:
8
+
9
+ - `index.css`:
10
+ - declare `color-scheme: light dark` on `:root`, so apps importing it follow the device light/dark preference instead of always rendering light. Every `--kds-*` color token resolves through `light-dark()`, so on a dark-mode device the UI — plus browser chrome such as scrollbars, form controls and the default canvas background — switches to dark with no opt-in on the consumer's side.
11
+ - partially migrated apps are most affected: legacy `--knime-*` properties are hard-coded light and ignore `light-dark()`, so those parts stay light next to the now-dark tokenized parts.
12
+ - to keep the previous always-light rendering, declare `:root { color-scheme: light; }` in the app. Apps importing only `kds-variables.css` are unaffected — see "Enabling Dark Mode" in the package README.
13
+
3
14
  ## 4.0.0
4
15
 
5
16
  ## 3.0.0
package/README.md CHANGED
@@ -40,6 +40,24 @@ To use the design tokens and basic CSS you can simply import the following into
40
40
 
41
41
  - `@import "@knime/kds-styles/index.css"`: Bundles all previous imports and adds basic core style rules, e.g. uses modern-normalize for browser reset. **Important:** Use only for new projects, or if conversion is already at a point where core styles can be replaced.
42
42
 
43
+ ### Enabling Dark Mode
44
+
45
+ The color tokens resolve through `light-dark()`, so the root element's `color-scheme` decides light vs. dark. Its default (`normal`) resolves every token to its light value — an app that never sets it renders light on a dark device.
46
+
47
+ `index.css` declares `color-scheme: light dark` on `:root`, which makes it **the recommended import for apps that are completely dark-mode-ready**: no JavaScript, and it applies on the first (even server-rendered) paint, so nothing flickers on hydration.
48
+
49
+ An app that cannot import `index.css` yet — e.g. it still needs the `@knime/styles` reset and only imports `kds-variables.css` — can declare the property itself:
50
+
51
+ ```css
52
+ :root {
53
+ color-scheme: light dark;
54
+ }
55
+ ```
56
+
57
+ Do so deliberately if the app is only partially migrated: legacy `--knime-*` properties are hard-coded light and ignore `light-dark()`, so those parts stay light, and `color-scheme` also switches browser chrome (scrollbars, form controls, canvas background).
58
+
59
+ For an explicit user override, call `useKdsDarkMode()` from `@knime/kds-components`. It writes `color-scheme` inline on `<html>`, winning over the rule above. It needs a DOM, so in a server-rendered app call it from client-only code and leave the `system` default to CSS.
60
+
43
61
  ### Design Tokens in JavaScript/TypeScript
44
62
 
45
63
  For cases where CSS variables cannot be used (e.g. layout calculations, canvas rendering or JavaScript services), the design tokens are also exported as TypeScript constants. They are shipped precompiled (ESM `.js` + `.d.ts`), so they work in any environment — including plain Node.js — without additional setup:
@@ -1,5 +1,13 @@
1
1
  :root {
2
2
  font-family: var(--kds-core-font-family-roboto), sans-serif;
3
+
4
+ /*
5
+ * Follow the device preference. The color tokens resolve via `light-dark()`,
6
+ * so this needs no JavaScript and applies on the first paint.
7
+ * `useKdsDarkMode()` overrides it with an inline style for an explicit
8
+ * light/dark preference.
9
+ */
10
+ color-scheme: light dark;
3
11
  }
4
12
 
5
13
  body {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knime/kds-styles",
3
- "version": "4.0.0",
3
+ "version": "5.0.0",
4
4
  "description": "Package containing the design tokens and icons for the KNIME Design System",
5
5
  "repository": {
6
6
  "type": "git",