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>
63 lines
2.6 KiB
TypeScript
63 lines
2.6 KiB
TypeScript
import { RouteHandler } from 'workbox-core/types.js';
|
|
import { Route } from './Route.js';
|
|
import './_version.js';
|
|
export interface NavigationRouteMatchOptions {
|
|
allowlist?: RegExp[];
|
|
denylist?: RegExp[];
|
|
}
|
|
/**
|
|
* NavigationRoute makes it easy to create a
|
|
* {@link workbox-routing.Route} that matches for browser
|
|
* [navigation requests]{@link https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading#first_what_are_navigation_requests}.
|
|
*
|
|
* It will only match incoming Requests whose
|
|
* {@link https://fetch.spec.whatwg.org/#concept-request-mode|mode}
|
|
* is set to `navigate`.
|
|
*
|
|
* You can optionally only apply this route to a subset of navigation requests
|
|
* by using one or both of the `denylist` and `allowlist` parameters.
|
|
*
|
|
* @memberof workbox-routing
|
|
* @extends workbox-routing.Route
|
|
*/
|
|
declare class NavigationRoute extends Route {
|
|
private readonly _allowlist;
|
|
private readonly _denylist;
|
|
/**
|
|
* If both `denylist` and `allowlist` are provided, the `denylist` will
|
|
* take precedence and the request will not match this route.
|
|
*
|
|
* The regular expressions in `allowlist` and `denylist`
|
|
* are matched against the concatenated
|
|
* [`pathname`]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/pathname}
|
|
* and [`search`]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/search}
|
|
* portions of the requested URL.
|
|
*
|
|
* *Note*: These RegExps may be evaluated against every destination URL during
|
|
* a navigation. Avoid using
|
|
* [complex RegExps](https://github.com/GoogleChrome/workbox/issues/3077),
|
|
* or else your users may see delays when navigating your site.
|
|
*
|
|
* @param {workbox-routing~handlerCallback} handler A callback
|
|
* function that returns a Promise resulting in a Response.
|
|
* @param {Object} options
|
|
* @param {Array<RegExp>} [options.denylist] If any of these patterns match,
|
|
* the route will not handle the request (even if a allowlist RegExp matches).
|
|
* @param {Array<RegExp>} [options.allowlist=[/./]] If any of these patterns
|
|
* match the URL's pathname and search parameter, the route will handle the
|
|
* request (assuming the denylist doesn't match).
|
|
*/
|
|
constructor(handler: RouteHandler, { allowlist, denylist }?: NavigationRouteMatchOptions);
|
|
/**
|
|
* Routes match handler.
|
|
*
|
|
* @param {Object} options
|
|
* @param {URL} options.url
|
|
* @param {Request} options.request
|
|
* @return {boolean}
|
|
*
|
|
* @private
|
|
*/
|
|
private _match;
|
|
}
|
|
export { NavigationRoute };
|