Vite + TypeScript PWA that mirrors the Android app's core features: - Pre-processed shelter data (build-time UTM33N→WGS84 conversion) - Leaflet map with shelter markers, user location, and offline tiles - Canvas compass arrow (ported from DirectionArrowView.kt) - IndexedDB shelter cache with 7-day staleness check - Service worker with CacheFirst tiles and precached app shell - i18n for en, nb, nn (ported from Android strings.xml) - iOS/Android compass handling with low-pass filter - Respects user map interaction (no auto-snap on pan/zoom) - Build revision cache-breaker for reliable SW updates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
66 lines
2.3 KiB
TypeScript
66 lines
2.3 KiB
TypeScript
declare module 'virtual:pwa-info' {
|
|
export interface PwaInfo {
|
|
pwaInDevEnvironment: boolean
|
|
/**
|
|
* The web manifest will be always here.
|
|
*/
|
|
webManifest: {
|
|
href: string
|
|
useCredentials: boolean
|
|
/**
|
|
* The link tag with or without `crossorigin`:
|
|
* - `<link rel="manifest" href="<webManifestUrl>" />`.
|
|
* - `<link rel="manifest" href="<webManifestUrl>" crossorigin="use-credentials" />`.
|
|
*/
|
|
linkTag: string
|
|
}
|
|
/**
|
|
* The service worker data will be exposed only if required, that's, will **NOT** be exposed if:
|
|
* - not using `pwaPluginOptions.injectRegister` with `script`, `script-defer` or `inline` values
|
|
* - if using `pwaPluginOptions.injectRegister` with `auto` (default) and importing any of the virtual modules
|
|
*/
|
|
registerSW?: {
|
|
/**
|
|
* When this flag is `true` the service worker must be registered via inline script otherwise registered via script with src attribute `registerSW.js`.
|
|
*
|
|
* @deprecated From `v0.17.2` this flag is deprecated, use `mode` instead.
|
|
*/
|
|
inline: boolean
|
|
/**
|
|
* When this flag is `inline` the service worker must be registered via inline script otherwise registered via script with src attribute `registerSW.js`.
|
|
*/
|
|
mode: 'inline' | 'script' | 'script-defer'
|
|
/**
|
|
* The path for the inline script: will contain the service worker url.
|
|
*/
|
|
inlinePath: string
|
|
/**
|
|
* The path for the src script for `registerSW.js`.
|
|
*/
|
|
registerPath: string
|
|
/**
|
|
* The scope for the service worker: only required for `inline: true`.
|
|
*/
|
|
scope: string
|
|
/**
|
|
* The type for the service worker: only required for `inline: true`.
|
|
*/
|
|
type: 'classic' | 'module'
|
|
/**
|
|
* The script tag if `shouldRegisterSW` returns `true`.
|
|
*/
|
|
scriptTag?: string
|
|
}
|
|
}
|
|
/**
|
|
* Return the PWA information if available.
|
|
*
|
|
* This property will be `undefined` if:
|
|
* - SSR build
|
|
* - PWA is disabled: `pwaPluginOptions.disable = true`
|
|
* - running `Dev Server` and `pwaPluginOptions.devOptions.enabled = false` (default).
|
|
*
|
|
* @returns The PWA information.
|
|
*/
|
|
export const pwaInfo: PwaInfo | undefined
|
|
}
|