@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
@@ -0,0 +1,224 @@
1
+ /* The index (Index.tsx): beside the sidebar, a toolbar that stays and a list
2
+ of milestones under it. A milestone row opens its home over the list
3
+ (Milestone.tsx); the rows on the rail under it are quick links. Search is
4
+ the command menu (Command.tsx). Every value comes from the tokens. */
5
+
6
+ /* The index fills the space beside the sidebar; the sidebar's own centered column is for the studio's pages. */
7
+ .ix-frame { --ix-line: 40px; font-size: 14px; line-height: 20px; }
8
+ .ix-behind { display: contents; }
9
+ .index-frame.ix-frame main.ix-main { width: auto; min-width: 0; }
10
+ .ix-toolbar { position: sticky; z-index: 2; top: 0; display: flex; flex-direction: column; gap: 8px; padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 12px 24px; background: var(--bg-primary); border-bottom: 1px solid var(--border-secondary); }
11
+ @media (max-width: 1023px) { .ix-toolbar { position: static; padding-top: 12px; } }
12
+ .ix-list { padding: 12px 12px 128px; }
13
+ :is(.ix-cmd, .ix-toolbar) :is(kbd, .ix-kbd) { display: inline-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: 11px/16px var(--sys-font-mono); color: var(--text-quaternary); }
14
+ /* Studio's switch ends a row of the home, inside the row's hover surface. */
15
+ .ix-home-row > .index-audience { flex: none; padding-right: 10px; }
16
+ /* A prototype with no milestone, and a tool, has no home: its switch ends its row on the index, in a column of its own. */
17
+ .ix-rows[data-audience] { grid-template-columns: minmax(0, 1fr) 144px 64px auto; }
18
+ .ix-rows[data-audience] .ix-row { grid-column: 1 / 4; }
19
+ .ix-rows[data-audience] > .ix-item > .index-audience { grid-column: 4; padding-right: 12px; }
20
+
21
+ .ix-toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 32px; }
22
+ .ix-toolbar h1 { font-size: 15px; line-height: 24px; font-weight: 600; color: var(--text-primary); }
23
+ .ix-toolbar-actions { display: flex; align-items: center; gap: 4px; }
24
+ .ix-toolbar-sep { width: 1px; height: 16px; margin: 0 4px; background: var(--border-secondary); }
25
+
26
+ .ix-chips { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; align-items: center; gap: 6px; }
27
+ .ix-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 2px 0 10px; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--border-secondary); font-size: 13px; color: var(--text-primary); }
28
+ .ix-chip-facet { color: var(--text-tertiary); }
29
+ .ix-chip-x { position: relative; 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; }
30
+ .ix-chip-x::before { content: ""; position: absolute; inset: -4px; }
31
+ .ix-chips-clear { height: 28px; padding: 0 8px; border: 0; border-radius: var(--radius-sm); background: none; font: inherit; font-size: 13px; color: var(--text-tertiary); cursor: pointer; }
32
+ @media (hover: hover) and (pointer: fine) {
33
+ .ix-chip-x:hover { background: var(--bg-primary_hover); color: var(--fg-secondary); }
34
+ .ix-chips-clear:hover { color: var(--text-primary); }
35
+ }
36
+
37
+
38
+ /* A milestone and its quick links: one grid, so the status and the date run down a column each.
39
+ The milestone row is the one with a home; the rows under it hang on a rail and are plain links. */
40
+ .ix-rows { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr) 144px 64px; column-gap: 16px; }
41
+ .ix-rows + .ix-rows { margin-top: 16px; }
42
+ .ix-item { position: relative; grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; border-radius: var(--radius-md); transition: background-color var(--dur-hover) var(--ease-hover); }
43
+ .ix-row { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; height: var(--ix-line); padding: 0 12px; border: 0; border-radius: var(--radius-md); background: none; font: inherit; text-align: left; color: inherit; text-decoration: none; cursor: pointer; scroll-margin: 8px 0; }
44
+ .ix-row:focus-visible { outline: 2px solid var(--fg-brand-primary); outline-offset: -2px; box-shadow: none; }
45
+ .ix-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
46
+ .ix-ms .ix-title { font-weight: 600; }
47
+ /* Two targets, two surfaces: the fold sits in the gutter on the rail its quick links hang from, and the row's
48
+ fill starts to its right, so the row never reads as a heading that folds. */
49
+ .ix-ms > .ix-row { margin-left: 30px; padding-left: 6px; transition: background-color var(--dur-hover) var(--ease-hover); }
50
+ .ix-loose-head { padding-left: 36px; }
51
+ .ix-fold { position: absolute; z-index: 1; left: 6px; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: var(--radius-sm); background: none; color: var(--fg-quaternary); cursor: pointer; transition: background-color var(--dur-hover) var(--ease-hover), color var(--dur-hover) var(--ease-hover); }
52
+ .ix-fold svg { transition: transform var(--dur-hover) var(--ease-out); }
53
+ .ix-fold[aria-expanded="false"] svg { transform: rotate(-90deg); }
54
+ @media (hover: hover) and (pointer: fine) { .ix-fold:hover { background: var(--bg-active); color: var(--fg-secondary); } }
55
+ .ix-date { grid-column: 3; justify-self: end; font-size: 13px; color: var(--text-quaternary); white-space: nowrap; }
56
+ /* What a click on a milestone does, said where the date sits: same cell, so nothing shifts. */
57
+ .ix-ms .ix-date, .ix-cue { grid-row: 1; transition: opacity var(--dur-hover) var(--ease-hover); }
58
+ .ix-cue { grid-column: 3; justify-self: end; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-secondary); white-space: nowrap; opacity: 0; pointer-events: none; }
59
+ .ix-ms > .ix-row:focus-visible .ix-date { opacity: 0; }
60
+ .ix-ms > .ix-row:focus-visible .ix-cue { opacity: 1; }
61
+ @media (hover: hover) and (pointer: fine) {
62
+ .ix-ms > .ix-row:hover .ix-date { opacity: 0; }
63
+ .ix-ms > .ix-row:hover .ix-cue { opacity: 1; }
64
+ }
65
+ .ix-loose-head { grid-column: 1 / -1; display: flex; align-items: center; height: var(--ix-line); padding: 0 12px 0 36px; font-size: 14px; font-weight: 600; color: var(--text-tertiary); }
66
+
67
+ .ix-link { height: 32px; }
68
+ /* Quick links carry no icon: the rail, the indent and the "Explorations" label say what they are. Their text
69
+ starts on the milestone title's edge. */
70
+ .ix-lead { display: flex; align-items: center; min-width: 0; padding-left: 24px; }
71
+ /* Names the rows under it. Not a control: no hover, no pointer. It starts on the titles' left edge. */
72
+ .ix-kind { display: flex; align-items: flex-end; height: 28px; padding: 0 12px 4px 36px; font-size: 12px; font-weight: 500; color: var(--text-quaternary); }
73
+ .ix-link .ix-title { color: var(--text-secondary); }
74
+ .ix-note { font-size: 13px; color: var(--text-quaternary); }
75
+ .ix-item[data-child]::before { content: ""; position: absolute; left: 18px; top: 0; bottom: 0; width: 1px; background: var(--border-secondary); pointer-events: none; }
76
+ /* Explorations hang one level in, on a rail of their own under the "Explorations" label: the same 18px from rail
77
+ to text as the level above. */
78
+ .ix-item[data-nested]::after { content: ""; position: absolute; left: 38px; top: 0; bottom: 0; width: 1px; background: var(--border-secondary); pointer-events: none; }
79
+ .ix-item[data-nested] .ix-lead { padding-left: 44px; }
80
+
81
+ .ix-status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-tertiary); white-space: nowrap; }
82
+ .ix-status::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--fg-quinary); }
83
+ /* Shape before colour: open work is a ring, settled work a solid dot, and only what waits on someone
84
+ (the client, or engineering) takes the accent. */
85
+ .ix-status[data-status="exploring"]::before { background: none; box-shadow: inset 0 0 0 1.5px var(--fg-tertiary); }
86
+ .ix-status[data-status="decided"]::before { background: var(--fg-tertiary); }
87
+ .ix-status:is([data-status="ready"], [data-state="ready"], [data-state="for-dev"])::before { background: var(--fg-brand-primary); }
88
+
89
+ .ix-item[data-current]:not(.ix-ms), .ix-ms[data-current] > .ix-row { background: var(--bg-active); }
90
+ @media (hover: hover) and (pointer: fine) {
91
+ .ix-item:not(.ix-ms):has(> .ix-row):hover, .ix-ms > .ix-row:hover { background: var(--bg-primary_hover); }
92
+ .ix-item[data-current]:not(.ix-ms):hover, .ix-ms[data-current] > .ix-row:hover { background: var(--bg-active); }
93
+ .ix-link:hover .ix-title { color: var(--text-primary); }
94
+ }
95
+ @media (pointer: coarse) {
96
+ .ix-frame { --ix-line: 48px; }
97
+ .ix-link { height: 44px; }
98
+ .ix-fold { left: 0; width: 44px; height: 44px; }
99
+ .ix-ms > .ix-row { margin-left: 44px; padding-left: 0; }
100
+ .ix-loose-head { padding-left: 44px; }
101
+ .ix-lead { padding-left: 32px; }
102
+ .ix-kind { padding-left: 44px; }
103
+ .ix-item[data-child]::before { left: 22px; }
104
+ .ix-item[data-nested]::after { left: 46px; }
105
+ .ix-item[data-nested] .ix-lead { padding-left: 52px; }
106
+ .ix-chips-clear { min-height: 44px; }
107
+ .ix-cmd-item { height: 44px; }
108
+ .ix-toolbar .btn-sm { min-height: 44px; min-width: 44px; }
109
+ .ix-chip-x::before { inset: -10px; }
110
+ }
111
+
112
+ .ix-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 48px 12px; }
113
+ .ix-empty h2 { font-size: 14px; font-weight: 600; }
114
+ .ix-empty p { color: var(--text-tertiary); max-width: 52ch; }
115
+ .ix-empty code { font: 13px/20px var(--sys-font-mono); color: var(--text-secondary); }
116
+
117
+ /* The peek: one bar, a reading column and a quiet column of facts, and a foot that never scrolls away.
118
+ The bar says where you are and holds every control but the one primary action, which sits alone in the foot. */
119
+ .ix-overlay { position: fixed; z-index: 5; inset: 0; display: grid; place-items: start center; padding: 64px 24px 24px; background: oklch(0.2 0.02 265 / 0.32); opacity: 0; visibility: hidden; transition: opacity var(--dur-dialog-out) var(--ease-in), visibility 0s linear var(--dur-dialog-out); }
120
+ .ix-overlay[data-open] { opacity: 1; visibility: visible; transition: opacity var(--dur-dialog) var(--ease-out), visibility 0s; }
121
+ .ix-modal { container-type: inline-size; display: flex; flex-direction: column; width: min(760px, 100%); max-height: min(640px, 100%); overflow: hidden; border-radius: var(--radius-xl); background: var(--bg-primary); box-shadow: 0 0 0 1px oklch(0 0 0 / 0.08), var(--shadow-xl); transform: scale(0.97); transition: transform var(--dur-dialog-out) var(--ease-in); }
122
+ .ix-overlay[data-open] .ix-modal { transform: none; transition: transform var(--dur-dialog) var(--ease-out); }
123
+ .ix-overlay[data-instant], .ix-overlay[data-instant] .ix-modal { transition: none; }
124
+ .ix-modal:focus-visible { outline: none; }
125
+ .dark-mode .ix-modal { box-shadow: 0 0 0 1px oklch(1 0 0 / 0.1); }
126
+
127
+ .ix-modal-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 52px; padding: 0 10px 0 32px; border-bottom: 1px solid var(--border-secondary); }
128
+ .ix-crumb { font-size: 13px; line-height: 20px; color: var(--text-quaternary); }
129
+ .ix-modal-tools { flex: none; display: flex; align-items: center; gap: 2px; }
130
+ .ix-modal-tools .btn-icon { color: var(--fg-quaternary); }
131
+ .ix-step-up svg { transform: rotate(180deg); }
132
+ .ix-modal-close { margin-left: 8px; }
133
+ .ix-modal-tools .btn[aria-disabled="true"] { opacity: 0.4; cursor: default; pointer-events: none; }
134
+
135
+ .ix-modal-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 220px; overflow-y: auto; overscroll-behavior: contain; }
136
+ .ix-read { padding: 28px 32px 32px; }
137
+ .ix-read-title { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); text-wrap: balance; overflow-wrap: anywhere; }
138
+ .ix-read-summary { margin-top: 8px; max-width: 60ch; font-size: 14px; line-height: 22px; color: var(--text-secondary); text-wrap: pretty; }
139
+ .ix-read-question { margin-top: 28px; }
140
+ .ix-read-question h3 { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--text-quaternary); }
141
+ .ix-read-question p { margin-top: 6px; max-width: 46ch; font: 400 18px/27px var(--font-voice); letter-spacing: -0.01em; color: var(--text-primary); text-wrap: pretty; }
142
+
143
+ .ix-home-group { margin-top: 28px; }
144
+ .ix-home-group h3 { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--text-quaternary); }
145
+ .ix-home-group ul { list-style: none; margin: 6px -10px 0; padding: 0; }
146
+ .ix-home-row { display: flex; align-items: center; gap: 4px; border-radius: var(--radius-md); transition: background-color var(--dur-hover) var(--ease-hover); }
147
+ .ix-home-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: var(--radius-md); color: var(--text-primary); text-decoration: none; }
148
+ .ix-home-link > svg { flex: none; color: var(--fg-quaternary); }
149
+ .ix-home-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
150
+ @media (hover: hover) and (pointer: fine) { .ix-home-row:hover { background: var(--bg-primary_hover); } }
151
+
152
+ .ix-facts { display: flex; flex-direction: column; gap: 20px; margin: 0; padding: 28px 20px 28px 24px; background: var(--bg-secondary_subtle); font-size: 13px; line-height: 20px; }
153
+ .ix-facts dt { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--text-quaternary); }
154
+ .ix-facts dd { margin: 6px 0 0; color: var(--text-primary); }
155
+ .ix-facts .ix-status { color: var(--text-primary); }
156
+
157
+ .ix-modal-foot { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border-secondary); }
158
+ .ix-modal-foot .btn-tertiary { margin-right: auto; }
159
+ .ix-open { padding-right: 8px; }
160
+ .ix-foot-note { font-size: 13px; color: var(--text-quaternary); }
161
+ .ix-kbd-on { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 4px; padding: 0 4px; border-radius: var(--radius-xs); background: oklch(1 0 0 / 0.16); font: 12px/16px var(--sys-font-mono); color: inherit; }
162
+ .dark-mode .ix-kbd-on { background: oklch(0 0 0 / 0.12); }
163
+
164
+ /* Full page: the same home with the whole screen, for a milestone with a long list. */
165
+ .ix-overlay[data-full] { padding: 0; }
166
+ .ix-overlay[data-full] .ix-modal { width: 100%; height: 100%; max-height: none; border-radius: 0; box-shadow: none; }
167
+ .ix-overlay[data-full] .ix-read { width: min(720px, 100%); justify-self: center; }
168
+ @media (max-width: 640px) { .ix-overlay { padding: 12px 8px 8px; } }
169
+ /* Narrow, the facts move under what the prototype asks, as one row. */
170
+ @container (max-width: 600px) {
171
+ .ix-modal-bar { padding-left: 16px; }
172
+ .ix-modal-body { grid-template-columns: minmax(0, 1fr); }
173
+ .ix-read { padding: 20px 16px 24px; }
174
+ .ix-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px; }
175
+ .ix-kbd-on, .ix-crumb, .ix-modal-tools [aria-label="Full page"] { display: none; }
176
+ .ix-modal-bar { justify-content: flex-end; }
177
+ .ix-open { padding-right: 12px; }
178
+ .ix-modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)) 4px; }
179
+ }
180
+
181
+ /* The command menu: no motion, since it opens a hundred times a day. */
182
+ .ix-cmd-overlay { position: fixed; z-index: 6; inset: 0; display: grid; place-items: start center; padding: 12vh 16px 16px; background: oklch(0.2 0.02 265 / 0.24); }
183
+ .ix-cmd { display: flex; flex-direction: column; width: min(600px, 100%); max-height: min(480px, 100%); overflow: hidden; border-radius: var(--radius-xl); background: var(--bg-primary); box-shadow: 0 0 0 1px oklch(0 0 0 / 0.08), var(--shadow-xl); }
184
+ .dark-mode .ix-cmd { box-shadow: 0 0 0 1px oklch(1 0 0 / 0.1); }
185
+ .ix-cmd-field { flex: none; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--border-secondary); transition: border-color var(--dur-hover) var(--ease-hover); }
186
+ .ix-cmd-field:focus-within { border-bottom-color: var(--border-brand); }
187
+ .ix-cmd-field > svg { flex: none; color: var(--fg-quaternary); }
188
+ .ix-cmd-field input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; font: inherit; font-size: 16px; color: var(--text-primary); }
189
+ .ix-cmd-field input:focus-visible { outline: none; box-shadow: none; }
190
+ .ix-cmd-field input::placeholder { color: var(--text-placeholder); }
191
+ .ix-cmd-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px; }
192
+ .ix-cmd-group { padding: 8px 10px 4px; font-size: 12px; line-height: 18px; font-weight: 500; color: var(--text-quaternary); }
193
+ .ix-cmd-item { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--text-primary); cursor: pointer; }
194
+ .ix-cmd-item[aria-selected="true"] { background: var(--bg-active); }
195
+ .ix-cmd-item svg { flex: none; color: var(--fg-quaternary); }
196
+ .ix-cmd-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
197
+ .ix-cmd-hint { flex: none; font-size: 12px; color: var(--text-quaternary); }
198
+ .ix-cmd-none { padding: 16px 10px; color: var(--text-tertiary); }
199
+ .ix-cmd-foot { flex: none; display: flex; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--border-secondary); font-size: 12px; color: var(--text-tertiary); }
200
+ .ix-cmd-foot span { display: inline-flex; align-items: center; gap: 4px; }
201
+
202
+ :root[data-motion="reduce"] .ix-modal { transform: none; }
203
+ :root[data-motion="reduce"] .ix-fold svg { transition: none; }
204
+ :root[data-motion="reduce"] .ix-ms .ix-date, :root[data-motion="reduce"] .ix-cue { transition: none; }
205
+
206
+ /* On a phone each row keeps its title and status. */
207
+ @media (max-width: 640px) {
208
+ .ix-rows { grid-template-columns: minmax(0, 1fr) 128px; }
209
+ .ix-rows[data-audience] { grid-template-columns: minmax(0, 1fr) 128px auto; }
210
+ .ix-rows[data-audience] .ix-row { grid-column: 1 / 3; }
211
+ .ix-rows[data-audience] > .ix-item > .index-audience { grid-column: 3; }
212
+ .ix-date, .ix-cue { display: none; }
213
+ .ix-toolbar-actions .btn-label { display: none; }
214
+ .ix-toolbar { padding-left: 16px; }
215
+ }
216
+
217
+ /* On touch the peek's controls grow to 44px; the bar's buttons lose their gap so their areas never overlap. */
218
+ @media (pointer: coarse) {
219
+ .ix-modal-tools { gap: 0; }
220
+ .ix-modal-tools .btn-icon { width: 44px; height: 44px; }
221
+ .ix-modal-foot .btn { min-height: 44px; }
222
+ .ix-home-link { min-height: 44px; }
223
+ .ix-modal-bar { height: 60px; padding-right: 4px; }
224
+ }
@@ -0,0 +1,157 @@
1
+ import assert from 'node:assert/strict';
2
+ import { test } from 'node:test';
3
+ import {
4
+ byOrder,
5
+ dateOf,
6
+ fmtShort,
7
+ type Item,
8
+ milestonesOf,
9
+ startsFolded,
10
+ statusLabel,
11
+ waits,
12
+ withRecent,
13
+ } from './milestones.ts';
14
+
15
+ const item = (slug: string, over: Partial<Item> = {}): Item => ({
16
+ slug,
17
+ title: slug,
18
+ summary: '',
19
+ track: 'product',
20
+ status: 'exploring',
21
+ kind: 'exploration',
22
+ feature: 'billing',
23
+ created: '2026-01-01',
24
+ presented: '',
25
+ question: '',
26
+ ...over,
27
+ });
28
+
29
+ test('a milestone takes its name from the feature and its summary, question and status from its Main', () => {
30
+ const { milestones } = milestonesOf([
31
+ item('plan', { kind: 'sprint', status: 'ready', summary: 'Plans.', question: 'What does it cost?' }),
32
+ item('meter'),
33
+ ]);
34
+ assert.equal(milestones.length, 1);
35
+ const [m] = milestones;
36
+ assert.deepEqual(
37
+ {
38
+ id: m.id,
39
+ title: m.title,
40
+ summary: m.summary,
41
+ question: m.question,
42
+ status: m.status,
43
+ main: m.main?.slug,
44
+ },
45
+ {
46
+ id: 'billing',
47
+ title: 'Billing',
48
+ summary: 'Plans.',
49
+ question: 'What does it cost?',
50
+ status: 'ready',
51
+ main: 'plan',
52
+ },
53
+ );
54
+ });
55
+
56
+ test('quick links are live explorations only, the ones that wait on someone first', () => {
57
+ const { milestones } = milestonesOf([
58
+ item('main', { kind: 'sprint' }),
59
+ item('old', { created: '2026-01-02' }),
60
+ item('dev', { status: 'ready' }),
61
+ item('show', { status: 'review', kind: 'alternate' }),
62
+ item('done', { status: 'decided' }),
63
+ item('seen', { status: 'presented', presented: '2026-02-01' }),
64
+ item('gone', { status: 'archived' }),
65
+ ]);
66
+ const [m] = milestones;
67
+ assert.deepEqual(
68
+ m.live.map((e) => e.slug),
69
+ ['show', 'dev', 'old'],
70
+ );
71
+ assert.deepEqual(m.explorations.map((e) => e.slug).sort(), ['dev', 'done', 'old', 'show']);
72
+ assert.deepEqual(
73
+ m.presented.map((e) => e.slug),
74
+ ['seen'],
75
+ );
76
+ assert.deepEqual(
77
+ m.archived.map((e) => e.slug),
78
+ ['gone'],
79
+ );
80
+ assert.equal(m.updated, '2026-02-01');
81
+ });
82
+
83
+ test('a second sprint is an exploration, a presented sprint frees the Main, and no Main is still exploring', () => {
84
+ const two = milestonesOf([item('a', { kind: 'sprint' }), item('b', { kind: 'sprint' })]).milestones[0];
85
+ assert.equal(two.main?.slug, 'a');
86
+ assert.deepEqual(
87
+ two.explorations.map((e) => e.slug),
88
+ ['b'],
89
+ );
90
+ const freed = milestonesOf([item('a', { kind: 'sprint', status: 'presented' }), item('b')]).milestones[0];
91
+ assert.equal(freed.main, undefined);
92
+ assert.equal(freed.status, 'exploring');
93
+ });
94
+
95
+ test('tools never list, prototypes with no feature are loose, and an all-archived milestone leaves', () => {
96
+ const { milestones, loose } = milestonesOf([
97
+ item('tool', { kind: 'tool', feature: '' }),
98
+ item('one-off', { feature: '' }),
99
+ item('old-one-off', { feature: '', status: 'archived' }),
100
+ item('dead', { feature: 'search', status: 'archived' }),
101
+ ]);
102
+ assert.deepEqual(milestones, []);
103
+ assert.deepEqual(
104
+ loose.map((e) => e.slug),
105
+ ['one-off'],
106
+ );
107
+ });
108
+
109
+ test('milestones order by last updated or by name', () => {
110
+ const { milestones } = milestonesOf([
111
+ item('a', { feature: 'search', created: '2026-01-01' }),
112
+ item('b', { feature: 'billing', created: '2026-03-01' }),
113
+ ]);
114
+ assert.deepEqual(
115
+ [...milestones].sort(byOrder('updated')).map((m) => m.id),
116
+ ['billing', 'search'],
117
+ );
118
+ assert.deepEqual(
119
+ [...milestones].sort(byOrder('name')).map((m) => m.id),
120
+ ['billing', 'search'],
121
+ );
122
+ assert.deepEqual(
123
+ [...milestones]
124
+ .reverse()
125
+ .sort(byOrder('name'))
126
+ .map((m) => m.title),
127
+ ['Billing', 'Search'],
128
+ );
129
+ });
130
+
131
+ test('review reads as the studio or the client would say it; other statuses have one word', () => {
132
+ assert.equal(statusLabel('review', true), 'Ready to present');
133
+ assert.equal(statusLabel('review', false), 'In review');
134
+ assert.equal(statusLabel('ready', false), 'Ready for dev');
135
+ assert.equal(statusLabel('custom', true), 'custom');
136
+ assert.equal(waits('review') && waits('ready'), true);
137
+ assert.equal(waits('exploring'), false);
138
+ });
139
+
140
+ test('a presented take is dated by the day it was shown; a settled milestone starts folded', () => {
141
+ assert.equal(dateOf(item('a', { status: 'presented', presented: '2026-05-01' })), '2026-05-01');
142
+ assert.equal(dateOf(item('a', { status: 'presented' })), '2026-01-01');
143
+ assert.equal(startsFolded({ status: 'decided' }), true);
144
+ assert.equal(startsFolded({ status: 'ready' }), false);
145
+ });
146
+
147
+ test('recent keeps the newest first, each once, five at most', () => {
148
+ assert.deepEqual(withRecent(['a', 'b'], 'b'), ['b', 'a']);
149
+ assert.equal(withRecent(['a', 'b', 'c', 'd', 'e'], 'f').length, 5);
150
+ });
151
+
152
+ test('a date reads short, with its year only when it is another year', () => {
153
+ const now = new Date('2026-12-02T12:00:00');
154
+ assert.equal(fmtShort('2026-10-02', now), '2 Oct');
155
+ assert.equal(fmtShort('2025-10-02', now), '2 Oct 2025');
156
+ assert.equal(fmtShort(''), '');
157
+ });
@@ -0,0 +1,144 @@
1
+ // How the index reads the catalog, kept pure so it is tested
2
+ // (shell/milestones.test.ts). The README's fields keep their names; the hub
3
+ // shows them under the names people use:
4
+ //
5
+ // feature a Milestone: the unit of work, one question
6
+ // kind: sprint its Main: the current answer, one per milestone
7
+ // docs/sprints/<f>/guide.md its Guide
8
+ // kind: alternate, exploration an Exploration: a take on the whole or a study of a part
9
+ //
10
+ // The index lists milestones and, under each, links to what is live. The rest
11
+ // (takes the client saw, the archive) is one level down, in the milestone's home.
12
+ import type { Meta } from '../core/catalog.ts';
13
+ import { featureTitle } from '../core/feature.ts';
14
+
15
+ /** What the index needs of a prototype: an `Entry` (shell/registry.ts) is one. */
16
+ export type Item = Pick<
17
+ Meta,
18
+ | 'slug'
19
+ | 'title'
20
+ | 'summary'
21
+ | 'track'
22
+ | 'status'
23
+ | 'kind'
24
+ | 'feature'
25
+ | 'created'
26
+ | 'presented'
27
+ | 'question'
28
+ >;
29
+
30
+ export type Milestone<T extends Item = Item> = {
31
+ id: string;
32
+ title: string;
33
+ summary: string;
34
+ question: string;
35
+ /** Its Main's status; a milestone with no Main is still exploring. */
36
+ status: string;
37
+ track: string;
38
+ /** The newest date among its prototypes. */
39
+ updated: string;
40
+ main?: T;
41
+ /** Open explorations, the pressing ones first: the index's quick links. */
42
+ live: T[];
43
+ /** Every exploration still the milestone's own work, live or settled. */
44
+ explorations: T[];
45
+ /** Takes the client saw and did not pick. */
46
+ presented: T[];
47
+ archived: T[];
48
+ };
49
+
50
+ /** A presented take is dated by the day the client saw it. */
51
+ export const dateOf = (e: Pick<Item, 'status' | 'created' | 'presented'>) =>
52
+ (e.status === 'presented' && e.presented) || e.created;
53
+
54
+ /** The statuses of work still in motion. `review` and `ready` wait on someone, so they lead. */
55
+ const LIVE = ['review', 'ready', 'exploring', 'in-progress'];
56
+ const isLiveStatus = (status: string) => LIVE.includes(status);
57
+ /** Waits on someone: the client to look, or engineering to build. The only statuses a quick link spells out. */
58
+ export const waits = (status: string) => status === 'review' || status === 'ready';
59
+
60
+ const LABEL: Record<string, string> = {
61
+ exploring: 'Exploring',
62
+ 'in-progress': 'In progress',
63
+ ready: 'Ready for dev',
64
+ decided: 'Decided',
65
+ presented: 'Presented',
66
+ archived: 'Archived',
67
+ };
68
+ /**
69
+ * A status in words. `review` is the studio's own next step ("Ready to
70
+ * present"); a client reads the same status as theirs to look at ("In review").
71
+ */
72
+ export const statusLabel = (status: string, studio: boolean) =>
73
+ status === 'review' ? (studio ? 'Ready to present' : 'In review') : (LABEL[status] ?? status);
74
+
75
+ const newest = (a: Item, b: Item) => dateOf(b).localeCompare(dateOf(a)) || a.title.localeCompare(b.title);
76
+ const pressing = (a: Item, b: Item) => LIVE.indexOf(a.status) - LIVE.indexOf(b.status) || newest(a, b);
77
+
78
+ function milestoneOf<T extends Item>(id: string, own: T[]): Milestone<T> {
79
+ const open = own.filter((e) => e.status !== 'archived' && e.status !== 'presented');
80
+ const main = open.find((e) => e.kind === 'sprint');
81
+ const explorations = open.filter((e) => e !== main).sort(newest);
82
+ const lead = main ?? explorations[0] ?? own[0];
83
+ return {
84
+ id,
85
+ title: featureTitle(id),
86
+ summary: main?.summary ?? '',
87
+ question: main?.question ?? '',
88
+ status: main?.status ?? (open.length ? 'exploring' : (lead?.status ?? 'exploring')),
89
+ track: lead?.track ?? '',
90
+ updated: own.map(dateOf).sort().at(-1) ?? '',
91
+ main,
92
+ live: explorations.filter((e) => isLiveStatus(e.status)).sort(pressing),
93
+ explorations,
94
+ presented: own.filter((e) => e.status === 'presented').sort(newest),
95
+ archived: own.filter((e) => e.status === 'archived').sort(newest),
96
+ };
97
+ }
98
+
99
+ /**
100
+ * The prototypes as milestones, in the order their features first list, and
101
+ * the ones that belong to none. A milestone whose every prototype is archived
102
+ * leaves the index; its prototypes are still found by search.
103
+ */
104
+ export function milestonesOf<T extends Item>(list: readonly T[]): { milestones: Milestone<T>[]; loose: T[] } {
105
+ const own = list.filter((e) => e.kind !== 'tool');
106
+ const ids = [...new Set(own.map((e) => e.feature).filter(Boolean))];
107
+ return {
108
+ milestones: ids
109
+ .map((id) =>
110
+ milestoneOf(
111
+ id,
112
+ own.filter((e) => e.feature === id),
113
+ ),
114
+ )
115
+ .filter((m) => m.main || m.explorations.length || m.presented.length),
116
+ loose: own.filter((e) => !e.feature && e.status !== 'archived').sort(newest),
117
+ };
118
+ }
119
+
120
+ export type Order = 'updated' | 'name';
121
+ export const byOrder =
122
+ (order: Order) =>
123
+ (a: Milestone, b: Milestone): number =>
124
+ order === 'name'
125
+ ? a.title.localeCompare(b.title)
126
+ : b.updated.localeCompare(a.updated) || a.title.localeCompare(b.title);
127
+
128
+ /** Until someone folds or unfolds it, a settled milestone starts folded and an open one does not. */
129
+ export const startsFolded = (m: Pick<Milestone, 'status'>) => m.status === 'decided';
130
+
131
+ /** The most recent slugs first, each once, at most five: the sidebar's Recent. */
132
+ export const withRecent = (recent: readonly string[], slug: string) =>
133
+ [slug, ...recent.filter((s) => s !== slug)].slice(0, 5);
134
+
135
+ /** An ISO date as "2 Oct", with the year only when it is not this one; empty for an empty string. Noon, so no timezone moves the day. */
136
+ export function fmtShort(iso: string, now = new Date()) {
137
+ if (!iso) return '';
138
+ const day = new Date(`${iso}T12:00:00`);
139
+ return day.toLocaleDateString('en-GB', {
140
+ day: 'numeric',
141
+ month: 'short',
142
+ ...(day.getFullYear() === now.getFullYear() ? {} : { year: 'numeric' }),
143
+ });
144
+ }
package/shell/registry.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { allSlugs, entryOf, guideDocs } from 'virtual:design-hub/registry';
2
2
  import type { ComponentType } from 'react';
3
- import { byIndexOrder, type Meta, readMeta } from '../core/catalog';
3
+ import { byIndexOrder, isOpen, type Meta, readMeta } from '../core/catalog';
4
4
  import { isPrototypeSlug } from '../core/prototype';
5
5
  import type { Doc } from './doc';
6
6
 
@@ -36,7 +36,8 @@ export const everySlug = (): Promise<string[]> => allSlugs();
36
36
 
37
37
  export const guides = new Map<string, () => Promise<Doc>>(Object.entries(guideDocs));
38
38
 
39
- // The prototype a feature's walkthrough opens: the sprint itself, else the first one listed.
39
+ // The prototype a feature's walkthrough opens: its open sprint, else the first open one listed, else any.
40
40
  export const featureEntry = (entries: readonly Entry[], feature: string) =>
41
- entries.find((e) => e.feature === feature && e.kind === 'sprint') ??
41
+ entries.find((e) => e.feature === feature && e.kind === 'sprint' && isOpen(e)) ??
42
+ entries.find((e) => e.feature === feature && isOpen(e)) ??
42
43
  entries.find((e) => e.feature === feature);