@hugocxl/design 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BRAND.md +82 -0
- package/DESIGN.md +100 -0
- package/LICENSE +21 -0
- package/README.md +112 -2
- package/dist/design.css +263 -0
- package/dist/design.js +20 -0
- package/dist/react.d.ts +128 -0
- package/dist/react.js +124 -0
- package/dist/tailwind.css +53 -0
- package/dist/theme.js +16 -0
- package/dist/tokens.css +78 -0
- package/dist/tokens.d.ts +76 -0
- package/dist/tokens.js +121 -0
- package/dist/tokens.json +73 -0
- package/package.json +76 -4
- package/skills/design/SKILL.md +67 -0
package/BRAND.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hugocxl
|
|
3
|
+
description: The personal brand of Hugo Corta (@hugocxl). Engineering first, modern, minimal and precise.
|
|
4
|
+
handle: "@hugocxl"
|
|
5
|
+
site: https://hugocxl.me
|
|
6
|
+
look: "@hugocxl/design"
|
|
7
|
+
---
|
|
8
|
+
# Brand
|
|
9
|
+
|
|
10
|
+
Who the work is for, what it stands for and how it speaks. The look lives in [DESIGN.md](DESIGN.md); this file never repeats a value.
|
|
11
|
+
|
|
12
|
+
## Positioning
|
|
13
|
+
|
|
14
|
+
**I build precise software and write down what I learn doing it.**
|
|
15
|
+
|
|
16
|
+
- **For** people who build things: engineers, designers who code, founders, and the agents working beside them.
|
|
17
|
+
- **About** software engineering, developer tools, design systems and AI agents, and the growth it takes to keep getting better at them.
|
|
18
|
+
- **Like** Apple: careful craft, nothing ornamental, every detail on purpose.
|
|
19
|
+
|
|
20
|
+
## Pillars
|
|
21
|
+
|
|
22
|
+
When two conflict, the earlier one wins.
|
|
23
|
+
|
|
24
|
+
1. **Engineering.** Show the work. Correct before clever, measured before claimed.
|
|
25
|
+
2. **Craft.** The last 10% is the product. Details people feel before they notice.
|
|
26
|
+
3. **Growth.** Learn in public. Every project leaves a reusable piece behind.
|
|
27
|
+
4. **Minimalism.** Remove until it breaks, then put one thing back.
|
|
28
|
+
5. **Openness.** Default to open source and plain explanations.
|
|
29
|
+
|
|
30
|
+
## Voice
|
|
31
|
+
|
|
32
|
+
Calm, plain and exact, like good documentation written by someone who cares. Confident without selling.
|
|
33
|
+
|
|
34
|
+
- **Plain words.** Say "fast" only with a number. Prefer the concrete noun.
|
|
35
|
+
- **Short sentences.** One idea each. Lead with the point; detail follows in the same paragraph (in muted on a page).
|
|
36
|
+
- **Sentence case** everywhere: titles, buttons, menus, headings.
|
|
37
|
+
- **First person singular** on personal surfaces ("I", "my"). **"You"** inside a product page, never "we" or "the user".
|
|
38
|
+
- **Engineering honesty.** Name limits and trade-offs. Say what is not done yet.
|
|
39
|
+
|
|
40
|
+
| Write | Not |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| Sessions survive restarts and reconnect where you left them. | Never lose your work again with our revolutionary session tech! |
|
|
43
|
+
| I rebuilt the renderer; scrolling now holds 120 fps. | We're thrilled to announce blazing-fast performance. |
|
|
44
|
+
| This doesn't support Windows yet. | Windows support coming soon! |
|
|
45
|
+
|
|
46
|
+
**Avoid:** revolutionary, game-changing, blazing, seamless, magical, effortless, supercharge, unleash, leverage, robust, cutting-edge, world-class, simply, just, thrilled, excited to announce. No exclamation marks. No emoji in pages, docs or commit messages.
|
|
47
|
+
|
|
48
|
+
## Naming
|
|
49
|
+
|
|
50
|
+
- **Handle:** `@hugocxl` everywhere (GitHub, npm, social). The person is Hugo Corta; the work is `@hugocxl`.
|
|
51
|
+
- **Products:** one short real or compound word. Lowercase as a repository, capitalised as a product: `tab` / Tab.
|
|
52
|
+
- **Packages:** `@hugocxl/<plain-noun>`, so the name is the category: `design`, `icons`, `vectors`.
|
|
53
|
+
- **Commits:** `<Added|Changed|Removed|Improved|Fixed>: <One user-facing sentence.>`
|
|
54
|
+
|
|
55
|
+
## Wordmark
|
|
56
|
+
|
|
57
|
+
The wordmark is the name set in type (`.ds-wordmark`); there is no logo symbol. Never outline it, color it, add a gradient or shadow, or pair it with an emoji or mark.
|
|
58
|
+
|
|
59
|
+
**Footer:** the same on every site: `© <year> Hugo Corta` at the start, `GitHub` and `npm` at the end. Navigation belongs in the masthead.
|
|
60
|
+
|
|
61
|
+
## Imagery
|
|
62
|
+
|
|
63
|
+
- **Screenshots** of the real product, at real size or larger, in a `.ds-media` card.
|
|
64
|
+
- **Figures** from `@hugocxl/vectors`, line drawings in ink, named in the caption.
|
|
65
|
+
- **Icons** from `@hugocxl/icons`, Stroke style, in the text color, before words.
|
|
66
|
+
- **Never** stock photography, AI-generated images, 3D renders, mascots or emoji.
|
|
67
|
+
|
|
68
|
+
## Writing formats
|
|
69
|
+
|
|
70
|
+
| Format | Shape |
|
|
71
|
+
| --- | --- |
|
|
72
|
+
| README | Package name as `#`, one-line promise, one paragraph, then short sections with plain headings |
|
|
73
|
+
| Release note | One line per change, starting with Added, Changed, Removed, Improved or Fixed |
|
|
74
|
+
| Post | A title that states the result, the problem, what I tried, what worked, numbers, what I learned |
|
|
75
|
+
| Bio | `Hugo Corta — <role>. Developer tools, design systems and open-source projects.` |
|
|
76
|
+
|
|
77
|
+
## Checklist
|
|
78
|
+
|
|
79
|
+
- [ ] It says one thing, in plain words, with a number where a claim is made.
|
|
80
|
+
- [ ] It uses `@hugocxl/design` unchanged: system font, ink and grey, one accent phrase.
|
|
81
|
+
- [ ] No hype words, exclamation marks, emoji, stock or generated imagery.
|
|
82
|
+
- [ ] The source, license and limits are a click away.
|
package/DESIGN.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Design
|
|
2
|
+
|
|
3
|
+
The rules of `@hugocxl/design`, for product and launch pages and the personal site. Web only. Every value lives in `src/tokens.mjs` and ships as `--ds-*` custom properties; this file never repeats a value that could drift, except where a rule needs one.
|
|
4
|
+
|
|
5
|
+
## Principles
|
|
6
|
+
|
|
7
|
+
- **One column, read top to bottom.** A page is a 40rem column; only figures break out to the 51.25rem wide measure.
|
|
8
|
+
- **Type and grey do the hierarchy.** Ink for what matters, muted for what follows. One accent, used once or twice per page.
|
|
9
|
+
- **Nothing ornamental.** No custom fonts, shadows, gradients (besides the canvas glow), icons-as-decoration or animation beyond a press.
|
|
10
|
+
|
|
11
|
+
## Type
|
|
12
|
+
|
|
13
|
+
The system UI font for every word (`--ds-sans`: `system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`); the system monospace (`--ds-mono`) only for code. No font files.
|
|
14
|
+
|
|
15
|
+
| Role | Token | Weight | Where |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| Display | `--ds-size-display` (36–56px fluid) | 600, -0.025em | The hero `h1`, once per page |
|
|
18
|
+
| Title | `--ds-size-title` (32px) | 600, -0.02em | `.ds-title h1` on docs, changelog, posts |
|
|
19
|
+
| Heading | `--ds-size-heading` (20px) | 600 | `.ds-section > h2` |
|
|
20
|
+
| Lead | `--ds-size-lead` (18px) | 400–500 | Eyebrow, hero subhead, title subline |
|
|
21
|
+
| Reading | `--ds-size-reading` (16px/1.5) | 400 | Body |
|
|
22
|
+
| Small / label | `--ds-size-small`, `--ds-size-label` (14px) | 400–500 | Nav, captions, dates, tables, footer |
|
|
23
|
+
| Control | `--ds-size-control` (15px) | 500 | Buttons |
|
|
24
|
+
| Code | `--ds-size-code` (14px), mono | 400 | `code`, `.ds-code` |
|
|
25
|
+
|
|
26
|
+
Sentence case everywhere. `strong` is 600. Headlines balance; paragraphs wrap pretty.
|
|
27
|
+
|
|
28
|
+
## Color
|
|
29
|
+
|
|
30
|
+
| Token | Light | Dark | Use |
|
|
31
|
+
| --- | --- | --- | --- |
|
|
32
|
+
| `--ds-canvas` | #f8f8f8 | #151515 | Page |
|
|
33
|
+
| `--ds-ink` | #151515 | #ffffff | Text that matters |
|
|
34
|
+
| `--ds-muted` | ink 64% | white 79% | Supporting text, labels, nav |
|
|
35
|
+
| `--ds-faint` | ink 36% | white 50% | Placeholders only |
|
|
36
|
+
| `--ds-rule` | ink 8% | white 8% | Hairlines, the `.ds-more` wash |
|
|
37
|
+
| `--ds-surface` / `--ds-edge` | white 80% / white | white 4% / white 4% | Cards: media, tiles, code |
|
|
38
|
+
| `--ds-accent` | #f31a7c | #f31a7c | Focus ring, canvas glow |
|
|
39
|
+
| `--ds-accent-text` | #d5176d | #f6539d | Accent words (`.ds-accent`) |
|
|
40
|
+
| `--ds-action` / `--ds-on-action` | ink / white | white / ink | The primary button |
|
|
41
|
+
| `--ds-material` | canvas 80% | canvas 80% | The translucent masthead |
|
|
42
|
+
|
|
43
|
+
- **One accent.** Cranberry marks one phrase in the hero (`.ds-accent`) and focus. It never means "clickable": links are underlined text in the surrounding color.
|
|
44
|
+
- **Muted continues a thought.** Lead with the point in ink, follow in `<span class="ds-muted">` in the same paragraph.
|
|
45
|
+
- **Dark theme** follows `prefers-color-scheme` and is overridden by `<html data-theme="light|dark">` (set by `theme.js` or `setTheme`).
|
|
46
|
+
|
|
47
|
+
## Space and shape
|
|
48
|
+
|
|
49
|
+
Spacing steps `--ds-space-1…10`: 4, 8, 12, 16, 20, 32, 40, 56, 80, 128px. Sections sit `space-8` apart; figures `space-7`; paragraphs `space-4`; the footer `space-9` below the content.
|
|
50
|
+
|
|
51
|
+
Radii: `--ds-radius-control` 8px (buttons), `--ds-radius-media` 12px (cards, figures, code), `--ds-radius-pill`. Targets are at least `--ds-target` (40px). The bar is `--ds-bar` (52px).
|
|
52
|
+
|
|
53
|
+
## Classes
|
|
54
|
+
|
|
55
|
+
| Class | Element | Purpose |
|
|
56
|
+
| --- | --- | --- |
|
|
57
|
+
| `ds` + `data-layout="plain"` | `body` | Canvas, type, gutter |
|
|
58
|
+
| `ds-masthead` | `header` | Sticky translucent bar |
|
|
59
|
+
| `ds-wordmark` | `a` | Product name, home link, bold |
|
|
60
|
+
| `ds-theme` + `data-ds-theme` | `button` | Theme switch (icon only, with `aria-label`) |
|
|
61
|
+
| `ds-column ds-opening` | `article` | The 40rem column with top padding |
|
|
62
|
+
| `ds-hero` | `section` | `.ds-eyebrow`, `h1`, subhead `p`, `.ds-actions` |
|
|
63
|
+
| `ds-eyebrow` | `p` | Product name above the headline |
|
|
64
|
+
| `ds-accent` | `span` | The one accent phrase |
|
|
65
|
+
| `ds-actions` | `p` | Row of buttons |
|
|
66
|
+
| `ds-button` | `a`/`button` | Primary: ink fill |
|
|
67
|
+
| `ds-more` | `a`/`button` | Secondary: rule wash, trailing icon |
|
|
68
|
+
| `ds-title` | `hgroup` | Page title + muted subline |
|
|
69
|
+
| `ds-meta` | `ul` | Row of `.ds-label` items under a title |
|
|
70
|
+
| `ds-section` | `section` | `h2` + content |
|
|
71
|
+
| `ds-muted` | `span` | Supporting text |
|
|
72
|
+
| `ds-label` | `span` | Small grey text: dates, versions, captions |
|
|
73
|
+
| `ds-wide` | `figure` | Breaks out to the wide measure |
|
|
74
|
+
| `ds-media` | `div` | 3:2 card holding an `img`, `video` or `.ds-vector` |
|
|
75
|
+
| `ds-caption` | `figcaption` | Holds a `.ds-label`, e.g. "Fig. 01 / …" |
|
|
76
|
+
| `ds-grid` + `data-columns="2|3|4"` | `ul` | Tiles: `li > h3 + p` (one column under 34rem) |
|
|
77
|
+
| `ds-index` | `ol` | Rows: `li > .ds-label + div > h3 + p` (changelog, posts, experience) |
|
|
78
|
+
| `ds-table`, `ds-table-scroll` | `table`, `div` | Data tables, scroll wrapper |
|
|
79
|
+
| `ds-code` | `div` | `pre > code` + copy `button` |
|
|
80
|
+
| `ds-footer` | `footer` | Two `ul`s: `© <year> Hugo Corta` / GitHub, npm |
|
|
81
|
+
| `ds-icon` | `svg` | 1em icon before words |
|
|
82
|
+
| `ds-vector` | `svg` | Line illustration in ink |
|
|
83
|
+
| `ds-visually-hidden` | any | Screen-reader only |
|
|
84
|
+
|
|
85
|
+
## Page recipes
|
|
86
|
+
|
|
87
|
+
**Product home.** Masthead (wordmark, Docs and Changelog with icons, GitHub, theme). Hero: eyebrow = product name, a one-sentence headline ending in an accent phrase, one muted subhead, a primary download button and a `.ds-more` to the docs. A wide figure of the real product, captioned "Fig. 01 / …". One plain paragraph saying what it is. Then 4–7 sections, each a plain `h2` that states a benefit and one or two paragraphs (or a short list). Close with a "Get <Product>" section. Footer.
|
|
88
|
+
|
|
89
|
+
**Docs.** `.ds-title` (h1 "Docs" + subline), `.ds-meta` (version, date), an intro section, then one section per topic with `id`s. Tables in `.ds-table-scroll`, commands in `.ds-code`, diagrams as wide figures.
|
|
90
|
+
|
|
91
|
+
**Changelog.** `.ds-title`, one intro section, then `ol.ds-index`: each `li id="v<version>"` has a date label and `h3` version, groups as `<p><strong>Added.</strong> …</p>`.
|
|
92
|
+
|
|
93
|
+
**Personal site.** Same shell. Hero without eyebrow or with the handle, `.ds-grid` for projects, `.ds-index` for experience or posts.
|
|
94
|
+
|
|
95
|
+
## Do not
|
|
96
|
+
|
|
97
|
+
- Add fonts, colors, shadows, radii or sizes outside the tokens. Site CSS may only use `--ds-*` values.
|
|
98
|
+
- Use the accent for links, buttons or more than one phrase per screen.
|
|
99
|
+
- Put more than one primary button in a row, or more than three nav items.
|
|
100
|
+
- Use title case, exclamation marks or emoji.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hugo Corta
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,113 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @hugocxl/design
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
### One small stylesheet for my product pages and personal site.
|
|
4
|
+
|
|
5
|
+
The system UI font, a pale canvas with ink greys, one cranberry accent, light and dark. Plain CSS classes (`ds-*`), `--ds-*` tokens, a Tailwind v4 theme and a few React components. Web only; no font files, no runtime beyond an optional 1 KB theme script. It replaces `@hugocxl/design-system`, `@hugocxl/components` and `@hugocxl/brand`.
|
|
6
|
+
|
|
7
|
+
- [DESIGN.md](DESIGN.md): type, color, spacing, classes and page recipes
|
|
8
|
+
- [BRAND.md](BRAND.md): voice, naming and imagery
|
|
9
|
+
- [examples/index.html](examples/index.html): the Tab home page rebuilt with the package
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install @hugocxl/design
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Plain HTML
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<link rel="stylesheet" href="node_modules/@hugocxl/design/dist/design.css">
|
|
21
|
+
<script src="node_modules/@hugocxl/design/dist/theme.js"></script>
|
|
22
|
+
<script type="module" src="node_modules/@hugocxl/design/dist/design.js"></script>
|
|
23
|
+
|
|
24
|
+
<body class="ds" data-layout="plain">
|
|
25
|
+
<header class="ds-masthead">
|
|
26
|
+
<a class="ds-wordmark" href="./">Tab</a>
|
|
27
|
+
<nav aria-label="Main"><a href="docs.html">Docs</a><a href="changelog.html">Changelog</a></nav>
|
|
28
|
+
<a href="https://github.com/hugocxl/tab">GitHub</a>
|
|
29
|
+
<button class="ds-theme" type="button" data-ds-theme aria-label="Switch theme">◐</button>
|
|
30
|
+
</header>
|
|
31
|
+
<main>
|
|
32
|
+
<article class="ds-column ds-opening">
|
|
33
|
+
<section class="ds-hero">
|
|
34
|
+
<p class="ds-eyebrow">Tab</p>
|
|
35
|
+
<h1>Everything side by side in one <span class="ds-accent">native workspace.</span></h1>
|
|
36
|
+
<p>Tab is a terminal multiplexer for the Mac.</p>
|
|
37
|
+
<p class="ds-actions"><a class="ds-button" href="#">Download for macOS</a><a class="ds-more" href="docs.html">Read the docs</a></p>
|
|
38
|
+
</section>
|
|
39
|
+
<section class="ds-section"><h2>Four panes</h2><p>Lead in ink. <span class="ds-muted">Detail in muted.</span></p></section>
|
|
40
|
+
</article>
|
|
41
|
+
</main>
|
|
42
|
+
<footer class="ds-footer">
|
|
43
|
+
<ul><li>© 2026 Hugo Corta</li></ul>
|
|
44
|
+
<ul><li><a href="https://github.com/hugocxl">GitHub</a></li><li><a href="https://www.npmjs.com/~hugocxl">npm</a></li></ul>
|
|
45
|
+
</footer>
|
|
46
|
+
</body>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`theme.js` goes in `<head>` as a classic script: it applies the stored or system theme before paint and makes any `[data-ds-theme]` button toggle it. `design.js` (optional) adds the masthead hairline on scroll and `.ds-code` copy buttons. Without JavaScript the page still follows `prefers-color-scheme`.
|
|
50
|
+
|
|
51
|
+
## Tailwind v4
|
|
52
|
+
|
|
53
|
+
```css
|
|
54
|
+
@import "tailwindcss";
|
|
55
|
+
@import "@hugocxl/design/tailwind.css"; /* tokens + @theme */
|
|
56
|
+
@import "@hugocxl/design/css"; /* optional: the ds-* classes */
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```html
|
|
60
|
+
<p class="bg-canvas text-muted font-sans text-lead p-space-4 rounded-media max-w-measure">…</p>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Theme keys: `--color-{canvas,ink,muted,faint,rule,surface,edge,accent,accent-text,action,on-action,material}`, `--font-{sans,mono}`, `--text-{display,title,heading,lead,reading,small,control,label,code}`, `--spacing-space-{1..10}`, `--spacing-{target,bar}`, `--radius-{control,media,pill}`, `--container-{measure,wide}`. The `dark:` variant matches `[data-theme=dark]`.
|
|
64
|
+
|
|
65
|
+
## React
|
|
66
|
+
|
|
67
|
+
```jsx
|
|
68
|
+
import '@hugocxl/design/css';
|
|
69
|
+
import { Page, Masthead, Hero, Section, Button, Figure, Footer, themeScript } from '@hugocxl/design/react';
|
|
70
|
+
|
|
71
|
+
// In <head>: <script dangerouslySetInnerHTML={{ __html: themeScript }} />
|
|
72
|
+
export default () => (
|
|
73
|
+
<Page
|
|
74
|
+
masthead={<Masthead wordmark="Tab" links={[{ label: 'Docs', href: '/docs' }]} pageLink={{ label: 'GitHub', href: 'https://github.com/hugocxl/tab' }} />}
|
|
75
|
+
footer={<Footer />}
|
|
76
|
+
>
|
|
77
|
+
<Hero
|
|
78
|
+
eyebrow="Tab"
|
|
79
|
+
title={<>Side by side in one <span className="ds-accent">native workspace.</span></>}
|
|
80
|
+
lead="Tab is a terminal multiplexer for the Mac."
|
|
81
|
+
actions={<><Button href="/download">Download for macOS</Button><Button variant="more" href="/docs">Read the docs</Button></>}
|
|
82
|
+
/>
|
|
83
|
+
<Figure src="/tab.png" alt="A Tab workspace" width={1920} height={1080} caption="Fig. 01 / A Tab workspace" />
|
|
84
|
+
<Section id="panes" title="Four panes">
|
|
85
|
+
<p>Lead in ink. <span className="ds-muted">Detail in muted.</span></p>
|
|
86
|
+
</Section>
|
|
87
|
+
</Page>
|
|
88
|
+
);
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Also exported: `Title`, `Grid`, `Index`, `ThemeToggle`, `getTheme`, `setTheme`. `react` is an optional peer dependency.
|
|
92
|
+
|
|
93
|
+
## Tokens
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
import { tokens, vars } from '@hugocxl/design/tokens'; // also @hugocxl/design/tokens.json and tokens.css
|
|
97
|
+
tokens.color.dark.canvas; // '#151515'
|
|
98
|
+
vars['color.ink']; // 'var(--ds-ink)'
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Develop
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
npm install
|
|
105
|
+
npm test # builds dist/ and runs the checks
|
|
106
|
+
open examples/index.html
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Releases publish to npm from GitHub Actions when the version in `package.json` changes on `main`.
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
MIT
|
package/dist/design.css
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
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
|
+
}
|
|
79
|
+
|
|
80
|
+
/* ─── Shell and layout ───────────────────────────────────────────────── */
|
|
81
|
+
/* The page: the canvas with a soft glow of the accent at the top. Put .ds on <body> (or on the
|
|
82
|
+
outermost element of the page) with data-layout="plain". */
|
|
83
|
+
html:has(> body.ds), html:has(> body > .ds) { background: var(--ds-canvas) }
|
|
84
|
+
body:has(> .ds) { margin: 0 }
|
|
85
|
+
.ds {
|
|
86
|
+
--ds-gutter: clamp(1rem, 4vw, 2rem);
|
|
87
|
+
box-sizing: border-box;
|
|
88
|
+
min-height: 100vh;
|
|
89
|
+
margin: 0;
|
|
90
|
+
padding: 0 var(--ds-gutter);
|
|
91
|
+
color: var(--ds-ink);
|
|
92
|
+
background: radial-gradient(ellipse 120% 26rem at 50% 0, color-mix(in srgb, var(--ds-accent) 9%, transparent), transparent) no-repeat, var(--ds-canvas);
|
|
93
|
+
font: 400 var(--ds-size-reading)/1.5 var(--ds-sans);
|
|
94
|
+
letter-spacing: 0;
|
|
95
|
+
-webkit-font-smoothing: antialiased;
|
|
96
|
+
-webkit-text-size-adjust: 100%;
|
|
97
|
+
text-size-adjust: 100%;
|
|
98
|
+
}
|
|
99
|
+
.ds *, .ds *::before, .ds *::after { box-sizing: border-box }
|
|
100
|
+
.ds main { container-type: inline-size }
|
|
101
|
+
.ds :where(h1, h2, h3, p, ol, ul, figure, pre, table) { margin: 0 }
|
|
102
|
+
.ds :where(img, svg, video) { max-width: 100% }
|
|
103
|
+
.ds-column { max-width: var(--ds-measure); margin-inline: auto }
|
|
104
|
+
.ds-opening { padding-top: clamp(var(--ds-space-7), 6vw, var(--ds-space-9)) }
|
|
105
|
+
.ds-wide {
|
|
106
|
+
width: min(100cqw, var(--ds-wide));
|
|
107
|
+
margin-block: var(--ds-space-7);
|
|
108
|
+
margin-inline: calc((100% - min(100cqw, var(--ds-wide))) / 2);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* ─── Text ───────────────────────────────────────────────────────────── */
|
|
112
|
+
.ds :where(h1, h2, h3) { font: inherit; letter-spacing: inherit }
|
|
113
|
+
.ds :where(p, ul, ol, .ds-code, .ds-table, .ds-table-scroll) + :where(p, ul, ol, .ds-code, .ds-table, .ds-table-scroll) { margin-top: var(--ds-space-4) }
|
|
114
|
+
.ds p { text-wrap: pretty }
|
|
115
|
+
.ds-section :where(ul:not([class]), ol:not([class])) { padding-left: 1.2em }
|
|
116
|
+
.ds-section :where(ul:not([class]), ol:not([class])) > li + li { margin-top: var(--ds-space-2) }
|
|
117
|
+
.ds strong { font-weight: 600 }
|
|
118
|
+
/* Links read as the text around them, underlined. The accent never means "clickable". */
|
|
119
|
+
.ds a { color: inherit; text-decoration-line: underline; text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: .2em }
|
|
120
|
+
.ds a:hover { text-decoration-color: currentColor }
|
|
121
|
+
.ds :where(code, kbd, samp) { font: 400 .875em/inherit var(--ds-mono); font-variant-numeric: tabular-nums slashed-zero }
|
|
122
|
+
.ds :focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 2px }
|
|
123
|
+
.ds-muted { color: var(--ds-muted) }
|
|
124
|
+
.ds-accent { color: var(--ds-accent-text) }
|
|
125
|
+
.ds-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0 }
|
|
126
|
+
|
|
127
|
+
/* The page title (an <hgroup>): large, semibold, tight; the line under it in muted. */
|
|
128
|
+
.ds-title { font-size: var(--ds-size-title); font-weight: 600; line-height: 1.15; letter-spacing: -.02em; text-wrap: balance }
|
|
129
|
+
.ds-title > * { display: block }
|
|
130
|
+
.ds-title > :not(:first-child) { margin-top: var(--ds-space-2); color: var(--ds-muted); font-size: var(--ds-size-lead); font-weight: 400; line-height: 1.4; letter-spacing: 0 }
|
|
131
|
+
|
|
132
|
+
/* The hero: the product name, one display headline, a muted subhead and the actions. */
|
|
133
|
+
.ds-eyebrow { color: var(--ds-muted); font-size: var(--ds-size-lead); font-weight: 500; line-height: 1.3 }
|
|
134
|
+
.ds-hero h1 { max-width: 14em; margin-top: var(--ds-space-2); font-size: var(--ds-size-display); font-weight: 600; line-height: 1.05; letter-spacing: -.025em; text-wrap: balance }
|
|
135
|
+
.ds-hero h1:first-child { margin-top: 0 }
|
|
136
|
+
.ds-hero h1 + p { max-width: 32em; margin-top: var(--ds-space-4); color: var(--ds-muted); font-size: var(--ds-size-lead); line-height: 1.45; text-wrap: pretty }
|
|
137
|
+
.ds-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-3); margin-top: var(--ds-space-6) }
|
|
138
|
+
.ds-hero + * { margin-top: var(--ds-space-8) }
|
|
139
|
+
|
|
140
|
+
/* Sections: a semibold heading, then the content. */
|
|
141
|
+
.ds-section { margin-top: var(--ds-space-8); scroll-margin-top: calc(var(--ds-bar) + var(--ds-space-4)) }
|
|
142
|
+
.ds-section > h2 { margin-bottom: var(--ds-space-4); font-size: var(--ds-size-heading); font-weight: 600; line-height: 1.3; letter-spacing: -.01em }
|
|
143
|
+
.ds-section h3 { font-weight: 600 }
|
|
144
|
+
|
|
145
|
+
/* Labels: the small grey line for dates, versions and captions, with tabular figures. */
|
|
146
|
+
.ds-label { font: 400 var(--ds-size-label)/1.4 var(--ds-sans); color: var(--ds-muted); font-variant-numeric: tabular-nums }
|
|
147
|
+
.ds-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-2) var(--ds-space-4); margin-top: var(--ds-space-5); list-style: none; padding: 0 }
|
|
148
|
+
.ds-meta + * { margin-top: var(--ds-space-7) }
|
|
149
|
+
|
|
150
|
+
/* ─── Masthead and footer ────────────────────────────────────────────── */
|
|
151
|
+
/* The sticky bar on the translucent page color. The wordmark goes home, up to three nav items
|
|
152
|
+
follow (an icon before their words), then one page link and the theme switch. A hairline
|
|
153
|
+
appears once the page has scrolled (design.js or the React Masthead sets data-scrolled). */
|
|
154
|
+
.ds-masthead {
|
|
155
|
+
position: sticky;
|
|
156
|
+
top: 0;
|
|
157
|
+
z-index: 10;
|
|
158
|
+
display: flex;
|
|
159
|
+
align-items: center;
|
|
160
|
+
gap: 0 var(--ds-space-5);
|
|
161
|
+
min-height: var(--ds-bar);
|
|
162
|
+
margin-inline: calc(-1 * var(--ds-gutter));
|
|
163
|
+
padding-inline: var(--ds-space-4);
|
|
164
|
+
border-bottom: 1px solid transparent;
|
|
165
|
+
background: var(--ds-material);
|
|
166
|
+
-webkit-backdrop-filter: saturate(180%) blur(20px);
|
|
167
|
+
backdrop-filter: saturate(180%) blur(20px);
|
|
168
|
+
font-size: var(--ds-size-small);
|
|
169
|
+
font-weight: 500;
|
|
170
|
+
}
|
|
171
|
+
.ds-masthead[data-scrolled] { border-bottom-color: var(--ds-rule) }
|
|
172
|
+
.ds-masthead a { display: inline-flex; align-items: center; min-height: var(--ds-target); color: var(--ds-muted); text-decoration: none; white-space: nowrap }
|
|
173
|
+
.ds-masthead a:hover, .ds-masthead a[aria-current] { color: var(--ds-ink) }
|
|
174
|
+
.ds-masthead nav { display: flex; align-items: center; gap: 0 var(--ds-space-5); margin-left: var(--ds-space-4); margin-right: auto }
|
|
175
|
+
.ds-masthead nav .ds-icon { width: 1.125em; height: 1.125em; margin-inline-end: .375rem; vertical-align: -.2em }
|
|
176
|
+
.ds .ds-wordmark { color: var(--ds-ink); font-size: 1rem; font-weight: 700; letter-spacing: -.03em }
|
|
177
|
+
.ds-masthead > .ds-wordmark:has(+ :not(nav)) { margin-right: auto }
|
|
178
|
+
.ds-masthead > nav ~ a:not(.ds-wordmark) { color: var(--ds-ink) }
|
|
179
|
+
/* Narrow screens: nav items show only their icons (words stay for screen readers); on a phone
|
|
180
|
+
the page link steps out. */
|
|
181
|
+
@media (max-width: 640px) {
|
|
182
|
+
.ds-masthead nav { margin-left: var(--ds-space-2) }
|
|
183
|
+
.ds-masthead nav > a:has(> .ds-icon) { font-size: 0 }
|
|
184
|
+
.ds-masthead nav > a > .ds-icon { width: 1.25rem; height: 1.25rem; margin: 0 }
|
|
185
|
+
}
|
|
186
|
+
@media (max-width: 400px) {
|
|
187
|
+
.ds-masthead { gap: 0 var(--ds-space-3); padding-inline: var(--ds-space-3) }
|
|
188
|
+
.ds-masthead nav { gap: 0 var(--ds-space-4) }
|
|
189
|
+
.ds-masthead > nav ~ a:not(.ds-wordmark) { display: none }
|
|
190
|
+
}
|
|
191
|
+
.ds-theme { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; margin-inline: calc(-1 * var(--ds-space-3)); padding: 0; border: 0; border-radius: 50%; color: var(--ds-muted); background: transparent; font: inherit; font-size: 1.125rem; cursor: pointer }
|
|
192
|
+
.ds-theme:hover { color: var(--ds-ink) }
|
|
193
|
+
.ds-theme > .ds-icon { margin: 0 }
|
|
194
|
+
|
|
195
|
+
/* The footer: a hairline, then small grey words at both ends. */
|
|
196
|
+
.ds-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--ds-space-2) var(--ds-space-5); margin-top: var(--ds-space-9); padding-block: var(--ds-space-5) var(--ds-space-7); border-top: 1px solid var(--ds-rule); color: var(--ds-muted); font: 400 var(--ds-size-label)/1.4 var(--ds-sans) }
|
|
197
|
+
.ds-footer ul { display: flex; flex-wrap: wrap; gap: var(--ds-space-2) var(--ds-space-5); margin: 0; padding: 0; list-style: none }
|
|
198
|
+
.ds-footer a { color: var(--ds-muted); text-decoration: none }
|
|
199
|
+
.ds-footer a:hover { color: var(--ds-ink) }
|
|
200
|
+
|
|
201
|
+
/* ─── Figures and tiles ──────────────────────────────────────────────── */
|
|
202
|
+
/* The card: the surface with a hairline edge and a 12px radius. Figures, tiles and code sit on one. */
|
|
203
|
+
.ds-media { position: relative; display: grid; place-items: center; aspect-ratio: 3 / 2; overflow: hidden; border: 1px solid var(--ds-edge); border-radius: var(--ds-radius-media); background: var(--ds-surface) }
|
|
204
|
+
.ds-media > img, .ds-media > video { width: 100%; height: 100%; object-fit: cover }
|
|
205
|
+
.ds-caption { display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-4); min-height: var(--ds-target); margin-top: var(--ds-space-2) }
|
|
206
|
+
|
|
207
|
+
/* Tiles: a grid of cards, one idea each. data-columns="2" | "3" (default) | "4". */
|
|
208
|
+
.ds-grid { display: grid; grid-template-columns: repeat(var(--ds-cols, 3), minmax(0, 1fr)); gap: var(--ds-space-4); list-style: none; padding: 0 }
|
|
209
|
+
.ds-grid[data-columns="2"] { --ds-cols: 2 }
|
|
210
|
+
.ds-grid[data-columns="4"] { --ds-cols: 4 }
|
|
211
|
+
.ds-grid > li { display: flex; flex-direction: column; padding: var(--ds-space-5); border: 1px solid var(--ds-edge); border-radius: var(--ds-radius-media); background: var(--ds-surface) }
|
|
212
|
+
.ds-grid h3 { margin-top: auto; font-weight: 600; line-height: 1.3 }
|
|
213
|
+
.ds-grid h3 a { color: var(--ds-ink); text-decoration: none }
|
|
214
|
+
.ds-grid h3 a:hover { text-decoration: underline }
|
|
215
|
+
.ds-grid p { margin-top: var(--ds-space-1); font-size: var(--ds-size-small); line-height: 1.45; color: var(--ds-muted) }
|
|
216
|
+
@container (max-width: 34rem) { .ds-grid { grid-template-columns: minmax(0, 1fr); gap: var(--ds-space-3) } }
|
|
217
|
+
|
|
218
|
+
/* Illustrations from @hugocxl/vectors, in ink. */
|
|
219
|
+
.ds-vector { display: block; color: var(--ds-ink) }
|
|
220
|
+
.ds-media > .ds-vector { width: auto; height: 82%; max-width: 92%; aspect-ratio: 4 / 3 }
|
|
221
|
+
.ds-grid .ds-vector { width: 100%; height: auto; aspect-ratio: 4 / 3; margin-block: var(--ds-space-3) var(--ds-space-4) }
|
|
222
|
+
|
|
223
|
+
/* ─── Index list and table ───────────────────────────────────────────── */
|
|
224
|
+
/* The index (changelog, posts, experience): a grey label beside a title, rows on hairlines. */
|
|
225
|
+
.ds-index { list-style: none; padding: 0; border-bottom: 1px solid var(--ds-rule) }
|
|
226
|
+
.ds-opening > .ds-index, .ds-section + .ds-index { margin-top: var(--ds-space-7) }
|
|
227
|
+
.ds-index > li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: var(--ds-space-1) var(--ds-space-5); padding-block: var(--ds-space-4); border-top: 1px solid var(--ds-rule); scroll-margin-top: calc(var(--ds-bar) + var(--ds-space-4)) }
|
|
228
|
+
.ds-index .ds-label { padding-top: .15em }
|
|
229
|
+
.ds-index h3 { font-weight: 600 }
|
|
230
|
+
.ds-index p { margin-top: var(--ds-space-1); color: var(--ds-muted) }
|
|
231
|
+
.ds-index p + p { margin-top: var(--ds-space-2) }
|
|
232
|
+
@container (max-width: 30rem) { .ds-index > li { grid-template-columns: minmax(0, 1fr) } }
|
|
233
|
+
|
|
234
|
+
.ds-table { width: 100%; border-collapse: collapse; font-size: var(--ds-size-small); font-variant-numeric: tabular-nums }
|
|
235
|
+
.ds-table th { font: 500 var(--ds-size-label)/1.4 var(--ds-sans); color: var(--ds-muted); text-align: left }
|
|
236
|
+
.ds-table :where(th, td) { padding: var(--ds-space-3) var(--ds-space-4) var(--ds-space-3) 0; border-bottom: 1px solid var(--ds-rule); vertical-align: top }
|
|
237
|
+
.ds-table tbody th { font: inherit; color: var(--ds-ink) }
|
|
238
|
+
.ds-table-scroll { overflow-x: auto }
|
|
239
|
+
|
|
240
|
+
/* ─── Controls and code ──────────────────────────────────────────────── */
|
|
241
|
+
/* The primary button is inverted ink; .ds-more is an 8% wash of ink with grey words and an arrow. */
|
|
242
|
+
.ds-button { display: inline-flex; align-items: center; justify-content: center; gap: var(--ds-space-2); min-height: var(--ds-target); padding: 0 var(--ds-space-4); border: 0; border-radius: var(--ds-radius-control); color: var(--ds-on-action); background: var(--ds-action); font: 500 var(--ds-size-control)/1 var(--ds-sans); text-decoration: none; cursor: pointer }
|
|
243
|
+
.ds a.ds-button { color: var(--ds-on-action); text-decoration: none }
|
|
244
|
+
.ds-button:hover { opacity: .86 }
|
|
245
|
+
.ds-button > .ds-icon { margin: 0 }
|
|
246
|
+
.ds .ds-more { display: inline-flex; align-items: center; gap: var(--ds-space-2); min-height: var(--ds-target); padding: 0 var(--ds-space-4); border: 0; border-radius: var(--ds-radius-control); color: var(--ds-muted); background: var(--ds-rule); font: 500 var(--ds-size-control)/1 var(--ds-sans); text-decoration: none; cursor: pointer }
|
|
247
|
+
.ds .ds-more:hover { color: var(--ds-ink) }
|
|
248
|
+
.ds-more > .ds-icon { order: 1; width: .9em; height: .9em; margin: 0 }
|
|
249
|
+
|
|
250
|
+
/* Code blocks: a card with a copy button (design.js wires it). */
|
|
251
|
+
.ds-code { position: relative; border: 1px solid var(--ds-edge); border-radius: var(--ds-radius-media); background: var(--ds-surface) }
|
|
252
|
+
.ds-code pre { padding: var(--ds-space-4) var(--ds-space-5); overflow-x: auto; font: 400 var(--ds-size-code)/1.6 var(--ds-mono); font-variant-numeric: tabular-nums slashed-zero; white-space: pre; tab-size: 2 }
|
|
253
|
+
.ds-code pre code { font: inherit }
|
|
254
|
+
.ds-code button { position: absolute; top: var(--ds-space-2); right: var(--ds-space-2); min-height: 1.75rem; padding: 0 var(--ds-space-3); border: 0; border-radius: var(--ds-radius-control); color: var(--ds-muted); background: var(--ds-rule); font: 500 var(--ds-size-small)/1 var(--ds-sans); cursor: pointer }
|
|
255
|
+
.ds-code button:hover { color: var(--ds-ink) }
|
|
256
|
+
|
|
257
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
258
|
+
.ds-button, .ds-more, .ds-theme { transition: transform var(--ds-ease), color var(--ds-ease), background-color var(--ds-ease), opacity var(--ds-ease) }
|
|
259
|
+
.ds-button:active, .ds-more:active, .ds-theme:active { transform: scale(.97) }
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/* Icons (e.g. @hugocxl/icons, Stroke): before the words of a link, button or label. */
|
|
263
|
+
.ds-icon { display: inline-block; width: 1em; height: 1em; margin-inline-end: var(--ds-space-2); vertical-align: -.125em; flex: none }
|
package/dist/design.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @hugocxl/design page behaviour, optional: the masthead hairline once the page has scrolled and
|
|
2
|
+
// the copy button of .ds-code blocks. Load with <script type="module" src=".../design.js">.
|
|
3
|
+
const masthead = document.querySelector('.ds-masthead');
|
|
4
|
+
if (masthead) {
|
|
5
|
+
const mark = () => masthead.toggleAttribute('data-scrolled', scrollY > 0);
|
|
6
|
+
mark();
|
|
7
|
+
addEventListener('scroll', mark, { passive: true });
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
document.addEventListener('click', async event => {
|
|
11
|
+
const button = event.target.closest?.('.ds-code button');
|
|
12
|
+
if (!button) return;
|
|
13
|
+
try {
|
|
14
|
+
await navigator.clipboard.writeText(button.closest('.ds-code').querySelector('pre').textContent);
|
|
15
|
+
button.textContent = 'Copied';
|
|
16
|
+
} catch {
|
|
17
|
+
button.textContent = 'Select to copy';
|
|
18
|
+
}
|
|
19
|
+
setTimeout(() => { button.textContent = 'Copy'; }, 1600);
|
|
20
|
+
});
|