@ssgoi/core 6.6.0
Functional transitions config
transitions in SsgoiConfig can now be a function of device context, in addition to the existing plain list — mirroring how preserveScroll already receives isMobile:
// existing form — unchanged, fully type-compatible
transitions: [
{ from: "/", to: "/about", transition: fade() },
]
// new functional form
transitions: ({ isMobile }) => [
{ from: "/", to: "/detail", transition: isMobile ? drawer() : fade() },
]The functional form destructures ({ isMobile }) (vs. preserveScroll's positional (isMobile)) so the boolean's meaning is self-documenting and the args object can grow later without breaking signatures.
Internals
- Both shapes are normalized to a single functional form at context creation, so no
typeofbranch leaks into the dispatcher. - Resolution + symmetric processing run lazily (once
isMobileis reliably measured) and are memoized per device class, so a static list is processed at most once perisMobilevalue. getIsMobileis shared withpreserveScroll— a single source of truth for device detection.
Compatibility
Fully backwards-compatible (additive minor). Existing transitions: [...] configs are unchanged, and all framework adapters inherit the new option automatically via @ssgoi/core types.
npm: @ssgoi/core@6.6.0 (latest)
PR #358