Primitives / API

foldkit-primitives/media

Functions

breakpointForThe breakpoint a width falls in: the name with the largest threshold at or below it, or null below every threshold. Breakpoints uses it; a view that has a…
isBrowserWhether a window exists: the client side of an SSR split.
isServerWhether no window exists: the server side of an SSR split.
platformFromUAThe platform a user-agent string names, preferring Client Hints when given (navigator.userAgentData.platform), with touch points telling a desktop-mode iPad…

Values

BreakpointsNamed breakpoints over the viewport width: one resize listener, derived names in update. Thresholds are mobile-first min-widths: the breakpoint is the…
BreakpointsMessage
BreakpointsModel
MediaQueryA media query as a bundle: matches in the Model, kept current by a matchMedia change stream. State stays in the parent Model, so it replays and time-travels…
MediaQueryMessage
MediaQueryModel
PlatformPlatform detection as pure functions. platformFromUA reads a user-agent string (passed in, so tests pin it without stubbing globals); order matters —…
PrefersDark(prefers-color-scheme: dark), bound so placements give no args.
PrefersReducedMotion(prefers-reduced-motion: reduce), bound so placements give no args.

Interfaces

PlatformHintsClient Hints (navigator.userAgentData) plus touch points (navigator.maxTouchPoints), passed in so detection stays pure and pinned. Only platform and…