Skip to content

Commit

Permalink
fix(inspector) use runes and force runes mode to avoid issues in clie…
Browse files Browse the repository at this point in the history
…nt apps that set runes mode globally
  • Loading branch information
dominikg committed Oct 23, 2024
1 parent 52e4a4f commit 85e42d1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/cold-hats-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/vite-plugin-svelte-inspector': patch
---

fix(inspector): migrate client component to runes and force runes mode"
22 changes: 13 additions & 9 deletions packages/vite-plugin-svelte-inspector/src/runtime/Inspector.svelte
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<svelte:options runes={true} />

<script>
// do not use TS here so that this component works in non-ts projects too
import { onMount } from 'svelte';
Expand All @@ -8,8 +10,8 @@
const nav_keys = Object.values(options.navKeys).map((k) => k?.toLowerCase());
const open_key = options.openKey?.toLowerCase();
let enabled = false;
let has_opened = false;
let enabled = $state(false);
let has_opened = $state(false);
const icon = `data:image/svg+xml;base64,${btoa(
`
Expand All @@ -24,17 +26,19 @@
)}`;
// location of code in file
let file_loc;
let file_loc = $state();
// cursor pos and width for file_loc overlay positioning
let x, y, w;
let x = $state(),
y = $state(),
w = $state();
let active_el;
let active_el = $state();
let hold_start_ts;
let hold_start_ts = $state();
$: show_toggle =
// eslint-disable-next-line svelte/valid-compile
options.showToggleButton === 'always' || (options.showToggleButton === 'active' && enabled);
const show_toggle = $derived(
options.showToggleButton === 'always' || (options.showToggleButton === 'active' && enabled)
);
function mousemove(e) {
x = e.x;
Expand Down

0 comments on commit 85e42d1

Please sign in to comment.