Add progressive web app companion for cross-platform access

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>
This commit is contained in:
Ole-Morten Duesund 2026-03-08 17:41:38 +01:00
commit e8428de775
12051 changed files with 1799735 additions and 0 deletions

View file

@ -0,0 +1,71 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const codegen_1 = require("../../compile/codegen");
const metadata_1 = require("./metadata");
const nullable_1 = require("./nullable");
const error_1 = require("./error");
const types_1 = require("../discriminator/types");
const error = {
message: (cxt) => {
const { schema, params } = cxt;
return params.discrError
? params.discrError === types_1.DiscrError.Tag
? `tag "${schema}" must be string`
: `value of tag "${schema}" must be in mapping`
: (0, error_1.typeErrorMessage)(cxt, "object");
},
params: (cxt) => {
const { schema, params } = cxt;
return params.discrError
? (0, codegen_1._) `{error: ${params.discrError}, tag: ${schema}, tagValue: ${params.tag}}`
: (0, error_1.typeErrorParams)(cxt, "object");
},
};
const def = {
keyword: "discriminator",
schemaType: "string",
implements: ["mapping"],
error,
code(cxt) {
(0, metadata_1.checkMetadata)(cxt);
const { gen, data, schema, parentSchema } = cxt;
const [valid, cond] = (0, nullable_1.checkNullableObject)(cxt, data);
gen.if(cond);
validateDiscriminator();
gen.elseIf((0, codegen_1.not)(valid));
cxt.error();
gen.endIf();
cxt.ok(valid);
function validateDiscriminator() {
const tag = gen.const("tag", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(schema)}`);
gen.if((0, codegen_1._) `${tag} === undefined`);
cxt.error(false, { discrError: types_1.DiscrError.Tag, tag });
gen.elseIf((0, codegen_1._) `typeof ${tag} == "string"`);
validateMapping(tag);
gen.else();
cxt.error(false, { discrError: types_1.DiscrError.Tag, tag }, { instancePath: schema });
gen.endIf();
}
function validateMapping(tag) {
gen.if(false);
for (const tagValue in parentSchema.mapping) {
gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`);
gen.assign(valid, applyTagSchema(tagValue));
}
gen.else();
cxt.error(false, { discrError: types_1.DiscrError.Mapping, tag }, { instancePath: schema, schemaPath: "mapping", parentSchema: true });
gen.endIf();
}
function applyTagSchema(schemaProp) {
const _valid = gen.name("valid");
cxt.subschema({
keyword: "mapping",
schemaProp,
jtdDiscriminator: schema,
}, _valid);
return _valid;
}
},
};
exports.default = def;
//# sourceMappingURL=discriminator.js.map