@felix-hz/seamount 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/LICENSE +21 -0
- package/README.md +150 -2
- package/THIRD_PARTY_NOTICES.md +37 -0
- package/dist/css/base.css +75 -0
- package/dist/css/components.css +1107 -0
- package/dist/css/fonts.css +136 -0
- package/dist/css/seamount.css +1483 -0
- package/dist/css/tailwind.css +64 -0
- package/dist/css/tokens.css +159 -0
- package/dist/fonts/DepartureMono-OFL.txt +93 -0
- package/dist/fonts/InstrumentSans-OFL.txt +93 -0
- package/dist/fonts/JetBrainsMono-OFL.txt +93 -0
- package/dist/fonts/Newsreader-OFL.txt +93 -0
- package/dist/fonts/departure-mono.woff2 +0 -0
- package/dist/fonts/instrument-sans.woff2 +0 -0
- package/dist/fonts/jetbrains-mono.woff2 +0 -0
- package/dist/fonts/newsreader-display.woff2 +0 -0
- package/dist/fonts/newsreader-italic.woff2 +0 -0
- package/dist/fonts/newsreader-semibold.woff2 +0 -0
- package/dist/fonts/newsreader.woff2 +0 -0
- package/dist/lib/format.d.ts +23 -0
- package/dist/lib/format.js +88 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/theme.d.ts +20 -0
- package/dist/lib/theme.js +53 -0
- package/dist/lib/theme.js.map +1 -0
- package/dist/react/button.d.ts +12 -0
- package/dist/react/button.js +19 -0
- package/dist/react/button.js.map +1 -0
- package/dist/react/cn.d.ts +4 -0
- package/dist/react/cn.js +10 -0
- package/dist/react/cn.js.map +1 -0
- package/dist/react/controls.d.ts +23 -0
- package/dist/react/controls.js +50 -0
- package/dist/react/controls.js.map +1 -0
- package/dist/react/dialog.d.ts +40 -0
- package/dist/react/dialog.js +102 -0
- package/dist/react/dialog.js.map +1 -0
- package/dist/react/feedback.d.ts +31 -0
- package/dist/react/feedback.js +86 -0
- package/dist/react/feedback.js.map +1 -0
- package/dist/react/field.d.ts +38 -0
- package/dist/react/field.js +81 -0
- package/dist/react/field.js.map +1 -0
- package/dist/react/hooks.d.ts +24 -0
- package/dist/react/hooks.js +58 -0
- package/dist/react/hooks.js.map +1 -0
- package/dist/react/index.d.ts +19 -0
- package/dist/react/index.js +19 -0
- package/dist/react/label.d.ts +28 -0
- package/dist/react/label.js +91 -0
- package/dist/react/label.js.map +1 -0
- package/dist/react/menu.d.ts +21 -0
- package/dist/react/menu.js +72 -0
- package/dist/react/menu.js.map +1 -0
- package/dist/react/overlay.d.ts +19 -0
- package/dist/react/overlay.js +47 -0
- package/dist/react/overlay.js.map +1 -0
- package/dist/react/row.d.ts +14 -0
- package/dist/react/row.js +35 -0
- package/dist/react/row.js.map +1 -0
- package/dist/react/section.d.ts +20 -0
- package/dist/react/section.js +72 -0
- package/dist/react/section.js.map +1 -0
- package/dist/react/select.d.ts +11 -0
- package/dist/react/select.js +59 -0
- package/dist/react/select.js.map +1 -0
- package/dist/react/spec.d.ts +10 -0
- package/dist/react/spec.js +25 -0
- package/dist/react/spec.js.map +1 -0
- package/dist/react/stat.d.ts +37 -0
- package/dist/react/stat.js +115 -0
- package/dist/react/stat.js.map +1 -0
- package/dist/react/tabs.d.ts +7 -0
- package/dist/react/tabs.js +30 -0
- package/dist/react/tabs.js.map +1 -0
- package/dist/react/toast.d.ts +51 -0
- package/dist/react/toast.js +122 -0
- package/dist/react/toast.js.map +1 -0
- package/package.json +100 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Félix Hernández Vieyra
|
|
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,151 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/icon.svg" width="64" height="64" alt="">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<h1 align="center">seamount</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">Printed precision for my sites and apps: tokens, faces, vanilla CSS and React components on Radix.</p>
|
|
8
|
+
|
|
9
|
+
Seamount is one cobalt ink on paper, four faces with one job each, instrument labels and hairlines. This package is the shared implementation: the same stylesheet serves a plain HTML page and the React components, so a desktop app in vanilla JS and a React Router app look and behave alike. The rules (principles, voice, charts, icons) are summarised in the stories; Storybook is the living reference.
|
|
10
|
+
|
|
11
|
+
## Contents
|
|
12
|
+
|
|
13
|
+
- [Install](#install)
|
|
14
|
+
- [Use it](#use-it)
|
|
15
|
+
- [What is in it](#what-is-in-it)
|
|
16
|
+
- [Develop](#develop)
|
|
17
|
+
- [Release](#release)
|
|
18
|
+
- [Licences](#licences)
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
pnpm add @felix-hz/seamount # or bun add, npm install
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
React 19 is a peer dependency for the components; the CSS, `format` and `theme` entries need nothing else.
|
|
27
|
+
|
|
28
|
+
## Use it
|
|
29
|
+
|
|
30
|
+
### Plain CSS
|
|
31
|
+
|
|
32
|
+
One file holds tokens, faces, base and components. Fonts resolve relative to it, so copy `dist/css` and `dist/fonts` together.
|
|
33
|
+
|
|
34
|
+
```html
|
|
35
|
+
<link rel="stylesheet" href="seamount/css/seamount.css">
|
|
36
|
+
|
|
37
|
+
<section class="sm-section">
|
|
38
|
+
<div class="sm-section-head">
|
|
39
|
+
<span class="sm-label" data-tone="accent">[ 01 ]</span>
|
|
40
|
+
<h2 class="sm-section-title">Power</h2>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="sm-row">
|
|
43
|
+
<div class="sm-row-text">
|
|
44
|
+
<div class="sm-row-name">Stop charging at</div>
|
|
45
|
+
<p class="sm-row-help">60% suits a laptop that stays plugged in.</p>
|
|
46
|
+
</div>
|
|
47
|
+
<button class="sm-button" data-variant="primary">Apply</button>
|
|
48
|
+
</div>
|
|
49
|
+
</section>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
[`examples/vanilla.html`](examples/vanilla.html) shows every class without React.
|
|
53
|
+
|
|
54
|
+
### React
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
import "@felix-hz/seamount/styles.css";
|
|
58
|
+
import { Button, Field, Input, Toaster, TooltipProvider, toast } from "@felix-hz/seamount";
|
|
59
|
+
|
|
60
|
+
export function App() {
|
|
61
|
+
return (
|
|
62
|
+
<TooltipProvider>
|
|
63
|
+
<Field label="Monthly limit" help="In NZD.">
|
|
64
|
+
<Input figures inputMode="decimal" />
|
|
65
|
+
</Field>
|
|
66
|
+
<Button variant="primary" onClick={() => toast.success({ title: "Created Groceries. $500 a month." })}>
|
|
67
|
+
Create budget
|
|
68
|
+
</Button>
|
|
69
|
+
<Toaster />
|
|
70
|
+
</TooltipProvider>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Components follow shadcn/ui's shape (Radix primitives, `asChild`, `data-slot` and `data-variant` attributes) but take their look from the `sm-` classes rather than utility strings, so overriding is plain CSS and needs no Tailwind.
|
|
76
|
+
|
|
77
|
+
### Tailwind 4
|
|
78
|
+
|
|
79
|
+
```css
|
|
80
|
+
@import "tailwindcss";
|
|
81
|
+
@import "@felix-hz/seamount/styles.css";
|
|
82
|
+
@import "@felix-hz/seamount/tailwind.css";
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`tailwind.css` maps the tokens into the theme (`bg-paper`, `text-ink-3`, `border-rule`, `font-mono`, `rounded`) and adds the `label` and `figures` utilities. Colours switch with the theme through the tokens, so `dark:` variants are rarely needed.
|
|
86
|
+
|
|
87
|
+
### Theme
|
|
88
|
+
|
|
89
|
+
Dark mode follows the OS until the page sets `data-theme="light"` or `"dark"` on `<html>`. To avoid a flash, inline the script in `<head>` and use the hook for the setting:
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
import { themeScript } from "@felix-hz/seamount/theme";
|
|
93
|
+
import { useTheme } from "@felix-hz/seamount";
|
|
94
|
+
|
|
95
|
+
<script dangerouslySetInnerHTML={{ __html: themeScript() }} />;
|
|
96
|
+
|
|
97
|
+
const { choice, setChoice } = useTheme(); // "system" | "light" | "dark", persisted
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Pass `classes: true` to both when an app's CSS keys off `.dark`.
|
|
101
|
+
|
|
102
|
+
### Formatting
|
|
103
|
+
|
|
104
|
+
`@felix-hz/seamount/format` holds the number and time rules as plain functions, safe on a server: `formatUnit(88.4, "°C")` gives `88.4 °C`, `formatSigned(-42.1)` gives `−42.10`, `formatWhen(date)` gives `4 min ago` or `Fri 20 Nov, 21:40`, and every one prints `–` for a missing value.
|
|
105
|
+
|
|
106
|
+
## What is in it
|
|
107
|
+
|
|
108
|
+
| Entry | Contents |
|
|
109
|
+
| -------------------------------------------------------------------------- | ---------------------------------------------- |
|
|
110
|
+
| `@felix-hz/seamount` | React components and hooks |
|
|
111
|
+
| `@felix-hz/seamount/styles.css` | tokens, faces, base and components in one file |
|
|
112
|
+
| `@felix-hz/seamount/tokens.css`, `fonts.css`, `base.css`, `components.css` | the same, in parts |
|
|
113
|
+
| `@felix-hz/seamount/tailwind.css` | Tailwind 4 theme mapping and utilities |
|
|
114
|
+
| `@felix-hz/seamount/format` | numbers, units, money and time |
|
|
115
|
+
| `@felix-hz/seamount/theme` | theme choice, head script, OS watch |
|
|
116
|
+
| `@felix-hz/seamount/fonts/*` | Latin-subset woff2 files and their licences |
|
|
117
|
+
|
|
118
|
+
**Components:** Button, Label, Tag, Kbd, Square, Live, ShortcutLabel, Section (collapsible), SpecList, Row, Field with Input and Textarea, Select, Checkbox, Switch, SegmentedControl, Tabs, Dialog, ConfirmDialog, Menu, Popover, Tooltip, Separator, Toaster and `toast`, Banner, EmptyState, LoadingState, Skeleton, Table, StatTile, Sparkline, Meter. **Hooks:** `useTheme`, `useHotkey`, `useField`.
|
|
119
|
+
|
|
120
|
+
Every component is a client component (`"use client"` is kept in the build); `format` and `theme` are not, so server code can import them.
|
|
121
|
+
|
|
122
|
+
The styles are in the `base` and `components` cascade layers, declared in Tailwind's order. Unlayered app CSS and Tailwind utilities beat them without `!important`.
|
|
123
|
+
|
|
124
|
+
## Develop
|
|
125
|
+
|
|
126
|
+
Node 20.19 or later and pnpm (`corepack enable`).
|
|
127
|
+
|
|
128
|
+
```sh
|
|
129
|
+
pnpm install
|
|
130
|
+
pnpm dev # Storybook at http://localhost:6006
|
|
131
|
+
pnpm test # Vitest with Testing Library
|
|
132
|
+
pnpm lint # Biome
|
|
133
|
+
pnpm typecheck
|
|
134
|
+
pnpm build # tsdown to dist/, then CSS and fonts
|
|
135
|
+
pnpm check:package # publint and arethetypeswrong against the packed tarball
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Conventions:
|
|
139
|
+
|
|
140
|
+
- A new component is a Radix primitive (or plain element) with `data-slot`, its variants as data attributes, and its look in `src/css/components.css` under an `sm-` class. A test checks that every class a component emits is defined.
|
|
141
|
+
- Exported functions carry explicit return types (`isolatedDeclarations`), which keeps declaration output fast and the public API deliberate.
|
|
142
|
+
- Copy in stories follows the Seamount voice: real-looking data, sentence case, NZ English, no em dashes.
|
|
143
|
+
- Each change consumers would notice gets a changeset (`pnpm changeset`); see `.changeset/README.md` for the bump rules.
|
|
144
|
+
|
|
145
|
+
## Release
|
|
146
|
+
|
|
147
|
+
Merging to `main` with pending changesets opens a "version packages" PR. Merging that PR publishes to npm from GitHub Actions with provenance, through npm trusted publishing (OIDC, no stored token), and tags the release.
|
|
148
|
+
|
|
149
|
+
## Licences
|
|
150
|
+
|
|
151
|
+
MIT, see [LICENSE](LICENSE). The fonts are under the SIL Open Font License 1.1, each licence beside its file in `dist/fonts`. Component structure follows shadcn/ui (MIT); see [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
## shadcn/ui
|
|
4
|
+
|
|
5
|
+
The React components follow the structure of shadcn/ui's Radix components (`asChild` through Radix Slot, `data-slot` and `data-variant` attributes, part names). Styling and behaviour are Seamount's own.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2023 shadcn
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Fonts
|
|
32
|
+
|
|
33
|
+
Newsreader, Instrument Sans, JetBrains Mono and Departure Mono are under the SIL Open Font License 1.1. Each licence ships beside its font in `dist/fonts`.
|
|
34
|
+
|
|
35
|
+
## Dependencies
|
|
36
|
+
|
|
37
|
+
Radix Primitives (`radix-ui`) and `clsx` are MIT-licensed runtime dependencies, installed from npm rather than copied.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/* ── Seamount base ──
|
|
2
|
+
Opt-in element defaults: paper ground, the sans for interface text, tabular figures, the focus ring and
|
|
3
|
+
reduced motion. Apps that own their reset can skip this file and keep only tokens and components. */
|
|
4
|
+
|
|
5
|
+
@layer base {
|
|
6
|
+
html {
|
|
7
|
+
-webkit-text-size-adjust: 100%;
|
|
8
|
+
text-size-adjust: 100%;
|
|
9
|
+
-webkit-tap-highlight-color: transparent;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
body {
|
|
13
|
+
margin: 0;
|
|
14
|
+
background: var(--sm-paper);
|
|
15
|
+
color: var(--sm-ink);
|
|
16
|
+
font-family: var(--sm-font-sans);
|
|
17
|
+
font-size: var(--sm-text-body);
|
|
18
|
+
line-height: 1.5;
|
|
19
|
+
-webkit-font-smoothing: antialiased;
|
|
20
|
+
-moz-osx-font-smoothing: grayscale;
|
|
21
|
+
text-rendering: optimizeLegibility;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
h1,
|
|
25
|
+
h2,
|
|
26
|
+
h3 {
|
|
27
|
+
font-family: var(--sm-font-display);
|
|
28
|
+
font-weight: 350;
|
|
29
|
+
letter-spacing: -0.015em;
|
|
30
|
+
color: var(--sm-ink);
|
|
31
|
+
text-wrap: balance;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
p {
|
|
35
|
+
text-wrap: pretty;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
a {
|
|
39
|
+
color: inherit;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
code,
|
|
43
|
+
kbd,
|
|
44
|
+
samp,
|
|
45
|
+
pre {
|
|
46
|
+
font-family: var(--sm-font-mono);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
::selection {
|
|
50
|
+
background: var(--sm-tint);
|
|
51
|
+
color: var(--sm-ink);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
:focus-visible {
|
|
55
|
+
outline: 2px solid var(--sm-accent);
|
|
56
|
+
outline-offset: 2px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
hr {
|
|
60
|
+
border: 0;
|
|
61
|
+
border-top: 1px solid var(--sm-rule);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* !important inside a layer outranks unlayered app styles, so reduced motion always wins */
|
|
65
|
+
@media (prefers-reduced-motion: reduce) {
|
|
66
|
+
*,
|
|
67
|
+
*::before,
|
|
68
|
+
*::after {
|
|
69
|
+
animation-duration: 0.01ms !important;
|
|
70
|
+
animation-iteration-count: 1 !important;
|
|
71
|
+
transition-duration: 0.01ms !important;
|
|
72
|
+
scroll-behavior: auto !important;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|