@movk/maplibre 1.0.0 → 1.1.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 (198) hide show
  1. package/README.en.md +2 -2
  2. package/README.md +2 -2
  3. package/dist/module.d.mts +7 -0
  4. package/dist/module.d.ts +7 -0
  5. package/dist/module.json +1 -1
  6. package/dist/module.mjs +25 -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/unplugin.d.mts +1 -1
  192. package/dist/unplugin.d.ts +1 -1
  193. package/dist/unplugin.mjs +1 -7
  194. package/package.json +20 -12
  195. package/dist/runtime/draw-modes/index.d.ts +0 -16
  196. package/dist/runtime/draw-modes/index.js +0 -32
  197. package/dist/runtime/utils/draw-theme.d.ts +0 -47
  198. /package/dist/runtime/{utils → domains/map}/draw-theme.js +0 -0
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@movk/maplibre",
3
3
  "type": "module",
4
- "version": "1.0.0",
5
- "packageManager": "pnpm@12.5.1",
4
+ "version": "1.1.0",
5
+ "packageManager": "pnpm@12.6.0",
6
6
  "description": "声明式 MapLibre GL 封装库:MaplibreMap/Source/Layer 等组件与 composables,原生支持 Nuxt 4 模块,并通过 Vite 插件在纯 Vue + Vite 项目中可用。无需 access token,内置 3D 建筑、雷达/扩散/辉光等动态效果,sky/terrain 环境,绘制(terra-draw)、天地图、WMS/WMTS 与多坐标系本土化支持。",
7
7
  "author": "YiXuan <mhaibaraai@gmail.com>",
8
8
  "license": "MIT",
@@ -49,10 +49,6 @@
49
49
  "types": "./dist/vue-plugin.d.mts",
50
50
  "import": "./dist/vue-plugin.mjs"
51
51
  },
52
- "./draw-modes": {
53
- "types": "./dist/runtime/draw-modes/index.d.ts",
54
- "import": "./dist/runtime/draw-modes/index.js"
55
- },
56
52
  "./index.css": "./dist/runtime/index.css",
57
53
  "./runtime/*": "./dist/runtime/*",
58
54
  "./components/*": "./dist/runtime/components/*",
@@ -75,9 +71,6 @@
75
71
  "vue-plugin": [
76
72
  "./dist/vue-plugin.d.mts"
77
73
  ],
78
- "draw-modes": [
79
- "./dist/runtime/draw-modes/index.d.ts"
80
- ],
81
74
  "runtime/*": [
82
75
  "./dist/runtime/*"
83
76
  ],
@@ -95,16 +88,28 @@
95
88
  "dist"
96
89
  ],
97
90
  "peerDependencies": {
91
+ "@geomatico/maplibre-cog-protocol": ">=0.10.0",
98
92
  "lottie-web": ">=5.0.0",
93
+ "maplibre-contour": ">=0.1.0",
99
94
  "maplibre-gl": ">=6.0.0",
95
+ "pmtiles": ">=4.0.0",
100
96
  "terra-draw": ">=1.0.0",
101
97
  "terra-draw-maplibre-gl-adapter": ">=1.0.0",
102
98
  "vue": ">=3.5.0"
103
99
  },
104
100
  "peerDependenciesMeta": {
101
+ "@geomatico/maplibre-cog-protocol": {
102
+ "optional": true
103
+ },
105
104
  "lottie-web": {
106
105
  "optional": true
107
106
  },
107
+ "maplibre-contour": {
108
+ "optional": true
109
+ },
110
+ "pmtiles": {
111
+ "optional": true
112
+ },
108
113
  "terra-draw": {
109
114
  "optional": true
110
115
  },
@@ -131,7 +136,7 @@
131
136
  },
132
137
  "dependencies": {
133
138
  "@maplibre/maplibre-gl-style-spec": "^26.4.4",
134
- "@movk/core": "^1.4.1",
139
+ "@movk/core": "^1.5.0",
135
140
  "@turf/area": "^7.4.0",
136
141
  "@turf/bearing": "^7.4.0",
137
142
  "@turf/buffer": "^7.4.0",
@@ -148,6 +153,7 @@
148
153
  "unplugin-vue-components": "^32.1.0"
149
154
  },
150
155
  "devDependencies": {
156
+ "@geomatico/maplibre-cog-protocol": "^0.10.0",
151
157
  "@nuxt/eslint-config": "^1.17.0",
152
158
  "@nuxt/kit": "^4.5.2",
153
159
  "@nuxt/module-builder": "^1.0.3",
@@ -159,15 +165,17 @@
159
165
  "eslint": "^10.11.0",
160
166
  "happy-dom": "^20.14.5",
161
167
  "lottie-web": "^5.13.0",
162
- "maplibre-gl": "^6.10.0",
168
+ "maplibre-contour": "^0.1.1",
169
+ "maplibre-gl": "^6.11.2",
163
170
  "nuxt": "^4.5.2",
171
+ "pmtiles": "^4.5.0",
164
172
  "release-it": "^21.1.0",
165
173
  "terra-draw": "^1.35.0",
166
174
  "terra-draw-maplibre-gl-adapter": "^1.4.1",
167
175
  "typescript": "^6.0.3",
168
176
  "unbuild": "^3.6.1",
169
177
  "unplugin": "^3.4.0",
170
- "vitest": "^5.0.1",
178
+ "vitest": "^5.0.2",
171
179
  "vue": "^3.5.43",
172
180
  "vue-tsc": "^3.3.11"
173
181
  }
@@ -1,16 +0,0 @@
1
- import type { TerraDrawExtend } from 'terra-draw';
2
- import type { DrawThemeOptions } from '../utils/draw-theme';
3
- /** 内置绘制模式名(不含选择模式 'select') */
4
- export declare const DRAW_MODE_NAMES: readonly ["point", "linestring", "polygon", "rectangle", "circle", "ellipse", "sector"];
5
- export type DrawModeName = (typeof DRAW_MODE_NAMES)[number];
6
- /** terra-draw 模式实例(绘制或选择模式) */
7
- export type DrawMode = TerraDrawExtend.TerraDrawBaseDrawMode<TerraDrawExtend.CustomStyling>;
8
- export interface MovkDrawModesOptions {
9
- /** 绘制主题,参见 drawThemeStyles */
10
- theme?: DrawThemeOptions;
11
- }
12
- /**
13
- * 预设 terra-draw 模式集合:选择模式 + 全部内置绘制模式,统一应用主题。
14
- * 每次调用返回新实例,模式实例不可在多个 TerraDraw 间共享。
15
- */
16
- export declare function movkDrawModes(options?: MovkDrawModesOptions): DrawMode[];
@@ -1,32 +0,0 @@
1
- import {
2
- TerraDrawCircleMode,
3
- TerraDrawEllipseMode,
4
- TerraDrawLineStringMode,
5
- TerraDrawPointMode,
6
- TerraDrawPolygonMode,
7
- TerraDrawRectangleMode,
8
- TerraDrawSectorMode,
9
- TerraDrawSelectMode
10
- } from "terra-draw";
11
- import { drawThemeStyles } from "../utils/draw-theme.js";
12
- export const DRAW_MODE_NAMES = ["point", "linestring", "polygon", "rectangle", "circle", "ellipse", "sector"];
13
- const EDITABLE_COORDINATES = { draggable: true, deletable: true, midpoints: true };
14
- export function movkDrawModes(options = {}) {
15
- const styles = drawThemeStyles(options.theme);
16
- const flags = Object.fromEntries(DRAW_MODE_NAMES.map((name) => [name, {
17
- feature: {
18
- draggable: true,
19
- ...name === "linestring" || name === "polygon" ? { coordinates: EDITABLE_COORDINATES } : {}
20
- }
21
- }]));
22
- return [
23
- new TerraDrawSelectMode({ flags, styles: styles.select }),
24
- new TerraDrawPointMode({ styles: styles.point }),
25
- new TerraDrawLineStringMode({ styles: styles.linestring }),
26
- new TerraDrawPolygonMode({ styles: styles.polygon }),
27
- new TerraDrawRectangleMode({ styles: styles.rectangle }),
28
- new TerraDrawCircleMode({ styles: styles.circle }),
29
- new TerraDrawEllipseMode({ styles: styles.ellipse }),
30
- new TerraDrawSectorMode({ styles: styles.sector })
31
- ];
32
- }
@@ -1,47 +0,0 @@
1
- import type { GeoJSONStoreFeatures, HexColor } from 'terra-draw';
2
- export interface DrawThemeOptions {
3
- /**
4
- * 非激活态主色
5
- * @defaultValue '#3b82f6'
6
- */
7
- color?: HexColor;
8
- /**
9
- * 激活态(绘制辅助点/选中)主色
10
- * @defaultValue '#f59e0b'
11
- */
12
- activeColor?: HexColor;
13
- /**
14
- * 多边形填充不透明度
15
- * @defaultValue 0.1
16
- */
17
- fillOpacity?: number;
18
- /**
19
- * 线宽
20
- * @defaultValue 2
21
- */
22
- lineWidth?: number;
23
- /**
24
- * 顶点圆半径
25
- * @defaultValue 5
26
- */
27
- vertexRadius?: number;
28
- }
29
- type ColorStyle = (feature: GeoJSONStoreFeatures) => HexColor;
30
- type ModeStyles = Record<string, number | HexColor | ColorStyle>;
31
- /** 各模式的 terra-draw styles,键为模式名 */
32
- export interface DrawThemeStyles {
33
- select: Record<string, number | HexColor>;
34
- point: ModeStyles;
35
- linestring: ModeStyles;
36
- polygon: ModeStyles;
37
- rectangle: ModeStyles;
38
- circle: ModeStyles;
39
- ellipse: ModeStyles;
40
- sector: ModeStyles;
41
- }
42
- /**
43
- * 生成 terra-draw 各模式的主题样式。
44
- * 要素 `properties.color` 优先于主题色,便于按要素单独着色(配合 setFeatureProperty)。
45
- */
46
- export declare function drawThemeStyles(options?: DrawThemeOptions): DrawThemeStyles;
47
- export {};