@eyeglass/inspector 0.1.6 → 0.1.7

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 CHANGED
@@ -27,15 +27,19 @@ The inspector auto-initializes when imported and only runs in development mode.
27
27
  - **Multi-select** up to 5 elements
28
28
  - **Framework detection** - React, Vue, Svelte component names and file paths
29
29
  - **Semantic capture** - accessibility tree, computed styles, geometry
30
+ - **DOM neighborhood** - captures parent layout context (flex/grid) and children
30
31
  - **Real-time feedback** - see Claude's progress in the browser
31
32
  - **One-click undo** - revert changes from the hub
33
+ - **Keyboard shortcuts** - toggle inspector with `Cmd/Ctrl + Shift + E`
32
34
 
33
35
  ## How It Works
34
36
 
35
37
  1. Hover over elements to highlight them
36
38
  2. Click to select and open the request panel
37
39
  3. Type what you want to change
38
- 4. Submit - Claude receives full context and makes the change
40
+ 4. Submit - your AI agent receives full context and makes the change
39
41
  5. HMR updates your browser automatically
40
42
 
43
+ **Supported agents:** Claude Code, GitHub Copilot CLI, OpenAI Codex CLI
44
+
41
45
  See the [main repo](https://github.com/donutboyband/eyeglass) for full documentation.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Constants for Eyeglass Inspector
3
+ */
4
+ export declare const BRIDGE_URL = "http://localhost:3300";
5
+ export declare const STORAGE_KEY = "eyeglass_session";
6
+ export declare const HISTORY_KEY = "eyeglass_history";
7
+ export declare const ENABLED_KEY = "eyeglass_enabled";
8
+ export declare const AUTOCOMMIT_KEY = "eyeglass_autocommit";
9
+ export declare const THEME_KEY = "eyeglass_theme";
10
+ export declare const SESSION_TTL = 10000;
11
+ export declare const MAX_SELECTION = 5;
12
+ export declare const WORKING_PHRASES: string[];
13
+ export declare const EYE_CURSOR = "url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiM2MzY2ZjEiIHN0cm9rZS13aWR0aD0iMi41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik0xIDEyczQtOCAxMS04IDExIDggMTEgOC00IDgtMTEgOC0xMS04LTExLTh6Ii8+PGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iMyIgZmlsbD0iIzYzNjZmMSIvPjwvc3ZnPg==\") 8 8, crosshair";
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Drag handlers for Eyeglass Inspector panel
3
+ */
4
+ export interface DragState {
5
+ isDragging: boolean;
6
+ dragOffset: {
7
+ x: number;
8
+ y: number;
9
+ };
10
+ panel: HTMLDivElement | null;
11
+ }
12
+ export interface DragCallbacks {
13
+ setDragging: (isDragging: boolean) => void;
14
+ setDragOffset: (offset: {
15
+ x: number;
16
+ y: number;
17
+ }) => void;
18
+ setCustomPanelPosition: (position: {
19
+ x: number;
20
+ y: number;
21
+ }) => void;
22
+ }
23
+ /**
24
+ * Creates panel drag handler functions
25
+ */
26
+ export declare function createDragHandlers(getState: () => DragState, callbacks: DragCallbacks): {
27
+ handlePanelDragStart: (e: MouseEvent) => void;
28
+ handlePanelDrag: (e: MouseEvent) => void;
29
+ handlePanelDragEnd: () => void;
30
+ };
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Event handlers for Eyeglass Inspector
3
+ */
4
+ export interface MouseMoveHandlerState {
5
+ frozen: boolean;
6
+ multiSelectMode: boolean;
7
+ inspectorEnabled: boolean;
8
+ throttleTimeout: number | null;
9
+ }
10
+ export interface MouseMoveHandlerCallbacks {
11
+ setThrottleTimeout: (timeout: number | null) => void;
12
+ hideHighlight: () => void;
13
+ showHighlight: (element: Element) => void;
14
+ setCurrentElement: (element: Element | null) => void;
15
+ }
16
+ /**
17
+ * Creates a mouse move handler function
18
+ */
19
+ export declare function createMouseMoveHandler(host: HTMLElement, shadow: ShadowRoot, getState: () => MouseMoveHandlerState, callbacks: MouseMoveHandlerCallbacks): (e: MouseEvent) => void;
20
+ export interface ClickHandlerState {
21
+ inspectorEnabled: boolean;
22
+ currentElement: Element | null;
23
+ frozen: boolean;
24
+ multiSelectMode: boolean;
25
+ }
26
+ export interface ClickHandlerCallbacks {
27
+ toggleInSelection: (element: Element) => void;
28
+ freeze: () => void;
29
+ }
30
+ /**
31
+ * Creates a click handler function
32
+ */
33
+ export declare function createClickHandler(host: HTMLElement, getState: () => ClickHandlerState, callbacks: ClickHandlerCallbacks): (e: MouseEvent) => void;
34
+ export interface KeyDownHandlerState {
35
+ frozen: boolean;
36
+ }
37
+ export interface KeyDownHandlerCallbacks {
38
+ unfreeze: () => void;
39
+ toggleInspectorEnabled: () => void;
40
+ }
41
+ /**
42
+ * Creates a keydown handler function
43
+ *
44
+ * Keyboard shortcuts:
45
+ * - Escape: Close panel / unfreeze
46
+ * - Ctrl/Cmd + Shift + E: Toggle inspector enabled
47
+ */
48
+ export declare function createKeyDownHandler(getState: () => KeyDownHandlerState, callbacks: KeyDownHandlerCallbacks): (e: KeyboardEvent) => void;
49
+ export interface ScrollHandlerState {
50
+ frozen: boolean;
51
+ currentElement: Element | null;
52
+ highlight: HTMLDivElement | null;
53
+ multiSelectMode: boolean;
54
+ selectedElements: Element[];
55
+ scrollTimeout: number | null;
56
+ }
57
+ export interface ScrollHandlerCallbacks {
58
+ showHighlight: (element: Element) => void;
59
+ updateMultiSelectHighlightPositions: () => void;
60
+ disableHighlightTransitions: () => void;
61
+ enableHighlightTransitions: () => void;
62
+ setScrollTimeout: (timeout: number | null) => void;
63
+ }
64
+ /**
65
+ * Creates a scroll handler function
66
+ */
67
+ export declare function createScrollHandler(getState: () => ScrollHandlerState, callbacks: ScrollHandlerCallbacks): () => void;