@ewjdev/anyclick-react 2.0.0 → 4.0.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/dist/chunk-7KW4HSJM.mjs +35 -0
- package/dist/chunk-7KW4HSJM.mjs.map +1 -0
- package/dist/chunk-YBHJXEH6.mjs +305 -0
- package/dist/chunk-YBHJXEH6.mjs.map +1 -0
- package/dist/index.css +23 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +419 -11
- package/dist/index.d.ts +419 -11
- package/dist/index.js +2539 -310
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2514 -279
- package/dist/index.mjs.map +1 -1
- package/dist/token-EXBG54PO.mjs +66 -0
- package/dist/token-EXBG54PO.mjs.map +1 -0
- package/dist/token-util-4XOQ3GFX.mjs +6 -0
- package/dist/token-util-4XOQ3GFX.mjs.map +1 -0
- package/package.json +20 -9
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import react__default, { CSSProperties, ReactNode, ButtonHTMLAttributes, InputHTMLAttributes } from 'react';
|
|
4
4
|
import { AnyclickAdapter, AnyclickType, AnyclickPayload, ScreenshotConfig, AnyclickTriggerEvent, ScreenshotData, AnyclickMenuEvent } from '@ewjdev/anyclick-core';
|
|
5
5
|
export { ALL_CURATED_PROPERTIES, AccessibilityInfo, AnyclickAdapter, AnyclickPayload, AnyclickType, BoxModelInfo, CURATED_STYLE_PROPERTIES, ComputedStylesInfo, DEFAULT_SCREENSHOT_CONFIG, DEFAULT_SENSITIVE_SELECTORS, ElementContext, ElementInspectInfo, PageContext, ScreenshotCapture, ScreenshotCaptureMode, ScreenshotConfig, ScreenshotData, captureAllScreenshots, captureScreenshot, estimateTotalSize, formatBoxModel, formatBytes, formatStylesAsCSS, getAccessibilityInfo, getAttributes, getBoxModelInfo, getComputedStyles, getElementInspectInfo, isScreenshotSupported } from '@ewjdev/anyclick-core';
|
|
6
6
|
import * as zustand from 'zustand';
|
|
@@ -130,7 +130,7 @@ interface InspectSimpleProps {
|
|
|
130
130
|
onClose: () => void;
|
|
131
131
|
onSelectElement?: (element: Element) => void;
|
|
132
132
|
ideConfig?: Partial<IDEConfig>;
|
|
133
|
-
style?:
|
|
133
|
+
style?: react__default.CSSProperties;
|
|
134
134
|
className?: string;
|
|
135
135
|
highlightColors?: HighlightColors;
|
|
136
136
|
showBoxModelOverlay?: boolean;
|
|
@@ -139,6 +139,160 @@ interface InspectSimpleProps {
|
|
|
139
139
|
}
|
|
140
140
|
declare function InspectSimple({ visible, targetElement, onClose, ideConfig, style, className, highlightColors, }: InspectSimpleProps): react_jsx_runtime.JSX.Element | null;
|
|
141
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Type definitions for QuickChat component.
|
|
144
|
+
*
|
|
145
|
+
* @module QuickChat/types
|
|
146
|
+
* @since 2.0.0
|
|
147
|
+
*/
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Context payload chunk that can be included or excluded by the user.
|
|
151
|
+
*/
|
|
152
|
+
interface ContextChunk {
|
|
153
|
+
/** Unique identifier for the chunk */
|
|
154
|
+
id: string;
|
|
155
|
+
/** Human-readable label for the chunk */
|
|
156
|
+
label: string;
|
|
157
|
+
/** The actual content/data */
|
|
158
|
+
content: string;
|
|
159
|
+
/** Type of context (element, text, error, etc.) */
|
|
160
|
+
type: "element" | "text" | "error" | "navigation" | "custom";
|
|
161
|
+
/** Whether this chunk is included in the payload (default: true) */
|
|
162
|
+
included: boolean;
|
|
163
|
+
/** Size in characters */
|
|
164
|
+
size: number;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* A suggested prompt from the AI pre-pass.
|
|
168
|
+
*/
|
|
169
|
+
interface SuggestedPrompt {
|
|
170
|
+
/** Unique identifier */
|
|
171
|
+
id: string;
|
|
172
|
+
/** The prompt text */
|
|
173
|
+
text: string;
|
|
174
|
+
/** Optional category */
|
|
175
|
+
category?: string;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Quick action available for AI responses.
|
|
179
|
+
*/
|
|
180
|
+
interface QuickAction {
|
|
181
|
+
/** Unique identifier */
|
|
182
|
+
id: string;
|
|
183
|
+
/** Label to display */
|
|
184
|
+
label: string;
|
|
185
|
+
/** Icon to display */
|
|
186
|
+
icon?: ReactNode;
|
|
187
|
+
/** Action handler */
|
|
188
|
+
onClick: () => void;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* A single chat message.
|
|
192
|
+
*/
|
|
193
|
+
interface ChatMessage {
|
|
194
|
+
/** Unique identifier */
|
|
195
|
+
id: string;
|
|
196
|
+
/** Role of the sender */
|
|
197
|
+
role: "user" | "assistant" | "system";
|
|
198
|
+
/** Message content */
|
|
199
|
+
content: string;
|
|
200
|
+
/** Timestamp */
|
|
201
|
+
timestamp: number;
|
|
202
|
+
/** Whether the message is currently streaming */
|
|
203
|
+
isStreaming?: boolean;
|
|
204
|
+
/** Quick actions available for this message */
|
|
205
|
+
actions?: QuickAction[];
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Configuration for t3.chat integration.
|
|
209
|
+
*/
|
|
210
|
+
interface T3ChatIntegrationConfig {
|
|
211
|
+
/** Whether to show the "Send to t3.chat" button */
|
|
212
|
+
enabled?: boolean;
|
|
213
|
+
/** Base URL for t3.chat (default: https://t3.chat) */
|
|
214
|
+
baseUrl?: string;
|
|
215
|
+
/** Label for the button (default: "Ask t3.chat") */
|
|
216
|
+
label?: string;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Configuration for the QuickChat component.
|
|
220
|
+
*/
|
|
221
|
+
interface QuickChatConfig {
|
|
222
|
+
/** API endpoint for chat requests */
|
|
223
|
+
endpoint?: string;
|
|
224
|
+
/** Model to use for the main chat (default: auto) */
|
|
225
|
+
model?: string;
|
|
226
|
+
/** Model to use for pre-pass suggestions (default: gpt-5-nano) */
|
|
227
|
+
prePassModel?: string;
|
|
228
|
+
/** Maximum response length in characters */
|
|
229
|
+
maxResponseLength?: number;
|
|
230
|
+
/** Whether to show context redaction UI */
|
|
231
|
+
showRedactionUI?: boolean;
|
|
232
|
+
/** Whether to show suggested prompts */
|
|
233
|
+
showSuggestions?: boolean;
|
|
234
|
+
/** Custom system prompt */
|
|
235
|
+
systemPrompt?: string;
|
|
236
|
+
/** Placeholder text for input */
|
|
237
|
+
placeholder?: string;
|
|
238
|
+
/** Header title */
|
|
239
|
+
title?: string;
|
|
240
|
+
/** t3.chat integration settings */
|
|
241
|
+
t3chat?: T3ChatIntegrationConfig;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Props for the QuickChat component.
|
|
245
|
+
*/
|
|
246
|
+
interface QuickChatProps {
|
|
247
|
+
/** Whether the chat is visible */
|
|
248
|
+
visible: boolean;
|
|
249
|
+
/** Target element that was right-clicked */
|
|
250
|
+
targetElement: Element | null;
|
|
251
|
+
/** Container element */
|
|
252
|
+
containerElement: Element | null;
|
|
253
|
+
/** Callback when chat is closed */
|
|
254
|
+
onClose: () => void;
|
|
255
|
+
/** Callback when user wants to pin the chat */
|
|
256
|
+
onPin?: (pinned: boolean) => void;
|
|
257
|
+
/** Whether the chat is pinned */
|
|
258
|
+
isPinned?: boolean;
|
|
259
|
+
/** Configuration options */
|
|
260
|
+
config?: QuickChatConfig;
|
|
261
|
+
/** Custom styles */
|
|
262
|
+
style?: CSSProperties;
|
|
263
|
+
/** Custom class name */
|
|
264
|
+
className?: string;
|
|
265
|
+
/** Initial input value (for type-to-chat feature) */
|
|
266
|
+
initialInput?: string;
|
|
267
|
+
/** Callback when initial input has been consumed */
|
|
268
|
+
onInitialInputConsumed?: () => void;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* State for the QuickChat hook.
|
|
272
|
+
*/
|
|
273
|
+
interface QuickChatState {
|
|
274
|
+
/** Current input value */
|
|
275
|
+
input: string;
|
|
276
|
+
/** Chat messages */
|
|
277
|
+
messages: ChatMessage[];
|
|
278
|
+
/** Whether we're loading suggestions */
|
|
279
|
+
isLoadingSuggestions: boolean;
|
|
280
|
+
/** Whether we're sending a message */
|
|
281
|
+
isSending: boolean;
|
|
282
|
+
/** Whether we're streaming a response */
|
|
283
|
+
isStreaming: boolean;
|
|
284
|
+
/** Suggested prompts from pre-pass */
|
|
285
|
+
suggestedPrompts: SuggestedPrompt[];
|
|
286
|
+
/** Context chunks with redaction state */
|
|
287
|
+
contextChunks: ContextChunk[];
|
|
288
|
+
/** Error message if any */
|
|
289
|
+
error: string | null;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Default configuration values.
|
|
293
|
+
*/
|
|
294
|
+
declare const DEFAULT_QUICK_CHAT_CONFIG: Required<QuickChatConfig>;
|
|
295
|
+
|
|
142
296
|
/**
|
|
143
297
|
* Type definitions for @ewjdev/anyclick-react.
|
|
144
298
|
*
|
|
@@ -439,6 +593,11 @@ interface AnyclickProviderProps {
|
|
|
439
593
|
onSubmitError?: (error: Error, payload: AnyclickPayload) => void;
|
|
440
594
|
/** Callback after successful submission */
|
|
441
595
|
onSubmitSuccess?: (payload: AnyclickPayload) => void;
|
|
596
|
+
/**
|
|
597
|
+
* Configuration for QuickChat AI assistant.
|
|
598
|
+
* Set to enable the lightweight AI chat in the context menu.
|
|
599
|
+
*/
|
|
600
|
+
quickChatConfig?: QuickChatConfig;
|
|
442
601
|
/**
|
|
443
602
|
* Whether to scope this provider to its children only.
|
|
444
603
|
* When true, events will only be captured for elements within this provider's subtree.
|
|
@@ -541,6 +700,11 @@ interface ContextMenuProps {
|
|
|
541
700
|
};
|
|
542
701
|
/** Menu positioning mode (default: 'inView') */
|
|
543
702
|
positionMode?: MenuPositionMode;
|
|
703
|
+
/**
|
|
704
|
+
* Configuration for QuickChat AI assistant.
|
|
705
|
+
* When provided, shows the QuickChat interface in the context menu.
|
|
706
|
+
*/
|
|
707
|
+
quickChatConfig?: QuickChatConfig;
|
|
544
708
|
/** Configuration for screenshot capture */
|
|
545
709
|
screenshotConfig?: ScreenshotConfig;
|
|
546
710
|
/** Custom styles */
|
|
@@ -591,7 +755,7 @@ interface ScreenshotPreviewProps {
|
|
|
591
755
|
*
|
|
592
756
|
* @since 1.0.0
|
|
593
757
|
*/
|
|
594
|
-
declare function AnyclickProvider({ adapter, children, cooldownMs, disabled, header, highlightConfig, maxAncestors, maxInnerTextLength, maxOuterHTMLLength, menuClassName, menuItems, menuStyle, metadata, onSubmitError, onSubmitSuccess, scoped, screenshotConfig, stripAttributes, targetFilter, theme, touchHoldDurationMs, touchMoveThreshold, }: AnyclickProviderProps): react_jsx_runtime.JSX.Element;
|
|
758
|
+
declare function AnyclickProvider({ adapter, children, cooldownMs, disabled, header, highlightConfig, maxAncestors, maxInnerTextLength, maxOuterHTMLLength, menuClassName, menuItems, menuStyle, metadata, onSubmitError, onSubmitSuccess, quickChatConfig, scoped, screenshotConfig, stripAttributes, targetFilter, theme, touchHoldDurationMs, touchMoveThreshold, }: AnyclickProviderProps): react_jsx_runtime.JSX.Element;
|
|
595
759
|
/**
|
|
596
760
|
* @deprecated Use {@link AnyclickProvider} instead. Will be removed in v2.0.0.
|
|
597
761
|
*/
|
|
@@ -617,7 +781,7 @@ declare function FunModeBridge(): null;
|
|
|
617
781
|
*
|
|
618
782
|
* @since 1.0.0
|
|
619
783
|
*/
|
|
620
|
-
declare function ContextMenu({ className, containerElement, footer, header, highlightConfig, isSubmitting, items, onClose, onSelect, position, positionMode, screenshotConfig, style, targetElement, visible, }: ContextMenuProps): react_jsx_runtime.JSX.Element
|
|
784
|
+
declare function ContextMenu({ className, containerElement, footer, header, highlightConfig, isSubmitting, items, onClose, onSelect, position, positionMode, quickChatConfig, screenshotConfig, style, targetElement, visible, }: ContextMenuProps): react_jsx_runtime.JSX.Element;
|
|
621
785
|
|
|
622
786
|
/**
|
|
623
787
|
* Screenshot preview component - shows captured screenshots before sending.
|
|
@@ -628,7 +792,7 @@ declare function ContextMenu({ className, containerElement, footer, header, high
|
|
|
628
792
|
*
|
|
629
793
|
* @since 1.0.0
|
|
630
794
|
*/
|
|
631
|
-
declare const ScreenshotPreview:
|
|
795
|
+
declare const ScreenshotPreview: react__default.NamedExoticComponent<ScreenshotPreviewProps>;
|
|
632
796
|
|
|
633
797
|
/**
|
|
634
798
|
* React context for anyclick functionality.
|
|
@@ -648,12 +812,12 @@ declare const ScreenshotPreview: React__default.NamedExoticComponent<ScreenshotP
|
|
|
648
812
|
* @see {@link useAnyclick} for the recommended way to access this context
|
|
649
813
|
* @since 1.0.0
|
|
650
814
|
*/
|
|
651
|
-
declare const AnyclickContext:
|
|
815
|
+
declare const AnyclickContext: react.Context<AnyclickContextValue | null>;
|
|
652
816
|
/**
|
|
653
817
|
* @deprecated Use {@link AnyclickContext} instead. Will be removed in v2.0.0.
|
|
654
818
|
* @see {@link AnyclickContext}
|
|
655
819
|
*/
|
|
656
|
-
declare const FeedbackContext:
|
|
820
|
+
declare const FeedbackContext: react.Context<AnyclickContextValue | null>;
|
|
657
821
|
/**
|
|
658
822
|
* Hook to access anyclick context values and methods.
|
|
659
823
|
*
|
|
@@ -846,6 +1010,14 @@ declare const useProviderStore: zustand.UseBoundStore<zustand.StoreApi<ProviderS
|
|
|
846
1010
|
*/
|
|
847
1011
|
declare function dispatchContextMenuEvent(event: MouseEvent, element: Element): void;
|
|
848
1012
|
|
|
1013
|
+
declare const Button: react.ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
1014
|
+
variant?: "default" | "ghost" | "outline" | "destructive";
|
|
1015
|
+
size?: "sm" | "md" | "lg";
|
|
1016
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
1017
|
+
|
|
1018
|
+
type InputProps = InputHTMLAttributes<HTMLInputElement>;
|
|
1019
|
+
declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
|
|
1020
|
+
|
|
849
1021
|
/**
|
|
850
1022
|
* Available preset role identifiers.
|
|
851
1023
|
*
|
|
@@ -987,6 +1159,160 @@ declare function createPresetMenu(role: PresetRole, options?: CreatePresetMenuOp
|
|
|
987
1159
|
*/
|
|
988
1160
|
declare function listPresets(): PresetConfig[];
|
|
989
1161
|
|
|
1162
|
+
/**
|
|
1163
|
+
* Creates a menu item for sending selected text or a query to t3.chat.
|
|
1164
|
+
*
|
|
1165
|
+
* Can be added to any custom menu configuration. Uses the current text
|
|
1166
|
+
* selection if available, otherwise opens t3.chat without a pre-filled query.
|
|
1167
|
+
*
|
|
1168
|
+
* @param options - Optional customization for the menu item
|
|
1169
|
+
* @returns A ContextMenuItem configured for t3.chat
|
|
1170
|
+
*
|
|
1171
|
+
* @example
|
|
1172
|
+
* ```tsx
|
|
1173
|
+
* import { createT3ChatMenuItem } from "@ewjdev/anyclick-react";
|
|
1174
|
+
*
|
|
1175
|
+
* const menuItems = [
|
|
1176
|
+
* { label: "Bug", type: "bug", showComment: true },
|
|
1177
|
+
* createT3ChatMenuItem(),
|
|
1178
|
+
* ];
|
|
1179
|
+
* ```
|
|
1180
|
+
*
|
|
1181
|
+
* @since 1.5.0
|
|
1182
|
+
*/
|
|
1183
|
+
declare function createT3ChatMenuItem(options?: {
|
|
1184
|
+
/** Custom label for the menu item */
|
|
1185
|
+
label?: string;
|
|
1186
|
+
/** Base URL for t3.chat */
|
|
1187
|
+
baseUrl?: string;
|
|
1188
|
+
}): ContextMenuItem;
|
|
1189
|
+
/**
|
|
1190
|
+
* Gets the currently selected text on the page.
|
|
1191
|
+
*
|
|
1192
|
+
* Useful for checking if text is selected before showing certain menu items.
|
|
1193
|
+
*
|
|
1194
|
+
* @returns The selected text, or empty string if nothing is selected
|
|
1195
|
+
*
|
|
1196
|
+
* @example
|
|
1197
|
+
* ```tsx
|
|
1198
|
+
* const selection = getSelectedText();
|
|
1199
|
+
* if (selection) {
|
|
1200
|
+
* console.log("Selected:", selection);
|
|
1201
|
+
* }
|
|
1202
|
+
* ```
|
|
1203
|
+
*
|
|
1204
|
+
* @since 1.5.0
|
|
1205
|
+
*/
|
|
1206
|
+
declare function getSelectedText(): string;
|
|
1207
|
+
/**
|
|
1208
|
+
* Checks if there is currently any text selected on the page.
|
|
1209
|
+
*
|
|
1210
|
+
* @returns true if text is selected
|
|
1211
|
+
*
|
|
1212
|
+
* @since 1.5.0
|
|
1213
|
+
*/
|
|
1214
|
+
declare function hasTextSelection(): boolean;
|
|
1215
|
+
/**
|
|
1216
|
+
* Detects if an element is or contains an image that can be uploaded.
|
|
1217
|
+
*
|
|
1218
|
+
* Checks for:
|
|
1219
|
+
* - `<img>` elements
|
|
1220
|
+
* - `<picture>` elements
|
|
1221
|
+
* - `<canvas>` elements
|
|
1222
|
+
* - `<svg>` elements
|
|
1223
|
+
* - CSS background images
|
|
1224
|
+
*
|
|
1225
|
+
* @param element - The element to check
|
|
1226
|
+
* @returns Object with isImage flag and optional image source
|
|
1227
|
+
*
|
|
1228
|
+
* @since 1.5.0
|
|
1229
|
+
*/
|
|
1230
|
+
declare function detectImageElement(element: Element | null): {
|
|
1231
|
+
isImage: boolean;
|
|
1232
|
+
src?: string;
|
|
1233
|
+
type?: "img" | "picture" | "svg" | "canvas" | "background";
|
|
1234
|
+
};
|
|
1235
|
+
/**
|
|
1236
|
+
* Creates a menu item for uploading images to UploadThing.
|
|
1237
|
+
*
|
|
1238
|
+
* The menu item will upload the target element if it's an image,
|
|
1239
|
+
* or a screenshot of the element otherwise.
|
|
1240
|
+
*
|
|
1241
|
+
* Requires an UploadThing adapter to be configured. The onClick handler
|
|
1242
|
+
* receives the target element and can use detectImageElement to determine
|
|
1243
|
+
* if it's an image.
|
|
1244
|
+
*
|
|
1245
|
+
* @param options - Configuration options
|
|
1246
|
+
* @returns A ContextMenuItem configured for UploadThing
|
|
1247
|
+
*
|
|
1248
|
+
* @example
|
|
1249
|
+
* ```tsx
|
|
1250
|
+
* import { createUploadThingMenuItem } from "@ewjdev/anyclick-react";
|
|
1251
|
+
*
|
|
1252
|
+
* const menuItems = [
|
|
1253
|
+
* createUploadThingMenuItem({
|
|
1254
|
+
* endpoint: "/api/uploadthing",
|
|
1255
|
+
* onUploadComplete: (result) => {
|
|
1256
|
+
* console.log("Uploaded:", result.url);
|
|
1257
|
+
* },
|
|
1258
|
+
* }),
|
|
1259
|
+
* ];
|
|
1260
|
+
* ```
|
|
1261
|
+
*
|
|
1262
|
+
* @since 1.5.0
|
|
1263
|
+
*/
|
|
1264
|
+
declare function createUploadThingMenuItem(options?: {
|
|
1265
|
+
/** Custom label for the menu item */
|
|
1266
|
+
label?: string;
|
|
1267
|
+
/** API endpoint for uploading */
|
|
1268
|
+
endpoint?: string;
|
|
1269
|
+
/** Callback when upload completes */
|
|
1270
|
+
onUploadComplete?: (result: {
|
|
1271
|
+
url?: string;
|
|
1272
|
+
error?: string;
|
|
1273
|
+
}) => void;
|
|
1274
|
+
/** Callback when upload fails */
|
|
1275
|
+
onUploadError?: (error: Error) => void;
|
|
1276
|
+
}): ContextMenuItem;
|
|
1277
|
+
/**
|
|
1278
|
+
* Creates a menu item for uploading screenshots to UploadThing.
|
|
1279
|
+
*
|
|
1280
|
+
* This captures a screenshot of the target element and uploads it.
|
|
1281
|
+
* Requires the screenshot preview to be enabled for best results.
|
|
1282
|
+
*
|
|
1283
|
+
* @param options - Configuration options
|
|
1284
|
+
* @returns A ContextMenuItem configured for screenshot uploads
|
|
1285
|
+
*
|
|
1286
|
+
* @example
|
|
1287
|
+
* ```tsx
|
|
1288
|
+
* import { createUploadScreenshotMenuItem } from "@ewjdev/anyclick-react";
|
|
1289
|
+
*
|
|
1290
|
+
* const menuItems = [
|
|
1291
|
+
* createUploadScreenshotMenuItem({
|
|
1292
|
+
* endpoint: "/api/uploadthing",
|
|
1293
|
+
* onUploadComplete: (result) => {
|
|
1294
|
+
* navigator.clipboard.writeText(result.url);
|
|
1295
|
+
* },
|
|
1296
|
+
* }),
|
|
1297
|
+
* ];
|
|
1298
|
+
* ```
|
|
1299
|
+
*
|
|
1300
|
+
* @since 1.5.0
|
|
1301
|
+
*/
|
|
1302
|
+
declare function createUploadScreenshotMenuItem(options?: {
|
|
1303
|
+
/** Custom label for the menu item */
|
|
1304
|
+
label?: string;
|
|
1305
|
+
/** API endpoint for uploading */
|
|
1306
|
+
endpoint?: string;
|
|
1307
|
+
/** Callback when upload completes */
|
|
1308
|
+
onUploadComplete?: (result: {
|
|
1309
|
+
url?: string;
|
|
1310
|
+
error?: string;
|
|
1311
|
+
}) => void;
|
|
1312
|
+
/** Callback when upload fails */
|
|
1313
|
+
onUploadError?: (error: Error) => void;
|
|
1314
|
+
}): ContextMenuItem;
|
|
1315
|
+
|
|
990
1316
|
/**
|
|
991
1317
|
* Style definitions for anyclick-react components.
|
|
992
1318
|
*
|
|
@@ -1227,7 +1553,7 @@ interface InspectDialogManagerProps {
|
|
|
1227
1553
|
/** IDE configuration for "Open in IDE" feature */
|
|
1228
1554
|
ideConfig?: Partial<IDEConfig>;
|
|
1229
1555
|
/** Custom styles for the dialog */
|
|
1230
|
-
dialogStyle?:
|
|
1556
|
+
dialogStyle?: react__default.CSSProperties;
|
|
1231
1557
|
/** Custom class name for the dialog */
|
|
1232
1558
|
dialogClassName?: string;
|
|
1233
1559
|
/** Custom highlight colors for the element highlight */
|
|
@@ -1267,7 +1593,7 @@ interface AnyclickLogoProps {
|
|
|
1267
1593
|
/** Custom class name */
|
|
1268
1594
|
className?: string;
|
|
1269
1595
|
/** Custom styles */
|
|
1270
|
-
style?:
|
|
1596
|
+
style?: react__default.CSSProperties;
|
|
1271
1597
|
/** Click handler */
|
|
1272
1598
|
onClick?: () => void;
|
|
1273
1599
|
}
|
|
@@ -1277,4 +1603,86 @@ interface AnyclickLogoProps {
|
|
|
1277
1603
|
*/
|
|
1278
1604
|
declare function AnyclickLogo({ size, borderWidth, primaryColor, backgroundColor, className, style, onClick, }: AnyclickLogoProps): react_jsx_runtime.JSX.Element;
|
|
1279
1605
|
|
|
1280
|
-
|
|
1606
|
+
/**
|
|
1607
|
+
* QuickChat component.
|
|
1608
|
+
*/
|
|
1609
|
+
declare function QuickChat({ visible, targetElement, containerElement, onClose, onPin, isPinned: isPinnedProp, config, style, className, initialInput, onInitialInputConsumed, }: QuickChatProps): react_jsx_runtime.JSX.Element | null;
|
|
1610
|
+
|
|
1611
|
+
type DebugInfo = {
|
|
1612
|
+
status: number;
|
|
1613
|
+
ok: boolean;
|
|
1614
|
+
contentType: string | null;
|
|
1615
|
+
rawTextPreview: string;
|
|
1616
|
+
parsedKeys?: string[];
|
|
1617
|
+
contentPreview?: string;
|
|
1618
|
+
payloadPreview?: string;
|
|
1619
|
+
timestamp: number;
|
|
1620
|
+
error?: string;
|
|
1621
|
+
};
|
|
1622
|
+
|
|
1623
|
+
type RateLimitNotice = {
|
|
1624
|
+
status: 429;
|
|
1625
|
+
message: string;
|
|
1626
|
+
retryAt?: number;
|
|
1627
|
+
retryAfterSeconds?: number;
|
|
1628
|
+
requestId?: string;
|
|
1629
|
+
endpoint?: string;
|
|
1630
|
+
raw?: string;
|
|
1631
|
+
};
|
|
1632
|
+
|
|
1633
|
+
/**
|
|
1634
|
+
* Hook for managing QuickChat state and interactions.
|
|
1635
|
+
* Uses ai-sdk-ui for streaming and zustand for persistence.
|
|
1636
|
+
*/
|
|
1637
|
+
declare function useQuickChat(targetElement: Element | null, containerElement: Element | null, config?: QuickChatConfig): {
|
|
1638
|
+
input: string;
|
|
1639
|
+
messages: ChatMessage[];
|
|
1640
|
+
isLoadingSuggestions: boolean;
|
|
1641
|
+
isSending: boolean;
|
|
1642
|
+
isStreaming: boolean;
|
|
1643
|
+
suggestedPrompts: SuggestedPrompt[];
|
|
1644
|
+
contextChunks: ContextChunk[];
|
|
1645
|
+
error: string | null;
|
|
1646
|
+
debugInfo: DebugInfo | null;
|
|
1647
|
+
rateLimitNotice: RateLimitNotice | null;
|
|
1648
|
+
isPinned: boolean;
|
|
1649
|
+
lastSyncedAt: number | null;
|
|
1650
|
+
config: {
|
|
1651
|
+
endpoint: string;
|
|
1652
|
+
model: string;
|
|
1653
|
+
prePassModel: string;
|
|
1654
|
+
maxResponseLength: number;
|
|
1655
|
+
showRedactionUI: boolean;
|
|
1656
|
+
showSuggestions: boolean;
|
|
1657
|
+
systemPrompt: string;
|
|
1658
|
+
placeholder: string;
|
|
1659
|
+
title: string;
|
|
1660
|
+
t3chat: T3ChatIntegrationConfig;
|
|
1661
|
+
};
|
|
1662
|
+
setInput: (input: string) => void;
|
|
1663
|
+
toggleChunk: (chunkId: string) => void;
|
|
1664
|
+
toggleAllChunks: (included: boolean) => void;
|
|
1665
|
+
selectSuggestion: (prompt: SuggestedPrompt) => void;
|
|
1666
|
+
sendMessage: (messageText?: string) => Promise<void>;
|
|
1667
|
+
clearMessages: () => void;
|
|
1668
|
+
setIsPinned: (pinned: boolean) => void;
|
|
1669
|
+
clearRateLimitNotice: () => void;
|
|
1670
|
+
};
|
|
1671
|
+
|
|
1672
|
+
/**
|
|
1673
|
+
* Style definitions for QuickChat component.
|
|
1674
|
+
*
|
|
1675
|
+
* @module QuickChat/styles
|
|
1676
|
+
* @since 2.0.0
|
|
1677
|
+
*/
|
|
1678
|
+
|
|
1679
|
+
/**
|
|
1680
|
+
* QuickChat component styles.
|
|
1681
|
+
*/
|
|
1682
|
+
declare const quickChatStyles: Record<string, CSSProperties>;
|
|
1683
|
+
/**
|
|
1684
|
+
* CSS keyframes for animations (to be injected).
|
|
1685
|
+
*/
|
|
1686
|
+
declare const quickChatKeyframes = "\n@keyframes blink {\n 0%, 50% { opacity: 1; }\n 51%, 100% { opacity: 0; }\n}\n\n@keyframes bounce {\n 0%, 80%, 100% { transform: scale(0); }\n 40% { transform: scale(1); }\n}\n\n@keyframes slideIn {\n from {\n opacity: 0;\n transform: translateY(-8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes slideInFromRight {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(0);\n }\n}\n\n@keyframes slideOutToRight {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(100%);\n }\n}\n\n@keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n@keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}\n\n@keyframes pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.5; }\n}\n";
|
|
1687
|
+
|
|
1688
|
+
export { AnyclickContext, type AnyclickContextValue, AnyclickLogo, type AnyclickLogoProps, AnyclickProvider, type AnyclickProviderProps, type AnyclickTheme, type AnyclickUserContext, Button, type ChatMessage, type CompactModeConfig, type ContextChunk, ContextMenu, type ContextMenuItem, type ContextMenuProps, type CreatePresetMenuOptions, DEFAULT_COMPACT_CONFIG, DEFAULT_QUICK_CHAT_CONFIG, FeedbackContext, type FeedbackMenuBadge, type FeedbackMenuStatus, FeedbackProvider, FunModeBridge, type FunModeThemeConfig, type HighlightColors, type HighlightConfig, type IDEConfig, type IDEProtocol, INSPECT_DIALOG_EVENT, Input, type InspectDialogEventDetail, InspectDialogManager, type InspectDialogManagerProps, InspectSimple, type InspectSimpleProps, type MenuPositionMode, type PinnedPosition, type PresetConfig, type PresetRole, type ProviderInstance, type QuickAction, QuickChat, type QuickChatConfig, type QuickChatProps, type QuickChatState, ScreenshotPreview, type ScreenshotPreviewProps, type SourceLocation, type SuggestedPrompt, type T3ChatIntegrationConfig, applyHighlights, buildIDEUrl, clearHighlights, createIDEOpener, createPresetMenu, createT3ChatMenuItem, createUploadScreenshotMenuItem, createUploadThingMenuItem, darkMenuStyles, defaultContainerSelectors, defaultHighlightColors, detectImageElement, detectPreferredIDE, dispatchContextMenuEvent, filterMenuItemsByRole, findContainerParent, findSourceLocationInAncestors, formatSourceLocation, generateProviderId, getBadgeStyle, getSelectedText, getSourceLocationFromElement, hasTextSelection, highlightContainer, highlightTarget, isIDEProtocolSupported, listPresets, menuCSSVariables, menuStyles, openInIDE, openInspectDialog, presetDefaults, quickChatKeyframes, quickChatStyles, useAnyclick, useFeedback, useProviderStore, useQuickChat };
|