@knime/kds-styles 2.2.0 → 2.4.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 +32 -0
- package/README.md +21 -0
- package/dist/tokens/css/_properties-legacy.css +220 -220
- package/dist/tokens/css/_properties.css +370 -370
- package/dist/tokens/css/_variables-legacy.css +220 -220
- package/dist/tokens/css/_variables.css +370 -370
- package/dist/tokens/ts/border-radius.d.ts +50 -0
- package/dist/tokens/ts/border-radius.js +88 -0
- package/dist/tokens/ts/border-width.d.ts +22 -0
- package/dist/tokens/ts/border-width.js +32 -0
- package/dist/tokens/ts/border.d.ts +118 -0
- package/dist/tokens/ts/border.js +316 -0
- package/dist/tokens/ts/box-shadow.d.ts +12 -0
- package/dist/tokens/ts/box-shadow.js +24 -0
- package/dist/tokens/ts/color.d.ts +880 -0
- package/dist/tokens/ts/color.js +1658 -0
- package/dist/tokens/ts/dimension.d.ts +196 -0
- package/dist/tokens/ts/dimension.js +362 -0
- package/dist/tokens/ts/elevation.d.ts +37 -0
- package/dist/tokens/ts/elevation.js +102 -0
- package/dist/tokens/ts/fake-border.d.ts +12 -0
- package/dist/tokens/ts/fake-border.js +24 -0
- package/dist/tokens/ts/font.d.ts +278 -0
- package/dist/tokens/ts/font.js +644 -0
- package/dist/tokens/ts/index.d.ts +17 -0
- package/dist/tokens/ts/index.js +16 -0
- package/dist/tokens/ts/sizing.d.ts +34 -0
- package/dist/tokens/ts/sizing.js +56 -0
- package/dist/tokens/ts/spacing.d.ts +90 -0
- package/dist/tokens/ts/spacing.js +115 -0
- package/dist/tokens/ts/types.d.ts +87 -0
- package/dist/tokens/ts/types.js +5 -0
- package/dist/tokens/ts/width.d.ts +14 -0
- package/dist/tokens/ts/width.js +16 -0
- package/package.json +5 -2
- 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.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b4222fa: Design tokens are now exported as structured TypeScript constants mirroring the
|
|
8
|
+
token JSON structure (KDS-690). `@knime/kds-styles/tokens` exposes one constant
|
|
9
|
+
per top-level token group (`color`, `dimension`, `spacing`, `border`,
|
|
10
|
+
`borderRadius`, `borderWidth`, `elevation`, `boxShadow`, `fakeBorder`, `font`,
|
|
11
|
+
`sizing`, `width`) plus the value types (`KdsColor`, `KdsDimension`,
|
|
12
|
+
`KdsTypography`, ...). Color values are always `{ light, dark }` pairs of HSL
|
|
13
|
+
component objects (`{ h, s, l, alpha }`); dimensional values are
|
|
14
|
+
`{ value, unit }` objects; composite tokens (border, elevation, typography)
|
|
15
|
+
stay structured objects. Every token additionally carries its CSS
|
|
16
|
+
representation in `css`: the exact value from the emitted CSS custom
|
|
17
|
+
properties (`css.value`, e.g. `light-dark(...)` for colors or the complete
|
|
18
|
+
font shorthand for typography) and the custom property reference
|
|
19
|
+
(`css.variable`, e.g. `var(--kds-color-surface-default)`). The exports are
|
|
20
|
+
shipped precompiled (ESM `.js` + `.d.ts`), so they also work in plain Node.js
|
|
21
|
+
without any TypeScript setup.
|
|
22
|
+
|
|
23
|
+
The previous flat camelCase px constants (e.g.
|
|
24
|
+
`kdsDimensionComponentHeight1p5x`) and the `kdsCore*` primitives were removed
|
|
25
|
+
from `@knime/kds-styles/tokens`; they were only used internally in this
|
|
26
|
+
repository and all usages have been migrated to the structured exports.
|
|
27
|
+
|
|
28
|
+
The CSS variables now carry the exact hsl values authored in the token sources:
|
|
29
|
+
the previously applied color transform rounded h/s/l components (e.g. `15.7%`
|
|
30
|
+
became `16%`) and rewrote the hue of zero-saturation grays. CSS and TS color
|
|
31
|
+
values are now numerically identical.
|
|
32
|
+
|
|
33
|
+
## 2.3.0
|
|
34
|
+
|
|
3
35
|
## 2.2.0
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
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):
|