@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,75 @@
1
+ import type { FilterSpecification, LayerSpecification, SourceSpecification } from '@maplibre/maplibre-gl-style-spec';
2
+ type PropBag = Record<string, unknown>;
3
+ type __VLS_Props = {
4
+ /** 图层 id,全局唯一 */
5
+ layerId: string;
6
+ /**
7
+ * 图层类型,决定渲染方式与可用的 paint / layout 属性
8
+ * @see https://maplibre.org/maplibre-style-spec/layers/
9
+ */
10
+ type: LayerSpecification['type'];
11
+ /** source id 字符串引用,或内联 source 对象(自动创建匿名源并随图层卸载) */
12
+ source?: string | SourceSpecification;
13
+ /** 矢量瓦片源内的子图层名(source-layer),消费矢量源时必填 */
14
+ sourceLayer?: string;
15
+ /**
16
+ * 绘制样式属性,响应式变更经 setPaintProperty 增量下发
17
+ * @see https://maplibre.org/maplibre-style-spec/layers/
18
+ */
19
+ paint?: PropBag;
20
+ /**
21
+ * 布局属性,响应式变更经 setLayoutProperty 增量下发
22
+ * @see https://maplibre.org/maplibre-style-spec/layers/
23
+ */
24
+ layout?: PropBag;
25
+ /**
26
+ * 过滤表达式,仅渲染匹配的要素
27
+ * @see https://maplibre.org/maplibre-style-spec/expressions/
28
+ */
29
+ filter?: FilterSpecification;
30
+ /**
31
+ * 最小缩放级别,低于此级别不渲染
32
+ * @defaultValue 0
33
+ */
34
+ minzoom?: number;
35
+ /**
36
+ * 最大缩放级别,高于此级别不渲染
37
+ * @defaultValue 24
38
+ */
39
+ maxzoom?: number;
40
+ /** 插入到该 id 图层之前;省略则追加到图层栈顶部 */
41
+ beforeId?: string;
42
+ };
43
+ declare var __VLS_1: {};
44
+ type __VLS_Slots = {} & {
45
+ default?: (props: typeof __VLS_1) => any;
46
+ };
47
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
48
+ click: (event: import("maplibre-gl").MapLayerMouseEvent) => any;
49
+ contextmenu: (event: import("maplibre-gl").MapLayerMouseEvent) => any;
50
+ dblclick: (event: import("maplibre-gl").MapLayerMouseEvent) => any;
51
+ mousemove: (event: import("maplibre-gl").MapLayerMouseEvent) => any;
52
+ mouseup: (event: import("maplibre-gl").MapLayerMouseEvent) => any;
53
+ mousedown: (event: import("maplibre-gl").MapLayerMouseEvent) => any;
54
+ mouseenter: (event: import("maplibre-gl").MapLayerMouseEvent) => any;
55
+ mouseleave: (event: import("maplibre-gl").MapLayerMouseEvent) => any;
56
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
57
+ onClick?: ((event: import("maplibre-gl").MapLayerMouseEvent) => any) | undefined;
58
+ onContextmenu?: ((event: import("maplibre-gl").MapLayerMouseEvent) => any) | undefined;
59
+ onDblclick?: ((event: import("maplibre-gl").MapLayerMouseEvent) => any) | undefined;
60
+ onMousemove?: ((event: import("maplibre-gl").MapLayerMouseEvent) => any) | undefined;
61
+ onMouseup?: ((event: import("maplibre-gl").MapLayerMouseEvent) => any) | undefined;
62
+ onMousedown?: ((event: import("maplibre-gl").MapLayerMouseEvent) => any) | undefined;
63
+ onMouseenter?: ((event: import("maplibre-gl").MapLayerMouseEvent) => any) | undefined;
64
+ onMouseleave?: ((event: import("maplibre-gl").MapLayerMouseEvent) => any) | undefined;
65
+ }>, {
66
+ filter: FilterSpecification;
67
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
68
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
69
+ declare const _default: typeof __VLS_export;
70
+ export default _default;
71
+ type __VLS_WithSlots<T, S> = T & {
72
+ new (): {
73
+ $slots: S;
74
+ };
75
+ };
@@ -0,0 +1,112 @@
1
+ <script setup>
2
+ import { inject, onUnmounted, watch } from "vue";
3
+ import { omitUndefined } from "@movk/core";
4
+ import { useMap } from "../composables/useMap";
5
+ import { LayerGroupKey } from "../domains/map/layer-group";
6
+ import { applyLayerProps } from "../utils/layer";
7
+ import { bindMapEvents } from "../utils/events";
8
+ const props = defineProps({
9
+ layerId: { type: String, required: true },
10
+ type: { type: String, required: true },
11
+ source: { type: [String, Object], required: false },
12
+ sourceLayer: { type: String, required: false },
13
+ paint: { type: Object, required: false },
14
+ layout: { type: Object, required: false },
15
+ filter: { type: [Boolean, Array], required: false, default: void 0 },
16
+ minzoom: { type: Number, required: false },
17
+ maxzoom: { type: Number, required: false },
18
+ beforeId: { type: String, required: false }
19
+ });
20
+ const emit = defineEmits(["click", "dblclick", "mousedown", "mouseup", "mousemove", "mouseenter", "mouseleave", "contextmenu"]);
21
+ const LAYER_EVENTS = ["click", "dblclick", "mousedown", "mouseup", "mousemove", "mouseenter", "mouseleave", "contextmenu"];
22
+ const ctx = useMap();
23
+ const group = inject(LayerGroupKey, null);
24
+ const inlineSourceId = `${props.layerId}__source`;
25
+ const hasInlineSource = typeof props.source === "object";
26
+ function resolveSourceId() {
27
+ if (props.source === void 0) return void 0;
28
+ return hasInlineSource ? inlineSourceId : props.source;
29
+ }
30
+ function buildSpec() {
31
+ const spec = omitUndefined({
32
+ id: props.layerId,
33
+ type: props.type,
34
+ source: resolveSourceId(),
35
+ paint: props.paint,
36
+ layout: props.layout,
37
+ filter: props.filter,
38
+ minzoom: props.minzoom,
39
+ maxzoom: props.maxzoom
40
+ });
41
+ if (props.sourceLayer) spec["source-layer"] = props.sourceLayer;
42
+ return spec;
43
+ }
44
+ function addLayer(map) {
45
+ if (map.getLayer(props.layerId)) return;
46
+ if (hasInlineSource && !map.getSource(inlineSourceId)) {
47
+ map.addSource(inlineSourceId, props.source);
48
+ }
49
+ const anchor = props.beforeId ?? group?.beforeId.value;
50
+ const before = anchor && map.getLayer(anchor) ? anchor : void 0;
51
+ map.addLayer(buildSpec(), before);
52
+ if (group && !group.visible.value) {
53
+ map.setLayoutProperty(props.layerId, "visibility", "none");
54
+ }
55
+ }
56
+ let stopEvents;
57
+ let onSourceData;
58
+ const stopReady = ctx.onReady((map) => {
59
+ const sourceId = resolveSourceId();
60
+ if (sourceId && !hasInlineSource && !map.getSource(sourceId)) {
61
+ if (onSourceData) map.off("sourcedata", onSourceData);
62
+ onSourceData = (event) => {
63
+ if (event.sourceId === sourceId && map.getSource(sourceId)) {
64
+ map.off("sourcedata", onSourceData);
65
+ onSourceData = void 0;
66
+ addLayer(map);
67
+ bindLayerEvents(map);
68
+ }
69
+ };
70
+ map.on("sourcedata", onSourceData);
71
+ return;
72
+ }
73
+ addLayer(map);
74
+ bindLayerEvents(map);
75
+ });
76
+ function bindLayerEvents(map) {
77
+ stopEvents?.();
78
+ stopEvents = bindMapEvents(map, LAYER_EVENTS, (type, event) => emit(type, event), props.layerId);
79
+ }
80
+ let prev = { id: props.layerId, paint: props.paint, layout: props.layout, filter: props.filter, minzoom: props.minzoom, maxzoom: props.maxzoom };
81
+ watch(
82
+ () => [props.paint, props.layout, props.filter, props.minzoom, props.maxzoom],
83
+ () => {
84
+ const map = ctx.map.value;
85
+ if (!map?.getLayer(props.layerId)) return;
86
+ const next = { id: props.layerId, paint: props.paint, layout: props.layout, filter: props.filter, minzoom: props.minzoom, maxzoom: props.maxzoom };
87
+ applyLayerProps(map, next, prev);
88
+ prev = next;
89
+ },
90
+ { deep: true }
91
+ );
92
+ if (group) {
93
+ watch(group.visible, (visible) => {
94
+ const map = ctx.map.value;
95
+ if (!map?.getLayer(props.layerId)) return;
96
+ map.setLayoutProperty(props.layerId, "visibility", visible ? "visible" : "none");
97
+ });
98
+ }
99
+ onUnmounted(() => {
100
+ stopReady();
101
+ stopEvents?.();
102
+ const map = ctx.map.value;
103
+ if (!map) return;
104
+ if (onSourceData) map.off("sourcedata", onSourceData);
105
+ if (map.getLayer(props.layerId)) map.removeLayer(props.layerId);
106
+ if (hasInlineSource && map.getSource(inlineSourceId)) map.removeSource(inlineSourceId);
107
+ });
108
+ </script>
109
+
110
+ <template>
111
+ <slot />
112
+ </template>
@@ -0,0 +1,75 @@
1
+ import type { FilterSpecification, LayerSpecification, SourceSpecification } from '@maplibre/maplibre-gl-style-spec';
2
+ type PropBag = Record<string, unknown>;
3
+ type __VLS_Props = {
4
+ /** 图层 id,全局唯一 */
5
+ layerId: string;
6
+ /**
7
+ * 图层类型,决定渲染方式与可用的 paint / layout 属性
8
+ * @see https://maplibre.org/maplibre-style-spec/layers/
9
+ */
10
+ type: LayerSpecification['type'];
11
+ /** source id 字符串引用,或内联 source 对象(自动创建匿名源并随图层卸载) */
12
+ source?: string | SourceSpecification;
13
+ /** 矢量瓦片源内的子图层名(source-layer),消费矢量源时必填 */
14
+ sourceLayer?: string;
15
+ /**
16
+ * 绘制样式属性,响应式变更经 setPaintProperty 增量下发
17
+ * @see https://maplibre.org/maplibre-style-spec/layers/
18
+ */
19
+ paint?: PropBag;
20
+ /**
21
+ * 布局属性,响应式变更经 setLayoutProperty 增量下发
22
+ * @see https://maplibre.org/maplibre-style-spec/layers/
23
+ */
24
+ layout?: PropBag;
25
+ /**
26
+ * 过滤表达式,仅渲染匹配的要素
27
+ * @see https://maplibre.org/maplibre-style-spec/expressions/
28
+ */
29
+ filter?: FilterSpecification;
30
+ /**
31
+ * 最小缩放级别,低于此级别不渲染
32
+ * @defaultValue 0
33
+ */
34
+ minzoom?: number;
35
+ /**
36
+ * 最大缩放级别,高于此级别不渲染
37
+ * @defaultValue 24
38
+ */
39
+ maxzoom?: number;
40
+ /** 插入到该 id 图层之前;省略则追加到图层栈顶部 */
41
+ beforeId?: string;
42
+ };
43
+ declare var __VLS_1: {};
44
+ type __VLS_Slots = {} & {
45
+ default?: (props: typeof __VLS_1) => any;
46
+ };
47
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
48
+ click: (event: import("maplibre-gl").MapLayerMouseEvent) => any;
49
+ contextmenu: (event: import("maplibre-gl").MapLayerMouseEvent) => any;
50
+ dblclick: (event: import("maplibre-gl").MapLayerMouseEvent) => any;
51
+ mousemove: (event: import("maplibre-gl").MapLayerMouseEvent) => any;
52
+ mouseup: (event: import("maplibre-gl").MapLayerMouseEvent) => any;
53
+ mousedown: (event: import("maplibre-gl").MapLayerMouseEvent) => any;
54
+ mouseenter: (event: import("maplibre-gl").MapLayerMouseEvent) => any;
55
+ mouseleave: (event: import("maplibre-gl").MapLayerMouseEvent) => any;
56
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
57
+ onClick?: ((event: import("maplibre-gl").MapLayerMouseEvent) => any) | undefined;
58
+ onContextmenu?: ((event: import("maplibre-gl").MapLayerMouseEvent) => any) | undefined;
59
+ onDblclick?: ((event: import("maplibre-gl").MapLayerMouseEvent) => any) | undefined;
60
+ onMousemove?: ((event: import("maplibre-gl").MapLayerMouseEvent) => any) | undefined;
61
+ onMouseup?: ((event: import("maplibre-gl").MapLayerMouseEvent) => any) | undefined;
62
+ onMousedown?: ((event: import("maplibre-gl").MapLayerMouseEvent) => any) | undefined;
63
+ onMouseenter?: ((event: import("maplibre-gl").MapLayerMouseEvent) => any) | undefined;
64
+ onMouseleave?: ((event: import("maplibre-gl").MapLayerMouseEvent) => any) | undefined;
65
+ }>, {
66
+ filter: FilterSpecification;
67
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
68
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
69
+ declare const _default: typeof __VLS_export;
70
+ export default _default;
71
+ type __VLS_WithSlots<T, S> = T & {
72
+ new (): {
73
+ $slots: S;
74
+ };
75
+ };
@@ -0,0 +1,25 @@
1
+ /** 图层组:统一子图层的插入锚点与显隐(组开关优先于子图层自身 layout.visibility)。 */
2
+ type __VLS_Props = {
3
+ /** 组内图层缺省插入到该图层之前 */
4
+ beforeId?: string;
5
+ /**
6
+ * 组级显隐
7
+ * @defaultValue true
8
+ */
9
+ visible?: boolean;
10
+ };
11
+ declare var __VLS_1: {};
12
+ type __VLS_Slots = {} & {
13
+ default?: (props: typeof __VLS_1) => any;
14
+ };
15
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
16
+ visible: boolean;
17
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
21
+ type __VLS_WithSlots<T, S> = T & {
22
+ new (): {
23
+ $slots: S;
24
+ };
25
+ };
@@ -0,0 +1,16 @@
1
+ <script setup>
2
+ import { provide, toRef } from "vue";
3
+ import { LayerGroupKey } from "../domains/map/layer-group";
4
+ const props = defineProps({
5
+ beforeId: { type: String, required: false },
6
+ visible: { type: Boolean, required: false, default: true }
7
+ });
8
+ provide(LayerGroupKey, {
9
+ beforeId: toRef(props, "beforeId"),
10
+ visible: toRef(props, "visible")
11
+ });
12
+ </script>
13
+
14
+ <template>
15
+ <slot />
16
+ </template>
@@ -0,0 +1,25 @@
1
+ /** 图层组:统一子图层的插入锚点与显隐(组开关优先于子图层自身 layout.visibility)。 */
2
+ type __VLS_Props = {
3
+ /** 组内图层缺省插入到该图层之前 */
4
+ beforeId?: string;
5
+ /**
6
+ * 组级显隐
7
+ * @defaultValue true
8
+ */
9
+ visible?: boolean;
10
+ };
11
+ declare var __VLS_1: {};
12
+ type __VLS_Slots = {} & {
13
+ default?: (props: typeof __VLS_1) => any;
14
+ };
15
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
16
+ visible: boolean;
17
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
21
+ type __VLS_WithSlots<T, S> = T & {
22
+ new (): {
23
+ $slots: S;
24
+ };
25
+ };
@@ -0,0 +1,50 @@
1
+ import type { LngLatLike } from 'maplibre-gl';
2
+ /** Lottie 标记:在地图标记位用 lottie-web 渲染矢量动画(走 Marker DOM,非 icon 帧驱动)。 */
3
+ type __VLS_Props = {
4
+ /** lottie 动画数据(JSON 对象);与 path 二选一 */
5
+ animationData?: object;
6
+ /** lottie 动画 URL;与 animationData 二选一 */
7
+ path?: string;
8
+ /**
9
+ * 是否循环
10
+ * @defaultValue true
11
+ */
12
+ loop?: boolean;
13
+ /**
14
+ * 是否自动播放
15
+ * @defaultValue true
16
+ */
17
+ autoplay?: boolean;
18
+ /**
19
+ * 播放速度倍率
20
+ * @defaultValue 1
21
+ */
22
+ speed?: number;
23
+ /**
24
+ * 容器宽(像素)
25
+ * @defaultValue 64
26
+ */
27
+ width?: number;
28
+ /**
29
+ * 容器高(像素)
30
+ * @defaultValue 64
31
+ */
32
+ height?: number;
33
+ };
34
+ type __VLS_ModelProps = {
35
+ 'lnglat': LngLatLike;
36
+ };
37
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
38
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
39
+ "update:lnglat": (value: LngLatLike) => any;
40
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
41
+ "onUpdate:lnglat"?: ((value: LngLatLike) => any) | undefined;
42
+ }>, {
43
+ width: number;
44
+ height: number;
45
+ loop: boolean;
46
+ autoplay: boolean;
47
+ speed: number;
48
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
49
+ declare const _default: typeof __VLS_export;
50
+ export default _default;
@@ -0,0 +1,31 @@
1
+ <script setup>
2
+ import { onMounted, onUnmounted, useTemplateRef, watch } from "vue";
3
+ import lottie from "lottie-web";
4
+ import MaplibreMarker from "./Marker.vue";
5
+ const props = defineProps({
6
+ animationData: { type: Object, required: false },
7
+ path: { type: String, required: false },
8
+ loop: { type: Boolean, required: false, default: true },
9
+ autoplay: { type: Boolean, required: false, default: true },
10
+ speed: { type: Number, required: false, default: 1 },
11
+ width: { type: Number, required: false, default: 64 },
12
+ height: { type: Number, required: false, default: 64 }
13
+ });
14
+ const lnglat = defineModel("lnglat", { type: [Object, Array], ...{ required: true } });
15
+ const container = useTemplateRef("container");
16
+ let anim;
17
+ onMounted(() => {
18
+ if (!container.value) return;
19
+ const base = { container: container.value, renderer: "svg", loop: props.loop, autoplay: props.autoplay };
20
+ anim = props.path ? lottie.loadAnimation({ ...base, path: props.path }) : lottie.loadAnimation({ ...base, animationData: props.animationData });
21
+ anim.setSpeed(props.speed);
22
+ });
23
+ watch(() => props.speed, (speed) => anim?.setSpeed(speed));
24
+ onUnmounted(() => anim?.destroy());
25
+ </script>
26
+
27
+ <template>
28
+ <MaplibreMarker v-model:lnglat="lnglat">
29
+ <div ref="container" :style="{ width: `${width}px`, height: `${height}px` }" />
30
+ </MaplibreMarker>
31
+ </template>
@@ -0,0 +1,50 @@
1
+ import type { LngLatLike } from 'maplibre-gl';
2
+ /** Lottie 标记:在地图标记位用 lottie-web 渲染矢量动画(走 Marker DOM,非 icon 帧驱动)。 */
3
+ type __VLS_Props = {
4
+ /** lottie 动画数据(JSON 对象);与 path 二选一 */
5
+ animationData?: object;
6
+ /** lottie 动画 URL;与 animationData 二选一 */
7
+ path?: string;
8
+ /**
9
+ * 是否循环
10
+ * @defaultValue true
11
+ */
12
+ loop?: boolean;
13
+ /**
14
+ * 是否自动播放
15
+ * @defaultValue true
16
+ */
17
+ autoplay?: boolean;
18
+ /**
19
+ * 播放速度倍率
20
+ * @defaultValue 1
21
+ */
22
+ speed?: number;
23
+ /**
24
+ * 容器宽(像素)
25
+ * @defaultValue 64
26
+ */
27
+ width?: number;
28
+ /**
29
+ * 容器高(像素)
30
+ * @defaultValue 64
31
+ */
32
+ height?: number;
33
+ };
34
+ type __VLS_ModelProps = {
35
+ 'lnglat': LngLatLike;
36
+ };
37
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
38
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
39
+ "update:lnglat": (value: LngLatLike) => any;
40
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
41
+ "onUpdate:lnglat"?: ((value: LngLatLike) => any) | undefined;
42
+ }>, {
43
+ width: number;
44
+ height: number;
45
+ loop: boolean;
46
+ autoplay: boolean;
47
+ speed: number;
48
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
49
+ declare const _default: typeof __VLS_export;
50
+ export default _default;
@@ -0,0 +1,84 @@
1
+ import type { LngLatLike, Map as MaplibreMap } from 'maplibre-gl';
2
+ import type { MaplibreMapOptions } from '../types';
3
+ type __VLS_Props = {
4
+ /** 地图 id;省略时自动生成。提供后可经 useMaplibre(id) 外部访问 */
5
+ mapId?: string;
6
+ /**
7
+ * maplibre-gl Map 初始化选项(container 由组件接管);缺省 style 时使用空白样式
8
+ * @see https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/MapOptions/
9
+ */
10
+ options?: MaplibreMapOptions;
11
+ /** 卸载时不销毁实例,配合 keepalive / `<keep-alive>` 跨路由复用 */
12
+ persistent?: boolean;
13
+ };
14
+ type __VLS_ModelProps = {
15
+ 'center'?: LngLatLike;
16
+ 'zoom'?: number;
17
+ 'bearing'?: number;
18
+ 'pitch'?: number;
19
+ };
20
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
21
+ declare var __VLS_1: {};
22
+ type __VLS_Slots = {} & {
23
+ default?: (props: typeof __VLS_1) => any;
24
+ };
25
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
26
+ /** 当前地图上下文 */
27
+ context: () => import("../types").MaplibreContext;
28
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
29
+ click: (event: import("maplibre-gl").MapMouseEvent) => any;
30
+ load: (map: MaplibreMap) => any;
31
+ error: (event: import("maplibre-gl").ErrorEvent) => any;
32
+ idle: (map: MaplibreMap) => any;
33
+ sourcedata: (event: import("maplibre-gl").MapSourceDataEvent) => any;
34
+ styledata: (event: import("maplibre-gl").MapStyleDataEvent) => any;
35
+ contextmenu: (event: import("maplibre-gl").MapMouseEvent) => any;
36
+ dblclick: (event: import("maplibre-gl").MapMouseEvent) => any;
37
+ mousemove: (event: import("maplibre-gl").MapMouseEvent) => any;
38
+ mouseup: (event: import("maplibre-gl").MapMouseEvent) => any;
39
+ mousedown: (event: import("maplibre-gl").MapMouseEvent) => any;
40
+ movestart: (event: import("maplibre-gl").MapMovementEvent) => any;
41
+ moveend: (event: import("maplibre-gl").MapMovementEvent) => any;
42
+ zoomstart: (event: import("maplibre-gl").MapMovementEvent) => any;
43
+ zoomend: (event: import("maplibre-gl").MapMovementEvent) => any;
44
+ rotateend: (event: import("maplibre-gl").MapMovementEvent) => any;
45
+ dragend: (event: import("maplibre-gl").MapMovementEvent) => any;
46
+ pitchend: (event: import("maplibre-gl").MapMovementEvent) => any;
47
+ "update:center": (value: LngLatLike | undefined) => any;
48
+ "update:zoom": (value: number | undefined) => any;
49
+ "update:bearing": (value: number | undefined) => any;
50
+ "update:pitch": (value: number | undefined) => any;
51
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
52
+ onClick?: ((event: import("maplibre-gl").MapMouseEvent) => any) | undefined;
53
+ onLoad?: ((map: MaplibreMap) => any) | undefined;
54
+ onError?: ((event: import("maplibre-gl").ErrorEvent) => any) | undefined;
55
+ onIdle?: ((map: MaplibreMap) => any) | undefined;
56
+ onSourcedata?: ((event: import("maplibre-gl").MapSourceDataEvent) => any) | undefined;
57
+ onStyledata?: ((event: import("maplibre-gl").MapStyleDataEvent) => any) | undefined;
58
+ onContextmenu?: ((event: import("maplibre-gl").MapMouseEvent) => any) | undefined;
59
+ onDblclick?: ((event: import("maplibre-gl").MapMouseEvent) => any) | undefined;
60
+ onMousemove?: ((event: import("maplibre-gl").MapMouseEvent) => any) | undefined;
61
+ onMouseup?: ((event: import("maplibre-gl").MapMouseEvent) => any) | undefined;
62
+ onMousedown?: ((event: import("maplibre-gl").MapMouseEvent) => any) | undefined;
63
+ onMovestart?: ((event: import("maplibre-gl").MapMovementEvent) => any) | undefined;
64
+ onMoveend?: ((event: import("maplibre-gl").MapMovementEvent) => any) | undefined;
65
+ onZoomstart?: ((event: import("maplibre-gl").MapMovementEvent) => any) | undefined;
66
+ onZoomend?: ((event: import("maplibre-gl").MapMovementEvent) => any) | undefined;
67
+ onRotateend?: ((event: import("maplibre-gl").MapMovementEvent) => any) | undefined;
68
+ onDragend?: ((event: import("maplibre-gl").MapMovementEvent) => any) | undefined;
69
+ onPitchend?: ((event: import("maplibre-gl").MapMovementEvent) => any) | undefined;
70
+ "onUpdate:center"?: ((value: LngLatLike | undefined) => any) | undefined;
71
+ "onUpdate:zoom"?: ((value: number | undefined) => any) | undefined;
72
+ "onUpdate:bearing"?: ((value: number | undefined) => any) | undefined;
73
+ "onUpdate:pitch"?: ((value: number | undefined) => any) | undefined;
74
+ }>, {
75
+ persistent: boolean;
76
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
77
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
78
+ declare const _default: typeof __VLS_export;
79
+ export default _default;
80
+ type __VLS_WithSlots<T, S> = T & {
81
+ new (): {
82
+ $slots: S;
83
+ };
84
+ };