@milesroxas/design-hub 0.13.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 (101) hide show
  1. package/README.md +38 -33
  2. package/core/catalog.test.ts +28 -1
  3. package/core/catalog.ts +21 -4
  4. package/core/prototype.test.ts +12 -1
  5. package/core/prototype.ts +21 -2
  6. package/core/review/model.ts +71 -6
  7. package/core/review/service.test.ts +536 -1
  8. package/core/review/service.ts +452 -25
  9. package/core/review/store.ts +45 -4
  10. package/dist/core/catalog.d.ts +8 -1
  11. package/dist/core/catalog.js +12 -3
  12. package/dist/core/prototype.d.ts +20 -2
  13. package/dist/core/prototype.js +17 -2
  14. package/dist/core/review/model.d.ts +42 -3
  15. package/dist/core/review/model.js +52 -3
  16. package/dist/core/review/service.d.ts +81 -7
  17. package/dist/core/review/service.js +407 -23
  18. package/dist/core/review/store.d.ts +29 -2
  19. package/dist/core/review/store.js +4 -0
  20. package/dist/scripts/client.d.ts +1 -1
  21. package/dist/scripts/client.js +1 -1
  22. package/dist/scripts/lib/catalog.d.ts +1 -1
  23. package/dist/scripts/lib/catalog.js +3 -3
  24. package/dist/scripts/lib/dns.d.ts +16 -2
  25. package/dist/scripts/lib/dns.js +66 -3
  26. package/dist/scripts/lib/fake-host.d.ts +16 -1
  27. package/dist/scripts/lib/fake-host.js +36 -1
  28. package/dist/scripts/lib/host.d.ts +2 -0
  29. package/dist/scripts/lib/resend.d.ts +36 -0
  30. package/dist/scripts/lib/resend.js +66 -0
  31. package/dist/scripts/lib/studio-deps.d.ts +7 -0
  32. package/dist/scripts/lib/studio-deps.js +6 -1
  33. package/dist/scripts/lib/studios.d.ts +2 -2
  34. package/dist/scripts/lib/studios.js +5 -5
  35. package/dist/scripts/lib/vercel-host.js +6 -0
  36. package/dist/scripts/new.d.ts +8 -3
  37. package/dist/scripts/new.js +15 -4
  38. package/dist/scripts/people.d.ts +16 -4
  39. package/dist/scripts/people.js +67 -17
  40. package/dist/scripts/preflight.js +1 -1
  41. package/dist/scripts/share.js +3 -3
  42. package/dist/scripts/studio.d.ts +19 -3
  43. package/dist/scripts/studio.js +327 -6
  44. package/dist/server/api.d.ts +25 -2
  45. package/dist/server/api.js +77 -17
  46. package/dist/server/dev-studio.d.ts +36 -0
  47. package/dist/server/dev-studio.js +181 -0
  48. package/dist/server/dev.d.ts +16 -1
  49. package/dist/server/dev.js +23 -3
  50. package/dist/server/gate.d.ts +26 -3
  51. package/dist/server/gate.js +323 -52
  52. package/dist/server/mailer.d.ts +60 -0
  53. package/dist/server/mailer.js +104 -0
  54. package/dist/server/mailers/fake.d.ts +8 -0
  55. package/dist/server/mailers/fake.js +16 -0
  56. package/dist/server/mailers/resend.d.ts +21 -0
  57. package/dist/server/mailers/resend.js +49 -0
  58. package/dist/server/session.js +4 -1
  59. package/dist/vercel/proxy.js +10 -3
  60. package/dist/vite/plugin.js +6 -1
  61. package/kit/ViewTools.tsx +9 -0
  62. package/kit/prefs.ts +3 -4
  63. package/kit/ui/Menu.tsx +29 -18
  64. package/kit/ui/layer.ts +41 -0
  65. package/package.json +1 -1
  66. package/shell/Command.tsx +142 -0
  67. package/shell/Index.tsx +902 -400
  68. package/shell/Milestone.tsx +302 -0
  69. package/shell/Sidebar.tsx +236 -0
  70. package/shell/index.css +224 -0
  71. package/shell/milestones.test.ts +157 -0
  72. package/shell/milestones.ts +144 -0
  73. package/shell/registry.ts +4 -3
  74. package/shell/review/Bar.tsx +1 -0
  75. package/shell/review/Card.tsx +17 -7
  76. package/shell/review/People.tsx +908 -134
  77. package/shell/review/Review.tsx +2 -2
  78. package/shell/review/anchor.ts +6 -1
  79. package/shell/review/client.ts +41 -7
  80. package/shell/review/menu-place.test.ts +41 -0
  81. package/shell/review/place.test.ts +26 -1
  82. package/shell/review/place.ts +17 -0
  83. package/shell/review/review.css +97 -11
  84. package/shell/review/view.test.ts +115 -1
  85. package/shell/review/view.ts +92 -2
  86. package/shell/shell.css +8 -175
  87. package/shell/sidebar.css +86 -0
  88. package/shell/studio/ClientHub.tsx +21 -10
  89. package/shell/studio/StudioHub.tsx +121 -45
  90. package/shell/studio/hub.css +118 -27
  91. package/shell/studio/page.tsx +28 -17
  92. package/shell/system.css +12 -0
  93. package/skills/miles-deploy/SKILL.md +25 -4
  94. package/skills/miles-new-feature/SKILL.md +2 -1
  95. package/skills/miles-prototype/SKILL.md +1 -1
  96. package/templates/app/README.md +1 -1
  97. package/templates/brand/README.md +1 -1
  98. package/templates/site/README.md +1 -1
  99. package/templates/space/README.md +1 -1
  100. package/templates/studio/.env.example +6 -0
  101. package/templates/studio/package.json +1 -1
package/shell/shell.css CHANGED
@@ -1,135 +1,12 @@
1
- /* The index: one group per feature (its primary prototype, its alternates on
2
- a rail, its explorations folded into cards), then prototypes with
3
- no feature, then the archive. Rows draw no dividers; their hover surface
4
- bleeds 12px into the gutter. The list ends in a foot (the Ledger Foot Rule).
5
- The rules are in README.md, The index. */
6
-
7
- /* One grid for the whole page, handed down by subgrid, so the context,
8
- status and date columns line up across every group without fixed widths.
9
- The page is 720px of text plus the 12px bleed each side; everything that
10
- is not a row carries that 12px itself. */
11
- .index { width: min(744px, 100% - 8px); margin: 0 auto; padding: 96px 0 128px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; column-gap: 20px; align-content: start; }
12
- .index > * { grid-column: 1 / -1; }
13
- .index-head, .index-tracks, .index-filter, .index-section, .index-subsection, .index-empty, .index-none, .index-foot { padding-inline: 12px; }
14
-
15
- .index-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 40px; }
16
- .index-head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 32px; }
17
- .index-head h1 { font-size: 18px; line-height: 28px; font-weight: 600; text-wrap: balance; }
18
- .index-voice { font: 400 18px/28px var(--font-voice); letter-spacing: -0.01em; color: var(--text-secondary); max-width: 44ch; text-wrap: pretty; }
19
- .index code { font: 13px/20px var(--sys-font-mono); color: var(--text-secondary); }
20
-
21
- .index-filter { margin-bottom: 24px; }
22
- .index-tracks { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 16px; border: 0; min-width: 0; }
23
- .index-tracks button { height: 32px; padding: 0 12px; border: 1px solid var(--border-secondary); border-radius: var(--radius-md); background: var(--bg-primary); color: var(--text-secondary); font: inherit; font-weight: 500; cursor: pointer; transition: background-color var(--dur-hover) var(--ease-hover), color var(--dur-hover) var(--ease-hover); }
24
- .index-tracks button[aria-pressed="true"] { background: var(--bg-active); border-color: var(--border-primary); color: var(--text-primary); }
25
- @media (hover: hover) { .index-tracks button:hover { color: var(--text-primary); } }
26
- .index-filter input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border-primary); border-radius: var(--radius-md); background: var(--bg-primary); box-shadow: var(--shadow-xs); font-size: 16px; transition: border-color var(--dur-hover) var(--ease-hover); }
27
- .index-filter input::placeholder { color: var(--text-placeholder); }
28
- .index-filter input:focus-visible { border-color: var(--border-brand); }
29
-
30
- .index-group { display: grid; grid-template-columns: subgrid; row-gap: 4px; }
31
- .index-group + .index-group { margin-top: 40px; }
32
- .index-section { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: 16px; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text-tertiary); }
33
- /* A feature's walkthrough sits at the end of its heading line, in the same tier. */
34
- .index-guide { display: inline-flex; align-items: center; gap: 2px; color: var(--text-secondary); text-decoration: none; border-radius: var(--radius-xs); transition: color var(--dur-hover) var(--ease-hover); }
35
- .index-guide:hover { color: var(--text-primary); }
36
- /* Alternates are other takes on the primary: indented 20px under it and
37
- joined by a 1px rail on the primary's text edge, so they read as children
38
- of that one row. Subgrid carries the padding to the first column only, so
39
- the meta columns still line up with every other row. */
40
- .index-alternates { position: relative; grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; padding-left: 20px; }
41
- .index-alternates::before { content: ""; position: absolute; left: 12px; top: 2px; bottom: 12px; width: 1px; background: var(--border-secondary); }
42
- .index-alternates > .index-list { row-gap: 0; }
43
- .index-alternates-label { grid-column: 1 / -1; padding: 4px 12px 0; font-size: 12px; line-height: 18px; font-weight: 500; color: var(--text-quaternary); }
44
-
45
- /* A feature's explorations sit under the sprint, folded away by default
46
- behind a caption one tier below the heading; the page remembers the fold. */
47
- /* Rhythm inside a group: each block's text sits 20px under the text above it
48
- (the primary under the heading, each caption under the last row's summary),
49
- and a caption sits 8px over what it labels, so it belongs to what follows.
50
- Groups stay 40px apart. */
51
- .index-subsection { grid-column: 1 / -1; margin-top: 4px; margin-bottom: 4px; font-size: 12px; line-height: 18px; font-weight: 500; }
52
- .index-fold-toggle { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 0; border: 0; background: none; font: inherit; color: var(--text-quaternary); cursor: pointer; border-radius: var(--radius-xs); transition: color var(--dur-hover) var(--ease-hover); }
53
- .index-fold-count { color: var(--text-quaternary); font-weight: 400; }
54
- .index-fold-toggle svg { transition: transform var(--dur-dialog) var(--ease-out); }
55
- .index-fold-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
56
-
57
- /* The fold opens by growing its one grid row from 0fr to 1fr while the cards
58
- fade in, and closes faster than it opens. The cards clip only a few pixels
59
- past their edge, so the hover shadow survives and a closed fold shows nothing. */
60
- .index-fold { grid-column: 1 / -1; display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows var(--dur-dialog-out) var(--ease-out), opacity var(--dur-dialog-out) var(--ease-out); }
61
- .index-fold[data-open] { grid-template-rows: 1fr; opacity: 1; transition-duration: var(--dur-dialog); }
62
- .index-fold[data-instant] { transition: none; }
63
-
64
- /* Cards, not rows: the explorations are side questions, met as a set. The
65
- grid's outer edges sit on the rows' hover bleed, so card text keeps the
66
- page's text edge. The edge is an inset ring (a border would sit pasted on
67
- the page, an outer ring would be clipped by the fold), one shadow layer for
68
- lift in light; dark has no shadows, so the ring carries it alone. */
69
- /* Light rests on a ring and two soft layers and lifts on hover by deepening
70
- them, the surface staying white so the card rises rather than sinks. Dark
71
- has no shadows, so the ring brightens and the surface steps up instead. */
72
- .index {
73
- --index-card-edge: inset 0 0 0 1px oklch(0 0 0 / 0.08), 0 1px 2px oklch(0 0 0 / 0.04), 0 2px 4px -2px oklch(0 0 0 / 0.04);
74
- --index-card-edge-hover: inset 0 0 0 1px oklch(0 0 0 / 0.12), 0 1px 3px oklch(0 0 0 / 0.06), 0 6px 12px -6px oklch(0 0 0 / 0.12);
75
- --index-card-bg-hover: var(--bg-primary);
76
- }
77
- .dark-mode .index { --index-card-edge: inset 0 0 0 1px oklch(1 0 0 / 0.09); --index-card-edge-hover: inset 0 0 0 1px oklch(1 0 0 / 0.16); --index-card-bg-hover: var(--bg-primary_hover); }
78
- .index-cards { min-height: 0; overflow: clip; overflow-clip-margin: 12px; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 8px; }
79
- .index-cards > li { display: flex; }
80
- .index-card { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: var(--radius-lg); background: var(--bg-primary); box-shadow: var(--index-card-edge); text-decoration: none; transition: background-color var(--dur-hover) var(--ease-hover), box-shadow var(--dur-hover) var(--ease-hover), transform var(--dur-press-out) var(--ease-press), opacity var(--dur-dialog-out) var(--ease-in); }
81
- /* The base focus ring is a box-shadow, so the card's edge would erase it; stack both. */
82
- .index-card:focus-visible { box-shadow: var(--focus-ring), var(--index-card-edge); }
83
- .index-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
84
- .index-card-head svg { flex-shrink: 0; margin-top: 2px; color: var(--fg-quaternary); transition: color var(--dur-hover) var(--ease-hover), transform var(--dur-hover) var(--ease-out); }
85
- /* The summary steps down to caption size so the title leads and three cards
86
- scan as three titles; Ink Tertiary keeps it a rung above the meta. */
87
- .index-card .index-summary { font-size: 12px; line-height: 18px; }
88
- .index-card-meta { margin-top: auto; padding-top: 12px; display: flex; align-items: center; gap: 12px; color: var(--text-quaternary); font-size: 12px; line-height: 18px; white-space: nowrap; }
89
- .index-card-meta > :last-child { margin-left: auto; }
90
-
91
- .index-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; }
92
- .index-list > li { display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; }
93
- .index-row { display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; row-gap: 2px; padding: 12px; min-height: 56px; border-radius: var(--radius-md); text-decoration: none; transition: background-color var(--dur-hover) var(--ease-hover), transform var(--dur-press-out) var(--ease-press), opacity var(--dur-dialog-out) var(--ease-in); }
94
- .index-title { grid-column: 1; font-weight: 600; color: var(--text-primary); }
95
- .index-summary { grid-column: 1; color: var(--text-tertiary); text-wrap: pretty; transition: color var(--dur-hover) var(--ease-hover); }
96
- .index-meta { display: grid; grid-template-columns: subgrid; grid-column: 2 / 5; grid-row: 1 / span 2; align-self: center; color: var(--text-quaternary); font-size: 12px; line-height: 18px; white-space: nowrap; }
97
- .index-meta > :last-child { justify-self: end; }
98
-
99
- /* The sprint is the one prototype opened every day: its title steps up one
100
- size, nothing else changes, so the row is heavier without a new shape. */
101
- .index-row[data-kind="sprint"] .index-title { font-size: 16px; line-height: 24px; }
102
-
103
- /* Status wears a dot so the column scans by colour before it is read:
104
- Ink for a question still open, Success for one answered, quiet for the
105
- archive. The word stays, so colour is never the only signal. */
106
- .index-status { display: inline-flex; align-items: center; gap: 6px; text-transform: capitalize; }
107
- .index-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--fg-quinary); }
108
- .index-status[data-status="exploring"]::before { background: var(--fg-brand-primary); }
109
- .index-status[data-status="decided"]::before { background: var(--fg-success-primary); }
110
-
111
- .index-none { min-height: 56px; display: flex; align-items: center; color: var(--text-tertiary); }
112
- .index-empty { display: flex; flex-direction: column; gap: 4px; min-height: 56px; }
113
- .index-empty h2 { font-size: 14px; font-weight: 600; }
114
- .index-empty p { color: var(--text-tertiary); max-width: 52ch; text-wrap: pretty; }
115
- .index-signed-out { align-items: flex-start; }
116
- .index-signed-out .btn { position: relative; margin-top: 12px; }
117
- /* The 38px button reaches 44px to the touch, as on the client's hub; nothing sits within 3px of it. */
118
- .index-signed-out .btn::before { content: ''; position: absolute; inset: -3px 0; }
119
-
120
- .index-foot { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border-secondary); color: var(--text-primary); }
121
-
122
- /* Studio, outside Client view: each prototype's audience in a fifth column,
123
- beside its row and never inside the link. Internal wears the internal
124
- comments' amber; Client-facing stays quiet. The switch is the plain kind:
125
- a 28px track, its hit area grown to 40px. */
126
- .index.has-audience { grid-template-columns: minmax(0, 1fr) auto auto auto auto; }
127
- .index.has-audience .index-row { grid-column: 1 / 5; }
128
- .index-list > li > .index-audience { grid-column: 5; align-self: center; padding-right: 12px; }
129
- .index-cards > li { flex-direction: column; gap: 6px; }
130
- .index-cards > li > .index-audience { padding: 0 12px 4px; }
1
+ /* What the hub's pages share beside the sidebar (sidebar.css): Studio's
2
+ audience switch, Client view's note, and the notice a page shows when it
3
+ cannot load. The index's own layout is index.css. */
4
+
5
+ /* Studio, outside Client view: a prototype's audience at the end of its row
6
+ and never inside the link. Internal wears the internal comments' amber;
7
+ Client-facing stays quiet. The switch is the plain kind: a 28px track, its
8
+ hit area grown to 40px. */
131
9
  .index-audience { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-size: 12px; line-height: 18px; color: var(--text-quaternary); white-space: nowrap; }
132
- .index-cards .index-audience { justify-content: space-between; }
133
10
  .index-audience-word[data-audience="internal"] { padding: 0 6px; border-radius: var(--radius-xs); background: var(--sys-internal); color: var(--sys-on-internal); font-weight: 500; }
134
11
  .index-switch { position: relative; flex: none; width: 28px; height: 16px; padding: 0; border: 0; border-radius: var(--radius-full); background: var(--border-primary); cursor: pointer; transition: background-color var(--dur-hover) var(--ease-hover); }
135
12
  .index-switch::before { content: ""; position: absolute; inset: -12px -6px; }
@@ -141,7 +18,6 @@
141
18
 
142
19
  /* Studio's Client view, entered from the head and left from this note: the
143
20
  comment layer's note (shell/review, .rv-viewing), in its words and look. */
144
- .index-client-view { flex: none; }
145
21
  .index-viewing {
146
22
  --button-tertiary-fg: var(--harness-fg-muted);
147
23
  --button-tertiary-fg_hover: oklch(1 0 0);
@@ -165,53 +41,10 @@ body:has(.rv-viewing) .index-viewing[data-at="top"] { display: none; }
165
41
  .index-viewing .icon { flex: none; color: var(--harness-fg-muted); }
166
42
  .index-viewing .btn.index-viewing-act { height: 28px; padding: 0 8px; }
167
43
 
168
- @media (hover: hover) and (pointer: fine) {
169
- .index-row:hover { background: var(--bg-primary_hover); }
170
- .index-row:hover .index-summary { color: var(--text-secondary); }
171
- .index-card:hover { background: var(--index-card-bg-hover); box-shadow: var(--index-card-edge-hover); }
172
- .index-card:hover:focus-visible { box-shadow: var(--focus-ring), var(--index-card-edge-hover); }
173
- .index-card:hover .index-summary { color: var(--text-secondary); }
174
- .index-card:hover .index-card-head svg { color: var(--fg-secondary); transform: translateX(2px); }
175
- .index-fold-toggle:hover { color: var(--text-secondary); }
176
- }
177
- .index-row:active { transform: scale(0.97); transition-duration: var(--dur-hover), var(--dur-press-in); }
178
- .index-card:active { transform: scale(0.97); transition-duration: var(--dur-hover), var(--dur-hover), var(--dur-press-in); }
179
-
180
- /* Arrival, one shot: the head fades, then each heading and row rises 4px
181
- in order, 30ms apart, then the foot. Seen many times a day, so it stays
182
- under 300ms per element and ends inside half a second. Keyframes fill
183
- backwards only, so once a row has arrived its opacity is free to transition. */
184
- .index-head { animation: index-fade 200ms var(--ease-out) backwards; }
185
- .index-rise { animation: index-rise 220ms var(--ease-out) calc(40ms + var(--i, 0) * 30ms) backwards; }
186
- @keyframes index-fade { from { opacity: 0; } }
187
- @keyframes index-rise { from { opacity: 0; translate: 0 4px; } }
188
-
189
- /* Departure, pointer only: the moment a row is clicked the rest of the page
190
- accelerates away (the Layer Exit curve) while the browser fetches the
191
- prototype, and the chosen row holds, so the eye keeps what it picked.
192
- The browser paints this page until the next one is ready, so the fade
193
- fills a wait that was blank. */
194
- .index-head, .index-tracks, .index-filter, .index-section, .index-subsection, .index-alternates-label, .index-foot, .index-audience { transition: opacity var(--dur-dialog-out) var(--ease-in); }
195
- .index.is-leaving .index-alternates::before { opacity: 0; transition: opacity var(--dur-dialog-out) var(--ease-in); }
196
- .index.is-leaving :is(.index-head, .index-tracks, .index-filter, .index-section, .index-subsection, .index-alternates-label, .index-foot, .index-row:not([data-chosen]), .index-card:not([data-chosen]), .index-audience) { opacity: 0; }
197
- .index.is-leaving :is(.index-row, .index-card) { pointer-events: none; }
198
-
199
- :root[data-motion="reduce"] .index-rise { animation-name: index-fade; animation-duration: 120ms; animation-timing-function: linear; }
200
- :root[data-motion="reduce"] :is(.index-row, .index-card):active { transform: none; }
201
- :root[data-motion="reduce"] .index-fold { transition-property: opacity; }
202
- :root[data-motion="reduce"] .index-fold-toggle svg { transition: none; }
203
- :root[data-motion="reduce"] .index-card:hover .index-card-head svg { transform: none; }
204
44
  :root[data-motion="reduce"] .index-switch-thumb { transition: none; }
205
45
  :root[data-motion="reduce"] .index-viewing { transition-property: opacity; }
206
46
  @starting-style { :root[data-motion="reduce"] .index-viewing { translate: -50% 0; } }
207
47
 
208
- @media (max-width: 560px) {
209
- .index, .index-group, .index-alternates, .index-list, .index-list > li, .index-row { display: flex; flex-direction: column; }
210
- .index-row { gap: 2px; }
211
- .index-meta { display: flex; gap: 12px; margin-top: 4px; }
212
- .index-list > li > .index-audience { justify-content: flex-start; padding: 0 12px 8px; }
213
- }
214
-
215
48
  .shell-notice { width: min(720px, 100% - 32px); margin: 0 auto; padding: 96px 0; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
216
49
  .shell-notice h1 { font-size: 18px; line-height: 28px; font-weight: 600; }
217
50
  .shell-notice p { color: var(--text-tertiary); }
@@ -0,0 +1,86 @@
1
+ /* The sidebar every hub page docks to its left edge (Sidebar.tsx): the
2
+ prototype index, the studio hub and a client's hub. Its surface and
3
+ hairline, Search, the page's views, then each view's jumps. Docked and
4
+ framed, it reads as navigation rather than a stray widget. The page's
5
+ main column stays centered in the space beside it. Under 1024px the
6
+ sidebar becomes a bar across the top and the jumps leave, since the list
7
+ is short enough to scroll. The classes keep the index's names: the index
8
+ was its first page. */
9
+ .index-frame { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100dvh; }
10
+ .index-frame > main { width: min(744px, 100% - 48px); }
11
+ .index-rail { position: sticky; top: 0; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: calc(20px + env(safe-area-inset-top, 0px)) 12px 24px calc(12px + env(safe-area-inset-left, 0px)); background: var(--bg-secondary_subtle); border-right: 1px solid var(--border-secondary); transition: opacity var(--dur-dialog-out) var(--ease-in); }
12
+ .index-rail-nav { display: flex; flex-direction: column; gap: 2px; }
13
+ /* Search is the same 32px as a view link, so the rail reads as one column of
14
+ controls. A hairline ring, not a border, so focus can replace it cleanly. */
15
+ .index-search { position: relative; display: flex; align-items: center; }
16
+ .index-search > svg { position: absolute; left: 8px; color: var(--fg-quaternary); pointer-events: none; }
17
+ .index-search input { width: 100%; height: 32px; padding: 0 32px; border: 0; border-radius: var(--radius-sm); background: var(--bg-primary); box-shadow: inset 0 0 0 1px var(--border-primary); font: inherit; font-size: 14px; line-height: 20px; color: var(--text-primary); transition: box-shadow var(--dur-hover) var(--ease-hover); }
18
+ .index-search input::placeholder { color: var(--text-placeholder); }
19
+ .index-search input::-webkit-search-cancel-button { appearance: none; }
20
+ /* A focused field says so with its edge alone, as the studio's People fields do; asked for more contrast, the ring comes back. */
21
+ .index-search input:focus-visible { outline: 2px solid transparent; box-shadow: inset 0 0 0 1px var(--border-brand); }
22
+ @media (prefers-contrast: more) { .index-search input:focus-visible { box-shadow: inset 0 0 0 1px var(--border-brand), var(--focus-ring); } }
23
+ .index-search input:disabled { cursor: default; }
24
+ .index-search-key { position: absolute; right: 6px; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--radius-xs); box-shadow: inset 0 0 0 1px var(--border-secondary); font: 12px/18px var(--sys-font-mono); color: var(--text-quaternary); pointer-events: none; transition: opacity var(--dur-hover) var(--ease-hover); }
25
+ .index-search:focus-within .index-search-key, .index-search:has(input:disabled) .index-search-key { opacity: 0; }
26
+ .index-search-clear { position: absolute; right: 4px; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: var(--radius-xs); background: none; color: var(--fg-quaternary); cursor: pointer; transition: color var(--dur-hover) var(--ease-hover), background-color var(--dur-hover) var(--ease-hover); }
27
+ .index-search-clear::before { content: ''; position: absolute; inset: -4px; }
28
+ /* A finger gets 44px: the clear button's area grows, and every sidebar link stands 44px tall. */
29
+ @media (pointer: coarse) {
30
+ .index-search-clear::before { inset: -10px; }
31
+ .index-rail-link, .index-rail-sub .index-rail-link, .index-rail-recent .index-rail-link { min-height: 44px; }
32
+ }
33
+ @media (hover: hover) and (pointer: fine) { .index-search-clear:hover { background: var(--bg-primary_hover); color: var(--fg-secondary); } }
34
+ /* A coarse pointer has no keyboard to press /, and iOS zooms into any field under 16px. */
35
+ @media (pointer: coarse) { .index-search-key { display: none; } .index-search input { font-size: 16px; } }
36
+ /* Search as a button (the index's command menu): the field's size and edge, so the rail reads the same. */
37
+ .index-search-open { display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 6px 0 8px; border: 0; border-radius: var(--radius-sm); background: var(--bg-primary); box-shadow: inset 0 0 0 1px var(--border-primary); font: inherit; font-size: 14px; line-height: 20px; color: var(--text-tertiary); cursor: pointer; transition: box-shadow var(--dur-hover) var(--ease-hover); }
38
+ .index-search-open > svg { flex: none; color: var(--fg-quaternary); }
39
+ .index-search-open > span:not(.index-search-key) { flex: 1; text-align: left; }
40
+ .index-search-open .index-search-key { position: static; }
41
+ @media (hover: hover) and (pointer: fine) { .index-search-open:hover { box-shadow: inset 0 0 0 1px var(--border-brand); } }
42
+ @media (pointer: coarse) { .index-search-open { height: 44px; } }
43
+ /* A long name ends in an ellipsis; the link never wraps to a second line. */
44
+ .index-rail-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
45
+ /* What was opened last: plain links under their own quiet heading. */
46
+ .index-rail-recent ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
47
+ .index-rail-recent .index-rail-link { min-height: 28px; padding: 4px 8px; font-weight: 400; color: var(--text-tertiary); }
48
+ .index-rail-heading { padding: 0 8px 4px; font-size: 12px; line-height: 18px; font-weight: 500; color: var(--text-quaternary); }
49
+ .index-rail-link { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 6px 8px; border: 0; border-radius: var(--radius-sm); background: transparent; font: inherit; font-weight: 500; text-align: left; color: var(--text-secondary); text-decoration: none; cursor: pointer; transition: background-color var(--dur-hover) var(--ease-hover), color var(--dur-hover) var(--ease-hover); }
50
+ /* Under a base, the way back to the client's hub sits above Search, a step quieter than the views. */
51
+ .index-rail-back { color: var(--text-tertiary); font-weight: 400; }
52
+ /* The features sit under Prototypes, the view that holds them: their names
53
+ line up with its name, and a hairline on the icon column ties them to it,
54
+ as the alternates rail does in the list. They step down to 28px, regular
55
+ weight and tertiary text, so the views lead. */
56
+ .index-rail-sub { position: relative; list-style: none; margin: 2px 0 6px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
57
+ .index-rail-sub::before { content: ""; position: absolute; left: 15px; top: 2px; bottom: 2px; width: 1px; background: var(--border-secondary); pointer-events: none; }
58
+ .index-rail-sub .index-rail-link { min-height: 28px; padding: 4px 8px 4px 32px; font-weight: 400; color: var(--text-tertiary); }
59
+ /* While searching, a view or feature with no matches dims rather than hiding, so the sidebar never shifts. */
60
+ .index-rail-link[data-empty], .index-rail-link:disabled { color: var(--text-disabled); }
61
+ .index-rail-link[data-empty] svg { color: var(--fg-disabled); }
62
+ .index-rail-link:disabled { cursor: default; }
63
+ .index-rail-link svg { flex: none; color: var(--fg-quaternary); }
64
+ .index-rail-link[aria-current="page"] { background: var(--bg-active); color: var(--text-primary); }
65
+ .index-rail-link[aria-current="page"] svg { color: var(--fg-secondary); }
66
+ @media (hover: hover) and (pointer: fine) { .index-rail-link:not([aria-current="page"], :disabled):hover { background: var(--bg-primary_hover); color: var(--text-primary); } }
67
+ .index-rail-link:not([aria-current="page"], :disabled):active { background: var(--bg-active); }
68
+ /* Who is signed in, at the foot of the sidebar under a hairline: the name, then the team a step quieter. */
69
+ .index-rail-who { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding: 16px 8px 0; border-top: 1px solid var(--border-secondary); font-size: 13px; line-height: 18px; }
70
+ .index-rail-who-name { font-weight: 500; color: var(--text-secondary); overflow-wrap: anywhere; }
71
+ .index-rail-who-team { color: var(--text-tertiary); overflow-wrap: anywhere; }
72
+ @media (max-width: 1023px) {
73
+ .index-frame { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
74
+ .index-frame > main { width: min(744px, 100% - 8px); padding-top: 40px; }
75
+ .index-rail { position: static; height: auto; overflow: visible; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px 8px; padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px calc(16px + env(safe-area-inset-left, 0px)); border-right: 0; border-bottom: 1px solid var(--border-secondary); }
76
+ .index-rail-back { width: auto; margin-right: auto; }
77
+ .index-rail-nav { flex-direction: row; }
78
+ .index-rail-nav .index-rail-link { width: auto; }
79
+ .index-rail-sub, .index-rail-recent { display: none; }
80
+ .index-search-open { flex: 1 1 100%; order: 1; }
81
+ .index-search { flex: 1 1 100%; order: 1; }
82
+ /* In the top bar, one quiet line after the views: "Miles Roxas · Local". */
83
+ .index-rail-who { order: 0; margin: 0 0 0 auto; flex-direction: row; gap: 6px; padding: 0 8px; border: 0; }
84
+ .index-rail-who-team::before { content: "·" / ""; margin-right: 6px; color: var(--text-quaternary); }
85
+ }
86
+ :root[data-motion="reduce"] :is(.index-rail-link, .index-search input, .index-search-clear, .index-search-open) { transition: none; }
@@ -1,6 +1,8 @@
1
1
  import { Icon } from '@kit/Icon';
2
2
  import { Button } from '@kit/ui';
3
- import { type HubLoaded, HubPage, useHubData } from './page';
3
+ import { useState } from 'react';
4
+ import { Sidebar } from '../Sidebar';
5
+ import { type HubLoaded, HubPage, hit, NoMatch, useHubData } from './page';
4
6
 
5
7
  /** What the hub shows of a project: the server sends no more. */
6
8
  type Listed = { slug: string; name: string };
@@ -9,18 +11,23 @@ type Loaded = HubLoaded<{ projects: Listed[] }>;
9
11
 
10
12
  export function ClientHub() {
11
13
  const loaded = useHubData<{ projects: Listed[] }>('projects');
14
+ const [query, setQuery] = useState('');
15
+ const sidebar = (
16
+ <Sidebar
17
+ label="Search projects"
18
+ search={loaded.status === 'ready' ? { query, setQuery } : undefined}
19
+ who={loaded.status === 'ready' ? loaded.me : null}
20
+ views={[{ key: 'projects', label: 'Projects', href: '#/', icon: 'grid-01', current: true }]}
21
+ />
22
+ );
12
23
  return (
13
- <HubPage
14
- title="Projects"
15
- voice="What the studio has shared here, each in its own hub."
16
- me={loaded.status === 'ready' ? loaded.me : null}
17
- >
18
- <Body loaded={loaded} />
24
+ <HubPage sidebar={sidebar} title="Projects" voice="What the studio has shared here, each in its own hub.">
25
+ <Body loaded={loaded} query={query} />
19
26
  </HubPage>
20
27
  );
21
28
  }
22
29
 
23
- function Body({ loaded }: { loaded: Loaded }) {
30
+ function Body({ loaded, query }: { loaded: Loaded; query: string }) {
24
31
  if (loaded.status === 'loading')
25
32
  return (
26
33
  <ul className="hub-list" aria-busy="true" aria-label="Loading projects">
@@ -36,11 +43,15 @@ function Body({ loaded }: { loaded: Loaded }) {
36
43
  <p>When the studio shares a project with you, it shows here.</p>
37
44
  </section>
38
45
  );
46
+ const q = query.trim().toLowerCase();
47
+ const shown = loaded.projects.filter((p) => hit(q, p.name, p.slug));
48
+ if (!shown.length) return <NoMatch query={query} />;
39
49
  return (
40
50
  <ul className="hub-list">
41
- {loaded.projects.map((p) => (
51
+ {shown.map((p) => (
42
52
  <li key={p.slug}>
43
- <a className="hub-row" href={`/${p.slug}/`}>
53
+ {/* Relative: the hub is at the host's root, so this is /<project>/ there, and under dev's /_clients/<client>/ too. */}
54
+ <a className="hub-row" href={`${p.slug}/`}>
44
55
  <span className="hub-name">{p.name}</span>
45
56
  <Icon name="arrow-right" size={16} className="hub-arrow" />
46
57
  </a>
@@ -1,10 +1,12 @@
1
+ import { useHashRoute } from '@kit/hooks';
1
2
  import { Icon } from '@kit/Icon';
2
3
  import { Badge, Button } from '@kit/ui';
3
- import { type ReactNode, useEffect, useId, useMemo, useRef, useState } from 'react';
4
+ import { type ReactNode, useCallback, useEffect, useId, useMemo, useRef, useState } from 'react';
4
5
  import { HANDOFF_START } from '../../core/prototype';
5
6
  import { createReviewStore, type Me, useReviewState } from '../review/client';
6
7
  import { People } from '../review/People';
7
- import { type HubLoaded, HubPage, useHubData } from './page';
8
+ import { Sidebar, useJump } from '../Sidebar';
9
+ import { type HubLoaded, HubPage, hit, NoMatch, useHubData } from './page';
8
10
 
9
11
  /** What the studio hub shows of a project and a client: the server sends no more. */
10
12
  type ListedProject = { slug: string; name: string; built: boolean };
@@ -12,40 +14,119 @@ type ListedClient = { slug: string; name: string; host: string; waiting: boolean
12
14
 
13
15
  type Loaded = HubLoaded<{ clients: ListedClient[] }>;
14
16
 
17
+ /** The studio hub's two views: its clients, and its own people on a page of their own. */
18
+ const VIEWS = {
19
+ clients: {
20
+ href: '#/',
21
+ title: 'Clients',
22
+ icon: 'briefcase-01',
23
+ voice: 'Every client of the studio. Open one to work in its hub, signed in as you.',
24
+ },
25
+ people: {
26
+ href: '#/people',
27
+ title: 'Studio people',
28
+ icon: 'users-01',
29
+ voice: 'The studio’s own people. They sign in here and see every client.',
30
+ },
31
+ } as const;
32
+ type View = keyof typeof VIEWS;
33
+
34
+ /** A client as the search leaves it: whole when its name, slug or address matches, else only its matching projects. */
35
+ function shownOf(client: ListedClient, q: string): ListedClient | null {
36
+ if (!q || hit(q, client.name, client.slug, client.host)) return client;
37
+ const projects = client.projects.filter((p) => hit(q, p.name, p.slug));
38
+ return projects.length ? { ...client, projects } : null;
39
+ }
40
+
41
+ /** The view the hash names: `#/people` is Studio people, anything else Clients. The tab's title follows it. */
42
+ function useView(): View {
43
+ const { path } = useHashRoute();
44
+ const view: View = path === VIEWS.people.href ? 'people' : 'clients';
45
+ useEffect(() => {
46
+ document.title = VIEWS[view].title;
47
+ }, [view]);
48
+ return view;
49
+ }
50
+
15
51
  export function StudioHub() {
16
52
  const loaded = useHubData<{ clients: ListedClient[] }>('clients');
53
+ const view = useView();
54
+ const [query, setQuery] = useState('');
55
+ const q = query.trim().toLowerCase();
56
+ const jump = useJump(view === 'clients', VIEWS.clients.href);
57
+ const clients = loaded.status === 'ready' ? loaded.clients : [];
58
+ // Search finds clients and projects: typing on Studio people goes to Clients, where the matches are.
59
+ const onType = () => {
60
+ if (view !== 'clients') location.hash = VIEWS.clients.href;
61
+ };
62
+ const sidebar = (
63
+ <Sidebar
64
+ label="Search clients and projects"
65
+ search={loaded.status === 'ready' ? { query, setQuery, onType } : undefined}
66
+ who={loaded.status === 'ready' ? loaded.me : null}
67
+ views={(Object.keys(VIEWS) as View[]).map((v) => ({
68
+ key: v,
69
+ label: VIEWS[v].title,
70
+ href: VIEWS[v].href,
71
+ icon: VIEWS[v].icon,
72
+ current: v === view,
73
+ empty: Boolean(q) && (v === 'people' || !clients.some((c) => shownOf(c, q))),
74
+ jumps:
75
+ v === 'clients'
76
+ ? clients.map((c) => ({ key: c.slug, label: c.name, hits: Boolean(shownOf(c, q)) }))
77
+ : undefined,
78
+ }))}
79
+ jumpsLabel="Jump to a client"
80
+ onJump={(slug) => jump(`client-${slug}`)}
81
+ />
82
+ );
17
83
  return (
18
- <HubPage
19
- title="Clients"
20
- voice="Every client of the studio. Open one to work in its hub, signed in as you."
21
- me={loaded.status === 'ready' ? loaded.me : null}
22
- >
23
- <Body loaded={loaded} />
84
+ <HubPage sidebar={sidebar} title={VIEWS[view].title} voice={VIEWS[view].voice}>
85
+ <Body loaded={loaded} view={view} query={query} q={q} />
24
86
  </HubPage>
25
87
  );
26
88
  }
27
89
 
28
- function Body({ loaded }: { loaded: Loaded }) {
90
+ function Body({ loaded, view, query, q }: { loaded: Loaded; view: View; query: string; q: string }) {
29
91
  if (loaded.status === 'loading') return <Loading />;
30
92
  if (loaded.status === 'error') return <Failed signedOut={loaded.signedOut} />;
93
+ if (view === 'people') return <StudioPeople me={loaded.me} />;
94
+ if (!loaded.clients.length)
95
+ return (
96
+ <section className="hub-empty">
97
+ <h2>No clients yet</h2>
98
+ <p>
99
+ Add the first from the studio folder with <code>design-hub client add</code>. It shows here as soon
100
+ as it is added.
101
+ </p>
102
+ </section>
103
+ );
104
+ const shown = loaded.clients.map((c) => shownOf(c, q)).filter((c) => c !== null);
105
+ if (!shown.length) return <NoMatch query={query} />;
31
106
  return (
32
107
  <div className="studio-clients">
33
- {loaded.clients.length ? (
34
- loaded.clients.map((c) => <ClientSection key={c.slug} client={c} me={loaded.me} />)
35
- ) : (
36
- <section className="hub-empty">
37
- <h2>No clients yet</h2>
38
- <p>
39
- Add the first from the studio folder with <code>design-hub client add</code>. It shows here as
40
- soon as it is added.
41
- </p>
42
- </section>
43
- )}
44
- <StudioSection me={loaded.me} />
108
+ {shown.map((c) => (
109
+ <ClientSection key={c.slug} client={c} me={loaded.me} />
110
+ ))}
45
111
  </div>
46
112
  );
47
113
  }
48
114
 
115
+ /** Loads a section's people, saying whether the last load failed and whether one is under way. */
116
+ function usePeopleLoad(store: PeopleStore) {
117
+ const [busy, setBusy] = useState(false);
118
+ const [failed, setFailed] = useState(false);
119
+ const load = useCallback(async () => {
120
+ setBusy(true);
121
+ await store.loadPeople().then(
122
+ () => setFailed(false),
123
+ () => setFailed(true),
124
+ );
125
+ setBusy(false);
126
+ }, [store]);
127
+ return { busy, failed, load };
128
+ }
129
+
49
130
  /**
50
131
  * A section's People: its button, and the panel it opens below the section's
51
132
  * rows with the review panel's People controls, for one client's people or
@@ -56,19 +137,10 @@ function Body({ loaded }: { loaded: Loaded }) {
56
137
  function usePeopleSection(me: Me | null, client?: string): { toggle: ReactNode; panel: ReactNode } {
57
138
  const store = useMemo(() => createReviewStore('', client), [client]);
58
139
  const [open, setOpen] = useState(false);
59
- const [busy, setBusy] = useState(false);
60
- const [failed, setFailed] = useState(false);
140
+ const { busy, failed, load } = usePeopleLoad(store);
61
141
  const id = useId();
62
142
  const button = useRef<HTMLButtonElement>(null);
63
143
  const panel = useRef<HTMLDivElement>(null);
64
- const load = async () => {
65
- setBusy(true);
66
- await store.loadPeople().then(
67
- () => setFailed(false),
68
- () => setFailed(true),
69
- );
70
- setBusy(false);
71
- };
72
144
  useEffect(() => {
73
145
  if (open) panel.current?.querySelector<HTMLElement>('input, button')?.focus();
74
146
  }, [open]);
@@ -148,6 +220,7 @@ function PeopleBody({
148
220
  me={me}
149
221
  people={s.people}
150
222
  access={s.access}
223
+ mail={s.mail}
151
224
  only={client ? 'client' : 'studio'}
152
225
  menuClassName=""
153
226
  />
@@ -155,20 +228,21 @@ function PeopleBody({
155
228
  );
156
229
  }
157
230
 
158
- /** The studio's own people, who sign in here and see every client. */
159
- function StudioSection({ me }: { me: Me | null }) {
160
- const people = usePeopleSection(me);
231
+ /**
232
+ * The studio's own people, who sign in here and see every client: a view of
233
+ * their own, so the People controls show at once, loaded on arrival, with no
234
+ * button to open them.
235
+ */
236
+ function StudioPeople({ me }: { me: Me | null }) {
237
+ const store = useMemo(() => createReviewStore(''), []);
238
+ const { busy, failed, load } = usePeopleLoad(store);
239
+ useEffect(() => {
240
+ void load();
241
+ }, [load]);
161
242
  return (
162
- <section className="studio-client studio-own" aria-labelledby="studio-people">
163
- <div className="studio-client-head">
164
- <div className="studio-client-name">
165
- <h2 id="studio-people">Studio people</h2>
166
- <p className="studio-note">Sign in here and see every client.</p>
167
- </div>
168
- <div className="studio-actions">{people.toggle}</div>
169
- </div>
170
- {people.panel}
171
- </section>
243
+ <div className="studio-people is-page">
244
+ <PeopleBody store={store} me={me} failed={failed} busy={busy} onRetry={load} />
245
+ </div>
172
246
  );
173
247
  }
174
248
 
@@ -211,7 +285,9 @@ function ClientSection({ client, me }: { client: ListedClient; me: Me | null })
211
285
  <section className="studio-client" aria-labelledby={titleId}>
212
286
  <div className="studio-client-head">
213
287
  <div className="studio-client-name">
214
- <h2 id={titleId}>{client.name}</h2>
288
+ <h2 id={titleId} tabIndex={-1}>
289
+ {client.name}
290
+ </h2>
215
291
  <p className="studio-host">{client.host}</p>
216
292
  </div>
217
293
  {/* A client still waiting for its address has no people op to run: its host is not proven yet. */}