@ranamaps/maps-js 0.0.0-stage → 0.4.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +13 -0
- package/NOTICES.md +230 -0
- package/README.md +119 -2
- package/dist/VERSION +1 -0
- package/dist/client.d.ts +69 -0
- package/dist/errors.d.ts +21 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.js +818 -0
- package/dist/index.js.map +7 -0
- package/dist/journey-trace.d.ts +62 -0
- package/dist/kit-render.d.ts +61 -0
- package/dist/kit.d.ts +609 -0
- package/dist/location-motion.d.ts +35 -0
- package/dist/location-route.d.ts +30 -0
- package/dist/location.d.ts +38 -0
- package/dist/map.d.ts +356 -0
- package/dist/polyline.d.ts +3 -0
- package/dist/rana-maps-worker.js +10 -0
- package/dist/rerouting.d.ts +88 -0
- package/dist/search.d.ts +21 -0
- package/dist/settings.d.ts +139 -0
- package/dist/style.css +112 -0
- package/dist/telemetry.d.ts +26 -0
- package/dist/types.d.ts +234 -0
- package/dist/vehicle.d.ts +77 -0
- package/dist/version.d.ts +1 -0
- package/dist/worker.d.ts +15 -0
- package/package.json +40 -4
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { RanaClient } from "./client.js";
|
|
2
|
+
import { RanaError } from "./errors.js";
|
|
3
|
+
import type { LocationFix } from "./location.js";
|
|
4
|
+
import type { Mode } from "./types.js";
|
|
5
|
+
export interface JourneyTraceOptions {
|
|
6
|
+
consent: true;
|
|
7
|
+
source: "measured" | "simulated";
|
|
8
|
+
mode?: Exclude<Mode, "transit">;
|
|
9
|
+
}
|
|
10
|
+
export interface JourneyTracePoint {
|
|
11
|
+
lat: number;
|
|
12
|
+
lng: number;
|
|
13
|
+
timestamp_ms: number;
|
|
14
|
+
accuracy_m: number;
|
|
15
|
+
speed_mps?: number;
|
|
16
|
+
heading_deg?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface JourneyTraceBatch {
|
|
19
|
+
journey_id: string;
|
|
20
|
+
batch_id: string;
|
|
21
|
+
consent: true;
|
|
22
|
+
source: "measured" | "simulated";
|
|
23
|
+
mode: Exclude<Mode, "transit">;
|
|
24
|
+
points: JourneyTracePoint[];
|
|
25
|
+
}
|
|
26
|
+
export interface JourneyTraceReceipt {
|
|
27
|
+
accepted: number;
|
|
28
|
+
simulated: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface JourneyTraceStatus {
|
|
31
|
+
buffered: number;
|
|
32
|
+
uploaded: number;
|
|
33
|
+
dropped: number;
|
|
34
|
+
stopped: boolean;
|
|
35
|
+
error?: RanaError;
|
|
36
|
+
}
|
|
37
|
+
/** Foreground, memory-only measured fixes. Explicit consent is required; diagnostics do not control this stream. */
|
|
38
|
+
export declare class JourneyTraceRecorder {
|
|
39
|
+
private readonly client;
|
|
40
|
+
private readonly changed;
|
|
41
|
+
private readonly wall;
|
|
42
|
+
private readonly journey;
|
|
43
|
+
private readonly options;
|
|
44
|
+
private points;
|
|
45
|
+
private pending?;
|
|
46
|
+
private work?;
|
|
47
|
+
private abort?;
|
|
48
|
+
private last;
|
|
49
|
+
private retryAt;
|
|
50
|
+
private uploaded;
|
|
51
|
+
private dropped;
|
|
52
|
+
private stopped;
|
|
53
|
+
private error?;
|
|
54
|
+
constructor(client: Pick<RanaClient, "uploadJourneyTrace">, options: JourneyTraceOptions, changed?: (status: JourneyTraceStatus) => void, wall?: () => number);
|
|
55
|
+
get status(): JourneyTraceStatus;
|
|
56
|
+
private publish;
|
|
57
|
+
record(fix: LocationFix): void;
|
|
58
|
+
flush(): Promise<void>;
|
|
59
|
+
private drain;
|
|
60
|
+
/** Revocation drops unsent positions and cancels in-flight work; already received evidence is not retracted. */
|
|
61
|
+
stop(): void;
|
|
62
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { KIT } from "./kit.js";
|
|
2
|
+
import type { LatLng } from "./types.js";
|
|
3
|
+
export type LinePreset = Exclude<keyof typeof KIT.lines.presets, "contributorGlow" | "closed">;
|
|
4
|
+
export type ResolvedLineOptions = {
|
|
5
|
+
color: string;
|
|
6
|
+
width: number;
|
|
7
|
+
outline: {
|
|
8
|
+
color: string;
|
|
9
|
+
width: number;
|
|
10
|
+
} | null;
|
|
11
|
+
dash: "solid" | "dashed" | "dotted";
|
|
12
|
+
cap: "round" | "butt" | "square";
|
|
13
|
+
arrows: boolean;
|
|
14
|
+
opacity: number;
|
|
15
|
+
};
|
|
16
|
+
export declare function fillTemplate(template: string, values: Record<string, string | number>): string;
|
|
17
|
+
/**
|
|
18
|
+
* The only colour form the overlay API accepts: `#RGB` or `#RRGGBB`, returned as uppercase `#RRGGBB`.
|
|
19
|
+
* Colours are written into marker SVG, so anything else is refused rather than passed through.
|
|
20
|
+
*/
|
|
21
|
+
export declare function kitColor(value: unknown, name?: string): string;
|
|
22
|
+
export declare function escapeXml(value: string): string;
|
|
23
|
+
/** Background luminance below which a style is treated as a night style (Night base ~0.008, Day base ~0.9). */
|
|
24
|
+
export declare const NIGHT_BACKGROUND_LUMINANCE = 0.2;
|
|
25
|
+
/**
|
|
26
|
+
* Whether a style's background colour is dark, from the colour the style actually paints rather than its name or URL.
|
|
27
|
+
* Accepts #RGB/#RRGGBB, rgb()/rgba() and hsl()/hsla(); returns undefined for anything else (an expression, say).
|
|
28
|
+
*/
|
|
29
|
+
export declare function isDarkBackground(color: unknown): boolean | undefined;
|
|
30
|
+
/** Splits text into user-perceived characters, so a label is never cut inside an emoji or accented letter. */
|
|
31
|
+
export declare function graphemes(text: string): string[];
|
|
32
|
+
export declare const takeGraphemes: (text: string, count: number) => string;
|
|
33
|
+
/**
|
|
34
|
+
* Drawn width of badge text in the font the SVG uses (Plus Jakarta Sans 800, falling back like the SVG does).
|
|
35
|
+
* Without a canvas (server rendering, tests) it falls back to an estimate per character.
|
|
36
|
+
*/
|
|
37
|
+
export declare function measureBadgeText(text: string, fontSize: number, fontWeight?: number | string): number;
|
|
38
|
+
/** For tests: forget the cached canvas so a stubbed document is picked up. */
|
|
39
|
+
export declare function resetTextMeasurement(): void;
|
|
40
|
+
export declare function inkForColor(color: string): "#FFFFFF" | "#161412";
|
|
41
|
+
export declare function formatClusterLabel(count: number): string;
|
|
42
|
+
export declare function resolveLineOptions(options?: {
|
|
43
|
+
preset?: LinePreset;
|
|
44
|
+
color?: string;
|
|
45
|
+
width?: number;
|
|
46
|
+
outline?: {
|
|
47
|
+
color: string;
|
|
48
|
+
width: number;
|
|
49
|
+
} | "none" | null;
|
|
50
|
+
dash?: "solid" | "dashed" | "dotted";
|
|
51
|
+
cap?: "round" | "butt" | "square";
|
|
52
|
+
arrows?: boolean;
|
|
53
|
+
opacity?: number;
|
|
54
|
+
}): ResolvedLineOptions;
|
|
55
|
+
export declare function defaultControls(phone: boolean): Record<"compass" | "zoom" | "locate" | "scale" | "fullscreen", boolean | string>;
|
|
56
|
+
export declare function circleCoordinates(center: LatLng, radiusMetres: number, steps?: number): Array<[number, number]>;
|
|
57
|
+
export declare function splitLine(path: LatLng[], progress: number): {
|
|
58
|
+
travelled: LatLng[];
|
|
59
|
+
ahead: LatLng[];
|
|
60
|
+
};
|
|
61
|
+
export declare function interpolate(start: LatLng, end: LatLng, t: number): LatLng;
|