@ewjdev/anyclick-react 3.0.0 → 5.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/README.md +62 -8
- package/dist/chunk-7KW4HSJM.mjs +35 -0
- package/dist/chunk-7KW4HSJM.mjs.map +1 -0
- package/dist/chunk-L4LZXN47.mjs +305 -0
- package/dist/chunk-L4LZXN47.mjs.map +1 -0
- package/dist/chunk-TG7QFERR.mjs +56 -0
- package/dist/chunk-TG7QFERR.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 +245 -29
- package/dist/index.d.ts +245 -29
- package/dist/index.js +3942 -2648
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3808 -2532
- package/dist/index.mjs.map +1 -1
- package/dist/token-3XZWTKZ4.mjs +66 -0
- package/dist/token-3XZWTKZ4.mjs.map +1 -0
- 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/dist/token-util-FRH7OT5O.mjs +6 -0
- package/dist/token-util-FRH7OT5O.mjs.map +1 -0
- package/package.json +12 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
|
-
import React__default, { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import React__default, { CSSProperties, ReactNode, ComponentType, HTMLAttributes, ButtonHTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes } 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';
|
|
@@ -293,6 +293,118 @@ interface QuickChatState {
|
|
|
293
293
|
*/
|
|
294
294
|
declare const DEFAULT_QUICK_CHAT_CONFIG: Required<QuickChatConfig>;
|
|
295
295
|
|
|
296
|
+
declare const ANYCLICK_STYLE_SLOTS: readonly ["menu.overlay", "menu.surface", "menu.header", "menu.headerAction", "menu.list", "menu.item", "menu.itemIcon", "menu.itemLabel", "menu.itemBadge", "menu.submenuIndicator", "menu.backButton", "menu.dragHandle", "comment.section", "comment.textarea", "comment.primaryAction", "comment.secondaryAction", "screenshot.surface", "screenshot.header", "screenshot.tab", "screenshot.tabActive", "screenshot.preview", "screenshot.empty", "screenshot.error", "screenshot.meta", "screenshot.action", "quickChat.surface", "quickChat.header", "quickChat.messageList", "quickChat.input", "quickChat.submit", "inspect.surface", "inspect.header", "inspect.content", "inspect.action", "shared.button", "shared.input", "shared.textarea", "shared.badge"];
|
|
297
|
+
type AnyclickStyleSlot = (typeof ANYCLICK_STYLE_SLOTS)[number];
|
|
298
|
+
interface AnyclickStyleTokens {
|
|
299
|
+
background: string;
|
|
300
|
+
surface: string;
|
|
301
|
+
surfaceMuted: string;
|
|
302
|
+
surfaceSubtle: string;
|
|
303
|
+
border: string;
|
|
304
|
+
text: string;
|
|
305
|
+
textMuted: string;
|
|
306
|
+
accent: string;
|
|
307
|
+
accentMuted: string;
|
|
308
|
+
accentText: string;
|
|
309
|
+
danger: string;
|
|
310
|
+
dangerMuted: string;
|
|
311
|
+
success: string;
|
|
312
|
+
warning: string;
|
|
313
|
+
focusRing: string;
|
|
314
|
+
radiusSm: string;
|
|
315
|
+
radiusMd: string;
|
|
316
|
+
radiusLg: string;
|
|
317
|
+
radiusFull: string;
|
|
318
|
+
shadowSm: string;
|
|
319
|
+
shadowMd: string;
|
|
320
|
+
shadowLg: string;
|
|
321
|
+
fontFamily: string;
|
|
322
|
+
fontMono: string;
|
|
323
|
+
fontSizeXs: string;
|
|
324
|
+
fontSizeSm: string;
|
|
325
|
+
fontSizeMd: string;
|
|
326
|
+
fontSizeLg: string;
|
|
327
|
+
lineHeightTight: number;
|
|
328
|
+
lineHeightBase: number;
|
|
329
|
+
spacing2xs: string;
|
|
330
|
+
spacingXs: string;
|
|
331
|
+
spacingSm: string;
|
|
332
|
+
spacingMd: string;
|
|
333
|
+
spacingLg: string;
|
|
334
|
+
spacingXl: string;
|
|
335
|
+
minTouchTarget: string;
|
|
336
|
+
zIndexOverlay: number;
|
|
337
|
+
zIndexSurface: number;
|
|
338
|
+
zIndexPinned: number;
|
|
339
|
+
}
|
|
340
|
+
interface AnyclickSlotState {
|
|
341
|
+
active?: boolean;
|
|
342
|
+
disabled?: boolean;
|
|
343
|
+
hovered?: boolean;
|
|
344
|
+
pressed?: boolean;
|
|
345
|
+
expanded?: boolean;
|
|
346
|
+
selected?: boolean;
|
|
347
|
+
error?: boolean;
|
|
348
|
+
loading?: boolean;
|
|
349
|
+
tone?: "accent" | "danger" | "info" | "neutral" | "success" | "warning" | (string & {});
|
|
350
|
+
size?: "sm" | "md" | "lg" | (string & {});
|
|
351
|
+
}
|
|
352
|
+
interface AnyclickSlotProps {
|
|
353
|
+
attrs?: Record<string, string | number | boolean | undefined>;
|
|
354
|
+
className?: string;
|
|
355
|
+
style?: CSSProperties;
|
|
356
|
+
}
|
|
357
|
+
interface AnyclickResolveSlotInput {
|
|
358
|
+
slot: AnyclickStyleSlot;
|
|
359
|
+
state: AnyclickSlotState;
|
|
360
|
+
tokens: AnyclickStyleTokens;
|
|
361
|
+
}
|
|
362
|
+
interface AnyclickSlotComponentProps {
|
|
363
|
+
children?: ReactNode;
|
|
364
|
+
className?: string;
|
|
365
|
+
slotName?: AnyclickStyleSlot;
|
|
366
|
+
slotState?: AnyclickSlotState;
|
|
367
|
+
style?: CSSProperties;
|
|
368
|
+
}
|
|
369
|
+
type AnyclickSurfaceProps = HTMLAttributes<HTMLDivElement> & AnyclickSlotComponentProps;
|
|
370
|
+
type AnyclickButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & AnyclickSlotComponentProps;
|
|
371
|
+
type AnyclickInputProps = InputHTMLAttributes<HTMLInputElement> & AnyclickSlotComponentProps;
|
|
372
|
+
type AnyclickTextareaProps = TextareaHTMLAttributes<HTMLTextAreaElement> & AnyclickSlotComponentProps;
|
|
373
|
+
type AnyclickTabsProps = HTMLAttributes<HTMLDivElement> & AnyclickSlotComponentProps;
|
|
374
|
+
type AnyclickTabProps = ButtonHTMLAttributes<HTMLButtonElement> & AnyclickSlotComponentProps;
|
|
375
|
+
type AnyclickBadgeProps = HTMLAttributes<HTMLSpanElement> & AnyclickSlotComponentProps;
|
|
376
|
+
interface AnyclickComponentOverrides {
|
|
377
|
+
Surface: ComponentType<AnyclickSurfaceProps>;
|
|
378
|
+
Button: ComponentType<AnyclickButtonProps>;
|
|
379
|
+
IconButton: ComponentType<AnyclickButtonProps>;
|
|
380
|
+
Input: ComponentType<AnyclickInputProps>;
|
|
381
|
+
Textarea: ComponentType<AnyclickTextareaProps>;
|
|
382
|
+
Tabs: ComponentType<AnyclickTabsProps>;
|
|
383
|
+
Tab: ComponentType<AnyclickTabProps>;
|
|
384
|
+
Badge: ComponentType<AnyclickBadgeProps>;
|
|
385
|
+
}
|
|
386
|
+
interface AnyclickStyleAdapter {
|
|
387
|
+
components?: Partial<AnyclickComponentOverrides>;
|
|
388
|
+
isFallback?: boolean;
|
|
389
|
+
name?: string;
|
|
390
|
+
resolveSlot?: (input: AnyclickResolveSlotInput) => AnyclickSlotProps | null | undefined;
|
|
391
|
+
tokens?: Partial<AnyclickStyleTokens>;
|
|
392
|
+
}
|
|
393
|
+
interface AnyclickStyleProviderProps {
|
|
394
|
+
children: ReactNode;
|
|
395
|
+
components?: Partial<AnyclickComponentOverrides>;
|
|
396
|
+
slotClassNames?: Partial<Record<AnyclickStyleSlot, string>>;
|
|
397
|
+
slotStyles?: Partial<Record<AnyclickStyleSlot, CSSProperties>>;
|
|
398
|
+
styleAdapter?: AnyclickStyleAdapter;
|
|
399
|
+
}
|
|
400
|
+
interface AnyclickResolvedStyleAdapter {
|
|
401
|
+
components: Partial<AnyclickComponentOverrides>;
|
|
402
|
+
isFallback: boolean;
|
|
403
|
+
name: string;
|
|
404
|
+
resolveSlot: (slot: AnyclickStyleSlot, state?: AnyclickSlotState, overrides?: Pick<AnyclickSlotProps, "className" | "style">) => AnyclickSlotProps;
|
|
405
|
+
tokens: AnyclickStyleTokens;
|
|
406
|
+
}
|
|
407
|
+
|
|
296
408
|
/**
|
|
297
409
|
* Type definitions for @ewjdev/anyclick-react.
|
|
298
410
|
*
|
|
@@ -335,9 +447,9 @@ interface AnyclickTheme {
|
|
|
335
447
|
funMode?: boolean | FunModeThemeConfig;
|
|
336
448
|
/** Configuration for element highlighting */
|
|
337
449
|
highlightConfig?: HighlightConfig;
|
|
338
|
-
/**
|
|
450
|
+
/** @deprecated Use `slotClassNames["menu.surface"]` or a style adapter instead. */
|
|
339
451
|
menuClassName?: string;
|
|
340
|
-
/**
|
|
452
|
+
/** @deprecated Use `slotStyles["menu.surface"]` or a style adapter instead. */
|
|
341
453
|
menuStyle?: CSSProperties;
|
|
342
454
|
/** Configuration for screenshot capture */
|
|
343
455
|
screenshotConfig?: ScreenshotConfig;
|
|
@@ -579,13 +691,13 @@ interface AnyclickProviderProps {
|
|
|
579
691
|
maxInnerTextLength?: number;
|
|
580
692
|
/** Maximum length for outerHTML capture */
|
|
581
693
|
maxOuterHTMLLength?: number;
|
|
582
|
-
/**
|
|
694
|
+
/** @deprecated Use `slotClassNames["menu.surface"]` or a style adapter instead. */
|
|
583
695
|
menuClassName?: string;
|
|
584
696
|
/** Custom menu items (defaults to Issue, Feature, Like) */
|
|
585
697
|
menuItems?: ContextMenuItem[];
|
|
586
698
|
/** Menu positioning mode (default: 'inView') */
|
|
587
699
|
menuPositionMode?: MenuPositionMode;
|
|
588
|
-
/**
|
|
700
|
+
/** @deprecated Use `slotStyles["menu.surface"]` or a style adapter instead. */
|
|
589
701
|
menuStyle?: CSSProperties;
|
|
590
702
|
/** Additional metadata to include with every submission */
|
|
591
703
|
metadata?: Record<string, unknown>;
|
|
@@ -620,6 +732,14 @@ interface AnyclickProviderProps {
|
|
|
620
732
|
* Set to null or { disabled: true } to disable anyclick in this subtree.
|
|
621
733
|
*/
|
|
622
734
|
theme?: AnyclickTheme | null;
|
|
735
|
+
/** Slot-level class overrides merged after inherited style providers. */
|
|
736
|
+
slotClassNames?: Partial<Record<AnyclickStyleSlot, string>>;
|
|
737
|
+
/** Slot-level inline style overrides merged after inherited style providers. */
|
|
738
|
+
slotStyles?: Partial<Record<AnyclickStyleSlot, CSSProperties>>;
|
|
739
|
+
/** Primitive component overrides for DOM replacement scenarios. */
|
|
740
|
+
components?: Partial<AnyclickComponentOverrides>;
|
|
741
|
+
/** Local style adapter merged on top of the nearest AnyclickStyleProvider. */
|
|
742
|
+
styleAdapter?: AnyclickStyleAdapter;
|
|
623
743
|
/** Duration in ms to hold touch before triggering context menu (default: 500) */
|
|
624
744
|
touchHoldDurationMs?: number;
|
|
625
745
|
/** Maximum movement in px before touch hold is cancelled (default: 10) */
|
|
@@ -755,7 +875,7 @@ interface ScreenshotPreviewProps {
|
|
|
755
875
|
*
|
|
756
876
|
* @since 1.0.0
|
|
757
877
|
*/
|
|
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;
|
|
878
|
+
declare function AnyclickProvider({ adapter, children, cooldownMs, disabled, header, highlightConfig, maxAncestors, maxInnerTextLength, maxOuterHTMLLength, menuClassName, menuItems, menuPositionMode, menuStyle, metadata, onSubmitError, onSubmitSuccess, quickChatConfig, scoped, screenshotConfig, slotClassNames, slotStyles, styleAdapter, stripAttributes, targetFilter, theme, touchHoldDurationMs, touchMoveThreshold, components, }: AnyclickProviderProps): react_jsx_runtime.JSX.Element;
|
|
759
879
|
/**
|
|
760
880
|
* @deprecated Use {@link AnyclickProvider} instead. Will be removed in v2.0.0.
|
|
761
881
|
*/
|
|
@@ -781,7 +901,7 @@ declare function FunModeBridge(): null;
|
|
|
781
901
|
*
|
|
782
902
|
* @since 1.0.0
|
|
783
903
|
*/
|
|
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;
|
|
904
|
+
declare function ContextMenu({ className, containerElement, footer, header, highlightConfig, isSubmitting, items, onClose, onSelect, position, positionMode, quickChatConfig, screenshotConfig, style: surfaceStyle, targetElement, visible, }: ContextMenuProps): react_jsx_runtime.JSX.Element;
|
|
785
905
|
|
|
786
906
|
/**
|
|
787
907
|
* Screenshot preview component - shows captured screenshots before sending.
|
|
@@ -1010,6 +1130,32 @@ declare const useProviderStore: zustand.UseBoundStore<zustand.StoreApi<ProviderS
|
|
|
1010
1130
|
*/
|
|
1011
1131
|
declare function dispatchContextMenuEvent(event: MouseEvent, element: Element): void;
|
|
1012
1132
|
|
|
1133
|
+
declare const fallbackAnyclickStyleAdapter: AnyclickStyleAdapter;
|
|
1134
|
+
|
|
1135
|
+
declare function composeClassNames(...values: Array<string | null | undefined | false>): string | undefined;
|
|
1136
|
+
declare function composeInlineStyles(...values: Array<React__default.CSSProperties | null | undefined>): React__default.CSSProperties | undefined;
|
|
1137
|
+
declare function mergeStyleAdapters(...adapters: Array<AnyclickStyleAdapter | null | undefined>): AnyclickResolvedStyleAdapter;
|
|
1138
|
+
declare function resolveSlotProps(adapter: AnyclickResolvedStyleAdapter, slot: AnyclickStyleSlot, state?: AnyclickSlotState, overrides?: Pick<AnyclickSlotProps, "className" | "style">): AnyclickSlotProps;
|
|
1139
|
+
declare function useAnyclickStyle(): AnyclickResolvedStyleAdapter;
|
|
1140
|
+
declare function AnyclickStyleProvider({ children, components, slotClassNames, slotStyles, styleAdapter, }: AnyclickStyleProviderProps): react_jsx_runtime.JSX.Element;
|
|
1141
|
+
|
|
1142
|
+
declare const AnyclickSurface: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & AnyclickSlotComponentProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
1143
|
+
declare const AnyclickButton: React__default.ForwardRefExoticComponent<React__default.ButtonHTMLAttributes<HTMLButtonElement> & AnyclickSlotComponentProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
1144
|
+
declare const AnyclickIconButton: React__default.ForwardRefExoticComponent<React__default.ButtonHTMLAttributes<HTMLButtonElement> & AnyclickSlotComponentProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
1145
|
+
declare const AnyclickInput: React__default.ForwardRefExoticComponent<React__default.InputHTMLAttributes<HTMLInputElement> & AnyclickSlotComponentProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
1146
|
+
declare const AnyclickTextarea: React__default.ForwardRefExoticComponent<React__default.TextareaHTMLAttributes<HTMLTextAreaElement> & AnyclickSlotComponentProps & React__default.RefAttributes<HTMLTextAreaElement>>;
|
|
1147
|
+
declare const AnyclickTabs: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & AnyclickSlotComponentProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
1148
|
+
declare const AnyclickTab: React__default.ForwardRefExoticComponent<React__default.ButtonHTMLAttributes<HTMLButtonElement> & AnyclickSlotComponentProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
1149
|
+
declare const AnyclickBadge: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLSpanElement> & AnyclickSlotComponentProps & React__default.RefAttributes<HTMLSpanElement>>;
|
|
1150
|
+
|
|
1151
|
+
declare const Button: React$1.ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
1152
|
+
variant?: "default" | "ghost" | "outline" | "destructive";
|
|
1153
|
+
size?: "sm" | "md" | "lg";
|
|
1154
|
+
} & React$1.RefAttributes<HTMLButtonElement>>;
|
|
1155
|
+
|
|
1156
|
+
type InputProps = InputHTMLAttributes<HTMLInputElement>;
|
|
1157
|
+
declare const Input: React$1.ForwardRefExoticComponent<InputProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
1158
|
+
|
|
1013
1159
|
/**
|
|
1014
1160
|
* Available preset role identifiers.
|
|
1015
1161
|
*
|
|
@@ -1076,6 +1222,7 @@ interface CreatePresetMenuOptions {
|
|
|
1076
1222
|
*/
|
|
1077
1223
|
overrides?: Partial<Omit<PresetConfig, "description" | "label" | "role">>;
|
|
1078
1224
|
}
|
|
1225
|
+
|
|
1079
1226
|
/**
|
|
1080
1227
|
* Default preset configurations for each role.
|
|
1081
1228
|
*
|
|
@@ -1536,6 +1683,8 @@ interface InspectDialogEventDetail {
|
|
|
1536
1683
|
}
|
|
1537
1684
|
/**
|
|
1538
1685
|
* Dispatch an event to open the inspect dialog for an element
|
|
1686
|
+
*
|
|
1687
|
+
* @deprecated Moved to `@ewjdev/anyclick-devtools`. Import `openInspectDialog` from there instead.
|
|
1539
1688
|
*/
|
|
1540
1689
|
declare function openInspectDialog(targetElement: Element): void;
|
|
1541
1690
|
/**
|
|
@@ -1563,6 +1712,8 @@ interface InspectDialogManagerProps {
|
|
|
1563
1712
|
* Place this component once in your app (e.g., alongside AnyclickProvider) to enable
|
|
1564
1713
|
* the inspect dialog functionality from the chrome preset.
|
|
1565
1714
|
*
|
|
1715
|
+
* @deprecated Moved to `@ewjdev/anyclick-devtools`. Import `InspectDialogManager` from there instead.
|
|
1716
|
+
*
|
|
1566
1717
|
* @example
|
|
1567
1718
|
* ```tsx
|
|
1568
1719
|
* <AnyclickProvider adapter={adapter}>
|
|
@@ -1600,37 +1751,102 @@ declare function AnyclickLogo({ size, borderWidth, primaryColor, backgroundColor
|
|
|
1600
1751
|
*/
|
|
1601
1752
|
declare function QuickChat({ visible, targetElement, containerElement, onClose, onPin, isPinned: isPinnedProp, config, style, className, initialInput, onInitialInputConsumed, }: QuickChatProps): react_jsx_runtime.JSX.Element | null;
|
|
1602
1753
|
|
|
1754
|
+
type DebugInfo = {
|
|
1755
|
+
status: number;
|
|
1756
|
+
ok: boolean;
|
|
1757
|
+
contentType: string | null;
|
|
1758
|
+
rawTextPreview: string;
|
|
1759
|
+
parsedKeys?: string[];
|
|
1760
|
+
contentPreview?: string;
|
|
1761
|
+
payloadPreview?: string;
|
|
1762
|
+
timestamp: number;
|
|
1763
|
+
error?: string;
|
|
1764
|
+
};
|
|
1765
|
+
|
|
1766
|
+
type RateLimitNotice = {
|
|
1767
|
+
status: 429;
|
|
1768
|
+
message: string;
|
|
1769
|
+
retryAt?: number;
|
|
1770
|
+
retryAfterSeconds?: number;
|
|
1771
|
+
requestId?: string;
|
|
1772
|
+
endpoint?: string;
|
|
1773
|
+
raw?: string;
|
|
1774
|
+
};
|
|
1775
|
+
|
|
1603
1776
|
/**
|
|
1604
|
-
*
|
|
1777
|
+
* Return type for useQuickChat hook.
|
|
1605
1778
|
*/
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
endpoint: string;
|
|
1609
|
-
model: string;
|
|
1610
|
-
prePassModel: string;
|
|
1611
|
-
maxResponseLength: number;
|
|
1612
|
-
showRedactionUI: boolean;
|
|
1613
|
-
showSuggestions: boolean;
|
|
1614
|
-
systemPrompt: string;
|
|
1615
|
-
placeholder: string;
|
|
1616
|
-
title: string;
|
|
1617
|
-
t3chat: T3ChatIntegrationConfig;
|
|
1618
|
-
};
|
|
1619
|
-
setInput: (value: string) => void;
|
|
1620
|
-
toggleChunk: (chunkId: string) => void;
|
|
1621
|
-
toggleAllChunks: (included: boolean) => void;
|
|
1622
|
-
selectSuggestion: (prompt: SuggestedPrompt) => void;
|
|
1623
|
-
sendMessage: (messageText?: string) => Promise<void>;
|
|
1624
|
-
clearMessages: () => void;
|
|
1779
|
+
interface UseQuickChatReturn {
|
|
1780
|
+
/** Current input value */
|
|
1625
1781
|
input: string;
|
|
1782
|
+
/** Array of chat messages */
|
|
1626
1783
|
messages: ChatMessage[];
|
|
1784
|
+
/** Whether suggestions are being loaded */
|
|
1627
1785
|
isLoadingSuggestions: boolean;
|
|
1786
|
+
/** Whether a message is being sent */
|
|
1628
1787
|
isSending: boolean;
|
|
1788
|
+
/** Whether a response is currently streaming */
|
|
1629
1789
|
isStreaming: boolean;
|
|
1790
|
+
/** Suggested prompts from AI pre-pass */
|
|
1630
1791
|
suggestedPrompts: SuggestedPrompt[];
|
|
1792
|
+
/** Context chunks extracted from target element */
|
|
1631
1793
|
contextChunks: ContextChunk[];
|
|
1794
|
+
/** Error message if any */
|
|
1632
1795
|
error: string | null;
|
|
1633
|
-
|
|
1796
|
+
/** Debug information for troubleshooting */
|
|
1797
|
+
debugInfo: DebugInfo | null;
|
|
1798
|
+
/** Rate limit notice if rate limited */
|
|
1799
|
+
rateLimitNotice: RateLimitNotice | null;
|
|
1800
|
+
/** Whether chat is pinned */
|
|
1801
|
+
isPinned: boolean;
|
|
1802
|
+
/** Last sync timestamp with backend */
|
|
1803
|
+
lastSyncedAt: number | null;
|
|
1804
|
+
/** Merged configuration */
|
|
1805
|
+
config: Required<QuickChatConfig>;
|
|
1806
|
+
/** Set input value */
|
|
1807
|
+
setInput: (value: string) => void;
|
|
1808
|
+
/** Toggle a context chunk's included state */
|
|
1809
|
+
toggleChunk: (chunkId: string) => void;
|
|
1810
|
+
/** Toggle all context chunks */
|
|
1811
|
+
toggleAllChunks: (included: boolean) => void;
|
|
1812
|
+
/** Select a suggested prompt (sets it as input) */
|
|
1813
|
+
selectSuggestion: (prompt: SuggestedPrompt) => void;
|
|
1814
|
+
/** Send a message (uses current input if no messageText provided) */
|
|
1815
|
+
sendMessage: (messageText?: string) => Promise<void>;
|
|
1816
|
+
/** Clear all messages */
|
|
1817
|
+
clearMessages: () => void;
|
|
1818
|
+
/** Set pinned state */
|
|
1819
|
+
setIsPinned: (pinned: boolean) => void;
|
|
1820
|
+
/** Clear rate limit notice */
|
|
1821
|
+
clearRateLimitNotice: () => void;
|
|
1822
|
+
}
|
|
1823
|
+
/**
|
|
1824
|
+
* Hook for managing QuickChat state and interactions.
|
|
1825
|
+
*
|
|
1826
|
+
* Provides a complete chat interface with:
|
|
1827
|
+
* - AI-powered streaming responses via ai-sdk
|
|
1828
|
+
* - Context extraction from DOM elements
|
|
1829
|
+
* - Message persistence (24h localStorage)
|
|
1830
|
+
* - Suggested prompts
|
|
1831
|
+
* - Rate limiting handling
|
|
1832
|
+
* - Backend synchronization
|
|
1833
|
+
*
|
|
1834
|
+
* @param targetElement - The DOM element to extract context from (e.g., right-clicked element)
|
|
1835
|
+
* @param containerElement - Optional container element for scoped context extraction
|
|
1836
|
+
* @param config - Configuration options (endpoint, model, systemPrompt, etc.)
|
|
1837
|
+
*
|
|
1838
|
+
* @returns Object containing chat state and control functions
|
|
1839
|
+
*
|
|
1840
|
+
* @example
|
|
1841
|
+
* ```tsx
|
|
1842
|
+
* const { messages, input, sendMessage, isSending } = useQuickChat(
|
|
1843
|
+
* targetElement,
|
|
1844
|
+
* containerElement,
|
|
1845
|
+
* { endpoint: '/api/chat', model: 'gpt-4' }
|
|
1846
|
+
* );
|
|
1847
|
+
* ```
|
|
1848
|
+
*/
|
|
1849
|
+
declare function useQuickChat(targetElement: Element | null, containerElement: Element | null, config?: QuickChatConfig): UseQuickChatReturn;
|
|
1634
1850
|
|
|
1635
1851
|
/**
|
|
1636
1852
|
* Style definitions for QuickChat component.
|
|
@@ -1648,4 +1864,4 @@ declare const quickChatStyles: Record<string, CSSProperties>;
|
|
|
1648
1864
|
*/
|
|
1649
1865
|
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";
|
|
1650
1866
|
|
|
1651
|
-
export { AnyclickContext, type AnyclickContextValue, AnyclickLogo, type AnyclickLogoProps, AnyclickProvider, type AnyclickProviderProps, type AnyclickTheme, type AnyclickUserContext, 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, 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 };
|
|
1867
|
+
export { ANYCLICK_STYLE_SLOTS, AnyclickBadge, type AnyclickBadgeProps, AnyclickButton, type AnyclickButtonProps, type AnyclickComponentOverrides, AnyclickContext, type AnyclickContextValue, AnyclickIconButton, AnyclickInput, type AnyclickInputProps, AnyclickLogo, type AnyclickLogoProps, AnyclickProvider, type AnyclickProviderProps, type AnyclickResolvedStyleAdapter, type AnyclickSlotProps, type AnyclickSlotState, type AnyclickStyleAdapter, AnyclickStyleProvider, type AnyclickStyleProviderProps, type AnyclickStyleSlot, type AnyclickStyleTokens, AnyclickSurface, type AnyclickSurfaceProps, AnyclickTab, type AnyclickTabProps, AnyclickTabs, type AnyclickTabsProps, AnyclickTextarea, type AnyclickTextareaProps, 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, composeClassNames, composeInlineStyles, createIDEOpener, createPresetMenu, createT3ChatMenuItem, createUploadScreenshotMenuItem, createUploadThingMenuItem, darkMenuStyles, defaultContainerSelectors, defaultHighlightColors, detectImageElement, detectPreferredIDE, dispatchContextMenuEvent, fallbackAnyclickStyleAdapter, filterMenuItemsByRole, findContainerParent, findSourceLocationInAncestors, formatSourceLocation, generateProviderId, getBadgeStyle, getSelectedText, getSourceLocationFromElement, hasTextSelection, highlightContainer, highlightTarget, isIDEProtocolSupported, listPresets, menuCSSVariables, menuStyles, mergeStyleAdapters, openInIDE, openInspectDialog, presetDefaults, quickChatKeyframes, quickChatStyles, resolveSlotProps, useAnyclick, useAnyclickStyle, useFeedback, useProviderStore, useQuickChat };
|