@hereorcode/dom-inspector 0.1.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 ADDED
@@ -0,0 +1,44 @@
1
+ # @hereorcode/dom-inspector
2
+
3
+ A lightweight browser-side DOM inspector that returns selector, XPath, and JS
4
+ path information for clicked elements.
5
+
6
+ ## Status
7
+
8
+ This package has not been published to npm yet. Use it from this pnpm workspace
9
+ or build/link it locally while developing.
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { createDOMInspector } from "@hereorcode/dom-inspector";
15
+
16
+ const inspector = createDOMInspector({
17
+ selectionScope: { modifierKey: "Alt" },
18
+ onSelect(result) {
19
+ console.log(result.selector);
20
+ console.log(result.xpath);
21
+ console.log(result.jsPath);
22
+ }
23
+ });
24
+
25
+ inspector.start();
26
+ ```
27
+
28
+ Hold `Alt`/`Option` while scrolling to expand or shrink the current hover scope
29
+ before clicking. Pass `selectionScope: false` to disable this behavior.
30
+
31
+ ## Local Development
32
+
33
+ From the repository root:
34
+
35
+ ```bash
36
+ pnpm install
37
+ pnpm --filter @hereorcode/dom-inspector typecheck
38
+ pnpm --filter @hereorcode/dom-inspector test
39
+ pnpm --filter @hereorcode/dom-inspector build
40
+ ```
41
+
42
+ Use the generated `dist` output only after running the build command. During
43
+ workspace development, the demo app imports this package through
44
+ `"@hereorcode/dom-inspector": "workspace:*"`.