@mapslibvn/web 0.4.0 → 0.5.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/README.md +75 -9
- package/THIRD_PARTY_NOTICES.md +33 -2
- package/dist/index.d.ts +111 -3
- package/dist/index.js +501 -3
- package/dist/mapslibvn.umd.js +40 -40
- package/dist/mapslibvn.umd.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,7 +1,74 @@
|
|
|
1
1
|
# @mapslibvn/web
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@mapslibvn/web)
|
|
4
|
+
[](https://www.npmjs.com/package/@mapslibvn/web)
|
|
5
|
+
[](https://bundlephobia.com/package/@mapslibvn/web)
|
|
6
|
+
[](https://www.npmjs.com/package/@mapslibvn/web)
|
|
7
|
+
|
|
8
|
+
**A production-ready web map SDK for Vietnam.** `@mapslibvn/web` wraps MapLibre GL JS and PMTiles into a single `createMap()` call — vector tiles, Vietnamese/English labels, a built-in accessible search box, and turn-by-turn navigation, with attribution handled correctly out of the box.
|
|
9
|
+
|
|
10
|
+
Framework-agnostic: drop it into a plain HTML page via `<script>`, or use it as the engine under [`@mapslibvn/react`](https://www.npmjs.com/package/@mapslibvn/react).
|
|
11
|
+
|
|
12
|
+
## Why teams pick it
|
|
13
|
+
|
|
14
|
+
- 🗺️ **One call to a working map** — `createMap()` sets up the style, vector tiles (via PMTiles, no tile server to run), attribution and language in one step.
|
|
15
|
+
- 🔎 **Autocomplete that just works** — the `<mapslibvn-autocomplete>` Web Component ships as an accessible ARIA combobox (keyboard navigation, live region, debounced requests) that drops into any stack — vanilla JS, Vue, Svelte, plain HTML — no React required.
|
|
16
|
+
- 🧭 **Turn-by-turn navigation layer** — route rendering, camera follow, automatic rerouting and Vietnamese voice guidance (Web Speech API) via `map.navigation`.
|
|
17
|
+
- 🌐 **Bilingual labels** — switch between Vietnamese and English map labels at runtime with `applyLanguage`; sovereignty-sensitive labels always stay in Vietnamese.
|
|
18
|
+
- 📦 **Ship it your way** — a tree-shakeable ESM build (`dist/index.js`, ≤ 15 kB gzip) for bundlers, or a self-contained UMD bundle with MapLibre and PMTiles baked in for a plain `<script>` tag.
|
|
19
|
+
- ⚖️ **Attribution can't be silently dropped** — `createMap` always injects the required attribution control; there's no option to hide it, by design.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @mapslibvn/web maplibre-gl@^6.4.1
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
MapLibre GL JS 6 requires a WebGL2-capable browser. Load MapLibre's CSS once at your app's entry point.
|
|
28
|
+
|
|
29
|
+
## Quick start (ESM)
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { createMap } from '@mapslibvn/web';
|
|
33
|
+
import * as maplibregl from 'maplibre-gl';
|
|
34
|
+
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
35
|
+
|
|
36
|
+
const map = createMap(
|
|
37
|
+
{
|
|
38
|
+
container: 'map',
|
|
39
|
+
apiKey: 'mlv_live_…',
|
|
40
|
+
apiBase: 'https://api.ai-solutions.io.vn',
|
|
41
|
+
center: [106.7, 10.776],
|
|
42
|
+
zoom: 13,
|
|
43
|
+
},
|
|
44
|
+
{ maplibre: maplibregl },
|
|
45
|
+
);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The UMD build at `@mapslibvn/web/umd` bundles MapLibre and PMTiles for you. If you self-host the UMD file, place `maplibre-gl-worker.mjs` and `maplibre-gl-shared.mjs` next to `mapslibvn.umd.js`. Don't hide or disable attribution. Never ship a secret key in client-side code — Web keys must be origin-restricted.
|
|
49
|
+
|
|
50
|
+
📖 Docs: <https://mapslibvn-docs.pages.dev/ban-do-web/>
|
|
51
|
+
|
|
52
|
+
📦 Part of the MapsLibVN SDK family: [`@mapslibvn/core`](https://www.npmjs.com/package/@mapslibvn/core) · [`@mapslibvn/react`](https://www.npmjs.com/package/@mapslibvn/react) · [`@mapslibvn/react-native`](https://www.npmjs.com/package/@mapslibvn/react-native)
|
|
53
|
+
|
|
54
|
+
Source license: MIT; see `THIRD_PARTY_NOTICES.md` for dependency and data licenses.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Tiếng Việt
|
|
59
|
+
|
|
60
|
+
**SDK bản đồ web sẵn sàng cho production, dành cho Việt Nam.** `@mapslibvn/web` gói MapLibre GL JS và PMTiles vào đúng một lệnh `createMap()` — vector tiles, nhãn song ngữ Việt/Anh, ô tìm kiếm dễ tiếp cận có sẵn, và dẫn đường chỉ đường, với attribution được xử lý đúng ngay từ đầu.
|
|
61
|
+
|
|
62
|
+
Không phụ thuộc framework: nhúng thẳng vào trang HTML thuần bằng `<script>`, hoặc dùng làm engine bên dưới [`@mapslibvn/react`](https://www.npmjs.com/package/@mapslibvn/react).
|
|
63
|
+
|
|
64
|
+
## Vì sao nên chọn
|
|
65
|
+
|
|
66
|
+
- 🗺️ **Một lệnh ra bản đồ chạy được ngay** — `createMap()` dựng sẵn style, vector tiles (qua PMTiles, không cần chạy tile server riêng), attribution và ngôn ngữ trong một bước.
|
|
67
|
+
- 🔎 **Autocomplete dùng được ngay** — web component `<mapslibvn-autocomplete>` là một combobox ARIA dễ tiếp cận (điều hướng bàn phím, vùng live, debounce request) nhúng được vào bất kỳ stack nào — vanilla JS, Vue, Svelte, HTML thuần — không cần React.
|
|
68
|
+
- 🧭 **Lớp dẫn đường trọn gói** — vẽ tuyến, camera bám theo, tự tính lại khi lệch tuyến và đọc thoại tiếng Việt (Web Speech API) qua `map.navigation`.
|
|
69
|
+
- 🌐 **Nhãn song ngữ** — đổi nhãn bản đồ giữa tiếng Việt và tiếng Anh ngay lúc chạy bằng `applyLanguage`; nhãn liên quan chủ quyền luôn giữ tiếng Việt.
|
|
70
|
+
- 📦 **Chọn cách đóng gói theo ý bạn** — bản ESM tree-shake được (`dist/index.js`, ≤ 15 kB gzip) cho các bundler, hoặc bản UMD tự chứa đã đóng gói sẵn MapLibre và PMTiles để dùng thẳng bằng thẻ `<script>`.
|
|
71
|
+
- ⚖️ **Không thể lặng lẽ tắt attribution** — `createMap` luôn tự thêm control ghi nguồn bắt buộc; không có tuỳ chọn ẩn nó, đây là chủ đích thiết kế.
|
|
5
72
|
|
|
6
73
|
## Cài đặt
|
|
7
74
|
|
|
@@ -9,10 +76,9 @@ attribution bắt buộc.
|
|
|
9
76
|
npm install @mapslibvn/web maplibre-gl@^6.4.1
|
|
10
77
|
```
|
|
11
78
|
|
|
12
|
-
MapLibre GL JS 6 yêu cầu trình duyệt hỗ trợ WebGL2. Nạp CSS của MapLibre một lần ở điểm vào ứng
|
|
13
|
-
dụng.
|
|
79
|
+
MapLibre GL JS 6 yêu cầu trình duyệt hỗ trợ WebGL2. Nạp CSS của MapLibre một lần ở điểm vào ứng dụng.
|
|
14
80
|
|
|
15
|
-
##
|
|
81
|
+
## Bắt đầu nhanh (ESM)
|
|
16
82
|
|
|
17
83
|
```ts
|
|
18
84
|
import { createMap } from '@mapslibvn/web';
|
|
@@ -31,10 +97,10 @@ const map = createMap(
|
|
|
31
97
|
);
|
|
32
98
|
```
|
|
33
99
|
|
|
34
|
-
Bản UMD tại export `@mapslibvn/web/umd` đóng gói sẵn MapLibre và PMTiles. Khi tự phục vụ UMD, đặt
|
|
35
|
-
|
|
36
|
-
|
|
100
|
+
Bản UMD tại export `@mapslibvn/web/umd` đóng gói sẵn MapLibre và PMTiles. Khi tự phục vụ UMD, đặt `maplibre-gl-worker.mjs` và `maplibre-gl-shared.mjs` cạnh `mapslibvn.umd.js`. Không tắt hoặc che attribution. Không đưa khóa bí mật vào mã nguồn; khóa Web phải giới hạn đúng origin.
|
|
101
|
+
|
|
102
|
+
📖 Tài liệu: <https://mapslibvn-docs.pages.dev/ban-do-web/>
|
|
37
103
|
|
|
38
|
-
|
|
104
|
+
📦 Nằm trong họ SDK MapsLibVN: [`@mapslibvn/core`](https://www.npmjs.com/package/@mapslibvn/core) · [`@mapslibvn/react`](https://www.npmjs.com/package/@mapslibvn/react) · [`@mapslibvn/react-native`](https://www.npmjs.com/package/@mapslibvn/react-native)
|
|
39
105
|
|
|
40
106
|
Giấy phép mã nguồn: MIT; xem `THIRD_PARTY_NOTICES.md` cho giấy phép phụ thuộc và dữ liệu.
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -9,7 +9,7 @@ MapsLibVN **không liên kết với, không được tài trợ hay chứng th
|
|
|
9
9
|
nhãn hiệu của bên thứ ba; tên đó xuất hiện ở đây và trong tài liệu chỉ để mô tả nguồn gốc kỹ
|
|
10
10
|
thuật của thư viện mà MapsLibVN sử dụng.
|
|
11
11
|
|
|
12
|
-
Cập nhật:
|
|
12
|
+
Cập nhật: 12/09/2026.
|
|
13
13
|
|
|
14
14
|
## 1. Thư viện được đóng gói hoặc là peer dependency của SDK
|
|
15
15
|
|
|
@@ -20,6 +20,8 @@ Cập nhật: 04/09/2026.
|
|
|
20
20
|
| react, react-dom | 18.3.1 (peer, chỉ `@mapslibvn/react`) | MIT | |
|
|
21
21
|
| @maplibre/maplibre-react-native | 11.3.8 (peer, chỉ `@mapslibvn/react-native`) | MIT | bộ vẽ bản đồ native iOS/Android |
|
|
22
22
|
| react, react-native | react ≥ 19.1, react-native ≥ 0.80 (peer, chỉ `@mapslibvn/react-native`) | MIT | |
|
|
23
|
+
| expo-location, expo-task-manager | 57.0.17 (peer **tuỳ chọn**, chỉ entry `@mapslibvn/react-native/expo`) | MIT | định vị tiền cảnh và nền cho dẫn đường |
|
|
24
|
+
| expo-speech, expo-audio, expo-keep-awake | 57.0.3 / 57.0.5 / 57.0.1 (peer **tuỳ chọn**, chỉ entry `@mapslibvn/react-native/expo`) | MIT | đọc câu chỉ dẫn, phiên âm thanh khi nền, giữ màn hình sáng |
|
|
23
25
|
|
|
24
26
|
Nguyên văn giấy phép ở mục 4.
|
|
25
27
|
|
|
@@ -385,9 +387,38 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SO
|
|
|
385
387
|
Gói này nhúng MapLibre Native (Android, iOS) khi build app — xem thông báo giấy phép trong
|
|
386
388
|
chính gói đó cho các thành phần native.
|
|
387
389
|
|
|
390
|
+
### 4.9 expo-location, expo-task-manager, expo-speech, expo-audio, expo-keep-awake — MIT
|
|
391
|
+
|
|
392
|
+
```
|
|
393
|
+
The MIT License (MIT)
|
|
394
|
+
|
|
395
|
+
Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)
|
|
396
|
+
|
|
397
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
398
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
399
|
+
in the Software without restriction, including without limitation the rights
|
|
400
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
401
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
402
|
+
furnished to do so, subject to the following conditions:
|
|
403
|
+
|
|
404
|
+
The above copyright notice and this permission notice shall be included in all
|
|
405
|
+
copies or substantial portions of the Software.
|
|
406
|
+
|
|
407
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
408
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
409
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
410
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
411
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
412
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
413
|
+
SOFTWARE.
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
Các gói này là peer dependency **tuỳ chọn**: chỉ app import `@mapslibvn/react-native/expo` (dẫn
|
|
417
|
+
đường) mới cài; SDK không đóng gói mã của chúng.
|
|
418
|
+
|
|
388
419
|
## 5. Công cụ phía máy chủ (không phân phối, liệt kê để minh bạch)
|
|
389
420
|
|
|
390
421
|
Planetiler (Apache-2.0), tippecanoe (BSD-2-Clause), osmium-tool (GPL-3.0 — dùng như công cụ
|
|
391
422
|
dòng lệnh, không liên kết mã), pyosmium (BSD-2-Clause), DuckDB (MIT), PostgreSQL
|
|
392
|
-
(PostgreSQL License), PostGIS (GPL-2.0 — chạy như dịch vụ), Hono (MIT), cloudflared
|
|
423
|
+
(PostgreSQL License), PostGIS (GPL-2.0 — chạy như dịch vụ), Valhalla (MIT — engine chỉ đường, chạy như dịch vụ riêng trên máy chủ, không liên kết mã), Hono (MIT), cloudflared
|
|
393
424
|
(Apache-2.0), Astro Starlight (MIT), Vitest (MIT), Playwright (Apache-2.0).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Lang, Theme, PoiSource, PoiFeature, MapsLibVNClient } from '@mapslibvn/core';
|
|
2
|
-
export { AttributionResponse, ClientOptions, Lang, MapsLibVNClient, MapsLibVNError, PoiFeature, PoiSource, Theme, attributionHtml, attributionText, createClient, nameExpression } from '@mapslibvn/core';
|
|
1
|
+
import { Lang, DirectionsResponse, TravelMode, RouteProvider, DirectionsLang, PositionSource, NavigationThresholds, NavigationProgress, NavigationStatus, NavigationEvents, PositionError, Theme, PoiSource, PoiFeature, MapsLibVNClient, GeoFix } from '@mapslibvn/core';
|
|
2
|
+
export { Announcement, AttributionResponse, ClientOptions, DirectionsLang, DirectionsOptions, DirectionsResponse, GeoFix, Lang, ManeuverKind, MapsLibVNClient, MapsLibVNError, NAVIGATION_THRESHOLDS, NavigationEvents, NavigationProgress, NavigationStatus, NavigationThresholds, Navigator, PoiFeature, PoiSource, PositionError, PositionSource, Route, RouteLeg, RouteProvider, RouteStep, Theme, TravelMode, attributionHtml, attributionText, createClient, createNavigator, formatDistance, formatDistanceShort, nameExpression, simulateFixes } from '@mapslibvn/core';
|
|
3
3
|
import * as maplibregl from 'maplibre-gl';
|
|
4
4
|
import { Protocol } from 'pmtiles';
|
|
5
5
|
|
|
@@ -16,6 +16,69 @@ interface StyleLike {
|
|
|
16
16
|
/** Đổi nhãn sang ngôn ngữ khác lúc chạy. Bỏ qua lớp chủ quyền (luôn tiếng Việt) và nhãn không phải tên. */
|
|
17
17
|
declare function applyLanguage(gl: StyleLike, lang: Lang): void;
|
|
18
18
|
|
|
19
|
+
declare const ROUTE_SOURCE_ID = "mapslibvn-route";
|
|
20
|
+
declare const ROUTE_LAYER_IDS: {
|
|
21
|
+
readonly alt: "mapslibvn-route-alt";
|
|
22
|
+
readonly casing: "mapslibvn-route-casing";
|
|
23
|
+
readonly line: "mapslibvn-route-line";
|
|
24
|
+
readonly traveled: "mapslibvn-route-traveled";
|
|
25
|
+
};
|
|
26
|
+
interface RoutesLayer {
|
|
27
|
+
show(response: DirectionsResponse, opts?: {
|
|
28
|
+
active?: number;
|
|
29
|
+
markers?: boolean;
|
|
30
|
+
}): void;
|
|
31
|
+
setActive(index: number): void;
|
|
32
|
+
/** Chia tuyến chính tại (`shapeIndex`, `snapped`): trước là đã đi, sau là còn lại. */
|
|
33
|
+
setProgress(shapeIndex: number, snapped: [number, number]): void;
|
|
34
|
+
clear(): void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface NavigationStartOptions {
|
|
38
|
+
response: DirectionsResponse;
|
|
39
|
+
routeIndex?: number;
|
|
40
|
+
/** Mặc định `map.places`. */
|
|
41
|
+
provider?: RouteProvider;
|
|
42
|
+
/** Mặc định 'auto'. */
|
|
43
|
+
reroute?: 'auto' | 'manual';
|
|
44
|
+
/** Mặc định theo `lang` của map. */
|
|
45
|
+
lang?: DirectionsLang;
|
|
46
|
+
/** Mặc định true. */
|
|
47
|
+
voice?: boolean | {
|
|
48
|
+
rate?: number;
|
|
49
|
+
volume?: number;
|
|
50
|
+
};
|
|
51
|
+
/** Mặc định true; zoom theo phương tiện, pitch 45. */
|
|
52
|
+
follow?: boolean | {
|
|
53
|
+
zoom?: number;
|
|
54
|
+
pitch?: number;
|
|
55
|
+
padding?: maplibregl.PaddingOptions;
|
|
56
|
+
};
|
|
57
|
+
/** Mặc định `geolocationSource()`. */
|
|
58
|
+
source?: PositionSource;
|
|
59
|
+
thresholds?: Partial<NavigationThresholds>;
|
|
60
|
+
/** Mặc định true. */
|
|
61
|
+
wakeLock?: boolean;
|
|
62
|
+
}
|
|
63
|
+
interface WebNavigationEvents extends NavigationEvents {
|
|
64
|
+
followChange: boolean;
|
|
65
|
+
positionError: PositionError;
|
|
66
|
+
voiceUnavailable: undefined;
|
|
67
|
+
}
|
|
68
|
+
interface NavigationController {
|
|
69
|
+
start(opts: NavigationStartOptions): void;
|
|
70
|
+
/** Dừng GPS, giọng nói, wake lock, puck; KHÔNG xoá tuyến (gọi `map.routes.clear()` nếu cần). */
|
|
71
|
+
stop(): void;
|
|
72
|
+
recenter(): void;
|
|
73
|
+
reroute(): Promise<void>;
|
|
74
|
+
readonly state: NavigationProgress | null;
|
|
75
|
+
readonly status: NavigationStatus;
|
|
76
|
+
readonly following: boolean;
|
|
77
|
+
on<K extends keyof WebNavigationEvents>(event: K, handler: (e: WebNavigationEvents[K]) => void): void;
|
|
78
|
+
off<K extends keyof WebNavigationEvents>(event: K, handler: (e: WebNavigationEvents[K]) => void): void;
|
|
79
|
+
}
|
|
80
|
+
declare const FOLLOW_ZOOM: Readonly<Record<TravelMode, number>>;
|
|
81
|
+
|
|
19
82
|
interface ProtocolHost {
|
|
20
83
|
addProtocol(name: string, loadFn: Protocol['tile']): void;
|
|
21
84
|
}
|
|
@@ -49,6 +112,9 @@ interface MarkerOptions {
|
|
|
49
112
|
interface MapEvents {
|
|
50
113
|
poiClick: PoiFeature;
|
|
51
114
|
load: undefined;
|
|
115
|
+
routeClick: {
|
|
116
|
+
index: number;
|
|
117
|
+
};
|
|
52
118
|
}
|
|
53
119
|
interface Deps {
|
|
54
120
|
maplibre: typeof maplibregl & ProtocolHost;
|
|
@@ -56,6 +122,10 @@ interface Deps {
|
|
|
56
122
|
interface MapsLibVNMap {
|
|
57
123
|
gl: maplibregl.Map;
|
|
58
124
|
places: MapsLibVNClient;
|
|
125
|
+
/** Vẽ tuyến từ `DirectionsResponse` (spec B 5.2). */
|
|
126
|
+
routes: RoutesLayer;
|
|
127
|
+
/** Dẫn đường theo GPS (spec B 5.5). */
|
|
128
|
+
navigation: NavigationController;
|
|
59
129
|
addMarker(o: MarkerOptions): maplibregl.Marker;
|
|
60
130
|
fitBounds(bbox: [number, number, number, number], padding?: number): void;
|
|
61
131
|
flyTo(center: [number, number], zoom?: number): void;
|
|
@@ -88,4 +158,42 @@ declare class MapsLibVNAutocomplete extends HTMLElement {
|
|
|
88
158
|
}
|
|
89
159
|
declare function defineAutocomplete(): void;
|
|
90
160
|
|
|
91
|
-
|
|
161
|
+
interface GeolocationSourceOptions {
|
|
162
|
+
/** Mặc định true. */
|
|
163
|
+
enableHighAccuracy?: boolean;
|
|
164
|
+
/** Mặc định 1000 ms. */
|
|
165
|
+
maximumAge?: number;
|
|
166
|
+
/** Mặc định 10 000 ms. */
|
|
167
|
+
timeout?: number;
|
|
168
|
+
/** Tiêm cho test; mặc định `navigator.geolocation`. */
|
|
169
|
+
geolocation?: Geolocation | undefined;
|
|
170
|
+
}
|
|
171
|
+
declare function toGeoFix(position: GeolocationPosition): GeoFix;
|
|
172
|
+
/** `navigator.geolocation.watchPosition` → `GeoFix`. Cần HTTPS (trừ localhost). */
|
|
173
|
+
declare function geolocationSource(options?: GeolocationSourceOptions): PositionSource;
|
|
174
|
+
/** Phát lại chuỗi fix (ví dụ từ `simulateFixes`) theo chênh timestamp chia `rate`; `rate: 0` phát hết một tick. */
|
|
175
|
+
declare function playbackSource(fixes: readonly GeoFix[], options?: {
|
|
176
|
+
rate?: number;
|
|
177
|
+
}): PositionSource;
|
|
178
|
+
|
|
179
|
+
interface SpeechOptions {
|
|
180
|
+
lang: DirectionsLang;
|
|
181
|
+
rate?: number;
|
|
182
|
+
volume?: number;
|
|
183
|
+
/** Tiêm cho test; mặc định `speechSynthesis` toàn cục. */
|
|
184
|
+
synth?: SpeechSynthesis | undefined;
|
|
185
|
+
/** Gọi đúng một lần khi xác định không đọc được (không có API hoặc không có voice khớp). */
|
|
186
|
+
onUnavailable?: () => void;
|
|
187
|
+
}
|
|
188
|
+
interface Speech {
|
|
189
|
+
/** Cắt câu đang đọc nếu `priority` ≥ ưu tiên câu đó; thấp hơn thì xếp hàng. */
|
|
190
|
+
speak(text: string, priority: 1 | 2 | 3): void;
|
|
191
|
+
/** Đọc câu rỗng trong user gesture để iOS mở khoá âm thanh. */
|
|
192
|
+
warmUp(): void;
|
|
193
|
+
cancel(): void;
|
|
194
|
+
/** false khi không có API hoặc đã biết danh sách voice mà không có voice khớp. */
|
|
195
|
+
readonly available: boolean;
|
|
196
|
+
}
|
|
197
|
+
declare function createSpeech(opts: SpeechOptions): Speech;
|
|
198
|
+
|
|
199
|
+
export { type CreateMapOptions, FOLLOW_ZOOM, type GeolocationSourceOptions, type MapEvents, MapsLibVNAutocomplete, type MapsLibVNMap, type MarkerOptions, type NavigationController, type NavigationStartOptions, ROUTE_LAYER_IDS, ROUTE_SOURCE_ID, type RoutesLayer, type Speech, type SpeechOptions, type WebNavigationEvents, applyLanguage, createMap, createSpeech, defineAutocomplete, geolocationSource, playbackSource, toGeoFix };
|