@ewjdev/anyclick-react 1.4.1 → 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/README.md +24 -1
- package/dist/index.d.mts +3 -172
- package/dist/index.d.ts +3 -172
- package/dist/index.js +547 -4648
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +466 -4554
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -43,6 +43,29 @@ export function Providers({ children }: { children: React.ReactNode }) {
|
|
|
43
43
|
|
|
44
44
|
That's it! Users can now right-click any element to submit feedback.
|
|
45
45
|
|
|
46
|
+
### Advanced inspector (DevTools UI)
|
|
47
|
+
|
|
48
|
+
For the full Chrome DevTools-style inspector (modification tracking, box model overlay, accessibility deep dive), install the dedicated package:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm install @ewjdev/anyclick-devtools
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import {
|
|
56
|
+
InspectDialogManager,
|
|
57
|
+
openInspectDialog,
|
|
58
|
+
} from "@ewjdev/anyclick-devtools";
|
|
59
|
+
|
|
60
|
+
// Place once near the root
|
|
61
|
+
<InspectDialogManager />;
|
|
62
|
+
|
|
63
|
+
// Trigger from a menu item or button
|
|
64
|
+
openInspectDialog(targetElement);
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`@ewjdev/anyclick-react` keeps the tiny inspector for quick selector/copy/screenshot flows, while `@ewjdev/anyclick-devtools` hosts the full-featured experience.
|
|
68
|
+
|
|
46
69
|
## Features
|
|
47
70
|
|
|
48
71
|
- 🖱️ **Right-Click Context Menu** - Native feel with customizable items
|
|
@@ -53,7 +76,7 @@ That's it! Users can now right-click any element to submit feedback.
|
|
|
53
76
|
- 📁 **Submenus** - Organize menu items with nested submenus
|
|
54
77
|
- 🎯 **Scoped Providers** - Limit feedback capture to specific components
|
|
55
78
|
- 🎨 **Nested Theming** - Override themes for specific sections of your app
|
|
56
|
-
- 🔍 **
|
|
79
|
+
- 🔍 **Tiny Inspector** - Built-in lightweight inspector (selector, contents, screenshot); full DevTools UI now lives in `@ewjdev/anyclick-devtools`
|
|
57
80
|
- ⚡ **Performance Optimized** - Memoized components and efficient re-renders
|
|
58
81
|
|
|
59
82
|
## API Reference
|
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,6 @@ import React__default, { ReactNode, CSSProperties } 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';
|
|
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,44 +119,25 @@ 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
|
|
140
|
+
declare function InspectSimple({ visible, targetElement, onClose, ideConfig, style, className, highlightColors, }: InspectSimpleProps): react_jsx_runtime.JSX.Element | null;
|
|
173
141
|
|
|
174
142
|
/**
|
|
175
143
|
* Type definitions for @ewjdev/anyclick-react.
|
|
@@ -1287,118 +1255,6 @@ interface InspectDialogManagerProps {
|
|
|
1287
1255
|
*/
|
|
1288
1256
|
declare function InspectDialogManager({ ideConfig, dialogStyle, dialogClassName, highlightColors, showBoxModelOverlay, initialPinnedPosition, compactConfig, }: InspectDialogManagerProps): react_jsx_runtime.JSX.Element;
|
|
1289
1257
|
|
|
1290
|
-
/**
|
|
1291
|
-
* Represents a modification made to an element
|
|
1292
|
-
*/
|
|
1293
|
-
interface ElementModification {
|
|
1294
|
-
/** Unique identifier for the element (generated selector or path) */
|
|
1295
|
-
elementId: string;
|
|
1296
|
-
/** CSS selector to find the element */
|
|
1297
|
-
selector: string;
|
|
1298
|
-
/** Human-readable description of the element */
|
|
1299
|
-
description: string;
|
|
1300
|
-
/** Timestamp of the last modification */
|
|
1301
|
-
lastModified: number;
|
|
1302
|
-
/** Original inline styles before modification */
|
|
1303
|
-
originalStyles: Record<string, string>;
|
|
1304
|
-
/** Current modified inline styles */
|
|
1305
|
-
modifiedStyles: Record<string, string>;
|
|
1306
|
-
/** Original attributes before modification */
|
|
1307
|
-
originalAttributes: Record<string, string>;
|
|
1308
|
-
/** Current modified attributes */
|
|
1309
|
-
modifiedAttributes: Record<string, string>;
|
|
1310
|
-
/** Whether the element was deleted */
|
|
1311
|
-
isDeleted?: boolean;
|
|
1312
|
-
}
|
|
1313
|
-
/**
|
|
1314
|
-
* Represents a deleted (hidden) element that can be restored
|
|
1315
|
-
* Elements are hidden with display:none rather than removed from DOM
|
|
1316
|
-
* for easier persistence and recovery
|
|
1317
|
-
*/
|
|
1318
|
-
interface DeletedElement {
|
|
1319
|
-
/** Unique identifier for the element */
|
|
1320
|
-
elementId: string;
|
|
1321
|
-
/** CSS selector to find the element */
|
|
1322
|
-
selector: string;
|
|
1323
|
-
/** Human-readable description */
|
|
1324
|
-
description: string;
|
|
1325
|
-
/** Original display value before hiding */
|
|
1326
|
-
originalDisplay: string;
|
|
1327
|
-
/** Timestamp of deletion */
|
|
1328
|
-
deletedAt: number;
|
|
1329
|
-
}
|
|
1330
|
-
/**
|
|
1331
|
-
* Generate a unique ID for an element based on its position in the DOM
|
|
1332
|
-
* Uses only simple, reliable selectors to avoid issues with special characters
|
|
1333
|
-
*/
|
|
1334
|
-
declare function generateElementId(element: Element): string;
|
|
1335
|
-
/**
|
|
1336
|
-
* Get a human-readable description of an element
|
|
1337
|
-
*/
|
|
1338
|
-
declare function getElementDescription(element: Element): string;
|
|
1339
|
-
/**
|
|
1340
|
-
* Persisted state shape (what gets saved to localStorage)
|
|
1341
|
-
*/
|
|
1342
|
-
interface PersistedState {
|
|
1343
|
-
pinnedPosition: PinnedPosition;
|
|
1344
|
-
modifiedElements: Record<string, ElementModification>;
|
|
1345
|
-
deletedElements: Record<string, DeletedElement>;
|
|
1346
|
-
}
|
|
1347
|
-
interface InspectStore extends PersistedState {
|
|
1348
|
-
/** Persisted pinned position */
|
|
1349
|
-
setPinnedPosition: (position: PinnedPosition) => void;
|
|
1350
|
-
/** Whether the store has been hydrated from storage */
|
|
1351
|
-
_hasHydrated: boolean;
|
|
1352
|
-
setHasHydrated: (state: boolean) => void;
|
|
1353
|
-
/** Whether modifications were auto-applied on page load */
|
|
1354
|
-
hasAutoAppliedModifications: boolean;
|
|
1355
|
-
setHasAutoAppliedModifications: (value: boolean) => void;
|
|
1356
|
-
/** Track a modification to an element */
|
|
1357
|
-
trackModification: (element: Element, type: "style" | "attribute", key: string, oldValue: string | null, newValue: string | null) => void;
|
|
1358
|
-
/** Track an element deletion */
|
|
1359
|
-
trackDeletion: (element: Element) => void;
|
|
1360
|
-
/** Get modification record for an element */
|
|
1361
|
-
getModification: (element: Element) => ElementModification | null;
|
|
1362
|
-
/** Reset all modifications for a specific element */
|
|
1363
|
-
resetElement: (elementId: string) => void;
|
|
1364
|
-
/** Reset all modifications for all elements (including restoring deleted elements) */
|
|
1365
|
-
resetAllElements: () => void;
|
|
1366
|
-
/** Get all modified elements that still exist in the DOM */
|
|
1367
|
-
getModifiedElementsInDOM: () => Array<{
|
|
1368
|
-
modification: ElementModification;
|
|
1369
|
-
element: Element | null;
|
|
1370
|
-
}>;
|
|
1371
|
-
/** Get count of deleted elements */
|
|
1372
|
-
getDeletedCount: () => number;
|
|
1373
|
-
/** Apply persisted modifications to the DOM */
|
|
1374
|
-
applyPersistedModifications: () => number;
|
|
1375
|
-
/** Clear persisted state (for testing) */
|
|
1376
|
-
clearPersistedState: () => void;
|
|
1377
|
-
}
|
|
1378
|
-
declare const useInspectStore: zustand.UseBoundStore<Omit<zustand.StoreApi<InspectStore>, "setState" | "persist"> & {
|
|
1379
|
-
setState(partial: InspectStore | Partial<InspectStore> | ((state: InspectStore) => InspectStore | Partial<InspectStore>), replace?: false | undefined): unknown;
|
|
1380
|
-
setState(state: InspectStore | ((state: InspectStore) => InspectStore), replace: true): unknown;
|
|
1381
|
-
persist: {
|
|
1382
|
-
setOptions: (options: Partial<zustand_middleware.PersistOptions<InspectStore, unknown, unknown>>) => void;
|
|
1383
|
-
clearStorage: () => void;
|
|
1384
|
-
rehydrate: () => Promise<void> | void;
|
|
1385
|
-
hasHydrated: () => boolean;
|
|
1386
|
-
onHydrate: (fn: (state: InspectStore) => void) => () => void;
|
|
1387
|
-
onFinishHydration: (fn: (state: InspectStore) => void) => () => void;
|
|
1388
|
-
getOptions: () => Partial<zustand_middleware.PersistOptions<InspectStore, unknown, unknown>>;
|
|
1389
|
-
};
|
|
1390
|
-
}>;
|
|
1391
|
-
/**
|
|
1392
|
-
* Custom hook to check if the store has been hydrated
|
|
1393
|
-
* Use this to prevent hydration mismatches in SSR
|
|
1394
|
-
*/
|
|
1395
|
-
declare function useHasHydrated(): boolean;
|
|
1396
|
-
/**
|
|
1397
|
-
* Wait for hydration to complete before accessing persisted data
|
|
1398
|
-
* Useful for ensuring data is available before rendering
|
|
1399
|
-
*/
|
|
1400
|
-
declare function waitForHydration(): Promise<void>;
|
|
1401
|
-
|
|
1402
1258
|
interface AnyclickLogoProps {
|
|
1403
1259
|
/** Size of the logo in pixels. Defaults to 64 */
|
|
1404
1260
|
size?: number;
|
|
@@ -1421,29 +1277,4 @@ interface AnyclickLogoProps {
|
|
|
1421
1277
|
*/
|
|
1422
1278
|
declare function AnyclickLogo({ size, borderWidth, primaryColor, backgroundColor, className, style, onClick, }: AnyclickLogoProps): react_jsx_runtime.JSX.Element;
|
|
1423
1279
|
|
|
1424
|
-
|
|
1425
|
-
/** Position of the indicator. Defaults to "bottom-right" */
|
|
1426
|
-
position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
1427
|
-
/** Size of the logo in pixels. Defaults to 48 */
|
|
1428
|
-
size?: number;
|
|
1429
|
-
/** Whether to auto-apply persisted modifications on mount. Defaults to true */
|
|
1430
|
-
autoApply?: boolean;
|
|
1431
|
-
/** Offset from edge in pixels. Defaults to 16 */
|
|
1432
|
-
offset?: number;
|
|
1433
|
-
/** Primary color for the logo */
|
|
1434
|
-
primaryColor?: string;
|
|
1435
|
-
/** Background color for the logo */
|
|
1436
|
-
backgroundColor?: string;
|
|
1437
|
-
}
|
|
1438
|
-
/**
|
|
1439
|
-
* ModificationIndicator - Shows the Anyclick logo when modifications are active
|
|
1440
|
-
*
|
|
1441
|
-
* This component:
|
|
1442
|
-
* 1. Waits for Zustand hydration before applying modifications
|
|
1443
|
-
* 2. Auto-applies persisted modifications on mount (if autoApply is true)
|
|
1444
|
-
* 3. Shows the Anyclick logo in the corner when modifications are active
|
|
1445
|
-
* 4. Clicking the logo opens a quick menu to view/reset modifications
|
|
1446
|
-
*/
|
|
1447
|
-
declare function ModificationIndicator({ position, size, autoApply, offset, primaryColor, backgroundColor, }: ModificationIndicatorProps): react_jsx_runtime.JSX.Element | null;
|
|
1448
|
-
|
|
1449
|
-
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, getBadgeStyle, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import React__default, { ReactNode, CSSProperties } 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';
|
|
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,44 +119,25 @@ 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
|
|
140
|
+
declare function InspectSimple({ visible, targetElement, onClose, ideConfig, style, className, highlightColors, }: InspectSimpleProps): react_jsx_runtime.JSX.Element | null;
|
|
173
141
|
|
|
174
142
|
/**
|
|
175
143
|
* Type definitions for @ewjdev/anyclick-react.
|
|
@@ -1287,118 +1255,6 @@ interface InspectDialogManagerProps {
|
|
|
1287
1255
|
*/
|
|
1288
1256
|
declare function InspectDialogManager({ ideConfig, dialogStyle, dialogClassName, highlightColors, showBoxModelOverlay, initialPinnedPosition, compactConfig, }: InspectDialogManagerProps): react_jsx_runtime.JSX.Element;
|
|
1289
1257
|
|
|
1290
|
-
/**
|
|
1291
|
-
* Represents a modification made to an element
|
|
1292
|
-
*/
|
|
1293
|
-
interface ElementModification {
|
|
1294
|
-
/** Unique identifier for the element (generated selector or path) */
|
|
1295
|
-
elementId: string;
|
|
1296
|
-
/** CSS selector to find the element */
|
|
1297
|
-
selector: string;
|
|
1298
|
-
/** Human-readable description of the element */
|
|
1299
|
-
description: string;
|
|
1300
|
-
/** Timestamp of the last modification */
|
|
1301
|
-
lastModified: number;
|
|
1302
|
-
/** Original inline styles before modification */
|
|
1303
|
-
originalStyles: Record<string, string>;
|
|
1304
|
-
/** Current modified inline styles */
|
|
1305
|
-
modifiedStyles: Record<string, string>;
|
|
1306
|
-
/** Original attributes before modification */
|
|
1307
|
-
originalAttributes: Record<string, string>;
|
|
1308
|
-
/** Current modified attributes */
|
|
1309
|
-
modifiedAttributes: Record<string, string>;
|
|
1310
|
-
/** Whether the element was deleted */
|
|
1311
|
-
isDeleted?: boolean;
|
|
1312
|
-
}
|
|
1313
|
-
/**
|
|
1314
|
-
* Represents a deleted (hidden) element that can be restored
|
|
1315
|
-
* Elements are hidden with display:none rather than removed from DOM
|
|
1316
|
-
* for easier persistence and recovery
|
|
1317
|
-
*/
|
|
1318
|
-
interface DeletedElement {
|
|
1319
|
-
/** Unique identifier for the element */
|
|
1320
|
-
elementId: string;
|
|
1321
|
-
/** CSS selector to find the element */
|
|
1322
|
-
selector: string;
|
|
1323
|
-
/** Human-readable description */
|
|
1324
|
-
description: string;
|
|
1325
|
-
/** Original display value before hiding */
|
|
1326
|
-
originalDisplay: string;
|
|
1327
|
-
/** Timestamp of deletion */
|
|
1328
|
-
deletedAt: number;
|
|
1329
|
-
}
|
|
1330
|
-
/**
|
|
1331
|
-
* Generate a unique ID for an element based on its position in the DOM
|
|
1332
|
-
* Uses only simple, reliable selectors to avoid issues with special characters
|
|
1333
|
-
*/
|
|
1334
|
-
declare function generateElementId(element: Element): string;
|
|
1335
|
-
/**
|
|
1336
|
-
* Get a human-readable description of an element
|
|
1337
|
-
*/
|
|
1338
|
-
declare function getElementDescription(element: Element): string;
|
|
1339
|
-
/**
|
|
1340
|
-
* Persisted state shape (what gets saved to localStorage)
|
|
1341
|
-
*/
|
|
1342
|
-
interface PersistedState {
|
|
1343
|
-
pinnedPosition: PinnedPosition;
|
|
1344
|
-
modifiedElements: Record<string, ElementModification>;
|
|
1345
|
-
deletedElements: Record<string, DeletedElement>;
|
|
1346
|
-
}
|
|
1347
|
-
interface InspectStore extends PersistedState {
|
|
1348
|
-
/** Persisted pinned position */
|
|
1349
|
-
setPinnedPosition: (position: PinnedPosition) => void;
|
|
1350
|
-
/** Whether the store has been hydrated from storage */
|
|
1351
|
-
_hasHydrated: boolean;
|
|
1352
|
-
setHasHydrated: (state: boolean) => void;
|
|
1353
|
-
/** Whether modifications were auto-applied on page load */
|
|
1354
|
-
hasAutoAppliedModifications: boolean;
|
|
1355
|
-
setHasAutoAppliedModifications: (value: boolean) => void;
|
|
1356
|
-
/** Track a modification to an element */
|
|
1357
|
-
trackModification: (element: Element, type: "style" | "attribute", key: string, oldValue: string | null, newValue: string | null) => void;
|
|
1358
|
-
/** Track an element deletion */
|
|
1359
|
-
trackDeletion: (element: Element) => void;
|
|
1360
|
-
/** Get modification record for an element */
|
|
1361
|
-
getModification: (element: Element) => ElementModification | null;
|
|
1362
|
-
/** Reset all modifications for a specific element */
|
|
1363
|
-
resetElement: (elementId: string) => void;
|
|
1364
|
-
/** Reset all modifications for all elements (including restoring deleted elements) */
|
|
1365
|
-
resetAllElements: () => void;
|
|
1366
|
-
/** Get all modified elements that still exist in the DOM */
|
|
1367
|
-
getModifiedElementsInDOM: () => Array<{
|
|
1368
|
-
modification: ElementModification;
|
|
1369
|
-
element: Element | null;
|
|
1370
|
-
}>;
|
|
1371
|
-
/** Get count of deleted elements */
|
|
1372
|
-
getDeletedCount: () => number;
|
|
1373
|
-
/** Apply persisted modifications to the DOM */
|
|
1374
|
-
applyPersistedModifications: () => number;
|
|
1375
|
-
/** Clear persisted state (for testing) */
|
|
1376
|
-
clearPersistedState: () => void;
|
|
1377
|
-
}
|
|
1378
|
-
declare const useInspectStore: zustand.UseBoundStore<Omit<zustand.StoreApi<InspectStore>, "setState" | "persist"> & {
|
|
1379
|
-
setState(partial: InspectStore | Partial<InspectStore> | ((state: InspectStore) => InspectStore | Partial<InspectStore>), replace?: false | undefined): unknown;
|
|
1380
|
-
setState(state: InspectStore | ((state: InspectStore) => InspectStore), replace: true): unknown;
|
|
1381
|
-
persist: {
|
|
1382
|
-
setOptions: (options: Partial<zustand_middleware.PersistOptions<InspectStore, unknown, unknown>>) => void;
|
|
1383
|
-
clearStorage: () => void;
|
|
1384
|
-
rehydrate: () => Promise<void> | void;
|
|
1385
|
-
hasHydrated: () => boolean;
|
|
1386
|
-
onHydrate: (fn: (state: InspectStore) => void) => () => void;
|
|
1387
|
-
onFinishHydration: (fn: (state: InspectStore) => void) => () => void;
|
|
1388
|
-
getOptions: () => Partial<zustand_middleware.PersistOptions<InspectStore, unknown, unknown>>;
|
|
1389
|
-
};
|
|
1390
|
-
}>;
|
|
1391
|
-
/**
|
|
1392
|
-
* Custom hook to check if the store has been hydrated
|
|
1393
|
-
* Use this to prevent hydration mismatches in SSR
|
|
1394
|
-
*/
|
|
1395
|
-
declare function useHasHydrated(): boolean;
|
|
1396
|
-
/**
|
|
1397
|
-
* Wait for hydration to complete before accessing persisted data
|
|
1398
|
-
* Useful for ensuring data is available before rendering
|
|
1399
|
-
*/
|
|
1400
|
-
declare function waitForHydration(): Promise<void>;
|
|
1401
|
-
|
|
1402
1258
|
interface AnyclickLogoProps {
|
|
1403
1259
|
/** Size of the logo in pixels. Defaults to 64 */
|
|
1404
1260
|
size?: number;
|
|
@@ -1421,29 +1277,4 @@ interface AnyclickLogoProps {
|
|
|
1421
1277
|
*/
|
|
1422
1278
|
declare function AnyclickLogo({ size, borderWidth, primaryColor, backgroundColor, className, style, onClick, }: AnyclickLogoProps): react_jsx_runtime.JSX.Element;
|
|
1423
1279
|
|
|
1424
|
-
|
|
1425
|
-
/** Position of the indicator. Defaults to "bottom-right" */
|
|
1426
|
-
position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
1427
|
-
/** Size of the logo in pixels. Defaults to 48 */
|
|
1428
|
-
size?: number;
|
|
1429
|
-
/** Whether to auto-apply persisted modifications on mount. Defaults to true */
|
|
1430
|
-
autoApply?: boolean;
|
|
1431
|
-
/** Offset from edge in pixels. Defaults to 16 */
|
|
1432
|
-
offset?: number;
|
|
1433
|
-
/** Primary color for the logo */
|
|
1434
|
-
primaryColor?: string;
|
|
1435
|
-
/** Background color for the logo */
|
|
1436
|
-
backgroundColor?: string;
|
|
1437
|
-
}
|
|
1438
|
-
/**
|
|
1439
|
-
* ModificationIndicator - Shows the Anyclick logo when modifications are active
|
|
1440
|
-
*
|
|
1441
|
-
* This component:
|
|
1442
|
-
* 1. Waits for Zustand hydration before applying modifications
|
|
1443
|
-
* 2. Auto-applies persisted modifications on mount (if autoApply is true)
|
|
1444
|
-
* 3. Shows the Anyclick logo in the corner when modifications are active
|
|
1445
|
-
* 4. Clicking the logo opens a quick menu to view/reset modifications
|
|
1446
|
-
*/
|
|
1447
|
-
declare function ModificationIndicator({ position, size, autoApply, offset, primaryColor, backgroundColor, }: ModificationIndicatorProps): react_jsx_runtime.JSX.Element | null;
|
|
1448
|
-
|
|
1449
|
-
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, getBadgeStyle, 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 };
|