@remaply/maps 0.0.0-stage → 0.3.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 +202 -0
- package/NOTICE +8 -0
- package/README.md +280 -2
- package/dist/client.d.ts +31 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +208 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +62 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +65 -0
- package/dist/config.js.map +1 -0
- package/dist/directions.d.ts +68 -0
- package/dist/directions.d.ts.map +1 -0
- package/dist/directions.js +114 -0
- package/dist/directions.js.map +1 -0
- package/dist/errors.d.ts +26 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +85 -0
- package/dist/errors.js.map +1 -0
- package/dist/geo.d.ts +17 -0
- package/dist/geo.d.ts.map +1 -0
- package/dist/geo.js +43 -0
- package/dist/geo.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/map.d.ts +133 -0
- package/dist/map.d.ts.map +1 -0
- package/dist/map.js +369 -0
- package/dist/map.js.map +1 -0
- package/dist/routePreview.d.ts +84 -0
- package/dist/routePreview.d.ts.map +1 -0
- package/dist/routePreview.js +206 -0
- package/dist/routePreview.js.map +1 -0
- package/dist/search.d.ts +70 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +60 -0
- package/dist/search.js.map +1 -0
- package/dist/security.d.ts +20 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +53 -0
- package/dist/security.js.map +1 -0
- package/dist/stepPreview.d.ts +127 -0
- package/dist/stepPreview.d.ts.map +1 -0
- package/dist/stepPreview.js +317 -0
- package/dist/stepPreview.js.map +1 -0
- package/dist/stepPreviewPanel.d.ts +41 -0
- package/dist/stepPreviewPanel.d.ts.map +1 -0
- package/dist/stepPreviewPanel.js +153 -0
- package/dist/stepPreviewPanel.js.map +1 -0
- package/dist/style.d.ts +45 -0
- package/dist/style.d.ts.map +1 -0
- package/dist/style.js +173 -0
- package/dist/style.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/package.json +56 -4
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
// Copyright 2026 Remaply
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { formatDistance, maneuverOf, routePoints } from "./directions.js";
|
|
4
|
+
import { boundsOf, distanceM, unwrapLongitudes } from "./geo.js";
|
|
5
|
+
import { ROUTE_COLORS, ROUTE_PREVIEW_LAYERS } from "./routePreview.js";
|
|
6
|
+
import { StepPreviewPanel } from "./stepPreviewPanel.js";
|
|
7
|
+
/** Close-in zoom on a turn, as in the Android and iOS route planner Preview. */
|
|
8
|
+
export const STEP_PREVIEW_ZOOM = 16.5;
|
|
9
|
+
/** Camera tilt on a turn, in degrees, as in the apps. A crossing is shown flat. */
|
|
10
|
+
export const STEP_PREVIEW_PITCH = 45;
|
|
11
|
+
/** How far along the route the direction of travel is read, in metres. */
|
|
12
|
+
const BEARING_LOOKAHEAD_M = 25;
|
|
13
|
+
/** Initial great-circle bearing from [a] to [b], degrees clockwise from north, 0–360. */
|
|
14
|
+
export function bearingBetween(a, b) {
|
|
15
|
+
const rad = Math.PI / 180;
|
|
16
|
+
const φ1 = a.lat * rad;
|
|
17
|
+
const φ2 = b.lat * rad;
|
|
18
|
+
const Δλ = (b.lon - a.lon) * rad;
|
|
19
|
+
const y = Math.sin(Δλ) * Math.cos(φ2);
|
|
20
|
+
const x = Math.cos(φ1) * Math.sin(φ2) - Math.sin(φ1) * Math.cos(φ2) * Math.cos(Δλ);
|
|
21
|
+
return ((Math.atan2(y, x) / rad) % 360 + 360) % 360;
|
|
22
|
+
}
|
|
23
|
+
/** Index of the point of [line] nearest [location], looking from [from] on (the first of equals). */
|
|
24
|
+
function nearestIndex(line, location, from) {
|
|
25
|
+
let best = from;
|
|
26
|
+
let bestDistance = Infinity;
|
|
27
|
+
for (let i = from; i < line.length; i++) {
|
|
28
|
+
const d = distanceM(line[i], location);
|
|
29
|
+
if (d < bestDistance) {
|
|
30
|
+
best = i;
|
|
31
|
+
bestDistance = d;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return best;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The direction of travel at point [index] of [line]: towards the point about 25 m further on, or,
|
|
38
|
+
* at the end of the line, from the point about 25 m before. Null for a line of one point.
|
|
39
|
+
*/
|
|
40
|
+
export function bearingAlong(line, index) {
|
|
41
|
+
if (line.length < 2)
|
|
42
|
+
return null;
|
|
43
|
+
const at = line[Math.min(Math.max(index, 0), line.length - 1)];
|
|
44
|
+
if (index < line.length - 1) {
|
|
45
|
+
let travelled = 0;
|
|
46
|
+
let i = index;
|
|
47
|
+
while (i < line.length - 1 && travelled < BEARING_LOOKAHEAD_M) {
|
|
48
|
+
travelled += distanceM(line[i], line[i + 1]);
|
|
49
|
+
i++;
|
|
50
|
+
}
|
|
51
|
+
const ahead = line[i];
|
|
52
|
+
if (ahead.lat !== at.lat || ahead.lon !== at.lon)
|
|
53
|
+
return bearingBetween(at, ahead);
|
|
54
|
+
}
|
|
55
|
+
let travelled = 0;
|
|
56
|
+
let i = Math.min(index, line.length - 1);
|
|
57
|
+
while (i > 0 && travelled < BEARING_LOOKAHEAD_M) {
|
|
58
|
+
travelled += distanceM(line[i - 1], line[i]);
|
|
59
|
+
i--;
|
|
60
|
+
}
|
|
61
|
+
const behind = line[i];
|
|
62
|
+
return behind.lat === at.lat && behind.lon === at.lon ? null : bearingBetween(behind, at);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The steps of [route] to step through, in order: each with its instruction, icon, length,
|
|
66
|
+
* where it is and the direction of travel there. On a route with stops, a leg's departure
|
|
67
|
+
* from a stop is left out: the arrival at that stop already shows it.
|
|
68
|
+
*/
|
|
69
|
+
export function previewSteps(route) {
|
|
70
|
+
const line = unwrapLongitudes(routePoints(route));
|
|
71
|
+
const raw = route.legs.flatMap((leg, legIndex) => leg.steps.filter((s, i) => !(legIndex > 0 && i === 0 && maneuverOf(s.type) === "depart")));
|
|
72
|
+
let cursor = 0;
|
|
73
|
+
return raw.map((step, i) => {
|
|
74
|
+
const maneuver = maneuverOf(step.type);
|
|
75
|
+
const index = line.length > 0 ? nearestIndex(line, step.location, cursor) : 0;
|
|
76
|
+
cursor = index;
|
|
77
|
+
const next = raw[i + 1];
|
|
78
|
+
const crossing = maneuver === "ferry" && step.type !== "ferry_exit" && next != null;
|
|
79
|
+
return {
|
|
80
|
+
step,
|
|
81
|
+
maneuver,
|
|
82
|
+
instruction: step.instruction,
|
|
83
|
+
distance: step.distance_m >= 1 ? formatDistance(step.distance_m) : null,
|
|
84
|
+
location: step.location,
|
|
85
|
+
bearing: bearingAlong(line, index),
|
|
86
|
+
frame: crossing ? [step.location, next.location] : [],
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
const SOURCE = "remaply-sdk-step-preview";
|
|
91
|
+
/** The layer marking the turn being shown. */
|
|
92
|
+
export const STEP_PREVIEW_LAYER = "remaply-sdk-step-preview-turn";
|
|
93
|
+
const NO_STEP = { type: "FeatureCollection", features: [] };
|
|
94
|
+
/**
|
|
95
|
+
* Step through a route's turns before setting off, as the apps' route planner Preview does: each
|
|
96
|
+
* Next or Back moves the camera to that turn, tilted and facing the way you will travel, marks the
|
|
97
|
+
* turn on the route, and shows it in a panel. This is a preview only: it does not follow your
|
|
98
|
+
* location, speak, or re-route.
|
|
99
|
+
*
|
|
100
|
+
* ```ts
|
|
101
|
+
* const steps = new StepPreview(map.maplibre); // or any MapLibre map
|
|
102
|
+
* const [best] = await route([from, to]);
|
|
103
|
+
* steps.start(best); // the first step; Next, Back and Exit preview in the panel
|
|
104
|
+
* steps.next(); // or drive it yourself
|
|
105
|
+
* steps.exit(); // back to where the camera was
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* Use `panel: false` to draw your own panel from `onChange`.
|
|
109
|
+
*/
|
|
110
|
+
export class StepPreview {
|
|
111
|
+
constructor(map, options = {}) {
|
|
112
|
+
this.map = map;
|
|
113
|
+
this.steps = [];
|
|
114
|
+
this.index = 0;
|
|
115
|
+
this.saved = null;
|
|
116
|
+
this.panel = null;
|
|
117
|
+
this.listening = false;
|
|
118
|
+
this.onStyleLoad = () => this.addLayer();
|
|
119
|
+
this.onKey = (e) => this.handleKey(e);
|
|
120
|
+
this.options = options;
|
|
121
|
+
map.on("style.load", this.onStyleLoad);
|
|
122
|
+
this.addLayer();
|
|
123
|
+
}
|
|
124
|
+
/** Whether a route is being stepped through. */
|
|
125
|
+
get active() {
|
|
126
|
+
return this.saved !== null;
|
|
127
|
+
}
|
|
128
|
+
/** The step shown and where it is in the route; null when not previewing. */
|
|
129
|
+
get state() {
|
|
130
|
+
const step = this.steps[this.index];
|
|
131
|
+
if (!this.active || !step)
|
|
132
|
+
return null;
|
|
133
|
+
return { index: this.index, count: this.steps.length, step, isFirst: this.index === 0, isLast: this.index === this.steps.length - 1 };
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Start stepping through [route] (from `route()`) at step [at], default the first. Returns false,
|
|
137
|
+
* and does nothing, for a route without steps. Starting again replaces the route but keeps the
|
|
138
|
+
* camera to go back to on exit.
|
|
139
|
+
*/
|
|
140
|
+
start(route, at = 0) {
|
|
141
|
+
const steps = previewSteps(route);
|
|
142
|
+
if (steps.length === 0)
|
|
143
|
+
return false;
|
|
144
|
+
if (!this.saved) {
|
|
145
|
+
const c = this.map.getCenter();
|
|
146
|
+
this.saved = { center: [c.lng, c.lat], zoom: this.map.getZoom(), bearing: this.map.getBearing(), pitch: this.map.getPitch() };
|
|
147
|
+
if ((this.options.keyboard ?? true) && typeof document !== "undefined") {
|
|
148
|
+
document.addEventListener("keydown", this.onKey);
|
|
149
|
+
this.listening = true;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
this.steps = steps;
|
|
153
|
+
if ((this.options.panel ?? true) && !this.panel) {
|
|
154
|
+
this.panel = new StepPreviewPanel(this.map.getContainer(), {
|
|
155
|
+
theme: this.options.theme ?? "auto",
|
|
156
|
+
onBack: () => this.back(),
|
|
157
|
+
onNext: () => this.next(),
|
|
158
|
+
onExit: () => this.exit(),
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
this.goTo(at);
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
/** Show step [index] (clamped to the route's steps). */
|
|
165
|
+
goTo(index) {
|
|
166
|
+
if (!this.active)
|
|
167
|
+
return;
|
|
168
|
+
this.index = Math.min(Math.max(Math.trunc(index), 0), this.steps.length - 1);
|
|
169
|
+
const state = this.state;
|
|
170
|
+
// The panel first: its height decides where the camera puts the turn.
|
|
171
|
+
this.panel?.show(state);
|
|
172
|
+
this.mark(state.step);
|
|
173
|
+
this.moveCamera(state.step);
|
|
174
|
+
this.options.onChange?.(state);
|
|
175
|
+
}
|
|
176
|
+
/** The next step; nothing on the last. */
|
|
177
|
+
next() {
|
|
178
|
+
if (this.active && this.index < this.steps.length - 1)
|
|
179
|
+
this.goTo(this.index + 1);
|
|
180
|
+
}
|
|
181
|
+
/** The step before; nothing on the first. */
|
|
182
|
+
back() {
|
|
183
|
+
if (this.active && this.index > 0)
|
|
184
|
+
this.goTo(this.index - 1);
|
|
185
|
+
}
|
|
186
|
+
/** Stop previewing: the panel and the turn's mark go, and the camera goes back to where it was. */
|
|
187
|
+
exit() {
|
|
188
|
+
const saved = this.saved;
|
|
189
|
+
if (!saved)
|
|
190
|
+
return;
|
|
191
|
+
this.saved = null;
|
|
192
|
+
this.steps = [];
|
|
193
|
+
this.index = 0;
|
|
194
|
+
if (this.listening)
|
|
195
|
+
document.removeEventListener("keydown", this.onKey);
|
|
196
|
+
this.listening = false;
|
|
197
|
+
this.panel?.remove();
|
|
198
|
+
this.panel = null;
|
|
199
|
+
this.setData(NO_STEP);
|
|
200
|
+
this.map.easeTo({ ...saved, padding: { top: 0, bottom: 0, left: 0, right: 0 }, duration: 800 });
|
|
201
|
+
this.options.onChange?.(null);
|
|
202
|
+
}
|
|
203
|
+
/** Exit, remove the layer and stop following style changes. */
|
|
204
|
+
remove() {
|
|
205
|
+
if (this.active)
|
|
206
|
+
this.exit();
|
|
207
|
+
this.map.off("style.load", this.onStyleLoad);
|
|
208
|
+
if (this.map.getLayer(STEP_PREVIEW_LAYER))
|
|
209
|
+
this.map.removeLayer(STEP_PREVIEW_LAYER);
|
|
210
|
+
if (this.map.getSource(SOURCE))
|
|
211
|
+
this.map.removeSource(SOURCE);
|
|
212
|
+
}
|
|
213
|
+
padding() {
|
|
214
|
+
const p = this.options.padding;
|
|
215
|
+
if (typeof p === "number")
|
|
216
|
+
return { top: p, bottom: p, left: p, right: p };
|
|
217
|
+
if (p)
|
|
218
|
+
return { top: 0, bottom: 0, left: 0, right: 0, ...p };
|
|
219
|
+
// Room for the built-in panel, so the turn is centred in the map above it.
|
|
220
|
+
return this.panel ? { top: 40, bottom: this.panel.height() + 24, left: 24, right: 24 } : { top: 40, bottom: 40, left: 40, right: 40 };
|
|
221
|
+
}
|
|
222
|
+
moveCamera(step) {
|
|
223
|
+
const padding = this.padding();
|
|
224
|
+
if (step.frame.length >= 2) {
|
|
225
|
+
const box = boundsOf([step.frame]);
|
|
226
|
+
if (box) {
|
|
227
|
+
const [west, south, east, north] = box;
|
|
228
|
+
// The zoom that fits both ends in the padded area; the centre is the box's, which the
|
|
229
|
+
// padding then places in the middle of that area.
|
|
230
|
+
const camera = this.map.cameraForBounds([[west, south], [east, north]], {
|
|
231
|
+
padding,
|
|
232
|
+
bearing: 0,
|
|
233
|
+
maxZoom: 14,
|
|
234
|
+
});
|
|
235
|
+
if (camera?.zoom !== undefined) {
|
|
236
|
+
// A crossing has no turn to line up with: flat and north up.
|
|
237
|
+
this.map.flyTo({ center: [(west + east) / 2, (south + north) / 2], zoom: camera.zoom, bearing: 0, pitch: 0, padding, duration: 900 });
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
this.map.flyTo({
|
|
243
|
+
center: [step.location.lon, step.location.lat],
|
|
244
|
+
zoom: this.options.zoom ?? STEP_PREVIEW_ZOOM,
|
|
245
|
+
bearing: step.bearing ?? this.map.getBearing(),
|
|
246
|
+
pitch: this.options.pitch ?? STEP_PREVIEW_PITCH,
|
|
247
|
+
padding,
|
|
248
|
+
duration: 900,
|
|
249
|
+
maxDuration: 2000,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
mark(step) {
|
|
253
|
+
this.setData({
|
|
254
|
+
type: "FeatureCollection",
|
|
255
|
+
features: [{ type: "Feature", geometry: { type: "Point", coordinates: [step.location.lon, step.location.lat] }, properties: {} }],
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
setData(data) {
|
|
259
|
+
const source = this.map.getSource(SOURCE);
|
|
260
|
+
// Not added yet (the map was still loading when the preview was made): add it now, with the data.
|
|
261
|
+
if (!source)
|
|
262
|
+
return this.addLayer();
|
|
263
|
+
source.setData(data);
|
|
264
|
+
if (this.map.getLayer(STEP_PREVIEW_LAYER))
|
|
265
|
+
this.map.moveLayer(STEP_PREVIEW_LAYER);
|
|
266
|
+
}
|
|
267
|
+
addLayer() {
|
|
268
|
+
const map = this.map;
|
|
269
|
+
if (map.getSource(SOURCE))
|
|
270
|
+
return;
|
|
271
|
+
const step = this.state?.step;
|
|
272
|
+
// isStyleLoaded() is also false while tiles load, which is no reason to wait: only a style
|
|
273
|
+
// still loading refuses the source, and then style.load brings us back.
|
|
274
|
+
try {
|
|
275
|
+
map.addSource(SOURCE, {
|
|
276
|
+
type: "geojson",
|
|
277
|
+
data: step
|
|
278
|
+
? { type: "FeatureCollection", features: [{ type: "Feature", geometry: { type: "Point", coordinates: [step.location.lon, step.location.lat] }, properties: {} }] }
|
|
279
|
+
: NO_STEP,
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
// Over the route line, under the route's From and To when they are drawn.
|
|
286
|
+
const before = map.getLayer(ROUTE_PREVIEW_LAYERS.links) ? ROUTE_PREVIEW_LAYERS.links : undefined;
|
|
287
|
+
map.addLayer({
|
|
288
|
+
id: STEP_PREVIEW_LAYER,
|
|
289
|
+
type: "circle",
|
|
290
|
+
source: SOURCE,
|
|
291
|
+
paint: {
|
|
292
|
+
"circle-radius": 9,
|
|
293
|
+
"circle-color": "#FFFFFF",
|
|
294
|
+
"circle-stroke-width": 4,
|
|
295
|
+
"circle-stroke-color": ROUTE_COLORS.casing,
|
|
296
|
+
"circle-pitch-alignment": "map",
|
|
297
|
+
},
|
|
298
|
+
}, before);
|
|
299
|
+
}
|
|
300
|
+
handleKey(e) {
|
|
301
|
+
if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey)
|
|
302
|
+
return;
|
|
303
|
+
const target = e.target;
|
|
304
|
+
if (target && (target.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(target.tagName)))
|
|
305
|
+
return;
|
|
306
|
+
if (e.key === "ArrowRight")
|
|
307
|
+
this.next();
|
|
308
|
+
else if (e.key === "ArrowLeft")
|
|
309
|
+
this.back();
|
|
310
|
+
else if (e.key === "Escape")
|
|
311
|
+
this.exit();
|
|
312
|
+
else
|
|
313
|
+
return;
|
|
314
|
+
e.preventDefault();
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
//# sourceMappingURL=stepPreview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepPreview.js","sourceRoot":"","sources":["../src/stepPreview.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,sCAAsC;AAGtC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAA6C,MAAM,iBAAiB,CAAC;AACrH,OAAO,E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BACL,eAAe,EAAE,CAAC;gBAClB,cAAc,EAAE,SAAS;gBACzB,qBAAqB,EAAE,CAAC;gBACxB,qBAAqB,EAAE,YAAY,CAAC,MAAM;gBAC1C,wBAAwB,EAAE,KAAK;aAChC;SACF,EACD,MAAM,CACP,CAAC;IACJ,CAAC;IAEO,SAAS,CAAC,CAAgB;QAChC,IAAI,CAAC,CAAC,gBAAgB,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO;YAAE,OAAO;QACrE,MAAM,MAAM,GAAG,CAAC,CAAC,MAA4B,CAAC;QAC9C,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,IAAI,2BAA2B,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAAE,OAAO;QACrG,IAAI,CAAC,CAAC,GAAG,KAAK,YAAY;YAAE,IAAI,CAAC,IAAI,EAAE,CAAC;aACnC,IAAI,CAAC,CAAC,GAAG,KAAK,WAAW;YAAE,IAAI,CAAC,IAAI,EAAE,CAAC;aACvC,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ;YAAE,IAAI,CAAC,IAAI,EAAE,CAAC;;YACpC,OAAO;QACZ,CAAC,CAAC,cAAc,EAAE,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Maneuver } from "./directions.js";
|
|
2
|
+
import type { StepPreviewState } from "./stepPreview.js";
|
|
3
|
+
/** `auto` follows the system's light or dark setting. */
|
|
4
|
+
export type StepPreviewTheme = "light" | "dark" | "auto";
|
|
5
|
+
/** The panel's colours, as the apps' route planner Preview. */
|
|
6
|
+
export declare const STEP_PREVIEW_COLORS: {
|
|
7
|
+
readonly primary: "#1C8B67";
|
|
8
|
+
readonly tile: "#0B5D43";
|
|
9
|
+
readonly chip: "#E8F5EF";
|
|
10
|
+
readonly chipText: "#0B5D43";
|
|
11
|
+
readonly chipDark: "#233B33";
|
|
12
|
+
readonly chipTextDark: "#34C08D";
|
|
13
|
+
readonly exit: "#D93025";
|
|
14
|
+
readonly exitDark: "#F28B82";
|
|
15
|
+
};
|
|
16
|
+
/** The turn's icon, as SVG markup. Exported for apps drawing their own panel. */
|
|
17
|
+
export declare function maneuverIconSvg(maneuver: Maneuver): string;
|
|
18
|
+
/** The built-in panel `StepPreview` shows at the bottom of the map. */
|
|
19
|
+
export declare class StepPreviewPanel {
|
|
20
|
+
private readonly root;
|
|
21
|
+
private readonly tile;
|
|
22
|
+
private readonly instruction;
|
|
23
|
+
private readonly distance;
|
|
24
|
+
private readonly fill;
|
|
25
|
+
private readonly count;
|
|
26
|
+
private readonly back;
|
|
27
|
+
private readonly next;
|
|
28
|
+
private readonly nextLabel;
|
|
29
|
+
constructor(container: HTMLElement, handlers: {
|
|
30
|
+
theme: StepPreviewTheme;
|
|
31
|
+
onBack: () => void;
|
|
32
|
+
onNext: () => void;
|
|
33
|
+
onExit: () => void;
|
|
34
|
+
});
|
|
35
|
+
/** Show [state]'s step. */
|
|
36
|
+
show(state: StepPreviewState): void;
|
|
37
|
+
/** The panel's height in pixels, to keep the camera's target clear of it. */
|
|
38
|
+
height(): number;
|
|
39
|
+
remove(): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=stepPreviewPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepPreviewPanel.d.ts","sourceRoot":"","sources":["../src/stepPreviewPanel.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,yDAAyD;AACzD,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzD,+DAA+D;AAC/D,eAAO,MAAM,mBAAmB;;;;;;;;;CAStB,CAAC;AAkDX,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAa1D;AAcD,uEAAuE;AACvE,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAc;IACnC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAc;IACnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IACvC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAc;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;IACpC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAoB;IACzC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAoB;IACzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAc;gBAGtC,SAAS,EAAE,WAAW,EACtB,QAAQ,EAAE;QAAE,KAAK,EAAE,gBAAgB,CAAC;QAAC,MAAM,EAAE,MAAM,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE;IAoDnG,2BAA2B;IAC3B,IAAI,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAenC,6EAA6E;IAC7E,MAAM,IAAI,MAAM;IAIhB,MAAM,IAAI,IAAI;CAGf"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// Copyright 2026 Remaply
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/** The panel's colours, as the apps' route planner Preview. */
|
|
4
|
+
export const STEP_PREVIEW_COLORS = {
|
|
5
|
+
primary: "#1C8B67",
|
|
6
|
+
tile: "#0B5D43",
|
|
7
|
+
chip: "#E8F5EF",
|
|
8
|
+
chipText: "#0B5D43",
|
|
9
|
+
chipDark: "#233B33",
|
|
10
|
+
chipTextDark: "#34C08D",
|
|
11
|
+
exit: "#D93025",
|
|
12
|
+
exitDark: "#F28B82",
|
|
13
|
+
};
|
|
14
|
+
const STYLE_ID = "remaply-step-preview-style";
|
|
15
|
+
const CSS = `
|
|
16
|
+
.remaply-step-preview{--rsp-surface:#FFFFFF;--rsp-title:#111827;--rsp-subtle:#626A7A;--rsp-muted:#F1F3F6;--rsp-track:#E6EAF0;
|
|
17
|
+
--rsp-chip:${STEP_PREVIEW_COLORS.chip};--rsp-chip-text:${STEP_PREVIEW_COLORS.chipText};--rsp-exit:${STEP_PREVIEW_COLORS.exit};
|
|
18
|
+
position:absolute;left:50%;bottom:12px;transform:translateX(-50%);z-index:3;box-sizing:border-box;width:calc(100% - 24px);max-width:440px;
|
|
19
|
+
padding:12px 16px 16px;border-radius:24px;background:var(--rsp-surface);color:var(--rsp-title);box-shadow:0 -4px 24px rgba(0,0,0,.16);
|
|
20
|
+
font:15px/1.35 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;display:flex;flex-direction:column;gap:14px}
|
|
21
|
+
.remaply-step-preview[data-theme=dark]{--rsp-surface:#151B1F;--rsp-title:#F3F4F6;--rsp-subtle:#C3CAD1;--rsp-muted:#232B30;--rsp-track:#2C373D;
|
|
22
|
+
--rsp-chip:${STEP_PREVIEW_COLORS.chipDark};--rsp-chip-text:${STEP_PREVIEW_COLORS.chipTextDark};--rsp-exit:${STEP_PREVIEW_COLORS.exitDark}}
|
|
23
|
+
@media (prefers-color-scheme:dark){.remaply-step-preview[data-theme=auto]{--rsp-surface:#151B1F;--rsp-title:#F3F4F6;--rsp-subtle:#C3CAD1;--rsp-muted:#232B30;
|
|
24
|
+
--rsp-track:#2C373D;--rsp-chip:${STEP_PREVIEW_COLORS.chipDark};--rsp-chip-text:${STEP_PREVIEW_COLORS.chipTextDark};--rsp-exit:${STEP_PREVIEW_COLORS.exitDark}}}
|
|
25
|
+
.remaply-step-preview *{box-sizing:border-box}
|
|
26
|
+
.remaply-step-preview button{font:inherit;cursor:pointer;border:0;-webkit-tap-highlight-color:transparent}
|
|
27
|
+
.remaply-step-preview button:focus-visible{outline:3px solid ${STEP_PREVIEW_COLORS.primary};outline-offset:2px}
|
|
28
|
+
.remaply-step-preview button:disabled{cursor:default}
|
|
29
|
+
.remaply-step-preview .rsp-top{display:flex;align-items:center;justify-content:space-between}
|
|
30
|
+
.remaply-step-preview .rsp-chip{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;background:var(--rsp-chip);
|
|
31
|
+
color:var(--rsp-chip-text);font-size:13px;font-weight:800;letter-spacing:.4px}
|
|
32
|
+
.remaply-step-preview .rsp-exit{display:inline-flex;align-items:center;gap:5px;min-height:44px;padding:0 4px;background:none;color:var(--rsp-exit);font-size:14px;font-weight:800}
|
|
33
|
+
.remaply-step-preview .rsp-turn{display:flex;align-items:center;gap:14px}
|
|
34
|
+
.remaply-step-preview .rsp-tile{flex:none;display:grid;place-items:center;width:56px;height:56px;border-radius:18px;background:${STEP_PREVIEW_COLORS.tile};color:#FFFFFF}
|
|
35
|
+
.remaply-step-preview .rsp-instruction{margin:0;font-size:19px;font-weight:800;line-height:1.25}
|
|
36
|
+
.remaply-step-preview .rsp-distance{margin:3px 0 0;font-size:14px;color:var(--rsp-subtle)}
|
|
37
|
+
.remaply-step-preview .rsp-progress{display:flex;align-items:center;gap:10px}
|
|
38
|
+
.remaply-step-preview .rsp-track{flex:1;height:6px;border-radius:999px;background:var(--rsp-track);overflow:hidden}
|
|
39
|
+
.remaply-step-preview .rsp-fill{height:100%;border-radius:999px;background:${STEP_PREVIEW_COLORS.primary};transition:width .25s ease}
|
|
40
|
+
.remaply-step-preview .rsp-count{font-size:14px;font-weight:800;font-variant-numeric:tabular-nums}
|
|
41
|
+
.remaply-step-preview .rsp-buttons{display:flex;gap:10px}
|
|
42
|
+
.remaply-step-preview .rsp-back,.remaply-step-preview .rsp-next{flex:1;display:inline-flex;align-items:center;justify-content:center;gap:6px;height:54px;border-radius:16px;font-size:16px;font-weight:700}
|
|
43
|
+
.remaply-step-preview .rsp-back{background:var(--rsp-muted);color:var(--rsp-title)}
|
|
44
|
+
.remaply-step-preview .rsp-back:disabled{opacity:.6;color:var(--rsp-subtle)}
|
|
45
|
+
.remaply-step-preview .rsp-next{background:${STEP_PREVIEW_COLORS.primary};color:#FFFFFF;font-weight:800;font-size:17px}
|
|
46
|
+
.remaply-step-preview .rsp-next:disabled{opacity:.4}
|
|
47
|
+
@media (prefers-reduced-motion:reduce){.remaply-step-preview .rsp-fill{transition:none}}
|
|
48
|
+
`;
|
|
49
|
+
const ARROW = "M12 3l6 7h-4v11h-4V10H6z";
|
|
50
|
+
/** Rotation of the plain arrow for each turn. */
|
|
51
|
+
const ROTATION = {
|
|
52
|
+
straight: 0, depart: 0, merge: 0, other: 0,
|
|
53
|
+
slight_right: 35, keep_right: 25, ramp_right: 35, right: 90, sharp_right: 135,
|
|
54
|
+
slight_left: -35, keep_left: -25, ramp_left: -35, left: -90, sharp_left: -135,
|
|
55
|
+
};
|
|
56
|
+
const svg = (body, extra = "", size = 28) => `<svg aria-hidden="true" width="${size}" height="${size}" viewBox="0 0 24 24" fill="currentColor"${extra}>${body}</svg>`;
|
|
57
|
+
/** The turn's icon, as SVG markup. Exported for apps drawing their own panel. */
|
|
58
|
+
export function maneuverIconSvg(maneuver) {
|
|
59
|
+
switch (maneuver) {
|
|
60
|
+
case "arrive":
|
|
61
|
+
return svg(`<path fill-rule="evenodd" d="M12 21.5s-7-6.1-7-11.5a7 7 0 0 1 14 0c0 5.4-7 11.5-7 11.5zM12 7.5a2.5 2.5 0 1 0 0 5a2.5 2.5 0 1 0 0-5z"/>`);
|
|
62
|
+
case "uturn":
|
|
63
|
+
return svg(`<path d="M17 21V10a5 5 0 0 0-10 0v4H4l4.5 5 4.5-5h-3v-4a2 2 0 0 1 4 0v11z"/>`);
|
|
64
|
+
case "roundabout":
|
|
65
|
+
return svg(`<path d="M12 6a6 6 0 1 0 6 6h-2.5A3.5 3.5 0 1 1 12 8.5V11l4-3.75L12 3.5z"/><path d="M10.75 17h2.5v5h-2.5z"/>`);
|
|
66
|
+
case "ferry":
|
|
67
|
+
return svg(`<path d="M6 6h12v5l2 1-2.5 6.5c-1.6 0-2.6-.8-3.5-1.5-.9.7-1.9 1.5-3 1.5s-2.1-.8-3-1.5c-.9.7-1.9 1.5-3.5 1.5L2 12l2-1V6zm2 2v2.2L12 8.5l4 1.7V8zM3 20.5c1.7 0 2.9-.7 4-1.5 1.1.8 2.3 1.5 5 1.5s3.9-.7 5-1.5c1.1.8 2.3 1.5 4 1.5V22c-1.7 0-2.9-.6-4-1.3-1.1.7-2.3 1.3-5 1.3s-3.9-.6-5-1.3C5.9 21.4 4.7 22 3 22z"/>`);
|
|
68
|
+
default:
|
|
69
|
+
return svg(`<path d="${ARROW}"/>`, ` style="transform:rotate(${ROTATION[maneuver] ?? 0}deg)"`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const EYE = svg(`<path d="M12 5c5 0 9 4.5 10 7-1 2.5-5 7-10 7S3 14.5 2 12c1-2.5 5-7 10-7zm0 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8zm0 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/>`, "", 15);
|
|
73
|
+
const CLOSE = svg(`<path d="M6.4 5 12 10.6 17.6 5 19 6.4 13.4 12l5.6 5.6-1.4 1.4-5.6-5.6L6.4 19 5 17.6 10.6 12 5 6.4z"/>`, "", 14);
|
|
74
|
+
const LEFT = svg(`<path d="M15.4 5.4 14 4l-8 8 8 8 1.4-1.4L8.8 12z"/>`, "", 16);
|
|
75
|
+
const RIGHT = svg(`<path d="M8.6 5.4 10 4l8 8-8 8-1.4-1.4 6.6-6.6z"/>`, "", 16);
|
|
76
|
+
function element(tag, className, html = "") {
|
|
77
|
+
const el = document.createElement(tag);
|
|
78
|
+
el.className = className;
|
|
79
|
+
if (html)
|
|
80
|
+
el.innerHTML = html;
|
|
81
|
+
return el;
|
|
82
|
+
}
|
|
83
|
+
/** The built-in panel `StepPreview` shows at the bottom of the map. */
|
|
84
|
+
export class StepPreviewPanel {
|
|
85
|
+
constructor(container, handlers) {
|
|
86
|
+
if (!document.getElementById(STYLE_ID)) {
|
|
87
|
+
const style = document.createElement("style");
|
|
88
|
+
style.id = STYLE_ID;
|
|
89
|
+
style.textContent = CSS;
|
|
90
|
+
document.head.appendChild(style);
|
|
91
|
+
}
|
|
92
|
+
this.root = element("section", "remaply-step-preview");
|
|
93
|
+
this.root.dataset.theme = handlers.theme;
|
|
94
|
+
this.root.setAttribute("aria-label", "Route preview");
|
|
95
|
+
const top = element("div", "rsp-top");
|
|
96
|
+
top.append(element("span", "rsp-chip", `${EYE}PREVIEW`));
|
|
97
|
+
const exit = element("button", "rsp-exit", `${CLOSE}Exit preview`);
|
|
98
|
+
exit.type = "button";
|
|
99
|
+
exit.addEventListener("click", handlers.onExit);
|
|
100
|
+
top.append(exit);
|
|
101
|
+
const turn = element("div", "rsp-turn");
|
|
102
|
+
this.tile = element("div", "rsp-tile");
|
|
103
|
+
const text = element("div", "");
|
|
104
|
+
this.instruction = element("p", "rsp-instruction");
|
|
105
|
+
this.instruction.setAttribute("aria-live", "polite");
|
|
106
|
+
this.distance = element("p", "rsp-distance");
|
|
107
|
+
text.append(this.instruction, this.distance);
|
|
108
|
+
turn.append(this.tile, text);
|
|
109
|
+
const progress = element("div", "rsp-progress");
|
|
110
|
+
const track = element("div", "rsp-track");
|
|
111
|
+
this.fill = element("div", "rsp-fill");
|
|
112
|
+
track.append(this.fill);
|
|
113
|
+
this.count = element("span", "rsp-count");
|
|
114
|
+
progress.append(track, this.count);
|
|
115
|
+
const buttons = element("div", "rsp-buttons");
|
|
116
|
+
this.back = element("button", "rsp-back", `${LEFT}<span>Back</span>`);
|
|
117
|
+
this.back.type = "button";
|
|
118
|
+
this.back.setAttribute("aria-label", "Previous step");
|
|
119
|
+
this.back.addEventListener("click", handlers.onBack);
|
|
120
|
+
this.next = element("button", "rsp-next");
|
|
121
|
+
this.next.type = "button";
|
|
122
|
+
this.nextLabel = element("span", "");
|
|
123
|
+
this.next.append(this.nextLabel);
|
|
124
|
+
this.next.insertAdjacentHTML("beforeend", RIGHT);
|
|
125
|
+
this.next.addEventListener("click", handlers.onNext);
|
|
126
|
+
buttons.append(this.back, this.next);
|
|
127
|
+
this.root.append(top, turn, progress, buttons);
|
|
128
|
+
container.append(this.root);
|
|
129
|
+
}
|
|
130
|
+
/** Show [state]'s step. */
|
|
131
|
+
show(state) {
|
|
132
|
+
const { step, index, count, isFirst, isLast } = state;
|
|
133
|
+
this.tile.innerHTML = maneuverIconSvg(step.maneuver);
|
|
134
|
+
this.instruction.textContent = step.instruction;
|
|
135
|
+
this.distance.textContent = step.distance ? `for ${step.distance}` : "";
|
|
136
|
+
this.distance.hidden = !step.distance;
|
|
137
|
+
this.fill.style.width = `${(count > 0 ? (index + 1) / count : 0) * 100}%`;
|
|
138
|
+
this.count.textContent = `${index + 1} / ${count}`;
|
|
139
|
+
this.count.setAttribute("aria-label", `Step ${index + 1} of ${count}`);
|
|
140
|
+
this.back.disabled = isFirst;
|
|
141
|
+
this.next.disabled = isLast;
|
|
142
|
+
this.nextLabel.textContent = isLast ? "Arrived" : "Next";
|
|
143
|
+
this.next.setAttribute("aria-label", isLast ? "Arrived" : "Next step");
|
|
144
|
+
}
|
|
145
|
+
/** The panel's height in pixels, to keep the camera's target clear of it. */
|
|
146
|
+
height() {
|
|
147
|
+
return this.root.offsetHeight || 230;
|
|
148
|
+
}
|
|
149
|
+
remove() {
|
|
150
|
+
this.root.remove();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=stepPreviewPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepPreviewPanel.js","sourceRoot":"","sources":["../src/stepPreviewPanel.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,sCAAsC;AAQtC,+DAA+D;AAC/D,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,SAAS;I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G,CAAC,MAAM,KAAK,EAAE,CAAC;QACnD,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,QAAQ,KAAK,GAAG,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC;QACvE,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAC7B,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC;QAC5B,IAAI,CAAC,SAAS,CAAC,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;QACzD,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IACzE,CAAC;IAED,6EAA6E;IAC7E,MAAM;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,GAAG,CAAC;IACvC,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IACrB,CAAC;CACF"}
|
package/dist/style.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { StyleSpecification } from "maplibre-gl";
|
|
2
|
+
/** Id of the vector tile source in the style. Its URL is replaced with the tiles of the API in use. */
|
|
3
|
+
export declare const REMAPLY_SOURCE = "remaply";
|
|
4
|
+
/** Label fonts for styles whose `glyphs` cannot be loaded (Remaply's default style may name `mapbox://fonts/...`). */
|
|
5
|
+
export declare const FALLBACK_GLYPHS = "https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf";
|
|
6
|
+
/** Copy of the GET /v1/tiles/{tileset}.json contract (app/features/tiles/schemas.py in the API). */
|
|
7
|
+
export interface TileJson {
|
|
8
|
+
tiles: string[];
|
|
9
|
+
minzoom?: number;
|
|
10
|
+
maxzoom?: number;
|
|
11
|
+
bounds?: number[] | null;
|
|
12
|
+
attribution?: string | null;
|
|
13
|
+
}
|
|
14
|
+
/** The style is not a MapLibre style with a `remaply` source. */
|
|
15
|
+
export declare class MapStyleError extends Error {
|
|
16
|
+
readonly name = "MapStyleError";
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The Remaply map style, ready for `new maplibregl.Map({ style })`: the style from the API (or
|
|
20
|
+
* `mapStyleUrl`), with its `remaply` source pointed at the tiles of the API in use, the sprite on that
|
|
21
|
+
* API, reachable fonts, and buildings and building numbers from `buildingMinZoom` /
|
|
22
|
+
* `addressNumberMinZoom`.
|
|
23
|
+
*
|
|
24
|
+
* The key is not written into the style: pass {@link transformRequest} to the map, which adds it to
|
|
25
|
+
* requests for the API's origin only. `RemaplyMap` does both for you.
|
|
26
|
+
*/
|
|
27
|
+
export declare function loadStyle(options?: {
|
|
28
|
+
signal?: AbortSignal;
|
|
29
|
+
}): Promise<StyleSpecification>;
|
|
30
|
+
/** The first font named literally in a symbol layer, for the glyph check and for marker labels. */
|
|
31
|
+
export declare function firstFont(style: Pick<StyleSpecification, "layers">): string | null;
|
|
32
|
+
export interface PrepareStyleOptions {
|
|
33
|
+
tileset: string;
|
|
34
|
+
buildingMinZoom: number | null;
|
|
35
|
+
addressNumberMinZoom: number | null;
|
|
36
|
+
}
|
|
37
|
+
/** Exported for tests. See {@link loadStyle}. */
|
|
38
|
+
export declare function prepareStyle(styleText: string, tileJson: TileJson, options: PrepareStyleOptions): StyleSpecification;
|
|
39
|
+
/**
|
|
40
|
+
* Tile URL template on the API in use. Keeps the query of the TileJSON URL (`?v=`, the tileset
|
|
41
|
+
* version): without it a rebuilt tileset would show a mix of old and new cached tiles. A `key` in
|
|
42
|
+
* that query is dropped: {@link transformRequest} adds the current one.
|
|
43
|
+
*/
|
|
44
|
+
export declare function tileUrl(tileset: string, tileJson: TileJson): string;
|
|
45
|
+
//# sourceMappingURL=style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../src/style.ts"],"names":[],"mappings":"AAGA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