@smartnet360/svelte-components 0.0.51 → 0.0.54
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/dist/apps/site-check/transforms.js +2 -2
- package/dist/core/Charts/ChartCard.svelte +6 -1
- package/dist/core/Charts/ChartComponent.svelte +8 -3
- package/dist/core/Charts/GlobalControls.svelte +116 -14
- package/dist/core/Charts/adapt.js +1 -1
- package/dist/core/Charts/charts.model.d.ts +3 -0
- package/dist/core/FeatureRegistry/index.js +1 -1
- package/dist/core/TreeView/TreeNode.svelte +40 -45
- package/dist/core/TreeView/TreeNode.svelte.d.ts +10 -0
- package/dist/core/TreeView/TreeView.svelte +14 -2
- package/dist/core/TreeView/TreeView.svelte.d.ts +10 -0
- package/dist/core/TreeView/tree-utils.d.ts +3 -0
- package/dist/core/TreeView/tree-utils.js +33 -9
- package/dist/core/TreeView/tree.store.js +49 -24
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/map/controls/MapControl.svelte +204 -0
- package/dist/map/controls/MapControl.svelte.d.ts +17 -0
- package/dist/map/controls/SiteFilterControl.svelte +126 -0
- package/dist/map/controls/SiteFilterControl.svelte.d.ts +16 -0
- package/dist/map/demo/DemoMap.svelte +98 -0
- package/dist/map/demo/DemoMap.svelte.d.ts +12 -0
- package/dist/map/demo/demo-data.d.ts +12 -0
- package/dist/map/demo/demo-data.js +220 -0
- package/dist/map/hooks/useCellData.d.ts +14 -0
- package/dist/map/hooks/useCellData.js +29 -0
- package/dist/map/hooks/useMapbox.d.ts +14 -0
- package/dist/map/hooks/useMapbox.js +29 -0
- package/dist/map/index.d.ts +27 -0
- package/dist/map/index.js +47 -0
- package/dist/map/layers/CellsLayer.svelte +242 -0
- package/dist/map/layers/CellsLayer.svelte.d.ts +21 -0
- package/dist/map/layers/CoverageLayer.svelte +37 -0
- package/dist/map/layers/CoverageLayer.svelte.d.ts +9 -0
- package/dist/map/layers/LayerBase.d.ts +42 -0
- package/dist/map/layers/LayerBase.js +58 -0
- package/dist/map/layers/SitesLayer.svelte +282 -0
- package/dist/map/layers/SitesLayer.svelte.d.ts +19 -0
- package/dist/map/providers/CellDataProvider.svelte +43 -0
- package/dist/map/providers/CellDataProvider.svelte.d.ts +12 -0
- package/dist/map/providers/MapboxProvider.svelte +38 -0
- package/dist/map/providers/MapboxProvider.svelte.d.ts +9 -0
- package/dist/map/providers/providerHelpers.d.ts +17 -0
- package/dist/map/providers/providerHelpers.js +26 -0
- package/dist/map/stores/cellDataStore.d.ts +21 -0
- package/dist/map/stores/cellDataStore.js +53 -0
- package/dist/map/stores/interactions.d.ts +20 -0
- package/dist/map/stores/interactions.js +33 -0
- package/dist/map/stores/mapStore.d.ts +8 -0
- package/dist/map/stores/mapStore.js +10 -0
- package/dist/map/types.d.ts +115 -0
- package/dist/map/types.js +10 -0
- package/dist/map/utils/geojson.d.ts +20 -0
- package/dist/map/utils/geojson.js +78 -0
- package/dist/map/utils/mapboxHelpers.d.ts +51 -0
- package/dist/map/utils/mapboxHelpers.js +98 -0
- package/dist/map/utils/math.d.ts +40 -0
- package/dist/map/utils/math.js +95 -0
- package/dist/map/utils/siteTreeUtils.d.ts +27 -0
- package/dist/map/utils/siteTreeUtils.js +164 -0
- package/package.json +1 -1
- package/dist/core/Map/Map.svelte +0 -312
- package/dist/core/Map/Map.svelte.d.ts +0 -230
- package/dist/core/Map/index.d.ts +0 -9
- package/dist/core/Map/index.js +0 -9
- package/dist/core/Map/mapSettings.d.ts +0 -147
- package/dist/core/Map/mapSettings.js +0 -226
- package/dist/core/Map/mapStore.d.ts +0 -73
- package/dist/core/Map/mapStore.js +0 -136
- package/dist/core/Map/types.d.ts +0 -72
- package/dist/core/Map/types.js +0 -32
package/dist/core/Map/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Map Component Exports
|
|
3
|
-
*
|
|
4
|
-
* Barrel export for clean imports
|
|
5
|
-
*/
|
|
6
|
-
export { default as Map } from './Map.svelte';
|
|
7
|
-
export { createMapStore, isMapReady, getMapInstance, type MapStore } from './mapStore';
|
|
8
|
-
export { mapSettingsSchema, type MapSettings } from './mapSettings';
|
|
9
|
-
export { MAP_STYLES, DEFAULT_MAP_OPTIONS, type MapOptions, type MapState, type MapStyleName } from './types';
|
package/dist/core/Map/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Map Component Exports
|
|
3
|
-
*
|
|
4
|
-
* Barrel export for clean imports
|
|
5
|
-
*/
|
|
6
|
-
export { default as Map } from './Map.svelte';
|
|
7
|
-
export { createMapStore, isMapReady, getMapInstance } from './mapStore';
|
|
8
|
-
export { mapSettingsSchema } from './mapSettings';
|
|
9
|
-
export { MAP_STYLES, DEFAULT_MAP_OPTIONS } from './types';
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Map Settings Schema
|
|
3
|
-
*
|
|
4
|
-
* Defines the settings schema for map configuration using the Settings component.
|
|
5
|
-
* Integrates with the Settings system for reactive map configuration.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Map settings schema for use with Settings component
|
|
9
|
-
*/
|
|
10
|
-
export declare const mapSettingsSchema: {
|
|
11
|
-
segments: ({
|
|
12
|
-
id: string;
|
|
13
|
-
title: string;
|
|
14
|
-
icon: string;
|
|
15
|
-
description: string;
|
|
16
|
-
fields: ({
|
|
17
|
-
id: string;
|
|
18
|
-
type: "select";
|
|
19
|
-
label: string;
|
|
20
|
-
description: string;
|
|
21
|
-
defaultValue: string;
|
|
22
|
-
options: {
|
|
23
|
-
value: string;
|
|
24
|
-
label: string;
|
|
25
|
-
description: string;
|
|
26
|
-
}[];
|
|
27
|
-
} | {
|
|
28
|
-
id: string;
|
|
29
|
-
type: "boolean";
|
|
30
|
-
label: string;
|
|
31
|
-
description: string;
|
|
32
|
-
defaultValue: true;
|
|
33
|
-
options?: undefined;
|
|
34
|
-
} | {
|
|
35
|
-
id: string;
|
|
36
|
-
type: "boolean";
|
|
37
|
-
label: string;
|
|
38
|
-
description: string;
|
|
39
|
-
defaultValue: false;
|
|
40
|
-
options?: undefined;
|
|
41
|
-
})[];
|
|
42
|
-
} | {
|
|
43
|
-
id: string;
|
|
44
|
-
title: string;
|
|
45
|
-
icon: string;
|
|
46
|
-
description: string;
|
|
47
|
-
fields: ({
|
|
48
|
-
id: string;
|
|
49
|
-
type: "range";
|
|
50
|
-
label: string;
|
|
51
|
-
description: string;
|
|
52
|
-
defaultValue: number;
|
|
53
|
-
min: number;
|
|
54
|
-
max: number;
|
|
55
|
-
step: number;
|
|
56
|
-
showValue: true;
|
|
57
|
-
unit: string;
|
|
58
|
-
} | {
|
|
59
|
-
id: string;
|
|
60
|
-
type: "number";
|
|
61
|
-
label: string;
|
|
62
|
-
description: string;
|
|
63
|
-
defaultValue: number;
|
|
64
|
-
min: number;
|
|
65
|
-
max: number;
|
|
66
|
-
step: number;
|
|
67
|
-
showValue?: undefined;
|
|
68
|
-
unit?: undefined;
|
|
69
|
-
})[];
|
|
70
|
-
} | {
|
|
71
|
-
id: string;
|
|
72
|
-
title: string;
|
|
73
|
-
icon: string;
|
|
74
|
-
description: string;
|
|
75
|
-
fields: ({
|
|
76
|
-
id: string;
|
|
77
|
-
type: "select";
|
|
78
|
-
label: string;
|
|
79
|
-
description: string;
|
|
80
|
-
defaultValue: number;
|
|
81
|
-
options: {
|
|
82
|
-
value: number;
|
|
83
|
-
label: string;
|
|
84
|
-
}[];
|
|
85
|
-
min?: undefined;
|
|
86
|
-
max?: undefined;
|
|
87
|
-
step?: undefined;
|
|
88
|
-
unit?: undefined;
|
|
89
|
-
} | {
|
|
90
|
-
id: string;
|
|
91
|
-
type: "boolean";
|
|
92
|
-
label: string;
|
|
93
|
-
description: string;
|
|
94
|
-
defaultValue: true;
|
|
95
|
-
options?: undefined;
|
|
96
|
-
min?: undefined;
|
|
97
|
-
max?: undefined;
|
|
98
|
-
step?: undefined;
|
|
99
|
-
unit?: undefined;
|
|
100
|
-
} | {
|
|
101
|
-
id: string;
|
|
102
|
-
type: "number";
|
|
103
|
-
label: string;
|
|
104
|
-
description: string;
|
|
105
|
-
defaultValue: number;
|
|
106
|
-
min: number;
|
|
107
|
-
max: number;
|
|
108
|
-
step: number;
|
|
109
|
-
unit: string;
|
|
110
|
-
options?: undefined;
|
|
111
|
-
})[];
|
|
112
|
-
})[];
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Type inference for map settings
|
|
116
|
-
*/
|
|
117
|
-
export type MapSettings = {
|
|
118
|
-
appearance: {
|
|
119
|
-
style: string;
|
|
120
|
-
show3dBuildings: boolean;
|
|
121
|
-
showTerrain: boolean;
|
|
122
|
-
};
|
|
123
|
-
controls: {
|
|
124
|
-
showNavigationControls: boolean;
|
|
125
|
-
showScaleControl: boolean;
|
|
126
|
-
showFullscreenControl: boolean;
|
|
127
|
-
showGeolocateControl: boolean;
|
|
128
|
-
};
|
|
129
|
-
interaction: {
|
|
130
|
-
dragRotate: boolean;
|
|
131
|
-
touchZoomRotate: boolean;
|
|
132
|
-
scrollZoom: boolean;
|
|
133
|
-
doubleClickZoom: boolean;
|
|
134
|
-
dragPan: boolean;
|
|
135
|
-
};
|
|
136
|
-
view: {
|
|
137
|
-
pitch: number;
|
|
138
|
-
bearing: number;
|
|
139
|
-
minZoom: number;
|
|
140
|
-
maxZoom: number;
|
|
141
|
-
};
|
|
142
|
-
performance: {
|
|
143
|
-
maxTileCacheSize: number;
|
|
144
|
-
antialias: boolean;
|
|
145
|
-
fadeDuration: number;
|
|
146
|
-
};
|
|
147
|
-
};
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Map Settings Schema
|
|
3
|
-
*
|
|
4
|
-
* Defines the settings schema for map configuration using the Settings component.
|
|
5
|
-
* Integrates with the Settings system for reactive map configuration.
|
|
6
|
-
*/
|
|
7
|
-
import { MAP_STYLES } from './types';
|
|
8
|
-
/**
|
|
9
|
-
* Map settings schema for use with Settings component
|
|
10
|
-
*/
|
|
11
|
-
export const mapSettingsSchema = {
|
|
12
|
-
segments: [
|
|
13
|
-
{
|
|
14
|
-
id: 'appearance',
|
|
15
|
-
title: 'Map Appearance',
|
|
16
|
-
icon: '🎨',
|
|
17
|
-
description: 'Visual style and theme settings',
|
|
18
|
-
fields: [
|
|
19
|
-
{
|
|
20
|
-
id: 'style',
|
|
21
|
-
type: 'select',
|
|
22
|
-
label: 'Map Style',
|
|
23
|
-
description: 'Choose the base map style',
|
|
24
|
-
defaultValue: 'streets',
|
|
25
|
-
options: [
|
|
26
|
-
{ value: 'streets', label: 'Streets', description: 'Default street map' },
|
|
27
|
-
{ value: 'satellite', label: 'Satellite', description: 'Satellite imagery' },
|
|
28
|
-
{
|
|
29
|
-
value: 'satelliteStreets',
|
|
30
|
-
label: 'Satellite Streets',
|
|
31
|
-
description: 'Satellite with street labels'
|
|
32
|
-
},
|
|
33
|
-
{ value: 'light', label: 'Light', description: 'Light colored theme' },
|
|
34
|
-
{ value: 'dark', label: 'Dark', description: 'Dark colored theme' },
|
|
35
|
-
{ value: 'outdoors', label: 'Outdoors', description: 'Outdoor/terrain map' },
|
|
36
|
-
{ value: 'navigationDay', label: 'Navigation Day', description: 'Navigation optimized' },
|
|
37
|
-
{ value: 'navigationNight', label: 'Navigation Night', description: 'Night navigation' }
|
|
38
|
-
]
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: 'show3dBuildings',
|
|
42
|
-
type: 'boolean',
|
|
43
|
-
label: 'Show 3D Buildings',
|
|
44
|
-
description: 'Display buildings in 3D when zoomed in',
|
|
45
|
-
defaultValue: true
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
id: 'showTerrain',
|
|
49
|
-
type: 'boolean',
|
|
50
|
-
label: 'Show Terrain',
|
|
51
|
-
description: 'Display 3D terrain elevation',
|
|
52
|
-
defaultValue: false
|
|
53
|
-
}
|
|
54
|
-
]
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
id: 'controls',
|
|
58
|
-
title: 'Map Controls',
|
|
59
|
-
icon: '🎮',
|
|
60
|
-
description: 'Control visibility and behavior',
|
|
61
|
-
fields: [
|
|
62
|
-
{
|
|
63
|
-
id: 'showNavigationControls',
|
|
64
|
-
type: 'boolean',
|
|
65
|
-
label: 'Navigation Controls',
|
|
66
|
-
description: 'Show zoom and rotation controls',
|
|
67
|
-
defaultValue: true
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
id: 'showScaleControl',
|
|
71
|
-
type: 'boolean',
|
|
72
|
-
label: 'Scale Control',
|
|
73
|
-
description: 'Show distance scale',
|
|
74
|
-
defaultValue: true
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
id: 'showFullscreenControl',
|
|
78
|
-
type: 'boolean',
|
|
79
|
-
label: 'Fullscreen Control',
|
|
80
|
-
description: 'Show fullscreen toggle button',
|
|
81
|
-
defaultValue: false
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
id: 'showGeolocateControl',
|
|
85
|
-
type: 'boolean',
|
|
86
|
-
label: 'Geolocation Control',
|
|
87
|
-
description: 'Show user location button',
|
|
88
|
-
defaultValue: false
|
|
89
|
-
}
|
|
90
|
-
]
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
id: 'interaction',
|
|
94
|
-
title: 'Interaction',
|
|
95
|
-
icon: '👆',
|
|
96
|
-
description: 'User interaction settings',
|
|
97
|
-
fields: [
|
|
98
|
-
{
|
|
99
|
-
id: 'dragRotate',
|
|
100
|
-
type: 'boolean',
|
|
101
|
-
label: 'Drag to Rotate',
|
|
102
|
-
description: 'Enable rotation by dragging with right mouse or ctrl+drag',
|
|
103
|
-
defaultValue: true
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
id: 'touchZoomRotate',
|
|
107
|
-
type: 'boolean',
|
|
108
|
-
label: 'Touch Zoom/Rotate',
|
|
109
|
-
description: 'Enable pinch to zoom and rotate on touch devices',
|
|
110
|
-
defaultValue: true
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
id: 'scrollZoom',
|
|
114
|
-
type: 'boolean',
|
|
115
|
-
label: 'Scroll to Zoom',
|
|
116
|
-
description: 'Enable mouse wheel zoom',
|
|
117
|
-
defaultValue: true
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
id: 'doubleClickZoom',
|
|
121
|
-
type: 'boolean',
|
|
122
|
-
label: 'Double Click Zoom',
|
|
123
|
-
description: 'Enable double click to zoom',
|
|
124
|
-
defaultValue: true
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
id: 'dragPan',
|
|
128
|
-
type: 'boolean',
|
|
129
|
-
label: 'Drag to Pan',
|
|
130
|
-
description: 'Enable map panning by dragging',
|
|
131
|
-
defaultValue: true
|
|
132
|
-
}
|
|
133
|
-
]
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
id: 'view',
|
|
137
|
-
title: 'View Settings',
|
|
138
|
-
icon: '🌍',
|
|
139
|
-
description: 'Camera and viewport settings',
|
|
140
|
-
fields: [
|
|
141
|
-
{
|
|
142
|
-
id: 'pitch',
|
|
143
|
-
type: 'range',
|
|
144
|
-
label: 'Pitch',
|
|
145
|
-
description: 'Camera tilt angle (0-85 degrees)',
|
|
146
|
-
defaultValue: 0,
|
|
147
|
-
min: 0,
|
|
148
|
-
max: 85,
|
|
149
|
-
step: 5,
|
|
150
|
-
showValue: true,
|
|
151
|
-
unit: '°'
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
id: 'bearing',
|
|
155
|
-
type: 'range',
|
|
156
|
-
label: 'Bearing',
|
|
157
|
-
description: 'Map rotation angle (0-360 degrees)',
|
|
158
|
-
defaultValue: 0,
|
|
159
|
-
min: 0,
|
|
160
|
-
max: 360,
|
|
161
|
-
step: 15,
|
|
162
|
-
showValue: true,
|
|
163
|
-
unit: '°'
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
id: 'minZoom',
|
|
167
|
-
type: 'number',
|
|
168
|
-
label: 'Min Zoom',
|
|
169
|
-
description: 'Minimum zoom level',
|
|
170
|
-
defaultValue: 0,
|
|
171
|
-
min: 0,
|
|
172
|
-
max: 22,
|
|
173
|
-
step: 1
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
id: 'maxZoom',
|
|
177
|
-
type: 'number',
|
|
178
|
-
label: 'Max Zoom',
|
|
179
|
-
description: 'Maximum zoom level',
|
|
180
|
-
defaultValue: 22,
|
|
181
|
-
min: 0,
|
|
182
|
-
max: 22,
|
|
183
|
-
step: 1
|
|
184
|
-
}
|
|
185
|
-
]
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
id: 'performance',
|
|
189
|
-
title: 'Performance',
|
|
190
|
-
icon: '⚡',
|
|
191
|
-
description: 'Performance and rendering settings',
|
|
192
|
-
fields: [
|
|
193
|
-
{
|
|
194
|
-
id: 'maxTileCacheSize',
|
|
195
|
-
type: 'select',
|
|
196
|
-
label: 'Tile Cache Size',
|
|
197
|
-
description: 'Maximum number of tiles to cache',
|
|
198
|
-
defaultValue: 500,
|
|
199
|
-
options: [
|
|
200
|
-
{ value: 100, label: 'Small (100)' },
|
|
201
|
-
{ value: 500, label: 'Medium (500)' },
|
|
202
|
-
{ value: 1000, label: 'Large (1000)' }
|
|
203
|
-
]
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
id: 'antialias',
|
|
207
|
-
type: 'boolean',
|
|
208
|
-
label: 'Anti-aliasing',
|
|
209
|
-
description: 'Enable anti-aliasing for smoother rendering (may impact performance)',
|
|
210
|
-
defaultValue: true
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
id: 'fadeDuration',
|
|
214
|
-
type: 'number',
|
|
215
|
-
label: 'Fade Duration',
|
|
216
|
-
description: 'Tile fade-in duration in milliseconds',
|
|
217
|
-
defaultValue: 300,
|
|
218
|
-
min: 0,
|
|
219
|
-
max: 1000,
|
|
220
|
-
step: 100,
|
|
221
|
-
unit: 'ms'
|
|
222
|
-
}
|
|
223
|
-
]
|
|
224
|
-
}
|
|
225
|
-
]
|
|
226
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Map Store
|
|
3
|
-
*
|
|
4
|
-
* Centralized store for map instance and state management.
|
|
5
|
-
* Allows components to access map instance and react to state changes.
|
|
6
|
-
*/
|
|
7
|
-
import type { Readable } from 'svelte/store';
|
|
8
|
-
import type { Map as MapboxMap } from 'mapbox-gl';
|
|
9
|
-
import type { MapboxOverlay } from '@deck.gl/mapbox';
|
|
10
|
-
import type { Layer } from '@deck.gl/core';
|
|
11
|
-
import type { MapState } from './types';
|
|
12
|
-
/**
|
|
13
|
-
* Create a map store instance
|
|
14
|
-
* Each map component should create its own store instance
|
|
15
|
-
*/
|
|
16
|
-
export declare function createMapStore(): {
|
|
17
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<MapState>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
|
|
18
|
-
/**
|
|
19
|
-
* Set the map instance after initialization
|
|
20
|
-
*/
|
|
21
|
-
setMap(map: MapboxMap): void;
|
|
22
|
-
/**
|
|
23
|
-
* Set the Deck.GL overlay instance
|
|
24
|
-
*/
|
|
25
|
-
setOverlay(overlay: MapboxOverlay): void;
|
|
26
|
-
/**
|
|
27
|
-
* Update Deck.GL layers
|
|
28
|
-
*/
|
|
29
|
-
setLayers(layers: Layer[]): void;
|
|
30
|
-
/**
|
|
31
|
-
* Add a layer to the existing layers
|
|
32
|
-
*/
|
|
33
|
-
addLayer(layer: Layer): void;
|
|
34
|
-
/**
|
|
35
|
-
* Remove a layer by id
|
|
36
|
-
*/
|
|
37
|
-
removeLayer(layerId: string): void;
|
|
38
|
-
/**
|
|
39
|
-
* Mark map as loaded
|
|
40
|
-
*/
|
|
41
|
-
setLoaded(isLoaded: boolean): void;
|
|
42
|
-
/**
|
|
43
|
-
* Update map view state
|
|
44
|
-
*/
|
|
45
|
-
updateViewState(updates: Partial<Pick<MapState, "center" | "zoom" | "pitch" | "bearing">>): void;
|
|
46
|
-
/**
|
|
47
|
-
* Fly to a location
|
|
48
|
-
*/
|
|
49
|
-
flyTo(center: [number, number], zoom?: number, options?: {
|
|
50
|
-
duration?: number;
|
|
51
|
-
}): void;
|
|
52
|
-
/**
|
|
53
|
-
* Fit map to bounds
|
|
54
|
-
*/
|
|
55
|
-
fitBounds(bounds: [[number, number], [number, number]], padding?: number): void;
|
|
56
|
-
/**
|
|
57
|
-
* Reset to initial state
|
|
58
|
-
*/
|
|
59
|
-
reset(): void;
|
|
60
|
-
/**
|
|
61
|
-
* Clean up map resources
|
|
62
|
-
*/
|
|
63
|
-
destroy(): void;
|
|
64
|
-
};
|
|
65
|
-
export type MapStore = ReturnType<typeof createMapStore>;
|
|
66
|
-
/**
|
|
67
|
-
* Derived store: Check if map is ready to use
|
|
68
|
-
*/
|
|
69
|
-
export declare function isMapReady(mapStore: MapStore): Readable<boolean>;
|
|
70
|
-
/**
|
|
71
|
-
* Derived store: Get current map instance (null-safe)
|
|
72
|
-
*/
|
|
73
|
-
export declare function getMapInstance(mapStore: MapStore): Readable<MapboxMap | null>;
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Map Store
|
|
3
|
-
*
|
|
4
|
-
* Centralized store for map instance and state management.
|
|
5
|
-
* Allows components to access map instance and react to state changes.
|
|
6
|
-
*/
|
|
7
|
-
import { writable, derived, get } from 'svelte/store';
|
|
8
|
-
/**
|
|
9
|
-
* Create a map store instance
|
|
10
|
-
* Each map component should create its own store instance
|
|
11
|
-
*/
|
|
12
|
-
export function createMapStore() {
|
|
13
|
-
const initialState = {
|
|
14
|
-
map: null,
|
|
15
|
-
overlay: null,
|
|
16
|
-
layers: [],
|
|
17
|
-
isLoaded: false,
|
|
18
|
-
center: [-74.5, 40],
|
|
19
|
-
zoom: 9,
|
|
20
|
-
pitch: 0,
|
|
21
|
-
bearing: 0
|
|
22
|
-
};
|
|
23
|
-
const store = writable(initialState);
|
|
24
|
-
return {
|
|
25
|
-
subscribe: store.subscribe,
|
|
26
|
-
/**
|
|
27
|
-
* Set the map instance after initialization
|
|
28
|
-
*/
|
|
29
|
-
setMap(map) {
|
|
30
|
-
store.update(state => ({ ...state, map }));
|
|
31
|
-
},
|
|
32
|
-
/**
|
|
33
|
-
* Set the Deck.GL overlay instance
|
|
34
|
-
*/
|
|
35
|
-
setOverlay(overlay) {
|
|
36
|
-
store.update(state => ({ ...state, overlay }));
|
|
37
|
-
},
|
|
38
|
-
/**
|
|
39
|
-
* Update Deck.GL layers
|
|
40
|
-
*/
|
|
41
|
-
setLayers(layers) {
|
|
42
|
-
const state = get(store);
|
|
43
|
-
if (state.overlay) {
|
|
44
|
-
state.overlay.setProps({ layers });
|
|
45
|
-
}
|
|
46
|
-
store.update(s => ({ ...s, layers }));
|
|
47
|
-
},
|
|
48
|
-
/**
|
|
49
|
-
* Add a layer to the existing layers
|
|
50
|
-
*/
|
|
51
|
-
addLayer(layer) {
|
|
52
|
-
const state = get(store);
|
|
53
|
-
const newLayers = [...state.layers, layer];
|
|
54
|
-
if (state.overlay) {
|
|
55
|
-
state.overlay.setProps({ layers: newLayers });
|
|
56
|
-
}
|
|
57
|
-
store.update(s => ({ ...s, layers: newLayers }));
|
|
58
|
-
},
|
|
59
|
-
/**
|
|
60
|
-
* Remove a layer by id
|
|
61
|
-
*/
|
|
62
|
-
removeLayer(layerId) {
|
|
63
|
-
const state = get(store);
|
|
64
|
-
const newLayers = state.layers.filter(l => l.id !== layerId);
|
|
65
|
-
if (state.overlay) {
|
|
66
|
-
state.overlay.setProps({ layers: newLayers });
|
|
67
|
-
}
|
|
68
|
-
store.update(s => ({ ...s, layers: newLayers }));
|
|
69
|
-
},
|
|
70
|
-
/**
|
|
71
|
-
* Mark map as loaded
|
|
72
|
-
*/
|
|
73
|
-
setLoaded(isLoaded) {
|
|
74
|
-
store.update(state => ({ ...state, isLoaded }));
|
|
75
|
-
},
|
|
76
|
-
/**
|
|
77
|
-
* Update map view state
|
|
78
|
-
*/
|
|
79
|
-
updateViewState(updates) {
|
|
80
|
-
store.update(state => ({ ...state, ...updates }));
|
|
81
|
-
},
|
|
82
|
-
/**
|
|
83
|
-
* Fly to a location
|
|
84
|
-
*/
|
|
85
|
-
flyTo(center, zoom, options) {
|
|
86
|
-
const state = get(store);
|
|
87
|
-
if (state.map) {
|
|
88
|
-
state.map.flyTo({
|
|
89
|
-
center,
|
|
90
|
-
zoom: zoom ?? state.zoom,
|
|
91
|
-
duration: options?.duration ?? 1000
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
/**
|
|
96
|
-
* Fit map to bounds
|
|
97
|
-
*/
|
|
98
|
-
fitBounds(bounds, padding) {
|
|
99
|
-
const state = get(store);
|
|
100
|
-
if (state.map) {
|
|
101
|
-
state.map.fitBounds(bounds, {
|
|
102
|
-
padding: padding ?? 50,
|
|
103
|
-
duration: 1000
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
/**
|
|
108
|
-
* Reset to initial state
|
|
109
|
-
*/
|
|
110
|
-
reset() {
|
|
111
|
-
store.set(initialState);
|
|
112
|
-
},
|
|
113
|
-
/**
|
|
114
|
-
* Clean up map resources
|
|
115
|
-
*/
|
|
116
|
-
destroy() {
|
|
117
|
-
const state = get(store);
|
|
118
|
-
if (state.map) {
|
|
119
|
-
state.map.remove();
|
|
120
|
-
}
|
|
121
|
-
this.reset();
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Derived store: Check if map is ready to use
|
|
127
|
-
*/
|
|
128
|
-
export function isMapReady(mapStore) {
|
|
129
|
-
return derived(mapStore, $store => $store.map !== null && $store.overlay !== null && $store.isLoaded);
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Derived store: Get current map instance (null-safe)
|
|
133
|
-
*/
|
|
134
|
-
export function getMapInstance(mapStore) {
|
|
135
|
-
return derived(mapStore, $store => $store.map);
|
|
136
|
-
}
|
package/dist/core/Map/types.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Map Component Type Definitions
|
|
3
|
-
*
|
|
4
|
-
* Defines types for Mapbox GL + Deck.GL integration
|
|
5
|
-
*/
|
|
6
|
-
import type { Map as MapboxMap } from 'mapbox-gl';
|
|
7
|
-
import type { MapboxOverlay } from '@deck.gl/mapbox';
|
|
8
|
-
import type { Layer } from '@deck.gl/core';
|
|
9
|
-
/**
|
|
10
|
-
* Map initialization options
|
|
11
|
-
*/
|
|
12
|
-
export interface MapOptions {
|
|
13
|
-
/** Mapbox access token (required) */
|
|
14
|
-
accessToken: string;
|
|
15
|
-
/** Initial map style */
|
|
16
|
-
style?: string;
|
|
17
|
-
/** Initial center coordinates [lng, lat] */
|
|
18
|
-
center?: [number, number];
|
|
19
|
-
/** Initial zoom level */
|
|
20
|
-
zoom?: number;
|
|
21
|
-
/** Initial pitch (tilt) in degrees */
|
|
22
|
-
pitch?: number;
|
|
23
|
-
/** Initial bearing (rotation) in degrees */
|
|
24
|
-
bearing?: number;
|
|
25
|
-
/** Minimum zoom level */
|
|
26
|
-
minZoom?: number;
|
|
27
|
-
/** Maximum zoom level */
|
|
28
|
-
maxZoom?: number;
|
|
29
|
-
/** Whether to show navigation controls */
|
|
30
|
-
showControls?: boolean;
|
|
31
|
-
/** Whether to show scale control */
|
|
32
|
-
showScale?: boolean;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Map state (stored in mapStore)
|
|
36
|
-
*/
|
|
37
|
-
export interface MapState {
|
|
38
|
-
/** The Mapbox GL instance */
|
|
39
|
-
map: MapboxMap | null;
|
|
40
|
-
/** The Deck.GL overlay instance */
|
|
41
|
-
overlay: MapboxOverlay | null;
|
|
42
|
-
/** Current Deck.GL layers */
|
|
43
|
-
layers: Layer[];
|
|
44
|
-
/** Whether the map is loaded and ready */
|
|
45
|
-
isLoaded: boolean;
|
|
46
|
-
/** Current map center */
|
|
47
|
-
center: [number, number];
|
|
48
|
-
/** Current zoom level */
|
|
49
|
-
zoom: number;
|
|
50
|
-
/** Current pitch */
|
|
51
|
-
pitch: number;
|
|
52
|
-
/** Current bearing */
|
|
53
|
-
bearing: number;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Map style presets
|
|
57
|
-
*/
|
|
58
|
-
export declare const MAP_STYLES: {
|
|
59
|
-
readonly streets: "mapbox://styles/mapbox/streets-v12";
|
|
60
|
-
readonly satellite: "mapbox://styles/mapbox/satellite-v9";
|
|
61
|
-
readonly satelliteStreets: "mapbox://styles/mapbox/satellite-streets-v12";
|
|
62
|
-
readonly light: "mapbox://styles/mapbox/light-v11";
|
|
63
|
-
readonly dark: "mapbox://styles/mapbox/dark-v11";
|
|
64
|
-
readonly outdoors: "mapbox://styles/mapbox/outdoors-v12";
|
|
65
|
-
readonly navigationDay: "mapbox://styles/mapbox/navigation-day-v1";
|
|
66
|
-
readonly navigationNight: "mapbox://styles/mapbox/navigation-night-v1";
|
|
67
|
-
};
|
|
68
|
-
export type MapStyleName = keyof typeof MAP_STYLES;
|
|
69
|
-
/**
|
|
70
|
-
* Default map options
|
|
71
|
-
*/
|
|
72
|
-
export declare const DEFAULT_MAP_OPTIONS: Partial<MapOptions>;
|