@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/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/handler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var v=Object.defineProperty;var
|
|
1
|
+
"use strict";var v=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var fe=Object.prototype.hasOwnProperty;var he=(o,a)=>{for(var h in a)v(o,h,{get:a[h],enumerable:!0})},Se=(o,a,h,L)=>{if(a&&typeof a=="object"||typeof a=="function")for(let u of ue(a))!fe.call(o,u)&&u!==h&&v(o,u,{get:()=>a[u],enumerable:!(L=de(a,u))||L.enumerable});return o};var be=o=>Se(v({},"__esModule",{value:!0}),o);var Pt={};he(Pt,{createMessageHandler:()=>Tt});module.exports=be(Pt);var l=require("zod");var f=require("zod");var g=require("zod");function t(o,a){return g.z.strictObject({type:g.z.literal(o),params:a})}function S(o,a){return g.z.strictObject({eventName:g.z.literal(o),id:g.z.string(),options:a})}function m(o){return g.z.strictObject({eventName:g.z.literal(o),id:g.z.string()})}var c=require("zod"),w=c.z.number(),P=c.z.number(),T=c.z.object({latitude:P,longitude:w}),N=c.z.number().min(1).max(23),C=c.z.tuple([w,P,w,P]),b=c.z.object({show:c.z.array(c.z.string()).optional(),hide:c.z.array(c.z.string()).optional()});var M=require("zod"),R=M.z.object({ids:M.z.array(M.z.string()).optional()}),U=M.z.object({ids:M.z.array(M.z.string()).optional()});var Me=t("getElement",f.z.string()),Le=t("getElementGeometry",f.z.string()),xe=t("getElements",R.optional()),Ge=t("getElementGroup",f.z.string()),Ie=t("getElementGroups",U.optional()),Te=t("setElementGroupVisibility",b),Ce=S("onElementChange",f.z.object({id:f.z.string()})),ze=S("onElementGroupChange",f.z.object({id:f.z.string()})),B={methods:[Me,Le,xe,Ge,Ie,Te],listeners:[Ce,ze]};var Fe=m("onPointerClick"),Ee=m("onPointerMove"),Z={methods:null,listeners:[Fe,Ee]};var i=require("zod");var n=require("zod"),ve=n.z.enum(["in","ni"]),we=n.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Ht=n.z.enum(["and","or"]),A=n.z.union([n.z.number(),n.z.string(),n.z.boolean(),n.z.null()]),q=n.z.string().or(n.z.null()),Pe=n.z.tuple([q,ve,n.z.array(A).or(n.z.null())]),Ve=n.z.tuple([q,we,A]),V=n.z.union([Pe,Ve]),k=n.z.tuple([n.z.lazy(()=>n.z.union([k,V,n.z.null(),n.z.boolean()])),n.z.enum(["and","or"]),n.z.lazy(()=>n.z.union([k,V,n.z.null(),n.z.boolean()]))]),H=n.z.union([k,V,n.z.null(),n.z.boolean()]);var r=require("zod");var _t=r.z.enum(["processing","completed","failed","incomplete"]),W=r.z.object({ids:r.z.array(r.z.string()).optional()}),K=r.z.object({ids:r.z.array(r.z.string()).optional()}),x=r.z.object({id:r.z.string(),layerId:r.z.string()}),_=r.z.object({ids:x.array().optional(),layerIds:r.z.string().array().optional()}),Q=r.z.object({layerIds:r.z.array(r.z.string()).optional(),areaQuery:r.z.union([r.z.object({coordinates:T}),r.z.object({boundary:C})]).optional()});var ke=t("getLayer",i.z.string()),Oe=t("getLayers",W.optional()),je=t("setLayerVisibility",b),Ne=S("onLayerChange",i.z.object({id:i.z.string()})),Re=t("setLayerStyle",i.z.object({id:i.z.string(),style:i.z.object({}).passthrough()})),Ue=t("setLayerLegendVisibility",b),Be=t("getLayerGroup",i.z.string()),Ze=t("getLayerGroups",K.optional()),Ae=t("setLayerGroupVisibility",b),qe=t("setLayerGroupLegendVisibility",b),He=S("onLayerGroupChange",i.z.object({id:i.z.string()})),We=t("getLegendItem",x),Ke=t("getLegendItems",_.optional()),_e=S("onLegendItemChange",x),Qe=t("setLegendItemVisibility",i.z.object({show:x.array().optional(),hide:x.array().optional()})),De=t("getLayerFilters",i.z.string()),$e=t("setLayerFilters",i.z.object({layerId:i.z.string(),filters:H,note:i.z.string().optional()})),Je=t("getRenderedFeatures",Q.optional()),D={methods:[ke,Oe,je,Re,Ue,Be,Ze,Ae,qe,We,Ke,Qe,De,$e,Je],listeners:[Ne,He,_e]};var I=require("zod");var d=require("zod"),$=d.z.object({id:d.z.string().or(d.z.number()),layerId:d.z.string(),showPopup:d.z.boolean().optional(),fitViewport:d.z.boolean().or(d.z.object({maxZoom:d.z.number()})).optional()});var Xe=t("getSelection",I.z.undefined()),Ye=m("onSelectionChange"),et=t("selectFeature",$),tt=t("clearSelection",I.z.object({features:I.z.boolean().optional(),elements:I.z.boolean().optional()}).optional()),J={methods:[Xe,et,tt],listeners:[Ye]};var oe=require("zod");var e=require("zod"),X=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Y=e.z.enum([...X,"link"]),ee=e.z.enum(X),ot=e.z.object({color:e.z.string(),symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable()}),nt=e.z.object({color:e.z.string(),strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"]),distanceMarker:e.z.boolean()}),rt=e.z.object({color:e.z.string(),routingMode:e.z.enum(["driving","cycling","walking","flying"]),strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"]),distanceMarker:e.z.boolean(),endCaps:e.z.boolean()}),at=e.z.object({color:e.z.string(),fillOpacity:e.z.number().min(0).max(1),strokeOpacity:e.z.number().min(0).max(1),strokeWidth:e.z.number().min(0),strokeStyle:e.z.enum(["solid","dashed","dotted"]),areaMarker:e.z.boolean()}),it=e.z.object({color:e.z.string(),fillOpacity:e.z.number().min(0).max(1),strokeOpacity:e.z.number().min(0).max(1),strokeWidth:e.z.number().min(0),strokeStyle:e.z.enum(["solid","dashed","dotted"]),radiusMarker:e.z.boolean()}),st=e.z.object({color:e.z.string(),opacity:e.z.number().min(0).max(1),size:e.z.number().min(0).max(100)}),lt=e.z.object({color:e.z.string(),opacity:e.z.number().min(0).max(1),size:e.z.number().min(0).max(200)}),pt=e.z.object({color:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"])}),mt=e.z.object({color:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"])}),te=e.z.discriminatedUnion("tool",[ot.partial().extend({tool:e.z.literal("pin")}),nt.partial().extend({tool:e.z.literal("line")}),rt.partial().extend({tool:e.z.literal("route")}),at.partial().extend({tool:e.z.literal("polygon")}),it.partial().extend({tool:e.z.literal("circle")}),st.partial().extend({tool:e.z.literal("marker")}),lt.partial().extend({tool:e.z.literal("highlighter")}),pt.partial().extend({tool:e.z.literal("text")}),mt.partial().extend({tool:e.z.literal("note")})]);var ct=t("setTool",Y.nullable()),yt=t("getTool",oe.z.undefined()),gt=m("onToolChange"),dt=t("setToolSettings",te),ut=t("getToolSettings",ee),ft=m("onToolSettingsChange"),ne={methods:[ct,yt,dt,ut],listeners:[gt,ft]};var s=require("zod"),re=s.z.object({showLegend:s.z.boolean().optional(),cooperativeGestures:s.z.boolean().optional(),fullScreenButton:s.z.boolean().optional(),geolocation:s.z.boolean().optional(),zoomControls:s.z.boolean().optional(),scaleBar:s.z.boolean().optional()}),ae=s.z.object({featureSelectPanel:s.z.boolean().optional(),featureHoverPanel:s.z.boolean().optional(),elementSelectPanel:s.z.boolean().optional(),linkClickOpen:s.z.boolean().optional(),imageLightboxOpen:s.z.boolean().optional()});var ht=t("updateUiControls",re),St=t("setOnMapInteractionsUi",ae),ie={methods:[ht,St],listeners:null};var me=require("zod");var z=require("zod");var se=z.z.object({center:T,zoom:N}),le=z.z.object({center:se.shape.center.optional(),zoom:se.shape.zoom.optional()}),pe=z.z.object({bounds:C});var bt=t("getViewport",me.z.undefined()),Mt=t("setViewport",le),Lt=t("fitViewportToBounds",pe),xt=m("onViewportMove"),Gt=m("onViewportMoveEnd"),It=m("onMapIdle"),ce={methods:[Mt,bt,Lt],listeners:[xt,Gt,It]};var O=[ie,ce,D,B,J,Z,ne];function Tt(o,a,h){let L=new Map;async function u(y){if(!wt.safeParse(y.data).success){h?.onUnknownMessage?.(y.data);return}let j=ge.safeParse(y.data);if(!j.success){h?.onInvalidMessage?.(y.data);return}let{data:p}=j;if(p.type==="felt.ready")y.ports[0]?.postMessage(!0);else if(p.type==="felt.addListener"){if(p.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let G="options"in p.event?{options:"options"in p.event?p.event.options:void 0,handler:E=>{y.ports[0]?.postMessage(E)}}:{handler:E=>{y.ports[0]?.postMessage(E)}},F=a.listeners[p.event.eventName](G);L.set(p.event.id,F)}else if(p.type==="felt.removeListener")L.get(p.id)?.(),L.delete(p.id);else try{let G=a.methods[p.type],F=await G(p.params);y.ports[0]?.postMessage(F)}catch(G){y.ports[0]?.postMessage({__error__:Ct(G)})}}return o.addEventListener("message",u),()=>{o.removeEventListener("message",u)}}function Ct(o){return o instanceof Error?o.message:typeof o=="object"&&o!==null&&"message"in o?String(o.message):typeof o=="string"?o:"Unknown error"}var ye={methods:O.map(o=>o.methods??[]).flat(),listeners:O.map(o=>o.listeners??[]).flat()},zt=l.z.discriminatedUnion("eventName",[l.z.strictObject({eventName:l.z.literal("")}),...ye.listeners]),Ft=l.z.strictObject({type:l.z.literal("felt.addListener"),event:zt}),Et=l.z.strictObject({type:l.z.literal("felt.removeListener"),id:l.z.string()}),vt=l.z.strictObject({type:l.z.literal("felt.ready")}),ge=l.z.discriminatedUnion("type",[vt,Ft,Et,...ye.methods]),wt=l.z.object({type:l.z.enum(ge.options.map(o=>o.shape.type.value))});0&&(module.exports={createMessageHandler});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feltmaps/js-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0-next.1",
|
|
4
4
|
"description": "An SDK for Felt maps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"felt",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"prettier": "^3.3.3",
|
|
46
46
|
"prettier-plugin-organize-imports": "^4.1.0",
|
|
47
47
|
"tsup": "^8.3.0",
|
|
48
|
-
"typedoc": "^0.
|
|
49
|
-
"typedoc-plugin-markdown": "^4.
|
|
50
|
-
"typedoc-plugin-remark": "^1.
|
|
51
|
-
"typedoc-plugin-zod": "^1.
|
|
48
|
+
"typedoc": "^0.27.6",
|
|
49
|
+
"typedoc-plugin-markdown": "^4.4.1",
|
|
50
|
+
"typedoc-plugin-remark": "^1.2.4",
|
|
51
|
+
"typedoc-plugin-zod": "^1.3.1",
|
|
52
52
|
"typescript": "^5.6.2",
|
|
53
53
|
"vite-tsconfig-paths": "^5.0.1",
|
|
54
54
|
"vitest": "^2.1.2",
|