Services
Every service in KatanaKit follows the same architecture: a small public API over a pure core, with the runtime I/O isolated behind it and SSR guards where the browser or Node/Bun is touched. Two public shapes exist, and both are re-exported as use* helpers from the package root:
- Singleton facade classes —
FetchApiManager,DatesService,LoggerService, … exposeuse*methods and agetInstance()accessor. - Function modules with strategies — DOM, storage, theme, viewport, observer and friends ship standalone
use*functions; behavior is swapped through strategy objects (for example,LocalStorageStrategy,SessionStorageStrategyandMemoryStorageStrategybehind the storage API).
ts
// Class-based facade
import { FetchApiManager } from "katanakit-js";
const api = FetchApiManager.getInstance();
api.useGetApi("pokeapi", "pokemonById", { params: { id: 25 } });
// Function module — same contract, no instance
import { useGetApi } from "katanakit-js";
useGetApi("pokeapi", "pokemonById", { params: { id: 25 } });The API Reference is generated from the source; the pages below are the hand-written reference companion: an overview paragraph, a quick example and one section per method with runnable examples.
Core
| Service | Description |
|---|---|
| HTTP Client | Register APIs, build URLs and call every HTTP method with Safe Results. |
| Logger | Log at every level with a small, replaceable logger and table output. |
| Storage | Typed local and session storage with an SSR-safe in-memory fallback. |
| DOM | SSR-safe DOM queries, element creation, attributes, classes and scroll. |
| Reactive | Signals, effects, memos and toggles for reactive state. |
| Formatter | Locale-aware number, currency and date formatting. |
| Converter | Unit conversions for temperature, distance and weight. |
| Error Helpers | Attempt, JSON parsing, normalize and serialize for unknown throws. |
| Generator | IDs, slugs, tokens and other generated values with zero dependencies. |
| Dates | Temporal-based date math: now, add or subtract days, boundaries. |
| Geometry | Area, perimeter and volume helpers with formatted output. |
| Timing | Delays, intervals, debounce, throttle and retry helpers. |
| Viewport | Viewport size, scroll position, media queries and prefers-* state. |
| Observer | Create and manage Intersection, Resize and Mutation observers. |
| Worker | Spawn workers, run functions off-thread and manage worker pools. |
Platform
| Service | Description |
|---|---|
| Theme | Dark and light mode with persistence, system preference and DOM sync. |
| Astro Adapter | Typed static paths and service access from Astro pages and endpoints. |
| RSS | Build RSS endpoints and parse feeds for content channels and embeds. |
| SEO | Generate HTML head and Open Graph tags from a single flat config. |
Integrations
| Service | Description |
|---|---|
| Nuxt Adapter | Nuxt composables and server-plugin helpers for the HTTP client. |
| Vue Adapter | Vue reactivity wrappers around the HTTP client and query cache. |
| Express Server | Start an Express server with the toolkit defaults and API config. |