From 00f60ce628fb1906c09a2324247c9b189297c648 Mon Sep 17 00:00:00 2001 From: Ignatius Bagus Date: Wed, 11 Oct 2023 18:55:58 +0700 Subject: [PATCH 1/3] feat: show event listeners in details --- src/app.css | 2 ++ src/lib/nodes/ElementAttributes.svelte | 8 ++--- src/lib/panel/PropertyList.svelte | 2 +- src/lib/runtime.ts | 2 +- src/lib/store.ts | 46 ++++++++++++++++++-------- src/routes/+layout.svelte | 24 +++++++++++--- 6 files changed, 60 insertions(+), 24 deletions(-) diff --git a/src/app.css b/src/app.css index 6824477..d12d85f 100644 --- a/src/app.css +++ b/src/app.css @@ -1,4 +1,6 @@ :root { + tab-size: 2; + --background: rgb(255, 255, 255); --color: rgb(74, 74, 79); diff --git a/src/lib/nodes/ElementAttributes.svelte b/src/lib/nodes/ElementAttributes.svelte index 8a9421b..c76a41e 100644 --- a/src/lib/nodes/ElementAttributes.svelte +++ b/src/lib/nodes/ElementAttributes.svelte @@ -30,11 +30,11 @@ {/each} {#each listeners as { event, handler, modifiers }} + {@const suffix = modifiers?.length ? `|${modifiers.join('|')}` : ''} +   - - on: - - {#if modifiers && modifiers.length}|{modifiers.join('|')}{/if} + + {/each} diff --git a/src/lib/panel/PropertyList.svelte b/src/lib/panel/PropertyList.svelte index f52121e..b4618d1 100644 --- a/src/lib/panel/PropertyList.svelte +++ b/src/lib/panel/PropertyList.svelte @@ -1,7 +1,7 @@ diff --git a/src/lib/nodes/Node.svelte b/src/lib/nodes/Node.svelte index a9a23a2..8a0a75d 100644 --- a/src/lib/nodes/Node.svelte +++ b/src/lib/nodes/Node.svelte @@ -45,8 +45,8 @@ tagName={node.tagName} selected={active} hover={current} - attributes={node.detail.attributes} - listeners={node.detail.listeners} + attributes={node.detail?.attributes || []} + listeners={node.detail?.listeners || []} hasChildren={!!node.children.length} {style} bind:expanded={node.expanded} @@ -62,7 +62,7 @@ tagName={node.tagName} selected={active} hover={current} - source={node.detail.source} + source={node.detail?.source} {style} bind:expanded={node.expanded} > @@ -107,7 +107,7 @@ {:else if node.type === 'text'}
- +
{:else if node.type === 'anchor'} From 2531b8226f5fa6cf5b726c5ac6ce1d4be08587b8 Mon Sep 17 00:00:00 2001 From: Ignatius Bagus Date: Fri, 13 Oct 2023 17:03:03 +0700 Subject: [PATCH 3/3] reuse type --- src/lib/store.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/store.ts b/src/lib/store.ts index d3b2479..e5ff2ac 100644 --- a/src/lib/store.ts +++ b/src/lib/store.ts @@ -47,7 +47,7 @@ export const query = writable(''); export type Profiler = { type: 'mount' | 'patch' | 'detach'; - node: { id: string; type: string; tagName: string }; + node: DebugNode; duration: number; start: number; end: number;