nano-kit-platform-web
Installation
SKILL.md
@nano_kit/platform-web
@nano_kit/platform-web wraps browser APIs in @nano_kit/store signals: storage-backed settings, media queries, window and document state, permissions, geolocation, cookies, cross-tab messages, locale and user agent. Signals, stores and DI are described in the nano-kit-store skill.
Reference
DOCS.md next to this file is the documentation of the released package as published on https://nano-kit.js.org, generated from the site sources. Read it for the helpers, their overloads and examples before writing code. This skill adds only conventions, choices and pitfalls.
Which helper for which job
- User settings that must survive a reload:
localStored; per-tab drafts:sessionStored. Thesyncedvariants follow changes made in other documents; use them when two tabs must agree. - Responsive and environment decisions:
mediaQueryand the window and document singletons, derived withcomputed, instead of ad-hocwindowreads in components. - Session and preferences shared with the server:
cookieStoredon theCookieStore$token, neverdocument.cookie. - Transient cross-tab events (logout, refresh):
broadcasted, which carries structured clones, so plain objects need no codec. - Locale negotiation:
browserLocaleon theLocales$token;UserAgent$for the user agent. Both resolve tonavigatorin the browser. - Storage and cookie values are strings unless a codec is given; use
JsonCodecorBooleanCodecfor anything else, and the rate limiter overloads for chatty writers.