@visulima/dev-toolbar 1.0.0-alpha.1 → 1.0.0-alpha.3
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 +56 -0
- package/README.md +59 -42
- package/dist/apps/a11y/a11y-store.d.ts +1 -1
- package/dist/apps/a11y/a11y-tooltip.d.ts +1 -1
- package/dist/apps/a11y/index.js +3 -3
- package/dist/apps/inspector/index.d.ts +3 -0
- package/dist/apps/inspector/index.js +17 -0
- package/dist/apps/inspector/inspector-app.d.ts +12 -0
- package/dist/apps/module-graph/index.js +2 -2
- package/dist/apps/more/index.js +2 -2
- package/dist/apps/performance/index.js +2 -2
- package/dist/apps/seo/index.js +2 -2
- package/dist/apps/settings/index.js +2 -2
- package/dist/apps/settings/settings-app.d.ts +0 -1
- package/dist/apps/tailwind/index.d.ts +3 -0
- package/dist/apps/tailwind/index.js +7 -0
- package/dist/apps/tailwind/tailwind-app.d.ts +5 -0
- package/dist/apps/timeline/index.js +2 -2
- package/dist/apps/vite-config/index.js +2 -2
- package/dist/client/overlay.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/packem_chunks/inject-source.js +1 -0
- package/dist/packem_shared/Alert-H-x1JuZ0.js +1 -0
- package/dist/packem_shared/Badge-C30mDKKG.js +1 -0
- package/dist/packem_shared/Button-DODNCTPZ.js +1 -0
- package/dist/packem_shared/Card-DdI7Wn3t.js +1 -0
- package/dist/packem_shared/Icon-DWFLZkwW.js +1 -0
- package/dist/packem_shared/Input-GfbOwAkK.js +1 -0
- package/dist/packem_shared/Label-Bzi47aUf.js +1 -0
- package/dist/packem_shared/Popover-o3Vkvndp.js +1 -0
- package/dist/packem_shared/Progress-vGfFpxRn.js +1 -0
- package/dist/packem_shared/Separator-DQGeJPQg.js +1 -0
- package/dist/packem_shared/Skeleton-BYXau6jM.js +1 -0
- package/dist/packem_shared/Switch-BeC78S_T.js +1 -0
- package/dist/packem_shared/Tabs-BBc4S-2T.js +1 -0
- package/dist/packem_shared/Textarea-DvbSX13V.js +1 -0
- package/dist/packem_shared/Tooltip-BwK-2I9P.js +1 -0
- package/dist/packem_shared/cn-DWLJYh3h.js +1 -0
- package/dist/packem_shared/createServerRPCContext-CRd6VAWp.js +1 -0
- package/dist/packem_shared/sharedToolbarStylesheet-DHHoFz2-.js +2 -0
- package/dist/packem_shared/use-theme-CX1gG6Sv.js +1 -0
- package/dist/rpc/functions/module-graph.d.ts +2 -2
- package/dist/rpc/functions/open-in-editor.d.ts +8 -3
- package/dist/rpc/functions/tailwind-config.d.ts +12 -0
- package/dist/rpc/server.d.ts +4 -1
- package/dist/timeline/capture.d.ts +6 -0
- package/dist/timeline/index.d.ts +1 -0
- package/dist/toolbar/app-manager.d.ts +7 -0
- package/dist/toolbar/components/app-button.d.ts +2 -2
- package/dist/toolbar/components/app-canvas.d.ts +0 -1
- package/dist/toolbar/components/app-tooltip-overlay.d.ts +0 -1
- package/dist/toolbar/components/first-visit-hint.d.ts +3 -3
- package/dist/toolbar/components/pinned-tooltip-card.d.ts +0 -1
- package/dist/toolbar/components/toolbar-bar.d.ts +0 -1
- package/dist/toolbar/components/vite-overlay-button.d.ts +0 -1
- package/dist/toolbar/context/index.d.ts +1 -1
- package/dist/toolbar/context/toolbar-context.d.ts +35 -35
- package/dist/toolbar/global-api.d.ts +1 -0
- package/dist/toolbar/hooks/index.d.ts +4 -4
- package/dist/toolbar/hooks/use-frame-state.d.ts +6 -6
- package/dist/toolbar/hooks/use-position.d.ts +1 -1
- package/dist/toolbar/index.d.ts +1 -2
- package/dist/toolbar/index.js +3 -4
- package/dist/types/app.d.ts +26 -14
- package/dist/types/global-api.d.ts +8 -1
- package/dist/types/rpc.d.ts +5 -0
- package/dist/ui/components/alert.d.ts +20 -0
- package/dist/ui/components/badge.d.ts +10 -0
- package/dist/ui/components/button.d.ts +12 -0
- package/dist/ui/components/card.d.ts +17 -0
- package/dist/ui/components/icon.d.ts +3 -3
- package/dist/ui/components/input.d.ts +8 -0
- package/dist/ui/components/label.d.ts +8 -0
- package/dist/ui/components/popover.d.ts +27 -0
- package/dist/ui/components/progress.d.ts +8 -0
- package/dist/ui/components/separator.d.ts +9 -0
- package/dist/ui/components/skeleton.d.ts +7 -0
- package/dist/ui/components/switch.d.ts +12 -0
- package/dist/ui/components/tabs.d.ts +29 -0
- package/dist/ui/components/textarea.d.ts +8 -0
- package/dist/ui/components/tooltip.d.ts +19 -0
- package/dist/ui/index.d.ts +17 -0
- package/dist/ui/index.js +1 -0
- package/dist/vite/inject-source.d.ts +25 -0
- package/dist/vite/matcher.d.ts +5 -0
- package/dist/vite-plugin.d.ts +39 -1
- package/dist/vite-plugin.js +2 -2
- package/package.json +20 -3
- package/dist/packem_shared/cn-BEsR6GkP.js +0 -1
- package/dist/packem_shared/createServerRPCContext-BVSesPXu.js +0 -1
- package/dist/packem_shared/icon-BUQ92HaT.js +0 -1
- package/dist/rpc/index.d.ts +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
+
## @visulima/dev-toolbar [1.0.0-alpha.3](https://github.com/visulima/visulima/compare/@visulima/dev-toolbar@1.0.0-alpha.2...@visulima/dev-toolbar@1.0.0-alpha.3) (2026-03-03)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **dev-toolbar:** add editor option to configure launch-editor per project ([2003693](https://github.com/visulima/visulima/commit/200369383470a835c5312b8af7b11e4d4183c369))
|
|
6
|
+
* **dev-toolbar:** add JSX source injection Vite plugin for inspector click-to-source ([2c5c5a6](https://github.com/visulima/visulima/commit/2c5c5a65399cd8cb14b10c83a9346364e7ca3ecd))
|
|
7
|
+
* **dev-toolbar:** add light/dark theme awareness to inspector overlays ([2bd30ee](https://github.com/visulima/visulima/commit/2bd30eeb9e7047894d8287a63b4719873df22375))
|
|
8
|
+
* **dev-toolbar:** add open-in-editor, copy HTML, and copy path to inspector ([f88e9b0](https://github.com/visulima/visulima/commit/f88e9b0d21979dd1214c511a9474b0204bb16191))
|
|
9
|
+
* **dev-toolbar:** add Preact-native UI kit and migrate apps to use it ([2fced8e](https://github.com/visulima/visulima/commit/2fced8e8547409ad9d39fd9af2a81010a5fd1999))
|
|
10
|
+
* **dev-toolbar:** add removeDevtoolsOnBuild option to Vite plugin ([d8d1d67](https://github.com/visulima/visulima/commit/d8d1d67a20747df23da60e4d81a2acd89516dc48))
|
|
11
|
+
* **dev-toolbar:** implement timeline event capture for HMR, network and JS errors ([9851ac7](https://github.com/visulima/visulima/commit/9851ac7a12a3b72d52b4f705c2afa7ecbfdf3cc0))
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **dev-toolbar:** add suppressHydrationWarning to prevent SSR hydration mismatch ([3c5d8e0](https://github.com/visulima/visulima/commit/3c5d8e0eb7eaf786dbe029598f50dfb2b5ce68a6))
|
|
16
|
+
* **dev-toolbar:** align UI components and inspector with design system ([93ff58b](https://github.com/visulima/visulima/commit/93ff58b88e61d2eab8b3289cf3ad76028380a45f))
|
|
17
|
+
* **dev-toolbar:** correct broken test assertions for settings, button, input, and textarea ([770100f](https://github.com/visulima/visulima/commit/770100f5a73b634e65373fb2b2e344a353a0978c))
|
|
18
|
+
* **dev-toolbar:** fix inspector by closing panel during inspection and move settings to bottom ([575e79c](https://github.com/visulima/visulima/commit/575e79ce2c581c0f48eae55589c83d9dbb30b6f1))
|
|
19
|
+
* **dev-toolbar:** hide action-only apps (e.g. Inspector) from canvas sidebar ([9fcf7e1](https://github.com/visulima/visulima/commit/9fcf7e1786ec4b7c1666da6500f011eff13a2fd2))
|
|
20
|
+
* **dev-toolbar:** prevent action buttons from opening the canvas panel ([113e540](https://github.com/visulima/visulima/commit/113e540bb19d5dbedc6fbef9138bf04d2434b7f1))
|
|
21
|
+
* **dev-toolbar:** prevent hydration mismatch from data-vdt-source in SSR apps ([231ecc7](https://github.com/visulima/visulima/commit/231ecc73f70a49da4a6cd0b584760d12369bd8f0))
|
|
22
|
+
* **dev-toolbar:** remove redundant server arg from RPC function dispatch ([a941dc7](https://github.com/visulima/visulima/commit/a941dc7e593d3681bed61b374262abb8a476392b))
|
|
23
|
+
* **dev-toolbar:** replace require() with dynamic import() in openInEditor ([3fede74](https://github.com/visulima/visulima/commit/3fede740db2c431c6bb62897d13a0d9afb8cc65a))
|
|
24
|
+
* **dev-toolbar:** split RPC barrel and fix open-in-editor with launch-editor ([28e079a](https://github.com/visulima/visulima/commit/28e079afa10ac4ed2e729205f8bdf9405d33c1c2))
|
|
25
|
+
* **dev-toolbar:** use HMR WebSocket RPC to open files in editor ([a63cdab](https://github.com/visulima/visulima/commit/a63cdab1c30f9f73eb6b5f59f7c1ee4143135eba))
|
|
26
|
+
* **dev-toolbar:** use original file positions to prevent SSR hydration mismatch ([a40edd5](https://github.com/visulima/visulima/commit/a40edd5fb1a11a5208182dd71627b472f64db6c5))
|
|
27
|
+
|
|
28
|
+
### Documentation
|
|
29
|
+
|
|
30
|
+
* **dev-toolbar:** document removeDevtoolsOnBuild option ([00955b2](https://github.com/visulima/visulima/commit/00955b2a484df78f66b4c58babbeb514d4943285))
|
|
31
|
+
* **dev-toolbar:** update docs for all recent feature additions ([b204e0f](https://github.com/visulima/visulima/commit/b204e0f8956cafb6967363fa0cc2b01c435cdedc))
|
|
32
|
+
|
|
33
|
+
### Code Refactoring
|
|
34
|
+
|
|
35
|
+
* **dev-toolbar:** convert inspector to toolbar action button ([0d0b682](https://github.com/visulima/visulima/commit/0d0b682e65511c158baa29134a8c50e7db459284))
|
|
36
|
+
|
|
37
|
+
## @visulima/dev-toolbar [1.0.0-alpha.2](https://github.com/visulima/visulima/compare/@visulima/dev-toolbar@1.0.0-alpha.1...@visulima/dev-toolbar@1.0.0-alpha.2) (2026-03-01)
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* **dev-toolbar:** correct Tailwind v4 PostCSS setup in TanStack Start examples ([090da58](https://github.com/visulima/visulima/commit/090da58cbbd87695c238dfd1f7371a6f06b9ef80))
|
|
42
|
+
* **dev-toolbar:** dismiss tooltip on button click ([0ed60af](https://github.com/visulima/visulima/commit/0ed60af72f2390f8fcebde063d35e45e6f7fe9b8))
|
|
43
|
+
* **dev-toolbar:** handle CJS/ESM interop for axe-core dynamic import ([7a86907](https://github.com/visulima/visulima/commit/7a8690730b7c7858beb635dc1d66869d5b5e19e2))
|
|
44
|
+
* **dev-toolbar:** use appendTo in TanStack Start examples for SSR ([0844250](https://github.com/visulima/visulima/commit/0844250edbeeda1dfdc28058316bb6303e91fda6))
|
|
45
|
+
|
|
46
|
+
### Documentation
|
|
47
|
+
|
|
48
|
+
* **dev-toolbar:** document appendTo for SSR frameworks (TanStack Start) ([eba507e](https://github.com/visulima/visulima/commit/eba507eba8d0b705f23f32e7c08dc40fca87473a))
|
|
49
|
+
|
|
50
|
+
### Miscellaneous Chores
|
|
51
|
+
|
|
52
|
+
* **dev-toolbar:** add framework examples for six setups ([38117c1](https://github.com/visulima/visulima/commit/38117c1e0d6d8d3abb94785d95780482f5870d5c))
|
|
53
|
+
* **dev-toolbar:** add TanStack Start + Cloudflare Pages example ([1463ef8](https://github.com/visulima/visulima/commit/1463ef892669215bdc71fe90048e40cfbb4907c0))
|
|
54
|
+
* **dev-toolbar:** add TanStack Start and Cloudflare examples ([ddfe175](https://github.com/visulima/visulima/commit/ddfe17571bb416712eb02f4ae0222d182bdc2844))
|
|
55
|
+
* remove IDE configs, memory-bank, and stale lint script ([3a1100e](https://github.com/visulima/visulima/commit/3a1100e1f9e5dae6fb6fefd486195e8cc80fc578))
|
|
56
|
+
|
|
1
57
|
## @visulima/dev-toolbar 1.0.0-alpha.1 (2026-02-28)
|
|
2
58
|
|
|
3
59
|
### Features
|
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
`@visulima/dev-toolbar` is a framework-agnostic development toolbar for **any Vite project** — React, Vue, Svelte, SolidJS, or plain HTML. Inspired by Astro DevToolbar, Vue DevTools, and Nuxt DevTools, it provides a consistent developer experience regardless of your framework.
|
|
30
30
|
|
|
31
|
-
The toolbar renders inside a Shadow DOM custom element (zero style leakage), communicates with the Vite dev server over type-safe RPC, and ships **
|
|
31
|
+
The toolbar renders inside a Shadow DOM custom element (zero style leakage), communicates with the Vite dev server over type-safe RPC, and ships **nine built-in apps** covering the most common development workflows.
|
|
32
32
|
|
|
33
33
|
## Install
|
|
34
34
|
|
|
@@ -53,9 +53,7 @@ import { defineConfig } from "vite";
|
|
|
53
53
|
import { devToolbar } from "@visulima/dev-toolbar/vite";
|
|
54
54
|
|
|
55
55
|
export default defineConfig({
|
|
56
|
-
plugins: [
|
|
57
|
-
devToolbar(),
|
|
58
|
-
],
|
|
56
|
+
plugins: [devToolbar()],
|
|
59
57
|
});
|
|
60
58
|
```
|
|
61
59
|
|
|
@@ -63,15 +61,17 @@ Start your dev server and press **`Alt`+`Shift`+`D`** to open the toolbar.
|
|
|
63
61
|
|
|
64
62
|
## Built-in Apps
|
|
65
63
|
|
|
66
|
-
| App
|
|
67
|
-
|
|
64
|
+
| App | What it does |
|
|
65
|
+
| ----------------- | ----------------------------------------------------------------------------- |
|
|
68
66
|
| **Accessibility** | axe-core WCAG audit with live element overlays and sessionStorage persistence |
|
|
69
|
-
| **Performance**
|
|
70
|
-
| **SEO**
|
|
71
|
-
| **Timeline**
|
|
72
|
-
| **Module Graph**
|
|
73
|
-
| **Vite Config**
|
|
74
|
-
| **
|
|
67
|
+
| **Performance** | Web Vitals (LCP, INP, CLS, FCP, TTFB), resource timing, navigation waterfall |
|
|
68
|
+
| **SEO** | Social preview cards for 7 platforms + full meta tag audit |
|
|
69
|
+
| **Timeline** | Chronological event log from your app and integrated libraries |
|
|
70
|
+
| **Module Graph** | Browse and filter Vite's live module dependency graph |
|
|
71
|
+
| **Vite Config** | Inspect the fully resolved Vite configuration |
|
|
72
|
+
| **Inspector** | Click any element to jump to its JSX source in your editor |
|
|
73
|
+
| **Tailwind** | Browse all resolved Tailwind CSS design tokens and their values |
|
|
74
|
+
| **Settings** | Theme, toolbar behaviour, panel sizing, and custom keyboard shortcuts |
|
|
75
75
|
|
|
76
76
|
All apps are enabled by default. Disable individual apps via plugin options:
|
|
77
77
|
|
|
@@ -81,7 +81,7 @@ devToolbar({
|
|
|
81
81
|
performance: false,
|
|
82
82
|
seo: false,
|
|
83
83
|
},
|
|
84
|
-
})
|
|
84
|
+
});
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
## Plugin Options
|
|
@@ -97,19 +97,21 @@ devToolbar({
|
|
|
97
97
|
settings: true,
|
|
98
98
|
timeline: true,
|
|
99
99
|
viteConfig: true,
|
|
100
|
+
inspector: true,
|
|
101
|
+
tailwind: true,
|
|
100
102
|
},
|
|
101
103
|
|
|
102
104
|
// Register custom apps
|
|
103
105
|
customApps: [],
|
|
104
106
|
|
|
105
107
|
// Toolbar pill placement
|
|
106
|
-
placement: "bottom-center",
|
|
107
|
-
position: "bottom",
|
|
108
|
+
placement: "bottom-center", // "bottom-left" | "bottom-center" | "bottom-right"
|
|
109
|
+
position: "bottom", // "bottom" | "top" | "left" | "right"
|
|
108
110
|
|
|
109
111
|
// Panel defaults (users can override via Settings app)
|
|
110
|
-
height: 60,
|
|
111
|
-
width: 80,
|
|
112
|
-
minimizePanelInactive: 5000,
|
|
112
|
+
height: 60, // % of viewport height
|
|
113
|
+
width: 80, // % of viewport width
|
|
114
|
+
minimizePanelInactive: 5000, // ms; -1 = never auto-hide
|
|
113
115
|
closeOnOutsideClick: true,
|
|
114
116
|
|
|
115
117
|
// Keyboard shortcuts (project-level defaults)
|
|
@@ -117,17 +119,32 @@ devToolbar({
|
|
|
117
119
|
toggle: "Alt+Shift+D",
|
|
118
120
|
close: "Escape",
|
|
119
121
|
},
|
|
120
|
-
|
|
122
|
+
|
|
123
|
+
// Strip toolbar from production builds (default: true)
|
|
124
|
+
removeDevtoolsOnBuild: true,
|
|
125
|
+
|
|
126
|
+
// Force a specific editor for "Open in editor" (auto-detected if omitted)
|
|
127
|
+
editor: "webstorm",
|
|
128
|
+
|
|
129
|
+
// JSX source injection for click-to-source in the inspector
|
|
130
|
+
injectSource: {
|
|
131
|
+
enabled: true, // set false to opt out
|
|
132
|
+
ignore: {
|
|
133
|
+
files: ["**/generated/**"], // glob patterns
|
|
134
|
+
components: ["StrictMode"], // component names
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
});
|
|
121
138
|
```
|
|
122
139
|
|
|
123
140
|
See the [full configuration reference](./docs/configuration.mdx) for all options.
|
|
124
141
|
|
|
125
142
|
## Keyboard Shortcuts
|
|
126
143
|
|
|
127
|
-
| Action
|
|
128
|
-
|
|
144
|
+
| Action | Default |
|
|
145
|
+
| ------------------------- | ----------------- |
|
|
129
146
|
| Toggle toolbar open/close | `Alt`+`Shift`+`D` |
|
|
130
|
-
| Close active app / panel
|
|
147
|
+
| Close active app / panel | `Escape` |
|
|
131
148
|
|
|
132
149
|
Both shortcuts are configurable in the Settings app or via plugin options.
|
|
133
150
|
|
|
@@ -152,12 +169,12 @@ devToolbar({
|
|
|
152
169
|
{
|
|
153
170
|
id: "my-package:my-app",
|
|
154
171
|
name: "My App",
|
|
155
|
-
icon: myIconSvg,
|
|
172
|
+
icon: myIconSvg, // raw SVG string
|
|
156
173
|
component: MyApp,
|
|
157
|
-
tooltip: MyTooltip,
|
|
174
|
+
tooltip: MyTooltip, // optional hover summary
|
|
158
175
|
},
|
|
159
176
|
],
|
|
160
|
-
})
|
|
177
|
+
});
|
|
161
178
|
```
|
|
162
179
|
|
|
163
180
|
See the [custom apps guide](./docs/custom-apps/creating-apps.mdx) for a step-by-step walkthrough including RPC, tooltips, and styling.
|
|
@@ -175,7 +192,7 @@ devToolbar({
|
|
|
175
192
|
return files.map((f) => `/${f.replace(/\.(tsx?|jsx?)$/, "")}`);
|
|
176
193
|
},
|
|
177
194
|
},
|
|
178
|
-
})
|
|
195
|
+
});
|
|
179
196
|
|
|
180
197
|
// Call from your app component
|
|
181
198
|
const routes = await helpers.rpc.getRoutes();
|
|
@@ -237,22 +254,22 @@ See the [library integration guide](./docs/integrations/library-integration.mdx)
|
|
|
237
254
|
|
|
238
255
|
All docs are in the [`docs/`](./docs/) folder in Fumadocs MDX format:
|
|
239
256
|
|
|
240
|
-
| Page
|
|
241
|
-
|
|
242
|
-
| [Getting Started](./docs/getting-started.mdx)
|
|
243
|
-
| [Configuration](./docs/configuration.mdx)
|
|
244
|
-
| [Accessibility](./docs/built-in-apps/accessibility.mdx)
|
|
245
|
-
| [Performance](./docs/built-in-apps/performance.mdx)
|
|
246
|
-
| [SEO](./docs/built-in-apps/seo.mdx)
|
|
247
|
-
| [Timeline](./docs/built-in-apps/timeline.mdx)
|
|
248
|
-
| [Module Graph](./docs/built-in-apps/module-graph.mdx)
|
|
249
|
-
| [Vite Config](./docs/built-in-apps/vite-config.mdx)
|
|
250
|
-
| [Settings](./docs/built-in-apps/settings.mdx)
|
|
251
|
-
| [Creating Apps](./docs/custom-apps/creating-apps.mdx)
|
|
252
|
-
| [App API](./docs/custom-apps/app-api.mdx)
|
|
253
|
-
| [RPC](./docs/custom-apps/rpc.mdx)
|
|
254
|
-
| [Global API](./docs/custom-apps/global-api.mdx)
|
|
255
|
-
| [Library Integration](./docs/integrations/library-integration.mdx) | Zero-dependency hook pattern
|
|
257
|
+
| Page | Contents |
|
|
258
|
+
| ------------------------------------------------------------------ | ---------------------------------------- |
|
|
259
|
+
| [Getting Started](./docs/getting-started.mdx) | Install, framework examples, first steps |
|
|
260
|
+
| [Configuration](./docs/configuration.mdx) | Full plugin options reference |
|
|
261
|
+
| [Accessibility](./docs/built-in-apps/accessibility.mdx) | axe-core, overlays, WCAG standards |
|
|
262
|
+
| [Performance](./docs/built-in-apps/performance.mdx) | Web Vitals thresholds, timing APIs |
|
|
263
|
+
| [SEO](./docs/built-in-apps/seo.mdx) | Social previews, meta tag audit |
|
|
264
|
+
| [Timeline](./docs/built-in-apps/timeline.mdx) | Event structure, emitting events |
|
|
265
|
+
| [Module Graph](./docs/built-in-apps/module-graph.mdx) | Search, ext badges, importer view |
|
|
266
|
+
| [Vite Config](./docs/built-in-apps/vite-config.mdx) | Resolved config sections |
|
|
267
|
+
| [Settings](./docs/built-in-apps/settings.mdx) | All settings, localStorage schema |
|
|
268
|
+
| [Creating Apps](./docs/custom-apps/creating-apps.mdx) | Step-by-step custom app guide |
|
|
269
|
+
| [App API](./docs/custom-apps/app-api.mdx) | TypeScript interface reference |
|
|
270
|
+
| [RPC](./docs/custom-apps/rpc.mdx) | Server functions, type-safe pattern |
|
|
271
|
+
| [Global API](./docs/custom-apps/global-api.mdx) | `__VISULIMA_DEVTOOLS__` reference |
|
|
272
|
+
| [Library Integration](./docs/integrations/library-integration.mdx) | Zero-dependency hook pattern |
|
|
256
273
|
|
|
257
274
|
## Supported Node.js Versions
|
|
258
275
|
|
|
@@ -37,7 +37,7 @@ declare class A11yStore {
|
|
|
37
37
|
setShowOverlays(show: boolean): void;
|
|
38
38
|
/** Change the WCAG standard used for future scans */
|
|
39
39
|
setStandard(standard: Standard): void;
|
|
40
|
-
subscribe(
|
|
40
|
+
subscribe(function_: Listener): () => void;
|
|
41
41
|
private notify;
|
|
42
42
|
private persist;
|
|
43
43
|
private update;
|
|
@@ -4,7 +4,7 @@ import type { AppTooltipProps } from "../../types/app.d.ts";
|
|
|
4
4
|
/**
|
|
5
5
|
* Hover tooltip for the Accessibility app button.
|
|
6
6
|
* Shows a summary of scan results and quick action buttons.
|
|
7
|
-
* @param _props
|
|
7
|
+
* @param _props Tooltip props (unused; reads from a11yStore directly)
|
|
8
8
|
* @returns Rendered tooltip component
|
|
9
9
|
*/
|
|
10
10
|
declare const A11yTooltip: (_props: AppTooltipProps) => ComponentChildren;
|
package/dist/apps/a11y/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Y=Object.defineProperty;var A=(a,e)=>Y(a,"name",{value:e,configurable:!0});import{addHookName as S}from"preact/devtools";import{useState as w,useEffect as U}from"preact/hooks";import u from"../../packem_shared/cn-DWLJYh3h.js";import{jsxs as i,jsx as t,Fragment as H}from"preact/jsx-runtime";import y from"../../packem_shared/Button-DODNCTPZ.js";import{Alert as X,AlertDescription as Z}from"../../packem_shared/Alert-H-x1JuZ0.js";const ee=`<!-- @license lucide-static v0.576.0 - ISC -->
|
|
2
2
|
<svg
|
|
3
3
|
class="lucide lucide-accessibility"
|
|
4
4
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -17,5 +17,5 @@ var K=Object.defineProperty;var C=(s,e)=>K(s,"name",{value:e,configurable:!0});i
|
|
|
17
17
|
<path d="M4.24 14.5a5 5 0 0 0 6.88 6" />
|
|
18
18
|
<path d="M13.76 17.5a5 5 0 0 0-6.88-6" />
|
|
19
19
|
</svg>
|
|
20
|
-
`;var
|
|
21
|
-
`)],{type:"text/csv"}),P=URL.createObjectURL(
|
|
20
|
+
`;var te=Object.defineProperty,f=A((a,e)=>te(a,"name",{value:e,configurable:!0}),"i$2");const M=["critical","serious","moderate","minor"],re={critical:"rgb(239,68,68)",minor:"rgb(100,116,139)",moderate:"rgb(249,115,22)",serious:"rgb(234,179,8)"},ne={"best-practice":["best-practice"],wcag2a:["wcag2a"],wcag21aa:["wcag2a","wcag2aa","wcag21a","wcag21aa"],wcag22aa:["wcag2a","wcag2aa","wcag21a","wcag21aa","wcag22a","wcag22aa"]},_="__vdt_a11y__",se=f(()=>{try{const a=sessionStorage.getItem(_);if(a){const e=JSON.parse(a);if(Array.isArray(e.issues))return{issues:e.issues,lastScan:e.lastScan??null}}}catch{}return{issues:[],lastScan:null}},"loadFromSession"),W=f((a,e)=>{const s=a;s.dataset.vdtA11y=e,s.style.setProperty("outline",`2px solid ${re[e]}`,"important"),s.style.setProperty("outline-offset","2px","important")},"setHighlight"),$=f(()=>{for(const a of document.querySelectorAll("[data-vdt-a11y]")){const e=a;delete e.dataset.vdtA11y,e.style.removeProperty("outline"),e.style.removeProperty("outline-offset")}},"clearHighlightsDOM"),G=f(a=>{$();for(const e of a)for(const s of e.nodes)try{const r=document.querySelector(s.selector);r&&W(r,e.impact)}catch{}},"applyOverlaysDOM"),ae=f(a=>{const e=a.at(-1);return Array.isArray(e)?e.join(" "):String(e??"")},"nodeSelector"),ie=f((a,e)=>{const s=[];for(const r of a)e.includes(r.id)||s.push({helpUrl:r.helpUrl,id:r.id,impact:r.impact??"minor",message:r.help,nodes:r.nodes.map(o=>({html:o.html,selector:ae(o.target)})),wcagTags:r.tags.filter(o=>o.startsWith("wcag")||o==="best-practice")});return s},"convertViolations"),oe=f(async a=>{const e=await import("axe-core"),s=typeof e.default?.run=="function"?e.default:e;if(typeof s.run!="function")throw new TypeError("axe-core could not be loaded — .run is not available");return s.run(document,{exclude:[["dev-toolbar"]],runOnly:{type:"tag",values:ne[a]}})},"runAxeScan");class le{static{A(this,"f")}static{f(this,"A11yStore")}listeners=new Set;state;constructor(){const{issues:e,lastScan:s}=se();this.state={isScanning:!1,issues:e,lastScan:s,scanError:null,showOverlays:!1,standard:"wcag21aa"}}clearHighlights(){$()}getState(){return this.state}highlightIssue(e){$();let s=!1;for(const r of e.nodes)try{const o=document.querySelector(r.selector);o&&(W(o,e.impact),s||(o.scrollIntoView({behavior:"smooth",block:"center"}),s=!0))}catch{}}async scan(e=[]){if(!this.state.isScanning){this.update({isScanning:!0,scanError:null});try{const s=await oe(this.state.standard),r=ie(s.violations,e);this.update({isScanning:!1,issues:r,lastScan:new Date().toISOString()}),this.persist(),this.state.showOverlays&&G(r)}catch(s){this.update({isScanning:!1,scanError:s instanceof Error?s.message:String(s)})}}}setShowOverlays(e){this.update({showOverlays:e}),e?G(this.state.issues):$()}setStandard(e){this.update({standard:e})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(){for(const e of this.listeners)e()}persist(){try{sessionStorage.setItem(_,JSON.stringify({issues:this.state.issues,lastScan:this.state.lastScan}))}catch{}}update(e){this.state={...this.state,...e},this.notify()}}const c=new le;var ce=Object.defineProperty,l=A((a,e)=>ce(a,"name",{value:e,configurable:!0}),"o");const I={critical:"Critical",minor:"Minor",moderate:"Moderate",serious:"Serious"},z={critical:"text-destructive",minor:"text-muted-foreground",moderate:"text-warning-foreground",serious:"text-warning-foreground"},de={critical:"bg-destructive/10 border-destructive/30",minor:"bg-foreground/4 border-border",moderate:"bg-warning/10 border-warning/30",serious:"bg-warning/10 border-warning/30"},ue={critical:"bg-destructive",minor:"bg-muted-foreground/50",moderate:"bg-warning",serious:"bg-warning"},ge=l(({count:a,isActive:e,onClick:s,severity:r})=>i("button",{class:u("flex flex-col items-center gap-1 px-3 py-2.5 border cursor-pointer transition-colors",e?"ring-1 ring-inset ring-primary/40":"hover:bg-foreground/6",de[r]),onClick:s,title:`${e?"Clear":"Filter by"} ${I[r]}`,type:"button",children:[t("span",{class:u("text-xl font-bold tabular-nums leading-none",z[r]),children:a}),t("span",{class:"text-[0.6rem] font-semibold uppercase tracking-wider text-muted-foreground",children:I[r]})]}),"SeverityBucket"),pe=l(({isSelected:a,issue:e,onClick:s,onDisable:r})=>i("div",{class:u("p-3 border cursor-pointer transition-colors",a?"bg-foreground/6 border-primary/30":"border-border hover:bg-foreground/3"),onClick:s,children:[i("div",{class:"flex items-start gap-2 mb-1.5",children:[t("span",{class:u("mt-1 size-2 rounded-full shrink-0",ue[e.impact])}),t("span",{class:"text-[0.75rem] font-semibold text-foreground flex-1 leading-snug",children:e.id}),t("span",{class:u("text-[0.6rem] font-bold uppercase tracking-wide shrink-0",z[e.impact]),children:I[e.impact]})]}),t("p",{class:"text-[0.7rem] text-muted-foreground leading-relaxed mb-2 ml-4",children:e.message}),e.nodes.length>0&&i("div",{class:"mb-2 ml-4 space-y-0.5",children:[e.nodes.slice(0,3).map((o,p)=>t("code",{class:"block text-[0.65rem] text-foreground/70 font-mono bg-foreground/5 px-2 py-1 truncate",children:o.selector},p)),e.nodes.length>3&&i("span",{class:"text-[0.62rem] text-muted-foreground/60",children:["+",e.nodes.length-3," more element",e.nodes.length>4?"s":""]})]}),i("div",{class:"flex items-center gap-2 flex-wrap ml-4",children:[e.wcagTags.slice(0,3).map(o=>t("span",{class:"text-[0.58rem] font-mono uppercase bg-primary/8 text-primary/70 border border-primary/20 px-1.5 py-0.5",children:o},o)),t("span",{class:"flex-1"}),t("a",{class:"text-[0.62rem] text-primary/70 hover:text-primary transition-colors",href:e.helpUrl,onClick:l(o=>o.stopPropagation(),"onClick"),rel:"noopener noreferrer",target:"_blank",children:"Learn more ↗"}),t("button",{class:"text-[0.62rem] text-muted-foreground/60 hover:text-muted-foreground transition-colors cursor-pointer bg-transparent border-0 p-0",onClick:l(o=>{o.stopPropagation(),r(e.id)},"onClick"),title:"Disable this rule for current session",type:"button",children:"Disable"})]})]}),"IssueCard"),me=l(a=>{const[e,s]=S(w(()=>c.getState()),"storeState"),[r,o]=S(w([]),"disabledRules"),[p,j]=S(w(null),"minSeverity"),[v,k]=S(w(null),"activeIssueId"),[m,d]=S(w(null),"filterSeverity");U(()=>c.subscribe(()=>s(c.getState())),[]),U(()=>c.clearHighlights.bind(c),[]);const{isScanning:h,issues:b,lastScan:J,scanError:R,showOverlays:N,standard:V}=e,T=J!==null||R!==null,L=l(()=>{d(null),k(null),c.scan(r)},"handleScan"),q=l(n=>{v===n.id?(k(null),c.clearHighlights(),N&&c.setShowOverlays(!0)):(k(n.id),c.highlightIssue(n))},"handleIssueClick"),F=l(n=>{o(g=>[...g,n])},"handleDisableRule"),E=b.filter(n=>!(r.includes(n.id)||m&&n.impact!==m||p&&M.indexOf(n.impact)>M.indexOf(p))),K=l(n=>b.filter(g=>!r.includes(g.id)&&g.impact===n).length,"countBy");return i("div",{class:"flex flex-col h-full",children:[i("div",{class:"shrink-0 flex items-center gap-2 px-4 py-2.5 border-b border-border bg-foreground/2 flex-wrap",children:[t(y,{class:u(h?"border-primary/30 text-primary/50 bg-primary/5":""),disabled:h,onClick:L,size:"sm",variant:"outline",children:h?"Scanning…":"Scan page"}),i("label",{class:"flex items-center gap-1.5 text-[0.7rem] text-muted-foreground",children:["Standard",i("select",{class:"bg-card border border-border text-foreground text-[0.7rem] px-1.5 py-1 cursor-pointer",onChange:l(n=>c.setStandard(n.target.value),"onChange"),style:"color-scheme: dark",value:V,children:[t("option",{value:"wcag21aa",children:"WCAG 2.1 AA"}),t("option",{value:"wcag22aa",children:"WCAG 2.2 AA"}),t("option",{value:"wcag2a",children:"WCAG 2.0 A"}),t("option",{value:"best-practice",children:"Best Practice"})]})]}),i("label",{class:"flex items-center gap-1.5 text-[0.7rem] text-muted-foreground",children:["Min",i("select",{class:"bg-card border border-border text-foreground text-[0.7rem] px-1.5 py-1 cursor-pointer",onChange:l(n=>{const{value:g}=n.target;j(g||null)},"onChange"),style:"color-scheme: dark",value:p??"",children:[t("option",{value:"",children:"All"}),t("option",{value:"critical",children:"Critical only"}),t("option",{value:"serious",children:"Serious+"}),t("option",{value:"moderate",children:"Moderate+"})]})]}),t(y,{class:u(N?"border-primary/30 text-primary bg-primary/8":""),onClick:l(()=>c.setShowOverlays(!N),"onClick"),size:"sm",title:"Toggle visual highlights on affected elements",variant:"outline",children:"Overlays"}),T&&b.length>0&&i(H,{children:[t(y,{class:"ml-auto",onClick:l(()=>{const n=new Blob([JSON.stringify(b,null,2)],{type:"application/json"}),g=URL.createObjectURL(n),C=document.createElement("a");C.href=g,C.download="a11y-audit.json",C.click(),URL.revokeObjectURL(g)},"onClick"),size:"sm",title:"Export audit results as JSON",variant:"outline",children:"JSON"}),t(y,{onClick:l(()=>{const n=l(x=>`"${x.replaceAll('"','""')}"`,"q"),g=["Rule ID","Severity","Message","Selector","HTML","WCAG Tags"].join(","),C=b.flatMap(x=>x.nodes.map(B=>[n(x.id),n(x.impact),n(x.message),n(B.selector),n(B.html),n(x.wcagTags.join("; "))].join(","))),Q=new Blob([[g,...C].join(`
|
|
21
|
+
`)],{type:"text/csv"}),P=URL.createObjectURL(Q),D=document.createElement("a");D.href=P,D.download="a11y-audit.csv",D.click(),URL.revokeObjectURL(P)},"onClick"),size:"sm",title:"Export audit results as CSV",variant:"outline",children:"CSV"})]})]}),i("div",{class:"flex-1 overflow-y-auto devtools-content-scroll",children:[R&&t(X,{class:"rounded-none border-x-0 border-t-0",variant:"destructive",children:i(Z,{children:["Scan failed: ",R]})}),!T&&!h&&i("div",{class:"flex flex-col items-center justify-center gap-4 p-8 min-h-48 text-center",children:[t("p",{class:"text-[0.8125rem] text-muted-foreground max-w-sm",children:"Run an accessibility audit using axe-core to detect WCAG violations on this page."}),t(y,{onClick:L,variant:"outline",children:"Start scan"})]}),h&&t("div",{class:"flex items-center justify-center gap-3 p-8 min-h-48",children:t("span",{class:"text-[0.8rem] text-muted-foreground",children:"Scanning for accessibility issues…"})}),T&&!h&&!R&&i("div",{class:"p-5 space-y-4",children:[t("div",{class:"grid grid-cols-4 gap-2",children:M.map(n=>t(ge,{count:K(n),isActive:m===n,onClick:l(()=>d(m===n?null:n),"onClick"),severity:n},n))}),E.length===0?i("div",{class:"p-6 text-center border border-border",children:[t("p",{class:"text-[0.8125rem] font-medium text-foreground/70",children:b.length===0?"No violations found!":"No issues match the current filters."}),b.length===0&&t("p",{class:"mt-1 text-[0.7rem] text-muted-foreground",children:"Great — the page passes all rules for the selected standard."})]}):i("section",{children:[i("div",{class:"flex items-center gap-2 mb-2",children:[i("span",{class:"text-[0.65rem] font-bold uppercase tracking-[0.1em] text-muted-foreground",children:[t("span",{"aria-hidden":"true",class:"text-primary/50",children:"//"})," ",E.length," issue",E.length===1?"":"s",m?` · ${I[m]} only`:""]}),m&&t(y,{class:"h-auto p-0 text-[0.62rem]",onClick:l(()=>d(null),"onClick"),variant:"link",children:"Clear ×"})]}),t("div",{class:"space-y-2",children:E.map(n=>t(pe,{isSelected:v===n.id,issue:n,onClick:l(()=>q(n),"onClick"),onDisable:F},n.id))})]}),r.length>0&&i("div",{class:"flex items-center gap-2 text-[0.65rem] text-muted-foreground/60",children:[i("span",{children:[r.length," rule",r.length===1?"":"s"," disabled this session."]}),t(y,{class:"h-auto p-0 text-[0.62rem]",onClick:l(()=>o([]),"onClick"),variant:"link",children:"Reset"})]})]})]})]})},"A11yApp");var he=Object.defineProperty,O=A((a,e)=>he(a,"name",{value:e,configurable:!0}),"i$1");const fe={critical:"text-destructive",minor:"text-muted-foreground",moderate:"text-warning-foreground",serious:"text-warning-foreground"},be={critical:"Crit",minor:"Min",moderate:"Mod",serious:"Ser"},xe=O(a=>{const e=new Date(a).getTime();if(Number.isNaN(e))return"unknown";const s=Math.max(0,Math.floor((Date.now()-e)/1e3));if(s<10)return"just now";if(s<60)return`${s}s ago`;const r=Math.floor(s/60);return r<60?`${r} min ago`:`${Math.floor(r/60)} hr ago`},"formatElapsed"),ye=O(a=>{const[e,s]=S(w(()=>c.getState()),"state");U(()=>c.subscribe(()=>s(c.getState())),[]);const{isScanning:r,issues:o,lastScan:p,showOverlays:j}=e,v=o.length,k=o.reduce((d,h)=>(d[h.impact]=(d[h.impact]??0)+1,d),{critical:0,minor:0,moderate:0,serious:0}),m=O(d=>k[d],"countBy");return i("div",{class:"space-y-3 min-w-[200px]",children:[p?i(H,{children:[i("div",{class:"flex items-baseline gap-2",children:[t("span",{class:u("text-2xl font-bold tabular-nums leading-none",v>0?"text-destructive":"text-success-foreground"),children:v}),i("span",{class:"text-[0.65rem] text-muted-foreground",children:["violation",v===1?"":"s"]})]}),t("div",{class:"grid grid-cols-4 gap-1.5",children:M.map(d=>i("div",{class:"flex flex-col items-center gap-0.5",children:[t("span",{class:u("text-[0.85rem] font-bold tabular-nums leading-none",fe[d]),children:m(d)}),t("span",{class:"text-[0.55rem] uppercase tracking-wide text-muted-foreground/70",children:be[d]})]},d))}),i("p",{class:"text-[0.62rem] text-muted-foreground/50",children:["Scanned ",xe(p)]})]}):i("div",{children:[t("p",{class:"text-[0.72rem] text-muted-foreground",children:"No scan run yet."}),t("p",{class:"text-[0.65rem] text-muted-foreground/50 mt-0.5",children:"Scan this page to detect WCAG violations."})]}),i("div",{class:"flex items-center gap-2 pt-2 border-t border-border/50",children:[t("button",{class:u("flex-1 px-2.5 py-1.5 text-[0.7rem] font-medium border transition-colors cursor-pointer",r?"border-primary/30 text-primary/50 bg-primary/5 cursor-not-allowed":"border-border text-foreground bg-transparent hover:bg-foreground/5"),disabled:r,onClick:O(()=>{c.scan()},"onClick"),type:"button",children:r?"Scanning…":p?"Re-scan":"Scan"}),t("button",{class:u("px-2.5 py-1.5 text-[0.7rem] border transition-colors",o.length===0?"border-border/50 text-muted-foreground/40 bg-transparent cursor-not-allowed":u("cursor-pointer",j?"border-primary/30 text-primary bg-primary/8":"border-border text-muted-foreground bg-transparent hover:text-foreground")),disabled:o.length===0,onClick:O(()=>c.setShowOverlays(!j),"onClick"),title:"Toggle visual highlights on affected elements",type:"button",children:"Overlays"})]})]})},"A11yTooltip"),je={component:me,icon:ee,id:"dev-toolbar:a11y",name:"Accessibility",tooltip:ye};export{je as default};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var A=Object.defineProperty;var w=(t,e)=>A(t,"name",{value:e,configurable:!0});const j=`<!-- @license lucide-static v0.576.0 - ISC -->
|
|
2
|
+
<svg
|
|
3
|
+
class="lucide lucide-inspect"
|
|
4
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
+
width="24"
|
|
6
|
+
height="24"
|
|
7
|
+
viewBox="0 0 24 24"
|
|
8
|
+
fill="none"
|
|
9
|
+
stroke="currentColor"
|
|
10
|
+
stroke-width="2"
|
|
11
|
+
stroke-linecap="round"
|
|
12
|
+
stroke-linejoin="round"
|
|
13
|
+
>
|
|
14
|
+
<path d="M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z" />
|
|
15
|
+
<path d="M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6" />
|
|
16
|
+
</svg>
|
|
17
|
+
`;var H=Object.defineProperty,r=w((t,e)=>H(t,"name",{value:e,configurable:!0}),"r");const _={bg:"#18181b",btnBg:"rgba(196,181,253,0.08)",btnBgHover:"rgba(196,181,253,0.16)",btnBorder:"rgba(196,181,253,0.25)",btnBorderHover:"rgba(196,181,253,0.5)",fg:"#fafafa",muted:"#a1a1aa",overlayBg:"rgba(196,181,253,0.06)",overlayBorder:"rgba(196,181,253,0.7)",primary:"#c4b5fd",shadow:"0 8px 32px rgba(0,0,0,.75)"},$={bg:"#ffffff",btnBg:"rgba(124,58,237,0.08)",btnBgHover:"rgba(124,58,237,0.16)",btnBorder:"rgba(124,58,237,0.25)",btnBorderHover:"rgba(124,58,237,0.5)",fg:"#18181b",muted:"#52525b",overlayBg:"rgba(124,58,237,0.06)",overlayBorder:"rgba(124,58,237,0.7)",primary:"#7c3aed",shadow:"0 8px 32px rgba(0,0,0,.15)"},y=r(()=>{try{const t=localStorage.getItem("__v_dt__theme");if(t==="light")return $;if(t==="dark")return _}catch{}return globalThis.window?.matchMedia("(prefers-color-scheme: dark)").matches?_:$},"getThemePalette"),x="__vdt_inspector_overlay",I="__vdt_inspector_label",h="__vdt_inspector_cursor",E="__vdt_inspector_badge",k="__vdt_inspector_kf",T="__vdt_inspector_result",S=r(()=>{let t=document.getElementById(x);if(!t){const e=y();t=document.createElement("div"),t.id=x,t.style.cssText=["position:fixed","pointer-events:none","z-index:2147483644","box-sizing:border-box",`border:1px solid ${e.overlayBorder}`,`background:${e.overlayBg}`,"transition:top 60ms,left 60ms,width 60ms,height 60ms","display:none"].join(";");const o=document.createElement("div");o.id=I,o.style.cssText=["position:absolute","bottom:calc(100% + 2px)","left:0",`background:${e.bg}`,`color:${e.primary}`,"font:11px/1.2 'JetBrains Mono',monospace","padding:2px 6px","white-space:nowrap","pointer-events:none",`border:1px solid ${e.btnBorder}`].join(";"),t.append(o),document.body.append(t)}return t},"getOrCreateOverlay"),O=r(t=>{let e=t;for(;e;){const o=e.dataset.vdtSource;if(o)return o;e=e.parentElement}return null},"findSource"),P=r(t=>{const e=t.split(":");if(e.length<3)return t;const o=e[e.length-2],n=e.slice(0,-2).join(":");return`${n.split("/").pop()??n}:${o}`},"formatSourceShort"),D=r(t=>{const e=document.getElementById(x);if(!e)return;const o=t.getBoundingClientRect();e.style.display="block",e.style.top=`${o.top}px`,e.style.left=`${o.left}px`,e.style.width=`${o.width}px`,e.style.height=`${o.height}px`;const n=document.getElementById(I);if(n){const a=t.tagName.toLowerCase(),l=t.id?`#${t.id}`:"",c=t.classList.length>0?`.${[...t.classList].slice(0,3).join(".")}`:"",d=`${a}${l}${c}`,i=O(t);n.textContent=i?`${d} · ${P(i)}`:d,o.top<28?(n.style.bottom="auto",n.style.top="calc(100% + 2px)"):(n.style.top="",n.style.bottom="calc(100% + 2px)")}},"updateOverlayPosition"),L=r(()=>{const t=document.getElementById(x);t&&(t.style.display="none")},"hideOverlay"),R=r(()=>{document.getElementById(x)?.remove(),document.getElementById(h)?.remove()},"removeOverlay"),C=r(t=>{let e=document.getElementById(h);t?(e||(e=document.createElement("style"),e.id=h,document.head.append(e)),e.textContent="*, *::before, *::after { cursor: crosshair !important; }"):e&&e.remove()},"setCrosshairCursor"),V=r(t=>{if(!document.getElementById(k)){const d=document.createElement("style");d.id=k,d.textContent="@keyframes __vdt_pulse{0%,100%{opacity:1}50%{opacity:.3}}",document.head.append(d)}M();const e=y(),o=document.createElement("div");o.id=E,o.style.cssText=["position:fixed","bottom:4rem","left:50%","transform:translateX(-50%)","z-index:2147483645","display:flex","align-items:center","gap:8px","padding:6px 14px 6px 10px",`background:${e.bg}`,`border:1px solid ${e.btnBorder}`,`box-shadow:${e.shadow}`,"font:12px/1 'JetBrains Mono',monospace",`color:${e.fg}`,"pointer-events:auto","user-select:none","white-space:nowrap"].join(";");const n=document.createElement("span");n.style.cssText=`display:inline-block;width:7px;height:7px;border-radius:50%;background:${e.primary};animation:__vdt_pulse 1.4s ease-in-out infinite;flex-shrink:0;`;const a=document.createElement("span");a.textContent="Click any element to inspect";const l=document.createElement("span");l.style.cssText=`color:${e.muted};margin:0 4px;`,l.textContent="·";const c=document.createElement("button");c.textContent="Cancel",c.style.cssText=`background:transparent;border:none;color:${e.primary};cursor:pointer;padding:0;font:12px/1 'JetBrains Mono',monospace;text-decoration:underline;text-underline-offset:3px;`,c.addEventListener("click",d=>{d.stopPropagation(),t()}),o.append(n,a,l,c),document.body.append(o)},"createFloatingBadge"),M=r(()=>{document.getElementById(E)?.remove()},"removeFloatingBadge"),z=r(t=>{const e=t.split(":"),o=Number.parseInt(e.at(-1)??"0",10)||void 0,n=Number.parseInt(e.at(-2)??"0",10)||void 0,a=e.slice(0,-2).join(":");globalThis.__VISULIMA_DEVTOOLS__?.rpc?.openInEditor?.(a,n,o)},"openInEditor"),g=r(()=>{document.getElementById(T)?.remove()},"removeResultPopup"),f=r((t,e)=>{const o=y(),n=document.createElement("button");return n.textContent=t,n.style.cssText=[`background:${o.btnBg}`,`border:1px solid ${o.btnBorder}`,`color:${o.primary}`,"cursor:pointer","font:11px/1 'JetBrains Mono',monospace","padding:5px 10px","white-space:nowrap"].join(";"),n.addEventListener("pointerover",()=>{n.style.background=o.btnBgHover,n.style.borderColor=o.btnBorderHover}),n.addEventListener("pointerout",()=>{n.style.background=o.btnBg,n.style.borderColor=o.btnBorder}),n.addEventListener("click",a=>{a.stopPropagation(),e()}),n},"makeActionButton"),J=r((t,e,o)=>{g();const n=y(),a=document.createElement("div");a.id=T,a.style.cssText=["position:fixed","z-index:2147483646",`background:${n.bg}`,`border:1px solid ${n.btnBorder}`,"padding:10px 32px 10px 12px","font:12px/1.4 'JetBrains Mono',monospace",`color:${n.fg}`,`box-shadow:${n.shadow}`,"min-width:200px","max-width:400px","pointer-events:auto"].join(";");let l=e.bottom+8;l+110>window.innerHeight&&(l=e.top-110-8);let{left:c}=e;c+280>window.innerWidth&&(c=Math.max(8,window.innerWidth-288)),a.style.top=`${l}px`,a.style.left=`${c}px`;const d=t.tagName.toLowerCase(),i=t.id?`#${t.id}`:"",s=t.classList.length>0?`.${[...t.classList].slice(0,3).join(".")}`:"",b=document.createElement("div");if(b.style.cssText=`color:${n.primary};font-weight:bold;margin-bottom:4px;word-break:break-all;`,b.textContent=`${d}${i}${s}`,a.append(b),o){const u=document.createElement("div");u.style.cssText=`color:${n.muted};margin-bottom:10px;word-break:break-all;font-size:10px;`,u.textContent=o,a.append(u)}const m=document.createElement("div");m.style.cssText="display:flex;gap:6px;flex-wrap:wrap;",o&&m.append(f("Open in editor",()=>{z(o),g()})),m.append(f("Copy HTML",()=>{navigator.clipboard.writeText(t.outerHTML),g()})),o&&m.append(f("Copy path",()=>{navigator.clipboard.writeText(o),g()})),a.append(m);const p=document.createElement("button");p.textContent="×",p.style.cssText=["position:absolute","top:6px","right:8px","background:transparent","border:none",`color:${n.muted}`,"cursor:pointer","font:16px/1 'JetBrains Mono',monospace","padding:0","line-height:1","transition:color 0.15s"].join(";"),p.addEventListener("pointerover",()=>{p.style.color=n.fg}),p.addEventListener("pointerout",()=>{p.style.color=n.muted}),p.addEventListener("click",u=>{u.stopPropagation(),g()}),a.append(p),document.body.append(a);const B=r(u=>{a.contains(u.target)||(g(),document.removeEventListener("click",B,!0))},"handleOutside");setTimeout(()=>{document.addEventListener("click",B,!0)},100)},"showResultPopup");let v=null;const N=r((t,e)=>{v?.(),S(),C(!0);const o=r(()=>document.getElementById(E),"badgeElement"),n=r(i=>{if(!i)return!1;const s=o();return!!(s&&(i===s||s.contains(i)))},"isOverBadge"),a=r(i=>{const s=i.target;if(!s||s.tagName==="DEV-TOOLBAR"||n(s)){L();return}D(s)},"handleMouseMove"),l=r(i=>{const s=i.target;if(!s||s.tagName==="DEV-TOOLBAR"||n(s))return;i.preventDefault(),i.stopPropagation();const b=s.getBoundingClientRect(),m=O(s);d(),t(),J(s,b,m)},"handleClick"),c=r(i=>{i.key==="Escape"&&(d(),e())},"handleKeyDown"),d=r(()=>{document.removeEventListener("mousemove",a),document.removeEventListener("click",l,!0),document.removeEventListener("keydown",c),L(),R(),C(!1),M(),v=null},"cleanup");V(()=>{d(),e()}),document.addEventListener("mousemove",a),document.addEventListener("click",l,!0),document.addEventListener("keydown",c),v=d},"startGlobalInspection"),G=r(()=>{v?.(),g()},"stopGlobalInspection"),U={icon:j,id:"dev-toolbar:inspector",name:"Inspector",onClick(){const t=globalThis.__VISULIMA_DEVTOOLS__;N(()=>{t?.setAppActive&&t.setAppActive("dev-toolbar:inspector",!1)},()=>{t?.setAppActive&&t.setAppActive("dev-toolbar:inspector",!1)})},onDeactivate(){G()}};export{U as default};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Start element inspection mode.
|
|
3
|
+
* Attaches crosshair cursor, hover highlight overlay, and a floating badge.
|
|
4
|
+
* Survives component unmounts — state lives at module level.
|
|
5
|
+
* @param onComplete Called when the user clicks an element (after cleanup).
|
|
6
|
+
* @param onCancel Called when the user cancels via badge button or Escape.
|
|
7
|
+
*/
|
|
8
|
+
export declare const startGlobalInspection: (onComplete: () => void, onCancel: () => void) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Cancel any in-progress inspection and clean up all DOM side-effects.
|
|
11
|
+
*/
|
|
12
|
+
export declare const stopGlobalInspection: () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var U=Object.defineProperty;var k=(o,d)=>U(o,"name",{value:d,configurable:!0});import{addHookName as
|
|
1
|
+
var U=Object.defineProperty;var k=(o,d)=>U(o,"name",{value:d,configurable:!0});import{addHookName as i}from"preact/devtools";import{useState as s,useRef as E,useEffect as S}from"preact/hooks";import j from"../../packem_shared/cn-DWLJYh3h.js";import{jsx as r,jsxs as t}from"preact/jsx-runtime";import b from"../../packem_shared/Button-DODNCTPZ.js";import $ from"../../packem_shared/Input-GfbOwAkK.js";const A=`<!-- @license lucide-static v0.576.0 - ISC -->
|
|
2
2
|
<svg
|
|
3
3
|
class="lucide lucide-network"
|
|
4
4
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -17,4 +17,4 @@ var U=Object.defineProperty;var k=(o,d)=>U(o,"name",{value:d,configurable:!0});i
|
|
|
17
17
|
<path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3" />
|
|
18
18
|
<path d="M12 12V8" />
|
|
19
19
|
</svg>
|
|
20
|
-
`;var
|
|
20
|
+
`;var B=Object.defineProperty,n=k((o,d)=>B(o,"name",{value:d,configurable:!0}),"o");const F={css:"bg-purple-500/15 text-purple-400 border-purple-500/30",js:"bg-green-500/15 text-green-400 border-green-500/30",json:"bg-yellow-500/15 text-yellow-400 border-yellow-500/30",jsx:"bg-green-500/15 text-green-400 border-green-500/30",svg:"bg-orange-500/15 text-orange-400 border-orange-500/30",ts:"bg-blue-500/15 text-blue-400 border-blue-500/30",tsx:"bg-blue-500/15 text-blue-400 border-blue-500/30",vue:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30"},G=n(o=>o.match(/\.([a-z]+)(?:\?|$)/i)?.[1]?.toLowerCase()??"?","getExtension"),C=n(({ext:o})=>r("span",{class:j("inline-flex px-1.5 py-0.5 text-[0.6rem] font-mono font-bold uppercase border",F[o]??"bg-foreground/6 text-muted-foreground border-border"),children:o}),"ExtBadge"),H=n(({helpers:o})=>{const[d,I]=i(s([]),"modules"),[M,p]=i(s(!0),"loading"),[v,w]=i(s(null),"error"),[x,L]=i(s(""),"search"),[c,u]=i(s(null),"selectedId"),[y,h]=i(s([]),"importersList"),R=i(E(null),"searchRef"),f=n(()=>{p(!0),w(null),u(null),o.rpc.getModuleGraph().then(e=>{const a=e.map(l=>({ext:G(l.url??l.id??""),id:l.id??l.url??"",importers:l.importerCount??0,importerUrls:Array.isArray(l.importerUrls)?l.importerUrls:[],url:l.url??l.id??""}));I(a),p(!1)}).catch(e=>{w(e.message??"Failed to load module graph"),p(!1)})},"load");S(()=>{f()},[]);const g=d.filter(e=>{const a=x.toLowerCase();return!a||e.url.toLowerCase().includes(a)||e.ext.includes(a)}),m=c?d.find(e=>e.id===c):null,z=n(e=>{if(c===e.id){u(null),h([]);return}u(e.id),h(e.importerUrls)},"showImporters");return M?t("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 select-none",children:[r("div",{"aria-hidden":"true",class:"flex gap-1.5 items-center",children:[0,160,320].map(e=>r("span",{class:"size-1.5 bg-primary/50 rounded-full animate-pulse",style:{animationDelay:`${e}ms`}},e))}),r("span",{class:"text-[0.75rem] text-muted-foreground",children:"Scanning module graph…"})]}):v?t("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 text-center",children:[r("p",{class:"text-[0.8rem] text-destructive",children:v}),r(b,{onClick:f,size:"sm",variant:"outline",children:"Retry"})]}):t("div",{class:"flex flex-col h-full",children:[t("div",{class:"flex items-center gap-2 px-4 py-2.5 border-b border-border shrink-0",children:[r($,{class:"flex-1 bg-foreground/4 font-mono text-[0.8rem] placeholder:text-muted-foreground/50 focus-visible:border-primary/50 border-border",onInput:n(e=>L(e.target.value),"onInput"),placeholder:"Filter modules…",ref:R,type:"text",value:x}),t("span",{class:"text-[0.7rem] text-muted-foreground shrink-0",children:[g.length," / ",d.length]}),r(b,{onClick:f,size:"sm",variant:"outline",children:"Refresh"})]}),t("div",{class:"flex flex-1 min-h-0 overflow-hidden",children:[r("div",{class:"flex-1 overflow-auto divide-y divide-border/30",children:g.length===0?t("div",{class:"flex items-center justify-center p-8 text-[0.8rem] text-muted-foreground",children:['No modules match "',x,'"']}):g.map(e=>t("button",{class:j("w-full flex items-center gap-3 px-4 py-2.5 text-left border-0 bg-transparent cursor-pointer","hover:bg-foreground/4 transition-colors duration-100",c===e.id&&"bg-primary/6"),onClick:n(()=>z(e),"onClick"),type:"button",children:[r(C,{ext:e.ext}),r("span",{class:"flex-1 text-[0.775rem] font-mono text-foreground/80 truncate min-w-0",children:e.url}),e.importers>0&&t("span",{class:"shrink-0 text-[0.65rem] text-muted-foreground px-1.5 py-0.5 bg-foreground/6 border border-border/50",children:[e.importers,"↑"]})]},e.id))}),m&&t("div",{class:"border-l border-border bg-background w-72 shrink-0 flex flex-col overflow-hidden",children:[t("div",{class:"flex items-center justify-between gap-2 px-4 py-3 border-b border-border shrink-0",children:[r("span",{class:"text-[0.7rem] font-semibold text-foreground uppercase tracking-wide",children:"Module Info"}),r(b,{"aria-label":"Close",class:"h-6 w-6 text-xs",onClick:n(()=>{u(null),h([])},"onClick"),size:"icon",variant:"ghost",children:"✕"})]}),t("div",{class:"flex-1 overflow-auto p-4 space-y-3",children:[t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"URL"}),r("code",{class:"text-[0.7rem] font-mono text-foreground/80 break-all",children:m.url})]}),t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Type"}),r(C,{ext:m.ext})]}),t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Importers"}),r("span",{class:"text-[0.8rem] font-mono text-foreground",children:m.importers})]}),y.length>0&&t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Imported by"}),r("div",{class:"space-y-1",children:y.map(e=>r("code",{class:"block text-[0.65rem] font-mono text-muted-foreground break-all",children:e},e))})]})]})]})]})]})},"ModuleGraphApp"),J={component:H,icon:A,id:"dev-toolbar:module-graph",name:"Modules"};export{J as default};
|
package/dist/apps/more/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var p=Object.defineProperty;var s=(n,t)=>p(n,"name",{value:t,configurable:!0});import{addHookName as m}from"preact/devtools";import{useState as u,useEffect as f}from"preact/hooks";import
|
|
1
|
+
var p=Object.defineProperty;var s=(n,t)=>p(n,"name",{value:t,configurable:!0});import{addHookName as m}from"preact/devtools";import{useState as u,useEffect as f}from"preact/hooks";import g from"../../packem_shared/cn-DWLJYh3h.js";import{jsxs as o,jsx as r}from"preact/jsx-runtime";const h=`<!-- @license lucide-static v0.576.0 - ISC -->
|
|
2
2
|
<svg
|
|
3
3
|
class="lucide lucide-more-horizontal"
|
|
4
4
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -15,5 +15,5 @@ var p=Object.defineProperty;var s=(n,t)=>p(n,"name",{value:t,configurable:!0});i
|
|
|
15
15
|
<circle cx="19" cy="12" r="1" />
|
|
16
16
|
<circle cx="5" cy="12" r="1" />
|
|
17
17
|
</svg>
|
|
18
|
-
`;var x=Object.defineProperty,i=s((n,t)=>x(n,"name",{value:t,configurable:!0}),"s");const b=i(n=>{const[t,c]=m(u([]),"apps");f(()=>{const e=globalThis.__VISULIMA_DEVTOOLS__;if(!e)return;const a=(e.getApps()??[]).filter(d=>!["dev-toolbar:a11y","dev-toolbar:
|
|
18
|
+
`;var x=Object.defineProperty,i=s((n,t)=>x(n,"name",{value:t,configurable:!0}),"s");const b=i(n=>{const[t,c]=m(u([]),"apps");f(()=>{const e=globalThis.__VISULIMA_DEVTOOLS__;if(!e)return;const a=(e.getApps()??[]).filter(d=>!["dev-toolbar:a11y","dev-toolbar:module-graph","dev-toolbar:more","dev-toolbar:performance","dev-toolbar:seo","dev-toolbar:settings","dev-toolbar:timeline","dev-toolbar:vite-config"].includes(d.id));c(a)},[]);const l=i(e=>{globalThis.__VISULIMA_DEVTOOLS__?.openApp(e).catch(console.error)},"openApp");return t.length===0?o("div",{class:"p-8 flex flex-col items-center justify-center min-h-48 gap-5 text-center select-none",children:[r("div",{class:"size-14 bg-primary/5 border border-primary/20 flex items-center justify-center",children:r("svg",{"aria-hidden":"true",class:"size-6 text-primary/40",fill:"none",stroke:"currentColor","stroke-width":"1.5",viewBox:"0 0 24 24",children:r("path",{d:"M12 6v6m0 0v6m0-6h6m-6 0H6","stroke-linecap":"round","stroke-linejoin":"round"})})}),o("div",{class:"space-y-1.5",children:[r("p",{class:"text-[0.8125rem] font-medium text-foreground/70",children:"No additional apps registered"}),r("p",{class:"text-[0.725rem] text-muted-foreground",children:"Register a custom app to see it here"}),r("pre",{class:"mt-3 text-[0.65rem] font-mono text-primary/70 bg-primary/5 border border-primary/15 px-3 py-2 text-left",children:`window.__VISULIMA_DEVTOOLS__
|
|
19
19
|
.registerApp({ id, name, icon })`})]})]}):o("div",{class:"p-5",children:[o("h2",{class:"text-[0.65rem] font-bold uppercase tracking-[0.1em] text-muted-foreground mb-3 flex items-center gap-1.5",children:[r("span",{"aria-hidden":"true",class:"text-primary/50",children:"//"}),"Additional Apps"]}),r("div",{class:"grid grid-cols-2 gap-2",children:t.map(e=>o("button",{class:g("flex items-center gap-3 p-3","border border-border bg-card hover:bg-foreground/4","text-left cursor-pointer transition-colors duration-150"),onClick:i(()=>l(e.id),"onClick"),title:e.name,type:"button",children:[r("span",{class:"size-5 shrink-0 flex items-center justify-center text-[0.65rem] font-bold uppercase bg-foreground/8 text-foreground/70",children:e.name.slice(0,2)}),r("span",{class:"text-[0.8125rem] font-medium text-foreground truncate",children:e.name})]},e.id))})]})},"MoreApp"),A={component:b,icon:h,id:"dev-toolbar:more",name:"More"};export{A as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var L=Object.defineProperty;var f=(t,e)=>L(t,"name",{value:e,configurable:!0});import{addHookName as y}from"preact/devtools";import{useState as C,useRef as M,useEffect as H}from"preact/hooks";import d from"../../packem_shared/cn-DWLJYh3h.js";import{jsx as r,jsxs as i}from"preact/jsx-runtime";const $=`<!-- @license lucide-static v0.576.0 - ISC -->
|
|
2
2
|
<svg
|
|
3
3
|
class="lucide lucide-gauge"
|
|
4
4
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -14,4 +14,4 @@ var $=Object.defineProperty;var f=(t,e)=>$(t,"name",{value:e,configurable:!0});i
|
|
|
14
14
|
<path d="m12 14 4-4" />
|
|
15
15
|
<path d="M3.34 19a10 10 0 1 1 17.32 0" />
|
|
16
16
|
</svg>
|
|
17
|
-
`;var j=Object.defineProperty,b=f((t,e)=>j(t,"name",{value:e,configurable:!0}),"s$1");const I={cls:{good:.1,poor:.25},fcp:{good:1800,poor:3e3},fid:{good:100,poor:300},lcp:{good:2500,poor:4e3},ttfb:{good:800,poor:1800}},x=b((t,e)=>{const{good:s,poor:n}=I[t];return e<=s?"good":e<=n?"needs-improvement":"poor"},"getCwvRating");class z{static{f(this,"PerformanceMonitor")}static{b(this,"PerformanceMonitor")}clsValue=0;fpsSamples=[];listeners=new Set;longTaskIdCounter=0;longTasks=[];memory=null;memoryInterval=null;observers=[];rafId=null;running=!1;vitals={cls:null,fcp:null,fid:null,lcp:null,ttfb:null};clearLongTasks(){this.longTasks=[],this.emit()}getSnapshot(){return{fps:this.currentFps(),longTasks:[...this.longTasks],memory:this.memory,vitals:{...this.vitals}}}start(){this.running||typeof window>"u"||(this.running=!0,this.startFps(),this.startMemory(),this.startCwv(),this.startLongTasks(),this.loadTtfb())}stop(){if(this.running){this.running=!1,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.memoryInterval!==null&&(clearInterval(this.memoryInterval),this.memoryInterval=null);for(const e of this.observers)e.disconnect();this.observers=[]}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}currentFps(){if(this.fpsSamples.length<2)return 0;const e=this.fpsSamples.slice(-Math.min(this.fpsSamples.length,10));if(e.length<2)return 0;let s=0,n=0;for(let l=1;l<e.length;l++){const a=e[l]-e[l-1];a>0&&a<500&&(s+=a,n++)}return n===0?0:Math.min(60,Math.round(1e3/(s/n)))}emit(){const e=this.getSnapshot();for(const s of this.listeners)s(e)}loadTtfb(){const e=performance.getEntriesByType("navigation");e.length>0&&e[0]&&(this.vitals.ttfb=Math.round(e[0].responseStart-e[0].requestStart),this.emit())}startCwv(){this.tryObserve("largest-contentful-paint",e=>{const s=e.getEntries().at(-1);s&&(this.vitals.lcp=Math.round(s.startTime),this.emit())}),this.tryObserve("layout-shift",e=>{for(const s of e.getEntries()){const n=s;n.hadRecentInput||(this.clsValue+=n.value,this.vitals.cls=Math.round(this.clsValue*1e3)/1e3)}this.emit()}),this.tryObserve("first-input",e=>{const s=e.getEntries()[0];s&&(this.vitals.fid=Math.round(s.processingStart-s.startTime),this.emit())}),this.tryObserve("paint",e=>{for(const s of e.getEntries())s.name==="first-contentful-paint"&&(this.vitals.fcp=Math.round(s.startTime),this.emit())})}startFps(){let e=null;const s=b(n=>{this.running&&(e!==null&&(this.fpsSamples.push(n),this.fpsSamples.length>60&&this.fpsSamples.shift(),this.fpsSamples.length%16===0&&this.emit()),e=n,this.rafId=requestAnimationFrame(s))},"tick");this.rafId=requestAnimationFrame(s)}startLongTasks(){this.tryObserve("longtask",e=>{for(const s of e.getEntries())this.longTaskIdCounter++,this.longTasks.push({duration:Math.round(s.duration),id:`lt-${this.longTaskIdCounter}`,startTime:Math.round(s.startTime)}),this.longTasks.length>100&&this.longTasks.shift();this.emit()})}startMemory(){const e=performance;if(!e.memory)return;const s=b(()=>{e.memory&&(this.memory={jsHeapSizeLimit:e.memory.jsHeapSizeLimit,totalJSHeapSize:e.memory.totalJSHeapSize,usedJSHeapSize:e.memory.usedJSHeapSize},this.emit())},"read");s(),this.memoryInterval=setInterval(s,1e3)}tryObserve(e,s){try{const n=new PerformanceObserver(s);n.observe({buffered:!0,type:e}),this.observers.push(n)}catch{}}}const p=new z;var P=Object.defineProperty,u=f((t,e)=>P(t,"name",{value:e,configurable:!0}),"s");const S=u(t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,"formatBytes"),B=u(t=>`${t} ms`,"formatMs"),k={good:"text-success-foreground","needs-improvement":"text-warning-foreground",poor:"text-destructive"},J={good:"bg-success/10 border-success/30","needs-improvement":"bg-warning/10 border-warning/30",poor:"bg-destructive/10 border-destructive/30"},O=u(({samples:t})=>{if(t.length<2)return r("svg",{height:36,width:120});const e=120/(t.length-1),s=t.map((n,l)=>{const a=l*e,o=36-n/60*36;return`${a.toFixed(1)},${o.toFixed(1)}`}).join(" ");return r("svg",{height:36,style:"overflow: visible",width:120,children:r("polyline",{fill:"none",points:s,stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.5"})})},"FpsSparkline"),R=u(({memory:t})=>{const e=t.usedJSHeapSize/t.jsHeapSizeLimit*100,s=t.totalJSHeapSize/t.jsHeapSizeLimit*100,n=e>80?"bg-destructive":e>50?"bg-warning":"bg-success";return i("div",{class:"space-y-1.5",children:[i("div",{class:"relative h-2 bg-foreground/8 rounded-full overflow-hidden",children:[r("div",{class:"absolute left-0 top-0 h-full bg-foreground/12 rounded-full",style:{width:`${s}%`}}),r("div",{class:d("absolute left-0 top-0 h-full rounded-full",n),style:{width:`${e}%`}})]}),i("div",{class:"flex justify-between text-[0.65rem] text-muted-foreground",children:[i("span",{children:["Used: ",r("span",{class:"text-foreground font-medium",children:S(t.usedJSHeapSize)})]}),i("span",{children:["Total: ",r("span",{class:"text-foreground font-medium",children:S(t.totalJSHeapSize)})]}),i("span",{children:["Limit: ",r("span",{class:"text-foreground font-medium",children:S(t.jsHeapSizeLimit)})]})]})]})},"MemoryBar"),E=u(({label:t,metric:e,unit:s,value:n})=>{if(n===null)return i("div",{class:"flex flex-col items-center gap-1 p-3 border border-border bg-foreground/2 min-w-0",children:[r("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wider font-semibold truncate w-full text-center",children:t}),r("span",{class:"text-[0.7rem] text-muted-foreground/50",children:"—"})]});const l=x(e,n),a=e==="cls"?n.toFixed(3):B(n);return i("div",{class:d("flex flex-col items-center gap-1 p-3 border min-w-0",J[l]),children:[r("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wider font-semibold truncate w-full text-center",children:t}),r("span",{class:d("text-[0.9rem] font-bold tabular-nums",k[l]),children:a}),r("span",{class:"text-[0.6rem] text-muted-foreground/70 uppercase tracking-wide",children:s})]})},"CwvCard"),V=u(({task:t})=>i("div",{class:"flex items-center gap-3 px-3 py-2 border-b border-border/50 last:border-0 text-[0.7rem]",children:[i("span",{class:"text-muted-foreground tabular-nums w-20 shrink-0",children:[t.startTime.toLocaleString()," ms"]}),r("div",{class:"flex-1 bg-foreground/6 rounded-sm overflow-hidden h-2",children:r("div",{class:"h-full bg-warning",style:{width:`${Math.min(100,t.duration/200*100)}%`},title:`${t.duration} ms`})}),i("span",{class:"text-warning-foreground font-semibold tabular-nums w-16 text-right shrink-0",children:[t.duration," ms"]})]}),"LongTaskRow"),g=u(({children:t,title:e,action:s})=>i("section",{class:"border border-border",children:[i("div",{class:"flex items-center justify-between px-4 py-2.5 bg-foreground/3 border-b border-border",children:[r("span",{class:"text-[0.7rem] font-semibold text-foreground uppercase tracking-wide",children:e}),s]}),r("div",{class:"p-4",children:t})]}),"Section"),A=120,q=u(t=>{const[e,s]=y(C(()=>p.getSnapshot()),"snapshot"),n=y(M([]),"fpsHistoryRef");H(()=>(p.start(),p.subscribe(c=>{n.current.push(c.fps),n.current.length>A&&n.current.shift(),s(c)})),[]);const{fps:l,longTasks:a,memory:o,vitals:m}=e,h=l>=50?"good":l>=30?"needs-improvement":"poor",F=[{label:"LCP",metric:"lcp",unit:"ms",value:m.lcp},{label:"FID",metric:"fid",unit:"ms",value:m.fid},{label:"CLS",metric:"cls",unit:"score",value:m.cls},{label:"FCP",metric:"fcp",unit:"ms",value:m.fcp},{label:"TTFB",metric:"ttfb",unit:"ms",value:m.ttfb}];return i("div",{class:"p-5 space-y-4",children:[r(g,{title:"FPS",children:i("div",{class:"flex items-end gap-5",children:[i("div",{class:"flex flex-col items-center gap-0.5 shrink-0",children:[r("span",{class:d("text-3xl font-bold tabular-nums leading-none",k[h]),children:l}),r("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wide",children:"fps"})]}),r("div",{class:d("flex-1 min-w-0",k[h]),children:r(O,{samples:n.current})}),i("div",{class:"flex flex-col justify-between h-9 text-[0.6rem] text-muted-foreground/50 shrink-0 tabular-nums",children:[r("span",{children:"60"}),r("span",{children:"30"}),r("span",{children:"0"})]})]})}),o?r(g,{title:"JS Heap Memory",children:r(R,{memory:o})}):r(g,{title:"JS Heap Memory",children:i("p",{class:"text-[0.72rem] text-muted-foreground text-center py-2",children:["Not available — enable"," ",r("code",{class:"font-mono text-foreground/70",children:"--enable-precise-memory-info"})," in Chrome flags."]})}),i(g,{title:"Core Web Vitals",children:[r("div",{class:"grid grid-cols-3 gap-2",children:F.map(c=>r(E,{label:c.label,metric:c.metric,unit:c.unit,value:c.value},c.metric))}),r("p",{class:"mt-2 text-[0.62rem] text-muted-foreground/60",children:"Measured from page load. Reload to refresh. LCP and FID update as the page is interacted with."})]}),r(g,{action:a.length>0?r("button",{class:"px-2 py-0.5 text-[0.65rem] border border-border text-muted-foreground hover:text-foreground cursor-pointer bg-transparent transition-colors",onClick:u(()=>p.clearLongTasks(),"onClick"),type:"button",children:"Clear"}):void 0,title:`Long Tasks${a.length>0?` (${a.length})`:""}`,children:a.length===0?r("p",{class:"text-[0.72rem] text-muted-foreground text-center py-2",children:"No long tasks detected yet."}):r("div",{class:"max-h-48 overflow-y-auto devtools-content-scroll",children:a.map(c=>r(V,{task:c},c.id))})})]})},"PerformanceApp");var D=Object.defineProperty,w=f((t,e)=>D(t,"name",{value:e,configurable:!0}),"c");const T=w(t=>t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,"formatBytes"),v={good:"text-success-foreground","needs-improvement":"text-warning-foreground",poor:"text-destructive"},N=w(({samples:t})=>{if(t.length<2)return r("svg",{height:24,width:60});const e=60/(t.length-1),s=t.map((n,l)=>`${(l*e).toFixed(1)},${(24-n/60*24).toFixed(1)}`).join(" ");return r("svg",{height:24,style:"overflow:visible",width:60,children:r("polyline",{fill:"none",points:s,stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.5"})})},"MiniSparkline"),K=w(({memory:t})=>{const e=t.usedJSHeapSize/t.jsHeapSizeLimit*100,s=e>80?"bg-destructive":e>50?"bg-warning":"bg-success";return i("div",{class:"flex items-center gap-2",children:[r("div",{class:"flex-1 h-1.5 bg-foreground/8 rounded-full overflow-hidden",children:r("div",{class:d("h-full rounded-full",s),style:{width:`${e}%`}})}),i("span",{class:"text-[0.65rem] tabular-nums text-muted-foreground shrink-0",children:[T(t.usedJSHeapSize)," / ",T(t.jsHeapSizeLimit)]})]})},"MiniMemoryBar"),W=60,U=w(t=>{const[e,s]=y(C(()=>p.getSnapshot()),"snapshot"),n=y(M([]),"fpsHistoryRef");H(()=>(p.start(),p.subscribe(h=>{n.current.push(h.fps),n.current.length>W&&n.current.shift(),s(h)})),[]);const{fps:l,memory:a,vitals:o}=e,m=l>=50?"good":l>=30?"needs-improvement":"poor";return i("div",{class:"space-y-3 min-w-[200px]",children:[i("div",{class:"flex items-end gap-3",children:[i("div",{class:"flex flex-col items-center gap-0 shrink-0",children:[r("span",{class:d("text-2xl font-bold tabular-nums leading-none",v[m]),children:l}),r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"fps"})]}),r("div",{class:d("flex-1 min-w-0",v[m]),children:r(N,{samples:n.current})})]}),i("div",{class:"flex gap-3",children:[o.lcp!==null&&i("div",{class:"flex flex-col gap-0.5",children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"LCP"}),i("span",{class:d("text-[0.8rem] font-semibold tabular-nums",v[x("lcp",o.lcp)]),children:[o.lcp," ms"]})]}),o.fcp!==null&&i("div",{class:"flex flex-col gap-0.5",children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"FCP"}),i("span",{class:d("text-[0.8rem] font-semibold tabular-nums",v[x("fcp",o.fcp)]),children:[o.fcp," ms"]})]}),o.cls!==null&&i("div",{class:"flex flex-col gap-0.5",children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"CLS"}),r("span",{class:d("text-[0.8rem] font-semibold tabular-nums",v[x("cls",o.cls)]),children:o.cls.toFixed(3)})]}),o.lcp===null&&o.fcp===null&&o.cls===null&&r("span",{class:"text-[0.65rem] text-muted-foreground/50",children:"Collecting metrics…"})]}),a&&i("div",{children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide block mb-1",children:"Heap"}),r(K,{memory:a})]})]})},"PerformanceTooltip"),Z={component:q,icon:L,id:"dev-toolbar:performance",name:"Performance",tooltip:U};export{Z as default};
|
|
17
|
+
`;var j=Object.defineProperty,b=f((t,e)=>j(t,"name",{value:e,configurable:!0}),"s$1");const I={cls:{good:.1,poor:.25},fcp:{good:1800,poor:3e3},fid:{good:100,poor:300},lcp:{good:2500,poor:4e3},ttfb:{good:800,poor:1800}},x=b((t,e)=>{const{good:s,poor:n}=I[t];return e<=s?"good":e<=n?"needs-improvement":"poor"},"getCwvRating");class z{static{f(this,"PerformanceMonitor")}static{b(this,"PerformanceMonitor")}clsValue=0;fpsSamples=[];listeners=new Set;longTaskIdCounter=0;longTasks=[];memory=null;memoryInterval=null;observers=[];rafId=null;running=!1;vitals={cls:null,fcp:null,fid:null,lcp:null,ttfb:null};clearLongTasks(){this.longTasks=[],this.emit()}getSnapshot(){return{fps:this.currentFps(),longTasks:[...this.longTasks],memory:this.memory,vitals:{...this.vitals}}}start(){this.running||globalThis.window===void 0||(this.running=!0,this.startFps(),this.startMemory(),this.startCwv(),this.startLongTasks(),this.loadTtfb())}stop(){if(this.running){this.running=!1,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.memoryInterval!==null&&(clearInterval(this.memoryInterval),this.memoryInterval=null);for(const e of this.observers)e.disconnect();this.observers=[]}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}currentFps(){if(this.fpsSamples.length<2)return 0;const e=this.fpsSamples.slice(-Math.min(this.fpsSamples.length,10));if(e.length<2)return 0;let s=0,n=0;for(let l=1;l<e.length;l++){const a=e[l]-e[l-1];a>0&&a<500&&(s+=a,n++)}return n===0?0:Math.min(60,Math.round(1e3/(s/n)))}emit(){const e=this.getSnapshot();for(const s of this.listeners)s(e)}loadTtfb(){const e=performance.getEntriesByType("navigation");e.length>0&&e[0]&&(this.vitals.ttfb=Math.round(e[0].responseStart-e[0].requestStart),this.emit())}startCwv(){this.tryObserve("largest-contentful-paint",e=>{const s=e.getEntries().at(-1);s&&(this.vitals.lcp=Math.round(s.startTime),this.emit())}),this.tryObserve("layout-shift",e=>{for(const s of e.getEntries()){const n=s;n.hadRecentInput||(this.clsValue+=n.value,this.vitals.cls=Math.round(this.clsValue*1e3)/1e3)}this.emit()}),this.tryObserve("first-input",e=>{const s=e.getEntries()[0];s&&(this.vitals.fid=Math.round(s.processingStart-s.startTime),this.emit())}),this.tryObserve("paint",e=>{for(const s of e.getEntries())s.name==="first-contentful-paint"&&(this.vitals.fcp=Math.round(s.startTime),this.emit())})}startFps(){let e=null;const s=b(n=>{this.running&&(e!==null&&(this.fpsSamples.push(n),this.fpsSamples.length>60&&this.fpsSamples.shift(),this.fpsSamples.length%16===0&&this.emit()),e=n,this.rafId=requestAnimationFrame(s))},"tick");this.rafId=requestAnimationFrame(s)}startLongTasks(){this.tryObserve("longtask",e=>{for(const s of e.getEntries())this.longTaskIdCounter++,this.longTasks.push({duration:Math.round(s.duration),id:`lt-${this.longTaskIdCounter}`,startTime:Math.round(s.startTime)}),this.longTasks.length>100&&this.longTasks.shift();this.emit()})}startMemory(){const e=performance;if(!e.memory)return;const s=b(()=>{e.memory&&(this.memory={jsHeapSizeLimit:e.memory.jsHeapSizeLimit,totalJSHeapSize:e.memory.totalJSHeapSize,usedJSHeapSize:e.memory.usedJSHeapSize},this.emit())},"read");s(),this.memoryInterval=setInterval(s,1e3)}tryObserve(e,s){try{const n=new PerformanceObserver(s);n.observe({buffered:!0,type:e}),this.observers.push(n)}catch{}}}const p=new z;var P=Object.defineProperty,u=f((t,e)=>P(t,"name",{value:e,configurable:!0}),"s");const S=u(t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,"formatBytes"),B=u(t=>`${t} ms`,"formatMs"),k={good:"text-success-foreground","needs-improvement":"text-warning-foreground",poor:"text-destructive"},J={good:"bg-success/10 border-success/30","needs-improvement":"bg-warning/10 border-warning/30",poor:"bg-destructive/10 border-destructive/30"},O=u(({samples:t})=>{if(t.length<2)return r("svg",{height:36,width:120});const e=120/(t.length-1),s=t.map((n,l)=>{const a=l*e,o=36-n/60*36;return`${a.toFixed(1)},${o.toFixed(1)}`}).join(" ");return r("svg",{height:36,style:"overflow: visible",width:120,children:r("polyline",{fill:"none",points:s,stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.5"})})},"FpsSparkline"),R=u(({memory:t})=>{const e=t.usedJSHeapSize/t.jsHeapSizeLimit*100,s=t.totalJSHeapSize/t.jsHeapSizeLimit*100,n=e>80?"bg-destructive":e>50?"bg-warning":"bg-success";return i("div",{class:"space-y-1.5",children:[i("div",{class:"relative h-2 bg-foreground/8 rounded-full overflow-hidden",children:[r("div",{class:"absolute left-0 top-0 h-full bg-foreground/12 rounded-full",style:{width:`${s}%`}}),r("div",{class:d("absolute left-0 top-0 h-full rounded-full",n),style:{width:`${e}%`}})]}),i("div",{class:"flex justify-between text-[0.65rem] text-muted-foreground",children:[i("span",{children:["Used: ",r("span",{class:"text-foreground font-medium",children:S(t.usedJSHeapSize)})]}),i("span",{children:["Total: ",r("span",{class:"text-foreground font-medium",children:S(t.totalJSHeapSize)})]}),i("span",{children:["Limit: ",r("span",{class:"text-foreground font-medium",children:S(t.jsHeapSizeLimit)})]})]})]})},"MemoryBar"),E=u(({label:t,metric:e,unit:s,value:n})=>{if(n===null)return i("div",{class:"flex flex-col items-center gap-1 p-3 border border-border bg-foreground/2 min-w-0",children:[r("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wider font-semibold truncate w-full text-center",children:t}),r("span",{class:"text-[0.7rem] text-muted-foreground/50",children:"—"})]});const l=x(e,n),a=e==="cls"?n.toFixed(3):B(n);return i("div",{class:d("flex flex-col items-center gap-1 p-3 border min-w-0",J[l]),children:[r("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wider font-semibold truncate w-full text-center",children:t}),r("span",{class:d("text-[0.9rem] font-bold tabular-nums",k[l]),children:a}),r("span",{class:"text-[0.6rem] text-muted-foreground/70 uppercase tracking-wide",children:s})]})},"CwvCard"),V=u(({task:t})=>i("div",{class:"flex items-center gap-3 px-3 py-2 border-b border-border/50 last:border-0 text-[0.7rem]",children:[i("span",{class:"text-muted-foreground tabular-nums w-20 shrink-0",children:[t.startTime.toLocaleString()," ms"]}),r("div",{class:"flex-1 bg-foreground/6 rounded-sm overflow-hidden h-2",children:r("div",{class:"h-full bg-warning",style:{width:`${Math.min(100,t.duration/200*100)}%`},title:`${t.duration} ms`})}),i("span",{class:"text-warning-foreground font-semibold tabular-nums w-16 text-right shrink-0",children:[t.duration," ms"]})]}),"LongTaskRow"),g=u(({action:t,children:e,title:s})=>i("section",{class:"border border-border",children:[i("div",{class:"flex items-center justify-between px-4 py-2.5 bg-foreground/3 border-b border-border",children:[r("span",{class:"text-[0.7rem] font-semibold text-foreground uppercase tracking-wide",children:s}),t]}),r("div",{class:"p-4",children:e})]}),"Section"),A=120,q=u(t=>{const[e,s]=y(C(()=>p.getSnapshot()),"snapshot"),n=y(M([]),"fpsHistoryRef");H(()=>(p.start(),p.subscribe(c=>{n.current.push(c.fps),n.current.length>A&&n.current.shift(),s(c)})),[]);const{fps:l,longTasks:a,memory:o,vitals:m}=e,h=l>=50?"good":l>=30?"needs-improvement":"poor",F=[{label:"LCP",metric:"lcp",unit:"ms",value:m.lcp},{label:"FID",metric:"fid",unit:"ms",value:m.fid},{label:"CLS",metric:"cls",unit:"score",value:m.cls},{label:"FCP",metric:"fcp",unit:"ms",value:m.fcp},{label:"TTFB",metric:"ttfb",unit:"ms",value:m.ttfb}];return i("div",{class:"p-5 space-y-4",children:[r(g,{title:"FPS",children:i("div",{class:"flex items-end gap-5",children:[i("div",{class:"flex flex-col items-center gap-0.5 shrink-0",children:[r("span",{class:d("text-3xl font-bold tabular-nums leading-none",k[h]),children:l}),r("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wide",children:"fps"})]}),r("div",{class:d("flex-1 min-w-0",k[h]),children:r(O,{samples:n.current})}),i("div",{class:"flex flex-col justify-between h-9 text-[0.6rem] text-muted-foreground/50 shrink-0 tabular-nums",children:[r("span",{children:"60"}),r("span",{children:"30"}),r("span",{children:"0"})]})]})}),o?r(g,{title:"JS Heap Memory",children:r(R,{memory:o})}):r(g,{title:"JS Heap Memory",children:i("p",{class:"text-[0.72rem] text-muted-foreground text-center py-2",children:["Not available — enable ",r("code",{class:"font-mono text-foreground/70",children:"--enable-precise-memory-info"})," in Chrome flags."]})}),i(g,{title:"Core Web Vitals",children:[r("div",{class:"grid grid-cols-3 gap-2",children:F.map(c=>r(E,{label:c.label,metric:c.metric,unit:c.unit,value:c.value},c.metric))}),r("p",{class:"mt-2 text-[0.62rem] text-muted-foreground/60",children:"Measured from page load. Reload to refresh. LCP and FID update as the page is interacted with."})]}),r(g,{action:a.length>0?r("button",{class:"px-2 py-0.5 text-[0.65rem] border border-border text-muted-foreground hover:text-foreground cursor-pointer bg-transparent transition-colors",onClick:u(()=>p.clearLongTasks(),"onClick"),type:"button",children:"Clear"}):void 0,title:`Long Tasks${a.length>0?` (${a.length})`:""}`,children:a.length===0?r("p",{class:"text-[0.72rem] text-muted-foreground text-center py-2",children:"No long tasks detected yet."}):r("div",{class:"max-h-48 overflow-y-auto devtools-content-scroll",children:a.map(c=>r(V,{task:c},c.id))})})]})},"PerformanceApp");var D=Object.defineProperty,w=f((t,e)=>D(t,"name",{value:e,configurable:!0}),"c");const T=w(t=>t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,"formatBytes"),v={good:"text-success-foreground","needs-improvement":"text-warning-foreground",poor:"text-destructive"},N=w(({samples:t})=>{if(t.length<2)return r("svg",{height:24,width:60});const e=60/(t.length-1),s=t.map((n,l)=>`${(l*e).toFixed(1)},${(24-n/60*24).toFixed(1)}`).join(" ");return r("svg",{height:24,style:"overflow:visible",width:60,children:r("polyline",{fill:"none",points:s,stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.5"})})},"MiniSparkline"),K=w(({memory:t})=>{const e=t.usedJSHeapSize/t.jsHeapSizeLimit*100,s=e>80?"bg-destructive":e>50?"bg-warning":"bg-success";return i("div",{class:"flex items-center gap-2",children:[r("div",{class:"flex-1 h-1.5 bg-foreground/8 rounded-full overflow-hidden",children:r("div",{class:d("h-full rounded-full",s),style:{width:`${e}%`}})}),i("span",{class:"text-[0.65rem] tabular-nums text-muted-foreground shrink-0",children:[T(t.usedJSHeapSize)," / ",T(t.jsHeapSizeLimit)]})]})},"MiniMemoryBar"),W=60,U=w(t=>{const[e,s]=y(C(()=>p.getSnapshot()),"snapshot"),n=y(M([]),"fpsHistoryRef");H(()=>(p.start(),p.subscribe(h=>{n.current.push(h.fps),n.current.length>W&&n.current.shift(),s(h)})),[]);const{fps:l,memory:a,vitals:o}=e,m=l>=50?"good":l>=30?"needs-improvement":"poor";return i("div",{class:"space-y-3 min-w-[200px]",children:[i("div",{class:"flex items-end gap-3",children:[i("div",{class:"flex flex-col items-center gap-0 shrink-0",children:[r("span",{class:d("text-2xl font-bold tabular-nums leading-none",v[m]),children:l}),r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"fps"})]}),r("div",{class:d("flex-1 min-w-0",v[m]),children:r(N,{samples:n.current})})]}),i("div",{class:"flex gap-3",children:[o.lcp!==null&&i("div",{class:"flex flex-col gap-0.5",children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"LCP"}),i("span",{class:d("text-[0.8rem] font-semibold tabular-nums",v[x("lcp",o.lcp)]),children:[o.lcp," ms"]})]}),o.fcp!==null&&i("div",{class:"flex flex-col gap-0.5",children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"FCP"}),i("span",{class:d("text-[0.8rem] font-semibold tabular-nums",v[x("fcp",o.fcp)]),children:[o.fcp," ms"]})]}),o.cls!==null&&i("div",{class:"flex flex-col gap-0.5",children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"CLS"}),r("span",{class:d("text-[0.8rem] font-semibold tabular-nums",v[x("cls",o.cls)]),children:o.cls.toFixed(3)})]}),o.lcp===null&&o.fcp===null&&o.cls===null&&r("span",{class:"text-[0.65rem] text-muted-foreground/50",children:"Collecting metrics…"})]}),a&&i("div",{children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide block mb-1",children:"Heap"}),r(K,{memory:a})]})]})},"PerformanceTooltip"),Z={component:q,icon:$,id:"dev-toolbar:performance",name:"Performance",tooltip:U};export{Z as default};
|