@oddsquad/vite-plugin-lit 0.2.3 → 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 (240) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/LICENSE +28 -0
  3. package/README.md +157 -0
  4. package/bin.mjs +154 -0
  5. package/client.d.ts +61 -0
  6. package/dist/client/assets/browser-agent-rpc-BXhoSh1z-CdtPhBL-.js +69 -0
  7. package/dist/client/assets/browser-agent-rpc-BXhoSh1z-CdtPhBL-.js.map +1 -0
  8. package/dist/client/assets/flow-DK8vmxvN.js +745 -0
  9. package/dist/client/assets/flow-DK8vmxvN.js.map +1 -0
  10. package/dist/client/assets/index-DVe6M4HV.js +10614 -0
  11. package/dist/client/assets/index-DVe6M4HV.js.map +1 -0
  12. package/{panel → dist/client}/index.html +1 -0
  13. package/index.d.ts.map +1 -1
  14. package/index.js +2 -2
  15. package/index.js.map +1 -1
  16. package/lib/color-scheme.d.ts.map +1 -1
  17. package/lib/color-scheme.js +17 -21
  18. package/lib/color-scheme.js.map +1 -1
  19. package/lib/devframe/definition.d.ts +45 -0
  20. package/lib/devframe/definition.d.ts.map +1 -0
  21. package/lib/devframe/definition.js +547 -0
  22. package/lib/devframe/definition.js.map +1 -0
  23. package/lib/devframe/icon.d.ts +8 -0
  24. package/lib/devframe/icon.d.ts.map +1 -0
  25. package/lib/devframe/icon.js +21 -0
  26. package/lib/devframe/icon.js.map +1 -0
  27. package/lib/devframe/paths.d.ts +12 -0
  28. package/lib/devframe/paths.d.ts.map +1 -0
  29. package/lib/devframe/paths.js +38 -0
  30. package/lib/devframe/paths.js.map +1 -0
  31. package/lib/devframe/protocol.d.ts +218 -0
  32. package/lib/devframe/protocol.d.ts.map +1 -0
  33. package/lib/devframe/protocol.js +77 -0
  34. package/lib/devframe/protocol.js.map +1 -0
  35. package/lib/devframe/source.d.ts +49 -0
  36. package/lib/devframe/source.d.ts.map +1 -0
  37. package/lib/devframe/source.js +23 -0
  38. package/lib/devframe/source.js.map +1 -0
  39. package/lib/devframe/vite.d.ts +116 -0
  40. package/lib/devframe/vite.d.ts.map +1 -0
  41. package/lib/devframe/vite.js +292 -0
  42. package/lib/devframe/vite.js.map +1 -0
  43. package/lib/http.d.ts +29 -0
  44. package/lib/http.d.ts.map +1 -0
  45. package/lib/http.js +35 -0
  46. package/lib/http.js.map +1 -0
  47. package/lib/icons.d.ts +2 -0
  48. package/lib/icons.d.ts.map +1 -1
  49. package/lib/icons.js +10 -4
  50. package/lib/icons.js.map +1 -1
  51. package/lib/options.d.ts +131 -0
  52. package/lib/options.d.ts.map +1 -0
  53. package/lib/options.js +128 -0
  54. package/lib/options.js.map +1 -0
  55. package/lib/plugin.d.ts +6 -137
  56. package/lib/plugin.d.ts.map +1 -1
  57. package/lib/plugin.js +280 -677
  58. package/lib/plugin.js.map +1 -1
  59. package/lib/plugins/css-literals.d.ts +15 -0
  60. package/lib/plugins/css-literals.d.ts.map +1 -0
  61. package/lib/plugins/css-literals.js +154 -0
  62. package/lib/plugins/css-literals.js.map +1 -0
  63. package/lib/plugins/css-queries.d.ts +20 -0
  64. package/lib/plugins/css-queries.d.ts.map +1 -0
  65. package/lib/plugins/css-queries.js +139 -0
  66. package/lib/plugins/css-queries.js.map +1 -0
  67. package/lib/plugins/open-in-editor.d.ts +16 -0
  68. package/lib/plugins/open-in-editor.d.ts.map +1 -0
  69. package/lib/plugins/open-in-editor.js +91 -0
  70. package/lib/plugins/open-in-editor.js.map +1 -0
  71. package/lib/plugins/shared.d.ts +13 -0
  72. package/lib/plugins/shared.d.ts.map +1 -0
  73. package/lib/plugins/shared.js +23 -0
  74. package/lib/plugins/shared.js.map +1 -0
  75. package/lib/plugins/timeline-virtual.d.ts +19 -0
  76. package/lib/plugins/timeline-virtual.d.ts.map +1 -0
  77. package/lib/plugins/timeline-virtual.js +53 -0
  78. package/lib/plugins/timeline-virtual.js.map +1 -0
  79. package/lib/runtime/css.d.ts +2 -2
  80. package/lib/runtime/css.d.ts.map +1 -1
  81. package/lib/runtime/css.js +41 -34
  82. package/lib/runtime/css.js.map +1 -1
  83. package/lib/runtime/edge-panel.d.ts.map +1 -1
  84. package/lib/runtime/edge-panel.js +82 -91
  85. package/lib/runtime/edge-panel.js.map +1 -1
  86. package/lib/runtime/fonts.d.ts.map +1 -1
  87. package/lib/runtime/fonts.js +1 -1
  88. package/lib/runtime/fonts.js.map +1 -1
  89. package/lib/runtime/indicator.d.ts.map +1 -1
  90. package/lib/runtime/indicator.js +71 -74
  91. package/lib/runtime/indicator.js.map +1 -1
  92. package/lib/runtime/inspector/collect.d.ts.map +1 -1
  93. package/lib/runtime/inspector/collect.js +83 -90
  94. package/lib/runtime/inspector/collect.js.map +1 -1
  95. package/lib/runtime/inspector/highlight.d.ts +16 -0
  96. package/lib/runtime/inspector/highlight.d.ts.map +1 -0
  97. package/lib/runtime/inspector/highlight.js +66 -0
  98. package/lib/runtime/inspector/highlight.js.map +1 -0
  99. package/lib/runtime/inspector/install.d.ts.map +1 -1
  100. package/lib/runtime/inspector/install.js +230 -205
  101. package/lib/runtime/inspector/install.js.map +1 -1
  102. package/lib/runtime/inspector/serialize.d.ts.map +1 -1
  103. package/lib/runtime/inspector/serialize.js +86 -107
  104. package/lib/runtime/inspector/serialize.js.map +1 -1
  105. package/lib/runtime/intern.d.ts.map +1 -1
  106. package/lib/runtime/intern.js +31 -29
  107. package/lib/runtime/intern.js.map +1 -1
  108. package/lib/runtime/overrides.d.ts.map +1 -1
  109. package/lib/runtime/overrides.js +14 -13
  110. package/lib/runtime/overrides.js.map +1 -1
  111. package/lib/runtime/patch.d.ts +8 -0
  112. package/lib/runtime/patch.d.ts.map +1 -1
  113. package/lib/runtime/patch.js +321 -282
  114. package/lib/runtime/patch.js.map +1 -1
  115. package/lib/runtime/source-meta.d.ts.map +1 -1
  116. package/lib/runtime/source-meta.js +1 -1
  117. package/lib/runtime/source-meta.js.map +1 -1
  118. package/lib/runtime/source-overlay/editors.d.ts.map +1 -1
  119. package/lib/runtime/source-overlay/editors.js +27 -27
  120. package/lib/runtime/source-overlay/editors.js.map +1 -1
  121. package/lib/runtime/source-overlay/mask-path.d.ts.map +1 -1
  122. package/lib/runtime/source-overlay/mask-path.js +15 -15
  123. package/lib/runtime/source-overlay/mask-path.js.map +1 -1
  124. package/lib/runtime/source-overlay/overlay-element.d.ts.map +1 -1
  125. package/lib/runtime/source-overlay/overlay-element.js +359 -355
  126. package/lib/runtime/source-overlay/overlay-element.js.map +1 -1
  127. package/lib/runtime/source-overlay/source-host.d.ts.map +1 -1
  128. package/lib/runtime/source-overlay/source-host.js +64 -71
  129. package/lib/runtime/source-overlay/source-host.js.map +1 -1
  130. package/lib/runtime/source-overlay/template.d.ts.map +1 -1
  131. package/lib/runtime/source-overlay/template.js +3 -3
  132. package/lib/runtime/source-overlay/template.js.map +1 -1
  133. package/lib/runtime/source-overlay.d.ts.map +1 -1
  134. package/lib/runtime/source-overlay.js +5 -2
  135. package/lib/runtime/source-overlay.js.map +1 -1
  136. package/lib/runtime/timeline/clock.d.ts.map +1 -1
  137. package/lib/runtime/timeline/clock.js +2 -2
  138. package/lib/runtime/timeline/clock.js.map +1 -1
  139. package/lib/runtime/timeline/flash.d.ts +39 -0
  140. package/lib/runtime/timeline/flash.d.ts.map +1 -0
  141. package/lib/runtime/timeline/flash.js +169 -0
  142. package/lib/runtime/timeline/flash.js.map +1 -0
  143. package/lib/runtime/timeline/identity.d.ts.map +1 -1
  144. package/lib/runtime/timeline/identity.js +27 -27
  145. package/lib/runtime/timeline/identity.js.map +1 -1
  146. package/lib/runtime/timeline/input.d.ts.map +1 -1
  147. package/lib/runtime/timeline/input.js +54 -67
  148. package/lib/runtime/timeline/input.js.map +1 -1
  149. package/lib/runtime/timeline/install.d.ts.map +1 -1
  150. package/lib/runtime/timeline/install.js +47 -33
  151. package/lib/runtime/timeline/install.js.map +1 -1
  152. package/lib/runtime/timeline/lifecycle.d.ts +8 -0
  153. package/lib/runtime/timeline/lifecycle.d.ts.map +1 -1
  154. package/lib/runtime/timeline/lifecycle.js +149 -133
  155. package/lib/runtime/timeline/lifecycle.js.map +1 -1
  156. package/lib/runtime/timeline/public-api.d.ts +2 -2
  157. package/lib/runtime/timeline/public-api.d.ts.map +1 -1
  158. package/lib/runtime/timeline/public-api.js +11 -11
  159. package/lib/runtime/timeline/public-api.js.map +1 -1
  160. package/lib/runtime/timeline/render.d.ts +15 -6
  161. package/lib/runtime/timeline/render.d.ts.map +1 -1
  162. package/lib/runtime/timeline/render.js +212 -78
  163. package/lib/runtime/timeline/render.js.map +1 -1
  164. package/lib/runtime/timeline/transport.d.ts.map +1 -1
  165. package/lib/runtime/timeline/transport.js +39 -43
  166. package/lib/runtime/timeline/transport.js.map +1 -1
  167. package/lib/segmented-tabs.d.ts +3 -1
  168. package/lib/segmented-tabs.d.ts.map +1 -1
  169. package/lib/segmented-tabs.js +136 -107
  170. package/lib/segmented-tabs.js.map +1 -1
  171. package/lib/snapshot.d.ts +28 -0
  172. package/lib/snapshot.d.ts.map +1 -0
  173. package/lib/snapshot.js +57 -0
  174. package/lib/snapshot.js.map +1 -0
  175. package/lib/source-meta.d.ts.map +1 -1
  176. package/lib/source-meta.js +176 -162
  177. package/lib/source-meta.js.map +1 -1
  178. package/lib/timeline/derive.d.ts +152 -0
  179. package/lib/timeline/derive.d.ts.map +1 -0
  180. package/lib/timeline/derive.js +242 -0
  181. package/lib/timeline/derive.js.map +1 -0
  182. package/lib/tokens.d.ts.map +1 -1
  183. package/lib/tokens.js +17 -18
  184. package/lib/tokens.js.map +1 -1
  185. package/lib/transform.d.ts.map +1 -1
  186. package/lib/transform.js +62 -57
  187. package/lib/transform.js.map +1 -1
  188. package/lib/types.d.ts.map +1 -1
  189. package/lib/types.js +1 -1
  190. package/lib/types.js.map +1 -1
  191. package/lib/wrap-table.d.ts.map +1 -1
  192. package/lib/wrap-table.js +19 -17
  193. package/lib/wrap-table.js.map +1 -1
  194. package/package.json +80 -13
  195. package/types/hmr-incompatibility.d.ts +59 -0
  196. package/types/hmr-incompatibility.d.ts.map +1 -0
  197. package/types/hmr-incompatibility.js +30 -0
  198. package/types/hmr-incompatibility.js.map +1 -0
  199. package/types/in-page.d.ts +49 -0
  200. package/types/in-page.d.ts.map +1 -0
  201. package/types/in-page.js +33 -0
  202. package/types/in-page.js.map +1 -0
  203. package/types/inspector.d.ts.map +1 -1
  204. package/types/inspector.js.map +1 -1
  205. package/types/snapshot.d.ts +44 -0
  206. package/types/snapshot.d.ts.map +1 -0
  207. package/types/snapshot.js +7 -0
  208. package/types/snapshot.js.map +1 -0
  209. package/types/timeline.d.ts +23 -1
  210. package/types/timeline.d.ts.map +1 -1
  211. package/types/timeline.js +2 -0
  212. package/types/timeline.js.map +1 -1
  213. package/lib/timeline-plugin.d.ts +0 -72
  214. package/lib/timeline-plugin.d.ts.map +0 -1
  215. package/lib/timeline-plugin.js +0 -376
  216. package/lib/timeline-plugin.js.map +0 -1
  217. package/panel/components-view.d.ts +0 -60
  218. package/panel/components-view.d.ts.map +0 -1
  219. package/panel/components-view.js +0 -587
  220. package/panel/components-view.js.map +0 -1
  221. package/panel/devtools-settings.d.ts +0 -41
  222. package/panel/devtools-settings.d.ts.map +0 -1
  223. package/panel/devtools-settings.js +0 -463
  224. package/panel/devtools-settings.js.map +0 -1
  225. package/panel/lit-devtools-panel.d.ts +0 -37
  226. package/panel/lit-devtools-panel.d.ts.map +0 -1
  227. package/panel/lit-devtools-panel.js +0 -185
  228. package/panel/lit-devtools-panel.js.map +0 -1
  229. package/panel/timeline-event-list.d.ts +0 -43
  230. package/panel/timeline-event-list.d.ts.map +0 -1
  231. package/panel/timeline-event-list.js +0 -416
  232. package/panel/timeline-event-list.js.map +0 -1
  233. package/panel/timeline-layers.d.ts +0 -25
  234. package/panel/timeline-layers.d.ts.map +0 -1
  235. package/panel/timeline-layers.js +0 -96
  236. package/panel/timeline-layers.js.map +0 -1
  237. package/panel/timeline-view.d.ts +0 -38
  238. package/panel/timeline-view.d.ts.map +0 -1
  239. package/panel/timeline-view.js +0 -234
  240. package/panel/timeline-view.js.map +0 -1
@@ -1,185 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2026 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
7
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10
- return c > 3 && r && Object.defineProperty(target, key, r), r;
11
- };
12
- import { LitElement, html, css, nothing } from 'lit';
13
- import { customElement, query, state } from 'lit/decorators.js';
14
- import { tokens, injectTokens } from '../lib/tokens.js';
15
- import { applyColorScheme, readColorSchemePreference, } from '../lib/color-scheme.js';
16
- import './timeline-view.js';
17
- // Install the shared design tokens on the panel iframe's :root before the
18
- // views render. Panel components inherit the semantic aliases from :root.
19
- // The panel owns this document, so it also declares `color-scheme` (host-page
20
- // injections must not — see `injectTokens`).
21
- injectTokens({ colorScheme: true });
22
- // Own the color-scheme class once the panel module is live: re-assert the
23
- // saved preference (the Settings tab mounts lazily, so it can't). `auto` needs
24
- // no JS — the tokens' `prefers-color-scheme` @media rule resolves it live.
25
- applyColorScheme(readColorSchemePreference());
26
- import './components-view.js';
27
- import './devtools-settings.js';
28
- import '../lib/segmented-tabs.js';
29
- import { CUBE_ICON, CLOCK_ICON, GEAR_ICON } from '../lib/icons.js';
30
- /**
31
- * Tabs hosted by the panel. The Timeline is the first; this list is the
32
- * extension point for future Lit DevTools views.
33
- */
34
- const TABS = [
35
- { id: 'components', label: 'Components', icon: CUBE_ICON },
36
- { id: 'timeline', label: 'Timeline', icon: CLOCK_ICON },
37
- { id: 'settings', label: 'Settings', icon: GEAR_ICON },
38
- ];
39
- /** Inline Lit logo mark. */
40
- const LIT_LOGO_SVG = html `<svg
41
- xmlns="http://www.w3.org/2000/svg"
42
- viewBox="-32 0 320 320"
43
- width="20"
44
- height="20"
45
- aria-hidden="true"
46
- >
47
- <path
48
- fill="#00e8ff"
49
- d="m64 192l25.926-44.727l38.233-19.114l63.974 63.974l10.833 61.754L192 320l-64-64l-38.074-25.615z"
50
- />
51
- <path
52
- fill="#283198"
53
- d="M128 256V128l64-64v128zM0 256l64 64l9.202-60.602L64 192l-37.542 23.71z"
54
- />
55
- <path
56
- fill="#324fff"
57
- d="M64 192V64l64-64v128zm128 128V192l64-64v128zM0 256V128l64 64z"
58
- />
59
- <path fill="#0ff" d="M64 320V192l64 64z" />
60
- </svg>`;
61
- /**
62
- * Root of the Lit DevTools panel — a tabbed shell. Each tab's view is kept
63
- * mounted and merely hidden when inactive, so the Timeline keeps recording
64
- * (and holds its events) while another tab is in front.
65
- */
66
- let LitDevtoolsPanel = class LitDevtoolsPanel extends LitElement {
67
- constructor() {
68
- super(...arguments);
69
- this._tab = 'components';
70
- }
71
- static { this.styles = [
72
- tokens,
73
- css `
74
- :host {
75
- display: flex;
76
- flex-direction: column;
77
- height: 100vh;
78
- font-family: var(--lit-devtools-font-sans);
79
- font-size: var(--lit-devtools-text-sm);
80
- background: var(--lit-devtools-bg);
81
- color: var(--lit-devtools-text);
82
- overflow: hidden;
83
- }
84
- header {
85
- display: flex;
86
- align-items: center;
87
- gap: var(--lit-devtools-space-6);
88
- padding: 0 var(--lit-devtools-space-5);
89
- border-bottom: 1px solid var(--lit-devtools-border);
90
- background: var(--lit-devtools-surface-low);
91
- flex-shrink: 0;
92
- }
93
- .brand {
94
- display: flex;
95
- align-items: center;
96
- gap: var(--lit-devtools-space-4);
97
- color: var(--lit-devtools-text-strong);
98
- font-weight: var(--lit-devtools-weight-bold);
99
- font-size: var(--lit-devtools-text-xs);
100
- letter-spacing: var(--lit-devtools-tracking-caps);
101
- text-transform: uppercase;
102
- padding: var(--lit-devtools-space-5) 0;
103
- }
104
- .brand svg {
105
- display: block;
106
- }
107
- .view {
108
- display: flex;
109
- flex-direction: column;
110
- flex: 1;
111
- overflow: hidden;
112
- }
113
- `,
114
- ]; }
115
- _onTabChange(e) {
116
- this._tab = e.detail.value;
117
- }
118
- /** A timeline event's "inspect" link — open the Components tab on it. */
119
- _onInspectElement(e) {
120
- this._tab = 'components';
121
- // The view is always mounted, so it can select without waiting for render.
122
- this._componentsView?.selectById(e.detail.id);
123
- }
124
- /**
125
- * A component was picked via the overlay inspector — switch to the Components
126
- * tab and request the parent DevTools shell to bring this dock entry to the
127
- * front, so the user can see the picked element without having to manually
128
- * open the Lit panel first.
129
- */
130
- _onInspectorActivate() {
131
- this._tab = 'components';
132
- // The panel iframe is same-origin with the Vite DevTools shell — the
133
- // parent exposes its DevTools client context on
134
- // window.__VITE_DEVTOOLS_CLIENT_CONTEXT__ (set by @vitejs/devtools's
135
- // inject.ts). Ask it to select the Lit dock entry so the panel becomes
136
- // visible.
137
- try {
138
- const parent = window.parent;
139
- if (parent &&
140
- parent !== window &&
141
- '__VITE_DEVTOOLS_CLIENT_CONTEXT__' in parent) {
142
- const ctx = parent.__VITE_DEVTOOLS_CLIENT_CONTEXT__;
143
- ctx?.docks?.switchEntry?.('lit-devtools');
144
- }
145
- }
146
- catch {
147
- // Cross-origin or not running inside the DevTools shell — ignore.
148
- }
149
- }
150
- render() {
151
- return html `
152
- <header>
153
- <span class="brand">${LIT_LOGO_SVG} Lit DevTools</span>
154
- <segmented-tabs
155
- .items=${TABS}
156
- .value=${this._tab}
157
- @change=${this._onTabChange}
158
- ></segmented-tabs>
159
- </header>
160
- <div class="view" @inspect-element=${this._onInspectElement}>
161
- <timeline-view ?hidden=${this._tab !== 'timeline'}></timeline-view>
162
- <!-- Kept mounted (like the timeline) so an overlay inspect-pick can
163
- arrive and switch us here even while another tab is in front. -->
164
- <components-view
165
- ?hidden=${this._tab !== 'components'}
166
- @inspector-activate=${this._onInspectorActivate}
167
- ></components-view>
168
- ${this._tab === 'settings'
169
- ? html `<devtools-settings></devtools-settings>`
170
- : nothing}
171
- </div>
172
- `;
173
- }
174
- };
175
- __decorate([
176
- state()
177
- ], LitDevtoolsPanel.prototype, "_tab", void 0);
178
- __decorate([
179
- query('components-view')
180
- ], LitDevtoolsPanel.prototype, "_componentsView", void 0);
181
- LitDevtoolsPanel = __decorate([
182
- customElement('lit-devtools-panel')
183
- ], LitDevtoolsPanel);
184
- export { LitDevtoolsPanel };
185
- //# sourceMappingURL=lit-devtools-panel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lit-devtools-panel.js","sourceRoot":"","sources":["../../../packages/labs/vite-plugin-lit/src/panel/lit-devtools-panel.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {LitElement, html, css, nothing} from 'lit';\nimport {customElement, query, state} from 'lit/decorators.js';\nimport {tokens, injectTokens} from '../lib/tokens.js';\nimport {\n applyColorScheme,\n readColorSchemePreference,\n} from '../lib/color-scheme.js';\nimport './timeline-view.js';\n\n// Install the shared design tokens on the panel iframe's :root before the\n// views render. Panel components inherit the semantic aliases from :root.\n// The panel owns this document, so it also declares `color-scheme` (host-page\n// injections must not — see `injectTokens`).\ninjectTokens({colorScheme: true});\n// Own the color-scheme class once the panel module is live: re-assert the\n// saved preference (the Settings tab mounts lazily, so it can't). `auto` needs\n// no JS — the tokens' `prefers-color-scheme` @media rule resolves it live.\napplyColorScheme(readColorSchemePreference());\nimport './components-view.js';\nimport type {ComponentsView} from './components-view.js';\nimport './devtools-settings.js';\nimport '../lib/segmented-tabs.js';\nimport type {TabItem} from '../lib/segmented-tabs.js';\nimport {CUBE_ICON, CLOCK_ICON, GEAR_ICON} from '../lib/icons.js';\n\n/**\n * Tabs hosted by the panel. The Timeline is the first; this list is the\n * extension point for future Lit DevTools views.\n */\nconst TABS: readonly TabItem[] = [\n {id: 'components', label: 'Components', icon: CUBE_ICON},\n {id: 'timeline', label: 'Timeline', icon: CLOCK_ICON},\n {id: 'settings', label: 'Settings', icon: GEAR_ICON},\n];\n\n/** Inline Lit logo mark. */\nconst LIT_LOGO_SVG = html`<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"-32 0 320 320\"\n width=\"20\"\n height=\"20\"\n aria-hidden=\"true\"\n>\n <path\n fill=\"#00e8ff\"\n d=\"m64 192l25.926-44.727l38.233-19.114l63.974 63.974l10.833 61.754L192 320l-64-64l-38.074-25.615z\"\n />\n <path\n fill=\"#283198\"\n d=\"M128 256V128l64-64v128zM0 256l64 64l9.202-60.602L64 192l-37.542 23.71z\"\n />\n <path\n fill=\"#324fff\"\n d=\"M64 192V64l64-64v128zm128 128V192l64-64v128zM0 256V128l64 64z\"\n />\n <path fill=\"#0ff\" d=\"M64 320V192l64 64z\" />\n</svg>`;\n\n/**\n * Root of the Lit DevTools panel — a tabbed shell. Each tab's view is kept\n * mounted and merely hidden when inactive, so the Timeline keeps recording\n * (and holds its events) while another tab is in front.\n */\n@customElement('lit-devtools-panel')\nexport class LitDevtoolsPanel extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: flex;\n flex-direction: column;\n height: 100vh;\n font-family: var(--lit-devtools-font-sans);\n font-size: var(--lit-devtools-text-sm);\n background: var(--lit-devtools-bg);\n color: var(--lit-devtools-text);\n overflow: hidden;\n }\n header {\n display: flex;\n align-items: center;\n gap: var(--lit-devtools-space-6);\n padding: 0 var(--lit-devtools-space-5);\n border-bottom: 1px solid var(--lit-devtools-border);\n background: var(--lit-devtools-surface-low);\n flex-shrink: 0;\n }\n .brand {\n display: flex;\n align-items: center;\n gap: var(--lit-devtools-space-4);\n color: var(--lit-devtools-text-strong);\n font-weight: var(--lit-devtools-weight-bold);\n font-size: var(--lit-devtools-text-xs);\n letter-spacing: var(--lit-devtools-tracking-caps);\n text-transform: uppercase;\n padding: var(--lit-devtools-space-5) 0;\n }\n .brand svg {\n display: block;\n }\n .view {\n display: flex;\n flex-direction: column;\n flex: 1;\n overflow: hidden;\n }\n `,\n ];\n\n @state() private _tab = 'components';\n\n @query('components-view') private _componentsView?: ComponentsView;\n\n private _onTabChange(e: CustomEvent<{value: string}>) {\n this._tab = e.detail.value;\n }\n\n /** A timeline event's \"inspect\" link — open the Components tab on it. */\n private _onInspectElement(e: CustomEvent<{id: number}>) {\n this._tab = 'components';\n // The view is always mounted, so it can select without waiting for render.\n this._componentsView?.selectById(e.detail.id);\n }\n\n /**\n * A component was picked via the overlay inspector — switch to the Components\n * tab and request the parent DevTools shell to bring this dock entry to the\n * front, so the user can see the picked element without having to manually\n * open the Lit panel first.\n */\n private _onInspectorActivate() {\n this._tab = 'components';\n // The panel iframe is same-origin with the Vite DevTools shell — the\n // parent exposes its DevTools client context on\n // window.__VITE_DEVTOOLS_CLIENT_CONTEXT__ (set by @vitejs/devtools's\n // inject.ts). Ask it to select the Lit dock entry so the panel becomes\n // visible.\n try {\n const parent = window.parent;\n if (\n parent &&\n parent !== window &&\n '__VITE_DEVTOOLS_CLIENT_CONTEXT__' in parent\n ) {\n const ctx = (\n parent as unknown as Record<\n string,\n | undefined\n | {docks?: {switchEntry?: (id: string) => Promise<boolean>}}\n >\n ).__VITE_DEVTOOLS_CLIENT_CONTEXT__;\n ctx?.docks?.switchEntry?.('lit-devtools');\n }\n } catch {\n // Cross-origin or not running inside the DevTools shell — ignore.\n }\n }\n\n override render() {\n return html`\n <header>\n <span class=\"brand\">${LIT_LOGO_SVG} Lit DevTools</span>\n <segmented-tabs\n .items=${TABS}\n .value=${this._tab}\n @change=${this._onTabChange}\n ></segmented-tabs>\n </header>\n <div class=\"view\" @inspect-element=${this._onInspectElement}>\n <timeline-view ?hidden=${this._tab !== 'timeline'}></timeline-view>\n <!-- Kept mounted (like the timeline) so an overlay inspect-pick can\n arrive and switch us here even while another tab is in front. -->\n <components-view\n ?hidden=${this._tab !== 'components'}\n @inspector-activate=${this._onInspectorActivate}\n ></components-view>\n ${this._tab === 'settings'\n ? html`<devtools-settings></devtools-settings>`\n : nothing}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'lit-devtools-panel': LitDevtoolsPanel;\n }\n}\n"]}
@@ -1,43 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2026 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- import { LitElement } from 'lit';
7
- import type { TimelineEvent } from '../types/timeline.js';
8
- import type { LayerState } from './timeline-layers.js';
9
- /** Scrollable list of recorded timeline events with an inline detail pane. */
10
- export declare class TimelineEventList extends LitElement {
11
- static styles: import("lit").CSSResult[];
12
- events: TimelineEvent[];
13
- layers: LayerState[];
14
- private _selected;
15
- /** Element id to filter the list to, or null for all elements. */
16
- private _elementFilter;
17
- /** Case-insensitive regex (source text) matched against tag/title/subtitle. */
18
- private _regex;
19
- private readonly _scrollRef;
20
- /** Distinct elements seen in `events`, recomputed only when `events` changes
21
- * (not on every render driven by selection/filter/regex state). */
22
- private _elementsCache;
23
- willUpdate(changed: Map<string, unknown>): void;
24
- updated(changed: Map<string, unknown>): void;
25
- private _colorOf;
26
- private _isVisible;
27
- /** Distinct elements (by stable id) seen across the recorded events. */
28
- private _computeElements;
29
- private _onFilterChange;
30
- /** Ask the panel shell to open the Components tab on this element. */
31
- private _inspect;
32
- private _onRegexInput;
33
- /** Text searched by the regex filter — element tag, title and subtitle. */
34
- private _haystack;
35
- render(): import("lit-html").TemplateResult<1>;
36
- private _renderDetail;
37
- }
38
- declare global {
39
- interface HTMLElementTagNameMap {
40
- 'timeline-event-list': TimelineEventList;
41
- }
42
- }
43
- //# sourceMappingURL=timeline-event-list.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"timeline-event-list.d.ts","sourceRoot":"","sources":["../../../packages/labs/vite-plugin-lit/src/panel/timeline-event-list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,UAAU,EAAqB,MAAM,KAAK,CAAC;AAKnD,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAErD,8EAA8E;AAC9E,qBACa,iBAAkB,SAAQ,UAAU;IAC/C,OAAgB,MAAM,4BAwJpB;IAEuB,MAAM,EAAE,aAAa,EAAE,CAAM;IAC7B,MAAM,EAAE,UAAU,EAAE,CAAM;IAC1C,OAAO,CAAC,SAAS,CAA8B;IACxD,kEAAkE;IACzD,OAAO,CAAC,cAAc,CAAuB;IACtD,+EAA+E;IACtE,OAAO,CAAC,MAAM,CAAM;IAE7B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+B;IAC1D;wEACoE;IACpE,OAAO,CAAC,cAAc,CAAwC;IAErD,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAcxC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAO9C,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,UAAU;IAYlB,wEAAwE;IACxE,OAAO,CAAC,gBAAgB;IAWxB,OAAO,CAAC,eAAe;IAKvB,sEAAsE;IACtE,OAAO,CAAC,QAAQ;IAUhB,OAAO,CAAC,aAAa;IAIrB,2EAA2E;IAC3E,OAAO,CAAC,SAAS;IAIR,MAAM;IA8Ff,OAAO,CAAC,aAAa;CA6DtB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,qBAAqB,EAAE,iBAAiB,CAAC;KAC1C;CACF"}
@@ -1,416 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2026 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
7
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10
- return c > 3 && r && Object.defineProperty(target, key, r), r;
11
- };
12
- import { LitElement, html, css, nothing } from 'lit';
13
- import { customElement, property, state } from 'lit/decorators.js';
14
- import { ref, createRef } from 'lit/directives/ref.js';
15
- import { repeat } from 'lit/directives/repeat.js';
16
- import { tokens } from '../lib/tokens.js';
17
- /** Scrollable list of recorded timeline events with an inline detail pane. */
18
- let TimelineEventList = class TimelineEventList extends LitElement {
19
- constructor() {
20
- super(...arguments);
21
- this.events = [];
22
- this.layers = [];
23
- this._selected = null;
24
- /** Element id to filter the list to, or null for all elements. */
25
- this._elementFilter = null;
26
- /** Case-insensitive regex (source text) matched against tag/title/subtitle. */
27
- this._regex = '';
28
- this._scrollRef = createRef();
29
- /** Distinct elements seen in `events`, recomputed only when `events` changes
30
- * (not on every render driven by selection/filter/regex state). */
31
- this._elementsCache = [];
32
- }
33
- static { this.styles = [
34
- tokens,
35
- css `
36
- :host {
37
- display: flex;
38
- flex-direction: column;
39
- flex: 1;
40
- overflow: hidden;
41
- }
42
- .filterbar {
43
- display: flex;
44
- align-items: center;
45
- gap: var(--lit-devtools-space-3);
46
- padding: var(--lit-devtools-space-2) var(--lit-devtools-space-5);
47
- border-bottom: 1px solid var(--lit-devtools-border);
48
- font-size: var(--lit-devtools-text-2xs);
49
- color: var(--lit-devtools-text-muted);
50
- flex-shrink: 0;
51
- }
52
- .filterbar select {
53
- background: var(--lit-devtools-surface-elevated);
54
- color: var(--lit-devtools-text);
55
- border: 1px solid var(--lit-devtools-border-strong);
56
- border-radius: var(--lit-devtools-radius-sm);
57
- padding: var(--lit-devtools-space-1) var(--lit-devtools-space-3);
58
- font-size: var(--lit-devtools-text-2xs);
59
- font-family: var(--lit-devtools-font-mono);
60
- }
61
- .filterbar input.regex {
62
- background: var(--lit-devtools-surface-elevated);
63
- color: var(--lit-devtools-text);
64
- border: 1px solid var(--lit-devtools-border-strong);
65
- border-radius: var(--lit-devtools-radius-sm);
66
- padding: var(--lit-devtools-space-1) var(--lit-devtools-space-3);
67
- font-size: var(--lit-devtools-text-2xs);
68
- font-family: var(--lit-devtools-font-mono);
69
- min-width: 140px;
70
- }
71
- .filterbar input.regex::placeholder {
72
- color: var(--lit-devtools-text-muted);
73
- }
74
- .filterbar input.regex.invalid {
75
- border-color: var(--lit-devtools-error);
76
- }
77
- .filterbar .count {
78
- margin-left: auto;
79
- color: var(--lit-devtools-text-muted);
80
- }
81
- .scroll {
82
- flex: 1;
83
- overflow-y: auto;
84
- padding: var(--lit-devtools-space-2) 0;
85
- }
86
- .empty {
87
- display: flex;
88
- flex-direction: column;
89
- align-items: center;
90
- justify-content: center;
91
- height: 100%;
92
- gap: var(--lit-devtools-space-4);
93
- color: var(--lit-devtools-text-muted);
94
- font-size: var(--lit-devtools-text-xs);
95
- }
96
- .hint {
97
- font-size: var(--lit-devtools-text-2xs);
98
- color: var(--lit-devtools-text-muted);
99
- }
100
- .row {
101
- display: flex;
102
- align-items: baseline;
103
- gap: var(--lit-devtools-space-4);
104
- padding: var(--lit-devtools-space-2) var(--lit-devtools-space-5);
105
- font-size: var(--lit-devtools-text-2xs);
106
- font-family: var(--lit-devtools-font-mono);
107
- border-bottom: 1px solid var(--lit-devtools-border);
108
- cursor: pointer;
109
- }
110
- .row:hover {
111
- background: var(--lit-devtools-surface-hover);
112
- }
113
- .row.selected {
114
- background: var(--lit-devtools-surface-active);
115
- }
116
- .time {
117
- color: var(--lit-devtools-text-muted);
118
- flex-shrink: 0;
119
- width: 56px;
120
- text-align: right;
121
- }
122
- .dot {
123
- width: 8px;
124
- height: 8px;
125
- border-radius: 50%;
126
- flex-shrink: 0;
127
- margin-top: 2px;
128
- }
129
- .title {
130
- flex: 1;
131
- color: var(--lit-devtools-text);
132
- overflow: hidden;
133
- text-overflow: ellipsis;
134
- white-space: nowrap;
135
- }
136
- .subtitle {
137
- color: var(--lit-devtools-text-muted);
138
- flex-shrink: 0;
139
- max-width: 200px;
140
- overflow: hidden;
141
- text-overflow: ellipsis;
142
- white-space: nowrap;
143
- }
144
- .detail {
145
- border-top: 1px solid var(--lit-devtools-border);
146
- background: var(--lit-devtools-surface-low);
147
- padding: var(--lit-devtools-space-5) var(--lit-devtools-space-5);
148
- font-size: var(--lit-devtools-text-2xs);
149
- font-family: var(--lit-devtools-font-mono);
150
- color: var(--lit-devtools-text-secondary);
151
- flex-shrink: 0;
152
- max-height: 130px;
153
- overflow-y: auto;
154
- }
155
- table {
156
- border-collapse: collapse;
157
- width: 100%;
158
- }
159
- td {
160
- padding: var(--lit-devtools-space-1) var(--lit-devtools-space-4)
161
- var(--lit-devtools-space-1) 0;
162
- vertical-align: top;
163
- }
164
- .key {
165
- color: var(--lit-devtools-text-muted);
166
- white-space: nowrap;
167
- }
168
- .val {
169
- color: var(--lit-devtools-text);
170
- word-break: break-all;
171
- }
172
- a {
173
- color: var(--lit-devtools-accent);
174
- text-decoration: none;
175
- }
176
- a:hover {
177
- text-decoration: underline;
178
- }
179
- .filter-link {
180
- cursor: pointer;
181
- margin-left: var(--lit-devtools-space-4);
182
- font-size: var(--lit-devtools-text-2xs);
183
- }
184
- `,
185
- ]; }
186
- willUpdate(changed) {
187
- if (changed.has('events')) {
188
- this._elementsCache = this._computeElements();
189
- // Drop a stale element filter when its element is no longer in the events
190
- // (e.g. after Clear), otherwise the list would silently show nothing.
191
- if (this._elementFilter !== null &&
192
- !this.events.some((ev) => ev.meta?.elementId === this._elementFilter)) {
193
- this._elementFilter = null;
194
- }
195
- }
196
- }
197
- updated(changed) {
198
- if (changed.has('events')) {
199
- const el = this._scrollRef.value;
200
- if (el)
201
- el.scrollTop = el.scrollHeight;
202
- }
203
- }
204
- _colorOf(layerId) {
205
- const l = this.layers.find((l) => l.id === layerId);
206
- if (!l)
207
- return '#888';
208
- return '#' + l.color.toString(16).padStart(6, '0');
209
- }
210
- _isVisible(ev) {
211
- const l = this.layers.find((l) => l.id === ev.layerId);
212
- if (l && !l.enabled)
213
- return false;
214
- if (this._elementFilter !== null &&
215
- ev.meta?.elementId !== this._elementFilter) {
216
- return false;
217
- }
218
- return true;
219
- }
220
- /** Distinct elements (by stable id) seen across the recorded events. */
221
- _computeElements() {
222
- const seen = new Map();
223
- for (const ev of this.events) {
224
- const id = ev.meta?.elementId;
225
- if (id != null && !seen.has(id)) {
226
- seen.set(id, ev.meta?.tagName ?? 'unknown');
227
- }
228
- }
229
- return [...seen].map(([id, tag]) => ({ id, tag }));
230
- }
231
- _onFilterChange(e) {
232
- const v = e.target.value;
233
- this._elementFilter = v === '' ? null : Number(v);
234
- }
235
- /** Ask the panel shell to open the Components tab on this element. */
236
- _inspect(id) {
237
- this.dispatchEvent(new CustomEvent('inspect-element', {
238
- detail: { id },
239
- bubbles: true,
240
- composed: true,
241
- }));
242
- }
243
- _onRegexInput(e) {
244
- this._regex = e.target.value;
245
- }
246
- /** Text searched by the regex filter — element tag, title and subtitle. */
247
- _haystack(ev) {
248
- return `${ev.meta?.tagName ?? ''} ${ev.title ?? ''} ${ev.subtitle ?? ''}`;
249
- }
250
- render() {
251
- const elements = this._elementsCache;
252
- // Compile the regex once per render; invalid patterns disable the filter
253
- // (rather than hiding everything) and flag the input.
254
- let re = null;
255
- let regexInvalid = false;
256
- if (this._regex !== '') {
257
- try {
258
- re = new RegExp(this._regex, 'i');
259
- }
260
- catch {
261
- regexInvalid = true;
262
- }
263
- }
264
- const visible = this.events.filter((ev) => this._isVisible(ev) && (re === null || re.test(this._haystack(ev))));
265
- return html `
266
- ${this.events.length > 0
267
- ? html `
268
- <div class="filterbar">
269
- ${elements.length > 0
270
- ? html `
271
- <span>Element:</span>
272
- <select @change=${this._onFilterChange}>
273
- <option
274
- value=""
275
- ?selected=${this._elementFilter === null}
276
- >
277
- All elements
278
- </option>
279
- ${elements.map((el) => html `
280
- <option
281
- value=${el.id}
282
- ?selected=${this._elementFilter === el.id}
283
- >
284
- &lt;${el.tag}&gt; #${el.id}
285
- </option>
286
- `)}
287
- </select>
288
- `
289
- : nothing}
290
- <input
291
- class="regex ${regexInvalid ? 'invalid' : ''}"
292
- type="text"
293
- spellcheck="false"
294
- placeholder="filter regex…"
295
- title="Case-insensitive regex matched against element tag, title and subtitle"
296
- .value=${this._regex}
297
- @input=${this._onRegexInput}
298
- />
299
- <span class="count"
300
- >${visible.length} / ${this.events.length}</span
301
- >
302
- </div>
303
- `
304
- : nothing}
305
- <div class="scroll" ${ref(this._scrollRef)}>
306
- ${visible.length === 0
307
- ? html `
308
- <div class="empty">
309
- <span>No events recorded.</span>
310
- <span class="hint"
311
- >Press Record then interact with the page.</span
312
- >
313
- </div>
314
- `
315
- : repeat(visible, (ev) => ev, (ev) => html `
316
- <div
317
- class="row ${this._selected === ev ? 'selected' : ''}"
318
- @click=${() => {
319
- this._selected = ev;
320
- }}
321
- >
322
- <span class="time">${ev.time.toFixed(1)}ms</span>
323
- <span
324
- class="dot"
325
- style=${'background:' + this._colorOf(ev.layerId)}
326
- ></span>
327
- <span class="title">${ev.title ?? ev.layerId}</span>
328
- <span class="subtitle">${ev.subtitle ?? nothing}</span>
329
- </div>
330
- `)}
331
- </div>
332
- ${this._selected ? this._renderDetail(this._selected) : nothing}
333
- `;
334
- }
335
- _renderDetail(ev) {
336
- const { meta } = ev;
337
- const src = meta?.source;
338
- return html `
339
- <div class="detail">
340
- <table>
341
- <tr>
342
- <td class="key">layer</td>
343
- <td class="val">${ev.layerId}</td>
344
- </tr>
345
- <tr>
346
- <td class="key">time</td>
347
- <td class="val">${ev.time.toFixed(3)} ms</td>
348
- </tr>
349
- ${meta?.tagName
350
- ? html `<tr>
351
- <td class="key">element</td>
352
- <td class="val">
353
- &lt;${meta.tagName}&gt; #${meta.elementId}
354
- ${meta.elementId != null
355
- ? html `<a
356
- class="filter-link"
357
- @click=${() => {
358
- this._elementFilter = meta.elementId;
359
- }}
360
- >filter</a
361
- ><a
362
- class="filter-link"
363
- title="Open this element in the Components tab"
364
- @click=${() => this._inspect(meta.elementId)}
365
- >inspect</a
366
- >`
367
- : nothing}
368
- </td>
369
- </tr>`
370
- : nothing}
371
- ${src
372
- ? html `<tr>
373
- <td class="key">source</td>
374
- <td class="val">
375
- <a
376
- href=${'/__lit-open-in-editor?file=' +
377
- encodeURIComponent(src.file) +
378
- '&line=' +
379
- src.line}
380
- target="_blank"
381
- >${src.file}:${src.line}</a
382
- >
383
- </td>
384
- </tr>`
385
- : nothing}
386
- ${ev.data != null
387
- ? html `<tr>
388
- <td class="key">data</td>
389
- <td class="val">${JSON.stringify(ev.data)}</td>
390
- </tr>`
391
- : nothing}
392
- </table>
393
- </div>
394
- `;
395
- }
396
- };
397
- __decorate([
398
- property({ type: Array })
399
- ], TimelineEventList.prototype, "events", void 0);
400
- __decorate([
401
- property({ type: Array })
402
- ], TimelineEventList.prototype, "layers", void 0);
403
- __decorate([
404
- state()
405
- ], TimelineEventList.prototype, "_selected", void 0);
406
- __decorate([
407
- state()
408
- ], TimelineEventList.prototype, "_elementFilter", void 0);
409
- __decorate([
410
- state()
411
- ], TimelineEventList.prototype, "_regex", void 0);
412
- TimelineEventList = __decorate([
413
- customElement('timeline-event-list')
414
- ], TimelineEventList);
415
- export { TimelineEventList };
416
- //# sourceMappingURL=timeline-event-list.js.map