@ewjdev/anyclick-react 3.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/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as React$1 from 'react';
3
- import React__default, { CSSProperties, ReactNode } from 'react';
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?: React__default.CSSProperties;
133
+ style?: react__default.CSSProperties;
134
134
  className?: string;
135
135
  highlightColors?: HighlightColors;
136
136
  showBoxModelOverlay?: boolean;
@@ -792,7 +792,7 @@ declare function ContextMenu({ className, containerElement, footer, header, high
792
792
  *
793
793
  * @since 1.0.0
794
794
  */
795
- declare const ScreenshotPreview: React__default.NamedExoticComponent<ScreenshotPreviewProps>;
795
+ declare const ScreenshotPreview: react__default.NamedExoticComponent<ScreenshotPreviewProps>;
796
796
 
797
797
  /**
798
798
  * React context for anyclick functionality.
@@ -812,12 +812,12 @@ declare const ScreenshotPreview: React__default.NamedExoticComponent<ScreenshotP
812
812
  * @see {@link useAnyclick} for the recommended way to access this context
813
813
  * @since 1.0.0
814
814
  */
815
- declare const AnyclickContext: React$1.Context<AnyclickContextValue | null>;
815
+ declare const AnyclickContext: react.Context<AnyclickContextValue | null>;
816
816
  /**
817
817
  * @deprecated Use {@link AnyclickContext} instead. Will be removed in v2.0.0.
818
818
  * @see {@link AnyclickContext}
819
819
  */
820
- declare const FeedbackContext: React$1.Context<AnyclickContextValue | null>;
820
+ declare const FeedbackContext: react.Context<AnyclickContextValue | null>;
821
821
  /**
822
822
  * Hook to access anyclick context values and methods.
823
823
  *
@@ -1010,6 +1010,14 @@ declare const useProviderStore: zustand.UseBoundStore<zustand.StoreApi<ProviderS
1010
1010
  */
1011
1011
  declare function dispatchContextMenuEvent(event: MouseEvent, element: Element): void;
1012
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
+
1013
1021
  /**
1014
1022
  * Available preset role identifiers.
1015
1023
  *
@@ -1545,7 +1553,7 @@ interface InspectDialogManagerProps {
1545
1553
  /** IDE configuration for "Open in IDE" feature */
1546
1554
  ideConfig?: Partial<IDEConfig>;
1547
1555
  /** Custom styles for the dialog */
1548
- dialogStyle?: React__default.CSSProperties;
1556
+ dialogStyle?: react__default.CSSProperties;
1549
1557
  /** Custom class name for the dialog */
1550
1558
  dialogClassName?: string;
1551
1559
  /** Custom highlight colors for the element highlight */
@@ -1585,7 +1593,7 @@ interface AnyclickLogoProps {
1585
1593
  /** Custom class name */
1586
1594
  className?: string;
1587
1595
  /** Custom styles */
1588
- style?: React__default.CSSProperties;
1596
+ style?: react__default.CSSProperties;
1589
1597
  /** Click handler */
1590
1598
  onClick?: () => void;
1591
1599
  }
@@ -1600,10 +1608,45 @@ declare function AnyclickLogo({ size, borderWidth, primaryColor, backgroundColor
1600
1608
  */
1601
1609
  declare function QuickChat({ visible, targetElement, containerElement, onClose, onPin, isPinned: isPinnedProp, config, style, className, initialInput, onInitialInputConsumed, }: QuickChatProps): react_jsx_runtime.JSX.Element | null;
1602
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
+
1603
1633
  /**
1604
1634
  * Hook for managing QuickChat state and interactions.
1635
+ * Uses ai-sdk-ui for streaming and zustand for persistence.
1605
1636
  */
1606
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;
1607
1650
  config: {
1608
1651
  endpoint: string;
1609
1652
  model: string;
@@ -1616,20 +1659,14 @@ declare function useQuickChat(targetElement: Element | null, containerElement: E
1616
1659
  title: string;
1617
1660
  t3chat: T3ChatIntegrationConfig;
1618
1661
  };
1619
- setInput: (value: string) => void;
1662
+ setInput: (input: string) => void;
1620
1663
  toggleChunk: (chunkId: string) => void;
1621
1664
  toggleAllChunks: (included: boolean) => void;
1622
1665
  selectSuggestion: (prompt: SuggestedPrompt) => void;
1623
1666
  sendMessage: (messageText?: string) => Promise<void>;
1624
1667
  clearMessages: () => void;
1625
- input: string;
1626
- messages: ChatMessage[];
1627
- isLoadingSuggestions: boolean;
1628
- isSending: boolean;
1629
- isStreaming: boolean;
1630
- suggestedPrompts: SuggestedPrompt[];
1631
- contextChunks: ContextChunk[];
1632
- error: string | null;
1668
+ setIsPinned: (pinned: boolean) => void;
1669
+ clearRateLimitNotice: () => void;
1633
1670
  };
1634
1671
 
1635
1672
  /**
@@ -1648,4 +1685,4 @@ declare const quickChatStyles: Record<string, CSSProperties>;
1648
1685
  */
1649
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";
1650
1687
 
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 };
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 };