@sveltejs/vite-plugin-svelte 1.0.6 → 1.0.8
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/dist/index.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/ui/inspector/Inspector.svelte +28 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/vite-plugin-svelte",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "dominikg",
|
|
6
6
|
"files": [
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
"@types/debug": "^4.1.7",
|
|
63
63
|
"@types/diff-match-patch": "^1.0.32",
|
|
64
64
|
"diff-match-patch": "^1.0.5",
|
|
65
|
-
"esbuild": "^0.15.
|
|
65
|
+
"esbuild": "^0.15.8",
|
|
66
66
|
"rollup": "^2.79.0",
|
|
67
|
-
"svelte": "^3.50.
|
|
67
|
+
"svelte": "^3.50.1",
|
|
68
68
|
"tsup": "^6.2.3",
|
|
69
|
-
"vite": "^3.1.
|
|
69
|
+
"vite": "^3.1.2"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
72
72
|
"dev": "pnpm build:ci --sourcemap --watch src",
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
let x, y, w;
|
|
26
26
|
|
|
27
27
|
let active_el;
|
|
28
|
-
let toggle_el;
|
|
29
28
|
|
|
30
29
|
let enabled_ts;
|
|
31
30
|
|
|
@@ -37,13 +36,16 @@
|
|
|
37
36
|
y = event.y;
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
function find_selectable_parent(el) {
|
|
41
|
-
|
|
39
|
+
function find_selectable_parent(el, include_self = false) {
|
|
40
|
+
if (!include_self) {
|
|
42
41
|
el = el.parentNode;
|
|
42
|
+
}
|
|
43
|
+
while (el) {
|
|
43
44
|
if (is_selectable(el)) {
|
|
44
45
|
return el;
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
+
el = el.parentNode;
|
|
48
|
+
}
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
function find_selectable_child(el) {
|
|
@@ -79,21 +81,19 @@
|
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
function is_selectable(el) {
|
|
82
|
-
if (el === toggle_el) {
|
|
83
|
-
return false; // toggle is our own
|
|
84
|
-
}
|
|
85
84
|
const file = el?.__svelte_meta?.loc?.file;
|
|
86
85
|
if (!file || file.includes('node_modules/')) {
|
|
87
86
|
return false; // no file or 3rd party
|
|
88
87
|
}
|
|
89
|
-
|
|
88
|
+
const id = el.getAttribute('id');
|
|
89
|
+
if (id === 'svelte-announcer' || id?.startsWith('svelte-inspector-')) {
|
|
90
90
|
return false; // ignore some elements by id that would be selectable from keyboard nav otherwise
|
|
91
91
|
}
|
|
92
92
|
return true;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
function mouseover(
|
|
96
|
-
const el = find_selectable_parent(
|
|
95
|
+
function mouseover({ target }) {
|
|
96
|
+
const el = find_selectable_parent(target, true);
|
|
97
97
|
activate(el, false);
|
|
98
98
|
}
|
|
99
99
|
|
|
@@ -174,14 +174,16 @@
|
|
|
174
174
|
if (options.holdMode && enabled) {
|
|
175
175
|
enabled_ts = Date.now();
|
|
176
176
|
}
|
|
177
|
-
} else if (
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
177
|
+
} else if (enabled) {
|
|
178
|
+
if (is_nav(event)) {
|
|
179
|
+
const el = find_selectable_for_nav(event.key);
|
|
180
|
+
if (el) {
|
|
181
|
+
activate(el);
|
|
182
|
+
stop(event);
|
|
183
|
+
}
|
|
184
|
+
} else if (is_open(event)) {
|
|
185
|
+
open_editor(event);
|
|
182
186
|
}
|
|
183
|
-
} else if (is_open(event)) {
|
|
184
|
-
open_editor(event);
|
|
185
187
|
}
|
|
186
188
|
}
|
|
187
189
|
|
|
@@ -220,10 +222,10 @@
|
|
|
220
222
|
|
|
221
223
|
function activate_initial_el() {
|
|
222
224
|
const hov = innermost_hover_el();
|
|
223
|
-
let el =
|
|
225
|
+
let el = find_selectable_parent(hov, true);
|
|
224
226
|
if (!el) {
|
|
225
227
|
const act = document.activeElement;
|
|
226
|
-
el =
|
|
228
|
+
el = find_selectable_parent(act, true);
|
|
227
229
|
}
|
|
228
230
|
if (!el) {
|
|
229
231
|
el = find_selectable_child(document.body);
|
|
@@ -286,21 +288,20 @@
|
|
|
286
288
|
|
|
287
289
|
{#if show_toggle}
|
|
288
290
|
<button
|
|
289
|
-
|
|
291
|
+
id="svelte-inspector-toggle"
|
|
290
292
|
class:enabled
|
|
291
293
|
style={`background-image: var(--svelte-inspector-icon);${options.toggleButtonPos
|
|
292
294
|
.split('-')
|
|
293
295
|
.map((p) => `${p}: 8px;`)
|
|
294
296
|
.join('')}`}
|
|
295
297
|
on:click={() => toggle()}
|
|
296
|
-
bind:this={toggle_el}
|
|
297
298
|
aria-label={`${enabled ? 'disable' : 'enable'} svelte-inspector`}
|
|
298
299
|
/>
|
|
299
300
|
{/if}
|
|
300
301
|
{#if enabled && active_el && file_loc}
|
|
301
302
|
{@const loc = active_el.__svelte_meta.loc}
|
|
302
303
|
<div
|
|
303
|
-
|
|
304
|
+
id="svelte-inspector-overlay"
|
|
304
305
|
style:left="{Math.min(x + 3, document.documentElement.clientWidth - w - 10)}px"
|
|
305
306
|
style:top="{document.documentElement.clientHeight < y + 50 ? y - 30 : y + 30}px"
|
|
306
307
|
bind:offsetWidth={w}
|
|
@@ -320,16 +321,17 @@
|
|
|
320
321
|
outline: 2px dashed #ff3e00 !important;
|
|
321
322
|
}
|
|
322
323
|
|
|
323
|
-
|
|
324
|
+
#svelte-inspector-overlay {
|
|
324
325
|
position: fixed;
|
|
325
326
|
background-color: rgba(0, 0, 0, 0.8);
|
|
326
327
|
color: #fff;
|
|
327
328
|
padding: 2px 4px;
|
|
328
329
|
border-radius: 5px;
|
|
329
330
|
z-index: 999999;
|
|
331
|
+
pointer-events: none;
|
|
330
332
|
}
|
|
331
333
|
|
|
332
|
-
|
|
334
|
+
#svelte-inspector-toggle {
|
|
333
335
|
all: unset;
|
|
334
336
|
border: 1px solid #ff3e00;
|
|
335
337
|
border-radius: 8px;
|
|
@@ -354,10 +356,10 @@
|
|
|
354
356
|
height: 1px;
|
|
355
357
|
}
|
|
356
358
|
|
|
357
|
-
|
|
359
|
+
#svelte-inspector-toggle:not(.enabled) {
|
|
358
360
|
filter: grayscale(1);
|
|
359
361
|
}
|
|
360
|
-
|
|
362
|
+
#svelte-inspector-toggle:hover {
|
|
361
363
|
background-color: #facece;
|
|
362
364
|
}
|
|
363
365
|
</style>
|