@duro-app/tokens 0.52.0 → 1.1.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/dist/keys.d.ts ADDED
@@ -0,0 +1,42 @@
1
+ import { RawColors } from './raw.js';
2
+ export declare const SPACING_KEYS: readonly ["xs", "sm", "ms", "md", "lg", "xl", "xxl", "xxxl"];
3
+ export type SpacingToken = (typeof SPACING_KEYS)[number];
4
+ export declare const SPACING_PX: {
5
+ readonly xs: 4;
6
+ readonly sm: 8;
7
+ readonly ms: 12;
8
+ readonly md: 16;
9
+ readonly lg: 24;
10
+ readonly xl: 32;
11
+ readonly xxl: 48;
12
+ readonly xxxl: 64;
13
+ };
14
+ export declare const RADIUS_KEYS: readonly ["xs", "sm", "md", "lg", "full"];
15
+ export type RadiusToken = (typeof RADIUS_KEYS)[number];
16
+ export declare const RADII_PX: {
17
+ readonly xs: 4;
18
+ readonly sm: 8;
19
+ readonly md: 12;
20
+ readonly lg: 16;
21
+ readonly full: 9999;
22
+ };
23
+ export declare const SHADOW_KEYS: readonly ["sm", "md", "lg"];
24
+ export type ShadowToken = (typeof SHADOW_KEYS)[number];
25
+ export declare const DURATION_MS: {
26
+ readonly instant: 0;
27
+ readonly fast: 150;
28
+ readonly base: 200;
29
+ readonly slow: 280;
30
+ };
31
+ export type DurationToken = keyof typeof DURATION_MS;
32
+ export declare const ICON_SIZES: {
33
+ readonly sm: 16;
34
+ readonly md: 18;
35
+ readonly lg: 24;
36
+ readonly xl: 36;
37
+ readonly xxl: 48;
38
+ };
39
+ export type IconSize = keyof typeof ICON_SIZES;
40
+ export type ColorToken = keyof RawColors;
41
+ export type { Breakpoint } from './tokens/breakpoints.css.js';
42
+ //# sourceMappingURL=keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,UAAU,CAAA;AAEvC,eAAO,MAAM,YAAY,8DAA+D,CAAA;AACxF,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAGxD,eAAO,MAAM,UAAU;;;;;;;;;CASb,CAAA;AAEV,eAAO,MAAM,WAAW,2CAA4C,CAAA;AACpE,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAGtD,eAAO,MAAM,QAAQ;;;;;;CAMX,CAAA;AAEV,eAAO,MAAM,WAAW,6BAA8B,CAAA;AACtD,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAGtD,eAAO,MAAM,WAAW;;;;;CAKd,CAAA;AACV,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,WAAW,CAAA;AAIpD,eAAO,MAAM,UAAU;;;;;;CAMb,CAAA;AACV,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,UAAU,CAAA;AAE9C,MAAM,MAAM,UAAU,GAAG,MAAM,SAAS,CAAA;AAExC,YAAY,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duro-app/tokens",
3
- "version": "0.52.0",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -35,6 +35,7 @@
35
35
  "types": "./src/raw.ts",
36
36
  "default": "./dist/raw.js"
37
37
  },
38
+ "./keys": "./src/keys.ts",
38
39
  "./tokens/breakpoints.css": "./src/tokens/breakpoints.css.ts",
39
40
  "./tokens/colors.css": "./src/tokens/colors.css.ts",
40
41
  "./tokens/spacing.css": "./src/tokens/spacing.css.ts",
package/src/keys.ts ADDED
@@ -0,0 +1,71 @@
1
+ // Token key unions and raw numeric values, as plain TypeScript.
2
+ //
3
+ // The css.ts files can't export these: StyleX requires inline object literals,
4
+ // and `css.defineVars` returns an opaque VarGroup whose keyof includes phantom
5
+ // members (`__opaqueId`, `__tokens`). So the scales are duplicated here as the
6
+ // typed source of truth for component props, Storybook argTypes, and tooling —
7
+ // with zero StyleX/react-strict-dom imports, so this module is safe to load in
8
+ // Node (tests, scripts, the ESLint plugin's drift test).
9
+ //
10
+ // `scripts/check-token-drift.mjs` runs in `prebuild` and fails the build if any
11
+ // value here diverges from the corresponding css.ts literal.
12
+
13
+ // Explicit .js extensions: this module is also typechecked under NodeNext
14
+ // resolution (the ESLint plugin's tests import it via the `types` condition),
15
+ // which rejects extensionless relative imports. Both are type-only, so they
16
+ // are erased at build time.
17
+ import type {RawColors} from './raw.js'
18
+
19
+ export const SPACING_KEYS = ['xs', 'sm', 'ms', 'md', 'lg', 'xl', 'xxl', 'xxxl'] as const
20
+ export type SpacingToken = (typeof SPACING_KEYS)[number]
21
+
22
+ // Mirrors tokens/spacing.css.ts `spacing` (px).
23
+ export const SPACING_PX = {
24
+ xs: 4,
25
+ sm: 8,
26
+ ms: 12,
27
+ md: 16,
28
+ lg: 24,
29
+ xl: 32,
30
+ xxl: 48,
31
+ xxxl: 64,
32
+ } as const
33
+
34
+ export const RADIUS_KEYS = ['xs', 'sm', 'md', 'lg', 'full'] as const
35
+ export type RadiusToken = (typeof RADIUS_KEYS)[number]
36
+
37
+ // Mirrors tokens/spacing.css.ts `radii` (px).
38
+ export const RADII_PX = {
39
+ xs: 4,
40
+ sm: 8,
41
+ md: 12,
42
+ lg: 16,
43
+ full: 9999,
44
+ } as const
45
+
46
+ export const SHADOW_KEYS = ['sm', 'md', 'lg'] as const
47
+ export type ShadowToken = (typeof SHADOW_KEYS)[number]
48
+
49
+ // Mirrors tokens/motion.css.ts `duration`, as numbers for setTimeout use.
50
+ export const DURATION_MS = {
51
+ instant: 0,
52
+ fast: 150,
53
+ base: 200,
54
+ slow: 280,
55
+ } as const
56
+ export type DurationToken = keyof typeof DURATION_MS
57
+
58
+ // Icon rendering sizes (SVG width/height, px). Not a css.defineVars scale —
59
+ // icons size via attributes, not CSS custom properties.
60
+ export const ICON_SIZES = {
61
+ sm: 16,
62
+ md: 18,
63
+ lg: 24,
64
+ xl: 36,
65
+ xxl: 48,
66
+ } as const
67
+ export type IconSize = keyof typeof ICON_SIZES
68
+
69
+ export type ColorToken = keyof RawColors
70
+
71
+ export type {Breakpoint} from './tokens/breakpoints.css.js'