@feltmaps/js-sdk 1.4.0 → 1.5.0-next.1
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 +101 -5
- package/dist/client.d.ts +101 -5
- package/dist/client.js +1 -1
- package/dist/handler.cjs +1 -1
- package/dist/handler.d.cts +411 -6
- package/dist/handler.d.ts +411 -6
- package/dist/handler.js +1 -1
- package/dist/{types-BDviYZ-T.d.cts → types-CVxZMwC_.d.cts} +200 -1
- package/dist/{types-BDviYZ-T.d.ts → types-CVxZMwC_.d.ts} +200 -1
- package/handler.d.ts +411 -6
- package/handler.js +1 -1
- package/package.json +5 -5
- package/{types-BDviYZ-T.d.ts → types-CVxZMwC_.d.ts} +200 -1
package/dist/handler.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { z as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, h as LayerGroup, l as LegendItem, o as LayerFilters, q as Feature, g as LayerChangeCallbackParams, j as LayerGroupChangeCallbackParams, n as LegendItemChangeCallbackParams,
|
|
3
|
+
import { z as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, h as LayerGroup, l as LegendItem, o as LayerFilters, q as Feature, g as LayerChangeCallbackParams, j as LayerGroupChangeCallbackParams, n as LegendItemChangeCallbackParams, D as FilterTernary, r as EntityNode, T as ToolType, t as ToolSettingsMap, u as ToolSettingsChangeEvent, V as ViewportState, ab as UnionToIntersection, ac as PromiseOrNot } from './types-CVxZMwC_.js';
|
|
4
4
|
|
|
5
5
|
type Method<TRequest extends {
|
|
6
6
|
type: string;
|
|
@@ -289,6 +289,31 @@ declare const SetLayerStyleMessage: z.ZodObject<{
|
|
|
289
289
|
};
|
|
290
290
|
type: "setLayerStyle";
|
|
291
291
|
}>;
|
|
292
|
+
declare const SetLayerLegendVisibilityMessage: z.ZodObject<{
|
|
293
|
+
type: z.ZodLiteral<"setLayerLegendVisibility">;
|
|
294
|
+
params: z.ZodObject<{
|
|
295
|
+
show: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
296
|
+
hide: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
297
|
+
}, "strip", z.ZodTypeAny, {
|
|
298
|
+
show?: string[] | undefined;
|
|
299
|
+
hide?: string[] | undefined;
|
|
300
|
+
}, {
|
|
301
|
+
show?: string[] | undefined;
|
|
302
|
+
hide?: string[] | undefined;
|
|
303
|
+
}>;
|
|
304
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
305
|
+
params: {
|
|
306
|
+
show?: string[] | undefined;
|
|
307
|
+
hide?: string[] | undefined;
|
|
308
|
+
};
|
|
309
|
+
type: "setLayerLegendVisibility";
|
|
310
|
+
}, {
|
|
311
|
+
params: {
|
|
312
|
+
show?: string[] | undefined;
|
|
313
|
+
hide?: string[] | undefined;
|
|
314
|
+
};
|
|
315
|
+
type: "setLayerLegendVisibility";
|
|
316
|
+
}>;
|
|
292
317
|
declare const GetGroupMessage: z.ZodObject<{
|
|
293
318
|
type: z.ZodLiteral<"getLayerGroup">;
|
|
294
319
|
params: z.ZodString;
|
|
@@ -344,6 +369,31 @@ declare const SetLayerGroupVisibilityMessage: z.ZodObject<{
|
|
|
344
369
|
};
|
|
345
370
|
type: "setLayerGroupVisibility";
|
|
346
371
|
}>;
|
|
372
|
+
declare const SetLayerGroupLegendVisibilityMessage: z.ZodObject<{
|
|
373
|
+
type: z.ZodLiteral<"setLayerGroupLegendVisibility">;
|
|
374
|
+
params: z.ZodObject<{
|
|
375
|
+
show: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
376
|
+
hide: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
377
|
+
}, "strip", z.ZodTypeAny, {
|
|
378
|
+
show?: string[] | undefined;
|
|
379
|
+
hide?: string[] | undefined;
|
|
380
|
+
}, {
|
|
381
|
+
show?: string[] | undefined;
|
|
382
|
+
hide?: string[] | undefined;
|
|
383
|
+
}>;
|
|
384
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
385
|
+
params: {
|
|
386
|
+
show?: string[] | undefined;
|
|
387
|
+
hide?: string[] | undefined;
|
|
388
|
+
};
|
|
389
|
+
type: "setLayerGroupLegendVisibility";
|
|
390
|
+
}, {
|
|
391
|
+
params: {
|
|
392
|
+
show?: string[] | undefined;
|
|
393
|
+
hide?: string[] | undefined;
|
|
394
|
+
};
|
|
395
|
+
type: "setLayerGroupLegendVisibility";
|
|
396
|
+
}>;
|
|
347
397
|
declare const OnLayerGroupChangeMessage: z.ZodObject<{
|
|
348
398
|
eventName: z.ZodLiteral<"onLayerGroupChange">;
|
|
349
399
|
id: z.ZodString;
|
|
@@ -659,9 +709,11 @@ type LayersSchema = {
|
|
|
659
709
|
getLayers: Method<zInfer<typeof GetLayersMessage>, Array<Layer | null>>;
|
|
660
710
|
setLayerVisibility: Method<zInfer<typeof SetLayerVisibilityMessage>, void>;
|
|
661
711
|
setLayerStyle: Method<zInfer<typeof SetLayerStyleMessage>, void>;
|
|
712
|
+
setLayerLegendVisibility: Method<zInfer<typeof SetLayerLegendVisibilityMessage>, void>;
|
|
662
713
|
getLayerGroup: Method<zInfer<typeof GetGroupMessage>, LayerGroup | null>;
|
|
663
714
|
getLayerGroups: Method<zInfer<typeof GetGroupsMessage>, Array<LayerGroup | null>>;
|
|
664
715
|
setLayerGroupVisibility: Method<zInfer<typeof SetLayerGroupVisibilityMessage>, void>;
|
|
716
|
+
setLayerGroupLegendVisibility: Method<zInfer<typeof SetLayerGroupLegendVisibilityMessage>, void>;
|
|
665
717
|
getLegendItem: Method<zInfer<typeof GetLegendItemMessage>, LegendItem | null>;
|
|
666
718
|
getLegendItems: Method<zInfer<typeof GetLegendItemsMessage>, Array<LegendItem | null>>;
|
|
667
719
|
setLegendItemVisibility: Method<zInfer<typeof SetLegendItemVisibilityMessage>, void>;
|
|
@@ -773,6 +825,353 @@ type SelectionSchema = {
|
|
|
773
825
|
};
|
|
774
826
|
};
|
|
775
827
|
|
|
828
|
+
declare const SetToolMessage: z.ZodObject<{
|
|
829
|
+
type: z.ZodLiteral<"setTool">;
|
|
830
|
+
params: z.ZodNullable<z.ZodEnum<["pin", "line", "route", "polygon", "circle", "marker", "highlighter", "text", "note", "link"]>>;
|
|
831
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
832
|
+
params: "link" | "note" | "pin" | "line" | "route" | "polygon" | "circle" | "marker" | "highlighter" | "text" | null;
|
|
833
|
+
type: "setTool";
|
|
834
|
+
}, {
|
|
835
|
+
params: "link" | "note" | "pin" | "line" | "route" | "polygon" | "circle" | "marker" | "highlighter" | "text" | null;
|
|
836
|
+
type: "setTool";
|
|
837
|
+
}>;
|
|
838
|
+
declare const GetToolMessage: z.ZodObject<{
|
|
839
|
+
type: z.ZodLiteral<"getTool">;
|
|
840
|
+
params: z.ZodUndefined;
|
|
841
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
842
|
+
type: "getTool";
|
|
843
|
+
params?: undefined;
|
|
844
|
+
}, {
|
|
845
|
+
type: "getTool";
|
|
846
|
+
params?: undefined;
|
|
847
|
+
}>;
|
|
848
|
+
declare const SetToolSettingsMessage: z.ZodObject<{
|
|
849
|
+
type: z.ZodLiteral<"setToolSettings">;
|
|
850
|
+
params: z.ZodDiscriminatedUnion<"tool", [z.ZodObject<z.objectUtil.extendShape<{
|
|
851
|
+
color: z.ZodOptional<z.ZodString>;
|
|
852
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
853
|
+
frame: z.ZodOptional<z.ZodNullable<z.ZodEnum<["frame-circle", "frame-square"]>>>;
|
|
854
|
+
}, {
|
|
855
|
+
tool: z.ZodLiteral<"pin">;
|
|
856
|
+
}>, "strip", z.ZodTypeAny, {
|
|
857
|
+
tool: "pin";
|
|
858
|
+
symbol?: string | undefined;
|
|
859
|
+
color?: string | undefined;
|
|
860
|
+
frame?: "frame-circle" | "frame-square" | null | undefined;
|
|
861
|
+
}, {
|
|
862
|
+
tool: "pin";
|
|
863
|
+
symbol?: string | undefined;
|
|
864
|
+
color?: string | undefined;
|
|
865
|
+
frame?: "frame-circle" | "frame-square" | null | undefined;
|
|
866
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
867
|
+
color: z.ZodOptional<z.ZodString>;
|
|
868
|
+
strokeOpacity: z.ZodOptional<z.ZodNumber>;
|
|
869
|
+
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
870
|
+
strokeStyle: z.ZodOptional<z.ZodEnum<["solid", "dashed", "dotted"]>>;
|
|
871
|
+
distanceMarker: z.ZodOptional<z.ZodBoolean>;
|
|
872
|
+
}, {
|
|
873
|
+
tool: z.ZodLiteral<"line">;
|
|
874
|
+
}>, "strip", z.ZodTypeAny, {
|
|
875
|
+
tool: "line";
|
|
876
|
+
color?: string | undefined;
|
|
877
|
+
strokeOpacity?: number | undefined;
|
|
878
|
+
strokeWidth?: number | undefined;
|
|
879
|
+
strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
|
|
880
|
+
distanceMarker?: boolean | undefined;
|
|
881
|
+
}, {
|
|
882
|
+
tool: "line";
|
|
883
|
+
color?: string | undefined;
|
|
884
|
+
strokeOpacity?: number | undefined;
|
|
885
|
+
strokeWidth?: number | undefined;
|
|
886
|
+
strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
|
|
887
|
+
distanceMarker?: boolean | undefined;
|
|
888
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
889
|
+
color: z.ZodOptional<z.ZodString>;
|
|
890
|
+
routingMode: z.ZodOptional<z.ZodEnum<["driving", "cycling", "walking", "flying"]>>;
|
|
891
|
+
strokeOpacity: z.ZodOptional<z.ZodNumber>;
|
|
892
|
+
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
893
|
+
strokeStyle: z.ZodOptional<z.ZodEnum<["solid", "dashed", "dotted"]>>;
|
|
894
|
+
distanceMarker: z.ZodOptional<z.ZodBoolean>;
|
|
895
|
+
endCaps: z.ZodOptional<z.ZodBoolean>;
|
|
896
|
+
}, {
|
|
897
|
+
tool: z.ZodLiteral<"route">;
|
|
898
|
+
}>, "strip", z.ZodTypeAny, {
|
|
899
|
+
tool: "route";
|
|
900
|
+
color?: string | undefined;
|
|
901
|
+
strokeOpacity?: number | undefined;
|
|
902
|
+
strokeWidth?: number | undefined;
|
|
903
|
+
strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
|
|
904
|
+
distanceMarker?: boolean | undefined;
|
|
905
|
+
routingMode?: "driving" | "cycling" | "walking" | "flying" | undefined;
|
|
906
|
+
endCaps?: boolean | undefined;
|
|
907
|
+
}, {
|
|
908
|
+
tool: "route";
|
|
909
|
+
color?: string | undefined;
|
|
910
|
+
strokeOpacity?: number | undefined;
|
|
911
|
+
strokeWidth?: number | undefined;
|
|
912
|
+
strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
|
|
913
|
+
distanceMarker?: boolean | undefined;
|
|
914
|
+
routingMode?: "driving" | "cycling" | "walking" | "flying" | undefined;
|
|
915
|
+
endCaps?: boolean | undefined;
|
|
916
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
917
|
+
color: z.ZodOptional<z.ZodString>;
|
|
918
|
+
fillOpacity: z.ZodOptional<z.ZodNumber>;
|
|
919
|
+
strokeOpacity: z.ZodOptional<z.ZodNumber>;
|
|
920
|
+
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
921
|
+
strokeStyle: z.ZodOptional<z.ZodEnum<["solid", "dashed", "dotted"]>>;
|
|
922
|
+
areaMarker: z.ZodOptional<z.ZodBoolean>;
|
|
923
|
+
}, {
|
|
924
|
+
tool: z.ZodLiteral<"polygon">;
|
|
925
|
+
}>, "strip", z.ZodTypeAny, {
|
|
926
|
+
tool: "polygon";
|
|
927
|
+
color?: string | undefined;
|
|
928
|
+
strokeOpacity?: number | undefined;
|
|
929
|
+
strokeWidth?: number | undefined;
|
|
930
|
+
strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
|
|
931
|
+
fillOpacity?: number | undefined;
|
|
932
|
+
areaMarker?: boolean | undefined;
|
|
933
|
+
}, {
|
|
934
|
+
tool: "polygon";
|
|
935
|
+
color?: string | undefined;
|
|
936
|
+
strokeOpacity?: number | undefined;
|
|
937
|
+
strokeWidth?: number | undefined;
|
|
938
|
+
strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
|
|
939
|
+
fillOpacity?: number | undefined;
|
|
940
|
+
areaMarker?: boolean | undefined;
|
|
941
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
942
|
+
color: z.ZodOptional<z.ZodString>;
|
|
943
|
+
fillOpacity: z.ZodOptional<z.ZodNumber>;
|
|
944
|
+
strokeOpacity: z.ZodOptional<z.ZodNumber>;
|
|
945
|
+
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
946
|
+
strokeStyle: z.ZodOptional<z.ZodEnum<["solid", "dashed", "dotted"]>>;
|
|
947
|
+
radiusMarker: z.ZodOptional<z.ZodBoolean>;
|
|
948
|
+
}, {
|
|
949
|
+
tool: z.ZodLiteral<"circle">;
|
|
950
|
+
}>, "strip", z.ZodTypeAny, {
|
|
951
|
+
tool: "circle";
|
|
952
|
+
color?: string | undefined;
|
|
953
|
+
strokeOpacity?: number | undefined;
|
|
954
|
+
strokeWidth?: number | undefined;
|
|
955
|
+
strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
|
|
956
|
+
fillOpacity?: number | undefined;
|
|
957
|
+
radiusMarker?: boolean | undefined;
|
|
958
|
+
}, {
|
|
959
|
+
tool: "circle";
|
|
960
|
+
color?: string | undefined;
|
|
961
|
+
strokeOpacity?: number | undefined;
|
|
962
|
+
strokeWidth?: number | undefined;
|
|
963
|
+
strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
|
|
964
|
+
fillOpacity?: number | undefined;
|
|
965
|
+
radiusMarker?: boolean | undefined;
|
|
966
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
967
|
+
color: z.ZodOptional<z.ZodString>;
|
|
968
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
969
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
970
|
+
}, {
|
|
971
|
+
tool: z.ZodLiteral<"marker">;
|
|
972
|
+
}>, "strip", z.ZodTypeAny, {
|
|
973
|
+
tool: "marker";
|
|
974
|
+
color?: string | undefined;
|
|
975
|
+
opacity?: number | undefined;
|
|
976
|
+
size?: number | undefined;
|
|
977
|
+
}, {
|
|
978
|
+
tool: "marker";
|
|
979
|
+
color?: string | undefined;
|
|
980
|
+
opacity?: number | undefined;
|
|
981
|
+
size?: number | undefined;
|
|
982
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
983
|
+
color: z.ZodOptional<z.ZodString>;
|
|
984
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
985
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
986
|
+
}, {
|
|
987
|
+
tool: z.ZodLiteral<"highlighter">;
|
|
988
|
+
}>, "strip", z.ZodTypeAny, {
|
|
989
|
+
tool: "highlighter";
|
|
990
|
+
color?: string | undefined;
|
|
991
|
+
opacity?: number | undefined;
|
|
992
|
+
size?: number | undefined;
|
|
993
|
+
}, {
|
|
994
|
+
tool: "highlighter";
|
|
995
|
+
color?: string | undefined;
|
|
996
|
+
opacity?: number | undefined;
|
|
997
|
+
size?: number | undefined;
|
|
998
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
999
|
+
color: z.ZodOptional<z.ZodString>;
|
|
1000
|
+
align: z.ZodOptional<z.ZodEnum<["left", "center", "right"]>>;
|
|
1001
|
+
style: z.ZodOptional<z.ZodEnum<["italic", "light", "regular", "caps"]>>;
|
|
1002
|
+
}, {
|
|
1003
|
+
tool: z.ZodLiteral<"text">;
|
|
1004
|
+
}>, "strip", z.ZodTypeAny, {
|
|
1005
|
+
tool: "text";
|
|
1006
|
+
style?: "italic" | "light" | "regular" | "caps" | undefined;
|
|
1007
|
+
color?: string | undefined;
|
|
1008
|
+
align?: "center" | "left" | "right" | undefined;
|
|
1009
|
+
}, {
|
|
1010
|
+
tool: "text";
|
|
1011
|
+
style?: "italic" | "light" | "regular" | "caps" | undefined;
|
|
1012
|
+
color?: string | undefined;
|
|
1013
|
+
align?: "center" | "left" | "right" | undefined;
|
|
1014
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
1015
|
+
color: z.ZodOptional<z.ZodString>;
|
|
1016
|
+
align: z.ZodOptional<z.ZodEnum<["left", "center", "right"]>>;
|
|
1017
|
+
style: z.ZodOptional<z.ZodEnum<["italic", "light", "regular", "caps"]>>;
|
|
1018
|
+
}, {
|
|
1019
|
+
tool: z.ZodLiteral<"note">;
|
|
1020
|
+
}>, "strip", z.ZodTypeAny, {
|
|
1021
|
+
tool: "note";
|
|
1022
|
+
style?: "italic" | "light" | "regular" | "caps" | undefined;
|
|
1023
|
+
color?: string | undefined;
|
|
1024
|
+
align?: "center" | "left" | "right" | undefined;
|
|
1025
|
+
}, {
|
|
1026
|
+
tool: "note";
|
|
1027
|
+
style?: "italic" | "light" | "regular" | "caps" | undefined;
|
|
1028
|
+
color?: string | undefined;
|
|
1029
|
+
align?: "center" | "left" | "right" | undefined;
|
|
1030
|
+
}>]>;
|
|
1031
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
1032
|
+
params: {
|
|
1033
|
+
tool: "pin";
|
|
1034
|
+
symbol?: string | undefined;
|
|
1035
|
+
color?: string | undefined;
|
|
1036
|
+
frame?: "frame-circle" | "frame-square" | null | undefined;
|
|
1037
|
+
} | {
|
|
1038
|
+
tool: "line";
|
|
1039
|
+
color?: string | undefined;
|
|
1040
|
+
strokeOpacity?: number | undefined;
|
|
1041
|
+
strokeWidth?: number | undefined;
|
|
1042
|
+
strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
|
|
1043
|
+
distanceMarker?: boolean | undefined;
|
|
1044
|
+
} | {
|
|
1045
|
+
tool: "route";
|
|
1046
|
+
color?: string | undefined;
|
|
1047
|
+
strokeOpacity?: number | undefined;
|
|
1048
|
+
strokeWidth?: number | undefined;
|
|
1049
|
+
strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
|
|
1050
|
+
distanceMarker?: boolean | undefined;
|
|
1051
|
+
routingMode?: "driving" | "cycling" | "walking" | "flying" | undefined;
|
|
1052
|
+
endCaps?: boolean | undefined;
|
|
1053
|
+
} | {
|
|
1054
|
+
tool: "polygon";
|
|
1055
|
+
color?: string | undefined;
|
|
1056
|
+
strokeOpacity?: number | undefined;
|
|
1057
|
+
strokeWidth?: number | undefined;
|
|
1058
|
+
strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
|
|
1059
|
+
fillOpacity?: number | undefined;
|
|
1060
|
+
areaMarker?: boolean | undefined;
|
|
1061
|
+
} | {
|
|
1062
|
+
tool: "circle";
|
|
1063
|
+
color?: string | undefined;
|
|
1064
|
+
strokeOpacity?: number | undefined;
|
|
1065
|
+
strokeWidth?: number | undefined;
|
|
1066
|
+
strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
|
|
1067
|
+
fillOpacity?: number | undefined;
|
|
1068
|
+
radiusMarker?: boolean | undefined;
|
|
1069
|
+
} | {
|
|
1070
|
+
tool: "marker";
|
|
1071
|
+
color?: string | undefined;
|
|
1072
|
+
opacity?: number | undefined;
|
|
1073
|
+
size?: number | undefined;
|
|
1074
|
+
} | {
|
|
1075
|
+
tool: "highlighter";
|
|
1076
|
+
color?: string | undefined;
|
|
1077
|
+
opacity?: number | undefined;
|
|
1078
|
+
size?: number | undefined;
|
|
1079
|
+
} | {
|
|
1080
|
+
tool: "text";
|
|
1081
|
+
style?: "italic" | "light" | "regular" | "caps" | undefined;
|
|
1082
|
+
color?: string | undefined;
|
|
1083
|
+
align?: "center" | "left" | "right" | undefined;
|
|
1084
|
+
} | {
|
|
1085
|
+
tool: "note";
|
|
1086
|
+
style?: "italic" | "light" | "regular" | "caps" | undefined;
|
|
1087
|
+
color?: string | undefined;
|
|
1088
|
+
align?: "center" | "left" | "right" | undefined;
|
|
1089
|
+
};
|
|
1090
|
+
type: "setToolSettings";
|
|
1091
|
+
}, {
|
|
1092
|
+
params: {
|
|
1093
|
+
tool: "pin";
|
|
1094
|
+
symbol?: string | undefined;
|
|
1095
|
+
color?: string | undefined;
|
|
1096
|
+
frame?: "frame-circle" | "frame-square" | null | undefined;
|
|
1097
|
+
} | {
|
|
1098
|
+
tool: "line";
|
|
1099
|
+
color?: string | undefined;
|
|
1100
|
+
strokeOpacity?: number | undefined;
|
|
1101
|
+
strokeWidth?: number | undefined;
|
|
1102
|
+
strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
|
|
1103
|
+
distanceMarker?: boolean | undefined;
|
|
1104
|
+
} | {
|
|
1105
|
+
tool: "route";
|
|
1106
|
+
color?: string | undefined;
|
|
1107
|
+
strokeOpacity?: number | undefined;
|
|
1108
|
+
strokeWidth?: number | undefined;
|
|
1109
|
+
strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
|
|
1110
|
+
distanceMarker?: boolean | undefined;
|
|
1111
|
+
routingMode?: "driving" | "cycling" | "walking" | "flying" | undefined;
|
|
1112
|
+
endCaps?: boolean | undefined;
|
|
1113
|
+
} | {
|
|
1114
|
+
tool: "polygon";
|
|
1115
|
+
color?: string | undefined;
|
|
1116
|
+
strokeOpacity?: number | undefined;
|
|
1117
|
+
strokeWidth?: number | undefined;
|
|
1118
|
+
strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
|
|
1119
|
+
fillOpacity?: number | undefined;
|
|
1120
|
+
areaMarker?: boolean | undefined;
|
|
1121
|
+
} | {
|
|
1122
|
+
tool: "circle";
|
|
1123
|
+
color?: string | undefined;
|
|
1124
|
+
strokeOpacity?: number | undefined;
|
|
1125
|
+
strokeWidth?: number | undefined;
|
|
1126
|
+
strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
|
|
1127
|
+
fillOpacity?: number | undefined;
|
|
1128
|
+
radiusMarker?: boolean | undefined;
|
|
1129
|
+
} | {
|
|
1130
|
+
tool: "marker";
|
|
1131
|
+
color?: string | undefined;
|
|
1132
|
+
opacity?: number | undefined;
|
|
1133
|
+
size?: number | undefined;
|
|
1134
|
+
} | {
|
|
1135
|
+
tool: "highlighter";
|
|
1136
|
+
color?: string | undefined;
|
|
1137
|
+
opacity?: number | undefined;
|
|
1138
|
+
size?: number | undefined;
|
|
1139
|
+
} | {
|
|
1140
|
+
tool: "text";
|
|
1141
|
+
style?: "italic" | "light" | "regular" | "caps" | undefined;
|
|
1142
|
+
color?: string | undefined;
|
|
1143
|
+
align?: "center" | "left" | "right" | undefined;
|
|
1144
|
+
} | {
|
|
1145
|
+
tool: "note";
|
|
1146
|
+
style?: "italic" | "light" | "regular" | "caps" | undefined;
|
|
1147
|
+
color?: string | undefined;
|
|
1148
|
+
align?: "center" | "left" | "right" | undefined;
|
|
1149
|
+
};
|
|
1150
|
+
type: "setToolSettings";
|
|
1151
|
+
}>;
|
|
1152
|
+
declare const GetToolSettingsMessage: z.ZodObject<{
|
|
1153
|
+
type: z.ZodLiteral<"getToolSettings">;
|
|
1154
|
+
params: z.ZodEnum<["pin", "line", "route", "polygon", "circle", "marker", "highlighter", "text", "note"]>;
|
|
1155
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
1156
|
+
params: "note" | "pin" | "line" | "route" | "polygon" | "circle" | "marker" | "highlighter" | "text";
|
|
1157
|
+
type: "getToolSettings";
|
|
1158
|
+
}, {
|
|
1159
|
+
params: "note" | "pin" | "line" | "route" | "polygon" | "circle" | "marker" | "highlighter" | "text";
|
|
1160
|
+
type: "getToolSettings";
|
|
1161
|
+
}>;
|
|
1162
|
+
type ToolsSchema = {
|
|
1163
|
+
methods: {
|
|
1164
|
+
setTool: Method<zInfer<typeof SetToolMessage>, void>;
|
|
1165
|
+
getTool: Method<zInfer<typeof GetToolMessage>, ToolType | null>;
|
|
1166
|
+
setToolSettings: Method<zInfer<typeof SetToolSettingsMessage>, void>;
|
|
1167
|
+
getToolSettings: Method<zInfer<typeof GetToolSettingsMessage>, ToolSettingsMap[keyof ToolSettingsMap]>;
|
|
1168
|
+
};
|
|
1169
|
+
listeners: {
|
|
1170
|
+
onToolChange: Listener<void, ToolType | null>;
|
|
1171
|
+
onToolSettingsChange: Listener<void, ToolSettingsChangeEvent>;
|
|
1172
|
+
};
|
|
1173
|
+
};
|
|
1174
|
+
|
|
776
1175
|
declare const UiControlsMessage: zod.ZodObject<{
|
|
777
1176
|
type: zod.ZodLiteral<"updateUiControls">;
|
|
778
1177
|
params: zod.ZodObject<{
|
|
@@ -955,7 +1354,7 @@ type ViewportSchema = {
|
|
|
955
1354
|
};
|
|
956
1355
|
};
|
|
957
1356
|
|
|
958
|
-
type AllModules = UiSchema | ViewportSchema | LayersSchema | ElementsSchema | SelectionSchema | InteractionsSchema;
|
|
1357
|
+
type AllModules = UiSchema | ViewportSchema | LayersSchema | ElementsSchema | SelectionSchema | InteractionsSchema | ToolsSchema;
|
|
959
1358
|
|
|
960
1359
|
type FeltHandlers = {
|
|
961
1360
|
methods: FeltMethodHandlers;
|
|
@@ -963,16 +1362,21 @@ type FeltHandlers = {
|
|
|
963
1362
|
};
|
|
964
1363
|
type MethodSpec = UnionToIntersection<AllModules["methods"]>;
|
|
965
1364
|
type ListenerSpec = UnionToIntersection<AllModules["listeners"]>;
|
|
966
|
-
type ExtractMethodParams<T extends Record<string, {
|
|
1365
|
+
type ExtractMethodParams<T extends Record<string, AnyFunction | {
|
|
967
1366
|
request: {
|
|
968
1367
|
params?: any;
|
|
969
1368
|
};
|
|
970
1369
|
response: any;
|
|
971
1370
|
}>> = {
|
|
972
|
-
[K in keyof T]: {
|
|
1371
|
+
[K in keyof T]: T[K] extends {
|
|
1372
|
+
request: {
|
|
1373
|
+
params?: any;
|
|
1374
|
+
};
|
|
1375
|
+
response: any;
|
|
1376
|
+
} ? {
|
|
973
1377
|
request: T[K]["request"]["params"];
|
|
974
1378
|
response: T[K]["response"];
|
|
975
|
-
};
|
|
1379
|
+
} : T[K];
|
|
976
1380
|
};
|
|
977
1381
|
type ExtractListenerParams<T extends Record<string, {
|
|
978
1382
|
options: any;
|
|
@@ -983,8 +1387,9 @@ type ExtractListenerParams<T extends Record<string, {
|
|
|
983
1387
|
eventParams: T[K]["eventParams"];
|
|
984
1388
|
};
|
|
985
1389
|
};
|
|
1390
|
+
type AnyFunction = (...args: any[]) => any;
|
|
986
1391
|
type MethodHandlers<T> = {
|
|
987
|
-
[K in keyof T]: (request: T[K] extends {
|
|
1392
|
+
[K in keyof T]: T[K] extends AnyFunction ? T[K] : (request: T[K] extends {
|
|
988
1393
|
request: any;
|
|
989
1394
|
} ? T[K]["request"] : never) => PromiseOrNot<T[K] extends {
|
|
990
1395
|
response: any;
|
package/dist/handler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as
|
|
1
|
+
import{z as l}from"zod";import{z as f}from"zod";import{z as y}from"zod";function t(n,h){return y.strictObject({type:y.literal(n),params:h})}function d(n,h){return y.strictObject({eventName:y.literal(n),id:y.string(),options:h})}function p(n){return y.strictObject({eventName:y.literal(n),id:y.string()})}import{z as m}from"zod";var z=m.number(),F=m.number(),L=m.object({latitude:F,longitude:z}),j=m.number().min(1).max(23),x=m.tuple([z,F,z,F]),u=m.object({show:m.array(m.string()).optional(),hide:m.array(m.string()).optional()});import{z as S}from"zod";var N=S.object({ids:S.array(S.string()).optional()}),R=S.object({ids:S.array(S.string()).optional()});var ce=t("getElement",f.string()),ye=t("getElementGeometry",f.string()),ge=t("getElements",N.optional()),de=t("getElementGroup",f.string()),ue=t("getElementGroups",R.optional()),fe=t("setElementGroupVisibility",u),he=d("onElementChange",f.object({id:f.string()})),Se=d("onElementGroupChange",f.object({id:f.string()})),U={methods:[ce,ye,ge,de,ue,fe],listeners:[he,Se]};var be=p("onPointerClick"),Me=p("onPointerMove"),B={methods:null,listeners:[be,Me]};import{z as a}from"zod";import{z as o}from"zod";var Le=o.enum(["in","ni"]),xe=o.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Ut=o.enum(["and","or"]),Z=o.union([o.number(),o.string(),o.boolean(),o.null()]),A=o.string().or(o.null()),Ge=o.tuple([A,Le,o.array(Z).or(o.null())]),Ie=o.tuple([A,xe,Z]),E=o.union([Ge,Ie]),v=o.tuple([o.lazy(()=>o.union([v,E,o.null(),o.boolean()])),o.enum(["and","or"]),o.lazy(()=>o.union([v,E,o.null(),o.boolean()]))]),q=o.union([v,E,o.null(),o.boolean()]);import{z as r}from"zod";var qt=r.enum(["processing","completed","failed","incomplete"]),H=r.object({ids:r.array(r.string()).optional()}),W=r.object({ids:r.array(r.string()).optional()}),b=r.object({id:r.string(),layerId:r.string()}),K=r.object({ids:b.array().optional(),layerIds:r.string().array().optional()}),_=r.object({layerIds:r.array(r.string()).optional(),areaQuery:r.union([r.object({coordinates:L}),r.object({boundary:x})]).optional()});var Te=t("getLayer",a.string()),Ce=t("getLayers",H.optional()),ze=t("setLayerVisibility",u),Fe=d("onLayerChange",a.object({id:a.string()})),Ee=t("setLayerStyle",a.object({id:a.string(),style:a.object({}).passthrough()})),ve=t("setLayerLegendVisibility",u),we=t("getLayerGroup",a.string()),Pe=t("getLayerGroups",W.optional()),Ve=t("setLayerGroupVisibility",u),ke=t("setLayerGroupLegendVisibility",u),Oe=d("onLayerGroupChange",a.object({id:a.string()})),je=t("getLegendItem",b),Ne=t("getLegendItems",K.optional()),Re=d("onLegendItemChange",b),Ue=t("setLegendItemVisibility",a.object({show:b.array().optional(),hide:b.array().optional()})),Be=t("getLayerFilters",a.string()),Ze=t("setLayerFilters",a.object({layerId:a.string(),filters:q,note:a.string().optional()})),Ae=t("getRenderedFeatures",_.optional()),Q={methods:[Te,Ce,ze,Ee,ve,we,Pe,Ve,ke,je,Ne,Ue,Be,Ze,Ae],listeners:[Fe,Oe,Re]};import{z as G}from"zod";import{z as g}from"zod";var D=g.object({id:g.string().or(g.number()),layerId:g.string(),showPopup:g.boolean().optional(),fitViewport:g.boolean().or(g.object({maxZoom:g.number()})).optional()});var qe=t("getSelection",G.undefined()),He=p("onSelectionChange"),We=t("selectFeature",D),Ke=t("clearSelection",G.object({features:G.boolean().optional(),elements:G.boolean().optional()}).optional()),$={methods:[qe,We,Ke],listeners:[He]};import{z as ot}from"zod";import{z as e}from"zod";var J=["pin","line","route","polygon","circle","marker","highlighter","text","note"],X=e.enum([...J,"link"]),Y=e.enum(J),_e=e.object({color:e.string(),symbol:e.string(),frame:e.enum(["frame-circle","frame-square"]).nullable()}),Qe=e.object({color:e.string(),strokeOpacity:e.number(),strokeWidth:e.number(),strokeStyle:e.enum(["solid","dashed","dotted"]),distanceMarker:e.boolean()}),De=e.object({color:e.string(),routingMode:e.enum(["driving","cycling","walking","flying"]),strokeOpacity:e.number(),strokeWidth:e.number(),strokeStyle:e.enum(["solid","dashed","dotted"]),distanceMarker:e.boolean(),endCaps:e.boolean()}),$e=e.object({color:e.string(),fillOpacity:e.number().min(0).max(1),strokeOpacity:e.number().min(0).max(1),strokeWidth:e.number().min(0),strokeStyle:e.enum(["solid","dashed","dotted"]),areaMarker:e.boolean()}),Je=e.object({color:e.string(),fillOpacity:e.number().min(0).max(1),strokeOpacity:e.number().min(0).max(1),strokeWidth:e.number().min(0),strokeStyle:e.enum(["solid","dashed","dotted"]),radiusMarker:e.boolean()}),Xe=e.object({color:e.string(),opacity:e.number().min(0).max(1),size:e.number().min(0).max(100)}),Ye=e.object({color:e.string(),opacity:e.number().min(0).max(1),size:e.number().min(0).max(200)}),et=e.object({color:e.string(),align:e.enum(["left","center","right"]),style:e.enum(["italic","light","regular","caps"])}),tt=e.object({color:e.string(),align:e.enum(["left","center","right"]),style:e.enum(["italic","light","regular","caps"])}),ee=e.discriminatedUnion("tool",[_e.partial().extend({tool:e.literal("pin")}),Qe.partial().extend({tool:e.literal("line")}),De.partial().extend({tool:e.literal("route")}),$e.partial().extend({tool:e.literal("polygon")}),Je.partial().extend({tool:e.literal("circle")}),Xe.partial().extend({tool:e.literal("marker")}),Ye.partial().extend({tool:e.literal("highlighter")}),et.partial().extend({tool:e.literal("text")}),tt.partial().extend({tool:e.literal("note")})]);var nt=t("setTool",X.nullable()),rt=t("getTool",ot.undefined()),at=p("onToolChange"),it=t("setToolSettings",ee),st=t("getToolSettings",Y),lt=p("onToolSettingsChange"),te={methods:[nt,rt,it,st],listeners:[at,lt]};import{z as s}from"zod";var oe=s.object({showLegend:s.boolean().optional(),cooperativeGestures:s.boolean().optional(),fullScreenButton:s.boolean().optional(),geolocation:s.boolean().optional(),zoomControls:s.boolean().optional(),scaleBar:s.boolean().optional()}),ne=s.object({featureSelectPanel:s.boolean().optional(),featureHoverPanel:s.boolean().optional(),elementSelectPanel:s.boolean().optional(),linkClickOpen:s.boolean().optional(),imageLightboxOpen:s.boolean().optional()});var pt=t("updateUiControls",oe),mt=t("setOnMapInteractionsUi",ne),re={methods:[pt,mt],listeners:null};import{z as ct}from"zod";import{z as w}from"zod";var ae=w.object({center:L,zoom:j}),ie=w.object({center:ae.shape.center.optional(),zoom:ae.shape.zoom.optional()}),se=w.object({bounds:x});var yt=t("getViewport",ct.undefined()),gt=t("setViewport",ie),dt=t("fitViewportToBounds",se),ut=p("onViewportMove"),ft=p("onViewportMoveEnd"),ht=p("onMapIdle"),le={methods:[gt,yt,dt],listeners:[ut,ft,ht]};var P=[re,le,Q,U,$,B,te];function Po(n,h,V){let I=new Map;async function k(c){if(!Gt.safeParse(c.data).success){V?.onUnknownMessage?.(c.data);return}let O=me.safeParse(c.data);if(!O.success){V?.onInvalidMessage?.(c.data);return}let{data:i}=O;if(i.type==="felt.ready")c.ports[0]?.postMessage(!0);else if(i.type==="felt.addListener"){if(i.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let M="options"in i.event?{options:"options"in i.event?i.event.options:void 0,handler:C=>{c.ports[0]?.postMessage(C)}}:{handler:C=>{c.ports[0]?.postMessage(C)}},T=h.listeners[i.event.eventName](M);I.set(i.event.id,T)}else if(i.type==="felt.removeListener")I.get(i.id)?.(),I.delete(i.id);else try{let M=h.methods[i.type],T=await M(i.params);c.ports[0]?.postMessage(T)}catch(M){c.ports[0]?.postMessage({__error__:St(M)})}}return n.addEventListener("message",k),()=>{n.removeEventListener("message",k)}}function St(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 pe={methods:P.map(n=>n.methods??[]).flat(),listeners:P.map(n=>n.listeners??[]).flat()},bt=l.discriminatedUnion("eventName",[l.strictObject({eventName:l.literal("")}),...pe.listeners]),Mt=l.strictObject({type:l.literal("felt.addListener"),event:bt}),Lt=l.strictObject({type:l.literal("felt.removeListener"),id:l.string()}),xt=l.strictObject({type:l.literal("felt.ready")}),me=l.discriminatedUnion("type",[xt,Mt,Lt,...pe.methods]),Gt=l.object({type:l.enum(me.options.map(n=>n.shape.type.value))});export{Po as createMessageHandler};
|