@oddsquad/vite-plugin-lit 0.0.3 → 0.0.5
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/index.d.ts +3 -2
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/lib/color-scheme.d.ts +30 -0
- package/lib/color-scheme.d.ts.map +1 -0
- package/lib/color-scheme.js +41 -0
- package/lib/color-scheme.js.map +1 -0
- package/lib/icons.d.ts +18 -0
- package/lib/icons.d.ts.map +1 -0
- package/lib/icons.js +23 -0
- package/lib/icons.js.map +1 -0
- package/lib/plugin.d.ts +71 -6
- package/lib/plugin.d.ts.map +1 -1
- package/lib/plugin.js +522 -21
- package/lib/plugin.js.map +1 -1
- package/lib/runtime/css.d.ts +94 -0
- package/lib/runtime/css.d.ts.map +1 -0
- package/lib/runtime/css.js +112 -0
- package/lib/runtime/css.js.map +1 -0
- package/lib/runtime/edge-panel.d.ts +18 -0
- package/lib/runtime/edge-panel.d.ts.map +1 -0
- package/lib/runtime/edge-panel.js +130 -0
- package/lib/runtime/edge-panel.js.map +1 -0
- package/lib/runtime/fonts.d.ts +18 -0
- package/lib/runtime/fonts.d.ts.map +1 -0
- package/lib/runtime/fonts.js +18 -0
- package/lib/runtime/fonts.js.map +1 -0
- package/lib/runtime/indicator.d.ts +7 -0
- package/lib/runtime/indicator.d.ts.map +1 -0
- package/lib/runtime/indicator.js +141 -0
- package/lib/runtime/indicator.js.map +1 -0
- package/lib/runtime/inspector/collect.d.ts +17 -0
- package/lib/runtime/inspector/collect.d.ts.map +1 -0
- package/lib/runtime/inspector/collect.js +132 -0
- package/lib/runtime/inspector/collect.js.map +1 -0
- package/lib/runtime/inspector/install.d.ts +7 -0
- package/lib/runtime/inspector/install.d.ts.map +1 -0
- package/lib/runtime/inspector/install.js +204 -0
- package/lib/runtime/inspector/install.js.map +1 -0
- package/lib/runtime/inspector/serialize.d.ts +10 -0
- package/lib/runtime/inspector/serialize.d.ts.map +1 -0
- package/lib/runtime/inspector/serialize.js +133 -0
- package/lib/runtime/inspector/serialize.js.map +1 -0
- package/lib/runtime/intern.d.ts.map +1 -1
- package/lib/runtime/intern.js +1 -1
- package/lib/runtime/intern.js.map +1 -1
- package/lib/runtime/overrides.d.ts +25 -0
- package/lib/runtime/overrides.d.ts.map +1 -0
- package/lib/runtime/overrides.js +33 -0
- package/lib/runtime/overrides.js.map +1 -0
- package/lib/runtime/patch.d.ts +6 -15
- package/lib/runtime/patch.d.ts.map +1 -1
- package/lib/runtime/patch.js +81 -28
- package/lib/runtime/patch.js.map +1 -1
- package/lib/runtime/source-meta.d.ts +16 -0
- package/lib/runtime/source-meta.d.ts.map +1 -0
- package/lib/runtime/source-meta.js +8 -0
- package/lib/runtime/source-meta.js.map +1 -0
- package/lib/runtime/source-overlay/editors.d.ts +9 -0
- package/lib/runtime/source-overlay/editors.d.ts.map +1 -0
- package/lib/runtime/source-overlay/editors.js +40 -0
- package/lib/runtime/source-overlay/editors.js.map +1 -0
- package/lib/runtime/source-overlay/mask-path.d.ts +7 -0
- package/lib/runtime/source-overlay/mask-path.d.ts.map +1 -0
- package/lib/runtime/source-overlay/mask-path.js +26 -0
- package/lib/runtime/source-overlay/mask-path.js.map +1 -0
- package/lib/runtime/source-overlay/overlay-element.d.ts +18 -0
- package/lib/runtime/source-overlay/overlay-element.d.ts.map +1 -0
- package/lib/runtime/source-overlay/overlay-element.js +381 -0
- package/lib/runtime/source-overlay/overlay-element.js.map +1 -0
- package/lib/runtime/source-overlay/source-host.d.ts +14 -0
- package/lib/runtime/source-overlay/source-host.d.ts.map +1 -0
- package/lib/runtime/source-overlay/source-host.js +94 -0
- package/lib/runtime/source-overlay/source-host.js.map +1 -0
- package/lib/runtime/source-overlay/template.d.ts +7 -0
- package/lib/runtime/source-overlay/template.d.ts.map +1 -0
- package/lib/runtime/source-overlay/template.js +125 -0
- package/lib/runtime/source-overlay/template.js.map +1 -0
- package/lib/runtime/source-overlay.d.ts +7 -0
- package/lib/runtime/source-overlay.d.ts.map +1 -0
- package/lib/runtime/source-overlay.js +11 -0
- package/lib/runtime/source-overlay.js.map +1 -0
- package/lib/runtime/timeline/clock.d.ts +10 -0
- package/lib/runtime/timeline/clock.d.ts.map +1 -0
- package/lib/runtime/timeline/clock.js +22 -0
- package/lib/runtime/timeline/clock.js.map +1 -0
- package/lib/runtime/timeline/identity.d.ts +37 -0
- package/lib/runtime/timeline/identity.d.ts.map +1 -0
- package/lib/runtime/timeline/identity.js +73 -0
- package/lib/runtime/timeline/identity.js.map +1 -0
- package/lib/runtime/timeline/input.d.ts +16 -0
- package/lib/runtime/timeline/input.d.ts.map +1 -0
- package/lib/runtime/timeline/input.js +87 -0
- package/lib/runtime/timeline/input.js.map +1 -0
- package/lib/runtime/timeline/install.d.ts +7 -0
- package/lib/runtime/timeline/install.d.ts.map +1 -0
- package/lib/runtime/timeline/install.js +69 -0
- package/lib/runtime/timeline/install.js.map +1 -0
- package/lib/runtime/timeline/lifecycle.d.ts +27 -0
- package/lib/runtime/timeline/lifecycle.d.ts.map +1 -0
- package/lib/runtime/timeline/lifecycle.js +225 -0
- package/lib/runtime/timeline/lifecycle.js.map +1 -0
- package/lib/runtime/timeline/public-api.d.ts +28 -0
- package/lib/runtime/timeline/public-api.d.ts.map +1 -0
- package/lib/runtime/timeline/public-api.js +44 -0
- package/lib/runtime/timeline/public-api.js.map +1 -0
- package/lib/runtime/timeline/render.d.ts +39 -0
- package/lib/runtime/timeline/render.d.ts.map +1 -0
- package/lib/runtime/timeline/render.js +109 -0
- package/lib/runtime/timeline/render.js.map +1 -0
- package/lib/runtime/timeline/transport.d.ts +42 -0
- package/lib/runtime/timeline/transport.d.ts.map +1 -0
- package/lib/runtime/timeline/transport.js +86 -0
- package/lib/runtime/timeline/transport.js.map +1 -0
- package/lib/segmented-tabs.d.ts +33 -0
- package/lib/segmented-tabs.d.ts.map +1 -0
- package/lib/segmented-tabs.js +129 -0
- package/lib/segmented-tabs.js.map +1 -0
- package/lib/source-meta.d.ts +26 -0
- package/lib/source-meta.d.ts.map +1 -0
- package/lib/source-meta.js +129 -0
- package/lib/source-meta.js.map +1 -0
- package/lib/timeline-plugin.d.ts +72 -0
- package/lib/timeline-plugin.d.ts.map +1 -0
- package/lib/timeline-plugin.js +376 -0
- package/lib/timeline-plugin.js.map +1 -0
- package/lib/tokens.d.ts +38 -0
- package/lib/tokens.d.ts.map +1 -0
- package/lib/tokens.js +263 -0
- package/lib/tokens.js.map +1 -0
- package/lib/transform.d.ts +5 -5
- package/lib/transform.d.ts.map +1 -1
- package/lib/transform.js +3 -3
- package/lib/transform.js.map +1 -1
- package/lib/types.d.ts +34 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +7 -0
- package/lib/types.js.map +1 -0
- package/lib/wrap-table.d.ts.map +1 -1
- package/lib/wrap-table.js.map +1 -1
- package/package.json +18 -4
- package/panel/components-view.d.ts +60 -0
- package/panel/components-view.d.ts.map +1 -0
- package/panel/components-view.js +581 -0
- package/panel/components-view.js.map +1 -0
- package/panel/devtools-settings.d.ts +41 -0
- package/panel/devtools-settings.d.ts.map +1 -0
- package/panel/devtools-settings.js +463 -0
- package/panel/devtools-settings.js.map +1 -0
- package/panel/index.html +29 -0
- package/panel/lit-devtools-panel.d.ts +37 -0
- package/panel/lit-devtools-panel.d.ts.map +1 -0
- package/panel/lit-devtools-panel.js +183 -0
- package/panel/lit-devtools-panel.js.map +1 -0
- package/panel/timeline-event-list.d.ts +43 -0
- package/panel/timeline-event-list.d.ts.map +1 -0
- package/panel/timeline-event-list.js +416 -0
- package/panel/timeline-event-list.js.map +1 -0
- package/panel/timeline-layers.d.ts +25 -0
- package/panel/timeline-layers.d.ts.map +1 -0
- package/panel/timeline-layers.js +96 -0
- package/panel/timeline-layers.js.map +1 -0
- package/panel/timeline-view.d.ts +38 -0
- package/panel/timeline-view.d.ts.map +1 -0
- package/panel/timeline-view.js +234 -0
- package/panel/timeline-view.js.map +1 -0
- package/types/inspector.d.ts +130 -0
- package/types/inspector.d.ts.map +1 -0
- package/types/inspector.js +16 -0
- package/types/inspector.js.map +1 -0
- package/types/timeline.d.ts +98 -0
- package/types/timeline.d.ts.map +1 -0
- package/types/timeline.js +39 -0
- package/types/timeline.js.map +1 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
import { SOURCE_META_KEY } from '../source-meta.js';
|
|
7
|
+
// Walk up from an element (crossing shadow boundaries) to the nearest host that
|
|
8
|
+
// carries Lit source metadata, i.e. the component that rendered it.
|
|
9
|
+
export const findSourceHost = (el) => {
|
|
10
|
+
let current = el;
|
|
11
|
+
while (current !== null) {
|
|
12
|
+
const ctor = current.constructor;
|
|
13
|
+
if (ctor[SOURCE_META_KEY] !== undefined) {
|
|
14
|
+
return current;
|
|
15
|
+
}
|
|
16
|
+
const root = current.getRootNode();
|
|
17
|
+
if (root instanceof ShadowRoot) {
|
|
18
|
+
current = root.host;
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
current = current.parentElement;
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
};
|
|
25
|
+
// Pierce nested shadow roots to find the deepest element under the cursor.
|
|
26
|
+
// document.elementFromPoint retargets shadow content to the top-level host, so
|
|
27
|
+
// we descend through each shadowRoot to reach the innermost element.
|
|
28
|
+
export const deepElementFromPoint = (x, y) => {
|
|
29
|
+
let el = document.elementFromPoint(x, y);
|
|
30
|
+
let deepest = el;
|
|
31
|
+
while (el?.shadowRoot) {
|
|
32
|
+
const inner = el.shadowRoot.elementFromPoint(x, y);
|
|
33
|
+
if (inner === null || inner === el)
|
|
34
|
+
break;
|
|
35
|
+
deepest = inner;
|
|
36
|
+
el = inner;
|
|
37
|
+
}
|
|
38
|
+
return deepest;
|
|
39
|
+
};
|
|
40
|
+
// Resolve the source host under a viewport point. The optional dialog is the
|
|
41
|
+
// overlay's own modal, temporarily closed so it doesn't shadow the hit-test.
|
|
42
|
+
export const findSourceAtPoint = (x, y, dialog = null) => {
|
|
43
|
+
if (dialog !== null)
|
|
44
|
+
dialog.close();
|
|
45
|
+
try {
|
|
46
|
+
const deepest = deepElementFromPoint(x, y);
|
|
47
|
+
if (deepest !== null) {
|
|
48
|
+
const host = findSourceHost(deepest);
|
|
49
|
+
if (host !== null)
|
|
50
|
+
return host;
|
|
51
|
+
}
|
|
52
|
+
// Bounding-rect fallback for elements elementFromPoint misses — prefer the
|
|
53
|
+
// deepest matching host so nested components still beat their ancestors.
|
|
54
|
+
let best = null;
|
|
55
|
+
for (const el of document.querySelectorAll('*')) {
|
|
56
|
+
const ctor = el.constructor;
|
|
57
|
+
if (ctor[SOURCE_META_KEY] === undefined)
|
|
58
|
+
continue;
|
|
59
|
+
const rect = el.getBoundingClientRect();
|
|
60
|
+
if (x >= rect.left &&
|
|
61
|
+
x <= rect.right &&
|
|
62
|
+
y >= rect.top &&
|
|
63
|
+
y <= rect.bottom) {
|
|
64
|
+
if (best === null || best.contains(el))
|
|
65
|
+
best = el;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return best;
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
if (dialog !== null && !dialog.open)
|
|
72
|
+
dialog.showModal();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
export const defaultResolver = {
|
|
76
|
+
async resolveElementInfo(el) {
|
|
77
|
+
const host = findSourceHost(el);
|
|
78
|
+
if (host === null)
|
|
79
|
+
return null;
|
|
80
|
+
const ctor = host.constructor;
|
|
81
|
+
const meta = ctor[SOURCE_META_KEY];
|
|
82
|
+
if (meta === undefined)
|
|
83
|
+
return null;
|
|
84
|
+
return {
|
|
85
|
+
tagName: host.tagName.toLowerCase(),
|
|
86
|
+
componentName: meta.componentName,
|
|
87
|
+
source: {
|
|
88
|
+
filePath: meta.filePath,
|
|
89
|
+
lineNumber: meta.lineNumber,
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=source-host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-host.js","sourceRoot":"","sources":["../../../../../packages/labs/vite-plugin-lit/src/lib/runtime/source-overlay/source-host.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,eAAe,EAAqB,MAAM,mBAAmB,CAAC;AAOtE,gFAAgF;AAChF,oEAAoE;AACpE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAW,EAAkB,EAAE;IAC5D,IAAI,OAAO,GAAmB,EAAE,CAAC;IACjC,OAAO,OAAO,KAAK,IAAI,EAAE,CAAC;QACxB,MAAM,IAAI,GAAG,OAAO,CAAC,WAEpB,CAAC;QACF,IAAI,IAAI,CAAC,eAAe,CAAC,KAAK,SAAS,EAAE,CAAC;YACxC,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;QACnC,IAAI,IAAI,YAAY,UAAU,EAAE,CAAC;YAC/B,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC;YACpB,SAAS;QACX,CAAC;QACD,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;IAClC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,2EAA2E;AAC3E,+EAA+E;AAC/E,qEAAqE;AACrE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAS,EAAE,CAAS,EAAkB,EAAE;IAC3E,IAAI,EAAE,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACzC,IAAI,OAAO,GAAmB,EAAE,CAAC;IACjC,OAAO,EAAE,EAAE,UAAU,EAAE,CAAC;QACtB,MAAM,KAAK,GAAG,EAAE,CAAC,UAAU,CAAC,gBAA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CAAC;YACpD,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;YAAS,CAAC;QACT,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI;YAAE,MAAM,CAAC,SAAS,EAAE,CAAC;IAC1D,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAoB;IAC9C,KAAK,CAAC,kBAAkB,CAAC,EAAE;QACzB,MAAM,IAAI,GAAG,cAAc,CAAC,EAAE,CAAC,CAAC;QAChC,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,WAEjB,CAAC;QACF,MAAM,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC,CAAC;QACnC,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC;QACpC,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;YACnC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,MAAM,EAAE;gBACN,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,UAAU,EAAE,IAAI,CAAC,UAAU;aAC5B;SACF,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {SOURCE_META_KEY, type LitSourceMeta} from '../source-meta.js';\nimport type {ElementInfo} from '../../types.js';\n\nexport interface ElementResolver {\n resolveElementInfo(el: Element): Promise<ElementInfo | null>;\n}\n\n// Walk up from an element (crossing shadow boundaries) to the nearest host that\n// carries Lit source metadata, i.e. the component that rendered it.\nexport const findSourceHost = (el: Element): Element | null => {\n let current: Element | null = el;\n while (current !== null) {\n const ctor = current.constructor as CustomElementConstructor & {\n [SOURCE_META_KEY]?: LitSourceMeta;\n };\n if (ctor[SOURCE_META_KEY] !== undefined) {\n return current;\n }\n const root = current.getRootNode();\n if (root instanceof ShadowRoot) {\n current = root.host;\n continue;\n }\n current = current.parentElement;\n }\n return null;\n};\n\n// Pierce nested shadow roots to find the deepest element under the cursor.\n// document.elementFromPoint retargets shadow content to the top-level host, so\n// we descend through each shadowRoot to reach the innermost element.\nexport const deepElementFromPoint = (x: number, y: number): Element | null => {\n let el = document.elementFromPoint(x, y);\n let deepest: Element | null = el;\n while (el?.shadowRoot) {\n const inner = el.shadowRoot.elementFromPoint(x, y);\n if (inner === null || inner === el) break;\n deepest = inner;\n el = inner;\n }\n return deepest;\n};\n\n// Resolve the source host under a viewport point. The optional dialog is the\n// overlay's own modal, temporarily closed so it doesn't shadow the hit-test.\nexport const findSourceAtPoint = (\n x: number,\n y: number,\n dialog: HTMLDialogElement | null = null\n): Element | null => {\n if (dialog !== null) dialog.close();\n try {\n const deepest = deepElementFromPoint(x, y);\n if (deepest !== null) {\n const host = findSourceHost(deepest);\n if (host !== null) return host;\n }\n\n // Bounding-rect fallback for elements elementFromPoint misses — prefer the\n // deepest matching host so nested components still beat their ancestors.\n let best: Element | null = null;\n for (const el of document.querySelectorAll('*')) {\n const ctor = el.constructor as CustomElementConstructor & {\n [SOURCE_META_KEY]?: LitSourceMeta;\n };\n if (ctor[SOURCE_META_KEY] === undefined) continue;\n const rect = el.getBoundingClientRect();\n if (\n x >= rect.left &&\n x <= rect.right &&\n y >= rect.top &&\n y <= rect.bottom\n ) {\n if (best === null || best.contains(el)) best = el;\n }\n }\n return best;\n } finally {\n if (dialog !== null && !dialog.open) dialog.showModal();\n }\n};\n\nexport const defaultResolver: ElementResolver = {\n async resolveElementInfo(el) {\n const host = findSourceHost(el);\n if (host === null) return null;\n const ctor = host.constructor as CustomElementConstructor & {\n [SOURCE_META_KEY]?: LitSourceMeta;\n };\n const meta = ctor[SOURCE_META_KEY];\n if (meta === undefined) return null;\n return {\n tagName: host.tagName.toLowerCase(),\n componentName: meta.componentName,\n source: {\n filePath: meta.filePath,\n lineNumber: meta.lineNumber,\n },\n };\n },\n};\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
export declare const OVERLAY_HTML = "\n <style>\n dialog {\n background: transparent;\n border: none;\n padding: 0;\n margin: 0;\n max-width: none;\n max-height: none;\n pointer-events: none;\n }\n #mask {\n position: fixed;\n inset: 0;\n pointer-events: none;\n background: rgba(0,0,0,0);\n transition: background-color 0.3s cubic-bezier(0.9, 0, 0.1, 1);\n }\n #highlight {\n position: fixed;\n top: 0;\n left: 0;\n pointer-events: none;\n box-sizing: border-box;\n border-radius: var(--lit-devtools-radius-md);\n }\n #tooltip {\n position: fixed;\n /* Lift above the Vite DevTools edge panel when it's docked to the bottom\n (--edge-bottom is set from JS; 0 otherwise). */\n bottom: calc(16px + var(--edge-bottom, 0px));\n left: 50%;\n translate: -50%;\n display: none;\n align-items: stretch;\n pointer-events: auto;\n max-width: min(90vw, 480px);\n border-radius: var(--lit-devtools-radius-md);\n background: var(--lit-devtools-surface-elevated);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n color: var(--lit-devtools-text-strong);\n font: 12px/1.4 var(--lit-devtools-font-mono, ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace);\n box-shadow: var(--lit-devtools-shadow-md);\n overflow: hidden;\n }\n .icon-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n flex: 0 0 auto;\n padding: 0 12px;\n border: none;\n background: transparent;\n color: inherit;\n cursor: pointer;\n }\n .icon-btn:hover { background: var(--lit-devtools-surface-hover); }\n /* No outline ring; keyboard focus reuses the subtle hover tint. */\n .icon-btn:focus { outline: none; }\n .icon-btn:focus-visible { background: var(--lit-devtools-surface-hover); }\n .icon-btn svg {\n width: 16px;\n height: 16px;\n display: block;\n fill: currentColor;\n }\n #meta {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 1px;\n min-width: 0;\n padding: 6px 10px;\n border-left: 1px solid var(--lit-devtools-border-subtle);\n border-right: 1px solid var(--lit-devtools-border-subtle);\n }\n #tag {\n font-weight: 600;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n color: var(--lit-devtools-text-strong);\n }\n #path {\n color: var(--lit-devtools-text-secondary);\n font-size: 11px;\n word-break: break-all;\n }\n </style>\n <dialog id=\"overlay\">\n <div id=\"mask\"></div>\n <div id=\"highlight\"></div>\n <div id=\"tooltip\">\n <span\n id=\"open\"\n class=\"icon-btn\"\n title=\"Open in editor\"\n aria-label=\"Open in editor\"\n ><svg viewBox=\"0 0 256 256\" aria-hidden=\"true\"><path d=\"M69.12,94.15,28.5,128l40.62,33.85a8,8,0,1,1-10.24,12.29l-48-40a8,8,0,0,1,0-12.29l48-40a8,8,0,0,1,10.24,12.3Zm176,27.7-48-40a8,8,0,1,0-10.24,12.3L227.5,128l-40.62,33.85a8,8,0,1,0,10.24,12.29l48-40a8,8,0,0,0,0-12.29ZM162.73,32.48a8,8,0,0,0-10.25,4.79l-64,176a8,8,0,0,0,4.79,10.26A8.14,8.14,0,0,0,96,224a8,8,0,0,0,7.52-5.27l64-176A8,8,0,0,0,162.73,32.48Z\"></path></svg></span>\n <div id=\"meta\">\n <span id=\"tag\"></span>\n <span id=\"path\"></span>\n </div>\n <button\n id=\"copy\"\n class=\"icon-btn\"\n type=\"button\"\n title=\"Copy path\"\n aria-label=\"Copy path\"\n ><svg viewBox=\"0 0 256 256\" aria-hidden=\"true\"><path d=\"M184,64H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H184a8,8,0,0,0,8-8V72A8,8,0,0,0,184,64Zm-8,144H48V80H176ZM224,40V184a8,8,0,0,1-16,0V48H72a8,8,0,0,1,0-16H216A8,8,0,0,1,224,40Z\"></path></svg></button>\n </div>\n </dialog>\n";
|
|
7
|
+
//# sourceMappingURL=template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../../packages/labs/vite-plugin-lit/src/lib/runtime/source-overlay/template.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,eAAO,MAAM,YAAY,u2HAiHxB,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
import { FONT_MONO_VAR } from '../fonts.js';
|
|
7
|
+
import { CODE_ICON, COPY_ICON } from '../../icons.js';
|
|
8
|
+
// Shadow DOM markup for the overlay: a transparent modal <dialog> hosting the
|
|
9
|
+
// dimming mask, the highlight ring, and the bottom-fixed tooltip panel. The
|
|
10
|
+
// panel is a three-section split: open-in-editor icon | tag + path | copy icon.
|
|
11
|
+
export const OVERLAY_HTML = `
|
|
12
|
+
<style>
|
|
13
|
+
dialog {
|
|
14
|
+
background: transparent;
|
|
15
|
+
border: none;
|
|
16
|
+
padding: 0;
|
|
17
|
+
margin: 0;
|
|
18
|
+
max-width: none;
|
|
19
|
+
max-height: none;
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
}
|
|
22
|
+
#mask {
|
|
23
|
+
position: fixed;
|
|
24
|
+
inset: 0;
|
|
25
|
+
pointer-events: none;
|
|
26
|
+
background: rgba(0,0,0,0);
|
|
27
|
+
transition: background-color 0.3s cubic-bezier(0.9, 0, 0.1, 1);
|
|
28
|
+
}
|
|
29
|
+
#highlight {
|
|
30
|
+
position: fixed;
|
|
31
|
+
top: 0;
|
|
32
|
+
left: 0;
|
|
33
|
+
pointer-events: none;
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
border-radius: var(--lit-devtools-radius-md);
|
|
36
|
+
}
|
|
37
|
+
#tooltip {
|
|
38
|
+
position: fixed;
|
|
39
|
+
/* Lift above the Vite DevTools edge panel when it's docked to the bottom
|
|
40
|
+
(--edge-bottom is set from JS; 0 otherwise). */
|
|
41
|
+
bottom: calc(16px + var(--edge-bottom, 0px));
|
|
42
|
+
left: 50%;
|
|
43
|
+
translate: -50%;
|
|
44
|
+
display: none;
|
|
45
|
+
align-items: stretch;
|
|
46
|
+
pointer-events: auto;
|
|
47
|
+
max-width: min(90vw, 480px);
|
|
48
|
+
border-radius: var(--lit-devtools-radius-md);
|
|
49
|
+
background: var(--lit-devtools-surface-elevated);
|
|
50
|
+
backdrop-filter: blur(8px);
|
|
51
|
+
-webkit-backdrop-filter: blur(8px);
|
|
52
|
+
color: var(--lit-devtools-text-strong);
|
|
53
|
+
font: 12px/1.4 ${FONT_MONO_VAR};
|
|
54
|
+
box-shadow: var(--lit-devtools-shadow-md);
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
}
|
|
57
|
+
.icon-btn {
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
justify-content: center;
|
|
61
|
+
flex: 0 0 auto;
|
|
62
|
+
padding: 0 12px;
|
|
63
|
+
border: none;
|
|
64
|
+
background: transparent;
|
|
65
|
+
color: inherit;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
}
|
|
68
|
+
.icon-btn:hover { background: var(--lit-devtools-surface-hover); }
|
|
69
|
+
/* No outline ring; keyboard focus reuses the subtle hover tint. */
|
|
70
|
+
.icon-btn:focus { outline: none; }
|
|
71
|
+
.icon-btn:focus-visible { background: var(--lit-devtools-surface-hover); }
|
|
72
|
+
.icon-btn svg {
|
|
73
|
+
width: 16px;
|
|
74
|
+
height: 16px;
|
|
75
|
+
display: block;
|
|
76
|
+
fill: currentColor;
|
|
77
|
+
}
|
|
78
|
+
#meta {
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
gap: 1px;
|
|
83
|
+
min-width: 0;
|
|
84
|
+
padding: 6px 10px;
|
|
85
|
+
border-left: 1px solid var(--lit-devtools-border-subtle);
|
|
86
|
+
border-right: 1px solid var(--lit-devtools-border-subtle);
|
|
87
|
+
}
|
|
88
|
+
#tag {
|
|
89
|
+
font-weight: 600;
|
|
90
|
+
white-space: nowrap;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
text-overflow: ellipsis;
|
|
93
|
+
color: var(--lit-devtools-text-strong);
|
|
94
|
+
}
|
|
95
|
+
#path {
|
|
96
|
+
color: var(--lit-devtools-text-secondary);
|
|
97
|
+
font-size: 11px;
|
|
98
|
+
word-break: break-all;
|
|
99
|
+
}
|
|
100
|
+
</style>
|
|
101
|
+
<dialog id="overlay">
|
|
102
|
+
<div id="mask"></div>
|
|
103
|
+
<div id="highlight"></div>
|
|
104
|
+
<div id="tooltip">
|
|
105
|
+
<span
|
|
106
|
+
id="open"
|
|
107
|
+
class="icon-btn"
|
|
108
|
+
title="Open in editor"
|
|
109
|
+
aria-label="Open in editor"
|
|
110
|
+
>${CODE_ICON}</span>
|
|
111
|
+
<div id="meta">
|
|
112
|
+
<span id="tag"></span>
|
|
113
|
+
<span id="path"></span>
|
|
114
|
+
</div>
|
|
115
|
+
<button
|
|
116
|
+
id="copy"
|
|
117
|
+
class="icon-btn"
|
|
118
|
+
type="button"
|
|
119
|
+
title="Copy path"
|
|
120
|
+
aria-label="Copy path"
|
|
121
|
+
>${COPY_ICON}</button>
|
|
122
|
+
</div>
|
|
123
|
+
</dialog>
|
|
124
|
+
`;
|
|
125
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../packages/labs/vite-plugin-lit/src/lib/runtime/source-overlay/template.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEpD,8EAA8E;AAC9E,4EAA4E;AAC5E,gFAAgF;AAChF,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA0CL,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAyD3B,SAAS;;;;;;;;;;;SAWT,SAAS;;;CAGjB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {FONT_MONO_VAR} from '../fonts.js';\nimport {CODE_ICON, COPY_ICON} from '../../icons.js';\n\n// Shadow DOM markup for the overlay: a transparent modal <dialog> hosting the\n// dimming mask, the highlight ring, and the bottom-fixed tooltip panel. The\n// panel is a three-section split: open-in-editor icon | tag + path | copy icon.\nexport const OVERLAY_HTML = `\n <style>\n dialog {\n background: transparent;\n border: none;\n padding: 0;\n margin: 0;\n max-width: none;\n max-height: none;\n pointer-events: none;\n }\n #mask {\n position: fixed;\n inset: 0;\n pointer-events: none;\n background: rgba(0,0,0,0);\n transition: background-color 0.3s cubic-bezier(0.9, 0, 0.1, 1);\n }\n #highlight {\n position: fixed;\n top: 0;\n left: 0;\n pointer-events: none;\n box-sizing: border-box;\n border-radius: var(--lit-devtools-radius-md);\n }\n #tooltip {\n position: fixed;\n /* Lift above the Vite DevTools edge panel when it's docked to the bottom\n (--edge-bottom is set from JS; 0 otherwise). */\n bottom: calc(16px + var(--edge-bottom, 0px));\n left: 50%;\n translate: -50%;\n display: none;\n align-items: stretch;\n pointer-events: auto;\n max-width: min(90vw, 480px);\n border-radius: var(--lit-devtools-radius-md);\n background: var(--lit-devtools-surface-elevated);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n color: var(--lit-devtools-text-strong);\n font: 12px/1.4 ${FONT_MONO_VAR};\n box-shadow: var(--lit-devtools-shadow-md);\n overflow: hidden;\n }\n .icon-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n flex: 0 0 auto;\n padding: 0 12px;\n border: none;\n background: transparent;\n color: inherit;\n cursor: pointer;\n }\n .icon-btn:hover { background: var(--lit-devtools-surface-hover); }\n /* No outline ring; keyboard focus reuses the subtle hover tint. */\n .icon-btn:focus { outline: none; }\n .icon-btn:focus-visible { background: var(--lit-devtools-surface-hover); }\n .icon-btn svg {\n width: 16px;\n height: 16px;\n display: block;\n fill: currentColor;\n }\n #meta {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 1px;\n min-width: 0;\n padding: 6px 10px;\n border-left: 1px solid var(--lit-devtools-border-subtle);\n border-right: 1px solid var(--lit-devtools-border-subtle);\n }\n #tag {\n font-weight: 600;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n color: var(--lit-devtools-text-strong);\n }\n #path {\n color: var(--lit-devtools-text-secondary);\n font-size: 11px;\n word-break: break-all;\n }\n </style>\n <dialog id=\"overlay\">\n <div id=\"mask\"></div>\n <div id=\"highlight\"></div>\n <div id=\"tooltip\">\n <span\n id=\"open\"\n class=\"icon-btn\"\n title=\"Open in editor\"\n aria-label=\"Open in editor\"\n >${CODE_ICON}</span>\n <div id=\"meta\">\n <span id=\"tag\"></span>\n <span id=\"path\"></span>\n </div>\n <button\n id=\"copy\"\n class=\"icon-btn\"\n type=\"button\"\n title=\"Copy path\"\n aria-label=\"Copy path\"\n >${COPY_ICON}</button>\n </div>\n </dialog>\n`;\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
export { initSourceOverlay, toggleSourceOverlay, type SourceOverlayInitOptions, } from './source-overlay/overlay-element.js';
|
|
7
|
+
//# sourceMappingURL=source-overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-overlay.d.ts","sourceRoot":"","sources":["../../../../packages/labs/vite-plugin-lit/src/lib/runtime/source-overlay.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,wBAAwB,GAC9B,MAAM,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
// Entry point for the source overlay runtime. The plugin resolves this module
|
|
7
|
+
// by path and imports initSourceOverlay; the implementation lives in
|
|
8
|
+
// ./source-overlay/. Importing the element module also registers the
|
|
9
|
+
// <lit-source-overlay> custom element as a side effect.
|
|
10
|
+
export { initSourceOverlay, toggleSourceOverlay, } from './source-overlay/overlay-element.js';
|
|
11
|
+
//# sourceMappingURL=source-overlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-overlay.js","sourceRoot":"","sources":["../../../../packages/labs/vite-plugin-lit/src/lib/runtime/source-overlay.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,8EAA8E;AAC9E,qEAAqE;AACrE,qEAAqE;AACrE,wDAAwD;AACxD,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GAEpB,MAAM,qCAAqC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n// Entry point for the source overlay runtime. The plugin resolves this module\n// by path and imports initSourceOverlay; the implementation lives in\n// ./source-overlay/. Importing the element module also registers the\n// <lit-source-overlay> custom element as a side effect.\nexport {\n initSourceOverlay,\n toggleSourceOverlay,\n type SourceOverlayInitOptions,\n} from './source-overlay/overlay-element.js';\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
/** Re-zero the clock; called when recording transitions off → on. */
|
|
7
|
+
export declare const resetClock: () => void;
|
|
8
|
+
/** Milliseconds since the last {@link resetClock}. */
|
|
9
|
+
export declare const now: () => number;
|
|
10
|
+
//# sourceMappingURL=clock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../../../../packages/labs/vite-plugin-lit/src/lib/runtime/timeline/clock.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH,qEAAqE;AACrE,eAAO,MAAM,UAAU,QAAO,IAE7B,CAAC;AAEF,sDAAsD;AACtD,eAAO,MAAM,GAAG,QAAO,MAAmC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Recording-relative clock for the timeline.
|
|
8
|
+
*
|
|
9
|
+
* Built-in capture layers timestamp events with {@link now} rather than raw
|
|
10
|
+
* `performance.now()`, so event times read as "ms since recording started"
|
|
11
|
+
* (the first event is ~0) instead of "ms since the app page loaded" — which is
|
|
12
|
+
* also meaningless to the panel, an iframe with its own time origin. The origin
|
|
13
|
+
* is re-zeroed on each rising edge of recording via {@link resetClock}.
|
|
14
|
+
*/
|
|
15
|
+
let epoch = 0;
|
|
16
|
+
/** Re-zero the clock; called when recording transitions off → on. */
|
|
17
|
+
export const resetClock = () => {
|
|
18
|
+
epoch = performance.now();
|
|
19
|
+
};
|
|
20
|
+
/** Milliseconds since the last {@link resetClock}. */
|
|
21
|
+
export const now = () => performance.now() - epoch;
|
|
22
|
+
//# sourceMappingURL=clock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.js","sourceRoot":"","sources":["../../../../../packages/labs/vite-plugin-lit/src/lib/runtime/timeline/clock.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH,IAAI,KAAK,GAAG,CAAC,CAAC;AAEd,qEAAqE;AACrE,MAAM,CAAC,MAAM,UAAU,GAAG,GAAS,EAAE;IACnC,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;AAC5B,CAAC,CAAC;AAEF,sDAAsD;AACtD,MAAM,CAAC,MAAM,GAAG,GAAG,GAAW,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Recording-relative clock for the timeline.\n *\n * Built-in capture layers timestamp events with {@link now} rather than raw\n * `performance.now()`, so event times read as \"ms since recording started\"\n * (the first event is ~0) instead of \"ms since the app page loaded\" — which is\n * also meaningless to the panel, an iframe with its own time origin. The origin\n * is re-zeroed on each rising edge of recording via {@link resetClock}.\n */\n\nlet epoch = 0;\n\n/** Re-zero the clock; called when recording transitions off → on. */\nexport const resetClock = (): void => {\n epoch = performance.now();\n};\n\n/** Milliseconds since the last {@link resetClock}. */\nexport const now = (): number => performance.now() - epoch;\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Stable per-instance id and source-meta lookup for the timeline.
|
|
8
|
+
*
|
|
9
|
+
* Assigns monotonic numeric ids to ReactiveElement instances via a WeakMap
|
|
10
|
+
* so we never mutate the elements themselves and ids survive HMR (same
|
|
11
|
+
* instance identity after in-place patching).
|
|
12
|
+
*
|
|
13
|
+
* Source metadata is read from the Symbol injected by the source-meta
|
|
14
|
+
* transform — the same one the source-overlay feature uses — so timeline
|
|
15
|
+
* events can deep-link to the component's definition file.
|
|
16
|
+
*/
|
|
17
|
+
export interface ElementSource {
|
|
18
|
+
file: string;
|
|
19
|
+
line: number;
|
|
20
|
+
}
|
|
21
|
+
/** Returns (and memoises) a stable numeric id for an element instance. */
|
|
22
|
+
export declare const idOf: (el: object) => number;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves an id back to its element instance, or `undefined` if it was never
|
|
25
|
+
* seen or has since been garbage-collected. Used by the inspector to act on the
|
|
26
|
+
* id the panel sends (details, watch, highlight).
|
|
27
|
+
*/
|
|
28
|
+
export declare const elementById: (id: number) => Element | undefined;
|
|
29
|
+
/** Reads the file/line source metadata injected by the plugin transform. */
|
|
30
|
+
export declare const sourceOf: (el: object) => ElementSource | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Extracts the changed property keys from a PropertyValues argument.
|
|
33
|
+
* Returns undefined when `changed` is not a Map (e.g. for lifecycle hooks
|
|
34
|
+
* that don't receive a changed-properties argument).
|
|
35
|
+
*/
|
|
36
|
+
export declare const changedKeys: (changed: unknown) => string[] | undefined;
|
|
37
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../../../packages/labs/vite-plugin-lit/src/lib/runtime/timeline/identity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AA8BD,0EAA0E;AAC1E,eAAO,MAAM,IAAI,GAAI,IAAI,MAAM,KAAG,MASjC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,IAAI,MAAM,KAAG,OAAO,GAAG,SAOlD,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,QAAQ,GAAI,IAAI,MAAM,KAAG,aAAa,GAAG,SAQrD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,OAAO,KAAG,MAAM,EAAE,GAAG,SAKzD,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
const SOURCE_META_KEY = Symbol.for('@lit-labs/vite-plugin-lit#source');
|
|
7
|
+
/** WeakMap avoids retaining elements after disconnection + GC. */
|
|
8
|
+
const ids = new WeakMap();
|
|
9
|
+
let nextId = 0;
|
|
10
|
+
/**
|
|
11
|
+
* Reverse map for {@link elementById}, so a panel request (which only carries
|
|
12
|
+
* an id) can be resolved back to the live instance. WeakRef-valued so we never
|
|
13
|
+
* keep an element alive past GC; dead entries are pruned on lookup.
|
|
14
|
+
*/
|
|
15
|
+
const byId = new Map();
|
|
16
|
+
/**
|
|
17
|
+
* Drops `byId` entries as their elements are garbage-collected. The `WeakRef`
|
|
18
|
+
* already lets the element itself be reclaimed, but the Map slot (id + WeakRef
|
|
19
|
+
* wrapper) would otherwise linger until the next `elementById(id)` lookup —
|
|
20
|
+
* which only happens on a panel request for that specific id, so on a churning
|
|
21
|
+
* page (a list re-rendering thousands of rows) dead entries accumulate for the
|
|
22
|
+
* whole dev session. Guarded for environments without `FinalizationRegistry`.
|
|
23
|
+
*/
|
|
24
|
+
const byIdRegistry = typeof FinalizationRegistry === 'function'
|
|
25
|
+
? new FinalizationRegistry((id) => {
|
|
26
|
+
byId.delete(id);
|
|
27
|
+
})
|
|
28
|
+
: undefined;
|
|
29
|
+
/** Returns (and memoises) a stable numeric id for an element instance. */
|
|
30
|
+
export const idOf = (el) => {
|
|
31
|
+
let id = ids.get(el);
|
|
32
|
+
if (id === undefined) {
|
|
33
|
+
id = nextId++;
|
|
34
|
+
ids.set(el, id);
|
|
35
|
+
byId.set(id, new WeakRef(el));
|
|
36
|
+
byIdRegistry?.register(el, id);
|
|
37
|
+
}
|
|
38
|
+
return id;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Resolves an id back to its element instance, or `undefined` if it was never
|
|
42
|
+
* seen or has since been garbage-collected. Used by the inspector to act on the
|
|
43
|
+
* id the panel sends (details, watch, highlight).
|
|
44
|
+
*/
|
|
45
|
+
export const elementById = (id) => {
|
|
46
|
+
const el = byId.get(id)?.deref();
|
|
47
|
+
if (el === undefined) {
|
|
48
|
+
byId.delete(id);
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
return el;
|
|
52
|
+
};
|
|
53
|
+
/** Reads the file/line source metadata injected by the plugin transform. */
|
|
54
|
+
export const sourceOf = (el) => {
|
|
55
|
+
const ctor = el.constructor;
|
|
56
|
+
if (ctor === undefined)
|
|
57
|
+
return undefined;
|
|
58
|
+
const meta = ctor[SOURCE_META_KEY];
|
|
59
|
+
if (meta?.filePath === undefined)
|
|
60
|
+
return undefined;
|
|
61
|
+
return { file: meta.filePath, line: meta.lineNumber ?? 1 };
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Extracts the changed property keys from a PropertyValues argument.
|
|
65
|
+
* Returns undefined when `changed` is not a Map (e.g. for lifecycle hooks
|
|
66
|
+
* that don't receive a changed-properties argument).
|
|
67
|
+
*/
|
|
68
|
+
export const changedKeys = (changed) => {
|
|
69
|
+
if (!(changed instanceof Map))
|
|
70
|
+
return undefined;
|
|
71
|
+
return [...changed.keys()].map((k) => typeof k === 'symbol' ? k.toString() : String(k));
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../../../packages/labs/vite-plugin-lit/src/lib/runtime/timeline/identity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AAEvE,kEAAkE;AAClE,MAAM,GAAG,GAAG,IAAI,OAAO,EAAkB,CAAC;AAC1C,IAAI,MAAM,GAAG,CAAC,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C;IACzE,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACzC,MAAM,IAAI,GAAG,IAAI,CAAC,eAAe,CAEpB,CAAC;IACd,IAAI,IAAI,EAAE,QAAQ,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACnD,OAAO,EAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,UAAU,IAAI,CAAC,EAAC,CAAC;AAC3D,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAgB,EAAwB,EAAE;IACpE,IAAI,CAAC,CAAC,OAAO,YAAY,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAChD,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACnC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CACjD,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Stable per-instance id and source-meta lookup for the timeline.\n *\n * Assigns monotonic numeric ids to ReactiveElement instances via a WeakMap\n * so we never mutate the elements themselves and ids survive HMR (same\n * instance identity after in-place patching).\n *\n * Source metadata is read from the Symbol injected by the source-meta\n * transform — the same one the source-overlay feature uses — so timeline\n * events can deep-link to the component's definition file.\n */\n\nexport interface ElementSource {\n file: string;\n line: number;\n}\n\nconst SOURCE_META_KEY = Symbol.for('@lit-labs/vite-plugin-lit#source');\n\n/** WeakMap avoids retaining elements after disconnection + GC. */\nconst ids = new WeakMap<object, number>();\nlet nextId = 0;\n\n/**\n * Reverse map for {@link elementById}, so a panel request (which only carries\n * an id) can be resolved back to the live instance. WeakRef-valued so we never\n * keep an element alive past GC; dead entries are pruned on lookup.\n */\nconst byId = new Map<number, WeakRef<object>>();\n\n/**\n * Drops `byId` entries as their elements are garbage-collected. The `WeakRef`\n * already lets the element itself be reclaimed, but the Map slot (id + WeakRef\n * wrapper) would otherwise linger until the next `elementById(id)` lookup —\n * which only happens on a panel request for that specific id, so on a churning\n * page (a list re-rendering thousands of rows) dead entries accumulate for the\n * whole dev session. Guarded for environments without `FinalizationRegistry`.\n */\nconst byIdRegistry =\n typeof FinalizationRegistry === 'function'\n ? new FinalizationRegistry<number>((id) => {\n byId.delete(id);\n })\n : undefined;\n\n/** Returns (and memoises) a stable numeric id for an element instance. */\nexport const idOf = (el: object): number => {\n let id = ids.get(el);\n if (id === undefined) {\n id = nextId++;\n ids.set(el, id);\n byId.set(id, new WeakRef(el));\n byIdRegistry?.register(el, id);\n }\n return id;\n};\n\n/**\n * Resolves an id back to its element instance, or `undefined` if it was never\n * seen or has since been garbage-collected. Used by the inspector to act on the\n * id the panel sends (details, watch, highlight).\n */\nexport const elementById = (id: number): Element | undefined => {\n const el = byId.get(id)?.deref();\n if (el === undefined) {\n byId.delete(id);\n return undefined;\n }\n return el as Element;\n};\n\n/** Reads the file/line source metadata injected by the plugin transform. */\nexport const sourceOf = (el: object): ElementSource | undefined => {\n const ctor = (el as {constructor?: Record<symbol, unknown>}).constructor;\n if (ctor === undefined) return undefined;\n const meta = ctor[SOURCE_META_KEY] as\n | {filePath?: string; lineNumber?: number}\n | undefined;\n if (meta?.filePath === undefined) return undefined;\n return {file: meta.filePath, line: meta.lineNumber ?? 1};\n};\n\n/**\n * Extracts the changed property keys from a PropertyValues argument.\n * Returns undefined when `changed` is not a Map (e.g. for lifecycle hooks\n * that don't receive a changed-properties argument).\n */\nexport const changedKeys = (changed: unknown): string[] | undefined => {\n if (!(changed instanceof Map)) return undefined;\n return [...changed.keys()].map((k) =>\n typeof k === 'symbol' ? k.toString() : String(k)\n );\n};\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Mouse and keyboard timeline layers — plain window listeners, direct port
|
|
8
|
+
* of the Vue DevTools timeline input capture pattern.
|
|
9
|
+
*/
|
|
10
|
+
import type { TimelineEvent } from '../../../types/timeline.js';
|
|
11
|
+
type EmitFn = (event: TimelineEvent) => void;
|
|
12
|
+
type RecordingFn = () => boolean;
|
|
13
|
+
export declare const installMouseLayer: (emit: EmitFn, recording: RecordingFn, mouseEnabled: () => boolean) => void;
|
|
14
|
+
export declare const installKeyboardLayer: (emit: EmitFn, recording: RecordingFn, keyEnabled: () => boolean) => void;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../../packages/labs/vite-plugin-lit/src/lib/runtime/timeline/input.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AAG9D,KAAK,MAAM,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;AAC7C,KAAK,WAAW,GAAG,MAAM,OAAO,CAAC;AAyEjC,eAAO,MAAM,iBAAiB,GAC5B,MAAM,MAAM,EACZ,WAAW,WAAW,EACtB,cAAc,MAAM,OAAO,KAC1B,IAWF,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,MAAM,MAAM,EACZ,WAAW,WAAW,EACtB,YAAY,MAAM,OAAO,KACxB,IAWF,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
import { now } from './clock.js';
|
|
7
|
+
const MOUSE_EVENTS = [
|
|
8
|
+
'mousedown',
|
|
9
|
+
'mouseup',
|
|
10
|
+
'click',
|
|
11
|
+
'dblclick',
|
|
12
|
+
];
|
|
13
|
+
const KEY_EVENTS = ['keydown', 'keyup'];
|
|
14
|
+
const mouseHandler = (emit, recording, mouseEnabled) => (e) => {
|
|
15
|
+
if (!recording() || !mouseEnabled())
|
|
16
|
+
return;
|
|
17
|
+
const me = e;
|
|
18
|
+
const data = {
|
|
19
|
+
type: e.type,
|
|
20
|
+
x: Math.round(me.clientX),
|
|
21
|
+
y: Math.round(me.clientY),
|
|
22
|
+
button: me.button,
|
|
23
|
+
};
|
|
24
|
+
emit({
|
|
25
|
+
layerId: 'mouse',
|
|
26
|
+
time: now(),
|
|
27
|
+
title: e.type,
|
|
28
|
+
subtitle: `(${data.x}, ${data.y})`,
|
|
29
|
+
data,
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const keyHandler = (emit, recording, keyEnabled) => (e) => {
|
|
33
|
+
if (!recording() || !keyEnabled())
|
|
34
|
+
return;
|
|
35
|
+
const ke = e;
|
|
36
|
+
const modifiers = [];
|
|
37
|
+
if (ke.ctrlKey)
|
|
38
|
+
modifiers.push('Ctrl');
|
|
39
|
+
if (ke.metaKey)
|
|
40
|
+
modifiers.push('Meta');
|
|
41
|
+
if (ke.altKey)
|
|
42
|
+
modifiers.push('Alt');
|
|
43
|
+
if (ke.shiftKey)
|
|
44
|
+
modifiers.push('Shift');
|
|
45
|
+
const data = {
|
|
46
|
+
type: e.type,
|
|
47
|
+
key: ke.key,
|
|
48
|
+
code: ke.code,
|
|
49
|
+
modifiers,
|
|
50
|
+
};
|
|
51
|
+
emit({
|
|
52
|
+
layerId: 'keyboard',
|
|
53
|
+
time: now(),
|
|
54
|
+
title: ke.key,
|
|
55
|
+
subtitle: modifiers.length ? modifiers.join('+') : undefined,
|
|
56
|
+
data,
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
let mouseCleanup = null;
|
|
60
|
+
let keyCleanup = null;
|
|
61
|
+
export const installMouseLayer = (emit, recording, mouseEnabled) => {
|
|
62
|
+
if (mouseCleanup !== null)
|
|
63
|
+
return;
|
|
64
|
+
const handler = mouseHandler(emit, recording, mouseEnabled);
|
|
65
|
+
for (const type of MOUSE_EVENTS) {
|
|
66
|
+
window.addEventListener(type, handler, { capture: true, passive: true });
|
|
67
|
+
}
|
|
68
|
+
mouseCleanup = () => {
|
|
69
|
+
for (const type of MOUSE_EVENTS) {
|
|
70
|
+
window.removeEventListener(type, handler, { capture: true });
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
export const installKeyboardLayer = (emit, recording, keyEnabled) => {
|
|
75
|
+
if (keyCleanup !== null)
|
|
76
|
+
return;
|
|
77
|
+
const handler = keyHandler(emit, recording, keyEnabled);
|
|
78
|
+
for (const type of KEY_EVENTS) {
|
|
79
|
+
window.addEventListener(type, handler, { capture: true, passive: true });
|
|
80
|
+
}
|
|
81
|
+
keyCleanup = () => {
|
|
82
|
+
for (const type of KEY_EVENTS) {
|
|
83
|
+
window.removeEventListener(type, handler, { capture: true });
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../../../packages/labs/vite-plugin-lit/src/lib/runtime/timeline/input.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EAAC,GAAG,EAAC,MAAM,YAAY,CAAC;AAK/B,MAAM,YAAY,GAAG;IACnB,WAAW;IACX,SAAS;IACT,OAAO;IACP,UAAU;CAC0B,CAAC;AAEvC,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,OAAO,CAAsC,CAAC;AAgB7E,MAAM,YAAY,GAChB,CAAC,IAAY,EAAE,SAAsB,EAAE,YAA2B,EAAE,EAAE,CACtE,CAAC,CAA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,CAAC;IACxD,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;IACzE,CAAC;IACD,UAAU,GAAG,GAAG,EAAE;QAChB,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;YAC9B,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Mouse and keyboard timeline layers — plain window listeners, direct port\n * of the Vue DevTools timeline input capture pattern.\n */\n\nimport type {TimelineEvent} from '../../../types/timeline.js';\nimport {now} from './clock.js';\n\ntype EmitFn = (event: TimelineEvent) => void;\ntype RecordingFn = () => boolean;\n\nconst MOUSE_EVENTS = [\n 'mousedown',\n 'mouseup',\n 'click',\n 'dblclick',\n] as const satisfies readonly string[];\n\nconst KEY_EVENTS = ['keydown', 'keyup'] as const satisfies readonly string[];\n\ninterface MouseData {\n type: string;\n x: number;\n y: number;\n button: number;\n}\n\ninterface KeyData {\n type: string;\n key: string;\n code: string;\n modifiers: string[];\n}\n\nconst mouseHandler =\n (emit: EmitFn, recording: RecordingFn, mouseEnabled: () => boolean) =>\n (e: Event): void => {\n if (!recording() || !mouseEnabled()) return;\n const me = e as MouseEvent;\n const data: MouseData = {\n type: e.type,\n x: Math.round(me.clientX),\n y: Math.round(me.clientY),\n button: me.button,\n };\n emit({\n layerId: 'mouse',\n time: now(),\n title: e.type,\n subtitle: `(${data.x}, ${data.y})`,\n data,\n });\n };\n\nconst keyHandler =\n (emit: EmitFn, recording: RecordingFn, keyEnabled: () => boolean) =>\n (e: Event): void => {\n if (!recording() || !keyEnabled()) return;\n const ke = e as KeyboardEvent;\n const modifiers: string[] = [];\n if (ke.ctrlKey) modifiers.push('Ctrl');\n if (ke.metaKey) modifiers.push('Meta');\n if (ke.altKey) modifiers.push('Alt');\n if (ke.shiftKey) modifiers.push('Shift');\n const data: KeyData = {\n type: e.type,\n key: ke.key,\n code: ke.code,\n modifiers,\n };\n emit({\n layerId: 'keyboard',\n time: now(),\n title: ke.key,\n subtitle: modifiers.length ? modifiers.join('+') : undefined,\n data,\n });\n };\n\nlet mouseCleanup: (() => void) | null = null;\nlet keyCleanup: (() => void) | null = null;\n\nexport const installMouseLayer = (\n emit: EmitFn,\n recording: RecordingFn,\n mouseEnabled: () => boolean\n): void => {\n if (mouseCleanup !== null) return;\n const handler = mouseHandler(emit, recording, mouseEnabled);\n for (const type of MOUSE_EVENTS) {\n window.addEventListener(type, handler, {capture: true, passive: true});\n }\n mouseCleanup = () => {\n for (const type of MOUSE_EVENTS) {\n window.removeEventListener(type, handler, {capture: true});\n }\n };\n};\n\nexport const installKeyboardLayer = (\n emit: EmitFn,\n recording: RecordingFn,\n keyEnabled: () => boolean\n): void => {\n if (keyCleanup !== null) return;\n const handler = keyHandler(emit, recording, keyEnabled);\n for (const type of KEY_EVENTS) {\n window.addEventListener(type, handler, {capture: true, passive: true});\n }\n keyCleanup = () => {\n for (const type of KEY_EVENTS) {\n window.removeEventListener(type, handler, {capture: true});\n }\n };\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../../../packages/labs/vite-plugin-lit/src/lib/runtime/timeline/install.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|