@oddsquad/vite-plugin-lit 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/LICENSE +1 -1
- package/README.md +14 -7
- package/bin.mjs +2 -8
- package/client.d.ts +0 -6
- package/dist/client/assets/{browser-agent-rpc-BXhoSh1z-BuCvPGjS.js → browser-agent-rpc-BXhoSh1z-ybEeG-x9.js} +2 -2
- package/dist/client/assets/{browser-agent-rpc-BXhoSh1z-BuCvPGjS.js.map → browser-agent-rpc-BXhoSh1z-ybEeG-x9.js.map} +1 -1
- package/dist/client/assets/{index-D632jo79.js → index-CgkhETVR.js} +2 -144
- package/dist/client/assets/index-CgkhETVR.js.map +1 -0
- package/dist/client/index.html +1 -1
- package/dist/standalone/lit-devtools.js +2 -105
- package/index.d.ts +0 -5
- package/index.d.ts.map +1 -1
- package/index.js +1 -5
- package/index.js.map +1 -1
- package/lib/color-scheme.d.ts +0 -5
- package/lib/color-scheme.d.ts.map +1 -1
- package/lib/color-scheme.js +0 -5
- package/lib/color-scheme.js.map +1 -1
- package/lib/confine.d.ts +0 -5
- package/lib/confine.d.ts.map +1 -1
- package/lib/confine.js +0 -5
- package/lib/confine.js.map +1 -1
- package/lib/devframe/allowed-origins.d.ts +11 -3
- package/lib/devframe/allowed-origins.d.ts.map +1 -1
- package/lib/devframe/allowed-origins.js +0 -5
- package/lib/devframe/allowed-origins.js.map +1 -1
- package/lib/devframe/definition.d.ts +7 -3
- package/lib/devframe/definition.d.ts.map +1 -1
- package/lib/devframe/definition.js +1 -6
- package/lib/devframe/definition.js.map +1 -1
- package/lib/devframe/icon.d.ts +0 -5
- package/lib/devframe/icon.d.ts.map +1 -1
- package/lib/devframe/icon.js +0 -5
- package/lib/devframe/icon.js.map +1 -1
- package/lib/devframe/launch-editor.d.ts +0 -5
- package/lib/devframe/launch-editor.d.ts.map +1 -1
- package/lib/devframe/launch-editor.js +0 -5
- package/lib/devframe/launch-editor.js.map +1 -1
- package/lib/devframe/paths.d.ts +8 -3
- package/lib/devframe/paths.d.ts.map +1 -1
- package/lib/devframe/paths.js +0 -5
- package/lib/devframe/paths.js.map +1 -1
- package/lib/devframe/protocol.d.ts +6 -3
- package/lib/devframe/protocol.d.ts.map +1 -1
- package/lib/devframe/protocol.js +0 -5
- package/lib/devframe/protocol.js.map +1 -1
- package/lib/devframe/rpc-source.d.ts +15 -3
- package/lib/devframe/rpc-source.d.ts.map +1 -1
- package/lib/devframe/rpc-source.js +0 -5
- package/lib/devframe/rpc-source.js.map +1 -1
- package/lib/devframe/source.d.ts +0 -5
- package/lib/devframe/source.d.ts.map +1 -1
- package/lib/devframe/source.js +7 -3
- package/lib/devframe/source.js.map +1 -1
- package/lib/devframe/vite.d.ts +0 -5
- package/lib/devframe/vite.d.ts.map +1 -1
- package/lib/devframe/vite.js +16 -3
- package/lib/devframe/vite.js.map +1 -1
- package/lib/http.d.ts +0 -5
- package/lib/http.d.ts.map +1 -1
- package/lib/http.js +0 -5
- package/lib/http.js.map +1 -1
- package/lib/icons.d.ts +0 -5
- package/lib/icons.d.ts.map +1 -1
- package/lib/icons.js +0 -5
- package/lib/icons.js.map +1 -1
- package/lib/options.d.ts +0 -5
- package/lib/options.d.ts.map +1 -1
- package/lib/options.js +0 -5
- package/lib/options.js.map +1 -1
- package/lib/override-baselines.d.ts +0 -5
- package/lib/override-baselines.d.ts.map +1 -1
- package/lib/override-baselines.js +0 -5
- package/lib/override-baselines.js.map +1 -1
- package/lib/plugin.d.ts +0 -5
- package/lib/plugin.d.ts.map +1 -1
- package/lib/plugin.js +0 -5
- package/lib/plugin.js.map +1 -1
- package/lib/plugins/css-literals.d.ts +0 -5
- package/lib/plugins/css-literals.d.ts.map +1 -1
- package/lib/plugins/css-literals.js +0 -5
- package/lib/plugins/css-literals.js.map +1 -1
- package/lib/plugins/css-queries.d.ts +0 -5
- package/lib/plugins/css-queries.d.ts.map +1 -1
- package/lib/plugins/css-queries.js +0 -5
- package/lib/plugins/css-queries.js.map +1 -1
- package/lib/plugins/open-in-editor.d.ts +0 -5
- package/lib/plugins/open-in-editor.d.ts.map +1 -1
- package/lib/plugins/open-in-editor.js +0 -5
- package/lib/plugins/open-in-editor.js.map +1 -1
- package/lib/plugins/private-fields.d.ts +0 -5
- package/lib/plugins/private-fields.d.ts.map +1 -1
- package/lib/plugins/private-fields.js +0 -5
- package/lib/plugins/private-fields.js.map +1 -1
- package/lib/plugins/shared.d.ts +0 -5
- package/lib/plugins/shared.d.ts.map +1 -1
- package/lib/plugins/shared.js +0 -5
- package/lib/plugins/shared.js.map +1 -1
- package/lib/plugins/timeline-virtual.d.ts +0 -5
- package/lib/plugins/timeline-virtual.d.ts.map +1 -1
- package/lib/plugins/timeline-virtual.js +0 -5
- package/lib/plugins/timeline-virtual.js.map +1 -1
- package/lib/runtime/child-state.d.ts +0 -5
- package/lib/runtime/child-state.d.ts.map +1 -1
- package/lib/runtime/child-state.js +18 -3
- package/lib/runtime/child-state.js.map +1 -1
- package/lib/runtime/css.d.ts +14 -3
- package/lib/runtime/css.d.ts.map +1 -1
- package/lib/runtime/css.js +3 -5
- package/lib/runtime/css.js.map +1 -1
- package/lib/runtime/edge-panel.d.ts +8 -3
- package/lib/runtime/edge-panel.d.ts.map +1 -1
- package/lib/runtime/edge-panel.js +0 -5
- package/lib/runtime/edge-panel.js.map +1 -1
- package/lib/runtime/fonts.d.ts +0 -5
- package/lib/runtime/fonts.d.ts.map +1 -1
- package/lib/runtime/fonts.js +0 -5
- package/lib/runtime/fonts.js.map +1 -1
- package/lib/runtime/indicator.d.ts +3 -3
- package/lib/runtime/indicator.js +0 -5
- package/lib/runtime/indicator.js.map +1 -1
- package/lib/runtime/inspector/collect.d.ts +3 -3
- package/lib/runtime/inspector/collect.d.ts.map +1 -1
- package/lib/runtime/inspector/collect.js +0 -5
- package/lib/runtime/inspector/collect.js.map +1 -1
- package/lib/runtime/inspector/highlight.d.ts +10 -3
- package/lib/runtime/inspector/highlight.d.ts.map +1 -1
- package/lib/runtime/inspector/highlight.js +0 -5
- package/lib/runtime/inspector/highlight.js.map +1 -1
- package/lib/runtime/inspector/install.d.ts +6 -3
- package/lib/runtime/inspector/install.d.ts.map +1 -1
- package/lib/runtime/inspector/install.js +0 -5
- package/lib/runtime/inspector/install.js.map +1 -1
- package/lib/runtime/inspector/serialize.d.ts +4 -3
- package/lib/runtime/inspector/serialize.d.ts.map +1 -1
- package/lib/runtime/inspector/serialize.js +0 -5
- package/lib/runtime/inspector/serialize.js.map +1 -1
- package/lib/runtime/intern.d.ts +11 -3
- package/lib/runtime/intern.d.ts.map +1 -1
- package/lib/runtime/intern.js +11 -3
- package/lib/runtime/intern.js.map +1 -1
- package/lib/runtime/overrides.d.ts +3 -3
- package/lib/runtime/overrides.d.ts.map +1 -1
- package/lib/runtime/overrides.js +0 -5
- package/lib/runtime/overrides.js.map +1 -1
- package/lib/runtime/page-channel.d.ts +0 -5
- package/lib/runtime/page-channel.d.ts.map +1 -1
- package/lib/runtime/page-channel.js +13 -3
- package/lib/runtime/page-channel.js.map +1 -1
- package/lib/runtime/patch.d.ts +0 -5
- package/lib/runtime/patch.d.ts.map +1 -1
- package/lib/runtime/patch.js +0 -5
- package/lib/runtime/patch.js.map +1 -1
- package/lib/runtime/rpc-transport.d.ts +13 -3
- package/lib/runtime/rpc-transport.d.ts.map +1 -1
- package/lib/runtime/rpc-transport.js +3 -5
- package/lib/runtime/rpc-transport.js.map +1 -1
- package/lib/runtime/source-meta.d.ts +0 -5
- package/lib/runtime/source-meta.d.ts.map +1 -1
- package/lib/runtime/source-meta.js +0 -5
- package/lib/runtime/source-meta.js.map +1 -1
- package/lib/runtime/source-overlay/editors.d.ts +0 -5
- package/lib/runtime/source-overlay/editors.d.ts.map +1 -1
- package/lib/runtime/source-overlay/editors.js +0 -5
- package/lib/runtime/source-overlay/editors.js.map +1 -1
- package/lib/runtime/source-overlay/mask-path.d.ts +0 -5
- package/lib/runtime/source-overlay/mask-path.d.ts.map +1 -1
- package/lib/runtime/source-overlay/mask-path.js +0 -5
- package/lib/runtime/source-overlay/mask-path.js.map +1 -1
- package/lib/runtime/source-overlay/overlay-element.d.ts +0 -5
- package/lib/runtime/source-overlay/overlay-element.d.ts.map +1 -1
- package/lib/runtime/source-overlay/overlay-element.js +0 -5
- package/lib/runtime/source-overlay/overlay-element.js.map +1 -1
- package/lib/runtime/source-overlay/source-host.d.ts +0 -5
- package/lib/runtime/source-overlay/source-host.d.ts.map +1 -1
- package/lib/runtime/source-overlay/source-host.js +0 -5
- package/lib/runtime/source-overlay/source-host.js.map +1 -1
- package/lib/runtime/source-overlay/template.d.ts +0 -5
- package/lib/runtime/source-overlay/template.d.ts.map +1 -1
- package/lib/runtime/source-overlay/template.js +0 -5
- package/lib/runtime/source-overlay/template.js.map +1 -1
- package/lib/runtime/source-overlay.d.ts +0 -5
- package/lib/runtime/source-overlay.d.ts.map +1 -1
- package/lib/runtime/source-overlay.js +0 -5
- package/lib/runtime/source-overlay.js.map +1 -1
- package/lib/runtime/standalone.d.ts +0 -5
- package/lib/runtime/standalone.d.ts.map +1 -1
- package/lib/runtime/standalone.js +0 -5
- package/lib/runtime/standalone.js.map +1 -1
- package/lib/runtime/timeline/chrome-tracks.d.ts +0 -5
- package/lib/runtime/timeline/chrome-tracks.d.ts.map +1 -1
- package/lib/runtime/timeline/chrome-tracks.js +5 -3
- package/lib/runtime/timeline/chrome-tracks.js.map +1 -1
- package/lib/runtime/timeline/clock.d.ts +7 -3
- package/lib/runtime/timeline/clock.d.ts.map +1 -1
- package/lib/runtime/timeline/clock.js +0 -5
- package/lib/runtime/timeline/clock.js.map +1 -1
- package/lib/runtime/timeline/flash.d.ts +0 -5
- package/lib/runtime/timeline/flash.d.ts.map +1 -1
- package/lib/runtime/timeline/flash.js +15 -3
- package/lib/runtime/timeline/flash.js.map +1 -1
- package/lib/runtime/timeline/identity.d.ts +0 -5
- package/lib/runtime/timeline/identity.d.ts.map +1 -1
- package/lib/runtime/timeline/identity.js +9 -3
- package/lib/runtime/timeline/identity.js.map +1 -1
- package/lib/runtime/timeline/input.d.ts +0 -5
- package/lib/runtime/timeline/input.d.ts.map +1 -1
- package/lib/runtime/timeline/input.js +2 -3
- package/lib/runtime/timeline/input.js.map +1 -1
- package/lib/runtime/timeline/install.d.ts +11 -3
- package/lib/runtime/timeline/install.d.ts.map +1 -1
- package/lib/runtime/timeline/install.js +0 -5
- package/lib/runtime/timeline/install.js.map +1 -1
- package/lib/runtime/timeline/lifecycle.d.ts +13 -3
- package/lib/runtime/timeline/lifecycle.d.ts.map +1 -1
- package/lib/runtime/timeline/lifecycle.js +0 -5
- package/lib/runtime/timeline/lifecycle.js.map +1 -1
- package/lib/runtime/timeline/public-api.d.ts +6 -3
- package/lib/runtime/timeline/public-api.d.ts.map +1 -1
- package/lib/runtime/timeline/public-api.js +0 -5
- package/lib/runtime/timeline/public-api.js.map +1 -1
- package/lib/runtime/timeline/render.d.ts +0 -5
- package/lib/runtime/timeline/render.d.ts.map +1 -1
- package/lib/runtime/timeline/render.js +21 -3
- package/lib/runtime/timeline/render.js.map +1 -1
- package/lib/runtime/timeline/transport.d.ts +0 -5
- package/lib/runtime/timeline/transport.d.ts.map +1 -1
- package/lib/runtime/timeline/transport.js +10 -3
- package/lib/runtime/timeline/transport.js.map +1 -1
- package/lib/segmented-tabs.d.ts +0 -5
- package/lib/segmented-tabs.d.ts.map +1 -1
- package/lib/segmented-tabs.js +0 -5
- package/lib/segmented-tabs.js.map +1 -1
- package/lib/snapshot.d.ts +11 -3
- package/lib/snapshot.d.ts.map +1 -1
- package/lib/snapshot.js +0 -5
- package/lib/snapshot.js.map +1 -1
- package/lib/source-meta.d.ts +0 -5
- package/lib/source-meta.d.ts.map +1 -1
- package/lib/source-meta.js +0 -5
- package/lib/source-meta.js.map +1 -1
- package/lib/timeline/derive.d.ts +0 -5
- package/lib/timeline/derive.d.ts.map +1 -1
- package/lib/timeline/derive.js +22 -3
- package/lib/timeline/derive.js.map +1 -1
- package/lib/timeline/filter.d.ts +0 -5
- package/lib/timeline/filter.d.ts.map +1 -1
- package/lib/timeline/filter.js +6 -3
- package/lib/timeline/filter.js.map +1 -1
- package/lib/timeline/tracks.d.ts +0 -5
- package/lib/timeline/tracks.d.ts.map +1 -1
- package/lib/timeline/tracks.js +12 -3
- package/lib/timeline/tracks.js.map +1 -1
- package/lib/tokens.d.ts +0 -5
- package/lib/tokens.d.ts.map +1 -1
- package/lib/tokens.js +0 -5
- package/lib/tokens.js.map +1 -1
- package/lib/transform.d.ts +0 -5
- package/lib/transform.d.ts.map +1 -1
- package/lib/transform.js +0 -5
- package/lib/transform.js.map +1 -1
- package/lib/types.d.ts +10 -5
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +0 -5
- package/lib/types.js.map +1 -1
- package/lib/wrap-table.d.ts +0 -5
- package/lib/wrap-table.d.ts.map +1 -1
- package/lib/wrap-table.js +12 -3
- package/lib/wrap-table.js.map +1 -1
- package/package.json +2 -2
- package/types/hmr-incompatibility.d.ts +0 -5
- package/types/hmr-incompatibility.d.ts.map +1 -1
- package/types/hmr-incompatibility.js +13 -3
- package/types/hmr-incompatibility.js.map +1 -1
- package/types/in-page.d.ts +0 -5
- package/types/in-page.d.ts.map +1 -1
- package/types/in-page.js +0 -5
- package/types/in-page.js.map +1 -1
- package/types/inspector.d.ts +0 -5
- package/types/inspector.d.ts.map +1 -1
- package/types/inspector.js +13 -3
- package/types/inspector.js.map +1 -1
- package/types/snapshot.d.ts +0 -5
- package/types/snapshot.d.ts.map +1 -1
- package/types/snapshot.js +12 -3
- package/types/snapshot.js.map +1 -1
- package/types/timeline.d.ts +0 -5
- package/types/timeline.d.ts.map +1 -1
- package/types/timeline.js +0 -5
- package/types/timeline.js.map +1 -1
- package/dist/client/assets/index-D632jo79.js.map +0 -1
package/lib/timeline/filter.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* The Timeline's element and regex filters, as pure functions.
|
|
3
|
+
*
|
|
4
|
+
* Both presentations (the list and the tracks) answer "show me only this
|
|
5
|
+
* element" or "only things matching /update/". The filter state therefore
|
|
6
|
+
* lives in `timeline-view` and each presentation applies it here, so the two
|
|
7
|
+
* cannot drift apart on what a match means.
|
|
5
8
|
*/
|
|
6
9
|
/**
|
|
7
10
|
* Compiles the regex box. An empty box matches everything. A pattern that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../src/lib/timeline/filter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../src/lib/timeline/filter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,MAAc,EACyB,EAAE;IACzC,IAAI,MAAM,KAAK,EAAE;QAAE,OAAO,EAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAC,CAAC;IACrD,IAAI,CAAC;QACH,OAAO,EAAC,EAAE,EAAE,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,KAAK,EAAC,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;IACnC,CAAC;AACH,CAAC,CAAC;AAEF;yEACyE;AACzE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAkB,EAAU,EAAE,CACzD,GAAG,IAAI,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,IAAI,EAAE,IAAI,CACjE,IAAI,CAAC,OAAO,IAAI,EAAE,CACnB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAEhB;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,KAA8B,EAC9B,SAAwB,EACxB,EAAiB,EACD,EAAE,CAClB,KAAK,CAAC,MAAM,CACV,CAAC,IAAI,EAAE,EAAE,CACP,CAAC,SAAS,KAAK,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,SAAS,KAAK,SAAS,CAAC;IAC1D,CAAC,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAC/C,CAAC;AAEJ,wEAAwE;AACxE,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,MAAgC,EACE,EAAE;IACpC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IACvC,KAAK,MAAM,EAAE,IAAI,MAAM,EAAE,CAAC;QACxB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC;QAC9B,IAAI,EAAE,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,IAAI,SAAS,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,EAAE,EAAE,GAAG,EAAC,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC","sourcesContent":["/**\n * The Timeline's element and regex filters, as pure functions.\n *\n * Both presentations (the list and the tracks) answer \"show me only this\n * element\" or \"only things matching /update/\". The filter state therefore\n * lives in `timeline-view` and each presentation applies it here, so the two\n * cannot drift apart on what a match means.\n */\n\nimport type {TimelineEvent} from '../../types/timeline.js';\nimport type {TimelineSpan} from './derive.js';\n\n/**\n * Compiles the regex box. An empty box matches everything. A pattern that\n * does not compile (the user is mid-typing `foo(`) disables the filter rather\n * than hiding every row, and is reported as `invalid` so the input can say so.\n */\nexport const compileRegex = (\n source: string\n): {re: RegExp | null; invalid: boolean} => {\n if (source === '') return {re: null, invalid: false};\n try {\n return {re: new RegExp(source, 'i'), invalid: false};\n } catch {\n return {re: null, invalid: true};\n }\n};\n\n/** Text the regex filter searches: element tag, name, subtitle and the\n * changed property keys (the reason is worth searching for by name). */\nexport const spanHaystack = (span: TimelineSpan): string =>\n `${span.meta?.tagName ?? ''} ${span.name} ${span.subtitle ?? ''} ${(\n span.changed ?? []\n ).join(' ')}`;\n\n/**\n * Applies the element and regex filters. `re` comes from {@link compileRegex}\n * so a caller filtering on every keystroke compiles once, not per span.\n */\nexport const filterSpans = (\n spans: readonly TimelineSpan[],\n elementId: number | null,\n re: RegExp | null\n): TimelineSpan[] =>\n spans.filter(\n (span) =>\n (elementId === null || span.meta?.elementId === elementId) &&\n (re === null || re.test(spanHaystack(span)))\n );\n\n/** Distinct elements (by stable id) seen across the recorded events. */\nexport const listElements = (\n events: readonly TimelineEvent[]\n): Array<{id: number; tag: string}> => {\n const seen = new Map<number, string>();\n for (const ev of events) {\n const id = ev.meta?.elementId;\n if (id != null && !seen.has(id)) {\n seen.set(id, ev.meta?.tagName ?? 'unknown');\n }\n }\n return [...seen].map(([id, tag]) => ({id, tag}));\n};\n"]}
|
package/lib/timeline/tracks.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracks.d.ts","sourceRoot":"","sources":["../../src/lib/timeline/tracks.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tracks.d.ts","sourceRoot":"","sources":["../../src/lib/timeline/tracks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAE9C;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;AAEtC,2EAA2E;AAC3E,MAAM,WAAW,KAA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EAAE,MAAM,CAAA;CAO5B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,QAClB,QAAQ,SACN,MAAM,OACR,MAAM,KACV,CAAC,MAAM,EAAE,MAAM,CAgBjB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,UAAW,MAAM,KAAG,MAOxC,CAAC"}
|
package/lib/timeline/tracks.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Layout for the Timeline's track view: one horizontal lane per layer on a
|
|
3
|
+
* shared time axis.
|
|
4
|
+
*
|
|
5
|
+
* The list answers "what happened, in what order, to whom". It cannot show
|
|
6
|
+
* concurrency or rhythm — which layers fire together, how a click lines up
|
|
7
|
+
* with the update tick it caused, how long a tick is next to its neighbours.
|
|
8
|
+
* This module turns the same {@link TimelineSpan}s into lanes and rows, and
|
|
9
|
+
* owns the arithmetic between milliseconds and pixels, so the element that
|
|
10
|
+
* draws them (`panel/timeline-tracks.ts`) is only DOM.
|
|
11
|
+
*
|
|
12
|
+
* Pure and dependency-free, like `derive.ts`, so it is unit-tested without a
|
|
13
|
+
* browser.
|
|
5
14
|
*/
|
|
6
15
|
/**
|
|
7
16
|
* Where a span stops occupying its row. A point event occupies only its own
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracks.js","sourceRoot":"","sources":["../../src/lib/timeline/tracks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA+BH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAkB,EAAU,EAAE;IACxD,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC;IAC5C,OAAO,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC5D,CAAC,CAA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AC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACtD,MAAM,GAAG,GAAG,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAChD,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;QAC9B,IAAI,CAAC,GAAG,GAAG,IAAI,KAAK;YAAE,OAAO,CAAC,GAAG,GAAG,CAAC;IACvC,CAAC;IACD,OAAO,EAAE,GAAG,GAAG,CAAC;AAClB,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Layout for the Timeline's track view: one horizontal lane per layer on a\n * shared time axis.\n *\n * The list answers \"what happened, in what order, to whom\". It cannot show\n * concurrency or rhythm — which layers fire together, how a click lines up\n * with the update tick it caused, how long a tick is next to its neighbours.\n * This module turns the same {@link TimelineSpan}s into lanes and rows, and\n * owns the arithmetic between milliseconds and pixels, so the element that\n * draws them (`panel/timeline-tracks.ts`) is only DOM.\n *\n * Pure and dependency-free, like `derive.ts`, so it is unit-tested without a\n * browser.\n */\n\nimport type {TimelineSpan} from './derive.js';\n\n/**\n * Spans in one row of a lane, sorted by start and never overlapping, so\n * {@link visibleRange} can binary-search them.\n */\nexport type TrackRow = TimelineSpan[];\n\n/** One lane: every span of one layer, packed into non-overlapping rows. */\nexport interface Track {\n layerId: string;\n rows: TrackRow[];\n}\n\n/**\n * Where a span stops occupying its row. A point event occupies only its own\n * instant; a span whose end has not arrived (still running, or its end fell\n * out of the buffer) occupies the rest of the recording, because that is\n * where it is drawn — up to the live edge.\n */\nexport const occupiedEnd = (span: TimelineSpan): number => {\n if (span.end !== undefined) return span.end;\n return span.groupId === undefined ? span.start : Infinity;\n};\n\n/**\n * Groups spans into one track per layer, in `layers` order, then any layer\n * the spans mention that `layers` does not (a custom layer announced after the\n * last `get-meta`), in first-seen order. A layer with no spans still gets an\n * empty track, so a lane does not appear and vanish as events arrive.\n *\n * Within a track, spans are packed greedily: each goes into the first row\n * whose last span has ended by the time it starts. Lit's lifecycle phases\n * nest, so one update tick lands as `performUpdate` on row 0 and\n * `willUpdate` / `update` / `updated` side by side on row 1 — the flame shape\n * falls out of the packing without modelling it.\n */\nexport const buildTracks = (\n spans: readonly TimelineSpan[],\n layers: readonly {id: string}[]\n): Track[] => {\n const byLayer = new Map<string, TimelineSpan[]>();\n for (const layer of layers) byLayer.set(layer.id, []);\n for (const span of spans) {\n let list = byLayer.get(span.layerId);\n if (list === undefined) {\n list = [];\n byLayer.set(span.layerId, list);\n }\n list.push(span);\n }\n return [...byLayer].map(([layerId, list]) => ({\n layerId,\n rows: packRows(list),\n }));\n};\n\nconst packRows = (spans: TimelineSpan[]): TrackRow[] => {\n // `toSpans` already sorts by start; re-sort only if a caller did not.\n const sorted = spans.every(\n (s, i) => i === 0 || spans[i - 1]!.start <= s.start\n )\n ? spans\n : [...spans].sort((a, b) => a.start - b.start);\n const rows: TrackRow[] = [];\n const rowEnds: number[] = [];\n for (const span of sorted) {\n let row = rowEnds.findIndex((end) => end <= span.start);\n if (row === -1) {\n row = rows.length;\n rows.push([]);\n rowEnds.push(-Infinity);\n }\n rows[row]!.push(span);\n rowEnds[row] = occupiedEnd(span);\n }\n return rows;\n};\n\n/**\n * The recording's time bounds over `spans`: the earliest start, and the\n * latest instant anything is known to have happened (an end, or the start of\n * a span with none). The origin is the earliest start rather than zero\n * because the panel's buffer is capped and rolls its oldest events off; a\n * long recording would otherwise open on an empty stretch.\n */\nexport const timeBounds = (\n spans: readonly TimelineSpan[]\n): {origin: number; extent: number} => {\n if (spans.length === 0) return {origin: 0, extent: 0};\n let origin = Infinity;\n let last = -Infinity;\n for (const span of spans) {\n origin = Math.min(origin, span.start);\n last = Math.max(last, span.end ?? span.start);\n }\n return {origin, extent: last - origin};\n};\n\n/** Deepest zoom, in multiples of \"fit\": about a microsecond per pixel on a\n * second-long recording, past which there is nothing left to separate. */\nexport const MAX_ZOOM = 100_000;\n\n/** A recording with a single instant in it still needs a nonzero axis. */\nconst MIN_EXTENT_MS = 1;\n\n/** Mapping between recording time and pixels for the current zoom and pan. */\nexport interface TimeScale {\n pxPerMs: number;\n /** First and last millisecond inside the plot. */\n start: number;\n end: number;\n toX(ms: number): number;\n toMs(x: number): number;\n}\n\n/**\n * Builds the scale for a plot `width` pixels wide showing a recording that\n * begins at `originMs` and runs for `extentMs`.\n *\n * `zoom` is a multiple of \"fit\" (1 shows the whole recording); `pan` is how\n * many milliseconds past the origin the left edge sits. Both are clamped, so\n * callers can apply a raw wheel or drag delta and read back where it landed.\n */\nexport const timeScale = (\n originMs: number,\n extentMs: number,\n width: number,\n zoom = 1,\n pan = 0\n): TimeScale => {\n const extent = Math.max(extentMs, MIN_EXTENT_MS);\n const z = clampZoom(zoom);\n const visibleMs = extent / z;\n const p = clampPan(pan, extent, z);\n const pxPerMs = Math.max(width, 1) / visibleMs;\n const start = originMs + p;\n return {\n pxPerMs,\n start,\n end: start + visibleMs,\n toX: (ms) => (ms - start) * pxPerMs,\n toMs: (x) => start + x / pxPerMs,\n };\n};\n\nexport const clampZoom = (zoom: number): number =>\n Math.min(Math.max(Number.isNaN(zoom) ? 1 : zoom, 1), MAX_ZOOM);\n\n/** Keeps the visible window inside the recording. */\nexport const clampPan = (\n pan: number,\n extentMs: number,\n zoom: number\n): number => {\n const extent = Math.max(extentMs, MIN_EXTENT_MS);\n const max = extent - extent / clampZoom(zoom);\n return Math.min(Math.max(Number.isNaN(pan) ? 0 : pan, 0), max);\n};\n\n/** The pan that puts the live edge (the end of the recording) at the right\n * of the plot, for following a recording in progress. */\nexport const livePan = (extentMs: number, zoom: number): number =>\n clampPan(Infinity, extentMs, zoom);\n\n/**\n * Zooms by `factor` while keeping the millisecond under pixel `x` where it\n * is, which is what a wheel over a timeline is expected to do.\n */\nexport const zoomAt = (\n originMs: number,\n extentMs: number,\n width: number,\n zoom: number,\n pan: number,\n x: number,\n factor: number\n): {zoom: number; pan: number} => {\n const before = timeScale(originMs, extentMs, width, zoom, pan);\n const anchor = before.toMs(x);\n const nextZoom = clampZoom(clampZoom(zoom) * factor);\n const after = timeScale(originMs, extentMs, width, nextZoom, 0);\n const nextPan = anchor - originMs - x / after.pxPerMs;\n return {zoom: nextZoom, pan: clampPan(nextPan, extentMs, nextZoom)};\n};\n\n/**\n * Index range `[from, to)` of the spans in `row` that intersect the window\n * `[start, end]`, found by binary search so a zoomed-in lane renders a\n * handful of marks rather than walking thousands.\n *\n * Only the span just before the first one starting inside the window can\n * reach into it, because a row's spans never overlap.\n */\nexport const visibleRange = (\n row: TrackRow,\n start: number,\n end: number\n): [number, number] => {\n const firstAtOrAfter = (t: number, inclusive: boolean) => {\n let lo = 0;\n let hi = row.length;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n const s = row[mid]!.start;\n if (inclusive ? s < t : s <= t) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n };\n let from = firstAtOrAfter(start, true);\n if (from > 0 && occupiedEnd(row[from - 1]!) >= start) from--;\n const to = firstAtOrAfter(end, false);\n return [from, Math.max(from, to)];\n};\n\n/**\n * A round tick interval (1, 2 or 5 times a power of ten, in milliseconds) at\n * least `minMs` long, for axis labels that land on readable numbers.\n */\nexport const niceStep = (minMs: number): number => {\n if (!(minMs > 0) || !Number.isFinite(minMs)) return 1;\n const pow = 10 ** Math.floor(Math.log10(minMs));\n for (const m of [1, 2, 5, 10]) {\n if (m * pow >= minMs) return m * pow;\n }\n return 10 * pow;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"tracks.js","sourceRoot":"","sources":["../../src/lib/timeline/tracks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAgBH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAkB,EAAU,EAAE;IACxD,IAAI,IAAI,CAAC,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I,EAAE,EAAE,CAAC,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAU,EAAE;IAChD,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACtD,MAAM,GAAG,GAAG,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAChD,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;QAC9B,IAAI,CAAC,GAAG,GAAG,IAAI,KAAK;YAAE,OAAO,CAAC,GAAG,GAAG,CAAC;IACvC,CAAC;IACD,OAAO,EAAE,GAAG,GAAG,CAAC;AAClB,CAAC,CAAC","sourcesContent":["/**\n * Layout for the Timeline's track view: one horizontal lane per layer on a\n * shared time axis.\n *\n * The list answers \"what happened, in what order, to whom\". It cannot show\n * concurrency or rhythm — which layers fire together, how a click lines up\n * with the update tick it caused, how long a tick is next to its neighbours.\n * This module turns the same {@link TimelineSpan}s into lanes and rows, and\n * owns the arithmetic between milliseconds and pixels, so the element that\n * draws them (`panel/timeline-tracks.ts`) is only DOM.\n *\n * Pure and dependency-free, like `derive.ts`, so it is unit-tested without a\n * browser.\n */\n\nimport type {TimelineSpan} from './derive.js';\n\n/**\n * Spans in one row of a lane, sorted by start and never overlapping, so\n * {@link visibleRange} can binary-search them.\n */\nexport type TrackRow = TimelineSpan[];\n\n/** One lane: every span of one layer, packed into non-overlapping rows. */\nexport interface Track {\n layerId: string;\n rows: TrackRow[];\n}\n\n/**\n * Where a span stops occupying its row. A point event occupies only its own\n * instant; a span whose end has not arrived (still running, or its end fell\n * out of the buffer) occupies the rest of the recording, because that is\n * where it is drawn — up to the live edge.\n */\nexport const occupiedEnd = (span: TimelineSpan): number => {\n if (span.end !== undefined) return span.end;\n return span.groupId === undefined ? span.start : Infinity;\n};\n\n/**\n * Groups spans into one track per layer, in `layers` order, then any layer\n * the spans mention that `layers` does not (a custom layer announced after the\n * last `get-meta`), in first-seen order. A layer with no spans still gets an\n * empty track, so a lane does not appear and vanish as events arrive.\n *\n * Within a track, spans are packed greedily: each goes into the first row\n * whose last span has ended by the time it starts. Lit's lifecycle phases\n * nest, so one update tick lands as `performUpdate` on row 0 and\n * `willUpdate` / `update` / `updated` side by side on row 1 — the flame shape\n * falls out of the packing without modelling it.\n */\nexport const buildTracks = (\n spans: readonly TimelineSpan[],\n layers: readonly {id: string}[]\n): Track[] => {\n const byLayer = new Map<string, TimelineSpan[]>();\n for (const layer of layers) byLayer.set(layer.id, []);\n for (const span of spans) {\n let list = byLayer.get(span.layerId);\n if (list === undefined) {\n list = [];\n byLayer.set(span.layerId, list);\n }\n list.push(span);\n }\n return [...byLayer].map(([layerId, list]) => ({\n layerId,\n rows: packRows(list),\n }));\n};\n\nconst packRows = (spans: TimelineSpan[]): TrackRow[] => {\n // `toSpans` already sorts by start; re-sort only if a caller did not.\n const sorted = spans.every(\n (s, i) => i === 0 || spans[i - 1]!.start <= s.start\n )\n ? spans\n : [...spans].sort((a, b) => a.start - b.start);\n const rows: TrackRow[] = [];\n const rowEnds: number[] = [];\n for (const span of sorted) {\n let row = rowEnds.findIndex((end) => end <= span.start);\n if (row === -1) {\n row = rows.length;\n rows.push([]);\n rowEnds.push(-Infinity);\n }\n rows[row]!.push(span);\n rowEnds[row] = occupiedEnd(span);\n }\n return rows;\n};\n\n/**\n * The recording's time bounds over `spans`: the earliest start, and the\n * latest instant anything is known to have happened (an end, or the start of\n * a span with none). The origin is the earliest start rather than zero\n * because the panel's buffer is capped and rolls its oldest events off; a\n * long recording would otherwise open on an empty stretch.\n */\nexport const timeBounds = (\n spans: readonly TimelineSpan[]\n): {origin: number; extent: number} => {\n if (spans.length === 0) return {origin: 0, extent: 0};\n let origin = Infinity;\n let last = -Infinity;\n for (const span of spans) {\n origin = Math.min(origin, span.start);\n last = Math.max(last, span.end ?? span.start);\n }\n return {origin, extent: last - origin};\n};\n\n/** Deepest zoom, in multiples of \"fit\": about a microsecond per pixel on a\n * second-long recording, past which there is nothing left to separate. */\nexport const MAX_ZOOM = 100_000;\n\n/** A recording with a single instant in it still needs a nonzero axis. */\nconst MIN_EXTENT_MS = 1;\n\n/** Mapping between recording time and pixels for the current zoom and pan. */\nexport interface TimeScale {\n pxPerMs: number;\n /** First and last millisecond inside the plot. */\n start: number;\n end: number;\n toX(ms: number): number;\n toMs(x: number): number;\n}\n\n/**\n * Builds the scale for a plot `width` pixels wide showing a recording that\n * begins at `originMs` and runs for `extentMs`.\n *\n * `zoom` is a multiple of \"fit\" (1 shows the whole recording); `pan` is how\n * many milliseconds past the origin the left edge sits. Both are clamped, so\n * callers can apply a raw wheel or drag delta and read back where it landed.\n */\nexport const timeScale = (\n originMs: number,\n extentMs: number,\n width: number,\n zoom = 1,\n pan = 0\n): TimeScale => {\n const extent = Math.max(extentMs, MIN_EXTENT_MS);\n const z = clampZoom(zoom);\n const visibleMs = extent / z;\n const p = clampPan(pan, extent, z);\n const pxPerMs = Math.max(width, 1) / visibleMs;\n const start = originMs + p;\n return {\n pxPerMs,\n start,\n end: start + visibleMs,\n toX: (ms) => (ms - start) * pxPerMs,\n toMs: (x) => start + x / pxPerMs,\n };\n};\n\nexport const clampZoom = (zoom: number): number =>\n Math.min(Math.max(Number.isNaN(zoom) ? 1 : zoom, 1), MAX_ZOOM);\n\n/** Keeps the visible window inside the recording. */\nexport const clampPan = (\n pan: number,\n extentMs: number,\n zoom: number\n): number => {\n const extent = Math.max(extentMs, MIN_EXTENT_MS);\n const max = extent - extent / clampZoom(zoom);\n return Math.min(Math.max(Number.isNaN(pan) ? 0 : pan, 0), max);\n};\n\n/** The pan that puts the live edge (the end of the recording) at the right\n * of the plot, for following a recording in progress. */\nexport const livePan = (extentMs: number, zoom: number): number =>\n clampPan(Infinity, extentMs, zoom);\n\n/**\n * Zooms by `factor` while keeping the millisecond under pixel `x` where it\n * is, which is what a wheel over a timeline is expected to do.\n */\nexport const zoomAt = (\n originMs: number,\n extentMs: number,\n width: number,\n zoom: number,\n pan: number,\n x: number,\n factor: number\n): {zoom: number; pan: number} => {\n const before = timeScale(originMs, extentMs, width, zoom, pan);\n const anchor = before.toMs(x);\n const nextZoom = clampZoom(clampZoom(zoom) * factor);\n const after = timeScale(originMs, extentMs, width, nextZoom, 0);\n const nextPan = anchor - originMs - x / after.pxPerMs;\n return {zoom: nextZoom, pan: clampPan(nextPan, extentMs, nextZoom)};\n};\n\n/**\n * Index range `[from, to)` of the spans in `row` that intersect the window\n * `[start, end]`, found by binary search so a zoomed-in lane renders a\n * handful of marks rather than walking thousands.\n *\n * Only the span just before the first one starting inside the window can\n * reach into it, because a row's spans never overlap.\n */\nexport const visibleRange = (\n row: TrackRow,\n start: number,\n end: number\n): [number, number] => {\n const firstAtOrAfter = (t: number, inclusive: boolean) => {\n let lo = 0;\n let hi = row.length;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n const s = row[mid]!.start;\n if (inclusive ? s < t : s <= t) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n };\n let from = firstAtOrAfter(start, true);\n if (from > 0 && occupiedEnd(row[from - 1]!) >= start) from--;\n const to = firstAtOrAfter(end, false);\n return [from, Math.max(from, to)];\n};\n\n/**\n * A round tick interval (1, 2 or 5 times a power of ten, in milliseconds) at\n * least `minMs` long, for axis labels that land on readable numbers.\n */\nexport const niceStep = (minMs: number): number => {\n if (!(minMs > 0) || !Number.isFinite(minMs)) return 1;\n const pow = 10 ** Math.floor(Math.log10(minMs));\n for (const m of [1, 2, 5, 10]) {\n if (m * pow >= minMs) return m * pow;\n }\n return 10 * pow;\n};\n"]}
|
package/lib/tokens.d.ts
CHANGED
package/lib/tokens.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/lib/tokens.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/lib/tokens.ts"],"names":[],"mappings":"AAyMA;;;;GAIG;AACH,eAAO,MAAM,QAAQ,stKAAqC,CAAC;AAE3D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,MAAM,yBAIlB,CAAC;AAIF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,sBAExB,mBAAmB,KAAQ,MAwB7B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,aAAc,mBAAmB,KAAG,IAO5D,CAAC"}
|
package/lib/tokens.js
CHANGED
package/lib/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/lib/tokens.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,GAAG,EAAE,SAAS,EAAC,MAAM,KAAK,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqFpB,CAAC;AAEF,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCpB,CAAC;AAEF,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAE5C,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCrB,CAAC;AAEF,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAE9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,YAAY,KAAK,YAAY,EAAE,CAAC;AAE3D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;MAEnB,SAAS,CAAC,YAAY,CAAC;;CAE5B,CAAC;AAEF,IAAI,SAAS,GAAG,KAAK,CAAC;AAgBtB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC7B,WAAW,GAAG,KAAK,GACpB,GAAwB,EAAE,EAAU,EAAE;IACrC,MAAM,IAAI,GAAG,WAAW;QACtB,CAAC,CAAC,GAAG,YAAY,OAAO,aAAa,EAAE;QACvC,CAAC,CAAC,YAAY,CAAC;IACjB,MAAM,KAAK,GAAG,WAAW;QACvB,CAAC,CAAC,GAAG,aAAa,OAAO,cAAc,EAAE;QACzC,CAAC,CAAC,aAAa,CAAC;IAClB,OAAO;;QAED,YAAY;QACZ,IAAI;;;;UAIF,KAAK;;;;QAIP,KAAK;;;QAGL,IAAI;;GAET,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAA6B,EAAQ,EAAE;IAClE,IAAI,SAAS;QAAE,OAAO;IACtB,SAAS,GAAG,IAAI,CAAC;IACjB,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,YAAY,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;IACnD,KAAK,CAAC,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAC5C,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {css, unsafeCSS} from 'lit';\n\n/**\n * Design token CSS custom properties for the Lit DevTools.\n *\n * Two entry points:\n * - **`tokens`** — Lit `css` template that defines the theme-agnostic base\n * tokens on `:host`. Semantic color aliases (`--lit-devtools-bg`, `--lit-devtools-surface`, `--lit-devtools-text`,\n * etc.) are inherited from `:root`, where {@link injectTokens} installs them.\n * Use as `static styles = [tokens, css`…`]`.\n * - **`injectTokens()`** — injects `:root { … }` into the page `<head>` once.\n * This makes semantic aliases available to every devtools surface, both\n * runtime elements (indicator, source-overlay) that build their shadow DOM\n * via `innerHTML` and Lit panel components that inherit from `:root`.\n * The injected stylesheet reacts to `prefers-color-scheme` and to\n * `.color-scheme-light` / `.color-scheme-dark` classes on `:root`.\n *\n * Sourced from the lit-design skill (`tokens/colors.css`). Defaults to the\n * dark DevTools theme; the light lit.dev website palette is applied when the\n * OS/browser requests a light color scheme or when `:root` has the matching\n * theme class.\n *\n * Fonts are system stacks (no webfonts). For the branded Manrope + Roboto Mono\n * see the lit-design skill's `fonts/` directory.\n */\n\nconst baseTokenCSS = `\n /* ---- Brand · the Lit flame ---- */\n --lit-devtools-lit-blue: #324fff;\n --lit-devtools-lit-blue-bright: #4d63ff;\n --lit-devtools-lit-indigo: #2a2c9d;\n --lit-devtools-lit-dark-blue: #283198;\n --lit-devtools-lit-cyan: #00ffff;\n --lit-devtools-lit-dark-cyan: #00e8ff;\n\n /* ---- Neutral ink scale (0 = near-black, 13 = white) ---- */\n --lit-devtools-ink-0: hsl(0 0% 1%);\n --lit-devtools-ink-1: hsl(0 0% 5%);\n --lit-devtools-ink-2: hsl(0 0% 7%);\n --lit-devtools-ink-3: hsl(0 0% 11%);\n --lit-devtools-ink-4: hsl(0 0% 13%);\n --lit-devtools-ink-5: hsl(0 0% 16%);\n --lit-devtools-ink-6: hsl(0 0% 21%);\n --lit-devtools-ink-7: hsl(0 0% 28%);\n --lit-devtools-ink-8: hsl(0 0% 38%);\n --lit-devtools-ink-9: hsl(0 0% 57%);\n --lit-devtools-ink-10: hsl(0 0% 63%);\n --lit-devtools-ink-11: hsl(0 0% 78%);\n --lit-devtools-ink-12: hsl(0 0% 89%);\n --lit-devtools-ink-13: hsl(0 0% 100%);\n\n /* ---- Typography ---- */\n --lit-devtools-font-sans: system-ui, -apple-system, 'Segoe UI', sans-serif;\n --lit-devtools-font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;\n\n --lit-devtools-weight-regular: 400;\n --lit-devtools-weight-medium: 500;\n --lit-devtools-weight-semibold: 600;\n --lit-devtools-weight-bold: 700;\n --lit-devtools-weight-extrabold: 800;\n\n --lit-devtools-text-2xs: 11px;\n --lit-devtools-text-xs: 12px;\n --lit-devtools-text-sm: 13px;\n --lit-devtools-text-md: 14px;\n --lit-devtools-text-base:16px;\n\n --lit-devtools-leading-tight: 1.15;\n --lit-devtools-leading-snug: 1.3;\n --lit-devtools-leading-normal: 1.5;\n\n --lit-devtools-tracking-tight: -0.02em;\n --lit-devtools-tracking-snug: -0.01em;\n --lit-devtools-tracking-normal: 0;\n --lit-devtools-tracking-wide: 0.02em;\n --lit-devtools-tracking-caps: 0.06em;\n\n /* ---- Spacing (4px base) ---- */\n --lit-devtools-space-0: 0;\n --lit-devtools-space-1: 2px;\n --lit-devtools-space-2: 4px;\n --lit-devtools-space-3: 6px;\n --lit-devtools-space-4: 8px;\n --lit-devtools-space-5: 12px;\n --lit-devtools-space-6: 16px;\n --lit-devtools-space-7: 20px;\n --lit-devtools-space-8: 24px;\n --lit-devtools-space-9: 32px;\n\n /* ---- Radius ---- */\n --lit-devtools-radius-xs: 3px;\n --lit-devtools-radius-sm: 5px;\n --lit-devtools-radius-md: 8px;\n --lit-devtools-radius-lg: 12px;\n --lit-devtools-radius-xl: 16px;\n --lit-devtools-radius-pill: 999px;\n\n /* ---- Elevation ---- */\n --lit-devtools-shadow-xs: 0 1px 2px hsl(0 0% 0% / 0.30);\n --lit-devtools-shadow-sm: 0 1px 5px hsl(0 0% 0% / 0.35);\n --lit-devtools-shadow-md: 0 4px 14px hsl(0 0% 0% / 0.40);\n --lit-devtools-shadow-lg: 0 12px 32px hsl(0 0% 0% / 0.50);\n --lit-devtools-shadow-xl: 0 24px 64px hsl(0 0% 0% / 0.55);\n --lit-devtools-shadow-window: 0 24px 80px hsl(0 0% 0% / 0.6),\n 0 0 0 1px hsl(0 0% 100% / 0.06);\n --lit-devtools-ring: 0 0 0 2px var(--lit-devtools-accent-ring);\n\n /* ---- Motion ---- */\n --lit-devtools-ease-standard: cubic-bezier(0.2, 0, 0, 1);\n --lit-devtools-dur-fast: 140ms;\n --lit-devtools-dur-normal: 220ms;\n`;\n\nconst darkThemeCSS = `\n /* ---- DARK · DevTools theme ---- */\n --lit-devtools-accent: var(--lit-devtools-lit-blue-bright);\n --lit-devtools-accent-hover: #6478ff;\n --lit-devtools-accent-pressed: #3d54f0;\n --lit-devtools-accent-soft: hsla(232 100% 65% / 0.16);\n --lit-devtools-accent-ring: hsla(232 100% 65% / 0.45);\n --lit-devtools-on-accent: #ffffff;\n --lit-devtools-accent-cyan: var(--lit-devtools-lit-dark-cyan);\n\n --lit-devtools-bg: var(--lit-devtools-ink-0);\n --lit-devtools-surface: var(--lit-devtools-ink-2);\n --lit-devtools-surface-low: var(--lit-devtools-ink-1);\n --lit-devtools-surface-container: var(--lit-devtools-ink-4);\n --lit-devtools-surface-container-high: var(--lit-devtools-ink-5);\n --lit-devtools-surface-elevated: var(--lit-devtools-ink-6);\n --lit-devtools-surface-hover: hsl(0 0% 100% / 0.04);\n --lit-devtools-surface-active: hsl(0 0% 100% / 0.07);\n\n --lit-devtools-text: var(--lit-devtools-ink-12);\n --lit-devtools-text-strong: var(--lit-devtools-ink-13);\n --lit-devtools-text-secondary: var(--lit-devtools-ink-10);\n --lit-devtools-text-muted: var(--lit-devtools-ink-8);\n --lit-devtools-text-link: var(--lit-devtools-lit-blue-bright);\n\n --lit-devtools-border: var(--lit-devtools-ink-6);\n --lit-devtools-border-strong: var(--lit-devtools-ink-7);\n --lit-devtools-border-subtle: hsl(0 0% 100% / 0.06);\n\n --lit-devtools-success: hsl(158 74% 53%);\n --lit-devtools-success-soft: hsl(158 74% 53% / 0.15);\n --lit-devtools-warning: #f4bf4f;\n --lit-devtools-warning-soft: hsl(43 88% 63% / 0.15);\n --lit-devtools-error: #ff6b6b;\n --lit-devtools-error-soft: hsl(0 100% 71% / 0.15);\n --lit-devtools-info: var(--lit-devtools-lit-dark-cyan);\n --lit-devtools-info-soft: hsl(187 100% 47% / 0.15);\n\n --lit-devtools-selection-bg: var(--lit-devtools-accent);\n --lit-devtools-on-selection: #ffffff;\n`;\n\nconst darkSchemeCSS = `color-scheme: dark;`;\n\nconst lightThemeCSS = `\n /* ---- LIGHT · lit.dev website theme ---- */\n --lit-devtools-accent: var(--lit-devtools-lit-blue);\n --lit-devtools-accent-hover: #1f3bff;\n --lit-devtools-accent-pressed: #2a2c9d;\n --lit-devtools-accent-soft: hsla(232 100% 60% / 0.12);\n --lit-devtools-accent-ring: hsla(232 100% 60% / 0.40);\n --lit-devtools-on-accent: #ffffff;\n --lit-devtools-accent-cyan: var(--lit-devtools-lit-dark-cyan);\n\n --lit-devtools-bg: #f4f4f4;\n --lit-devtools-surface: #ffffff;\n --lit-devtools-surface-low: #f3f3f3;\n --lit-devtools-surface-container: #ffffff;\n --lit-devtools-surface-container-high: #e8e8e8;\n --lit-devtools-surface-elevated: #ffffff;\n --lit-devtools-surface-hover: hsl(0 0% 0% / 0.04);\n --lit-devtools-surface-active: hsl(0 0% 0% / 0.07);\n\n --lit-devtools-text: #242424;\n --lit-devtools-text-strong: #000000;\n --lit-devtools-text-secondary: #6e6e6e;\n --lit-devtools-text-muted: #949494;\n --lit-devtools-text-link: #005dc7;\n\n --lit-devtools-border: #e2e2e2;\n --lit-devtools-border-strong: #c6c6c6;\n --lit-devtools-border-subtle: hsl(0 0% 0% / 0.07);\n\n --lit-devtools-success: #00865b;\n --lit-devtools-success-soft: hsl(158 100% 26% / 0.10);\n --lit-devtools-warning: #b26a00;\n --lit-devtools-warning-soft: hsl(40 100% 35% / 0.10);\n --lit-devtools-error: #ba1a1a;\n --lit-devtools-error-soft: hsl(0 75% 42% / 0.10);\n --lit-devtools-info: #005dc7;\n --lit-devtools-info-soft: hsl(210 100% 39% / 0.10);\n\n --lit-devtools-selection-bg: var(--lit-devtools-accent);\n --lit-devtools-on-selection: #ffffff;\n`;\n\nconst lightSchemeCSS = `color-scheme: light;`;\n\n/**\n * Default dark theme tokens as a flat string, primarily for use by\n * {@link injectTokens}. Prefer importing `tokens` for Lit components so the\n * semantic aliases are inherited from `:root`.\n */\nexport const tokenCSS = `${baseTokenCSS}\\n${darkThemeCSS}`;\n\n/**\n * Lit `css` template for use in panel component shadow roots.\n *\n * ```ts\n * import {tokens} from '../lib/tokens.js';\n * // ...\n * static override styles = [tokens, css`…`];\n * ```\n *\n * This installs the theme-agnostic base tokens on `:host`. Semantic aliases\n * (`--lit-devtools-bg`, `--lit-devtools-text`, etc.) are inherited from `:root`, where they are installed\n * by {@link injectTokens}. The panel iframe calls `injectTokens()` from\n * \\`lit-devtools-panel.ts\\` so all components inherit the same dark/light theme.\n */\nexport const tokens = css`\n :host {\n ${unsafeCSS(baseTokenCSS)}\n }\n`;\n\nlet _injected = false;\n\n/**\n * Options for {@link injectTokens} / {@link tokenStyleText}.\n */\nexport interface InjectTokensOptions {\n /**\n * Also declare `color-scheme` on `:root`. Only safe when the devtools OWN\n * the target document (the panel iframe / standalone panel page). Never set\n * this when injecting into the host page: `color-scheme` on the embedder's\n * `:root` makes the UA repaint the canvas dark for apps that don't declare\n * an opaque background. Defaults to `false`.\n */\n colorScheme?: boolean;\n}\n\n/**\n * Builds the token stylesheet text injected by {@link injectTokens}.\n *\n * By default the sheet defines custom properties only — inert for the host\n * page. With `colorScheme: true` it additionally declares `color-scheme` so\n * the owning document's UA surfaces (canvas, form controls, scrollbars)\n * follow the devtools theme.\n */\nexport const tokenStyleText = ({\n colorScheme = false,\n}: InjectTokensOptions = {}): string => {\n const dark = colorScheme\n ? `${darkThemeCSS}\\n ${darkSchemeCSS}`\n : darkThemeCSS;\n const light = colorScheme\n ? `${lightThemeCSS}\\n ${lightSchemeCSS}`\n : lightThemeCSS;\n return `\n :root {\n ${baseTokenCSS}\n ${dark}\n }\n @media (prefers-color-scheme: light) {\n :root {\n ${light}\n }\n }\n :root.color-scheme-light {\n ${light}\n }\n :root.color-scheme-dark {\n ${dark}\n }\n `;\n};\n\n/**\n * Injects `:root { … }` into the page `<head>` once.\n *\n * CSS custom properties defined on `:root` cascade through shadow DOM\n * boundaries, so this makes every `var(--lit-devtools-accent)` etc. resolve inside both\n * runtime elements (indicator, source-overlay) and Lit panel components.\n *\n * The injected stylesheet reacts to `prefers-color-scheme` and to\n * `.color-scheme-light` / `.color-scheme-dark` classes on the document root.\n * It never sets `color-scheme` on the host page; the panel opts in via\n * {@link InjectTokensOptions.colorScheme} for its own document.\n */\nexport const injectTokens = (options?: InjectTokensOptions): void => {\n if (_injected) return;\n _injected = true;\n const style = document.createElement('style');\n style.setAttribute('data-lit-devtools-tokens', '');\n style.textContent = tokenStyleText(options);\n document.head.prepend(style);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/lib/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,SAAS,EAAC,MAAM,KAAK,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqFpB,CAAC;AAEF,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCpB,CAAC;AAEF,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAE5C,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCrB,CAAC;AAEF,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAE9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,YAAY,KAAK,YAAY,EAAE,CAAC;AAE3D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;MAEnB,SAAS,CAAC,YAAY,CAAC;;CAE5B,CAAC;AAEF,IAAI,SAAS,GAAG,KAAK,CAAC;AAgBtB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC7B,WAAW,GAAG,KAAK,GACpB,GAAwB,EAAE,EAAU,EAAE;IACrC,MAAM,IAAI,GAAG,WAAW;QACtB,CAAC,CAAC,GAAG,YAAY,OAAO,aAAa,EAAE;QACvC,CAAC,CAAC,YAAY,CAAC;IACjB,MAAM,KAAK,GAAG,WAAW;QACvB,CAAC,CAAC,GAAG,aAAa,OAAO,cAAc,EAAE;QACzC,CAAC,CAAC,aAAa,CAAC;IAClB,OAAO;;QAED,YAAY;QACZ,IAAI;;;;UAIF,KAAK;;;;QAIP,KAAK;;;QAGL,IAAI;;GAET,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAA6B,EAAQ,EAAE;IAClE,IAAI,SAAS;QAAE,OAAO;IACtB,SAAS,GAAG,IAAI,CAAC;IACjB,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,YAAY,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;IACnD,KAAK,CAAC,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAC5C,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC,CAAC","sourcesContent":["import {css, unsafeCSS} from 'lit';\n\n/**\n * Design token CSS custom properties for the Lit DevTools.\n *\n * Two entry points:\n * - **`tokens`** — Lit `css` template that defines the theme-agnostic base\n * tokens on `:host`. Semantic color aliases (`--lit-devtools-bg`, `--lit-devtools-surface`, `--lit-devtools-text`,\n * etc.) are inherited from `:root`, where {@link injectTokens} installs them.\n * Use as `static styles = [tokens, css`…`]`.\n * - **`injectTokens()`** — injects `:root { … }` into the page `<head>` once.\n * This makes semantic aliases available to every devtools surface, both\n * runtime elements (indicator, source-overlay) that build their shadow DOM\n * via `innerHTML` and Lit panel components that inherit from `:root`.\n * The injected stylesheet reacts to `prefers-color-scheme` and to\n * `.color-scheme-light` / `.color-scheme-dark` classes on `:root`.\n *\n * Sourced from the lit-design skill (`tokens/colors.css`). Defaults to the\n * dark DevTools theme; the light lit.dev website palette is applied when the\n * OS/browser requests a light color scheme or when `:root` has the matching\n * theme class.\n *\n * Fonts are system stacks (no webfonts). For the branded Manrope + Roboto Mono\n * see the lit-design skill's `fonts/` directory.\n */\n\nconst baseTokenCSS = `\n /* ---- Brand · the Lit flame ---- */\n --lit-devtools-lit-blue: #324fff;\n --lit-devtools-lit-blue-bright: #4d63ff;\n --lit-devtools-lit-indigo: #2a2c9d;\n --lit-devtools-lit-dark-blue: #283198;\n --lit-devtools-lit-cyan: #00ffff;\n --lit-devtools-lit-dark-cyan: #00e8ff;\n\n /* ---- Neutral ink scale (0 = near-black, 13 = white) ---- */\n --lit-devtools-ink-0: hsl(0 0% 1%);\n --lit-devtools-ink-1: hsl(0 0% 5%);\n --lit-devtools-ink-2: hsl(0 0% 7%);\n --lit-devtools-ink-3: hsl(0 0% 11%);\n --lit-devtools-ink-4: hsl(0 0% 13%);\n --lit-devtools-ink-5: hsl(0 0% 16%);\n --lit-devtools-ink-6: hsl(0 0% 21%);\n --lit-devtools-ink-7: hsl(0 0% 28%);\n --lit-devtools-ink-8: hsl(0 0% 38%);\n --lit-devtools-ink-9: hsl(0 0% 57%);\n --lit-devtools-ink-10: hsl(0 0% 63%);\n --lit-devtools-ink-11: hsl(0 0% 78%);\n --lit-devtools-ink-12: hsl(0 0% 89%);\n --lit-devtools-ink-13: hsl(0 0% 100%);\n\n /* ---- Typography ---- */\n --lit-devtools-font-sans: system-ui, -apple-system, 'Segoe UI', sans-serif;\n --lit-devtools-font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;\n\n --lit-devtools-weight-regular: 400;\n --lit-devtools-weight-medium: 500;\n --lit-devtools-weight-semibold: 600;\n --lit-devtools-weight-bold: 700;\n --lit-devtools-weight-extrabold: 800;\n\n --lit-devtools-text-2xs: 11px;\n --lit-devtools-text-xs: 12px;\n --lit-devtools-text-sm: 13px;\n --lit-devtools-text-md: 14px;\n --lit-devtools-text-base:16px;\n\n --lit-devtools-leading-tight: 1.15;\n --lit-devtools-leading-snug: 1.3;\n --lit-devtools-leading-normal: 1.5;\n\n --lit-devtools-tracking-tight: -0.02em;\n --lit-devtools-tracking-snug: -0.01em;\n --lit-devtools-tracking-normal: 0;\n --lit-devtools-tracking-wide: 0.02em;\n --lit-devtools-tracking-caps: 0.06em;\n\n /* ---- Spacing (4px base) ---- */\n --lit-devtools-space-0: 0;\n --lit-devtools-space-1: 2px;\n --lit-devtools-space-2: 4px;\n --lit-devtools-space-3: 6px;\n --lit-devtools-space-4: 8px;\n --lit-devtools-space-5: 12px;\n --lit-devtools-space-6: 16px;\n --lit-devtools-space-7: 20px;\n --lit-devtools-space-8: 24px;\n --lit-devtools-space-9: 32px;\n\n /* ---- Radius ---- */\n --lit-devtools-radius-xs: 3px;\n --lit-devtools-radius-sm: 5px;\n --lit-devtools-radius-md: 8px;\n --lit-devtools-radius-lg: 12px;\n --lit-devtools-radius-xl: 16px;\n --lit-devtools-radius-pill: 999px;\n\n /* ---- Elevation ---- */\n --lit-devtools-shadow-xs: 0 1px 2px hsl(0 0% 0% / 0.30);\n --lit-devtools-shadow-sm: 0 1px 5px hsl(0 0% 0% / 0.35);\n --lit-devtools-shadow-md: 0 4px 14px hsl(0 0% 0% / 0.40);\n --lit-devtools-shadow-lg: 0 12px 32px hsl(0 0% 0% / 0.50);\n --lit-devtools-shadow-xl: 0 24px 64px hsl(0 0% 0% / 0.55);\n --lit-devtools-shadow-window: 0 24px 80px hsl(0 0% 0% / 0.6),\n 0 0 0 1px hsl(0 0% 100% / 0.06);\n --lit-devtools-ring: 0 0 0 2px var(--lit-devtools-accent-ring);\n\n /* ---- Motion ---- */\n --lit-devtools-ease-standard: cubic-bezier(0.2, 0, 0, 1);\n --lit-devtools-dur-fast: 140ms;\n --lit-devtools-dur-normal: 220ms;\n`;\n\nconst darkThemeCSS = `\n /* ---- DARK · DevTools theme ---- */\n --lit-devtools-accent: var(--lit-devtools-lit-blue-bright);\n --lit-devtools-accent-hover: #6478ff;\n --lit-devtools-accent-pressed: #3d54f0;\n --lit-devtools-accent-soft: hsla(232 100% 65% / 0.16);\n --lit-devtools-accent-ring: hsla(232 100% 65% / 0.45);\n --lit-devtools-on-accent: #ffffff;\n --lit-devtools-accent-cyan: var(--lit-devtools-lit-dark-cyan);\n\n --lit-devtools-bg: var(--lit-devtools-ink-0);\n --lit-devtools-surface: var(--lit-devtools-ink-2);\n --lit-devtools-surface-low: var(--lit-devtools-ink-1);\n --lit-devtools-surface-container: var(--lit-devtools-ink-4);\n --lit-devtools-surface-container-high: var(--lit-devtools-ink-5);\n --lit-devtools-surface-elevated: var(--lit-devtools-ink-6);\n --lit-devtools-surface-hover: hsl(0 0% 100% / 0.04);\n --lit-devtools-surface-active: hsl(0 0% 100% / 0.07);\n\n --lit-devtools-text: var(--lit-devtools-ink-12);\n --lit-devtools-text-strong: var(--lit-devtools-ink-13);\n --lit-devtools-text-secondary: var(--lit-devtools-ink-10);\n --lit-devtools-text-muted: var(--lit-devtools-ink-8);\n --lit-devtools-text-link: var(--lit-devtools-lit-blue-bright);\n\n --lit-devtools-border: var(--lit-devtools-ink-6);\n --lit-devtools-border-strong: var(--lit-devtools-ink-7);\n --lit-devtools-border-subtle: hsl(0 0% 100% / 0.06);\n\n --lit-devtools-success: hsl(158 74% 53%);\n --lit-devtools-success-soft: hsl(158 74% 53% / 0.15);\n --lit-devtools-warning: #f4bf4f;\n --lit-devtools-warning-soft: hsl(43 88% 63% / 0.15);\n --lit-devtools-error: #ff6b6b;\n --lit-devtools-error-soft: hsl(0 100% 71% / 0.15);\n --lit-devtools-info: var(--lit-devtools-lit-dark-cyan);\n --lit-devtools-info-soft: hsl(187 100% 47% / 0.15);\n\n --lit-devtools-selection-bg: var(--lit-devtools-accent);\n --lit-devtools-on-selection: #ffffff;\n`;\n\nconst darkSchemeCSS = `color-scheme: dark;`;\n\nconst lightThemeCSS = `\n /* ---- LIGHT · lit.dev website theme ---- */\n --lit-devtools-accent: var(--lit-devtools-lit-blue);\n --lit-devtools-accent-hover: #1f3bff;\n --lit-devtools-accent-pressed: #2a2c9d;\n --lit-devtools-accent-soft: hsla(232 100% 60% / 0.12);\n --lit-devtools-accent-ring: hsla(232 100% 60% / 0.40);\n --lit-devtools-on-accent: #ffffff;\n --lit-devtools-accent-cyan: var(--lit-devtools-lit-dark-cyan);\n\n --lit-devtools-bg: #f4f4f4;\n --lit-devtools-surface: #ffffff;\n --lit-devtools-surface-low: #f3f3f3;\n --lit-devtools-surface-container: #ffffff;\n --lit-devtools-surface-container-high: #e8e8e8;\n --lit-devtools-surface-elevated: #ffffff;\n --lit-devtools-surface-hover: hsl(0 0% 0% / 0.04);\n --lit-devtools-surface-active: hsl(0 0% 0% / 0.07);\n\n --lit-devtools-text: #242424;\n --lit-devtools-text-strong: #000000;\n --lit-devtools-text-secondary: #6e6e6e;\n --lit-devtools-text-muted: #949494;\n --lit-devtools-text-link: #005dc7;\n\n --lit-devtools-border: #e2e2e2;\n --lit-devtools-border-strong: #c6c6c6;\n --lit-devtools-border-subtle: hsl(0 0% 0% / 0.07);\n\n --lit-devtools-success: #00865b;\n --lit-devtools-success-soft: hsl(158 100% 26% / 0.10);\n --lit-devtools-warning: #b26a00;\n --lit-devtools-warning-soft: hsl(40 100% 35% / 0.10);\n --lit-devtools-error: #ba1a1a;\n --lit-devtools-error-soft: hsl(0 75% 42% / 0.10);\n --lit-devtools-info: #005dc7;\n --lit-devtools-info-soft: hsl(210 100% 39% / 0.10);\n\n --lit-devtools-selection-bg: var(--lit-devtools-accent);\n --lit-devtools-on-selection: #ffffff;\n`;\n\nconst lightSchemeCSS = `color-scheme: light;`;\n\n/**\n * Default dark theme tokens as a flat string, primarily for use by\n * {@link injectTokens}. Prefer importing `tokens` for Lit components so the\n * semantic aliases are inherited from `:root`.\n */\nexport const tokenCSS = `${baseTokenCSS}\\n${darkThemeCSS}`;\n\n/**\n * Lit `css` template for use in panel component shadow roots.\n *\n * ```ts\n * import {tokens} from '../lib/tokens.js';\n * // ...\n * static override styles = [tokens, css`…`];\n * ```\n *\n * This installs the theme-agnostic base tokens on `:host`. Semantic aliases\n * (`--lit-devtools-bg`, `--lit-devtools-text`, etc.) are inherited from `:root`, where they are installed\n * by {@link injectTokens}. The panel iframe calls `injectTokens()` from\n * \\`lit-devtools-panel.ts\\` so all components inherit the same dark/light theme.\n */\nexport const tokens = css`\n :host {\n ${unsafeCSS(baseTokenCSS)}\n }\n`;\n\nlet _injected = false;\n\n/**\n * Options for {@link injectTokens} / {@link tokenStyleText}.\n */\nexport interface InjectTokensOptions {\n /**\n * Also declare `color-scheme` on `:root`. Only safe when the devtools OWN\n * the target document (the panel iframe / standalone panel page). Never set\n * this when injecting into the host page: `color-scheme` on the embedder's\n * `:root` makes the UA repaint the canvas dark for apps that don't declare\n * an opaque background. Defaults to `false`.\n */\n colorScheme?: boolean;\n}\n\n/**\n * Builds the token stylesheet text injected by {@link injectTokens}.\n *\n * By default the sheet defines custom properties only — inert for the host\n * page. With `colorScheme: true` it additionally declares `color-scheme` so\n * the owning document's UA surfaces (canvas, form controls, scrollbars)\n * follow the devtools theme.\n */\nexport const tokenStyleText = ({\n colorScheme = false,\n}: InjectTokensOptions = {}): string => {\n const dark = colorScheme\n ? `${darkThemeCSS}\\n ${darkSchemeCSS}`\n : darkThemeCSS;\n const light = colorScheme\n ? `${lightThemeCSS}\\n ${lightSchemeCSS}`\n : lightThemeCSS;\n return `\n :root {\n ${baseTokenCSS}\n ${dark}\n }\n @media (prefers-color-scheme: light) {\n :root {\n ${light}\n }\n }\n :root.color-scheme-light {\n ${light}\n }\n :root.color-scheme-dark {\n ${dark}\n }\n `;\n};\n\n/**\n * Injects `:root { … }` into the page `<head>` once.\n *\n * CSS custom properties defined on `:root` cascade through shadow DOM\n * boundaries, so this makes every `var(--lit-devtools-accent)` etc. resolve inside both\n * runtime elements (indicator, source-overlay) and Lit panel components.\n *\n * The injected stylesheet reacts to `prefers-color-scheme` and to\n * `.color-scheme-light` / `.color-scheme-dark` classes on the document root.\n * It never sets `color-scheme` on the host page; the panel opts in via\n * {@link InjectTokensOptions.colorScheme} for its own document.\n */\nexport const injectTokens = (options?: InjectTokensOptions): void => {\n if (_injected) return;\n _injected = true;\n const style = document.createElement('style');\n style.setAttribute('data-lit-devtools-tokens', '');\n style.textContent = tokenStyleText(options);\n document.head.prepend(style);\n};\n"]}
|
package/lib/transform.d.ts
CHANGED
package/lib/transform.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../src/lib/transform.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../src/lib/transform.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,cAAc,CAAC;AAGvC;;;;;GAKG;AACH,eAAO,MAAM,cAAc,kBAAkB,CAAC;AAE9C,2DAA2D;AAC3D,eAAO,MAAM,UAAU,yBAA6B,CAAC;AASrD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,SACtB,MAAM,sBACQ,OAAO,KAC1B,OAIwD,CAAC;AAE5D,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;CAC7C;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,SACvB,MAAM,KACX,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAwDzC,CAAC"}
|
package/lib/transform.js
CHANGED
package/lib/transform.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../src/lib/transform.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../src/lib/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAC5C,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC;AAE9C,2DAA2D;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,cAAc,SAAS,CAAC;AAErD,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;AAC/D,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AAElD,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAW,EAAE,CACrD,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACvE,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,IAAY,EACZ,kBAA2B,EAClB,EAAE,CACX,yEAAyE,CAAC,IAAI,CAC5E,IAAI,CACL;IACD,CAAC,kBAAkB,IAAI,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAO5D;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,kBA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SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC;QACjE,CAAC;aAAM,CAAC;YACN,wEAAwE;YACxE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,cAAc,GAAG,IAAI,EAAE,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,GAAG,IAAI,CAAC;IACjB,CAAC;IACD,IAAI,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,CAAC,EAAE,CAAC;QAChD,EAAE,CAAC,OAAO,CAAC,WAAW,UAAU,MAAM,CAAC,CAAC;QACxC,EAAE,CAAC,MAAM,CAAC,gCAAgC,CAAC,CAAC;QAC5C,OAAO,GAAG,IAAI,CAAC;IACjB,CAAC;IACD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO;QACL,IAAI,EAAE,EAAE,CAAC,QAAQ,EAAE;QACnB,GAAG,EAAE,EAAE,CAAC,WAAW,CAAC,EAAC,KAAK,EAAE,UAAU,EAAC,CAAC;KACzC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {init, parse} from 'es-module-lexer';\nimport MagicString from 'magic-string';\nimport {WRAP_TABLE} from './wrap-table.js';\n\n/**\n * Prefix for this plugin's virtual module ids. Rewritten specifiers carry\n * the `\\0` convention directly in the transformed source; Vite's\n * import-analysis resolves them through our `resolveId` and encodes the\n * `\\0` for the browser, so it never reaches the network.\n */\nexport const VIRTUAL_PREFIX = '\\0lit-plugin:';\n\n/** Virtual module that installs the define interceptor. */\nexport const INSTALL_ID = `${VIRTUAL_PREFIX}install`;\n\nconst LIT_FAMILY_PACKAGES = ['lit', 'lit-html', 'lit-element'];\nconst LIT_FAMILY_SCOPES = ['@lit/', '@lit-labs/'];\n\nconst isLitFamilySpecifier = (spec: string): boolean =>\n LIT_FAMILY_PACKAGES.some((p) => spec === p || spec.startsWith(`${p}/`)) ||\n LIT_FAMILY_SCOPES.some((s) => spec.startsWith(s));\n\n/**\n * A module needs the define interceptor + self-accept if it registers\n * custom elements: a textual `customElements.define(` call, or — only when\n * a lit-family import is present — a `customElement(` decorator call (the\n * decorator runtime call stays textually present after TS transpilation).\n */\nexport const isComponentModule = (\n code: string,\n hasLitFamilyImport: boolean\n): boolean =>\n /(?<![.\\w$])(?:(?:window|globalThis|self)\\.)?customElements\\.define\\s*\\(/.test(\n code\n ) ||\n (hasLitFamilyImport && /\\bcustomElement\\s*\\(/.test(code));\n\nexport interface LitPluginTransformResult {\n code: string;\n map: ReturnType<MagicString['generateMap']>;\n}\n\n/**\n * The whole dev transform, as a pure function of the module source:\n *\n * - Pass 1 (all user modules — shared template-partial modules must intern\n * too): rewrite import/export-from/dynamic-import specifiers found in the\n * wrap table to their `\\0lit-plugin:` wrapper module.\n * - Pass 2 (component modules): prepend the interceptor install import\n * (static imports hoist, so the interceptor is installed before this\n * module's defines) and append a self-accept (re-execution alone triggers\n * the define interceptor — no hotUpdate hook needed).\n *\n * Returns `null` when the module needs no changes.\n */\nexport const transformLitModule = async (\n code: string\n): Promise<LitPluginTransformResult | null> => {\n // Cheap pre-filter before parsing.\n if (!code.includes('lit') && !code.includes('customElements')) {\n return null;\n }\n // Idempotency: never re-instrument our own output.\n if (code.includes(VIRTUAL_PREFIX)) {\n return null;\n }\n await init();\n let imports;\n try {\n [imports] = parse(code);\n } catch {\n // Not parseable as a module; leave it to Vite to error.\n return null;\n }\n const ms = new MagicString(code);\n let changed = false;\n let hasLitFamilyImport = false;\n for (const imp of imports) {\n // `import.meta` reports a null specifier; a dynamic import reports\n // undefined when its argument is not statically analyzable, and a glob\n // (template literal) specifier is a pattern rather than a real id.\n const spec = imp.specifier;\n if (spec == null || (imp.type === 'dynamic' && imp.glob)) {\n continue;\n }\n if (isLitFamilySpecifier(spec)) {\n hasLitFamilyImport = true;\n }\n if (!WRAP_TABLE.has(spec)) {\n continue;\n }\n if (imp.type === 'dynamic') {\n // Dynamic import: [start, end) includes the quotes (or backticks) —\n // narrow them to plain quotes around the rewritten specifier.\n ms.overwrite(imp.start, imp.end, `'${VIRTUAL_PREFIX}${spec}'`);\n } else {\n // Static import / export-from: [start, end) is the bare specifier text.\n ms.overwrite(imp.start, imp.end, `${VIRTUAL_PREFIX}${spec}`);\n }\n changed = true;\n }\n if (isComponentModule(code, hasLitFamilyImport)) {\n ms.prepend(`import '${INSTALL_ID}';\\n`);\n ms.append(`\\nimport.meta.hot?.accept();\\n`);\n changed = true;\n }\n if (!changed) {\n return null;\n }\n return {\n code: ms.toString(),\n map: ms.generateMap({hires: 'boundary'}),\n };\n};\n"]}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2026 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/
|
|
1
|
+
/** The component the source overlay resolved under the pointer. */
|
|
6
2
|
export interface ElementInfo {
|
|
3
|
+
/** The element's tag name, e.g. `my-element`. */
|
|
7
4
|
tagName: string;
|
|
5
|
+
/** The class that defines the element, when the plugin recorded it. */
|
|
8
6
|
componentName?: string;
|
|
7
|
+
/** Where the component is defined. */
|
|
9
8
|
source: {
|
|
9
|
+
/** Absolute path of the defining module. */
|
|
10
10
|
filePath: string;
|
|
11
|
+
/** Line of the class declaration in that module. */
|
|
11
12
|
lineNumber: number;
|
|
12
13
|
};
|
|
13
14
|
}
|
|
15
|
+
/** An editor the source overlay can open files in. */
|
|
14
16
|
export interface EditorConfig {
|
|
17
|
+
/** Label shown in the overlay, e.g. `VS Code`. */
|
|
15
18
|
name: string;
|
|
19
|
+
/** Builds the URL that opens `path` at `line`, e.g. `vscode://file/…`. */
|
|
16
20
|
url: (path: string, line: number) => string;
|
|
17
21
|
}
|
|
22
|
+
/** Options for the in-page source overlay (`sourceOverlay`). */
|
|
18
23
|
export interface SourceOverlayOptions {
|
|
19
24
|
/**
|
|
20
25
|
* Hotkey letter with Ctrl+Shift (default `s` -> Ctrl+Shift+S).
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/lib/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/lib/types.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,MAAM,WAAW,WAAW;IAC1B,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,MAAM,EAAE;QACN,4CAA4C;QAC5C,QAAQ,EAAE,MAAM,CAAC;QACjB,oDAAoD;QACpD,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,sDAAsD;AACtD,MAAM,WAAW,YAAY;IAC3B,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7C;AAED,gEAAgE;AAChE,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,2EAA2E;IAC3E,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IAE/B,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,iDAAiD;IACjD,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,OAAO,CAAC;IAEnC,uDAAuD;IACvD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;CACxC"}
|
package/lib/types.js
CHANGED
package/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/lib/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/lib/types.ts"],"names":[],"mappings":"","sourcesContent":["/** The component the source overlay resolved under the pointer. */\nexport interface ElementInfo {\n /** The element's tag name, e.g. `my-element`. */\n tagName: string;\n /** The class that defines the element, when the plugin recorded it. */\n componentName?: string;\n /** Where the component is defined. */\n source: {\n /** Absolute path of the defining module. */\n filePath: string;\n /** Line of the class declaration in that module. */\n lineNumber: number;\n };\n}\n\n/** An editor the source overlay can open files in. */\nexport interface EditorConfig {\n /** Label shown in the overlay, e.g. `VS Code`. */\n name: string;\n /** Builds the URL that opens `path` at `line`, e.g. `vscode://file/…`. */\n url: (path: string, line: number) => string;\n}\n\n/** Options for the in-page source overlay (`sourceOverlay`). */\nexport interface SourceOverlayOptions {\n /**\n * Hotkey letter with Ctrl+Shift (default `s` -> Ctrl+Shift+S).\n */\n key?: string;\n\n /** Built-in editor key or custom `{ name, url }`. Defaults to `vscode`. */\n editor?: EditorConfig | string;\n\n /** Optional workspace root prefix for absolute file paths. */\n workspaceRoot?: string;\n\n /** Mouse move throttle in ms (default 50). */\n throttleMs?: number;\n\n /** Filter elements to skip during inspection. */\n exclude?: (el: Element) => boolean;\n\n /** Callback fired when the user clicks a component. */\n onSelect?: (info: ElementInfo) => void;\n}\n"]}
|
package/lib/wrap-table.d.ts
CHANGED
package/lib/wrap-table.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap-table.d.ts","sourceRoot":"","sources":["../src/lib/wrap-table.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"wrap-table.d.ts","sourceRoot":"","sources":["../src/lib/wrap-table.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,CAAC;IACvD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAQD,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAehE,CAAC"}
|
package/lib/wrap-table.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* The exact wrap surface: which template-tag exports of which lit-family
|
|
3
|
+
* module specifiers get interned, and in which namespace.
|
|
4
|
+
*
|
|
5
|
+
* Namespaces are per tag *type*, not per module — `html` from `'lit'` and
|
|
6
|
+
* from `'lit-html'` feed the same lit-html template cache, so they must
|
|
7
|
+
* share canonical arrays. But content-equal `html` and `svg` templates must
|
|
8
|
+
* never share one (a shared Template would parse SVG as HTML), and the
|
|
9
|
+
* static-html tags pass zero-statics calls straight through to lit-html, so
|
|
10
|
+
* they get their own namespaces too.
|
|
11
|
+
*
|
|
12
|
+
* Specifiers must be valid export-map subpaths (e.g. `lit/index.js` and
|
|
13
|
+
* `lit-html/lit-html.js` are not, and are deliberately absent).
|
|
5
14
|
*/
|
|
6
15
|
const tags = (...names) =>
|
|
7
16
|
names.map((exportName) => ({exportName, ns: exportName}));
|
package/lib/wrap-table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap-table.js","sourceRoot":"","sources":["../src/lib/wrap-table.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"wrap-table.js","sourceRoot":"","sources":["../src/lib/wrap-table.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,MAAM,IAAI,GAAG,CAAC,GAAG,KAAsC,EAAgB,EAAE,CACvE,KAAK,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,EAAC,UAAU,EAAE,EAAE,EAAE,UAAU,EAAC,CAAC,CAAC,CAAC;AAE5D,MAAM,UAAU,GAAG,CAAC,GAAG,KAAsC,EAAgB,EAAE,CAC7E,KAAK,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,EAAC,UAAU,EAAE,EAAE,EAAE,UAAU,UAAU,EAAE,EAAC,CAAC,CAAC,CAAC;AAExE,MAAM,CAAC,MAAM,UAAU,GAA+C,IAAI,GAAG,CAAC;IAC5E,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC,oBAAoB,EAAE,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC3D,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC3C,CAAC,oBAAoB,EAAE,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC3D,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC,4BAA4B,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IACpE,CAAC,uBAAuB,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC,kCAAkC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACjD,qEAAqE;IACrE,uEAAuE;IACvE,sEAAsE;IACtE,qBAAqB;IACrB,CAAC,mBAAmB,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CAC3C,CAAC,CAAC","sourcesContent":["/**\n * The exact wrap surface: which template-tag exports of which lit-family\n * module specifiers get interned, and in which namespace.\n *\n * Namespaces are per tag *type*, not per module — `html` from `'lit'` and\n * from `'lit-html'` feed the same lit-html template cache, so they must\n * share canonical arrays. But content-equal `html` and `svg` templates must\n * never share one (a shared Template would parse SVG as HTML), and the\n * static-html tags pass zero-statics calls straight through to lit-html, so\n * they get their own namespaces too.\n *\n * Specifiers must be valid export-map subpaths (e.g. `lit/index.js` and\n * `lit-html/lit-html.js` are not, and are deliberately absent).\n */\n\nexport interface WrappedTag {\n readonly exportName: 'html' | 'svg' | 'mathml' | 'css';\n readonly ns: string;\n}\n\nconst tags = (...names: Array<WrappedTag['exportName']>): WrappedTag[] =>\n names.map((exportName) => ({exportName, ns: exportName}));\n\nconst staticTags = (...names: Array<WrappedTag['exportName']>): WrappedTag[] =>\n names.map((exportName) => ({exportName, ns: `static-${exportName}`}));\n\nexport const WRAP_TABLE: ReadonlyMap<string, readonly WrappedTag[]> = new Map([\n ['lit', tags('html', 'svg', 'mathml', 'css')],\n ['lit/html.js', tags('html', 'svg', 'mathml')],\n ['lit/static-html.js', staticTags('html', 'svg', 'mathml')],\n ['lit-html', tags('html', 'svg', 'mathml')],\n ['lit-html/static.js', staticTags('html', 'svg', 'mathml')],\n ['lit-element', tags('html', 'svg', 'mathml', 'css')],\n ['lit-element/lit-element.js', tags('html', 'svg', 'mathml', 'css')],\n ['@lit/reactive-element', tags('css')],\n ['@lit/reactive-element/css-tag.js', tags('css')],\n // The signals tags wrap the user's values but pass the strings array\n // straight through to lit-html's core tags, so they intern in the same\n // namespaces as plain html/svg (content-equal templates share a cache\n // entry either way).\n ['@lit-labs/signals', tags('html', 'svg')],\n]);\n"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oddsquad/vite-plugin-lit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Vite plugin providing true HMR for Lit components, plus CSS helpers and a DevTools panel",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
|
-
"author": "
|
|
6
|
+
"author": "oddcelot",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "index.js",
|
|
9
9
|
"module": "index.js",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmr-incompatibility.d.ts","sourceRoot":"","sources":["../src/types/hmr-incompatibility.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"hmr-incompatibility.d.ts","sourceRoot":"","sources":["../src/types/hmr-incompatibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,kFAAkF;AAClF,MAAM,MAAM,wBAAwB,GAChC;IAAC,IAAI,EAAE,qBAAqB,CAAA;CAAC,GAC7B;IAAC,IAAI,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,GACtC;IAAC,IAAI,EAAE,6BAA6B,CAAA;CAAC,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,sGAAsG;IACtG,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,wBAAwB,CAAC;IACjC,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;CACpC;AAED,sFAAsF;AACtF,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,WAAY,wBAAwB,KAAG,MASpE,CAAC"}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Shared types and channel constant for HMR-incompatibility reporting.
|
|
3
|
+
*
|
|
4
|
+
* When the browser runtime can't hot-patch a component in place it logs one
|
|
5
|
+
* line to the console and, by default, full-reloads the page — which clears
|
|
6
|
+
* the console before anyone reads it. These types carry the same reason, in
|
|
7
|
+
* structured form, from the page runtime to the node side over the HMR
|
|
8
|
+
* {@link HMR_INCOMPATIBLE_CHANNEL}, where it is cached so the DevTools panel
|
|
9
|
+
* and an agent-facing query RPC can both read it back after the reload.
|
|
10
|
+
*
|
|
11
|
+
* The three reasons mirror the "Cannot be patched in place" cases documented
|
|
12
|
+
* in `docs/src/content/docs/reference/limitations.mdx`; adding a fourth means
|
|
13
|
+
* extending {@link HmrIncompatibilityReason} and {@link describeHmrReason}
|
|
14
|
+
* together, plus the docs page.
|
|
5
15
|
*/
|
|
6
16
|
/** HMR channel the page runtime uses to report an {@link HmrIncompatibilityEvent}. */
|
|
7
17
|
export const HMR_INCOMPATIBLE_CHANNEL = 'lit:hmr:incompatible';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmr-incompatibility.js","sourceRoot":"","sources":["../src/types/hmr-incompatibility.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"hmr-incompatibility.js","sourceRoot":"","sources":["../src/types/hmr-incompatibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAuBH,sFAAsF;AACtF,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAgC,EAAU,EAAE;IAC5E,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,qBAAqB;YACxB,OAAO,8BAA8B,CAAC;QACxC,KAAK,cAAc;YACjB,OAAO,oBAAoB,MAAM,CAAC,MAAM,EAAE,CAAC;QAC7C,KAAK,6BAA6B;YAChC,OAAO,sEAAsE,CAAC;IAClF,CAAC;AACH,CAAC,CAAC","sourcesContent":["/**\n * Shared types and channel constant for HMR-incompatibility reporting.\n *\n * When the browser runtime can't hot-patch a component in place it logs one\n * line to the console and, by default, full-reloads the page — which clears\n * the console before anyone reads it. These types carry the same reason, in\n * structured form, from the page runtime to the node side over the HMR\n * {@link HMR_INCOMPATIBLE_CHANNEL}, where it is cached so the DevTools panel\n * and an agent-facing query RPC can both read it back after the reload.\n *\n * The three reasons mirror the \"Cannot be patched in place\" cases documented\n * in `docs/src/content/docs/reference/limitations.mdx`; adding a fourth means\n * extending {@link HmrIncompatibilityReason} and {@link describeHmrReason}\n * together, plus the docs page.\n */\n\n/** Why a component couldn't be hot-patched in place, or a related silent case. */\nexport type HmrIncompatibilityReason =\n | {code: 'accessor-decorators'}\n | {code: 'patch-failed'; detail: string}\n | {code: 'observed-attributes-changed'};\n\n/**\n * One HMR-incompatibility notice from the page runtime. `action` reflects\n * what actually happened for *this* event, not just the configured default:\n * 'reload' / 'warn' come from `hmr.onIncompatible`; 'none' is the\n * `observed-attributes-changed` case, which never reloads regardless of that\n * setting (the patch already succeeded).\n */\nexport interface HmrIncompatibilityEvent {\n tagName: string;\n /** `Date.now()` in the browser — there is no shared clock with the timeline's `performance.now()`. */\n time: number;\n reason: HmrIncompatibilityReason;\n action: 'reload' | 'warn' | 'none';\n}\n\n/** HMR channel the page runtime uses to report an {@link HmrIncompatibilityEvent}. */\nexport const HMR_INCOMPATIBLE_CHANNEL = 'lit:hmr:incompatible';\n\n/**\n * How many events the node-side cache keeps, and the panel mirrors. A dev\n * session with many failing edits must not grow either without bound; the\n * newest are the ones worth keeping.\n */\nexport const MAX_HMR_INCOMPATIBILITIES = 50;\n\n/**\n * Human-readable text for a reason, shared by the browser console message in\n * `src/lib/runtime/patch.ts` and the DevTools panel's banner so the two can't\n * drift apart. The wording of the first two cases is asserted verbatim by\n * `src/test/unit/patch_test.ts` — it is part of the console output contract.\n */\nexport const describeHmrReason = (reason: HmrIncompatibilityReason): string => {\n switch (reason.code) {\n case 'accessor-decorators':\n return 'standard accessor decorators';\n case 'patch-failed':\n return `patching failed: ${reason.detail}`;\n case 'observed-attributes-changed':\n return \"observedAttributes changed; the platform registry can't pick this up\";\n }\n};\n"]}
|
package/types/in-page.d.ts
CHANGED
package/types/in-page.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-page.d.ts","sourceRoot":"","sources":["../src/types/in-page.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"in-page.d.ts","sourceRoot":"","sources":["../src/types/in-page.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,8CAA8C;AAC9C,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AAEjD;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE;QACN,UAAU,EAAE;YACV,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;SACxC,CAAC;KACH,CAAC;CACH"}
|
package/types/in-page.js
CHANGED
package/types/in-page.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-page.js","sourceRoot":"","sources":["../src/types/in-page.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"in-page.js","sourceRoot":"","sources":["../src/types/in-page.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,8CAA8C;AAC9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC","sourcesContent":["/**\n * The direct page ↔ panel channel, for interactions that never need the node\n * side.\n *\n * Everything else the Components tab does goes panel → node → page over RPC\n * and Vite's HMR channel, and should keep going that way: the node side caches\n * the tree and the last details so a panel that connects late has something to\n * render, and so the MCP tools can answer without a panel open. None of that\n * is true of the hover outline — it is pure page-local drawing, it is issued\n * on every `mouseenter` in the tree, and nothing but the page itself ever\n * wants to know about it.\n *\n * Devframe's in-page channel connects a page script to a panel iframe over a\n * `MessageChannel` with no server in the path (same-origin, handshake by\n * posting to the ancestor chain). Two consequences:\n *\n * - The outline stops paying a full round trip through node on every pointer\n * move.\n * - It keeps working where there is no node side at all, which is what a\n * static snapshot of the panel needs to be more than a screenshot.\n *\n * The channel is best-effort by construction. A panel opened as its own tab\n * has no ancestor page script to handshake with, so both sides must treat\n * \"not connected\" as normal and fall back to the RPC path.\n */\n\n/** Channel name, shared by both endpoints. */\nexport const LIT_IN_PAGE_CHANNEL = 'lit:in-page';\n\n/**\n * Contract for {@link LIT_IN_PAGE_CHANNEL}.\n *\n * `highlight` is an event, not a query: the panel does not want an answer, and\n * a fire-and-forget emit is what keeps a hover cheap. `id` is the same stable\n * numeric element id used everywhere else (the timeline's `idOf()` WeakMap),\n * so a tree node, a details payload, and an outline all agree on identity.\n * `null` clears the outline.\n */\nexport interface LitInPageProtocol {\n events: {\n pageScript: {\n highlight: (id: number | null) => void;\n };\n };\n}\n"]}
|
package/types/inspector.d.ts
CHANGED
package/types/inspector.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspector.d.ts","sourceRoot":"","sources":["../src/types/inspector.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"inspector.d.ts","sourceRoot":"","sources":["../src/types/inspector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,yEAAyE;AACzE,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,iBAAiB,EAAE,CAAC;CAC/B;AAED,4EAA4E;AAC5E,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,SAAS,EAAE,MAAM,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AI,CAAA;CAAC;AACpC,wEAAwE;GACtE;IAAC,IAAI,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;CAAC;AACxC;;;;GAIG;GACD;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC;AACrC;;;;GAIG;GACD;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAC;AAEnB,iFAAiF;AACjF,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD,4EAA4E;AAC5E,eAAO,MAAM,oBAAoB,qBAAqB,CAAC;AAEvD,6EAA6E;AAC7E,eAAO,MAAM,8BAA8B,gCAAgC,CAAC;AAE5E,wEAAwE;AACxE,eAAO,MAAM,YAAY,4BAA4B,CAAC;AAEtD,mFAAmF;AACnF,eAAO,MAAM,iBAAiB,YAAY,CAAC"}
|
package/types/inspector.js
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Shared types and channel/path constants for the Components inspector.
|
|
3
|
+
*
|
|
4
|
+
* The inspector lets the DevTools panel show a hierarchical tree of the Lit
|
|
5
|
+
* components on the page plus a detail view (reactive properties, internal
|
|
6
|
+
* state, attributes, source) of a selected element. The panel can't touch the
|
|
7
|
+
* page DOM directly (separate iframe document), so everything flows over the
|
|
8
|
+
* existing transport: panel → server (POST {@link INSPECT_PATH}) → app runtime
|
|
9
|
+
* (HMR {@link INSPECT_CMD_CHANNEL}); app → server (HMR
|
|
10
|
+
* {@link INSPECT_DATA_CHANNEL}) → panel (SSE `event: {@link INSPECT_SSE_EVENT}`).
|
|
11
|
+
*
|
|
12
|
+
* Elements are referenced across the boundary by the stable numeric id from the
|
|
13
|
+
* timeline's `idOf()` WeakMap, so a tree node, a details payload, and an
|
|
14
|
+
* inspector pick all agree on identity.
|
|
5
15
|
*/
|
|
6
16
|
/** HMR channel the server uses to forward a panel command to the app runtime. */
|
|
7
17
|
export const INSPECT_CMD_CHANNEL = 'lit:inspect:cmd';
|