wovvmap-webview-bridge 1.0.8 → 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.
- package/README.md +210 -213
- package/dist/handlers/WebBridgeHandlers.d.ts.map +1 -1
- package/dist/handlers/WebBridgeHandlers.js +29 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/types/BridgeMessage.d.ts +102 -0
- package/dist/types/BridgeMessage.js +2 -0
- package/dist/types/NodePoint.d.ts +36 -0
- package/dist/types/NodePoint.js +2 -0
- package/dist/types/PathFindingResult.d.ts +6 -0
- package/dist/types/PathFindingResult.js +2 -0
- package/dist/types/types.d.ts +56 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/webviewBridge/BridgeService.d.ts +6 -0
- package/dist/webviewBridge/BridgeService.d.ts.map +1 -1
- package/dist/webviewBridge/BridgeService.js +20 -0
- package/dist/webviewBridge/BridgeStorage.d.ts +17 -6
- package/dist/webviewBridge/BridgeStorage.d.ts.map +1 -1
- package/dist/webviewBridge/BridgeStorage.js +19 -4
- package/dist/webviewBridge/WebViewScreen.d.ts.map +1 -1
- package/dist/webviewBridge/WebViewScreen.js +1 -2
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,213 +1,210 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
## License
|
|
212
|
-
|
|
213
|
-
MIT © Your Name
|
|
1
|
+
# React Native WebView Bridge
|
|
2
|
+
|
|
3
|
+
A lightweight and strongly typed bridge for **React Native + WebView** communication.
|
|
4
|
+
It provides an out-of-the-box `<WebViewScreen />`, helpers for sending events, a global store with Zustand, and strongly typed message contracts.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## ✨ Features
|
|
9
|
+
|
|
10
|
+
- 📱 **WebView wrapper**: `<WebViewScreen />` ready to use.
|
|
11
|
+
- 🔄 **Bridge service actions** for all map/direction operations.
|
|
12
|
+
- 🗂 **Typed handlers** for Web → React Native communication.
|
|
13
|
+
- 📦 **State management** using Zustand (`BridgeStorage`).
|
|
14
|
+
- 🧩 **TypeScript auto-imports** for events, node data, and navigation state.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 📦 Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install react-native-webview zustand
|
|
22
|
+
# or
|
|
23
|
+
yarn add react-native-webview zustand
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 🚀 Usage
|
|
29
|
+
|
|
30
|
+
### 1. Render the WebView
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import React from "react";
|
|
34
|
+
import { WebViewScreen } from "your-bridge-package";
|
|
35
|
+
|
|
36
|
+
export default function App() {
|
|
37
|
+
return <WebViewScreen url="https://your-map-app-url.com" />;
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### 2. Sending Messages (React Native → Web)
|
|
44
|
+
|
|
45
|
+
All helper methods are provided via `BridgeService.ts`.
|
|
46
|
+
They wrap `sendToWeb(...)` and ensure correct **OutgoingMessage** format.
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import {
|
|
50
|
+
sendStartPointToBridge,
|
|
51
|
+
sendEndPointToBridge,
|
|
52
|
+
sendActiveFloorToBridge,
|
|
53
|
+
sendPathNextBtnClick,
|
|
54
|
+
sendPathPreBtnClick,
|
|
55
|
+
sendPathFinishBtnClick,
|
|
56
|
+
sendSelectCategory,
|
|
57
|
+
sendZoomIn,
|
|
58
|
+
sendZoomOut,
|
|
59
|
+
sendClearStartAndEndPoint,
|
|
60
|
+
sendPathFilter,
|
|
61
|
+
sendGetDirectionToBridge,
|
|
62
|
+
} from "your-bridge-package";
|
|
63
|
+
|
|
64
|
+
// Example usage
|
|
65
|
+
sendStartPointToBridge("A1"); // Set start node
|
|
66
|
+
sendEndPointToBridge("B5"); // Set end node
|
|
67
|
+
sendActiveFloorToBridge(2); // Switch active floor
|
|
68
|
+
sendPathNextBtnClick(); // Go to next step in navigation
|
|
69
|
+
sendPathPreBtnClick(); // Go to previous step
|
|
70
|
+
sendPathFinishBtnClick(); // End navigation
|
|
71
|
+
sendSelectCategory("Food"); // Highlight category
|
|
72
|
+
sendZoomIn(); // Zoom in on map
|
|
73
|
+
sendZoomOut(); // Zoom out
|
|
74
|
+
sendClearStartAndEndPoint(); // Reset start/end
|
|
75
|
+
sendPathFilter(); // Apply path filters (lift/escalator)
|
|
76
|
+
sendGetDirectionToBridge(); // Request navigation directions
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### 3. Handling Messages (Web → React Native)
|
|
82
|
+
|
|
83
|
+
The bridge supports typed incoming messages.
|
|
84
|
+
You can register handlers for specific events using `registerBridgeHandler`.
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import { registerBridgeHandler } from "your-bridge-package";
|
|
88
|
+
|
|
89
|
+
registerBridgeHandler("isSceneClick", (payload) => {
|
|
90
|
+
console.log("Scene clicked:", payload);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
registerBridgeHandler("isShapClick", (payload) => {
|
|
94
|
+
console.log("Shape clicked:", payload.value);
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Internally, all other events are stored inside the **Zustand store**.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### 4. Accessing State
|
|
103
|
+
|
|
104
|
+
The `BridgeStorage` Zustand store automatically syncs WebView state.
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
import { bridgeStorage } from "your-bridge-package";
|
|
108
|
+
|
|
109
|
+
const state = bridgeStorage((s) => ({
|
|
110
|
+
isMapLoaded: s.isMapLoaded,
|
|
111
|
+
activeFloor: s.activeFloor,
|
|
112
|
+
searchablePoints: s.searchablePoints,
|
|
113
|
+
stapByStapList: s.stapByStapList,
|
|
114
|
+
}));
|
|
115
|
+
|
|
116
|
+
console.log(state);
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Available fields:
|
|
120
|
+
- `isBridgeLoaded`
|
|
121
|
+
- `isMapLoaded`
|
|
122
|
+
- `searchablePoints`
|
|
123
|
+
- `activeFloor`
|
|
124
|
+
- `elevator`, `escalator`
|
|
125
|
+
- `floorImages`
|
|
126
|
+
- `stapByStapList`
|
|
127
|
+
- `nextPreState`
|
|
128
|
+
- `pointsByKey`
|
|
129
|
+
- `categoryList`
|
|
130
|
+
- `allCategoryNodes`
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 🧩 Types
|
|
135
|
+
|
|
136
|
+
Types are exported for safer development and auto-import convenience.
|
|
137
|
+
|
|
138
|
+
### `IncomingMessage` (Web → RN)
|
|
139
|
+
```ts
|
|
140
|
+
type IncomingMessage =
|
|
141
|
+
| { type: "event"; key: "mapLoaded"; value: boolean; file: string }
|
|
142
|
+
| { type: "event"; key: "isConnection"; value: boolean; file: string }
|
|
143
|
+
| { type: "event"; key: "_searchablePoints"; value: NodePoint[]; file: string }
|
|
144
|
+
| { type: "event"; key: "Category"; value: Category[]; file: string }
|
|
145
|
+
| { type: "event"; key: "_allCategory"; value: Record<string, NodePoint[]>; file: string }
|
|
146
|
+
| { type: "event"; key: "_activeFloor"; value: number; file: string }
|
|
147
|
+
| { type: "event"; key: "FloorImg"; value: FloorImage[]; file: string }
|
|
148
|
+
| { type: "event"; key: "isSceneClick"; file: string }
|
|
149
|
+
| { type: "event"; key: "isShapClick"; value: NodePoint; file: string }
|
|
150
|
+
| { type: "event"; key: "stapByStapList"; value: StepInstruction[]; file: string }
|
|
151
|
+
| { type: "event"; key: "pathNextPreState"; value: NavState; file: string };
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### `OutgoingMessage` (RN → Web)
|
|
155
|
+
```ts
|
|
156
|
+
type OutgoingMessage =
|
|
157
|
+
| { type: "event"; key: "setStartPoint"; value: string; file: string }
|
|
158
|
+
| { type: "event"; key: "setEndPoint"; value: string; file: string }
|
|
159
|
+
| { type: "event"; key: "setActiveFloor"; value: number; file: string }
|
|
160
|
+
| { type: "event"; key: "pathNextBtnClick"; file: string }
|
|
161
|
+
| { type: "event"; key: "pathPreBtnClick"; file: string }
|
|
162
|
+
| { type: "event"; key: "pathFinishBtnClick"; file: string }
|
|
163
|
+
| { type: "event"; key: "setSelectCatedory"; value: string | null; file: string }
|
|
164
|
+
| { type: "event"; key: "zoomIn"; file: string }
|
|
165
|
+
| { type: "event"; key: "zoomOut"; file: string }
|
|
166
|
+
| { type: "event"; key: "clearStartAndEndPoint"; file: string }
|
|
167
|
+
| { type: "event"; key: "setPathFilter"; value: filterPath; file: string }
|
|
168
|
+
| { type: "event"; key: "getDirection"; file: string }
|
|
169
|
+
| { type: "event"; key: "setMapTheme"; value: Theme | null; file: string }
|
|
170
|
+
| { type: "event"; key: "navigateTo"; value: string; file: string };
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### `NodePoint`
|
|
174
|
+
Represents a searchable location on the map, with properties like `LocationName`, `Category`, `shape[]`, `logo`, etc.
|
|
175
|
+
|
|
176
|
+
### `Category`
|
|
177
|
+
Represents a category with `name`, `Description`, and `color`.
|
|
178
|
+
|
|
179
|
+
### `FloorImage`
|
|
180
|
+
Holds metadata about floors (name, url, index, etc).
|
|
181
|
+
|
|
182
|
+
### `StepInstruction`
|
|
183
|
+
Represents a step in navigation (`instruction`, `distance`, `icon`).
|
|
184
|
+
|
|
185
|
+
### `NavState`
|
|
186
|
+
Navigation state info (current floor index, step index, prev/next availability).
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 📖 File Structure
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
src/
|
|
194
|
+
├── index.ts # Entry exports
|
|
195
|
+
├── webviewBridge/
|
|
196
|
+
│ ├── WebViewScreen.tsx # <WebView /> wrapper
|
|
197
|
+
│ ├── BridgeService.ts # Actions (sendToWeb wrappers)
|
|
198
|
+
│ ├── BridgeStorage.ts # Zustand store
|
|
199
|
+
│ ├── WebViewBridgeRef.ts # WebView ref manager
|
|
200
|
+
├── handlers/
|
|
201
|
+
│ └── WebBridgeHandlers.ts
|
|
202
|
+
├── types/
|
|
203
|
+
│ └── types.ts # Strongly typed contracts
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 🛡 License
|
|
209
|
+
|
|
210
|
+
MIT © 2025
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebBridgeHandlers.d.ts","sourceRoot":"","sources":["../../src/handlers/WebBridgeHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAmB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAI5D,MAAM,MAAM,eAAe,GAAG;IAC7B,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,cAAc,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC1F,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,aAAa,CAAC;QAAC,KAAK,EAAE,SAAS,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACzG,CAAC;AAGF,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,eAAe,CAAM,CAAC;AAK1D,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,MAAM,eAAe,EACnE,MAAM,CAAC,EACP,SAAS,eAAe,CAAC,CAAC,CAAC,SAG5B,CAAC;AAGF,eAAO,MAAM,mBAAmB,GAC9B,OAAO,mBAAmB,
|
|
1
|
+
{"version":3,"file":"WebBridgeHandlers.d.ts","sourceRoot":"","sources":["../../src/handlers/WebBridgeHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAmB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAI5D,MAAM,MAAM,eAAe,GAAG;IAC7B,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,cAAc,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC1F,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,aAAa,CAAC;QAAC,KAAK,EAAE,SAAS,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACzG,CAAC;AAGF,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,eAAe,CAAM,CAAC;AAK1D,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,MAAM,eAAe,EACnE,MAAM,CAAC,EACP,SAAS,eAAe,CAAC,CAAC,CAAC,SAG5B,CAAC;AAGF,eAAO,MAAM,mBAAmB,GAC9B,OAAO,mBAAmB,SA8C3B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BridgeStorage } from "../webviewBridge/BridgeStorage";
|
|
2
2
|
// ✅ 2. Global handler storage
|
|
3
3
|
export const eventHandlers = {};
|
|
4
4
|
// ✅ 4. Register handler function
|
|
@@ -7,27 +7,42 @@ export const registerBridgeHandler = (type, handler) => {
|
|
|
7
7
|
};
|
|
8
8
|
// ✅ 5. Main bridge handler
|
|
9
9
|
export const handleBridgeMessage = (event) => {
|
|
10
|
-
var _a, _b;
|
|
11
10
|
try {
|
|
12
11
|
const message = JSON.parse(event.nativeEvent.data);
|
|
12
|
+
const state = BridgeStorage.getState();
|
|
13
13
|
if (message.key === "mapLoaded")
|
|
14
|
-
|
|
14
|
+
state.setIsMapLoaded(message.value);
|
|
15
15
|
if (message.key === "isConnection")
|
|
16
|
-
|
|
17
|
-
if (message.key === "_searchablePoints")
|
|
18
|
-
|
|
16
|
+
state.setIsBridgeLoaded(message.value);
|
|
17
|
+
if (message.key === "_searchablePoints") {
|
|
18
|
+
const points = [...message.value];
|
|
19
|
+
points.sort((a, b) => {
|
|
20
|
+
var _a, _b, _c, _d;
|
|
21
|
+
const nameA = ((_b = (_a = a.LocationName) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b.trim().toLowerCase()) || "";
|
|
22
|
+
const nameB = ((_d = (_c = b.LocationName) === null || _c === void 0 ? void 0 : _c.text) === null || _d === void 0 ? void 0 : _d.trim().toLowerCase()) || "";
|
|
23
|
+
return nameA.localeCompare(nameB);
|
|
24
|
+
});
|
|
25
|
+
state.setSearchablePoints(points);
|
|
26
|
+
const map = new Map();
|
|
27
|
+
message.value.forEach(obj => {
|
|
28
|
+
if (obj.key) {
|
|
29
|
+
map.set(obj.key, obj);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
state.setPointsByKey(map);
|
|
33
|
+
}
|
|
19
34
|
if (message.key === "_activeFloor")
|
|
20
|
-
|
|
35
|
+
state.setActiveFloor(message.value);
|
|
21
36
|
if (message.key === "FloorImg")
|
|
22
|
-
|
|
23
|
-
if (message.key === "isSceneClick")
|
|
24
|
-
(_a = eventHandlers[message.key]) === null || _a === void 0 ? void 0 : _a.call(eventHandlers, message);
|
|
25
|
-
if (message.key === "isShapClick")
|
|
26
|
-
(_b = eventHandlers[message.key]) === null || _b === void 0 ? void 0 : _b.call(eventHandlers, message);
|
|
37
|
+
state.setFloorImages(message.value);
|
|
27
38
|
if (message.key === "stapByStapList")
|
|
28
|
-
|
|
39
|
+
state.setStapByStapList(message.value);
|
|
29
40
|
if (message.key === "pathNextPreState")
|
|
30
|
-
|
|
41
|
+
state.setNextPreState(message.value);
|
|
42
|
+
if (message.key === "Category")
|
|
43
|
+
state.setCategoryList(message.value);
|
|
44
|
+
if (message.key === "_allCategory")
|
|
45
|
+
state.setAllCategoryNodes(message.value);
|
|
31
46
|
}
|
|
32
47
|
catch (e) {
|
|
33
48
|
console.error("WebView message error:", e);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { WebViewScreen } from "./webviewBridge/WebViewScreen";
|
|
2
2
|
export { sendStartPointToBridge, sendEndPointToBridge, sendActiveFloorToBridge, sendPathNextBtnClick, sendPathPreBtnClick, sendPathFinishBtnClick, } from "./webviewBridge/BridgeService";
|
|
3
|
-
export {
|
|
3
|
+
export { BridgeStorage } from "./webviewBridge/BridgeStorage";
|
|
4
4
|
export { registerBridgeHandler } from "./handlers/WebBridgeHandlers";
|
|
5
5
|
export type { IncomingMessage, OutgoingMessage, NodePoint, Category, FloorImage, StepInstruction, NavState, } from "./types/types";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG9D,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AAGvC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG9D,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AAGvC,OAAQ,EAAC,aAAa,EAAC,MAAO,+BAA+B,CAAC;AAG9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAGrE,YAAY,EACV,eAAe,EACf,eAAe,EACf,SAAS,EACT,QAAQ,EACR,UAAU,EACV,eAAe,EACf,QAAQ,GACT,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,6 @@ export { WebViewScreen } from "./webviewBridge/WebViewScreen";
|
|
|
3
3
|
// Bridge helpers (named exports)
|
|
4
4
|
export { sendStartPointToBridge, sendEndPointToBridge, sendActiveFloorToBridge, sendPathNextBtnClick, sendPathPreBtnClick, sendPathFinishBtnClick, } from "./webviewBridge/BridgeService";
|
|
5
5
|
// State/store
|
|
6
|
-
export {
|
|
6
|
+
export { BridgeStorage } from "./webviewBridge/BridgeStorage";
|
|
7
7
|
// Handlers
|
|
8
8
|
export { registerBridgeHandler } from "./handlers/WebBridgeHandlers";
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { SerializableNodePoint as NodePoint, SerializablePoint2D as Point2D } from "./NodePoint";
|
|
2
|
+
import { PathFindingResult } from "./PathFindingResult";
|
|
3
|
+
export interface NodePointOuterFiled {
|
|
4
|
+
point: NodePoint;
|
|
5
|
+
name: string;
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
z: number;
|
|
9
|
+
}
|
|
10
|
+
export interface Point3D extends Point2D {
|
|
11
|
+
z: number;
|
|
12
|
+
}
|
|
13
|
+
export interface NodeLineOuterFiled {
|
|
14
|
+
a: Point3D;
|
|
15
|
+
b: Point3D;
|
|
16
|
+
distance: number;
|
|
17
|
+
pointA: NodePoint;
|
|
18
|
+
pointB: NodePoint;
|
|
19
|
+
}
|
|
20
|
+
export type BridgeMessage = {
|
|
21
|
+
type: "event";
|
|
22
|
+
key: "floor";
|
|
23
|
+
value: number;
|
|
24
|
+
} | {
|
|
25
|
+
type: "event";
|
|
26
|
+
key: "pathData";
|
|
27
|
+
value: NodePoint[];
|
|
28
|
+
} | {
|
|
29
|
+
type: "event";
|
|
30
|
+
key: "PathFindingResult";
|
|
31
|
+
value: PathFindingResult;
|
|
32
|
+
} | {
|
|
33
|
+
type: "event";
|
|
34
|
+
key: "searchTextResult";
|
|
35
|
+
value: NodePoint[];
|
|
36
|
+
} | {
|
|
37
|
+
type: "event";
|
|
38
|
+
key: "shapeZoomAndSelect";
|
|
39
|
+
value: NodePoint | undefined;
|
|
40
|
+
} | {
|
|
41
|
+
type: "event";
|
|
42
|
+
key: "searchablePoints";
|
|
43
|
+
value: NodePoint[];
|
|
44
|
+
} | {
|
|
45
|
+
type: "event";
|
|
46
|
+
key: "nodePoint";
|
|
47
|
+
value: {
|
|
48
|
+
[key: string]: NodePointOuterFiled;
|
|
49
|
+
};
|
|
50
|
+
} | {
|
|
51
|
+
type: "event";
|
|
52
|
+
key: "nodeline";
|
|
53
|
+
value: {
|
|
54
|
+
[key: string]: NodeLineOuterFiled;
|
|
55
|
+
};
|
|
56
|
+
} | {
|
|
57
|
+
type: "event";
|
|
58
|
+
key: "categoryList";
|
|
59
|
+
value: {
|
|
60
|
+
[key: string]: NodePoint;
|
|
61
|
+
};
|
|
62
|
+
} | {
|
|
63
|
+
type: "event";
|
|
64
|
+
key: "floorInfo";
|
|
65
|
+
value: {
|
|
66
|
+
floors: {
|
|
67
|
+
index: number;
|
|
68
|
+
shortName: string;
|
|
69
|
+
fullName: string;
|
|
70
|
+
floorNumber: number;
|
|
71
|
+
}[];
|
|
72
|
+
defaultFloorIndex: number;
|
|
73
|
+
};
|
|
74
|
+
} | {
|
|
75
|
+
type: "event";
|
|
76
|
+
key: "to";
|
|
77
|
+
value: string;
|
|
78
|
+
} | {
|
|
79
|
+
type: "event";
|
|
80
|
+
key: "from";
|
|
81
|
+
value: string;
|
|
82
|
+
} | {
|
|
83
|
+
type: "event";
|
|
84
|
+
key: "elevator";
|
|
85
|
+
value: "true" | "false";
|
|
86
|
+
} | {
|
|
87
|
+
type: "event";
|
|
88
|
+
key: "escalator";
|
|
89
|
+
value: "true" | "false";
|
|
90
|
+
};
|
|
91
|
+
export type SendToWebMessage = {
|
|
92
|
+
type: "setNavigationData";
|
|
93
|
+
payload: {
|
|
94
|
+
from?: string;
|
|
95
|
+
to?: string;
|
|
96
|
+
elevator?: boolean;
|
|
97
|
+
escalator?: boolean;
|
|
98
|
+
floor?: number;
|
|
99
|
+
};
|
|
100
|
+
} | {
|
|
101
|
+
type: "condtiotion";
|
|
102
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type NavigationInstruction = "left" | "right" | "startPoint" | "endPoint" | "Take Elevator" | "Take Escalator" | "Exit Elevator" | "Exit Escalator" | null;
|
|
2
|
+
export type SerializablePoint2D = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
};
|
|
6
|
+
export type SerializableNodePoint = {
|
|
7
|
+
x?: number;
|
|
8
|
+
y?: number;
|
|
9
|
+
z?: number;
|
|
10
|
+
targetDist?: number;
|
|
11
|
+
close?: boolean;
|
|
12
|
+
elementTag?: string;
|
|
13
|
+
type?: string;
|
|
14
|
+
LeaseType?: string;
|
|
15
|
+
Category?: string;
|
|
16
|
+
color?: string;
|
|
17
|
+
Description?: string;
|
|
18
|
+
shape?: SerializablePoint2D[];
|
|
19
|
+
key?: string;
|
|
20
|
+
myAngle?: number;
|
|
21
|
+
NavigationInstruction?: NavigationInstruction;
|
|
22
|
+
distanceToNextPoint: number;
|
|
23
|
+
stepsToNextPoint: number;
|
|
24
|
+
floorBash?: boolean;
|
|
25
|
+
brand_Id?: string | null;
|
|
26
|
+
LocationName?: {
|
|
27
|
+
text?: string;
|
|
28
|
+
textColor?: string;
|
|
29
|
+
textSize?: string;
|
|
30
|
+
rotate?: number;
|
|
31
|
+
};
|
|
32
|
+
colleague?: {
|
|
33
|
+
name: string;
|
|
34
|
+
role?: string;
|
|
35
|
+
}[];
|
|
36
|
+
};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -85,6 +85,20 @@ export type NavState = {
|
|
|
85
85
|
isLastStep: boolean;
|
|
86
86
|
hasPath: boolean;
|
|
87
87
|
};
|
|
88
|
+
export type filterPath = {
|
|
89
|
+
elevator: boolean;
|
|
90
|
+
escalator: boolean;
|
|
91
|
+
stair: boolean;
|
|
92
|
+
};
|
|
93
|
+
export type Theme = {
|
|
94
|
+
"theme-path-color"?: string;
|
|
95
|
+
"theme-path-highlight-color"?: string;
|
|
96
|
+
"theme-anchor-store-color"?: string[];
|
|
97
|
+
"theme-platform-color"?: string;
|
|
98
|
+
"theme-endpoint-shape-color"?: string[];
|
|
99
|
+
"theme-startpoint-shape-color"?: string[];
|
|
100
|
+
"theme-shape-theme-color"?: string[];
|
|
101
|
+
};
|
|
88
102
|
export type IncomingMessage = {
|
|
89
103
|
type: "event";
|
|
90
104
|
key: "pong";
|
|
@@ -109,6 +123,11 @@ export type IncomingMessage = {
|
|
|
109
123
|
key: "Category";
|
|
110
124
|
value: Category[];
|
|
111
125
|
file: string;
|
|
126
|
+
} | {
|
|
127
|
+
type: "event";
|
|
128
|
+
key: "_allCategory";
|
|
129
|
+
value: Record<string, NodePoint[]>;
|
|
130
|
+
file: string;
|
|
112
131
|
} | {
|
|
113
132
|
type: "event";
|
|
114
133
|
key: "_activeFloor";
|
|
@@ -142,7 +161,7 @@ export type IncomingMessage = {
|
|
|
142
161
|
export type OutgoingMessage = {
|
|
143
162
|
type: "applyCSS";
|
|
144
163
|
selector: string;
|
|
145
|
-
style: Partial<
|
|
164
|
+
style: Partial<CSSStyleDeclaration>;
|
|
146
165
|
} | {
|
|
147
166
|
type: "event";
|
|
148
167
|
key: "ping";
|
|
@@ -175,5 +194,41 @@ export type OutgoingMessage = {
|
|
|
175
194
|
type: "event";
|
|
176
195
|
key: "pathFinishBtnClick";
|
|
177
196
|
file: string;
|
|
197
|
+
} | {
|
|
198
|
+
type: "event";
|
|
199
|
+
key: "setSelectCatedory";
|
|
200
|
+
value: string | null;
|
|
201
|
+
file: string;
|
|
202
|
+
} | {
|
|
203
|
+
type: "event";
|
|
204
|
+
key: "zoomIn";
|
|
205
|
+
file: string;
|
|
206
|
+
} | {
|
|
207
|
+
type: "event";
|
|
208
|
+
key: "zoomOut";
|
|
209
|
+
file: string;
|
|
210
|
+
} | {
|
|
211
|
+
type: "event";
|
|
212
|
+
key: "clearStartAndEndPoint";
|
|
213
|
+
file: string;
|
|
214
|
+
} | {
|
|
215
|
+
type: "event";
|
|
216
|
+
key: "setPathFilter";
|
|
217
|
+
value: filterPath;
|
|
218
|
+
file: string;
|
|
219
|
+
} | {
|
|
220
|
+
type: "event";
|
|
221
|
+
key: "getDirection";
|
|
222
|
+
file: string;
|
|
223
|
+
} | {
|
|
224
|
+
type: "event";
|
|
225
|
+
key: "setMapTheme";
|
|
226
|
+
file: string;
|
|
227
|
+
value: Theme | null;
|
|
228
|
+
} | {
|
|
229
|
+
type: "event";
|
|
230
|
+
key: "navigateTo";
|
|
231
|
+
value: string;
|
|
232
|
+
file: string;
|
|
178
233
|
};
|
|
179
234
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EA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C;IAAC,KAAK,EAAC,MAAM,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA"}
|
|
@@ -4,4 +4,10 @@ export declare const sendActiveFloorToBridge: (floorId: number) => void;
|
|
|
4
4
|
export declare const sendPathNextBtnClick: () => void;
|
|
5
5
|
export declare const sendPathPreBtnClick: () => void;
|
|
6
6
|
export declare const sendPathFinishBtnClick: () => void;
|
|
7
|
+
export declare const sendSelectCategory: (categgory: string | null) => void;
|
|
8
|
+
export declare const sendZoomIn: () => void;
|
|
9
|
+
export declare const sendZoomOut: () => void;
|
|
10
|
+
export declare const sendClearStartAndEndPoint: () => void;
|
|
11
|
+
export declare const sendPathFilter: () => void;
|
|
12
|
+
export declare const sendGetDirectionToBridge: () => void;
|
|
7
13
|
//# sourceMappingURL=BridgeService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BridgeService.d.ts","sourceRoot":"","sources":["../../src/webviewBridge/BridgeService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BridgeService.d.ts","sourceRoot":"","sources":["../../src/webviewBridge/BridgeService.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,GAAI,YAAY,MAAM,SAEtD,CAAA;AAGD,eAAO,MAAM,sBAAsB,GAAI,cAAc,MAAM,SAE1D,CAAA;AAED,eAAO,MAAM,uBAAuB,GAAI,SAAS,MAAM,SAEtD,CAAA;AAED,eAAO,MAAM,oBAAoB,YAEhC,CAAA;AACD,eAAO,MAAM,mBAAmB,YAE/B,CAAA;AAED,eAAO,MAAM,sBAAsB,YAElC,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,WAAW,MAAM,GAAG,IAAI,SAE1D,CAAA;AAGD,eAAO,MAAM,UAAU,YAEtB,CAAA;AAED,eAAO,MAAM,WAAW,YAEvB,CAAA;AAED,eAAO,MAAM,yBAAyB,YAErC,CAAA;AAED,eAAO,MAAM,cAAc,YAG1B,CAAA;AAGD,eAAO,MAAM,wBAAwB,YAEpC,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BridgeStorage } from "./BridgeStorage";
|
|
1
2
|
import { sendToWeb } from "./WebViewBridgeRef";
|
|
2
3
|
export const sendEndPointToBridge = (endPointId) => {
|
|
3
4
|
sendToWeb({ type: "event", key: "setEndPoint", value: endPointId, file: "BridgeService.ts" });
|
|
@@ -17,3 +18,22 @@ export const sendPathPreBtnClick = () => {
|
|
|
17
18
|
export const sendPathFinishBtnClick = () => {
|
|
18
19
|
sendToWeb({ type: "event", key: "pathFinishBtnClick", file: "BridgeService.ts" });
|
|
19
20
|
};
|
|
21
|
+
export const sendSelectCategory = (categgory) => {
|
|
22
|
+
sendToWeb({ type: "event", key: "setSelectCatedory", value: categgory, file: "BridgeService.ts" });
|
|
23
|
+
};
|
|
24
|
+
export const sendZoomIn = () => {
|
|
25
|
+
sendToWeb({ type: "event", key: "zoomIn", file: "BridgeService.ts" });
|
|
26
|
+
};
|
|
27
|
+
export const sendZoomOut = () => {
|
|
28
|
+
sendToWeb({ type: "event", key: "zoomOut", file: "BridgeService.ts" });
|
|
29
|
+
};
|
|
30
|
+
export const sendClearStartAndEndPoint = () => {
|
|
31
|
+
sendToWeb({ type: "event", key: "clearStartAndEndPoint", file: "BridgeService.ts" });
|
|
32
|
+
};
|
|
33
|
+
export const sendPathFilter = () => {
|
|
34
|
+
const { elevator, escalator } = BridgeStorage.getState();
|
|
35
|
+
sendToWeb({ type: "event", key: "setPathFilter", value: { elevator: elevator === "true", escalator: escalator === "true", stair: false }, file: "BridgeService.ts" });
|
|
36
|
+
};
|
|
37
|
+
export const sendGetDirectionToBridge = () => {
|
|
38
|
+
sendToWeb({ type: "event", key: "getDirection", file: "BridgeService.ts" });
|
|
39
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FloorImage, NavState, NodePoint, StepInstruction } from "../types/types";
|
|
1
|
+
import type { Category, FloorImage, NavState, NodePoint, StepInstruction } from "../types/types";
|
|
2
2
|
type BridgeStorage = {
|
|
3
3
|
isBridgeLoaded: boolean;
|
|
4
4
|
isMapLoaded: boolean;
|
|
@@ -9,11 +9,22 @@ type BridgeStorage = {
|
|
|
9
9
|
floorImages: FloorImage[];
|
|
10
10
|
stapByStapList: StepInstruction[];
|
|
11
11
|
nextPreState: NavState | null;
|
|
12
|
+
pointsByKey: Map<string, NodePoint>;
|
|
13
|
+
categoryList: Category[];
|
|
14
|
+
allCategoryNodes: Record<string, NodePoint[]>;
|
|
15
|
+
setIsBridgeLoaded: (val: boolean) => void;
|
|
16
|
+
setIsMapLoaded: (val: boolean) => void;
|
|
17
|
+
setSearchablePoints: (points: NodePoint[]) => void;
|
|
18
|
+
setActiveFloor: (floor: number) => void;
|
|
19
|
+
setElevator: (val: "true" | "false") => void;
|
|
20
|
+
setEscalator: (val: "true" | "false") => void;
|
|
21
|
+
setFloorImages: (imgs: FloorImage[]) => void;
|
|
22
|
+
setStapByStapList: (steps: StepInstruction[]) => void;
|
|
23
|
+
setNextPreState: (state: NavState | null) => void;
|
|
24
|
+
setPointsByKey: (map: Map<string, NodePoint>) => void;
|
|
25
|
+
setCategoryList: (list: Category[]) => void;
|
|
26
|
+
setAllCategoryNodes: (data: Record<string, NodePoint[]>) => void;
|
|
12
27
|
};
|
|
13
|
-
export declare
|
|
14
|
-
set<K extends keyof BridgeStorage>(key: K, value: BridgeStorage[K]): void;
|
|
15
|
-
onChange(callback: <K extends keyof BridgeStorage>(key: K, newValue: BridgeStorage[K], oldValue: BridgeStorage[K]) => void): () => void;
|
|
16
|
-
signal<K extends keyof BridgeStorage>(key: K): [BridgeStorage[K], (value: BridgeStorage[K]) => void];
|
|
17
|
-
};
|
|
28
|
+
export declare const BridgeStorage: import("zustand").UseBoundStore<import("zustand").StoreApi<BridgeStorage>>;
|
|
18
29
|
export {};
|
|
19
30
|
//# sourceMappingURL=BridgeStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BridgeStorage.d.ts","sourceRoot":"","sources":["../../src/webviewBridge/BridgeStorage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"BridgeStorage.d.ts","sourceRoot":"","sources":["../../src/webviewBridge/BridgeStorage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEhG,KAAK,aAAa,GAAG;IACnB,cAAc,EAAE,OAAO,CAAA;IACvB,WAAW,EAAE,OAAO,CAAA;IACpB,gBAAgB,EAAE,SAAS,EAAE,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAA;IAC1B,SAAS,EAAE,MAAM,GAAG,OAAO,CAAA;IAC3B,WAAW,EAAE,UAAU,EAAE,CAAA;IACzB,cAAc,EAAE,eAAe,EAAE,CAAA;IACjC,YAAY,EAAE,QAAQ,GAAG,IAAI,CAAA;IAC7B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IACnC,YAAY,EAAE,QAAQ,EAAE,CAAA;IACxB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAA;IAG7C,iBAAiB,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;IACzC,cAAc,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC,mBAAmB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,IAAI,CAAA;IAClD,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,KAAK,IAAI,CAAA;IAC5C,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,KAAK,IAAI,CAAA;IAC7C,cAAc,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,IAAI,CAAA;IAC5C,iBAAiB,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,IAAI,CAAA;IACrD,eAAe,EAAE,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAA;IACjD,cAAc,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,IAAI,CAAA;IACrD,eAAe,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAA;IAC3C,mBAAmB,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,KAAK,IAAI,CAAA;CACjE,CAAA;AAED,eAAO,MAAM,aAAa,4EA0BvB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
export const BridgeStorage = create((set) => ({
|
|
3
3
|
isBridgeLoaded: false,
|
|
4
4
|
isMapLoaded: false,
|
|
5
5
|
searchablePoints: [],
|
|
@@ -8,5 +8,20 @@ export let bridgeStorage = createStore({
|
|
|
8
8
|
escalator: "false",
|
|
9
9
|
floorImages: [],
|
|
10
10
|
stapByStapList: [],
|
|
11
|
-
nextPreState: null
|
|
12
|
-
|
|
11
|
+
nextPreState: null,
|
|
12
|
+
pointsByKey: new Map(),
|
|
13
|
+
categoryList: [],
|
|
14
|
+
allCategoryNodes: {},
|
|
15
|
+
setIsBridgeLoaded: (val) => set({ isBridgeLoaded: val }),
|
|
16
|
+
setIsMapLoaded: (val) => set({ isMapLoaded: val }),
|
|
17
|
+
setSearchablePoints: (points) => set({ searchablePoints: points }),
|
|
18
|
+
setActiveFloor: (floor) => set({ activeFloor: floor }),
|
|
19
|
+
setElevator: (val) => set({ elevator: val }),
|
|
20
|
+
setEscalator: (val) => set({ escalator: val }),
|
|
21
|
+
setFloorImages: (imgs) => set({ floorImages: imgs }),
|
|
22
|
+
setStapByStapList: (steps) => set({ stapByStapList: steps }),
|
|
23
|
+
setNextPreState: (state) => set({ nextPreState: state }),
|
|
24
|
+
setPointsByKey: (map) => set({ pointsByKey: map }),
|
|
25
|
+
setCategoryList: (list) => set({ categoryList: list }),
|
|
26
|
+
setAllCategoryNodes: (data) => set({ allCategoryNodes: data }),
|
|
27
|
+
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebViewScreen.d.ts","sourceRoot":"","sources":["../../src/webviewBridge/WebViewScreen.tsx"],"names":[],"mappings":"AAMA,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAGF,eAAO,MAAM,aAAa,GAAI,SAAS,KAAK,
|
|
1
|
+
{"version":3,"file":"WebViewScreen.d.ts","sourceRoot":"","sources":["../../src/webviewBridge/WebViewScreen.tsx"],"names":[],"mappings":"AAMA,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAGF,eAAO,MAAM,aAAa,GAAI,SAAS,KAAK,4CAuB3C,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { handleBridgeMessage } from "../handlers/WebBridgeHandlers";
|
|
3
|
-
import { webviewRef } from "./WebViewBridgeRef";
|
|
4
3
|
import { WebView } from 'react-native-webview';
|
|
5
4
|
export const WebViewScreen = ({ url }) => {
|
|
6
5
|
const onMessage = (event) => {
|
|
7
6
|
console.log("on message event", event);
|
|
8
7
|
handleBridgeMessage(event);
|
|
9
8
|
};
|
|
10
|
-
return (_jsx(WebView, {
|
|
9
|
+
return (_jsx(WebView, { source: { uri: url }, onMessage: onMessage, onLoadStart: () => console.log("WebView: load start", url), onLoadEnd: () => console.log("WebView: load end"), onLoadProgress: ({ nativeEvent }) => console.log("WebView: progress", nativeEvent.progress), onError: (e) => console.warn("WebView error:", e.nativeEvent), style: { flex: 1 } }));
|
|
11
10
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wovvmap-webview-bridge",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -9,19 +9,19 @@
|
|
|
9
9
|
"default": "./dist/index.js"
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
|
-
"files": [
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
13
15
|
"sideEffects": false,
|
|
14
16
|
"scripts": {
|
|
15
|
-
|
|
17
|
+
"build": "tsc -p tsconfig.json"
|
|
16
18
|
},
|
|
17
19
|
"peerDependencies": {
|
|
18
|
-
"react": "^19.1.0",
|
|
19
|
-
"react-native": "^0.80.1",
|
|
20
20
|
"react-native-webview": "^13.15.0",
|
|
21
|
-
"
|
|
21
|
+
"zustand": "^5.0.8"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"@types/react": "^19.1.8",
|
|
25
|
+
"typescript": "^5.5.0"
|
|
26
26
|
}
|
|
27
27
|
}
|