@milesroxas/design-hub 0.14.0 → 0.15.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.
Files changed (44) hide show
  1. package/README.md +37 -32
  2. package/core/catalog.test.ts +28 -1
  3. package/core/catalog.ts +21 -4
  4. package/dist/core/catalog.d.ts +8 -1
  5. package/dist/core/catalog.js +12 -3
  6. package/dist/scripts/lib/catalog.d.ts +1 -1
  7. package/dist/scripts/lib/catalog.js +3 -3
  8. package/dist/scripts/new.d.ts +8 -3
  9. package/dist/scripts/new.js +15 -4
  10. package/dist/scripts/preflight.js +1 -1
  11. package/dist/scripts/share.js +3 -3
  12. package/dist/server/api.d.ts +11 -0
  13. package/dist/server/api.js +6 -0
  14. package/dist/server/dev-studio.d.ts +36 -0
  15. package/dist/server/dev-studio.js +181 -0
  16. package/dist/server/dev.d.ts +16 -1
  17. package/dist/server/dev.js +4 -4
  18. package/dist/vite/plugin.js +3 -0
  19. package/kit/ViewTools.tsx +9 -0
  20. package/kit/prefs.ts +3 -4
  21. package/package.json +1 -1
  22. package/shell/Command.tsx +142 -0
  23. package/shell/Index.tsx +902 -400
  24. package/shell/Milestone.tsx +302 -0
  25. package/shell/Sidebar.tsx +236 -0
  26. package/shell/index.css +224 -0
  27. package/shell/milestones.test.ts +157 -0
  28. package/shell/milestones.ts +144 -0
  29. package/shell/registry.ts +4 -3
  30. package/shell/shell.css +8 -175
  31. package/shell/sidebar.css +86 -0
  32. package/shell/studio/ClientHub.tsx +21 -10
  33. package/shell/studio/StudioHub.tsx +120 -45
  34. package/shell/studio/hub.css +20 -15
  35. package/shell/studio/page.tsx +28 -17
  36. package/shell/system.css +12 -0
  37. package/skills/miles-deploy/SKILL.md +1 -1
  38. package/skills/miles-new-feature/SKILL.md +2 -1
  39. package/skills/miles-prototype/SKILL.md +1 -1
  40. package/templates/app/README.md +1 -1
  41. package/templates/brand/README.md +1 -1
  42. package/templates/site/README.md +1 -1
  43. package/templates/space/README.md +1 -1
  44. package/templates/studio/package.json +1 -1
@@ -1,4 +1,4 @@
1
- /* The client hub and the studio hub: one column of project rows in the
1
+ /* The client hub and the studio hub: the sidebar docked left (../sidebar.css), then one column of project rows in the
2
2
  index's measure and rhythm (shell.css, The index), on the hub's neutral
3
3
  system look. The studio hub groups the rows under a head per client. A studio
4
4
  site has no tokens.css, so the few motion values the hub and kit/ui read
@@ -19,7 +19,7 @@
19
19
  body { background: var(--bg-primary); }
20
20
 
21
21
  .hub { width: min(744px, 100% - 8px); margin: 0 auto; padding: 96px 0 128px; display: flex; flex-direction: column; }
22
- .hub-head, .hub-empty, .hub-foot { padding-inline: 12px; }
22
+ .hub-head, .hub-empty { padding-inline: 12px; }
23
23
 
24
24
  .hub-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 40px; }
25
25
  .hub-head h1 { font-size: 18px; line-height: 28px; font-weight: 600; text-wrap: balance; }
@@ -42,10 +42,9 @@ body { background: var(--bg-primary); }
42
42
  .hub-empty h2 { font-size: 14px; line-height: 20px; font-weight: 600; }
43
43
  .hub-empty p { color: var(--text-tertiary); max-width: 52ch; text-wrap: pretty; }
44
44
  .hub-empty .btn { position: relative; margin-top: 12px; }
45
- /* The 38px button reaches 44px to the touch; nothing sits within 3px of it. */
46
- .hub-empty .btn::before { content: ''; position: absolute; inset: -3px 0; }
45
+ /* The 32px button reaches 44px to the touch; nothing sits within 6px of it. */
46
+ .hub-empty .btn::before { content: ''; position: absolute; inset: -6px 0; }
47
47
 
48
- .hub-foot { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border-secondary); color: var(--text-tertiary); }
49
48
 
50
49
  :root[data-motion="reduce"] .hub-row:not(.is-static):active { transform: none; }
51
50
  :root[data-motion="reduce"] .hub-row:hover .hub-arrow { translate: none; }
@@ -62,21 +61,19 @@ body { background: var(--bg-primary); }
62
61
  .studio-client-head .badge { flex-shrink: 0; }
63
62
  .studio-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
64
63
  .studio-note { font-size: 13px; line-height: 18px; color: var(--text-tertiary); }
65
- /* The studio's own people sit apart from the clients, under a rule. */
66
- .studio-own { padding-top: 24px; border-top: 1px solid var(--border-secondary); }
67
64
  .studio-open { margin: 0; flex-shrink: 0; }
68
65
  .studio-open .hub-row { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
69
66
  .studio-project { display: flex; flex-direction: column; min-width: 0; }
70
67
  .studio-none { color: var(--text-tertiary); white-space: nowrap; }
71
68
  .studio-client > .studio-none { padding-inline: 12px; white-space: normal; }
72
- /* Open hub and People are 38px buttons; each reaches 44px to the touch, as the empty state's does. */
69
+ /* Open hub and People are 32px buttons; each reaches 44px to the touch, as the empty state's does. */
73
70
  .studio-client-head .btn { position: relative; }
74
- .studio-client-head .btn::before { content: ''; position: absolute; inset: -3px 0; }
71
+ .studio-client-head .btn::before { content: ''; position: absolute; inset: -6px 0; }
75
72
  /* The project row is a button: its name is "Open <project>", and the base focus ring sits inside its corners. */
76
73
  .studio-open .hub-row:focus-visible { box-shadow: var(--focus-ring); }
77
74
  /* While the list loads: one client's head and two rows at their filled sizes. */
78
75
  .studio-skeleton-name { width: 160px; height: 42px; border-radius: var(--radius-sm); background: var(--bg-tertiary); }
79
- .studio-skeleton-open { width: 90px; height: 38px; border-radius: var(--radius-sm); background: var(--bg-tertiary); }
76
+ .studio-skeleton-open { width: 90px; height: 32px; border-radius: var(--radius-sm); background: var(--bg-tertiary); }
80
77
  .studio-skeleton-row { height: 62px; }
81
78
 
82
79
  /* A section's people: the review panel's People controls (review/People.tsx)
@@ -89,7 +86,7 @@ body { background: var(--bg-primary); }
89
86
  .studio-people .rv-disclosure { font-size: 13px; line-height: 18px; max-width: 60ch; }
90
87
  .studio-people .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
91
88
  .studio-people .field-label { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--text-secondary); }
92
- .studio-people .btn { position: relative; height: 40px; padding: 0 14px; }
89
+ .studio-people .btn { position: relative; height: 32px; padding: 0 12px; }
93
90
  /* Add person, a quiet row at the end of the list. Its fill runs the row's width and 10px past the text on both
94
91
  sides, so the icon stays on the names' left edge. */
95
92
  .studio-people .btn.rv-add-person { justify-content: flex-start; width: calc(100% + 20px); margin-inline: -10px; }
@@ -163,7 +160,7 @@ body { background: var(--bg-primary); }
163
160
  .studio-people .btn.rv-row-menu { grid-column: 3; grid-row: 1; width: 32px; height: 32px; margin: -6px -6px -6px 0; padding: 0; color: var(--text-tertiary); }
164
161
  .studio-people .rv-people .btn.rv-row-menu::before { inset: -6px; }
165
162
  /* A row with one action shows it by name, its text ending on the edge the menus end on. */
166
- .studio-people .btn.rv-row-act { grid-column: 3; grid-row: 1; margin: -8px -10px -8px 0; }
163
+ .studio-people .btn.rv-row-act { grid-column: 3; grid-row: 1; margin: -6px -10px -6px 0; }
167
164
  @media (max-width: 600px) {
168
165
  .studio-people .rv-people li { grid-template-columns: minmax(0, 1fr) auto; }
169
166
  .studio-people .rv-email { white-space: normal; overflow-wrap: anywhere; }
@@ -197,13 +194,21 @@ body { background: var(--bg-primary); }
197
194
  .studio-people .btn:focus-visible { box-shadow: var(--focus-ring), var(--shadow-xs); }
198
195
  /* 16px on a touch screen or a phone, as kit/base.css sets every input, so iOS does not zoom into a field. */
199
196
  @media (pointer: coarse), (max-width: 767px) { .studio-people .input { font-size: 16px; } }
200
- .studio-people .btn.rv-act { height: 36px; padding: 0 10px; color: var(--text-tertiary); font-weight: 500; }
197
+ .studio-people .btn.rv-act { height: 32px; padding: 0 10px; color: var(--text-tertiary); font-weight: 500; }
201
198
  .studio-people .btn.rv-act-danger { color: var(--text-error-primary); }
202
199
  @media (hover: hover) and (pointer: fine) {
203
200
  .studio-people .btn.rv-act:hover { color: var(--text-primary); }
204
201
  .studio-people .btn.rv-act-danger:hover { color: var(--text-error-primary_hover); }
205
202
  }
206
- .studio-people .btn::before { content: ''; position: absolute; inset: -4px 0; }
207
- .studio-people .btn:not(.rv-act)::before { inset: -2px 0; }
203
+ /* Every 32px button reaches 44px to the touch. */
204
+ .studio-people .btn::before { content: ''; position: absolute; inset: -6px 0; }
208
205
  .studio-people-error { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 12px; border-radius: var(--radius-md); background: var(--bg-error-primary); color: var(--text-error-primary); }
209
206
  .studio-people > .hub-empty { padding-inline: 0; }
207
+
208
+ /* The sidebar (../sidebar.css) docks beside the page; a search that leaves nothing says so in the list's place. */
209
+ .hub-none { min-height: 56px; display: flex; align-items: center; padding-inline: 12px; color: var(--text-tertiary); }
210
+ /* A jump lands the client's heading at the top with room above it; the heading takes focus but draws no ring. */
211
+ .studio-client { scroll-margin-top: 32px; }
212
+ .studio-client-name h2:focus { outline: none; box-shadow: none; }
213
+ /* On its own view the studio's people need no frame: the page's head names them. */
214
+ .studio-people.is-page { margin-inline: 0; padding: 0 12px; border: 0; border-radius: 0; }
@@ -1,6 +1,7 @@
1
1
  // What the client hub and the studio hub share: who is signed in with the
2
- // one list the page shows, loaded together, and the page around it (its
3
- // head, its body, and who is signed in at the foot).
2
+ // one list the page shows, loaded together, and the page around it (the
3
+ // sidebar docked to its left, who is signed in at its foot, the page's head
4
+ // and its body).
4
5
  import { type ReactNode, useEffect, useState } from 'react';
5
6
  import { call, type Me } from '../review/client';
6
7
 
@@ -28,30 +29,40 @@ export function useHubData<T extends object>(op: string): HubLoaded<T> {
28
29
  return loaded;
29
30
  }
30
31
 
31
- /** The page: its title and voice, its body, and who is signed in once that is known. */
32
+ /** The page: the sidebar (who is signed in sits at its foot), the page's title and voice, and its body. */
32
33
  export function HubPage({
34
+ sidebar,
33
35
  title,
34
36
  voice,
35
- me,
36
37
  children,
37
38
  }: {
39
+ sidebar: ReactNode;
38
40
  title: string;
39
41
  voice: string;
40
- me: Me | null;
41
42
  children: ReactNode;
42
43
  }) {
43
44
  return (
44
- <main className="hub">
45
- <header className="hub-head">
46
- <h1>{title}</h1>
47
- <p className="hub-voice">{voice}</p>
48
- </header>
49
- {children}
50
- {me ? (
51
- <footer className="hub-foot">
52
- Signed in as {me.name}, {me.team}
53
- </footer>
54
- ) : null}
55
- </main>
45
+ <div className="index-frame">
46
+ {sidebar}
47
+ <main className="hub">
48
+ <header className="hub-head">
49
+ <h1>{title}</h1>
50
+ <p className="hub-voice">{voice}</p>
51
+ </header>
52
+ {children}
53
+ </main>
54
+ </div>
55
+ );
56
+ }
57
+
58
+ /** Whether any of the texts holds the query, already trimmed and lowercased. */
59
+ export const hit = (q: string, ...texts: string[]) => texts.some((t) => t.toLowerCase().includes(q));
60
+
61
+ /** A search that leaves nothing, in the index's words. */
62
+ export function NoMatch({ query }: { query: string }) {
63
+ return (
64
+ <p className="hub-none" role="status">
65
+ Nothing here matches “{query.trim()}”.
66
+ </p>
56
67
  );
57
68
  }
package/shell/system.css CHANGED
@@ -239,5 +239,17 @@
239
239
  --focus-ring-error: 0 0 0 2px oklch(0.145 0 0), 0 0 0 4px oklch(0.704 0.191 22.216);
240
240
  }
241
241
 
242
+ /* Buttons on hub pages are compact, the review panel's size: 32px, and 36px
243
+ for the one primary act on a page. kit/ui's 38 and 42px suit a product
244
+ screen, but here they shouted over the content they act on. Labels drop
245
+ to 500 so a row of them stays quiet. Where a button stands alone, its hub
246
+ stylesheet grows its hit area to 44px for touch. */
247
+ .sys .btn { font-weight: 500; }
248
+ .sys .btn-md { height: 36px; padding: 0 14px; }
249
+ .sys .btn-sm { height: 32px; padding: 0 12px; }
250
+ .sys .btn.btn-icon { width: 32px; height: 32px; padding: 0; }
251
+ .sys .btn.btn-icon.btn-md { width: 36px; height: 36px; }
252
+ .sys .btn-sm:has(> .icon:first-child, > .btn-content > .icon:first-child):not(.btn-icon) { padding-left: 10px; }
253
+
242
254
  /* Code in hub pages takes the mono face. */
243
255
  .sys :is(code, kbd, pre, samp) { font-family: var(--sys-font-mono); }
@@ -136,7 +136,7 @@ pnpm people --studio <studio> # the studio's people, wit
136
136
  pnpm people link <id> --studio <studio> # a new link for one of them, the owner too
137
137
  ```
138
138
 
139
- `owner` in the studio folder's `studio.json` is the owner's id. A Studio person's link is on `studio.<apex>` once it answers; before then `--studio` refuses `add`, `link` and `sign-out`, changes nothing and says why (`studio_host_waiting`). In a linked project, `--kind studio`, or `add --studio` for the project's own studio, prints a `notice` that they see every client. On `studio.<apex>`, **People** under **Studio people** adds Studio people and gives another Studio person a new link; a person's own row there has no actions, so a user's own new link comes from `pnpm people link <their id> --studio <studio>` or from someone else in the studio. Use the command when the owner lost their link or wants a second device.
139
+ `owner` in the studio folder's `studio.json` is the owner's id. A Studio person's link is on `studio.<apex>` once it answers; before then `--studio` refuses `add`, `link` and `sign-out`, changes nothing and says why (`studio_host_waiting`). In a linked project, `--kind studio`, or `add --studio` for the project's own studio, prints a `notice` that they see every client. On `studio.<apex>`, **Studio people** in the sidebar adds Studio people and gives another Studio person a new link; a person's own row there has no actions, so a user's own new link comes from `pnpm people link <their id> --studio <studio>` or from someone else in the studio. Use the command when the owner lost their link or wants a second device.
140
140
 
141
141
  - **A link signs in one device, then stops working.** Opening it shows who it is for and a Continue button; Continue uses it up. Why: a mail or chat preview opens links too, and must not use one up. An unused link lasts 14 days.
142
142
  - **Another device, or a link that stopped working:** `pnpm people link <id>` gives one more link. Their other devices stay signed in.
@@ -13,6 +13,7 @@ One feature is one slug used in two places: `docs/sprints/<slug>/` and the `feat
13
13
  2. **Which kind?** Walk this; the first match wins.
14
14
  - The feature's main prototype, the one its walkthrough opens → `--sprint`. One per feature; `pnpm new` refuses a second.
15
15
  - Another full take on the same flow, to compare against the primary → `--alternate`. Refused until the primary exists.
16
+ - A small app that makes assets for several features (chart skeletons, an icon set) → `--tool`. No feature; it starts In progress and lists under Tools.
16
17
  - A side question about one part (a menu's motion, a loading state) → exploration, the default.
17
18
  3. **Which track?** Read `.design-hub/project.json` (or `pnpm tracks`). A project with one track uses it. A project with several needs `--track product|website|brand`: product is app screens, website is CMS pages, brand is collateral (social posts, slides, print). `pnpm new` refuses a track the project does not have, because the track decides the shell, the sample to read, and how `miles-port` hands it off.
18
19
  4. **Where does it stand?** `--app` when the question is about the feature in context: the track's shell, `AppShell` for product and `SiteShell` for website, as `DESIGN.md`, Shell, describes. Nothing when it is one thing alone in the Space. Brand is always a `Board` of artboards, whatever the flags; `miles-brand` takes over from step 6.
@@ -38,4 +39,4 @@ One feature is one slug used in two places: `docs/sprints/<slug>/` and the `feat
38
39
 
39
40
  ## When done means decided
40
41
 
41
- When the user picks: the Decision section gets what was chosen, its values, what was rejected and why; then the folder is deleted, or `status: archived` when the user wants it kept. A rule the decision made lands in `DESIGN.md` as a named rule the same day.
42
+ When the user picks: the Decision section gets what was chosen, its values, what was rejected and why; then the folder is deleted, or `status: archived` when the user wants it kept. A take the client saw and did not pick gets `status: presented` and `presented: <date>`: it stays in its feature's group, so the studio can show what they weighed. A rule the decision made lands in `DESIGN.md` as a named rule the same day.
@@ -56,7 +56,7 @@ Anything a control would do that the prototype does not build says so: `notInPro
56
56
 
57
57
  ## Who sees it
58
58
 
59
- A new prototype is **Internal**: only Studio can open it, until a Studio person marks it **Client-facing** with the switch beside it on the hub's index (no command reads or sets it). Never tell the user a new prototype is ready for the client before that. 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. Why: an internal prototype stays inside the studio only because nothing of it leaves its folder.
59
+ A new prototype is **Internal**: only Studio can open it, until a Studio person marks it **Client-facing** with the switch beside it in its milestone's home on the hub's index, or on its row there when it has no feature (no command reads or sets it). Never tell the user a new prototype is ready for the client before that. 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. Why: an internal prototype stays inside the studio only because nothing of it leaves its folder.
60
60
 
61
61
  - Never reach into another prototype's folder: an import, a CSS `@import` or `url()`, a `new URL(…, import.meta.url)`. The build refuses each, naming both files: copy the file in, or promote it to `kit/`. A link to another prototype's page is fine; reading its files is not. And nothing in `kit/` may point into a prototype's folder: the build refuses that too.
62
62
  - No web worker in a prototype (`new Worker`, `?worker`, `?worker&inline`): Vite builds it outside the prototype's folder, so the build refuses it. Run the work on the main thread, or build the worker from `kit/` files that use no prototype's.
@@ -3,7 +3,7 @@ title: {{title}}
3
3
  summary: One line on what this explores.
4
4
  context: app
5
5
  track: {{track}}
6
- status: exploring
6
+ status: {{status}}
7
7
  kind: {{kind}}
8
8
  feature: {{feature}}
9
9
  created: {{created}}
@@ -3,7 +3,7 @@ title: {{title}}
3
3
  summary: One line on what this piece is for.
4
4
  context: board
5
5
  track: {{track}}
6
- status: exploring
6
+ status: {{status}}
7
7
  kind: {{kind}}
8
8
  feature: {{feature}}
9
9
  created: {{created}}
@@ -3,7 +3,7 @@ title: {{title}}
3
3
  summary: One line on what this explores.
4
4
  context: app
5
5
  track: {{track}}
6
- status: exploring
6
+ status: {{status}}
7
7
  kind: {{kind}}
8
8
  feature: {{feature}}
9
9
  created: {{created}}
@@ -3,7 +3,7 @@ title: {{title}}
3
3
  summary: One line on what this explores.
4
4
  context: space
5
5
  track: {{track}}
6
- status: exploring
6
+ status: {{status}}
7
7
  kind: {{kind}}
8
8
  feature: {{feature}}
9
9
  created: {{created}}
@@ -9,7 +9,7 @@
9
9
  "build": "node build.mjs"
10
10
  },
11
11
  "dependencies": {
12
- "@milesroxas/design-hub": "0.14.0",
12
+ "@milesroxas/design-hub": "0.15.0",
13
13
  "react": "^19.3.1",
14
14
  "react-dom": "^19.3.1"
15
15
  }