@knime/kds-styles 2.3.0 → 2.5.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +21 -0
  3. package/dist/tokens/css/_properties-legacy.css +220 -220
  4. package/dist/tokens/css/_properties.css +370 -370
  5. package/dist/tokens/css/_variables-legacy.css +220 -220
  6. package/dist/tokens/css/_variables.css +370 -370
  7. package/dist/tokens/ts/border-radius.d.ts +50 -0
  8. package/dist/tokens/ts/border-radius.js +88 -0
  9. package/dist/tokens/ts/border-width.d.ts +22 -0
  10. package/dist/tokens/ts/border-width.js +32 -0
  11. package/dist/tokens/ts/border.d.ts +118 -0
  12. package/dist/tokens/ts/border.js +316 -0
  13. package/dist/tokens/ts/box-shadow.d.ts +12 -0
  14. package/dist/tokens/ts/box-shadow.js +24 -0
  15. package/dist/tokens/ts/color.d.ts +880 -0
  16. package/dist/tokens/ts/color.js +1658 -0
  17. package/dist/tokens/ts/dimension.d.ts +196 -0
  18. package/dist/tokens/ts/dimension.js +362 -0
  19. package/dist/tokens/ts/elevation.d.ts +37 -0
  20. package/dist/tokens/ts/elevation.js +102 -0
  21. package/dist/tokens/ts/fake-border.d.ts +12 -0
  22. package/dist/tokens/ts/fake-border.js +24 -0
  23. package/dist/tokens/ts/font.d.ts +278 -0
  24. package/dist/tokens/ts/font.js +644 -0
  25. package/dist/tokens/ts/index.d.ts +17 -0
  26. package/dist/tokens/ts/index.js +16 -0
  27. package/dist/tokens/ts/sizing.d.ts +34 -0
  28. package/dist/tokens/ts/sizing.js +56 -0
  29. package/dist/tokens/ts/spacing.d.ts +90 -0
  30. package/dist/tokens/ts/spacing.js +115 -0
  31. package/dist/tokens/ts/types.d.ts +87 -0
  32. package/dist/tokens/ts/types.js +5 -0
  33. package/dist/tokens/ts/width.d.ts +14 -0
  34. package/dist/tokens/ts/width.js +16 -0
  35. package/package.json +6 -3
  36. package/dist/tokens/ts/_tokens.ts +0 -125
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @knime/kds-styles
2
2
 
3
+ ## 2.5.0
4
+
5
+ ## 2.4.0
6
+
7
+ ### Minor Changes
8
+
9
+ - b4222fa: Design tokens are now exported as structured TypeScript constants mirroring the
10
+ token JSON structure (KDS-690). `@knime/kds-styles/tokens` exposes one constant
11
+ per top-level token group (`color`, `dimension`, `spacing`, `border`,
12
+ `borderRadius`, `borderWidth`, `elevation`, `boxShadow`, `fakeBorder`, `font`,
13
+ `sizing`, `width`) plus the value types (`KdsColor`, `KdsDimension`,
14
+ `KdsTypography`, ...). Color values are always `{ light, dark }` pairs of HSL
15
+ component objects (`{ h, s, l, alpha }`); dimensional values are
16
+ `{ value, unit }` objects; composite tokens (border, elevation, typography)
17
+ stay structured objects. Every token additionally carries its CSS
18
+ representation in `css`: the exact value from the emitted CSS custom
19
+ properties (`css.value`, e.g. `light-dark(...)` for colors or the complete
20
+ font shorthand for typography) and the custom property reference
21
+ (`css.variable`, e.g. `var(--kds-color-surface-default)`). The exports are
22
+ shipped precompiled (ESM `.js` + `.d.ts`), so they also work in plain Node.js
23
+ without any TypeScript setup.
24
+
25
+ The previous flat camelCase px constants (e.g.
26
+ `kdsDimensionComponentHeight1p5x`) and the `kdsCore*` primitives were removed
27
+ from `@knime/kds-styles/tokens`; they were only used internally in this
28
+ repository and all usages have been migrated to the structured exports.
29
+
30
+ The CSS variables now carry the exact hsl values authored in the token sources:
31
+ the previously applied color transform rounded h/s/l components (e.g. `15.7%`
32
+ became `16%`) and rewrote the hue of zero-saturation grays. CSS and TS color
33
+ values are now numerically identical.
34
+
3
35
  ## 2.3.0
4
36
 
5
37
  ## 2.2.0
package/README.md CHANGED
@@ -24,6 +24,8 @@ All token values are fully calculated, ensuring that no variable references rema
24
24
 
25
25
  Two sets of files are generated for light and dark mode. Subsequently, the CSS files are merged to contain all variables only once. For variables that use different color values in light and dark mode, the `light-dark()` function is employed.
26
26
 
27
+ In the TypeScript exports, color values are always emitted as `{ light, dark }` pairs (colors are the only mode-dependent token values); all other values are identical in both modes and stay plain.
28
+
27
29
  ## Fonts
28
30
 
29
31
  The design system uses the Roboto, Roboto Condensed and Roboto Mono fonts for typography. When using `@knime/kds-styles` as a dependency the fonts will automatically be installed, no separate dependency is needed.
@@ -39,6 +41,25 @@ To use the design tokens and basic CSS you can simply import the following into
39
41
 
40
42
  - `@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.
41
43
 
44
+ ### Design Tokens in JavaScript/TypeScript
45
+
46
+ 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:
47
+
48
+ ```ts
49
+ import { color, dimension, font } from "@knime/kds-styles/tokens";
50
+
51
+ dimension.component.height["1.5x"].value; // 24 (px)
52
+ dimension.component.height["1.5x"].css.value; // "24px"
53
+ color.surface.default.light; // { h: 0, s: 0, l: 98, alpha: 1 }
54
+ color.surface.default.dark; // { h: 0, s: 0, l: 15.7, alpha: 1 }
55
+ color.surface.default.css.value; // "light-dark(hsl(0, 0%, 98%), hsl(0, 0%, 15.7%))"
56
+ color.surface.default.css.variable; // "var(--kds-color-surface-default)"
57
+ font.base.display.small.fontSize; // { value: 20, unit: "px" }
58
+ font.base.display.small.css.value; // "700 20px/normal Roboto, sans-serif"
59
+ ```
60
+
61
+ The exports mirror the token JSON structure (without the `kds` root): one constant per top-level token group plus the value types (`KdsColor`, `KdsDimension`, `KdsTypography`, ...). Dimensional values are `{ value, unit }` objects, color values are always `{ light, dark }` pairs of HSL component objects (equivalent to the CSS color `hsl(<h> <s>% <l>% / <alpha>)`), and composite tokens (border, elevation, typography) remain structured objects. Every token additionally carries its CSS representation in `css`: the exact value from the emitted CSS custom properties (`css.value`, including `light-dark()` for colors and complete shorthands for composite tokens) and the custom property reference (`css.variable`). The internal `core` primitives are intentionally not emitted — their values are already inlined into the semantic tokens, which are the only ones consumers should use.
62
+
42
63
  ## Important Scripts
43
64
 
44
65
  Here are some of the most important scripts defined in the [`package.json`](package.json):