@milesroxas/create-design-hub 0.8.1 → 0.10.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milesroxas/create-design-hub",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Create a Design Hub project: the thin folder of prototypes, kit materials and docs that installs the @milesroxas/design-hub package. Runs as `npm create @milesroxas/design-hub`.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
],
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@biomejs/biome": "2.6.3",
|
|
35
|
-
"@milesroxas/design-hub": "0.
|
|
35
|
+
"@milesroxas/design-hub": "0.10.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"check": "biome check --config-path ../design-hub/configs/biome .",
|
package/template/AGENTS.md
CHANGED
|
@@ -10,7 +10,7 @@ Code here is for sketching, not shipping. Following Karri Saarinen's [Design is
|
|
|
10
10
|
|
|
11
11
|
1. **Problem first.** `README.md` states the problem and the one question before any code exists. Restate it when you present the prototype.
|
|
12
12
|
2. **Where it stands.** Pick one per prototype: the shell of its track (`AppShell` for product, `SiteShell` for website), the project's chrome from `kit/shell.ts` and `DESIGN.md`, Shell; or the low-gravity space (`Space`), one thing alone on a quiet canvas with the picker and live dials. Brand collateral always stands on a `Board` of `Artboard`s, each at its real pixel size.
|
|
13
|
-
3. **Low gravity.** A prototype imports only `@kit/*` and its own folder. Never another prototype. No tests, no stories, no abstractions for later. The fidelity ceiling is in the `miles-prototype` skill, and the fidelity guard hook says so when a write goes over it.
|
|
13
|
+
3. **Low gravity.** A prototype imports only `@kit/*` and its own folder. Never another prototype: the build refuses it. No tests, no stories, no abstractions for later. The fidelity ceiling is in the `miles-prototype` skill, and the fidelity guard hook says so when a write goes over it.
|
|
14
14
|
4. **Fork, don't flex.** If a kit piece needs to behave differently, copy it into the prototype folder and change the copy. Never add a prop or a variant to `kit/` for one prototype.
|
|
15
15
|
5. **Promote on second use.** When a second prototype copies the same thing, move it into `kit/` and point both at it.
|
|
16
16
|
6. **Real materials, worst content.** Real tokens, fonts and icons. The content comes from `fixtures.json`: `real` pulled from the CMS or copied from the comp, `missing` written by hand, and `longest`, `empty` and `max` derived by `@kit/fixtures`.
|
|
@@ -78,10 +78,21 @@ README frontmatter, all fields required (`feature` may be empty for a one-off):
|
|
|
78
78
|
|
|
79
79
|
The README's `## States` table lists every state the prototype holds and how to reach it. The fidelity guard asks whether a write adds a state that is not there, and `miles-port` refuses a folder without the table.
|
|
80
80
|
|
|
81
|
-
- Sub-pages are hash routes (`/sample-list/#/items/42`) via `useHashRoute`. The path belongs to the hub, and `/guide/`
|
|
81
|
+
- Sub-pages are hash routes (`/sample-list/#/items/42`) via `useHashRoute`. The path belongs to the hub, and `/guide/`, `/api/` and `/assets/` are taken.
|
|
82
82
|
- Persist with `useStoredState(key, initial)`, keys prefixed with the slug. A preference, never a store.
|
|
83
83
|
- Only the open prototype's code and CSS load. Kit class names are shared: never reuse one for something else.
|
|
84
84
|
|
|
85
|
+
## Who sees a prototype
|
|
86
|
+
|
|
87
|
+
- A new prototype is **Internal**: only Studio can open it. A Studio person marks it **Client-facing** with the switch beside it on the hub's index (no command reads or sets it); a Client's index lists only client-facing prototypes. Say so when you hand a new one over. A switch flipped under `pnpm dev` writes this machine's store only; the deployed site keeps its own.
|
|
88
|
+
- Everything in `prototypes/<slug>/` (code, README, styles, fixtures, images) ships only to people who may see that prototype. The deployed site refuses its page and files to a Client while it is internal.
|
|
89
|
+
- Never reach into another prototype's files (an import, a CSS `@import` or `url()`, a `new URL`): the build refuses it, naming both. No web worker in a prototype either: the build refuses it (a worker in `kit/` that uses no prototype's files is fine). Run `pnpm build` before you share: it checks more than `pnpm dev` does. Never put shared code directly in `prototypes/` or in a folder there without a README: the build refuses it; shared code belongs in `kit/`. Write styles in plain CSS (or `.pcss`): Sass, Less and Stylus are refused in prototypes and in `kit/`, in `pnpm dev` and `pnpm build`, because their own imports resolve where no check sees them. The build also fails when a file outside a prototype's folder is one of that prototype's files whole (the same bytes, a `data:` URI of it, or its whole text as a string), however it got there; it does not look for part of a file, so shared lines and rules build. A `new URL` whose path is built at run time is not seen until its content lands outside the folder.
|
|
90
|
+
- A prototype's small images and SVGs are files of their own, never `data:` URIs, so the site can refuse them to a Client while the prototype is internal.
|
|
91
|
+
- `kit/` is shared with every signed-in person, clients included: nothing client-secret goes there, and nothing in it may point into a prototype's folder (the build refuses it). A link from one prototype's page to another's is fine.
|
|
92
|
+
- A dial is **Internal** too: a client's Controls panel has only the View tools until a dial is marked client-facing. Mark one in code with `client(...)` from `@kit/dials` only when the user asks for clients to have it; otherwise leave it, and Studio marks it with the eye beside its row in the Controls panel, which overrules the code on that site. Never mark fixtures, roles or scenarios: they are how the studio tests. An internal dial's name, range and default are still in the page's code a client's browser loads, so a dial's name never says what a client must not read. A client reads an internal dial's default, so the default is the value to present.
|
|
93
|
+
- Walkthrough text (`docs/sprints/<feature>/guide.md`) and feature names go to every signed-in person, clients included, whether or not the feature's prototypes are client-facing: a walkthrough must not name or describe internal work until the client may see it.
|
|
94
|
+
- `guide`, `api` and `assets` are the hub's paths, never a slug (`pnpm new` refuses them).
|
|
95
|
+
|
|
85
96
|
## A feature
|
|
86
97
|
|
|
87
98
|
One slug in two places: `docs/sprints/<feature>/` and the `feature:` line of every prototype that belongs to it. The hub serves `docs/sprints/<feature>/guide.md` at `/guide/<feature>/`; inside any prototype of the feature, **Open the walkthrough** is the last row of Controls. Nothing is wired by hand.
|
|
@@ -93,13 +104,13 @@ One slug in two places: `docs/sprints/<feature>/` and the `feature:` line of eve
|
|
|
93
104
|
| Import | What |
|
|
94
105
|
| --- | --- |
|
|
95
106
|
| `@kit/shell` | `BRAND`, `PRODUCT` (nav, workspace, user), `SITE` (nav, footer): the one place the chrome is written. |
|
|
96
|
-
| `@kit/AppShell`, `@kit/SiteShell` | The disposable shells. Mount the dialog, sheet and toast hosts and the View dials. `PageHead({ title, desc, back, actions })`. |
|
|
97
|
-
| `@kit/Space` | `<Space title lede width
|
|
98
|
-
| `@kit/Artboard` | `<Board title lede>` holding `<Artboard format name>`s: collateral at real pixel size, scaled to fit on screen, written to files by `pnpm export`. `FORMATS` lists the sizes. |
|
|
107
|
+
| `@kit/AppShell`, `@kit/SiteShell` | The disposable shells. Mount the dialog, sheet and toast hosts and the View dials (theme, reduce motion, speed). A prototype never mounts `ViewTools` itself. `PageHead({ title, desc, back, actions })`. |
|
|
108
|
+
| `@kit/Space` | `<Space title lede width tools?>`: the low-gravity canvas. `tools` narrows the View panel to what changes something here: `['theme']` when nothing moves, `['motion']` when there is one theme, `false` for neither. |
|
|
109
|
+
| `@kit/Artboard` | `<Board title lede>` holding `<Artboard format name>`s: collateral at real pixel size, scaled to fit on screen, written to files by `pnpm export`. `FORMATS` lists the sizes. A board has no View panel and is held to the light look it exports in: no motion, no theme styles, no `ViewTools`; a dark version is a `tone` dial. |
|
|
99
110
|
| `@kit/ui` | `Button`, `Chevron`, `Segmented`, `Badge`, `Checkbox`, `useMenu`, `Select`, `openDialog`, `confirmDialog`, `openSheet`, `toast()`, `notInPrototype(what)`. Card, table and empty-state classes in `ui.css`. |
|
|
100
111
|
| `@kit/fixtures` | `fixtureSets({ real, missing }, { max, text })` returns `{ real, longest, empty, max, missing }`; `SET_NAMES` for the dial. |
|
|
101
|
-
| `@kit/Variants` | `<Variants options={{ Quiet, Editorial }}>`: the picker. Keys 1-N, arrows, R; `?v=N`. |
|
|
102
|
-
| `@kit/dials` | `useDials(name, config, { hints })` for values JS reads; `<DialVars name config target?>` writes CSS variables without re-rendering. Every dial carries a hint. |
|
|
112
|
+
| `@kit/Variants` | `<Variants options={{ Quiet, Editorial }}>`: the picker. Keys 1-N, arrows, R; `?v=N`. A client gets only the variants Studio marks with the picker's eye, the first when none is marked, and no picker when there is one. |
|
|
113
|
+
| `@kit/dials` | `useDials(name, config, { hints })` for values JS reads; `<DialVars name config target?>` writes CSS variables without re-rendering. Every dial carries a hint. `client(dial)` around a dial, or a folder of them, marks it client-facing. |
|
|
103
114
|
| `@kit/Icon`, `@kit/icons` | `<Icon name size label?>`. Add a glyph in `kit/icons.ts`. |
|
|
104
115
|
| `@kit/prefs`, `@kit/hooks`, `@kit/format`, `@kit/motion` | Theme and motion preferences; `useHashRoute`, `useStoredState`; `fmtDate`, `plural`; `ease.*` and `spring.*`. |
|
|
105
116
|
| `@kit/tokens.css` | The design's tokens, light and `.dark-mode`. Loaded globally. |
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AppShell, PageHead } from '@kit/AppShell';
|
|
2
|
-
import { DialVars, useDials } from '@kit/dials';
|
|
2
|
+
import { client, DialVars, useDials } from '@kit/dials';
|
|
3
3
|
import { type FixtureSets, fixtureSets, SET_NAMES, type SetName } from '@kit/fixtures';
|
|
4
4
|
import { fmtDate, plural } from '@kit/format';
|
|
5
5
|
import { useHashRoute } from '@kit/hooks';
|
|
@@ -36,7 +36,8 @@ function ItemsPage() {
|
|
|
36
36
|
'Review',
|
|
37
37
|
{
|
|
38
38
|
fixtures: { type: 'select', options: [...SET_NAMES], default: 'real' },
|
|
39
|
-
|
|
39
|
+
// client(): a client gets this dial too. Every other dial is internal until Studio's eye marks it.
|
|
40
|
+
density: client({ type: 'select', options: ['comfortable', 'compact'], default: 'comfortable' }),
|
|
40
41
|
},
|
|
41
42
|
{
|
|
42
43
|
hints: {
|