@ingissa/navcore-mapbox 1.0.9 → 1.0.10

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 (3) hide show
  1. package/LICENSE +3 -3
  2. package/README.md +102 -0
  3. package/package.json +44 -44
package/LICENSE CHANGED
@@ -1,3 +1,3 @@
1
- Copyright (c) 2026 Abdelnasser Aitabi. All rights reserved.
2
-
3
- No license is granted except by separate written agreement.
1
+ Copyright (c) 2026 Abdelnasser Aitabi. All rights reserved.
2
+
3
+ No license is granted except by separate written agreement.
package/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # @ingissa/navcore-mapbox
2
+
3
+ [Official Website](https://navcore-web.vercel.app/)
4
+
5
+ > Mapbox Directions provider adapter for the NavCore navigation engine.
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@ingissa/navcore-mapbox)](https://www.npmjs.com/package/@ingissa/navcore-mapbox)
8
+ ![License](https://img.shields.io/badge/license-Proprietary-red)
9
+ [![TypeScript](https://img.shields.io/badge/TypeScript-strict-blue)](https://www.typescriptlang.org/)
10
+
11
+ ---
12
+
13
+ ## Overview
14
+
15
+ `@ingissa/navcore-mapbox` provides `MapboxDirectionsProvider`, an implementation of NavCore's `DirectionsProvider` interface targeting the Mapbox Directions API.
16
+
17
+ ### Key Capabilities
18
+ - **Direct NavCore integration**: Directly compatible with `createNavigationSession` and `createRoutePlan`.
19
+ - **Automatic waypoint chunking**: Transparently splits routes with more than 25 waypoints into chunks, querying each chunk and stitching geometry with the `OVERLAP_1` strategy.
20
+ - **Configurable routing profiles**: Supports `driving`, `driving-traffic`, `cycling`, and `walking`.
21
+
22
+ > [!NOTE]
23
+ > `@ingissa/navcore-mapbox` is a routing directions provider only. It does not export a map renderer. For map rendering in React Native, use `@rnmapbox/maps` or `react-native-maps` directly in your application components by consuming state from `useNavSelector()`.
24
+
25
+ ---
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ npm install @ingissa/navcore-mapbox @ingissa/navcore-core
31
+ ```
32
+
33
+ ### Peer Dependencies
34
+ - `@ingissa/navcore-core`: `^1.0.9` (required)
35
+ - `@rnmapbox/maps`: `>=10.0.0` (optional, for React Native applications)
36
+
37
+ ---
38
+
39
+ ## Quickstart
40
+
41
+ ```typescript
42
+ import { createNavigationSession } from '@ingissa/navcore-core';
43
+ import { MapboxDirectionsProvider } from '@ingissa/navcore-mapbox';
44
+
45
+ // Initialize Mapbox provider with your access token
46
+ const provider = new MapboxDirectionsProvider({
47
+ accessToken: 'pk.eyJ1...',
48
+ profile: 'driving-traffic', // 'driving' | 'driving-traffic' | 'cycling' | 'walking'
49
+ maxWaypointsPerChunk: 25, // Default: 25 (Mapbox API limit)
50
+ });
51
+
52
+ // Pass to a NavigationSession
53
+ const nav = createNavigationSession({
54
+ provider,
55
+ providerName: 'mapbox',
56
+ engineOptions: { isDev: true },
57
+ });
58
+
59
+ // Fetch route and start navigation
60
+ const plan = await nav.navigate({
61
+ origin: [2.3522, 48.8566],
62
+ destination: [2.3009, 48.8741],
63
+ });
64
+
65
+ console.log(`Route loaded: ${plan.distanceM}m, duration: ${plan.durationS}s`);
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Standalone Usage
71
+
72
+ ```typescript
73
+ import { MapboxDirectionsProvider } from '@ingissa/navcore-mapbox';
74
+
75
+ const provider = new MapboxDirectionsProvider({
76
+ accessToken: process.env.MAPBOX_TOKEN!,
77
+ });
78
+
79
+ const result = await provider.getRoute([
80
+ [2.3522, 48.8566],
81
+ [2.3300, 48.8650],
82
+ [2.3009, 48.8741],
83
+ ]);
84
+
85
+ console.log('Coordinates:', result.geometry.length);
86
+ console.log('Distance in metres:', result.distance);
87
+ console.log('Duration in seconds:', result.duration);
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Documentation
93
+
94
+ - [Directions Providers Guide](../../docs/directions-providers.md)
95
+ - [API Reference](../../docs/api-reference/navcore-mapbox.md)
96
+ - [Official Website](https://navcore-web.vercel.app/)
97
+
98
+ ---
99
+
100
+ ## Licensing
101
+
102
+ Proprietary software. Copyright (c) 2026 Abdelnasser Aitabi. All rights reserved. No license is granted except by separate written agreement.
package/package.json CHANGED
@@ -1,44 +1,44 @@
1
- {
2
- "name": "@ingissa/navcore-mapbox",
3
- "version": "1.0.9",
4
- "description": "Mapbox GL adapter for NavCore — renderer and directions provider.",
5
- "author": "Ingissa <8abnav@gmail.com>",
6
- "license": "SEE LICENSE IN LICENSE",
7
- "homepage": "https://navcore-web.vercel.app/",
8
- "main": "dist/index.js",
9
- "module": "dist/index.mjs",
10
- "types": "dist/index.d.ts",
11
- "exports": {
12
- ".": {
13
- "types": "./dist/index.d.ts",
14
- "import": "./dist/index.mjs",
15
- "require": "./dist/index.js"
16
- }
17
- },
18
- "files": [
19
- "dist",
20
- "LICENSE"
21
- ],
22
- "sideEffects": false,
23
- "publishConfig": {
24
- "access": "public"
25
- },
26
- "engines": {
27
- "node": ">=16"
28
- },
29
- "scripts": {
30
- "build": "tsup",
31
- "lint": "tsc --noEmit",
32
- "prepublishOnly": "npm run build --prefix ../.. && node ../../scripts/check-release.mjs"
33
- },
34
- "peerDependencies": {
35
- "@ingissa/navcore-core": "^1.0.9",
36
- "@rnmapbox/maps": ">=10.0.0"
37
- },
38
- "peerDependenciesMeta": {
39
- "@rnmapbox/maps": {
40
- "optional": true
41
- }
42
- },
43
- "dependencies": {}
44
- }
1
+ {
2
+ "name": "@ingissa/navcore-mapbox",
3
+ "version": "1.0.10",
4
+ "description": "Mapbox GL adapter for NavCore — renderer and directions provider.",
5
+ "author": "Ingissa <8abnav@gmail.com>",
6
+ "license": "SEE LICENSE IN LICENSE",
7
+ "homepage": "https://navcore-web.vercel.app/",
8
+ "main": "dist/index.js",
9
+ "module": "dist/index.mjs",
10
+ "types": "dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.mjs",
15
+ "require": "./dist/index.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "LICENSE"
21
+ ],
22
+ "sideEffects": false,
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "engines": {
27
+ "node": ">=16"
28
+ },
29
+ "scripts": {
30
+ "build": "tsup",
31
+ "lint": "tsc --noEmit",
32
+ "prepublishOnly": "npm run build --prefix ../.. && node ../../scripts/check-release.mjs"
33
+ },
34
+ "peerDependencies": {
35
+ "@ingissa/navcore-core": "^1.0.10",
36
+ "@rnmapbox/maps": ">=10.0.0"
37
+ },
38
+ "peerDependenciesMeta": {
39
+ "@rnmapbox/maps": {
40
+ "optional": true
41
+ }
42
+ },
43
+ "dependencies": {}
44
+ }