@hanzo/design 0.5.0 → 0.5.1

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/LICENSE CHANGED
@@ -1,28 +1,14 @@
1
- BSD 3-Clause License
1
+ Licensed under either of
2
2
 
3
- Copyright (c) 2026 Hanzo AI, Inc.
3
+ * Apache License, Version 2.0 (LICENSE-APACHE or
4
+ https://www.apache.org/licenses/LICENSE-2.0)
5
+ * MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
4
6
 
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions are met:
7
+ at your option.
7
8
 
8
- 1. Redistributions of source code must retain the above copyright notice, this
9
- list of conditions and the following disclaimer.
9
+ Unless you explicitly state otherwise, any contribution intentionally
10
+ submitted for inclusion in the work by you, as defined in the Apache-2.0
11
+ license, shall be dual licensed as above, without any additional terms or
12
+ conditions.
10
13
 
11
- 2. Redistributions in binary form must reproduce the above copyright notice,
12
- this list of conditions and the following disclaimer in the documentation
13
- and/or other materials provided with the distribution.
14
-
15
- 3. Neither the name of the copyright holder nor the names of its
16
- contributors may be used to endorse or promote products derived from
17
- this software without specific prior written permission.
18
-
19
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
+ See HIP-0137 (hanzoai/hips) for the standard this follows.
package/README.md CHANGED
@@ -126,7 +126,7 @@ Tokens track `hanzo.ai` (`app/globals.css`, `tailwind.config.ts`, `DESIGN.md`) a
126
126
 
127
127
  ## License
128
128
 
129
- BSD-3-Clause. Brand marks (the Hanzo logo, partner and provider logos) are the property of their respective owners and are provided for identification.
129
+ MIT OR Apache-2.0, per [HIP-0137](https://github.com/hanzoai/hips/blob/main/HIPs/hip-0137-one-license.md). Brand marks (the Hanzo logo, partner and provider logos) are the property of their respective owners and are provided for identification.
130
130
 
131
131
  ## Using it in a Tailwind app
132
132
 
package/dist/index.d.ts CHANGED
@@ -34,4 +34,6 @@ export declare function tokenValue(name: CssVarName): string | undefined;
34
34
  * bare. Pass a URL you serve.
35
35
  */
36
36
  export declare function injectDesignCss(href: string): void;
37
+ export { vars, css, isColor, TYPE_MIN, TYPE_MAX } from './preference.js';
38
+ export type { Preference, Density } from './preference.js';
37
39
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAW,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE1D,uFAAuF;AACvF,MAAM,MAAM,SAAS,GAAG,UAAU,SAAS,KAAK,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAA;AAErE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAI9E;AAED,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAE/D;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAQlD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAW,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE1D,uFAAuF;AACvF,MAAM,MAAM,SAAS,GAAG,UAAU,SAAS,KAAK,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAA;AAErE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAI9E;AAED,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAE/D;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAQlD;AAKD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACzE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -59,3 +59,7 @@ export function injectDesignCss(href) {
59
59
  l.setAttribute('data-hanzo-design', '');
60
60
  document.head.appendChild(l);
61
61
  }
62
+ // A person's own reading of the system — type size, density, accent — as CSS
63
+ // custom properties. Pure: it maps a preference to variables and returns them,
64
+ // so an app, an embedded preview and a server render all apply it the same way.
65
+ export { vars, css, isColor, TYPE_MIN, TYPE_MAX } from './preference.js';
@@ -0,0 +1,65 @@
1
+ /**
2
+ * A person's own reading of the system: type size, density, accent.
3
+ *
4
+ * Three knobs, and each is ONE multiplier on a whole axis — never a restated
5
+ * ramp. The ramps live in `tokens/*.css`, authored once, and each rung carries
6
+ * its own `calc(<base> * var(--type-scale, 1))`. So a preference sets three
7
+ * numbers and every rung follows, including rungs added later and rungs this
8
+ * file has never heard of.
9
+ *
10
+ * That is not a style choice; it is the fix for a real bug. The first version of
11
+ * this module kept its own copy of the type ramp so it could recompute each
12
+ * rung, and the copy was WRONG — it had `lg: 1rem` and `xl: 1.125rem` (16px and
13
+ * 18px) while `tokens/typography.css` says `0.9375rem` and `1.0625rem` (15px and
14
+ * 17px). Setting a preference of 1 — "leave it alone" — would have silently
15
+ * resized two rungs of the published design. A second copy of a value is a
16
+ * second source of truth, and it drifted before anyone used it.
17
+ *
18
+ * Because the knobs are plain multipliers, any OTHER ramp can opt in the same
19
+ * way. @hanzo/gui compiles its own `--f-size-*` scale for the 1600-odd
20
+ * `fontSize="$n"` call sites in the apps; an app that redeclares those as
21
+ * `calc(<its px> * var(--type-scale, 1))` gets the same control with no change
22
+ * at scale 1.
23
+ *
24
+ * It is a pure function on purpose: it maps a preference to custom properties
25
+ * and returns them, touching no document. That is what lets an app, an embedded
26
+ * preview and a server render apply it identically.
27
+ */
28
+ export type Density = "compact" | "default" | "comfortable";
29
+ export interface Preference {
30
+ /** Multiplier on the type ramp. 1 is the published scale. */
31
+ type?: number;
32
+ density?: Density;
33
+ /** A CSS colour for --primary / --accent. Rejected unless it is one. */
34
+ accent?: string;
35
+ }
36
+ /**
37
+ * The type multiplier is CLAMPED, and the bounds are not arbitrary.
38
+ *
39
+ * Below 0.85 the smallest rung (--text-xs, 11px) drops under 9.4px, which stops
40
+ * being small and starts being unreadable — and a preference that lets someone
41
+ * render their own tools illegible is a trap, not a choice. Above 1.4 the
42
+ * chrome stops fitting its own containers: this app's builder header already
43
+ * overlaps its actions below 1440px at scale 1.
44
+ */
45
+ export declare const TYPE_MIN = 0.85;
46
+ export declare const TYPE_MAX = 1.4;
47
+ /**
48
+ * Is this a colour, or is it something being smuggled into a style attribute?
49
+ *
50
+ * A preference is user input and its destination is CSS. `#fff`, `rgb(...)`,
51
+ * `oklch(...)` and the bare keywords are colours; anything carrying a `;`, a
52
+ * `}`, or a `url(` is trying to be a second declaration, and the answer is to
53
+ * drop the axis rather than to sanitise a string into something plausible.
54
+ */
55
+ export declare function isColor(v: string): boolean;
56
+ /**
57
+ * The custom properties a preference produces.
58
+ *
59
+ * Only the axes actually set appear, so an app can spread the result over
60
+ * whatever it already has without a default silently overriding a brand.
61
+ */
62
+ export declare function vars(p: Preference): Record<string, string>;
63
+ /** `vars()` as a declaration block, for a <style> tag or an SSR inline. */
64
+ export declare function css(p: Preference, selector?: string): string;
65
+ //# sourceMappingURL=preference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preference.d.ts","sourceRoot":"","sources":["../src/preference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,CAAC;AAE5D,MAAM,WAAW,UAAU;IACzB,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,OAAO,CAAC;AAC7B,eAAO,MAAM,QAAQ,MAAM,CAAC;AAqB5B;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAS1C;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAmB1D;AAED,2EAA2E;AAC3E,wBAAgB,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,QAAQ,SAAc,GAAG,MAAM,CAKjE"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * A person's own reading of the system: type size, density, accent.
3
+ *
4
+ * Three knobs, and each is ONE multiplier on a whole axis — never a restated
5
+ * ramp. The ramps live in `tokens/*.css`, authored once, and each rung carries
6
+ * its own `calc(<base> * var(--type-scale, 1))`. So a preference sets three
7
+ * numbers and every rung follows, including rungs added later and rungs this
8
+ * file has never heard of.
9
+ *
10
+ * That is not a style choice; it is the fix for a real bug. The first version of
11
+ * this module kept its own copy of the type ramp so it could recompute each
12
+ * rung, and the copy was WRONG — it had `lg: 1rem` and `xl: 1.125rem` (16px and
13
+ * 18px) while `tokens/typography.css` says `0.9375rem` and `1.0625rem` (15px and
14
+ * 17px). Setting a preference of 1 — "leave it alone" — would have silently
15
+ * resized two rungs of the published design. A second copy of a value is a
16
+ * second source of truth, and it drifted before anyone used it.
17
+ *
18
+ * Because the knobs are plain multipliers, any OTHER ramp can opt in the same
19
+ * way. @hanzo/gui compiles its own `--f-size-*` scale for the 1600-odd
20
+ * `fontSize="$n"` call sites in the apps; an app that redeclares those as
21
+ * `calc(<its px> * var(--type-scale, 1))` gets the same control with no change
22
+ * at scale 1.
23
+ *
24
+ * It is a pure function on purpose: it maps a preference to custom properties
25
+ * and returns them, touching no document. That is what lets an app, an embedded
26
+ * preview and a server render apply it identically.
27
+ */
28
+ /**
29
+ * The type multiplier is CLAMPED, and the bounds are not arbitrary.
30
+ *
31
+ * Below 0.85 the smallest rung (--text-xs, 11px) drops under 9.4px, which stops
32
+ * being small and starts being unreadable — and a preference that lets someone
33
+ * render their own tools illegible is a trap, not a choice. Above 1.4 the
34
+ * chrome stops fitting its own containers: this app's builder header already
35
+ * overlaps its actions below 1440px at scale 1.
36
+ */
37
+ export const TYPE_MIN = 0.85;
38
+ export const TYPE_MAX = 1.4;
39
+ /**
40
+ * Density moves SPACING only, and its range is much tighter than type's.
41
+ *
42
+ * Spacing compounds: a page nests padding inside gap inside margin, so a 0.75
43
+ * multiplier is already three-quarters of every one of those in sequence. Below
44
+ * that, touch targets fall under the 44px floor `base.css` sets for coarse
45
+ * pointers, and the control that promised comfort takes it away.
46
+ */
47
+ const DENSITY = {
48
+ compact: 0.85,
49
+ default: 1,
50
+ comfortable: 1.15,
51
+ };
52
+ const clamp = (n, lo, hi) => Math.min(hi, Math.max(lo, n));
53
+ /** Trim to 4dp so a multiplier cannot emit a 17-digit float into a stylesheet. */
54
+ const round = (n) => String(Math.round(n * 10000) / 10000);
55
+ /**
56
+ * Is this a colour, or is it something being smuggled into a style attribute?
57
+ *
58
+ * A preference is user input and its destination is CSS. `#fff`, `rgb(...)`,
59
+ * `oklch(...)` and the bare keywords are colours; anything carrying a `;`, a
60
+ * `}`, or a `url(` is trying to be a second declaration, and the answer is to
61
+ * drop the axis rather than to sanitise a string into something plausible.
62
+ */
63
+ export function isColor(v) {
64
+ const s = v.trim();
65
+ if (!s || s.length > 64)
66
+ return false;
67
+ if (/[;{}()]/.test(s) && !/^(rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color)\([^;{}]*\)$/i.test(s))
68
+ return false;
69
+ return (/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(s) ||
70
+ /^(rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color)\([^;{}]*\)$/i.test(s) ||
71
+ /^[a-z]{3,20}$/i.test(s));
72
+ }
73
+ /**
74
+ * The custom properties a preference produces.
75
+ *
76
+ * Only the axes actually set appear, so an app can spread the result over
77
+ * whatever it already has without a default silently overriding a brand.
78
+ */
79
+ export function vars(p) {
80
+ const out = {};
81
+ if (typeof p.type === "number" && Number.isFinite(p.type)) {
82
+ out["--type-scale"] = round(clamp(p.type, TYPE_MIN, TYPE_MAX));
83
+ }
84
+ if (p.density && p.density in DENSITY) {
85
+ out["--density"] = round(DENSITY[p.density]);
86
+ }
87
+ if (p.accent && isColor(p.accent)) {
88
+ // Both names, because the ramp uses --primary for action surfaces and
89
+ // --accent for selection. One hue, stated once, landing on both.
90
+ out["--primary"] = p.accent.trim();
91
+ out["--accent"] = p.accent.trim();
92
+ }
93
+ return out;
94
+ }
95
+ /** `vars()` as a declaration block, for a <style> tag or an SSR inline. */
96
+ export function css(p, selector = "html:root") {
97
+ const v = vars(p);
98
+ const keys = Object.keys(v);
99
+ if (!keys.length)
100
+ return "";
101
+ return `${selector}{${keys.map((k) => `${k}:${v[k]}`).join(";")}}`;
102
+ }
@@ -91,31 +91,32 @@ export declare const colors: {
91
91
  };
92
92
  /** typography tokens (from tokens/typography.css). Values are raw CSS. */
93
93
  export declare const typography: {
94
- readonly 'text-xs': "0.6875rem";
95
- readonly 'leading-xs': "1rem";
96
- readonly 'text-sm': "0.8125rem";
97
- readonly 'leading-sm': "1.15rem";
98
- readonly 'text-base': "0.875rem";
99
- readonly 'leading-base': "1.35rem";
100
- readonly 'text-lg': "0.9375rem";
101
- readonly 'leading-lg': "1.4rem";
102
- readonly 'text-xl': "1.0625rem";
103
- readonly 'leading-xl': "1.55rem";
104
- readonly 'text-2xl': "1.3125rem";
105
- readonly 'leading-2xl': "1.7rem";
106
- readonly 'text-3xl': "1.625rem";
107
- readonly 'leading-3xl': "1.95rem";
108
- readonly 'text-4xl': "2rem";
109
- readonly 'leading-4xl': "2.25rem";
110
- readonly 'text-5xl': "2.5rem";
94
+ readonly 'type-scale': "1";
95
+ readonly 'text-xs': "calc(0.6875rem * var(--type-scale, 1))";
96
+ readonly 'leading-xs': "calc(1rem * var(--type-scale, 1))";
97
+ readonly 'text-sm': "calc(0.8125rem * var(--type-scale, 1))";
98
+ readonly 'leading-sm': "calc(1.15rem * var(--type-scale, 1))";
99
+ readonly 'text-base': "calc(0.875rem * var(--type-scale, 1))";
100
+ readonly 'leading-base': "calc(1.35rem * var(--type-scale, 1))";
101
+ readonly 'text-lg': "calc(0.9375rem * var(--type-scale, 1))";
102
+ readonly 'leading-lg': "calc(1.4rem * var(--type-scale, 1))";
103
+ readonly 'text-xl': "calc(1.0625rem * var(--type-scale, 1))";
104
+ readonly 'leading-xl': "calc(1.55rem * var(--type-scale, 1))";
105
+ readonly 'text-2xl': "calc(1.3125rem * var(--type-scale, 1))";
106
+ readonly 'leading-2xl': "calc(1.7rem * var(--type-scale, 1))";
107
+ readonly 'text-3xl': "calc(1.625rem * var(--type-scale, 1))";
108
+ readonly 'leading-3xl': "calc(1.95rem * var(--type-scale, 1))";
109
+ readonly 'text-4xl': "calc(2rem * var(--type-scale, 1))";
110
+ readonly 'leading-4xl': "calc(2.25rem * var(--type-scale, 1))";
111
+ readonly 'text-5xl': "calc(2.5rem * var(--type-scale, 1))";
111
112
  readonly 'leading-5xl': "1.05";
112
- readonly 'text-6xl': "3.25rem";
113
+ readonly 'text-6xl': "calc(3.25rem * var(--type-scale, 1))";
113
114
  readonly 'leading-6xl': "1";
114
- readonly 'text-7xl': "4rem";
115
+ readonly 'text-7xl': "calc(4rem * var(--type-scale, 1))";
115
116
  readonly 'leading-7xl': "1";
116
- readonly 'text-8xl': "5.25rem";
117
+ readonly 'text-8xl': "calc(5.25rem * var(--type-scale, 1))";
117
118
  readonly 'leading-8xl': "1";
118
- readonly 'text-9xl': "7rem";
119
+ readonly 'text-9xl': "calc(7rem * var(--type-scale, 1))";
119
120
  readonly 'leading-9xl': "1";
120
121
  readonly 'font-size-xs': "var(--text-xs)";
121
122
  readonly 'font-size-sm': "var(--text-sm)";
@@ -156,21 +157,22 @@ export declare const typography: {
156
157
  };
157
158
  /** spacing tokens (from tokens/spacing.css). Values are raw CSS. */
158
159
  export declare const spacing: {
160
+ readonly density: "1";
159
161
  readonly 'space-0': "0";
160
- readonly 'space-1': "0.25rem";
161
- readonly 'space-2': "0.5rem";
162
- readonly 'space-3': "0.75rem";
163
- readonly 'space-4': "1rem";
164
- readonly 'space-5': "1.25rem";
165
- readonly 'space-6': "1.5rem";
166
- readonly 'space-8': "2rem";
167
- readonly 'space-10': "2.5rem";
168
- readonly 'space-12': "3rem";
169
- readonly 'space-14': "3.5rem";
170
- readonly 'space-16': "4rem";
171
- readonly 'space-20': "5rem";
172
- readonly 'space-24': "6rem";
173
- readonly 'space-32': "8rem";
162
+ readonly 'space-1': "calc(0.25rem * var(--density, 1))";
163
+ readonly 'space-2': "calc(0.5rem * var(--density, 1))";
164
+ readonly 'space-3': "calc(0.75rem * var(--density, 1))";
165
+ readonly 'space-4': "calc(1rem * var(--density, 1))";
166
+ readonly 'space-5': "calc(1.25rem * var(--density, 1))";
167
+ readonly 'space-6': "calc(1.5rem * var(--density, 1))";
168
+ readonly 'space-8': "calc(2rem * var(--density, 1))";
169
+ readonly 'space-10': "calc(2.5rem * var(--density, 1))";
170
+ readonly 'space-12': "calc(3rem * var(--density, 1))";
171
+ readonly 'space-14': "calc(3.5rem * var(--density, 1))";
172
+ readonly 'space-16': "calc(4rem * var(--density, 1))";
173
+ readonly 'space-20': "calc(5rem * var(--density, 1))";
174
+ readonly 'space-24': "calc(6rem * var(--density, 1))";
175
+ readonly 'space-32': "calc(8rem * var(--density, 1))";
174
176
  readonly 'golden-1': "0.25rem";
175
177
  readonly 'golden-2': "0.405rem";
176
178
  readonly 'golden-3': "0.654rem";
@@ -374,31 +376,32 @@ export declare const cssVars: {
374
376
  readonly '--chrome-dot-red': "rgb(239 68 68 / .6)";
375
377
  readonly '--chrome-dot-yellow': "rgb(234 179 8 / .6)";
376
378
  readonly '--chrome-dot-green': "rgb(34 197 94 / .6)";
377
- readonly '--text-xs': "0.6875rem";
378
- readonly '--leading-xs': "1rem";
379
- readonly '--text-sm': "0.8125rem";
380
- readonly '--leading-sm': "1.15rem";
381
- readonly '--text-base': "0.875rem";
382
- readonly '--leading-base': "1.35rem";
383
- readonly '--text-lg': "0.9375rem";
384
- readonly '--leading-lg': "1.4rem";
385
- readonly '--text-xl': "1.0625rem";
386
- readonly '--leading-xl': "1.55rem";
387
- readonly '--text-2xl': "1.3125rem";
388
- readonly '--leading-2xl': "1.7rem";
389
- readonly '--text-3xl': "1.625rem";
390
- readonly '--leading-3xl': "1.95rem";
391
- readonly '--text-4xl': "2rem";
392
- readonly '--leading-4xl': "2.25rem";
393
- readonly '--text-5xl': "2.5rem";
379
+ readonly '--type-scale': "1";
380
+ readonly '--text-xs': "calc(0.6875rem * var(--type-scale, 1))";
381
+ readonly '--leading-xs': "calc(1rem * var(--type-scale, 1))";
382
+ readonly '--text-sm': "calc(0.8125rem * var(--type-scale, 1))";
383
+ readonly '--leading-sm': "calc(1.15rem * var(--type-scale, 1))";
384
+ readonly '--text-base': "calc(0.875rem * var(--type-scale, 1))";
385
+ readonly '--leading-base': "calc(1.35rem * var(--type-scale, 1))";
386
+ readonly '--text-lg': "calc(0.9375rem * var(--type-scale, 1))";
387
+ readonly '--leading-lg': "calc(1.4rem * var(--type-scale, 1))";
388
+ readonly '--text-xl': "calc(1.0625rem * var(--type-scale, 1))";
389
+ readonly '--leading-xl': "calc(1.55rem * var(--type-scale, 1))";
390
+ readonly '--text-2xl': "calc(1.3125rem * var(--type-scale, 1))";
391
+ readonly '--leading-2xl': "calc(1.7rem * var(--type-scale, 1))";
392
+ readonly '--text-3xl': "calc(1.625rem * var(--type-scale, 1))";
393
+ readonly '--leading-3xl': "calc(1.95rem * var(--type-scale, 1))";
394
+ readonly '--text-4xl': "calc(2rem * var(--type-scale, 1))";
395
+ readonly '--leading-4xl': "calc(2.25rem * var(--type-scale, 1))";
396
+ readonly '--text-5xl': "calc(2.5rem * var(--type-scale, 1))";
394
397
  readonly '--leading-5xl': "1.05";
395
- readonly '--text-6xl': "3.25rem";
398
+ readonly '--text-6xl': "calc(3.25rem * var(--type-scale, 1))";
396
399
  readonly '--leading-6xl': "1";
397
- readonly '--text-7xl': "4rem";
400
+ readonly '--text-7xl': "calc(4rem * var(--type-scale, 1))";
398
401
  readonly '--leading-7xl': "1";
399
- readonly '--text-8xl': "5.25rem";
402
+ readonly '--text-8xl': "calc(5.25rem * var(--type-scale, 1))";
400
403
  readonly '--leading-8xl': "1";
401
- readonly '--text-9xl': "7rem";
404
+ readonly '--text-9xl': "calc(7rem * var(--type-scale, 1))";
402
405
  readonly '--leading-9xl': "1";
403
406
  readonly '--font-size-xs': "var(--text-xs)";
404
407
  readonly '--font-size-sm': "var(--text-sm)";
@@ -436,21 +439,22 @@ export declare const cssVars: {
436
439
  readonly '--type-caption': "400 var(--text-xs)/var(--leading-xs) var(--font-sans)";
437
440
  readonly '--type-code': "400 var(--text-sm)/var(--leading-relaxed) var(--font-mono)";
438
441
  readonly '--type-eyebrow': "600 0.625rem/1 var(--font-sans)";
442
+ readonly '--density': "1";
439
443
  readonly '--space-0': "0";
440
- readonly '--space-1': "0.25rem";
441
- readonly '--space-2': "0.5rem";
442
- readonly '--space-3': "0.75rem";
443
- readonly '--space-4': "1rem";
444
- readonly '--space-5': "1.25rem";
445
- readonly '--space-6': "1.5rem";
446
- readonly '--space-8': "2rem";
447
- readonly '--space-10': "2.5rem";
448
- readonly '--space-12': "3rem";
449
- readonly '--space-14': "3.5rem";
450
- readonly '--space-16': "4rem";
451
- readonly '--space-20': "5rem";
452
- readonly '--space-24': "6rem";
453
- readonly '--space-32': "8rem";
444
+ readonly '--space-1': "calc(0.25rem * var(--density, 1))";
445
+ readonly '--space-2': "calc(0.5rem * var(--density, 1))";
446
+ readonly '--space-3': "calc(0.75rem * var(--density, 1))";
447
+ readonly '--space-4': "calc(1rem * var(--density, 1))";
448
+ readonly '--space-5': "calc(1.25rem * var(--density, 1))";
449
+ readonly '--space-6': "calc(1.5rem * var(--density, 1))";
450
+ readonly '--space-8': "calc(2rem * var(--density, 1))";
451
+ readonly '--space-10': "calc(2.5rem * var(--density, 1))";
452
+ readonly '--space-12': "calc(3rem * var(--density, 1))";
453
+ readonly '--space-14': "calc(3.5rem * var(--density, 1))";
454
+ readonly '--space-16': "calc(4rem * var(--density, 1))";
455
+ readonly '--space-20': "calc(5rem * var(--density, 1))";
456
+ readonly '--space-24': "calc(6rem * var(--density, 1))";
457
+ readonly '--space-32': "calc(8rem * var(--density, 1))";
454
458
  readonly '--golden-1': "0.25rem";
455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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoQV,CAAA;AAEV,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,OAAO,CAAA"}
@@ -94,31 +94,32 @@ export const colors = {
94
94
  };
95
95
  /** typography tokens (from tokens/typography.css). Values are raw CSS. */
96
96
  export const typography = {
97
- 'text-xs': '0.6875rem',
98
- 'leading-xs': '1rem',
99
- 'text-sm': '0.8125rem',
100
- 'leading-sm': '1.15rem',
101
- 'text-base': '0.875rem',
102
- 'leading-base': '1.35rem',
103
- 'text-lg': '0.9375rem',
104
- 'leading-lg': '1.4rem',
105
- 'text-xl': '1.0625rem',
106
- 'leading-xl': '1.55rem',
107
- 'text-2xl': '1.3125rem',
108
- 'leading-2xl': '1.7rem',
109
- 'text-3xl': '1.625rem',
110
- 'leading-3xl': '1.95rem',
111
- 'text-4xl': '2rem',
112
- 'leading-4xl': '2.25rem',
113
- 'text-5xl': '2.5rem',
97
+ 'type-scale': '1',
98
+ 'text-xs': 'calc(0.6875rem * var(--type-scale, 1))',
99
+ 'leading-xs': 'calc(1rem * var(--type-scale, 1))',
100
+ 'text-sm': 'calc(0.8125rem * var(--type-scale, 1))',
101
+ 'leading-sm': 'calc(1.15rem * var(--type-scale, 1))',
102
+ 'text-base': 'calc(0.875rem * var(--type-scale, 1))',
103
+ 'leading-base': 'calc(1.35rem * var(--type-scale, 1))',
104
+ 'text-lg': 'calc(0.9375rem * var(--type-scale, 1))',
105
+ 'leading-lg': 'calc(1.4rem * var(--type-scale, 1))',
106
+ 'text-xl': 'calc(1.0625rem * var(--type-scale, 1))',
107
+ 'leading-xl': 'calc(1.55rem * var(--type-scale, 1))',
108
+ 'text-2xl': 'calc(1.3125rem * var(--type-scale, 1))',
109
+ 'leading-2xl': 'calc(1.7rem * var(--type-scale, 1))',
110
+ 'text-3xl': 'calc(1.625rem * var(--type-scale, 1))',
111
+ 'leading-3xl': 'calc(1.95rem * var(--type-scale, 1))',
112
+ 'text-4xl': 'calc(2rem * var(--type-scale, 1))',
113
+ 'leading-4xl': 'calc(2.25rem * var(--type-scale, 1))',
114
+ 'text-5xl': 'calc(2.5rem * var(--type-scale, 1))',
114
115
  'leading-5xl': '1.05',
115
- 'text-6xl': '3.25rem',
116
+ 'text-6xl': 'calc(3.25rem * var(--type-scale, 1))',
116
117
  'leading-6xl': '1',
117
- 'text-7xl': '4rem',
118
+ 'text-7xl': 'calc(4rem * var(--type-scale, 1))',
118
119
  'leading-7xl': '1',
119
- 'text-8xl': '5.25rem',
120
+ 'text-8xl': 'calc(5.25rem * var(--type-scale, 1))',
120
121
  'leading-8xl': '1',
121
- 'text-9xl': '7rem',
122
+ 'text-9xl': 'calc(7rem * var(--type-scale, 1))',
122
123
  'leading-9xl': '1',
123
124
  'font-size-xs': 'var(--text-xs)',
124
125
  'font-size-sm': 'var(--text-sm)',
@@ -159,21 +160,22 @@ export const typography = {
159
160
  };
160
161
  /** spacing tokens (from tokens/spacing.css). Values are raw CSS. */
161
162
  export const spacing = {
163
+ 'density': '1',
162
164
  'space-0': '0',
163
- 'space-1': '0.25rem',
164
- 'space-2': '0.5rem',
165
- 'space-3': '0.75rem',
166
- 'space-4': '1rem',
167
- 'space-5': '1.25rem',
168
- 'space-6': '1.5rem',
169
- 'space-8': '2rem',
170
- 'space-10': '2.5rem',
171
- 'space-12': '3rem',
172
- 'space-14': '3.5rem',
173
- 'space-16': '4rem',
174
- 'space-20': '5rem',
175
- 'space-24': '6rem',
176
- 'space-32': '8rem',
165
+ 'space-1': 'calc(0.25rem * var(--density, 1))',
166
+ 'space-2': 'calc(0.5rem * var(--density, 1))',
167
+ 'space-3': 'calc(0.75rem * var(--density, 1))',
168
+ 'space-4': 'calc(1rem * var(--density, 1))',
169
+ 'space-5': 'calc(1.25rem * var(--density, 1))',
170
+ 'space-6': 'calc(1.5rem * var(--density, 1))',
171
+ 'space-8': 'calc(2rem * var(--density, 1))',
172
+ 'space-10': 'calc(2.5rem * var(--density, 1))',
173
+ 'space-12': 'calc(3rem * var(--density, 1))',
174
+ 'space-14': 'calc(3.5rem * var(--density, 1))',
175
+ 'space-16': 'calc(4rem * var(--density, 1))',
176
+ 'space-20': 'calc(5rem * var(--density, 1))',
177
+ 'space-24': 'calc(6rem * var(--density, 1))',
178
+ 'space-32': 'calc(8rem * var(--density, 1))',
177
179
  'golden-1': '0.25rem',
178
180
  'golden-2': '0.405rem',
179
181
  'golden-3': '0.654rem',
@@ -377,31 +379,32 @@ export const cssVars = {
377
379
  '--chrome-dot-red': 'rgb(239 68 68 / .6)',
378
380
  '--chrome-dot-yellow': 'rgb(234 179 8 / .6)',
379
381
  '--chrome-dot-green': 'rgb(34 197 94 / .6)',
380
- '--text-xs': '0.6875rem',
381
- '--leading-xs': '1rem',
382
- '--text-sm': '0.8125rem',
383
- '--leading-sm': '1.15rem',
384
- '--text-base': '0.875rem',
385
- '--leading-base': '1.35rem',
386
- '--text-lg': '0.9375rem',
387
- '--leading-lg': '1.4rem',
388
- '--text-xl': '1.0625rem',
389
- '--leading-xl': '1.55rem',
390
- '--text-2xl': '1.3125rem',
391
- '--leading-2xl': '1.7rem',
392
- '--text-3xl': '1.625rem',
393
- '--leading-3xl': '1.95rem',
394
- '--text-4xl': '2rem',
395
- '--leading-4xl': '2.25rem',
396
- '--text-5xl': '2.5rem',
382
+ '--type-scale': '1',
383
+ '--text-xs': 'calc(0.6875rem * var(--type-scale, 1))',
384
+ '--leading-xs': 'calc(1rem * var(--type-scale, 1))',
385
+ '--text-sm': 'calc(0.8125rem * var(--type-scale, 1))',
386
+ '--leading-sm': 'calc(1.15rem * var(--type-scale, 1))',
387
+ '--text-base': 'calc(0.875rem * var(--type-scale, 1))',
388
+ '--leading-base': 'calc(1.35rem * var(--type-scale, 1))',
389
+ '--text-lg': 'calc(0.9375rem * var(--type-scale, 1))',
390
+ '--leading-lg': 'calc(1.4rem * var(--type-scale, 1))',
391
+ '--text-xl': 'calc(1.0625rem * var(--type-scale, 1))',
392
+ '--leading-xl': 'calc(1.55rem * var(--type-scale, 1))',
393
+ '--text-2xl': 'calc(1.3125rem * var(--type-scale, 1))',
394
+ '--leading-2xl': 'calc(1.7rem * var(--type-scale, 1))',
395
+ '--text-3xl': 'calc(1.625rem * var(--type-scale, 1))',
396
+ '--leading-3xl': 'calc(1.95rem * var(--type-scale, 1))',
397
+ '--text-4xl': 'calc(2rem * var(--type-scale, 1))',
398
+ '--leading-4xl': 'calc(2.25rem * var(--type-scale, 1))',
399
+ '--text-5xl': 'calc(2.5rem * var(--type-scale, 1))',
397
400
  '--leading-5xl': '1.05',
398
- '--text-6xl': '3.25rem',
401
+ '--text-6xl': 'calc(3.25rem * var(--type-scale, 1))',
399
402
  '--leading-6xl': '1',
400
- '--text-7xl': '4rem',
403
+ '--text-7xl': 'calc(4rem * var(--type-scale, 1))',
401
404
  '--leading-7xl': '1',
402
- '--text-8xl': '5.25rem',
405
+ '--text-8xl': 'calc(5.25rem * var(--type-scale, 1))',
403
406
  '--leading-8xl': '1',
404
- '--text-9xl': '7rem',
407
+ '--text-9xl': 'calc(7rem * var(--type-scale, 1))',
405
408
  '--leading-9xl': '1',
406
409
  '--font-size-xs': 'var(--text-xs)',
407
410
  '--font-size-sm': 'var(--text-sm)',
@@ -439,21 +442,22 @@ export const cssVars = {
439
442
  '--type-caption': '400 var(--text-xs)/var(--leading-xs) var(--font-sans)',
440
443
  '--type-code': '400 var(--text-sm)/var(--leading-relaxed) var(--font-mono)',
441
444
  '--type-eyebrow': '600 0.625rem/1 var(--font-sans)',
445
+ '--density': '1',
442
446
  '--space-0': '0',
443
- '--space-1': '0.25rem',
444
- '--space-2': '0.5rem',
445
- '--space-3': '0.75rem',
446
- '--space-4': '1rem',
447
- '--space-5': '1.25rem',
448
- '--space-6': '1.5rem',
449
- '--space-8': '2rem',
450
- '--space-10': '2.5rem',
451
- '--space-12': '3rem',
452
- '--space-14': '3.5rem',
453
- '--space-16': '4rem',
454
- '--space-20': '5rem',
455
- '--space-24': '6rem',
456
- '--space-32': '8rem',
447
+ '--space-1': 'calc(0.25rem * var(--density, 1))',
448
+ '--space-2': 'calc(0.5rem * var(--density, 1))',
449
+ '--space-3': 'calc(0.75rem * var(--density, 1))',
450
+ '--space-4': 'calc(1rem * var(--density, 1))',
451
+ '--space-5': 'calc(1.25rem * var(--density, 1))',
452
+ '--space-6': 'calc(1.5rem * var(--density, 1))',
453
+ '--space-8': 'calc(2rem * var(--density, 1))',
454
+ '--space-10': 'calc(2.5rem * var(--density, 1))',
455
+ '--space-12': 'calc(3rem * var(--density, 1))',
456
+ '--space-14': 'calc(3.5rem * var(--density, 1))',
457
+ '--space-16': 'calc(4rem * var(--density, 1))',
458
+ '--space-20': 'calc(5rem * var(--density, 1))',
459
+ '--space-24': 'calc(6rem * var(--density, 1))',
460
+ '--space-32': 'calc(8rem * var(--density, 1))',
457
461
  '--golden-1': '0.25rem',
458
462
  '--golden-2': '0.405rem',
459
463
  '--golden-3': '0.654rem',