@dle.dev/ember
v3.2.0
Published
A headless, accessible, and highly customizable accordion component for Svelte.
Readme
@dle.dev/ember — Headless Components for Svelte
A collection of headless components for svelte 5
Install
Yarn / npm / pnpm (package name from package.json):
npm install @dle.dev/ember
# or
pnpm add @dle.dev/emberPeer dependency: Svelte 5.
Components
Tree
A small, headless, accessible and highly-customizable nestable tree component for Svelte. The implementation stores children in a Record keyed by id, enabling O(1) lookups within a node’s children. Helper functions are provided for toggling, inserting, updating and deleting nodes.
Implementation details
- The component performs DFS-style path resolution to find nodes by id using
getPathToNodeByIdand then performs structural cloning to update/insert/delete nodes immutably. Seesrc/lib/tree/utils.tsfor the full implementations. onMountthe component normalizes nodes to ensureexpandedis set to a boolean.
Development
Scripts available in package.json:
npm run dev— starts Vite dev server for the demo site.npm run build— builds the demo and packages the svelte component.npm run test— runs unit tests (vitest).npm run check— runs type/svelte checkers.
Roadmap
- Include a modal store
Contributing
PRs and issues welcome. Please keep changes small and add tests.
License
MIT — see License.md.
