@aylith/inspekt-core 0.4.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.
Files changed (71) hide show
  1. package/dist/actions/built-in.d.ts +17 -0
  2. package/dist/actions/built-in.d.ts.map +1 -0
  3. package/dist/adapters/generic.d.ts +3 -0
  4. package/dist/adapters/generic.d.ts.map +1 -0
  5. package/dist/adapters/index.d.ts +5 -0
  6. package/dist/adapters/index.d.ts.map +1 -0
  7. package/dist/adapters/react.d.ts +3 -0
  8. package/dist/adapters/react.d.ts.map +1 -0
  9. package/dist/adapters/solid.d.ts +3 -0
  10. package/dist/adapters/solid.d.ts.map +1 -0
  11. package/dist/adapters/svelte.d.ts +3 -0
  12. package/dist/adapters/svelte.d.ts.map +1 -0
  13. package/dist/adapters/types.d.ts +19 -0
  14. package/dist/adapters/types.d.ts.map +1 -0
  15. package/dist/adapters/vue.d.ts +3 -0
  16. package/dist/adapters/vue.d.ts.map +1 -0
  17. package/dist/capability-probe-AKVKYSDE.js +107 -0
  18. package/dist/capability-probe-AKVKYSDE.js.map +1 -0
  19. package/dist/components/rich-select.d.ts +62 -0
  20. package/dist/components/rich-select.d.ts.map +1 -0
  21. package/dist/components/tooltip.d.ts +34 -0
  22. package/dist/components/tooltip.d.ts.map +1 -0
  23. package/dist/detection/capability-probe.d.ts +31 -0
  24. package/dist/detection/capability-probe.d.ts.map +1 -0
  25. package/dist/detection/fiber-detector.d.ts +12 -0
  26. package/dist/detection/fiber-detector.d.ts.map +1 -0
  27. package/dist/detection/source-detector.d.ts +30 -0
  28. package/dist/detection/source-detector.d.ts.map +1 -0
  29. package/dist/detection/vue-detector.d.ts +14 -0
  30. package/dist/detection/vue-detector.d.ts.map +1 -0
  31. package/dist/fiber-detector-CFB7M7OY.js +50 -0
  32. package/dist/fiber-detector-CFB7M7OY.js.map +1 -0
  33. package/dist/highlight/bounding-boxes.d.ts +20 -0
  34. package/dist/highlight/bounding-boxes.d.ts.map +1 -0
  35. package/dist/highlight/highlighter.d.ts +11 -0
  36. package/dist/highlight/highlighter.d.ts.map +1 -0
  37. package/dist/highlight/prism.d.ts +23 -0
  38. package/dist/highlight/prism.d.ts.map +1 -0
  39. package/dist/index.cjs +3560 -0
  40. package/dist/index.cjs.map +1 -0
  41. package/dist/index.d.ts +12 -0
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +3222 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/overlay/overlay.d.ts +30 -0
  46. package/dist/overlay/overlay.d.ts.map +1 -0
  47. package/dist/popover/popover.d.ts +54 -0
  48. package/dist/popover/popover.d.ts.map +1 -0
  49. package/dist/runtime/context.d.ts +3 -0
  50. package/dist/runtime/context.d.ts.map +1 -0
  51. package/dist/runtime/freeze.d.ts +2 -0
  52. package/dist/runtime/freeze.d.ts.map +1 -0
  53. package/dist/runtime/index.d.ts +4 -0
  54. package/dist/runtime/index.d.ts.map +1 -0
  55. package/dist/runtime/open-file.d.ts +2 -0
  56. package/dist/runtime/open-file.d.ts.map +1 -0
  57. package/dist/snippet/cache.d.ts +13 -0
  58. package/dist/snippet/cache.d.ts.map +1 -0
  59. package/dist/snippet/snippet-resolver.d.ts +21 -0
  60. package/dist/snippet/snippet-resolver.d.ts.map +1 -0
  61. package/dist/snippet/sourcemap-resolver.d.ts +9 -0
  62. package/dist/snippet/sourcemap-resolver.d.ts.map +1 -0
  63. package/dist/sourcemap-resolver-3PQ6R6PU.js +182 -0
  64. package/dist/sourcemap-resolver-3PQ6R6PU.js.map +1 -0
  65. package/dist/styles.d.ts +2 -0
  66. package/dist/styles.d.ts.map +1 -0
  67. package/dist/tree-panel/tree-panel.d.ts +33 -0
  68. package/dist/tree-panel/tree-panel.d.ts.map +1 -0
  69. package/dist/types.d.ts +148 -0
  70. package/dist/types.d.ts.map +1 -0
  71. package/package.json +51 -0
@@ -0,0 +1,17 @@
1
+ import type { InspektAction, InspektCustomEditor } from '../types.js';
2
+ export interface SendToAgentOptions {
3
+ /** Daemon base URL — typically http://127.0.0.1:5678. */
4
+ daemonUrl: string;
5
+ /** Token required in X-Inspekt-Token. Set by `npx inspekt setup`. */
6
+ token: string;
7
+ /** Callback fired after a successful POST — used for UX (toast, etc.). */
8
+ onSent?: (grabId: string) => void;
9
+ /** Callback for errors. */
10
+ onError?: (err: Error) => void;
11
+ }
12
+ export declare function createSendToAgentAction(opts: SendToAgentOptions): InspektAction;
13
+ export declare function createOpenEditorAction(serverUrl: string, editor: string, customEditors?: InspektCustomEditor[]): InspektAction;
14
+ export declare function createCopyPathAction(): InspektAction;
15
+ export declare function createOpenGithubAction(repo: string, branch: string): InspektAction;
16
+ export declare function createConsoleLogAction(): InspektAction;
17
+ //# sourceMappingURL=built-in.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"built-in.d.ts","sourceRoot":"","sources":["../../src/actions/built-in.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAoB,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAQxF,MAAM,WAAW,kBAAkB;IACjC,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,2BAA2B;IAC3B,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC;CAChC;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,kBAAkB,GAAG,aAAa,CAsC/E;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,aAAa,GAAE,mBAAmB,EAAO,GACxC,aAAa,CAyBf;AAED,wBAAgB,oBAAoB,IAAI,aAAa,CAoBpD;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAWlF;AAED,wBAAgB,sBAAsB,IAAI,aAAa,CActD"}
@@ -0,0 +1,3 @@
1
+ import type { FrameworkAdapter } from './types.js';
2
+ export declare const genericAdapter: FrameworkAdapter;
3
+ //# sourceMappingURL=generic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic.d.ts","sourceRoot":"","sources":["../../src/adapters/generic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAsClE,eAAO,MAAM,cAAc,EAAE,gBAuE5B,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { FrameworkAdapter } from './types.js';
2
+ export type { ComponentNode, FrameworkAdapter } from './types.js';
3
+ export declare function detectAdapter(): FrameworkAdapter;
4
+ export declare function getAdapter(framework: string): FrameworkAdapter;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAOnD,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AASlE,wBAAgB,aAAa,IAAI,gBAAgB,CAKhD;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAa9D"}
@@ -0,0 +1,3 @@
1
+ import type { FrameworkAdapter } from './types.js';
2
+ export declare const reactAdapter: FrameworkAdapter;
3
+ //# sourceMappingURL=react.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/adapters/react.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAqLlE,eAAO,MAAM,YAAY,EAAE,gBAgE1B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { FrameworkAdapter } from './types.js';
2
+ export declare const solidAdapter: FrameworkAdapter;
3
+ //# sourceMappingURL=solid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solid.d.ts","sourceRoot":"","sources":["../../src/adapters/solid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAiBlE,eAAO,MAAM,YAAY,EAAE,gBA4H1B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { FrameworkAdapter } from './types.js';
2
+ export declare const svelteAdapter: FrameworkAdapter;
3
+ //# sourceMappingURL=svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svelte.d.ts","sourceRoot":"","sources":["../../src/adapters/svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAoBlE,eAAO,MAAM,aAAa,EAAE,gBA6H3B,CAAC"}
@@ -0,0 +1,19 @@
1
+ export interface ComponentNode {
2
+ name: string;
3
+ filePath: string | null;
4
+ line: number | null;
5
+ column: number | null;
6
+ domElement: HTMLElement | null;
7
+ props: Record<string, unknown> | null;
8
+ children: ComponentNode[];
9
+ framework: 'react' | 'vue' | 'svelte' | 'solid' | 'unknown';
10
+ depth: number;
11
+ }
12
+ export interface FrameworkAdapter {
13
+ name: string;
14
+ detect(): boolean;
15
+ getComponentTree(root: HTMLElement): ComponentNode | null;
16
+ getComponentAtElement(element: HTMLElement): ComponentNode | null;
17
+ getAncestors(element: HTMLElement): ComponentNode[];
18
+ }
19
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/adapters/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACtC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,SAAS,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IAC5D,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,IAAI,OAAO,CAAC;IAClB,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,aAAa,GAAG,IAAI,CAAC;IAC1D,qBAAqB,CAAC,OAAO,EAAE,WAAW,GAAG,aAAa,GAAG,IAAI,CAAC;IAClE,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,aAAa,EAAE,CAAC;CACrD"}
@@ -0,0 +1,3 @@
1
+ import type { FrameworkAdapter } from './types.js';
2
+ export declare const vueAdapter: FrameworkAdapter;
3
+ //# sourceMappingURL=vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue.d.ts","sourceRoot":"","sources":["../../src/adapters/vue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AA0GlE,eAAO,MAAM,UAAU,EAAE,gBAiExB,CAAC"}
@@ -0,0 +1,107 @@
1
+ // src/detection/capability-probe.ts
2
+ var PROBE_THROTTLE_MS = 500;
3
+ var PROBE_TIMEOUT_MS = 1e3;
4
+ var INSPEKT_CAPABILITIES_MESSAGE = "inspekt:capabilities";
5
+ async function pingHead(url, fetcher) {
6
+ const controller = new AbortController();
7
+ const timer = setTimeout(() => controller.abort(), PROBE_TIMEOUT_MS);
8
+ try {
9
+ const res = await fetcher(url, { method: "HEAD", signal: controller.signal });
10
+ return res.ok;
11
+ } catch {
12
+ return false;
13
+ } finally {
14
+ clearTimeout(timer);
15
+ }
16
+ }
17
+ function hasInstrumentation() {
18
+ if (document.querySelector("[data-insp-path]")) return true;
19
+ return false;
20
+ }
21
+ function detectSourceMapHint() {
22
+ const scripts = document.querySelectorAll("script[src]");
23
+ for (const s of Array.from(scripts).slice(0, 5)) {
24
+ if (s.src.endsWith(".map")) return true;
25
+ }
26
+ return false;
27
+ }
28
+ async function probeCapabilities(ctx = {}) {
29
+ const fetcher = ctx.fetcher ?? fetch;
30
+ const instrumented = hasInstrumentation();
31
+ const sourceMapAvailable = detectSourceMapHint();
32
+ const serverReachable = ctx.serverUrl ? await pingHead(new URL("/__inspekt/capabilities", ctx.serverUrl).toString(), fetcher) : false;
33
+ const agentConnected = ctx.daemonUrl ? await pingHead(new URL("/__inspekt/daemon", ctx.daemonUrl).toString(), fetcher) : false;
34
+ const snippetSource = serverReachable ? "devserver" : ctx.sourceMapEnabled && sourceMapAvailable ? "sourcemap" : null;
35
+ return {
36
+ instrumented,
37
+ snippetSource,
38
+ serverReachable,
39
+ sourceMapAvailable,
40
+ agentConnected
41
+ };
42
+ }
43
+ function publishCapabilities(caps, ctx = {}) {
44
+ if (ctx.onResult) {
45
+ ctx.onResult(caps);
46
+ return;
47
+ }
48
+ window.postMessage(
49
+ { source: "inspekt", type: INSPEKT_CAPABILITIES_MESSAGE, payload: caps },
50
+ "*"
51
+ );
52
+ }
53
+ function watchCapabilities(ctx = {}) {
54
+ let pending = false;
55
+ let lastPub = 0;
56
+ const fire = async () => {
57
+ if (pending) return;
58
+ pending = true;
59
+ try {
60
+ const caps = await probeCapabilities(ctx);
61
+ publishCapabilities(caps, ctx);
62
+ lastPub = Date.now();
63
+ } finally {
64
+ pending = false;
65
+ }
66
+ };
67
+ const schedule = () => {
68
+ const elapsed = Date.now() - lastPub;
69
+ if (elapsed >= PROBE_THROTTLE_MS) {
70
+ void fire();
71
+ } else {
72
+ setTimeout(fire, PROBE_THROTTLE_MS - elapsed);
73
+ }
74
+ };
75
+ void fire();
76
+ const observer = new MutationObserver((muts) => {
77
+ for (const m of muts) {
78
+ if (m.type === "attributes" && m.attributeName === "data-insp-path") {
79
+ schedule();
80
+ return;
81
+ }
82
+ if (m.type === "childList" && (m.addedNodes.length || m.removedNodes.length)) {
83
+ const added = Array.from(m.addedNodes).some(
84
+ (n) => n instanceof Element && n.querySelector?.("[data-insp-path]")
85
+ );
86
+ if (added) {
87
+ schedule();
88
+ return;
89
+ }
90
+ }
91
+ }
92
+ });
93
+ observer.observe(document.documentElement, {
94
+ subtree: true,
95
+ childList: true,
96
+ attributes: true,
97
+ attributeFilter: ["data-insp-path"]
98
+ });
99
+ return () => observer.disconnect();
100
+ }
101
+ export {
102
+ INSPEKT_CAPABILITIES_MESSAGE,
103
+ probeCapabilities,
104
+ publishCapabilities,
105
+ watchCapabilities
106
+ };
107
+ //# sourceMappingURL=capability-probe-AKVKYSDE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/detection/capability-probe.ts"],"sourcesContent":["// Per-tab capability probe. Runs in the page's main world (or content-script\n// world — works in either because it only touches the DOM and `fetch`) and\n// posts the result via `window.postMessage` so the Chrome extension's content\n// script can forward it to the background.\n//\n// The background script uses the result to pick the correct toolbar icon\n// (greyscale vs color) and badge text (\"OFF\" / \"ON\" / \"DEV\" / \"MAP\" / \"AI\").\n\nimport type { PageCapabilities } from '../types.js';\n\nconst PROBE_THROTTLE_MS = 500;\nconst PROBE_TIMEOUT_MS = 1000;\nexport const INSPEKT_CAPABILITIES_MESSAGE = 'inspekt:capabilities';\n\nexport interface ProbeContext {\n /** When set, used as the URL prefix for the dev-server `/capabilities` ping. */\n serverUrl?: string;\n /** When set, used as the URL prefix for the daemon `/daemon` ping (Phase 3+). */\n daemonUrl?: string;\n /**\n * When true, source-map fallback is enabled. The probe will set\n * snippetSource='sourcemap' even if the dev server is unreachable, as long\n * as the page has at least one .map-bearing script.\n */\n sourceMapEnabled?: boolean;\n /** Custom fetcher (injectable for tests). */\n fetcher?: typeof fetch;\n /** When set, posts the probe result via this callback instead of postMessage. */\n onResult?: (caps: PageCapabilities) => void;\n}\n\nasync function pingHead(url: string, fetcher: typeof fetch): Promise<boolean> {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), PROBE_TIMEOUT_MS);\n try {\n const res = await fetcher(url, { method: 'HEAD', signal: controller.signal });\n return res.ok;\n } catch {\n return false;\n } finally {\n clearTimeout(timer);\n }\n}\n\nfunction hasInstrumentation(): boolean {\n // Either a build-time attribute (multi-framework) or React fiber on the root\n // (zero-config React/Preact). Cheap synchronous check first.\n if (document.querySelector('[data-insp-path]')) return true;\n // Detecting React fiber here without importing bippy is unreliable; the\n // resolveElementSource() path will do it on actual element clicks. For the\n // probe we only flag instrumented when the static signal is present.\n return false;\n}\n\nfunction detectSourceMapHint(): boolean {\n // Cheap heuristic: at least one <script src=...> that returns the\n // `SourceMap` header or whose response ends with the `sourceMappingURL`\n // comment. We can't fetch every script body in the probe, so we look at\n // the document head for `<script>` tags whose URLs end with `.map` or\n // adjacent declarations. Conservative — Phase 5's resolver does the real\n // lookup on demand.\n const scripts = document.querySelectorAll<HTMLScriptElement>('script[src]');\n for (const s of Array.from(scripts).slice(0, 5)) {\n if (s.src.endsWith('.map')) return true;\n }\n return false;\n}\n\nexport async function probeCapabilities(ctx: ProbeContext = {}): Promise<PageCapabilities> {\n const fetcher = ctx.fetcher ?? fetch;\n const instrumented = hasInstrumentation();\n const sourceMapAvailable = detectSourceMapHint();\n\n const serverReachable = ctx.serverUrl\n ? await pingHead(new URL('/__inspekt/capabilities', ctx.serverUrl).toString(), fetcher)\n : false;\n\n const agentConnected = ctx.daemonUrl\n ? await pingHead(new URL('/__inspekt/daemon', ctx.daemonUrl).toString(), fetcher)\n : false;\n\n // Only claim sourcemap as the snippet source when the user has explicitly\n // opted in — otherwise the icon would imply we'll fetch .map files when in\n // fact we won't.\n const snippetSource: PageCapabilities['snippetSource'] = serverReachable\n ? 'devserver'\n : ctx.sourceMapEnabled && sourceMapAvailable\n ? 'sourcemap'\n : null;\n\n return {\n instrumented,\n snippetSource,\n serverReachable,\n sourceMapAvailable,\n agentConnected,\n };\n}\n\n/**\n * Publishes the probe result via `window.postMessage` so a Chrome extension\n * content script can forward it to the background. The message envelope is\n * stable and namespaced under `inspekt:capabilities`.\n */\nexport function publishCapabilities(caps: PageCapabilities, ctx: ProbeContext = {}): void {\n if (ctx.onResult) {\n ctx.onResult(caps);\n return;\n }\n window.postMessage(\n { source: 'inspekt', type: INSPEKT_CAPABILITIES_MESSAGE, payload: caps },\n '*',\n );\n}\n\n/**\n * Installs a MutationObserver that re-probes when `data-insp-path` attributes\n * appear/disappear from the document. Returns a teardown function.\n */\nexport function watchCapabilities(ctx: ProbeContext = {}): () => void {\n let pending = false;\n let lastPub = 0;\n\n const fire = async () => {\n if (pending) return;\n pending = true;\n try {\n const caps = await probeCapabilities(ctx);\n publishCapabilities(caps, ctx);\n lastPub = Date.now();\n } finally {\n pending = false;\n }\n };\n\n const schedule = () => {\n const elapsed = Date.now() - lastPub;\n if (elapsed >= PROBE_THROTTLE_MS) {\n void fire();\n } else {\n setTimeout(fire, PROBE_THROTTLE_MS - elapsed);\n }\n };\n\n // Initial probe.\n void fire();\n\n const observer = new MutationObserver((muts) => {\n for (const m of muts) {\n if (m.type === 'attributes' && m.attributeName === 'data-insp-path') {\n schedule();\n return;\n }\n if (m.type === 'childList' && (m.addedNodes.length || m.removedNodes.length)) {\n // Fast-path: only re-probe when an element we care about appeared.\n const added = Array.from(m.addedNodes).some(\n (n) => n instanceof Element && n.querySelector?.('[data-insp-path]'),\n );\n if (added) {\n schedule();\n return;\n }\n }\n }\n });\n observer.observe(document.documentElement, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['data-insp-path'],\n });\n\n return () => observer.disconnect();\n}\n"],"mappings":"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","names":[]}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * RichSelect — a small, framework-free dropdown that supports per-item
3
+ * icons, hint text, and an optional side-popover (used for the Editor
4
+ * picker which shows a "Visit website" link on hover).
5
+ *
6
+ * Lives in document scope (not shadow DOM) — it's meant for the Chrome
7
+ * extension's options / welcome surfaces, not the in-page popover. The
8
+ * listbox is portal-mounted on `document.body` so it escapes overflow:
9
+ * hidden ancestors.
10
+ */
11
+ import { type Placement } from '@floating-ui/dom';
12
+ export interface RichSelectItem<V extends string = string> {
13
+ value: V;
14
+ label: string;
15
+ /** Secondary descriptive line shown under the label. */
16
+ hint?: string;
17
+ /** Path / data URL / SVG inline string. If absent we render a letter tile. */
18
+ icon?: string;
19
+ /** Optional element rendered inside the per-row side popover. */
20
+ popover?: () => HTMLElement;
21
+ /**
22
+ * Optional group label. When two consecutive items have different group
23
+ * strings, a non-interactive header row is inserted before the second.
24
+ * Items with the same group string render together; the order of items
25
+ * decides the order of groups. Items without `group` form an implicit
26
+ * leading "ungrouped" section.
27
+ */
28
+ group?: string;
29
+ /**
30
+ * Optional click handler. When set, takes precedence over the default
31
+ * `select(value)` behavior — useful for action rows like "+ Add custom".
32
+ * The row is still rendered but skips the selected-state marker.
33
+ */
34
+ action?: () => void;
35
+ }
36
+ export interface RichSelectOptions<V extends string = string> {
37
+ /** Element to host the trigger button (replaced). */
38
+ anchor: HTMLElement;
39
+ items: RichSelectItem<V>[];
40
+ /** Current selected value. */
41
+ value: V;
42
+ /** Called on selection change. */
43
+ onChange: (value: V) => void;
44
+ /** ms delay before the per-item side popover appears. Default 50. */
45
+ popoverDelay?: number;
46
+ /** Optional aria label for the trigger. */
47
+ ariaLabel?: string;
48
+ /**
49
+ * Floating-UI placement for the per-row side popover. Defaults to `'top'`
50
+ * (matches the simple tooltip behavior). For the editor dropdown we pass
51
+ * `'left-start'` so the rich card slides in to the side without covering
52
+ * the listbox rows.
53
+ */
54
+ popoverPlacement?: Placement;
55
+ }
56
+ export interface RichSelectController<V extends string = string> {
57
+ setValue(value: V): void;
58
+ getValue(): V;
59
+ destroy(): void;
60
+ }
61
+ export declare function createRichSelect<V extends string = string>(opts: RichSelectOptions<V>): RichSelectController<V>;
62
+ //# sourceMappingURL=rich-select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rich-select.d.ts","sourceRoot":"","sources":["../../src/components/rich-select.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACvD,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,WAAW,CAAC;IAC5B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAC1D,qDAAqD;IACrD,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3B,8BAA8B;IAC9B,KAAK,EAAE,CAAC,CAAC;IACT,kCAAkC;IAClC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC7B,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAC7D,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACzB,QAAQ,IAAI,CAAC,CAAC;IACd,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EACxD,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,GACzB,oBAAoB,CAAC,CAAC,CAAC,CAmRzB"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Tooltip — drop-in replacement for the OS `title=""` attribute.
3
+ *
4
+ * Two modes:
5
+ * - **Plain**: `content` is a string → renders a small pill.
6
+ * - **Rich**: `content` is an HTMLElement → the tooltip stays open while the
7
+ * cursor is over the bubble itself (so anchors inside are clickable).
8
+ *
9
+ * Portal-aware: the bubble is appended into the provided `root` (a shadow
10
+ * root for in-page popover usage, or `document.body` for the extension's
11
+ * options/popup/welcome pages).
12
+ *
13
+ * Positioning is delegated to `@floating-ui/dom` — `computePosition` + `flip` +
14
+ * `shift` middleware keep the bubble inside the viewport; `autoUpdate` keeps
15
+ * it locked to the trigger as the page scrolls or resizes.
16
+ */
17
+ import { type Placement } from '@floating-ui/dom';
18
+ export interface TooltipOptions {
19
+ /** Render target. Defaults to `document.body`. */
20
+ root?: HTMLElement | ShadowRoot;
21
+ /** ms before showing on enter. Default 200. */
22
+ enterDelay?: number;
23
+ /** ms before hiding on leave. Default 80. */
24
+ leaveDelay?: number;
25
+ /**
26
+ * Floating-UI placement. Defaults to `'top'`. Auto-flips via the `flip`
27
+ * middleware when there's no room.
28
+ */
29
+ placement?: Placement;
30
+ /** Px gap between the trigger and the bubble. Default 8. */
31
+ offsetPx?: number;
32
+ }
33
+ export declare function attachTooltip(trigger: HTMLElement, content: string | HTMLElement, opts?: TooltipOptions): () => void;
34
+ //# sourceMappingURL=tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/components/tooltip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,cAAc;IAC7B,kDAAkD;IAClD,IAAI,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;IAChC,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAID,wBAAgB,aAAa,CAC3B,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,MAAM,GAAG,WAAW,EAC7B,IAAI,GAAE,cAAmB,GACxB,MAAM,IAAI,CAmHZ"}
@@ -0,0 +1,31 @@
1
+ import type { PageCapabilities } from '../types.js';
2
+ export declare const INSPEKT_CAPABILITIES_MESSAGE = "inspekt:capabilities";
3
+ export interface ProbeContext {
4
+ /** When set, used as the URL prefix for the dev-server `/capabilities` ping. */
5
+ serverUrl?: string;
6
+ /** When set, used as the URL prefix for the daemon `/daemon` ping (Phase 3+). */
7
+ daemonUrl?: string;
8
+ /**
9
+ * When true, source-map fallback is enabled. The probe will set
10
+ * snippetSource='sourcemap' even if the dev server is unreachable, as long
11
+ * as the page has at least one .map-bearing script.
12
+ */
13
+ sourceMapEnabled?: boolean;
14
+ /** Custom fetcher (injectable for tests). */
15
+ fetcher?: typeof fetch;
16
+ /** When set, posts the probe result via this callback instead of postMessage. */
17
+ onResult?: (caps: PageCapabilities) => void;
18
+ }
19
+ export declare function probeCapabilities(ctx?: ProbeContext): Promise<PageCapabilities>;
20
+ /**
21
+ * Publishes the probe result via `window.postMessage` so a Chrome extension
22
+ * content script can forward it to the background. The message envelope is
23
+ * stable and namespaced under `inspekt:capabilities`.
24
+ */
25
+ export declare function publishCapabilities(caps: PageCapabilities, ctx?: ProbeContext): void;
26
+ /**
27
+ * Installs a MutationObserver that re-probes when `data-insp-path` attributes
28
+ * appear/disappear from the document. Returns a teardown function.
29
+ */
30
+ export declare function watchCapabilities(ctx?: ProbeContext): () => void;
31
+ //# sourceMappingURL=capability-probe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability-probe.d.ts","sourceRoot":"","sources":["../../src/detection/capability-probe.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpD,eAAO,MAAM,4BAA4B,yBAAyB,CAAC;AAEnE,MAAM,WAAW,YAAY;IAC3B,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,6CAA6C;IAC7C,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;IACvB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC7C;AAuCD,wBAAsB,iBAAiB,CAAC,GAAG,GAAE,YAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA6BzF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,GAAE,YAAiB,GAAG,IAAI,CASxF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,YAAiB,GAAG,MAAM,IAAI,CAsDpE"}
@@ -0,0 +1,12 @@
1
+ import type { SourceInfo } from './source-detector.js';
2
+ /**
3
+ * Reads source location for a DOM element via React fiber `_debugSource`.
4
+ * Returns null when:
5
+ * - bippy can't find a fiber (not a React app, or React not in dev mode)
6
+ * - no `_debugSource` is set (Babel jsx-source plugin disabled)
7
+ *
8
+ * Designed to be called *before* the DOM-attribute fallback. Either path
9
+ * yields a `SourceInfo` the rest of the runtime already understands.
10
+ */
11
+ export declare function fiberSourceFor(element: Element): Promise<SourceInfo | null>;
12
+ //# sourceMappingURL=fiber-detector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fiber-detector.d.ts","sourceRoot":"","sources":["../../src/detection/fiber-detector.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAkDvD;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAwBjF"}
@@ -0,0 +1,30 @@
1
+ import type { InspectedElement } from '../types.js';
2
+ export interface SourceInfo {
3
+ filePath: string;
4
+ line: number;
5
+ column: number;
6
+ componentName: string;
7
+ rawPath: string;
8
+ }
9
+ export declare function parseSourceAttribute(value: string): SourceInfo | null;
10
+ export declare function findSourceAttribute(element: HTMLElement): string | null;
11
+ export declare function findClosestSource(element: HTMLElement): {
12
+ element: HTMLElement;
13
+ source: SourceInfo;
14
+ } | null;
15
+ export declare function elementToInspected(domElement: HTMLElement, source: SourceInfo, pathMapping?: Record<string, string>, detectionSource?: 'fiber' | 'attribute'): InspectedElement;
16
+ /**
17
+ * Resolves source for a DOM element using the strategy chain:
18
+ * 1. React fiber `_debugSource` (zero-config for React/Preact)
19
+ * 2. `data-insp-path` / `data-inspekt-path` DOM attribute
20
+ * 3. null (no source available)
21
+ *
22
+ * Returns the matching element AND the source info. The element may be
23
+ * an ancestor of the input when only ancestors carry the attribute.
24
+ */
25
+ export declare function resolveElementSource(element: HTMLElement): Promise<{
26
+ element: HTMLElement;
27
+ source: SourceInfo;
28
+ from: 'fiber' | 'attribute';
29
+ } | null>;
30
+ //# sourceMappingURL=source-detector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-detector.d.ts","sourceRoot":"","sources":["../../src/detection/source-detector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAQpD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CA6BrE;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAEvE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG;IAAE,OAAO,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,GAAG,IAAI,CAmB3G;AAED,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,WAAW,EACvB,MAAM,EAAE,UAAU,EAClB,WAAW,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,EACxC,eAAe,GAAE,OAAO,GAAG,WAAyB,GACnD,gBAAgB,CA0BlB;AAED;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC;IAAE,OAAO,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,OAAO,GAAG,WAAW,CAAA;CAAE,GAAG,IAAI,CAAC,CAoB3F"}
@@ -0,0 +1,14 @@
1
+ import type { SourceInfo } from './source-detector.js';
2
+ /**
3
+ * Sync Vue source lookup. Walks up `__vueParentComponent` (Vue 3) or
4
+ * `__vue__` (Vue 2) until it finds a component with a `__file` source
5
+ * attached at compile time. Returns null in production builds and on
6
+ * non-Vue pages.
7
+ *
8
+ * Vue strips line/column from `__file`, so this surfaces `line: 1` —
9
+ * good enough to open the file in the user's editor. The DOM-attribute
10
+ * path (`data-insp-path`) remains the line-accurate option for Vue
11
+ * projects that opt into `@aylith/inspekt-vite`.
12
+ */
13
+ export declare function vueSourceFor(element: Element): SourceInfo | null;
14
+ //# sourceMappingURL=vue-detector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue-detector.d.ts","sourceRoot":"","sources":["../../src/detection/vue-detector.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAuEvD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAGhE"}
@@ -0,0 +1,50 @@
1
+ // src/detection/fiber-detector.ts
2
+ var bippy = null;
3
+ var bippyImportPromise = null;
4
+ async function loadBippy() {
5
+ if (bippy) return bippy;
6
+ if (!bippyImportPromise) {
7
+ bippyImportPromise = import("bippy");
8
+ }
9
+ bippy = await bippyImportPromise;
10
+ return bippy;
11
+ }
12
+ function findFiberWithDebugSource(startFiber, isCompositeFiber) {
13
+ let f = startFiber;
14
+ while (f) {
15
+ const debug = f._debugSource;
16
+ if (debug?.fileName && typeof debug.lineNumber === "number") {
17
+ if (isCompositeFiber(f)) return f;
18
+ let upper = f.return;
19
+ while (upper) {
20
+ const upperDebug = upper._debugSource;
21
+ if (upperDebug?.fileName && isCompositeFiber(upper)) return upper;
22
+ upper = upper.return;
23
+ }
24
+ return f;
25
+ }
26
+ f = f.return;
27
+ }
28
+ return null;
29
+ }
30
+ async function fiberSourceFor(element) {
31
+ const { getFiberFromHostInstance, isCompositeFiber, getDisplayName } = await loadBippy();
32
+ const hostFiber = getFiberFromHostInstance(element);
33
+ if (!hostFiber) return null;
34
+ const fiber = findFiberWithDebugSource(hostFiber, isCompositeFiber);
35
+ if (!fiber) return null;
36
+ const debug = fiber._debugSource;
37
+ if (!debug?.fileName || typeof debug.lineNumber !== "number") return null;
38
+ const componentName = getDisplayName(fiber.type) ?? debug.fileName.split("/").pop()?.replace(/\.\w+$/, "") ?? "Unknown";
39
+ return {
40
+ filePath: debug.fileName,
41
+ line: debug.lineNumber,
42
+ column: debug.columnNumber ?? 1,
43
+ componentName,
44
+ rawPath: `${debug.fileName}:${debug.lineNumber}:${debug.columnNumber ?? 1}:${componentName}`
45
+ };
46
+ }
47
+ export {
48
+ fiberSourceFor
49
+ };
50
+ //# sourceMappingURL=fiber-detector-CFB7M7OY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/detection/fiber-detector.ts"],"sourcesContent":["// Fiber-based source detection for React/Preact apps.\n//\n// React's `@babel/plugin-transform-react-jsx-source` (default in CRA, Vite-React,\n// Next.js dev) attaches `_debugSource` to every JSXOpeningElement at build time.\n// React's reconciler stores it on the resulting fiber. We can read it via bippy's\n// fiber-traversal helpers.\n//\n// This means React projects need *no* build plugin from us — click-to-source\n// works automatically in dev. The DOM-attribute path (Phase 0 transform) covers\n// Vue / Svelte / Solid where there is no equivalent fiber convention.\n\nimport type { Fiber } from 'bippy';\nimport type { SourceInfo } from './source-detector.js';\n\nlet bippy: typeof import('bippy') | null = null;\nlet bippyImportPromise: Promise<typeof import('bippy')> | null = null;\n\nasync function loadBippy(): Promise<typeof import('bippy')> {\n if (bippy) return bippy;\n if (!bippyImportPromise) {\n bippyImportPromise = import('bippy');\n }\n bippy = await bippyImportPromise;\n return bippy;\n}\n\ninterface DebugSource {\n fileName?: string;\n lineNumber?: number;\n columnNumber?: number;\n}\n\n/**\n * Walks up the fiber tree from a host fiber until it finds one with\n * `_debugSource` populated and a non-null component type.\n */\nfunction findFiberWithDebugSource(\n startFiber: Fiber,\n isCompositeFiber: (f: Fiber) => boolean,\n): Fiber | null {\n let f: Fiber | null = startFiber;\n while (f) {\n const debug = (f as Fiber & { _debugSource?: DebugSource })._debugSource;\n if (debug?.fileName && typeof debug.lineNumber === 'number') {\n // Prefer a composite (function/class) fiber over a host (div/span) fiber\n // for componentName purposes. Continue walking only if the current frame\n // is a host fiber and we haven't seen a composite yet.\n if (isCompositeFiber(f)) return f;\n // Walk one more step looking for a composite owner before returning.\n let upper: Fiber | null = f.return;\n while (upper) {\n const upperDebug = (upper as Fiber & { _debugSource?: DebugSource })._debugSource;\n if (upperDebug?.fileName && isCompositeFiber(upper)) return upper;\n upper = upper.return;\n }\n return f; // host fiber with debugSource — better than nothing\n }\n f = f.return;\n }\n return null;\n}\n\n/**\n * Reads source location for a DOM element via React fiber `_debugSource`.\n * Returns null when:\n * - bippy can't find a fiber (not a React app, or React not in dev mode)\n * - no `_debugSource` is set (Babel jsx-source plugin disabled)\n *\n * Designed to be called *before* the DOM-attribute fallback. Either path\n * yields a `SourceInfo` the rest of the runtime already understands.\n */\nexport async function fiberSourceFor(element: Element): Promise<SourceInfo | null> {\n const { getFiberFromHostInstance, isCompositeFiber, getDisplayName } = await loadBippy();\n\n const hostFiber = getFiberFromHostInstance(element);\n if (!hostFiber) return null;\n\n const fiber = findFiberWithDebugSource(hostFiber, isCompositeFiber);\n if (!fiber) return null;\n\n const debug = (fiber as Fiber & { _debugSource?: DebugSource })._debugSource;\n if (!debug?.fileName || typeof debug.lineNumber !== 'number') return null;\n\n const componentName =\n getDisplayName(fiber.type) ??\n debug.fileName.split('/').pop()?.replace(/\\.\\w+$/, '') ??\n 'Unknown';\n\n return {\n filePath: debug.fileName,\n line: debug.lineNumber,\n column: debug.columnNumber ?? 1,\n componentName,\n rawPath: `${debug.fileName}:${debug.lineNumber}:${debug.columnNumber ?? 1}:${componentName}`,\n };\n}\n"],"mappings":";AAcA,IAAI,QAAuC;AAC3C,IAAI,qBAA6D;AAEjE,eAAe,YAA6C;AAC1D,MAAI,MAAO,QAAO;AAClB,MAAI,CAAC,oBAAoB;AACvB,yBAAqB,OAAO,OAAO;AAAA,EACrC;AACA,UAAQ,MAAM;AACd,SAAO;AACT;AAYA,SAAS,yBACP,YACA,kBACc;AACd,MAAI,IAAkB;AACtB,SAAO,GAAG;AACR,UAAM,QAAS,EAA6C;AAC5D,QAAI,OAAO,YAAY,OAAO,MAAM,eAAe,UAAU;AAI3D,UAAI,iBAAiB,CAAC,EAAG,QAAO;AAEhC,UAAI,QAAsB,EAAE;AAC5B,aAAO,OAAO;AACZ,cAAM,aAAc,MAAiD;AACrE,YAAI,YAAY,YAAY,iBAAiB,KAAK,EAAG,QAAO;AAC5D,gBAAQ,MAAM;AAAA,MAChB;AACA,aAAO;AAAA,IACT;AACA,QAAI,EAAE;AAAA,EACR;AACA,SAAO;AACT;AAWA,eAAsB,eAAe,SAA8C;AACjF,QAAM,EAAE,0BAA0B,kBAAkB,eAAe,IAAI,MAAM,UAAU;AAEvF,QAAM,YAAY,yBAAyB,OAAO;AAClD,MAAI,CAAC,UAAW,QAAO;AAEvB,QAAM,QAAQ,yBAAyB,WAAW,gBAAgB;AAClE,MAAI,CAAC,MAAO,QAAO;AAEnB,QAAM,QAAS,MAAiD;AAChE,MAAI,CAAC,OAAO,YAAY,OAAO,MAAM,eAAe,SAAU,QAAO;AAErE,QAAM,gBACJ,eAAe,MAAM,IAAI,KACzB,MAAM,SAAS,MAAM,GAAG,EAAE,IAAI,GAAG,QAAQ,UAAU,EAAE,KACrD;AAEF,SAAO;AAAA,IACL,UAAU,MAAM;AAAA,IAChB,MAAM,MAAM;AAAA,IACZ,QAAQ,MAAM,gBAAgB;AAAA,IAC9B;AAAA,IACA,SAAS,GAAG,MAAM,QAAQ,IAAI,MAAM,UAAU,IAAI,MAAM,gBAAgB,CAAC,IAAI,aAAa;AAAA,EAC5F;AACF;","names":[]}
@@ -0,0 +1,20 @@
1
+ export declare class BoundingBoxOverlay {
2
+ private shadowRoot;
3
+ private container;
4
+ private boxes;
5
+ private mounted;
6
+ private rafHandle;
7
+ private resizeObserver;
8
+ private mutationObserver;
9
+ constructor(shadowRoot: ShadowRoot);
10
+ enable(): void;
11
+ disable(): void;
12
+ destroy(): void;
13
+ private clear;
14
+ private scan;
15
+ private makeBox;
16
+ private scheduleRepaint;
17
+ private scheduleRescan;
18
+ private repaint;
19
+ }
20
+ //# sourceMappingURL=bounding-boxes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bounding-boxes.d.ts","sourceRoot":"","sources":["../../src/highlight/bounding-boxes.ts"],"names":[],"mappings":"AAgBA,qBAAa,kBAAkB;IAQjB,OAAO,CAAC,UAAU;IAP9B,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,KAAK,CAAoB;IACjC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,cAAc,CAA+B;IACrD,OAAO,CAAC,gBAAgB,CAAiC;IAEzD,YAAoB,UAAU,EAAE,UAAU,EAIzC;IAED,MAAM,IAAI,IAAI,CAkBb;IAED,OAAO,IAAI,IAAI,CAYd;IAED,OAAO,IAAI,IAAI,CAGd;IAED,OAAO,CAAC,KAAK;IAKb,OAAO,CAAC,IAAI;IAaZ,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,eAAe,CAMrB;IAEF,OAAO,CAAC,cAAc,CAUpB;IAEF,OAAO,CAAC,OAAO;CAahB"}
@@ -0,0 +1,11 @@
1
+ import type { HighlightConfig } from '../types.js';
2
+ export declare class Highlighter {
3
+ private highlights;
4
+ private config;
5
+ constructor(config: HighlightConfig);
6
+ highlight(element: HTMLElement, type?: 'selected' | 'hovered' | 'border'): void;
7
+ unhighlight(element: HTMLElement): void;
8
+ unhighlightAll(): void;
9
+ updateConfig(config: HighlightConfig): void;
10
+ }
11
+ //# sourceMappingURL=highlighter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"highlighter.d.ts","sourceRoot":"","sources":["../../src/highlight/highlighter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAYnD,qBAAa,WAAW;IACtB,OAAO,CAAC,UAAU,CAA0C;IAC5D,OAAO,CAAC,MAAM,CAAkB;IAEhC,YAAY,MAAM,EAAE,eAAe,EAElC;IAED,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,GAAE,UAAU,GAAG,SAAS,GAAG,QAAqB,GAAG,IAAI,CAiC1F;IAED,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAUtC;IAED,cAAc,IAAI,IAAI,CAIrB;IAED,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAE1C;CACF"}
@@ -0,0 +1,23 @@
1
+ import 'prismjs/components/prism-markup.js';
2
+ import 'prismjs/components/prism-clike.js';
3
+ import 'prismjs/components/prism-javascript.js';
4
+ import 'prismjs/components/prism-jsx.js';
5
+ import 'prismjs/components/prism-typescript.js';
6
+ import 'prismjs/components/prism-tsx.js';
7
+ import 'prismjs/components/prism-css.js';
8
+ import 'prismjs/components/prism-json.js';
9
+ export interface CodeToken {
10
+ text: string;
11
+ /** Prism token type, e.g. "keyword", "string", "comment". Empty for plain text. */
12
+ type: string;
13
+ }
14
+ export interface CodeLine {
15
+ tokens: CodeToken[];
16
+ }
17
+ /**
18
+ * Tokenize source code and split into per-line token arrays. Newlines are
19
+ * consumed by the splitter (not emitted as tokens), so the caller can join
20
+ * the resulting lines with its own `\n` if rendering to a single `<pre>`.
21
+ */
22
+ export declare function tokenizeToLines(code: string, lang?: string): CodeLine[];
23
+ //# sourceMappingURL=prism.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prism.d.ts","sourceRoot":"","sources":["../../src/highlight/prism.ts"],"names":[],"mappings":"AAcA,OAAO,oCAAoC,CAAC;AAC5C,OAAO,mCAAmC,CAAC;AAC3C,OAAO,wCAAwC,CAAC;AAChD,OAAO,iCAAiC,CAAC;AACzC,OAAO,wCAAwC,CAAC;AAChD,OAAO,iCAAiC,CAAC;AACzC,OAAO,iCAAiC,CAAC;AACzC,OAAO,kCAAkC,CAAC;AAE1C,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,SAAS,EAAE,CAAC;CACrB;AAkCD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,EAAE,CASvE"}