@mappedin/react-native-sdk 6.0.0-alpha.8 → 6.0.0-beta.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.
@@ -0,0 +1,45 @@
1
+ import type { Coordinate, TAddModelOptions } from '@mappedin/mappedin-js';
2
+ import type { Mappedin } from '../types';
3
+ export interface ModelProps {
4
+ /**
5
+ * The target coordinate where the model should be placed
6
+ */
7
+ target: Coordinate;
8
+ /**
9
+ * URL of the 3D model (GLTF or GLB format)
10
+ */
11
+ url: string;
12
+ /**
13
+ * Optional model options
14
+ */
15
+ options?: TAddModelOptions;
16
+ /**
17
+ * Callback called when model is successfully created
18
+ * @param model - The model object
19
+ */
20
+ onLoad?: (model: Mappedin.Model) => void;
21
+ }
22
+ /**
23
+ * Model component for React Native.
24
+ *
25
+ * Displays a 3D model on the map at the specified coordinate.
26
+ * The model is managed through the WebView bridge and communicates with the core SDK.
27
+ * Models are in GLTF or GLB format and can be scaled, rotated, and positioned.
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * <Model
32
+ * target={coordinate}
33
+ * url="https://example.com/model.glb"
34
+ * options={{
35
+ * scale: [2, 2, 2],
36
+ * rotation: [0, 90, 0],
37
+ * opacity: 0.8,
38
+ * interactive: true
39
+ * }}
40
+ * onLoad={(model) => console.log('Model loaded:', model)}
41
+ * />
42
+ * ```
43
+ */
44
+ export declare function Model(props: ModelProps): null;
45
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/components/model.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,WAAW,UAAU;IAC1B;;OAEG;IACH,MAAM,EAAE,UAAU,CAAC;IACnB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,KAAK,IAAI,CAAC;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,QA2DtC"}
@@ -0,0 +1,42 @@
1
+ import type { Coordinate, TAddPathOptions } from '@mappedin/mappedin-js';
2
+ import type { Mappedin } from '../types';
3
+ export interface PathProps {
4
+ /**
5
+ * Array of coordinates to form the path
6
+ */
7
+ coordinate: Coordinate[];
8
+ /**
9
+ * Optional path options
10
+ */
11
+ options?: TAddPathOptions;
12
+ /**
13
+ * Callback called when path is successfully created
14
+ * @param path - The path object
15
+ */
16
+ onLoad?: (path: Mappedin.Path) => void;
17
+ /**
18
+ * Callback called when path animation completes
19
+ */
20
+ onDrawComplete?: () => void;
21
+ }
22
+ /**
23
+ * Path component for React Native.
24
+ *
25
+ * Displays a path on the map using the provided coordinates.
26
+ * The path is managed through the WebView bridge and communicates with the core SDK.
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * const directions = await mapView.getDirections(startSpace, endSpace);
31
+ * return directions ? (
32
+ * <Path
33
+ * coordinate={directions.coordinates}
34
+ * options={{ color: 'blue', width: 1 }}
35
+ * onLoad={(path) => console.log('Path loaded:', path)}
36
+ * onDrawComplete={() => console.log('Path drawing complete')}
37
+ * />
38
+ * ) : null;
39
+ * ```
40
+ */
41
+ export declare function Path(props: PathProps): null;
42
+ //# sourceMappingURL=path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/components/path.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,WAAW,SAAS;IACzB;;OAEG;IACH,UAAU,EAAE,UAAU,EAAE,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,KAAK,IAAI,CAAC;IACvC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,QAmEpC"}
@@ -0,0 +1,54 @@
1
+ import type { Mappedin } from '../types';
2
+ type Add = Mappedin.MapView['Shapes']['add'];
3
+ export interface ShapeProps {
4
+ /**
5
+ * GeoJSON FeatureCollection containing the geometry for the shape
6
+ */
7
+ geometry: Parameters<Add>[0];
8
+ /**
9
+ * Style configuration for the shape
10
+ */
11
+ style: Parameters<Add>[1];
12
+ /**
13
+ * Optional floor to add the shape to
14
+ */
15
+ floor?: Parameters<Add>[2];
16
+ /**
17
+ * Callback called when shape is successfully created
18
+ * @param shape - The shape object
19
+ */
20
+ onLoad?: (shape: Mappedin.Shape) => void;
21
+ }
22
+ /**
23
+ * Shape component for React Native.
24
+ *
25
+ * Displays custom GeoJSON geometry on the map using the provided style.
26
+ * The shape is managed through the WebView bridge and communicates with the core SDK.
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * const geometry = {
31
+ * type: 'FeatureCollection',
32
+ * features: [{
33
+ * type: 'Feature',
34
+ * geometry: {
35
+ * type: 'Polygon',
36
+ * coordinates: [[[-80.521, 43.466], [-80.521, 43.465], [-80.520, 43.465], [-80.520, 43.466], [-80.521, 43.466]]]
37
+ * },
38
+ * properties: { id: 'my-shape' }
39
+ * }]
40
+ * };
41
+ *
42
+ * return (
43
+ * <Shape
44
+ * geometry={geometry}
45
+ * style={{ color: 'blue', height: 2, opacity: 0.7 }}
46
+ * floor={currentFloor}
47
+ * onLoad={(shape) => console.log('Shape loaded:', shape)}
48
+ * />
49
+ * );
50
+ * ```
51
+ */
52
+ export declare function Shape(props: ShapeProps): null;
53
+ export {};
54
+ //# sourceMappingURL=shape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shape.d.ts","sourceRoot":"","sources":["../../src/components/shape.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,KAAK,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC;AAC7C,MAAM,WAAW,UAAU;IAC1B;;OAEG;IACH,QAAQ,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7B;;OAEG;IACH,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,KAAK,IAAI,CAAC;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,QAkEtC"}
@@ -0,0 +1,89 @@
1
+ import type { TEvents } from '@mappedin/mappedin-js';
2
+ /**
3
+ * # Event Management System
4
+ *
5
+ * The React Native SDK uses a sophisticated event management system that bridges events
6
+ * between the WebView (where the actual map runs) and the React Native application.
7
+ *
8
+ * ## Architecture Overview
9
+ *
10
+ * The event system follows a hub-and-spoke pattern with these key principles:
11
+ *
12
+ * ### 1. Single WebView Subscription Per Event Type
13
+ * - The WebView only maintains **one subscription** per event type (e.g., 'click', 'hover')
14
+ * - This prevents duplicate event listeners and reduces overhead in the WebView
15
+ * - Event subscription is managed via the bridge communication layer
16
+ *
17
+ * ### 2. Multiple React Native Callbacks Per Event
18
+ * - Multiple React Native components can register callbacks for the same event type
19
+ * - When the WebView event fires, React Native receives it via the bridge
20
+ * - React Native then fires **all registered callbacks** for that event type
21
+ *
22
+ * ## Event Flow
23
+ *
24
+ * ```
25
+ * ┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
26
+ * │ React Native │ │ Bridge │ │ WebView │
27
+ * │ Components │ │ Communication │ │ (Mappedin SDK) │
28
+ * └─────────────────┘ └──────────────────┘ └─────────────────────┘
29
+ * │ │ │
30
+ * │ useEvent('click', cb1)│ │
31
+ * ├──────────────────────>│ │
32
+ * │ │ │
33
+ * │ │ Subscribe to 'click' │
34
+ * │ ├─────────────────────-─>│
35
+ * │ │ │
36
+ * │ │ │ (Only once per
37
+ * │ useEvent('click', cb2)│ │ event type)
38
+ * ├──────────────────────>│ │
39
+ * │ │ │
40
+ * │ │ (No new subscription) │
41
+ * │ │ Click Event Fired │
42
+ * │ │<────────────────────-──┤
43
+ * │ cb1(eventData) │ │
44
+ * │<──────────────────────┤ │
45
+ * │ cb2(eventData) │ │
46
+ * │<──────────────────────┤ │
47
+ * ```
48
+ * @internal This module is used internally by the SDK
49
+ */
50
+ type TEventPayload<EventName extends keyof TEvents> = TEvents[EventName] extends {
51
+ data: null;
52
+ } ? TEvents[EventName]['data'] : TEvents[EventName];
53
+ type EventCallback<T extends keyof TEvents> = (payload: TEventPayload<T>) => void;
54
+ /**
55
+ * Creates an event control system for managing event callbacks.
56
+ * This is used internally to manage event subscriptions and callbacks.
57
+ *
58
+ * @internal
59
+ */
60
+ export declare function createEventControl(): {
61
+ /**
62
+ * Register a callback for a specific event type
63
+ * @internal
64
+ */
65
+ registerEventCallback<T extends keyof TEvents>(event: T, callback: EventCallback<T>): void;
66
+ /**
67
+ * Unregister a callback for a specific event type
68
+ * @internal
69
+ */
70
+ unregisterEventCallback<T extends keyof TEvents>(event: T, callback: EventCallback<T>): void;
71
+ /**
72
+ * Check if there are any callbacks registered for a specific event type
73
+ * @internal
74
+ */
75
+ hasEventCallbacks<T extends keyof TEvents>(event: T): boolean;
76
+ /**
77
+ * Trigger all callbacks for a specific event with the given payload
78
+ * @internal
79
+ */
80
+ handleEvent<T extends keyof TEvents>(event: T, payload: TEventPayload<T>): void;
81
+ /**
82
+ * Destroy all event callbacks
83
+ * @internal
84
+ */
85
+ destroy(): void;
86
+ };
87
+ export type EventControl = ReturnType<typeof createEventControl>;
88
+ export {};
89
+ //# sourceMappingURL=event-control.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-control.d.ts","sourceRoot":"","sources":["../../src/controls/event-control.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,KAAK,aAAa,CAAC,SAAS,SAAS,MAAM,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC,SAAS;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,GAC5F,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,GAC1B,OAAO,CAAC,SAAS,CAAC,CAAC;AAEtB,KAAK,aAAa,CAAC,CAAC,SAAS,MAAM,OAAO,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAElF;;;;;GAKG;AACH,wBAAgB,kBAAkB;IAKhC;;;OAGG;0BACmB,CAAC,SAAS,MAAM,OAAO,SAAS,CAAC,YAAY,aAAa,CAAC,CAAC,CAAC;IAYnF;;;OAGG;4BACqB,CAAC,SAAS,MAAM,OAAO,SAAS,CAAC,YAAY,aAAa,CAAC,CAAC,CAAC;IAYrF;;;OAGG;sBACe,CAAC,SAAS,MAAM,OAAO,SAAS,CAAC,GAAG,OAAO;IAO7D;;;OAGG;gBACS,CAAC,SAAS,MAAM,OAAO,SAAS,CAAC,WAAW,aAAa,CAAC,CAAC,CAAC;IAgBxE;;;OAGG;;EAKJ;AAED,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,360 @@
1
+ import type { MapView, TUpdateState, Directions, TNavigationOptions, TAddMarkerOptions, TStateChangedInternalPayload, MapElementsWithState } from '@mappedin/mappedin-js';
2
+ import type { UseBridgeHook } from '../hooks/use-bridge.js';
3
+ import type { Mappedin } from '../types.js';
4
+ import type { EventControl } from './event-control.js';
5
+ /**
6
+ * Configuration for a navigation marker's template and display options.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // Basic distance marker
11
+ * {
12
+ * template: 'Distance: {{instruction.distance}}m',
13
+ * options: { interactive: true, rank: 'high' }
14
+ * }
15
+ *
16
+ * // Turn instruction marker
17
+ * {
18
+ * template: 'Turn {{instruction.action.bearing}} in {{instruction.distance}}m',
19
+ * options: { rank: 'medium' }
20
+ * }
21
+ * ```
22
+ */
23
+ export type NavigationMarkerConfig = {
24
+ /**
25
+ * Handlebars templates receive objects with an 'instruction' property containing TDirectionInstruction data. @see {@link TDirectionInstruction} in @mappedin/mappedin-js for full type details
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * {
30
+ * template: '<div>Turn {{instruction.action.bearing}} in {{instruction.distance}}m</div>',
31
+ * }
32
+ */
33
+ template?: string;
34
+ /** Optional configuration for marker behavior */
35
+ options?: TAddMarkerOptions;
36
+ };
37
+ /**
38
+ * Extended navigation options that support configurable markers.
39
+ *
40
+ * Example:
41
+ * ```typescript
42
+ * createMarkers: {
43
+ * departure: {
44
+ * template: 'Departure: {{instruction.action.type}}',
45
+ * options: { interactive: true }
46
+ * },
47
+ * destination: {
48
+ * template: 'Destination: {{instruction.action.type}}',
49
+ * options: { rank: 'medium' }
50
+ * },
51
+ * connection: false // Disable connection markers
52
+ * }
53
+ * ```
54
+ */
55
+ export type ExtendedNavigationOptions = Omit<TNavigationOptions, 'createMarkers'> & {
56
+ createMarkers?: {
57
+ /** Departure marker configuration or boolean to enable/disable */
58
+ departure?: NavigationMarkerConfig | boolean;
59
+ /** Destination marker configuration or boolean to enable/disable */
60
+ destination?: NavigationMarkerConfig | boolean;
61
+ /** Connection marker configuration or boolean to enable/disable */
62
+ connection?: NavigationMarkerConfig | boolean;
63
+ };
64
+ };
65
+ /**
66
+ * Utility type that converts all methods in a given type to return Promises.
67
+ * Used in MapViewControl to wrap synchronous MapView methods for async bridge communication.
68
+ *
69
+ * @template T - The type to promisify
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * // Original synchronous API
74
+ * interface TextAPI {
75
+ * label(space: Space): Text3D;
76
+ * remove(text: Text3D): void;
77
+ * }
78
+ *
79
+ * // Promisified version
80
+ * type AsyncTextAPI = Promisify<TextAPI>;
81
+ * // Results in:
82
+ * // {
83
+ * // label(space: Space): Promise<Text3D>;
84
+ * // remove(text: Text3D): Promise<void>;
85
+ * // }
86
+ * ```
87
+ *
88
+ * @remarks
89
+ * TypeScript's type system has limitations with complex generic transformations.
90
+ * The basic Promisify works well for simple cases but struggles with:
91
+ * - Function overloads - only the last overload signature is preserved
92
+ * - Generic functions with conditional return types - type information is lost
93
+ * - Complex generic constraints - requires manual type definitions
94
+ */
95
+ export type Promisify<T> = {
96
+ [K in keyof T]: T[K] extends (...args: infer Args) => infer Return ? Return extends Promise<any> ? T[K] : (...args: Args) => Promise<Return> : T[K] extends object ? Promisify<T[K]> : T[K];
97
+ };
98
+ /**
99
+ * Type definition for the promisified updateState method with function overloads preserved.
100
+ *
101
+ * This type specifically handles the complex overloaded signatures of updateState that the generic
102
+ * Promisify utility cannot properly preserve. It maintains full type safety for both entity objects
103
+ * and string IDs while ensuring all calls return Promises for bridge communication.
104
+ *
105
+ * @template T - The entity type being updated (Space, Text3D, etc.) or string ID
106
+ *
107
+ * @example Type-safe entity updates
108
+ * ```typescript
109
+ * // Space update with full type safety
110
+ * const space: Space = mapData.getByType('space')[0];
111
+ * await mapView.updateState(space, {
112
+ * color: '#ff0000', // ✅ Valid Space property
113
+ * opacity: 0.8, // ✅ Valid Space property
114
+ * invalidProp: 'value' // ❌ TypeScript error - not a Space property
115
+ * });
116
+ *
117
+ * // Text3D update with specific styling options
118
+ * const text3D: Text3D = await mapView.Text3D.label(space, 'Room 101');
119
+ * await mapView.updateState(text3D, {
120
+ * color: '#0066cc', // ✅ Valid Text3D property
121
+ * fontSize: 16, // ✅ Valid Text3D property
122
+ * fillOpacity: 0.9 // ✅ Valid Text3D property
123
+ * });
124
+ *
125
+ * // Marker update with positioning and visibility
126
+ * const marker: Marker = await mapView.Markers.add(coordinate, '<div>Pin</div>');
127
+ * await mapView.updateState(marker, {
128
+ * rank: 'always-visible' // ✅ Valid Marker property
129
+ * });
130
+ * ```
131
+ *
132
+ *
133
+ * @example Error handling and validation
134
+ * ```typescript
135
+ * try {
136
+ * await mapView.updateState(space, { color: '#invalid-color' });
137
+ * } catch (error) {
138
+ * console.error('State update failed:', error);
139
+ * // Handle bridge communication errors
140
+ * }
141
+ * ```
142
+ *
143
+ * @remarks
144
+ * **Why this type exists:**
145
+ * - The generic `Promisify<T>` utility cannot preserve function overloads
146
+ * - TypeScript intersection types from overloads lose individual signature information
147
+ * - This explicit type maintains both overload signatures with proper type safety
148
+ * - Ensures consistent Promise return types for all bridge operations
149
+ *
150
+ */
151
+ export type PromisifiedUpdateState = <T extends MapElementsWithState>(target: T, state: TUpdateState<T>) => Promise<void>;
152
+ /**
153
+ * Extended navigation with custom marker templates
154
+ *
155
+ * @see {@link ExtendedNavigationOptions} for more information on the options
156
+ *
157
+ * @interface
158
+ */
159
+ export type Navigation = {
160
+ draw(directions: Directions | Directions[], options?: ExtendedNavigationOptions): Promise<void>;
161
+ } & Omit<MapView['Navigation'], 'draw'>;
162
+ type MapViewMethods = Omit<MapView, 'on' | 'off' | 'emit' | '__core' | 'then' | 'catch' | 'finally' | 'valueOf' | 'toString' | 'toJSON' | typeof Symbol.toPrimitive | typeof Symbol.toStringTag> & {
163
+ /**
164
+ * Internal method used by useEvent hook to call the bridge.
165
+ *
166
+ * @remarks
167
+ * This method is used by useEvent hook to call the bridge.
168
+ * It is not part of the public API and should not be used directly.
169
+ *
170
+ * @internal
171
+ */
172
+ _bridgeCall: UseBridgeHook['instruct'];
173
+ };
174
+ /**
175
+ * A proxy that intercepts {@link MapView} method calls and forwards them through the bridge to the WebView.
176
+ * All method calls are converted to asynchronous bridge instructions.
177
+ *
178
+ * This interface provides access to all MapView methods and properties in an async manner,
179
+ * with specialized handling for Navigation and updateState methods.
180
+ *
181
+ * **Key Properties:**
182
+ * - `updateState` - Async wrapper for updating entity states with type safety
183
+ * - `Navigation` - Extended navigation with custom marker templates
184
+ * - `on` - Subscribe to map events
185
+ * - `off` - Unsubscribe from map events
186
+ * - `destroy` - Clean up resources and event subscriptions
187
+ * - All other MapView methods are available as async calls
188
+ *
189
+ * @example Basic Usage
190
+ * ```typescript
191
+ * // All MapView methods are available as async calls
192
+ * await mapView.setFloor('floor-id');
193
+ * await mapView.Camera.focusOn(target, options);
194
+ * await mapView.Labels.add(coordinate, content);
195
+ *
196
+ * // Navigation with custom markers
197
+ * await mapView.Navigation.draw(directions, {
198
+ * createMarkers: {
199
+ * connection: { template: '<div>{{instruction.action.type}}</div>', options: { rank: 'always-visible' } }
200
+ * }
201
+ * });
202
+ *
203
+ * // Event handling
204
+ * mapView.on('click', handler);
205
+ * mapView.off('click', handler);
206
+ *
207
+ * // Cleanup when unmounting
208
+ * mapView.destroy();
209
+ * ```
210
+ *
211
+ * @interface
212
+ */
213
+ export type MapViewControl = Omit<Promisify<MapViewMethods>, 'updateState' | 'Navigation' | 'Text3D' | 'BlueDot' | 'Camera' | 'Labels' | 'Markers' | 'Models' | 'Images' | 'Paths' | 'Shapes' | 'Style' | 'Outdoor'> & {
214
+ /**
215
+ * Promisified version of updateState that asynchronously updates visual properties of map entities.
216
+ *
217
+ * This method provides type-safe updates for various map entities with async bridge communication.
218
+ * All state changes are applied through the React Native bridge and return a Promise.
219
+ *
220
+ * @param target - The entity to update (Space, Text3D, Marker, Label, etc.) or its string ID
221
+ * @param state - The new state properties to apply to the entity
222
+ * @returns Promise that resolves when the update is complete
223
+ *
224
+ * @example
225
+ * ```typescript
226
+ * // Update a space's appearance
227
+ * const space = mapData.getByType('space')[0];
228
+ * await mapView.updateState(space, {
229
+ * color: '#ff0000',
230
+ * opacity: 0.8
231
+ * });
232
+ *
233
+ * // Update a 3D text label
234
+ * const text3D = await mapView.Text3D.label(space, 'Room 101');
235
+ * await mapView.updateState(text3D, {
236
+ * color: '#0066cc',
237
+ * fontSize: 16,
238
+ * fillOpacity: 0.9
239
+ * });
240
+ *
241
+ * // Update a marker's styling
242
+ * const marker = await mapView.Markers.add(coordinate, '<div>Custom Marker</div>');
243
+ * await mapView.updateState(marker, {
244
+ * rank: 'always-visible'
245
+ * });
246
+ *
247
+ * // Update using string ID
248
+ * await mapView.updateState('space-id-123', {
249
+ * color: '#00ff00',
250
+ * opacity: 0.5
251
+ * });
252
+ *
253
+ * @remarks
254
+ * Unlike the synchronous MapView.updateState, this method:
255
+ * - Returns a Promise that resolves when the bridge operation completes
256
+ * - Provides full TypeScript type safety for all supported entity types
257
+ * - Handles bridge communication errors gracefully
258
+ * - Supports both entity objects and string IDs as targets
259
+ *
260
+ * Supported entity types include: Space, Text3D, MapObject, Label, Marker, Shape,
261
+ * Door, Facade, Floor, Model, Path, PathSegment, and string IDs.
262
+ */
263
+ updateState: PromisifiedUpdateState;
264
+ /** Extended navigation with custom marker templates */
265
+ Navigation: Navigation;
266
+ /** 3D text controls with async methods */
267
+ Text3D: Promisify<import('@mappedin/mappedin-js').Text3D>;
268
+ /** Blue dot controls with async methods */
269
+ BlueDot: Promisify<import('@mappedin/mappedin-js').MapView['__BlueDot']>;
270
+ /** Camera controls with async methods */
271
+ Camera: Promisify<import('@mappedin/mappedin-js').Camera>;
272
+ /** Label controls with async methods */
273
+ Labels: Promisify<import('@mappedin/mappedin-js').Labels>;
274
+ /** Marker controls with async methods */
275
+ Markers: Promisify<import('@mappedin/mappedin-js').Markers>;
276
+ /** Model controls with async methods */
277
+ Models: Promisify<import('@mappedin/mappedin-js').Models>;
278
+ /** Image controls with async methods */
279
+ Images: Promisify<import('@mappedin/mappedin-js').Images>;
280
+ /** Path controls with async methods */
281
+ Paths: Promisify<import('@mappedin/mappedin-js').Paths>;
282
+ /** Shape controls with async methods */
283
+ Shapes: Promisify<import('@mappedin/mappedin-js').Shapes>;
284
+ /** Style controls with async methods */
285
+ Style: Promisify<import('@mappedin/mappedin-js').Style>;
286
+ /** Outdoor controls with async methods */
287
+ Outdoor: Promisify<import('@mappedin/mappedin-js').Outdoor>;
288
+ /** Subscribe to map events */
289
+ on: MapView['on'];
290
+ /** Unsubscribe from map events */
291
+ off: MapView['off'];
292
+ /** Destroy resources, caches, and event subscriptions */
293
+ destroy: () => Promise<void>;
294
+ /**
295
+ * Internal method to get cache state for testing
296
+ * @internal
297
+ */
298
+ __getCacheState?: () => {
299
+ cacheSize: number;
300
+ propertyCacheKeys: string[];
301
+ };
302
+ };
303
+ /**
304
+ * Creates a typed wrapper that allows calling any method on the MapView class through the bridge.
305
+ *
306
+ * Features:
307
+ * - Full TypeScript support with auto-completion
308
+ * - Type-safe method calls with proper parameter and return type checking
309
+ * - Supports any method call on MapView (e.g., mapView.setFloor(...))
310
+ * - Supports namespaced methods (e.g., mapView.Camera.focusOn(...))
311
+ * - Supports property access for direct values (e.g., mapView.currentFloor, mapView.Camera.maxZoomLevel)
312
+ * - All methods automatically return Promises since they go through the bridge
313
+ * - Properties return cached values directly (synchronously)
314
+ * - Automatically stays in sync with MapView API changes
315
+ * - Subscribes to camera-state-change events to keep camera properties in sync
316
+ * - Extended Navigation.draw method supports custom createMarker property
317
+ *
318
+ * Usage examples:
319
+ * ```typescript
320
+ * const mapView = createMapViewControl(instruct);
321
+ *
322
+ * // Direct method calls with full type safety
323
+ * await mapView.setFloor('floor-id'); // TypeScript knows the parameter type
324
+ *
325
+ * // Namespaced method calls with auto-completion
326
+ * await mapView.Camera.focusOn(target, options);
327
+ * await mapView.Labels.add(coordinate, content);
328
+ * await mapView.Markers.add(coordinate, '<div>Marker</div>');
329
+ *
330
+ * // Extended Navigation.draw with custom createMarker property
331
+ * await mapView.Navigation.draw(directions, {
332
+ * createMarkers: {
333
+ * departure: '<div>departure</div>',
334
+ * destination: false,
335
+ * connection: '<div>connection {{instruction.action.type}}</div>',
336
+ * },
337
+ * pathOptions: { color: '#ff0000' },
338
+ * // ... all other TNavigationOptions remain available
339
+ * });
340
+ *
341
+ * // Property access returns cached values directly (no await needed)
342
+ * const currentFloor = mapView.currentFloor; // Returns 'floor-1'
343
+ * const maxZoom = mapView.Camera.maxZoomLevel; // Returns 1
344
+ * const minZoom = mapView.Camera.minZoomLevel; // Returns 0.5
345
+ *
346
+ * // All method return types are properly typed as Promises
347
+ * const directions = await mapView.getDirections(from, to);
348
+ * const mapData = await mapView.getMapData();
349
+ * ```
350
+ *
351
+ * @param instruct - The bridge instruction function from useBridge hook
352
+ * @param mapData - The map data for the map view
353
+ * @param eventControl - Optional event control instance for handling events
354
+ * @returns A typed proxy that intercepts any method call and forwards it to the bridge
355
+ */
356
+ export declare function createMapViewControl(instruct: UseBridgeHook['instruct'], mapData: Mappedin.MapData, eventControl: EventControl, { startInitialState }?: {
357
+ startInitialState?: TStateChangedInternalPayload;
358
+ }): Promise<MapViewControl>;
359
+ export {};
360
+ //# sourceMappingURL=map-view-control.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map-view-control.d.ts","sourceRoot":"","sources":["../../src/controls/map-view-control.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,OAAO,EACP,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,4BAA4B,EAC5B,oBAAoB,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB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,EACzB,YAAY,EAAE,YAAY,EAC1B,EAAE,iBAAsB,EAAE,GAAE;IAAE,iBAAiB,CAAC,EAAE,4BAA4B,CAAA;CAAO,GACnF,OAAO,CAAC,cAAc,CAAC,CA4fzB"}
@@ -0,0 +1,4 @@
1
+ export declare class MapViewNullError extends Error {
2
+ constructor(name: string);
3
+ }
4
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,gBAAiB,SAAQ,KAAK;gBAC9B,IAAI,EAAE,MAAM;CAGxB"}