@spunto/design-system 0.35.1 → 0.37.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
package/src/brand/logo.test.tsx
CHANGED
|
@@ -49,4 +49,21 @@ describe("SpuntoLogo", () => {
|
|
|
49
49
|
expect(spuntoLogoShapes("mark")).toHaveLength(3)
|
|
50
50
|
expect(spuntoLogoShapes("glyph")).toHaveLength(3 + 3 + 3 + 3 + 4)
|
|
51
51
|
})
|
|
52
|
+
|
|
53
|
+
it("draws the same shapes when working, only alive", () => {
|
|
54
|
+
const still = attrs(renderToStaticMarkup(<SpuntoLogo tone="pillars" />))
|
|
55
|
+
const alive = renderToStaticMarkup(<SpuntoLogo tone="pillars" working />)
|
|
56
|
+
const strip = ({ tag, x, y, width, height, rx, cx, cy, r, d, fill }: Record<string, string>) =>
|
|
57
|
+
({ tag, x, y, width, height, rx, cx, cy, r, d, fill })
|
|
58
|
+
expect(attrs(alive).map(strip)).toEqual(still.map(strip))
|
|
59
|
+
expect(alive).toContain("data-working")
|
|
60
|
+
// Every pillar on the wave, each at its own place on the lap.
|
|
61
|
+
const delays = [...alive.matchAll(/animation-delay:(-?[\d.]+)s/g)].map(([, d]) => d)
|
|
62
|
+
expect(delays).toHaveLength(13)
|
|
63
|
+
expect(new Set(delays).size).toBe(13)
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
it("stays still by default", () => {
|
|
67
|
+
expect(renderToStaticMarkup(<SpuntoLogo />)).not.toContain("data-working")
|
|
68
|
+
})
|
|
52
69
|
})
|
|
@@ -43,27 +43,93 @@ export interface SpuntoLogoProps extends Omit<SVGProps<SVGSVGElement>, "children
|
|
|
43
43
|
* SVG is hidden from assistive tech.
|
|
44
44
|
*/
|
|
45
45
|
title?: string
|
|
46
|
+
/**
|
|
47
|
+
* Draw it alive — for "something is happening right now" (an agent session
|
|
48
|
+
* working, say). The S turns half a turn, which lands it back on itself (its
|
|
49
|
+
* two brackets are 180° twins); the container breathes; and a wave of light
|
|
50
|
+
* runs round the pillars in the order of the story — Build, Ship, Run, then
|
|
51
|
+
* the fleet that sits over all of it. Off under `prefers-reduced-motion`.
|
|
52
|
+
* The keyframes live in `styles.css`.
|
|
53
|
+
*/
|
|
54
|
+
working?: boolean
|
|
46
55
|
}
|
|
47
56
|
|
|
48
57
|
const INK: SpuntoLogoPaint = { ink: "currentColor" }
|
|
49
58
|
|
|
50
|
-
|
|
59
|
+
type ShapeAttrs = Pick<SVGProps<SVGElement>, "className" | "style">
|
|
60
|
+
|
|
61
|
+
function Shape({ shape, fill, ...attrs }: { shape: SpuntoLogoShape; fill: string } & ShapeAttrs) {
|
|
51
62
|
switch (shape.kind) {
|
|
52
63
|
case "rect":
|
|
53
|
-
return <rect x={shape.x} y={shape.y} width={shape.w} height={shape.h} rx={shape.rx} fill={fill} />
|
|
64
|
+
return <rect x={shape.x} y={shape.y} width={shape.w} height={shape.h} rx={shape.rx} fill={fill} {...attrs} />
|
|
54
65
|
case "circle":
|
|
55
|
-
return <circle cx={shape.cx} cy={shape.cy} r={shape.r} fill={fill} />
|
|
66
|
+
return <circle cx={shape.cx} cy={shape.cy} r={shape.r} fill={fill} {...attrs} />
|
|
56
67
|
case "path":
|
|
57
|
-
return <path d={shape.d} fill={fill} />
|
|
68
|
+
return <path d={shape.d} fill={fill} {...attrs} />
|
|
58
69
|
}
|
|
59
70
|
}
|
|
60
71
|
|
|
72
|
+
/* The wave's route round the pillars: down the Build stack, along the belt,
|
|
73
|
+
up the Run lights, and back across the fleet — one loop, in story order,
|
|
74
|
+
that also happens to be a single counter-clockwise lap of the tile. */
|
|
75
|
+
const WAVE: Partial<Record<SpuntoLogoShape["role"], (n: number, count: number) => number>> = {
|
|
76
|
+
build: (n) => n,
|
|
77
|
+
ship: (n) => 3 + n,
|
|
78
|
+
run: (n, count) => 7 + (count - 1 - n),
|
|
79
|
+
fleet: (n, count) => 10 + (count - 1 - n),
|
|
80
|
+
}
|
|
81
|
+
const WAVE_LENGTH = 13
|
|
82
|
+
/** One lap of the wave, in seconds — `--spunto-logo-lap` in `styles.css`. */
|
|
83
|
+
const WAVE_LAP = 2.4
|
|
84
|
+
|
|
85
|
+
function WorkingShapes({ shapes, paint }: { shapes: SpuntoLogoShape[]; paint: SpuntoLogoPaint }) {
|
|
86
|
+
const fill = (s: SpuntoLogoShape) => spuntoLogoFill(paint, s.role) ?? paint.ink
|
|
87
|
+
const seen: Partial<Record<SpuntoLogoShape["role"], number>> = {}
|
|
88
|
+
const counts: Partial<Record<SpuntoLogoShape["role"], number>> = {}
|
|
89
|
+
for (const s of shapes) counts[s.role] = (counts[s.role] ?? 0) + 1
|
|
90
|
+
|
|
91
|
+
const tile = shapes.filter((s) => s.role === "tile")
|
|
92
|
+
const core = shapes.filter((s) => s.role === "core")
|
|
93
|
+
const pillars = shapes.filter((s) => s.role !== "tile" && s.role !== "core")
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<>
|
|
97
|
+
{tile.map((s, i) => (
|
|
98
|
+
<Shape key={`t${i}`} shape={s} fill={fill(s)} />
|
|
99
|
+
))}
|
|
100
|
+
<g data-slot="spunto-logo-core">
|
|
101
|
+
{core.map((s, i) => (
|
|
102
|
+
<Shape key={`c${i}`} shape={s} fill={fill(s)} {...dot(s)} />
|
|
103
|
+
))}
|
|
104
|
+
</g>
|
|
105
|
+
{pillars.map((s, i) => {
|
|
106
|
+
const n = seen[s.role] ?? 0
|
|
107
|
+
seen[s.role] = n + 1
|
|
108
|
+
const step = WAVE[s.role]?.(n, counts[s.role] ?? 1) ?? 0
|
|
109
|
+
return (
|
|
110
|
+
<Shape
|
|
111
|
+
key={`p${i}`}
|
|
112
|
+
shape={s}
|
|
113
|
+
fill={fill(s)}
|
|
114
|
+
className="spunto-logo-pillar"
|
|
115
|
+
style={{ animationDelay: `${((step / WAVE_LENGTH) * WAVE_LAP - WAVE_LAP).toFixed(3)}s` }}
|
|
116
|
+
/>
|
|
117
|
+
)
|
|
118
|
+
})}
|
|
119
|
+
</>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** The container dot breathes on its own, inside the turning S. */
|
|
124
|
+
const dot = (s: SpuntoLogoShape): ShapeAttrs => (s.kind === "circle" ? { className: "spunto-logo-dot" } : {})
|
|
125
|
+
|
|
61
126
|
export function SpuntoLogo({
|
|
62
127
|
variant = "glyph",
|
|
63
128
|
tone = "flame",
|
|
64
129
|
paint: overrides,
|
|
65
130
|
size,
|
|
66
131
|
title,
|
|
132
|
+
working = false,
|
|
67
133
|
className,
|
|
68
134
|
...rest
|
|
69
135
|
}: SpuntoLogoProps) {
|
|
@@ -79,12 +145,15 @@ export function SpuntoLogo({
|
|
|
79
145
|
className={cn("shrink-0", className)}
|
|
80
146
|
role={title ? "img" : undefined}
|
|
81
147
|
aria-hidden={title ? undefined : true}
|
|
148
|
+
data-working={working || undefined}
|
|
82
149
|
{...rest}
|
|
83
150
|
>
|
|
84
151
|
{title && <title>{title}</title>}
|
|
85
|
-
{
|
|
86
|
-
<
|
|
87
|
-
)
|
|
152
|
+
{working ? (
|
|
153
|
+
<WorkingShapes shapes={shapes} paint={paint} />
|
|
154
|
+
) : (
|
|
155
|
+
shapes.map((shape, i) => <Shape key={i} shape={shape} fill={spuntoLogoFill(paint, shape.role) ?? paint.ink} />)
|
|
156
|
+
)}
|
|
88
157
|
</svg>
|
|
89
158
|
)
|
|
90
159
|
}
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
WrenchIcon,
|
|
20
20
|
} from "lucide-react"
|
|
21
21
|
|
|
22
|
+
import { SpuntoLogo } from "../../brand"
|
|
22
23
|
import { cn } from "../../utils"
|
|
23
24
|
import { AgentMarkdown, renderInlineMarkdown } from "./agent-markdown"
|
|
24
25
|
import { TaskFiles, fileRefs } from "./task-attachments"
|
|
@@ -350,10 +351,18 @@ function PendingEntry({ text, previews = [] }: { text: string; previews?: string
|
|
|
350
351
|
)
|
|
351
352
|
}
|
|
352
353
|
|
|
354
|
+
/** The last row while the session can still move: the logo, alive. */
|
|
353
355
|
function WorkingEntry() {
|
|
354
356
|
return (
|
|
355
357
|
<Entry className="pb-0">
|
|
356
|
-
|
|
358
|
+
{/* The logo *is* the marker: its flame tile is opaque, so the rail stops behind it. */}
|
|
359
|
+
<SpuntoLogo
|
|
360
|
+
working
|
|
361
|
+
tone="flame"
|
|
362
|
+
size={24}
|
|
363
|
+
className="absolute left-0 top-0.5 -translate-x-1/2 shadow-sm"
|
|
364
|
+
data-slot="task-working"
|
|
365
|
+
/>
|
|
357
366
|
<p className="pt-1 text-[11px] text-muted-foreground">working…</p>
|
|
358
367
|
</Entry>
|
|
359
368
|
)
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// machine), then how it was set up.
|
|
15
15
|
|
|
16
16
|
import { createContext, useContext, useState, type ReactNode } from "react"
|
|
17
|
-
import { ChevronRightIcon, ExternalLinkIcon, GitBranchIcon, Loader2Icon, XCircleIcon } from "lucide-react"
|
|
17
|
+
import { CheckIcon, ChevronRightIcon, CopyIcon, ExternalLinkIcon, GitBranchIcon, Loader2Icon, XCircleIcon } from "lucide-react"
|
|
18
18
|
|
|
19
19
|
import { cn, formatRelativeTime } from "../../utils"
|
|
20
20
|
import { TaskCommandLog } from "./command-log"
|
|
@@ -55,6 +55,27 @@ function Fact({ label, children }: { label: string; children: ReactNode }) {
|
|
|
55
55
|
)
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/** The branch is what you type next (`git fetch`, `git checkout`), so it is one click from the clipboard. */
|
|
59
|
+
function CopyBranchButton({ branch }: { branch: string }) {
|
|
60
|
+
const [copied, setCopied] = useState(false)
|
|
61
|
+
return (
|
|
62
|
+
<button
|
|
63
|
+
type="button"
|
|
64
|
+
title={copied ? "Copied" : "Copy branch name"}
|
|
65
|
+
aria-label="Copy branch name"
|
|
66
|
+
onClick={() => {
|
|
67
|
+
navigator.clipboard?.writeText(branch).then(() => {
|
|
68
|
+
setCopied(true)
|
|
69
|
+
setTimeout(() => setCopied(false), 1500)
|
|
70
|
+
})
|
|
71
|
+
}}
|
|
72
|
+
className="mt-0.5 shrink-0 text-muted-foreground transition-colors hover:text-foreground"
|
|
73
|
+
>
|
|
74
|
+
{copied ? <CheckIcon className="h-3 w-3 text-emerald-600 dark:text-emerald-400" /> : <CopyIcon className="h-3 w-3" />}
|
|
75
|
+
</button>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
58
79
|
function Block({
|
|
59
80
|
variant,
|
|
60
81
|
title,
|
|
@@ -140,7 +161,8 @@ export function TaskDetails({
|
|
|
140
161
|
<Fact label="Branch">
|
|
141
162
|
<span className="flex items-start gap-1 font-mono break-all">
|
|
142
163
|
<GitBranchIcon className="mt-0.5 h-3 w-3 shrink-0 text-muted-foreground" />
|
|
143
|
-
{task.branch}
|
|
164
|
+
<span className="min-w-0">{task.branch}</span>
|
|
165
|
+
<CopyBranchButton branch={task.branch} />
|
|
144
166
|
</span>
|
|
145
167
|
</Fact>
|
|
146
168
|
</div>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { ReactNode } from "react"
|
|
9
9
|
import { describe, it, expect, vi } from "vitest"
|
|
10
|
-
import { render, screen, fireEvent } from "@testing-library/react"
|
|
10
|
+
import { render, screen, fireEvent, waitFor } from "@testing-library/react"
|
|
11
11
|
|
|
12
12
|
import { renderInlineMarkdown } from "./agent-markdown"
|
|
13
13
|
import { emptyCommandTerminalState, planCommandTerminalWrites } from "./command-terminal"
|
|
@@ -15,6 +15,7 @@ import { TaskComposer } from "./composer"
|
|
|
15
15
|
import { TaskBoot, bootSteps } from "./machine"
|
|
16
16
|
import { formatCost, formatTokens } from "./session-usage"
|
|
17
17
|
import { TaskCockpit } from "./task-cockpit"
|
|
18
|
+
import { TaskDetails } from "./task-details"
|
|
18
19
|
import { TaskList } from "./task-list"
|
|
19
20
|
import { taskSpan } from "./task-state"
|
|
20
21
|
import { TaskTitle } from "./task-title"
|
|
@@ -382,3 +383,14 @@ describe("TaskCockpit panels", () => {
|
|
|
382
383
|
expect(screen.getByText("session panel")).toBeTruthy()
|
|
383
384
|
})
|
|
384
385
|
})
|
|
386
|
+
|
|
387
|
+
describe("TaskDetails", () => {
|
|
388
|
+
it("copies the branch name from its icon", async () => {
|
|
389
|
+
const writeText = vi.fn().mockResolvedValue(undefined)
|
|
390
|
+
Object.defineProperty(navigator, "clipboard", { value: { writeText }, configurable: true })
|
|
391
|
+
render(<TaskDetails task={task()} />)
|
|
392
|
+
fireEvent.click(screen.getByRole("button", { name: "Copy branch name" }))
|
|
393
|
+
expect(writeText).toHaveBeenCalledWith("task/fix-login-a1b2c3")
|
|
394
|
+
await waitFor(() => expect(screen.getByTitle("Copied")).toBeTruthy())
|
|
395
|
+
})
|
|
396
|
+
})
|
package/styles.css
CHANGED
|
@@ -612,6 +612,49 @@
|
|
|
612
612
|
[data-slot="image-pull"] * { transition-duration: 0.01ms !important; }
|
|
613
613
|
}
|
|
614
614
|
|
|
615
|
+
/* ---------------------------------------------------------------------------
|
|
616
|
+
SpuntoLogo — working.
|
|
617
|
+
`<SpuntoLogo working />`: the S makes a half turn and settles (its brackets
|
|
618
|
+
are 180° twins, so every turn lands on the same drawing — it reads as a
|
|
619
|
+
flick, never a spinner), the container dot breathes, and a light runs round
|
|
620
|
+
the pillars in story order. The per-pillar delay is an inline style, since
|
|
621
|
+
it depends on the shape's place on the route; the lap is 2.4 s (keep it in
|
|
622
|
+
step with `WAVE_LAP` in `brand/spunto-logo.tsx`).
|
|
623
|
+
--------------------------------------------------------------------------- */
|
|
624
|
+
@keyframes spunto-logo-turn {
|
|
625
|
+
0%, 55% { transform: rotate(0deg); }
|
|
626
|
+
80% { transform: rotate(192deg); }
|
|
627
|
+
90%, 100% { transform: rotate(180deg); }
|
|
628
|
+
}
|
|
629
|
+
@keyframes spunto-logo-breathe {
|
|
630
|
+
0%, 100% { transform: scale(1); }
|
|
631
|
+
50% { transform: scale(0.72); }
|
|
632
|
+
}
|
|
633
|
+
@keyframes spunto-logo-wave {
|
|
634
|
+
0% { opacity: 1; transform: scale(1.35); }
|
|
635
|
+
18% { opacity: 1; transform: scale(1); }
|
|
636
|
+
45%, 100% { opacity: 0.3; transform: scale(0.8); }
|
|
637
|
+
}
|
|
638
|
+
svg[data-working] [data-slot="spunto-logo-core"] {
|
|
639
|
+
transform-origin: 64px 64px;
|
|
640
|
+
animation: spunto-logo-turn 2.4s cubic-bezier(0.5, 0, 0.3, 1) infinite;
|
|
641
|
+
}
|
|
642
|
+
svg[data-working] .spunto-logo-dot {
|
|
643
|
+
transform-box: fill-box;
|
|
644
|
+
transform-origin: center;
|
|
645
|
+
animation: spunto-logo-breathe 1.2s ease-in-out infinite;
|
|
646
|
+
}
|
|
647
|
+
svg[data-working] .spunto-logo-pillar {
|
|
648
|
+
transform-box: fill-box;
|
|
649
|
+
transform-origin: center;
|
|
650
|
+
animation: spunto-logo-wave 2.4s ease-out infinite;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
@media (prefers-reduced-motion: reduce) {
|
|
654
|
+
/* Standing still, the logo is just the logo — every pillar lit, the S at rest. */
|
|
655
|
+
svg[data-working] * { animation: none; }
|
|
656
|
+
}
|
|
657
|
+
|
|
615
658
|
/* ---------------------------------------------------------------------------
|
|
616
659
|
FormSection — entrance.
|
|
617
660
|
A long form arrives as a stack of cards; each one lifts in slightly after the
|