Common
A set of Vue 3 composables, router helpers, Pinia store helpers, error classes and small utilities shared across the @basmilius ecosystem. The package is opinionated about its peer dependencies — it expects a Vue 3 application with Vue Router and Pinia available — but is otherwise unobtrusive.
Highlights
useDtoFormDrive a form from a reactive DTO with dirty tracking and submit guards.useDataTablePaginated, sortable data tables backed by an async fetcher.useServiceLazily instantiate and memoize an HTTP service per component.useHotKeyBind keyboard shortcuts with modifiers, targeting and repeat.persistentRefA ref that mirrors localStorage and survives reloads.defineStoreA Pinia setup store that hands back refs by default.Explore by category
- Composables — Vue 3 composables for clipboard, debouncing, observers, pagination and more
- Router helpers — small wrappers around
vue-routerfor typed parameters, navigation and named views - Store — a Pinia
defineStorevariant that returns refs by default - Errors — domain exceptions used by
guardedand consumed byuseService - Utilities — small helpers such as
persistentRef,generateColorPaletteandunwrapElement
Peer dependencies
The package leans on three peers that you almost certainly already have in any Vue 3 application.
vue— composables and lifecycle hooksvue-router— required by everything in/common/router/pinia— required bydefineStore
@basmilius/http-client is an optional peer that unlocks the data-oriented composables useDataTable, useDtoForm and useService.
Quick example
ts
import { ref } from 'vue';
import { useDebouncedRef, persistentStringRef } from '@basmilius/common';
const query = persistentStringRef('search:query', null);
const debounced = useDebouncedRef(query, 250);Continue with installation or jump straight to a category from the sidebar.