@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 +1 @@
1
- {"version":3,"file":"edge-panel.js","sourceRoot":"","sources":["../../../../packages/labs/vite-plugin-lit/src/lib/runtime/edge-panel.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AAEH,MAAM,QAAQ,GAAG,6BAA6B,CAAC;AAC/C,MAAM,QAAQ,GAAG,0BAA0B,CAAC;AAC5C,0DAA0D;AAC1D,MAAM,GAAG,GAAG,EAAE,CAAC;AACf,yEAAyE;AACzE,MAAM,IAAI,GAAG,CAAC,CAAC;AASf,MAAM,IAAI,GAAe,EAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAC,CAAC;AAEhE,MAAM,SAAS,GAAG,GAAuB,EAAE;IACzC,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC9C,MAAM,IAAI,GAAI,IAAgD,EAAE,UAAU,CAAC;IAC3E,OAAQ,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAwB,IAAI,IAAI,CAAC;AACxE,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,GAAe,EAAE;IACrC,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;IAC1B,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,MAAM,CAAC,GAAG,KAAK,CAAC,qBAAqB,EAAE,CAAC;IACxC,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACjD,+EAA+E;IAC/E,0EAA0E;IAC1E,2EAA2E;IAC3E,WAAW;IACX,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC,WAAW,CAAC;IAChD,MAAM,EAAE,GAAG,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O,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;QACD,QAAQ,EAAE,CAAC;IACb,CAAC,CAAC;IAEF,6EAA6E;IAC7E,+BAA+B;IAC/B,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,MAAM,IAAI,GAAG,GAAG,EAAE;QAChB,MAAM,EAAE,CAAC;QACT,IAAI,CAAC,aAAa,IAAI,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC;YACnC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACxB,CAAC;IACH,CAAC,CAAC;IACF,IAAI,EAAE,CAAC;IAEP,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAE5C,OAAO,GAAG,EAAE;QACV,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC/C,EAAE,CAAC,UAAU,EAAE,CAAC;QAChB,EAAE,CAAC,UAAU,EAAE,CAAC;QAChB,IAAI,GAAG,KAAK,CAAC;YAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Keeps our on-page dev UI (HMR indicator, source-overlay tooltip) clear of the\n * Vite DevTools edge panel so they don't sit on top of it.\n *\n * The panel is `#vite-devtools-edge-panel` inside the open shadow root of the\n * `<vite-devtools-dock-embedded>` host, and only exists while the dock is\n * docked to an edge (it can be moved/resized). We report the inset, in px, that\n * the panel occupies on each viewport edge it touches — plus a small gap — so\n * callers can offset themselves.\n */\n\nconst HOST_TAG = 'vite-devtools-dock-embedded';\nconst PANEL_ID = 'vite-devtools-edge-panel';\n/** Gap to leave between our UI and the devtools panel. */\nconst GAP = 12;\n/** Tolerance (px) for treating the panel as touching a viewport edge. */\nconst EDGE = 2;\n\nexport interface EdgeInsets {\n top: number;\n right: number;\n bottom: number;\n left: number;\n}\n\nconst ZERO: EdgeInsets = {top: 0, right: 0, bottom: 0, left: 0};\n\nconst findPanel = (): HTMLElement | null => {\n const host = document.querySelector(HOST_TAG);\n const root = (host as {shadowRoot?: ShadowRoot | null} | null)?.shadowRoot;\n return (root?.getElementById(PANEL_ID) as HTMLElement | null) ?? null;\n};\n\n/**\n * Inset (px + gap) the docked panel occupies, on the single edge it's docked\n * to. The panel docks to one edge and spans the perpendicular axis fully, so we\n * pick the dock edge from which axis it spans — a full-width panel is docked\n * top/bottom, a full-height one left/right. (Inferring the edge per-side would\n * wrongly flag a full-width bottom panel as also docked left and right.)\n */\nconst computeInsets = (): EdgeInsets => {\n const panel = findPanel();\n if (panel === null) return ZERO;\n const r = panel.getBoundingClientRect();\n if (r.width === 0 || r.height === 0) return ZERO;\n // Use the layout viewport (excludes scrollbars) — a fixed `right:0`/`bottom:0`\n // panel aligns to clientWidth/Height, not innerWidth/Height, so comparing\n // against the latter would miss a full-width panel whenever a scrollbar is\n // present.\n const vw = document.documentElement.clientWidth;\n const vh = document.documentElement.clientHeight;\n const spansWidth = r.left <= EDGE && r.right >= vw - EDGE;\n const spansHeight = r.top <= EDGE && r.bottom >= vh - EDGE;\n const insets = {...ZERO};\n if (spansWidth && !spansHeight) {\n if (r.top <= EDGE) insets.top = r.bottom + GAP;\n else if (r.bottom >= vh - EDGE) insets.bottom = vh - r.top + GAP;\n } else if (spansHeight && !spansWidth) {\n if (r.left <= EDGE) insets.left = r.right + GAP;\n else if (r.right >= vw - EDGE) insets.right = vw - r.left + GAP;\n }\n return insets;\n};\n\n/**\n * Calls `onChange` with the current insets and again whenever they change — the\n * panel being docked/resized/moved, the window resizing, or the devtools\n * mounting after us. Returns a disposer.\n */\nexport const observeEdgeInsets = (\n onChange: (insets: EdgeInsets) => void\n): (() => void) => {\n let raf = 0;\n let last = '';\n let observedPanel: Element | null = null;\n let observingRoot = false;\n\n const emit = () => {\n raf = 0;\n const insets = computeInsets();\n const key = `${insets.top}|${insets.right}|${insets.bottom}|${insets.left}`;\n if (key !== last) {\n last = key;\n onChange(insets);\n }\n };\n const schedule = () => {\n if (raf === 0) raf = requestAnimationFrame(emit);\n };\n\n const ro = new ResizeObserver(schedule);\n // Re-attach on any devtools DOM change (panel mounting, docking to a new edge)\n // then recompute; cheap thanks to the rAF + diff above.\n const mo = new MutationObserver(() => attach());\n\n const attach = () => {\n const host = document.querySelector(HOST_TAG);\n const root = (host as {shadowRoot?: ShadowRoot | null} | null)?.shadowRoot;\n if (root && !observingRoot) {\n observingRoot = true;\n mo.observe(root, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['style', 'class'],\n });\n }\n const panel = findPanel();\n if (panel !== null && panel !== observedPanel) {\n observedPanel = panel;\n ro.observe(panel);\n }\n schedule();\n };\n\n // The devtools host mounts asynchronously; poll until it's present, then let\n // the observers drive updates.\n let tries = 0;\n const poll = () => {\n attach();\n if (!observingRoot && tries++ < 60) {\n setTimeout(poll, 250);\n }\n };\n poll();\n\n window.addEventListener('resize', schedule);\n\n return () => {\n window.removeEventListener('resize', schedule);\n ro.disconnect();\n mo.disconnect();\n if (raf !== 0) cancelAnimationFrame(raf);\n };\n};\n"]}
1
+ {"version":3,"file":"edge-panel.js","sourceRoot":"","sources":["../../src/lib/runtime/edge-panel.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AAEH,MAAM,QAAQ,GAAG,6BAA6B,CAAC;AAC/C,MAAM,QAAQ,GAAG,0BAA0B,CAAC;AAC5C,0DAA0D;AAC1D,MAAM,GAAG,GAAG,EAAE,CAAC;AACf,yEAAyE;AACzE,MAAM,IAAI,GAAG,CAAC,CAAC;AASf,MAAM,IAAI,GAAe,EAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAC,CAAC;AAEhE,MAAM,SAAS,GAAG,GAAuB,EAAE;IACzC,MAAM,IAAI,GAAG,QAAQ,C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IAAI,GAAG,KAAK,CAAC;YAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Keeps our on-page dev UI (HMR indicator, source-overlay tooltip) clear of the\n * Vite DevTools edge panel so they don't sit on top of it.\n *\n * The panel is `#vite-devtools-edge-panel` inside the open shadow root of the\n * `<vite-devtools-dock-embedded>` host, and only exists while the dock is\n * docked to an edge (it can be moved/resized). We report the inset, in px, that\n * the panel occupies on each viewport edge it touches — plus a small gap — so\n * callers can offset themselves.\n */\n\nconst HOST_TAG = 'vite-devtools-dock-embedded';\nconst PANEL_ID = 'vite-devtools-edge-panel';\n/** Gap to leave between our UI and the devtools panel. */\nconst GAP = 12;\n/** Tolerance (px) for treating the panel as touching a viewport edge. */\nconst EDGE = 2;\n\nexport interface EdgeInsets {\n top: number;\n right: number;\n bottom: number;\n left: number;\n}\n\nconst ZERO: EdgeInsets = {top: 0, right: 0, bottom: 0, left: 0};\n\nconst findPanel = (): HTMLElement | null => {\n const host = document.querySelector(HOST_TAG);\n const root = (host as {shadowRoot?: ShadowRoot | null} | null)?.shadowRoot;\n return (root?.getElementById(PANEL_ID) as HTMLElement | null) ?? null;\n};\n\n/**\n * Inset (px + gap) the docked panel occupies, on the single edge it's docked\n * to. The panel docks to one edge and spans the perpendicular axis fully, so we\n * pick the dock edge from which axis it spans — a full-width panel is docked\n * top/bottom, a full-height one left/right. (Inferring the edge per-side would\n * wrongly flag a full-width bottom panel as also docked left and right.)\n */\nconst computeInsets = (): EdgeInsets => {\n const panel = findPanel();\n if (panel === null) return ZERO;\n const r = panel.getBoundingClientRect();\n if (r.width === 0 || r.height === 0) return ZERO;\n // Use the layout viewport (excludes scrollbars) — a fixed `right:0`/`bottom:0`\n // panel aligns to clientWidth/Height, not innerWidth/Height, so comparing\n // against the latter would miss a full-width panel whenever a scrollbar is\n // present.\n const vw = document.documentElement.clientWidth;\n const vh = document.documentElement.clientHeight;\n const spansWidth = r.left <= EDGE && r.right >= vw - EDGE;\n const spansHeight = r.top <= EDGE && r.bottom >= vh - EDGE;\n const insets = {...ZERO};\n if (spansWidth && !spansHeight) {\n if (r.top <= EDGE) insets.top = r.bottom + GAP;\n else if (r.bottom >= vh - EDGE) insets.bottom = vh - r.top + GAP;\n } else if (spansHeight && !spansWidth) {\n if (r.left <= EDGE) insets.left = r.right + GAP;\n else if (r.right >= vw - EDGE) insets.right = vw - r.left + GAP;\n }\n return insets;\n};\n\n/**\n * Calls `onChange` with the current insets and again whenever they change — the\n * panel being docked/resized/moved, the window resizing, or the devtools\n * mounting after us. Returns a disposer.\n */\nexport const observeEdgeInsets = (\n onChange: (insets: EdgeInsets) => void\n): (() => void) => {\n let raf = 0;\n let last = '';\n let observedPanel: Element | null = null;\n let observingRoot = false;\n\n const emit = () => {\n raf = 0;\n const insets = computeInsets();\n const key = `${insets.top}|${insets.right}|${insets.bottom}|${insets.left}`;\n if (key !== last) {\n last = key;\n onChange(insets);\n }\n };\n const schedule = () => {\n if (raf === 0) raf = requestAnimationFrame(emit);\n };\n\n const ro = new ResizeObserver(schedule);\n // Re-attach on any devtools DOM change (panel mounting, docking to a new edge)\n // then recompute; cheap thanks to the rAF + diff above.\n const mo = new MutationObserver(() => attach());\n\n const attach = () => {\n const host = document.querySelector(HOST_TAG);\n const root = (host as {shadowRoot?: ShadowRoot | null} | null)?.shadowRoot;\n if (root && !observingRoot) {\n observingRoot = true;\n mo.observe(root, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['style', 'class'],\n });\n }\n const panel = findPanel();\n if (panel !== null && panel !== observedPanel) {\n observedPanel = panel;\n ro.observe(panel);\n }\n schedule();\n };\n\n // The devtools host mounts asynchronously; poll until it's present, then let\n // the observers drive updates.\n let tries = 0;\n const poll = () => {\n attach();\n if (!observingRoot && tries++ < 60) {\n setTimeout(poll, 250);\n }\n };\n poll();\n\n window.addEventListener('resize', schedule);\n\n return () => {\n window.removeEventListener('resize', schedule);\n ro.disconnect();\n mo.disconnect();\n if (raf !== 0) cancelAnimationFrame(raf);\n };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../../../../packages/labs/vite-plugin-lit/src/lib/runtime/fonts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,qGAAqG,CAAC;AAEzI,kFAAkF;AAClF,eAAO,MAAM,aAAa,oIAA6D,CAAC"}
1
+ {"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/fonts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,qGAAqG,CAAC;AAEzI,kFAAkF;AAClF,eAAO,MAAM,aAAa,oIAA6D,CAAC"}
@@ -15,4 +15,4 @@
15
15
  export const LIT_DEVTOOLS_FONT_MONO = `ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace`;
16
16
  /** `var()` reference to the devtools mono font with the default stack inlined. */
17
17
  export const FONT_MONO_VAR = `var(--lit-devtools-font-mono, ${LIT_DEVTOOLS_FONT_MONO})`;
18
- //# sourceMappingURL=fonts.js.map
18
+ //# sourceMappingURL=fonts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fonts.js","sourceRoot":"","sources":["../../../../packages/labs/vite-plugin-lit/src/lib/runtime/fonts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,kGAAkG,CAAC;AAEzI,kFAAkF;AAClF,MAAM,CAAC,MAAM,aAAa,GAAG,iCAAiC,sBAAsB,GAAG,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Default monospace font stack for the devtools UI (HMR indicator, source\n * overlay). Surfaced through the `--lit-devtools-font-mono` custom property so\n * consumers can override it; this constant is the fallback default, mirroring\n * the `--lit-devtools-radius` convention.\n *\n * The devtools only render code-adjacent text, so monospace is the only stack\n * they need.\n */\nexport const LIT_DEVTOOLS_FONT_MONO = `ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace`;\n\n/** `var()` reference to the devtools mono font with the default stack inlined. */\nexport const FONT_MONO_VAR = `var(--lit-devtools-font-mono, ${LIT_DEVTOOLS_FONT_MONO})`;\n"]}
1
+ {"version":3,"file":"fonts.js","sourceRoot":"","sources":["../../src/lib/runtime/fonts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,kGAAkG,CAAC;AAEzI,kFAAkF;AAClF,MAAM,CAAC,MAAM,aAAa,GAAG,iCAAiC,sBAAsB,GAAG,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Default monospace font stack for the devtools UI (HMR indicator, source\n * overlay). Surfaced through the `--lit-devtools-font-mono` custom property so\n * consumers can override it; this constant is the fallback default, mirroring\n * the `--lit-devtools-radius` convention.\n *\n * The devtools only render code-adjacent text, so monospace is the only stack\n * they need.\n */\nexport const LIT_DEVTOOLS_FONT_MONO = `ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace`;\n\n/** `var()` reference to the devtools mono font with the default stack inlined. */\nexport const FONT_MONO_VAR = `var(--lit-devtools-font-mono, ${LIT_DEVTOOLS_FONT_MONO})`;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"indicator.d.ts","sourceRoot":"","sources":["../../../../packages/labs/vite-plugin-lit/src/lib/runtime/indicator.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
1
+ {"version":3,"file":"indicator.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/indicator.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -8,11 +8,11 @@
8
8
  * Injected by the Vite plugin as an external module so that
9
9
  * `import.meta.hot` is available.
10
10
  */
11
- import { FONT_MONO_VAR } from './fonts.js';
12
- import { FLAME_ICON } from '../icons.js';
13
- import { subscribeOverride } from './overrides.js';
14
- import { observeEdgeInsets } from './edge-panel.js';
15
- import { injectTokens } from '../tokens.js';
11
+ import {FONT_MONO_VAR} from './fonts.js';
12
+ import {FLAME_ICON} from '../icons.js';
13
+ import {subscribeOverride} from './overrides.js';
14
+ import {observeEdgeInsets} from './edge-panel.js';
15
+ import {injectTokens} from '../tokens.js';
16
16
  /**
17
17
  * True when an HMR batch is purely a stylesheet swap — every update is either
18
18
  * a `css-update` or a `js-update` whose accepted module is a `.css` source
@@ -26,31 +26,29 @@ import { injectTokens } from '../tokens.js';
26
26
  * rather than being silently dropped.
27
27
  */
28
28
  function isStyleSwap(data) {
29
- const updates = data?.updates;
30
- if (!Array.isArray(updates) || updates.length === 0)
31
- return false;
32
- return updates.every((u) => {
33
- if (u.type === 'css-update')
34
- return true;
35
- if (u.type === 'js-update') {
36
- return (u.acceptedPath ?? u.path ?? '').split('?')[0].endsWith('.css');
37
- }
38
- return false;
39
- });
29
+ const updates = data?.updates;
30
+ if (!Array.isArray(updates) || updates.length === 0) return false;
31
+ return updates.every((u) => {
32
+ if (u.type === 'css-update') return true;
33
+ if (u.type === 'js-update') {
34
+ return (u.acceptedPath ?? u.path ?? '').split('?')[0].endsWith('.css');
35
+ }
36
+ return false;
37
+ });
40
38
  }
41
39
  class LitDevtoolsIndicator extends HTMLElement {
42
- #initialized = false;
43
- #count = 0;
44
- #container;
45
- #countEl = null;
46
- constructor() {
47
- super();
48
- const root = this.attachShadow({ mode: 'closed' });
49
- // `--idle-op` is the at-rest opacity: 0 (invisible until a pulse) without a
50
- // count, .5 (count stays legible) with one. The count display and idle
51
- // opacity are both driven by the `.with-count` class so the panel can
52
- // toggle the count on/off live (see #setCount).
53
- root.innerHTML = `
40
+ #initialized = false;
41
+ #count = 0;
42
+ #container;
43
+ #countEl = null;
44
+ constructor() {
45
+ super();
46
+ const root = this.attachShadow({mode: 'closed'});
47
+ // `--idle-op` is the at-rest opacity: 0 (invisible until a pulse) without a
48
+ // count, .5 (count stays legible) with one. The count display and idle
49
+ // opacity are both driven by the `.with-count` class so the panel can
50
+ // toggle the count on/off live (see #setCount).
51
+ root.innerHTML = `
54
52
  <style>
55
53
  @keyframes pulse{0%{opacity:var(--idle-op,0)}15%{opacity:1}80%{opacity:1}100%{opacity:var(--idle-op,0)}}
56
54
  :host{
@@ -91,51 +89,50 @@ class LitDevtoolsIndicator extends HTMLElement {
91
89
  </style>
92
90
  <div id="container"><span id="icon">${FLAME_ICON}</span><span id="indicator"><span class="dot"></span><span class="count">0</span></span></div>
93
91
  `;
94
- this.#container = root.getElementById('container');
95
- this.#countEl = root.querySelector('.count');
96
- this.#setCount(this.hasAttribute('count'));
97
- }
98
- /** Show/hide the cumulative update count (and the at-rest opacity). */
99
- #setCount(enabled) {
100
- this.#container.classList.toggle('with-count', enabled);
101
- }
102
- connectedCallback() {
103
- if (this.#initialized)
104
- return;
105
- this.#initialized = true;
106
- injectTokens();
107
- const hot = import.meta.hot;
108
- hot?.on('vite:afterUpdate', (data) => {
109
- // Count only updates that actually re-render/re-execute a component;
110
- // a pure shared-stylesheet swap (?css-sheet / ?raw / ?url adopted sheet)
111
- // restyles in place without re-rendering, so it pulses but doesn't count.
112
- const styleSwap = isStyleSwap(data);
113
- if (!styleSwap && this.#countEl !== null) {
114
- this.#countEl.textContent = String(++this.#count);
115
- }
116
- this.#container.classList.toggle('style-swap', styleSwap);
117
- this.#container.classList.remove('active');
118
- void this.#container.offsetWidth;
119
- this.#container.classList.add('active');
120
- });
121
- // Let the DevTools panel hide/show the indicator and its count live (and
122
- // across reloads).
123
- subscribeOverride(hot, (o) => {
124
- if (o.hmrIndicatorVisible !== undefined) {
125
- this.style.display = o.hmrIndicatorVisible ? '' : 'none';
126
- }
127
- if (o.hmrIndicatorCount !== undefined) {
128
- this.#setCount(o.hmrIndicatorCount);
129
- }
130
- });
131
- // Stay clear of the Vite DevTools edge panel.
132
- observeEdgeInsets((insets) => {
133
- this.style.setProperty('--edge-top', `${insets.top}px`);
134
- this.style.setProperty('--edge-right', `${insets.right}px`);
135
- this.style.setProperty('--edge-bottom', `${insets.bottom}px`);
136
- this.style.setProperty('--edge-left', `${insets.left}px`);
137
- });
138
- }
92
+ this.#container = root.getElementById('container');
93
+ this.#countEl = root.querySelector('.count');
94
+ this.#setCount(this.hasAttribute('count'));
95
+ }
96
+ /** Show/hide the cumulative update count (and the at-rest opacity). */
97
+ #setCount(enabled) {
98
+ this.#container.classList.toggle('with-count', enabled);
99
+ }
100
+ connectedCallback() {
101
+ if (this.#initialized) return;
102
+ this.#initialized = true;
103
+ injectTokens();
104
+ const hot = import.meta.hot;
105
+ hot?.on('vite:afterUpdate', (data) => {
106
+ // Count only updates that actually re-render/re-execute a component;
107
+ // a pure shared-stylesheet swap (?css-sheet / ?raw / ?url adopted sheet)
108
+ // restyles in place without re-rendering, so it pulses but doesn't count.
109
+ const styleSwap = isStyleSwap(data);
110
+ if (!styleSwap && this.#countEl !== null) {
111
+ this.#countEl.textContent = String(++this.#count);
112
+ }
113
+ this.#container.classList.toggle('style-swap', styleSwap);
114
+ this.#container.classList.remove('active');
115
+ void this.#container.offsetWidth;
116
+ this.#container.classList.add('active');
117
+ });
118
+ // Let the DevTools panel hide/show the indicator and its count live (and
119
+ // across reloads).
120
+ subscribeOverride(hot, (o) => {
121
+ if (o.hmrIndicatorVisible !== undefined) {
122
+ this.style.display = o.hmrIndicatorVisible ? '' : 'none';
123
+ }
124
+ if (o.hmrIndicatorCount !== undefined) {
125
+ this.#setCount(o.hmrIndicatorCount);
126
+ }
127
+ });
128
+ // Stay clear of the Vite DevTools edge panel.
129
+ observeEdgeInsets((insets) => {
130
+ this.style.setProperty('--edge-top', `${insets.top}px`);
131
+ this.style.setProperty('--edge-right', `${insets.right}px`);
132
+ this.style.setProperty('--edge-bottom', `${insets.bottom}px`);
133
+ this.style.setProperty('--edge-left', `${insets.left}px`);
134
+ });
135
+ }
139
136
  }
140
137
  customElements.define('lit-devtools-hmr-indicator', LitDevtoolsIndicator);
141
- //# sourceMappingURL=indicator.js.map
138
+ //# sourceMappingURL=indicator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"indicator.js","sourceRoot":"","sources":["../../../../packages/labs/vite-plugin-lit/src/lib/runtime/indicator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AACvC,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAS1C;;;;;;;;;;;GAWG;AACH,SAAS,WAAW,CAAC,IAAa;IAChC,MAAM,OAAO,GAAI,IAA6C,EAAE,OAAO,CAAC;IACxE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAClE,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACzB,IAAI,CAAC,CAAC,IAAI,KAAK,YAAY;YAAE,OAAO,IAAI,CAAC;QACzC,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YAC3B,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC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M,IAAI,CAAC,CAAC;YAC9D,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,aAAa,EAAE,GAAG,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,cAAc,CAAC,MAAM,CAAC,4BAA4B,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Custom element for the HMR update indicator.\n * Injected by the Vite plugin as an external module so that\n * `import.meta.hot` is available.\n */\n\nimport {FONT_MONO_VAR} from './fonts.js';\nimport {FLAME_ICON} from '../icons.js';\nimport {subscribeOverride} from './overrides.js';\nimport {observeEdgeInsets} from './edge-panel.js';\nimport {injectTokens} from '../tokens.js';\n\n/** One entry of a Vite `vite:afterUpdate` payload. */\ninterface ViteUpdate {\n type?: string;\n path?: string;\n acceptedPath?: string;\n}\n\n/**\n * True when an HMR batch is purely a stylesheet swap — every update is either\n * a `css-update` or a `js-update` whose accepted module is a `.css` source\n * (the shared-sheet queries `?css-sheet`/`?raw`/`?url` all accept a `.css`\n * path). Such a batch restyles adopted sheets in place with no re-render.\n *\n * Heuristic: keyed on the accepted path ending in `.css`. Robust for this\n * plugin's own queries; a user hand-wiring `import.meta.hot.accept` on a raw\n * `.css` would also read as a style swap, which is the intended grouping. An\n * empty/missing payload can't be classified, so it counts as a re-render\n * rather than being silently dropped.\n */\nfunction isStyleSwap(data: unknown): boolean {\n const updates = (data as {updates?: ViteUpdate[]} | undefined)?.updates;\n if (!Array.isArray(updates) || updates.length === 0) return false;\n return updates.every((u) => {\n if (u.type === 'css-update') return true;\n if (u.type === 'js-update') {\n return (u.acceptedPath ?? u.path ?? '').split('?')[0].endsWith('.css');\n }\n return false;\n });\n}\n\nclass LitDevtoolsIndicator extends HTMLElement {\n #initialized = false;\n #count = 0;\n #container: HTMLElement;\n #countEl: HTMLElement | null = null;\n\n constructor() {\n super();\n const root = this.attachShadow({mode: 'closed'});\n // `--idle-op` is the at-rest opacity: 0 (invisible until a pulse) without a\n // count, .5 (count stays legible) with one. The count display and idle\n // opacity are both driven by the `.with-count` class so the panel can\n // toggle the count on/off live (see #setCount).\n root.innerHTML = `\n <style>\n @keyframes pulse{0%{opacity:var(--idle-op,0)}15%{opacity:1}80%{opacity:1}100%{opacity:var(--idle-op,0)}}\n :host{\n position:fixed;inset:0;display:grid;\n z-index:2147483647;pointer-events:none;\n /* Base padding plus the inset the Vite DevTools edge panel occupies\n on each edge (set from JS), so the indicator never sits on it. */\n padding:\n calc(var(--lit-devtools-hmr-indicator-padding,16px) + var(--edge-top,0px))\n calc(var(--lit-devtools-hmr-indicator-padding,16px) + var(--edge-right,0px))\n calc(var(--lit-devtools-hmr-indicator-padding,16px) + var(--edge-bottom,0px))\n calc(var(--lit-devtools-hmr-indicator-padding,16px) + var(--edge-left,0px))\n }\n #container{\n place-self:var(--lit-devtools-hmr-indicator-align,end end);\n display:flex;align-items:stretch;\n background:var(--lit-devtools-surface-elevated);color:var(--lit-devtools-text-strong);\n backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);\n border-radius:var(--lit-devtools-radius-md);\n font:12px/1 ${FONT_MONO_VAR};font-variant-numeric:tabular-nums;\n overflow:hidden;opacity:var(--idle-op,0)\n }\n #container.with-count{--idle-op:.5}\n #container.active{animation:pulse 2.5s ease-out forwards}\n #icon{display:flex;align-items:center;justify-content:center;padding:0 10px}\n #icon svg{width:16px;height:16px;display:block;fill:currentColor}\n #indicator{\n display:flex;align-items:center;gap:6px;\n padding:7px 12px;\n border-left:1px solid var(--lit-devtools-border-subtle)\n }\n .dot{width:8px;height:8px;border-radius:50%;background:var(--lit-devtools-success);flex-shrink:0}\n /* Style-only swaps (shared adopted stylesheet hot-swap, no re-render)\n pulse in the calmer info color and don't bump the count. */\n #container.style-swap .dot{background:var(--lit-devtools-info)}\n .count{display:none}\n #container.with-count .count{display:inline}\n </style>\n <div id=\"container\"><span id=\"icon\">${FLAME_ICON}</span><span id=\"indicator\"><span class=\"dot\"></span><span class=\"count\">0</span></span></div>\n `;\n this.#container = root.getElementById('container')!;\n this.#countEl = root.querySelector('.count');\n this.#setCount(this.hasAttribute('count'));\n }\n\n /** Show/hide the cumulative update count (and the at-rest opacity). */\n #setCount(enabled: boolean) {\n this.#container.classList.toggle('with-count', enabled);\n }\n\n connectedCallback() {\n if (this.#initialized) return;\n this.#initialized = true;\n injectTokens();\n const hot = (\n import.meta as {\n hot?: {on: (event: string, cb: (data?: unknown) => void) => void};\n }\n ).hot;\n hot?.on('vite:afterUpdate', (data) => {\n // Count only updates that actually re-render/re-execute a component;\n // a pure shared-stylesheet swap (?css-sheet / ?raw / ?url adopted sheet)\n // restyles in place without re-rendering, so it pulses but doesn't count.\n const styleSwap = isStyleSwap(data);\n if (!styleSwap && this.#countEl !== null) {\n this.#countEl.textContent = String(++this.#count);\n }\n this.#container.classList.toggle('style-swap', styleSwap);\n this.#container.classList.remove('active');\n void this.#container.offsetWidth;\n this.#container.classList.add('active');\n });\n // Let the DevTools panel hide/show the indicator and its count live (and\n // across reloads).\n subscribeOverride(hot, (o) => {\n if (o.hmrIndicatorVisible !== undefined) {\n this.style.display = o.hmrIndicatorVisible ? '' : 'none';\n }\n if (o.hmrIndicatorCount !== undefined) {\n this.#setCount(o.hmrIndicatorCount);\n }\n });\n // Stay clear of the Vite DevTools edge panel.\n observeEdgeInsets((insets) => {\n this.style.setProperty('--edge-top', `${insets.top}px`);\n this.style.setProperty('--edge-right', `${insets.right}px`);\n this.style.setProperty('--edge-bottom', `${insets.bottom}px`);\n this.style.setProperty('--edge-left', `${insets.left}px`);\n });\n }\n}\n\ncustomElements.define('lit-devtools-hmr-indicator', LitDevtoolsIndicator);\n"]}
1
+ {"version":3,"file":"indicator.js","sourceRoot":"","sources":["../../src/lib/runtime/indicator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,OAAO,EAAC,aAAa,EAA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QAC1C,CAAC,CAAC,CAAC;QACH,yEAAyE;QACzE,mBAAmB;QACnB,iBAAiB,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE;YAC3B,IAAI,CAAC,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;gBACxC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;YAC3D,CAAC;YACD,IAAI,CAAC,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;gBACtC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;YACtC,CAAC;QACH,CAAC,CAAC,CAAC;QACH,8CAA8C;QAC9C,iBAAiB,CAAC,CAAC,MAAM,EAAE,EAAE;YAC3B,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,YAAY,EAAE,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;YACxD,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,cAAc,EAAE,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC;YAC5D,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,eAAe,EAAE,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;YAC9D,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,aAAa,EAAE,GAAG,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,cAAc,CAAC,MAAM,CAAC,4BAA4B,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Custom element for the HMR update indicator.\n * Injected by the Vite plugin as an external module so that\n * `import.meta.hot` is available.\n */\n\nimport {FONT_MONO_VAR} from './fonts.js';\nimport {FLAME_ICON} from '../icons.js';\nimport {subscribeOverride} from './overrides.js';\nimport {observeEdgeInsets} from './edge-panel.js';\nimport {injectTokens} from '../tokens.js';\n\n/** One entry of a Vite `vite:afterUpdate` payload. */\ninterface ViteUpdate {\n type?: string;\n path?: string;\n acceptedPath?: string;\n}\n\n/**\n * True when an HMR batch is purely a stylesheet swap — every update is either\n * a `css-update` or a `js-update` whose accepted module is a `.css` source\n * (the shared-sheet queries `?css-sheet`/`?raw`/`?url` all accept a `.css`\n * path). Such a batch restyles adopted sheets in place with no re-render.\n *\n * Heuristic: keyed on the accepted path ending in `.css`. Robust for this\n * plugin's own queries; a user hand-wiring `import.meta.hot.accept` on a raw\n * `.css` would also read as a style swap, which is the intended grouping. An\n * empty/missing payload can't be classified, so it counts as a re-render\n * rather than being silently dropped.\n */\nfunction isStyleSwap(data: unknown): boolean {\n const updates = (data as {updates?: ViteUpdate[]} | undefined)?.updates;\n if (!Array.isArray(updates) || updates.length === 0) return false;\n return updates.every((u) => {\n if (u.type === 'css-update') return true;\n if (u.type === 'js-update') {\n return (u.acceptedPath ?? u.path ?? '').split('?')[0].endsWith('.css');\n }\n return false;\n });\n}\n\nclass LitDevtoolsIndicator extends HTMLElement {\n #initialized = false;\n #count = 0;\n #container: HTMLElement;\n #countEl: HTMLElement | null = null;\n\n constructor() {\n super();\n const root = this.attachShadow({mode: 'closed'});\n // `--idle-op` is the at-rest opacity: 0 (invisible until a pulse) without a\n // count, .5 (count stays legible) with one. The count display and idle\n // opacity are both driven by the `.with-count` class so the panel can\n // toggle the count on/off live (see #setCount).\n root.innerHTML = `\n <style>\n @keyframes pulse{0%{opacity:var(--idle-op,0)}15%{opacity:1}80%{opacity:1}100%{opacity:var(--idle-op,0)}}\n :host{\n position:fixed;inset:0;display:grid;\n z-index:2147483647;pointer-events:none;\n /* Base padding plus the inset the Vite DevTools edge panel occupies\n on each edge (set from JS), so the indicator never sits on it. */\n padding:\n calc(var(--lit-devtools-hmr-indicator-padding,16px) + var(--edge-top,0px))\n calc(var(--lit-devtools-hmr-indicator-padding,16px) + var(--edge-right,0px))\n calc(var(--lit-devtools-hmr-indicator-padding,16px) + var(--edge-bottom,0px))\n calc(var(--lit-devtools-hmr-indicator-padding,16px) + var(--edge-left,0px))\n }\n #container{\n place-self:var(--lit-devtools-hmr-indicator-align,end end);\n display:flex;align-items:stretch;\n background:var(--lit-devtools-surface-elevated);color:var(--lit-devtools-text-strong);\n backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);\n border-radius:var(--lit-devtools-radius-md);\n font:12px/1 ${FONT_MONO_VAR};font-variant-numeric:tabular-nums;\n overflow:hidden;opacity:var(--idle-op,0)\n }\n #container.with-count{--idle-op:.5}\n #container.active{animation:pulse 2.5s ease-out forwards}\n #icon{display:flex;align-items:center;justify-content:center;padding:0 10px}\n #icon svg{width:16px;height:16px;display:block;fill:currentColor}\n #indicator{\n display:flex;align-items:center;gap:6px;\n padding:7px 12px;\n border-left:1px solid var(--lit-devtools-border-subtle)\n }\n .dot{width:8px;height:8px;border-radius:50%;background:var(--lit-devtools-success);flex-shrink:0}\n /* Style-only swaps (shared adopted stylesheet hot-swap, no re-render)\n pulse in the calmer info color and don't bump the count. */\n #container.style-swap .dot{background:var(--lit-devtools-info)}\n .count{display:none}\n #container.with-count .count{display:inline}\n </style>\n <div id=\"container\"><span id=\"icon\">${FLAME_ICON}</span><span id=\"indicator\"><span class=\"dot\"></span><span class=\"count\">0</span></span></div>\n `;\n this.#container = root.getElementById('container')!;\n this.#countEl = root.querySelector('.count');\n this.#setCount(this.hasAttribute('count'));\n }\n\n /** Show/hide the cumulative update count (and the at-rest opacity). */\n #setCount(enabled: boolean) {\n this.#container.classList.toggle('with-count', enabled);\n }\n\n connectedCallback() {\n if (this.#initialized) return;\n this.#initialized = true;\n injectTokens();\n const hot = (\n import.meta as {\n hot?: {on: (event: string, cb: (data?: unknown) => void) => void};\n }\n ).hot;\n hot?.on('vite:afterUpdate', (data) => {\n // Count only updates that actually re-render/re-execute a component;\n // a pure shared-stylesheet swap (?css-sheet / ?raw / ?url adopted sheet)\n // restyles in place without re-rendering, so it pulses but doesn't count.\n const styleSwap = isStyleSwap(data);\n if (!styleSwap && this.#countEl !== null) {\n this.#countEl.textContent = String(++this.#count);\n }\n this.#container.classList.toggle('style-swap', styleSwap);\n this.#container.classList.remove('active');\n void this.#container.offsetWidth;\n this.#container.classList.add('active');\n });\n // Let the DevTools panel hide/show the indicator and its count live (and\n // across reloads).\n subscribeOverride(hot, (o) => {\n if (o.hmrIndicatorVisible !== undefined) {\n this.style.display = o.hmrIndicatorVisible ? '' : 'none';\n }\n if (o.hmrIndicatorCount !== undefined) {\n this.#setCount(o.hmrIndicatorCount);\n }\n });\n // Stay clear of the Vite DevTools edge panel.\n observeEdgeInsets((insets) => {\n this.style.setProperty('--edge-top', `${insets.top}px`);\n this.style.setProperty('--edge-right', `${insets.right}px`);\n this.style.setProperty('--edge-bottom', `${insets.bottom}px`);\n this.style.setProperty('--edge-left', `${insets.left}px`);\n });\n }\n}\n\ncustomElements.define('lit-devtools-hmr-indicator', LitDevtoolsIndicator);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../../../../packages/labs/vite-plugin-lit/src/lib/runtime/inspector/collect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,KAAK,EAEV,gBAAgB,EAEhB,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAsCrC;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,IAAI,OAAO,KAAG,OAO3C,CAAC;AA2CF,wEAAwE;AACxE,eAAO,MAAM,SAAS,QAAO,iBAAiB,EAI7C,CAAC;AAWF,yEAAyE;AACzE,eAAO,MAAM,cAAc,GAAI,IAAI,OAAO,KAAG,gBA6C5C,CAAC"}
1
+ {"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../../src/lib/runtime/inspector/collect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,KAAK,EAEV,gBAAgB,EAEhB,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAsCrC;;;;GAIG;AACH,eAAO,MAAM,aAAa,OAAQ,OAAO,KAAG,OAO3C,CAAC;AA2CF,wEAAwE;AACxE,eAAO,MAAM,SAAS,QAAO,iBAAiB,EAI7C,CAAC;AAWF,yEAAyE;AACzE,eAAO,MAAM,cAAc,OAAQ,OAAO,KAAG,gBA6C5C,CAAC"}
@@ -8,15 +8,15 @@
8
8
  * element's reactive state for the inspector panel. Runs entirely in the page;
9
9
  * the results are sent over the transport as plain JSON.
10
10
  */
11
- import { idOf } from '../timeline/identity.js';
12
- import { serialize, typeTag } from './serialize.js';
11
+ import {idOf} from '../timeline/identity.js';
12
+ import {serialize, typeTag} from './serialize.js';
13
13
  const SOURCE_META_KEY = Symbol.for('@lit-labs/vite-plugin-lit#source');
14
14
  const metaOf = (el) => el.constructor[SOURCE_META_KEY];
15
15
  const sourceOf = (el) => {
16
- const meta = metaOf(el);
17
- return meta === undefined
18
- ? undefined
19
- : { file: meta.filePath, line: meta.lineNumber };
16
+ const meta = metaOf(el);
17
+ return meta === undefined
18
+ ? undefined
19
+ : {file: meta.filePath, line: meta.lineNumber};
20
20
  };
21
21
  /**
22
22
  * An element worth showing in the tree: an upgraded custom element that
@@ -24,25 +24,25 @@ const sourceOf = (el) => {
24
24
  * the source-meta transform touched them, while skipping devtools' own UI.
25
25
  */
26
26
  export const isInspectable = (el) => {
27
- const tag = el.tagName.toLowerCase();
28
- if (!tag.includes('-'))
29
- return false;
30
- if (tag === 'lit-source-overlay' || tag.startsWith('lit-devtools-')) {
31
- return false;
32
- }
33
- return typeof el.requestUpdate === 'function';
27
+ const tag = el.tagName.toLowerCase();
28
+ if (!tag.includes('-')) return false;
29
+ if (tag === 'lit-source-overlay' || tag.startsWith('lit-devtools-')) {
30
+ return false;
31
+ }
32
+ return typeof el.requestUpdate === 'function';
34
33
  };
35
34
  const nodeFor = (el, children) => {
36
- const meta = metaOf(el);
37
- return {
38
- id: idOf(el),
39
- tagName: el.tagName.toLowerCase(),
40
- componentName: meta?.componentName,
41
- source: meta === undefined
42
- ? undefined
43
- : { file: meta.filePath, line: meta.lineNumber },
44
- children,
45
- };
35
+ const meta = metaOf(el);
36
+ return {
37
+ id: idOf(el),
38
+ tagName: el.tagName.toLowerCase(),
39
+ componentName: meta?.componentName,
40
+ source:
41
+ meta === undefined
42
+ ? undefined
43
+ : {file: meta.filePath, line: meta.lineNumber},
44
+ children,
45
+ };
46
46
  };
47
47
  /**
48
48
  * Visits `el`: if it's inspectable it becomes a node whose children are the
@@ -51,82 +51,75 @@ const nodeFor = (el, children) => {
51
51
  * are flattened away).
52
52
  */
53
53
  const visit = (el, sink) => {
54
- if (isInspectable(el)) {
55
- const children = [];
56
- descend(el, children);
57
- sink.push(nodeFor(el, children));
58
- }
59
- else {
60
- descend(el, sink);
61
- }
54
+ if (isInspectable(el)) {
55
+ const children = [];
56
+ descend(el, children);
57
+ sink.push(nodeFor(el, children));
58
+ } else {
59
+ descend(el, sink);
60
+ }
62
61
  };
63
62
  const descend = (el, sink) => {
64
- const shadow = el.shadowRoot;
65
- if (shadow !== null) {
66
- for (const child of shadow.children)
67
- visit(child, sink);
68
- }
69
- for (const child of el.children)
70
- visit(child, sink);
63
+ const shadow = el.shadowRoot;
64
+ if (shadow !== null) {
65
+ for (const child of shadow.children) visit(child, sink);
66
+ }
67
+ for (const child of el.children) visit(child, sink);
71
68
  };
72
69
  /** Build the full component render tree rooted at the document body. */
73
70
  export const buildTree = () => {
74
- const roots = [];
75
- for (const child of document.body.children)
76
- visit(child, roots);
77
- return roots;
71
+ const roots = [];
72
+ for (const child of document.body.children) visit(child, roots);
73
+ return roots;
78
74
  };
79
75
  const attributeName = (key, decl) => {
80
- if (decl.attribute === false)
81
- return false;
82
- if (typeof decl.attribute === 'string')
83
- return decl.attribute;
84
- return String(key).toLowerCase();
76
+ if (decl.attribute === false) return false;
77
+ if (typeof decl.attribute === 'string') return decl.attribute;
78
+ return String(key).toLowerCase();
85
79
  };
86
80
  /** Snapshot one element's reactive properties, attributes, and flags. */
87
81
  export const collectDetails = (el) => {
88
- const re = el;
89
- const declarations = re.constructor.elementProperties;
90
- const properties = [];
91
- if (declarations !== undefined) {
92
- for (const [key, decl] of declarations) {
93
- // Reading a reactive property runs its accessor, which may throw; one bad
94
- // getter must not take out the whole details snapshot.
95
- let value;
96
- let threw = false;
97
- try {
98
- value = el[key];
99
- }
100
- catch {
101
- threw = true;
102
- }
103
- properties.push({
104
- name: typeof key === 'symbol' ? key.toString() : String(key),
105
- value: threw ? '[getter threw]' : serialize(value),
106
- type: threw ? 'error' : typeTag(value),
107
- attribute: attributeName(key, decl),
108
- reflects: decl.reflect === true,
109
- state: decl.state === true,
110
- });
111
- }
82
+ const re = el;
83
+ const declarations = re.constructor.elementProperties;
84
+ const properties = [];
85
+ if (declarations !== undefined) {
86
+ for (const [key, decl] of declarations) {
87
+ // Reading a reactive property runs its accessor, which may throw; one bad
88
+ // getter must not take out the whole details snapshot.
89
+ let value;
90
+ let threw = false;
91
+ try {
92
+ value = el[key];
93
+ } catch {
94
+ threw = true;
95
+ }
96
+ properties.push({
97
+ name: typeof key === 'symbol' ? key.toString() : String(key),
98
+ value: threw ? '[getter threw]' : serialize(value),
99
+ type: threw ? 'error' : typeTag(value),
100
+ attribute: attributeName(key, decl),
101
+ reflects: decl.reflect === true,
102
+ state: decl.state === true,
103
+ });
112
104
  }
113
- const attributes = Array.from(el.attributes, (a) => ({
114
- name: a.name,
115
- value: a.value,
116
- }));
117
- const meta = metaOf(el);
118
- return {
119
- id: idOf(el),
120
- tagName: el.tagName.toLowerCase(),
121
- componentName: meta?.componentName,
122
- source: sourceOf(el),
123
- attributes,
124
- properties,
125
- flags: {
126
- hasUpdated: re.hasUpdated === true,
127
- isUpdatePending: re.isUpdatePending === true,
128
- hasShadowRoot: el.shadowRoot !== null,
129
- },
130
- };
105
+ }
106
+ const attributes = Array.from(el.attributes, (a) => ({
107
+ name: a.name,
108
+ value: a.value,
109
+ }));
110
+ const meta = metaOf(el);
111
+ return {
112
+ id: idOf(el),
113
+ tagName: el.tagName.toLowerCase(),
114
+ componentName: meta?.componentName,
115
+ source: sourceOf(el),
116
+ attributes,
117
+ properties,
118
+ flags: {
119
+ hasUpdated: re.hasUpdated === true,
120
+ isUpdatePending: re.isUpdatePending === true,
121
+ hasShadowRoot: el.shadowRoot !== null,
122
+ },
123
+ };
131
124
  };
132
- //# sourceMappingURL=collect.js.map
125
+ //# sourceMappingURL=collect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"collect.js","sourceRoot":"","sources":["../../../../../packages/labs/vite-plugin-lit/src/lib/runtime/inspector/collect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,OAAO,EAAC,IAAI,EAAC,MAAM,yBAAyB,CAAC;AAC7C,OAAO,EAAC,SAAS,EAAE,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAQlD,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AA0BvE,MAAM,MAAM,GAAG,CAAC,EAAW,EAA6B,EAAE,CACvD,EAA0B,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;AAE3D,MAAM,QAAQ,GAAG,CAAC,EAAW,EAA6B,EAAE;IAC1D,MAAM,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;IACxB,OAAO,IAAI,KAAK,SAAS;QACvB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,EAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,UAAU,EAAC,CAAC;AACnD,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAW,EAAW,EAAE;IACpD,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IACrC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAC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SACtC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Walks the page to build the component render tree and to snapshot a single\n * element's reactive state for the inspector panel. Runs entirely in the page;\n * the results are sent over the transport as plain JSON.\n */\n\nimport {idOf} from '../timeline/identity.js';\nimport {serialize, typeTag} from './serialize.js';\nimport type {\n ElementSource,\n InspectorDetails,\n InspectorProp,\n InspectorTreeNode,\n} from '../../../types/inspector.js';\n\nconst SOURCE_META_KEY = Symbol.for('@lit-labs/vite-plugin-lit#source');\n\ninterface LitSourceMeta {\n filePath: string;\n lineNumber: number;\n componentName: string;\n}\n\n/** Subset of ReactiveElement's `PropertyDeclaration` we read. */\ninterface PropertyDeclaration {\n attribute?: boolean | string;\n reflect?: boolean;\n state?: boolean;\n}\n\n/** Subset of a ReactiveElement instance/constructor we duck-type against. */\ninterface ReactiveElementLike extends Element {\n requestUpdate?: unknown;\n hasUpdated?: boolean;\n isUpdatePending?: boolean;\n constructor: {\n elementProperties?: Map<PropertyKey, PropertyDeclaration>;\n [SOURCE_META_KEY]?: LitSourceMeta;\n };\n}\n\nconst metaOf = (el: Element): LitSourceMeta | undefined =>\n (el as ReactiveElementLike).constructor[SOURCE_META_KEY];\n\nconst sourceOf = (el: Element): ElementSource | undefined => {\n const meta = metaOf(el);\n return meta === undefined\n ? undefined\n : {file: meta.filePath, line: meta.lineNumber};\n};\n\n/**\n * An element worth showing in the tree: an upgraded custom element that\n * duck-types as a ReactiveElement. Catches Lit components regardless of whether\n * the source-meta transform touched them, while skipping devtools' own UI.\n */\nexport const isInspectable = (el: Element): boolean => {\n const tag = el.tagName.toLowerCase();\n if (!tag.includes('-')) return false;\n if (tag === 'lit-source-overlay' || tag.startsWith('lit-devtools-')) {\n return false;\n }\n return typeof (el as ReactiveElementLike).requestUpdate === 'function';\n};\n\nconst nodeFor = (\n el: Element,\n children: InspectorTreeNode[]\n): InspectorTreeNode => {\n const meta = metaOf(el);\n return {\n id: idOf(el),\n tagName: el.tagName.toLowerCase(),\n componentName: meta?.componentName,\n source:\n meta === undefined\n ? undefined\n : {file: meta.filePath, line: meta.lineNumber},\n children,\n };\n};\n\n/**\n * Visits `el`: if it's inspectable it becomes a node whose children are the\n * inspectables nested in its shadow + light DOM; otherwise we descend, pushing\n * any inspectables we find into the current `sink` (so non-component wrappers\n * are flattened away).\n */\nconst visit = (el: Element, sink: InspectorTreeNode[]): void => {\n if (isInspectable(el)) {\n const children: InspectorTreeNode[] = [];\n descend(el, children);\n sink.push(nodeFor(el, children));\n } else {\n descend(el, sink);\n }\n};\n\nconst descend = (el: Element, sink: InspectorTreeNode[]): void => {\n const shadow = el.shadowRoot;\n if (shadow !== null) {\n for (const child of shadow.children) visit(child, sink);\n }\n for (const child of el.children) visit(child, sink);\n};\n\n/** Build the full component render tree rooted at the document body. */\nexport const buildTree = (): InspectorTreeNode[] => {\n const roots: InspectorTreeNode[] = [];\n for (const child of document.body.children) visit(child, roots);\n return roots;\n};\n\nconst attributeName = (\n key: PropertyKey,\n decl: PropertyDeclaration\n): string | false => {\n if (decl.attribute === false) return false;\n if (typeof decl.attribute === 'string') return decl.attribute;\n return String(key).toLowerCase();\n};\n\n/** Snapshot one element's reactive properties, attributes, and flags. */\nexport const collectDetails = (el: Element): InspectorDetails => {\n const re = el as ReactiveElementLike;\n const declarations = re.constructor.elementProperties;\n const properties: InspectorProp[] = [];\n if (declarations !== undefined) {\n for (const [key, decl] of declarations) {\n // Reading a reactive property runs its accessor, which may throw; one bad\n // getter must not take out the whole details snapshot.\n let value: unknown;\n let threw = false;\n try {\n value = (el as unknown as Record<PropertyKey, unknown>)[key];\n } catch {\n threw = true;\n }\n properties.push({\n name: typeof key === 'symbol' ? key.toString() : String(key),\n value: threw ? '[getter threw]' : serialize(value),\n type: threw ? 'error' : typeTag(value),\n attribute: attributeName(key, decl),\n reflects: decl.reflect === true,\n state: decl.state === true,\n });\n }\n }\n\n const attributes = Array.from(el.attributes, (a) => ({\n name: a.name,\n value: a.value,\n }));\n\n const meta = metaOf(el);\n return {\n id: idOf(el),\n tagName: el.tagName.toLowerCase(),\n componentName: meta?.componentName,\n source: sourceOf(el),\n attributes,\n properties,\n flags: {\n hasUpdated: re.hasUpdated === true,\n isUpdatePending: re.isUpdatePending === true,\n hasShadowRoot: el.shadowRoot !== null,\n },\n };\n};\n"]}
1
+ {"version":3,"file":"collect.js","sourceRoot":"","sources":["../../../src/lib/runtime/inspector/collect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,OAAO,EAAC,IAAI,EAAC,MAAM,yBAAyB,CAAC;AAC7C,OAAO,EAAC,SAAS,EAAE,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAQlD,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AA0BvE,MAAM,MAAM,GAAG,CAAC,EAAW,EAA6B,EAAE,CACvD,EAA0B,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;AAE3D,MAAM,QAAQ,GAAG,CAAC,EAAW,EAA6B,EAAE;IAC1D,MAAM,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;IACxB,OAAO,IAAI,KAAK,SAAS;QACvB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,EAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,UAAU,EAAC,CAAC;AACnD,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAW,EAAW,EAAE;IACpD,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IACrC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,IAAI,GAAG,KAAK,oBAAoB,IAAI,GAAG,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,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DX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Walks the page to build the component render tree and to snapshot a single\n * element's reactive state for the inspector panel. Runs entirely in the page;\n * the results are sent over the transport as plain JSON.\n */\n\nimport {idOf} from '../timeline/identity.js';\nimport {serialize, typeTag} from './serialize.js';\nimport type {\n ElementSource,\n InspectorDetails,\n InspectorProp,\n InspectorTreeNode,\n} from '../../../types/inspector.js';\n\nconst SOURCE_META_KEY = Symbol.for('@lit-labs/vite-plugin-lit#source');\n\ninterface LitSourceMeta {\n filePath: string;\n lineNumber: number;\n componentName: string;\n}\n\n/** Subset of ReactiveElement's `PropertyDeclaration` we read. */\ninterface PropertyDeclaration {\n attribute?: boolean | string;\n reflect?: boolean;\n state?: boolean;\n}\n\n/** Subset of a ReactiveElement instance/constructor we duck-type against. */\ninterface ReactiveElementLike extends Element {\n requestUpdate?: unknown;\n hasUpdated?: boolean;\n isUpdatePending?: boolean;\n constructor: {\n elementProperties?: Map<PropertyKey, PropertyDeclaration>;\n [SOURCE_META_KEY]?: LitSourceMeta;\n };\n}\n\nconst metaOf = (el: Element): LitSourceMeta | undefined =>\n (el as ReactiveElementLike).constructor[SOURCE_META_KEY];\n\nconst sourceOf = (el: Element): ElementSource | undefined => {\n const meta = metaOf(el);\n return meta === undefined\n ? undefined\n : {file: meta.filePath, line: meta.lineNumber};\n};\n\n/**\n * An element worth showing in the tree: an upgraded custom element that\n * duck-types as a ReactiveElement. Catches Lit components regardless of whether\n * the source-meta transform touched them, while skipping devtools' own UI.\n */\nexport const isInspectable = (el: Element): boolean => {\n const tag = el.tagName.toLowerCase();\n if (!tag.includes('-')) return false;\n if (tag === 'lit-source-overlay' || tag.startsWith('lit-devtools-')) {\n return false;\n }\n return typeof (el as ReactiveElementLike).requestUpdate === 'function';\n};\n\nconst nodeFor = (\n el: Element,\n children: InspectorTreeNode[]\n): InspectorTreeNode => {\n const meta = metaOf(el);\n return {\n id: idOf(el),\n tagName: el.tagName.toLowerCase(),\n componentName: meta?.componentName,\n source:\n meta === undefined\n ? undefined\n : {file: meta.filePath, line: meta.lineNumber},\n children,\n };\n};\n\n/**\n * Visits `el`: if it's inspectable it becomes a node whose children are the\n * inspectables nested in its shadow + light DOM; otherwise we descend, pushing\n * any inspectables we find into the current `sink` (so non-component wrappers\n * are flattened away).\n */\nconst visit = (el: Element, sink: InspectorTreeNode[]): void => {\n if (isInspectable(el)) {\n const children: InspectorTreeNode[] = [];\n descend(el, children);\n sink.push(nodeFor(el, children));\n } else {\n descend(el, sink);\n }\n};\n\nconst descend = (el: Element, sink: InspectorTreeNode[]): void => {\n const shadow = el.shadowRoot;\n if (shadow !== null) {\n for (const child of shadow.children) visit(child, sink);\n }\n for (const child of el.children) visit(child, sink);\n};\n\n/** Build the full component render tree rooted at the document body. */\nexport const buildTree = (): InspectorTreeNode[] => {\n const roots: InspectorTreeNode[] = [];\n for (const child of document.body.children) visit(child, roots);\n return roots;\n};\n\nconst attributeName = (\n key: PropertyKey,\n decl: PropertyDeclaration\n): string | false => {\n if (decl.attribute === false) return false;\n if (typeof decl.attribute === 'string') return decl.attribute;\n return String(key).toLowerCase();\n};\n\n/** Snapshot one element's reactive properties, attributes, and flags. */\nexport const collectDetails = (el: Element): InspectorDetails => {\n const re = el as ReactiveElementLike;\n const declarations = re.constructor.elementProperties;\n const properties: InspectorProp[] = [];\n if (declarations !== undefined) {\n for (const [key, decl] of declarations) {\n // Reading a reactive property runs its accessor, which may throw; one bad\n // getter must not take out the whole details snapshot.\n let value: unknown;\n let threw = false;\n try {\n value = (el as unknown as Record<PropertyKey, unknown>)[key];\n } catch {\n threw = true;\n }\n properties.push({\n name: typeof key === 'symbol' ? key.toString() : String(key),\n value: threw ? '[getter threw]' : serialize(value),\n type: threw ? 'error' : typeTag(value),\n attribute: attributeName(key, decl),\n reflects: decl.reflect === true,\n state: decl.state === true,\n });\n }\n }\n\n const attributes = Array.from(el.attributes, (a) => ({\n name: a.name,\n value: a.value,\n }));\n\n const meta = metaOf(el);\n return {\n id: idOf(el),\n tagName: el.tagName.toLowerCase(),\n componentName: meta?.componentName,\n source: sourceOf(el),\n attributes,\n properties,\n flags: {\n hasUpdated: re.hasUpdated === true,\n isUpdatePending: re.isUpdatePending === true,\n hasShadowRoot: el.shadowRoot !== null,\n },\n };\n};\n"]}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ /** Draw the outline over `el`. */
7
+ export declare const showHighlight: (el: Element) => void;
8
+ /** Hide the outline. Cheap and safe before the box has ever been built. */
9
+ export declare const clearHighlight: () => void;
10
+ /**
11
+ * Outline the element with this id, or clear it for `null` — and also when
12
+ * the id no longer resolves, since a stale outline over the wrong element is
13
+ * worse than none.
14
+ */
15
+ export declare const highlightById: (id: number | null) => void;
16
+ //# sourceMappingURL=highlight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../../../src/lib/runtime/inspector/highlight.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqCH,kCAAkC;AAClC,eAAO,MAAM,aAAa,OAAQ,OAAO,KAAG,IAS3C,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,cAAc,QAAO,IAEjC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,OAAQ,MAAM,GAAG,IAAI,KAAG,IAQjD,CAAC"}