@xingm/vmap-cesium-toolbar 0.0.6 → 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.
- package/README.md +126 -230
- package/dist/README.md +172 -0
- package/dist/adapters/DrawHelperAdapter.d.ts +143 -0
- package/dist/adapters/MapLoaderAdapter.d.ts +44 -0
- package/dist/adapters/OverlayServiceAdapter.d.ts +102 -0
- package/dist/adapters/ToolbarAdapter.d.ts +71 -0
- package/dist/adapters/index.d.ts +23 -0
- package/dist/components/BaseComponent.d.ts +116 -0
- package/dist/components/SearchBox.d.ts +136 -0
- package/dist/components/Toolbar.d.ts +115 -0
- package/dist/components/ToolbarButton.d.ts +100 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/core/MapPlugin.d.ts +160 -0
- package/dist/core/constants.d.ts +88 -0
- package/dist/core/entities/BaseOverlay.d.ts +156 -0
- package/dist/core/entities/Circle.d.ts +102 -0
- package/dist/core/entities/Icon.d.ts +86 -0
- package/dist/core/entities/InfoWindow.d.ts +116 -0
- package/dist/core/entities/Label.d.ts +92 -0
- package/dist/core/entities/Marker.d.ts +66 -0
- package/dist/core/entities/Polygon.d.ts +93 -0
- package/dist/core/entities/Polyline.d.ts +72 -0
- package/dist/core/entities/Rectangle.d.ts +99 -0
- package/dist/core/entities/Ring.d.ts +114 -0
- package/dist/core/entities/SVG.d.ts +89 -0
- package/dist/core/entities/index.d.ts +27 -0
- package/dist/core/index.d.ts +25 -0
- package/dist/core/layers/BaiduMapLayer.d.ts +37 -0
- package/dist/core/layers/CustomMapLayer.d.ts +43 -0
- package/dist/core/layers/GaodeMapLayer.d.ts +41 -0
- package/dist/core/layers/HeatmapLayer.d.ts +118 -0
- package/dist/core/layers/MapLayer.d.ts +37 -0
- package/dist/core/layers/OSMMapLayer.d.ts +37 -0
- package/dist/core/layers/PointClusterLayer.d.ts +119 -0
- package/dist/core/layers/TDTMapLayer.d.ts +45 -0
- package/dist/core/layers/index.d.ts +15 -0
- package/dist/core/services/draw/DrawInteractionController.d.ts +16 -0
- package/dist/core/services/draw/DrawService.d.ts +38 -0
- package/dist/core/services/draw/DrawSessionStore.d.ts +28 -0
- package/dist/core/services/draw/drawDefaults.d.ts +16 -0
- package/dist/core/services/draw/entities/drawEntityFactory.d.ts +10 -0
- package/dist/core/services/draw/entities/drawEntityRegistry.d.ts +8 -0
- package/dist/core/services/draw/entities/drawFinalFactory.d.ts +14 -0
- package/dist/core/services/draw/entities/drawPreviewFactory.d.ts +15 -0
- package/dist/core/services/draw/geometry/drawGeometry.d.ts +11 -0
- package/dist/core/services/draw/geometry/drawPosition.d.ts +6 -0
- package/dist/core/services/draw/index.d.ts +7 -0
- package/dist/core/services/draw/labels/drawHint.d.ts +16 -0
- package/dist/core/services/draw/labels/measurementCanvas.d.ts +8 -0
- package/dist/core/services/draw/labels/measurementLabelFactory.d.ts +18 -0
- package/dist/core/services/draw/measurementThemeResolver.d.ts +9 -0
- package/dist/core/services/draw/types/drawState.d.ts +37 -0
- package/dist/core/services/draw/types/drawTypes.d.ts +97 -0
- package/dist/core/services/index.d.ts +10 -0
- package/dist/core/services/overlay/OverlayService.d.ts +188 -0
- package/dist/core/services/overlay/index.d.ts +7 -0
- package/dist/core/services/toolbar/ToolbarService.d.ts +175 -0
- package/dist/core/services/toolbar/buttons/BaseButtonHandler.d.ts +111 -0
- package/dist/core/services/toolbar/buttons/LayersButtonHandler.d.ts +47 -0
- package/dist/core/services/toolbar/buttons/MeasureButtonHandler.d.ts +94 -0
- package/dist/core/services/toolbar/buttons/SearchButtonHandler.d.ts +111 -0
- package/dist/core/services/toolbar/buttons/SimpleButtonHandler.d.ts +79 -0
- package/dist/core/services/toolbar/config.d.ts +7 -0
- package/dist/core/services/toolbar/index.d.ts +30 -0
- package/dist/core/services/toolbar/menus/BaseMenu.d.ts +99 -0
- package/dist/core/services/toolbar/menus/MeasureMenu.d.ts +44 -0
- package/dist/core/services/toolbar/types.d.ts +198 -0
- package/dist/core/types.d.ts +586 -0
- package/dist/i18n/en-US.d.ts +46 -0
- package/dist/i18n/index.d.ts +45 -2
- package/dist/i18n/zh-CN.d.ts +46 -0
- package/dist/index.d.ts +37 -42
- package/dist/index.es.js +6874 -9666
- package/dist/index.es.js.map +1 -1
- package/dist/libs/CesiumMapModel.d.ts +1 -172
- package/dist/libs/CesiumMapToolbar.d.ts +1 -1
- package/dist/libs/CesiumOverlayService.d.ts +9 -222
- package/dist/libs/config/CesiumMapConfig.d.ts +5 -12
- package/dist/libs/drawHelper/DrawHint.d.ts +15 -27
- package/dist/libs/drawHelper/index.d.ts +67 -6
- package/dist/libs/toolBar/CesiumMapController.d.ts +38 -64
- package/dist/libs/toolBar/MapLayersService.d.ts +10 -61
- package/dist/libs/toolBar/MapSearchService.d.ts +8 -29
- package/dist/libs/toolBar/MapToolBarConfig.d.ts +33 -5
- package/dist/libs/toolBar/MeasurementService.d.ts +13 -5
- package/dist/libs/toolBar/NotFlyZonesService.d.ts +6 -41
- package/dist/package.json +19 -6
- package/dist/styles/ComponentStyles.d.ts +82 -0
- package/dist/styles/StyleManager.d.ts +142 -0
- package/dist/styles/index.d.ts +128 -0
- package/dist/utils/common.d.ts +4 -0
- package/package.json +1 -1
- package/dist/hooks/toolBarConfig.d.ts +0 -75
- package/dist/hooks/useDrawHelper.d.ts +0 -24
- package/dist/hooks/useDynamicRing.d.ts +0 -44
- package/dist/hooks/useHeatmapHelper.d.ts +0 -18
- package/dist/hooks/useMap.d.ts +0 -14
- package/dist/hooks/useMapInit.d.ts +0 -14
- package/dist/hooks/useOverlayHelper.d.ts +0 -48
- package/dist/hooks/usePointClusterHelper.d.ts +0 -14
- package/dist/index.umd.js +0 -326
- package/dist/index.umd.js.map +0 -1
- package/dist/libs/drawHelper/BaseDraw.d.ts +0 -194
- package/dist/libs/drawHelper/DrawCircle.d.ts +0 -31
- package/dist/libs/drawHelper/DrawLine.d.ts +0 -49
- package/dist/libs/drawHelper/DrawPolgon.d.ts +0 -35
- package/dist/libs/drawHelper/DrawRectangle.d.ts +0 -24
- package/dist/libs/i18n/en-US.d.ts +0 -69
- package/dist/libs/i18n/index.d.ts +0 -25
- package/dist/libs/i18n/zh-CN.d.ts +0 -69
- package/dist/libs/overlay/MapCircle.d.ts +0 -130
- package/dist/libs/overlay/MapIcon.d.ts +0 -69
- package/dist/libs/overlay/MapInfoWindow.d.ts +0 -100
- package/dist/libs/overlay/MapLabel.d.ts +0 -73
- package/dist/libs/overlay/MapMarker.d.ts +0 -60
- package/dist/libs/overlay/MapPolygon.d.ts +0 -114
- package/dist/libs/overlay/MapPolyline.d.ts +0 -64
- package/dist/libs/overlay/MapRectangle.d.ts +0 -101
- package/dist/libs/overlay/MapRing.d.ts +0 -107
- package/dist/libs/overlay/MapSVG.d.ts +0 -73
- package/dist/libs/overlay/OverlayEditController.d.ts +0 -167
- package/dist/libs/overlay/OverlayEditHandles.d.ts +0 -101
- package/dist/libs/overlay/OverlayHighlight.d.ts +0 -40
- package/dist/libs/overlay/index.d.ts +0 -23
- package/dist/libs/overlay/primitives/CirclePrimitiveBatch.d.ts +0 -42
- package/dist/libs/overlay/primitives/CirclePrimitiveLayerStack.d.ts +0 -24
- package/dist/libs/overlay/primitives/PolygonPrimitiveBatch.d.ts +0 -43
- package/dist/libs/overlay/primitives/PolygonPrimitiveLayerStack.d.ts +0 -24
- package/dist/libs/overlay/primitives/RectanglePrimitiveBatch.d.ts +0 -41
- package/dist/libs/overlay/primitives/RectanglePrimitiveLayerStack.d.ts +0 -24
- package/dist/libs/overlay/types.d.ts +0 -121
- package/dist/z.const.d.ts +0 -24
- /package/dist/{libs → utils}/PickGovernor.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Viewer } from '../../../node_modules/cesium';
|
|
2
2
|
import { MapType } from '../CesiumMapModel';
|
|
3
|
-
import { I18nLike } from '../../
|
|
3
|
+
import { I18nLike } from '../../i18n';
|
|
4
4
|
/**
|
|
5
5
|
* 图层服务配置接口
|
|
6
6
|
*/
|
|
@@ -17,73 +17,22 @@ export interface MapLayersServiceConfig {
|
|
|
17
17
|
onNoFlyZoneToggle?: (isChecked: boolean) => void;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* 图层服务 - 存根实现
|
|
21
|
+
* 为了保持向后兼容性
|
|
22
22
|
*/
|
|
23
23
|
export declare class MapLayersService {
|
|
24
|
-
private static readonly PLACE_NAME_LAYER_TAG;
|
|
25
24
|
private viewer;
|
|
26
25
|
private toolbarElement;
|
|
27
26
|
private config;
|
|
28
|
-
private
|
|
29
|
-
private currentMapTypeConfig;
|
|
30
|
-
private currentMapLayers;
|
|
31
|
-
private currentPlaceNameProvider;
|
|
32
|
-
private currentPlaceNameLayer;
|
|
33
|
-
private isPlaceNameChecked;
|
|
34
|
-
private i18n;
|
|
35
|
-
private useI18n;
|
|
27
|
+
private menuElement;
|
|
36
28
|
constructor(viewer: Viewer, toolbarElement: HTMLElement, config: MapLayersServiceConfig);
|
|
37
|
-
|
|
38
|
-
* 初始化当前地图上下文:用于“初始底图不是通过 switchMapType 加载”时的路网层识别。
|
|
39
|
-
*/
|
|
40
|
-
private bootstrapCurrentMapContext;
|
|
41
|
-
/**
|
|
42
|
-
* 更新配置
|
|
43
|
-
*/
|
|
44
|
-
updateConfig(config: Partial<MapLayersServiceConfig>): void;
|
|
45
|
-
adjustMenuPosition: (menu: HTMLElement) => void;
|
|
46
|
-
/**
|
|
47
|
-
* 切换图层菜单
|
|
48
|
-
*/
|
|
49
|
-
toggleLayers(buttonElement: HTMLElement): void;
|
|
50
|
-
/**
|
|
51
|
-
* 创建地图类型部分
|
|
52
|
-
*/
|
|
53
|
-
private createMapTypeSection;
|
|
54
|
-
/**
|
|
55
|
-
* 创建地图类型项
|
|
56
|
-
*/
|
|
57
|
-
private createMapTypeItem;
|
|
58
|
-
/**
|
|
59
|
-
* 创建叠加图层部分
|
|
60
|
-
*/
|
|
61
|
-
private createOverlaySection;
|
|
62
|
-
/**
|
|
63
|
-
* 创建叠加图层项
|
|
64
|
-
*/
|
|
65
|
-
private createOverlayItem;
|
|
66
|
-
/**
|
|
67
|
-
* 切换地图类型
|
|
68
|
-
*/
|
|
29
|
+
bootstrapCurrentMapContext(): void;
|
|
69
30
|
switchMapType(mapTypeId: string): void;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
getCurrentMapType(): string;
|
|
74
|
-
private setPlaceNameChecked;
|
|
75
|
-
private shouldEnablePlaceName;
|
|
76
|
-
private isSameProvider;
|
|
77
|
-
private resolveExistingPlaceNameLayer;
|
|
78
|
-
private ensurePlaceNameProvider;
|
|
79
|
-
private addPlaceNameLayer;
|
|
80
|
-
private removePlaceNameLayer;
|
|
81
|
-
/**
|
|
82
|
-
* 关闭图层菜单
|
|
83
|
-
*/
|
|
31
|
+
togglePlaceName(): void;
|
|
32
|
+
showNoFlyZones(): void;
|
|
33
|
+
toggleNoFlyZoneVisibility(): void;
|
|
84
34
|
closeLayersMenu(): void;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
*/
|
|
35
|
+
toggleLayers(buttonElement: HTMLElement): void;
|
|
36
|
+
updateConfig(config: Partial<MapLayersServiceConfig>): void;
|
|
88
37
|
destroy(): void;
|
|
89
38
|
}
|
|
@@ -1,47 +1,26 @@
|
|
|
1
1
|
import { Viewer } from '../../../node_modules/cesium';
|
|
2
|
-
import {
|
|
3
|
-
import { I18nLike } from '../../
|
|
2
|
+
import { SearchCallback } from '../CesiumMapModel';
|
|
3
|
+
import { I18nLike } from '../../i18n';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* 搜索服务 - 存根实现
|
|
6
|
+
* 为了保持向后兼容性
|
|
7
7
|
*/
|
|
8
8
|
export declare class SearchService {
|
|
9
9
|
private viewer;
|
|
10
10
|
private toolbarElement;
|
|
11
11
|
private searchCallback?;
|
|
12
|
-
private searchContainer;
|
|
13
12
|
private i18n;
|
|
14
13
|
private useI18n;
|
|
14
|
+
private searchContainer;
|
|
15
|
+
private static readonly fallbackI18n;
|
|
15
16
|
constructor(viewer: Viewer, toolbarElement: HTMLElement, searchCallback?: SearchCallback, options?: {
|
|
16
17
|
i18n?: I18nLike;
|
|
17
18
|
useI18n?: boolean;
|
|
18
19
|
});
|
|
19
|
-
/**
|
|
20
|
-
* 设置搜索回调
|
|
21
|
-
*/
|
|
22
20
|
setSearchCallback(callback: SearchCallback): void;
|
|
23
|
-
/**
|
|
24
|
-
* 切换搜索功能
|
|
25
|
-
*/
|
|
26
21
|
toggleSearch(buttonElement: HTMLElement): void;
|
|
27
|
-
|
|
28
|
-
* 执行默认搜索(使用天地图 API)
|
|
29
|
-
*/
|
|
30
|
-
private performDefaultSearch;
|
|
31
|
-
/**
|
|
32
|
-
* 显示搜索结果
|
|
33
|
-
*/
|
|
34
|
-
displaySearchResults(results: SearchResult[], container: HTMLElement): void;
|
|
35
|
-
/**
|
|
36
|
-
* 选择搜索结果
|
|
37
|
-
*/
|
|
38
|
-
selectSearchResult(result: SearchResult): void;
|
|
39
|
-
/**
|
|
40
|
-
* 关闭搜索框
|
|
41
|
-
*/
|
|
22
|
+
hideSearch(): void;
|
|
42
23
|
closeSearchContainer(): void;
|
|
43
|
-
/**
|
|
44
|
-
* 销毁搜索服务
|
|
45
|
-
*/
|
|
46
24
|
destroy(): void;
|
|
25
|
+
private flyToResult;
|
|
47
26
|
}
|
|
@@ -1,10 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { CustomButtonConfig } from '../CesiumMapModel';
|
|
2
|
+
/**
|
|
3
|
+
* 旧版默认按钮配置。
|
|
4
|
+
* 从 core/constants 映射导出,避免重复维护。
|
|
5
|
+
*/
|
|
6
|
+
export declare const defaultButtons: CustomButtonConfig[];
|
|
7
|
+
/**
|
|
8
|
+
* 旧版默认测量菜单项。
|
|
9
|
+
*/
|
|
4
10
|
export declare const defaultMeasureItems: {
|
|
5
11
|
id: string;
|
|
6
12
|
text: string;
|
|
7
|
-
textKey
|
|
13
|
+
textKey?: string;
|
|
8
14
|
icon: string;
|
|
9
15
|
}[];
|
|
10
|
-
|
|
16
|
+
/**
|
|
17
|
+
* 旧版默认工具栏样式配置。
|
|
18
|
+
*/
|
|
19
|
+
export declare const defaultToolBarStyle: {
|
|
20
|
+
position?: "top-right" | "top-left" | "bottom-right" | "bottom-left";
|
|
21
|
+
direction?: "row" | "column";
|
|
22
|
+
buttonSize?: number;
|
|
23
|
+
buttonSpacing?: number;
|
|
24
|
+
padding?: string;
|
|
25
|
+
backgroundColor?: string;
|
|
26
|
+
borderColor?: string;
|
|
27
|
+
borderRadius?: number;
|
|
28
|
+
borderWidth?: number;
|
|
29
|
+
boxShadow?: string;
|
|
30
|
+
zIndex?: number;
|
|
31
|
+
offsetTop?: number;
|
|
32
|
+
offsetRight?: number;
|
|
33
|
+
offsetBottom?: number;
|
|
34
|
+
offsetLeft?: number;
|
|
35
|
+
buttons?: CustomButtonConfig[];
|
|
36
|
+
useI18n?: boolean;
|
|
37
|
+
i18n?: import('../..').I18nLike;
|
|
38
|
+
};
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import { Viewer } from '../../../node_modules/cesium';
|
|
2
|
-
import { default as DrawHelper } from '../CesiumMapDraw';
|
|
3
2
|
import { MeasurementCallback } from '../CesiumMapModel';
|
|
3
|
+
import { MeasurementCompleteEvent } from '../../core/services/toolbar/types';
|
|
4
4
|
export type MeasureMode = 'none' | 'distance' | 'area';
|
|
5
|
+
/**
|
|
6
|
+
* 测量服务 - 存根实现
|
|
7
|
+
* 为了保持向后兼容性
|
|
8
|
+
*/
|
|
5
9
|
export declare class MeasurementService {
|
|
6
|
-
private viewer;
|
|
7
10
|
private drawHelper;
|
|
8
11
|
private measurementCallback?;
|
|
9
12
|
private currentMode;
|
|
10
|
-
|
|
13
|
+
private completionListeners;
|
|
14
|
+
private clearListeners;
|
|
15
|
+
constructor(viewer: Viewer, drawHelper: any, measurementCallback?: MeasurementCallback);
|
|
11
16
|
getMeasureMode(): MeasureMode;
|
|
12
17
|
setupDrawHelperCallbacks(): void;
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
onMeasurementComplete(callback: (event: MeasurementCompleteEvent) => void): void;
|
|
19
|
+
onClearComplete(callback: () => void): void;
|
|
20
|
+
startDistanceMeasurement(_drawOptions?: any): void;
|
|
21
|
+
startAreaMeasurement(_drawOptions?: any): void;
|
|
15
22
|
clearMeasurements(): void;
|
|
23
|
+
private emitMeasurementComplete;
|
|
16
24
|
}
|
|
@@ -1,51 +1,16 @@
|
|
|
1
1
|
import { Viewer } from '../../../node_modules/cesium';
|
|
2
|
-
import { I18nLike } from '../../libs/i18n';
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
export interface NotFlyZonesServiceConfig {
|
|
7
|
-
extrudedHeight?: number;
|
|
8
|
-
autoLoad?: boolean;
|
|
9
|
-
i18n?: I18nLike;
|
|
10
|
-
useI18n?: boolean;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* 禁飞区服务类
|
|
14
|
-
* 负责处理机场禁飞区相关的所有逻辑
|
|
3
|
+
* 禁飞区服务 - 存根实现
|
|
4
|
+
* 为了保持向后兼容性
|
|
15
5
|
*/
|
|
16
6
|
export declare class NotFlyZonesService {
|
|
17
7
|
private viewer;
|
|
18
|
-
private
|
|
19
|
-
|
|
20
|
-
private isNoFlyZoneLoading;
|
|
21
|
-
private readonly extrudedHeight;
|
|
22
|
-
private i18n;
|
|
23
|
-
private useI18n;
|
|
24
|
-
constructor(viewer: Viewer, config?: NotFlyZonesServiceConfig);
|
|
25
|
-
/**
|
|
26
|
-
* 加载并显示机场禁飞区
|
|
27
|
-
*/
|
|
8
|
+
private visible;
|
|
9
|
+
constructor(viewer: Viewer, config?: any);
|
|
28
10
|
showNoFlyZones(): Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
* 隐藏机场禁飞区
|
|
31
|
-
*/
|
|
32
11
|
hideNoFlyZones(): void;
|
|
33
|
-
|
|
34
|
-
* 切换机场禁飞区显示状态
|
|
35
|
-
*/
|
|
36
|
-
toggleNoFlyZones(): Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* 获取禁飞区显示状态
|
|
39
|
-
*/
|
|
12
|
+
toggleVisibility(): void;
|
|
40
13
|
getNoFlyZoneVisible(): boolean;
|
|
41
|
-
|
|
42
|
-
* 创建禁飞区多边形配置选项
|
|
43
|
-
* @param positions - 多边形的顶点坐标数组,使用笛卡尔坐标系
|
|
44
|
-
* @returns 返回一个包含多边形图形配置选项的对象
|
|
45
|
-
*/
|
|
46
|
-
private createNoFlyZonePolygonOptions;
|
|
47
|
-
/**
|
|
48
|
-
* 销毁禁飞区服务
|
|
49
|
-
*/
|
|
14
|
+
toggleNoFlyZones(): Promise<void>;
|
|
50
15
|
destroy(): void;
|
|
51
16
|
}
|
package/dist/package.json
CHANGED
|
@@ -1,29 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xingm/vmap-cesium-toolbar",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A powerful Cesium map toolbar plugin with drawing, measurement, and interaction features",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.es.js",
|
|
7
7
|
"module": "index.es.js",
|
|
8
8
|
"types": "index.d.ts",
|
|
9
9
|
"files": [
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"adapters",
|
|
11
|
+
"components",
|
|
12
|
+
"core",
|
|
13
|
+
"geojson",
|
|
14
|
+
"i18n",
|
|
12
15
|
"index.d.ts",
|
|
13
|
-
"
|
|
16
|
+
"index.es.js",
|
|
17
|
+
"index.es.js.map",
|
|
18
|
+
"libs",
|
|
14
19
|
"README.md",
|
|
15
|
-
"
|
|
20
|
+
"style.css",
|
|
21
|
+
"styles",
|
|
22
|
+
"utils"
|
|
16
23
|
],
|
|
17
24
|
"exports": {
|
|
18
25
|
".": {
|
|
26
|
+
"types": "./index.d.ts",
|
|
19
27
|
"import": "./index.es.js",
|
|
20
28
|
"default": "./index.es.js"
|
|
21
29
|
},
|
|
22
|
-
"./style": "./style.css"
|
|
30
|
+
"./style": "./style.css",
|
|
31
|
+
"./package.json": "./package.json"
|
|
23
32
|
},
|
|
24
33
|
"peerDependencies": {
|
|
25
34
|
"vue": "^3.0.0"
|
|
26
35
|
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"cesium": "^1.134.1",
|
|
38
|
+
"vue": "^3.5.18"
|
|
39
|
+
},
|
|
27
40
|
"keywords": [
|
|
28
41
|
"cesium",
|
|
29
42
|
"map",
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { StyleConfig } from '../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* 组件样式工具
|
|
4
|
+
* 提供组件样式的创建、管理和应用功能
|
|
5
|
+
*/
|
|
6
|
+
export interface ComponentStyleOptions {
|
|
7
|
+
baseClass?: string;
|
|
8
|
+
variants?: Record<string, Record<string, string>>;
|
|
9
|
+
defaultVariant?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 组件样式类
|
|
13
|
+
*/
|
|
14
|
+
export declare class ComponentStyles {
|
|
15
|
+
private componentName;
|
|
16
|
+
private options;
|
|
17
|
+
private styleId;
|
|
18
|
+
/**
|
|
19
|
+
* 构造函数
|
|
20
|
+
* @param componentName 组件名称
|
|
21
|
+
* @param options 样式选项
|
|
22
|
+
*/
|
|
23
|
+
constructor(componentName: string, options?: ComponentStyleOptions);
|
|
24
|
+
/**
|
|
25
|
+
* 生成基础样式
|
|
26
|
+
*/
|
|
27
|
+
private generateBaseStyles;
|
|
28
|
+
/**
|
|
29
|
+
* 生成变体样式
|
|
30
|
+
*/
|
|
31
|
+
private generateVariantStyles;
|
|
32
|
+
/**
|
|
33
|
+
* 生成状态样式
|
|
34
|
+
*/
|
|
35
|
+
private generateStateStyles;
|
|
36
|
+
/**
|
|
37
|
+
* 注入样式
|
|
38
|
+
*/
|
|
39
|
+
inject(): string;
|
|
40
|
+
/**
|
|
41
|
+
* 移除样式
|
|
42
|
+
*/
|
|
43
|
+
remove(): void;
|
|
44
|
+
/**
|
|
45
|
+
* 获取样式配置
|
|
46
|
+
* @param variant 变体名称
|
|
47
|
+
*/
|
|
48
|
+
getStyleConfig(variant?: string): StyleConfig;
|
|
49
|
+
/**
|
|
50
|
+
* 应用样式到元素
|
|
51
|
+
* @param element 目标元素
|
|
52
|
+
* @param variant 变体名称
|
|
53
|
+
*/
|
|
54
|
+
applyToElement(element: HTMLElement, variant?: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* 添加变体
|
|
57
|
+
* @param variantName 变体名称
|
|
58
|
+
* @param styles 样式对象
|
|
59
|
+
*/
|
|
60
|
+
addVariant(variantName: string, styles: Record<string, string>): void;
|
|
61
|
+
/**
|
|
62
|
+
* 移除变体
|
|
63
|
+
* @param variantName 变体名称
|
|
64
|
+
*/
|
|
65
|
+
removeVariant(variantName: string): void;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 预定义组件样式
|
|
69
|
+
*/
|
|
70
|
+
export declare const predefinedComponentStyles: {
|
|
71
|
+
toolbar: ComponentStyles;
|
|
72
|
+
button: ComponentStyles;
|
|
73
|
+
searchBox: ComponentStyles;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* 创建组件样式的工厂函数
|
|
77
|
+
*/
|
|
78
|
+
export declare function createComponentStyles(componentName: string, options?: ComponentStyleOptions): ComponentStyles;
|
|
79
|
+
/**
|
|
80
|
+
* 获取预定义组件样式
|
|
81
|
+
*/
|
|
82
|
+
export declare function getPredefinedComponentStyles(componentName: keyof typeof predefinedComponentStyles): ComponentStyles;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 样式管理器
|
|
3
|
+
* 负责管理组件样式,支持样式隔离、主题切换和动态样式注入
|
|
4
|
+
*/
|
|
5
|
+
export interface StyleRule {
|
|
6
|
+
selector: string;
|
|
7
|
+
properties: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
export interface Theme {
|
|
10
|
+
name: string;
|
|
11
|
+
variables: Record<string, string>;
|
|
12
|
+
rules: StyleRule[];
|
|
13
|
+
}
|
|
14
|
+
export interface StyleManagerConfig {
|
|
15
|
+
prefix?: string;
|
|
16
|
+
isolateStyles?: boolean;
|
|
17
|
+
defaultTheme?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 样式管理器类
|
|
21
|
+
*/
|
|
22
|
+
export declare class StyleManager {
|
|
23
|
+
private static instance;
|
|
24
|
+
private styleElement;
|
|
25
|
+
private styles;
|
|
26
|
+
private themes;
|
|
27
|
+
private config;
|
|
28
|
+
private currentTheme;
|
|
29
|
+
/**
|
|
30
|
+
* 私有构造函数(单例模式)
|
|
31
|
+
*/
|
|
32
|
+
private constructor();
|
|
33
|
+
/**
|
|
34
|
+
* 获取单例实例
|
|
35
|
+
*/
|
|
36
|
+
static getInstance(config?: StyleManagerConfig): StyleManager;
|
|
37
|
+
/**
|
|
38
|
+
* 初始化样式管理器
|
|
39
|
+
*/
|
|
40
|
+
private init;
|
|
41
|
+
/**
|
|
42
|
+
* 添加默认主题
|
|
43
|
+
*/
|
|
44
|
+
private addDefaultTheme;
|
|
45
|
+
/**
|
|
46
|
+
* 转换颜色变量(将十六进制转换为RGB)
|
|
47
|
+
*/
|
|
48
|
+
private convertColorVariables;
|
|
49
|
+
/**
|
|
50
|
+
* 十六进制颜色转换为RGB
|
|
51
|
+
*/
|
|
52
|
+
private hexToRgb;
|
|
53
|
+
/**
|
|
54
|
+
* 添加样式规则
|
|
55
|
+
* @param id 样式ID
|
|
56
|
+
* @param cssText CSS文本
|
|
57
|
+
*/
|
|
58
|
+
addStyle(id: string, cssText: string): void;
|
|
59
|
+
/**
|
|
60
|
+
* 移除样式规则
|
|
61
|
+
* @param id 样式ID
|
|
62
|
+
*/
|
|
63
|
+
removeStyle(id: string): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* 添加主题
|
|
66
|
+
* @param theme 主题配置
|
|
67
|
+
*/
|
|
68
|
+
addTheme(theme: Theme): void;
|
|
69
|
+
/**
|
|
70
|
+
* 移除主题
|
|
71
|
+
* @param name 主题名称
|
|
72
|
+
*/
|
|
73
|
+
removeTheme(name: string): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* 应用主题
|
|
76
|
+
* @param name 主题名称
|
|
77
|
+
*/
|
|
78
|
+
applyTheme(name: string): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* 获取当前主题
|
|
81
|
+
*/
|
|
82
|
+
getCurrentTheme(): string;
|
|
83
|
+
/**
|
|
84
|
+
* 获取主题配置
|
|
85
|
+
* @param name 主题名称
|
|
86
|
+
*/
|
|
87
|
+
getTheme(name: string): Theme | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* 获取所有主题名称
|
|
90
|
+
*/
|
|
91
|
+
getThemeNames(): string[];
|
|
92
|
+
/**
|
|
93
|
+
* 更新样式变量
|
|
94
|
+
* @param variables 变量映射
|
|
95
|
+
*/
|
|
96
|
+
updateVariables(variables: Record<string, string>): void;
|
|
97
|
+
/**
|
|
98
|
+
* 获取CSS变量值
|
|
99
|
+
* @param name 变量名
|
|
100
|
+
*/
|
|
101
|
+
getVariable(name: string): string | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* 设置CSS变量值
|
|
104
|
+
* @param name 变量名
|
|
105
|
+
* @param value 变量值
|
|
106
|
+
*/
|
|
107
|
+
setVariable(name: string, value: string): void;
|
|
108
|
+
/**
|
|
109
|
+
* 生成作用域选择器
|
|
110
|
+
* @param selector 原始选择器
|
|
111
|
+
*/
|
|
112
|
+
scopedSelector(selector: string): string;
|
|
113
|
+
/**
|
|
114
|
+
* 更新样式元素内容
|
|
115
|
+
*/
|
|
116
|
+
private updateStyleElement;
|
|
117
|
+
/**
|
|
118
|
+
* 生成组件样式
|
|
119
|
+
* @param componentName 组件名称
|
|
120
|
+
* @param styles 样式对象
|
|
121
|
+
*/
|
|
122
|
+
generateComponentStyles(componentName: string, styles: Record<string, string>): string;
|
|
123
|
+
/**
|
|
124
|
+
* 注入组件样式
|
|
125
|
+
* @param componentName 组件名称
|
|
126
|
+
* @param styles 样式对象
|
|
127
|
+
* @returns 样式ID
|
|
128
|
+
*/
|
|
129
|
+
injectComponentStyles(componentName: string, styles: Record<string, string>): string;
|
|
130
|
+
/**
|
|
131
|
+
* 销毁样式管理器
|
|
132
|
+
*/
|
|
133
|
+
destroy(): void;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* 创建样式管理器的工厂函数
|
|
137
|
+
*/
|
|
138
|
+
export declare function createStyleManager(config?: StyleManagerConfig): StyleManager;
|
|
139
|
+
/**
|
|
140
|
+
* 默认导出样式管理器实例
|
|
141
|
+
*/
|
|
142
|
+
export declare const styleManager: StyleManager;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { StyleManager, StyleManagerConfig } from './StyleManager';
|
|
2
|
+
import { ComponentStyles, createComponentStyles } from './ComponentStyles';
|
|
3
|
+
export { StyleManager, createStyleManager, styleManager, type StyleRule, type Theme, type StyleManagerConfig, } from './StyleManager';
|
|
4
|
+
export { ComponentStyles, createComponentStyles, getPredefinedComponentStyles, predefinedComponentStyles, type ComponentStyleOptions, } from './ComponentStyles';
|
|
5
|
+
/**
|
|
6
|
+
* 样式模块版本信息
|
|
7
|
+
*/
|
|
8
|
+
export declare const VERSION = "1.0.0";
|
|
9
|
+
/**
|
|
10
|
+
* 样式模块描述
|
|
11
|
+
*/
|
|
12
|
+
export declare const DESCRIPTION = "VMap Cesium Tool \u6837\u5F0F\u6A21\u5757 - \u63D0\u4F9B\u6837\u5F0F\u7BA1\u7406\u3001\u4E3B\u9898\u5207\u6362\u548C\u7EC4\u4EF6\u6837\u5F0F\u529F\u80FD";
|
|
13
|
+
/**
|
|
14
|
+
* 预定义主题
|
|
15
|
+
*/
|
|
16
|
+
export declare const predefinedThemes: {
|
|
17
|
+
light: {
|
|
18
|
+
name: string;
|
|
19
|
+
variables: {
|
|
20
|
+
'--primary-color': string;
|
|
21
|
+
'--primary-hover-color': string;
|
|
22
|
+
'--primary-active-color': string;
|
|
23
|
+
'--background-color': string;
|
|
24
|
+
'--border-color': string;
|
|
25
|
+
'--text-color': string;
|
|
26
|
+
'--text-secondary-color': string;
|
|
27
|
+
};
|
|
28
|
+
rules: never[];
|
|
29
|
+
};
|
|
30
|
+
dark: {
|
|
31
|
+
name: string;
|
|
32
|
+
variables: {
|
|
33
|
+
'--primary-color': string;
|
|
34
|
+
'--primary-hover-color': string;
|
|
35
|
+
'--primary-active-color': string;
|
|
36
|
+
'--background-color': string;
|
|
37
|
+
'--border-color': string;
|
|
38
|
+
'--text-color': string;
|
|
39
|
+
'--text-secondary-color': string;
|
|
40
|
+
};
|
|
41
|
+
rules: never[];
|
|
42
|
+
};
|
|
43
|
+
blue: {
|
|
44
|
+
name: string;
|
|
45
|
+
variables: {
|
|
46
|
+
'--primary-color': string;
|
|
47
|
+
'--primary-hover-color': string;
|
|
48
|
+
'--primary-active-color': string;
|
|
49
|
+
'--background-color': string;
|
|
50
|
+
'--border-color': string;
|
|
51
|
+
'--text-color': string;
|
|
52
|
+
'--text-secondary-color': string;
|
|
53
|
+
};
|
|
54
|
+
rules: never[];
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* 初始化样式系统
|
|
59
|
+
*/
|
|
60
|
+
export declare function initStyleSystem(config?: StyleManagerConfig): StyleManager;
|
|
61
|
+
/**
|
|
62
|
+
* 应用主题
|
|
63
|
+
*/
|
|
64
|
+
export declare function applyTheme(themeName: string): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* 获取当前主题
|
|
67
|
+
*/
|
|
68
|
+
export declare function getCurrentTheme(): string;
|
|
69
|
+
/**
|
|
70
|
+
* 获取所有可用主题
|
|
71
|
+
*/
|
|
72
|
+
export declare function getAvailableThemes(): string[];
|
|
73
|
+
/**
|
|
74
|
+
* 默认导出样式模块
|
|
75
|
+
*/
|
|
76
|
+
declare const stylesModule: {
|
|
77
|
+
VERSION: string;
|
|
78
|
+
DESCRIPTION: string;
|
|
79
|
+
styleManager: StyleManager;
|
|
80
|
+
initStyleSystem: typeof initStyleSystem;
|
|
81
|
+
applyTheme: typeof applyTheme;
|
|
82
|
+
getCurrentTheme: typeof getCurrentTheme;
|
|
83
|
+
getAvailableThemes: typeof getAvailableThemes;
|
|
84
|
+
predefinedThemes: {
|
|
85
|
+
light: {
|
|
86
|
+
name: string;
|
|
87
|
+
variables: {
|
|
88
|
+
'--primary-color': string;
|
|
89
|
+
'--primary-hover-color': string;
|
|
90
|
+
'--primary-active-color': string;
|
|
91
|
+
'--background-color': string;
|
|
92
|
+
'--border-color': string;
|
|
93
|
+
'--text-color': string;
|
|
94
|
+
'--text-secondary-color': string;
|
|
95
|
+
};
|
|
96
|
+
rules: never[];
|
|
97
|
+
};
|
|
98
|
+
dark: {
|
|
99
|
+
name: string;
|
|
100
|
+
variables: {
|
|
101
|
+
'--primary-color': string;
|
|
102
|
+
'--primary-hover-color': string;
|
|
103
|
+
'--primary-active-color': string;
|
|
104
|
+
'--background-color': string;
|
|
105
|
+
'--border-color': string;
|
|
106
|
+
'--text-color': string;
|
|
107
|
+
'--text-secondary-color': string;
|
|
108
|
+
};
|
|
109
|
+
rules: never[];
|
|
110
|
+
};
|
|
111
|
+
blue: {
|
|
112
|
+
name: string;
|
|
113
|
+
variables: {
|
|
114
|
+
'--primary-color': string;
|
|
115
|
+
'--primary-hover-color': string;
|
|
116
|
+
'--primary-active-color': string;
|
|
117
|
+
'--background-color': string;
|
|
118
|
+
'--border-color': string;
|
|
119
|
+
'--text-color': string;
|
|
120
|
+
'--text-secondary-color': string;
|
|
121
|
+
};
|
|
122
|
+
rules: never[];
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
ComponentStyles: typeof ComponentStyles;
|
|
126
|
+
createComponentStyles: typeof createComponentStyles;
|
|
127
|
+
};
|
|
128
|
+
export default stylesModule;
|
package/dist/utils/common.d.ts
CHANGED
|
@@ -12,3 +12,7 @@ export declare function heightToZoomLevel(height: number): number;
|
|
|
12
12
|
* @returns 相机高度(米)
|
|
13
13
|
*/
|
|
14
14
|
export declare function zoomLevelToHeight(zoomLevel: number): number;
|
|
15
|
+
/**
|
|
16
|
+
* 深度合并对象
|
|
17
|
+
*/
|
|
18
|
+
export declare function deepMerge<T>(target: T, source: Partial<T>): T;
|
package/package.json
CHANGED