@tokamaq/ui 0.0.0-stage → 0.1.0-dev.2

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 (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +23 -2
  3. package/lint/index.js +22 -0
  4. package/lint/oxlint.json +58 -0
  5. package/lint/plugin.js +411 -0
  6. package/package.json +82 -4
  7. package/src/avatar.tsx +34 -0
  8. package/src/button.tsx +109 -0
  9. package/src/chip.tsx +52 -0
  10. package/src/cn.ts +71 -0
  11. package/src/code-block.tsx +58 -0
  12. package/src/collapsible.tsx +76 -0
  13. package/src/command.tsx +101 -0
  14. package/src/dialog.tsx +93 -0
  15. package/src/file-name.tsx +41 -0
  16. package/src/fonts/Geist-Variable.woff2 +0 -0
  17. package/src/fonts/GeistMono-Variable.woff2 +0 -0
  18. package/src/fonts/OFL.txt +92 -0
  19. package/src/fonts.css +15 -0
  20. package/src/icon.tsx +30 -0
  21. package/src/icons.ts +23 -0
  22. package/src/index.ts +24 -0
  23. package/src/input.tsx +86 -0
  24. package/src/kbd.tsx +33 -0
  25. package/src/kit/command.tsx +45 -0
  26. package/src/kit/contrast.ts +31 -0
  27. package/src/kit/controls.tsx +233 -0
  28. package/src/kit/disclosure.tsx +39 -0
  29. package/src/kit/frame.tsx +34 -0
  30. package/src/kit/inputs.tsx +53 -0
  31. package/src/kit/kit.tsx +76 -0
  32. package/src/kit/overlays.tsx +79 -0
  33. package/src/kit/rows.tsx +160 -0
  34. package/src/kit/tokens.tsx +189 -0
  35. package/src/menu.tsx +99 -0
  36. package/src/resizable.tsx +40 -0
  37. package/src/row-list.tsx +65 -0
  38. package/src/row.tsx +147 -0
  39. package/src/scroll-area.tsx +64 -0
  40. package/src/select.tsx +67 -0
  41. package/src/status-icon.tsx +49 -0
  42. package/src/switch.tsx +73 -0
  43. package/src/tabs.tsx +44 -0
  44. package/src/textarea.tsx +30 -0
  45. package/src/theme.css +397 -0
  46. package/src/tooltip.tsx +40 -0
  47. package/tests/setup.ts +29 -0
@@ -0,0 +1,34 @@
1
+ import { For } from "solid-js";
2
+ import type { JSX } from "@solidjs/web";
3
+
4
+ export type Theme = "dark" | "light";
5
+
6
+ export function Themes(props: { children: (theme: Theme) => JSX.Element }): JSX.Element {
7
+ return (
8
+ <div class="grid grid-cols-2">
9
+ <For each={["dark", "light"] as const}>
10
+ {(theme) => (
11
+ <div data-theme={theme} aria-label={`${theme} theme`} role="group">
12
+ <div class="flex h-full flex-col gap-12 surface-window p-8">{props.children(theme)}</div>
13
+ </div>
14
+ )}
15
+ </For>
16
+ </div>
17
+ );
18
+ }
19
+
20
+ export function Section(props: { label: string; title: string; children: JSX.Element }): JSX.Element {
21
+ return (
22
+ <section class="flex flex-col gap-4">
23
+ <div class="flex flex-col gap-1">
24
+ <span class="text-data text-ink-3">{props.label}</span>
25
+ <h3 class="text-read font-semibold text-ink">{props.title}</h3>
26
+ </div>
27
+ {props.children}
28
+ </section>
29
+ );
30
+ }
31
+
32
+ export function Caption(props: { children: JSX.Element }): JSX.Element {
33
+ return <span class="text-label text-ink-3">{props.children}</span>;
34
+ }
@@ -0,0 +1,53 @@
1
+ import { For } from "solid-js";
2
+ import { Button, Input, Switch, icons } from "@tokamaq/ui";
3
+ import type { JSX } from "@solidjs/web";
4
+ import { Caption, Section } from "./frame.tsx";
5
+
6
+ const switches = [
7
+ { state: "on", checked: true },
8
+ { state: "off", checked: false },
9
+ { state: "focus", checked: true, preview: "focus" },
10
+ { state: "disabled on", checked: true, disabled: true },
11
+ { state: "disabled off", checked: false, disabled: true },
12
+ ] as const;
13
+
14
+ export function Inputs(props: { theme: string }): JSX.Element {
15
+ return (
16
+ <Section label="Primitives · Input, Switch" title="One line, on or off">
17
+ <div class="grid grid-cols-2 items-start gap-4">
18
+ <Input aria-label={`Empty label, ${props.theme}`} placeholder="Personal" />
19
+ <Input aria-label={`Filled label, ${props.theme}`} value="Personal" size="lg" />
20
+ <Input
21
+ aria-label={`Callback link, ${props.theme}`}
22
+ mono
23
+ placeholder="http://localhost:1455/callback?code=…"
24
+ />
25
+ <Input
26
+ aria-label={`Search, ${props.theme}`}
27
+ icon={icons.search}
28
+ placeholder="Search subscriptions"
29
+ trail={<Button variant="ghost" icon={icons.close} label="Clear" tabindex={-1} />}
30
+ />
31
+ <Input aria-label={`Focused, ${props.theme}`} data-preview="focus" placeholder="Focused" />
32
+ <Input aria-label={`Invalid code, ${props.theme}`} mono invalid value="PERSONAL" />
33
+ <Input aria-label={`Disabled, ${props.theme}`} disabled placeholder="Disabled" />
34
+ </div>
35
+ <Caption>md 40 · lg 48 · mono for links and codes · invalid edges in red.</Caption>
36
+ <div class="flex items-center gap-6">
37
+ <For each={switches}>
38
+ {(item) => (
39
+ <span class="flex items-center gap-2">
40
+ <Switch
41
+ aria-label={`${item.state}, ${props.theme}`}
42
+ defaultChecked={item.checked}
43
+ disabled={"disabled" in item}
44
+ data-preview={"preview" in item ? item.preview : undefined}
45
+ />
46
+ <Caption>{item.state}</Caption>
47
+ </span>
48
+ )}
49
+ </For>
50
+ </div>
51
+ </Section>
52
+ );
53
+ }
@@ -0,0 +1,76 @@
1
+ /*
2
+ <Kit />
3
+
4
+ Every token and primitive in dark and light side by side, in each state.
5
+ Mounted by the app at /kit.
6
+ */
7
+ import { Show, createSignal } from "solid-js";
8
+ import type { JSX } from "@solidjs/web";
9
+ import { Button, Tabs } from "@tokamaq/ui";
10
+ import { Buttons, Facts, Fields, OnSurfaces } from "./controls.tsx";
11
+ import { Disclosure } from "./disclosure.tsx";
12
+ import { Inputs } from "./inputs.tsx";
13
+ import { Themes } from "./frame.tsx";
14
+ import { Overlays } from "./overlays.tsx";
15
+ import { Rows } from "./rows.tsx";
16
+ import { Space, Tones, Type } from "./tokens.tsx";
17
+
18
+ export function Kit(): JSX.Element {
19
+ const [open, setOpen] = createSignal(false);
20
+ return (
21
+ <div id="kit" data-theme="dark" class="surface-window">
22
+ <Tabs.Root defaultValue="tokens">
23
+ <div class="flex items-center gap-4 bg-window px-8 pt-6 pb-4">
24
+ <h2 class="text-read font-semibold text-ink">Tokamaq UI kit</h2>
25
+ <Tabs.List aria-label="Kit sections">
26
+ <Tabs.Tab value="tokens">Tokens</Tabs.Tab>
27
+ <Tabs.Tab value="controls">Controls</Tabs.Tab>
28
+ <Tabs.Tab value="rows">Rows</Tabs.Tab>
29
+ <Tabs.Tab value="overlays">Popups</Tabs.Tab>
30
+ </Tabs.List>
31
+ </div>
32
+ <Tabs.Panel value="tokens">
33
+ <Themes>
34
+ {() => (
35
+ <>
36
+ <Tones />
37
+ <Type />
38
+ <Space />
39
+ </>
40
+ )}
41
+ </Themes>
42
+ </Tabs.Panel>
43
+ <Tabs.Panel value="controls">
44
+ <Themes>
45
+ {(theme) => (
46
+ <>
47
+ <Buttons />
48
+ <OnSurfaces />
49
+ <Facts />
50
+ <Fields theme={theme} />
51
+ <Inputs theme={theme} />
52
+ <Disclosure theme={theme} />
53
+ </>
54
+ )}
55
+ </Themes>
56
+ </Tabs.Panel>
57
+ <Tabs.Panel value="rows">
58
+ <Themes>{(theme) => <Rows theme={theme} />}</Themes>
59
+ </Tabs.Panel>
60
+ <Tabs.Panel value="overlays">
61
+ <div class="flex items-center gap-4 bg-window px-8 pb-4">
62
+ <Button variant="outline" onClick={() => setOpen(!open())}>
63
+ {open() ? "Close the popups" : "Show the popups open"}
64
+ </Button>
65
+ </div>
66
+ <Show
67
+ when={open()}
68
+ fallback={<Themes>{(theme) => <Overlays theme={theme} open={false} />}</Themes>}
69
+ >
70
+ <Themes>{(theme) => <Overlays theme={theme} open />}</Themes>
71
+ </Show>
72
+ </Tabs.Panel>
73
+ </Tabs.Root>
74
+ </div>
75
+ );
76
+ }
@@ -0,0 +1,79 @@
1
+ import type { JSX } from "@solidjs/web";
2
+ import { Dialog, Menu, Select, Tooltip, icons } from "@tokamaq/ui";
3
+ import { CommandList } from "./command.tsx";
4
+ import { Caption, Section } from "./frame.tsx";
5
+
6
+ const densities = [
7
+ { value: "roomy", label: "Roomy" },
8
+ { value: "normal", label: "Normal" },
9
+ { value: "dense", label: "Dense" },
10
+ ];
11
+
12
+ export function Overlays(props: { theme: string; open: boolean }): JSX.Element {
13
+ return (
14
+ <>
15
+ <Section label="Primitives · Menu, Select, Tooltip, Dialog" title="Popups">
16
+ <Caption>
17
+ {props.open ? "Shown open. Escape closes; focus returns to the trigger." : "Closed."}
18
+ </Caption>
19
+ <div>
20
+ <Dialog.Root>
21
+ <Dialog.Trigger variant="outline">Rename thread</Dialog.Trigger>
22
+ <Dialog.Backdrop />
23
+ <Dialog.Content>
24
+ <Dialog.Title>Rename thread</Dialog.Title>
25
+ <Dialog.Description>Only you see the new name.</Dialog.Description>
26
+ <div class="flex justify-end gap-2">
27
+ <Dialog.Close>Cancel</Dialog.Close>
28
+ <Dialog.Close variant="brand">Save</Dialog.Close>
29
+ </div>
30
+ </Dialog.Content>
31
+ </Dialog.Root>
32
+ </div>
33
+ <div class="grid grid-cols-3 items-start gap-8">
34
+ <div>
35
+ <Menu.Root defaultOpen={props.open} modal={false}>
36
+ <Menu.Trigger variant="ghost" icon={icons.more} label={`Thread actions, ${props.theme}`} />
37
+ <Menu.Content align="start">
38
+ <Menu.Item value="rename">Rename</Menu.Item>
39
+ <Menu.Item value="archive" shortcut="mod+e">
40
+ Archive
41
+ </Menu.Item>
42
+ <Menu.Item value="share" disabled>
43
+ Share
44
+ </Menu.Item>
45
+ <Menu.Separator />
46
+ <Menu.Item value="delete" destructive>
47
+ Delete
48
+ </Menu.Item>
49
+ </Menu.Content>
50
+ </Menu.Root>
51
+ </div>
52
+ <div>
53
+ <Select.Root defaultValue="normal" items={densities} defaultOpen={props.open} modal={false}>
54
+ <Select.Label>Density, {props.theme}</Select.Label>
55
+ <Select.Trigger>
56
+ <Select.Value />
57
+ </Select.Trigger>
58
+ <Select.Content>
59
+ <Select.Item value="roomy">Roomy</Select.Item>
60
+ <Select.Item value="normal">Normal</Select.Item>
61
+ <Select.Item value="dense">Dense</Select.Item>
62
+ </Select.Content>
63
+ </Select.Root>
64
+ </div>
65
+ <div>
66
+ <Tooltip.Root defaultOpen={props.open}>
67
+ <Tooltip.Trigger variant="ghost" icon={icons.search} label={`Search, ${props.theme}`} />
68
+ <Tooltip.Content>Search threads</Tooltip.Content>
69
+ </Tooltip.Root>
70
+ </div>
71
+ </div>
72
+ <div aria-hidden="true" class="h-16" />
73
+ <div aria-hidden="true" class="h-16" />
74
+ <div aria-hidden="true" class="h-16" />
75
+ </Section>
76
+ <CommandList theme={props.theme} />
77
+ </>
78
+ );
79
+ }
@@ -0,0 +1,160 @@
1
+ import { For, createSignal } from "solid-js";
2
+ import type { JSX } from "@solidjs/web";
3
+ import { Avatar, Icon, Row, RowList, StatusIcon } from "@tokamaq/ui";
4
+ import { Caption, Section } from "./frame.tsx";
5
+
6
+ // LobeHub marks for Claude and OpenAI, as on the boards. Sample data only.
7
+ const claude =
8
+ "M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z";
9
+ const openai =
10
+ "M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z";
11
+
12
+ function Model(props: { mark: string; name: string; project?: string }): JSX.Element {
13
+ return (
14
+ <>
15
+ <Icon path={props.mark} size={12} />
16
+ <span class="text-data">{props.name}</span>
17
+ {props.project && <span>· {props.project}</span>}
18
+ </>
19
+ );
20
+ }
21
+
22
+ function Agent(props: {
23
+ mark: string;
24
+ name: string;
25
+ activity: string;
26
+ status: "running" | "done";
27
+ }): JSX.Element {
28
+ return (
29
+ <Row
30
+ kind="half"
31
+ lead={<Icon path={props.mark} size={12} />}
32
+ trail={<StatusIcon status={props.status} size={12} label={props.activity} />}
33
+ >
34
+ <span class="text-data text-ink-2">{props.name}</span> {props.activity}
35
+ </Row>
36
+ );
37
+ }
38
+
39
+ export function Threads(props: { theme: string }): JSX.Element {
40
+ const [value, setValue] = createSignal<string | null>("csv");
41
+ return (
42
+ <div class="density-dense">
43
+ <RowList.Root
44
+ aria-label={`Threads, ${props.theme}`}
45
+ value={value()}
46
+ onValueChange={(next: unknown) => setValue(next as string | null)}
47
+ >
48
+ <RowList.Option
49
+ value="csv"
50
+ kind="double"
51
+ lead={<StatusIcon status="running" label="Add CSV export" />}
52
+ trail="0:12"
53
+ detail={<Model mark={claude} name="sonnet 4.5" project="invoices-app" />}
54
+ sub={
55
+ <>
56
+ <Agent mark={claude} name="haiku 4.5" activity="running tests" status="running" />
57
+ <Agent mark={claude} name="haiku 4.5" activity="read 6 files" status="done" />
58
+ </>
59
+ }
60
+ >
61
+ Add CSV export
62
+ </RowList.Option>
63
+ <RowList.Option
64
+ value="rounding"
65
+ kind="double"
66
+ lead={<StatusIcon status="needs-you" label="Fix total rounding" />}
67
+ trail="2m"
68
+ detail={<Model mark={openai} name="gpt-5 codex" project="invoices-app" />}
69
+ >
70
+ Fix total rounding
71
+ </RowList.Option>
72
+ <RowList.Group>
73
+ <RowList.Option
74
+ value="paginate"
75
+ lead={<StatusIcon status="done" label="Paginate customer list" />}
76
+ trail="12m"
77
+ >
78
+ Paginate customer list
79
+ </RowList.Option>
80
+ <RowList.Option
81
+ value="stripe"
82
+ lead={<StatusIcon status="failed" label="Upgrade Stripe SDK" />}
83
+ trail="3h"
84
+ >
85
+ Upgrade Stripe SDK
86
+ </RowList.Option>
87
+ <RowList.Option
88
+ value="pdf"
89
+ lead={<StatusIcon status="done" label="PDF dark mode" />}
90
+ trail="1d"
91
+ disabled
92
+ >
93
+ PDF dark mode
94
+ </RowList.Option>
95
+ <RowList.Option
96
+ value="refund"
97
+ lead={<StatusIcon status="running" label="Refund flow" />}
98
+ trail={<Avatar name="Ana" size={16} />}
99
+ >
100
+ Refund flow
101
+ </RowList.Option>
102
+ </RowList.Group>
103
+ </RowList.Root>
104
+ </div>
105
+ );
106
+ }
107
+
108
+ const densities = ["roomy", "normal", "dense"] as const;
109
+ const densityClass = { roomy: "density-roomy", normal: "density-normal", dense: "density-dense" } as const;
110
+ const rowStates = [
111
+ ["rest", undefined, false],
112
+ ["hover", "hover", false],
113
+ ["focus", "focus", false],
114
+ ["selected", undefined, true],
115
+ ] as const;
116
+
117
+ export function Rows(props: { theme: string }): JSX.Element {
118
+ return (
119
+ <Section label="Primitives · Row, RowList, Density" title="Half 24 · single 32 / 40 / 48 · double 48">
120
+ <div class="grid grid-cols-2 gap-8">
121
+ <Threads theme={props.theme} />
122
+ <div class="flex flex-col gap-2">
123
+ <Caption>The chosen thread list (C). Arrows move, Enter picks. PDF dark mode is disabled.</Caption>
124
+ <For each={rowStates}>
125
+ {([state, preview, selected]) => (
126
+ <div class="density-dense">
127
+ <Row
128
+ lead={<StatusIcon status="done" />}
129
+ trail="12m"
130
+ selected={selected}
131
+ data-preview={preview}
132
+ render={(attrs) => <a href="#kit" tabindex={-1} {...attrs} />}
133
+ >
134
+ Row · {state}
135
+ </Row>
136
+ </div>
137
+ )}
138
+ </For>
139
+ </div>
140
+ </div>
141
+ <div class="grid grid-cols-3 gap-4">
142
+ <For each={densities}>
143
+ {(density) => (
144
+ <div class="flex flex-col gap-1">
145
+ <Caption>{density}</Caption>
146
+ <div class={`flex flex-col gap-1 ${densityClass[density]}`}>
147
+ <Row lead={<StatusIcon status="done" />} trail="12m" selected>
148
+ Weekly admin
149
+ </Row>
150
+ <Row lead={<StatusIcon status="running" />} trail="1d">
151
+ Trip to Lisbon
152
+ </Row>
153
+ </div>
154
+ </div>
155
+ )}
156
+ </For>
157
+ </div>
158
+ </Section>
159
+ );
160
+ }
@@ -0,0 +1,189 @@
1
+ import { For, createSignal } from "solid-js";
2
+ import type { JSX } from "@solidjs/web";
3
+ import { Caption, Section } from "./frame.tsx";
4
+ import { tokenContrast } from "./contrast.ts";
5
+
6
+ const surfaces = ["window", "stage", "tray", "card", "band"] as const;
7
+ const inks = ["ink", "ink-2", "ink-3"] as const;
8
+ const semantic = ["added", "removed", "warn", "info"] as const;
9
+
10
+ const surfaceClass: Record<(typeof surfaces)[number], string> = {
11
+ window: "bg-window",
12
+ stage: "bg-stage",
13
+ tray: "bg-tray",
14
+ card: "bg-card",
15
+ band: "bg-band",
16
+ };
17
+ const inkClass: Record<(typeof inks)[number], string> = {
18
+ ink: "text-ink",
19
+ "ink-2": "text-ink-2",
20
+ "ink-3": "text-ink-3",
21
+ };
22
+ const semanticClass: Record<(typeof semantic)[number], [string, string]> = {
23
+ added: ["text-added", "bg-added-tint"],
24
+ removed: ["text-removed", "bg-removed-tint"],
25
+ warn: ["text-warn", "bg-warn-tint"],
26
+ info: ["text-info", "bg-info-tint"],
27
+ };
28
+
29
+ export function Tones(): JSX.Element {
30
+ return (
31
+ <Section label="Tokens · colour" title="Five surfaces, three text tones">
32
+ <div class="grid grid-cols-5 gap-2">
33
+ <For each={surfaces}>
34
+ {(surface) => (
35
+ <div class={`flex flex-col gap-2 rounded-md p-3 ${surfaceClass[surface]}`}>
36
+ <span class="text-row font-medium text-ink">{surface}</span>
37
+ <For each={inks}>{(ink) => <span class={`text-label ${inkClass[ink]}`}>{ink}</span>}</For>
38
+ </div>
39
+ )}
40
+ </For>
41
+ </div>
42
+ <div class="grid grid-cols-4 gap-2">
43
+ <For each={semantic}>
44
+ {(name) => (
45
+ <div class={`flex flex-col gap-1 rounded-md p-3 ${semanticClass[name][1]}`}>
46
+ <span class={`text-data ${semanticClass[name][0]}`}>{name} +12</span>
47
+ <span class="text-label text-ink-2">{name}-tint</span>
48
+ </div>
49
+ )}
50
+ </For>
51
+ </div>
52
+ <div class="flex items-center gap-3">
53
+ <span class="rounded-sm bg-brand px-3 py-1 text-row font-medium text-brand-ink">
54
+ brand / brand-ink
55
+ </span>
56
+ <span class="rounded-sm bg-brand-tint px-3 py-1 text-row text-brand-text">
57
+ brand-text on brand-tint
58
+ </span>
59
+ <a href="#kit" class="text-row link">
60
+ A link is brand-text, underlined
61
+ </a>
62
+ </div>
63
+ <Measured />
64
+ </Section>
65
+ );
66
+ }
67
+
68
+ type Pair = { fg: string; bg: string; ratio: number; need: number };
69
+
70
+ function measure(root: Element): Pair[] {
71
+ const pairs: Pair[] = [];
72
+ const add = (fg: string, bg: string, need: number) =>
73
+ pairs.push({ fg, bg, need, ratio: tokenContrast(root, fg, bg) });
74
+ for (const ink of inks) for (const surface of surfaces) add(ink, surface, 4.5);
75
+ for (const name of semantic) for (const bg of ["stage", "card", "band", `${name}-tint`]) add(name, bg, 4.5);
76
+ for (const surface of surfaces) add("brand-text", surface, 4.5);
77
+ add("brand-text", "brand-tint", 4.5);
78
+ add("brand-ink", "brand", 4.5);
79
+ add("stage", "ink", 4.5);
80
+ add("stage", "removed", 4.5);
81
+ return pairs;
82
+ }
83
+
84
+ function Measured(): JSX.Element {
85
+ const [pairs, setPairs] = createSignal<Pair[]>([]);
86
+ return (
87
+ <div
88
+ class="flex flex-col gap-2"
89
+ ref={(element) => requestAnimationFrame(() => setPairs(measure(element)))}
90
+ >
91
+ <Caption>
92
+ Measured in this page. Text needs 4.5. The focus ring is brand-text, so the brand-text rows also cover
93
+ it (it needs 3).
94
+ </Caption>
95
+ <div class="grid grid-cols-3 gap-x-4">
96
+ <For each={pairs()}>
97
+ {(pair) => (
98
+ <div class="flex justify-between gap-2 text-data">
99
+ <span class="text-ink-2">
100
+ {pair.fg} / {pair.bg}
101
+ </span>
102
+ <span class={pair.ratio >= pair.need ? "text-ink" : "text-removed"}>
103
+ {pair.ratio.toFixed(2)}
104
+ </span>
105
+ </div>
106
+ )}
107
+ </For>
108
+ </div>
109
+ </div>
110
+ );
111
+ }
112
+
113
+ export function Type(): JSX.Element {
114
+ return (
115
+ <Section label="Tokens · type" title="Three sizes, four roles">
116
+ <div class="flex flex-col gap-3">
117
+ <div class="flex items-baseline gap-4">
118
+ <span class="w-16 shrink-0 text-data text-ink-3">read</span>
119
+ <p class="max-w-read text-read text-ink">
120
+ The cache outlived the token, so the export kept old columns.
121
+ </p>
122
+ </div>
123
+ <div class="flex items-baseline gap-4">
124
+ <span class="w-16 shrink-0 text-data text-ink-3">row</span>
125
+ <span class="text-row text-ink">Ran · Explored · </span>
126
+ <span class="text-row font-medium text-ink">Push the branch</span>
127
+ </div>
128
+ <div class="flex items-baseline gap-4">
129
+ <span class="w-16 shrink-0 text-data text-ink-3">label</span>
130
+ <span class="text-label text-ink-3">Claude Code · 22 passed · waiting for you</span>
131
+ </div>
132
+ <div class="flex items-baseline gap-4">
133
+ <span class="w-16 shrink-0 text-data text-ink-3">data</span>
134
+ <span class="text-data text-ink-3">9.4s +6 −2 2 / 3 opus 4.5</span>
135
+ </div>
136
+ </div>
137
+ </Section>
138
+ );
139
+ }
140
+
141
+ const steps = [
142
+ ["1", "w-1"],
143
+ ["2", "w-2"],
144
+ ["3", "w-3"],
145
+ ["4", "w-4"],
146
+ ["6", "w-6"],
147
+ ["8", "w-8"],
148
+ ["12", "w-12"],
149
+ ["16", "w-16"],
150
+ ] as const;
151
+ const radii = ["rounded-xs", "rounded-sm", "rounded-md", "rounded-lg"] as const;
152
+
153
+ export function Space(): JSX.Element {
154
+ return (
155
+ <Section label="Tokens · space, radius, depth" title="One scale, base 4">
156
+ <div class="grid grid-cols-2 gap-8">
157
+ <div class="flex flex-col gap-2">
158
+ <For each={steps}>
159
+ {([step, width]) => (
160
+ <div class="flex items-center gap-3">
161
+ <span class="w-8 text-data text-ink-3">{step}</span>
162
+ <span class={`h-2 rounded-xs bg-ink-3 ${width}`} />
163
+ <span class="text-data text-ink-3">{Number(step) * 4}px</span>
164
+ </div>
165
+ )}
166
+ </For>
167
+ </div>
168
+ <div class="flex flex-col gap-4">
169
+ <div class="flex gap-3">
170
+ <For each={radii}>
171
+ {(radius) => (
172
+ <div class={`flex h-12 w-16 items-end bg-card p-1 ${radius}`}>
173
+ <span class="text-data text-ink-3">{radius.slice(8)}</span>
174
+ </div>
175
+ )}
176
+ </For>
177
+ </div>
178
+ <div class="flex items-center gap-3">
179
+ <span class="rounded-sm bg-card px-3 py-1 text-row text-ink-2">card · flat</span>
180
+ <span class="rounded-sm bg-ink px-3 py-1 text-row font-medium text-stage shadow-raised">
181
+ raised
182
+ </span>
183
+ </div>
184
+ <Caption>shadow-raised means pressable. Nothing else casts one.</Caption>
185
+ </div>
186
+ </div>
187
+ </Section>
188
+ );
189
+ }