@wodira/browser 1.0.0 → 1.2.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +111 -1
  3. package/dist/index.cjs +36 -0
  4. package/dist/index.d.ts +90 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +36 -0
  7. package/dist/types.d.ts +3 -0
  8. package/dist/types.d.ts.map +1 -1
  9. package/dist/ui/boxes/cdn.js +15 -15
  10. package/dist/ui/boxes/index.js +4 -4
  11. package/dist/ui/components.d.ts +33 -1
  12. package/dist/ui/components.d.ts.map +1 -1
  13. package/dist/ui/events.d.ts +1 -1
  14. package/dist/ui/events.d.ts.map +1 -1
  15. package/dist/ui/i18n.d.ts +1 -1
  16. package/dist/ui/i18n.d.ts.map +1 -1
  17. package/dist/ui/index-dqnha6dj.js +1625 -0
  18. package/dist/ui/index-h2b598n9.js +1624 -0
  19. package/dist/ui/{index-tfej862z.js → index-k8s7q1sf.js} +50 -1568
  20. package/dist/ui/index.d.ts +1 -0
  21. package/dist/ui/index.d.ts.map +1 -1
  22. package/dist/ui/index.js +352 -125
  23. package/dist/ui/map-view-8tyrehav.js +28737 -0
  24. package/dist/ui/maplibre-gl-worker.mjs +10 -0
  25. package/dist/ui/route-3d/cdn.d.ts +2 -0
  26. package/dist/ui/route-3d/cdn.d.ts.map +1 -0
  27. package/dist/ui/route-3d/cdn.js +1527 -0
  28. package/dist/ui/route-3d/gpx.d.ts +14 -0
  29. package/dist/ui/route-3d/gpx.d.ts.map +1 -0
  30. package/dist/ui/route-3d/index.d.ts +12 -0
  31. package/dist/ui/route-3d/index.d.ts.map +1 -0
  32. package/dist/ui/route-3d/index.js +16 -0
  33. package/dist/ui/route-3d/map-view.d.ts +73 -0
  34. package/dist/ui/route-3d/map-view.d.ts.map +1 -0
  35. package/dist/ui/route-3d/maplibre-gl-worker.mjs +10 -0
  36. package/dist/ui/route-3d/route-3d.d.ts +168 -0
  37. package/dist/ui/route-3d/route-3d.d.ts.map +1 -0
  38. package/dist/ui/route-3d/route-geo.d.ts +77 -0
  39. package/dist/ui/route-3d/route-geo.d.ts.map +1 -0
  40. package/dist/ui/shirt-sponsors/cdn.js +29 -27
  41. package/dist/ui/shirt-sponsors/index.js +5 -3
  42. package/dist/ui/shirt-sponsors/shirt-auction.d.ts +19 -0
  43. package/dist/ui/shirt-sponsors/shirt-auction.d.ts.map +1 -1
  44. package/package.json +15 -6
@@ -0,0 +1,168 @@
1
+ import { LitElement, type PropertyValues } from 'lit';
2
+ import { type RouteTrack } from './route-geo.js';
3
+ /**
4
+ * Interactive 3D course map: satellite imagery over real terrain, the route drawn with a glow,
5
+ * start/finish, aid stations and kilometre marks, and an elevation profile linked to the map.
6
+ * Visitors can turn, tilt and zoom the map, scrub the profile, fly the course and go full screen.
7
+ *
8
+ * Data comes from WODira (`event-id` + `publishable-key`), from a GPX file (`gpx-url`), or from
9
+ * the `gpx` / `tracks` properties. MapLibre loads only when the element is on the page.
10
+ *
11
+ * @fires wodira:route:selected - `{ routeId }` when the visitor switches course.
12
+ * @fires wodira:route:ready - `{ routeId, distanceM, ascentM }` once a course is drawn.
13
+ */
14
+ export declare class WodiraRoute3d extends LitElement {
15
+ static properties: {
16
+ eventId: {
17
+ type: StringConstructor;
18
+ attribute: string;
19
+ };
20
+ publishableKey: {
21
+ type: StringConstructor;
22
+ attribute: string;
23
+ };
24
+ baseUrl: {
25
+ type: StringConstructor;
26
+ attribute: string;
27
+ };
28
+ routeId: {
29
+ type: StringConstructor;
30
+ attribute: string;
31
+ };
32
+ gpxUrl: {
33
+ type: StringConstructor;
34
+ attribute: string;
35
+ };
36
+ label: {
37
+ type: StringConstructor;
38
+ };
39
+ locale: {
40
+ type: StringConstructor;
41
+ };
42
+ workerUrl: {
43
+ type: StringConstructor;
44
+ attribute: string;
45
+ };
46
+ freeGestures: {
47
+ type: BooleanConstructor;
48
+ attribute: string;
49
+ };
50
+ gpx: {
51
+ attribute: boolean;
52
+ };
53
+ tracks: {
54
+ attribute: boolean;
55
+ };
56
+ loaded: {
57
+ state: boolean;
58
+ };
59
+ loading: {
60
+ state: boolean;
61
+ };
62
+ failed: {
63
+ state: boolean;
64
+ };
65
+ activeIndex: {
66
+ state: boolean;
67
+ };
68
+ hoverDistance: {
69
+ state: boolean;
70
+ };
71
+ flightDistance: {
72
+ state: boolean;
73
+ };
74
+ flying: {
75
+ state: boolean;
76
+ };
77
+ threeD: {
78
+ state: boolean;
79
+ };
80
+ fullscreen: {
81
+ state: boolean;
82
+ };
83
+ mapFailed: {
84
+ state: boolean;
85
+ };
86
+ mapLoading: {
87
+ state: boolean;
88
+ };
89
+ bearing: {
90
+ state: boolean;
91
+ };
92
+ };
93
+ static styles: import("lit").CSSResult;
94
+ eventId: string;
95
+ publishableKey: string;
96
+ baseUrl: string;
97
+ routeId: string;
98
+ gpxUrl: string;
99
+ label: string;
100
+ locale: string;
101
+ workerUrl: string;
102
+ freeGestures: boolean;
103
+ /** GPX document text; takes precedence over `gpx-url` and the WODira event. */
104
+ gpx: string | null;
105
+ /** Ready-made courses; take precedence over every other source. */
106
+ tracks: RouteTrack[] | null;
107
+ private loaded;
108
+ private loading;
109
+ private failed;
110
+ private activeIndex;
111
+ private hoverDistance;
112
+ private flightDistance;
113
+ private flying;
114
+ private threeD;
115
+ private fullscreen;
116
+ private mapFailed;
117
+ private mapLoading;
118
+ private bearing;
119
+ private view;
120
+ private viewContainer;
121
+ private viewGeneration;
122
+ private abort;
123
+ private profileCache;
124
+ private themeObserver;
125
+ private drawnTrack;
126
+ constructor();
127
+ /** Re-reads the `--wodira-route-*` colours into the map after changing them from script. */
128
+ refreshTheme(): void;
129
+ connectedCallback(): void;
130
+ disconnectedCallback(): void;
131
+ protected willUpdate(changes: PropertyValues): void;
132
+ protected updated(): void;
133
+ private get language();
134
+ private get numberLocale();
135
+ private get text();
136
+ private load;
137
+ /** null when the element is not configured with any source. */
138
+ private fetchTracks;
139
+ private trackFromGpx;
140
+ private get activeTrack();
141
+ private get profile();
142
+ private selectTrack;
143
+ private colors;
144
+ private labels;
145
+ private startView;
146
+ private drawTrack;
147
+ private disposeView;
148
+ private toggle3d;
149
+ private toggleFlight;
150
+ private toggleFullscreen;
151
+ /** iPhone Safari has no element fullscreen; a fixed overlay stands in for it. */
152
+ private pseudoFullscreen;
153
+ private setPseudoFullscreen;
154
+ private readonly onFullscreenChange;
155
+ private readonly onDocumentKey;
156
+ private profileDistanceAt;
157
+ private onProfilePointer;
158
+ private onProfileLeave;
159
+ private onProfileKey;
160
+ private formatKm;
161
+ private formatMetres;
162
+ protected render(): import("lit").TemplateResult<1>;
163
+ private renderBody;
164
+ private renderHeader;
165
+ private renderControls;
166
+ private renderProfile;
167
+ }
168
+ //# sourceMappingURL=route-3d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-3d.d.ts","sourceRoot":"","sources":["../../../src/ui/route-3d/route-3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAS/E,OAAO,EAOL,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AAwKxB;;;;;;;;;;GAUG;AACH,qBAAa,aAAc,SAAQ,UAAU;IAC3C,OAAgB,UAAU;QACxB,OAAO;YAAI,IAAI;YAAU,SAAS;;QAClC,cAAc;YAAI,IAAI;YAAU,SAAS;;QACzC,OAAO;YAAI,IAAI;YAAU,SAAS;;QAClC,OAAO;YAAI,IAAI;YAAU,SAAS;;QAClC,MAAM;YAAI,IAAI;YAAU,SAAS;;QACjC,KAAK;YAAI,IAAI;;QACb,MAAM;YAAI,IAAI;;QACd,SAAS;YAAI,IAAI;YAAU,SAAS;;QACpC,YAAY;YAAI,IAAI;YAAW,SAAS;;QACxC,GAAG;YAAI,SAAS;;QAChB,MAAM;YAAI,SAAS;;QACnB,MAAM;YAAI,KAAK;;QACf,OAAO;YAAI,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FAA4F;IAC5F,YAAY,IAAI,IAAI,CAEnB;IAEQ,iBAAiB,IAAI,IAAI,CAajC;IAEQ,oBAAoB,IAAI,IAAI,CAQpC;IAED,UAAmB,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAc3D;IAED,UAAmB,OAAO,IAAI,IAAI,CAUjC;IAID,OAAO,KAAK,QAAQ,GAOnB;IAED,OAAO,KAAK,YAAY,GAIvB;IAED,OAAO,KAAK,IAAI,GAEf;YAEa,IAAI;IA6BlB,+DAA+D;YACjD,WAAW;IAyBzB,OAAO,CAAC,YAAY;IAgBpB,OAAO,KAAK,WAAW,GAEtB;IAED,OAAO,KAAK,OAAO,GAgBlB;IAED,OAAO,CAAC,WAAW;IAkBnB,OAAO,CAAC,MAAM;IAWd,OAAO,CAAC,MAAM;YAcA,SAAS;IA0CvB,OAAO,CAAC,SAAS;IAuBjB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,YAAY;YAMN,gBAAgB;IAa9B,iFAAiF;IACjF,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAOjC;IAEF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAE5B;IAIF,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,YAAY;IAqBpB,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,YAAY;IAMpB,UAAmB,MAAM,oCAgBxB;IAED,OAAO,CAAC,UAAU;IA6ClB,OAAO,CAAC,YAAY;IA4DpB,OAAO,CAAC,cAAc;IA0EtB,OAAO,CAAC,aAAa;CAyItB"}
@@ -0,0 +1,77 @@
1
+ import type { WodiraRouteWaypointType } from '../../index.js';
2
+ export interface Coordinate {
3
+ lat: number;
4
+ lon: number;
5
+ }
6
+ /** A track point. Elevation in metres when the source has it. */
7
+ export interface RoutePoint {
8
+ lat: number;
9
+ lon: number;
10
+ ele?: number;
11
+ }
12
+ export type RouteWaypointType = WodiraRouteWaypointType;
13
+ export interface RouteWaypoint {
14
+ type: RouteWaypointType;
15
+ name?: string;
16
+ lat: number;
17
+ lon: number;
18
+ ele?: number;
19
+ }
20
+ /** One route ready to draw: the source data plus the measurements derived from it. */
21
+ export interface RouteTrack {
22
+ id: string;
23
+ name: string;
24
+ points: RoutePoint[];
25
+ waypoints: RouteWaypoint[];
26
+ /** Hex colour chosen by the organizer, if any. */
27
+ color?: string | null;
28
+ /** Download link for the original GPX, if the source has one. */
29
+ gpxUrl?: string | null;
30
+ /** Totals reported by the source; measured from the points when absent. */
31
+ distanceM?: number;
32
+ ascentM?: number;
33
+ descentM?: number;
34
+ }
35
+ export interface RouteProfile {
36
+ /** Cumulative distance in metres at each point. */
37
+ distances: number[];
38
+ /** Elevation at each point; null where the source has none. */
39
+ elevations: Array<number | null>;
40
+ distanceM: number;
41
+ ascentM: number;
42
+ descentM: number;
43
+ minEleM: number | null;
44
+ maxEleM: number | null;
45
+ hasElevation: boolean;
46
+ }
47
+ /** Great-circle distance in metres. */
48
+ export declare function haversine(a: Coordinate, b: Coordinate): number;
49
+ /** Distance, climbing and elevation range, with hysteresis so GPS jitter does not inflate D+. */
50
+ export declare function measureRoute(points: readonly RoutePoint[]): RouteProfile;
51
+ /** Position, elevation and heading at a distance along the route, interpolated between points. */
52
+ export declare function pointAtDistance(points: readonly RoutePoint[], profile: RouteProfile, distance: number): {
53
+ lat: number;
54
+ lon: number;
55
+ ele: number | null;
56
+ bearing: number;
57
+ index: number;
58
+ } | null;
59
+ /** Initial compass bearing from a to b, in degrees. */
60
+ export declare function bearing(a: Coordinate, b: Coordinate): number;
61
+ /** Distance along the route of the point nearest to a coordinate (screen-free, planar approximation). */
62
+ export declare function distanceAtNearest(points: readonly RoutePoint[], profile: RouteProfile, target: {
63
+ lat: number;
64
+ lon: number;
65
+ }): number;
66
+ /** A readable kilometre step that gives roughly `target` marks along the route. */
67
+ export declare function kilometreStep(distanceM: number, target?: number): number;
68
+ /** Evenly spaced points for the elevation chart, so long tracks stay cheap to draw. */
69
+ export declare function sampleProfile(points: readonly RoutePoint[], profile: RouteProfile, samples?: number): Array<{
70
+ distance: number;
71
+ ele: number;
72
+ }>;
73
+ /** [west, south, east, north] of the points. */
74
+ export declare function routeBounds(points: readonly RoutePoint[]): [number, number, number, number];
75
+ /** True when start and finish are within 250 m, so one "start / finish" marker is enough. */
76
+ export declare function isLoop(points: readonly RoutePoint[]): boolean;
77
+ //# sourceMappingURL=route-geo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-geo.d.ts","sourceRoot":"","sources":["../../../src/ui/route-3d/route-geo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,iEAAiE;AACjE,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAExD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,iBAAiB,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,sFAAsF;AACtF,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,GAAG,I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