@movk/maplibre 1.0.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.
Files changed (256) hide show
  1. package/LICENSE +21 -0
  2. package/README.en.md +192 -0
  3. package/README.md +191 -0
  4. package/dist/module.d.mts +20 -0
  5. package/dist/module.d.ts +20 -0
  6. package/dist/module.json +12 -0
  7. package/dist/module.mjs +63 -0
  8. package/dist/runtime/components/CustomLayer.d.vue.ts +24 -0
  9. package/dist/runtime/components/CustomLayer.vue +23 -0
  10. package/dist/runtime/components/CustomLayer.vue.d.ts +24 -0
  11. package/dist/runtime/components/Layer.d.vue.ts +75 -0
  12. package/dist/runtime/components/Layer.vue +112 -0
  13. package/dist/runtime/components/Layer.vue.d.ts +75 -0
  14. package/dist/runtime/components/LayerGroup.d.vue.ts +25 -0
  15. package/dist/runtime/components/LayerGroup.vue +16 -0
  16. package/dist/runtime/components/LayerGroup.vue.d.ts +25 -0
  17. package/dist/runtime/components/LottieMarker.d.vue.ts +50 -0
  18. package/dist/runtime/components/LottieMarker.vue +31 -0
  19. package/dist/runtime/components/LottieMarker.vue.d.ts +50 -0
  20. package/dist/runtime/components/Map.d.vue.ts +84 -0
  21. package/dist/runtime/components/Map.vue +134 -0
  22. package/dist/runtime/components/Map.vue.d.ts +84 -0
  23. package/dist/runtime/components/Marker.d.vue.ts +54 -0
  24. package/dist/runtime/components/Marker.vue +86 -0
  25. package/dist/runtime/components/Marker.vue.d.ts +54 -0
  26. package/dist/runtime/components/Popup.d.vue.ts +30 -0
  27. package/dist/runtime/components/Popup.vue +33 -0
  28. package/dist/runtime/components/Popup.vue.d.ts +30 -0
  29. package/dist/runtime/components/Source.d.vue.ts +23 -0
  30. package/dist/runtime/components/Source.vue +44 -0
  31. package/dist/runtime/components/Source.vue.d.ts +23 -0
  32. package/dist/runtime/components/Tooltip.d.vue.ts +45 -0
  33. package/dist/runtime/components/Tooltip.vue +106 -0
  34. package/dist/runtime/components/Tooltip.vue.d.ts +45 -0
  35. package/dist/runtime/components/buffers/BufferCircle.d.vue.ts +27 -0
  36. package/dist/runtime/components/buffers/BufferCircle.vue +30 -0
  37. package/dist/runtime/components/buffers/BufferCircle.vue.d.ts +27 -0
  38. package/dist/runtime/components/buffers/BufferEllipse.d.vue.ts +35 -0
  39. package/dist/runtime/components/buffers/BufferEllipse.vue +36 -0
  40. package/dist/runtime/components/buffers/BufferEllipse.vue.d.ts +35 -0
  41. package/dist/runtime/components/buffers/BufferLine.d.vue.ts +21 -0
  42. package/dist/runtime/components/buffers/BufferLine.vue +40 -0
  43. package/dist/runtime/components/buffers/BufferLine.vue.d.ts +21 -0
  44. package/dist/runtime/components/buffers/BufferPolygon.d.vue.ts +21 -0
  45. package/dist/runtime/components/buffers/BufferPolygon.vue +40 -0
  46. package/dist/runtime/components/buffers/BufferPolygon.vue.d.ts +21 -0
  47. package/dist/runtime/components/buffers/BufferSector.d.vue.ts +31 -0
  48. package/dist/runtime/components/buffers/BufferSector.vue +35 -0
  49. package/dist/runtime/components/buffers/BufferSector.vue.d.ts +31 -0
  50. package/dist/runtime/components/controls/AttributionControl.d.vue.ts +24 -0
  51. package/dist/runtime/components/controls/AttributionControl.vue +18 -0
  52. package/dist/runtime/components/controls/AttributionControl.vue.d.ts +24 -0
  53. package/dist/runtime/components/controls/FullscreenControl.d.vue.ts +24 -0
  54. package/dist/runtime/components/controls/FullscreenControl.vue +18 -0
  55. package/dist/runtime/components/controls/FullscreenControl.vue.d.ts +24 -0
  56. package/dist/runtime/components/controls/GeolocateControl.d.vue.ts +24 -0
  57. package/dist/runtime/components/controls/GeolocateControl.vue +18 -0
  58. package/dist/runtime/components/controls/GeolocateControl.vue.d.ts +24 -0
  59. package/dist/runtime/components/controls/NavigationControl.d.vue.ts +24 -0
  60. package/dist/runtime/components/controls/NavigationControl.vue +18 -0
  61. package/dist/runtime/components/controls/NavigationControl.vue.d.ts +24 -0
  62. package/dist/runtime/components/controls/ScaleControl.d.vue.ts +24 -0
  63. package/dist/runtime/components/controls/ScaleControl.vue +18 -0
  64. package/dist/runtime/components/controls/ScaleControl.vue.d.ts +24 -0
  65. package/dist/runtime/components/effects/AnimatedImage.d.vue.ts +28 -0
  66. package/dist/runtime/components/effects/AnimatedImage.vue +50 -0
  67. package/dist/runtime/components/effects/AnimatedImage.vue.d.ts +28 -0
  68. package/dist/runtime/components/effects/DiffusionCircle.d.vue.ts +44 -0
  69. package/dist/runtime/components/effects/DiffusionCircle.vue +47 -0
  70. package/dist/runtime/components/effects/DiffusionCircle.vue.d.ts +44 -0
  71. package/dist/runtime/components/effects/FlowBuilding.d.vue.ts +53 -0
  72. package/dist/runtime/components/effects/FlowBuilding.vue +64 -0
  73. package/dist/runtime/components/effects/FlowBuilding.vue.d.ts +53 -0
  74. package/dist/runtime/components/effects/GlowCircle.d.vue.ts +44 -0
  75. package/dist/runtime/components/effects/GlowCircle.vue +42 -0
  76. package/dist/runtime/components/effects/GlowCircle.vue.d.ts +44 -0
  77. package/dist/runtime/components/effects/GradientBuilding.d.vue.ts +25 -0
  78. package/dist/runtime/components/effects/GradientBuilding.vue +37 -0
  79. package/dist/runtime/components/effects/GradientBuilding.vue.d.ts +25 -0
  80. package/dist/runtime/components/effects/Migration.d.vue.ts +50 -0
  81. package/dist/runtime/components/effects/Migration.vue +90 -0
  82. package/dist/runtime/components/effects/Migration.vue.d.ts +50 -0
  83. package/dist/runtime/components/effects/Radar.d.vue.ts +32 -0
  84. package/dist/runtime/components/effects/Radar.vue +49 -0
  85. package/dist/runtime/components/effects/Radar.vue.d.ts +32 -0
  86. package/dist/runtime/components/effects/SpriteImage.d.vue.ts +41 -0
  87. package/dist/runtime/components/effects/SpriteImage.vue +67 -0
  88. package/dist/runtime/components/effects/SpriteImage.vue.d.ts +41 -0
  89. package/dist/runtime/components/effects/TextureBuilding.d.vue.ts +25 -0
  90. package/dist/runtime/components/effects/TextureBuilding.vue +39 -0
  91. package/dist/runtime/components/effects/TextureBuilding.vue.d.ts +25 -0
  92. package/dist/runtime/components/effects/Trail.d.vue.ts +44 -0
  93. package/dist/runtime/components/effects/Trail.vue +61 -0
  94. package/dist/runtime/components/effects/Trail.vue.d.ts +44 -0
  95. package/dist/runtime/components/effects/WaveCircle.d.vue.ts +44 -0
  96. package/dist/runtime/components/effects/WaveCircle.vue +55 -0
  97. package/dist/runtime/components/effects/WaveCircle.vue.d.ts +44 -0
  98. package/dist/runtime/components/effects/WindowBuilding.d.vue.ts +53 -0
  99. package/dist/runtime/components/effects/WindowBuilding.vue +61 -0
  100. package/dist/runtime/components/effects/WindowBuilding.vue.d.ts +53 -0
  101. package/dist/runtime/components/environment/Sky.d.vue.ts +21 -0
  102. package/dist/runtime/components/environment/Sky.vue +15 -0
  103. package/dist/runtime/components/environment/Sky.vue.d.ts +21 -0
  104. package/dist/runtime/components/environment/Temperature.d.vue.ts +47 -0
  105. package/dist/runtime/components/environment/Temperature.vue +41 -0
  106. package/dist/runtime/components/environment/Temperature.vue.d.ts +47 -0
  107. package/dist/runtime/components/environment/Terrain.d.vue.ts +34 -0
  108. package/dist/runtime/components/environment/Terrain.vue +47 -0
  109. package/dist/runtime/components/environment/Terrain.vue.d.ts +34 -0
  110. package/dist/runtime/components/extensions/DrawControl.d.vue.ts +0 -0
  111. package/dist/runtime/components/extensions/DrawControl.vue +168 -0
  112. package/dist/runtime/components/extensions/DrawControl.vue.d.ts +0 -0
  113. package/dist/runtime/components/extensions/TiandituLayer.d.vue.ts +20 -0
  114. package/dist/runtime/components/extensions/TiandituLayer.vue +26 -0
  115. package/dist/runtime/components/extensions/TiandituLayer.vue.d.ts +20 -0
  116. package/dist/runtime/components/extensions/WmsLayer.d.vue.ts +50 -0
  117. package/dist/runtime/components/extensions/WmsLayer.vue +39 -0
  118. package/dist/runtime/components/extensions/WmsLayer.vue.d.ts +50 -0
  119. package/dist/runtime/components/extensions/WmtsLayer.d.vue.ts +42 -0
  120. package/dist/runtime/components/extensions/WmtsLayer.vue +37 -0
  121. package/dist/runtime/components/extensions/WmtsLayer.vue.d.ts +42 -0
  122. package/dist/runtime/components/layers/BuildingLayer.d.vue.ts +28 -0
  123. package/dist/runtime/components/layers/BuildingLayer.vue +41 -0
  124. package/dist/runtime/components/layers/BuildingLayer.vue.d.ts +28 -0
  125. package/dist/runtime/components/layers/ClusterLayer.d.vue.ts +55 -0
  126. package/dist/runtime/components/layers/ClusterLayer.vue +86 -0
  127. package/dist/runtime/components/layers/ClusterLayer.vue.d.ts +55 -0
  128. package/dist/runtime/components/layers/ImageLayer.d.vue.ts +21 -0
  129. package/dist/runtime/components/layers/ImageLayer.vue +25 -0
  130. package/dist/runtime/components/layers/ImageLayer.vue.d.ts +21 -0
  131. package/dist/runtime/components/layers/RasterLayer.d.vue.ts +35 -0
  132. package/dist/runtime/components/layers/RasterLayer.vue +34 -0
  133. package/dist/runtime/components/layers/RasterLayer.vue.d.ts +35 -0
  134. package/dist/runtime/components/layers/VideoLayer.d.vue.ts +28 -0
  135. package/dist/runtime/components/layers/VideoLayer.vue +38 -0
  136. package/dist/runtime/components/layers/VideoLayer.vue.d.ts +28 -0
  137. package/dist/runtime/composables/defineMaplibreControl.d.ts +3 -0
  138. package/dist/runtime/composables/defineMaplibreControl.js +6 -0
  139. package/dist/runtime/composables/useFeatureState.d.ts +35 -0
  140. package/dist/runtime/composables/useFeatureState.js +76 -0
  141. package/dist/runtime/composables/useFrameIcon.d.ts +17 -0
  142. package/dist/runtime/composables/useFrameIcon.js +36 -0
  143. package/dist/runtime/composables/useMap.d.ts +3 -0
  144. package/dist/runtime/composables/useMap.js +9 -0
  145. package/dist/runtime/composables/useMapAnimation.d.ts +21 -0
  146. package/dist/runtime/composables/useMapAnimation.js +13 -0
  147. package/dist/runtime/composables/useMapExport.d.ts +34 -0
  148. package/dist/runtime/composables/useMapExport.js +35 -0
  149. package/dist/runtime/composables/useMaplibre.d.ts +6 -0
  150. package/dist/runtime/composables/useMaplibre.js +4 -0
  151. package/dist/runtime/composables/useMaplibreCamera.d.ts +15 -0
  152. package/dist/runtime/composables/useMaplibreCamera.js +32 -0
  153. package/dist/runtime/composables/useMaplibreDraw.d.ts +10 -0
  154. package/dist/runtime/composables/useMaplibreDraw.js +34 -0
  155. package/dist/runtime/composables/useMaplibreImage.d.ts +19 -0
  156. package/dist/runtime/composables/useMaplibreImage.js +33 -0
  157. package/dist/runtime/composables/useMeasure.d.ts +25 -0
  158. package/dist/runtime/composables/useMeasure.js +173 -0
  159. package/dist/runtime/domains/map/config.d.ts +7 -0
  160. package/dist/runtime/domains/map/config.js +13 -0
  161. package/dist/runtime/domains/map/context.d.ts +13 -0
  162. package/dist/runtime/domains/map/context.js +51 -0
  163. package/dist/runtime/domains/map/control.d.ts +4 -0
  164. package/dist/runtime/domains/map/control.js +28 -0
  165. package/dist/runtime/domains/map/create-map.d.ts +3 -0
  166. package/dist/runtime/domains/map/create-map.js +21 -0
  167. package/dist/runtime/domains/map/draw-context.d.ts +26 -0
  168. package/dist/runtime/domains/map/draw-context.js +73 -0
  169. package/dist/runtime/domains/map/draw-registry.d.ts +5 -0
  170. package/dist/runtime/domains/map/draw-registry.js +15 -0
  171. package/dist/runtime/domains/map/draw-toolbar.d.ts +15 -0
  172. package/dist/runtime/domains/map/draw-toolbar.js +52 -0
  173. package/dist/runtime/domains/map/draw.d.ts +4 -0
  174. package/dist/runtime/domains/map/draw.js +1 -0
  175. package/dist/runtime/domains/map/layer-group.d.ts +9 -0
  176. package/dist/runtime/domains/map/layer-group.js +1 -0
  177. package/dist/runtime/domains/map/registry.d.ts +4 -0
  178. package/dist/runtime/domains/map/registry.js +10 -0
  179. package/dist/runtime/domains/map/resolve.d.ts +7 -0
  180. package/dist/runtime/domains/map/resolve.js +7 -0
  181. package/dist/runtime/domains/map/style-effect.d.ts +6 -0
  182. package/dist/runtime/domains/map/style-effect.js +21 -0
  183. package/dist/runtime/draw-modes/index.d.ts +16 -0
  184. package/dist/runtime/draw-modes/index.js +32 -0
  185. package/dist/runtime/index.css +1 -0
  186. package/dist/runtime/plugins/config.d.ts +2 -0
  187. package/dist/runtime/plugins/config.js +6 -0
  188. package/dist/runtime/types/draw.d.ts +30 -0
  189. package/dist/runtime/types/draw.js +0 -0
  190. package/dist/runtime/types/index.d.ts +3 -0
  191. package/dist/runtime/types/index.js +0 -0
  192. package/dist/runtime/types/map.d.ts +45 -0
  193. package/dist/runtime/types/map.js +0 -0
  194. package/dist/runtime/types/tianditu.d.ts +247 -0
  195. package/dist/runtime/types/tianditu.js +0 -0
  196. package/dist/runtime/utils/animated-image.d.ts +13 -0
  197. package/dist/runtime/utils/animated-image.js +47 -0
  198. package/dist/runtime/utils/buffer.d.ts +24 -0
  199. package/dist/runtime/utils/buffer.js +13 -0
  200. package/dist/runtime/utils/building-effects.d.ts +73 -0
  201. package/dist/runtime/utils/building-effects.js +50 -0
  202. package/dist/runtime/utils/building.d.ts +53 -0
  203. package/dist/runtime/utils/building.js +26 -0
  204. package/dist/runtime/utils/cluster.d.ts +24 -0
  205. package/dist/runtime/utils/cluster.js +42 -0
  206. package/dist/runtime/utils/coordinate.d.ts +12 -0
  207. package/dist/runtime/utils/coordinate.js +44 -0
  208. package/dist/runtime/utils/draw-theme.d.ts +47 -0
  209. package/dist/runtime/utils/draw-theme.js +39 -0
  210. package/dist/runtime/utils/effects.d.ts +34 -0
  211. package/dist/runtime/utils/effects.js +78 -0
  212. package/dist/runtime/utils/events.d.ts +6 -0
  213. package/dist/runtime/utils/events.js +20 -0
  214. package/dist/runtime/utils/frame-icon.d.ts +27 -0
  215. package/dist/runtime/utils/frame-icon.js +45 -0
  216. package/dist/runtime/utils/geometry.d.ts +5 -0
  217. package/dist/runtime/utils/geometry.js +41 -0
  218. package/dist/runtime/utils/heatmap.d.ts +36 -0
  219. package/dist/runtime/utils/heatmap.js +30 -0
  220. package/dist/runtime/utils/layer.d.ts +13 -0
  221. package/dist/runtime/utils/layer.js +17 -0
  222. package/dist/runtime/utils/logger.d.ts +2 -0
  223. package/dist/runtime/utils/logger.js +2 -0
  224. package/dist/runtime/utils/measure.d.ts +4 -0
  225. package/dist/runtime/utils/measure.js +8 -0
  226. package/dist/runtime/utils/sprite.d.ts +31 -0
  227. package/dist/runtime/utils/sprite.js +23 -0
  228. package/dist/runtime/utils/tianditu-administrative.d.ts +3 -0
  229. package/dist/runtime/utils/tianditu-administrative.js +48 -0
  230. package/dist/runtime/utils/tianditu-client.d.ts +30 -0
  231. package/dist/runtime/utils/tianditu-client.js +17 -0
  232. package/dist/runtime/utils/tianditu-geocoder.d.ts +5 -0
  233. package/dist/runtime/utils/tianditu-geocoder.js +37 -0
  234. package/dist/runtime/utils/tianditu-request.d.ts +20 -0
  235. package/dist/runtime/utils/tianditu-request.js +42 -0
  236. package/dist/runtime/utils/tianditu-route.d.ts +3 -0
  237. package/dist/runtime/utils/tianditu-route.js +40 -0
  238. package/dist/runtime/utils/tianditu-search.d.ts +15 -0
  239. package/dist/runtime/utils/tianditu-search.js +183 -0
  240. package/dist/runtime/utils/tianditu.d.ts +21 -0
  241. package/dist/runtime/utils/tianditu.js +26 -0
  242. package/dist/runtime/utils/wms.d.ts +43 -0
  243. package/dist/runtime/utils/wms.js +30 -0
  244. package/dist/runtime/utils/wmts.d.ts +35 -0
  245. package/dist/runtime/utils/wmts.js +29 -0
  246. package/dist/types.d.mts +5 -0
  247. package/dist/unplugin.d.mts +30 -0
  248. package/dist/unplugin.d.ts +30 -0
  249. package/dist/unplugin.mjs +53 -0
  250. package/dist/vite.d.mts +7 -0
  251. package/dist/vite.d.ts +7 -0
  252. package/dist/vite.mjs +11 -0
  253. package/dist/vue-plugin.d.mts +9 -0
  254. package/dist/vue-plugin.d.ts +9 -0
  255. package/dist/vue-plugin.mjs +9 -0
  256. package/package.json +174 -0
@@ -0,0 +1,35 @@
1
+ type __VLS_Props = {
2
+ /** 图层 id;省略时自动生成 */
3
+ layerId?: string;
4
+ /** URL 模板瓦片地址({z}/{x}/{y} 占位) */
5
+ tiles: string[];
6
+ /**
7
+ * 瓦片尺寸
8
+ * @defaultValue 256
9
+ */
10
+ tileSize?: number;
11
+ /**
12
+ * 瓦片坐标方案
13
+ * @defaultValue 'xyz'
14
+ */
15
+ scheme?: 'xyz' | 'tms';
16
+ /** 数据源最小缩放级别 */
17
+ minzoom?: number;
18
+ /** 数据源最大缩放级别 */
19
+ maxzoom?: number;
20
+ /** 版权信息 */
21
+ attribution?: string;
22
+ /**
23
+ * 不透明度
24
+ * @defaultValue 1
25
+ */
26
+ opacity?: number;
27
+ /** 插入到该图层之前 */
28
+ beforeId?: string;
29
+ };
30
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
31
+ opacity: number;
32
+ tileSize: number;
33
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
+ declare const _default: typeof __VLS_export;
35
+ export default _default;
@@ -0,0 +1,28 @@
1
+ import type { VideoSourceSpecification } from '@maplibre/maplibre-gl-style-spec';
2
+ type __VLS_Props = {
3
+ /** 图层 id;省略时自动生成 */
4
+ layerId?: string;
5
+ /** 视频地址列表(多格式回退) */
6
+ urls: string[];
7
+ /** 四角经纬度:左上/右上/右下/左下 */
8
+ coordinates: VideoSourceSpecification['coordinates'];
9
+ /**
10
+ * 不透明度
11
+ * @defaultValue 1
12
+ */
13
+ opacity?: number;
14
+ /** 插入到该图层之前 */
15
+ beforeId?: string;
16
+ };
17
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
18
+ /** 播放视频 */
19
+ play: () => void | undefined;
20
+ /** 暂停视频 */
21
+ pause: () => void | undefined;
22
+ /** 底层 video 元素 */
23
+ video: () => HTMLVideoElement | undefined;
24
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
25
+ opacity: number;
26
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
27
+ declare const _default: typeof __VLS_export;
28
+ export default _default;
@@ -0,0 +1,38 @@
1
+ <script setup>
2
+ import { computed, useId } from "vue";
3
+ import { useMap } from "../../composables/useMap";
4
+ import MaplibreSource from "../Source.vue";
5
+ import MaplibreLayer from "../Layer.vue";
6
+ const props = defineProps({
7
+ layerId: { type: String, required: false },
8
+ urls: { type: Array, required: true },
9
+ coordinates: { type: Array, required: true },
10
+ opacity: { type: Number, required: false, default: 1 },
11
+ beforeId: { type: String, required: false }
12
+ });
13
+ const ctx = useMap();
14
+ const id = props.layerId ?? `movk-video-${useId()}`;
15
+ const source = computed(() => ({
16
+ type: "video",
17
+ urls: props.urls,
18
+ coordinates: props.coordinates
19
+ }));
20
+ const paint = computed(() => ({ "raster-opacity": props.opacity }));
21
+ function videoSource() {
22
+ return ctx.map.value?.getSource(id);
23
+ }
24
+ defineExpose({
25
+ /** 播放视频 */
26
+ play: () => videoSource()?.play(),
27
+ /** 暂停视频 */
28
+ pause: () => videoSource()?.pause(),
29
+ /** 底层 video 元素 */
30
+ video: () => videoSource()?.getVideo()
31
+ });
32
+ </script>
33
+
34
+ <template>
35
+ <MaplibreSource :source-id="id" :source="source">
36
+ <MaplibreLayer :layer-id="id" type="raster" :source="id" :paint="paint" :before-id="beforeId" />
37
+ </MaplibreSource>
38
+ </template>
@@ -0,0 +1,28 @@
1
+ import type { VideoSourceSpecification } from '@maplibre/maplibre-gl-style-spec';
2
+ type __VLS_Props = {
3
+ /** 图层 id;省略时自动生成 */
4
+ layerId?: string;
5
+ /** 视频地址列表(多格式回退) */
6
+ urls: string[];
7
+ /** 四角经纬度:左上/右上/右下/左下 */
8
+ coordinates: VideoSourceSpecification['coordinates'];
9
+ /**
10
+ * 不透明度
11
+ * @defaultValue 1
12
+ */
13
+ opacity?: number;
14
+ /** 插入到该图层之前 */
15
+ beforeId?: string;
16
+ };
17
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
18
+ /** 播放视频 */
19
+ play: () => void | undefined;
20
+ /** 暂停视频 */
21
+ pause: () => void | undefined;
22
+ /** 底层 video 元素 */
23
+ video: () => HTMLVideoElement | undefined;
24
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
25
+ opacity: number;
26
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
27
+ declare const _default: typeof __VLS_export;
28
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { IControl, Map as MaplibreMap } from 'maplibre-gl';
2
+ /** 用回调式 onAdd/onRemove 快速定义一个自定义 MapLibre 控件。 */
3
+ export declare function defineMaplibreControl(onAdd: (map: MaplibreMap) => HTMLElement, onRemove: (map: MaplibreMap) => void): IControl;
@@ -0,0 +1,6 @@
1
+ export function defineMaplibreControl(onAdd, onRemove) {
2
+ return {
3
+ onAdd,
4
+ onRemove
5
+ };
6
+ }
@@ -0,0 +1,35 @@
1
+ import type { ShallowRef } from 'vue';
2
+ import type { MapGeoJSONFeature } from 'maplibre-gl';
3
+ export interface UseFeatureStateOptions {
4
+ /** 目标地图 id;在 MaplibreMap 子树外使用时必填 */
5
+ mapId?: string;
6
+ /**
7
+ * 维护 hover 状态
8
+ * @defaultValue true
9
+ */
10
+ hover?: boolean;
11
+ /**
12
+ * 维护 click 选中状态
13
+ * @defaultValue true
14
+ */
15
+ select?: boolean;
16
+ /**
17
+ * 悬浮时设置 pointer 指针
18
+ * @defaultValue true
19
+ */
20
+ cursor?: boolean;
21
+ }
22
+ export interface UseFeatureStateReturn {
23
+ /** 当前悬浮要素 */
24
+ hovered: ShallowRef<MapGeoJSONFeature | undefined>;
25
+ /** 当前选中要素 */
26
+ selected: ShallowRef<MapGeoJSONFeature | undefined>;
27
+ /** 清除选中 */
28
+ clearSelection: () => void;
29
+ }
30
+ /**
31
+ * 在目标图层上维护 feature-state 的 hover/selected 状态,
32
+ * 消费侧 paint 用 ['feature-state', 'hover' | 'selected'] 表达式驱动样式。
33
+ * 要素必须有 id(或 source 配置 promoteId / generateId)。
34
+ */
35
+ export declare function useFeatureState(layerId: string, options?: UseFeatureStateOptions): UseFeatureStateReturn;
@@ -0,0 +1,76 @@
1
+ import { onMounted, onUnmounted, shallowRef } from "vue";
2
+ import { useContextResolver } from "../domains/map/resolve.js";
3
+ import { logger } from "../utils/logger.js";
4
+ export function useFeatureState(layerId, options = {}) {
5
+ const { hover = true, select = true, cursor = true } = options;
6
+ const resolve = useContextResolver(options.mapId);
7
+ const hovered = shallowRef();
8
+ const selected = shallowRef();
9
+ let boundMap;
10
+ function clearState(map, feature, key) {
11
+ try {
12
+ map.removeFeatureState(feature, key);
13
+ } catch {
14
+ }
15
+ }
16
+ function setCursor(map, value) {
17
+ const canvas = map.getCanvas();
18
+ if (canvas) canvas.style.cursor = value;
19
+ }
20
+ function onMove(event) {
21
+ const map = boundMap;
22
+ const feature = event.features?.[0];
23
+ if (!map || !feature || feature.id === void 0) return;
24
+ if (cursor) setCursor(map, "pointer");
25
+ if (hovered.value?.id === feature.id) return;
26
+ if (hovered.value) clearState(map, hovered.value, "hover");
27
+ map.setFeatureState(feature, { hover: true });
28
+ hovered.value = feature;
29
+ }
30
+ function onLeave() {
31
+ const map = boundMap;
32
+ if (!map) return;
33
+ if (cursor) setCursor(map, "");
34
+ if (hovered.value) clearState(map, hovered.value, "hover");
35
+ hovered.value = void 0;
36
+ }
37
+ function onClick(event) {
38
+ const map = boundMap;
39
+ const feature = event.features?.[0];
40
+ if (!map || !feature || feature.id === void 0) return;
41
+ if (selected.value) clearState(map, selected.value, "selected");
42
+ map.setFeatureState(feature, { selected: true });
43
+ selected.value = feature;
44
+ }
45
+ function clearSelection() {
46
+ if (boundMap && selected.value) clearState(boundMap, selected.value, "selected");
47
+ selected.value = void 0;
48
+ }
49
+ onMounted(async () => {
50
+ const ctx = resolve();
51
+ if (!ctx) {
52
+ logger.warn("useFeatureState: no map context found; pass options.mapId or call inside <MaplibreMap>.");
53
+ return;
54
+ }
55
+ const map = await ctx.whenLoaded();
56
+ boundMap = map;
57
+ if (hover) {
58
+ map.on("mousemove", layerId, onMove);
59
+ map.on("mouseleave", layerId, onLeave);
60
+ }
61
+ if (select) map.on("click", layerId, onClick);
62
+ });
63
+ onUnmounted(() => {
64
+ const map = boundMap;
65
+ if (!map) return;
66
+ if (hover) {
67
+ map.off("mousemove", layerId, onMove);
68
+ map.off("mouseleave", layerId, onLeave);
69
+ onLeave();
70
+ }
71
+ if (select) map.off("click", layerId, onClick);
72
+ clearSelection();
73
+ boundMap = void 0;
74
+ });
75
+ return { hovered, selected, clearSelection };
76
+ }
@@ -0,0 +1,17 @@
1
+ export interface UseFrameIconOptions {
2
+ /** 注册到样式的图片名(symbol 图层 icon-image 引用) */
3
+ imageName: string;
4
+ /** 纹理边长(像素) */
5
+ size: number;
6
+ /** 当前帧序列(响应式取值) */
7
+ frames: () => ImageData[];
8
+ /** 固定帧率,durations 缺省时生效 */
9
+ fps?: number;
10
+ /** 每帧时长 ms(响应式取值),优先于 fps */
11
+ durations?: () => number[] | undefined;
12
+ }
13
+ /**
14
+ * 帧动画图标生命周期:注册 StyleImageInterface、样式重载补回、styleimagemissing 兜底、卸载清理。
15
+ * SpriteImage / AnimatedImage 共用,确保纹理建立与缺图兜底逻辑一致。
16
+ */
17
+ export declare function useFrameIcon(options: UseFrameIconOptions): void;
@@ -0,0 +1,36 @@
1
+ import { onUnmounted } from "vue";
2
+ import { useMap } from "./useMap.js";
3
+ import { createFrameStyleImage } from "../utils/frame-icon.js";
4
+ export function useFrameIcon(options) {
5
+ const ctx = useMap();
6
+ const { imageName } = options;
7
+ const image = createFrameStyleImage({
8
+ size: options.size,
9
+ frames: options.frames,
10
+ fps: options.fps,
11
+ durations: options.durations,
12
+ getMap: () => ctx.map.value
13
+ });
14
+ function ensureImage(map) {
15
+ if (!map.isStyleLoaded() || map.hasImage(imageName)) return;
16
+ map.addImage(imageName, image);
17
+ }
18
+ function onMissing(e) {
19
+ const map = ctx.map.value;
20
+ if (e.id === imageName && map && !map.hasImage(imageName)) {
21
+ map.addImage(imageName, image);
22
+ }
23
+ }
24
+ const stopReady = ctx.onReady((map) => {
25
+ ensureImage(map);
26
+ map.off("styleimagemissing", onMissing);
27
+ map.on("styleimagemissing", onMissing);
28
+ });
29
+ onUnmounted(() => {
30
+ stopReady();
31
+ const map = ctx.map.value;
32
+ if (!map) return;
33
+ map.off("styleimagemissing", onMissing);
34
+ if (map.hasImage(imageName)) map.removeImage(imageName);
35
+ });
36
+ }
@@ -0,0 +1,3 @@
1
+ import type { MaplibreContext } from '../types';
2
+ /** 注入当前 MaplibreMap 的上下文;必须在 MaplibreMap 子树内调用。 */
3
+ export declare function useMap(): MaplibreContext;
@@ -0,0 +1,9 @@
1
+ import { inject } from "vue";
2
+ import { MaplibreContextKey } from "../domains/map/context.js";
3
+ export function useMap() {
4
+ const context = inject(MaplibreContextKey, null);
5
+ if (!context) {
6
+ throw new Error("[movk-maplibre] useMap() must be called inside a <MaplibreMap> component.");
7
+ }
8
+ return context;
9
+ }
@@ -0,0 +1,21 @@
1
+ import type { Ref } from 'vue';
2
+ import type { Map as MaplibreMap } from 'maplibre-gl';
3
+ export interface UseMapAnimationOptions {
4
+ /** 目标地图 id;在 MaplibreMap 子树外使用时必填 */
5
+ mapId?: string;
6
+ /**
7
+ * 创建后立即启动
8
+ * @defaultValue true
9
+ */
10
+ immediate?: boolean;
11
+ }
12
+ export interface UseMapAnimationReturn {
13
+ pause: () => void;
14
+ resume: () => void;
15
+ isActive: Readonly<Ref<boolean>>;
16
+ }
17
+ /**
18
+ * 地图帧动画原语:基于 useRafFn(组件卸载自动停止),
19
+ * 仅在地图存在且样式就绪时调用 frame,供动效组件与帧驱动图片复用。
20
+ */
21
+ export declare function useMapAnimation(frame: (map: MaplibreMap, elapsedMs: number) => void, options?: UseMapAnimationOptions): UseMapAnimationReturn;
@@ -0,0 +1,13 @@
1
+ import { useRafFn } from "@vueuse/core";
2
+ import { useContextResolver } from "../domains/map/resolve.js";
3
+ export function useMapAnimation(frame, options = {}) {
4
+ const resolve = useContextResolver(options.mapId);
5
+ let start;
6
+ const { pause, resume, isActive } = useRafFn(({ timestamp }) => {
7
+ const map = resolve()?.map.value;
8
+ if (!map || !map.isStyleLoaded()) return;
9
+ start ??= timestamp;
10
+ frame(map, timestamp - start);
11
+ }, { immediate: options.immediate ?? true });
12
+ return { pause, resume, isActive };
13
+ }
@@ -0,0 +1,34 @@
1
+ export interface UseMapExportOptions {
2
+ /** 目标地图 id;在 MaplibreMap 子树外使用时必填 */
3
+ mapId?: string;
4
+ }
5
+ export interface ExportImageOptions {
6
+ /**
7
+ * 图像格式
8
+ * @defaultValue 'image/png'
9
+ */
10
+ format?: 'image/png' | 'image/jpeg' | 'image/webp';
11
+ /**
12
+ * 有损格式质量 0-1
13
+ * @defaultValue 0.92
14
+ */
15
+ quality?: number;
16
+ }
17
+ export interface DownloadOptions extends ExportImageOptions {
18
+ /**
19
+ * 下载文件名
20
+ * @defaultValue 'map.png'
21
+ */
22
+ fileName?: string;
23
+ }
24
+ export interface UseMapExportReturn {
25
+ /** 导出当前地图为 dataURL */
26
+ exportImage: (options?: ExportImageOptions) => Promise<string>;
27
+ /** 导出并触发浏览器下载 */
28
+ download: (options?: DownloadOptions) => Promise<void>;
29
+ }
30
+ /**
31
+ * 地图导出:在 render 回调内同步读画布,免 preserveDrawingBuffer 改造。
32
+ * WebGL 缓冲区在帧渲染后即被清空,故必须在 render 事件回调内取 toDataURL。
33
+ */
34
+ export declare function useMapExport(options?: UseMapExportOptions): UseMapExportReturn;
@@ -0,0 +1,35 @@
1
+ import { useContextResolver } from "../domains/map/resolve.js";
2
+ import { logger } from "../utils/logger.js";
3
+ export function useMapExport(options = {}) {
4
+ const resolve = useContextResolver(options.mapId);
5
+ async function exportImage(opts = {}) {
6
+ const ctx = resolve();
7
+ if (!ctx) {
8
+ throw new Error("[movk-maplibre] useMapExport: no map context found; pass options.mapId or call inside <MaplibreMap>.");
9
+ }
10
+ const map = await ctx.whenLoaded();
11
+ return new Promise((resolve2, reject) => {
12
+ map.once("render", () => {
13
+ try {
14
+ resolve2(map.getCanvas().toDataURL(opts.format ?? "image/png", opts.quality ?? 0.92));
15
+ } catch (error) {
16
+ reject(error instanceof Error ? error : new Error(String(error)));
17
+ }
18
+ });
19
+ map.triggerRepaint();
20
+ });
21
+ }
22
+ async function download(opts = {}) {
23
+ try {
24
+ const dataUrl = await exportImage(opts);
25
+ const link = document.createElement("a");
26
+ link.href = dataUrl;
27
+ link.download = opts.fileName ?? "map.png";
28
+ link.click();
29
+ } catch (error) {
30
+ logger.warn("Map export failed:", error);
31
+ throw error;
32
+ }
33
+ }
34
+ return { exportImage, download };
35
+ }
@@ -0,0 +1,6 @@
1
+ import type { MaplibreContext } from '../types';
2
+ /**
3
+ * 按 id 从注册表获取地图上下文(逃生口)。
4
+ * 用于在组件树之外或跨路由访问已挂载的地图;未找到时返回 undefined。
5
+ */
6
+ export declare function useMaplibre(id: string): MaplibreContext | undefined;
@@ -0,0 +1,4 @@
1
+ import { getMapContext } from "../domains/map/registry.js";
2
+ export function useMaplibre(id) {
3
+ return getMapContext(id);
4
+ }
@@ -0,0 +1,15 @@
1
+ import type { CameraOptions, EaseToOptions, FitBoundsOptions, FlyToOptions, LngLatBoundsLike } from 'maplibre-gl';
2
+ import type { GeoJSON } from 'geojson';
3
+ export interface UseMaplibreCameraOptions {
4
+ /** 目标地图 id;在 MaplibreMap 子树外使用时必填 */
5
+ mapId?: string;
6
+ }
7
+ export interface UseMaplibreCameraReturn {
8
+ flyTo: (options: FlyToOptions) => Promise<void>;
9
+ easeTo: (options: EaseToOptions) => Promise<void>;
10
+ jumpTo: (options: CameraOptions) => Promise<void>;
11
+ /** 缩放到目标范围;target 支持包围盒或任意 GeoJSON(自动求包围盒) */
12
+ fitBounds: (target: LngLatBoundsLike | GeoJSON, options?: FitBoundsOptions) => Promise<void>;
13
+ }
14
+ /** 相机操作助手;所有方法等待地图加载完成后执行。 */
15
+ export declare function useMaplibreCamera(options?: UseMaplibreCameraOptions): UseMaplibreCameraReturn;
@@ -0,0 +1,32 @@
1
+ import { useContextResolver } from "../domains/map/resolve.js";
2
+ import { boundsOfGeoJSON } from "../utils/geometry.js";
3
+ import { logger } from "../utils/logger.js";
4
+ function isGeoJSON(target) {
5
+ return !Array.isArray(target) && typeof target === "object" && target !== null && typeof target.type === "string";
6
+ }
7
+ export function useMaplibreCamera(options = {}) {
8
+ const resolve = useContextResolver(options.mapId);
9
+ async function withMap(action) {
10
+ const ctx = resolve();
11
+ if (!ctx) {
12
+ logger.warn("useMaplibreCamera: no map context found; pass options.mapId or call inside <MaplibreMap>.");
13
+ return;
14
+ }
15
+ action(await ctx.whenLoaded());
16
+ }
17
+ return {
18
+ flyTo: (options2) => withMap((map) => map.flyTo(options2)),
19
+ easeTo: (options2) => withMap((map) => map.easeTo(options2)),
20
+ jumpTo: (options2) => withMap((map) => map.jumpTo(options2)),
21
+ fitBounds(target, fitOptions) {
22
+ return withMap((map) => {
23
+ const bounds = isGeoJSON(target) ? boundsOfGeoJSON(target) : target;
24
+ if (!bounds) {
25
+ logger.warn("fitBounds: target GeoJSON has no coordinates.");
26
+ return;
27
+ }
28
+ map.fitBounds(bounds, fitOptions);
29
+ });
30
+ }
31
+ };
32
+ }
@@ -0,0 +1,10 @@
1
+ import type { MaplibreDrawContext } from '../types';
2
+ export interface UseMaplibreDrawOptions {
3
+ /** 目标地图 id;在 MaplibreDrawControl 子树外使用时必填 */
4
+ mapId?: string;
5
+ }
6
+ /**
7
+ * 获取绘制上下文:省略 mapId 时注入最近的 MaplibreDrawControl,
8
+ * 传入 mapId 时按 id 查注册表,可在其子树外(如全局面板)驱动绘制。
9
+ */
10
+ export declare function useMaplibreDraw(options?: UseMaplibreDrawOptions): MaplibreDrawContext;
@@ -0,0 +1,34 @@
1
+ import { computed, inject } from "vue";
2
+ import { DrawKey } from "../domains/map/draw.js";
3
+ import { getDrawContext } from "../domains/map/draw-registry.js";
4
+ import { logger } from "../utils/logger.js";
5
+ function createRemoteContext(mapId) {
6
+ function resolve(action) {
7
+ const context = getDrawContext(mapId);
8
+ if (!context) logger.warn(`useMaplibreDraw: no <MaplibreDrawControl> registered for map "${mapId}"; ${action} ignored.`);
9
+ return context;
10
+ }
11
+ return {
12
+ mapId,
13
+ draw: computed(() => getDrawContext(mapId)?.draw.value),
14
+ whenReady() {
15
+ const context = getDrawContext(mapId);
16
+ return context ? context.whenReady() : Promise.reject(new Error(`[movk-maplibre] no <MaplibreDrawControl> registered for map "${mapId}".`));
17
+ },
18
+ changeMode: async (mode) => resolve("changeMode")?.changeMode(mode),
19
+ add: async (geojson) => await resolve("add")?.add(geojson) ?? [],
20
+ deleteAll: async () => resolve("deleteAll")?.deleteAll(),
21
+ setFeatureProperty: async (featureId, property, value) => resolve("setFeatureProperty")?.setFeatureProperty(featureId, property, value),
22
+ // 读操作静默降级:常在 computed 中反复求值,告警会刷屏
23
+ getAll: () => getDrawContext(mapId)?.getAll(),
24
+ getMode: () => getDrawContext(mapId)?.getMode()
25
+ };
26
+ }
27
+ export function useMaplibreDraw(options = {}) {
28
+ if (options.mapId) return createRemoteContext(options.mapId);
29
+ const context = inject(DrawKey, null);
30
+ if (!context) {
31
+ throw new Error("[movk-maplibre] useMaplibreDraw() must be called inside a <MaplibreDrawControl> component, or pass options.mapId.");
32
+ }
33
+ return context;
34
+ }
@@ -0,0 +1,19 @@
1
+ import type { Ref } from 'vue';
2
+ export interface UseMaplibreImageOptions {
3
+ /** 目标地图 id;在 MaplibreMap 子树外使用时必填 */
4
+ mapId?: string;
5
+ /** 作为 SDF 图标(可经 icon-color 着色) */
6
+ sdf?: boolean;
7
+ /**
8
+ * 像素密度
9
+ * @defaultValue 1
10
+ */
11
+ pixelRatio?: number;
12
+ }
13
+ /**
14
+ * 注册 symbol 图层可用的命名图片。
15
+ * setStyle 清空样式图片后经 onReady 自动补回;卸载时移除。
16
+ */
17
+ export declare function useMaplibreImage(name: string, url: string, options?: UseMaplibreImageOptions): {
18
+ loaded: Ref<boolean>;
19
+ };
@@ -0,0 +1,33 @@
1
+ import { onMounted, onUnmounted, ref } from "vue";
2
+ import { useContextResolver } from "../domains/map/resolve.js";
3
+ import { logger } from "../utils/logger.js";
4
+ export function useMaplibreImage(name, url, options = {}) {
5
+ const { mapId, ...imageOptions } = options;
6
+ const resolve = useContextResolver(mapId);
7
+ const loaded = ref(false);
8
+ let ctx;
9
+ let stopReady;
10
+ onMounted(() => {
11
+ ctx = resolve();
12
+ if (!ctx) {
13
+ logger.warn("useMaplibreImage: no map context found; pass options.mapId or call inside <MaplibreMap>.");
14
+ return;
15
+ }
16
+ stopReady = ctx.onReady((map) => {
17
+ if (map.hasImage(name)) {
18
+ loaded.value = true;
19
+ return;
20
+ }
21
+ map.loadImage(url).then(({ data }) => {
22
+ if (!map.hasImage(name)) map.addImage(name, data, imageOptions);
23
+ loaded.value = true;
24
+ }).catch((error) => logger.warn(`Failed to load image "${name}":`, error));
25
+ });
26
+ });
27
+ onUnmounted(() => {
28
+ stopReady?.();
29
+ const map = ctx?.map.value;
30
+ if (map?.hasImage(name)) map.removeImage(name);
31
+ });
32
+ return { loaded };
33
+ }
@@ -0,0 +1,25 @@
1
+ import type { Ref } from 'vue';
2
+ export type MeasureMode = 'distance' | 'area';
3
+ export interface UseMeasureOptions {
4
+ /** 目标地图 id;在 MaplibreMap 子树外使用时必填 */
5
+ mapId?: string;
6
+ /**
7
+ * 主色
8
+ * @defaultValue '#f59e0b'
9
+ */
10
+ color?: string;
11
+ }
12
+ export interface UseMeasureReturn {
13
+ /** 进入测量:click 加点、mousemove 预览、dblclick 结束当前段 */
14
+ start: (mode: MeasureMode) => void;
15
+ /** 退出测量交互(保留已绘结果) */
16
+ stop: () => void;
17
+ /** 清空全部测量结果 */
18
+ clear: () => void;
19
+ mode: Ref<MeasureMode | undefined>;
20
+ active: Ref<boolean>;
21
+ /** 当前段(含光标预览)的格式化读数 */
22
+ result: Ref<string>;
23
+ }
24
+ /** 测距/测面工具:自管 geojson 源与展示图层,turf 计算实时读数。 */
25
+ export declare function useMeasure(options?: UseMeasureOptions): UseMeasureReturn;