@supertype.ai/foundations 0.1.25 → 0.1.27
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/README.md +28 -49
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
# @supertype.ai/foundations
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
[](https://github.com/supertypeai/foundations/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/@supertype.ai/foundations)
|
|
5
|
+
[](https://bundlephobia.com/package/@supertype.ai/foundations)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
[The foundations philosophy](https://supertypeai.github.io/foundations/philosophy/) lays out the Raison d'être better, but the crux is that it is a reusable design system that binds typography primitives, content blocks, the long-form essay shell, the token and theme CSS, and the build-time tooling that keep baseline quality high (SEO, OG cards, lint rules, contrast
|
|
9
|
+
checks) in a single package. Used by Supertype's own projects like [Viably work operating system](https://viably.app) and [supertype.ai](https://supertype.ai), it is also MIT-licensed and available for any Next.js 15+ project built atop Tailwind and Shadcn.
|
|
7
10
|
|
|
8
11
|
```sh
|
|
9
12
|
yarn add @supertype.ai/foundations
|
|
10
13
|
```
|
|
11
14
|
|
|
12
|
-
**Start here:** [Install](#install)
|
|
15
|
+
**Start here:** [Install](#install), then [Your first page](#your-first-page).
|
|
13
16
|
|
|
14
17
|
**Reference:** [Typography](docs/typography.md) · [Blocks](docs/blocks.md) ·
|
|
15
18
|
[The essay shell](docs/essay.md) · [Build-time tooling](docs/tooling.md) ·
|
|
@@ -18,18 +21,18 @@ yarn add @supertype.ai/foundations
|
|
|
18
21
|
**Working on the package itself:** [Contributing](docs/contributing.md), for
|
|
19
22
|
local iteration against a consumer and for releasing.
|
|
20
23
|
|
|
24
|
+
Like the project? ⭐ Star it on [GitHub](https://github.com/supertypeai/foundations)
|
|
25
|
+
|
|
21
26
|
## See it running
|
|
22
27
|
|
|
23
|
-
|
|
28
|
+
Check out: [the documentation site](https://supertypeai.github.io/foundations/), or alternatively run the example site locally:
|
|
24
29
|
|
|
25
30
|
```sh
|
|
26
31
|
yarn example:install # once, to install Next, the peers and the package
|
|
27
32
|
yarn example # then open http://localhost:3000
|
|
28
33
|
```
|
|
29
34
|
|
|
30
|
-
[`examples/site`](examples/site) renders every component along with the code, and include whole-page [recipes](examples/site/app/_recipes) to copy into your project
|
|
31
|
-
|
|
32
|
-
## Alternatively, check out: [the documentation site](https://supertypeai.github.io/foundations/)
|
|
35
|
+
[`examples/site`](examples/site) renders every component along with the code, and include whole-page [recipes](examples/site/app/_recipes) to copy into your project. Comes with the `dark` and `.editorial` switches.
|
|
33
36
|
|
|
34
37
|
## Initialization and Diagnostics
|
|
35
38
|
|
|
@@ -41,9 +44,7 @@ npx @supertype.ai/foundations doctor # checks this app against everything bel
|
|
|
41
44
|
```
|
|
42
45
|
|
|
43
46
|
`init` edits one file: the CSS entry that imports Tailwind. It adds the imports
|
|
44
|
-
you are missing and reorders anything that is out of place. Run it with `--dry-run` first to see the patch. Everything else it
|
|
45
|
-
prints for you to paste — the font binding, and the `llms.txt` line for a coding
|
|
46
|
-
agent.
|
|
47
|
+
you are missing and reorders anything that is out of place. Run it with `--dry-run` first to see the patch. Everything else it prints for you to paste (the font binding, and the `llms.txt` lines for a coding agent).
|
|
47
48
|
|
|
48
49
|
The steps performed by `init` are written out below anyway. See [the CLI](docs/cli.md) for the full list of checks and details.
|
|
49
50
|
|
|
@@ -65,7 +66,7 @@ untagged git dependency re-resolves to a different commit on any fresh install.
|
|
|
65
66
|
|
|
66
67
|
```jsonc
|
|
67
68
|
// package.json
|
|
68
|
-
"@supertype.ai/foundations": "https://github.com/supertypeai/foundations.git#v0.1.
|
|
69
|
+
"@supertype.ai/foundations": "https://github.com/supertypeai/foundations.git#v0.1.27"
|
|
69
70
|
```
|
|
70
71
|
|
|
71
72
|
</details>
|
|
@@ -89,8 +90,7 @@ default, so without it every class is purged and the components
|
|
|
89
90
|
render with no styles at all.
|
|
90
91
|
|
|
91
92
|
**`theme.css` is required.** `tokens.css` names the colour roles; `theme.css` is
|
|
92
|
-
what gives them values. Without it
|
|
93
|
-
resolves to nothing, so the page renders unpainted with no error. It also carries
|
|
93
|
+
what gives them values. Without it color utility can't be resolved, so the page renders unpainted with no error. It also carries
|
|
94
94
|
`--secondary-ink`, `--subtle-foreground`, the four earth tones the marker
|
|
95
95
|
highlight uses, and the `accordion-down` and `accordion-up` keyframes. Skip it
|
|
96
96
|
only if you declare every role yourself; `foundations doctor` fails when neither
|
|
@@ -114,9 +114,7 @@ const serif = Average({ variable: "--font-average", weight: "400", subsets: ["la
|
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
**Bind with `.variable`, never `.className`.** A className sets `font-family` on
|
|
117
|
-
the element itself and leaves the roles unresolved,
|
|
118
|
-
typeface while every `font-sans` and `font-heading` utility on it renders
|
|
119
|
-
another.
|
|
117
|
+
the element itself and leaves the roles unresolved, causing a mismatch where the page renders one typeface while every `font-sans` and `font-heading` utility on it renders another.
|
|
120
118
|
|
|
121
119
|
### 4. Check the wiring
|
|
122
120
|
|
|
@@ -195,8 +193,7 @@ Two rules cover most of the API:
|
|
|
195
193
|
`text-sm text-muted-foreground` is `<TypographyMuted>`. Using the primitives
|
|
196
194
|
keeps a size and a colour from drifting apart across a few hundred call sites.
|
|
197
195
|
- **Retune with CSS variables, not classes.** The package owns its own
|
|
198
|
-
classnames. Change a `--text
|
|
199
|
-
everything moves together.
|
|
196
|
+
classnames. Change a `--text-*`, `--heading-weight`, or a colour specification in `theme.css` to retune the whole package. Read [Tokens and theming](#tokens-and-theming) for full instructions.
|
|
200
197
|
|
|
201
198
|
---
|
|
202
199
|
|
|
@@ -205,18 +202,13 @@ Two rules cover most of the API:
|
|
|
205
202
|
`yarn example` (above) builds the package, syncs it in and starts the dev
|
|
206
203
|
server. `yarn example:build` is what CI would run.
|
|
207
204
|
|
|
208
|
-
It installs the package from a git tag rather than from the registry
|
|
209
|
-
|
|
210
|
-
it with `yarn sync`, with no workspace and no symlink. Its `global.css`
|
|
211
|
-
and `layout.tsx` are the blocks above, unchanged, so an install instruction that
|
|
212
|
-
stops being true breaks the site.
|
|
205
|
+
It installs the package from a git tag rather than from the registry and updates
|
|
206
|
+
it with `yarn sync`.
|
|
213
207
|
|
|
214
208
|
`/recipes` holds whole pages rather than single components: a marketing hero, a
|
|
215
|
-
metrics panel, pricing tiers, a docs page, an article index, and
|
|
216
|
-
that wire up MDX. Each one lives in
|
|
209
|
+
metrics panel, pricing tiers, a docs page, an article index, and examples of MDX-rendered pages. Each one lives in
|
|
217
210
|
[`app/_recipes/`](examples/site/app/_recipes) as a complete file that imports
|
|
218
211
|
only from this package, so you can paste it into your app and it compiles.
|
|
219
|
-
`yarn example:build` fails if a recipe reaches for a local helper.
|
|
220
212
|
|
|
221
213
|
---
|
|
222
214
|
|
|
@@ -253,15 +245,6 @@ package.
|
|
|
253
245
|
| `./tokens.css` `./theme.css` `./type.css` `./prose.css` `./shiki.css` | the style layer | [Tokens and theming](#tokens-and-theming) |
|
|
254
246
|
| `foundations` (bin) | `init` and `doctor` | [The CLI](docs/cli.md) |
|
|
255
247
|
|
|
256
|
-
The entries are split by what they pull in. Blocks and the MDX map stay out of
|
|
257
|
-
the root barrel so that importing a heading does not resolve `@base-ui/react` or
|
|
258
|
-
`next/image`, and `/rehype` and `/contrast` stay out of both so they can run in
|
|
259
|
-
bare Node, where React cannot be resolved.
|
|
260
|
-
|
|
261
|
-
None of the entry points can be imported from plain Node, though: typography
|
|
262
|
-
reaches `next/link` through `next-view-transitions`. Import them from a Next app,
|
|
263
|
-
or from a test runner that resolves Next — both consumers' vitest suites do.
|
|
264
|
-
|
|
265
248
|
---
|
|
266
249
|
|
|
267
250
|
## Tokens and theming
|
|
@@ -274,18 +257,18 @@ only ever one palette in play.
|
|
|
274
257
|
|
|
275
258
|
Each status hue ships twice, on the same rule as the categorical tints:
|
|
276
259
|
`--success`, `--warn` and `--info` are **fills**, held to 3:1 against the page
|
|
277
|
-
and a card
|
|
260
|
+
and a card; `--success-ink`,
|
|
278
261
|
`--warn-ink` and `--info-ink` are the same hues as **text**, held to 4.5:1.
|
|
279
262
|
`--danger` ships as an ink only. `--destructive` keeps shadcn's shape, where
|
|
280
263
|
`--destructive-foreground` is the label printed on the fill — that is what
|
|
281
264
|
`-foreground` means throughout, and `-ink` means the hue used as words.
|
|
282
|
-
`checkSignals` in `@supertype.ai/foundations/contrast` measures all
|
|
265
|
+
`checkSignals` in `@supertype.ai/foundations/contrast` measures all of them and fails if any are below the threshold.
|
|
283
266
|
|
|
284
267
|
`tokens.css` also binds the `dark:` variant to the `.dark` class. Do not skip
|
|
285
268
|
that import: Tailwind v4 otherwise follows the OS setting and quietly ignores
|
|
286
269
|
your toggle.
|
|
287
270
|
|
|
288
|
-
`theme.css` gives those roles the
|
|
271
|
+
`theme.css` gives those roles the latte and espresso palette, and adds the
|
|
289
272
|
editorial inks (`--secondary-ink`, `--subtle-foreground`, and the ochre,
|
|
290
273
|
terracotta, sage and fig pairs) along with the elevation shadows.
|
|
291
274
|
|
|
@@ -306,25 +289,21 @@ than patching the utilities:
|
|
|
306
289
|
|
|
307
290
|
`type.css` names three font roles (`--font-sans`, `--font-mono` and
|
|
308
291
|
`--font-heading`) and the weight that goes with the heading face. `.editorial`
|
|
309
|
-
gives the heading role to the serif and drops the weight to 400
|
|
310
|
-
only has one:
|
|
292
|
+
gives the heading role to the serif and drops the weight to 400.
|
|
311
293
|
|
|
312
294
|
```tsx
|
|
313
295
|
<div className="editorial">…</div> {/* or on <html> for an editorial site */}
|
|
314
296
|
```
|
|
315
297
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
surfaces set body at different sizes: 13px in the product, 18px on `.editorial`. Scope the
|
|
319
|
-
class to whichever surfaces should be editorial, whether that is a marketing and
|
|
320
|
-
docs section or the whole site.
|
|
298
|
+
Heading sizes are a _ratio_ to the body text under them, and the two
|
|
299
|
+
surfaces set body at different sizes: 13px in the product, 18px on `.editorial`. Scope the class to whichever surfaces should be editorial, whether that is a marketing and docs section or the whole site.
|
|
321
300
|
|
|
322
301
|
---
|
|
323
302
|
|
|
324
303
|
## Design rules
|
|
325
304
|
|
|
326
305
|
1. **The package owns its final classnames.** Retune with CSS custom properties
|
|
327
|
-
(the `--text
|
|
306
|
+
(the `--text-*`, `--heading-weight`, the colour tokens) rather than by
|
|
328
307
|
patching classes. A property the package declares is read by the package —
|
|
329
308
|
`test/tokens-live.test.ts` fails on one that is not, because a knob that
|
|
330
309
|
turns nothing is worse than no knob at all.
|
|
@@ -351,7 +330,7 @@ Sites running the package:
|
|
|
351
330
|
- [supertype.ai](https://supertype.ai) — Supertype, a regional-leading analytics engineering and data science consulting firm.
|
|
352
331
|
- [viably.app](https://viably.app) — Viably, an observability-first business operating system and CRM for automation-obsessed teams.
|
|
353
332
|
|
|
354
|
-
|
|
333
|
+
## 
|
|
355
334
|
|
|
356
335
|
## License
|
|
357
336
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supertype.ai/foundations",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"type": "git",
|
|
129
129
|
"url": "git+https://github.com/supertypeai/foundations.git"
|
|
130
130
|
},
|
|
131
|
-
"homepage": "https://github.
|
|
131
|
+
"homepage": "https://supertypeai.github.io/foundations/",
|
|
132
132
|
"contributors": [
|
|
133
133
|
{
|
|
134
134
|
"name": "Supertype Pte. Ltd.",
|