Skip to content

v0.4.0

Choose a tag to compare

@kennyfrc kennyfrc released this 28 Jul 13:02
· 9 commits to master since this release

cami v0.4.0

The TypeScript release. v0.4.0 rebuilds cami around stores as the one state abstraction, ships template directives on the public API, and adds full TypeScript support end to end. Supersedes the 0.3 series (last: 0.3.23).

Stores are the state story

ObservableStore is now the general-purpose state abstraction. Streams, observable elements, and per-node glue retire in favor of stores:

  • Actions, memos, queries, and mutations for async and derived state, plus lifecycle hooks and built-in state machines
  • URLStore — URL state and routing exposed as a store, with hardened route and deep-link contract behavior
  • Versioned localStorage persistence through storage adapters (createLocalStorage, persistToLocalStorageThunk)
  • Removed from the public API: ObservableStream, ObservableElement, slice, computed, and http — stores cover their roles (memos replace computed)
  • Observable, ObservableState, and effect() remain for 0.3 compatibility but are deprecated. New code should use component fields, stores, and afterRender()

Template directives

Templates move from a vendored lit-html fork to upstream lit-html 3.3, and its directives are now public API:

  • repeat — render dynamic lists efficiently, optionally keyed so element identity survives reorders
  • keyed — force rebuild or reuse of a DOM fragment when its key changes
  • unsafeHTML — render trusted HTML strings
  • useImage — resource helper for images with load-state handling

Full TypeScript support

  • The runtime is written in TypeScript, and the package ships declarations (build/cami.d.ts chain) with 40+ exported types for stores, actions, queries, mutations, routes, resources, and elements. v0.3 shipped no types.
  • One API across runtimes: browser-global CDN bundle (cami.cdn.js) or the ES module build (cami.module.js)

Also in this release

  • Hardened runtime contracts — lifecycle, dispatch, and store invariants tightened across the runtime
  • Documentation recentered around the supported API: https://camijs.com/
  • Dependency tree clean: npm audit reports 0 vulnerabilities (dev tooling refreshed; unused fetch-mock removed)

Install / upgrade

npm install cami@0.4.0
<script src="https://unpkg.com/cami@0.4.0/build/cami.cdn.js"></script>

Verified on this build

  • 20 test files / 196 tests passing (Vitest + jsdom)
  • tsc --noEmit: 0 errors
  • npm audit: 0 vulnerabilities

Full Changelog: v0.3.21...v0.4.0