@oddsquad/vite-plugin-lit 0.2.2 → 0.3.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 +64 -0
- package/LICENSE +28 -0
- package/README.md +153 -0
- package/bin.mjs +154 -0
- package/client.d.ts +61 -0
- package/dist/client/assets/browser-agent-rpc-BXhoSh1z-BvWe4sTJ.js +69 -0
- package/dist/client/assets/browser-agent-rpc-BXhoSh1z-BvWe4sTJ.js.map +1 -0
- package/dist/client/assets/index-CFrVgNfS.js +9740 -0
- package/dist/client/assets/index-CFrVgNfS.js.map +1 -0
- package/{panel → dist/client}/index.html +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/lib/color-scheme.d.ts.map +1 -1
- package/lib/color-scheme.js +17 -21
- package/lib/color-scheme.js.map +1 -1
- package/lib/devframe/definition.d.ts +45 -0
- package/lib/devframe/definition.d.ts.map +1 -0
- package/lib/devframe/definition.js +547 -0
- package/lib/devframe/definition.js.map +1 -0
- package/lib/devframe/icon.d.ts +8 -0
- package/lib/devframe/icon.d.ts.map +1 -0
- package/lib/devframe/icon.js +21 -0
- package/lib/devframe/icon.js.map +1 -0
- package/lib/devframe/paths.d.ts +12 -0
- package/lib/devframe/paths.d.ts.map +1 -0
- package/lib/devframe/paths.js +38 -0
- package/lib/devframe/paths.js.map +1 -0
- package/lib/devframe/protocol.d.ts +218 -0
- package/lib/devframe/protocol.d.ts.map +1 -0
- package/lib/devframe/protocol.js +76 -0
- package/lib/devframe/protocol.js.map +1 -0
- package/lib/devframe/source.d.ts +49 -0
- package/lib/devframe/source.d.ts.map +1 -0
- package/lib/devframe/source.js +23 -0
- package/lib/devframe/source.js.map +1 -0
- package/lib/devframe/vite.d.ts +116 -0
- package/lib/devframe/vite.d.ts.map +1 -0
- package/lib/devframe/vite.js +291 -0
- package/lib/devframe/vite.js.map +1 -0
- package/lib/http.d.ts +29 -0
- package/lib/http.d.ts.map +1 -0
- package/lib/http.js +35 -0
- package/lib/http.js.map +1 -0
- package/lib/icons.d.ts +2 -0
- package/lib/icons.d.ts.map +1 -1
- package/lib/icons.js +10 -4
- package/lib/icons.js.map +1 -1
- package/lib/plugin.d.ts +15 -4
- package/lib/plugin.d.ts.map +1 -1
- package/lib/plugin.js +640 -574
- package/lib/plugin.js.map +1 -1
- package/lib/runtime/css.d.ts +2 -16
- package/lib/runtime/css.d.ts.map +1 -1
- package/lib/runtime/css.js +43 -36
- package/lib/runtime/css.js.map +1 -1
- package/lib/runtime/edge-panel.d.ts.map +1 -1
- package/lib/runtime/edge-panel.js +82 -91
- package/lib/runtime/edge-panel.js.map +1 -1
- package/lib/runtime/fonts.d.ts.map +1 -1
- package/lib/runtime/fonts.js +1 -1
- package/lib/runtime/fonts.js.map +1 -1
- package/lib/runtime/indicator.d.ts.map +1 -1
- package/lib/runtime/indicator.js +71 -74
- package/lib/runtime/indicator.js.map +1 -1
- package/lib/runtime/inspector/collect.d.ts.map +1 -1
- package/lib/runtime/inspector/collect.js +83 -90
- package/lib/runtime/inspector/collect.js.map +1 -1
- package/lib/runtime/inspector/highlight.d.ts +16 -0
- package/lib/runtime/inspector/highlight.d.ts.map +1 -0
- package/lib/runtime/inspector/highlight.js +66 -0
- package/lib/runtime/inspector/highlight.js.map +1 -0
- package/lib/runtime/inspector/install.d.ts.map +1 -1
- package/lib/runtime/inspector/install.js +180 -205
- package/lib/runtime/inspector/install.js.map +1 -1
- package/lib/runtime/inspector/serialize.d.ts.map +1 -1
- package/lib/runtime/inspector/serialize.js +86 -107
- package/lib/runtime/inspector/serialize.js.map +1 -1
- package/lib/runtime/intern.d.ts.map +1 -1
- package/lib/runtime/intern.js +31 -29
- package/lib/runtime/intern.js.map +1 -1
- package/lib/runtime/overrides.d.ts.map +1 -1
- package/lib/runtime/overrides.js +14 -13
- package/lib/runtime/overrides.js.map +1 -1
- package/lib/runtime/patch.d.ts +8 -0
- package/lib/runtime/patch.d.ts.map +1 -1
- package/lib/runtime/patch.js +321 -282
- package/lib/runtime/patch.js.map +1 -1
- package/lib/runtime/source-meta.d.ts.map +1 -1
- package/lib/runtime/source-meta.js +1 -1
- package/lib/runtime/source-meta.js.map +1 -1
- package/lib/runtime/source-overlay/editors.d.ts.map +1 -1
- package/lib/runtime/source-overlay/editors.js +27 -27
- package/lib/runtime/source-overlay/editors.js.map +1 -1
- package/lib/runtime/source-overlay/mask-path.d.ts.map +1 -1
- package/lib/runtime/source-overlay/mask-path.js +15 -15
- package/lib/runtime/source-overlay/mask-path.js.map +1 -1
- package/lib/runtime/source-overlay/overlay-element.d.ts.map +1 -1
- package/lib/runtime/source-overlay/overlay-element.js +347 -356
- package/lib/runtime/source-overlay/overlay-element.js.map +1 -1
- package/lib/runtime/source-overlay/source-host.d.ts.map +1 -1
- package/lib/runtime/source-overlay/source-host.js +64 -71
- package/lib/runtime/source-overlay/source-host.js.map +1 -1
- package/lib/runtime/source-overlay/template.d.ts.map +1 -1
- package/lib/runtime/source-overlay/template.js +3 -3
- package/lib/runtime/source-overlay/template.js.map +1 -1
- package/lib/runtime/source-overlay.d.ts.map +1 -1
- package/lib/runtime/source-overlay.js +5 -2
- package/lib/runtime/source-overlay.js.map +1 -1
- package/lib/runtime/timeline/clock.d.ts.map +1 -1
- package/lib/runtime/timeline/clock.js +2 -2
- package/lib/runtime/timeline/clock.js.map +1 -1
- package/lib/runtime/timeline/flash.d.ts +39 -0
- package/lib/runtime/timeline/flash.d.ts.map +1 -0
- package/lib/runtime/timeline/flash.js +169 -0
- package/lib/runtime/timeline/flash.js.map +1 -0
- package/lib/runtime/timeline/identity.d.ts.map +1 -1
- package/lib/runtime/timeline/identity.js +27 -27
- package/lib/runtime/timeline/identity.js.map +1 -1
- package/lib/runtime/timeline/input.d.ts.map +1 -1
- package/lib/runtime/timeline/input.js +54 -67
- package/lib/runtime/timeline/input.js.map +1 -1
- package/lib/runtime/timeline/install.d.ts.map +1 -1
- package/lib/runtime/timeline/install.js +38 -29
- package/lib/runtime/timeline/install.js.map +1 -1
- package/lib/runtime/timeline/lifecycle.d.ts +8 -0
- package/lib/runtime/timeline/lifecycle.d.ts.map +1 -1
- package/lib/runtime/timeline/lifecycle.js +149 -133
- package/lib/runtime/timeline/lifecycle.js.map +1 -1
- package/lib/runtime/timeline/public-api.d.ts.map +1 -1
- package/lib/runtime/timeline/public-api.js +9 -9
- package/lib/runtime/timeline/public-api.js.map +1 -1
- package/lib/runtime/timeline/render.d.ts.map +1 -1
- package/lib/runtime/timeline/render.js +70 -75
- package/lib/runtime/timeline/render.js.map +1 -1
- package/lib/runtime/timeline/transport.d.ts.map +1 -1
- package/lib/runtime/timeline/transport.js +39 -43
- package/lib/runtime/timeline/transport.js.map +1 -1
- package/lib/segmented-tabs.d.ts +3 -1
- package/lib/segmented-tabs.d.ts.map +1 -1
- package/lib/segmented-tabs.js +136 -107
- package/lib/segmented-tabs.js.map +1 -1
- package/lib/snapshot.d.ts +28 -0
- package/lib/snapshot.d.ts.map +1 -0
- package/lib/snapshot.js +57 -0
- package/lib/snapshot.js.map +1 -0
- package/lib/source-meta.d.ts.map +1 -1
- package/lib/source-meta.js +176 -162
- package/lib/source-meta.js.map +1 -1
- package/lib/timeline/derive.d.ts +152 -0
- package/lib/timeline/derive.d.ts.map +1 -0
- package/lib/timeline/derive.js +242 -0
- package/lib/timeline/derive.js.map +1 -0
- package/lib/timeline-plugin.d.ts.map +1 -1
- package/lib/timeline-plugin.js +304 -321
- package/lib/timeline-plugin.js.map +1 -1
- package/lib/tokens.d.ts.map +1 -1
- package/lib/tokens.js +17 -18
- package/lib/tokens.js.map +1 -1
- package/lib/transform.d.ts.map +1 -1
- package/lib/transform.js +62 -57
- package/lib/transform.js.map +1 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +1 -1
- package/lib/types.js.map +1 -1
- package/lib/wrap-table.d.ts.map +1 -1
- package/lib/wrap-table.js +19 -17
- package/lib/wrap-table.js.map +1 -1
- package/package.json +77 -13
- package/types/hmr-incompatibility.d.ts +59 -0
- package/types/hmr-incompatibility.d.ts.map +1 -0
- package/types/hmr-incompatibility.js +30 -0
- package/types/hmr-incompatibility.js.map +1 -0
- package/types/in-page.d.ts +49 -0
- package/types/in-page.d.ts.map +1 -0
- package/types/in-page.js +33 -0
- package/types/in-page.js.map +1 -0
- package/types/inspector.d.ts.map +1 -1
- package/types/inspector.js.map +1 -1
- package/types/snapshot.d.ts +44 -0
- package/types/snapshot.d.ts.map +1 -0
- package/types/snapshot.js +7 -0
- package/types/snapshot.js.map +1 -0
- package/types/timeline.d.ts +11 -0
- package/types/timeline.d.ts.map +1 -1
- package/types/timeline.js.map +1 -1
- package/panel/components-view.d.ts +0 -60
- package/panel/components-view.d.ts.map +0 -1
- package/panel/components-view.js +0 -587
- package/panel/components-view.js.map +0 -1
- package/panel/devtools-settings.d.ts +0 -41
- package/panel/devtools-settings.d.ts.map +0 -1
- package/panel/devtools-settings.js +0 -463
- package/panel/devtools-settings.js.map +0 -1
- package/panel/lit-devtools-panel.d.ts +0 -37
- package/panel/lit-devtools-panel.d.ts.map +0 -1
- package/panel/lit-devtools-panel.js +0 -185
- package/panel/lit-devtools-panel.js.map +0 -1
- package/panel/timeline-event-list.d.ts +0 -43
- package/panel/timeline-event-list.d.ts.map +0 -1
- package/panel/timeline-event-list.js +0 -416
- package/panel/timeline-event-list.js.map +0 -1
- package/panel/timeline-layers.d.ts +0 -25
- package/panel/timeline-layers.d.ts.map +0 -1
- package/panel/timeline-layers.js +0 -96
- package/panel/timeline-layers.js.map +0 -1
- package/panel/timeline-view.d.ts +0 -38
- package/panel/timeline-view.d.ts.map +0 -1
- package/panel/timeline-view.js +0 -234
- package/panel/timeline-view.js.map +0 -1
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import {idOf, sourceOf} from './identity.js';
|
|
7
|
+
import {now} from './clock.js';
|
|
8
8
|
/**
|
|
9
9
|
* Builds the element-identity `meta` for a render event from the render
|
|
10
10
|
* `host` (the LitElement whose `render()` produced these debug events).
|
|
@@ -13,83 +13,79 @@ import { now } from './clock.js';
|
|
|
13
13
|
* (e.g. a bare lit-html `render()` call not driven by a LitElement).
|
|
14
14
|
*/
|
|
15
15
|
const hostMeta = (host) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
16
|
+
if (host === null || typeof host !== 'object') return undefined;
|
|
17
|
+
return {
|
|
18
|
+
elementId: idOf(host),
|
|
19
|
+
tagName: host.localName ?? 'unknown',
|
|
20
|
+
source: sourceOf(host),
|
|
21
|
+
};
|
|
23
22
|
};
|
|
24
23
|
let removeListener = null;
|
|
25
24
|
const onLitDebug = (e, emit, recording, layerEnabled) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
case 'end render': {
|
|
48
|
-
const meta = hostMeta(detail.options?.host);
|
|
49
|
-
emit({
|
|
50
|
-
layerId: 'lit-render',
|
|
51
|
-
time,
|
|
52
|
-
groupId: id,
|
|
53
|
-
title: 'render:end',
|
|
54
|
-
subtitle: meta?.tagName,
|
|
55
|
-
data: { kind, id },
|
|
56
|
-
meta,
|
|
57
|
-
});
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
// `template prep` fires once per *unique* template, the first time it's
|
|
61
|
-
// compiled — low volume, useful as a "new template" marker.
|
|
62
|
-
case 'template prep':
|
|
63
|
-
emit({
|
|
64
|
-
layerId: 'lit-render',
|
|
65
|
-
time,
|
|
66
|
-
title: kind,
|
|
67
|
-
data: { kind, id },
|
|
68
|
-
});
|
|
69
|
-
break;
|
|
70
|
-
// `template updating` / `template instantiated` / `…and updated` fire once
|
|
71
|
-
// per template-bound ChildPart on *every* render — extremely high volume
|
|
72
|
-
// (a ticking clock or animation floods the layer). The begin/end render
|
|
73
|
-
// pair above already captures each render as a grouped duration, so these
|
|
74
|
-
// add noise without signal. Skip them; re-expose behind a "verbose" toggle
|
|
75
|
-
// if per-part detail is ever needed. Same rationale for commit * / set part.
|
|
76
|
-
default:
|
|
77
|
-
break;
|
|
25
|
+
if (!recording() || !layerEnabled()) return;
|
|
26
|
+
const detail = e.detail;
|
|
27
|
+
if (!detail?.kind) return;
|
|
28
|
+
const time = now();
|
|
29
|
+
const {kind, id} = detail;
|
|
30
|
+
switch (kind) {
|
|
31
|
+
case 'begin render': {
|
|
32
|
+
const meta = hostMeta(detail.options?.host);
|
|
33
|
+
emit({
|
|
34
|
+
layerId: 'lit-render',
|
|
35
|
+
time,
|
|
36
|
+
groupId: id,
|
|
37
|
+
title: 'render:start',
|
|
38
|
+
subtitle: meta?.tagName,
|
|
39
|
+
data: {kind, id},
|
|
40
|
+
meta,
|
|
41
|
+
});
|
|
42
|
+
break;
|
|
78
43
|
}
|
|
44
|
+
case 'end render': {
|
|
45
|
+
const meta = hostMeta(detail.options?.host);
|
|
46
|
+
emit({
|
|
47
|
+
layerId: 'lit-render',
|
|
48
|
+
time,
|
|
49
|
+
groupId: id,
|
|
50
|
+
title: 'render:end',
|
|
51
|
+
subtitle: meta?.tagName,
|
|
52
|
+
data: {kind, id},
|
|
53
|
+
meta,
|
|
54
|
+
});
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
// `template prep` fires once per *unique* template, the first time it's
|
|
58
|
+
// compiled — low volume, useful as a "new template" marker.
|
|
59
|
+
case 'template prep':
|
|
60
|
+
emit({
|
|
61
|
+
layerId: 'lit-render',
|
|
62
|
+
time,
|
|
63
|
+
title: kind,
|
|
64
|
+
data: {kind, id},
|
|
65
|
+
});
|
|
66
|
+
break;
|
|
67
|
+
// `template updating` / `template instantiated` / `…and updated` fire once
|
|
68
|
+
// per template-bound ChildPart on *every* render — extremely high volume
|
|
69
|
+
// (a ticking clock or animation floods the layer). The begin/end render
|
|
70
|
+
// pair above already captures each render as a grouped duration, so these
|
|
71
|
+
// add noise without signal. Skip them; re-expose behind a "verbose" toggle
|
|
72
|
+
// if per-part detail is ever needed. Same rationale for commit * / set part.
|
|
73
|
+
default:
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
79
76
|
};
|
|
80
77
|
/**
|
|
81
78
|
* Install the lit-debug render layer.
|
|
82
79
|
* Idempotent — calling again when already installed is a no-op.
|
|
83
80
|
*/
|
|
84
81
|
export const installRenderLayer = (emit, recording, layerEnabled) => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
removeListener = () => window.removeEventListener('lit-debug', handler);
|
|
82
|
+
if (removeListener !== null) return;
|
|
83
|
+
// The listener is cheap and always attached; the per-render cost lives in the
|
|
84
|
+
// `emitLitDebugLogEvents` flag, which the caller toggles via
|
|
85
|
+
// `setRenderDebugEnabled` only while actively capturing.
|
|
86
|
+
const handler = (e) => onLitDebug(e, emit, recording, layerEnabled);
|
|
87
|
+
window.addEventListener('lit-debug', handler);
|
|
88
|
+
removeListener = () => window.removeEventListener('lit-debug', handler);
|
|
93
89
|
};
|
|
94
90
|
/**
|
|
95
91
|
* Toggle Lit's debug event system. Enabling makes lit-html dispatch a
|
|
@@ -97,13 +93,12 @@ export const installRenderLayer = (emit, recording, layerEnabled) => {
|
|
|
97
93
|
* keeps it off unless the render layer is actively recording.
|
|
98
94
|
*/
|
|
99
95
|
export const setRenderDebugEnabled = (enabled) => {
|
|
100
|
-
|
|
101
|
-
enabled;
|
|
96
|
+
globalThis.emitLitDebugLogEvents = enabled;
|
|
102
97
|
};
|
|
103
98
|
/** Remove the listener and clear the Lit debug flag. */
|
|
104
99
|
export const uninstallRenderLayer = () => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
100
|
+
removeListener?.();
|
|
101
|
+
removeListener = null;
|
|
102
|
+
setRenderDebugEnabled(false);
|
|
108
103
|
};
|
|
109
|
-
//# sourceMappingURL=render.js.map
|
|
104
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../src/lib/runtime/timeline/render.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * lit-render timeline layer — listens to the built-in lit-debug CustomEvents\n * instead of patching prototypes, so it's zero-cost when the Lit debug flag\n * is off and perfectly accurate for the render layer.\n *\n * `globalThis.emitLitDebugLogEvents = true` gates the events, and lit-html\n * dispatches a CustomEvent per render whenever it's set — a real per-render\n * cost. So the caller drives the flag via {@link setRenderDebugEnabled} from\n * `recording × layer-enabled` rather than leaving it on for the whole session.\n * The events are tagged `*Unstable` in the Lit source; we tolerate missing\n * `kind` values gracefully.\n *\n * begin render / end render share a numeric `id` → we use it as groupId so\n * the panel can show a duration bar for each render call.\n */\n\nimport type {TimelineEvent} from '../../../types/timeline.js';\nimport {idOf, sourceOf} from './identity.js';\nimport {now} from './clock.js';\n\ntype EmitFn = (event: TimelineEvent) => void;\ntype RecordingFn = () => boolean;\ntype LayerEnabledFn = () => boolean;\n\n/** Minimal shape of the lit-debug event detail we care about. */\ninterface LitDebugDetail {\n kind: string;\n id?: number;\n template?: unknown;\n instance?: unknown;\n /** Render options passed to lit-html's `render()`; `host` is the element. */\n options?: {host?: unknown};\n}\n\n/**\n * Builds the element-identity `meta` for a render event from the render\n * `host` (the LitElement whose `render()` produced these debug events).\n * Uses the same id/source maps as the lifecycle layer so an element keeps one\n * stable id across both layers. Returns undefined for host-less renders\n * (e.g. a bare lit-html `render()` call not driven by a LitElement).\n */\nconst hostMeta = (\n host: unknown\n): NonNullable<TimelineEvent['meta']> | undefined => {\n if (host === null || typeof host !== 'object') return undefined;\n return {\n elementId: idOf(host),\n tagName: (host as Element).localName ?? 'unknown',\n source: sourceOf(host),\n };\n};\n\ntype LitDebugEvent = CustomEvent<LitDebugDetail>;\n\nlet removeListener: (() => void) | null = null;\n\nconst onLitDebug = (\n e: Event,\n emit: EmitFn,\n recording: RecordingFn,\n layerEnabled: LayerEnabledFn\n): void => {\n if (!recording() || !layerEnabled()) return;\n\n const detail = (e as LitDebugEvent).detail;\n if (!detail?.kind) return;\n\n const time = now();\n const {kind, id} = detail;\n\n switch (kind) {\n case 'begin render': {\n const meta = hostMeta(detail.options?.host);\n emit({\n layerId: 'lit-render',\n time,\n groupId: id,\n title: 'render:start',\n subtitle: meta?.tagName,\n data: {kind, id},\n meta,\n });\n break;\n }\n\n case 'end render': {\n const meta = hostMeta(detail.options?.host);\n emit({\n layerId: 'lit-render',\n time,\n groupId: id,\n title: 'render:end',\n subtitle: meta?.tagName,\n data: {kind, id},\n meta,\n });\n break;\n }\n\n // `template prep` fires once per *unique* template, the first time it's\n // compiled — low volume, useful as a \"new template\" marker.\n case 'template prep':\n emit({\n layerId: 'lit-render',\n time,\n title: kind,\n data: {kind, id},\n });\n break;\n\n // `template updating` / `template instantiated` / `…and updated` fire once\n // per template-bound ChildPart on *every* render — extremely high volume\n // (a ticking clock or animation floods the layer). The begin/end render\n // pair above already captures each render as a grouped duration, so these\n // add noise without signal. Skip them; re-expose behind a \"verbose\" toggle\n // if per-part detail is ever needed. Same rationale for commit * / set part.\n default:\n break;\n }\n};\n\n/**\n * Install the lit-debug render layer.\n * Idempotent — calling again when already installed is a no-op.\n */\nexport const installRenderLayer = (\n emit: EmitFn,\n recording: RecordingFn,\n layerEnabled: LayerEnabledFn\n): void => {\n if (removeListener !== null) return;\n\n // The listener is cheap and always attached; the per-render cost lives in the\n // `emitLitDebugLogEvents` flag, which the caller toggles via\n // `setRenderDebugEnabled` only while actively capturing.\n const handler = (e: Event) => onLitDebug(e, emit, recording, layerEnabled);\n window.addEventListener('lit-debug', handler);\n removeListener = () => window.removeEventListener('lit-debug', handler);\n};\n\n/**\n * Toggle Lit's debug event system. Enabling makes lit-html dispatch a\n * CustomEvent on every render (dev-only; no-op in prod builds), so the caller\n * keeps it off unless the render layer is actively recording.\n */\nexport const setRenderDebugEnabled = (enabled: boolean): void => {\n (globalThis as {emitLitDebugLogEvents?: boolean}).emitLitDebugLogEvents =\n enabled;\n};\n\n/** Remove the listener and clear the Lit debug flag. */\nexport const uninstallRenderLayer = (): void => {\n removeListener?.();\n removeListener = null;\n setRenderDebugEnabled(false);\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/lib/runtime/timeline/transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AAE9D,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C,CAAC;AAmBF;;;;GAIG;AACH,eAAO,MAAM,YAAY,QAAS,SAAS,KAAG,IAe7C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,OAAQ,MAAM,IAAI,KAAG,IAMrD,CAAC;AAaF;;;;GAIG;AACH,eAAO,MAAM,IAAI,UAAW,aAAa,KAAG,IAc3C,CAAC"}
|
|
@@ -23,45 +23,41 @@ const pendingCallbacks = [];
|
|
|
23
23
|
* Flushes any queued events and fires pending one-shot callbacks.
|
|
24
24
|
*/
|
|
25
25
|
export const setHotClient = (hot) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// ignore
|
|
39
|
-
}
|
|
26
|
+
hotClient = hot;
|
|
27
|
+
// Drain any events that arrived before the client was wired.
|
|
28
|
+
if (queue.length > 0 && !flushScheduled) {
|
|
29
|
+
flushScheduled = true;
|
|
30
|
+
queueMicrotask(flush);
|
|
31
|
+
}
|
|
32
|
+
// Fire one-shot callbacks (e.g. addTimelineLayer announcements).
|
|
33
|
+
for (const cb of pendingCallbacks.splice(0)) {
|
|
34
|
+
try {
|
|
35
|
+
cb();
|
|
36
|
+
} catch {
|
|
37
|
+
// ignore
|
|
40
38
|
}
|
|
39
|
+
}
|
|
41
40
|
};
|
|
42
41
|
/**
|
|
43
42
|
* Register a callback to be invoked once the HMR client is available.
|
|
44
43
|
* If the client is already set the callback is fired on the next microtask.
|
|
45
44
|
*/
|
|
46
45
|
export const setHotClientCallback = (cb) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
46
|
+
if (hotClient !== null) {
|
|
47
|
+
queueMicrotask(cb);
|
|
48
|
+
} else {
|
|
49
|
+
pendingCallbacks.push(cb);
|
|
50
|
+
}
|
|
53
51
|
};
|
|
54
52
|
const flush = () => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
// HMR channel may be temporarily unavailable; events are dropped.
|
|
64
|
-
}
|
|
53
|
+
flushScheduled = false;
|
|
54
|
+
if (queue.length === 0 || hotClient === null) return;
|
|
55
|
+
const batch = queue.splice(0);
|
|
56
|
+
try {
|
|
57
|
+
hotClient.send('lit:timeline:push-event', {events: batch});
|
|
58
|
+
} catch {
|
|
59
|
+
// HMR channel may be temporarily unavailable; events are dropped.
|
|
60
|
+
}
|
|
65
61
|
};
|
|
66
62
|
/**
|
|
67
63
|
* Enqueue a timeline event for forwarding to the Vite server.
|
|
@@ -69,18 +65,18 @@ const flush = () => {
|
|
|
69
65
|
* doesn't send dozens of individual messages.
|
|
70
66
|
*/
|
|
71
67
|
export const emit = (event) => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
if (!flushScheduled) {
|
|
82
|
-
flushScheduled = true;
|
|
83
|
-
queueMicrotask(flush);
|
|
68
|
+
queue.push(event);
|
|
69
|
+
if (hotClient === null) {
|
|
70
|
+
// No consumer yet: bound the buffer instead of scheduling a flush that
|
|
71
|
+
// would only no-op. `setHotClient` drains the retained tail on connect.
|
|
72
|
+
if (queue.length > MAX_PENDING) {
|
|
73
|
+
queue.splice(0, queue.length - MAX_PENDING);
|
|
84
74
|
}
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (!flushScheduled) {
|
|
78
|
+
flushScheduled = true;
|
|
79
|
+
queueMicrotask(flush);
|
|
80
|
+
}
|
|
85
81
|
};
|
|
86
|
-
//# sourceMappingURL=transport.js.map
|
|
82
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../src/lib/runtime/timeline/transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAuBH,MAAM,KAAK,GAAoB,EAAE,CAAC;AAClC,IAAI,cAAc,GAAG,KAAK,CAAC;AAC3B,IAAI,SAAS,GAAqB,IAAI,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB,kFAAkF;AAClF,oEAAoE;AACpE,MAAM,gBAAgB,GAAsB,EAAE,CAAC;AAE/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAc,EAAQ,EAAE;IACnD,SAAS,GAAG,GAAG,CAAC;IAChB,6DAA6D;IAC7D,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;QACxC,cAAc,GAAG,IAAI,CAAC;QACtB,cAAc,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IACD,iEAAiE;IACjE,KAAK,MAAM,EAAE,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5C,IAAI,CAAC;YACH,EAAE,EAAE,CAAC;QACP,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EAAc,EAAQ,EAAE;IAC3D,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACvB,cAAc,CAAC,EAAE,CAAC,CAAC;IACrB,CAAC;SAAM,CAAC;QACN,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,KAAK,GAAG,GAAS,EAAE;IACvB,cAAc,GAAG,KAAK,CAAC;IACvB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO;IACrD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC9B,IAAI,CAAC;QACH,SAAS,CAAC,IAAI,CAAC,yBAAyB,EAAE,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC,CAAC;IAC7D,CAAC;IAAC,MAAM,CAAC;QACP,kEAAkE;IACpE,CAAC;AACH,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,KAAoB,EAAQ,EAAE;IACjD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClB,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACvB,uEAAuE;QACvE,wEAAwE;QACxE,IAAI,KAAK,CAAC,MAAM,GAAG,WAAW,EAAE,CAAC;YAC/B,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO;IACT,CAAC;IACD,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,cAAc,GAAG,IAAI,CAAC;QACtB,cAAc,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;AACH,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Buffered transport for timeline events.\n *\n * Phase 0/1: forwards events over Vite's HMR WebSocket channel\n * (`import.meta.hot.send`). This avoids the need for a separate devframe\n * RPC connection in early phases and works with any Vite dev server.\n *\n * Phase 2 migration: replace `sendViaHmr` with `sendViaRpc` when the\n * devframe RPC client is available (injected by the panel's clientScript).\n *\n * Batching: we coalesce events with `queueMicrotask` so a burst of\n * commit/set-part events from a single render doesn't hammer the channel\n * with one message per event.\n */\n\nimport type {TimelineEvent} from '../../../types/timeline.js';\n\ntype HotClient = {\n send: (event: string, data: unknown) => void;\n};\n\nconst queue: TimelineEvent[] = [];\nlet flushScheduled = false;\nlet hotClient: HotClient | null = null;\n\n/**\n * Cap on events retained while no hot client is connected. Without a client\n * `flush()` cannot drain the queue, so an uncapped buffer would grow for the\n * whole session (in production, or before `install.ts` wires the client).\n * We keep only the most recent events; the retained tail flushes if a client\n * later connects.\n */\nconst MAX_PENDING = 1000;\n\n// Callbacks registered before the hot client was available (e.g. addTimelineLayer\n// called at module init time before install.ts has set the client).\nconst pendingCallbacks: Array<() => void> = [];\n\n/**\n * Register the HMR hot client.\n * Called by install.ts after import.meta.hot check.\n * Flushes any queued events and fires pending one-shot callbacks.\n */\nexport const setHotClient = (hot: HotClient): void => {\n hotClient = hot;\n // Drain any events that arrived before the client was wired.\n if (queue.length > 0 && !flushScheduled) {\n flushScheduled = true;\n queueMicrotask(flush);\n }\n // Fire one-shot callbacks (e.g. addTimelineLayer announcements).\n for (const cb of pendingCallbacks.splice(0)) {\n try {\n cb();\n } catch {\n // ignore\n }\n }\n};\n\n/**\n * Register a callback to be invoked once the HMR client is available.\n * If the client is already set the callback is fired on the next microtask.\n */\nexport const setHotClientCallback = (cb: () => void): void => {\n if (hotClient !== null) {\n queueMicrotask(cb);\n } else {\n pendingCallbacks.push(cb);\n }\n};\n\nconst flush = (): void => {\n flushScheduled = false;\n if (queue.length === 0 || hotClient === null) return;\n const batch = queue.splice(0);\n try {\n hotClient.send('lit:timeline:push-event', {events: batch});\n } catch {\n // HMR channel may be temporarily unavailable; events are dropped.\n }\n};\n\n/**\n * Enqueue a timeline event for forwarding to the Vite server.\n * Batches via microtask so a single synchronous render burst\n * doesn't send dozens of individual messages.\n */\nexport const emit = (event: TimelineEvent): void => {\n queue.push(event);\n if (hotClient === null) {\n // No consumer yet: bound the buffer instead of scheduling a flush that\n // would only no-op. `setHotClient` drains the retained tail on connect.\n if (queue.length > MAX_PENDING) {\n queue.splice(0, queue.length - MAX_PENDING);\n }\n return;\n }\n if (!flushScheduled) {\n flushScheduled = true;\n queueMicrotask(flush);\n }\n};\n"]}
|
package/lib/segmented-tabs.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface TabItem {
|
|
|
8
8
|
id: string;
|
|
9
9
|
label: string;
|
|
10
10
|
icon?: string;
|
|
11
|
+
/** Optional count pill trailing the label. Hidden when absent or zero. */
|
|
12
|
+
badge?: number;
|
|
11
13
|
}
|
|
12
14
|
export type SegTabSize = 'sm' | 'md';
|
|
13
15
|
/**
|
|
@@ -23,7 +25,7 @@ export declare class SegmentedTabs extends LitElement {
|
|
|
23
25
|
size: SegTabSize;
|
|
24
26
|
constructor();
|
|
25
27
|
private _select;
|
|
26
|
-
render(): import("lit
|
|
28
|
+
render(): import("lit").TemplateResult<1>;
|
|
27
29
|
}
|
|
28
30
|
declare global {
|
|
29
31
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmented-tabs.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"segmented-tabs.d.ts","sourceRoot":"","sources":["../src/lib/segmented-tabs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,UAAU,EAAqB,MAAM,KAAK,CAAC;AAInD,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AAErC;;;;;GAKG;AACH,qBACa,aAAc,SAAQ,UAAU;IAC3C,OAAgB,MAAM,4BAkEpB;IAE+B,KAAK,EAAE,OAAO,EAAE,CAAC;IAE9B,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,EAAE,UAAU,CAAC;IAErC,cAKC;IAED,OAAO,CAAC,OAAO;IAWN,MAAM,oCA+Bd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,aAAa,CAAC;KACjC;CACF"}
|
package/lib/segmented-tabs.js
CHANGED
|
@@ -3,15 +3,28 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
var __decorate =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
var __decorate =
|
|
7
|
+
(this && this.__decorate) ||
|
|
8
|
+
function (decorators, target, key, desc) {
|
|
9
|
+
var c = arguments.length,
|
|
10
|
+
r =
|
|
11
|
+
c < 3
|
|
12
|
+
? target
|
|
13
|
+
: desc === null
|
|
14
|
+
? (desc = Object.getOwnPropertyDescriptor(target, key))
|
|
15
|
+
: desc,
|
|
16
|
+
d;
|
|
17
|
+
if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function')
|
|
18
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
19
|
+
else
|
|
20
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
21
|
+
if ((d = decorators[i]))
|
|
22
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
23
|
+
return (c > 3 && r && Object.defineProperty(target, key, r), r);
|
|
24
|
+
};
|
|
25
|
+
import {LitElement, html, css, nothing} from 'lit';
|
|
26
|
+
import {customElement, property} from 'lit/decorators.js';
|
|
27
|
+
import {tokens} from './tokens.js';
|
|
15
28
|
/**
|
|
16
29
|
* Inline segmented tab control. Renders a horizontal row of text-only tabs
|
|
17
30
|
* with the active one highlighted by the accent color.
|
|
@@ -19,111 +32,127 @@ import { tokens } from './tokens.js';
|
|
|
19
32
|
* Matches the SegmentedTabs spec from the Lit Design System devtools kit.
|
|
20
33
|
*/
|
|
21
34
|
let SegmentedTabs = class SegmentedTabs extends LitElement {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var(--lit-devtools-
|
|
47
|
-
|
|
48
|
-
var(--lit-devtools-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
35
|
+
static {
|
|
36
|
+
this.styles = [
|
|
37
|
+
tokens,
|
|
38
|
+
css`
|
|
39
|
+
:host {
|
|
40
|
+
display: flex;
|
|
41
|
+
gap: var(--lit-devtools-space-1);
|
|
42
|
+
align-self: stretch;
|
|
43
|
+
}
|
|
44
|
+
button {
|
|
45
|
+
appearance: none;
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: var(--lit-devtools-space-2);
|
|
49
|
+
border: 0;
|
|
50
|
+
background: none;
|
|
51
|
+
font: inherit;
|
|
52
|
+
color: var(--lit-devtools-text-muted);
|
|
53
|
+
padding: 0 var(--lit-devtools-space-5);
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
border-bottom: 2px solid transparent;
|
|
56
|
+
white-space: nowrap;
|
|
57
|
+
transition:
|
|
58
|
+
color var(--lit-devtools-dur-fast) var(--lit-devtools-ease-standard),
|
|
59
|
+
border-color var(--lit-devtools-dur-fast)
|
|
60
|
+
var(--lit-devtools-ease-standard),
|
|
61
|
+
background var(--lit-devtools-dur-fast)
|
|
62
|
+
var(--lit-devtools-ease-standard);
|
|
63
|
+
}
|
|
64
|
+
button:hover {
|
|
65
|
+
color: var(--lit-devtools-text);
|
|
66
|
+
background: var(--lit-devtools-surface-hover);
|
|
67
|
+
}
|
|
68
|
+
button.active {
|
|
69
|
+
color: var(--lit-devtools-accent);
|
|
70
|
+
border-bottom-color: var(--lit-devtools-accent);
|
|
71
|
+
}
|
|
72
|
+
button:focus-visible {
|
|
73
|
+
outline: 2px solid var(--lit-devtools-accent-ring);
|
|
74
|
+
outline-offset: -2px;
|
|
75
|
+
}
|
|
76
|
+
button svg {
|
|
77
|
+
width: 18px;
|
|
78
|
+
height: 18px;
|
|
79
|
+
flex-shrink: 0;
|
|
80
|
+
}
|
|
81
|
+
.badge {
|
|
82
|
+
flex-shrink: 0;
|
|
83
|
+
min-width: 16px;
|
|
84
|
+
padding: 0 var(--lit-devtools-space-1);
|
|
85
|
+
border-radius: var(--lit-devtools-radius-pill);
|
|
86
|
+
background: var(--lit-devtools-error-soft);
|
|
87
|
+
color: var(--lit-devtools-error);
|
|
88
|
+
font-size: var(--lit-devtools-text-xs);
|
|
89
|
+
line-height: 16px;
|
|
90
|
+
text-align: center;
|
|
91
|
+
}
|
|
92
|
+
:host([size='sm']) button {
|
|
93
|
+
font-size: var(--lit-devtools-text-xs);
|
|
94
|
+
padding: 0 var(--lit-devtools-space-4);
|
|
95
|
+
}
|
|
96
|
+
:host([size='md']) button,
|
|
97
|
+
:host(:not([size])) button {
|
|
98
|
+
font-size: var(--lit-devtools-text-sm);
|
|
99
|
+
padding: 0 var(--lit-devtools-space-5);
|
|
100
|
+
}
|
|
101
|
+
`,
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
constructor() {
|
|
105
|
+
super();
|
|
106
|
+
this.items = [];
|
|
107
|
+
this.value = '';
|
|
108
|
+
this.size = 'md';
|
|
109
|
+
}
|
|
110
|
+
_select(id) {
|
|
111
|
+
this.value = id;
|
|
112
|
+
this.dispatchEvent(
|
|
113
|
+
new CustomEvent('change', {
|
|
114
|
+
detail: {value: id},
|
|
115
|
+
bubbles: true,
|
|
116
|
+
composed: true,
|
|
117
|
+
})
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
render() {
|
|
121
|
+
return html`
|
|
122
|
+
${this.items.map(
|
|
123
|
+
(item) => html`
|
|
95
124
|
<button
|
|
96
125
|
role="tab"
|
|
97
126
|
aria-selected=${item.id === this.value}
|
|
98
127
|
class=${item.id === this.value ? 'active' : ''}
|
|
99
128
|
@click=${() => this._select(item.id)}
|
|
100
129
|
>
|
|
101
|
-
${
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
130
|
+
${
|
|
131
|
+
item.icon
|
|
132
|
+
? html`<svg
|
|
133
|
+
viewBox="0 0 256 256"
|
|
134
|
+
fill="currentColor"
|
|
135
|
+
aria-hidden="true"
|
|
136
|
+
>
|
|
137
|
+
<path d=${item.icon} />
|
|
138
|
+
</svg>`
|
|
139
|
+
: nothing
|
|
140
|
+
}
|
|
110
141
|
${item.label}
|
|
142
|
+
${
|
|
143
|
+
item.badge
|
|
144
|
+
? html`<span class="badge">${item.badge}</span>`
|
|
145
|
+
: nothing
|
|
146
|
+
}
|
|
111
147
|
</button>
|
|
112
|
-
`
|
|
148
|
+
`
|
|
149
|
+
)}
|
|
113
150
|
`;
|
|
114
|
-
|
|
151
|
+
}
|
|
115
152
|
};
|
|
116
|
-
__decorate([
|
|
117
|
-
|
|
118
|
-
], SegmentedTabs.prototype,
|
|
119
|
-
__decorate([
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
__decorate([
|
|
123
|
-
property()
|
|
124
|
-
], SegmentedTabs.prototype, "size", void 0);
|
|
125
|
-
SegmentedTabs = __decorate([
|
|
126
|
-
customElement('segmented-tabs')
|
|
127
|
-
], SegmentedTabs);
|
|
128
|
-
export { SegmentedTabs };
|
|
129
|
-
//# sourceMappingURL=segmented-tabs.js.map
|
|
153
|
+
__decorate([property({type: Array})], SegmentedTabs.prototype, 'items', void 0);
|
|
154
|
+
__decorate([property()], SegmentedTabs.prototype, 'value', void 0);
|
|
155
|
+
__decorate([property()], SegmentedTabs.prototype, 'size', void 0);
|
|
156
|
+
SegmentedTabs = __decorate([customElement('segmented-tabs')], SegmentedTabs);
|
|
157
|
+
export {SegmentedTabs};
|
|
158
|
+
//# sourceMappingURL=segmented-tabs.js.map
|