@connextar/house 0.23.0 → 0.23.3

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 (187) hide show
  1. package/README.md +27 -3
  2. package/dist/analytics/browser.d.ts +1 -0
  3. package/dist/analytics/browser.d.ts.map +1 -1
  4. package/dist/analytics/browser.js +20 -3
  5. package/dist/analytics/browser.js.map +1 -1
  6. package/dist/analytics/config.d.ts +5 -0
  7. package/dist/analytics/config.d.ts.map +1 -1
  8. package/dist/analytics/config.js +4 -1
  9. package/dist/analytics/config.js.map +1 -1
  10. package/dist/analytics/react.d.ts.map +1 -1
  11. package/dist/analytics/react.js +4 -2
  12. package/dist/analytics/react.js.map +1 -1
  13. package/dist/analytics/redact.d.ts.map +1 -1
  14. package/dist/analytics/redact.js +6 -1
  15. package/dist/analytics/redact.js.map +1 -1
  16. package/dist/rate-limit/prisma-index.d.ts +1 -1
  17. package/dist/rate-limit/prisma-index.d.ts.map +1 -1
  18. package/dist/rate-limit/prisma-index.js.map +1 -1
  19. package/dist/rate-limit/prisma.d.ts +10 -1
  20. package/dist/rate-limit/prisma.d.ts.map +1 -1
  21. package/dist/rate-limit/prisma.js +2 -1
  22. package/dist/rate-limit/prisma.js.map +1 -1
  23. package/package.json +5 -2
  24. package/src/account/data-contract.ts +112 -0
  25. package/src/account/index.ts +11 -0
  26. package/src/admin/access.ts +267 -0
  27. package/src/admin/audit.ts +238 -0
  28. package/src/admin/bootstrap.ts +220 -0
  29. package/src/admin/client-index.ts +19 -0
  30. package/src/admin/client.tsx +187 -0
  31. package/src/admin/index.ts +91 -0
  32. package/src/admin/proof.ts +155 -0
  33. package/src/admin/second-factor-index.ts +16 -0
  34. package/src/admin/second-factor.ts +403 -0
  35. package/src/admin/testing-index.ts +13 -0
  36. package/src/admin/testing.ts +299 -0
  37. package/src/admin/view-as.ts +511 -0
  38. package/src/ai/config-index.ts +40 -0
  39. package/src/ai/config.ts +176 -0
  40. package/src/ai/images.ts +18 -0
  41. package/src/ai/index.ts +21 -0
  42. package/src/ai/pricing.ts +107 -0
  43. package/src/ai/provider.ts +403 -0
  44. package/src/analytics/browser.ts +400 -0
  45. package/src/analytics/client-index.ts +12 -0
  46. package/src/analytics/config.ts +89 -0
  47. package/src/analytics/index.ts +17 -0
  48. package/src/analytics/ingest.ts +81 -0
  49. package/src/analytics/react-index.ts +16 -0
  50. package/src/analytics/react.tsx +241 -0
  51. package/src/analytics/redact.ts +146 -0
  52. package/src/analytics/server-index.ts +17 -0
  53. package/src/analytics/server.ts +277 -0
  54. package/src/auth/index.ts +30 -0
  55. package/src/auth/second-factor-index.ts +16 -0
  56. package/src/auth/second-factor-next.ts +136 -0
  57. package/src/auth/second-factor-routes.ts +40 -0
  58. package/src/auth/second-factor.ts +226 -0
  59. package/src/auth/step-up-client-index.ts +13 -0
  60. package/src/auth/step-up-client.ts +23 -0
  61. package/src/auth/step-up-index.ts +19 -0
  62. package/src/auth/step-up-routes.ts +99 -0
  63. package/src/auth/step-up.ts +432 -0
  64. package/src/auth/two-factor-policy.ts +112 -0
  65. package/src/changelog/changelog.tsx +367 -0
  66. package/src/changelog/index.ts +12 -0
  67. package/src/editor/block-handle.tsx +312 -0
  68. package/src/editor/blocks.ts +169 -0
  69. package/src/editor/bubble-toolbar.tsx +208 -0
  70. package/src/editor/collapsible.ts +159 -0
  71. package/src/editor/content-index.ts +1 -0
  72. package/src/editor/content.tsx +343 -0
  73. package/src/editor/editor.tsx +333 -0
  74. package/src/editor/emoji-index.ts +1 -0
  75. package/src/editor/emoji-picker.tsx +114 -0
  76. package/src/editor/emoji.ts +436 -0
  77. package/src/editor/index.ts +6 -0
  78. package/src/editor/sections.ts +83 -0
  79. package/src/editor/suggestion-popup.tsx +136 -0
  80. package/src/editor/suggestions.ts +309 -0
  81. package/src/editor/ui.tsx +171 -0
  82. package/src/errors/error-shell.tsx +72 -0
  83. package/src/errors/global-error-shell.tsx +116 -0
  84. package/src/errors/index.ts +2 -0
  85. package/src/grid/columns.ts +48 -0
  86. package/src/grid/compare.ts +35 -0
  87. package/src/grid/hidden-columns.ts +95 -0
  88. package/src/grid/index.ts +27 -0
  89. package/src/grid/use-grid.ts +282 -0
  90. package/src/grid/views.ts +70 -0
  91. package/src/guides/guide-article.tsx +92 -0
  92. package/src/guides/guide-figure-zoom.tsx +533 -0
  93. package/src/guides/guide-figure.tsx +68 -0
  94. package/src/guides/guide-toc.tsx +133 -0
  95. package/src/guides/guides-landing.tsx +57 -0
  96. package/src/guides/guides-search.tsx +160 -0
  97. package/src/guides/guides-shell.tsx +60 -0
  98. package/src/guides/guides-sidebar.tsx +93 -0
  99. package/src/guides/index.ts +28 -0
  100. package/src/guides/library.ts +165 -0
  101. package/src/health/health.ts +115 -0
  102. package/src/health/index.ts +11 -0
  103. package/src/internal/cx.ts +4 -0
  104. package/src/internal/next-link.ts +23 -0
  105. package/src/jobs/counts.ts +151 -0
  106. package/src/jobs/cron-auth.ts +60 -0
  107. package/src/jobs/health.ts +315 -0
  108. package/src/jobs/idle.ts +86 -0
  109. package/src/jobs/index.ts +120 -0
  110. package/src/jobs/job-health-list.tsx +316 -0
  111. package/src/jobs/next-index.ts +4 -0
  112. package/src/jobs/next.ts +65 -0
  113. package/src/jobs/prisma-index.ts +12 -0
  114. package/src/jobs/prisma.ts +170 -0
  115. package/src/jobs/prune.ts +79 -0
  116. package/src/jobs/react-index.ts +35 -0
  117. package/src/jobs/registry.ts +189 -0
  118. package/src/jobs/scheduler.ts +437 -0
  119. package/src/jobs/store.ts +212 -0
  120. package/src/jobs/windows.ts +157 -0
  121. package/src/maintenance/core.ts +270 -0
  122. package/src/maintenance/gate.ts +171 -0
  123. package/src/maintenance/index.ts +40 -0
  124. package/src/maintenance/page.ts +76 -0
  125. package/src/maintenance/proxy.ts +88 -0
  126. package/src/maintenance/react-index.ts +7 -0
  127. package/src/maintenance/react.tsx +190 -0
  128. package/src/maintenance/route.ts +82 -0
  129. package/src/maintenance/unavailable.ts +61 -0
  130. package/src/markdown/figure.tsx +132 -0
  131. package/src/markdown/figures.ts +237 -0
  132. package/src/markdown/guide.tsx +536 -0
  133. package/src/markdown/index.ts +53 -0
  134. package/src/markdown/table-view.tsx +74 -0
  135. package/src/markdown/table.ts +90 -0
  136. package/src/password/common.ts +58 -0
  137. package/src/password/estimate-index.ts +18 -0
  138. package/src/password/estimate.ts +715 -0
  139. package/src/password/index.ts +40 -0
  140. package/src/password/password-input.tsx +116 -0
  141. package/src/password/password-strength.tsx +157 -0
  142. package/src/password/reveal.ts +151 -0
  143. package/src/rate-limit/better-auth.ts +94 -0
  144. package/src/rate-limit/index.ts +32 -0
  145. package/src/rate-limit/keys.ts +110 -0
  146. package/src/rate-limit/limiter.ts +276 -0
  147. package/src/rate-limit/prisma-index.ts +12 -0
  148. package/src/rate-limit/prisma.ts +157 -0
  149. package/src/rate-limit/store.ts +47 -0
  150. package/src/release/changelog.ts +364 -0
  151. package/src/release/index.ts +32 -0
  152. package/src/release/version.ts +64 -0
  153. package/src/setup-guide/bits.tsx +420 -0
  154. package/src/setup-guide/card.tsx +358 -0
  155. package/src/setup-guide/class-names.ts +144 -0
  156. package/src/setup-guide/context.tsx +239 -0
  157. package/src/setup-guide/guide.ts +271 -0
  158. package/src/setup-guide/index.ts +76 -0
  159. package/src/setup-guide/launcher.tsx +207 -0
  160. package/src/setup-guide/strip.tsx +127 -0
  161. package/src/styles/house.css +384 -0
  162. package/src/trail/index.ts +12 -0
  163. package/src/trail/rules.ts +84 -0
  164. package/src/trail/trail.tsx +367 -0
  165. package/src/ux/errors.ts +32 -0
  166. package/src/ux/feedback.tsx +41 -0
  167. package/src/ux/index.ts +44 -0
  168. package/src/ux/navigation-index.ts +16 -0
  169. package/src/ux/navigation-progress.tsx +270 -0
  170. package/src/ux/optimistic.ts +415 -0
  171. package/src/ux/use-action.ts +155 -0
  172. package/src/ux/use-optimistic-list.ts +227 -0
  173. package/src/ux/use-optimistic-value.ts +136 -0
  174. package/src/web-search/index.ts +13 -0
  175. package/src/web-search/providers.ts +177 -0
  176. package/src/web-search/types.ts +98 -0
  177. package/src/whats-new/body.tsx +190 -0
  178. package/src/whats-new/index.ts +43 -0
  179. package/src/whats-new/seen.ts +40 -0
  180. package/src/whats-new/select.ts +230 -0
  181. package/src/whats-new/use-whats-new.ts +109 -0
  182. package/src/wizard/index.ts +61 -0
  183. package/src/wizard/invalid.ts +152 -0
  184. package/src/wizard/react-hook-form-index.ts +11 -0
  185. package/src/wizard/rhf-adapter.ts +67 -0
  186. package/src/wizard/rules.ts +137 -0
  187. package/src/wizard/wizard.tsx +442 -0
@@ -0,0 +1,358 @@
1
+ "use client";
2
+
3
+ import { ArrowRight, Sparkles, Trophy } from "lucide-react";
4
+ import * as React from "react";
5
+
6
+ import { cx } from "../internal/cx.js";
7
+ import {
8
+ GuideIconLink,
9
+ HowToButton,
10
+ ItemHelp,
11
+ MiniProgress,
12
+ RewardChip,
13
+ RewardRing,
14
+ Segments,
15
+ StepCircle,
16
+ useClassNames,
17
+ type ClassNameOverrides,
18
+ } from "./bits.js";
19
+ import { SETUP_BAND_STYLE } from "./class-names.js";
20
+ import { rewardWord, useSetupGuide, type SetupGuideState } from "./context.js";
21
+ import type { GuideItem, GuideStep } from "./guide.js";
22
+
23
+ /** Replaces an item's — or one step's — default action, by its key. */
24
+ export type SetupActions = Partial<Record<string, React.ReactNode>>;
25
+
26
+ export interface SetupCardProps {
27
+ /**
28
+ * `full` leads a page that has little else on it: the band with what has been
29
+ * earned, and every item as a row. `compact` is one band above the day's work
30
+ * once the account has some, showing progress and what is next.
31
+ */
32
+ variant: "full" | "compact";
33
+ title: string;
34
+ lead: string;
35
+ /** Extra words under the progress in the band. */
36
+ aside?: React.ReactNode;
37
+ actions?: SetupActions;
38
+ /** An item whose steps are done on this very page, listed inside its row. */
39
+ inlineItemKey?: string;
40
+ /** What to show when there is no guide to draw — hidden, or an account without one. */
41
+ fallback?: React.ReactNode;
42
+ /** Shown when every step is done and paid, e.g. a link to what was earned. */
43
+ completeAction?: React.ReactNode;
44
+ /** How long the whole thing takes, if the app wants to promise. */
45
+ timeNote?: string;
46
+ /** A line about what the reward is for, under the ring. */
47
+ rewardNote?: string;
48
+ /** Replaces the band's background outright. `{}` falls back to the card's own. */
49
+ bandStyle?: React.CSSProperties;
50
+ className?: string;
51
+ classNames?: ClassNameOverrides;
52
+ }
53
+
54
+ export function SetupCard({
55
+ variant,
56
+ title,
57
+ lead,
58
+ aside,
59
+ actions = {},
60
+ inlineItemKey,
61
+ fallback = null,
62
+ completeAction,
63
+ timeNote,
64
+ rewardNote,
65
+ bandStyle = SETUP_BAND_STYLE,
66
+ className,
67
+ classNames,
68
+ }: SetupCardProps) {
69
+ const setup = useSetupGuide();
70
+ const c = useClassNames(classNames);
71
+ const guide = setup?.guide;
72
+ if (!setup || !guide || guide.hidden) return <>{fallback}</>;
73
+
74
+ const words = setup.words;
75
+
76
+ if (guide.complete) {
77
+ return (
78
+ <section
79
+ className={cx(
80
+ "flex flex-col items-start gap-4 rounded-2xl p-5 text-white sm:flex-row sm:items-center sm:p-6",
81
+ className,
82
+ )}
83
+ style={bandStyle}
84
+ >
85
+ <span className="flex size-12 shrink-0 items-center justify-center rounded-2xl bg-white/10 text-emerald-300">
86
+ <Trophy className="size-6" aria-hidden />
87
+ </span>
88
+ <div className="min-w-0 flex-1">
89
+ <p className="text-lg font-bold tracking-tight">You&apos;re all set up</p>
90
+ <p className="mt-1 text-sm text-slate-300">
91
+ All {guide.totalReward} {rewardWord(guide.totalReward, words)} are in your account.
92
+ </p>
93
+ </div>
94
+ <div className="flex items-center gap-2">
95
+ {completeAction}
96
+ <HideButton setup={setup} className={c.bandQuietButton} label="Hide this" />
97
+ </div>
98
+ </section>
99
+ );
100
+ }
101
+
102
+ const left = guide.totalReward - guide.earnedReward;
103
+ const next = guide.items.find((item) => item.key === guide.nextKey) ?? null;
104
+
105
+ if (variant === "compact") {
106
+ return (
107
+ <section
108
+ aria-label="Get started"
109
+ className={cx("@container rounded-2xl p-4 text-white sm:p-5", className)}
110
+ style={bandStyle}
111
+ >
112
+ <div className="flex flex-col gap-4 @4xl:flex-row @4xl:items-center @4xl:gap-5">
113
+ <div className="flex items-center gap-4 @4xl:contents">
114
+ <RewardRing
115
+ earned={guide.earnedReward}
116
+ total={guide.totalReward}
117
+ size={64}
118
+ words={words}
119
+ classNames={classNames}
120
+ />
121
+ <div className="flex min-w-0 flex-1 flex-col gap-1.5 @4xl:w-60 @4xl:flex-none">
122
+ <p className="text-[15px] font-semibold">
123
+ Get started · {guide.doneItems} of {guide.items.length} steps done
124
+ </p>
125
+ <p className="text-[13px] text-slate-300">
126
+ {left} more {rewardWord(left, words)} to earn
127
+ </p>
128
+ <Segments done={guide.doneItems} total={guide.items.length} classNames={classNames} />
129
+ </div>
130
+ </div>
131
+ <span className="hidden w-px self-stretch bg-white/10 @4xl:block" aria-hidden />
132
+ {next ? (
133
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
134
+ <p className="text-[11px] font-bold tracking-[0.14em] text-slate-400 uppercase">Next up</p>
135
+ <p className="flex flex-wrap items-center gap-2.5 text-[15px] font-semibold">
136
+ {next.title}
137
+ <RewardChip
138
+ reward={next.reward - next.earnedReward}
139
+ tone="dark"
140
+ words={words}
141
+ classNames={classNames}
142
+ />
143
+ </p>
144
+ <p className="text-[13px] text-slate-300">
145
+ {next.steps.length > 1 ? `${next.doneCount} of ${next.steps.length} done. ` : ""}
146
+ {next.description}
147
+ </p>
148
+ </div>
149
+ ) : (
150
+ <p className="flex-1 text-sm text-slate-300">Every step you can do now is done — the rest follow on.</p>
151
+ )}
152
+ <div className="flex flex-wrap items-center gap-2">
153
+ {next ? (actions[next.key] ?? <ItemLink item={next} variant="primary" classNames={classNames} />) : null}
154
+ <button type="button" onClick={() => setup.setPanelOpen(true)} className={cx(c.button, c.bandQuietButton)}>
155
+ All steps
156
+ </button>
157
+ </div>
158
+ </div>
159
+ </section>
160
+ );
161
+ }
162
+
163
+ return (
164
+ <section aria-label="Get started" className={cx(c.card, "@container", className)}>
165
+ <div className="flex flex-col @3xl:flex-row">
166
+ <div className={cx(c.band, "@3xl:w-[340px] @3xl:shrink-0 @5xl:w-[380px]")} style={bandStyle}>
167
+ <p className={c.bandEyebrow}>Get started</p>
168
+ <h2 className={c.bandTitle}>{title}</h2>
169
+ <p className={c.bandLead}>{lead}</p>
170
+ <div className="mt-7 flex items-center gap-4">
171
+ <RewardRing earned={guide.earnedReward} total={guide.totalReward} words={words} classNames={classNames} />
172
+ <div className="min-w-0">
173
+ <p className="flex items-center gap-1.5 text-sm font-semibold">
174
+ <Sparkles className="size-4" aria-hidden />
175
+ {rewardWord(2, words)} earned
176
+ </p>
177
+ {rewardNote ? <p className={cx("mt-1 text-[12.5px] leading-normal", c.bandMuted)}>{rewardNote}</p> : null}
178
+ </div>
179
+ </div>
180
+ <div className="mt-6 flex flex-col gap-2">
181
+ <div className="flex justify-between gap-2 text-xs text-slate-300">
182
+ <span>
183
+ {guide.doneItems} of {guide.items.length} steps done
184
+ </span>
185
+ {timeNote ? <span className={c.bandMuted}>{timeNote}</span> : null}
186
+ </div>
187
+ <Segments done={guide.doneItems} total={guide.items.length} classNames={classNames} />
188
+ </div>
189
+ {aside}
190
+ <div className="mt-auto flex flex-wrap items-center gap-x-5 gap-y-2 pt-7 text-sm">
191
+ <HideButton setup={setup} className={c.bandQuietButton} label="Hide for now" />
192
+ </div>
193
+ </div>
194
+ <div className={cx(c.panel, "@container/steps")}>
195
+ <div className="flex items-baseline justify-between gap-2 px-3 pb-2 sm:px-4">
196
+ <h3 className={c.panelHeading}>Your setup steps</h3>
197
+ <p className={c.panelNote}>
198
+ {left} {rewardWord(left, words)} to earn
199
+ </p>
200
+ </div>
201
+ <ol>
202
+ {guide.items.map((item, index) => (
203
+ <ItemRow
204
+ key={item.key}
205
+ item={item}
206
+ index={index}
207
+ isNext={item.key === guide.nextKey}
208
+ action={actions[item.key]}
209
+ inline={item.key === inlineItemKey}
210
+ actions={actions}
211
+ classNames={classNames}
212
+ />
213
+ ))}
214
+ </ol>
215
+ </div>
216
+ </div>
217
+ </section>
218
+ );
219
+ }
220
+
221
+ function HideButton({ setup, className, label }: { setup: SetupGuideState; className: string; label: string }) {
222
+ if (setup.readOnly) return null;
223
+ return (
224
+ <button type="button" onClick={() => void setup.setHidden(true)} className={className}>
225
+ {label}
226
+ </button>
227
+ );
228
+ }
229
+
230
+ function ItemLink({
231
+ item,
232
+ variant,
233
+ classNames,
234
+ }: {
235
+ item: GuideItem;
236
+ variant: "primary" | "outline";
237
+ classNames?: ClassNameOverrides;
238
+ }) {
239
+ const c = useClassNames(classNames);
240
+ const setup = useSetupGuide();
241
+ const Link = setup?.Link ?? (({ children, ...rest }) => <a {...rest}>{children}</a>);
242
+ return (
243
+ <Link href={item.href} className={cx(c.button, variant === "primary" ? c.buttonPrimary : c.buttonOutline)}>
244
+ {item.actionLabel}
245
+ {variant === "primary" ? <ArrowRight className="size-4" aria-hidden /> : null}
246
+ </Link>
247
+ );
248
+ }
249
+
250
+ function ItemRow({
251
+ item,
252
+ index,
253
+ isNext,
254
+ action,
255
+ inline,
256
+ actions,
257
+ classNames,
258
+ }: {
259
+ item: GuideItem;
260
+ index: number;
261
+ isNext: boolean;
262
+ action: React.ReactNode;
263
+ inline: boolean;
264
+ actions: SetupActions;
265
+ classNames?: ClassNameOverrides;
266
+ }) {
267
+ const c = useClassNames(classNames);
268
+ const setup = useSetupGuide();
269
+ const words = setup?.words ?? { one: "credit", many: "credits" };
270
+ const state = item.done ? "done" : isNext ? "next" : "todo";
271
+ const paid = item.steps.length > 0 && item.steps.every((step) => step.earned);
272
+
273
+ const button = item.done ? null : item.blocked ? (
274
+ <span className={c.blocked}>{item.blocked}</span>
275
+ ) : isNext ? (
276
+ (action ?? <ItemLink item={item} variant="primary" classNames={classNames} />)
277
+ ) : inline ? null : (
278
+ (action ?? <ItemLink item={item} variant="outline" classNames={classNames} />)
279
+ );
280
+
281
+ return (
282
+ <li className={cx(c.row, isNext && c.rowNext, "@xl/steps:grid-cols-[auto_minmax(0,1fr)_auto]")}>
283
+ <StepCircle state={state} n={index + 1} className="mt-0.5 @xl/steps:row-span-2" classNames={classNames} />
284
+ <div className="min-w-0">
285
+ <div className="flex flex-wrap items-center gap-x-2.5 gap-y-1">
286
+ <p className={cx(c.rowTitle, item.done && c.rowTitleDone)}>
287
+ {item.title}
288
+ <span className={c.srOnly}>{item.done ? " (done)" : " (to do)"}</span>
289
+ </p>
290
+ {item.steps.length > 1 ? <MiniProgress done={item.doneCount} total={item.steps.length} /> : null}
291
+ </div>
292
+ {item.description ? <p className={c.rowDescription}>{item.description}</p> : null}
293
+ {inline && item.steps.length > 1 ? (
294
+ <ul className="mt-2">
295
+ {item.steps.map((step) => (
296
+ <SubStepRow
297
+ key={step.key}
298
+ step={step}
299
+ action={actions[step.key] ?? <StepLink step={step} href={item.href} classNames={classNames} />}
300
+ classNames={classNames}
301
+ />
302
+ ))}
303
+ </ul>
304
+ ) : null}
305
+ {isNext && button ? <div className="mt-3 flex flex-wrap items-center gap-3">{button}</div> : null}
306
+ </div>
307
+ <div className="col-start-2 flex flex-wrap items-center gap-1 @xl/steps:col-start-3 @xl/steps:row-start-1 @xl/steps:justify-end">
308
+ {item.reward > 0 ? (
309
+ <RewardChip reward={item.reward} state={paid ? "earned" : "todo"} words={words} classNames={classNames} />
310
+ ) : null}
311
+ {item.done ? null : <ItemHelp item={item} classNames={classNames} />}
312
+ {!isNext && button ? <span className="ml-2 flex">{button}</span> : null}
313
+ </div>
314
+ </li>
315
+ );
316
+ }
317
+
318
+ function StepLink({ step, href, classNames }: { step: GuideStep; href: string; classNames?: ClassNameOverrides }) {
319
+ const c = useClassNames(classNames);
320
+ const setup = useSetupGuide();
321
+ const Link = setup?.Link ?? (({ children, ...rest }) => <a {...rest}>{children}</a>);
322
+ return (
323
+ <Link href={href} className={cx(c.button, step.done ? c.buttonQuiet : c.buttonOutline)}>
324
+ {step.done ? "Edit" : "Add"}
325
+ </Link>
326
+ );
327
+ }
328
+
329
+ function SubStepRow({
330
+ step,
331
+ action,
332
+ classNames,
333
+ }: {
334
+ step: GuideStep;
335
+ action: React.ReactNode;
336
+ classNames?: ClassNameOverrides;
337
+ }) {
338
+ const c = useClassNames(classNames);
339
+ return (
340
+ <li className={c.subRow}>
341
+ <StepCircle state={step.done ? "done" : "todo"} size="sm" classNames={classNames} />
342
+ <p className={cx("min-w-0 flex-1 text-sm font-medium", step.done && c.rowTitleDone)}>
343
+ {step.title}
344
+ <span className={c.srOnly}>{step.done ? " (done)" : " (to do)"}</span>
345
+ </p>
346
+ {step.reward > 0 ? (
347
+ <RewardChip reward={step.reward} state={step.earned ? "earned" : "todo"} classNames={classNames} />
348
+ ) : null}
349
+ {step.done ? null : (
350
+ <span className="inline-flex items-center">
351
+ {step.how ? <HowToButton how={step.how} guide={step.guide} classNames={classNames} /> : null}
352
+ <GuideIconLink guide={step.guide} classNames={classNames} />
353
+ </span>
354
+ )}
355
+ <span className="flex min-w-16 justify-end">{action}</span>
356
+ </li>
357
+ );
358
+ }
@@ -0,0 +1,144 @@
1
+ /**
2
+ * The house look, on the shared theme tokens. Every part an app might want to
3
+ * say differently is a key here, and `classNames` replaces the ones it names —
4
+ * the same bargain the wizard and the guide renderer offer.
5
+ *
6
+ * The one part that is not a class is the dark band behind the progress: it is
7
+ * a gradient over a token, so it is a style object (`bandStyle`) an app can
8
+ * replace outright. AltEd lights its evergreen ink from two corners; an app
9
+ * with no ink colour can pass `{}` and get the card's own background.
10
+ */
11
+ export interface SetupGuideClassNames {
12
+ card: string;
13
+ band: string;
14
+ bandEyebrow: string;
15
+ bandTitle: string;
16
+ bandLead: string;
17
+ bandMuted: string;
18
+ bandLink: string;
19
+ bandQuietButton: string;
20
+ panel: string;
21
+ panelHeading: string;
22
+ panelNote: string;
23
+ row: string;
24
+ rowNext: string;
25
+ rowTitle: string;
26
+ rowTitleDone: string;
27
+ rowDescription: string;
28
+ subRow: string;
29
+ circle: string;
30
+ circleDone: string;
31
+ circleNext: string;
32
+ circleReady: string;
33
+ circleTodo: string;
34
+ chip: string;
35
+ chipEarned: string;
36
+ chipOnComplete: string;
37
+ chipDark: string;
38
+ bar: string;
39
+ barFill: string;
40
+ segment: string;
41
+ segmentDone: string;
42
+ segmentDoneDark: string;
43
+ segmentTodo: string;
44
+ segmentTodoDark: string;
45
+ button: string;
46
+ buttonPrimary: string;
47
+ buttonOutline: string;
48
+ buttonQuiet: string;
49
+ iconButton: string;
50
+ popover: string;
51
+ popoverTitle: string;
52
+ popoverStep: string;
53
+ popoverNumber: string;
54
+ popoverFooter: string;
55
+ strip: string;
56
+ stripTitle: string;
57
+ stripSummary: string;
58
+ stripTile: string;
59
+ stripTileNext: string;
60
+ launcher: string;
61
+ launcherChip: string;
62
+ launcherBadge: string;
63
+ /** The disc inside the progress ring, which sits on whatever the ring is drawn over. */
64
+ ringFace: string;
65
+ ringFaceLight: string;
66
+ blocked: string;
67
+ srOnly: string;
68
+ }
69
+
70
+ export const SETUP_GUIDE_CLASS_NAMES: SetupGuideClassNames = {
71
+ card: "overflow-hidden rounded-2xl border border-border bg-card shadow-sm",
72
+ band: "flex flex-col p-6 text-white sm:p-8",
73
+ bandEyebrow: "text-xs font-bold tracking-[0.14em] text-emerald-300 uppercase",
74
+ bandTitle: "mt-3.5 text-2xl leading-tight font-bold tracking-tight text-balance",
75
+ bandLead: "mt-3 text-sm leading-relaxed text-slate-300",
76
+ bandMuted: "text-slate-400",
77
+ bandLink: "font-medium text-emerald-300 underline-offset-4 hover:underline",
78
+ bandQuietButton:
79
+ "text-slate-400 hover:text-white focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
80
+ panel: "min-w-0 flex-1 p-3 sm:p-5",
81
+ panelHeading: "text-sm font-semibold",
82
+ panelNote: "text-xs text-muted-foreground",
83
+ row: "grid grid-cols-[auto_minmax(0,1fr)] gap-x-3.5 gap-y-2 border-b border-border px-3 py-3.5 last:border-b-0 sm:px-4",
84
+ rowNext: "my-1 rounded-xl border border-primary/25 bg-primary/5 px-3 py-4 sm:px-4",
85
+ rowTitle: "text-[15px] font-semibold",
86
+ rowTitleDone: "text-muted-foreground",
87
+ rowDescription: "mt-1 max-w-xl text-[13px] leading-normal text-muted-foreground",
88
+ subRow: "flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-border py-2.5",
89
+ circle: "flex shrink-0 items-center justify-center rounded-full text-xs font-semibold tabular-nums",
90
+ circleDone: "bg-primary text-primary-foreground",
91
+ circleNext: "bg-primary text-primary-foreground ring-4 ring-primary/15",
92
+ circleReady: "border-[1.5px] border-primary bg-background text-primary",
93
+ circleTodo: "border-[1.5px] border-muted-foreground/40 bg-background text-muted-foreground",
94
+ chip: "inline-flex h-6 shrink-0 items-center gap-1 rounded-full border border-primary/30 bg-primary/10 px-2 text-xs font-semibold whitespace-nowrap tabular-nums text-primary",
95
+ chipEarned:
96
+ "inline-flex h-6 shrink-0 items-center gap-1 px-0.5 text-xs font-semibold whitespace-nowrap tabular-nums text-primary",
97
+ chipOnComplete: "border-dashed border-primary/50 bg-background",
98
+ chipDark: "border-white/35 bg-white/10 text-white",
99
+ bar: "h-2 w-full overflow-hidden rounded-full bg-secondary",
100
+ barFill: "h-full rounded-full bg-primary transition-[width]",
101
+ segment: "h-1.5 flex-1 rounded-full",
102
+ segmentDone: "bg-primary",
103
+ segmentDoneDark: "bg-emerald-300",
104
+ segmentTodo: "bg-secondary",
105
+ segmentTodoDark: "bg-white/15",
106
+ button:
107
+ "inline-flex items-center gap-1.5 rounded-md px-3 py-2 text-sm font-medium transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none disabled:pointer-events-none disabled:opacity-60",
108
+ buttonPrimary: "bg-primary text-primary-foreground hover:bg-primary/90",
109
+ buttonOutline: "border border-border hover:bg-muted",
110
+ buttonQuiet: "text-muted-foreground hover:bg-muted hover:text-foreground",
111
+ iconButton:
112
+ "inline-flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
113
+ popover:
114
+ "absolute right-0 z-50 mt-1 w-80 rounded-lg border border-border bg-popover p-4 text-popover-foreground shadow-lg",
115
+ popoverTitle: "text-sm font-semibold",
116
+ popoverStep: "flex gap-2.5 text-[13px] leading-normal",
117
+ popoverNumber:
118
+ "mt-px flex size-5 shrink-0 items-center justify-center rounded-full bg-secondary text-[11px] font-bold text-secondary-foreground",
119
+ popoverFooter: "mt-3.5 flex items-center justify-between gap-2 border-t border-border pt-3",
120
+ strip: "rounded-2xl border border-border bg-card px-4 py-4 shadow-sm sm:px-5",
121
+ stripTitle: "text-[15px] font-semibold",
122
+ stripSummary: "text-[13px] text-muted-foreground",
123
+ stripTile: "flex min-h-[6.5rem] flex-col gap-2 rounded-xl border border-border bg-background p-3",
124
+ stripTileNext: "border-primary/35 bg-primary/5",
125
+ launcher:
126
+ "relative inline-flex h-9 shrink-0 items-center gap-2 rounded-full border border-border bg-background py-0 pr-2.5 pl-1.5 text-[13px] font-semibold shadow-sm transition-colors hover:border-primary/40 hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
127
+ launcherChip:
128
+ "inline-flex h-[22px] items-center gap-1 rounded-full border border-primary/30 bg-primary/10 px-1.5 text-xs text-primary tabular-nums",
129
+ ringFace: "bg-[#0e2f27] text-white",
130
+ ringFaceLight: "bg-card text-foreground",
131
+ launcherBadge:
132
+ "absolute -top-3 -right-2 rounded-full bg-primary px-1.5 py-0.5 text-xs leading-none font-semibold text-primary-foreground shadow-md",
133
+ blocked: "px-1.5 text-xs text-muted-foreground",
134
+ srOnly: "sr-only",
135
+ };
136
+
137
+ /** The dark band's background. Replaceable outright; `{}` falls back to the card. */
138
+ export const SETUP_BAND_STYLE: Record<string, string> = {
139
+ background: [
140
+ "radial-gradient(120% 70% at 0% 0%, color-mix(in oklab, var(--primary) 22%, transparent), transparent 55%)",
141
+ "radial-gradient(90% 60% at 100% 100%, color-mix(in oklab, var(--primary) 12%, transparent), transparent 60%)",
142
+ "#0e2f27",
143
+ ].join(", "),
144
+ };