@movk/maplibre 1.0.0 → 1.2.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 (202) hide show
  1. package/README.en.md +2 -2
  2. package/README.md +2 -2
  3. package/dist/module.d.mts +12 -3
  4. package/dist/module.d.ts +12 -3
  5. package/dist/module.json +1 -1
  6. package/dist/module.mjs +26 -11
  7. package/dist/runtime/components/CustomLayer.d.vue.ts +1 -1
  8. package/dist/runtime/components/CustomLayer.vue +18 -4
  9. package/dist/runtime/components/CustomLayer.vue.d.ts +1 -1
  10. package/dist/runtime/components/Layer.d.vue.ts +4 -4
  11. package/dist/runtime/components/Layer.vue +43 -18
  12. package/dist/runtime/components/Layer.vue.d.ts +4 -4
  13. package/dist/runtime/components/LayerGroup.d.vue.ts +23 -10
  14. package/dist/runtime/components/LayerGroup.vue +44 -4
  15. package/dist/runtime/components/LayerGroup.vue.d.ts +23 -10
  16. package/dist/runtime/components/LottieMarker.d.vue.ts +3 -3
  17. package/dist/runtime/components/LottieMarker.vue +6 -2
  18. package/dist/runtime/components/LottieMarker.vue.d.ts +3 -3
  19. package/dist/runtime/components/Map.d.vue.ts +2 -1
  20. package/dist/runtime/components/Map.vue +2 -6
  21. package/dist/runtime/components/Map.vue.d.ts +2 -1
  22. package/dist/runtime/components/Marker.d.vue.ts +2 -1
  23. package/dist/runtime/components/Marker.vue +33 -9
  24. package/dist/runtime/components/Marker.vue.d.ts +2 -1
  25. package/dist/runtime/components/Popup.d.vue.ts +1 -1
  26. package/dist/runtime/components/Popup.vue +23 -4
  27. package/dist/runtime/components/Popup.vue.d.ts +1 -1
  28. package/dist/runtime/components/Source.d.vue.ts +2 -2
  29. package/dist/runtime/components/Source.vue +3 -15
  30. package/dist/runtime/components/Source.vue.d.ts +2 -2
  31. package/dist/runtime/components/Tooltip.d.vue.ts +2 -2
  32. package/dist/runtime/components/Tooltip.vue +47 -19
  33. package/dist/runtime/components/Tooltip.vue.d.ts +2 -2
  34. package/dist/runtime/components/buffers/BufferCircle.d.vue.ts +1 -1
  35. package/dist/runtime/components/buffers/BufferCircle.vue.d.ts +1 -1
  36. package/dist/runtime/components/buffers/BufferEllipse.d.vue.ts +1 -1
  37. package/dist/runtime/components/buffers/BufferEllipse.vue.d.ts +1 -1
  38. package/dist/runtime/components/buffers/BufferLine.d.vue.ts +1 -1
  39. package/dist/runtime/components/buffers/BufferLine.vue.d.ts +1 -1
  40. package/dist/runtime/components/buffers/BufferPolygon.d.vue.ts +1 -1
  41. package/dist/runtime/components/buffers/BufferPolygon.vue.d.ts +1 -1
  42. package/dist/runtime/components/buffers/BufferSector.d.vue.ts +1 -1
  43. package/dist/runtime/components/buffers/BufferSector.vue.d.ts +1 -1
  44. package/dist/runtime/components/controls/BasemapControl.d.vue.ts +35 -0
  45. package/dist/runtime/components/controls/BasemapControl.vue +60 -0
  46. package/dist/runtime/components/controls/BasemapControl.vue.d.ts +35 -0
  47. package/dist/runtime/components/controls/Control.d.vue.ts +51 -0
  48. package/dist/runtime/components/controls/Control.vue +95 -0
  49. package/dist/runtime/components/controls/Control.vue.d.ts +51 -0
  50. package/dist/runtime/components/controls/GlobeControl.d.vue.ts +18 -0
  51. package/dist/runtime/components/controls/GlobeControl.vue +15 -0
  52. package/dist/runtime/components/controls/GlobeControl.vue.d.ts +18 -0
  53. package/dist/runtime/components/controls/LayerControl.d.vue.ts +44 -0
  54. package/dist/runtime/components/controls/LayerControl.vue +63 -0
  55. package/dist/runtime/components/controls/LayerControl.vue.d.ts +44 -0
  56. package/dist/runtime/components/controls/Legend.d.vue.ts +47 -0
  57. package/dist/runtime/components/controls/Legend.vue +69 -0
  58. package/dist/runtime/components/controls/Legend.vue.d.ts +47 -0
  59. package/dist/runtime/components/controls/Minimap.d.vue.ts +45 -0
  60. package/dist/runtime/components/controls/Minimap.vue +31 -0
  61. package/dist/runtime/components/controls/Minimap.vue.d.ts +45 -0
  62. package/dist/runtime/components/effects/AnimatedImage.d.vue.ts +1 -1
  63. package/dist/runtime/components/effects/AnimatedImage.vue +9 -6
  64. package/dist/runtime/components/effects/AnimatedImage.vue.d.ts +1 -1
  65. package/dist/runtime/components/effects/DiffusionCircle.d.vue.ts +1 -1
  66. package/dist/runtime/components/effects/DiffusionCircle.vue.d.ts +1 -1
  67. package/dist/runtime/components/effects/FlowBuilding.d.vue.ts +1 -1
  68. package/dist/runtime/components/effects/FlowBuilding.vue.d.ts +1 -1
  69. package/dist/runtime/components/effects/GlowCircle.d.vue.ts +1 -1
  70. package/dist/runtime/components/effects/GlowCircle.vue.d.ts +1 -1
  71. package/dist/runtime/components/effects/GradientBuilding.d.vue.ts +1 -1
  72. package/dist/runtime/components/effects/GradientBuilding.vue.d.ts +1 -1
  73. package/dist/runtime/components/effects/Migration.d.vue.ts +1 -1
  74. package/dist/runtime/components/effects/Migration.vue.d.ts +1 -1
  75. package/dist/runtime/components/effects/Radar.d.vue.ts +1 -1
  76. package/dist/runtime/components/effects/Radar.vue.d.ts +1 -1
  77. package/dist/runtime/components/effects/SpriteImage.d.vue.ts +1 -1
  78. package/dist/runtime/components/effects/SpriteImage.vue +40 -24
  79. package/dist/runtime/components/effects/SpriteImage.vue.d.ts +1 -1
  80. package/dist/runtime/components/effects/TextureBuilding.d.vue.ts +1 -1
  81. package/dist/runtime/components/effects/TextureBuilding.vue +1 -1
  82. package/dist/runtime/components/effects/TextureBuilding.vue.d.ts +1 -1
  83. package/dist/runtime/components/effects/Trail.d.vue.ts +1 -1
  84. package/dist/runtime/components/effects/Trail.vue.d.ts +1 -1
  85. package/dist/runtime/components/effects/WaveCircle.d.vue.ts +1 -1
  86. package/dist/runtime/components/effects/WaveCircle.vue.d.ts +1 -1
  87. package/dist/runtime/components/effects/WindowBuilding.d.vue.ts +1 -1
  88. package/dist/runtime/components/effects/WindowBuilding.vue.d.ts +1 -1
  89. package/dist/runtime/components/environment/Projection.d.vue.ts +28 -0
  90. package/dist/runtime/components/environment/Projection.vue +27 -0
  91. package/dist/runtime/components/environment/Projection.vue.d.ts +28 -0
  92. package/dist/runtime/components/environment/Temperature.d.vue.ts +1 -1
  93. package/dist/runtime/components/environment/Temperature.vue.d.ts +1 -1
  94. package/dist/runtime/components/environment/Terrain.d.vue.ts +1 -1
  95. package/dist/runtime/components/environment/Terrain.vue +5 -0
  96. package/dist/runtime/components/environment/Terrain.vue.d.ts +1 -1
  97. package/dist/runtime/components/extensions/DrawControl.vue +23 -19
  98. package/dist/runtime/components/extensions/Swipe.d.vue.ts +48 -0
  99. package/dist/runtime/components/extensions/Swipe.vue +141 -0
  100. package/dist/runtime/components/extensions/Swipe.vue.d.ts +48 -0
  101. package/dist/runtime/components/layers/BuildingLayer.d.vue.ts +1 -1
  102. package/dist/runtime/components/layers/BuildingLayer.vue.d.ts +1 -1
  103. package/dist/runtime/components/layers/ClusterLayer.d.vue.ts +1 -1
  104. package/dist/runtime/components/layers/ClusterLayer.vue.d.ts +1 -1
  105. package/dist/runtime/components/layers/ContourLayer.d.vue.ts +59 -0
  106. package/dist/runtime/components/layers/ContourLayer.vue +84 -0
  107. package/dist/runtime/components/layers/ContourLayer.vue.d.ts +59 -0
  108. package/dist/runtime/components/layers/GraticuleLayer.d.vue.ts +31 -0
  109. package/dist/runtime/components/layers/GraticuleLayer.vue +88 -0
  110. package/dist/runtime/components/layers/GraticuleLayer.vue.d.ts +31 -0
  111. package/dist/runtime/components/layers/ImageLayer.d.vue.ts +1 -1
  112. package/dist/runtime/components/layers/ImageLayer.vue.d.ts +1 -1
  113. package/dist/runtime/components/layers/MaskLayer.d.vue.ts +44 -0
  114. package/dist/runtime/components/layers/MaskLayer.vue +32 -0
  115. package/dist/runtime/components/layers/MaskLayer.vue.d.ts +44 -0
  116. package/dist/runtime/components/layers/RasterLayer.d.vue.ts +5 -3
  117. package/dist/runtime/components/layers/RasterLayer.vue +9 -2
  118. package/dist/runtime/components/layers/RasterLayer.vue.d.ts +5 -3
  119. package/dist/runtime/components/layers/VideoLayer.d.vue.ts +1 -1
  120. package/dist/runtime/components/layers/VideoLayer.vue.d.ts +1 -1
  121. package/dist/runtime/composables/useFeatureState.js +27 -5
  122. package/dist/runtime/composables/useFrameIcon.d.ts +4 -3
  123. package/dist/runtime/composables/useFrameIcon.js +18 -8
  124. package/dist/runtime/composables/useLayerTree.d.ts +11 -0
  125. package/dist/runtime/composables/useLayerTree.js +12 -0
  126. package/dist/runtime/composables/useMapAnimation.d.ts +4 -2
  127. package/dist/runtime/composables/useMapAnimation.js +5 -4
  128. package/dist/runtime/composables/useMapExport.js +2 -5
  129. package/dist/runtime/composables/useMapSync.d.ts +16 -0
  130. package/dist/runtime/composables/useMapSync.js +42 -0
  131. package/dist/runtime/composables/useMaplibreCamera.d.ts +1 -1
  132. package/dist/runtime/composables/useMaplibreCamera.js +1 -1
  133. package/dist/runtime/composables/useMaplibreImage.d.ts +3 -3
  134. package/dist/runtime/composables/useMaplibreImage.js +26 -5
  135. package/dist/runtime/domains/map/config.js +2 -3
  136. package/dist/runtime/domains/map/context.js +15 -0
  137. package/dist/runtime/domains/map/control.d.ts +1 -1
  138. package/dist/runtime/domains/map/control.js +1 -1
  139. package/dist/runtime/domains/map/draw-modes.d.ts +9 -0
  140. package/dist/runtime/domains/map/draw-modes.js +53 -0
  141. package/dist/runtime/domains/map/draw-registry.d.ts +2 -3
  142. package/dist/runtime/domains/map/draw-registry.js +6 -9
  143. package/dist/runtime/domains/map/draw-theme.d.ts +12 -0
  144. package/dist/runtime/domains/map/draw-toolbar.js +11 -10
  145. package/dist/runtime/domains/map/layer-group.d.ts +15 -4
  146. package/dist/runtime/domains/map/layer-tree.d.ts +3 -0
  147. package/dist/runtime/domains/map/layer-tree.js +10 -0
  148. package/dist/runtime/domains/map/minimap.d.ts +18 -0
  149. package/dist/runtime/domains/map/minimap.js +86 -0
  150. package/dist/runtime/domains/map/registry.js +4 -3
  151. package/dist/runtime/domains/map/style-layers.d.ts +7 -0
  152. package/dist/runtime/domains/map/style-layers.js +54 -0
  153. package/dist/runtime/domains/map/style.d.ts +3 -0
  154. package/dist/runtime/domains/map/style.js +5 -0
  155. package/dist/runtime/domains/map/swipe.d.ts +9 -0
  156. package/dist/runtime/domains/map/swipe.js +62 -0
  157. package/dist/runtime/index.css +1 -1
  158. package/dist/runtime/types/draw.d.ts +34 -1
  159. package/dist/runtime/types/index.d.ts +1 -0
  160. package/dist/runtime/types/layer.d.ts +40 -0
  161. package/dist/runtime/types/layer.js +0 -0
  162. package/dist/runtime/types/map.d.ts +6 -0
  163. package/dist/runtime/utils/cog.d.ts +2 -0
  164. package/dist/runtime/utils/cog.js +9 -0
  165. package/dist/runtime/utils/effects.js +2 -1
  166. package/dist/runtime/utils/events.d.ts +6 -0
  167. package/dist/runtime/utils/events.js +25 -0
  168. package/dist/runtime/utils/frame-icon.d.ts +2 -5
  169. package/dist/runtime/utils/frame-icon.js +10 -4
  170. package/dist/runtime/utils/graticule.d.ts +19 -0
  171. package/dist/runtime/utils/graticule.js +62 -0
  172. package/dist/runtime/utils/layer-opacity.d.ts +7 -0
  173. package/dist/runtime/utils/layer-opacity.js +59 -0
  174. package/dist/runtime/utils/layer.js +2 -1
  175. package/dist/runtime/utils/legend.d.ts +9 -0
  176. package/dist/runtime/utils/legend.js +52 -0
  177. package/dist/runtime/utils/marker.d.ts +11 -0
  178. package/dist/runtime/utils/marker.js +28 -0
  179. package/dist/runtime/utils/mask.d.ts +8 -0
  180. package/dist/runtime/utils/mask.js +33 -0
  181. package/dist/runtime/utils/minimap.d.ts +6 -0
  182. package/dist/runtime/utils/minimap.js +15 -0
  183. package/dist/runtime/utils/pmtiles.d.ts +3 -0
  184. package/dist/runtime/utils/pmtiles.js +10 -0
  185. package/dist/runtime/utils/source.d.ts +7 -0
  186. package/dist/runtime/utils/source.js +35 -0
  187. package/dist/runtime/utils/swipe.d.ts +32 -0
  188. package/dist/runtime/utils/swipe.js +18 -0
  189. package/dist/runtime/utils/tianditu.d.ts +10 -1
  190. package/dist/runtime/utils/tianditu.js +11 -0
  191. package/dist/runtime/utils/zzts-tile.d.ts +54 -0
  192. package/dist/runtime/utils/zzts-tile.js +85 -0
  193. package/dist/runtime/utils/zzts.d.ts +14 -0
  194. package/dist/runtime/utils/zzts.js +72 -0
  195. package/dist/unplugin.d.mts +1 -1
  196. package/dist/unplugin.d.ts +1 -1
  197. package/dist/unplugin.mjs +1 -7
  198. package/package.json +29 -21
  199. package/dist/runtime/draw-modes/index.d.ts +0 -16
  200. package/dist/runtime/draw-modes/index.js +0 -32
  201. package/dist/runtime/utils/draw-theme.d.ts +0 -47
  202. /package/dist/runtime/{utils → domains/map}/draw-theme.js +0 -0
package/README.en.md CHANGED
@@ -130,8 +130,8 @@ All components are prefixed with `Maplibre` by default (configurable). Grouped b
130
130
  | Core | `MaplibreMap` `MaplibreSource` `MaplibreLayer` `MaplibreLayerGroup` `MaplibreCustomLayer` `MaplibreMarker` `MaplibreLottieMarker` `MaplibrePopup` `MaplibreTooltip` |
131
131
  | Layers | `MaplibreBuildingLayer` `MaplibreClusterLayer` `MaplibreImageLayer` `MaplibreRasterLayer` `MaplibreVideoLayer` |
132
132
  | Effects | `MaplibreRadar` `MaplibreDiffusionCircle` `MaplibreGlowCircle` `MaplibreWaveCircle` `MaplibreGradientBuilding` `MaplibreTextureBuilding` `MaplibreWindowBuilding` `MaplibreFlowBuilding` `MaplibreMigration` `MaplibreTrail` `MaplibreAnimatedImage` `MaplibreSpriteImage` |
133
- | Environment | `MaplibreSky` `MaplibreTerrain` `MaplibreTemperature` |
134
- | Controls | `MaplibreNavigationControl` `MaplibreGeolocateControl` `MaplibreFullscreenControl` `MaplibreScaleControl` `MaplibreAttributionControl` |
133
+ | Environment | `MaplibreSky` `MaplibreProjection` `MaplibreTerrain` `MaplibreTemperature` |
134
+ | Controls | `MaplibreNavigationControl` `MaplibreGeolocateControl` `MaplibreFullscreenControl` `MaplibreGlobeControl` `MaplibreScaleControl` `MaplibreAttributionControl` |
135
135
  | Extensions | `MaplibreDrawControl` `MaplibreTiandituLayer` `MaplibreWmsLayer` `MaplibreWmtsLayer` |
136
136
  | Buffers | `MaplibreBufferCircle` `MaplibreBufferEllipse` `MaplibreBufferLine` `MaplibreBufferPolygon` `MaplibreBufferSector` |
137
137
 
package/README.md CHANGED
@@ -129,8 +129,8 @@ const zoom = ref(9)
129
129
  | 核心 | `MaplibreMap` `MaplibreSource` `MaplibreLayer` `MaplibreLayerGroup` `MaplibreCustomLayer` `MaplibreMarker` `MaplibreLottieMarker` `MaplibrePopup` `MaplibreTooltip` |
130
130
  | 图层 | `MaplibreBuildingLayer` `MaplibreClusterLayer` `MaplibreImageLayer` `MaplibreRasterLayer` `MaplibreVideoLayer` |
131
131
  | 效果 | `MaplibreRadar` `MaplibreDiffusionCircle` `MaplibreGlowCircle` `MaplibreWaveCircle` `MaplibreGradientBuilding` `MaplibreTextureBuilding` `MaplibreWindowBuilding` `MaplibreFlowBuilding` `MaplibreMigration` `MaplibreTrail` `MaplibreAnimatedImage` `MaplibreSpriteImage` |
132
- | 环境 | `MaplibreSky` `MaplibreTerrain` `MaplibreTemperature` |
133
- | 控件 | `MaplibreNavigationControl` `MaplibreGeolocateControl` `MaplibreFullscreenControl` `MaplibreScaleControl` `MaplibreAttributionControl` |
132
+ | 环境 | `MaplibreSky` `MaplibreProjection` `MaplibreTerrain` `MaplibreTemperature` |
133
+ | 控件 | `MaplibreNavigationControl` `MaplibreGeolocateControl` `MaplibreFullscreenControl` `MaplibreGlobeControl` `MaplibreScaleControl` `MaplibreAttributionControl` |
134
134
  | 扩展 | `MaplibreDrawControl` `MaplibreTiandituLayer` `MaplibreWmsLayer` `MaplibreWmtsLayer` |
135
135
  | 缓冲 | `MaplibreBufferCircle` `MaplibreBufferEllipse` `MaplibreBufferLine` `MaplibreBufferPolygon` `MaplibreBufferSector` |
136
136
 
package/dist/module.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
1
+ import { NuxtModule } from '@nuxt/schema';
2
2
  export * from '../dist/runtime/types/index.js';
3
3
 
4
4
  interface ModuleOptions {
@@ -13,8 +13,17 @@ interface ModuleOptions {
13
13
  * @defaultValue 'Maplibre'
14
14
  */
15
15
  prefix?: string;
16
+ /** 按需注册数据协议(需安装对应可选依赖);开启后在客户端插件中注册,未开启时不打包相关依赖 */
17
+ protocols?: {
18
+ /** 注册 `pmtiles://` 协议,依赖 pmtiles */
19
+ pmtiles?: boolean;
20
+ /** 注册 `cog://` 协议,依赖 @geomatico/maplibre-cog-protocol */
21
+ cog?: boolean;
22
+ /** 注册 `zzts://` 协议(ZZTS 二维动态切片服务),无额外依赖;需自定义请求时改为自行调用 `registerZztsProtocol` */
23
+ zzts?: boolean;
24
+ };
16
25
  }
17
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
26
+ declare const module$1: NuxtModule<ModuleOptions, ModuleOptions, false>;
18
27
 
19
- export { _default as default };
28
+ export { module$1 as default };
20
29
  export type { ModuleOptions };
package/dist/module.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
1
+ import { NuxtModule } from '@nuxt/schema';
2
2
  export * from '../dist/runtime/types/index.js';
3
3
 
4
4
  interface ModuleOptions {
@@ -13,8 +13,17 @@ interface ModuleOptions {
13
13
  * @defaultValue 'Maplibre'
14
14
  */
15
15
  prefix?: string;
16
+ /** 按需注册数据协议(需安装对应可选依赖);开启后在客户端插件中注册,未开启时不打包相关依赖 */
17
+ protocols?: {
18
+ /** 注册 `pmtiles://` 协议,依赖 pmtiles */
19
+ pmtiles?: boolean;
20
+ /** 注册 `cog://` 协议,依赖 @geomatico/maplibre-cog-protocol */
21
+ cog?: boolean;
22
+ /** 注册 `zzts://` 协议(ZZTS 二维动态切片服务),无额外依赖;需自定义请求时改为自行调用 `registerZztsProtocol` */
23
+ zzts?: boolean;
24
+ };
16
25
  }
17
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
26
+ declare const module$1: NuxtModule<ModuleOptions, ModuleOptions, false>;
18
27
 
19
- export { _default as default };
28
+ export { module$1 as default };
20
29
  export type { ModuleOptions };
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movk/maplibre",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "configKey": "maplibre",
5
5
  "compatibility": {
6
6
  "nuxt": ">=4.0.0"
package/dist/module.mjs CHANGED
@@ -1,10 +1,11 @@
1
1
  import { createRequire } from 'node:module';
2
- import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir, addImports, addPlugin, addPluginTemplate, extendViteConfig } from '@nuxt/kit';
2
+ import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir, addPlugin, addPluginTemplate, extendViteConfig } from '@nuxt/kit';
3
3
  import { defu } from 'defu';
4
4
 
5
5
  const name = "@movk/maplibre";
6
- const version = "1.0.0";
6
+ const version = "1.2.0";
7
7
 
8
+ const OPTIONAL_DEPS = ["lottie-web", "pmtiles", "@geomatico/maplibre-cog-protocol", "maplibre-contour"];
8
9
  const module$1 = defineNuxtModule({
9
10
  meta: {
10
11
  name,
@@ -31,10 +32,6 @@ const module$1 = defineNuxtModule({
31
32
  pathPrefix: false
32
33
  });
33
34
  addImportsDir(resolve("./runtime/composables"));
34
- addImports([
35
- { name: "movkDrawModes", from: resolve("./runtime/draw-modes") },
36
- { name: "drawThemeStyles", from: resolve("./runtime/utils/draw-theme") }
37
- ]);
38
35
  addPlugin({ src: resolve("./runtime/plugins/config") });
39
36
  addPluginTemplate({
40
37
  filename: "movk-maplibre-worker.client.mjs",
@@ -46,15 +43,33 @@ const module$1 = defineNuxtModule({
46
43
  `export default defineNuxtPlugin(() => { setMaplibreConfig({ workerUrl }) })`
47
44
  ].join("\n")
48
45
  });
46
+ const protocols = [
47
+ options.protocols?.pmtiles && { path: "./runtime/utils/pmtiles", register: "registerPmtilesProtocol" },
48
+ options.protocols?.cog && { path: "./runtime/utils/cog", register: "registerCogProtocol" },
49
+ options.protocols?.zzts && { path: "./runtime/utils/zzts", register: "registerZztsProtocol" }
50
+ ].filter((item) => !!item);
51
+ if (protocols.length) {
52
+ addPluginTemplate({
53
+ filename: "movk-maplibre-protocols.client.mjs",
54
+ mode: "client",
55
+ getContents: () => [
56
+ `import { defineNuxtPlugin } from '#app'`,
57
+ ...protocols.map(({ path, register }) => `import { ${register} } from ${JSON.stringify(resolve(path))}`),
58
+ `export default defineNuxtPlugin(() => { ${protocols.map(({ register }) => `${register}()`).join("; ")} })`
59
+ ].join("\n")
60
+ });
61
+ }
49
62
  extendViteConfig((config) => {
50
63
  config.optimizeDeps ||= {};
51
64
  const include = config.optimizeDeps.include ||= [];
52
65
  const require = createRequire(import.meta.url);
53
- if (include.includes("lottie-web")) return;
54
- try {
55
- require.resolve("lottie-web", { paths: [nuxt.options.rootDir] });
56
- include.push("lottie-web");
57
- } catch {
66
+ for (const dep of OPTIONAL_DEPS) {
67
+ if (include.includes(dep)) continue;
68
+ try {
69
+ require.resolve(dep, { paths: [nuxt.options.rootDir] });
70
+ include.push(dep);
71
+ } catch {
72
+ }
58
73
  }
59
74
  });
60
75
  }
@@ -2,7 +2,7 @@ import type { CustomLayerInterface } from 'maplibre-gl';
2
2
  /** CustomLayerInterface 逃生舱:托管自定义 WebGL 图层的挂载/卸载与样式重载重建。 */
3
3
  type __VLS_Props = {
4
4
  /**
5
- * 自定义图层实现(含 id/type/render)
5
+ * 自定义图层实现(含 id/type/render);按引用比较,替换对象时移除旧图层并添加新图层
6
6
  * @see https://maplibre.org/maplibre-gl-js/docs/API/interfaces/CustomLayerInterface/
7
7
  */
8
8
  layer: CustomLayerInterface;
@@ -1,15 +1,29 @@
1
1
  <script setup>
2
- import { onUnmounted } from "vue";
2
+ import { onUnmounted, toRaw, watch } from "vue";
3
3
  import { useMap } from "../composables/useMap";
4
4
  const props = defineProps({
5
5
  layer: { type: Object, required: true },
6
6
  beforeId: { type: String, required: false }
7
7
  });
8
8
  const ctx = useMap();
9
- const stopReady = ctx.onReady((map) => {
9
+ function resolveBeforeId(map) {
10
+ return props.beforeId && map.getLayer(props.beforeId) ? props.beforeId : void 0;
11
+ }
12
+ function addLayer(map) {
10
13
  if (map.getLayer(props.layer.id)) return;
11
- const before = props.beforeId && map.getLayer(props.beforeId) ? props.beforeId : void 0;
12
- map.addLayer(props.layer, before);
14
+ map.addLayer(toRaw(props.layer), resolveBeforeId(map));
15
+ }
16
+ const stopReady = ctx.onReady(addLayer);
17
+ watch(() => props.layer, (_next, prev) => {
18
+ const map = ctx.map.value;
19
+ if (!map?.getLayer(prev.id)) return;
20
+ map.removeLayer(prev.id);
21
+ addLayer(map);
22
+ });
23
+ watch(() => props.beforeId, () => {
24
+ const map = ctx.map.value;
25
+ if (!map?.getLayer(props.layer.id)) return;
26
+ map.moveLayer(props.layer.id, resolveBeforeId(map));
13
27
  });
14
28
  onUnmounted(() => {
15
29
  stopReady();
@@ -2,7 +2,7 @@ import type { CustomLayerInterface } from 'maplibre-gl';
2
2
  /** CustomLayerInterface 逃生舱:托管自定义 WebGL 图层的挂载/卸载与样式重载重建。 */
3
3
  type __VLS_Props = {
4
4
  /**
5
- * 自定义图层实现(含 id/type/render)
5
+ * 自定义图层实现(含 id/type/render);按引用比较,替换对象时移除旧图层并添加新图层
6
6
  * @see https://maplibre.org/maplibre-gl-js/docs/API/interfaces/CustomLayerInterface/
7
7
  */
8
8
  layer: CustomLayerInterface;
@@ -1,16 +1,16 @@
1
1
  import type { FilterSpecification, LayerSpecification, SourceSpecification } from '@maplibre/maplibre-gl-style-spec';
2
2
  type PropBag = Record<string, unknown>;
3
3
  type __VLS_Props = {
4
- /** 图层 id,全局唯一 */
4
+ /** 图层 id,全局唯一;变更需配合 `:key` 重建 */
5
5
  layerId: string;
6
6
  /**
7
- * 图层类型,决定渲染方式与可用的 paint / layout 属性
7
+ * 图层类型,决定渲染方式与可用的 paint / layout 属性;变更需配合 `:key` 重建
8
8
  * @see https://maplibre.org/maplibre-style-spec/layers/
9
9
  */
10
10
  type: LayerSpecification['type'];
11
- /** source id 字符串引用,或内联 source 对象(自动创建匿名源并随图层卸载) */
11
+ /** source id 字符串引用,或内联 source 对象(自动创建匿名源并随图层卸载,内容变化时增量更新);二者之间切换需配合 `:key` 重建 */
12
12
  source?: string | SourceSpecification;
13
- /** 矢量瓦片源内的子图层名(source-layer),消费矢量源时必填 */
13
+ /** 矢量瓦片源内的子图层名(source-layer),消费矢量源时必填;变更需配合 `:key` 重建 */
14
14
  sourceLayer?: string;
15
15
  /**
16
16
  * 绘制样式属性,响应式变更经 setPaintProperty 增量下发
@@ -1,10 +1,12 @@
1
1
  <script setup>
2
- import { inject, onUnmounted, watch } from "vue";
2
+ import { computed, inject, onUnmounted, watch } from "vue";
3
3
  import { omitUndefined } from "@movk/core";
4
4
  import { useMap } from "../composables/useMap";
5
5
  import { LayerGroupKey } from "../domains/map/layer-group";
6
6
  import { applyLayerProps } from "../utils/layer";
7
+ import { opacityPropsFor, scaleOpacity } from "../utils/layer-opacity";
7
8
  import { bindMapEvents } from "../utils/events";
9
+ import { updateSource } from "../utils/source";
8
10
  const props = defineProps({
9
11
  layerId: { type: String, required: true },
10
12
  type: { type: String, required: true },
@@ -21,6 +23,22 @@ const emit = defineEmits(["click", "dblclick", "mousedown", "mouseup", "mousemov
21
23
  const LAYER_EVENTS = ["click", "dblclick", "mousedown", "mouseup", "mousemove", "mouseenter", "mouseleave", "contextmenu"];
22
24
  const ctx = useMap();
23
25
  const group = inject(LayerGroupKey, null);
26
+ const effectiveLayout = computed(() => {
27
+ if (!group) return props.layout;
28
+ const visibility = group.visible.value ? props.layout?.visibility ?? "visible" : "none";
29
+ return { ...props.layout, visibility };
30
+ });
31
+ const effectivePaint = computed(() => {
32
+ const factor = group?.opacity.value ?? 1;
33
+ if (factor === 1) return props.paint;
34
+ const scaled = Object.fromEntries(
35
+ opacityPropsFor(props.type).map((key) => [key, scaleOpacity(props.paint?.[key], factor)])
36
+ );
37
+ return { ...props.paint, ...scaled };
38
+ });
39
+ if (group) {
40
+ onUnmounted(group.registerLayer(() => ({ layerId: props.layerId, type: props.type, paint: props.paint })));
41
+ }
24
42
  const inlineSourceId = `${props.layerId}__source`;
25
43
  const hasInlineSource = typeof props.source === "object";
26
44
  function resolveSourceId() {
@@ -32,8 +50,8 @@ function buildSpec() {
32
50
  id: props.layerId,
33
51
  type: props.type,
34
52
  source: resolveSourceId(),
35
- paint: props.paint,
36
- layout: props.layout,
53
+ paint: effectivePaint.value,
54
+ layout: effectiveLayout.value,
37
55
  filter: props.filter,
38
56
  minzoom: props.minzoom,
39
57
  maxzoom: props.maxzoom
@@ -41,17 +59,21 @@ function buildSpec() {
41
59
  if (props.sourceLayer) spec["source-layer"] = props.sourceLayer;
42
60
  return spec;
43
61
  }
62
+ function resolveBeforeId(map) {
63
+ const anchor = props.beforeId ?? group?.beforeId.value;
64
+ return anchor && map.getLayer(anchor) ? anchor : void 0;
65
+ }
66
+ function currentUpdate() {
67
+ return { id: props.layerId, paint: effectivePaint.value, layout: effectiveLayout.value, filter: props.filter, minzoom: props.minzoom, maxzoom: props.maxzoom };
68
+ }
69
+ let prev = currentUpdate();
44
70
  function addLayer(map) {
45
71
  if (map.getLayer(props.layerId)) return;
46
72
  if (hasInlineSource && !map.getSource(inlineSourceId)) {
47
73
  map.addSource(inlineSourceId, props.source);
48
74
  }
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
- }
75
+ map.addLayer(buildSpec(), resolveBeforeId(map));
76
+ prev = currentUpdate();
55
77
  }
56
78
  let stopEvents;
57
79
  let onSourceData;
@@ -77,25 +99,28 @@ function bindLayerEvents(map) {
77
99
  stopEvents?.();
78
100
  stopEvents = bindMapEvents(map, LAYER_EVENTS, (type, event) => emit(type, event), props.layerId);
79
101
  }
80
- let prev = { id: props.layerId, paint: props.paint, layout: props.layout, filter: props.filter, minzoom: props.minzoom, maxzoom: props.maxzoom };
81
102
  watch(
82
- () => [props.paint, props.layout, props.filter, props.minzoom, props.maxzoom],
103
+ () => [effectivePaint.value, effectiveLayout.value, props.filter, props.minzoom, props.maxzoom],
83
104
  () => {
84
105
  const map = ctx.map.value;
85
106
  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 };
107
+ const next = currentUpdate();
87
108
  applyLayerProps(map, next, prev);
88
109
  prev = next;
89
110
  },
90
111
  { deep: true }
91
112
  );
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
- });
113
+ if (hasInlineSource) {
114
+ watch(() => props.source, (next, prev2) => {
115
+ const source = ctx.map.value?.getSource(inlineSourceId);
116
+ if (source) updateSource(source, next, prev2);
117
+ }, { deep: true });
98
118
  }
119
+ watch(() => props.beforeId ?? group?.beforeId.value, () => {
120
+ const map = ctx.map.value;
121
+ if (!map?.getLayer(props.layerId)) return;
122
+ map.moveLayer(props.layerId, resolveBeforeId(map));
123
+ });
99
124
  onUnmounted(() => {
100
125
  stopReady();
101
126
  stopEvents?.();
@@ -1,16 +1,16 @@
1
1
  import type { FilterSpecification, LayerSpecification, SourceSpecification } from '@maplibre/maplibre-gl-style-spec';
2
2
  type PropBag = Record<string, unknown>;
3
3
  type __VLS_Props = {
4
- /** 图层 id,全局唯一 */
4
+ /** 图层 id,全局唯一;变更需配合 `:key` 重建 */
5
5
  layerId: string;
6
6
  /**
7
- * 图层类型,决定渲染方式与可用的 paint / layout 属性
7
+ * 图层类型,决定渲染方式与可用的 paint / layout 属性;变更需配合 `:key` 重建
8
8
  * @see https://maplibre.org/maplibre-style-spec/layers/
9
9
  */
10
10
  type: LayerSpecification['type'];
11
- /** source id 字符串引用,或内联 source 对象(自动创建匿名源并随图层卸载) */
11
+ /** source id 字符串引用,或内联 source 对象(自动创建匿名源并随图层卸载,内容变化时增量更新);二者之间切换需配合 `:key` 重建 */
12
12
  source?: string | SourceSpecification;
13
- /** 矢量瓦片源内的子图层名(source-layer),消费矢量源时必填 */
13
+ /** 矢量瓦片源内的子图层名(source-layer),消费矢量源时必填;变更需配合 `:key` 重建 */
14
14
  sourceLayer?: string;
15
15
  /**
16
16
  * 绘制样式属性,响应式变更经 setPaintProperty 增量下发
@@ -1,20 +1,33 @@
1
- /** 图层组:统一子图层的插入锚点与显隐(组开关优先于子图层自身 layout.visibility)。 */
1
+ import type { LegendItem, StyleLayerPredicate } from '../types';
2
+ /** 图层组:统一子图层的插入锚点、显隐与透明度;带 title 时进入图层树,供图层控件、图例与 useLayerTree 使用。 */
2
3
  type __VLS_Props = {
3
- /** 组内图层缺省插入到该图层之前 */
4
+ /** 组内图层缺省插入到该图层之前;未设置时继承父组 */
4
5
  beforeId?: string;
5
- /**
6
- * 组级显隐
7
- * @defaultValue true
8
- */
9
- visible?: boolean;
6
+ /** 组标题;设置后注册到图层树,出现在 MaplibreLayerControl、MaplibreLegend 与 useLayerTree 中 */
7
+ title?: string;
8
+ /** 图例项;省略时由子图层颜色推导 */
9
+ legend?: LegendItem[];
10
+ /** 认领底图样式自带的图层(按类型、source-layer 等匹配),与子图层一起受组的显隐与透明度控制 */
11
+ styleLayers?: StyleLayerPredicate;
10
12
  };
13
+ type __VLS_ModelProps = {
14
+ /** 组级显隐(组开关优先于子图层自身的 layout.visibility) */
15
+ 'visible'?: boolean;
16
+ /** 组级透明度 0..1,按图层类型缩放各透明度属性 */
17
+ 'opacity'?: number;
18
+ };
19
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
11
20
  declare var __VLS_1: {};
12
21
  type __VLS_Slots = {} & {
13
22
  default?: (props: typeof __VLS_1) => any;
14
23
  };
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>;
24
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
+ "update:visible": (value: boolean) => any;
26
+ "update:opacity": (value: number) => any;
27
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
28
+ "onUpdate:visible"?: ((value: boolean) => any) | undefined;
29
+ "onUpdate:opacity"?: ((value: number) => any) | undefined;
30
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
31
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
19
32
  declare const _default: typeof __VLS_export;
20
33
  export default _default;
@@ -1,14 +1,54 @@
1
1
  <script setup>
2
- import { provide, toRef } from "vue";
2
+ import { computed, inject, provide, reactive, shallowReactive, useId, watch } from "vue";
3
+ import { clamp } from "@movk/core";
4
+ import { useMap } from "../composables/useMap";
3
5
  import { LayerGroupKey } from "../domains/map/layer-group";
6
+ import { getLayerTree } from "../domains/map/layer-tree";
7
+ import { useStyleLayerAdoption } from "../domains/map/style-layers";
8
+ import { deriveLegend } from "../utils/legend";
4
9
  const props = defineProps({
5
10
  beforeId: { type: String, required: false },
6
- visible: { type: Boolean, required: false, default: true }
11
+ title: { type: String, required: false },
12
+ legend: { type: Array, required: false },
13
+ styleLayers: { type: Function, required: false }
7
14
  });
15
+ const visible = defineModel("visible", { type: Boolean, ...{ default: true } });
16
+ const opacity = defineModel("opacity", { type: Number, ...{ default: 1 } });
17
+ const ctx = useMap();
18
+ const parent = inject(LayerGroupKey, null);
19
+ const effectiveVisible = computed(() => (parent?.visible.value ?? true) && visible.value);
20
+ const effectiveOpacity = computed(() => (parent?.opacity.value ?? 1) * clamp(opacity.value, 0, 1));
21
+ const layers = shallowReactive(/* @__PURE__ */ new Set());
22
+ function registerLayer(descriptor) {
23
+ if (!props.title && parent) return parent.registerLayer(descriptor);
24
+ layers.add(descriptor);
25
+ return () => layers.delete(descriptor);
26
+ }
8
27
  provide(LayerGroupKey, {
9
- beforeId: toRef(props, "beforeId"),
10
- visible: toRef(props, "visible")
28
+ beforeId: computed(() => props.beforeId ?? parent?.beforeId.value),
29
+ visible: effectiveVisible,
30
+ opacity: effectiveOpacity,
31
+ registerLayer
11
32
  });
33
+ useStyleLayerAdoption(() => props.styleLayers, effectiveVisible, effectiveOpacity);
34
+ const legendItems = computed(() => props.legend ?? deriveLegend([...layers].map((get) => get()), props.title ?? ""));
35
+ const item = reactive({
36
+ id: useId(),
37
+ title: computed(() => props.title ?? ""),
38
+ visible,
39
+ opacity,
40
+ legend: legendItems,
41
+ setVisible: (value) => {
42
+ visible.value = value;
43
+ },
44
+ setOpacity: (value) => {
45
+ opacity.value = clamp(value, 0, 1);
46
+ }
47
+ });
48
+ watch(() => Boolean(props.title), (titled, _, onCleanup) => {
49
+ if (!titled) return;
50
+ onCleanup(getLayerTree(ctx).register(item.id, item));
51
+ }, { immediate: true });
12
52
  </script>
13
53
 
14
54
  <template>
@@ -1,20 +1,33 @@
1
- /** 图层组:统一子图层的插入锚点与显隐(组开关优先于子图层自身 layout.visibility)。 */
1
+ import type { LegendItem, StyleLayerPredicate } from '../types';
2
+ /** 图层组:统一子图层的插入锚点、显隐与透明度;带 title 时进入图层树,供图层控件、图例与 useLayerTree 使用。 */
2
3
  type __VLS_Props = {
3
- /** 组内图层缺省插入到该图层之前 */
4
+ /** 组内图层缺省插入到该图层之前;未设置时继承父组 */
4
5
  beforeId?: string;
5
- /**
6
- * 组级显隐
7
- * @defaultValue true
8
- */
9
- visible?: boolean;
6
+ /** 组标题;设置后注册到图层树,出现在 MaplibreLayerControl、MaplibreLegend 与 useLayerTree 中 */
7
+ title?: string;
8
+ /** 图例项;省略时由子图层颜色推导 */
9
+ legend?: LegendItem[];
10
+ /** 认领底图样式自带的图层(按类型、source-layer 等匹配),与子图层一起受组的显隐与透明度控制 */
11
+ styleLayers?: StyleLayerPredicate;
10
12
  };
13
+ type __VLS_ModelProps = {
14
+ /** 组级显隐(组开关优先于子图层自身的 layout.visibility) */
15
+ 'visible'?: boolean;
16
+ /** 组级透明度 0..1,按图层类型缩放各透明度属性 */
17
+ 'opacity'?: number;
18
+ };
19
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
11
20
  declare var __VLS_1: {};
12
21
  type __VLS_Slots = {} & {
13
22
  default?: (props: typeof __VLS_1) => any;
14
23
  };
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>;
24
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
+ "update:visible": (value: boolean) => any;
26
+ "update:opacity": (value: number) => any;
27
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
28
+ "onUpdate:visible"?: ((value: boolean) => any) | undefined;
29
+ "onUpdate:opacity"?: ((value: number) => any) | undefined;
30
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
31
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
19
32
  declare const _default: typeof __VLS_export;
20
33
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import type { LngLatLike } from 'maplibre-gl';
2
2
  /** Lottie 标记:在地图标记位用 lottie-web 渲染矢量动画(走 Marker DOM,非 icon 帧驱动)。 */
3
3
  type __VLS_Props = {
4
- /** lottie 动画数据(JSON 对象);与 path 二选一 */
4
+ /** lottie 动画数据(JSON 对象);与 path 二选一,按引用比较,替换对象才重新加载 */
5
5
  animationData?: object;
6
6
  /** lottie 动画 URL;与 animationData 二选一 */
7
7
  path?: string;
@@ -40,11 +40,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
40
40
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
41
41
  "onUpdate:lnglat"?: ((value: LngLatLike) => any) | undefined;
42
42
  }>, {
43
- width: number;
44
- height: number;
45
43
  loop: boolean;
46
44
  autoplay: boolean;
47
45
  speed: number;
46
+ width: number;
47
+ height: number;
48
48
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
49
49
  declare const _default: typeof __VLS_export;
50
50
  export default _default;
@@ -14,12 +14,16 @@ const props = defineProps({
14
14
  const lnglat = defineModel("lnglat", { type: [Object, Array], ...{ required: true } });
15
15
  const container = useTemplateRef("container");
16
16
  let anim;
17
- onMounted(() => {
17
+ function load() {
18
+ anim?.destroy();
19
+ anim = void 0;
18
20
  if (!container.value) return;
19
21
  const base = { container: container.value, renderer: "svg", loop: props.loop, autoplay: props.autoplay };
20
22
  anim = props.path ? lottie.loadAnimation({ ...base, path: props.path }) : lottie.loadAnimation({ ...base, animationData: props.animationData });
21
23
  anim.setSpeed(props.speed);
22
- });
24
+ }
25
+ onMounted(load);
26
+ watch([() => props.path, () => props.animationData, () => props.loop, () => props.autoplay], load);
23
27
  watch(() => props.speed, (speed) => anim?.setSpeed(speed));
24
28
  onUnmounted(() => anim?.destroy());
25
29
  </script>
@@ -1,7 +1,7 @@
1
1
  import type { LngLatLike } from 'maplibre-gl';
2
2
  /** Lottie 标记:在地图标记位用 lottie-web 渲染矢量动画(走 Marker DOM,非 icon 帧驱动)。 */
3
3
  type __VLS_Props = {
4
- /** lottie 动画数据(JSON 对象);与 path 二选一 */
4
+ /** lottie 动画数据(JSON 对象);与 path 二选一,按引用比较,替换对象才重新加载 */
5
5
  animationData?: object;
6
6
  /** lottie 动画 URL;与 animationData 二选一 */
7
7
  path?: string;
@@ -40,11 +40,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
40
40
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
41
41
  "onUpdate:lnglat"?: ((value: LngLatLike) => any) | undefined;
42
42
  }>, {
43
- width: number;
44
- height: number;
45
43
  loop: boolean;
46
44
  autoplay: boolean;
47
45
  speed: number;
46
+ width: number;
47
+ height: number;
48
48
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
49
49
  declare const _default: typeof __VLS_export;
50
50
  export default _default;
@@ -4,7 +4,8 @@ type __VLS_Props = {
4
4
  /** 地图 id;省略时自动生成。提供后可经 useMaplibre(id) 外部访问 */
5
5
  mapId?: string;
6
6
  /**
7
- * maplibre-gl Map 初始化选项(container 由组件接管);缺省 style 时使用空白样式
7
+ * maplibre-gl Map 初始化选项(container 由组件接管);缺省 style 时使用空白样式。
8
+ * 除 style 外仅在创建时读取,变更需配合 `:key` 重建
8
9
  * @see https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/MapOptions/
9
10
  */
10
11
  options?: MaplibreMapOptions;
@@ -5,14 +5,10 @@ import { omitUndefined } from "@movk/core";
5
5
  import { LngLat } from "maplibre-gl";
6
6
  import { createMaplibreContext, MaplibreContextKey } from "../domains/map/context";
7
7
  import { createMaplibreGl } from "../domains/map/create-map";
8
- import { getMaplibreConfig } from "../domains/map/config";
8
+ import { blankStyle } from "../domains/map/style";
9
9
  import { getMapContext, registerMap, unregisterMap } from "../domains/map/registry";
10
10
  import { bindMapEvents } from "../utils/events";
11
11
  defineOptions({ inheritAttrs: false });
12
- function blankStyle() {
13
- const { glyphs } = getMaplibreConfig();
14
- return { version: 8, ...glyphs ? { glyphs } : {}, sources: {}, layers: [] };
15
- }
16
12
  const props = defineProps({
17
13
  mapId: { type: String, required: false },
18
14
  options: { type: Object, required: false },
@@ -130,5 +126,5 @@ defineExpose({
130
126
  </template>
131
127
 
132
128
  <style>
133
- @layer components{:where(.movk-maplibre){height:100%;position:relative;width:100%}}.movk-maplibre>.movk-maplibre__container{inset:0;position:absolute}
129
+ @layer components{:where(.movk-maplibre){height:100%;position:relative;width:100%}}.movk-maplibre{isolation:isolate}.movk-maplibre>.movk-maplibre__container{inset:0;position:absolute}
134
130
  </style>
@@ -4,7 +4,8 @@ type __VLS_Props = {
4
4
  /** 地图 id;省略时自动生成。提供后可经 useMaplibre(id) 外部访问 */
5
5
  mapId?: string;
6
6
  /**
7
- * maplibre-gl Map 初始化选项(container 由组件接管);缺省 style 时使用空白样式
7
+ * maplibre-gl Map 初始化选项(container 由组件接管);缺省 style 时使用空白样式。
8
+ * 除 style 外仅在创建时读取,变更需配合 `:key` 重建
8
9
  * @see https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/MapOptions/
9
10
  */
10
11
  options?: MaplibreMapOptions;
@@ -3,7 +3,8 @@ import type { LngLatLike, MarkerOptions, PopupOptions } from 'maplibre-gl';
3
3
  import type { PopupTrigger } from '../types';
4
4
  type __VLS_Props = {
5
5
  /**
6
- * 标记选项;element 由默认插槽提供,无需在此传入
6
+ * 标记选项;element 由默认插槽提供,无需在此传入。
7
+ * 有 setter 的字段(rotation、draggable 等)增量更新,anchor、color、scale 变化时重建
7
8
  * @see https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/MarkerOptions/
8
9
  */
9
10
  options?: Omit<MarkerOptions, 'element'>;