map-gl-offline 0.1.0-alpha.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/LICENSE +21 -0
- package/README.md +590 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.esm.js +15863 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +16015 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/managers/offlineMapManager/analyticsManagement.d.ts +7 -0
- package/dist/managers/offlineMapManager/base.d.ts +14 -0
- package/dist/managers/offlineMapManager/cleanupManagement.d.ts +16 -0
- package/dist/managers/offlineMapManager/importExportManagement.d.ts +10 -0
- package/dist/managers/offlineMapManager/index.d.ts +72 -0
- package/dist/managers/offlineMapManager/maintenanceManagement.d.ts +13 -0
- package/dist/managers/offlineMapManager/modules.d.ts +10 -0
- package/dist/managers/offlineMapManager/regionManagement.d.ts +11 -0
- package/dist/managers/offlineMapManager/resourceManagement.d.ts +24 -0
- package/dist/managers/offlineMapManager/styleManagement.d.ts +17 -0
- package/dist/managers/offlineMapManager.d.ts +2 -0
- package/dist/services/analyticsService.d.ts +10 -0
- package/dist/services/baseDownloadService.d.ts +96 -0
- package/dist/services/cleanupService.d.ts +34 -0
- package/dist/services/fontService.d.ts +26 -0
- package/dist/services/glyphService.d.ts +58 -0
- package/dist/services/importExportService.d.ts +57 -0
- package/dist/services/maintenanceService.d.ts +15 -0
- package/dist/services/regionService.d.ts +31 -0
- package/dist/services/resourceService.d.ts +42 -0
- package/dist/services/spriteService.d.ts +30 -0
- package/dist/services/styleService.d.ts +73 -0
- package/dist/services/tileService.d.ts +24 -0
- package/dist/storage/indexedDbManager.d.ts +2 -0
- package/dist/style.css +213 -0
- package/dist/types/cleanup.d.ts +49 -0
- package/dist/types/database.d.ts +33 -0
- package/dist/types/font.d.ts +115 -0
- package/dist/types/glyph.d.ts +127 -0
- package/dist/types/import-export.d.ts +96 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/maintenance.d.ts +49 -0
- package/dist/types/progress.d.ts +11 -0
- package/dist/types/region.d.ts +57 -0
- package/dist/types/sprite.d.ts +172 -0
- package/dist/types/style.d.ts +103 -0
- package/dist/types/tile.d.ts +112 -0
- package/dist/types/ui.d.ts +10 -0
- package/dist/ui/ThemeManager.d.ts +23 -0
- package/dist/ui/components/DownloadProgress.d.ts +14 -0
- package/dist/ui/components/PanelActions.d.ts +12 -0
- package/dist/ui/components/PanelHeader.d.ts +15 -0
- package/dist/ui/components/RegionList.d.ts +24 -0
- package/dist/ui/components/shared/BaseComponent.d.ts +86 -0
- package/dist/ui/components/shared/Button.d.ts +45 -0
- package/dist/ui/components/shared/List.d.ts +56 -0
- package/dist/ui/components/shared/MapControlButton.d.ts +37 -0
- package/dist/ui/components/shared/Modal.d.ts +49 -0
- package/dist/ui/components/shared/Panel.d.ts +53 -0
- package/dist/ui/components/shared/PanelContent.d.ts +39 -0
- package/dist/ui/components/shared/RegionDrawingTool.d.ts +54 -0
- package/dist/ui/components/shared/index.d.ts +12 -0
- package/dist/ui/controls/polygonControl.d.ts +83 -0
- package/dist/ui/controls/regionControl.d.ts +71 -0
- package/dist/ui/managers/ControlButtonManager.d.ts +42 -0
- package/dist/ui/managers/PanelManager.d.ts +160 -0
- package/dist/ui/managers/downloadManager.d.ts +63 -0
- package/dist/ui/modals/confirmationModal.d.ts +30 -0
- package/dist/ui/modals/importExportModal.d.ts +46 -0
- package/dist/ui/modals/importExportModal.old.d.ts +27 -0
- package/dist/ui/modals/modalManager.d.ts +23 -0
- package/dist/ui/modals/regionDetailsModal.d.ts +37 -0
- package/dist/ui/modals/regionFormModal.d.ts +86 -0
- package/dist/ui/offlineManagerControl.d.ts +120 -0
- package/dist/utils/asyncUtils.d.ts +24 -0
- package/dist/utils/cleanupCompressedTiles.d.ts +12 -0
- package/dist/utils/constants.d.ts +94 -0
- package/dist/utils/download.d.ts +52 -0
- package/dist/utils/errorHandling.d.ts +67 -0
- package/dist/utils/formatUtils.d.ts +24 -0
- package/dist/utils/formatting.d.ts +31 -0
- package/dist/utils/icons.d.ts +50 -0
- package/dist/utils/idbFetchHandler.d.ts +2 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/logger.d.ts +52 -0
- package/dist/utils/performance.d.ts +164 -0
- package/dist/utils/styleProviderUtils.d.ts +42 -0
- package/dist/utils/styleUtils.d.ts +35 -0
- package/dist/utils/validation.d.ts +67 -0
- package/package.json +145 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regions list component for the offline manager - Modern, compact design
|
|
3
|
+
* Refactored to use modular Button components
|
|
4
|
+
*/
|
|
5
|
+
import { BaseComponent } from './shared/BaseComponent';
|
|
6
|
+
import type { StoredRegion } from '../../types';
|
|
7
|
+
export interface RegionsListProps {
|
|
8
|
+
regions: StoredRegion[];
|
|
9
|
+
onDeleteRegion?: (regionId: string) => void;
|
|
10
|
+
onShowRegionDetails?: (regionId: string) => void;
|
|
11
|
+
onFocusRegion?: (regionId: string) => void;
|
|
12
|
+
onImportExport?: (regionId: string) => void;
|
|
13
|
+
formatBytes?: (bytes: number) => string;
|
|
14
|
+
}
|
|
15
|
+
export declare class RegionsList extends BaseComponent {
|
|
16
|
+
private props;
|
|
17
|
+
constructor(props: RegionsListProps);
|
|
18
|
+
protected createElement(): HTMLElement;
|
|
19
|
+
updateRegions(regions: StoredRegion[]): void;
|
|
20
|
+
private render;
|
|
21
|
+
private createRegionCard;
|
|
22
|
+
private createRegionActions;
|
|
23
|
+
}
|
|
24
|
+
export declare function createRegionsList(props: RegionsListProps): HTMLDivElement;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Component Class
|
|
3
|
+
* Provides common functionality for UI components
|
|
4
|
+
*/
|
|
5
|
+
export interface ComponentConfig {
|
|
6
|
+
className?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
events?: {
|
|
9
|
+
[event: string]: EventListener;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare abstract class BaseComponent {
|
|
13
|
+
protected element: HTMLElement;
|
|
14
|
+
protected config: ComponentConfig;
|
|
15
|
+
protected isMounted: boolean;
|
|
16
|
+
protected eventListeners: Map<string, EventListener>;
|
|
17
|
+
constructor(config?: ComponentConfig);
|
|
18
|
+
/**
|
|
19
|
+
* Create the root element
|
|
20
|
+
*/
|
|
21
|
+
protected abstract createElement(): HTMLElement;
|
|
22
|
+
/**
|
|
23
|
+
* Apply configuration to element
|
|
24
|
+
*/
|
|
25
|
+
protected applyConfig(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Bind event listeners
|
|
28
|
+
*/
|
|
29
|
+
protected bindEvents(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Add event listener with cleanup tracking
|
|
32
|
+
*/
|
|
33
|
+
protected addEventListener(event: string, handler: EventListener): void;
|
|
34
|
+
/**
|
|
35
|
+
* Remove all tracked event listeners
|
|
36
|
+
*/
|
|
37
|
+
protected removeAllEventListeners(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Get the element
|
|
40
|
+
*/
|
|
41
|
+
getElement(): HTMLElement;
|
|
42
|
+
/**
|
|
43
|
+
* Mount to parent
|
|
44
|
+
*/
|
|
45
|
+
mount(parent: HTMLElement): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Unmount from parent
|
|
48
|
+
*/
|
|
49
|
+
unmount(): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Lifecycle hook - called after mounting
|
|
52
|
+
*/
|
|
53
|
+
protected onMount?(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Lifecycle hook - called before unmounting
|
|
56
|
+
*/
|
|
57
|
+
protected onUnmount?(): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Update component
|
|
60
|
+
*/
|
|
61
|
+
update(): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Lifecycle hook - called during updates
|
|
64
|
+
*/
|
|
65
|
+
protected onUpdate?(): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Destroy component
|
|
68
|
+
*/
|
|
69
|
+
destroy(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Update element content
|
|
72
|
+
*/
|
|
73
|
+
setContent(content: string | HTMLElement): void;
|
|
74
|
+
/**
|
|
75
|
+
* Show element
|
|
76
|
+
*/
|
|
77
|
+
show(): void;
|
|
78
|
+
/**
|
|
79
|
+
* Hide element
|
|
80
|
+
*/
|
|
81
|
+
hide(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Toggle visibility
|
|
84
|
+
*/
|
|
85
|
+
toggle(): void;
|
|
86
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reusable Button Component
|
|
3
|
+
* Provides a modular button with progress badge functionality
|
|
4
|
+
*/
|
|
5
|
+
import { BaseComponent, ComponentConfig } from './BaseComponent';
|
|
6
|
+
export interface ButtonConfig extends ComponentConfig {
|
|
7
|
+
text?: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
variant?: 'primary' | 'secondary' | 'success' | 'danger';
|
|
12
|
+
size?: 'sm' | 'md' | 'lg';
|
|
13
|
+
onClick?: () => void;
|
|
14
|
+
showProgressBadge?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare class Button extends BaseComponent {
|
|
17
|
+
protected config: ButtonConfig;
|
|
18
|
+
private progressBadge?;
|
|
19
|
+
constructor(config?: ButtonConfig);
|
|
20
|
+
protected createElement(): HTMLElement;
|
|
21
|
+
private setupButton;
|
|
22
|
+
private getVariantClasses;
|
|
23
|
+
private getSizeClasses;
|
|
24
|
+
private createProgressBadge;
|
|
25
|
+
/**
|
|
26
|
+
* Update button text
|
|
27
|
+
*/
|
|
28
|
+
setText(text: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* Update button state
|
|
31
|
+
*/
|
|
32
|
+
setDisabled(disabled: boolean): void;
|
|
33
|
+
/**
|
|
34
|
+
* Update progress badge
|
|
35
|
+
*/
|
|
36
|
+
updateProgressBadge(text: string, visible: boolean): void;
|
|
37
|
+
/**
|
|
38
|
+
* Show progress badge
|
|
39
|
+
*/
|
|
40
|
+
showProgressBadge(text?: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Hide progress badge
|
|
43
|
+
*/
|
|
44
|
+
hideProgressBadge(): void;
|
|
45
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reusable List Component
|
|
3
|
+
* Provides a modular list with customizable item rendering
|
|
4
|
+
*/
|
|
5
|
+
import { BaseComponent, ComponentConfig } from './BaseComponent';
|
|
6
|
+
export interface ListItemConfig {
|
|
7
|
+
id: string;
|
|
8
|
+
data: unknown;
|
|
9
|
+
template?: string;
|
|
10
|
+
actions?: Array<{
|
|
11
|
+
label: string;
|
|
12
|
+
action: string;
|
|
13
|
+
variant?: 'primary' | 'secondary' | 'danger';
|
|
14
|
+
icon?: string;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
export interface ListConfig extends ComponentConfig {
|
|
18
|
+
items?: ListItemConfig[];
|
|
19
|
+
emptyText?: string;
|
|
20
|
+
itemTemplate?: (item: unknown) => string;
|
|
21
|
+
onItemAction?: (action: string, itemId: string, item: unknown) => void;
|
|
22
|
+
onItemClick?: (itemId: string, item: unknown) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare class List extends BaseComponent {
|
|
25
|
+
protected config: ListConfig;
|
|
26
|
+
private listContainer?;
|
|
27
|
+
constructor(config?: ListConfig);
|
|
28
|
+
protected createElement(): HTMLElement;
|
|
29
|
+
private createListStructure;
|
|
30
|
+
private renderItems;
|
|
31
|
+
private renderEmptyState;
|
|
32
|
+
private createItemElement;
|
|
33
|
+
private getDefaultItemTemplate;
|
|
34
|
+
private createActionsContainer;
|
|
35
|
+
private getActionButtonClasses;
|
|
36
|
+
/**
|
|
37
|
+
* Update list items
|
|
38
|
+
*/
|
|
39
|
+
setItems(items: ListItemConfig[]): void;
|
|
40
|
+
/**
|
|
41
|
+
* Add item to list
|
|
42
|
+
*/
|
|
43
|
+
addItem(item: ListItemConfig): void;
|
|
44
|
+
/**
|
|
45
|
+
* Remove item from list
|
|
46
|
+
*/
|
|
47
|
+
removeItem(itemId: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* Update specific item
|
|
50
|
+
*/
|
|
51
|
+
updateItem(itemId: string, newData: unknown): void;
|
|
52
|
+
/**
|
|
53
|
+
* Clear all items
|
|
54
|
+
*/
|
|
55
|
+
clear(): void;
|
|
56
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Control Button Component
|
|
3
|
+
* Refactored from ButtonManager to be more reusable
|
|
4
|
+
*/
|
|
5
|
+
import { BaseComponent, ComponentConfig } from './BaseComponent';
|
|
6
|
+
export interface ControlButtonConfig extends ComponentConfig {
|
|
7
|
+
title?: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
onToggle?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare class ControlButton extends BaseComponent {
|
|
12
|
+
private button;
|
|
13
|
+
private progressBadge;
|
|
14
|
+
private buttonConfig;
|
|
15
|
+
constructor(config?: ControlButtonConfig);
|
|
16
|
+
protected createElement(): HTMLElement;
|
|
17
|
+
/**
|
|
18
|
+
* Update button text and state
|
|
19
|
+
*/
|
|
20
|
+
updateButton(text: string, disabled: boolean): void;
|
|
21
|
+
/**
|
|
22
|
+
* Update progress badge
|
|
23
|
+
*/
|
|
24
|
+
updateProgressBadge(text: string, visible: boolean): void;
|
|
25
|
+
/**
|
|
26
|
+
* Reset to default state
|
|
27
|
+
*/
|
|
28
|
+
resetToDefault(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Set button active state
|
|
31
|
+
*/
|
|
32
|
+
setActive(active: boolean): void;
|
|
33
|
+
/**
|
|
34
|
+
* Override destroy to remove specific event listeners
|
|
35
|
+
*/
|
|
36
|
+
destroy(): void;
|
|
37
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reusable Modal Component
|
|
3
|
+
* Provides a modular modal with configurable content and actions
|
|
4
|
+
*/
|
|
5
|
+
import { BaseComponent, ComponentConfig } from './BaseComponent';
|
|
6
|
+
export interface ModalConfig extends ComponentConfig {
|
|
7
|
+
title?: string;
|
|
8
|
+
subtitle?: string;
|
|
9
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
10
|
+
closable?: boolean;
|
|
11
|
+
backdrop?: boolean;
|
|
12
|
+
showThemeToggle?: boolean;
|
|
13
|
+
onClose?: () => void;
|
|
14
|
+
onThemeToggle?: () => void;
|
|
15
|
+
}
|
|
16
|
+
export declare class Modal extends BaseComponent {
|
|
17
|
+
protected config: ModalConfig;
|
|
18
|
+
private backdrop?;
|
|
19
|
+
private modalContent?;
|
|
20
|
+
private header?;
|
|
21
|
+
private body?;
|
|
22
|
+
private footer?;
|
|
23
|
+
constructor(config?: ModalConfig);
|
|
24
|
+
protected createElement(): HTMLElement;
|
|
25
|
+
private createModalStructure;
|
|
26
|
+
private createHeader;
|
|
27
|
+
private getSizeClasses;
|
|
28
|
+
private setupEventListeners;
|
|
29
|
+
/**
|
|
30
|
+
* Set modal body content
|
|
31
|
+
*/
|
|
32
|
+
setContent(content: string | HTMLElement): void;
|
|
33
|
+
/**
|
|
34
|
+
* Set modal footer content
|
|
35
|
+
*/
|
|
36
|
+
setFooter(content: string | HTMLElement): void;
|
|
37
|
+
/**
|
|
38
|
+
* Show the modal
|
|
39
|
+
*/
|
|
40
|
+
show(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Hide the modal
|
|
43
|
+
*/
|
|
44
|
+
hide(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Clean up event listeners
|
|
47
|
+
*/
|
|
48
|
+
protected onUnmount(): Promise<void>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Panel Component
|
|
3
|
+
* Refactored panel management into reusable component
|
|
4
|
+
*/
|
|
5
|
+
import { BaseComponent, ComponentConfig } from './BaseComponent';
|
|
6
|
+
export interface PanelConfig extends ComponentConfig {
|
|
7
|
+
title?: string;
|
|
8
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
position?: 'center' | 'top' | 'bottom' | 'left' | 'right';
|
|
10
|
+
closable?: boolean;
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare class Panel extends BaseComponent {
|
|
14
|
+
private header;
|
|
15
|
+
private body;
|
|
16
|
+
private footer;
|
|
17
|
+
private panelConfig;
|
|
18
|
+
constructor(config?: PanelConfig);
|
|
19
|
+
protected createElement(): HTMLElement;
|
|
20
|
+
private createPanelStructure;
|
|
21
|
+
/**
|
|
22
|
+
* Set panel title
|
|
23
|
+
*/
|
|
24
|
+
setTitle(title: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* Set panel body content
|
|
27
|
+
*/
|
|
28
|
+
setBody(content: string | HTMLElement): void;
|
|
29
|
+
/**
|
|
30
|
+
* Set panel footer content
|
|
31
|
+
*/
|
|
32
|
+
setFooter(content: string | HTMLElement | null): void;
|
|
33
|
+
/**
|
|
34
|
+
* Open panel
|
|
35
|
+
*/
|
|
36
|
+
open(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Close panel
|
|
39
|
+
*/
|
|
40
|
+
close(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Get body element for direct manipulation
|
|
43
|
+
*/
|
|
44
|
+
getBody(): HTMLElement | null;
|
|
45
|
+
/**
|
|
46
|
+
* Get header element
|
|
47
|
+
*/
|
|
48
|
+
getHeader(): HTMLElement | null;
|
|
49
|
+
/**
|
|
50
|
+
* Get footer element
|
|
51
|
+
*/
|
|
52
|
+
getFooter(): HTMLElement | null;
|
|
53
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Panel Content Renderer Component
|
|
3
|
+
* Refactored from PanelRenderer to be more focused and reusable
|
|
4
|
+
*/
|
|
5
|
+
import { BaseComponent } from './BaseComponent';
|
|
6
|
+
import { OfflineMapManager } from '../../../managers/offlineMapManager';
|
|
7
|
+
import { DownloadManager } from '../../managers/downloadManager';
|
|
8
|
+
import { ModalManager } from '../../modals/modalManager';
|
|
9
|
+
export interface ContentRendererConfig {
|
|
10
|
+
offlineManager: OfflineMapManager;
|
|
11
|
+
downloadManager: DownloadManager;
|
|
12
|
+
modalManager: ModalManager;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
onAddRegion: () => void;
|
|
15
|
+
onFocusRegion: (regionId: string) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare class PanelContentRenderer extends BaseComponent {
|
|
18
|
+
private offlineManager;
|
|
19
|
+
private downloadManager;
|
|
20
|
+
private modalManager;
|
|
21
|
+
private contentConfig;
|
|
22
|
+
constructor(config: ContentRendererConfig);
|
|
23
|
+
protected createElement(): HTMLElement;
|
|
24
|
+
/**
|
|
25
|
+
* Render content into a container
|
|
26
|
+
*/
|
|
27
|
+
render(container: HTMLElement): Promise<void>;
|
|
28
|
+
private createMainContent;
|
|
29
|
+
private setupContentEventListeners;
|
|
30
|
+
private findAndShowRegionDetails;
|
|
31
|
+
private showRegionDetails;
|
|
32
|
+
private deleteRegion;
|
|
33
|
+
private downloadRegion;
|
|
34
|
+
private showImportExportModal;
|
|
35
|
+
/**
|
|
36
|
+
* Refresh content
|
|
37
|
+
*/
|
|
38
|
+
refresh(): Promise<void>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Region Drawing Component
|
|
3
|
+
* Refactored from RegionControl to be more focused and reusable
|
|
4
|
+
*/
|
|
5
|
+
import { BaseComponent } from './BaseComponent';
|
|
6
|
+
import type { Map as MaplibreMap } from 'maplibre-gl';
|
|
7
|
+
import { DownloadManager } from '../../managers/downloadManager';
|
|
8
|
+
import { ModalManager } from '../../modals/modalManager';
|
|
9
|
+
export interface RegionDrawingConfig {
|
|
10
|
+
map: MaplibreMap;
|
|
11
|
+
downloadManager: DownloadManager;
|
|
12
|
+
modalManager: ModalManager;
|
|
13
|
+
container: HTMLElement;
|
|
14
|
+
onRegionSaved: () => void;
|
|
15
|
+
getCurrentStyleUrl: () => string;
|
|
16
|
+
}
|
|
17
|
+
export declare class RegionDrawing extends BaseComponent {
|
|
18
|
+
private map;
|
|
19
|
+
private downloadManager;
|
|
20
|
+
private modalManager;
|
|
21
|
+
private drawingConfig;
|
|
22
|
+
private isDrawing;
|
|
23
|
+
private drawingHandler;
|
|
24
|
+
constructor(config: RegionDrawingConfig);
|
|
25
|
+
protected createElement(): HTMLElement;
|
|
26
|
+
/**
|
|
27
|
+
* Start region selection mode
|
|
28
|
+
*/
|
|
29
|
+
startSelection(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Stop region selection mode
|
|
32
|
+
*/
|
|
33
|
+
stopSelection(): void;
|
|
34
|
+
private setupDrawingMode;
|
|
35
|
+
private cleanupDrawingMode;
|
|
36
|
+
private showDrawingInstructions;
|
|
37
|
+
private hideDrawingInstructions;
|
|
38
|
+
private handleMapClick;
|
|
39
|
+
private createBoundsAroundPoint;
|
|
40
|
+
private showRegionForm;
|
|
41
|
+
/**
|
|
42
|
+
* Calculate approximate area from bounds in km²
|
|
43
|
+
* This is a simplified calculation for display purposes
|
|
44
|
+
*/
|
|
45
|
+
private calculateAreaFromBounds;
|
|
46
|
+
/**
|
|
47
|
+
* Check if currently in drawing mode
|
|
48
|
+
*/
|
|
49
|
+
isInDrawingMode(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Cleanup when component is destroyed
|
|
52
|
+
*/
|
|
53
|
+
cleanup(): void;
|
|
54
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Components Index
|
|
3
|
+
* Exports all reusable components
|
|
4
|
+
*/
|
|
5
|
+
export { BaseComponent, ComponentConfig } from './BaseComponent';
|
|
6
|
+
export { ControlButton, ControlButtonConfig } from './MapControlButton';
|
|
7
|
+
export { Panel, PanelConfig } from './Panel';
|
|
8
|
+
export { PanelContentRenderer, ContentRendererConfig } from './PanelContent';
|
|
9
|
+
export { RegionDrawing, RegionDrawingConfig } from './RegionDrawingTool';
|
|
10
|
+
export { Button, ButtonConfig } from './Button';
|
|
11
|
+
export { Modal, ModalConfig } from './Modal';
|
|
12
|
+
export { List, ListConfig, ListItemConfig } from './List';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Polygon Selection Control Component
|
|
3
|
+
* Handles polygon drawing, area calculation, and map visualization
|
|
4
|
+
*/
|
|
5
|
+
import type { Map as MaplibreMap } from 'maplibre-gl';
|
|
6
|
+
export interface PolygonControlOptions {
|
|
7
|
+
onSave: (bounds: [number, number, number, number], area: number) => void;
|
|
8
|
+
onCancel: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare class PolygonControl {
|
|
11
|
+
private map;
|
|
12
|
+
private container;
|
|
13
|
+
private saveButton;
|
|
14
|
+
private areaDisplay;
|
|
15
|
+
private currentBounds;
|
|
16
|
+
private currentArea;
|
|
17
|
+
private options;
|
|
18
|
+
constructor(map: MaplibreMap, options: PolygonControlOptions);
|
|
19
|
+
/**
|
|
20
|
+
* Initialize polygon control mode
|
|
21
|
+
*/
|
|
22
|
+
enter(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Exit polygon control mode
|
|
25
|
+
*/
|
|
26
|
+
exit(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Get current selection bounds
|
|
29
|
+
*/
|
|
30
|
+
getCurrentBounds(): [number, number, number, number] | null;
|
|
31
|
+
/**
|
|
32
|
+
* Get current selection area
|
|
33
|
+
*/
|
|
34
|
+
getCurrentArea(): number;
|
|
35
|
+
/**
|
|
36
|
+
* Create the polygon control UI - area display at bottom center
|
|
37
|
+
*/
|
|
38
|
+
private createUI;
|
|
39
|
+
/**
|
|
40
|
+
* Create save polygon button
|
|
41
|
+
*/
|
|
42
|
+
createSaveButton(parentContainer: HTMLElement): void;
|
|
43
|
+
/**
|
|
44
|
+
* Remove UI elements
|
|
45
|
+
*/
|
|
46
|
+
private removeUI;
|
|
47
|
+
/**
|
|
48
|
+
* Show save button
|
|
49
|
+
*/
|
|
50
|
+
private showSaveButton;
|
|
51
|
+
/**
|
|
52
|
+
* Hide save button
|
|
53
|
+
*/
|
|
54
|
+
private hideSaveButton;
|
|
55
|
+
/**
|
|
56
|
+
* Handle save button click
|
|
57
|
+
*/
|
|
58
|
+
private handleSave;
|
|
59
|
+
/**
|
|
60
|
+
* Trigger save programmatically
|
|
61
|
+
*/
|
|
62
|
+
triggerSave(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Add map event listeners
|
|
65
|
+
*/
|
|
66
|
+
private addMapListeners;
|
|
67
|
+
/**
|
|
68
|
+
* Remove map event listeners
|
|
69
|
+
*/
|
|
70
|
+
private removeMapListeners;
|
|
71
|
+
/**
|
|
72
|
+
* Handle map move/zoom events
|
|
73
|
+
*/
|
|
74
|
+
private handleMapMove;
|
|
75
|
+
/**
|
|
76
|
+
* Update polygon visualization based on current map bounds
|
|
77
|
+
*/
|
|
78
|
+
private updateVisualization;
|
|
79
|
+
/**
|
|
80
|
+
* Remove polygon visualization from map
|
|
81
|
+
*/
|
|
82
|
+
private removeVisualization;
|
|
83
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Region Control Component
|
|
3
|
+
* Manages region selection, form modal, and saves
|
|
4
|
+
*/
|
|
5
|
+
import type { Map as MaplibreMap } from 'maplibre-gl';
|
|
6
|
+
import { DownloadManager } from '../managers/downloadManager';
|
|
7
|
+
import { ModalManager } from '../modals/modalManager';
|
|
8
|
+
export interface RegionControlOptions {
|
|
9
|
+
map: MaplibreMap;
|
|
10
|
+
downloadManager: DownloadManager;
|
|
11
|
+
modalManager: ModalManager;
|
|
12
|
+
container: HTMLDivElement;
|
|
13
|
+
onRegionSaved?: () => void;
|
|
14
|
+
styleUrl: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class RegionControl {
|
|
17
|
+
private map;
|
|
18
|
+
private downloadManager;
|
|
19
|
+
private modalManager;
|
|
20
|
+
private container;
|
|
21
|
+
private saveButton;
|
|
22
|
+
private polygonControl;
|
|
23
|
+
private regionFormModal;
|
|
24
|
+
private options;
|
|
25
|
+
private isActive;
|
|
26
|
+
constructor(options: RegionControlOptions);
|
|
27
|
+
/**
|
|
28
|
+
* Start region selection mode
|
|
29
|
+
*/
|
|
30
|
+
startSelection(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Cancel region selection
|
|
33
|
+
*/
|
|
34
|
+
cancelSelection(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Create save polygon button
|
|
37
|
+
*/
|
|
38
|
+
private createSaveButton;
|
|
39
|
+
/**
|
|
40
|
+
* Remove save button
|
|
41
|
+
*/
|
|
42
|
+
private removeSaveButton;
|
|
43
|
+
/**
|
|
44
|
+
* Handle save button click
|
|
45
|
+
*/
|
|
46
|
+
private handleSaveClick;
|
|
47
|
+
/**
|
|
48
|
+
* Show region form modal
|
|
49
|
+
*/
|
|
50
|
+
private showRegionForm;
|
|
51
|
+
/**
|
|
52
|
+
* Handle form cancellation
|
|
53
|
+
*/
|
|
54
|
+
private handleFormCancel;
|
|
55
|
+
/**
|
|
56
|
+
* Handle region save from form
|
|
57
|
+
*/
|
|
58
|
+
private handleRegionSave;
|
|
59
|
+
/**
|
|
60
|
+
* Check if region selection is active
|
|
61
|
+
*/
|
|
62
|
+
isSelectionActive(): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Update the style URL for new regions
|
|
65
|
+
*/
|
|
66
|
+
updateStyleUrl(newStyleUrl: string): void;
|
|
67
|
+
/**
|
|
68
|
+
* Cleanup when control is removed
|
|
69
|
+
*/
|
|
70
|
+
cleanup(): void;
|
|
71
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Button Manager Component
|
|
3
|
+
* Manages the main control button and progress badge states
|
|
4
|
+
* Refactored to use modular Button component
|
|
5
|
+
*/
|
|
6
|
+
export interface ButtonManagerOptions {
|
|
7
|
+
onTogglePanel: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare class ButtonManager {
|
|
10
|
+
private container;
|
|
11
|
+
private button;
|
|
12
|
+
private options;
|
|
13
|
+
constructor(options: ButtonManagerOptions);
|
|
14
|
+
/**
|
|
15
|
+
* Get the container element
|
|
16
|
+
*/
|
|
17
|
+
getContainer(): HTMLDivElement;
|
|
18
|
+
/**
|
|
19
|
+
* Update button text and state
|
|
20
|
+
*/
|
|
21
|
+
updateButton(text: string, disabled: boolean): void;
|
|
22
|
+
/**
|
|
23
|
+
* Update progress badge
|
|
24
|
+
*/
|
|
25
|
+
updateProgressBadge(text: string, visible: boolean): void;
|
|
26
|
+
/**
|
|
27
|
+
* Reset button to default state
|
|
28
|
+
*/
|
|
29
|
+
resetToDefault(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Create container element
|
|
32
|
+
*/
|
|
33
|
+
private createContainer;
|
|
34
|
+
/**
|
|
35
|
+
* Create main button using modular Button component
|
|
36
|
+
*/
|
|
37
|
+
private createButton;
|
|
38
|
+
/**
|
|
39
|
+
* Cleanup when removed
|
|
40
|
+
*/
|
|
41
|
+
cleanup(): void;
|
|
42
|
+
}
|