Revert "perf: improve efficiency and performance"

This commit is contained in:
Xylight authored and GitHub committed 2025-08-01 21:26:04 +00:00
1 parent 7e188f218a
commit 4177b42fc2
32 files changed
+470 -248

No files matched your search

+58
View File
@@ -0,0 +1,58 @@
<script lang="ts">
import { createBubbler } from 'svelte/legacy'
const bubble = createBubbler()
import { generateID } from '../forms/helper.js'
type T = $$Generic
interface Props {
value: T
group: T
inlineDescription?: boolean
id?: string
disabled?: boolean
children?: import('svelte').Snippet
description?: import('svelte').Snippet
}
let {
value,
group = $bindable(),
inlineDescription = false,
id = generateID(),
disabled = false,
children,
description,
...rest
}: Props = $props()
</script>
<div
class="font-normal cursor-pointer text-sm flex flex-row items-baseline gap-2"
>
<input
{...rest}
{id}
type="radio"
bind:group
{value}
onblur={bubble('blur-sm')}
onchange={bubble('change')}
{disabled}
class="cursor-pointer disabled:cursor-not-allowed peer disabled:opacity-50"
/>
<label
for={id}
class="inline-flex {inlineDescription
? 'flex-row'
: 'flex-col'} cursor-pointer peer-disabled:cursor-not-allowed font-medium gap-1 peer-disabled:opacity-50"
>
{@render children?.()}
{#if description}
<span class="font-normal text-slate-600 dark:text-zinc-400">
{@render description?.()}
</span>
{/if}
</label>
</div>
+25
View File
@@ -0,0 +1,25 @@
<script lang="ts">
import { generateID } from '../forms/helper.js'
interface Props {
group?: string
row?: boolean
class?: string
children?: import('svelte').Snippet<[{ group: string }]>
}
let {
group = generateID(),
row = false,
class: clazz = '',
children,
}: Props = $props()
</script>
<div class="flex flex-col gap-1">
<div
class="flex {row ? 'flex-row flex-wrap' : 'flex-col'} gap-4 {clazz || ''}"
>
{@render children?.({ group })}
</div>
</div>