zenit-sdk 0.0.1 → 0.0.2

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.
@@ -1,4 +1,184 @@
1
- export { an as FloatingChatBox, ao as FloatingChatBoxProps, aj as LayerSnapshot, ar as LayerStyle, am as ZenitFeatureFilterPanel, al as ZenitLayerManager, ah as ZenitMap, ak as ZenitMapProps, ai as ZenitMapRef, aw as ZoomOpacityOptions, ax as clampNumber, ay as clampOpacity, av as getAccentByLayerId, aC as getEffectiveLayerOpacity, at as getLayerColor, aB as getLayerZoomOpacityFactor, au as getStyleByLayerId, aA as getZoomOpacityFactor, az as isPolygonLayer, as as resolveLayerAccent, ap as useSendMessage, aq as useSendMessageStream } from '../index-C_2fk0Fk.mjs';
1
+ import React from 'react';
2
+ import L, { PathOptions } from 'leaflet';
3
+ import { d as ZenitClient, a as GeoJsonFeatureCollection, a4 as EffectiveLayerState, B as Bbox, c as GeoJsonPolygon, L as LayerFilters, af as SuggestedAction, a8 as ChatServiceConfig, ae as ChatRequestDto, a9 as ChatRequestOptions, ag as ChatResponseDto } from '../chat.service-Dr9qCnuT.mjs';
2
4
  export { ChevronLeft, ChevronRight, Eye, EyeOff, Layers, Upload, X, ZoomIn } from 'lucide-react';
3
- import 'react';
4
- import 'leaflet';
5
+
6
+ interface LayerStyle$1 {
7
+ color?: string;
8
+ weight?: number;
9
+ fillColor?: string;
10
+ fillOpacity?: number;
11
+ }
12
+ /**
13
+ * Resuelve el color de acento para una capa basado en su estilo.
14
+ * Prioridad: fillColor → color → null
15
+ */
16
+ declare function resolveLayerAccent(style?: LayerStyle$1 | null): string | null;
17
+ /**
18
+ * Obtiene el color de acento para una capa, con fallback a un color neutral.
19
+ * @param style - El estilo de la capa
20
+ * @param fallback - Color de fallback (por defecto gris neutral)
21
+ */
22
+ declare function getLayerColor(style?: LayerStyle$1 | null, fallback?: string): string;
23
+ /**
24
+ * Busca el estilo de una capa en un arreglo de mapLayers por su layerId.
25
+ */
26
+ declare function getStyleByLayerId(layerId: string | number, mapLayers?: Array<{
27
+ layerId: number | string;
28
+ style?: LayerStyle$1 | null;
29
+ }>): LayerStyle$1 | null;
30
+ /**
31
+ * Obtiene el color de acento de una capa por su layerId.
32
+ */
33
+ declare function getAccentByLayerId(layerId: string | number, mapLayers?: Array<{
34
+ layerId: number | string;
35
+ style?: LayerStyle$1 | null;
36
+ }>): string | null;
37
+
38
+ interface LayerSnapshot {
39
+ layerId: number | string;
40
+ visible: boolean;
41
+ opacity: number;
42
+ }
43
+ interface ZenitMapRef {
44
+ setLayerOpacity: (layerId: number | string, opacity: number) => void;
45
+ setLayerVisibility: (layerId: number | string, visible: boolean) => void;
46
+ fitBounds: (bbox: Bbox, options?: {
47
+ padding?: [number, number];
48
+ animate?: boolean;
49
+ }) => void;
50
+ setView: (coordinates: {
51
+ lat: number;
52
+ lon: number;
53
+ }, zoom?: number) => void;
54
+ getLayerSnapshot: () => LayerSnapshot[];
55
+ restoreLayerSnapshot: (snapshot: LayerSnapshot[]) => void;
56
+ highlightFeature: (layerId: number | string, featureId?: number | string) => void;
57
+ getMapInstance: () => L.Map | null;
58
+ }
59
+ interface ZenitMapProps {
60
+ client: ZenitClient;
61
+ mapId: number;
62
+ height?: string;
63
+ width?: string;
64
+ initialZoom?: number;
65
+ initialCenter?: [number, number];
66
+ showLayerPanel?: boolean;
67
+ overlayGeojson?: GeoJsonFeatureCollection | null;
68
+ overlayStyle?: PathOptions;
69
+ layerControls?: Array<{
70
+ layerId: number | string;
71
+ visible?: boolean;
72
+ opacity?: number;
73
+ }>;
74
+ layerStates?: EffectiveLayerState[];
75
+ layerGeojson?: Record<string | number, GeoJsonFeatureCollection | null | undefined>;
76
+ onLayerStateChange?: (states: EffectiveLayerState[]) => void;
77
+ onError?: (error: unknown, ctx: 'map') => void;
78
+ onLoadingChange?: (ctx: 'map', loading: boolean) => void;
79
+ onFeatureClick?: (feature: any, layerId?: number | string) => void;
80
+ onFeatureHover?: (feature: any, layerId?: number | string) => void;
81
+ featureInfoMode?: 'popup' | 'none';
82
+ mapLayers?: Array<{
83
+ layerId: number | string;
84
+ style?: LayerStyle$1 | null;
85
+ }>;
86
+ zoomToBbox?: Bbox | null;
87
+ zoomToGeojson?: GeoJsonFeatureCollection | null;
88
+ onZoomChange?: (zoom: number) => void;
89
+ onMapReady?: (map: L.Map) => void;
90
+ }
91
+ declare const ZenitMap: React.ForwardRefExoticComponent<ZenitMapProps & React.RefAttributes<ZenitMapRef>>;
92
+
93
+ interface LayerStyle {
94
+ color?: string;
95
+ weight?: number;
96
+ fillColor?: string;
97
+ fillOpacity?: number;
98
+ }
99
+ interface ZenitLayerManagerProps {
100
+ client: ZenitClient;
101
+ mapId: number | string;
102
+ side?: 'left' | 'right';
103
+ className?: string;
104
+ style?: React.CSSProperties;
105
+ height?: string;
106
+ layerStates?: EffectiveLayerState[];
107
+ onLayerStatesChange?: (states: EffectiveLayerState[]) => void;
108
+ mapZoom?: number;
109
+ autoOpacityOnZoom?: boolean;
110
+ autoOpacityConfig?: {
111
+ minZoom?: number;
112
+ maxZoom?: number;
113
+ minOpacity?: number;
114
+ maxOpacity?: number;
115
+ };
116
+ showUploadTab?: boolean;
117
+ showLayerVisibilityIcon?: boolean;
118
+ layerFeatureCounts?: Record<string | number, number | null | undefined>;
119
+ mapLayers?: Array<{
120
+ layerId: number | string;
121
+ geometryType?: string | null;
122
+ layerType?: string | null;
123
+ name?: string | null;
124
+ style?: LayerStyle | null;
125
+ bboxGeometry?: GeoJsonPolygon | null;
126
+ displayOrder?: number | null;
127
+ }>;
128
+ onZoomToLayer?: (layerId: number | string, bboxGeometry?: GeoJsonPolygon | null) => void;
129
+ }
130
+ declare const ZenitLayerManager: React.FC<ZenitLayerManagerProps>;
131
+
132
+ interface ZenitFeatureFilterPanelProps {
133
+ title?: string;
134
+ description?: string;
135
+ className?: string;
136
+ style?: React.CSSProperties;
137
+ filters?: LayerFilters;
138
+ onChange?: (filters: LayerFilters) => void;
139
+ children?: React.ReactNode;
140
+ }
141
+ declare const ZenitFeatureFilterPanel: React.FC<ZenitFeatureFilterPanelProps>;
142
+
143
+ interface FloatingChatBoxProps {
144
+ mapId?: number;
145
+ filteredLayerIds?: number[];
146
+ filters?: Record<string, unknown>;
147
+ userId?: number | null;
148
+ baseUrl?: string;
149
+ accessToken?: string;
150
+ getAccessToken?: () => string | Promise<string>;
151
+ onActionClick?: (action: SuggestedAction) => void;
152
+ }
153
+ declare const FloatingChatBox: React.FC<FloatingChatBoxProps>;
154
+
155
+ declare const useSendMessage: (config?: ChatServiceConfig) => {
156
+ sendMessage: (mapId: number, request: ChatRequestDto, options?: ChatRequestOptions) => Promise<ChatResponseDto>;
157
+ isLoading: boolean;
158
+ error: unknown;
159
+ };
160
+ declare const useSendMessageStream: (config?: ChatServiceConfig) => {
161
+ sendMessage: (mapId: number, request: ChatRequestDto, options?: ChatRequestOptions) => Promise<ChatResponseDto>;
162
+ isStreaming: boolean;
163
+ streamingText: string;
164
+ completeResponse: ChatResponseDto | null;
165
+ error: unknown;
166
+ reset: () => void;
167
+ };
168
+
169
+ interface ZoomOpacityOptions {
170
+ minZoom?: number;
171
+ maxZoom?: number;
172
+ minFactor?: number;
173
+ maxFactor?: number;
174
+ minOpacity?: number;
175
+ maxOpacity?: number;
176
+ }
177
+ declare function clampNumber(value: number, min: number, max: number): number;
178
+ declare function clampOpacity(value: number): number;
179
+ declare function isPolygonLayer(layerType?: string, geometryType?: string): boolean;
180
+ declare function getZoomOpacityFactor(zoom: number, options?: ZoomOpacityOptions): number;
181
+ declare function getLayerZoomOpacityFactor(zoom: number, layerType?: string, geometryType?: string, options?: ZoomOpacityOptions): number;
182
+ declare function getEffectiveLayerOpacity(baseOpacity: number, zoom: number, layerType?: string, geometryType?: string, options?: ZoomOpacityOptions): number;
183
+
184
+ export { FloatingChatBox, type FloatingChatBoxProps, type LayerSnapshot, type LayerStyle$1 as LayerStyle, ZenitFeatureFilterPanel, ZenitLayerManager, ZenitMap, type ZenitMapProps, type ZenitMapRef, type ZoomOpacityOptions, clampNumber, clampOpacity, getAccentByLayerId, getEffectiveLayerOpacity, getLayerColor, getLayerZoomOpacityFactor, getStyleByLayerId, getZoomOpacityFactor, isPolygonLayer, resolveLayerAccent, useSendMessage, useSendMessageStream };
@@ -1,4 +1,184 @@
1
- export { an as FloatingChatBox, ao as FloatingChatBoxProps, aj as LayerSnapshot, ar as LayerStyle, am as ZenitFeatureFilterPanel, al as ZenitLayerManager, ah as ZenitMap, ak as ZenitMapProps, ai as ZenitMapRef, aw as ZoomOpacityOptions, ax as clampNumber, ay as clampOpacity, av as getAccentByLayerId, aC as getEffectiveLayerOpacity, at as getLayerColor, aB as getLayerZoomOpacityFactor, au as getStyleByLayerId, aA as getZoomOpacityFactor, az as isPolygonLayer, as as resolveLayerAccent, ap as useSendMessage, aq as useSendMessageStream } from '../index-C_2fk0Fk.js';
1
+ import React from 'react';
2
+ import L, { PathOptions } from 'leaflet';
3
+ import { d as ZenitClient, a as GeoJsonFeatureCollection, a4 as EffectiveLayerState, B as Bbox, c as GeoJsonPolygon, L as LayerFilters, af as SuggestedAction, a8 as ChatServiceConfig, ae as ChatRequestDto, a9 as ChatRequestOptions, ag as ChatResponseDto } from '../chat.service-Dr9qCnuT.js';
2
4
  export { ChevronLeft, ChevronRight, Eye, EyeOff, Layers, Upload, X, ZoomIn } from 'lucide-react';
3
- import 'react';
4
- import 'leaflet';
5
+
6
+ interface LayerStyle$1 {
7
+ color?: string;
8
+ weight?: number;
9
+ fillColor?: string;
10
+ fillOpacity?: number;
11
+ }
12
+ /**
13
+ * Resuelve el color de acento para una capa basado en su estilo.
14
+ * Prioridad: fillColor → color → null
15
+ */
16
+ declare function resolveLayerAccent(style?: LayerStyle$1 | null): string | null;
17
+ /**
18
+ * Obtiene el color de acento para una capa, con fallback a un color neutral.
19
+ * @param style - El estilo de la capa
20
+ * @param fallback - Color de fallback (por defecto gris neutral)
21
+ */
22
+ declare function getLayerColor(style?: LayerStyle$1 | null, fallback?: string): string;
23
+ /**
24
+ * Busca el estilo de una capa en un arreglo de mapLayers por su layerId.
25
+ */
26
+ declare function getStyleByLayerId(layerId: string | number, mapLayers?: Array<{
27
+ layerId: number | string;
28
+ style?: LayerStyle$1 | null;
29
+ }>): LayerStyle$1 | null;
30
+ /**
31
+ * Obtiene el color de acento de una capa por su layerId.
32
+ */
33
+ declare function getAccentByLayerId(layerId: string | number, mapLayers?: Array<{
34
+ layerId: number | string;
35
+ style?: LayerStyle$1 | null;
36
+ }>): string | null;
37
+
38
+ interface LayerSnapshot {
39
+ layerId: number | string;
40
+ visible: boolean;
41
+ opacity: number;
42
+ }
43
+ interface ZenitMapRef {
44
+ setLayerOpacity: (layerId: number | string, opacity: number) => void;
45
+ setLayerVisibility: (layerId: number | string, visible: boolean) => void;
46
+ fitBounds: (bbox: Bbox, options?: {
47
+ padding?: [number, number];
48
+ animate?: boolean;
49
+ }) => void;
50
+ setView: (coordinates: {
51
+ lat: number;
52
+ lon: number;
53
+ }, zoom?: number) => void;
54
+ getLayerSnapshot: () => LayerSnapshot[];
55
+ restoreLayerSnapshot: (snapshot: LayerSnapshot[]) => void;
56
+ highlightFeature: (layerId: number | string, featureId?: number | string) => void;
57
+ getMapInstance: () => L.Map | null;
58
+ }
59
+ interface ZenitMapProps {
60
+ client: ZenitClient;
61
+ mapId: number;
62
+ height?: string;
63
+ width?: string;
64
+ initialZoom?: number;
65
+ initialCenter?: [number, number];
66
+ showLayerPanel?: boolean;
67
+ overlayGeojson?: GeoJsonFeatureCollection | null;
68
+ overlayStyle?: PathOptions;
69
+ layerControls?: Array<{
70
+ layerId: number | string;
71
+ visible?: boolean;
72
+ opacity?: number;
73
+ }>;
74
+ layerStates?: EffectiveLayerState[];
75
+ layerGeojson?: Record<string | number, GeoJsonFeatureCollection | null | undefined>;
76
+ onLayerStateChange?: (states: EffectiveLayerState[]) => void;
77
+ onError?: (error: unknown, ctx: 'map') => void;
78
+ onLoadingChange?: (ctx: 'map', loading: boolean) => void;
79
+ onFeatureClick?: (feature: any, layerId?: number | string) => void;
80
+ onFeatureHover?: (feature: any, layerId?: number | string) => void;
81
+ featureInfoMode?: 'popup' | 'none';
82
+ mapLayers?: Array<{
83
+ layerId: number | string;
84
+ style?: LayerStyle$1 | null;
85
+ }>;
86
+ zoomToBbox?: Bbox | null;
87
+ zoomToGeojson?: GeoJsonFeatureCollection | null;
88
+ onZoomChange?: (zoom: number) => void;
89
+ onMapReady?: (map: L.Map) => void;
90
+ }
91
+ declare const ZenitMap: React.ForwardRefExoticComponent<ZenitMapProps & React.RefAttributes<ZenitMapRef>>;
92
+
93
+ interface LayerStyle {
94
+ color?: string;
95
+ weight?: number;
96
+ fillColor?: string;
97
+ fillOpacity?: number;
98
+ }
99
+ interface ZenitLayerManagerProps {
100
+ client: ZenitClient;
101
+ mapId: number | string;
102
+ side?: 'left' | 'right';
103
+ className?: string;
104
+ style?: React.CSSProperties;
105
+ height?: string;
106
+ layerStates?: EffectiveLayerState[];
107
+ onLayerStatesChange?: (states: EffectiveLayerState[]) => void;
108
+ mapZoom?: number;
109
+ autoOpacityOnZoom?: boolean;
110
+ autoOpacityConfig?: {
111
+ minZoom?: number;
112
+ maxZoom?: number;
113
+ minOpacity?: number;
114
+ maxOpacity?: number;
115
+ };
116
+ showUploadTab?: boolean;
117
+ showLayerVisibilityIcon?: boolean;
118
+ layerFeatureCounts?: Record<string | number, number | null | undefined>;
119
+ mapLayers?: Array<{
120
+ layerId: number | string;
121
+ geometryType?: string | null;
122
+ layerType?: string | null;
123
+ name?: string | null;
124
+ style?: LayerStyle | null;
125
+ bboxGeometry?: GeoJsonPolygon | null;
126
+ displayOrder?: number | null;
127
+ }>;
128
+ onZoomToLayer?: (layerId: number | string, bboxGeometry?: GeoJsonPolygon | null) => void;
129
+ }
130
+ declare const ZenitLayerManager: React.FC<ZenitLayerManagerProps>;
131
+
132
+ interface ZenitFeatureFilterPanelProps {
133
+ title?: string;
134
+ description?: string;
135
+ className?: string;
136
+ style?: React.CSSProperties;
137
+ filters?: LayerFilters;
138
+ onChange?: (filters: LayerFilters) => void;
139
+ children?: React.ReactNode;
140
+ }
141
+ declare const ZenitFeatureFilterPanel: React.FC<ZenitFeatureFilterPanelProps>;
142
+
143
+ interface FloatingChatBoxProps {
144
+ mapId?: number;
145
+ filteredLayerIds?: number[];
146
+ filters?: Record<string, unknown>;
147
+ userId?: number | null;
148
+ baseUrl?: string;
149
+ accessToken?: string;
150
+ getAccessToken?: () => string | Promise<string>;
151
+ onActionClick?: (action: SuggestedAction) => void;
152
+ }
153
+ declare const FloatingChatBox: React.FC<FloatingChatBoxProps>;
154
+
155
+ declare const useSendMessage: (config?: ChatServiceConfig) => {
156
+ sendMessage: (mapId: number, request: ChatRequestDto, options?: ChatRequestOptions) => Promise<ChatResponseDto>;
157
+ isLoading: boolean;
158
+ error: unknown;
159
+ };
160
+ declare const useSendMessageStream: (config?: ChatServiceConfig) => {
161
+ sendMessage: (mapId: number, request: ChatRequestDto, options?: ChatRequestOptions) => Promise<ChatResponseDto>;
162
+ isStreaming: boolean;
163
+ streamingText: string;
164
+ completeResponse: ChatResponseDto | null;
165
+ error: unknown;
166
+ reset: () => void;
167
+ };
168
+
169
+ interface ZoomOpacityOptions {
170
+ minZoom?: number;
171
+ maxZoom?: number;
172
+ minFactor?: number;
173
+ maxFactor?: number;
174
+ minOpacity?: number;
175
+ maxOpacity?: number;
176
+ }
177
+ declare function clampNumber(value: number, min: number, max: number): number;
178
+ declare function clampOpacity(value: number): number;
179
+ declare function isPolygonLayer(layerType?: string, geometryType?: string): boolean;
180
+ declare function getZoomOpacityFactor(zoom: number, options?: ZoomOpacityOptions): number;
181
+ declare function getLayerZoomOpacityFactor(zoom: number, layerType?: string, geometryType?: string, options?: ZoomOpacityOptions): number;
182
+ declare function getEffectiveLayerOpacity(baseOpacity: number, zoom: number, layerType?: string, geometryType?: string, options?: ZoomOpacityOptions): number;
183
+
184
+ export { FloatingChatBox, type FloatingChatBoxProps, type LayerSnapshot, type LayerStyle$1 as LayerStyle, ZenitFeatureFilterPanel, ZenitLayerManager, ZenitMap, type ZenitMapProps, type ZenitMapRef, type ZoomOpacityOptions, clampNumber, clampOpacity, getAccentByLayerId, getEffectiveLayerOpacity, getLayerColor, getLayerZoomOpacityFactor, getStyleByLayerId, getZoomOpacityFactor, isPolygonLayer, resolveLayerAccent, useSendMessage, useSendMessageStream };