@feltmaps/js-sdk 1.5.0-next.6 → 1.5.0-next.7
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/dist/client.cjs +1 -1
- package/dist/client.d.cts +103 -11
- package/dist/client.d.ts +103 -11
- package/dist/client.js +1 -1
- package/dist/handler.cjs +1 -1
- package/dist/handler.d.cts +91 -31
- package/dist/handler.d.ts +91 -31
- package/dist/handler.js +1 -1
- package/dist/{types-CQwkpLq-.d.cts → types-XLCA2cX-.d.cts} +164 -14
- package/dist/{types-CQwkpLq-.d.ts → types-XLCA2cX-.d.ts} +164 -14
- package/handler.d.ts +91 -31
- package/handler.js +1 -1
- package/package.json +1 -1
- package/{types-CQwkpLq-.d.ts → types-XLCA2cX-.d.ts} +164 -14
package/dist/handler.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as zod from 'zod';
|
|
2
1
|
import { z } from 'zod';
|
|
3
|
-
import { J as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, u as GetLayerCategoriesGroup, w as GetLayerHistogramBin, A as AggregationMethod, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams,
|
|
2
|
+
import { J as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, u as GetLayerCategoriesGroup, w as GetLayerHistogramBin, A as AggregationMethod, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams, ao as FilterTernary, y as MapDetails, z as EntityNode, T as ToolType, D as ToolSettingsMap, H as ToolSettingsChangeEvent, V as ViewportState, O as ViewportConstraints, aS as UnionToIntersection, aT as PromiseOrNot } from './types-XLCA2cX-.cjs';
|
|
4
3
|
|
|
5
4
|
type Method<TRequest extends {
|
|
6
5
|
type: string;
|
|
@@ -1429,6 +1428,9 @@ type ElementsSchema = {
|
|
|
1429
1428
|
onElementChange: Listener<zInfer<typeof OnElementChangeMessage.shape.options>, ElementChangeCallbackParams>;
|
|
1430
1429
|
onElementGroupChange: Listener<zInfer<typeof OnElementGroupChangeMessage.shape.options>, ElementGroupChangeCallbackParams>;
|
|
1431
1430
|
onElementCreate: ListenerNoOptions<ElementChangeCallbackParams>;
|
|
1431
|
+
onElementCreateEnd: ListenerNoOptions<{
|
|
1432
|
+
element: Element;
|
|
1433
|
+
}>;
|
|
1432
1434
|
onElementDelete: Listener<zInfer<typeof OnElementDeleteMessage.shape.options>, void>;
|
|
1433
1435
|
};
|
|
1434
1436
|
};
|
|
@@ -2027,8 +2029,8 @@ declare const GetLayerCategoriesMessage: z.ZodObject<{
|
|
|
2027
2029
|
} | undefined;
|
|
2028
2030
|
}>>;
|
|
2029
2031
|
}, "strip", z.ZodTypeAny, {
|
|
2030
|
-
layerId: string;
|
|
2031
2032
|
attribute: string;
|
|
2033
|
+
layerId: string;
|
|
2032
2034
|
values?: {
|
|
2033
2035
|
boundary?: [number, number][] | {
|
|
2034
2036
|
type: "Polygon";
|
|
@@ -2047,8 +2049,8 @@ declare const GetLayerCategoriesMessage: z.ZodObject<{
|
|
|
2047
2049
|
filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
|
|
2048
2050
|
limit?: number | undefined;
|
|
2049
2051
|
}, {
|
|
2050
|
-
layerId: string;
|
|
2051
2052
|
attribute: string;
|
|
2053
|
+
layerId: string;
|
|
2052
2054
|
values?: {
|
|
2053
2055
|
boundary?: [number, number][] | {
|
|
2054
2056
|
type: "Polygon";
|
|
@@ -2069,8 +2071,8 @@ declare const GetLayerCategoriesMessage: z.ZodObject<{
|
|
|
2069
2071
|
}>;
|
|
2070
2072
|
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
2071
2073
|
params: {
|
|
2072
|
-
layerId: string;
|
|
2073
2074
|
attribute: string;
|
|
2075
|
+
layerId: string;
|
|
2074
2076
|
values?: {
|
|
2075
2077
|
boundary?: [number, number][] | {
|
|
2076
2078
|
type: "Polygon";
|
|
@@ -2092,8 +2094,8 @@ declare const GetLayerCategoriesMessage: z.ZodObject<{
|
|
|
2092
2094
|
type: "getCategoryData";
|
|
2093
2095
|
}, {
|
|
2094
2096
|
params: {
|
|
2095
|
-
layerId: string;
|
|
2096
2097
|
attribute: string;
|
|
2098
|
+
layerId: string;
|
|
2097
2099
|
values?: {
|
|
2098
2100
|
boundary?: [number, number][] | {
|
|
2099
2101
|
type: "Polygon";
|
|
@@ -2193,8 +2195,8 @@ declare const GetLayerHistogramMessage: z.ZodObject<{
|
|
|
2193
2195
|
} | undefined;
|
|
2194
2196
|
}>>;
|
|
2195
2197
|
}, "strip", z.ZodTypeAny, {
|
|
2196
|
-
layerId: string;
|
|
2197
2198
|
attribute: string;
|
|
2199
|
+
layerId: string;
|
|
2198
2200
|
steps: number[] | {
|
|
2199
2201
|
type: "equal-intervals";
|
|
2200
2202
|
count: number;
|
|
@@ -2219,8 +2221,8 @@ declare const GetLayerHistogramMessage: z.ZodObject<{
|
|
|
2219
2221
|
} | [number, number, number, number] | undefined;
|
|
2220
2222
|
filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
|
|
2221
2223
|
}, {
|
|
2222
|
-
layerId: string;
|
|
2223
2224
|
attribute: string;
|
|
2225
|
+
layerId: string;
|
|
2224
2226
|
steps: number[] | {
|
|
2225
2227
|
type: "equal-intervals";
|
|
2226
2228
|
count: number;
|
|
@@ -2247,8 +2249,8 @@ declare const GetLayerHistogramMessage: z.ZodObject<{
|
|
|
2247
2249
|
}>;
|
|
2248
2250
|
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
2249
2251
|
params: {
|
|
2250
|
-
layerId: string;
|
|
2251
2252
|
attribute: string;
|
|
2253
|
+
layerId: string;
|
|
2252
2254
|
steps: number[] | {
|
|
2253
2255
|
type: "equal-intervals";
|
|
2254
2256
|
count: number;
|
|
@@ -2276,8 +2278,8 @@ declare const GetLayerHistogramMessage: z.ZodObject<{
|
|
|
2276
2278
|
type: "getHistogramData";
|
|
2277
2279
|
}, {
|
|
2278
2280
|
params: {
|
|
2279
|
-
layerId: string;
|
|
2280
2281
|
attribute: string;
|
|
2282
|
+
layerId: string;
|
|
2281
2283
|
steps: number[] | {
|
|
2282
2284
|
type: "equal-intervals";
|
|
2283
2285
|
count: number;
|
|
@@ -2870,16 +2872,16 @@ type ToolsSchema = {
|
|
|
2870
2872
|
};
|
|
2871
2873
|
};
|
|
2872
2874
|
|
|
2873
|
-
declare const UiControlsMessage:
|
|
2874
|
-
type:
|
|
2875
|
-
params:
|
|
2876
|
-
showLegend:
|
|
2877
|
-
cooperativeGestures:
|
|
2878
|
-
fullScreenButton:
|
|
2879
|
-
geolocation:
|
|
2880
|
-
zoomControls:
|
|
2881
|
-
scaleBar:
|
|
2882
|
-
}, "strip",
|
|
2875
|
+
declare const UiControlsMessage: z.ZodObject<{
|
|
2876
|
+
type: z.ZodLiteral<"updateUiControls">;
|
|
2877
|
+
params: z.ZodObject<{
|
|
2878
|
+
showLegend: z.ZodOptional<z.ZodBoolean>;
|
|
2879
|
+
cooperativeGestures: z.ZodOptional<z.ZodBoolean>;
|
|
2880
|
+
fullScreenButton: z.ZodOptional<z.ZodBoolean>;
|
|
2881
|
+
geolocation: z.ZodOptional<z.ZodBoolean>;
|
|
2882
|
+
zoomControls: z.ZodOptional<z.ZodBoolean>;
|
|
2883
|
+
scaleBar: z.ZodOptional<z.ZodBoolean>;
|
|
2884
|
+
}, "strip", z.ZodTypeAny, {
|
|
2883
2885
|
showLegend?: boolean | undefined;
|
|
2884
2886
|
cooperativeGestures?: boolean | undefined;
|
|
2885
2887
|
fullScreenButton?: boolean | undefined;
|
|
@@ -2894,7 +2896,7 @@ declare const UiControlsMessage: zod.ZodObject<{
|
|
|
2894
2896
|
zoomControls?: boolean | undefined;
|
|
2895
2897
|
scaleBar?: boolean | undefined;
|
|
2896
2898
|
}>;
|
|
2897
|
-
},
|
|
2899
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
2898
2900
|
params: {
|
|
2899
2901
|
showLegend?: boolean | undefined;
|
|
2900
2902
|
cooperativeGestures?: boolean | undefined;
|
|
@@ -2915,15 +2917,15 @@ declare const UiControlsMessage: zod.ZodObject<{
|
|
|
2915
2917
|
};
|
|
2916
2918
|
type: "updateUiControls";
|
|
2917
2919
|
}>;
|
|
2918
|
-
declare const OnMapInteractionsMessage:
|
|
2919
|
-
type:
|
|
2920
|
-
params:
|
|
2921
|
-
featureSelectPanel:
|
|
2922
|
-
featureHoverPanel:
|
|
2923
|
-
elementSelectPanel:
|
|
2924
|
-
linkClickOpen:
|
|
2925
|
-
imageLightboxOpen:
|
|
2926
|
-
}, "strip",
|
|
2920
|
+
declare const OnMapInteractionsMessage: z.ZodObject<{
|
|
2921
|
+
type: z.ZodLiteral<"setOnMapInteractionsUi">;
|
|
2922
|
+
params: z.ZodObject<{
|
|
2923
|
+
featureSelectPanel: z.ZodOptional<z.ZodBoolean>;
|
|
2924
|
+
featureHoverPanel: z.ZodOptional<z.ZodBoolean>;
|
|
2925
|
+
elementSelectPanel: z.ZodOptional<z.ZodBoolean>;
|
|
2926
|
+
linkClickOpen: z.ZodOptional<z.ZodBoolean>;
|
|
2927
|
+
imageLightboxOpen: z.ZodOptional<z.ZodBoolean>;
|
|
2928
|
+
}, "strip", z.ZodTypeAny, {
|
|
2927
2929
|
featureSelectPanel?: boolean | undefined;
|
|
2928
2930
|
featureHoverPanel?: boolean | undefined;
|
|
2929
2931
|
elementSelectPanel?: boolean | undefined;
|
|
@@ -2936,7 +2938,7 @@ declare const OnMapInteractionsMessage: zod.ZodObject<{
|
|
|
2936
2938
|
linkClickOpen?: boolean | undefined;
|
|
2937
2939
|
imageLightboxOpen?: boolean | undefined;
|
|
2938
2940
|
}>;
|
|
2939
|
-
},
|
|
2941
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
2940
2942
|
params: {
|
|
2941
2943
|
featureSelectPanel?: boolean | undefined;
|
|
2942
2944
|
featureHoverPanel?: boolean | undefined;
|
|
@@ -2955,10 +2957,68 @@ declare const OnMapInteractionsMessage: zod.ZodObject<{
|
|
|
2955
2957
|
};
|
|
2956
2958
|
type: "setOnMapInteractionsUi";
|
|
2957
2959
|
}>;
|
|
2960
|
+
declare const ShowLayerDataTableMessage: z.ZodObject<{
|
|
2961
|
+
type: z.ZodLiteral<"showLayerDataTable">;
|
|
2962
|
+
params: z.ZodOptional<z.ZodObject<{
|
|
2963
|
+
layerId: z.ZodString;
|
|
2964
|
+
sorting: z.ZodOptional<z.ZodObject<{
|
|
2965
|
+
attribute: z.ZodString;
|
|
2966
|
+
direction: z.ZodEnum<["asc", "desc"]>;
|
|
2967
|
+
}, "strip", z.ZodTypeAny, {
|
|
2968
|
+
attribute: string;
|
|
2969
|
+
direction: "asc" | "desc";
|
|
2970
|
+
}, {
|
|
2971
|
+
attribute: string;
|
|
2972
|
+
direction: "asc" | "desc";
|
|
2973
|
+
}>>;
|
|
2974
|
+
}, "strip", z.ZodTypeAny, {
|
|
2975
|
+
layerId: string;
|
|
2976
|
+
sorting?: {
|
|
2977
|
+
attribute: string;
|
|
2978
|
+
direction: "asc" | "desc";
|
|
2979
|
+
} | undefined;
|
|
2980
|
+
}, {
|
|
2981
|
+
layerId: string;
|
|
2982
|
+
sorting?: {
|
|
2983
|
+
attribute: string;
|
|
2984
|
+
direction: "asc" | "desc";
|
|
2985
|
+
} | undefined;
|
|
2986
|
+
}>>;
|
|
2987
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
2988
|
+
type: "showLayerDataTable";
|
|
2989
|
+
params?: {
|
|
2990
|
+
layerId: string;
|
|
2991
|
+
sorting?: {
|
|
2992
|
+
attribute: string;
|
|
2993
|
+
direction: "asc" | "desc";
|
|
2994
|
+
} | undefined;
|
|
2995
|
+
} | undefined;
|
|
2996
|
+
}, {
|
|
2997
|
+
type: "showLayerDataTable";
|
|
2998
|
+
params?: {
|
|
2999
|
+
layerId: string;
|
|
3000
|
+
sorting?: {
|
|
3001
|
+
attribute: string;
|
|
3002
|
+
direction: "asc" | "desc";
|
|
3003
|
+
} | undefined;
|
|
3004
|
+
} | undefined;
|
|
3005
|
+
}>;
|
|
3006
|
+
declare const HideLayerDataTableMessage: z.ZodObject<{
|
|
3007
|
+
type: z.ZodLiteral<"hideLayerDataTable">;
|
|
3008
|
+
params: z.ZodUndefined;
|
|
3009
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
3010
|
+
type: "hideLayerDataTable";
|
|
3011
|
+
params?: undefined;
|
|
3012
|
+
}, {
|
|
3013
|
+
type: "hideLayerDataTable";
|
|
3014
|
+
params?: undefined;
|
|
3015
|
+
}>;
|
|
2958
3016
|
type UiSchema = {
|
|
2959
3017
|
methods: {
|
|
2960
3018
|
updateUiControls: Method<zInfer<typeof UiControlsMessage>, void>;
|
|
2961
3019
|
setOnMapInteractionsUi: Method<zInfer<typeof OnMapInteractionsMessage>, void>;
|
|
3020
|
+
showLayerDataTable: Method<zInfer<typeof ShowLayerDataTableMessage>, void>;
|
|
3021
|
+
hideLayerDataTable: Method<zInfer<typeof HideLayerDataTableMessage>, void>;
|
|
2962
3022
|
};
|
|
2963
3023
|
listeners: {};
|
|
2964
3024
|
};
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as zod from 'zod';
|
|
2
1
|
import { z } from 'zod';
|
|
3
|
-
import { J as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, u as GetLayerCategoriesGroup, w as GetLayerHistogramBin, A as AggregationMethod, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams,
|
|
2
|
+
import { J as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, u as GetLayerCategoriesGroup, w as GetLayerHistogramBin, A as AggregationMethod, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams, ao as FilterTernary, y as MapDetails, z as EntityNode, T as ToolType, D as ToolSettingsMap, H as ToolSettingsChangeEvent, V as ViewportState, O as ViewportConstraints, aS as UnionToIntersection, aT as PromiseOrNot } from './types-XLCA2cX-.js';
|
|
4
3
|
|
|
5
4
|
type Method<TRequest extends {
|
|
6
5
|
type: string;
|
|
@@ -1429,6 +1428,9 @@ type ElementsSchema = {
|
|
|
1429
1428
|
onElementChange: Listener<zInfer<typeof OnElementChangeMessage.shape.options>, ElementChangeCallbackParams>;
|
|
1430
1429
|
onElementGroupChange: Listener<zInfer<typeof OnElementGroupChangeMessage.shape.options>, ElementGroupChangeCallbackParams>;
|
|
1431
1430
|
onElementCreate: ListenerNoOptions<ElementChangeCallbackParams>;
|
|
1431
|
+
onElementCreateEnd: ListenerNoOptions<{
|
|
1432
|
+
element: Element;
|
|
1433
|
+
}>;
|
|
1432
1434
|
onElementDelete: Listener<zInfer<typeof OnElementDeleteMessage.shape.options>, void>;
|
|
1433
1435
|
};
|
|
1434
1436
|
};
|
|
@@ -2027,8 +2029,8 @@ declare const GetLayerCategoriesMessage: z.ZodObject<{
|
|
|
2027
2029
|
} | undefined;
|
|
2028
2030
|
}>>;
|
|
2029
2031
|
}, "strip", z.ZodTypeAny, {
|
|
2030
|
-
layerId: string;
|
|
2031
2032
|
attribute: string;
|
|
2033
|
+
layerId: string;
|
|
2032
2034
|
values?: {
|
|
2033
2035
|
boundary?: [number, number][] | {
|
|
2034
2036
|
type: "Polygon";
|
|
@@ -2047,8 +2049,8 @@ declare const GetLayerCategoriesMessage: z.ZodObject<{
|
|
|
2047
2049
|
filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
|
|
2048
2050
|
limit?: number | undefined;
|
|
2049
2051
|
}, {
|
|
2050
|
-
layerId: string;
|
|
2051
2052
|
attribute: string;
|
|
2053
|
+
layerId: string;
|
|
2052
2054
|
values?: {
|
|
2053
2055
|
boundary?: [number, number][] | {
|
|
2054
2056
|
type: "Polygon";
|
|
@@ -2069,8 +2071,8 @@ declare const GetLayerCategoriesMessage: z.ZodObject<{
|
|
|
2069
2071
|
}>;
|
|
2070
2072
|
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
2071
2073
|
params: {
|
|
2072
|
-
layerId: string;
|
|
2073
2074
|
attribute: string;
|
|
2075
|
+
layerId: string;
|
|
2074
2076
|
values?: {
|
|
2075
2077
|
boundary?: [number, number][] | {
|
|
2076
2078
|
type: "Polygon";
|
|
@@ -2092,8 +2094,8 @@ declare const GetLayerCategoriesMessage: z.ZodObject<{
|
|
|
2092
2094
|
type: "getCategoryData";
|
|
2093
2095
|
}, {
|
|
2094
2096
|
params: {
|
|
2095
|
-
layerId: string;
|
|
2096
2097
|
attribute: string;
|
|
2098
|
+
layerId: string;
|
|
2097
2099
|
values?: {
|
|
2098
2100
|
boundary?: [number, number][] | {
|
|
2099
2101
|
type: "Polygon";
|
|
@@ -2193,8 +2195,8 @@ declare const GetLayerHistogramMessage: z.ZodObject<{
|
|
|
2193
2195
|
} | undefined;
|
|
2194
2196
|
}>>;
|
|
2195
2197
|
}, "strip", z.ZodTypeAny, {
|
|
2196
|
-
layerId: string;
|
|
2197
2198
|
attribute: string;
|
|
2199
|
+
layerId: string;
|
|
2198
2200
|
steps: number[] | {
|
|
2199
2201
|
type: "equal-intervals";
|
|
2200
2202
|
count: number;
|
|
@@ -2219,8 +2221,8 @@ declare const GetLayerHistogramMessage: z.ZodObject<{
|
|
|
2219
2221
|
} | [number, number, number, number] | undefined;
|
|
2220
2222
|
filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
|
|
2221
2223
|
}, {
|
|
2222
|
-
layerId: string;
|
|
2223
2224
|
attribute: string;
|
|
2225
|
+
layerId: string;
|
|
2224
2226
|
steps: number[] | {
|
|
2225
2227
|
type: "equal-intervals";
|
|
2226
2228
|
count: number;
|
|
@@ -2247,8 +2249,8 @@ declare const GetLayerHistogramMessage: z.ZodObject<{
|
|
|
2247
2249
|
}>;
|
|
2248
2250
|
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
2249
2251
|
params: {
|
|
2250
|
-
layerId: string;
|
|
2251
2252
|
attribute: string;
|
|
2253
|
+
layerId: string;
|
|
2252
2254
|
steps: number[] | {
|
|
2253
2255
|
type: "equal-intervals";
|
|
2254
2256
|
count: number;
|
|
@@ -2276,8 +2278,8 @@ declare const GetLayerHistogramMessage: z.ZodObject<{
|
|
|
2276
2278
|
type: "getHistogramData";
|
|
2277
2279
|
}, {
|
|
2278
2280
|
params: {
|
|
2279
|
-
layerId: string;
|
|
2280
2281
|
attribute: string;
|
|
2282
|
+
layerId: string;
|
|
2281
2283
|
steps: number[] | {
|
|
2282
2284
|
type: "equal-intervals";
|
|
2283
2285
|
count: number;
|
|
@@ -2870,16 +2872,16 @@ type ToolsSchema = {
|
|
|
2870
2872
|
};
|
|
2871
2873
|
};
|
|
2872
2874
|
|
|
2873
|
-
declare const UiControlsMessage:
|
|
2874
|
-
type:
|
|
2875
|
-
params:
|
|
2876
|
-
showLegend:
|
|
2877
|
-
cooperativeGestures:
|
|
2878
|
-
fullScreenButton:
|
|
2879
|
-
geolocation:
|
|
2880
|
-
zoomControls:
|
|
2881
|
-
scaleBar:
|
|
2882
|
-
}, "strip",
|
|
2875
|
+
declare const UiControlsMessage: z.ZodObject<{
|
|
2876
|
+
type: z.ZodLiteral<"updateUiControls">;
|
|
2877
|
+
params: z.ZodObject<{
|
|
2878
|
+
showLegend: z.ZodOptional<z.ZodBoolean>;
|
|
2879
|
+
cooperativeGestures: z.ZodOptional<z.ZodBoolean>;
|
|
2880
|
+
fullScreenButton: z.ZodOptional<z.ZodBoolean>;
|
|
2881
|
+
geolocation: z.ZodOptional<z.ZodBoolean>;
|
|
2882
|
+
zoomControls: z.ZodOptional<z.ZodBoolean>;
|
|
2883
|
+
scaleBar: z.ZodOptional<z.ZodBoolean>;
|
|
2884
|
+
}, "strip", z.ZodTypeAny, {
|
|
2883
2885
|
showLegend?: boolean | undefined;
|
|
2884
2886
|
cooperativeGestures?: boolean | undefined;
|
|
2885
2887
|
fullScreenButton?: boolean | undefined;
|
|
@@ -2894,7 +2896,7 @@ declare const UiControlsMessage: zod.ZodObject<{
|
|
|
2894
2896
|
zoomControls?: boolean | undefined;
|
|
2895
2897
|
scaleBar?: boolean | undefined;
|
|
2896
2898
|
}>;
|
|
2897
|
-
},
|
|
2899
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
2898
2900
|
params: {
|
|
2899
2901
|
showLegend?: boolean | undefined;
|
|
2900
2902
|
cooperativeGestures?: boolean | undefined;
|
|
@@ -2915,15 +2917,15 @@ declare const UiControlsMessage: zod.ZodObject<{
|
|
|
2915
2917
|
};
|
|
2916
2918
|
type: "updateUiControls";
|
|
2917
2919
|
}>;
|
|
2918
|
-
declare const OnMapInteractionsMessage:
|
|
2919
|
-
type:
|
|
2920
|
-
params:
|
|
2921
|
-
featureSelectPanel:
|
|
2922
|
-
featureHoverPanel:
|
|
2923
|
-
elementSelectPanel:
|
|
2924
|
-
linkClickOpen:
|
|
2925
|
-
imageLightboxOpen:
|
|
2926
|
-
}, "strip",
|
|
2920
|
+
declare const OnMapInteractionsMessage: z.ZodObject<{
|
|
2921
|
+
type: z.ZodLiteral<"setOnMapInteractionsUi">;
|
|
2922
|
+
params: z.ZodObject<{
|
|
2923
|
+
featureSelectPanel: z.ZodOptional<z.ZodBoolean>;
|
|
2924
|
+
featureHoverPanel: z.ZodOptional<z.ZodBoolean>;
|
|
2925
|
+
elementSelectPanel: z.ZodOptional<z.ZodBoolean>;
|
|
2926
|
+
linkClickOpen: z.ZodOptional<z.ZodBoolean>;
|
|
2927
|
+
imageLightboxOpen: z.ZodOptional<z.ZodBoolean>;
|
|
2928
|
+
}, "strip", z.ZodTypeAny, {
|
|
2927
2929
|
featureSelectPanel?: boolean | undefined;
|
|
2928
2930
|
featureHoverPanel?: boolean | undefined;
|
|
2929
2931
|
elementSelectPanel?: boolean | undefined;
|
|
@@ -2936,7 +2938,7 @@ declare const OnMapInteractionsMessage: zod.ZodObject<{
|
|
|
2936
2938
|
linkClickOpen?: boolean | undefined;
|
|
2937
2939
|
imageLightboxOpen?: boolean | undefined;
|
|
2938
2940
|
}>;
|
|
2939
|
-
},
|
|
2941
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
2940
2942
|
params: {
|
|
2941
2943
|
featureSelectPanel?: boolean | undefined;
|
|
2942
2944
|
featureHoverPanel?: boolean | undefined;
|
|
@@ -2955,10 +2957,68 @@ declare const OnMapInteractionsMessage: zod.ZodObject<{
|
|
|
2955
2957
|
};
|
|
2956
2958
|
type: "setOnMapInteractionsUi";
|
|
2957
2959
|
}>;
|
|
2960
|
+
declare const ShowLayerDataTableMessage: z.ZodObject<{
|
|
2961
|
+
type: z.ZodLiteral<"showLayerDataTable">;
|
|
2962
|
+
params: z.ZodOptional<z.ZodObject<{
|
|
2963
|
+
layerId: z.ZodString;
|
|
2964
|
+
sorting: z.ZodOptional<z.ZodObject<{
|
|
2965
|
+
attribute: z.ZodString;
|
|
2966
|
+
direction: z.ZodEnum<["asc", "desc"]>;
|
|
2967
|
+
}, "strip", z.ZodTypeAny, {
|
|
2968
|
+
attribute: string;
|
|
2969
|
+
direction: "asc" | "desc";
|
|
2970
|
+
}, {
|
|
2971
|
+
attribute: string;
|
|
2972
|
+
direction: "asc" | "desc";
|
|
2973
|
+
}>>;
|
|
2974
|
+
}, "strip", z.ZodTypeAny, {
|
|
2975
|
+
layerId: string;
|
|
2976
|
+
sorting?: {
|
|
2977
|
+
attribute: string;
|
|
2978
|
+
direction: "asc" | "desc";
|
|
2979
|
+
} | undefined;
|
|
2980
|
+
}, {
|
|
2981
|
+
layerId: string;
|
|
2982
|
+
sorting?: {
|
|
2983
|
+
attribute: string;
|
|
2984
|
+
direction: "asc" | "desc";
|
|
2985
|
+
} | undefined;
|
|
2986
|
+
}>>;
|
|
2987
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
2988
|
+
type: "showLayerDataTable";
|
|
2989
|
+
params?: {
|
|
2990
|
+
layerId: string;
|
|
2991
|
+
sorting?: {
|
|
2992
|
+
attribute: string;
|
|
2993
|
+
direction: "asc" | "desc";
|
|
2994
|
+
} | undefined;
|
|
2995
|
+
} | undefined;
|
|
2996
|
+
}, {
|
|
2997
|
+
type: "showLayerDataTable";
|
|
2998
|
+
params?: {
|
|
2999
|
+
layerId: string;
|
|
3000
|
+
sorting?: {
|
|
3001
|
+
attribute: string;
|
|
3002
|
+
direction: "asc" | "desc";
|
|
3003
|
+
} | undefined;
|
|
3004
|
+
} | undefined;
|
|
3005
|
+
}>;
|
|
3006
|
+
declare const HideLayerDataTableMessage: z.ZodObject<{
|
|
3007
|
+
type: z.ZodLiteral<"hideLayerDataTable">;
|
|
3008
|
+
params: z.ZodUndefined;
|
|
3009
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
3010
|
+
type: "hideLayerDataTable";
|
|
3011
|
+
params?: undefined;
|
|
3012
|
+
}, {
|
|
3013
|
+
type: "hideLayerDataTable";
|
|
3014
|
+
params?: undefined;
|
|
3015
|
+
}>;
|
|
2958
3016
|
type UiSchema = {
|
|
2959
3017
|
methods: {
|
|
2960
3018
|
updateUiControls: Method<zInfer<typeof UiControlsMessage>, void>;
|
|
2961
3019
|
setOnMapInteractionsUi: Method<zInfer<typeof OnMapInteractionsMessage>, void>;
|
|
3020
|
+
showLayerDataTable: Method<zInfer<typeof ShowLayerDataTableMessage>, void>;
|
|
3021
|
+
hideLayerDataTable: Method<zInfer<typeof HideLayerDataTableMessage>, void>;
|
|
2962
3022
|
};
|
|
2963
3023
|
listeners: {};
|
|
2964
3024
|
};
|
package/dist/handler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as g}from"zod";import{z as y}from"zod";import{z as x}from"zod";function t(n,T){return x.strictObject({type:x.literal(n),params:T})}function M(n,T){return x.strictObject({eventName:x.literal(n),id:x.string(),options:T})}function s(n){return x.strictObject({eventName:x.literal(n),id:x.string()})}import{z as a}from"zod";var F=a.number(),k=a.number(),v=a.object({latitude:k,longitude:F}),b=a.tuple([F,k]),ce=a.object({type:a.literal("Point"),coordinates:b}),ge=a.object({type:a.literal("Polygon"),coordinates:a.array(a.array(b))}),Xe=a.object({type:a.literal("LineString"),coordinates:a.array(b)}),L=a.object({type:a.literal("MultiLineString"),coordinates:a.array(Xe.shape.coordinates)}),de=a.number().min(1).max(23),I=a.tuple([F,k,F,k]),G=a.object({show:a.array(a.string()).optional(),hide:a.array(a.string()).optional()});import{z as e}from"zod";var d=e.object({id:e.string(),groupId:e.string().nullable(),color:e.string(),name:e.union([e.string(),e.null()]),description:e.union([e.string(),e.null()]),attributes:e.record(e.string(),e.unknown())}),w=e.object({imageUrl:e.string().nullable()}),H=e.object({strokeOpacity:e.number(),strokeWidth:e.number(),strokeStyle:e.enum(["solid","dashed","dotted"])}),Ye=e.enum(["meter","kilometer","foot","mile"]),B=d.extend(w.shape).extend({type:e.literal("Place"),coordinates:ce.shape.coordinates,symbol:e.string(),frame:e.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.boolean()}),Z=d.extend(w.shape).extend(H.shape).extend({type:e.literal("Path"),coordinates:L.shape.coordinates,distanceMarker:e.boolean(),endCaps:e.boolean(),routingMode:e.enum(["driving","cycling","walking","flying"]).nullable()}),D=d.extend(w.shape).extend(H.shape).extend({type:e.literal("Polygon"),coordinates:L.shape.coordinates,fillOpacity:e.number().min(0).max(1),areaMarker:e.boolean()}),W=d.extend(w.shape).extend(H.shape).extend({type:e.literal("Circle"),coordinates:b,radius:e.number(),radiusDisplayAngle:e.number(),radiusDisplayUnit:Ye.nullable(),fillOpacity:e.number().min(0).max(1),radiusMarker:e.boolean()}),K=d.extend({type:e.literal("Marker"),coordinates:L.shape.coordinates,opacity:e.number().min(0).max(1),size:e.number().min(0).max(100),zoom:e.number().min(0).max(23)}),_=d.extend({type:e.literal("Highlighter"),coordinates:L.shape.coordinates,opacity:e.number().min(0).max(1)}),ye=e.object({position:b,rotation:e.number(),scale:e.number(),zoom:e.number().min(0).max(23),coordinates:L.shape.coordinates}),ue=e.object({text:e.string(),align:e.enum(["left","center","right"]),style:e.enum(["italic","light","regular","caps"]),name:e.string()}),Q=d.extend(ye.shape).extend(ue.shape).extend({type:e.literal("Text")}),$=d.extend(ye.shape).extend(ue.shape).extend({type:e.literal("Note"),widthScale:e.number().min(0)}),J=d.extend({type:e.literal("Image"),coordinates:L.shape.coordinates,imageUrl:e.string(),opacity:e.number().min(0).max(1)}).omit({color:!0}),et=d.extend({type:e.literal("Link"),coordinates:L.shape.coordinates,url:e.string()}),h={type:!0,coordinates:!0},f={id:!0},X=B.partial().required(h).omit(f),V=Z.partial().required(h).omit(f),Y=D.partial().required(h).omit(f),ee=W.partial().required(h).required({radius:!0}).omit(f),te=K.partial().required(h).omit(f),oe=_.partial().required(h).omit(f),re=Q.partial().required(h).required({text:!0}).omit(f).omit({coordinates:!0,name:!0}),ne=$.partial().required(h).required({text:!0}).omit(f).omit({coordinates:!0,name:!0}),tt=J.partial().required(h).required({imageUrl:!0}).omit(f),he=e.discriminatedUnion("type",[X,V,Y,ee,te,oe,tt,re,ne]),Ko=B.omit({coordinates:!0}),_o=Z.omit({coordinates:!0}),Qo=D.omit({coordinates:!0}),$o=W.omit({coordinates:!0}),Jo=K.omit({coordinates:!0}),Xo=_.omit({coordinates:!0}),Yo=Q.omit({coordinates:!0}),er=$.omit({coordinates:!0}),tr=J.omit({coordinates:!0}),or=et.omit({coordinates:!0}),S={type:!0,id:!0},ot=B.partial().required(S),rt=Z.partial().required(S),nt=D.partial().required(S),at=W.partial().required(S),it=K.partial().required(S),st=_.partial().required(S),lt=Q.partial().required(S).omit({coordinates:!0,name:!0}),pt=$.partial().required(S).omit({coordinates:!0,name:!0}),mt=J.partial().required(S),fe=e.discriminatedUnion("type",[ot,rt,nt,at,it,st,lt,pt,mt]),Se=e.object({ids:e.array(e.string()).optional()}),xe=e.object({ids:e.array(e.string()).optional()});var ct=t("getElement",y.string()),gt=t("getElementGeometry",y.string()),dt=t("getElements",Se.optional()),yt=t("getElementGroup",y.string()),ut=t("getElementGroups",xe.optional()),ht=t("setElementGroupVisibility",G),ft=M("onElementChange",y.object({id:y.string()})),St=s("onElementCreate"),xt=M("onElementDelete",y.object({id:y.string()})),Mt=M("onElementGroupChange",y.object({id:y.string()})),bt=t("createElement",he),Lt=t("updateElement",fe),Ct=t("deleteElement",y.string()),Me={methods:[ct,gt,dt,yt,ut,ht,bt,Lt,Ct],listeners:[ft,St,xt,Mt]};var It=s("onPointerClick"),Gt=s("onPointerMove"),be={methods:null,listeners:[It,Gt]};import{z as l}from"zod";import{z as r}from"zod";var Et=r.enum(["in","ni"]),Tt=r.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),gr=r.enum(["and","or"]),Le=r.union([r.number(),r.string(),r.boolean(),r.null()]),Ce=r.string().or(r.null()),zt=r.tuple([Ce,Et,r.array(Le).or(r.null())]),Pt=r.tuple([Ce,Tt,Le]),ae=r.union([zt,Pt]),ie=r.tuple([r.lazy(()=>r.union([ie,ae,r.null(),r.boolean()])),r.enum(["and","or"]),r.lazy(()=>r.union([ie,ae,r.null(),r.boolean()]))]),E=r.union([ie,ae,r.null(),r.boolean()]);import{z as o}from"zod";var Ie=o.enum(["avg","max","min","sum","median"]),Ft=o.object({method:Ie,attribute:o.string()}),kt=o.object({methods:o.array(o.union([Ie,o.literal("count")])),attribute:o.string().optional()}),O=o.union([I,ge,o.array(b)]),Ge=o.object({boundary:O.optional(),filters:E.optional(),aggregation:Ft.optional()}),Ee=o.object({layerId:o.string(),attribute:o.string(),limit:o.number().optional(),boundary:O.optional(),filters:E.optional(),values:Ge.optional()}),fr=o.object({key:o.union([o.number(),o.string(),o.boolean()]),value:o.number().nullable()}),vt=o.object({type:o.literal("equal-intervals"),count:o.number()}),wt=o.object({type:o.literal("time-interval"),interval:o.enum(["hour","day","week","month","year"])}),Te=o.object({layerId:o.string(),attribute:o.string(),steps:o.union([vt,wt,o.array(o.number())]),boundary:O.optional(),filters:E.optional(),values:Ge.optional()}),Sr=o.object({min:o.number(),max:o.number(),value:o.number()}),ze=o.object({layerId:o.string(),boundary:O.optional(),filters:E.optional(),aggregation:kt});import{z as i}from"zod";var Lr=i.enum(["processing","completed","failed","incomplete"]),Pe=i.object({ids:i.array(i.string()).optional()}),Fe=i.object({ids:i.array(i.string()).optional()}),z=i.object({id:i.string(),layerId:i.string()}),ke=i.object({ids:z.array().optional(),layerIds:i.string().array().optional()}),ve=i.object({layerIds:i.array(i.string()).optional(),areaQuery:i.union([i.object({coordinates:v}),i.object({boundary:I})]).optional()});var Vt=t("getLayer",l.string()),Ot=t("getLayers",Pe.optional()),Ut=t("setLayerVisibility",G),Rt=M("onLayerChange",l.object({id:l.string()})),Nt=t("setLayerStyle",l.object({id:l.string(),style:l.object({}).passthrough()})),jt=t("setLayerLegendVisibility",G),qt=t("getLayerGroup",l.string()),At=t("getLayerGroups",Fe.optional()),Ht=t("setLayerGroupVisibility",G),Bt=t("setLayerGroupLegendVisibility",G),Zt=M("onLayerGroupChange",l.object({id:l.string()})),Dt=t("getLegendItem",z),Wt=t("getLegendItems",ke.optional()),Kt=M("onLegendItemChange",z),_t=t("setLegendItemVisibility",l.object({show:z.array().optional(),hide:z.array().optional()})),Qt=t("getLayerFilters",l.string()),$t=t("setLayerFilters",l.object({layerId:l.string(),filters:E,note:l.string().optional()})),Jt=t("getRenderedFeatures",ve.optional()),Xt=t("getCategoryData",Ee),Yt=t("getHistogramData",Te),eo=t("getAggregates",ze),we={methods:[Vt,Ot,Ut,Nt,jt,qt,At,Ht,Bt,Dt,Wt,_t,Qt,$t,Jt,Xt,Yt,eo],listeners:[Rt,Zt,Kt]};import{z as to}from"zod";var oo=t("getMapDetails",to.undefined()),Ve={methods:[oo],listeners:[]};import{z as U}from"zod";import{z as C}from"zod";var Oe=C.object({id:C.string().or(C.number()),layerId:C.string(),showPopup:C.boolean().optional(),fitViewport:C.boolean().or(C.object({maxZoom:C.number()})).optional()});var ro=t("getSelection",U.undefined()),no=s("onSelectionChange"),ao=t("selectFeature",Oe),io=t("clearSelection",U.object({features:U.boolean().optional(),elements:U.boolean().optional()}).optional()),Ue={methods:[ro,ao,io],listeners:[no]};import{z as fo}from"zod";import{z as m}from"zod";var Re=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Ne=m.enum([...Re,"link"]),je=m.enum(Re),so=X.pick({color:!0,symbol:!0,frame:!0}).required(),lo=V.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),po=V.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),mo=Y.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),co=ee.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),go=te.pick({color:!0,opacity:!0,size:!0}).required(),yo=oe.pick({color:!0,opacity:!0}).extend({size:m.number().min(0).max(200)}).required(),uo=re.pick({color:!0,align:!0,style:!0}).required(),ho=ne.pick({color:!0,align:!0,style:!0}).required(),qe=m.discriminatedUnion("tool",[so.partial().extend({tool:m.literal("pin")}),lo.partial().extend({tool:m.literal("line")}),po.partial().extend({tool:m.literal("route")}),mo.partial().extend({tool:m.literal("polygon")}),co.partial().extend({tool:m.literal("circle")}),go.partial().extend({tool:m.literal("marker")}),yo.partial().extend({tool:m.literal("highlighter")}),uo.partial().extend({tool:m.literal("text")}),ho.partial().extend({tool:m.literal("note")})]);var So=t("setTool",Ne.nullable()),xo=t("getTool",fo.undefined()),Mo=s("onToolChange"),bo=t("setToolSettings",qe),Lo=t("getToolSettings",je),Co=s("onToolSettingsChange"),Ae={methods:[So,xo,bo,Lo],listeners:[Mo,Co]};import{z as c}from"zod";var He=c.object({showLegend:c.boolean().optional(),cooperativeGestures:c.boolean().optional(),fullScreenButton:c.boolean().optional(),geolocation:c.boolean().optional(),zoomControls:c.boolean().optional(),scaleBar:c.boolean().optional()}),Be=c.object({featureSelectPanel:c.boolean().optional(),featureHoverPanel:c.boolean().optional(),elementSelectPanel:c.boolean().optional(),linkClickOpen:c.boolean().optional(),imageLightboxOpen:c.boolean().optional()});var Io=t("updateUiControls",He),Go=t("setOnMapInteractionsUi",Be),Ze={methods:[Io,Go],listeners:null};import{z as _e}from"zod";import{z as N}from"zod";var R=N.object({center:v,zoom:de}),De=N.object({center:R.shape.center.optional(),zoom:R.shape.zoom.optional()}),We=N.object({minZoom:R.shape.zoom.nullish(),maxZoom:R.shape.zoom.nullish(),bounds:I.nullish()}).nullable(),Ke=N.object({bounds:I});var Eo=t("getViewport",_e.undefined()),To=t("setViewport",De),zo=t("getViewportConstraints",_e.undefined()),Po=t("setViewportConstraints",We),Fo=t("fitViewportToBounds",Ke),ko=s("onViewportMove"),vo=s("onViewportMoveEnd"),wo=s("onMapIdle"),Qe={methods:[To,Eo,zo,Po,Fo],listeners:[ko,vo,wo]};var se=[Ze,Qe,we,Me,Ue,be,Ae,Ve];function fn(n,T,le){let j=new Map;async function pe(u){if(!jo.safeParse(u.data).success){le?.onUnknownMessage?.(u.data);return}let me=Je.safeParse(u.data);if(!me.success){le?.onInvalidMessage?.(u.data);return}let{data:p}=me;if(p.type==="felt.ready")u.ports[0]?.postMessage(!0);else if(p.type==="felt.addListener"){if(p.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let P="options"in p.event?{options:"options"in p.event?p.event.options:void 0,handler:A=>{u.ports[0]?.postMessage(A)}}:{handler:A=>{u.ports[0]?.postMessage(A)}},q=T.listeners[p.event.eventName](P);j.set(p.event.id,q)}else if(p.type==="felt.removeListener")j.get(p.id)?.(),j.delete(p.id);else try{let P=T.methods[p.type],q=await P(p.params);u.ports[0]?.postMessage(q)}catch(P){u.ports[0]?.postMessage({__error__:Vo(P)})}}return n.addEventListener("message",pe),()=>{n.removeEventListener("message",pe)}}function Vo(n){return n instanceof Error?n.message:typeof n=="object"&&n!==null&&"message"in n?String(n.message):typeof n=="string"?n:"Unknown error"}var $e={methods:se.map(n=>n.methods??[]).flat(),listeners:se.map(n=>n.listeners??[]).flat()},Oo=g.discriminatedUnion("eventName",[g.strictObject({eventName:g.literal("")}),...$e.listeners]),Uo=g.strictObject({type:g.literal("felt.addListener"),event:Oo}),Ro=g.strictObject({type:g.literal("felt.removeListener"),id:g.string()}),No=g.strictObject({type:g.literal("felt.ready")}),Je=g.discriminatedUnion("type",[No,Uo,Ro,...$e.methods]),jo=g.object({type:g.enum(Je.options.map(n=>n.shape.type.value))});export{fn as createMessageHandler};
|
|
1
|
+
import{z as g}from"zod";import{z as y}from"zod";import{z as x}from"zod";function t(a,T){return x.strictObject({type:x.literal(a),params:T})}function M(a,T){return x.strictObject({eventName:x.literal(a),id:x.string(),options:T})}function s(a){return x.strictObject({eventName:x.literal(a),id:x.string()})}import{z as n}from"zod";var F=n.number(),k=n.number(),w=n.object({latitude:k,longitude:F}),b=n.tuple([F,k]),me=n.object({type:n.literal("Point"),coordinates:b}),ce=n.object({type:n.literal("Polygon"),coordinates:n.array(n.array(b))}),et=n.object({type:n.literal("LineString"),coordinates:n.array(b)}),L=n.object({type:n.literal("MultiLineString"),coordinates:n.array(et.shape.coordinates)}),ge=n.number().min(1).max(23),I=n.tuple([F,k,F,k]),G=n.object({show:n.array(n.string()).optional(),hide:n.array(n.string()).optional()}),tt=n.enum(["asc","desc"]),de=n.object({attribute:n.string(),direction:tt});import{z as e}from"zod";var d=e.object({id:e.string(),groupId:e.string().nullable(),color:e.string(),name:e.union([e.string(),e.null()]),description:e.union([e.string(),e.null()]),attributes:e.record(e.string(),e.unknown())}),v=e.object({imageUrl:e.string().nullable()}),H=e.object({strokeOpacity:e.number(),strokeWidth:e.number(),strokeStyle:e.enum(["solid","dashed","dotted"])}),ot=e.enum(["meter","kilometer","foot","mile"]),ye=d.extend(v.shape).extend({type:e.literal("Place"),coordinates:me.shape.coordinates,symbol:e.string(),frame:e.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.boolean()}),B=d.extend(v.shape).extend(H.shape).extend({type:e.literal("Path"),coordinates:L.shape.coordinates,distanceMarker:e.boolean(),endCaps:e.boolean(),routingMode:e.enum(["driving","cycling","walking","flying"]).nullable()}),D=d.extend(v.shape).extend(H.shape).extend({type:e.literal("Polygon"),coordinates:L.shape.coordinates,fillOpacity:e.number().min(0).max(1),areaMarker:e.boolean()}),ue=d.extend(v.shape).extend(H.shape).extend({type:e.literal("Circle"),coordinates:b,radius:e.number(),radiusDisplayAngle:e.number(),radiusDisplayUnit:ot.nullable(),fillOpacity:e.number().min(0).max(1),radiusMarker:e.boolean()}),Z=d.extend({type:e.literal("Marker"),coordinates:L.shape.coordinates,opacity:e.number().min(0).max(1),size:e.number().min(0).max(100),zoom:e.number().min(0).max(23)}),W=d.extend({type:e.literal("Highlighter"),coordinates:L.shape.coordinates,opacity:e.number().min(0).max(1)}),he=e.object({position:b,rotation:e.number(),scale:e.number(),zoom:e.number().min(0).max(23),coordinates:L.shape.coordinates}),fe=e.object({text:e.string(),align:e.enum(["left","center","right"]),style:e.enum(["italic","light","regular","caps"]),name:e.string()}),K=d.extend(he.shape).extend(fe.shape).extend({type:e.literal("Text")}),_=d.extend(he.shape).extend(fe.shape).extend({type:e.literal("Note"),widthScale:e.number().min(0)}),Q=d.extend({type:e.literal("Image"),coordinates:L.shape.coordinates,imageUrl:e.string(),opacity:e.number().min(0).max(1)}).omit({color:!0}),rt=d.extend({type:e.literal("Link"),coordinates:L.shape.coordinates,url:e.string()}),h={type:!0,coordinates:!0},f={id:!0},$=ye.partial().required(h).omit(f),V=B.partial().required(h).omit(f),J=D.partial().required(h).omit(f),X=ue.partial().required(h).required({radius:!0}).omit(f),Y=Z.partial().required(h).omit(f),ee=W.partial().required(h).omit(f),te=K.partial().required(h).required({text:!0}).omit(f).omit({coordinates:!0,name:!0}),oe=_.partial().required(h).required({text:!0}).omit(f).omit({coordinates:!0,name:!0}),nt=Q.partial().required(h).required({imageUrl:!0}).omit(f),Se=e.discriminatedUnion("type",[$,V,J,X,Y,ee,nt,te,oe]);var Yo=B.omit({coordinates:!0}),er=D.omit({coordinates:!0});var tr=Z.omit({coordinates:!0}),or=W.omit({coordinates:!0}),rr=K.omit({coordinates:!0}),nr=_.omit({coordinates:!0}),ar=Q.omit({coordinates:!0}),ir=rt.omit({coordinates:!0}),S={type:!0,id:!0},at=ye.partial().required(S),it=B.partial().required(S),st=D.partial().required(S),lt=ue.partial().required(S),pt=Z.partial().required(S),mt=W.partial().required(S),ct=K.partial().required(S).omit({coordinates:!0,name:!0}),gt=_.partial().required(S).omit({coordinates:!0,name:!0}),dt=Q.partial().required(S),xe=e.discriminatedUnion("type",[at,it,st,lt,pt,mt,ct,gt,dt]),Me=e.object({ids:e.array(e.string()).optional()}),be=e.object({ids:e.array(e.string()).optional()});var yt=t("getElement",y.string()),ut=t("getElementGeometry",y.string()),ht=t("getElements",Me.optional()),ft=t("getElementGroup",y.string()),St=t("getElementGroups",be.optional()),xt=t("setElementGroupVisibility",G),Mt=M("onElementChange",y.object({id:y.string()})),bt=s("onElementCreate"),Lt=s("onElementCreateEnd"),Ct=M("onElementDelete",y.object({id:y.string()})),It=M("onElementGroupChange",y.object({id:y.string()})),Gt=t("createElement",Se),Et=t("updateElement",xe),Tt=t("deleteElement",y.string()),Le={methods:[yt,ut,ht,ft,St,xt,Gt,Et,Tt],listeners:[Mt,bt,Lt,Ct,It]};var zt=s("onPointerClick"),Pt=s("onPointerMove"),Ce={methods:null,listeners:[zt,Pt]};import{z as l}from"zod";import{z as r}from"zod";var Ft=r.enum(["in","ni"]),kt=r.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),hr=r.enum(["and","or"]),Ie=r.union([r.number(),r.string(),r.boolean(),r.null()]),Ge=r.string().or(r.null()),wt=r.tuple([Ge,Ft,r.array(Ie).or(r.null())]),vt=r.tuple([Ge,kt,Ie]),re=r.union([wt,vt]),ne=r.tuple([r.lazy(()=>r.union([ne,re,r.null(),r.boolean()])),r.enum(["and","or"]),r.lazy(()=>r.union([ne,re,r.null(),r.boolean()]))]),E=r.union([ne,re,r.null(),r.boolean()]);import{z as o}from"zod";var Ee=o.enum(["avg","max","min","sum","median"]),Vt=o.object({method:Ee,attribute:o.string()}),Ot=o.object({methods:o.array(o.union([Ee,o.literal("count")])),attribute:o.string().optional()}),O=o.union([I,ce,o.array(b)]),Te=o.object({boundary:O.optional(),filters:E.optional(),aggregation:Vt.optional()}),ze=o.object({layerId:o.string(),attribute:o.string(),limit:o.number().optional(),boundary:O.optional(),filters:E.optional(),values:Te.optional()}),br=o.object({key:o.union([o.number(),o.string(),o.boolean()]),value:o.number().nullable()}),Ut=o.object({type:o.literal("equal-intervals"),count:o.number()}),Rt=o.object({type:o.literal("time-interval"),interval:o.enum(["hour","day","week","month","year"])}),Pe=o.object({layerId:o.string(),attribute:o.string(),steps:o.union([Ut,Rt,o.array(o.number())]),boundary:O.optional(),filters:E.optional(),values:Te.optional()}),Lr=o.object({min:o.number(),max:o.number(),value:o.number()}),Fe=o.object({layerId:o.string(),boundary:O.optional(),filters:E.optional(),aggregation:Ot});import{z as i}from"zod";var Er=i.enum(["processing","completed","failed","incomplete"]),ke=i.object({ids:i.array(i.string()).optional()}),we=i.object({ids:i.array(i.string()).optional()}),z=i.object({id:i.string(),layerId:i.string()}),ve=i.object({ids:z.array().optional(),layerIds:i.string().array().optional()}),Ve=i.object({layerIds:i.array(i.string()).optional(),areaQuery:i.union([i.object({coordinates:w}),i.object({boundary:I})]).optional()});var Nt=t("getLayer",l.string()),jt=t("getLayers",ke.optional()),qt=t("setLayerVisibility",G),At=M("onLayerChange",l.object({id:l.string()})),Ht=t("setLayerStyle",l.object({id:l.string(),style:l.object({}).passthrough()})),Bt=t("setLayerLegendVisibility",G),Dt=t("getLayerGroup",l.string()),Zt=t("getLayerGroups",we.optional()),Wt=t("setLayerGroupVisibility",G),Kt=t("setLayerGroupLegendVisibility",G),_t=M("onLayerGroupChange",l.object({id:l.string()})),Qt=t("getLegendItem",z),$t=t("getLegendItems",ve.optional()),Jt=M("onLegendItemChange",z),Xt=t("setLegendItemVisibility",l.object({show:z.array().optional(),hide:z.array().optional()})),Yt=t("getLayerFilters",l.string()),eo=t("setLayerFilters",l.object({layerId:l.string(),filters:E,note:l.string().optional()})),to=t("getRenderedFeatures",Ve.optional()),oo=t("getCategoryData",ze),ro=t("getHistogramData",Pe),no=t("getAggregates",Fe),Oe={methods:[Nt,jt,qt,Ht,Bt,Dt,Zt,Wt,Kt,Qt,$t,Xt,Yt,eo,to,oo,ro,no],listeners:[At,_t,Jt]};import{z as ao}from"zod";var io=t("getMapDetails",ao.undefined()),Ue={methods:[io],listeners:[]};import{z as U}from"zod";import{z as C}from"zod";var Re=C.object({id:C.string().or(C.number()),layerId:C.string(),showPopup:C.boolean().optional(),fitViewport:C.boolean().or(C.object({maxZoom:C.number()})).optional()});var so=t("getSelection",U.undefined()),lo=s("onSelectionChange"),po=t("selectFeature",Re),mo=t("clearSelection",U.object({features:U.boolean().optional(),elements:U.boolean().optional()}).optional()),Ne={methods:[so,po,mo],listeners:[lo]};import{z as bo}from"zod";import{z as m}from"zod";var je=["pin","line","route","polygon","circle","marker","highlighter","text","note"],qe=m.enum([...je,"link"]),Ae=m.enum(je),co=$.pick({color:!0,symbol:!0,frame:!0}).required(),go=V.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),yo=V.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),uo=J.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),ho=X.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),fo=Y.pick({color:!0,opacity:!0,size:!0}).required(),So=ee.pick({color:!0,opacity:!0}).extend({size:m.number().min(0).max(200)}).required(),xo=te.pick({color:!0,align:!0,style:!0}).required(),Mo=oe.pick({color:!0,align:!0,style:!0}).required(),He=m.discriminatedUnion("tool",[co.partial().extend({tool:m.literal("pin")}),go.partial().extend({tool:m.literal("line")}),yo.partial().extend({tool:m.literal("route")}),uo.partial().extend({tool:m.literal("polygon")}),ho.partial().extend({tool:m.literal("circle")}),fo.partial().extend({tool:m.literal("marker")}),So.partial().extend({tool:m.literal("highlighter")}),xo.partial().extend({tool:m.literal("text")}),Mo.partial().extend({tool:m.literal("note")})]);var Lo=t("setTool",qe.nullable()),Co=t("getTool",bo.undefined()),Io=s("onToolChange"),Go=t("setToolSettings",He),Eo=t("getToolSettings",Ae),To=s("onToolSettingsChange"),Be={methods:[Lo,Co,Go,Eo],listeners:[Io,To]};import{z as ae}from"zod";import{z as c}from"zod";var De=c.object({showLegend:c.boolean().optional(),cooperativeGestures:c.boolean().optional(),fullScreenButton:c.boolean().optional(),geolocation:c.boolean().optional(),zoomControls:c.boolean().optional(),scaleBar:c.boolean().optional()}),Ze=c.object({featureSelectPanel:c.boolean().optional(),featureHoverPanel:c.boolean().optional(),elementSelectPanel:c.boolean().optional(),linkClickOpen:c.boolean().optional(),imageLightboxOpen:c.boolean().optional()});var zo=t("updateUiControls",De),Po=t("setOnMapInteractionsUi",Ze),Fo=t("showLayerDataTable",ae.object({layerId:ae.string(),sorting:de.optional()}).optional()),ko=t("hideLayerDataTable",ae.undefined()),We={methods:[zo,Po,Fo,ko],listeners:null};import{z as $e}from"zod";import{z as N}from"zod";var R=N.object({center:w,zoom:ge}),Ke=N.object({center:R.shape.center.optional(),zoom:R.shape.zoom.optional()}),_e=N.object({minZoom:R.shape.zoom.nullish(),maxZoom:R.shape.zoom.nullish(),bounds:I.nullish()}).nullable(),Qe=N.object({bounds:I});var wo=t("getViewport",$e.undefined()),vo=t("setViewport",Ke),Vo=t("getViewportConstraints",$e.undefined()),Oo=t("setViewportConstraints",_e),Uo=t("fitViewportToBounds",Qe),Ro=s("onViewportMove"),No=s("onViewportMoveEnd"),jo=s("onMapIdle"),Je={methods:[vo,wo,Vo,Oo,Uo],listeners:[Ro,No,jo]};var ie=[We,Je,Oe,Le,Ne,Ce,Be,Ue];function Cn(a,T,se){let j=new Map;async function le(u){if(!Zo.safeParse(u.data).success){se?.onUnknownMessage?.(u.data);return}let pe=Ye.safeParse(u.data);if(!pe.success){se?.onInvalidMessage?.(u.data);return}let{data:p}=pe;if(p.type==="felt.ready")u.ports[0]?.postMessage(!0);else if(p.type==="felt.addListener"){if(p.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let P="options"in p.event?{options:"options"in p.event?p.event.options:void 0,handler:A=>{u.ports[0]?.postMessage(A)}}:{handler:A=>{u.ports[0]?.postMessage(A)}},q=T.listeners[p.event.eventName](P);j.set(p.event.id,q)}else if(p.type==="felt.removeListener")j.get(p.id)?.(),j.delete(p.id);else try{let P=T.methods[p.type],q=await P(p.params);u.ports[0]?.postMessage(q)}catch(P){u.ports[0]?.postMessage({__error__:qo(P)})}}return a.addEventListener("message",le),()=>{a.removeEventListener("message",le)}}function qo(a){return a instanceof Error?a.message:typeof a=="object"&&a!==null&&"message"in a?String(a.message):typeof a=="string"?a:"Unknown error"}var Xe={methods:ie.map(a=>a.methods??[]).flat(),listeners:ie.map(a=>a.listeners??[]).flat()},Ao=g.discriminatedUnion("eventName",[g.strictObject({eventName:g.literal("")}),...Xe.listeners]),Ho=g.strictObject({type:g.literal("felt.addListener"),event:Ao}),Bo=g.strictObject({type:g.literal("felt.removeListener"),id:g.string()}),Do=g.strictObject({type:g.literal("felt.ready")}),Ye=g.discriminatedUnion("type",[Do,Ho,Bo,...Xe.methods]),Zo=g.object({type:g.enum(Ye.options.map(a=>a.shape.type.value))});export{Cn as createMessageHandler};
|