fix(ci): green the dev gates after the native and popup rounds

- RTL: the measured pills and centred controls use logical forms or a marked line
- i18n: the two native widget numbers are positions, not counts (NOT_PLURAL)
- Types: styleOverride on the lazy GL map, the location and shared-file payloads,
  the capabilities fallback, the transport sheet's stay metadata
- ESLint: latest-value refs move to layout effects, usePresence keeps the last
  open state in state, the booking import opens clean with a shared document
  kept in the list (the reset effect used to clear it again)
- Layers: the phone import sheet lives under mobile/ and reads through tripRepo;
  the offline host check moves to utils/tileUrl
- Sizes: plugin layer geometry, hardNavigate and the exit animations get
  modules of their own
- Tests follow the status radios, the stay chip overview, the dock + button
  for the first list and the field token; store registry lists the new stores
This commit is contained in:
Maurice
2026-11-06 18:24:25 +01:00
parent f81fe8cb17
commit b7951baf23
75 changed files with 645 additions and 475 deletions
+21 -8
View File
@@ -80,7 +80,7 @@ const REGIONAL_GLYPHS: { box: [number, number, number, number]; ranges: string[]
]
/** The glyph ranges a map of `bbox` needs: the common ones plus its region's scripts. */
export function glyphRangesFor(bbox: TileBbox | null): string[] {
function glyphRangesFor(bbox: TileBbox | null): string[] {
const out = new Set(GLYPH_RANGES)
if (bbox) {
for (const { box, ranges } of REGIONAL_GLYPHS) {
@@ -148,11 +148,8 @@ async function warm(cache: Cache | null, url: string): Promise<number> {
if (cache && (await cache.match(url))) return 0
const res = await fetch(url, { mode: 'cors' })
if (!res.ok) return 0
// The length header when the server sends one; otherwise the body itself.
const header = Number(res.headers.get('content-length'))
const size = header > 0 ? header : (await res.clone().blob()).size || 1
await cache?.put(url, res)
return size
await cache?.put(url, res.clone())
return await sizeOf(res)
} catch {
return 0
}
@@ -248,12 +245,13 @@ async function prefetchStyle(styleUrl: string, bbox: TileBbox | null = null): Pr
])
}
if (style.glyphs) {
const glyphs = style.glyphs
if (glyphs) {
// Through the same pool as the tiles: a trip in East Asia asks for a few
// hundred glyph ranges, and OpenFreeMap allows four requests at a time.
const urls = fontStacks(style).flatMap(stack =>
glyphRangesFor(bbox).map(range =>
style.glyphs!.replace('{fontstack}', encodeURIComponent(stack)).replace('{range}', range),
glyphs.replace('{fontstack}', encodeURIComponent(stack)).replace('{range}', range),
),
)
await inPool(urls, url => warm(cache, url))
@@ -311,6 +309,21 @@ export async function prefetchVectorForPlaces(
return { tiles: fetched, template }
}
/**
* The bytes a response brought, for the run's budget: the length header when
* the server sends one, else the body itself, and at least 1 so a fetched tile
* always counts as fetched.
*/
async function sizeOf(res: Response): Promise<number> {
const header = Number(res.headers?.get('content-length'))
if (header > 0) return header
try {
return (await res.blob()).size || 1
} catch {
return 1
}
}
/** Runs `task` over `items`, CONCURRENCY at a time. */
async function inPool<T>(items: T[], task: (item: T) => Promise<unknown>): Promise<void> {
let cursor = 0
+10 -4
View File
@@ -27,10 +27,9 @@ import type { Place } from '../types'
import { offlineDb, upsertSyncMeta } from '../db/offlineDb'
import { isAuthed } from './authGate'
import { isStoragePersisted } from './persistentStorage'
import { isVectorStyle, normalizeTileUrl, resolveTileUrl, withTileApiKey } from '../utils/tileUrl'
import { isOfflineForbiddenTemplate, isVectorStyle, normalizeTileUrl, resolveTileUrl, withTileApiKey } from '../utils/tileUrl'
import { OFM_DARK, OFM_POSITRON } from '../constants/mapDefaults'
import { clearVectorCache, prefetchStyleAssets, prefetchVectorForPlaces } from './glPrefetcher'
import { isOfflineForbiddenTemplate } from '../components/Map/offlineBasemap'
import { isNativeIos } from '../native/platform'
// ── Constants ─────────────────────────────────────────────────────────────────
@@ -390,6 +389,13 @@ function sameBbox(a: [number, number, number, number], b: TileBbox): boolean {
/** The OpenFreeMap styles the offline fallback draws; they share one tile set. */
const OFFLINE_BASEMAPS: readonly string[] = [OFM_POSITRON, OFM_DARK]
/**
* The offline basemap is a best-effort extra: a failed request leaves its tile
* uncached and the next sync tries again, so it stops neither the raster run
* nor the sync.
*/
function basemapFailed(): void {}
/**
* The trip's region of the offline basemap: the light style's tiles, style,
* sprite and glyphs, and the dark style's own style, sprite and glyphs on top,
@@ -398,8 +404,8 @@ const OFFLINE_BASEMAPS: readonly string[] = [OFM_POSITRON, OFM_DARK]
async function prefetchOfflineBasemap(places: Place[], template: string, cancelled: () => boolean): Promise<void> {
const light = template === OFM_DARK ? OFM_DARK : OFM_POSITRON
const other = light === OFM_DARK ? OFM_POSITRON : OFM_DARK
await prefetchVectorForPlaces(places, light, cancelled).catch(console.error)
if (!cancelled()) await prefetchStyleAssets(other, computeBbox(places)).catch(console.error)
await prefetchVectorForPlaces(places, light, cancelled).catch(basemapFailed)
if (!cancelled()) await prefetchStyleAssets(other, computeBbox(places)).catch(basemapFailed)
}
/**