From 105fc6ee60fb6e4e724145783fab843105ed54c4 Mon Sep 17 00:00:00 2001 From: abdel Date: Fri, 24 Oct 2025 05:26:39 +0800 Subject: [PATCH 1/8] fix: update value type in InputProps to ClassValue and improve class binding --- src/lib/components/input/input-value.svelte | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/components/input/input-value.svelte b/src/lib/components/input/input-value.svelte index 21bdb46..93f5b7d 100644 --- a/src/lib/components/input/input-value.svelte +++ b/src/lib/components/input/input-value.svelte @@ -2,7 +2,7 @@ export type InputPortals = 'input.l0' | 'input.l1' | 'input.l2' | 'input.l3'; export type InputProps = { - value?: string; + value?: ClassValue; files?: File[]; date?: Date | null; number?: number; @@ -19,7 +19,7 @@ import type { HTMLInputTypeAttribute } from 'svelte/elements'; import { on } from '$svelte-atoms/core/attachments/event.svelte'; import { getPreset } from '$svelte-atoms/core/context'; - import { toClassValue } from '$svelte-atoms/core/utils'; + import { cn, toClassValue, type ClassValue } from '$svelte-atoms/core/utils'; import type { PresetModuleName } from '$svelte-atoms/core/context/preset.svelte'; import { InputBond } from './bond.svelte'; @@ -94,11 +94,11 @@ } } } - class={[ + class={cn( 'h-full w-full flex-1 bg-transparent px-2 leading-1 outline-none', preset?.class, - toClassValue(bond, klass) - ]} + toClassValue(klass, bond) + )} onchange={handleChange} oninput={handleInput} {...valueProps} From 374a43143a30e58bfc26db073c46217352b88b78 Mon Sep 17 00:00:00 2001 From: abdel Date: Fri, 24 Oct 2025 05:27:04 +0800 Subject: [PATCH 2/8] fix: ensure proper binding in toClassValue calls for class handling --- src/lib/components/atom/html-atom.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/components/atom/html-atom.svelte b/src/lib/components/atom/html-atom.svelte index b958d72..483ef6f 100644 --- a/src/lib/components/atom/html-atom.svelte +++ b/src/lib/components/atom/html-atom.svelte @@ -38,11 +38,11 @@ return cls.replace('$preset', cn(preset?.class)); } - return toClassValue.apply(bond, [cls]); + return toClassValue.apply(bond, [cls, bond]); }); } - return [preset?.class ?? '', toClassValue.apply(bond, [klass])]; + return [preset?.class ?? '', toClassValue.apply(bond, [klass, bond])]; }); const _base = $derived(base ?? preset?.base); From 1560cbca069c8d25a5bb591c28d00e2c8fd25a4d Mon Sep 17 00:00:00 2001 From: abdel Date: Fri, 24 Oct 2025 05:29:08 +0800 Subject: [PATCH 3/8] fix: refine class binding in dropdown query component and remove unused imports --- src/lib/components/dropdown/dropdown-query.svelte | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/lib/components/dropdown/dropdown-query.svelte b/src/lib/components/dropdown/dropdown-query.svelte index fd7b5c0..b2ddf7d 100644 --- a/src/lib/components/dropdown/dropdown-query.svelte +++ b/src/lib/components/dropdown/dropdown-query.svelte @@ -1,8 +1,7 @@ + + + + item.value)} + onquerychange={(q) => (dd.query = q)} + > + {#snippet children({ dropdown })} + + { + ev.preventDefault(); + + dropdown.state.open(); + }} + > + + {#each dropdown?.state?.selectedItems ?? [] as item (item.id)} +
+ + {item.text} + +
+ {/each} + + + +
+ + + + {#each dd.current as item (item.id)} +
+ {item.text} +
+ {/each} +
+ {/snippet} +
+
+``` + +**Key composition features demonstrated:** + +- **Component Fusion**: Using `base={Input.Root}` to compose Dropdown.Trigger with Input styling and behavior +- **Snippet Patterns**: Accessing internal state through snippets for custom rendering +- **Reactive Filtering**: Combining search query state with reactive effects for real-time filtering +- **Smooth Animations**: Using Svelte's `flip` animation for seamless list transitions +- **Multi-Select State**: Managing complex selection state through the Bond pattern + --- ## 📖 Documentation From 9f14f7142d50cf7e5e5c226bb3ad47e7099f9279 Mon Sep 17 00:00:00 2001 From: abdel Date: Fri, 24 Oct 2025 05:46:31 +0800 Subject: [PATCH 8/8] bump version to 1.0.0-alpha.20 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a5b4111..c7ad7bf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@svelte-atoms/core", - "version": "1.0.0-alpha.19", + "version": "1.0.0-alpha.20", "description": "A modular, accessible, and extensible Svelte UI component library.", "repository": { "type": "git",