@flesler/cursor-canvas-web 1.0.2 → 1.1.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 (33) hide show
  1. package/README.md +9 -8
  2. package/dist/cursor-canvas.cjs +1 -1
  3. package/dist/cursor-canvas.js +571 -764
  4. package/dist/host-tokens-Cjzmp0z_.cjs +1 -0
  5. package/dist/host-tokens-Dh2BFFjv.js +412 -0
  6. package/dist/runtime/index.d.ts +5 -7
  7. package/dist/runtime.cjs +1 -1
  8. package/dist/runtime.js +101 -14
  9. package/package.json +21 -13
  10. package/src/vendor/canvas/SKILL.md +113 -0
  11. package/src/vendor/canvas-sdk/callout-tone-icons.d.ts +10 -0
  12. package/src/vendor/canvas-sdk/canvas-tokens.d.ts +259 -0
  13. package/src/vendor/canvas-sdk/chart-primitives.d.ts +272 -0
  14. package/src/vendor/canvas-sdk/collapsible-section.d.ts +66 -0
  15. package/src/vendor/canvas-sdk/dag-layout.d.ts +101 -0
  16. package/src/vendor/canvas-sdk/diff-view.d.ts +129 -0
  17. package/src/vendor/canvas-sdk/form-primitives.d.ts +194 -0
  18. package/src/vendor/canvas-sdk/hooks.d.ts +173 -0
  19. package/src/vendor/canvas-sdk/index.d.ts +65 -0
  20. package/src/vendor/canvas-sdk/internal/canvas-action-dispatch.d.ts +17 -0
  21. package/src/vendor/canvas-sdk/manifest.json +5 -0
  22. package/src/vendor/canvas-sdk/swatch.d.ts +39 -0
  23. package/src/vendor/canvas-sdk/theme.d.ts +107 -0
  24. package/src/vendor/canvas-sdk/todo-list.d.ts +48 -0
  25. package/src/vendor/canvas-sdk/ui-primitives.d.ts +569 -0
  26. package/src/vendor/canvas-sdk/usage-bar.d.ts +55 -0
  27. package/dist/shim/charts.d.ts +0 -66
  28. package/dist/shim/cursor-canvas.d.ts +0 -278
  29. package/dist/shim/dag.d.ts +0 -55
  30. package/dist/shim/diff.d.ts +0 -23
  31. package/dist/shim/theme.d.ts +0 -323
  32. package/dist/shim/todo.d.ts +0 -22
  33. package/dist/shim/use-tokens.d.ts +0 -6
@@ -0,0 +1,569 @@
1
+ /**
2
+ * UI primitives for `cursor/canvas`. Styling follows the Cursor dark theme; no extra packages required.
3
+ */
4
+ import { type CSSProperties, type JSX, type ReactNode } from "react";
5
+ /**
6
+ * Shallow-merge style objects with `override` taking precedence.
7
+ *
8
+ * Use for small tweaks on built-in components (e.g. extra padding or width).
9
+ * **Do not** use this to build elaborate custom chrome — prefer the built-in
10
+ * components and flat solid token colors. No gradients, no box-shadows.
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * // Good — minor override on a built-in component
15
+ * <CardBody style={mergeStyle({ padding: 16 })}>…</CardBody>
16
+ *
17
+ * // Bad — hand-rolled decorative styling
18
+ * <div style={mergeStyle(base, { background: "linear-gradient(…)" })}>…</div>
19
+ * ```
20
+ */
21
+ export declare function mergeStyle(base: CSSProperties, override?: CSSProperties): CSSProperties;
22
+ export type StackProps = {
23
+ children?: ReactNode;
24
+ gap?: number;
25
+ style?: CSSProperties;
26
+ };
27
+ /**
28
+ * Vertical flex column. Use as the top-level page wrapper or to stack cards/sections.
29
+ *
30
+ * @example
31
+ * ```tsx
32
+ * <Stack gap={16}>
33
+ * <H1>Dashboard</H1>
34
+ * <Card>…</Card>
35
+ * <Card>…</Card>
36
+ * </Stack>
37
+ * ```
38
+ */
39
+ export declare function Stack({ children, gap, style }: StackProps): JSX.Element;
40
+ export type RowProps = {
41
+ children?: ReactNode;
42
+ gap?: number;
43
+ align?: "start" | "center" | "end" | "stretch";
44
+ justify?: "start" | "center" | "end" | "space-between";
45
+ wrap?: boolean;
46
+ style?: CSSProperties;
47
+ };
48
+ /**
49
+ * Horizontal flex row. Use for inline groups of buttons, badges, or metadata.
50
+ *
51
+ * @example
52
+ * ```tsx
53
+ * <Row gap={8} align="center">
54
+ * <Button variant="primary">Save</Button>
55
+ * <Button variant="ghost">Cancel</Button>
56
+ * </Row>
57
+ * ```
58
+ */
59
+ export declare function Row({ children, gap, align, justify, wrap, style, }: RowProps): JSX.Element;
60
+ /**
61
+ * CSS Grid with tokenized gap. Prefer this over `Row` + `wrap` when you need a
62
+ * fixed number of equal-width columns: wrapped flex items can land on their
63
+ * own row and grow to full width (`flex-grow`), which is often surprising for
64
+ * boards and dashboards.
65
+ */
66
+ export type GridProps = {
67
+ children?: ReactNode;
68
+ /**
69
+ * Equal columns: pass a number (uses `repeat(n, minmax(0, 1fr))`), or a CSS
70
+ * `grid-template-columns` string (e.g. `"1fr 2fr"` or `"minmax(0, 200px) 1fr"`).
71
+ */
72
+ columns: number | string;
73
+ gap?: number;
74
+ align?: "start" | "center" | "end" | "stretch";
75
+ style?: CSSProperties;
76
+ };
77
+ export declare function Grid({ children, columns, gap, align, style, }: GridProps): JSX.Element;
78
+ export type DividerProps = {
79
+ style?: CSSProperties;
80
+ };
81
+ /**
82
+ * Horizontal line for visually separating sections. Uses `stroke.tertiary`
83
+ * to match the Card/Table hairline weight.
84
+ *
85
+ * @example
86
+ * ```tsx
87
+ * <Stack>
88
+ * <Text>Section one</Text>
89
+ * <Divider />
90
+ * <Text>Section two</Text>
91
+ * </Stack>
92
+ * ```
93
+ */
94
+ export declare function Divider({ style }: DividerProps): JSX.Element;
95
+ /**
96
+ * Flex spacer that pushes siblings apart. Place inside a `Row` to push
97
+ * trailing content to the right edge.
98
+ *
99
+ * @example
100
+ * ```tsx
101
+ * <Row>
102
+ * <Text>Title</Text>
103
+ * <Spacer />
104
+ * <Button variant="primary">Save</Button>
105
+ * </Row>
106
+ * ```
107
+ */
108
+ export declare function Spacer(): JSX.Element;
109
+ /** Horizontal alignment for a table column. */
110
+ export type TableColumnAlign = "left" | "center" | "right";
111
+ /** Semantic tone for a table row — marker dot in the first column. */
112
+ export type TableRowTone = "success" | "danger" | "warning" | "info" | "neutral";
113
+ /**
114
+ * Data table props. There is no `rowHeaderColumn` (or other invented
115
+ * column-role field) — pass `headers` plus `rows` of cells.
116
+ */
117
+ export type TableProps = {
118
+ /** Column titles, left to right. Column count is fixed by this array. */
119
+ headers: ReactNode[];
120
+ /**
121
+ * Body rows. Each row is an array of cells in the same order as `headers`.
122
+ * Shorter rows are padded with empty cells; extra cells are ignored.
123
+ */
124
+ rows: ReactNode[][];
125
+ /** Optional alignment per column index (headers/rows). Defaults to left. */
126
+ columnAlign?: Array<TableColumnAlign | undefined>;
127
+ /**
128
+ * Optional semantic tone per row index. Renders a small colored dot before
129
+ * the first column's content (no row fill or border). Sparse: `undefined`
130
+ * entries are unstyled.
131
+ */
132
+ rowTone?: Array<TableRowTone | undefined>;
133
+ /** When true (default), bordered rounded shell with horizontal scroll if needed. */
134
+ framed?: boolean;
135
+ /** Alternate subtle fill on even rows for easier scanning in large tables. */
136
+ striped?: boolean;
137
+ /** Stick the header row when the framed container scrolls vertically. */
138
+ stickyHeader?: boolean;
139
+ style?: CSSProperties;
140
+ /** Shown in a single spanning cell when `rows` is empty. */
141
+ emptyMessage?: ReactNode;
142
+ };
143
+ /**
144
+ * Data table with column headers and rows. Framed by default with its own
145
+ * bordered container — **do not wrap in a Card** unless the card itself is
146
+ * a named entity that happens to contain a table. Render directly under a
147
+ * heading in the normal case. There is no `rowHeaderColumn` prop.
148
+ *
149
+ * @example
150
+ * ```tsx
151
+ * // Good — table directly under a heading
152
+ * <H2>Active services</H2>
153
+ * <Table
154
+ * headers={["Service", "Status", "RPS"]}
155
+ * rows={[
156
+ * ["api-gateway", "Steady", "3.2k"],
157
+ * ["workers", "Hot", "8.1k"],
158
+ * ]}
159
+ * columnAlign={["left", "left", "right"]}
160
+ * />
161
+ *
162
+ * // Allowed — table inside a named-entity card
163
+ * <Card>
164
+ * <CardHeader>billing-service</CardHeader>
165
+ * <CardBody><Table headers={…} rows={…} /></CardBody>
166
+ * </Card>
167
+ * ```
168
+ */
169
+ export declare function Table({ headers, rows, columnAlign, rowTone, framed, striped, stickyHeader, style, emptyMessage, }: TableProps): JSX.Element;
170
+ export type TextWeight = "normal" | "medium" | "semibold" | "bold";
171
+ export type TextProps = {
172
+ children?: ReactNode;
173
+ tone?: "primary" | "secondary" | "tertiary" | "quaternary";
174
+ size?: "body" | "small";
175
+ /**
176
+ * Element tag to render. Defaults to `"p"` for top-level body copy and
177
+ * automatically switches to `"span"` when nested inside another typography
178
+ * container so inline emphasis stays valid HTML.
179
+ */
180
+ as?: "p" | "span";
181
+ /** Font weight. Default is `"normal"` (400). Use `"semibold"` or `"bold"` for emphasis. */
182
+ weight?: TextWeight;
183
+ /** Render as italic. */
184
+ italic?: boolean;
185
+ /**
186
+ * Truncate overflowing text with an ellipsis on a single line.
187
+ * - `true` / `"end"` — ellipsis at the end (default truncation).
188
+ * - `"start"` — ellipsis at the start. Useful for file paths where the
189
+ * filename matters more than the directory prefix.
190
+ *
191
+ * Requires the parent to have a bounded width (flex child with
192
+ * `minWidth: 0`, fixed width, etc.) — otherwise the text just expands
193
+ * and never overflows.
194
+ */
195
+ truncate?: boolean | "start" | "end";
196
+ style?: CSSProperties;
197
+ };
198
+ /**
199
+ * Body text with tone, size, weight, and italic variants.
200
+ *
201
+ * Top-level `Text` renders a `<p>`. Nested `Text` automatically renders a
202
+ * `<span>` so inline emphasis like `<Text>Use <Text weight="semibold">this</Text></Text>`
203
+ * does not emit invalid nested paragraphs. Use `as` to override when needed.
204
+ *
205
+ * Compose with `<Code>` for inline code and `<Link>` for hyperlinks inside
206
+ * the text flow.
207
+ *
208
+ * @example
209
+ * ```tsx
210
+ * <Text>Primary body text.</Text>
211
+ * <Text weight="semibold">Important note.</Text>
212
+ * <Text italic tone="secondary">Supplementary remark.</Text>
213
+ * <Text>Run <Code>npm install</Code> to get started.</Text>
214
+ * <Text>See the <Link href="https://example.com">docs</Link> for details.</Text>
215
+ * ```
216
+ */
217
+ export declare function Text({ children, tone, size, as, weight, italic, truncate, style, }: TextProps): JSX.Element;
218
+ export type H1Props = {
219
+ children?: ReactNode;
220
+ style?: CSSProperties;
221
+ };
222
+ /**
223
+ * Page-level heading. Use once at the top of a canvas.
224
+ * **Do not** place inside `CardHeader` — card headers use their own label.
225
+ *
226
+ * @example
227
+ * ```tsx
228
+ * <Stack>
229
+ * <H1>Performance Report</H1>
230
+ * <Card>…</Card>
231
+ * </Stack>
232
+ * ```
233
+ */
234
+ export declare function H1({ children, style }: H1Props): JSX.Element;
235
+ export type H2Props = {
236
+ children?: ReactNode;
237
+ style?: CSSProperties;
238
+ };
239
+ /**
240
+ * Section heading. Use between groups of cards or sections.
241
+ * **Do not** place inside `CardHeader` — card headers use their own label.
242
+ *
243
+ * @example
244
+ * ```tsx
245
+ * <Stack>
246
+ * <H2>Recent activity</H2>
247
+ * <Card>…</Card>
248
+ * <Card>…</Card>
249
+ * </Stack>
250
+ * ```
251
+ */
252
+ export declare function H2({ children, style }: H2Props): JSX.Element;
253
+ export type H3Props = {
254
+ children?: ReactNode;
255
+ style?: CSSProperties;
256
+ };
257
+ /**
258
+ * Sub-section heading. Use below `H2` for finer hierarchy.
259
+ *
260
+ * @example
261
+ * ```tsx
262
+ * <Stack>
263
+ * <H2>API Reference</H2>
264
+ * <H3>Authentication</H3>
265
+ * <Text>All requests require a bearer token.</Text>
266
+ * </Stack>
267
+ * ```
268
+ */
269
+ export declare function H3({ children, style }: H3Props): JSX.Element;
270
+ export type CodeProps = {
271
+ children?: ReactNode;
272
+ style?: CSSProperties;
273
+ };
274
+ /**
275
+ * Inline `<code>` span for identifiers, file names, or short snippets.
276
+ * Uses `0.92em` so it scales with surrounding text (headings, body, etc.).
277
+ *
278
+ * Prefer writing backtick markdown inside `Text` — e.g. `` <Text>Run `npm install`</Text> `` —
279
+ * which is automatically parsed. Use `<Code>` only when you need an explicit element.
280
+ *
281
+ * @example
282
+ * ```tsx
283
+ * <Text>Run <Code>npm install</Code> to get started.</Text>
284
+ * ```
285
+ */
286
+ export declare function Code({ children, style }: CodeProps): JSX.Element;
287
+ export type LinkProps = {
288
+ children?: ReactNode;
289
+ href: string;
290
+ style?: CSSProperties;
291
+ };
292
+ /**
293
+ * Inline link that opens in the user's default browser.
294
+ *
295
+ * Prefer writing markdown links inside `Text` — e.g. `<Text>See the [docs](url)</Text>` —
296
+ * which are automatically parsed. Use `<Link>` when you need an explicit anchor
297
+ * outside of a text flow or when composing with other elements.
298
+ *
299
+ * @example
300
+ * ```tsx
301
+ * <Link href="https://docs.example.com">View documentation</Link>
302
+ * ```
303
+ */
304
+ export declare function Link({ children, href, style }: LinkProps): JSX.Element;
305
+ export type CardSize = "base" | "lg";
306
+ /**
307
+ * Card chrome. Only `"default"` (bordered) and `"borderless"`.
308
+ * There is no accent, outlined, or primary variant — use `Callout` when
309
+ * the block needs semantic emphasis.
310
+ */
311
+ export type CardVariant = "default" | "borderless";
312
+ /**
313
+ * Inline chevron SVG used by disclosure-style controls (collapsible cards,
314
+ * expandable list items, etc.). Shared by `Card` and `todo-list.tsx` so
315
+ * every disclosure in the canvas SDK uses the same glyph.
316
+ */
317
+ export declare function CanvasChevron({ expanded }: {
318
+ expanded: boolean;
319
+ }): JSX.Element;
320
+ export type CardProps = {
321
+ children?: ReactNode;
322
+ /** Default: bordered surface with radius; `borderless` removes both. */
323
+ variant?: CardVariant;
324
+ /** `lg` uses a taller header and roomier title padding (matches packages/ui). */
325
+ size?: CardSize;
326
+ /**
327
+ * When true, the header uses `position: sticky` so it stays visible while
328
+ * the card body scrolls. Requires the card (or a parent) to have a
329
+ * constrained height and `overflow: auto` — the canvas host controls this,
330
+ * so sticky behavior depends on the host viewport.
331
+ */
332
+ stickyHeader?: boolean;
333
+ /**
334
+ * Make the card collapsible. The header becomes a clickable toggle with
335
+ * a leading chevron; `CardBody` renders nothing while the card is closed.
336
+ */
337
+ collapsible?: boolean;
338
+ /** Initial open state in uncontrolled mode. Ignored when `open` is set. */
339
+ defaultOpen?: boolean;
340
+ /** Controlled open state. Pair with `onOpenChange`. */
341
+ open?: boolean;
342
+ /** Fires on every toggle with the next open state. */
343
+ onOpenChange?: (open: boolean) => void;
344
+ style?: CSSProperties;
345
+ };
346
+ /**
347
+ * Bordered surface for a **labeled, self-contained unit** — a file, a service,
348
+ * a config block, or a table with a title. Compose with `CardHeader` + `CardBody`.
349
+ *
350
+ * **When to use Card:**
351
+ * - Displaying a named entity (file path, service name, resource).
352
+ * - Wrapping a `<Table>` or `<DiffView>` that needs a title.
353
+ * - A distinct, bounded section the user might scan by header label.
354
+ *
355
+ * **When NOT to use Card:**
356
+ * - General text sections — use `<H2>` + `<Text>` instead. Not every section
357
+ * needs a border.
358
+ * - Page-level layout — use `<Stack>` with headings. A canvas should not be a
359
+ * wall of stacked cards.
360
+ * - Nesting — do not put cards inside cards. Use `<Divider>` within a card body.
361
+ *
362
+ * Pass **plain text** as `CardHeader` children — the header provides its own
363
+ * 12px font. Do **not** put `<H1>` or `<H2>` inside a card header.
364
+ *
365
+ * Set `collapsible` to make the header a toggle that shows/hides `CardBody`.
366
+ *
367
+ * @example
368
+ * ```tsx
369
+ * // Card wraps a titled diff
370
+ * <Card>
371
+ * <CardHeader trailing={<DiffStats additions={5} deletions={2} />}>
372
+ * src/utils.ts
373
+ * </CardHeader>
374
+ * <CardBody style={{ padding: 0 }}>
375
+ * <DiffView path="src/utils.ts" lines={lines} />
376
+ * </CardBody>
377
+ * </Card>
378
+ *
379
+ * // Collapsible card
380
+ * <Card collapsible defaultOpen={false}>
381
+ * <CardHeader>deploy-service.ts</CardHeader>
382
+ * <CardBody>Service handles rolling deployments across regions.</CardBody>
383
+ * </Card>
384
+ *
385
+ * // Bad — card wrapping plain text that should just be a heading
386
+ * // Use <H2>Overview</H2><Text>…</Text> instead.
387
+ * ```
388
+ */
389
+ export declare function Card({ children, variant, size, stickyHeader, collapsible, defaultOpen, open: openProp, onOpenChange, style, }: CardProps): JSX.Element;
390
+ export type CardHeaderProps = {
391
+ /** Plain text title. Do **not** pass headings, buttons, pills, or layout rows. */
392
+ children?: ReactNode;
393
+ /** Small trailing content aligned to the right edge — a status label, a
394
+ * single pill, or a short metadata string. Keep it compact. */
395
+ trailing?: ReactNode;
396
+ style?: CSSProperties;
397
+ };
398
+ /**
399
+ * 28px header row (32px at `size="lg"`). A compact label for the card.
400
+ *
401
+ * **`children`** — plain text only. This is a 12px label, not a toolbar.
402
+ * Do **not** pass `<H1>`, `<H2>`, `<Text weight="bold">`, `<Pill>`,
403
+ * `<Button>`, `<Row>`, or any interactive/layout elements as children.
404
+ *
405
+ * **`trailing`** — optional right-aligned slot for small status indicators
406
+ * (a short label, a single `<Pill>`, a metadata string like a timestamp).
407
+ *
408
+ * @example
409
+ * ```tsx
410
+ * // Good — plain title
411
+ * <CardHeader>config.yaml</CardHeader>
412
+ *
413
+ * // Good — title with trailing status
414
+ * <CardHeader trailing={<Pill active>Healthy</Pill>}>
415
+ * billing-service
416
+ * </CardHeader>
417
+ *
418
+ * // Bad — heading in header (use CardHeader text, not H2)
419
+ * // Bad — buttons in header (no room, wrong context)
420
+ * // Bad — multiple pills in header (use trailing for one, or move to CardBody)
421
+ * ```
422
+ */
423
+ export declare function CardHeader({ children, trailing, style }: CardHeaderProps): JSX.Element;
424
+ export type CardBodyProps = {
425
+ children?: ReactNode;
426
+ style?: CSSProperties;
427
+ };
428
+ /**
429
+ * Padded content area inside a Card.
430
+ * Override `style` to adjust padding for custom layouts.
431
+ *
432
+ * @example
433
+ * ```tsx
434
+ * <Card>
435
+ * <CardHeader>Overview</CardHeader>
436
+ * <CardBody>This service is currently healthy.</CardBody>
437
+ * </Card>
438
+ * ```
439
+ */
440
+ export declare function CardBody({ children, style }: CardBodyProps): JSX.Element | null;
441
+ export type ButtonProps = {
442
+ children?: ReactNode;
443
+ variant?: "primary" | "secondary" | "ghost";
444
+ disabled?: boolean;
445
+ type?: "button" | "submit" | "reset";
446
+ style?: CSSProperties;
447
+ onClick?: () => void;
448
+ };
449
+ /**
450
+ * Action button (24px height, sized to its label). **Never stretch to full
451
+ * width** — buttons are always inline and hug their text.
452
+ *
453
+ * @example
454
+ * ```tsx
455
+ * <Row gap={8}>
456
+ * <Button variant="primary" onClick={handleSave}>Save</Button>
457
+ * <Button variant="secondary">Export</Button>
458
+ * <Button variant="ghost">Cancel</Button>
459
+ * </Row>
460
+ * ```
461
+ */
462
+ export declare function Button({ children, variant, disabled, type, style, onClick, }: ButtonProps): JSX.Element;
463
+ /**
464
+ * Accepted on `Pill` for source compatibility only — the value is ignored
465
+ * and every pill renders neutral. This is not the Stat / Callout / Chart /
466
+ * Table `rowTone` vocabulary: `"danger"` is not a member. Use those
467
+ * components when you need semantic color.
468
+ *
469
+ * @deprecated Pills always render neutral now; tones are ignored.
470
+ */
471
+ export type PillTone = "neutral" | "added" | "deleted" | "renamed" | "success" | "warning" | "info";
472
+ export type PillSize = "sm" | "md";
473
+ export type PillProps = {
474
+ children?: ReactNode;
475
+ /** Whether the pill is in its selected/active state (filled background). */
476
+ active?: boolean;
477
+ /**
478
+ * @deprecated Ignored — pills always render with neutral styling.
479
+ * `"danger"` is not a `PillTone`. Use `Stat`, `Callout`, `Chart`, or
480
+ * Table `rowTone` for semantic color.
481
+ */
482
+ tone?: PillTone;
483
+ /**
484
+ * Visual size. `"md"` (default) is the standard pill. `"sm"` is a
485
+ * compact variant with smaller text, tighter padding, and no border —
486
+ * designed for tight spaces like `CardHeader` trailing slots.
487
+ */
488
+ size?: PillSize;
489
+ /** Shown before the label (icon, emoji, etc.). */
490
+ leadingContent?: ReactNode;
491
+ /** e.g. shortcut hint — matches ui `Pill` ghost keyboard hint (muted primary). */
492
+ keyboardHint?: string;
493
+ disabled?: boolean;
494
+ title?: string;
495
+ style?: CSSProperties;
496
+ onClick?: () => void;
497
+ };
498
+ /**
499
+ * Pill-shaped label or toggle button. Use for tab bars, filter groups, or
500
+ * action suggestions. Set `active` for the selected state (filled background).
501
+ * Pills are always neutral — `tone` is ignored and is not a shared semantic
502
+ * vocabulary with Stat / Callout / Chart.
503
+ *
504
+ * @example
505
+ * ```tsx
506
+ * // Tab-style selector
507
+ * <Row gap={8}>
508
+ * {tabs.map(tab => (
509
+ * <Pill key={tab} active={tab === selected} onClick={() => setSelected(tab)}>
510
+ * {tab}
511
+ * </Pill>
512
+ * ))}
513
+ * </Row>
514
+ *
515
+ * // Action suggestion with shortcut hint
516
+ * <Pill onClick={handlePlan} keyboardHint="⇧Tab">Plan new idea</Pill>
517
+ * ```
518
+ */
519
+ export declare function Pill({ children, active, size, leadingContent, keyboardHint, disabled, title, style, onClick, }: PillProps): JSX.Element;
520
+ export type StatTone = "success" | "danger" | "warning" | "info";
521
+ export type StatProps = {
522
+ /** The primary metric value (number, percentage, short string). */
523
+ value: ReactNode;
524
+ /** Label below the value. */
525
+ label: string;
526
+ /** Semantic color for the value. Omit for default primary text. */
527
+ tone?: StatTone;
528
+ style?: CSSProperties;
529
+ };
530
+ /**
531
+ * Single metric display — a large value with a compact label beneath it.
532
+ * Best as compact supporting context beside a primary artifact (e.g. one or
533
+ * two Stats in a `<Row>`); reserve a `<Grid>` of equal Stats for when the
534
+ * data truly calls for a summary strip.
535
+ *
536
+ * @example
537
+ * ```tsx
538
+ * // Supporting context next to a primary artifact — not a hero KPI strip.
539
+ * <Row gap={16}>
540
+ * <Stat value="12" label="Failing checks" tone="danger" />
541
+ * <Stat value="3" label="Services" />
542
+ * </Row>
543
+ * ```
544
+ */
545
+ export declare function Stat({ value, label, tone, style }: StatProps): JSX.Element;
546
+ export type CalloutTone = "info" | "success" | "warning" | "danger" | "neutral";
547
+ export type CalloutProps = {
548
+ /** Body content. Plain strings, `<Text>`, `<Code>`, `<Link>`, or short lists. */
549
+ children?: ReactNode;
550
+ /** Semantic tone. Selects a default leading icon when `icon` is omitted. */
551
+ tone?: CalloutTone;
552
+ /** Optional bold title line, shown above the body. */
553
+ title?: ReactNode;
554
+ /** Optional leading icon (emoji, inline SVG, or short text glyph). */
555
+ icon?: ReactNode;
556
+ style?: CSSProperties;
557
+ };
558
+ /**
559
+ * Inline notice for warnings, tips, or short status messages. Each `tone`
560
+ * renders a cursor icon matching `@anysphere/ui` toasts (override with `icon`).
561
+ *
562
+ * @example
563
+ * ```tsx
564
+ * <Callout tone="warning" title="Heads up">
565
+ * Rolling deploy is in progress. Metrics may be noisy for 10 minutes.
566
+ * </Callout>
567
+ * ```
568
+ */
569
+ export declare function Callout({ children, tone, title, icon, style, }: CalloutProps): JSX.Element;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Segmented usage bar primitive — proportional pills + remainder, with an
3
+ * optional one-line label row above. Visually matches `packages/ui`
4
+ * `ContextUsageTray`'s usage bar, themed for canvas via the shared `Color`
5
+ * palette and `useHostTheme()` semantic tokens.
6
+ */
7
+ import type { CSSProperties, JSX, ReactNode } from "react";
8
+ import { type Color } from "./canvas-tokens.js";
9
+ export interface UsageBarSegment {
10
+ /** Stable identifier (used as React key). */
11
+ readonly id: string;
12
+ /** Proportional weight for this segment. Non-finite or `<= 0` is treated as 0. */
13
+ readonly value: number;
14
+ /**
15
+ * Optional explicit color. Defaults to a rotation through
16
+ * `usageColorSequence` by index, matching the original `packages/ui`
17
+ * `ContextUsageTray` order so the same index lands on the same hue.
18
+ */
19
+ readonly color?: Color;
20
+ }
21
+ export type UsageBarProps = {
22
+ /** Segments rendered left-to-right; widths are proportional to `value`. */
23
+ readonly segments: readonly UsageBarSegment[];
24
+ /** Total weight of the bar. The remainder span fills `max(0, total - sum(values))`. */
25
+ readonly total: number;
26
+ /** Optional small label rendered above the bar, left-aligned. */
27
+ readonly topLeftLabel?: ReactNode;
28
+ /** Optional small label rendered above the bar, right-aligned. */
29
+ readonly topRightLabel?: ReactNode;
30
+ readonly style?: CSSProperties;
31
+ };
32
+ /**
33
+ * Segmented horizontal usage bar — proportional category pills with a
34
+ * remainder span. Use to visualize a fixed-budget breakdown (context window
35
+ * tokens, storage usage, etc.).
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * <UsageBar
40
+ * total={120_000}
41
+ * topLeftLabel="64% Full"
42
+ * topRightLabel="76.8K / 120K Tokens"
43
+ * segments={[
44
+ * { id: "system", value: 8_000, color: "gray" },
45
+ * { id: "tools", value: 24_000, color: "purple" },
46
+ * { id: "rules", value: 12_000, color: "green" },
47
+ * { id: "skills", value: 6_000, color: "yellow" },
48
+ * { id: "mcp", value: 4_000, color: "pink" },
49
+ * { id: "subagents", value: 8_800, color: "blue" },
50
+ * { id: "conversation", value: 14_000, color: "orange" },
51
+ * ]}
52
+ * />
53
+ * ```
54
+ */
55
+ export declare function UsageBar({ segments, total, topLeftLabel, topRightLabel, style, }: UsageBarProps): JSX.Element;
@@ -1,66 +0,0 @@
1
- import { CSSProperties } from 'react';
2
- export type ChartTone = 'success' | 'danger' | 'warning' | 'info' | 'neutral';
3
- export type ChartDataPoint = {
4
- label: string;
5
- value: number;
6
- };
7
- export type ChartSeries = {
8
- name: string;
9
- data: number[];
10
- tone?: ChartTone;
11
- };
12
- export type ChartReferenceLine = {
13
- value: number;
14
- label?: string;
15
- tone?: ChartTone;
16
- };
17
- /** Unknown SDK props typecheck. The wrapper only reads the fields it names. */
18
- type ExtraProps = {
19
- [key: string]: unknown;
20
- };
21
- type ValueAxisProps = {
22
- beginAtZero?: boolean;
23
- yMin?: number;
24
- yMax?: number;
25
- referenceLines?: ChartReferenceLine[];
26
- };
27
- export type BarChartProps = ValueAxisProps & {
28
- categories: string[];
29
- series: ChartSeries[];
30
- height?: number;
31
- stacked?: boolean;
32
- horizontal?: boolean;
33
- normalized?: boolean;
34
- valueSuffix?: string;
35
- valuePrefix?: string;
36
- showValues?: boolean;
37
- style?: CSSProperties;
38
- } & ExtraProps;
39
- export type LineChartProps = ValueAxisProps & {
40
- categories: string[];
41
- series: ChartSeries[];
42
- height?: number;
43
- fill?: boolean;
44
- valueSuffix?: string;
45
- valuePrefix?: string;
46
- showValues?: boolean;
47
- showHoverGuide?: boolean;
48
- style?: CSSProperties;
49
- } & ExtraProps;
50
- export type PieChartProps = {
51
- data: Array<ChartDataPoint & {
52
- tone?: ChartTone;
53
- }>;
54
- size?: number;
55
- donut?: boolean;
56
- style?: CSSProperties;
57
- } & ExtraProps;
58
- /**
59
- * Fork-only export (not in IDE `index.d.ts`); keeps chart data shaping stable for
60
- * Mantine — listed under “fork-only” in `pnpm run check:sdk-exports`.
61
- */
62
- export declare function reshapeLineChartData(categories: string[], series: ChartSeries[]): Record<string, string | number>[];
63
- export declare function LineChart({ categories, series, height, fill, valueSuffix, valuePrefix, showValues, showHoverGuide, beginAtZero, yMin, yMax, referenceLines, style, }: LineChartProps): import("react").JSX.Element;
64
- export declare function BarChart({ categories, series, height, stacked, horizontal, normalized, valueSuffix, valuePrefix, showValues, beginAtZero, yMin, yMax, referenceLines, style, }: BarChartProps): import("react").JSX.Element;
65
- export declare function PieChart({ data, size, donut, style }: PieChartProps): import("react").JSX.Element;
66
- export {};