fix(web): eliminate all Svelte 5 runes-mode warnings (R10)
5 warnings → 0:
1. ActivityTimeline.svelte:103 — replaced deprecated <svelte:component
this={icon}> with direct dynamic component rendering ({@const IconComp
= icon}<IconComp />). In Svelte 5 runes mode, components are dynamic by
default; <svelte:component> is unnecessary.
2. DetailSection.svelte:18 — 'let open = (defaultOpen)' captured only
the initial value. Changed to (false) + to sync with
defaultOpen prop changes.
3. EntitySheet.svelte:10 — 'let currentSlug = (slug)' had the same
issue. Changed to <string|null>(null) + (the was
already there, now the initial value doesn't reference the prop).
4. theme.svelte.ts:23 — 'applyClass(current)' at module level referenced a
variable, capturing only the initial value. Changed to apply the
plain storedTheme() result for initialization; setTheme() already calls
applyClass() on changes.
5. Chat.svelte:326 — unused CSS selector '.prose-chat
:global(:first-child):is(h1,h2,h3)' replaced with explicit
:global(> h1:first-child) etc. (the :first-child pseudo wasn't matching
because the scoped wrapper div is the actual first child).
Build is now warning-free.
This commit is contained in:
@@ -100,7 +100,8 @@
|
||||
{:else if entry.status === 'failed'}
|
||||
<CircleXIcon class="size-3.5" />
|
||||
{:else if icon}
|
||||
<svelte:component this={icon} class="size-3" />
|
||||
{@const IconComp = icon}
|
||||
<IconComp class="size-3" />
|
||||
{:else}
|
||||
<CircleDotIcon class="size-3" />
|
||||
{/if}
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
children: Snippet
|
||||
} = $props()
|
||||
|
||||
let open = $state(defaultOpen)
|
||||
let open = $state(false)
|
||||
$effect(() => {
|
||||
open = defaultOpen
|
||||
})
|
||||
</script>
|
||||
|
||||
<Collapsible.Root bind:open class="rounded-md border bg-card">
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// Lets a relation click inside the sheet drill into that entity in place,
|
||||
// without closing/reopening. Resets to the externally-requested slug
|
||||
// whenever the caller opens the sheet on a different entity.
|
||||
let currentSlug = $state(slug)
|
||||
let currentSlug = $state<string | null>(null)
|
||||
$effect(() => {
|
||||
currentSlug = slug
|
||||
})
|
||||
|
||||
@@ -18,9 +18,10 @@ function storedTheme(): Theme {
|
||||
return window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark'
|
||||
}
|
||||
|
||||
let current: Theme = $state(storedTheme())
|
||||
const initialTheme = storedTheme()
|
||||
let current: Theme = $state(initialTheme)
|
||||
|
||||
applyClass(current)
|
||||
applyClass(initialTheme)
|
||||
|
||||
export function setTheme(t: Theme): void {
|
||||
current = t
|
||||
|
||||
@@ -323,7 +323,9 @@
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
.prose-chat :global(:first-child):is(h1, h2, h3) {
|
||||
.prose-chat :global(> h1:first-child),
|
||||
.prose-chat :global(> h2:first-child),
|
||||
.prose-chat :global(> h3:first-child) {
|
||||
margin-top: 0;
|
||||
}
|
||||
.prose-chat :global(h1)::after,
|
||||
|
||||
Reference in New Issue
Block a user