@ewjdev/anyclick-react 1.4.0 → 2.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,10 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { AnyclickAdapter, AnyclickTriggerEvent, AnyclickType, AnyclickPayload, ScreenshotConfig, ScreenshotData, AnyclickMenuEvent } from '@ewjdev/anyclick-core';
3
- 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';
4
2
  import * as React$1 from 'react';
5
3
  import React__default, { ReactNode, CSSProperties } from 'react';
4
+ import { AnyclickAdapter, AnyclickType, AnyclickPayload, ScreenshotConfig, AnyclickTriggerEvent, ScreenshotData, AnyclickMenuEvent } from '@ewjdev/anyclick-core';
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';
7
- import * as zustand_middleware from 'zustand/middleware';
8
7
 
9
8
  /**
10
9
  * IDE protocol handler integration for opening files directly in IDEs.
@@ -76,18 +75,9 @@ declare function createIDEOpener(config?: Partial<IDEConfig>): (location: Source
76
75
  */
77
76
  declare function formatSourceLocation(location: SourceLocation): string;
78
77
 
79
- /**
80
- * Position where the dialog is pinned
81
- */
82
78
  type PinnedPosition = "left" | "right" | "top" | "bottom" | "floating";
83
- /**
84
- * Compact mode configuration type
85
- * Adjust these values to control compact styling
86
- */
87
79
  interface CompactModeConfig {
88
- /** Base scaling factor (0.75 = 75% of normal size) */
89
80
  scale: number;
90
- /** Font sizes in pixels */
91
81
  fonts: {
92
82
  base: number;
93
83
  title: number;
@@ -99,7 +89,6 @@ interface CompactModeConfig {
99
89
  styleRow: number;
100
90
  button: number;
101
91
  };
102
- /** Spacing (padding/margins) as CSS values */
103
92
  spacing: {
104
93
  headerPadding: string;
105
94
  identityPadding: string;
@@ -114,7 +103,6 @@ interface CompactModeConfig {
114
103
  propertyRowPadding: string;
115
104
  styleRowPadding: string;
116
105
  };
117
- /** Gap values as CSS values */
118
106
  gaps: {
119
107
  headerTitle: string;
120
108
  pinButtons: string;
@@ -123,7 +111,6 @@ interface CompactModeConfig {
123
111
  button: string;
124
112
  footer: string;
125
113
  };
126
- /** Size values in pixels */
127
114
  sizes: {
128
115
  dialogWidth: number;
129
116
  closeButton: number;
@@ -132,58 +119,59 @@ interface CompactModeConfig {
132
119
  categoryMarginBottom: number;
133
120
  styleCategoryHeaderMarginBottom: number;
134
121
  };
135
- /** Letter spacing values */
136
122
  letterSpacing: {
137
123
  sectionTitle: string;
138
124
  };
139
125
  }
140
- /**
141
- * Default compact mode configuration
142
- * Use this as a base to create custom configurations
143
- */
144
126
  declare const DEFAULT_COMPACT_CONFIG: CompactModeConfig;
145
- /**
146
- * Props for the InspectDialog component
147
- */
148
- interface InspectDialogProps {
149
- /** Whether the dialog is visible */
127
+ interface InspectSimpleProps {
150
128
  visible: boolean;
151
- /** The element being inspected */
152
129
  targetElement: Element | null;
153
- /** Callback when dialog is closed */
154
130
  onClose: () => void;
155
- /** Callback when selecting a different element (e.g., from modified elements list) */
156
131
  onSelectElement?: (element: Element) => void;
157
- /** IDE configuration for "Open in IDE" feature */
158
132
  ideConfig?: Partial<IDEConfig>;
159
- /** Custom styles for the dialog */
160
133
  style?: React__default.CSSProperties;
161
- /** Custom class name */
162
134
  className?: string;
163
- /** Custom highlight colors */
164
135
  highlightColors?: HighlightColors;
165
- /** Whether to show box model overlay (padding/margin visualization) */
166
136
  showBoxModelOverlay?: boolean;
167
- /** Initial pinned position. Defaults to "floating" (centered) */
168
137
  initialPinnedPosition?: PinnedPosition;
169
- /** Custom compact mode configuration. Partially override DEFAULT_COMPACT_CONFIG */
170
138
  compactConfig?: Partial<CompactModeConfig>;
171
139
  }
172
- declare function InspectDialog({ visible, targetElement, onClose, onSelectElement, ideConfig, style, className, highlightColors, showBoxModelOverlay, initialPinnedPosition, compactConfig, }: InspectDialogProps): react_jsx_runtime.JSX.Element | null;
140
+ declare function InspectSimple({ visible, targetElement, onClose, ideConfig, style, className, highlightColors, }: InspectSimpleProps): react_jsx_runtime.JSX.Element | null;
141
+
142
+ /**
143
+ * Type definitions for @ewjdev/anyclick-react.
144
+ *
145
+ * Contains all public interfaces, types, and utility functions
146
+ * for configuring anyclick providers, menus, and themes.
147
+ *
148
+ * @module types
149
+ * @since 1.0.0
150
+ */
173
151
 
174
152
  /**
175
- * Theme configuration for AnyclickProvider
176
- * Supports nested theming with inheritance
153
+ * Theme configuration for AnyclickProvider.
154
+ *
155
+ * Supports nested theming with inheritance - child providers automatically
156
+ * inherit and can override parent theme settings.
157
+ *
158
+ * @example
159
+ * ```tsx
160
+ * const theme: AnyclickTheme = {
161
+ * menuStyle: { backgroundColor: "#1a1a1a" },
162
+ * highlightConfig: {
163
+ * colors: { targetColor: "#ef4444" },
164
+ * },
165
+ * };
166
+ *
167
+ * <AnyclickProvider adapter={adapter} theme={theme}>
168
+ * <App />
169
+ * </AnyclickProvider>
170
+ * ```
171
+ *
172
+ * @since 1.0.0
177
173
  */
178
174
  interface AnyclickTheme {
179
- /** Custom styles for the context menu */
180
- menuStyle?: CSSProperties;
181
- /** Custom class name for the context menu */
182
- menuClassName?: string;
183
- /** Configuration for element highlighting */
184
- highlightConfig?: HighlightConfig;
185
- /** Configuration for screenshot capture */
186
- screenshotConfig?: ScreenshotConfig;
187
175
  /** Whether anyclick functionality is disabled in this theme */
188
176
  disabled?: boolean;
189
177
  /**
@@ -191,159 +179,282 @@ interface AnyclickTheme {
191
179
  * When true/configured, a FunModeBridge can hand off the track to the pointer.
192
180
  */
193
181
  funMode?: boolean | FunModeThemeConfig;
182
+ /** Configuration for element highlighting */
183
+ highlightConfig?: HighlightConfig;
184
+ /** Custom class name for the context menu */
185
+ menuClassName?: string;
186
+ /** Custom styles for the context menu */
187
+ menuStyle?: CSSProperties;
188
+ /** Configuration for screenshot capture */
189
+ screenshotConfig?: ScreenshotConfig;
194
190
  }
195
191
  /**
196
- * Optional fun mode configuration (forwarded to pointer fun mode)
192
+ * Optional fun mode configuration (forwarded to pointer fun mode).
193
+ *
194
+ * @since 1.3.0
197
195
  */
198
196
  interface FunModeThemeConfig {
197
+ /** Optional acceleration override */
198
+ acceleration?: number;
199
199
  /** Whether fun mode is enabled (default: true) */
200
200
  enabled?: boolean;
201
201
  /** Optional max speed override for this provider */
202
202
  maxSpeed?: number;
203
- /** Optional acceleration override */
204
- acceleration?: number;
205
203
  }
206
204
  /**
207
- * Menu positioning modes
208
- * - static: Menu stays at exact click position (may go off-screen)
209
- * - inView: Menu adjusts position to stay fully visible in viewport
210
- * - dynamic: User can drag the menu to reposition it
211
- */
212
- type MenuPositionMode = "static" | "inView" | "dynamic";
213
- /**
214
- * Configuration for highlight colors
215
- */
216
- interface HighlightColors {
217
- /** Color for the target element highlight (default: #3b82f6 - blue) */
218
- targetColor?: string;
219
- /** Color for the container element highlight (default: #8b5cf6 - purple) */
220
- containerColor?: string;
221
- /** Opacity for the target shadow (default: 0.25) */
222
- targetShadowOpacity?: number;
223
- /** Opacity for the container shadow (default: 0.1) */
224
- containerShadowOpacity?: number;
225
- }
226
- /**
227
- * Configuration for highlight behavior
205
+ * Menu positioning modes for the context menu.
206
+ *
207
+ * - `static` - Menu stays at exact click position (may go off-screen)
208
+ * - `inView` - Menu adjusts position to stay fully visible in viewport
209
+ * - `dynamic` - User can drag the menu to reposition it
210
+ *
211
+ * @since 1.1.0
228
212
  */
229
- interface HighlightConfig {
230
- /** Whether to show highlights (default: true) */
231
- enabled?: boolean;
232
- /** Custom colors for highlights */
233
- colors?: HighlightColors;
234
- /** CSS selectors to identify container elements */
235
- containerSelectors?: string[];
236
- /** Minimum number of children for an element to be considered a container (default: 2) */
237
- minChildrenForContainer?: number;
238
- }
213
+ type MenuPositionMode = "dynamic" | "inView" | "static";
239
214
  /**
240
- * Menu item displayed in the Anyclick context menu
215
+ * Menu item displayed in the Anyclick context menu.
216
+ *
217
+ * @example
218
+ * ```tsx
219
+ * const menuItems: ContextMenuItem[] = [
220
+ * {
221
+ * type: "bug",
222
+ * label: "Report Bug",
223
+ * icon: <BugIcon />,
224
+ * showComment: true,
225
+ * },
226
+ * {
227
+ * type: "feature",
228
+ * label: "Request Feature",
229
+ * showComment: true,
230
+ * requiredRoles: ["admin", "developer"],
231
+ * },
232
+ * ];
233
+ * ```
234
+ *
235
+ * @since 1.0.0
241
236
  */
242
237
  interface ContextMenuItem {
243
- /** Feedback type for this option (use unique identifier for parent items with children) */
244
- type: AnyclickType;
245
- /** Display label */
246
- label: string;
247
- /** Optional icon */
248
- icon?: ReactNode;
249
- /** Whether to show a comment input for this type */
250
- showComment?: boolean;
251
- /** Optional status to signal availability (e.g., coming soon) */
252
- status?: FeedbackMenuStatus;
253
238
  /** Optional badge to render next to the label */
254
239
  badge?: FeedbackMenuBadge;
255
- /** Optional role(s) required to see this menu item */
256
- requiredRoles?: string[];
257
240
  /** Child menu items (creates a submenu) */
258
241
  children?: ContextMenuItem[];
242
+ /** Optional icon */
243
+ icon?: ReactNode;
244
+ /** Display label */
245
+ label: string;
259
246
  /**
260
247
  * Optional click handler for custom behavior.
261
248
  * Return `false` (or a Promise resolving to false) to skip the default submission flow.
262
249
  */
263
250
  onClick?: (context: {
264
- targetElement: Element | null;
265
- containerElement: Element | null;
266
251
  closeMenu: () => void;
267
- }) => void | boolean | Promise<void | boolean>;
252
+ containerElement: Element | null;
253
+ targetElement: Element | null;
254
+ }) => boolean | Promise<boolean | void> | void;
255
+ /** Optional role(s) required to see this menu item */
256
+ requiredRoles?: string[];
257
+ /** Whether to show a comment input for this type */
258
+ showComment?: boolean;
259
+ /** Optional status to signal availability (e.g., coming soon) */
260
+ status?: FeedbackMenuStatus;
261
+ /** Feedback type for this option (use unique identifier for parent items with children) */
262
+ type: AnyclickType;
268
263
  }
269
264
  /**
270
- * Visual badge for menu items
265
+ * Visual badge for menu items.
266
+ *
267
+ * @example
268
+ * ```tsx
269
+ * const badge: FeedbackMenuBadge = {
270
+ * label: "New",
271
+ * tone: "success",
272
+ * };
273
+ * ```
274
+ *
275
+ * @since 1.2.0
271
276
  */
272
277
  interface FeedbackMenuBadge {
273
278
  /** Text shown inside the badge */
274
279
  label: string;
275
280
  /** Optional tone to drive styling */
276
- tone?: "neutral" | "info" | "warning" | "success";
281
+ tone?: "info" | "neutral" | "success" | "warning";
277
282
  }
278
283
  /**
279
- * Status of a menu item used for presets (e.g., coming soon)
284
+ * Status of a menu item used for presets.
285
+ *
286
+ * - `available` - Item is fully functional
287
+ * - `comingSoon` - Item is visible but disabled
288
+ *
289
+ * @since 1.2.0
280
290
  */
281
291
  type FeedbackMenuStatus = "available" | "comingSoon";
282
292
  /**
283
- * User context for role-based menu filtering
293
+ * Configuration for highlight colors.
294
+ *
295
+ * @example
296
+ * ```tsx
297
+ * const colors: HighlightColors = {
298
+ * targetColor: "#ef4444", // Red for target
299
+ * containerColor: "#3b82f6", // Blue for container
300
+ * targetShadowOpacity: 0.3,
301
+ * containerShadowOpacity: 0.15,
302
+ * };
303
+ * ```
304
+ *
305
+ * @since 1.0.0
306
+ */
307
+ interface HighlightColors {
308
+ /** Color for the container element highlight (default: #8b5cf6 - purple) */
309
+ containerColor?: string;
310
+ /** Opacity for the container shadow (default: 0.1) */
311
+ containerShadowOpacity?: number;
312
+ /** Color for the target element highlight (default: #3b82f6 - blue) */
313
+ targetColor?: string;
314
+ /** Opacity for the target shadow (default: 0.25) */
315
+ targetShadowOpacity?: number;
316
+ }
317
+ /**
318
+ * Configuration for highlight behavior.
319
+ *
320
+ * @example
321
+ * ```tsx
322
+ * const highlightConfig: HighlightConfig = {
323
+ * enabled: true,
324
+ * colors: { targetColor: "#ef4444" },
325
+ * containerSelectors: [".card", ".modal", "[data-container]"],
326
+ * minChildrenForContainer: 3,
327
+ * };
328
+ * ```
329
+ *
330
+ * @since 1.0.0
331
+ */
332
+ interface HighlightConfig {
333
+ /** Custom colors for highlights */
334
+ colors?: HighlightColors;
335
+ /** CSS selectors to identify container elements */
336
+ containerSelectors?: string[];
337
+ /** Whether to show highlights (default: true) */
338
+ enabled?: boolean;
339
+ /** Minimum number of children for an element to be considered a container (default: 2) */
340
+ minChildrenForContainer?: number;
341
+ }
342
+ /**
343
+ * User context for role-based menu filtering.
344
+ *
345
+ * @example
346
+ * ```tsx
347
+ * const userContext: AnyclickUserContext = {
348
+ * id: "user-123",
349
+ * email: "user@example.com",
350
+ * roles: ["admin", "developer"],
351
+ * };
352
+ *
353
+ * const visibleItems = filterMenuItemsByRole(allMenuItems, userContext);
354
+ * ```
355
+ *
356
+ * @since 1.2.0
284
357
  */
285
358
  interface AnyclickUserContext {
286
- /** User's role(s) */
287
- roles?: string[];
288
- /** User ID */
289
- id?: string;
290
359
  /** User email */
291
360
  email?: string;
361
+ /** User ID */
362
+ id?: string;
363
+ /** User's role(s) */
364
+ roles?: string[];
292
365
  }
293
366
  /**
294
- * Filter menu items based on user context
367
+ * Filters menu items based on user context and required roles.
368
+ *
369
+ * Items without required roles are shown to everyone.
370
+ * Items with required roles are only shown to users who have at least one matching role.
371
+ *
372
+ * @param items - Menu items to filter
373
+ * @param userContext - Optional user context with roles
374
+ * @returns Filtered menu items visible to the user
375
+ *
376
+ * @example
377
+ * ```tsx
378
+ * const allItems: ContextMenuItem[] = [
379
+ * { type: "bug", label: "Report Bug" },
380
+ * { type: "admin", label: "Admin Panel", requiredRoles: ["admin"] },
381
+ * ];
382
+ *
383
+ * const userContext = { roles: ["user"] };
384
+ * const visibleItems = filterMenuItemsByRole(allItems, userContext);
385
+ * // => [{ type: "bug", label: "Report Bug" }]
386
+ * ```
387
+ *
388
+ * @since 1.2.0
295
389
  */
296
390
  declare function filterMenuItemsByRole(items: ContextMenuItem[], userContext?: AnyclickUserContext): ContextMenuItem[];
297
391
  /**
298
- * Props for the AnyclickProvider component
392
+ * Props for the AnyclickProvider component.
393
+ *
394
+ * @example
395
+ * ```tsx
396
+ * <AnyclickProvider
397
+ * adapter={myAdapter}
398
+ * menuItems={customMenuItems}
399
+ * highlightConfig={{ colors: { targetColor: "#ef4444" } }}
400
+ * screenshotConfig={{ enabled: true, showPreview: true }}
401
+ * onSubmitSuccess={(payload) => console.log("Submitted:", payload)}
402
+ * >
403
+ * <App />
404
+ * </AnyclickProvider>
405
+ * ```
406
+ *
407
+ * @since 1.0.0
299
408
  */
300
409
  interface AnyclickProviderProps {
301
- /** Header content */
302
- header?: ReactNode | null;
303
410
  /** The adapter to use for submitting anyclick */
304
411
  adapter: AnyclickAdapter;
305
412
  /** Child components */
306
413
  children: ReactNode;
307
- /**
308
- * Filter function to determine if anyclick should be captured for a target element
309
- * Return true to allow anyclick, false to ignore
310
- * Accepts both MouseEvent (right-click) and TouchEvent (press-and-hold)
311
- */
312
- targetFilter?: (event: AnyclickTriggerEvent, target: Element) => boolean;
313
- /** Custom menu items (defaults to Issue, Feature, Like) */
314
- menuItems?: ContextMenuItem[];
414
+ /** Cooldown in milliseconds between submissions (rate limiting) */
415
+ cooldownMs?: number;
416
+ /** Whether the provider is disabled */
417
+ disabled?: boolean;
418
+ /** Header content */
419
+ header?: ReactNode | null;
420
+ /** Configuration for element highlighting */
421
+ highlightConfig?: HighlightConfig;
422
+ /** Maximum number of ancestors to capture */
423
+ maxAncestors?: number;
315
424
  /** Maximum length for innerText capture */
316
425
  maxInnerTextLength?: number;
317
426
  /** Maximum length for outerHTML capture */
318
427
  maxOuterHTMLLength?: number;
319
- /** Maximum number of ancestors to capture */
320
- maxAncestors?: number;
321
- /** Cooldown in milliseconds between submissions (rate limiting) */
322
- cooldownMs?: number;
323
- /** Attributes to strip from outerHTML for privacy */
324
- stripAttributes?: string[];
428
+ /** Custom class name for the context menu */
429
+ menuClassName?: string;
430
+ /** Custom menu items (defaults to Issue, Feature, Like) */
431
+ menuItems?: ContextMenuItem[];
432
+ /** Menu positioning mode (default: 'inView') */
433
+ menuPositionMode?: MenuPositionMode;
434
+ /** Custom styles for the context menu */
435
+ menuStyle?: CSSProperties;
325
436
  /** Additional metadata to include with every submission */
326
437
  metadata?: Record<string, unknown>;
327
- /** Callback after successful submission */
328
- onSubmitSuccess?: (payload: AnyclickPayload) => void;
329
438
  /** Callback after failed submission */
330
439
  onSubmitError?: (error: Error, payload: AnyclickPayload) => void;
331
- /** Custom styles for the context menu */
332
- menuStyle?: CSSProperties;
333
- /** Custom class name for the context menu */
334
- menuClassName?: string;
335
- /** Whether the provider is disabled */
336
- disabled?: boolean;
337
- /** Configuration for element highlighting */
338
- highlightConfig?: HighlightConfig;
339
- /** Configuration for screenshot capture */
340
- screenshotConfig?: ScreenshotConfig;
440
+ /** Callback after successful submission */
441
+ onSubmitSuccess?: (payload: AnyclickPayload) => void;
341
442
  /**
342
443
  * Whether to scope this provider to its children only.
343
444
  * When true, events will only be captured for elements within this provider's subtree.
344
445
  * When false (default), events are captured for the entire document.
345
446
  */
346
447
  scoped?: boolean;
448
+ /** Configuration for screenshot capture */
449
+ screenshotConfig?: ScreenshotConfig;
450
+ /** Attributes to strip from outerHTML for privacy */
451
+ stripAttributes?: string[];
452
+ /**
453
+ * Filter function to determine if anyclick should be captured for a target element.
454
+ * Return true to allow anyclick, false to ignore.
455
+ * Accepts both MouseEvent (right-click) and TouchEvent (press-and-hold).
456
+ */
457
+ targetFilter?: (event: AnyclickTriggerEvent, target: Element) => boolean;
347
458
  /**
348
459
  * Theme configuration for this provider.
349
460
  * Themes are inherited from parent providers and merged (child overrides parent).
@@ -354,96 +465,135 @@ interface AnyclickProviderProps {
354
465
  touchHoldDurationMs?: number;
355
466
  /** Maximum movement in px before touch hold is cancelled (default: 10) */
356
467
  touchMoveThreshold?: number;
357
- /** Menu positioning mode (default: 'inView') */
358
- menuPositionMode?: MenuPositionMode;
359
468
  }
360
469
  /**
361
- * Context value exposed by AnyclickProvider
470
+ * Context value exposed by AnyclickProvider.
471
+ *
472
+ * Access via the {@link useAnyclick} hook.
473
+ *
474
+ * @example
475
+ * ```tsx
476
+ * function MyComponent() {
477
+ * const {
478
+ * isEnabled,
479
+ * isSubmitting,
480
+ * openMenu,
481
+ * closeMenu,
482
+ * submitAnyclick,
483
+ * theme,
484
+ * } = useAnyclick();
485
+ *
486
+ * // ...
487
+ * }
488
+ * ```
489
+ *
490
+ * @since 1.0.0
362
491
  */
363
492
  interface AnyclickContextValue {
493
+ /** Close the anyclick menu */
494
+ closeMenu: () => void;
364
495
  /** Whether anyclick is currently enabled */
365
496
  isEnabled: boolean;
366
497
  /** Whether a submission is in progress */
367
498
  isSubmitting: boolean;
368
- /** Submit anyclick for a specific element */
369
- submitAnyclick: (element: Element, type: AnyclickType, comment?: string) => Promise<void>;
370
499
  /** Open the anyclick menu programmatically */
371
500
  openMenu: (element: Element, position: {
372
501
  x: number;
373
502
  y: number;
374
503
  }) => void;
375
- /** Close the anyclick menu */
376
- closeMenu: () => void;
377
- /** The current merged theme (inherited from ancestors) */
378
- theme: AnyclickTheme;
379
- /** Whether this provider is scoped */
380
- scoped: boolean;
381
504
  /** The provider's unique ID */
382
505
  providerId: string;
506
+ /** Whether this provider is scoped */
507
+ scoped: boolean;
508
+ /** Submit anyclick for a specific element */
509
+ submitAnyclick: (element: Element, type: AnyclickType, comment?: string) => Promise<void>;
510
+ /** The current merged theme (inherited from ancestors) */
511
+ theme: AnyclickTheme;
383
512
  }
384
513
  /**
385
- * Props for the context menu component
514
+ * Props for the ContextMenu component.
515
+ *
516
+ * @since 1.0.0
386
517
  */
387
518
  interface ContextMenuProps {
388
- /** Whether the menu is visible */
389
- visible: boolean;
390
- /** Position of the menu */
391
- position: {
392
- x: number;
393
- y: number;
394
- };
395
- /** Target element for anyclick */
396
- targetElement: Element | null;
519
+ /** Custom class name */
520
+ className?: string;
397
521
  /** Container element found by highlight logic */
398
522
  containerElement: Element | null;
523
+ /** Footer content */
524
+ footer?: ReactNode;
525
+ /** Header content */
526
+ header?: ReactNode;
527
+ /** Configuration for element highlighting */
528
+ highlightConfig?: HighlightConfig;
529
+ /** Whether submission is in progress */
530
+ isSubmitting: boolean;
399
531
  /** Menu items to display */
400
532
  items: ContextMenuItem[];
401
- /** Callback when an item is selected */
402
- onSelect: (type: AnyclickType, comment?: string, screenshots?: ScreenshotData) => void;
403
533
  /** Callback when menu is closed */
404
534
  onClose: () => void;
405
- /** Whether submission is in progress */
406
- isSubmitting: boolean;
407
- /** Custom styles */
408
- style?: CSSProperties;
409
- /** Custom class name */
410
- className?: string;
411
- /** Configuration for element highlighting */
412
- highlightConfig?: HighlightConfig;
413
- /** Configuration for screenshot capture */
414
- screenshotConfig?: ScreenshotConfig;
535
+ /** Callback when an item is selected */
536
+ onSelect: (type: AnyclickType, comment?: string, screenshots?: ScreenshotData) => void;
537
+ /** Position of the menu */
538
+ position: {
539
+ x: number;
540
+ y: number;
541
+ };
415
542
  /** Menu positioning mode (default: 'inView') */
416
543
  positionMode?: MenuPositionMode;
417
- /** Header content */
418
- header?: ReactNode;
419
- /** Footer content */
420
- footer?: ReactNode;
544
+ /** Configuration for screenshot capture */
545
+ screenshotConfig?: ScreenshotConfig;
546
+ /** Custom styles */
547
+ style?: CSSProperties;
548
+ /** Target element for anyclick */
549
+ targetElement: Element | null;
550
+ /** Whether the menu is visible */
551
+ visible: boolean;
421
552
  }
422
553
  /**
423
- * Props for the screenshot preview component
554
+ * Props for the ScreenshotPreview component.
555
+ *
556
+ * @since 1.0.0
424
557
  */
425
558
  interface ScreenshotPreviewProps {
426
- /** Captured screenshot data */
427
- screenshots: ScreenshotData | null;
428
559
  /** Whether screenshots are loading */
429
560
  isLoading: boolean;
430
- /** Callback when user confirms screenshots */
431
- onConfirm: (screenshots: ScreenshotData) => void;
561
+ /** Whether submission is in progress */
562
+ isSubmitting: boolean;
432
563
  /** Callback when user cancels */
433
564
  onCancel: () => void;
565
+ /** Callback when user confirms screenshots */
566
+ onConfirm: (screenshots: ScreenshotData) => void;
434
567
  /** Callback when user wants to retake screenshots */
435
568
  onRetake: () => void;
436
- /** Whether submission is in progress */
437
- isSubmitting: boolean;
569
+ /** Captured screenshot data */
570
+ screenshots: ScreenshotData | null;
438
571
  }
439
572
 
440
573
  /**
441
- * AnyclickProvider component - wraps your app to enable feedback capture
442
- * Supports scoped providers and nested theming
574
+ * AnyclickProvider component - wraps your app to enable feedback capture.
575
+ *
576
+ * Supports scoped providers and nested theming with inheritance.
577
+ * Child providers automatically inherit and can override parent themes.
578
+ *
579
+ * @example
580
+ * ```tsx
581
+ * <AnyclickProvider
582
+ * adapter={myAdapter}
583
+ * menuItems={[
584
+ * { type: "bug", label: "Report Bug", showComment: true },
585
+ * ]}
586
+ * onSubmitSuccess={(payload) => console.log("Submitted:", payload)}
587
+ * >
588
+ * <App />
589
+ * </AnyclickProvider>
590
+ * ```
591
+ *
592
+ * @since 1.0.0
443
593
  */
444
- declare function AnyclickProvider({ adapter, children, targetFilter, menuItems, maxInnerTextLength, maxOuterHTMLLength, maxAncestors, cooldownMs, stripAttributes, metadata, onSubmitSuccess, onSubmitError, menuStyle, menuClassName, disabled, highlightConfig, header, screenshotConfig, scoped, theme, touchHoldDurationMs, touchMoveThreshold, }: AnyclickProviderProps): react_jsx_runtime.JSX.Element;
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;
445
595
  /**
446
- * @deprecated Use AnyclickProvider instead
596
+ * @deprecated Use {@link AnyclickProvider} instead. Will be removed in v2.0.0.
447
597
  */
448
598
  declare const FeedbackProvider: typeof AnyclickProvider;
449
599
 
@@ -455,146 +605,404 @@ declare const FeedbackProvider: typeof AnyclickProvider;
455
605
  declare function FunModeBridge(): null;
456
606
 
457
607
  /**
458
- * Context menu component for selecting feedback type
608
+ * Context menu component for selecting feedback type.
609
+ *
610
+ * Displays a customizable context menu with support for:
611
+ * - Custom menu items with icons and badges
612
+ * - Submenus for organizing options
613
+ * - Comment input for detailed feedback
614
+ * - Screenshot preview before sending
615
+ * - Touch-friendly interactions
616
+ * - Dynamic positioning modes
617
+ *
618
+ * @since 1.0.0
459
619
  */
460
- declare function ContextMenu({ visible, position, targetElement, containerElement, items, onSelect, onClose, isSubmitting, style, className, highlightConfig, screenshotConfig, positionMode, header, footer, }: ContextMenuProps): react_jsx_runtime.JSX.Element | null;
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 | null;
461
621
 
462
622
  /**
463
- * Screenshot preview component - shows captured screenshots before sending
623
+ * Screenshot preview component - shows captured screenshots before sending.
624
+ *
625
+ * Displays a preview of captured screenshots with tabs for element, container,
626
+ * and viewport captures. Allows users to review, retake, or proceed without
627
+ * screenshots.
628
+ *
629
+ * @since 1.0.0
464
630
  */
465
- declare function ScreenshotPreview({ screenshots, isLoading, onConfirm, onCancel, onRetake, isSubmitting, }: ScreenshotPreviewProps): react_jsx_runtime.JSX.Element;
631
+ declare const ScreenshotPreview: React__default.NamedExoticComponent<ScreenshotPreviewProps>;
466
632
 
467
633
  /**
468
- * React context for anyclick functionality
634
+ * React context for anyclick functionality.
635
+ *
636
+ * Provides access to anyclick state and methods throughout the component tree.
637
+ * Use the {@link useAnyclick} hook for type-safe access.
638
+ *
639
+ * @example
640
+ * ```tsx
641
+ * // Using the context directly (advanced)
642
+ * const context = useContext(AnyclickContext);
643
+ * if (context) {
644
+ * context.openMenu(element, { x: 100, y: 100 });
645
+ * }
646
+ * ```
647
+ *
648
+ * @see {@link useAnyclick} for the recommended way to access this context
649
+ * @since 1.0.0
469
650
  */
470
651
  declare const AnyclickContext: React$1.Context<AnyclickContextValue | null>;
471
652
  /**
472
- * @deprecated Use AnyclickContext instead
653
+ * @deprecated Use {@link AnyclickContext} instead. Will be removed in v2.0.0.
654
+ * @see {@link AnyclickContext}
473
655
  */
474
656
  declare const FeedbackContext: React$1.Context<AnyclickContextValue | null>;
475
657
  /**
476
- * Hook to access anyclick context
477
- * @throws Error if used outside of AnyclickProvider
658
+ * Hook to access anyclick context values and methods.
659
+ *
660
+ * Provides access to:
661
+ * - `isEnabled` - Whether anyclick is currently enabled
662
+ * - `isSubmitting` - Whether a submission is in progress
663
+ * - `submitAnyclick` - Function to submit feedback programmatically
664
+ * - `openMenu` - Function to open the context menu programmatically
665
+ * - `closeMenu` - Function to close the context menu
666
+ * - `theme` - The current merged theme configuration
667
+ * - `scoped` - Whether the current provider is scoped
668
+ * - `providerId` - The unique ID of the current provider
669
+ *
670
+ * @returns {AnyclickContextValue} The anyclick context value
671
+ * @throws {Error} When used outside of an AnyclickProvider
672
+ *
673
+ * @example
674
+ * ```tsx
675
+ * function FeedbackButton() {
676
+ * const { openMenu, isSubmitting, isEnabled } = useAnyclick();
677
+ *
678
+ * const handleClick = (event: React.MouseEvent) => {
679
+ * if (isEnabled && !isSubmitting) {
680
+ * openMenu(event.currentTarget, {
681
+ * x: event.clientX,
682
+ * y: event.clientY,
683
+ * });
684
+ * }
685
+ * };
686
+ *
687
+ * return (
688
+ * <button onClick={handleClick} disabled={!isEnabled || isSubmitting}>
689
+ * Send Feedback
690
+ * </button>
691
+ * );
692
+ * }
693
+ * ```
694
+ *
695
+ * @since 1.0.0
478
696
  */
479
697
  declare function useAnyclick(): AnyclickContextValue;
480
698
  /**
481
- * @deprecated Use useAnyclick instead
699
+ * @deprecated Use {@link useAnyclick} instead. Will be removed in v2.0.0.
700
+ * @see {@link useAnyclick}
482
701
  */
483
702
  declare function useFeedback(): AnyclickContextValue;
484
703
 
485
704
  /**
486
- * Registered provider instance
705
+ * Registered provider instance in the provider registry.
706
+ *
707
+ * Each AnyclickProvider creates an instance of this type when mounted,
708
+ * enabling the store to track and manage provider hierarchies.
709
+ *
710
+ * @since 1.0.0
487
711
  */
488
712
  interface ProviderInstance {
489
- /** Unique identifier for this provider instance */
490
- id: string;
491
713
  /** Reference to the provider's container element (null if not scoped) */
492
714
  containerRef: React.RefObject<Element | null>;
493
- /** Whether this provider is scoped to its container */
494
- scoped: boolean;
495
- /** The provider's theme configuration */
496
- theme: AnyclickTheme | null;
497
- /** Whether this provider is disabled */
498
- disabled: boolean;
499
- /** Parent provider ID (if nested) */
500
- parentId: string | null;
501
715
  /** Depth in the provider hierarchy (0 = root) */
502
716
  depth: number;
717
+ /** Whether this provider is disabled */
718
+ disabled: boolean;
719
+ /** Unique identifier for this provider instance */
720
+ id: string;
503
721
  /** Handler to call when an event occurs in this provider's scope */
504
722
  onContextMenu?: (event: AnyclickMenuEvent, element: Element) => boolean | void;
723
+ /** Parent provider ID (if nested) */
724
+ parentId: string | null;
725
+ /** Whether this provider is scoped to its container */
726
+ scoped: boolean;
727
+ /** The provider's theme configuration */
728
+ theme: AnyclickTheme | null;
505
729
  }
506
730
  /**
507
- * Provider registry store state
731
+ * Provider registry store state and actions.
732
+ * @internal
508
733
  */
509
734
  interface ProviderStore {
510
735
  /** Map of provider ID to provider instance */
511
736
  providers: Map<string, ProviderInstance>;
512
737
  /**
513
- * Register a new provider
738
+ * Finds all providers that contain a given element, sorted by depth (nearest first).
739
+ * @param element - The DOM element to find providers for
740
+ * @returns Array of matching providers, sorted by depth (deepest first)
514
741
  */
515
- registerProvider: (provider: ProviderInstance) => void;
742
+ findProvidersForElement: (element: Element) => ProviderInstance[];
516
743
  /**
517
- * Unregister a provider
744
+ * Finds the nearest parent provider for a given container.
745
+ * @param container - The container element to find a parent for
746
+ * @param excludeId - Optional provider ID to exclude from search
747
+ * @returns The nearest parent provider, or null if none found
518
748
  */
519
- unregisterProvider: (id: string) => void;
749
+ findParentProvider: (container: Element | null, excludeId?: string) => ProviderInstance | null;
520
750
  /**
521
- * Update a provider's configuration
751
+ * Gets the merged theme for a provider (includes inherited parent themes).
752
+ * @param providerId - The ID of the provider to get the merged theme for
753
+ * @returns The merged theme configuration
522
754
  */
523
- updateProvider: (id: string, updates: Partial<ProviderInstance>) => void;
755
+ getMergedTheme: (providerId: string) => AnyclickTheme;
524
756
  /**
525
- * Find all providers that contain a given element, sorted by depth (nearest first)
757
+ * Checks if any ancestor provider has disabled anyclick.
758
+ * @param providerId - The ID of the provider to check
759
+ * @returns True if any ancestor is disabled
526
760
  */
527
- findProvidersForElement: (element: Element) => ProviderInstance[];
761
+ isDisabledByAncestor: (providerId: string) => boolean;
528
762
  /**
529
- * Find the nearest parent provider for a given container
763
+ * Checks if an element is inside any scoped provider's container.
764
+ * Used to prevent the global provider from handling touch events.
765
+ * @param element - The element to check
766
+ * @returns True if element is inside any scoped provider
530
767
  */
531
- findParentProvider: (container: Element | null, excludeId?: string) => ProviderInstance | null;
768
+ isElementInAnyScopedProvider: (element: Element) => boolean;
532
769
  /**
533
- * Get merged theme for a provider (includes inherited parent themes)
770
+ * Checks if an element is inside a disabled scoped provider's container.
771
+ * @param element - The element to check
772
+ * @returns True if element is inside a disabled scope
534
773
  */
535
- getMergedTheme: (providerId: string) => AnyclickTheme;
774
+ isElementInDisabledScope: (element: Element) => boolean;
536
775
  /**
537
- * Check if any ancestor provider has disabled anyclick
776
+ * Registers a new provider in the store.
777
+ * @param provider - The provider instance to register
538
778
  */
539
- isDisabledByAncestor: (providerId: string) => boolean;
779
+ registerProvider: (provider: ProviderInstance) => void;
540
780
  /**
541
- * Check if an element is inside a disabled scoped provider's container
542
- * This is used to prevent the global provider from handling events
543
- * in areas where a disabled scoped provider should block them
781
+ * Unregisters a provider from the store.
782
+ * @param id - The ID of the provider to unregister
544
783
  */
545
- isElementInDisabledScope: (element: Element) => boolean;
784
+ unregisterProvider: (id: string) => void;
546
785
  /**
547
- * Check if an element is inside any scoped provider's container (enabled or not)
548
- * This is used to prevent the global provider from handling touch events
549
- * that should be handled by a scoped provider instead
786
+ * Updates a provider's configuration.
787
+ * @param id - The ID of the provider to update
788
+ * @param updates - Partial updates to apply
550
789
  */
551
- isElementInAnyScopedProvider: (element: Element) => boolean;
790
+ updateProvider: (id: string, updates: Partial<ProviderInstance>) => void;
552
791
  }
792
+ /**
793
+ * Generates a unique ID for a provider instance.
794
+ *
795
+ * @returns A unique provider ID string
796
+ *
797
+ * @example
798
+ * ```ts
799
+ * const id = generateProviderId();
800
+ * // => "anyclick-provider-1"
801
+ * ```
802
+ *
803
+ * @since 1.0.0
804
+ */
553
805
  declare function generateProviderId(): string;
554
806
  /**
555
- * Zustand store for managing provider instances
807
+ * Zustand store hook for managing provider instances.
808
+ *
809
+ * This store maintains a global registry of all AnyclickProvider instances,
810
+ * enabling features like:
811
+ * - Nested provider hierarchies
812
+ * - Theme inheritance
813
+ * - Scoped contexts
814
+ * - Event routing
815
+ *
816
+ * @example
817
+ * ```ts
818
+ * // Get providers for an element
819
+ * const providers = useProviderStore.getState().findProvidersForElement(element);
820
+ *
821
+ * // Get merged theme for a provider
822
+ * const { getMergedTheme } = useProviderStore();
823
+ * const theme = getMergedTheme(providerId);
824
+ * ```
825
+ *
826
+ * @since 1.0.0
556
827
  */
557
828
  declare const useProviderStore: zustand.UseBoundStore<zustand.StoreApi<ProviderStore>>;
558
829
  /**
559
- * Dispatch a context menu event to all matching providers (bubble up)
830
+ * Dispatches a context menu event to all matching providers.
831
+ *
832
+ * Routes the event through the provider hierarchy, calling handlers
833
+ * from the nearest (deepest) provider first.
834
+ *
835
+ * @param event - The original mouse event
836
+ * @param element - The target element
837
+ *
838
+ * @example
839
+ * ```ts
840
+ * document.addEventListener("contextmenu", (event) => {
841
+ * dispatchContextMenuEvent(event, event.target as Element);
842
+ * });
843
+ * ```
844
+ *
845
+ * @since 1.0.0
560
846
  */
561
847
  declare function dispatchContextMenuEvent(event: MouseEvent, element: Element): void;
562
848
 
563
- type PresetRole = "qa" | "pm" | "designer" | "developer" | "chrome";
849
+ /**
850
+ * Available preset role identifiers.
851
+ *
852
+ * - `qa` - QA/Testing focused menu with bug reporting and repro steps
853
+ * - `pm` - Product Manager focused menu with feature ideas and impact sizing
854
+ * - `designer` - Designer focused menu with visual QA and accessibility
855
+ * - `developer` - Developer focused menu with diagnostics and debugging
856
+ * - `chrome` - Chrome-like context menu with browser actions
857
+ *
858
+ * @since 1.2.0
859
+ */
860
+ type PresetRole = "chrome" | "designer" | "developer" | "pm" | "qa";
861
+ /**
862
+ * Complete preset configuration for a role.
863
+ *
864
+ * Contains all the settings needed to configure an AnyclickProvider
865
+ * for a specific user role.
866
+ *
867
+ * @since 1.2.0
868
+ */
564
869
  interface PresetConfig {
565
- role: PresetRole;
566
- label: string;
870
+ /** Human-readable description of the preset */
567
871
  description: string;
872
+ /** Optional highlight configuration */
873
+ highlightConfig?: HighlightConfig;
874
+ /** Human-readable label for the preset */
875
+ label: string;
876
+ /** Context menu items for this preset */
568
877
  menuItems: ContextMenuItem[];
569
- screenshotConfig?: Partial<ScreenshotConfig>;
878
+ /** Additional metadata to include with submissions */
570
879
  metadata?: Record<string, unknown>;
880
+ /** The preset role identifier */
881
+ role: PresetRole;
882
+ /** Screenshot capture configuration */
883
+ screenshotConfig?: Partial<ScreenshotConfig>;
884
+ /** Theme configuration including styles and highlighting */
571
885
  theme?: AnyclickTheme;
572
- highlightConfig?: HighlightConfig;
573
886
  }
887
+ /**
888
+ * Options for customizing preset menu creation.
889
+ *
890
+ * @since 1.2.0
891
+ */
574
892
  interface CreatePresetMenuOptions {
575
- /** Whether to include coming-soon items (defaults to true) */
893
+ /**
894
+ * Whether to include coming-soon items in the menu.
895
+ * Coming-soon items are shown but disabled.
896
+ * @default true
897
+ */
576
898
  includeComingSoon?: boolean;
577
899
  /**
578
900
  * Optional overrides for menu items, screenshot config, metadata, or theme.
579
901
  * Useful when you want to tweak a preset without rebuilding it manually.
902
+ *
903
+ * @example
904
+ * ```ts
905
+ * const qaPreset = createPresetMenu("qa", {
906
+ * overrides: {
907
+ * screenshotConfig: { quality: 0.9 },
908
+ * theme: { highlightConfig: { colors: { targetColor: "#ef4444" } } },
909
+ * },
910
+ * });
911
+ * ```
580
912
  */
581
- overrides?: Partial<Omit<PresetConfig, "role" | "label" | "description">>;
913
+ overrides?: Partial<Omit<PresetConfig, "description" | "label" | "role">>;
582
914
  }
915
+ /**
916
+ * Default preset configurations for each role.
917
+ *
918
+ * These are the base configurations that {@link createPresetMenu} uses.
919
+ * You can use them directly if you don't need any customization.
920
+ *
921
+ * @since 1.2.0
922
+ */
583
923
  declare const presetDefaults: Record<PresetRole, PresetConfig>;
584
924
  /**
585
- * Create a preset menu for a given role. Coming-soon items remain visible but disabled.
925
+ * Creates a preset menu configuration for a specific role.
926
+ *
927
+ * Returns a complete configuration that can be spread into AnyclickProvider props.
928
+ * Coming-soon items are included by default but shown as disabled.
929
+ *
930
+ * @param role - The preset role to create a menu for
931
+ * @param options - Optional customization options
932
+ * @returns A complete preset configuration
933
+ * @throws {Error} If an unknown role is specified
934
+ *
935
+ * @example
936
+ * ```tsx
937
+ * // Basic usage
938
+ * const qaPreset = createPresetMenu("qa");
939
+ *
940
+ * // With customization
941
+ * const devPreset = createPresetMenu("developer", {
942
+ * includeComingSoon: false,
943
+ * overrides: {
944
+ * screenshotConfig: { quality: 0.9 },
945
+ * },
946
+ * });
947
+ *
948
+ * <AnyclickProvider
949
+ * adapter={adapter}
950
+ * menuItems={qaPreset.menuItems}
951
+ * screenshotConfig={qaPreset.screenshotConfig}
952
+ * theme={qaPreset.theme}
953
+ * >
954
+ * <App />
955
+ * </AnyclickProvider>
956
+ * ```
957
+ *
958
+ * @since 1.2.0
586
959
  */
587
960
  declare function createPresetMenu(role: PresetRole, options?: CreatePresetMenuOptions): PresetConfig;
588
961
  /**
589
- * List all available presets with their defaults.
962
+ * Lists all available preset configurations.
963
+ *
964
+ * Returns cloned copies of all presets so they can be safely modified.
965
+ * Useful for displaying available options or building custom preset selectors.
966
+ *
967
+ * @returns Array of all preset configurations
968
+ *
969
+ * @example
970
+ * ```tsx
971
+ * const presets = listPresets();
972
+ *
973
+ * function PresetSelector({ onSelect }) {
974
+ * return (
975
+ * <select onChange={(e) => onSelect(e.target.value)}>
976
+ * {presets.map((preset) => (
977
+ * <option key={preset.role} value={preset.role}>
978
+ * {preset.label} - {preset.description}
979
+ * </option>
980
+ * ))}
981
+ * </select>
982
+ * );
983
+ * }
984
+ * ```
985
+ *
986
+ * @since 1.2.0
590
987
  */
591
988
  declare function listPresets(): PresetConfig[];
592
989
 
990
+ /**
991
+ * Style definitions for anyclick-react components.
992
+ *
993
+ * This module provides consolidated styling for all UI components,
994
+ * including CSS custom properties for theming and dark mode support.
995
+ *
996
+ * @module styles
997
+ * @since 1.0.0
998
+ */
999
+
593
1000
  /**
594
1001
  * CSS custom properties for menu theming.
1002
+ *
595
1003
  * These can be overridden via the `style` prop on AnyclickProvider.
596
1004
  *
597
- * Example:
1005
+ * @example
598
1006
  * ```tsx
599
1007
  * <AnyclickProvider
600
1008
  * theme={{
@@ -608,57 +1016,194 @@ declare function listPresets(): PresetConfig[];
608
1016
  * }}
609
1017
  * />
610
1018
  * ```
1019
+ *
1020
+ * @since 1.0.0
611
1021
  */
612
1022
  declare const menuCSSVariables: {
613
- readonly "--anyclick-menu-bg": "#ffffff";
614
- readonly "--anyclick-menu-hover": "#f5f5f5";
615
- readonly "--anyclick-menu-text": "#333333";
616
- readonly "--anyclick-menu-text-muted": "#666666";
617
- readonly "--anyclick-menu-border": "#e5e5e5";
618
1023
  readonly "--anyclick-menu-accent": "#0066cc";
619
1024
  readonly "--anyclick-menu-accent-text": "#ffffff";
620
- readonly "--anyclick-menu-input-bg": "#ffffff";
621
- readonly "--anyclick-menu-input-border": "#dddddd";
1025
+ readonly "--anyclick-menu-bg": "#ffffff";
1026
+ readonly "--anyclick-menu-border": "#e5e5e5";
622
1027
  readonly "--anyclick-menu-cancel-bg": "#f0f0f0";
623
1028
  readonly "--anyclick-menu-cancel-text": "#666666";
1029
+ readonly "--anyclick-menu-hover": "#f5f5f5";
1030
+ readonly "--anyclick-menu-input-bg": "#ffffff";
1031
+ readonly "--anyclick-menu-input-border": "#dddddd";
1032
+ readonly "--anyclick-menu-text": "#333333";
1033
+ readonly "--anyclick-menu-text-muted": "#666666";
624
1034
  };
1035
+ /**
1036
+ * Gets badge styles for a specific tone.
1037
+ *
1038
+ * @param tone - The badge tone (info, neutral, success, warning)
1039
+ * @returns CSSProperties for the badge
1040
+ *
1041
+ * @example
1042
+ * ```tsx
1043
+ * const style = getBadgeStyle("success");
1044
+ * // => { backgroundColor: "rgba(34, 197, 94, 0.15)", ... }
1045
+ * ```
1046
+ *
1047
+ * @since 1.2.0
1048
+ */
1049
+ declare function getBadgeStyle(tone?: "info" | "neutral" | "success" | "warning"): CSSProperties;
1050
+ /**
1051
+ * Core menu component styles.
1052
+ *
1053
+ * @since 1.0.0
1054
+ */
625
1055
  declare const menuStyles: Record<string, CSSProperties>;
1056
+ /**
1057
+ * Dark mode menu styles.
1058
+ *
1059
+ * Apply these styles for dark theme support.
1060
+ *
1061
+ * @since 1.0.0
1062
+ */
626
1063
  declare const darkMenuStyles: Record<string, CSSProperties>;
627
1064
 
628
1065
  /**
629
- * Highlight utilities for feedback target elements
1066
+ * Highlight utilities for feedback target elements.
1067
+ *
1068
+ * Provides functions to visually highlight DOM elements during feedback selection.
1069
+ * Highlights are applied using CSS classes and dynamically generated styles.
1070
+ *
1071
+ * @module highlight
1072
+ * @since 1.0.0
630
1073
  */
631
1074
 
632
1075
  /**
633
- * Default highlight colors
1076
+ * Default highlight colors used when no custom colors are specified.
1077
+ *
1078
+ * @example
1079
+ * ```ts
1080
+ * // Override specific colors
1081
+ * const customColors = {
1082
+ * ...defaultHighlightColors,
1083
+ * targetColor: "#ef4444", // Red instead of blue
1084
+ * };
1085
+ * ```
1086
+ *
1087
+ * @since 1.0.0
634
1088
  */
635
1089
  declare const defaultHighlightColors: Required<HighlightColors>;
636
1090
  /**
637
- * Default container selectors
1091
+ * Default CSS selectors used to identify container elements.
1092
+ *
1093
+ * These selectors are checked when traversing up the DOM tree to find
1094
+ * a suitable container element to highlight alongside the target.
1095
+ *
1096
+ * @example
1097
+ * ```ts
1098
+ * // Add custom selectors
1099
+ * const customSelectors = [
1100
+ * ...defaultContainerSelectors,
1101
+ * "[data-component]",
1102
+ * ".my-custom-container",
1103
+ * ];
1104
+ * ```
1105
+ *
1106
+ * @since 1.0.0
638
1107
  */
639
1108
  declare const defaultContainerSelectors: string[];
640
1109
  /**
641
- * Find the closest container parent element
1110
+ * Finds the closest container parent element for a given target element.
1111
+ *
1112
+ * Traverses up the DOM tree looking for elements that match container selectors
1113
+ * or have multiple meaningful child elements.
1114
+ *
1115
+ * @param element - The target element to find a container for
1116
+ * @param config - Optional highlight configuration with custom selectors
1117
+ * @returns The found container element, or null if none found
1118
+ *
1119
+ * @example
1120
+ * ```ts
1121
+ * const target = document.querySelector(".my-button");
1122
+ * const container = findContainerParent(target, {
1123
+ * containerSelectors: [".card", ".panel"],
1124
+ * minChildrenForContainer: 3,
1125
+ * });
1126
+ * ```
1127
+ *
1128
+ * @since 1.0.0
642
1129
  */
643
1130
  declare function findContainerParent(element: Element, config?: HighlightConfig): Element | null;
644
1131
  /**
645
- * Apply highlight to target element
1132
+ * Applies highlight styling to a target element.
1133
+ *
1134
+ * Injects the necessary CSS styles and adds the highlight class to the element.
1135
+ *
1136
+ * @param element - The element to highlight
1137
+ * @param colors - Optional custom highlight colors
1138
+ *
1139
+ * @example
1140
+ * ```ts
1141
+ * const target = document.querySelector(".my-button");
1142
+ * highlightTarget(target, { targetColor: "#ef4444" });
1143
+ * ```
1144
+ *
1145
+ * @since 1.0.0
646
1146
  */
647
1147
  declare function highlightTarget(element: Element, colors?: HighlightColors): void;
648
1148
  /**
649
- * Apply highlight to container element
1149
+ * Applies highlight styling to a container element.
1150
+ *
1151
+ * Container highlights are visually distinct from target highlights,
1152
+ * typically with a larger outline offset and different color.
1153
+ *
1154
+ * @param element - The container element to highlight
1155
+ * @param colors - Optional custom highlight colors
1156
+ *
1157
+ * @example
1158
+ * ```ts
1159
+ * const container = document.querySelector(".card");
1160
+ * highlightContainer(container, { containerColor: "#22c55e" });
1161
+ * ```
1162
+ *
1163
+ * @since 1.0.0
650
1164
  */
651
1165
  declare function highlightContainer(element: Element, colors?: HighlightColors): void;
652
1166
  /**
653
- * Remove all highlights from the document
1167
+ * Removes all highlight styling from the document.
1168
+ *
1169
+ * Clears both target and container highlights from all elements.
1170
+ *
1171
+ * @example
1172
+ * ```ts
1173
+ * // Remove highlights when closing the context menu
1174
+ * clearHighlights();
1175
+ * ```
1176
+ *
1177
+ * @since 1.0.0
654
1178
  */
655
1179
  declare function clearHighlights(): void;
656
1180
  /**
657
- * Apply highlights to target element and its container parent
1181
+ * Applies highlights to both a target element and its container parent.
1182
+ *
1183
+ * This is the main function for applying highlights during feedback selection.
1184
+ * It automatically finds the container parent and applies appropriate styling.
1185
+ *
1186
+ * @param targetElement - The element to highlight as the target
1187
+ * @param config - Optional highlight configuration
1188
+ * @returns Object containing the target and container elements
1189
+ *
1190
+ * @example
1191
+ * ```ts
1192
+ * const result = applyHighlights(clickedElement, {
1193
+ * enabled: true,
1194
+ * colors: { targetColor: "#3b82f6", containerColor: "#8b5cf6" },
1195
+ * containerSelectors: [".card", ".modal"],
1196
+ * });
1197
+ *
1198
+ * console.log(result.target); // The highlighted target
1199
+ * console.log(result.container); // The highlighted container (or null)
1200
+ * ```
1201
+ *
1202
+ * @since 1.0.0
658
1203
  */
659
1204
  declare function applyHighlights(targetElement: Element, config?: HighlightConfig): {
660
- target: Element;
661
1205
  container: Element | null;
1206
+ target: Element;
662
1207
  };
663
1208
 
664
1209
  /**
@@ -710,118 +1255,6 @@ interface InspectDialogManagerProps {
710
1255
  */
711
1256
  declare function InspectDialogManager({ ideConfig, dialogStyle, dialogClassName, highlightColors, showBoxModelOverlay, initialPinnedPosition, compactConfig, }: InspectDialogManagerProps): react_jsx_runtime.JSX.Element;
712
1257
 
713
- /**
714
- * Represents a modification made to an element
715
- */
716
- interface ElementModification {
717
- /** Unique identifier for the element (generated selector or path) */
718
- elementId: string;
719
- /** CSS selector to find the element */
720
- selector: string;
721
- /** Human-readable description of the element */
722
- description: string;
723
- /** Timestamp of the last modification */
724
- lastModified: number;
725
- /** Original inline styles before modification */
726
- originalStyles: Record<string, string>;
727
- /** Current modified inline styles */
728
- modifiedStyles: Record<string, string>;
729
- /** Original attributes before modification */
730
- originalAttributes: Record<string, string>;
731
- /** Current modified attributes */
732
- modifiedAttributes: Record<string, string>;
733
- /** Whether the element was deleted */
734
- isDeleted?: boolean;
735
- }
736
- /**
737
- * Represents a deleted (hidden) element that can be restored
738
- * Elements are hidden with display:none rather than removed from DOM
739
- * for easier persistence and recovery
740
- */
741
- interface DeletedElement {
742
- /** Unique identifier for the element */
743
- elementId: string;
744
- /** CSS selector to find the element */
745
- selector: string;
746
- /** Human-readable description */
747
- description: string;
748
- /** Original display value before hiding */
749
- originalDisplay: string;
750
- /** Timestamp of deletion */
751
- deletedAt: number;
752
- }
753
- /**
754
- * Generate a unique ID for an element based on its position in the DOM
755
- * Uses only simple, reliable selectors to avoid issues with special characters
756
- */
757
- declare function generateElementId(element: Element): string;
758
- /**
759
- * Get a human-readable description of an element
760
- */
761
- declare function getElementDescription(element: Element): string;
762
- /**
763
- * Persisted state shape (what gets saved to localStorage)
764
- */
765
- interface PersistedState {
766
- pinnedPosition: PinnedPosition;
767
- modifiedElements: Record<string, ElementModification>;
768
- deletedElements: Record<string, DeletedElement>;
769
- }
770
- interface InspectStore extends PersistedState {
771
- /** Persisted pinned position */
772
- setPinnedPosition: (position: PinnedPosition) => void;
773
- /** Whether the store has been hydrated from storage */
774
- _hasHydrated: boolean;
775
- setHasHydrated: (state: boolean) => void;
776
- /** Whether modifications were auto-applied on page load */
777
- hasAutoAppliedModifications: boolean;
778
- setHasAutoAppliedModifications: (value: boolean) => void;
779
- /** Track a modification to an element */
780
- trackModification: (element: Element, type: "style" | "attribute", key: string, oldValue: string | null, newValue: string | null) => void;
781
- /** Track an element deletion */
782
- trackDeletion: (element: Element) => void;
783
- /** Get modification record for an element */
784
- getModification: (element: Element) => ElementModification | null;
785
- /** Reset all modifications for a specific element */
786
- resetElement: (elementId: string) => void;
787
- /** Reset all modifications for all elements (including restoring deleted elements) */
788
- resetAllElements: () => void;
789
- /** Get all modified elements that still exist in the DOM */
790
- getModifiedElementsInDOM: () => Array<{
791
- modification: ElementModification;
792
- element: Element | null;
793
- }>;
794
- /** Get count of deleted elements */
795
- getDeletedCount: () => number;
796
- /** Apply persisted modifications to the DOM */
797
- applyPersistedModifications: () => number;
798
- /** Clear persisted state (for testing) */
799
- clearPersistedState: () => void;
800
- }
801
- declare const useInspectStore: zustand.UseBoundStore<Omit<zustand.StoreApi<InspectStore>, "setState" | "persist"> & {
802
- setState(partial: InspectStore | Partial<InspectStore> | ((state: InspectStore) => InspectStore | Partial<InspectStore>), replace?: false | undefined): unknown;
803
- setState(state: InspectStore | ((state: InspectStore) => InspectStore), replace: true): unknown;
804
- persist: {
805
- setOptions: (options: Partial<zustand_middleware.PersistOptions<InspectStore, unknown, unknown>>) => void;
806
- clearStorage: () => void;
807
- rehydrate: () => Promise<void> | void;
808
- hasHydrated: () => boolean;
809
- onHydrate: (fn: (state: InspectStore) => void) => () => void;
810
- onFinishHydration: (fn: (state: InspectStore) => void) => () => void;
811
- getOptions: () => Partial<zustand_middleware.PersistOptions<InspectStore, unknown, unknown>>;
812
- };
813
- }>;
814
- /**
815
- * Custom hook to check if the store has been hydrated
816
- * Use this to prevent hydration mismatches in SSR
817
- */
818
- declare function useHasHydrated(): boolean;
819
- /**
820
- * Wait for hydration to complete before accessing persisted data
821
- * Useful for ensuring data is available before rendering
822
- */
823
- declare function waitForHydration(): Promise<void>;
824
-
825
1258
  interface AnyclickLogoProps {
826
1259
  /** Size of the logo in pixels. Defaults to 64 */
827
1260
  size?: number;
@@ -844,29 +1277,4 @@ interface AnyclickLogoProps {
844
1277
  */
845
1278
  declare function AnyclickLogo({ size, borderWidth, primaryColor, backgroundColor, className, style, onClick, }: AnyclickLogoProps): react_jsx_runtime.JSX.Element;
846
1279
 
847
- interface ModificationIndicatorProps {
848
- /** Position of the indicator. Defaults to "bottom-right" */
849
- position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
850
- /** Size of the logo in pixels. Defaults to 48 */
851
- size?: number;
852
- /** Whether to auto-apply persisted modifications on mount. Defaults to true */
853
- autoApply?: boolean;
854
- /** Offset from edge in pixels. Defaults to 16 */
855
- offset?: number;
856
- /** Primary color for the logo */
857
- primaryColor?: string;
858
- /** Background color for the logo */
859
- backgroundColor?: string;
860
- }
861
- /**
862
- * ModificationIndicator - Shows the Anyclick logo when modifications are active
863
- *
864
- * This component:
865
- * 1. Waits for Zustand hydration before applying modifications
866
- * 2. Auto-applies persisted modifications on mount (if autoApply is true)
867
- * 3. Shows the Anyclick logo in the corner when modifications are active
868
- * 4. Clicking the logo opens a quick menu to view/reset modifications
869
- */
870
- declare function ModificationIndicator({ position, size, autoApply, offset, primaryColor, backgroundColor, }: ModificationIndicatorProps): react_jsx_runtime.JSX.Element | null;
871
-
872
- export { AnyclickContext, type AnyclickContextValue, AnyclickLogo, type AnyclickLogoProps, AnyclickProvider, type AnyclickProviderProps, type AnyclickTheme, type AnyclickUserContext, type CompactModeConfig, ContextMenu, type ContextMenuItem, type ContextMenuProps, type CreatePresetMenuOptions, DEFAULT_COMPACT_CONFIG, type DeletedElement, type ElementModification, FeedbackContext, type FeedbackMenuBadge, type FeedbackMenuStatus, FeedbackProvider, FunModeBridge, type FunModeThemeConfig, type HighlightColors, type HighlightConfig, type IDEConfig, type IDEProtocol, INSPECT_DIALOG_EVENT, InspectDialog, type InspectDialogEventDetail, InspectDialogManager, type InspectDialogManagerProps, type InspectDialogProps, type MenuPositionMode, ModificationIndicator, type ModificationIndicatorProps, type PinnedPosition, type PresetConfig, type PresetRole, type ProviderInstance, ScreenshotPreview, type ScreenshotPreviewProps, type SourceLocation, applyHighlights, buildIDEUrl, clearHighlights, createIDEOpener, createPresetMenu, darkMenuStyles, defaultContainerSelectors, defaultHighlightColors, detectPreferredIDE, dispatchContextMenuEvent, filterMenuItemsByRole, findContainerParent, findSourceLocationInAncestors, formatSourceLocation, generateElementId, generateProviderId, getElementDescription, getSourceLocationFromElement, highlightContainer, highlightTarget, isIDEProtocolSupported, listPresets, menuCSSVariables, menuStyles, openInIDE, openInspectDialog, presetDefaults, useAnyclick, useFeedback, useHasHydrated, useInspectStore, useProviderStore, waitForHydration };
1280
+ export { AnyclickContext, type AnyclickContextValue, AnyclickLogo, type AnyclickLogoProps, AnyclickProvider, type AnyclickProviderProps, type AnyclickTheme, type AnyclickUserContext, type CompactModeConfig, ContextMenu, type ContextMenuItem, type ContextMenuProps, type CreatePresetMenuOptions, DEFAULT_COMPACT_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, ScreenshotPreview, type ScreenshotPreviewProps, type SourceLocation, applyHighlights, buildIDEUrl, clearHighlights, createIDEOpener, createPresetMenu, darkMenuStyles, defaultContainerSelectors, defaultHighlightColors, detectPreferredIDE, dispatchContextMenuEvent, filterMenuItemsByRole, findContainerParent, findSourceLocationInAncestors, formatSourceLocation, generateProviderId, getBadgeStyle, getSourceLocationFromElement, highlightContainer, highlightTarget, isIDEProtocolSupported, listPresets, menuCSSVariables, menuStyles, openInIDE, openInspectDialog, presetDefaults, useAnyclick, useFeedback, useProviderStore };