@ewjdev/anyclick-react 4.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-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/index.d.mts +214 -35
- package/dist/index.d.ts +214 -35
- package/dist/index.js +3354 -2652
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3353 -2667
- 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-util-FRH7OT5O.mjs +6 -0
- package/dist/token-util-FRH7OT5O.mjs.map +1 -0
- package/package.json +4 -7
package/dist/index.d.ts
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$1 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';
|
|
@@ -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;
|
|
@@ -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.
|
|
@@ -792,7 +912,7 @@ declare function ContextMenu({ className, containerElement, footer, header, high
|
|
|
792
912
|
*
|
|
793
913
|
* @since 1.0.0
|
|
794
914
|
*/
|
|
795
|
-
declare const ScreenshotPreview:
|
|
915
|
+
declare const ScreenshotPreview: React__default.NamedExoticComponent<ScreenshotPreviewProps>;
|
|
796
916
|
|
|
797
917
|
/**
|
|
798
918
|
* React context for anyclick functionality.
|
|
@@ -812,12 +932,12 @@ declare const ScreenshotPreview: react__default.NamedExoticComponent<ScreenshotP
|
|
|
812
932
|
* @see {@link useAnyclick} for the recommended way to access this context
|
|
813
933
|
* @since 1.0.0
|
|
814
934
|
*/
|
|
815
|
-
declare const AnyclickContext:
|
|
935
|
+
declare const AnyclickContext: React$1.Context<AnyclickContextValue | null>;
|
|
816
936
|
/**
|
|
817
937
|
* @deprecated Use {@link AnyclickContext} instead. Will be removed in v2.0.0.
|
|
818
938
|
* @see {@link AnyclickContext}
|
|
819
939
|
*/
|
|
820
|
-
declare const FeedbackContext:
|
|
940
|
+
declare const FeedbackContext: React$1.Context<AnyclickContextValue | null>;
|
|
821
941
|
/**
|
|
822
942
|
* Hook to access anyclick context values and methods.
|
|
823
943
|
*
|
|
@@ -1010,13 +1130,31 @@ declare const useProviderStore: zustand.UseBoundStore<zustand.StoreApi<ProviderS
|
|
|
1010
1130
|
*/
|
|
1011
1131
|
declare function dispatchContextMenuEvent(event: MouseEvent, element: Element): void;
|
|
1012
1132
|
|
|
1013
|
-
declare const
|
|
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> & {
|
|
1014
1152
|
variant?: "default" | "ghost" | "outline" | "destructive";
|
|
1015
1153
|
size?: "sm" | "md" | "lg";
|
|
1016
|
-
} &
|
|
1154
|
+
} & React$1.RefAttributes<HTMLButtonElement>>;
|
|
1017
1155
|
|
|
1018
1156
|
type InputProps = InputHTMLAttributes<HTMLInputElement>;
|
|
1019
|
-
declare const Input:
|
|
1157
|
+
declare const Input: React$1.ForwardRefExoticComponent<InputProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
1020
1158
|
|
|
1021
1159
|
/**
|
|
1022
1160
|
* Available preset role identifiers.
|
|
@@ -1084,6 +1222,7 @@ interface CreatePresetMenuOptions {
|
|
|
1084
1222
|
*/
|
|
1085
1223
|
overrides?: Partial<Omit<PresetConfig, "description" | "label" | "role">>;
|
|
1086
1224
|
}
|
|
1225
|
+
|
|
1087
1226
|
/**
|
|
1088
1227
|
* Default preset configurations for each role.
|
|
1089
1228
|
*
|
|
@@ -1544,6 +1683,8 @@ interface InspectDialogEventDetail {
|
|
|
1544
1683
|
}
|
|
1545
1684
|
/**
|
|
1546
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.
|
|
1547
1688
|
*/
|
|
1548
1689
|
declare function openInspectDialog(targetElement: Element): void;
|
|
1549
1690
|
/**
|
|
@@ -1553,7 +1694,7 @@ interface InspectDialogManagerProps {
|
|
|
1553
1694
|
/** IDE configuration for "Open in IDE" feature */
|
|
1554
1695
|
ideConfig?: Partial<IDEConfig>;
|
|
1555
1696
|
/** Custom styles for the dialog */
|
|
1556
|
-
dialogStyle?:
|
|
1697
|
+
dialogStyle?: React__default.CSSProperties;
|
|
1557
1698
|
/** Custom class name for the dialog */
|
|
1558
1699
|
dialogClassName?: string;
|
|
1559
1700
|
/** Custom highlight colors for the element highlight */
|
|
@@ -1571,6 +1712,8 @@ interface InspectDialogManagerProps {
|
|
|
1571
1712
|
* Place this component once in your app (e.g., alongside AnyclickProvider) to enable
|
|
1572
1713
|
* the inspect dialog functionality from the chrome preset.
|
|
1573
1714
|
*
|
|
1715
|
+
* @deprecated Moved to `@ewjdev/anyclick-devtools`. Import `InspectDialogManager` from there instead.
|
|
1716
|
+
*
|
|
1574
1717
|
* @example
|
|
1575
1718
|
* ```tsx
|
|
1576
1719
|
* <AnyclickProvider adapter={adapter}>
|
|
@@ -1593,7 +1736,7 @@ interface AnyclickLogoProps {
|
|
|
1593
1736
|
/** Custom class name */
|
|
1594
1737
|
className?: string;
|
|
1595
1738
|
/** Custom styles */
|
|
1596
|
-
style?:
|
|
1739
|
+
style?: React__default.CSSProperties;
|
|
1597
1740
|
/** Click handler */
|
|
1598
1741
|
onClick?: () => void;
|
|
1599
1742
|
}
|
|
@@ -1631,43 +1774,79 @@ type RateLimitNotice = {
|
|
|
1631
1774
|
};
|
|
1632
1775
|
|
|
1633
1776
|
/**
|
|
1634
|
-
*
|
|
1635
|
-
* Uses ai-sdk-ui for streaming and zustand for persistence.
|
|
1777
|
+
* Return type for useQuickChat hook.
|
|
1636
1778
|
*/
|
|
1637
|
-
|
|
1779
|
+
interface UseQuickChatReturn {
|
|
1780
|
+
/** Current input value */
|
|
1638
1781
|
input: string;
|
|
1782
|
+
/** Array of chat messages */
|
|
1639
1783
|
messages: ChatMessage[];
|
|
1784
|
+
/** Whether suggestions are being loaded */
|
|
1640
1785
|
isLoadingSuggestions: boolean;
|
|
1786
|
+
/** Whether a message is being sent */
|
|
1641
1787
|
isSending: boolean;
|
|
1788
|
+
/** Whether a response is currently streaming */
|
|
1642
1789
|
isStreaming: boolean;
|
|
1790
|
+
/** Suggested prompts from AI pre-pass */
|
|
1643
1791
|
suggestedPrompts: SuggestedPrompt[];
|
|
1792
|
+
/** Context chunks extracted from target element */
|
|
1644
1793
|
contextChunks: ContextChunk[];
|
|
1794
|
+
/** Error message if any */
|
|
1645
1795
|
error: string | null;
|
|
1796
|
+
/** Debug information for troubleshooting */
|
|
1646
1797
|
debugInfo: DebugInfo | null;
|
|
1798
|
+
/** Rate limit notice if rate limited */
|
|
1647
1799
|
rateLimitNotice: RateLimitNotice | null;
|
|
1800
|
+
/** Whether chat is pinned */
|
|
1648
1801
|
isPinned: boolean;
|
|
1802
|
+
/** Last sync timestamp with backend */
|
|
1649
1803
|
lastSyncedAt: number | null;
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
showRedactionUI: boolean;
|
|
1656
|
-
showSuggestions: boolean;
|
|
1657
|
-
systemPrompt: string;
|
|
1658
|
-
placeholder: string;
|
|
1659
|
-
title: string;
|
|
1660
|
-
t3chat: T3ChatIntegrationConfig;
|
|
1661
|
-
};
|
|
1662
|
-
setInput: (input: string) => void;
|
|
1804
|
+
/** Merged configuration */
|
|
1805
|
+
config: Required<QuickChatConfig>;
|
|
1806
|
+
/** Set input value */
|
|
1807
|
+
setInput: (value: string) => void;
|
|
1808
|
+
/** Toggle a context chunk's included state */
|
|
1663
1809
|
toggleChunk: (chunkId: string) => void;
|
|
1810
|
+
/** Toggle all context chunks */
|
|
1664
1811
|
toggleAllChunks: (included: boolean) => void;
|
|
1812
|
+
/** Select a suggested prompt (sets it as input) */
|
|
1665
1813
|
selectSuggestion: (prompt: SuggestedPrompt) => void;
|
|
1814
|
+
/** Send a message (uses current input if no messageText provided) */
|
|
1666
1815
|
sendMessage: (messageText?: string) => Promise<void>;
|
|
1816
|
+
/** Clear all messages */
|
|
1667
1817
|
clearMessages: () => void;
|
|
1818
|
+
/** Set pinned state */
|
|
1668
1819
|
setIsPinned: (pinned: boolean) => void;
|
|
1820
|
+
/** Clear rate limit notice */
|
|
1669
1821
|
clearRateLimitNotice: () => void;
|
|
1670
|
-
}
|
|
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;
|
|
1671
1850
|
|
|
1672
1851
|
/**
|
|
1673
1852
|
* Style definitions for QuickChat component.
|
|
@@ -1685,4 +1864,4 @@ declare const quickChatStyles: Record<string, CSSProperties>;
|
|
|
1685
1864
|
*/
|
|
1686
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";
|
|
1687
1866
|
|
|
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 };
|
|
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 };
|