@pragma-sh/scratchpad 0.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.
- package/README.md +24 -0
- package/dist/index.cjs +96 -0
- package/dist/index.d.cts +46 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +38 -0
- package/dist/primitives.cjs +514 -0
- package/dist/primitives.d.cts +31 -0
- package/dist/primitives.d.ts +31 -0
- package/dist/primitives.js +454 -0
- package/dist/ui.cjs +1389 -0
- package/dist/ui.d.cts +90 -0
- package/dist/ui.d.ts +90 -0
- package/dist/ui.js +1313 -0
- package/package.json +60 -0
package/dist/ui.d.cts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export * from "@pragma-sh/sdk";
|
|
2
|
+
/** Context passed when a scratchpad action has no attached agent tab. */
|
|
3
|
+
interface MissingAgentContext {
|
|
4
|
+
text: string;
|
|
5
|
+
attach(): Promise<boolean>;
|
|
6
|
+
}
|
|
7
|
+
/** Options for {@link promptAgent}. */
|
|
8
|
+
interface PromptAgentOptions {
|
|
9
|
+
onMissingAgent?: (context: MissingAgentContext) => void | boolean | Promise<void | boolean>;
|
|
10
|
+
}
|
|
11
|
+
import { ButtonHTMLAttributes, HTMLAttributes, InputHTMLAttributes, ProgressHTMLAttributes, TextareaHTMLAttributes } from "react";
|
|
12
|
+
/** Visual weight of a scratchpad {@link Button}. */
|
|
13
|
+
type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "danger";
|
|
14
|
+
/** Semantic color of a {@link Badge} or {@link Progress}. */
|
|
15
|
+
type Tone = "neutral" | "primary" | "success" | "warning" | "danger";
|
|
16
|
+
/** Props for {@link Button}. */
|
|
17
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
18
|
+
variant?: ButtonVariant;
|
|
19
|
+
size?: "sm" | "md";
|
|
20
|
+
}
|
|
21
|
+
/** Scratchpad button matching desktop shadcn button proportions and tokens. */
|
|
22
|
+
declare function Button({ className, size, type, variant,...rest }: ButtonProps): React.JSX.Element;
|
|
23
|
+
/** Scratchpad single-line input matching desktop shadcn input tokens. */
|
|
24
|
+
declare function Input({ className,...rest }: InputHTMLAttributes<HTMLInputElement>): React.JSX.Element;
|
|
25
|
+
/** Scratchpad multiline input matching desktop shadcn textarea tokens. */
|
|
26
|
+
declare function Textarea({ className,...rest }: TextareaHTMLAttributes<HTMLTextAreaElement>): React.JSX.Element;
|
|
27
|
+
/** Props for {@link Progress}. */
|
|
28
|
+
interface ProgressProps extends ProgressHTMLAttributes<HTMLProgressElement> {
|
|
29
|
+
tone?: Tone;
|
|
30
|
+
}
|
|
31
|
+
/** Scratchpad progress bar using desktop semantic colors. */
|
|
32
|
+
declare function Progress({ className, style, tone,...rest }: ProgressProps): React.JSX.Element;
|
|
33
|
+
/** Surface that frames one scratchpad component, matching desktop cards. */
|
|
34
|
+
declare function Card({ className,...rest }: HTMLAttributes<HTMLElement>): React.JSX.Element;
|
|
35
|
+
/** Props for {@link Badge}. */
|
|
36
|
+
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
37
|
+
tone?: Tone;
|
|
38
|
+
}
|
|
39
|
+
/** Small state pill; color communicates state, never decoration. */
|
|
40
|
+
declare function Badge({ className, tone,...rest }: BadgeProps): React.JSX.Element;
|
|
41
|
+
/** Props for a live, read-only whiteboard rendering. */
|
|
42
|
+
interface WhiteboardProps {
|
|
43
|
+
id: string;
|
|
44
|
+
/** Poll interval for host-side version checks. Set to zero to disable polling. */
|
|
45
|
+
refreshIntervalMs?: number;
|
|
46
|
+
}
|
|
47
|
+
/** Live read-only PNG rendering of a worktree-scoped Pragma whiteboard. */
|
|
48
|
+
declare function Whiteboard({ id, refreshIntervalMs }: WhiteboardProps): React.JSX.Element;
|
|
49
|
+
/** One labeled answer option for {@link AskQuestion}. */
|
|
50
|
+
interface AskQuestionOption {
|
|
51
|
+
label: string;
|
|
52
|
+
value?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Shape of an {@link AskQuestion}: a single choice (`options`, `yes-no`), any
|
|
56
|
+
* number of choices (`multi-select`), or free text only (`text`). Every choice
|
|
57
|
+
* shape renders the same list — radios for a single answer, checkboxes for
|
|
58
|
+
* `multi-select`.
|
|
59
|
+
*/
|
|
60
|
+
type AskQuestionType = "options" | "yes-no" | "multi-select" | "text";
|
|
61
|
+
/** Props for {@link AskQuestion}. */
|
|
62
|
+
interface AskQuestionProps extends PromptAgentOptions {
|
|
63
|
+
question: string;
|
|
64
|
+
type?: AskQuestionType;
|
|
65
|
+
options?: readonly AskQuestionOption[];
|
|
66
|
+
/** Appends an "Other" choice that reveals a free-text field when selected. */
|
|
67
|
+
allowOpenResponse?: boolean;
|
|
68
|
+
submitLabel?: string;
|
|
69
|
+
onAnswer?: (answer: string) => void | Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
/** Interactive question whose answer is sent to attached agent tab. */
|
|
72
|
+
declare function AskQuestion({ question, type, options, allowOpenResponse, submitLabel, onAnswer, onMissingAgent }: AskQuestionProps): React.JSX.Element;
|
|
73
|
+
/** Props for {@link DiffReview}. */
|
|
74
|
+
interface DiffReviewProps extends PromptAgentOptions {
|
|
75
|
+
title?: string;
|
|
76
|
+
before: string;
|
|
77
|
+
after: string;
|
|
78
|
+
file?: string;
|
|
79
|
+
onDecision?: (accepted: boolean) => void | Promise<void>;
|
|
80
|
+
}
|
|
81
|
+
/** Before/after review card that returns accept/reject decision to attached agent. */
|
|
82
|
+
declare function DiffReview({ title, before, after, file, onDecision, onMissingAgent }: DiffReviewProps): React.JSX.Element;
|
|
83
|
+
/** Props for {@link AgentProgress}. */
|
|
84
|
+
interface AgentProgressProps {
|
|
85
|
+
tabIds: readonly string[];
|
|
86
|
+
title?: string;
|
|
87
|
+
}
|
|
88
|
+
/** Live progress for any set of same-worktree agent tab IDs. */
|
|
89
|
+
declare function AgentProgress({ tabIds, title }: AgentProgressProps): React.JSX.Element;
|
|
90
|
+
export { WhiteboardProps, Whiteboard, Tone, Textarea, ProgressProps, Progress, Input, DiffReviewProps, DiffReview, Card, ButtonVariant, ButtonProps, Button, BadgeProps, Badge, AskQuestionType, AskQuestionProps, AskQuestionOption, AskQuestion, AgentProgressProps, AgentProgress };
|
package/dist/ui.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export * from "@pragma-sh/sdk";
|
|
2
|
+
/** Context passed when a scratchpad action has no attached agent tab. */
|
|
3
|
+
interface MissingAgentContext {
|
|
4
|
+
text: string;
|
|
5
|
+
attach(): Promise<boolean>;
|
|
6
|
+
}
|
|
7
|
+
/** Options for {@link promptAgent}. */
|
|
8
|
+
interface PromptAgentOptions {
|
|
9
|
+
onMissingAgent?: (context: MissingAgentContext) => void | boolean | Promise<void | boolean>;
|
|
10
|
+
}
|
|
11
|
+
import { ButtonHTMLAttributes, HTMLAttributes, InputHTMLAttributes, ProgressHTMLAttributes, TextareaHTMLAttributes } from "react";
|
|
12
|
+
/** Visual weight of a scratchpad {@link Button}. */
|
|
13
|
+
type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "danger";
|
|
14
|
+
/** Semantic color of a {@link Badge} or {@link Progress}. */
|
|
15
|
+
type Tone = "neutral" | "primary" | "success" | "warning" | "danger";
|
|
16
|
+
/** Props for {@link Button}. */
|
|
17
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
18
|
+
variant?: ButtonVariant;
|
|
19
|
+
size?: "sm" | "md";
|
|
20
|
+
}
|
|
21
|
+
/** Scratchpad button matching desktop shadcn button proportions and tokens. */
|
|
22
|
+
declare function Button({ className, size, type, variant,...rest }: ButtonProps): React.JSX.Element;
|
|
23
|
+
/** Scratchpad single-line input matching desktop shadcn input tokens. */
|
|
24
|
+
declare function Input({ className,...rest }: InputHTMLAttributes<HTMLInputElement>): React.JSX.Element;
|
|
25
|
+
/** Scratchpad multiline input matching desktop shadcn textarea tokens. */
|
|
26
|
+
declare function Textarea({ className,...rest }: TextareaHTMLAttributes<HTMLTextAreaElement>): React.JSX.Element;
|
|
27
|
+
/** Props for {@link Progress}. */
|
|
28
|
+
interface ProgressProps extends ProgressHTMLAttributes<HTMLProgressElement> {
|
|
29
|
+
tone?: Tone;
|
|
30
|
+
}
|
|
31
|
+
/** Scratchpad progress bar using desktop semantic colors. */
|
|
32
|
+
declare function Progress({ className, style, tone,...rest }: ProgressProps): React.JSX.Element;
|
|
33
|
+
/** Surface that frames one scratchpad component, matching desktop cards. */
|
|
34
|
+
declare function Card({ className,...rest }: HTMLAttributes<HTMLElement>): React.JSX.Element;
|
|
35
|
+
/** Props for {@link Badge}. */
|
|
36
|
+
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
37
|
+
tone?: Tone;
|
|
38
|
+
}
|
|
39
|
+
/** Small state pill; color communicates state, never decoration. */
|
|
40
|
+
declare function Badge({ className, tone,...rest }: BadgeProps): React.JSX.Element;
|
|
41
|
+
/** Props for a live, read-only whiteboard rendering. */
|
|
42
|
+
interface WhiteboardProps {
|
|
43
|
+
id: string;
|
|
44
|
+
/** Poll interval for host-side version checks. Set to zero to disable polling. */
|
|
45
|
+
refreshIntervalMs?: number;
|
|
46
|
+
}
|
|
47
|
+
/** Live read-only PNG rendering of a worktree-scoped Pragma whiteboard. */
|
|
48
|
+
declare function Whiteboard({ id, refreshIntervalMs }: WhiteboardProps): React.JSX.Element;
|
|
49
|
+
/** One labeled answer option for {@link AskQuestion}. */
|
|
50
|
+
interface AskQuestionOption {
|
|
51
|
+
label: string;
|
|
52
|
+
value?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Shape of an {@link AskQuestion}: a single choice (`options`, `yes-no`), any
|
|
56
|
+
* number of choices (`multi-select`), or free text only (`text`). Every choice
|
|
57
|
+
* shape renders the same list — radios for a single answer, checkboxes for
|
|
58
|
+
* `multi-select`.
|
|
59
|
+
*/
|
|
60
|
+
type AskQuestionType = "options" | "yes-no" | "multi-select" | "text";
|
|
61
|
+
/** Props for {@link AskQuestion}. */
|
|
62
|
+
interface AskQuestionProps extends PromptAgentOptions {
|
|
63
|
+
question: string;
|
|
64
|
+
type?: AskQuestionType;
|
|
65
|
+
options?: readonly AskQuestionOption[];
|
|
66
|
+
/** Appends an "Other" choice that reveals a free-text field when selected. */
|
|
67
|
+
allowOpenResponse?: boolean;
|
|
68
|
+
submitLabel?: string;
|
|
69
|
+
onAnswer?: (answer: string) => void | Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
/** Interactive question whose answer is sent to attached agent tab. */
|
|
72
|
+
declare function AskQuestion({ question, type, options, allowOpenResponse, submitLabel, onAnswer, onMissingAgent }: AskQuestionProps): React.JSX.Element;
|
|
73
|
+
/** Props for {@link DiffReview}. */
|
|
74
|
+
interface DiffReviewProps extends PromptAgentOptions {
|
|
75
|
+
title?: string;
|
|
76
|
+
before: string;
|
|
77
|
+
after: string;
|
|
78
|
+
file?: string;
|
|
79
|
+
onDecision?: (accepted: boolean) => void | Promise<void>;
|
|
80
|
+
}
|
|
81
|
+
/** Before/after review card that returns accept/reject decision to attached agent. */
|
|
82
|
+
declare function DiffReview({ title, before, after, file, onDecision, onMissingAgent }: DiffReviewProps): React.JSX.Element;
|
|
83
|
+
/** Props for {@link AgentProgress}. */
|
|
84
|
+
interface AgentProgressProps {
|
|
85
|
+
tabIds: readonly string[];
|
|
86
|
+
title?: string;
|
|
87
|
+
}
|
|
88
|
+
/** Live progress for any set of same-worktree agent tab IDs. */
|
|
89
|
+
declare function AgentProgress({ tabIds, title }: AgentProgressProps): React.JSX.Element;
|
|
90
|
+
export { WhiteboardProps, Whiteboard, Tone, Textarea, ProgressProps, Progress, Input, DiffReviewProps, DiffReview, Card, ButtonVariant, ButtonProps, Button, BadgeProps, Badge, AskQuestionType, AskQuestionProps, AskQuestionOption, AskQuestion, AgentProgressProps, AgentProgress };
|