@hugocxl/design 0.0.1 → 0.1.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.
@@ -0,0 +1,128 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+
3
+ export type Theme = 'light' | 'dark';
4
+
5
+ /** Inline in <head> to apply the stored or system theme before the page paints. */
6
+ export declare const themeScript: string;
7
+ export declare function getTheme(): Theme;
8
+ export declare function setTheme(theme: Theme): void;
9
+
10
+ export interface ThemeToggleProps extends ComponentPropsWithoutRef<'button'> {
11
+ /** Accessible name. Default "Switch theme". */
12
+ label?: string;
13
+ /** Icon; defaults to a contrast icon. */
14
+ children?: ReactNode;
15
+ }
16
+ export declare function ThemeToggle(props: ThemeToggleProps): ReactNode;
17
+
18
+ export interface PageProps extends ComponentPropsWithoutRef<'div'> {
19
+ masthead?: ReactNode;
20
+ footer?: ReactNode;
21
+ /** Rendered inside main > article.ds-column.ds-opening. */
22
+ children?: ReactNode;
23
+ }
24
+ export declare function Page(props: PageProps): ReactNode;
25
+
26
+ export interface NavItem {
27
+ label: ReactNode;
28
+ href: string;
29
+ /** An icon element with class "ds-icon", shown alone on narrow screens. */
30
+ icon?: ReactNode;
31
+ current?: boolean;
32
+ }
33
+ export interface MastheadProps extends ComponentPropsWithoutRef<'header'> {
34
+ wordmark: ReactNode;
35
+ /** Wordmark link. Default "/". */
36
+ href?: string;
37
+ /** Up to three items. */
38
+ links?: NavItem[];
39
+ /** One link at the end, e.g. GitHub. */
40
+ pageLink?: { label: ReactNode; href: string };
41
+ /** Show the theme switch. Default true. */
42
+ theme?: boolean;
43
+ }
44
+ export declare function Masthead(props: MastheadProps): ReactNode;
45
+
46
+ export interface HeroProps extends Omit<ComponentPropsWithoutRef<'section'>, 'title'> {
47
+ eyebrow?: ReactNode;
48
+ title: ReactNode;
49
+ lead?: ReactNode;
50
+ /** Buttons: one primary Button and at most one variant="more". */
51
+ actions?: ReactNode;
52
+ }
53
+ export declare function Hero(props: HeroProps): ReactNode;
54
+
55
+ export interface TitleProps extends Omit<ComponentPropsWithoutRef<'hgroup'>, 'title'> {
56
+ title: ReactNode;
57
+ subtitle?: ReactNode;
58
+ /** Small grey labels under the title (version, date). */
59
+ meta?: ReactNode[];
60
+ }
61
+ export declare function Title(props: TitleProps): ReactNode;
62
+
63
+ export interface SectionProps extends Omit<ComponentPropsWithoutRef<'section'>, 'title'> {
64
+ title?: ReactNode;
65
+ }
66
+ export declare function Section(props: SectionProps): ReactNode;
67
+
68
+ export interface ButtonProps extends ComponentPropsWithoutRef<'a'> {
69
+ /** "primary" (ink, .ds-button) or "more" (wash with trailing icon, .ds-more). */
70
+ variant?: 'primary' | 'more';
71
+ /** Renders an <a> when set, otherwise a <button>. */
72
+ href?: string;
73
+ icon?: ReactNode;
74
+ }
75
+ export declare function Button(props: ButtonProps): ReactNode;
76
+
77
+ export interface FigureProps extends ComponentPropsWithoutRef<'figure'> {
78
+ src?: string;
79
+ alt?: string;
80
+ width?: number;
81
+ height?: number;
82
+ /** Shown as a grey label, e.g. "Fig. 01 / A workspace". */
83
+ caption?: ReactNode;
84
+ /** Break out to the wide measure. Default true. */
85
+ wide?: boolean;
86
+ /** Custom media (e.g. a vector) instead of an <img>. */
87
+ children?: ReactNode;
88
+ }
89
+ export declare function Figure(props: FigureProps): ReactNode;
90
+
91
+ export interface GridItem {
92
+ key?: string | number;
93
+ title: ReactNode;
94
+ description?: ReactNode;
95
+ href?: string;
96
+ visual?: ReactNode;
97
+ }
98
+ export interface GridProps extends ComponentPropsWithoutRef<'ul'> {
99
+ columns?: 2 | 3 | 4;
100
+ items: GridItem[];
101
+ }
102
+ export declare function Grid(props: GridProps): ReactNode;
103
+
104
+ export interface IndexItem {
105
+ key?: string | number;
106
+ id?: string;
107
+ label: ReactNode;
108
+ title: ReactNode;
109
+ href?: string;
110
+ description?: ReactNode;
111
+ children?: ReactNode;
112
+ }
113
+ export interface IndexProps extends ComponentPropsWithoutRef<'ol'> {
114
+ items: IndexItem[];
115
+ }
116
+ export declare function Index(props: IndexProps): ReactNode;
117
+
118
+ export interface FooterItem {
119
+ label: ReactNode;
120
+ href?: string;
121
+ }
122
+ export interface FooterProps extends ComponentPropsWithoutRef<'footer'> {
123
+ /** Default: "© <year> Hugo Corta". */
124
+ start?: FooterItem[];
125
+ /** Default: GitHub and npm. */
126
+ end?: FooterItem[];
127
+ }
128
+ export declare function Footer(props: FooterProps): ReactNode;
package/dist/react.js ADDED
@@ -0,0 +1,124 @@
1
+ // @hugocxl/design React components: thin wrappers that render the ds-* markup of design.css.
2
+ // Import the stylesheet once (`import '@hugocxl/design/css'`) and put `themeScript` in <head>.
3
+ import { createElement as h, Fragment, useEffect, useRef } from 'react';
4
+
5
+ const cx = (...names) => names.filter(Boolean).join(' ');
6
+
7
+ // Inline this in <head> (before the page paints) to apply the stored or system theme.
8
+ export const themeScript = "(function(){try{var t=localStorage.getItem('ds-theme')}catch(e){}document.documentElement.dataset.theme=t||(matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light')})()";
9
+
10
+ export function getTheme() {
11
+ return document.documentElement.dataset.theme === 'dark' ? 'dark' : 'light';
12
+ }
13
+
14
+ export function setTheme(theme) {
15
+ document.documentElement.dataset.theme = theme;
16
+ try { localStorage.setItem('ds-theme', theme); } catch {}
17
+ }
18
+
19
+ const ContrastIcon = () =>
20
+ h('svg', { className: 'ds-icon', viewBox: '0 0 16 16', fill: 'none', 'aria-hidden': 'true' },
21
+ h('path', { fill: 'currentColor', d: 'M1.48 8Q1.48 6.6739 1.9926 5.462Q2.4875 4.2918 3.3897 3.3897Q4.2918 2.4875 5.462 1.9926Q6.6739 1.48 8 1.48Q9.3261 1.48 10.538 1.9926Q11.7082 2.4875 12.6103 3.3897Q13.5125 4.2918 14.0074 5.462Q14.52 6.6739 14.52 8Q14.52 9.3261 14.0074 10.538Q13.5125 11.7082 12.6103 12.6103Q11.7082 13.5125 10.538 14.0074Q9.3261 14.52 8 14.52Q6.6739 14.52 5.462 14.0074Q4.2918 13.5125 3.3897 12.6103Q2.4875 11.7082 1.9926 10.538Q1.48 9.3261 1.48 8ZM2.52 8Q2.52 9.1152 2.9504 10.1329Q3.3663 11.1162 4.1251 11.8749Q4.8838 12.6337 5.8671 13.0496Q6.8847 13.48 8 13.48L8 2.52Q6.8848 2.52 5.8671 2.9504Q4.8838 3.3663 4.1251 4.1251Q3.3663 4.8838 2.9504 5.8671Q2.52 6.8848 2.52 8Z' }));
22
+
23
+ export function ThemeToggle({ label = 'Switch theme', children, className, ...rest }) {
24
+ return h('button', {
25
+ type: 'button',
26
+ className: cx('ds-theme', className),
27
+ 'aria-label': label,
28
+ onClick: () => setTheme(getTheme() === 'dark' ? 'light' : 'dark'),
29
+ ...rest,
30
+ }, children ?? h(ContrastIcon));
31
+ }
32
+
33
+ // The whole page: masthead, main > article.ds-column.ds-opening > children, footer.
34
+ export function Page({ masthead, footer, children, className, ...rest }) {
35
+ return h('div', { className: cx('ds', className), 'data-layout': 'plain', ...rest },
36
+ masthead,
37
+ h('main', null, h('article', { className: 'ds-column ds-opening' }, children)),
38
+ footer);
39
+ }
40
+
41
+ const NavLink = ({ label, href, icon, current }) =>
42
+ h('a', { href, 'aria-current': current ? 'page' : undefined }, icon, label);
43
+
44
+ export function Masthead({ wordmark, href = '/', links = [], pageLink, theme = true, children, className, ...rest }) {
45
+ const ref = useRef(null);
46
+ useEffect(() => {
47
+ const mark = () => ref.current?.toggleAttribute('data-scrolled', window.scrollY > 0);
48
+ mark();
49
+ window.addEventListener('scroll', mark, { passive: true });
50
+ return () => window.removeEventListener('scroll', mark);
51
+ }, []);
52
+ return h('header', { ref, className: cx('ds-masthead', className), ...rest },
53
+ h('a', { className: 'ds-wordmark', href }, wordmark),
54
+ links.length ? h('nav', { 'aria-label': 'Main' }, links.map(link => h(NavLink, { key: link.href, ...link }))) : null,
55
+ pageLink ? h('a', { href: pageLink.href }, pageLink.label) : null,
56
+ children,
57
+ theme ? h(ThemeToggle) : null);
58
+ }
59
+
60
+ export function Hero({ eyebrow, title, lead, actions, children, className, ...rest }) {
61
+ return h('section', { className: cx('ds-hero', className), ...rest },
62
+ eyebrow ? h('p', { className: 'ds-eyebrow' }, eyebrow) : null,
63
+ h('h1', null, title),
64
+ lead ? h('p', null, lead) : null,
65
+ actions ? h('p', { className: 'ds-actions' }, actions) : null,
66
+ children);
67
+ }
68
+
69
+ export function Title({ title, subtitle, meta, className, ...rest }) {
70
+ return h(Fragment, null,
71
+ h('hgroup', { className: cx('ds-title', className), ...rest },
72
+ h('h1', null, title),
73
+ subtitle ? h('p', null, subtitle) : null),
74
+ meta?.length ? h('ul', { className: 'ds-meta' }, meta.map((item, i) => h('li', { key: i, className: 'ds-label' }, item))) : null);
75
+ }
76
+
77
+ export function Section({ title, children, className, ...rest }) {
78
+ return h('section', { className: cx('ds-section', className), ...rest },
79
+ title ? h('h2', null, title) : null,
80
+ children);
81
+ }
82
+
83
+ export function Button({ variant = 'primary', href, icon, children, className, ...rest }) {
84
+ const props = { className: cx(variant === 'more' ? 'ds-more' : 'ds-button', className), ...rest };
85
+ if (href) return h('a', { href, ...props }, icon, children);
86
+ return h('button', { type: 'button', ...props }, icon, children);
87
+ }
88
+
89
+ export function Figure({ src, alt = '', width, height, caption, wide = true, children, className, ...rest }) {
90
+ return h('figure', { className: cx(wide && 'ds-wide', className), ...rest },
91
+ h('div', { className: 'ds-media' }, children ?? h('img', { src, alt, width, height })),
92
+ caption ? h('figcaption', { className: 'ds-caption' }, h('span', { className: 'ds-label' }, caption)) : null);
93
+ }
94
+
95
+ export function Grid({ columns = 3, items = [], className, ...rest }) {
96
+ return h('ul', { className: cx('ds-grid', className), 'data-columns': String(columns), ...rest },
97
+ items.map((item, i) => h('li', { key: item.key ?? i },
98
+ item.visual,
99
+ h('h3', null, item.href ? h('a', { href: item.href }, item.title) : item.title),
100
+ item.description ? h('p', null, item.description) : null)));
101
+ }
102
+
103
+ export function Index({ items = [], className, ...rest }) {
104
+ return h('ol', { className: cx('ds-index', className), ...rest },
105
+ items.map((item, i) => h('li', { key: item.key ?? i, id: item.id },
106
+ h('span', { className: 'ds-label' }, item.label),
107
+ h('div', null,
108
+ h('h3', null, item.href ? h('a', { href: item.href }, item.title) : item.title),
109
+ item.description ? h('p', null, item.description) : null,
110
+ item.children))));
111
+ }
112
+
113
+ const year = () => new Date().getFullYear();
114
+ const FooterList = ({ items }) =>
115
+ h('ul', null, items.map((item, i) => h('li', { key: i }, item.href ? h('a', { href: item.href }, item.label) : item.label)));
116
+
117
+ export function Footer({
118
+ start = [{ label: `© ${year()} Hugo Corta` }],
119
+ end = [{ label: 'GitHub', href: 'https://github.com/hugocxl' }, { label: 'npm', href: 'https://www.npmjs.com/~hugocxl' }],
120
+ className,
121
+ ...rest
122
+ }) {
123
+ return h('footer', { className: cx('ds-footer', className), ...rest }, h(FooterList, { items: start }), h(FooterList, { items: end }));
124
+ }
@@ -0,0 +1,53 @@
1
+ /* @hugocxl/design — generated by scripts/build.mjs. Do not edit. */
2
+ /* Use after `@import "tailwindcss";`. Add `@import "@hugocxl/design/css";` too for the ds-* classes. */
3
+ @import "./tokens.css";
4
+ @custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));
5
+
6
+ @theme inline {
7
+ --color-canvas: var(--ds-canvas);
8
+ --color-ink: var(--ds-ink);
9
+ --color-muted: var(--ds-muted);
10
+ --color-faint: var(--ds-faint);
11
+ --color-rule: var(--ds-rule);
12
+ --color-surface: var(--ds-surface);
13
+ --color-edge: var(--ds-edge);
14
+ --color-accent: var(--ds-accent);
15
+ --color-accent-text: var(--ds-accent-text);
16
+ --color-action: var(--ds-action);
17
+ --color-on-action: var(--ds-on-action);
18
+ --color-material: var(--ds-material);
19
+ --font-sans: var(--ds-sans);
20
+ --font-mono: var(--ds-mono);
21
+ --text-reading: var(--ds-size-reading);
22
+ --text-display: var(--ds-size-display);
23
+ --text-title: var(--ds-size-title);
24
+ --text-heading: var(--ds-size-heading);
25
+ --text-lead: var(--ds-size-lead);
26
+ --text-small: var(--ds-size-small);
27
+ --text-control: var(--ds-size-control);
28
+ --text-label: var(--ds-size-label);
29
+ --text-code: var(--ds-size-code);
30
+ --spacing-space-1: var(--ds-space-1);
31
+ --spacing-space-2: var(--ds-space-2);
32
+ --spacing-space-3: var(--ds-space-3);
33
+ --spacing-space-4: var(--ds-space-4);
34
+ --spacing-space-5: var(--ds-space-5);
35
+ --spacing-space-6: var(--ds-space-6);
36
+ --spacing-space-7: var(--ds-space-7);
37
+ --spacing-space-8: var(--ds-space-8);
38
+ --spacing-space-9: var(--ds-space-9);
39
+ --spacing-space-10: var(--ds-space-10);
40
+ --spacing-target: var(--ds-target);
41
+ --spacing-bar: var(--ds-bar);
42
+ --radius-control: var(--ds-radius-control);
43
+ --radius-media: var(--ds-radius-media);
44
+ --radius-pill: var(--ds-radius-pill);
45
+ --container-measure: var(--ds-measure);
46
+ --container-wide: var(--ds-wide);
47
+ --ease-ds: cubic-bezier(.25, .1, .25, 1);
48
+ }
49
+
50
+ @layer base {
51
+ html { background: var(--ds-canvas); color: var(--ds-ink); font-family: var(--ds-sans); -webkit-font-smoothing: antialiased }
52
+ code, kbd, samp, pre { font-family: var(--ds-mono) }
53
+ }
package/dist/theme.js ADDED
@@ -0,0 +1,16 @@
1
+ // @hugocxl/design theme switch. Load it in <head> as a classic script so the page never flashes
2
+ // the wrong theme. It follows the system appearance until the visitor presses a [data-ds-theme]
3
+ // button, then remembers their choice in localStorage ("ds-theme").
4
+ (function () {
5
+ var root = document.documentElement;
6
+ var query = window.matchMedia('(prefers-color-scheme: dark)');
7
+ function stored() { try { return localStorage.getItem('ds-theme'); } catch (e) { return null; } }
8
+ function apply() { root.dataset.theme = stored() || (query.matches ? 'dark' : 'light'); }
9
+ apply();
10
+ query.addEventListener('change', apply);
11
+ document.addEventListener('click', function (event) {
12
+ if (!event.target.closest || !event.target.closest('[data-ds-theme]')) return;
13
+ try { localStorage.setItem('ds-theme', root.dataset.theme === 'dark' ? 'light' : 'dark'); } catch (e) {}
14
+ apply();
15
+ });
16
+ })();
@@ -0,0 +1,78 @@
1
+ /* @hugocxl/design — generated by scripts/build.mjs. Do not edit. */
2
+ :root {
3
+ --ds-canvas: #f8f8f8;
4
+ --ds-ink: #151515;
5
+ --ds-muted: #151515a3;
6
+ --ds-faint: #1515155c;
7
+ --ds-rule: #15151514;
8
+ --ds-surface: #ffffffcc;
9
+ --ds-edge: #ffffff;
10
+ --ds-accent: #f31a7c;
11
+ --ds-accent-text: #d5176d;
12
+ --ds-action: #151515;
13
+ --ds-on-action: #ffffff;
14
+ --ds-material: #f8f8f8cc;
15
+ --ds-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
16
+ --ds-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
17
+ --ds-size-reading: 1rem;
18
+ --ds-size-display: clamp(2.25rem, calc(1.5rem + 3vw), 3.5rem);
19
+ --ds-size-title: 2rem;
20
+ --ds-size-heading: 1.25rem;
21
+ --ds-size-lead: 1.125rem;
22
+ --ds-size-small: .875rem;
23
+ --ds-size-control: .9375rem;
24
+ --ds-size-label: .875rem;
25
+ --ds-size-code: .875rem;
26
+ --ds-space-1: .25rem;
27
+ --ds-space-2: .5rem;
28
+ --ds-space-3: .75rem;
29
+ --ds-space-4: 1rem;
30
+ --ds-space-5: 1.25rem;
31
+ --ds-space-6: 2rem;
32
+ --ds-space-7: 2.5rem;
33
+ --ds-space-8: 3.5rem;
34
+ --ds-space-9: 5rem;
35
+ --ds-space-10: 8rem;
36
+ --ds-radius-control: 8px;
37
+ --ds-radius-media: 12px;
38
+ --ds-radius-pill: 999px;
39
+ --ds-target: 40px;
40
+ --ds-bar: 3.25rem;
41
+ --ds-measure: 40rem;
42
+ --ds-wide: 51.25rem;
43
+ --ds-ease: 160ms cubic-bezier(.25, .1, .25, 1);
44
+ accent-color: var(--ds-accent);
45
+ color-scheme: light;
46
+ }
47
+ @media (prefers-color-scheme: dark) {
48
+ :root:not([data-theme=light]) {
49
+ --ds-canvas: #151515;
50
+ --ds-ink: #ffffff;
51
+ --ds-muted: #ffffffc9;
52
+ --ds-faint: #ffffff80;
53
+ --ds-rule: #ffffff14;
54
+ --ds-surface: #ffffff0a;
55
+ --ds-edge: #ffffff0a;
56
+ --ds-accent: #f31a7c;
57
+ --ds-accent-text: #f6539d;
58
+ --ds-action: #ffffff;
59
+ --ds-on-action: #151515;
60
+ --ds-material: #151515cc;
61
+ color-scheme: dark;
62
+ }
63
+ }
64
+ :root[data-theme=dark] {
65
+ --ds-canvas: #151515;
66
+ --ds-ink: #ffffff;
67
+ --ds-muted: #ffffffc9;
68
+ --ds-faint: #ffffff80;
69
+ --ds-rule: #ffffff14;
70
+ --ds-surface: #ffffff0a;
71
+ --ds-edge: #ffffff0a;
72
+ --ds-accent: #f31a7c;
73
+ --ds-accent-text: #f6539d;
74
+ --ds-action: #ffffff;
75
+ --ds-on-action: #151515;
76
+ --ds-material: #151515cc;
77
+ color-scheme: dark;
78
+ }
@@ -0,0 +1,76 @@
1
+ /* @hugocxl/design — generated by scripts/build.mjs. Do not edit. */
2
+ export declare const tokens: {
3
+ readonly "color": {
4
+ readonly "light": {
5
+ readonly "canvas": string;
6
+ readonly "ink": string;
7
+ readonly "muted": string;
8
+ readonly "faint": string;
9
+ readonly "rule": string;
10
+ readonly "surface": string;
11
+ readonly "edge": string;
12
+ readonly "accent": string;
13
+ readonly "accent-text": string;
14
+ readonly "action": string;
15
+ readonly "on-action": string;
16
+ readonly "material": string;
17
+ };
18
+ readonly "dark": {
19
+ readonly "canvas": string;
20
+ readonly "ink": string;
21
+ readonly "muted": string;
22
+ readonly "faint": string;
23
+ readonly "rule": string;
24
+ readonly "surface": string;
25
+ readonly "edge": string;
26
+ readonly "accent": string;
27
+ readonly "accent-text": string;
28
+ readonly "action": string;
29
+ readonly "on-action": string;
30
+ readonly "material": string;
31
+ };
32
+ };
33
+ readonly "font": {
34
+ readonly "sans": string;
35
+ readonly "mono": string;
36
+ };
37
+ readonly "size": {
38
+ readonly "reading": string;
39
+ readonly "display": string;
40
+ readonly "title": string;
41
+ readonly "heading": string;
42
+ readonly "lead": string;
43
+ readonly "small": string;
44
+ readonly "control": string;
45
+ readonly "label": string;
46
+ readonly "code": string;
47
+ };
48
+ readonly "space": {
49
+ readonly "1": string;
50
+ readonly "2": string;
51
+ readonly "3": string;
52
+ readonly "4": string;
53
+ readonly "5": string;
54
+ readonly "6": string;
55
+ readonly "7": string;
56
+ readonly "8": string;
57
+ readonly "9": string;
58
+ readonly "10": string;
59
+ };
60
+ readonly "radius": {
61
+ readonly "control": string;
62
+ readonly "media": string;
63
+ readonly "pill": string;
64
+ };
65
+ readonly "layout": {
66
+ readonly "target": string;
67
+ readonly "bar": string;
68
+ readonly "measure": string;
69
+ readonly "wide": string;
70
+ };
71
+ readonly "motion": {
72
+ readonly "ease": string;
73
+ };
74
+ };
75
+ export declare const vars: Readonly<Record<"color.canvas" | "color.ink" | "color.muted" | "color.faint" | "color.rule" | "color.surface" | "color.edge" | "color.accent" | "color.accent-text" | "color.action" | "color.on-action" | "color.material" | "font.sans" | "font.mono" | "size.reading" | "size.display" | "size.title" | "size.heading" | "size.lead" | "size.small" | "size.control" | "size.label" | "size.code" | "space.1" | "space.2" | "space.3" | "space.4" | "space.5" | "space.6" | "space.7" | "space.8" | "space.9" | "space.10" | "radius.control" | "radius.media" | "radius.pill" | "layout.target" | "layout.bar" | "layout.measure" | "layout.wide" | "motion.ease", string>>;
76
+ export default tokens;
package/dist/tokens.js ADDED
@@ -0,0 +1,121 @@
1
+ /* @hugocxl/design — generated by scripts/build.mjs. Do not edit. */
2
+ export const tokens = {
3
+ "color": {
4
+ "light": {
5
+ "canvas": "#f8f8f8",
6
+ "ink": "#151515",
7
+ "muted": "#151515a3",
8
+ "faint": "#1515155c",
9
+ "rule": "#15151514",
10
+ "surface": "#ffffffcc",
11
+ "edge": "#ffffff",
12
+ "accent": "#f31a7c",
13
+ "accent-text": "#d5176d",
14
+ "action": "#151515",
15
+ "on-action": "#ffffff",
16
+ "material": "#f8f8f8cc"
17
+ },
18
+ "dark": {
19
+ "canvas": "#151515",
20
+ "ink": "#ffffff",
21
+ "muted": "#ffffffc9",
22
+ "faint": "#ffffff80",
23
+ "rule": "#ffffff14",
24
+ "surface": "#ffffff0a",
25
+ "edge": "#ffffff0a",
26
+ "accent": "#f31a7c",
27
+ "accent-text": "#f6539d",
28
+ "action": "#ffffff",
29
+ "on-action": "#151515",
30
+ "material": "#151515cc"
31
+ }
32
+ },
33
+ "font": {
34
+ "sans": "system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif",
35
+ "mono": "ui-monospace, SFMono-Regular, Menlo, monospace"
36
+ },
37
+ "size": {
38
+ "reading": "1rem",
39
+ "display": "clamp(2.25rem, calc(1.5rem + 3vw), 3.5rem)",
40
+ "title": "2rem",
41
+ "heading": "1.25rem",
42
+ "lead": "1.125rem",
43
+ "small": ".875rem",
44
+ "control": ".9375rem",
45
+ "label": ".875rem",
46
+ "code": ".875rem"
47
+ },
48
+ "space": {
49
+ "1": ".25rem",
50
+ "2": ".5rem",
51
+ "3": ".75rem",
52
+ "4": "1rem",
53
+ "5": "1.25rem",
54
+ "6": "2rem",
55
+ "7": "2.5rem",
56
+ "8": "3.5rem",
57
+ "9": "5rem",
58
+ "10": "8rem"
59
+ },
60
+ "radius": {
61
+ "control": "8px",
62
+ "media": "12px",
63
+ "pill": "999px"
64
+ },
65
+ "layout": {
66
+ "target": "40px",
67
+ "bar": "3.25rem",
68
+ "measure": "40rem",
69
+ "wide": "51.25rem"
70
+ },
71
+ "motion": {
72
+ "ease": "160ms cubic-bezier(.25, .1, .25, 1)"
73
+ }
74
+ };
75
+
76
+ /** CSS custom property references, e.g. vars['color.ink'] === 'var(--ds-ink)'. */
77
+ export const vars = {
78
+ "color.canvas": "var(--ds-canvas)",
79
+ "color.ink": "var(--ds-ink)",
80
+ "color.muted": "var(--ds-muted)",
81
+ "color.faint": "var(--ds-faint)",
82
+ "color.rule": "var(--ds-rule)",
83
+ "color.surface": "var(--ds-surface)",
84
+ "color.edge": "var(--ds-edge)",
85
+ "color.accent": "var(--ds-accent)",
86
+ "color.accent-text": "var(--ds-accent-text)",
87
+ "color.action": "var(--ds-action)",
88
+ "color.on-action": "var(--ds-on-action)",
89
+ "color.material": "var(--ds-material)",
90
+ "font.sans": "var(--ds-sans)",
91
+ "font.mono": "var(--ds-mono)",
92
+ "size.reading": "var(--ds-size-reading)",
93
+ "size.display": "var(--ds-size-display)",
94
+ "size.title": "var(--ds-size-title)",
95
+ "size.heading": "var(--ds-size-heading)",
96
+ "size.lead": "var(--ds-size-lead)",
97
+ "size.small": "var(--ds-size-small)",
98
+ "size.control": "var(--ds-size-control)",
99
+ "size.label": "var(--ds-size-label)",
100
+ "size.code": "var(--ds-size-code)",
101
+ "space.1": "var(--ds-space-1)",
102
+ "space.2": "var(--ds-space-2)",
103
+ "space.3": "var(--ds-space-3)",
104
+ "space.4": "var(--ds-space-4)",
105
+ "space.5": "var(--ds-space-5)",
106
+ "space.6": "var(--ds-space-6)",
107
+ "space.7": "var(--ds-space-7)",
108
+ "space.8": "var(--ds-space-8)",
109
+ "space.9": "var(--ds-space-9)",
110
+ "space.10": "var(--ds-space-10)",
111
+ "radius.control": "var(--ds-radius-control)",
112
+ "radius.media": "var(--ds-radius-media)",
113
+ "radius.pill": "var(--ds-radius-pill)",
114
+ "layout.target": "var(--ds-target)",
115
+ "layout.bar": "var(--ds-bar)",
116
+ "layout.measure": "var(--ds-measure)",
117
+ "layout.wide": "var(--ds-wide)",
118
+ "motion.ease": "var(--ds-ease)"
119
+ };
120
+
121
+ export default tokens;
@@ -0,0 +1,73 @@
1
+ {
2
+ "color": {
3
+ "light": {
4
+ "canvas": "#f8f8f8",
5
+ "ink": "#151515",
6
+ "muted": "#151515a3",
7
+ "faint": "#1515155c",
8
+ "rule": "#15151514",
9
+ "surface": "#ffffffcc",
10
+ "edge": "#ffffff",
11
+ "accent": "#f31a7c",
12
+ "accent-text": "#d5176d",
13
+ "action": "#151515",
14
+ "on-action": "#ffffff",
15
+ "material": "#f8f8f8cc"
16
+ },
17
+ "dark": {
18
+ "canvas": "#151515",
19
+ "ink": "#ffffff",
20
+ "muted": "#ffffffc9",
21
+ "faint": "#ffffff80",
22
+ "rule": "#ffffff14",
23
+ "surface": "#ffffff0a",
24
+ "edge": "#ffffff0a",
25
+ "accent": "#f31a7c",
26
+ "accent-text": "#f6539d",
27
+ "action": "#ffffff",
28
+ "on-action": "#151515",
29
+ "material": "#151515cc"
30
+ }
31
+ },
32
+ "font": {
33
+ "sans": "system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif",
34
+ "mono": "ui-monospace, SFMono-Regular, Menlo, monospace"
35
+ },
36
+ "size": {
37
+ "reading": "1rem",
38
+ "display": "clamp(2.25rem, calc(1.5rem + 3vw), 3.5rem)",
39
+ "title": "2rem",
40
+ "heading": "1.25rem",
41
+ "lead": "1.125rem",
42
+ "small": ".875rem",
43
+ "control": ".9375rem",
44
+ "label": ".875rem",
45
+ "code": ".875rem"
46
+ },
47
+ "space": {
48
+ "1": ".25rem",
49
+ "2": ".5rem",
50
+ "3": ".75rem",
51
+ "4": "1rem",
52
+ "5": "1.25rem",
53
+ "6": "2rem",
54
+ "7": "2.5rem",
55
+ "8": "3.5rem",
56
+ "9": "5rem",
57
+ "10": "8rem"
58
+ },
59
+ "radius": {
60
+ "control": "8px",
61
+ "media": "12px",
62
+ "pill": "999px"
63
+ },
64
+ "layout": {
65
+ "target": "40px",
66
+ "bar": "3.25rem",
67
+ "measure": "40rem",
68
+ "wide": "51.25rem"
69
+ },
70
+ "motion": {
71
+ "ease": "160ms cubic-bezier(.25, .1, .25, 1)"
72
+ }
73
+ }