@n1kname/components 0.0.0-stage → 0.2.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.
@@ -0,0 +1,142 @@
1
+ ---
2
+ /**
3
+ * Detail that opens beside what you were reading. A real dialog, so focus, Escape and the
4
+ * backdrop come from the browser. Any element with data-panel-open="id" opens it; add
5
+ * data-panel-section="id" to scroll to a section inside.
6
+ */
7
+ import Button from './Button.astro';
8
+
9
+ interface Props {
10
+ id: string;
11
+ title: string;
12
+ }
13
+ const { id, title } = Astro.props;
14
+ const titleId = `${id}-title`;
15
+ ---
16
+
17
+ <dialog class="side-panel" id={id} aria-labelledby={titleId} data-side-panel>
18
+ <div class="head">
19
+ <h2 id={titleId}>{title}</h2>
20
+ <Button data-panel-close>Close</Button>
21
+ </div>
22
+ <div class="body"><slot /></div>
23
+ </dialog>
24
+
25
+ <script>
26
+ document.querySelectorAll<HTMLDialogElement>('dialog[data-side-panel]').forEach((panel) => {
27
+ panel.querySelector('[data-panel-close]')?.addEventListener('click', () => panel.close());
28
+ // A click on the backdrop lands on the dialog itself.
29
+ panel.addEventListener('click', (e) => {
30
+ if (e.target === panel) panel.close();
31
+ });
32
+ document.querySelectorAll<HTMLElement>(`[data-panel-open="${panel.id}"]`).forEach((trigger) => {
33
+ trigger.addEventListener('click', () => {
34
+ panel.showModal();
35
+ const section = trigger.dataset.panelSection;
36
+ if (section) document.getElementById(section)?.scrollIntoView({ block: 'start' });
37
+ else panel.scrollTop = 0;
38
+ });
39
+ });
40
+ });
41
+ </script>
42
+
43
+ <style>
44
+ .side-panel {
45
+ margin: 0 0 0 auto;
46
+ width: min(900px, 100vw);
47
+ max-width: 100vw;
48
+ height: 100dvh;
49
+ max-height: 100dvh;
50
+ padding: 0 var(--sp-5) var(--sp-6);
51
+ border: 0;
52
+ border-inline-start: 1px solid var(--c-border);
53
+ background: var(--c-bg);
54
+ color: var(--c-text);
55
+ overflow-y: auto;
56
+ /* Scrolling past the end stays here, instead of moving the page behind it. */
57
+ overscroll-behavior: contain;
58
+ /* It leaves but stays within reach, so it uses standard easing, and leaves quicker. */
59
+ opacity: 0;
60
+ transform: translateX(16px);
61
+ transition:
62
+ opacity var(--motion-base) var(--ease-standard),
63
+ transform var(--motion-base) var(--ease-standard),
64
+ overlay var(--motion-base) allow-discrete,
65
+ display var(--motion-base) allow-discrete;
66
+ }
67
+
68
+ .side-panel[open] {
69
+ opacity: 1;
70
+ transform: none;
71
+ transition:
72
+ opacity var(--motion-slow) var(--ease-out),
73
+ transform var(--motion-slow) var(--ease-out),
74
+ overlay var(--motion-slow) allow-discrete,
75
+ display var(--motion-slow) allow-discrete;
76
+ }
77
+
78
+ @starting-style {
79
+ .side-panel[open] {
80
+ opacity: 0;
81
+ transform: translateX(24px);
82
+ }
83
+ }
84
+
85
+ .side-panel::backdrop {
86
+ background: rgb(0 0 0 / 0);
87
+ transition:
88
+ background-color var(--motion-base) var(--ease-standard),
89
+ overlay var(--motion-base) allow-discrete,
90
+ display var(--motion-base) allow-discrete;
91
+ }
92
+
93
+ .side-panel[open]::backdrop {
94
+ background: rgb(0 0 0 / 0.4);
95
+ transition-duration: var(--motion-slow);
96
+ transition-timing-function: var(--ease-out);
97
+ }
98
+
99
+ @starting-style {
100
+ .side-panel[open]::backdrop {
101
+ background: rgb(0 0 0 / 0);
102
+ }
103
+ }
104
+
105
+ @media (prefers-reduced-motion: reduce) {
106
+ .side-panel,
107
+ .side-panel[open] {
108
+ transform: none;
109
+ }
110
+
111
+ @starting-style {
112
+ .side-panel[open] {
113
+ transform: none;
114
+ }
115
+ }
116
+ }
117
+
118
+ .head {
119
+ position: sticky;
120
+ top: 0;
121
+ z-index: var(--z-sticky);
122
+ display: flex;
123
+ justify-content: space-between;
124
+ align-items: center;
125
+ gap: var(--sp-3);
126
+ padding-block: var(--sp-4);
127
+ background: var(--c-bg);
128
+ }
129
+
130
+ /* A section opened from a link clears the head. */
131
+ .body :global([id]) {
132
+ scroll-margin-top: 72px;
133
+ }
134
+
135
+ h2 {
136
+ margin: 0;
137
+ font-family: var(--font-display);
138
+ font-weight: 600;
139
+ font-size: var(--text-h3);
140
+ line-height: var(--leading-h3);
141
+ }
142
+ </style>
@@ -0,0 +1,35 @@
1
+ ---
2
+ /**
3
+ * The first stop for a keyboard: jumps past the header to the main content. Hidden until
4
+ * it has focus. Put it first in <body>, and give the main content a matching id.
5
+ */
6
+ interface Props {
7
+ /** The id of the main content, with its #. */
8
+ target?: string;
9
+ }
10
+ const { target = '#main' } = Astro.props;
11
+ ---
12
+
13
+ <a class="skip-link" href={target}>Skip to main content</a>
14
+
15
+ <style>
16
+ /* No transition: it appears on a key press, and keyboard actions shouldn't animate. */
17
+ .skip-link {
18
+ position: absolute;
19
+ top: var(--sp-2);
20
+ left: var(--sp-2);
21
+ z-index: var(--z-panel);
22
+ padding: var(--sp-2) var(--sp-3);
23
+ background: var(--c-surface);
24
+ border: 1px solid var(--c-border-strong);
25
+ border-radius: var(--radius-md);
26
+ font-size: var(--text-body-sm);
27
+ font-weight: 600;
28
+ color: var(--c-text);
29
+ transform: translateY(calc(-100% - var(--sp-3)));
30
+ }
31
+
32
+ .skip-link:focus {
33
+ transform: none;
34
+ }
35
+ </style>
@@ -0,0 +1,43 @@
1
+ ---
2
+ /**
3
+ * A narrow side beside a wide main, which stack when the two no longer fit. Works from
4
+ * the room it has, not the window, so it behaves the same inside a panel or a column.
5
+ */
6
+ interface Props {
7
+ /** Width of the narrow side, in px. */
8
+ sideWidth?: number;
9
+ /** The narrowest the main can be before the two stack, in px. */
10
+ mainWidth?: number;
11
+ gap?: number;
12
+ /** Which side the narrow one is on. */
13
+ sideAt?: 'start' | 'end';
14
+ }
15
+ const { sideWidth = 280, mainWidth = 420, gap = 5, sideAt = 'start', class: className, ...rest } = Astro.props;
16
+ ---
17
+
18
+ <div class:list={['split', sideAt, className]} style={`--side: ${sideWidth}px; --main: ${mainWidth}px; --gap: var(--sp-${gap})`} {...rest}>
19
+ <div class="side"><slot name="side" /></div>
20
+ <div class="main"><slot /></div>
21
+ </div>
22
+
23
+ <style>
24
+ .split {
25
+ display: flex;
26
+ flex-wrap: wrap;
27
+ gap: var(--gap);
28
+ }
29
+
30
+ .split.end {
31
+ flex-direction: row-reverse;
32
+ }
33
+
34
+ .side {
35
+ flex: 1 1 var(--side);
36
+ min-width: 0;
37
+ }
38
+
39
+ .main {
40
+ flex: 999 1 var(--main);
41
+ min-width: 0;
42
+ }
43
+ </style>
@@ -0,0 +1,20 @@
1
+ ---
2
+ /** Things one above the other, with one gap. The default layout: most of a page is a stack. */
3
+ interface Props {
4
+ /** A step of the spacing scale, 1 to 10. */
5
+ gap?: number;
6
+ as?: string;
7
+ }
8
+ const { gap = 4, as: Tag = 'div', class: className, ...rest } = Astro.props;
9
+ ---
10
+
11
+ <Tag class:list={['stack', className]} style={`--gap: var(--sp-${gap})`} {...rest}><slot /></Tag>
12
+
13
+ <style>
14
+ .stack {
15
+ display: flex;
16
+ flex-direction: column;
17
+ gap: var(--gap);
18
+ min-width: 0;
19
+ }
20
+ </style>
package/src/Stat.astro ADDED
@@ -0,0 +1,58 @@
1
+ ---
2
+ /**
3
+ * One number someone reads at a glance, inside a StatStrip. The value keeps its height
4
+ * while a page waits, so nothing jumps when it arrives. Unknown is –, never 0.
5
+ */
6
+ interface Props {
7
+ label: string;
8
+ value?: string;
9
+ context?: string;
10
+ /** Id, for a page that fills the value in once its data arrives. */
11
+ valueId?: string;
12
+ }
13
+ const { label, value = '–', context, valueId } = Astro.props;
14
+ ---
15
+
16
+ <div class="stat">
17
+ <dt>{label}</dt>
18
+ <dd>
19
+ <span class="value" id={valueId}>{value}</span>
20
+ {context && <small>{context}</small>}
21
+ </dd>
22
+ </div>
23
+
24
+ <style>
25
+ .stat {
26
+ padding: var(--sp-3) var(--sp-4);
27
+ border-inline-start: 1px solid var(--c-border);
28
+ min-width: 0;
29
+ }
30
+
31
+ dt {
32
+ font-size: var(--text-caption);
33
+ line-height: var(--leading-caption);
34
+ font-weight: 600;
35
+ color: var(--c-text-secondary);
36
+ }
37
+
38
+ dd {
39
+ margin: var(--sp-1) 0 0;
40
+ }
41
+
42
+ .value {
43
+ display: block;
44
+ min-height: 1lh;
45
+ font-size: var(--text-h3);
46
+ line-height: 1.2;
47
+ font-weight: 600;
48
+ color: var(--c-text);
49
+ }
50
+
51
+ small {
52
+ display: block;
53
+ margin-top: 2px;
54
+ font-size: var(--text-caption);
55
+ line-height: var(--leading-caption);
56
+ color: var(--c-text-muted);
57
+ }
58
+ </style>
@@ -0,0 +1,20 @@
1
+ ---
2
+ /** A row of Stats between two rules. Four at most: past that, you probably want a table. */
3
+ ---
4
+
5
+ <dl class="stat-strip"><slot /></dl>
6
+
7
+ <style>
8
+ .stat-strip {
9
+ display: grid;
10
+ grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
11
+ margin: 0;
12
+ border-block: 1px solid var(--c-border);
13
+ overflow: hidden;
14
+ }
15
+
16
+ /* The first in each row has no divider: the row's own edge does that job. */
17
+ .stat-strip > :global(.stat) {
18
+ margin-inline-start: -1px;
19
+ }
20
+ </style>
package/src/Tag.astro ADDED
@@ -0,0 +1,86 @@
1
+ ---
2
+ /**
3
+ * A pill: optional icon, then a label. Used for tags and links, so both read as
4
+ * the same object.
5
+ *
6
+ * The fills are meaningful rather than decorative:
7
+ * accent → this is a link you can act on, or a live state
8
+ * quiet → this is a descriptor, not something to click
9
+ * warm → a warm tag: how something was done
10
+ * cool → the cool tag: what something was about
11
+ */
12
+ import Icon from './Icon.astro';
13
+ import type { IconName } from './icons';
14
+
15
+ interface Props {
16
+ icon?: IconName;
17
+ href?: string;
18
+ tone?: 'accent' | 'quiet' | 'warm' | 'cool';
19
+ small?: boolean;
20
+ }
21
+
22
+ const { icon, href, tone = 'quiet', small = false } = Astro.props;
23
+ const Tag = href ? 'a' : 'span';
24
+ ---
25
+
26
+ <Tag class:list={['tag', tone, { small }]} href={href}>
27
+ {icon && <Icon name={icon} size={15} />}
28
+ <slot />
29
+ </Tag>
30
+
31
+ <style>
32
+ .tag {
33
+ display: inline-flex;
34
+ align-items: center;
35
+ gap: var(--sp-2);
36
+ padding: 5px var(--sp-3) 5px var(--sp-2);
37
+ border-radius: var(--radius-full);
38
+ font-size: var(--text-body-sm);
39
+ line-height: 1.4;
40
+ border: 1px solid transparent;
41
+ text-decoration: none;
42
+ white-space: nowrap;
43
+ }
44
+
45
+ /* No icon means no need for the tighter left padding. */
46
+ .tag:not(:has(svg)) {
47
+ padding-inline: var(--sp-3);
48
+ }
49
+
50
+ .quiet {
51
+ background: var(--c-surface);
52
+ border-color: var(--c-border);
53
+ color: var(--c-text-muted);
54
+ }
55
+
56
+ .accent,
57
+ .warm {
58
+ background: var(--c-surface-tint);
59
+ color: var(--c-text-accent);
60
+ }
61
+
62
+ .cool {
63
+ background: var(--c-tag-cool-bg);
64
+ color: var(--c-tag-cool-text);
65
+ }
66
+
67
+ .tag.small {
68
+ padding-block: 2px;
69
+ font-size: var(--text-caption);
70
+ }
71
+
72
+ a.tag {
73
+ transition:
74
+ border-color var(--motion-hover) var(--ease-hover),
75
+ background-color var(--motion-hover) var(--ease-hover);
76
+ }
77
+
78
+ a.quiet:hover {
79
+ border-color: var(--c-border-strong);
80
+ color: var(--c-text);
81
+ }
82
+
83
+ a.accent:hover {
84
+ border-color: var(--c-accent-edge);
85
+ }
86
+ </style>
@@ -0,0 +1,134 @@
1
+ ---
2
+ /**
3
+ * A project timeline: mono period in a left column, content on the right. The column
4
+ * fits the longest period, so every entry lines up, and wraps past 200px.
5
+ * Needs type.css for its t-meta and t-sub classes.
6
+ *
7
+ * The final entry is the current state, so its marker is filled.
8
+ */
9
+ interface Entry {
10
+ period: string;
11
+ label: string;
12
+ body: string;
13
+ }
14
+
15
+ interface Props {
16
+ entries: Entry[];
17
+ }
18
+
19
+ const { entries } = Astro.props;
20
+ ---
21
+
22
+ <ol class="timeline">
23
+ {
24
+ entries.map((e, i) => (
25
+ <li class={i === entries.length - 1 ? 'last' : ''}>
26
+ <span class="rail" aria-hidden="true" />
27
+ <span class="period t-meta">{e.period}</span>
28
+ <div class="body">
29
+ <p class="t-sub">{e.label}</p>
30
+ <p class="text">{e.body}</p>
31
+ </div>
32
+ </li>
33
+ ))
34
+ }
35
+ </ol>
36
+
37
+ <style>
38
+ .timeline {
39
+ display: grid;
40
+ grid-template-columns: 20px fit-content(200px) minmax(0, 1fr);
41
+ column-gap: var(--sp-4);
42
+ list-style: none;
43
+ margin: var(--sp-5) 0 var(--sp-7);
44
+ padding: 0;
45
+ }
46
+
47
+ /* Each entry shares the list's columns, so the periods all take the same width. */
48
+ li {
49
+ display: grid;
50
+ grid-column: 1 / -1;
51
+ grid-template-columns: subgrid;
52
+ padding-bottom: var(--sp-6);
53
+ position: relative;
54
+ }
55
+
56
+ li:last-child {
57
+ padding-bottom: 0;
58
+ }
59
+
60
+ /* Marker plus the connecting line, drawn as one element. */
61
+ .rail {
62
+ position: relative;
63
+ width: 20px;
64
+ margin-top: 3px;
65
+ }
66
+
67
+ .rail::before {
68
+ content: '';
69
+ position: absolute;
70
+ inset-inline-start: 0;
71
+ top: 0;
72
+ width: 14px;
73
+ height: 14px;
74
+ border-radius: var(--radius-full);
75
+ border: 3px solid var(--c-accent);
76
+ background: var(--c-bg);
77
+ }
78
+
79
+ .last .rail::before {
80
+ border-color: var(--c-text);
81
+ }
82
+
83
+ .rail::after {
84
+ content: '';
85
+ position: absolute;
86
+ inset-inline-start: 6px;
87
+ top: 18px;
88
+ bottom: calc(var(--sp-6) * -1);
89
+ width: 2px;
90
+ background: var(--c-border);
91
+ }
92
+
93
+ .last .rail::after {
94
+ display: none;
95
+ }
96
+
97
+ .period {
98
+ min-width: 84px;
99
+ padding-top: 1px;
100
+ }
101
+
102
+ .body p {
103
+ max-width: none;
104
+ }
105
+
106
+ .t-sub {
107
+ margin-bottom: var(--sp-1);
108
+ }
109
+
110
+ .text {
111
+ color: var(--c-text-muted);
112
+ }
113
+
114
+ /* Below the fold of a phone the three columns stop earning their keep. */
115
+ @media (max-width: 560px) {
116
+ .timeline {
117
+ grid-template-columns: 20px minmax(0, 1fr);
118
+ }
119
+
120
+ li {
121
+ row-gap: var(--sp-1);
122
+ }
123
+
124
+ /* Spans both rows so the connecting line still reaches the next marker. */
125
+ .rail {
126
+ grid-row: span 2;
127
+ }
128
+
129
+ .period,
130
+ .body {
131
+ grid-column: 2;
132
+ }
133
+ }
134
+ </style>
@@ -0,0 +1,43 @@
1
+ // Fills a DataTable after the page has loaded, for data that arrives at runtime. Each row
2
+ // is an array of cells: a string or number, or { html, sort, class }. `html` is written as
3
+ // is, so escape anything that came from outside.
4
+ export const esc = (s) => String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
5
+
6
+ export const setRows = (table, rows, rowClass = () => '') => {
7
+ const body = table.tBodies[0];
8
+ const head = [...table.tHead.rows[0].cells];
9
+ body.innerHTML = rows
10
+ .map((cells, r) => {
11
+ const tds = cells.map((c, i) => {
12
+ const v = c !== null && typeof c === 'object' ? c : { html: esc(c ?? '–'), sort: c };
13
+ const left = head[i]?.classList.contains('left') ? 'left' : '';
14
+ const sort = v.sort === null || v.sort === undefined ? '' : ` data-sort="${esc(v.sort)}"`;
15
+ return `<td class="${[left, v.class].filter(Boolean).join(' ')}"${sort}>${v.html}</td>`;
16
+ });
17
+ return `<tr class="${rowClass(rows[r], r)}">${tds.join('')}</tr>`;
18
+ })
19
+ .join('');
20
+ };
21
+
22
+ // Sorting: each header button cycles descending, then ascending. Rows without a value stay last.
23
+ export const makeSortable = (table) => {
24
+ const heads = [...table.tHead.rows[0].cells];
25
+ heads.forEach((th, i) => {
26
+ const button = th.querySelector('button');
27
+ if (!button) return;
28
+ button.addEventListener('click', () => {
29
+ const dir = th.getAttribute('aria-sort') === 'descending' ? 1 : -1;
30
+ heads.forEach((h) => h.removeAttribute('aria-sort'));
31
+ th.setAttribute('aria-sort', dir === 1 ? 'ascending' : 'descending');
32
+ const val = (tr) => tr.cells[i]?.dataset.sort ?? '';
33
+ const rows = [...table.tBodies[0].rows].sort((a, b) => {
34
+ const [x, y] = [val(a), val(b)];
35
+ if (x === '' || y === '') return x === y ? 0 : x === '' ? 1 : -1;
36
+ const [nx, ny] = [Number(x), Number(y)];
37
+ const order = Number.isNaN(nx) || Number.isNaN(ny) ? x.localeCompare(y) : nx - ny;
38
+ return order * dir;
39
+ });
40
+ table.tBodies[0].append(...rows);
41
+ });
42
+ });
43
+ };
package/src/icons.ts ADDED
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Lucide icon paths, inlined. No npm package, no webfont, no extra request.
3
+ * Lucide is ISC licensed; see THIRD_PARTY.md.
4
+ * Kept in a .ts module rather than the .astro component because component
5
+ * frontmatter cannot export types for other files to import.
6
+ *
7
+ * Only add an icon where there is a real taxonomy to mark (a row category, a
8
+ * kind of stop on a journey). Decorative icons are worse than none.
9
+ */
10
+ export const ICONS = {
11
+ users:
12
+ '<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>',
13
+ 'file-text':
14
+ '<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/>',
15
+ headphones:
16
+ '<path d="M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3"/>',
17
+ search: '<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',
18
+ 'trending-up':
19
+ '<polyline points="22 7 13.5 15.5 8.5 10.5 2 17"/><polyline points="16 7 22 7 22 13"/>',
20
+ 'shield-check':
21
+ '<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1 1 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/>',
22
+ 'graduation-cap':
23
+ '<path d="M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z"/><path d="M22 10v6"/><path d="M6 12.5V16a6 3 0 0 0 12 0v-3.5"/>',
24
+ building:
25
+ '<rect width="16" height="20" x="4" y="2" rx="2"/><path d="M9 22v-4h6v4"/><path d="M8 6h.01"/><path d="M16 6h.01"/><path d="M12 6h.01"/><path d="M12 10h.01"/><path d="M12 14h.01"/><path d="M16 10h.01"/><path d="M16 14h.01"/><path d="M8 10h.01"/><path d="M8 14h.01"/>',
26
+ zap: '<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>',
27
+ layers:
28
+ '<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"/><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"/><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"/>',
29
+ mail: '<rect width="20" height="16" x="2" y="4" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/>',
30
+ 'file-down':
31
+ '<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M12 18v-6"/><path d="m9 15 3 3 3-3"/>',
32
+ component:
33
+ '<path d="M15.536 11.293a1 1 0 0 0 0 1.414l2.828 2.829a1 1 0 0 0 1.415 0l2.828-2.829a1 1 0 0 0 0-1.414l-2.828-2.828a1 1 0 0 0-1.415 0z"/><path d="M2.293 11.293a1 1 0 0 0 0 1.414l2.828 2.829a1 1 0 0 0 1.415 0l2.828-2.829a1 1 0 0 0 0-1.414L6.536 8.465a1 1 0 0 0-1.415 0z"/><path d="M8.914 5.672a1 1 0 0 0 0 1.414l2.828 2.829a1 1 0 0 0 1.415 0l2.828-2.829a1 1 0 0 0 0-1.414l-2.828-2.828a1 1 0 0 0-1.415 0z"/><path d="M8.914 16.914a1 1 0 0 0 0 1.414l2.828 2.829a1 1 0 0 0 1.415 0l2.828-2.829a1 1 0 0 0 0-1.414l-2.828-2.828a1 1 0 0 0-1.415 0z"/>',
34
+ code: '<path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/>',
35
+ smartphone:
36
+ '<rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/>',
37
+ 'refresh-cw':
38
+ '<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>',
39
+ 'message-circle':
40
+ '<path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/>',
41
+ route:
42
+ '<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',
43
+ 'map-pin':
44
+ '<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"/><circle cx="12" cy="10" r="3"/>',
45
+ 'flask-conical':
46
+ '<path d="M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2"/><path d="M6.453 15h11.094"/><path d="M8.5 2h7"/>',
47
+ 'circle-check':
48
+ '<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>',
49
+ palette:
50
+ '<path d="M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z"/><circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/>',
51
+ linkedin:
52
+ '<path d="M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z"/><rect width="4" height="12" x="2" y="9"/><circle cx="4" cy="4" r="2"/>',
53
+ network:
54
+ '<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',
55
+ table:
56
+ '<path d="M12 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/>',
57
+ compass:
58
+ '<path d="m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z"/><circle cx="12" cy="12" r="10"/>',
59
+ workflow:
60
+ '<rect width="8" height="8" x="3" y="3" rx="2"/><path d="M7 11v4a2 2 0 0 0 2 2h4"/><rect width="8" height="8" x="13" y="13" rx="2"/>',
61
+ 'chevron-down': '<path d="m6 9 6 6 6-6"/>',
62
+ 'arrow-right': '<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>',
63
+ quote:
64
+ '<path d="M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h1a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"/><path d="M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h1a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"/>',
65
+ 'message-square':
66
+ '<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>',
67
+ } as const;
68
+
69
+ export type IconName = keyof typeof ICONS;
package/src/type.css ADDED
@@ -0,0 +1,29 @@
1
+ /* Type classes the components use. One rule picks the family: mono marks data, the
2
+ * body face marks structure inside a component. Import once, per site. */
3
+
4
+ /* A sub-heading inside a component. */
5
+ .t-sub {
6
+ font-family: var(--font-body);
7
+ font-weight: 600;
8
+ font-size: var(--text-sub);
9
+ line-height: var(--leading-sub);
10
+ letter-spacing: var(--tracking-sub);
11
+ }
12
+
13
+ /* Small structural label: block titles, table column headers. */
14
+ .t-label {
15
+ font-family: var(--font-body);
16
+ font-weight: 600;
17
+ font-size: var(--text-label);
18
+ line-height: var(--leading-label);
19
+ color: var(--c-text-muted);
20
+ }
21
+
22
+ /* Data annotation: a year, an ID, a tariff. Never prose. */
23
+ .t-meta {
24
+ font-family: var(--font-mono);
25
+ font-size: var(--text-caption);
26
+ line-height: var(--leading-caption);
27
+ color: var(--c-text-muted);
28
+ font-variant-numeric: tabular-nums;
29
+ }