@spunto/design-system 0.61.0 → 0.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spunto/design-system",
3
- "version": "0.61.0",
3
+ "version": "0.62.0",
4
4
  "description": "Spunto's shared design system — green tokens (conservatory + sprout), color constants, and UI primitives.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -0,0 +1,76 @@
1
+ "use client"
2
+
3
+ // What an app installed in the organization says about the links a conversation shared (capability
4
+ // `embed`, RFC 0053) — GitHub: each pull request, and where it stands. Drawn here, with our
5
+ // components, from data the app returned: an app never sends markup, nor a color — it names a
6
+ // tone, and the tone is painted with the status tokens every other block uses.
7
+
8
+ import { ExternalLinkIcon } from "lucide-react"
9
+
10
+ import { cn } from "../../utils"
11
+ import type { TaskAppTileItem, TaskAppTileTone } from "./types"
12
+
13
+ const TONE_TEXT: Record<TaskAppTileTone, string> = {
14
+ neutral: "text-muted-foreground",
15
+ info: "text-info",
16
+ success: "text-success",
17
+ warning: "text-warning",
18
+ danger: "text-destructive",
19
+ muted: "text-muted-foreground/70",
20
+ }
21
+
22
+ const TONE_CHIP: Record<TaskAppTileTone, string> = {
23
+ neutral: "bg-muted text-muted-foreground border-border",
24
+ info: "bg-info/12 text-info border-info/30",
25
+ success: "bg-success/12 text-success border-success/30",
26
+ warning: "bg-warning/15 text-warning-foreground border-warning/40 dark:text-warning",
27
+ danger: "bg-destructive/10 text-destructive border-destructive/30",
28
+ muted: "bg-muted/60 text-muted-foreground border-border/60",
29
+ }
30
+
31
+ /** The rows of one app's block, one card each — the same card as the branch's own pull request. */
32
+ export function TaskAppTileItems({ items, className }: { items: TaskAppTileItem[]; className?: string }) {
33
+ if (items.length === 0) return null
34
+ return (
35
+ <ul className={cn("space-y-1.5", className)}>
36
+ {items.map((item) => (
37
+ <li key={item.url}>
38
+ <a
39
+ href={item.url}
40
+ target="_blank"
41
+ rel="noreferrer"
42
+ title={item.url}
43
+ className="group block rounded-md border border-border/60 bg-background/60 px-2.5 py-2 transition-colors hover:border-border hover:bg-muted/40"
44
+ >
45
+ <div className="flex min-w-0 items-center gap-1.5">
46
+ {item.status && (
47
+ <span
48
+ className={cn(
49
+ "inline-flex h-5 shrink-0 items-center rounded-sm border px-1.5 text-[10px] font-medium",
50
+ TONE_CHIP[item.status.tone],
51
+ )}
52
+ >
53
+ {item.status.label}
54
+ </span>
55
+ )}
56
+ {item.label && <span className="shrink-0 font-mono text-[11px] text-muted-foreground">{item.label}</span>}
57
+ {item.subtitle && <span className="min-w-0 truncate font-mono text-[10px] text-muted-foreground">{item.subtitle}</span>}
58
+ <ExternalLinkIcon className="ml-auto h-3 w-3 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100" />
59
+ </div>
60
+ <p className="mt-1.5 line-clamp-2 text-xs leading-snug">{item.title}</p>
61
+ {item.badges && item.badges.length > 0 && (
62
+ <div className="mt-1.5 flex flex-wrap items-center gap-x-2.5 gap-y-1">
63
+ {item.badges.map((badge) => (
64
+ <span key={badge.label} className={cn("inline-flex items-center gap-1 text-[10px]", TONE_TEXT[badge.tone])}>
65
+ <span className="h-1.5 w-1.5 rounded-full bg-current" />
66
+ {badge.label}
67
+ </span>
68
+ ))}
69
+ </div>
70
+ )}
71
+ </a>
72
+ </li>
73
+ ))}
74
+ </ul>
75
+ )
76
+ }
@@ -87,6 +87,7 @@ export { TaskTerminalPanel } from "./terminal-panel"
87
87
  export type { TaskTerminalPanelProps } from "./terminal-panel"
88
88
  export { TaskPullRequest } from "./pull-request"
89
89
  export { TaskSharedFiles, TaskSharedLinks } from "./shared"
90
+ export { TaskAppTileItems } from "./app-tiles"
90
91
  export { TaskSessionUsage, formatCost, formatTokens } from "./session-usage"
91
92
  export { TaskCommandLog } from "./command-log"
92
93
  export { TaskBoot, TaskMachine, bootSteps, workerLabel } from "./machine"
@@ -97,6 +98,9 @@ export type { TaskBootLogs, TaskBootProps, TaskBootStep, TaskMachineProps, TaskM
97
98
  export type {
98
99
  AttachmentUrl,
99
100
  DraftFile,
101
+ TaskAppTile,
102
+ TaskAppTileItem,
103
+ TaskAppTileTone,
100
104
  PendingMessage,
101
105
  TaskDraft,
102
106
  TaskCommand,
@@ -21,8 +21,9 @@ import { TaskCommandLog } from "./command-log"
21
21
  import { TaskPullRequest } from "./pull-request"
22
22
  import { TaskSessionUsage } from "./session-usage"
23
23
  import { TaskSharedFiles, TaskSharedLinks } from "./shared"
24
+ import { TaskAppTileItems } from "./app-tiles"
24
25
  import { isLiveTaskState, taskSpan } from "./task-state"
25
- import type { AttachmentUrl, TaskCommand, TaskItem, TaskPendingAction, TaskPullRequests, TaskSessionUsageData, TaskSharedData } from "./types"
26
+ import type { AttachmentUrl, TaskAppTile, TaskCommand, TaskItem, TaskPendingAction, TaskPullRequests, TaskSessionUsageData, TaskSharedData } from "./types"
26
27
 
27
28
  /** Set by `TaskCockpitMobile` around its sheet, so Drop can close it. @internal */
28
29
  export const TaskDetailsSheetContext = createContext<{ close: () => void } | null>(null)
@@ -40,6 +41,11 @@ export interface TaskDetailsProps {
40
41
  * own block, absent while empty. Files need `attachmentUrl` to be drawn.
41
42
  */
42
43
  shared?: TaskSharedData | null
44
+ /**
45
+ * What the organization's apps say about the shared links (`GET .../tiles`, RFC 0053) — GitHub:
46
+ * the pull requests, and where each stands. One block per app, absent when it has nothing.
47
+ */
48
+ appTiles?: TaskAppTile[] | null
43
49
  attachmentUrl?: AttachmentUrl
44
50
  /** The Machine block's content — typically a `TaskMachine`. */
45
51
  machine?: ReactNode
@@ -131,6 +137,7 @@ export function TaskDetails({
131
137
  usage,
132
138
  pullRequests,
133
139
  shared,
140
+ appTiles,
134
141
  attachmentUrl,
135
142
  machine,
136
143
  commands = [],
@@ -226,6 +233,14 @@ export function TaskDetails({
226
233
  </Block>
227
234
  )}
228
235
 
236
+ {/* Right under the branch's own PR: what the org's apps make of the links the conversation
237
+ shared — the other pull requests it talked about, with where each one stands. */}
238
+ {appTiles?.map((tile) => (
239
+ <Block key={tile.appId} variant={variant} title={tile.title} hint={tile.appName}>
240
+ <TaskAppTileItems items={tile.items} />
241
+ </Block>
242
+ ))}
243
+
229
244
  {/* After the PR, before the machine: what the conversation handed over is what a reader
230
245
  comes back for — the preview URL, the doc pasted at the start, the screenshot. */}
231
246
  {shared && shared.links.length > 0 && (
@@ -262,6 +262,30 @@ export interface TaskSharedData {
262
262
  files: TaskSharedFile[]
263
263
  }
264
264
 
265
+ /** A meaning an app gives a status; the design system picks the color (RFC 0053). */
266
+ export type TaskAppTileTone = "neutral" | "info" | "success" | "warning" | "danger" | "muted"
267
+
268
+ /** One row of an app's block: a thing it recognized in a shared link, and where it stands. */
269
+ export interface TaskAppTileItem {
270
+ url: string
271
+ title: string
272
+ /** « #262 » */
273
+ label?: string
274
+ /** « coderhammer/spunto » */
275
+ subtitle?: string
276
+ status?: { label: string; tone: TaskAppTileTone }
277
+ badges?: { label: string; tone: TaskAppTileTone }[]
278
+ }
279
+
280
+ /** What an app draws in a task's details (`GET .../tiles`, capability `embed`). */
281
+ export interface TaskAppTile {
282
+ appId: string
283
+ appName: string
284
+ /** The block's heading — « Pull requests ». */
285
+ title: string
286
+ items: TaskAppTileItem[]
287
+ }
288
+
265
289
  // ── Machine ──────────────────────────────────────────────────────────────────────────────────
266
290
 
267
291
  /** The node a task's worker lives on. */