@claude-canvas/core 0.2.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.
@@ -0,0 +1,328 @@
1
+ declare class ShadowContainer {
2
+ private host;
3
+ private shadow;
4
+ private container;
5
+ private mounted;
6
+ constructor();
7
+ mount(): void;
8
+ unmount(): void;
9
+ getContainer(): HTMLDivElement;
10
+ getShadowRoot(): ShadowRoot;
11
+ }
12
+
13
+ type ToastVariant = 'success' | 'warning' | 'error' | 'info';
14
+ declare class Toast {
15
+ private shadowRoot;
16
+ private toastContainer;
17
+ private styleInjected;
18
+ constructor(shadowRoot: ShadowRoot);
19
+ private ensureStyle;
20
+ show(message: string, variant: ToastVariant): void;
21
+ hide(): void;
22
+ }
23
+
24
+ type AnnotationMode$1 = 'off' | 'select' | 'box' | 'memo' | 'capture';
25
+ interface KeyboardHandlerCallbacks {
26
+ onToggleMode: () => void;
27
+ onEscape: () => void;
28
+ onToolSwitch: (mode: AnnotationMode$1) => void;
29
+ onSend: () => void;
30
+ }
31
+ declare class KeyboardHandler {
32
+ private callbacks;
33
+ private enabled;
34
+ private listener;
35
+ constructor(callbacks: KeyboardHandlerCallbacks);
36
+ mount(): void;
37
+ unmount(): void;
38
+ setEnabled(enabled: boolean): void;
39
+ }
40
+
41
+ interface FabButtonOptions {
42
+ onActivate: () => void;
43
+ }
44
+ declare class FabButton {
45
+ private shadowRoot;
46
+ private options;
47
+ private button;
48
+ private tooltip;
49
+ private styleEl;
50
+ private mounted;
51
+ constructor(shadowRoot: ShadowRoot, options: FabButtonOptions);
52
+ mount(): void;
53
+ unmount(): void;
54
+ setVisible(visible: boolean): void;
55
+ private handleClick;
56
+ private handleMouseEnter;
57
+ private handleMouseLeave;
58
+ private showTooltip;
59
+ private hideTooltip;
60
+ }
61
+
62
+ type AnnotationMode = 'off' | 'select' | 'box' | 'memo' | 'capture';
63
+ type AnnotationType = 'box' | 'element-select';
64
+ type MessageRole = 'user' | 'assistant' | 'system';
65
+ type FileAction = 'edit' | 'create' | 'delete';
66
+ type LibraryType = 'carbon' | 'project-wrapper' | 'unknown';
67
+ interface SourceInfo {
68
+ componentName: string;
69
+ file: string;
70
+ line: number;
71
+ column: number;
72
+ library?: string;
73
+ tagName: string;
74
+ className?: string;
75
+ }
76
+ interface Annotation {
77
+ id: string;
78
+ type: AnnotationType;
79
+ rect?: {
80
+ x: number;
81
+ y: number;
82
+ width: number;
83
+ height: number;
84
+ };
85
+ source?: SourceInfo;
86
+ memo: string;
87
+ createdAt: number;
88
+ }
89
+ interface AnnotationSet {
90
+ annotations: Annotation[];
91
+ screenshot?: string;
92
+ viewport: {
93
+ width: number;
94
+ height: number;
95
+ };
96
+ }
97
+ interface FileChange {
98
+ file: string;
99
+ action: FileAction;
100
+ linesAdded: number;
101
+ linesRemoved: number;
102
+ }
103
+ interface ChatMessage {
104
+ id: string;
105
+ role: MessageRole;
106
+ content: string;
107
+ annotations?: AnnotationSet;
108
+ filesChanged?: FileChange[];
109
+ timestamp: number;
110
+ }
111
+
112
+ declare class ChatPanel {
113
+ private container;
114
+ private messageList;
115
+ private inputArea;
116
+ private sendButton;
117
+ private messages;
118
+ private collapsed;
119
+ private onSend?;
120
+ constructor(shadowRoot: ShadowRoot);
121
+ addMessage(msg: ChatMessage): void;
122
+ appendStream(delta: string): void;
123
+ toggle(): void;
124
+ isCollapsed(): boolean;
125
+ onMessageSend(cb: (message: string) => void): void;
126
+ private handleSend;
127
+ private renderMessage;
128
+ }
129
+
130
+ type SessionBarStatus = 'active' | 'qa-running' | 'qa-passed' | 'qa-failed';
131
+ declare class SessionBarPanel {
132
+ private container;
133
+ private statusDot;
134
+ private branchLabel;
135
+ private changeLabel;
136
+ private hmrLabel;
137
+ private endBtn;
138
+ private onEndSession?;
139
+ private visible;
140
+ constructor(shadowRoot: ShadowRoot);
141
+ show(branch: string): void;
142
+ hide(): void;
143
+ setStatus(status: SessionBarStatus): void;
144
+ updateChangedFiles(count: number): void;
145
+ setHmrStatus(connected: boolean): void;
146
+ onEnd(cb: () => void): void;
147
+ isVisible(): boolean;
148
+ }
149
+
150
+ interface QAStepDisplay {
151
+ name: string;
152
+ status: 'pending' | 'running' | 'pass' | 'fail';
153
+ duration?: number;
154
+ output?: string;
155
+ }
156
+ interface FileChangeDisplay {
157
+ file: string;
158
+ action: string;
159
+ linesAdded: number;
160
+ linesRemoved: number;
161
+ }
162
+ declare class QAResultPanel {
163
+ private overlay;
164
+ private modal;
165
+ private stepList;
166
+ private changeSummary;
167
+ private mergeBtn;
168
+ private fixBtn;
169
+ private discardBtn;
170
+ private confirmDialog;
171
+ private onMerge?;
172
+ private onFix?;
173
+ private onDiscard?;
174
+ constructor(shadowRoot: ShadowRoot);
175
+ show(): void;
176
+ hide(): void;
177
+ updateStep(step: QAStepDisplay): void;
178
+ setOverallPass(pass: boolean): void;
179
+ setChangeSummary(changes: FileChangeDisplay[]): void;
180
+ onMergeClick(cb: () => void): void;
181
+ onFixClick(cb: () => void): void;
182
+ onDiscardClick(cb: () => void): void;
183
+ private showConfirm;
184
+ }
185
+
186
+ interface ReactFiberDebugSource {
187
+ fileName: string;
188
+ lineNumber: number;
189
+ columnNumber: number;
190
+ }
191
+ interface ReactFiberType {
192
+ name?: string;
193
+ displayName?: string;
194
+ }
195
+ interface ReactFiber {
196
+ type: ReactFiberType | string | null;
197
+ stateNode: HTMLElement | null | Record<string, unknown>;
198
+ _debugSource: ReactFiberDebugSource | null;
199
+ return: ReactFiber | null;
200
+ }
201
+ declare const FiberWalker: {
202
+ /**
203
+ * Find the React fiber attached to a DOM element.
204
+ * React 18+ uses __reactFiber$<hash>, older versions use __reactInternalInstance$<hash>.
205
+ */
206
+ getFiberFromElement(el: HTMLElement): ReactFiber | null;
207
+ /**
208
+ * Extract SourceInfo from a React fiber's _debugSource.
209
+ * Returns null when debug source info is unavailable.
210
+ */
211
+ getSourceInfo(fiber: ReactFiber): SourceInfo | null;
212
+ };
213
+
214
+ declare class SourceMapper {
215
+ static detectLibrary(source: SourceInfo, wrapperPaths?: string[]): LibraryType;
216
+ static isWrapperComponent(file: string, wrapperPaths: string[]): boolean;
217
+ static formatSourcePath(file: string, line: number, column: number): string;
218
+ detectLibrary(source: SourceInfo, wrapperPaths?: string[]): LibraryType;
219
+ isWrapperComponent(file: string, wrapperPaths: string[]): boolean;
220
+ formatSourcePath(file: string, line: number, column: number): string;
221
+ }
222
+
223
+ declare class CanvasOverlay {
224
+ private canvas;
225
+ private ctx;
226
+ private mode;
227
+ private annotations;
228
+ constructor();
229
+ mount(): void;
230
+ unmount(): void;
231
+ setMode(mode: AnnotationMode): void;
232
+ getMode(): AnnotationMode;
233
+ drawHoverHighlight(rect: DOMRect): void;
234
+ drawSelectHighlight(rect: DOMRect): void;
235
+ drawBoxAnnotation(rect: {
236
+ x: number;
237
+ y: number;
238
+ width: number;
239
+ height: number;
240
+ }, memo: string): void;
241
+ clear(): void;
242
+ getAnnotations(): Annotation[];
243
+ addAnnotation(ann: Annotation): void;
244
+ clearAnnotations(): void;
245
+ }
246
+
247
+ declare class BoxTool {
248
+ private startX;
249
+ private startY;
250
+ private drawing;
251
+ startDraw(x: number, y: number): void;
252
+ updateDraw(x: number, y: number): {
253
+ x: number;
254
+ y: number;
255
+ width: number;
256
+ height: number;
257
+ };
258
+ endDraw(x: number, y: number): {
259
+ x: number;
260
+ y: number;
261
+ width: number;
262
+ height: number;
263
+ };
264
+ isDrawing(): boolean;
265
+ }
266
+
267
+ declare class TextMemo {
268
+ private input;
269
+ private visible;
270
+ constructor(container: HTMLElement);
271
+ show(x: number, y: number): void;
272
+ hide(): void;
273
+ getValue(): string;
274
+ isVisible(): boolean;
275
+ }
276
+
277
+ declare class CanvasOverlayPanel {
278
+ private overlay;
279
+ readonly boxTool: BoxTool;
280
+ private mode;
281
+ private onSourceSelect?;
282
+ private onAnnotationsReady?;
283
+ constructor();
284
+ mount(): void;
285
+ unmount(): void;
286
+ setMode(mode: AnnotationMode): void;
287
+ getMode(): AnnotationMode;
288
+ onSelect(cb: (source: SourceInfo) => void): void;
289
+ onSend(cb: (set: AnnotationSet) => void): void;
290
+ handleElementHover(el: HTMLElement): void;
291
+ handleElementSelect(el: HTMLElement): void;
292
+ collectAnnotationSet(): AnnotationSet;
293
+ send(): void;
294
+ clearAnnotations(): void;
295
+ }
296
+
297
+ declare class ToolbarPanel {
298
+ private container;
299
+ private currentTool;
300
+ private onModeChange?;
301
+ private onSend?;
302
+ private buttons;
303
+ private mounted;
304
+ constructor(shadowRoot: ShadowRoot);
305
+ mount(): void;
306
+ unmount(): void;
307
+ setActiveTool(mode: AnnotationMode): void;
308
+ getActiveTool(): AnnotationMode;
309
+ onToolChange(cb: (mode: AnnotationMode) => void): void;
310
+ onSendClick(cb: () => void): void;
311
+ isMounted(): boolean;
312
+ }
313
+
314
+ declare class InspectorPopupPanel {
315
+ private element;
316
+ private sourceMapper;
317
+ private pinned;
318
+ constructor(shadowRoot: ShadowRoot);
319
+ show(source: SourceInfo, rect: DOMRect): void;
320
+ hide(): void;
321
+ forceHide(): void;
322
+ pin(): void;
323
+ unpin(): void;
324
+ isPinned(): boolean;
325
+ isVisible(): boolean;
326
+ }
327
+
328
+ export { type Annotation, type AnnotationMode, type AnnotationSet, type AnnotationType, BoxTool, CanvasOverlay, CanvasOverlayPanel, type ChatMessage, ChatPanel, FabButton, type FabButtonOptions, FiberWalker, type FileAction, type FileChange, type FileChangeDisplay, InspectorPopupPanel, KeyboardHandler, type KeyboardHandlerCallbacks, type LibraryType, type MessageRole, QAResultPanel, type QAStepDisplay, type ReactFiber, type ReactFiberDebugSource, type ReactFiberType, SessionBarPanel, type SessionBarStatus, ShadowContainer, type SourceInfo, SourceMapper, TextMemo, Toast, type ToastVariant, ToolbarPanel };