@feltmaps/js-sdk 1.5.0-next.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.
@@ -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, A as FilterTernary, r as EntityNode, V as ViewportState, X as UnionToIntersection, Y as PromiseOrNot } from './types-BDviYZ-T.cjs';
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_.cjs';
4
4
 
5
5
  type Method<TRequest extends {
6
6
  type: string;
@@ -825,6 +825,353 @@ type SelectionSchema = {
825
825
  };
826
826
  };
827
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
+
828
1175
  declare const UiControlsMessage: zod.ZodObject<{
829
1176
  type: zod.ZodLiteral<"updateUiControls">;
830
1177
  params: zod.ZodObject<{
@@ -1007,7 +1354,7 @@ type ViewportSchema = {
1007
1354
  };
1008
1355
  };
1009
1356
 
1010
- type AllModules = UiSchema | ViewportSchema | LayersSchema | ElementsSchema | SelectionSchema | InteractionsSchema;
1357
+ type AllModules = UiSchema | ViewportSchema | LayersSchema | ElementsSchema | SelectionSchema | InteractionsSchema | ToolsSchema;
1011
1358
 
1012
1359
  type FeltHandlers = {
1013
1360
  methods: FeltMethodHandlers;
@@ -1015,16 +1362,21 @@ type FeltHandlers = {
1015
1362
  };
1016
1363
  type MethodSpec = UnionToIntersection<AllModules["methods"]>;
1017
1364
  type ListenerSpec = UnionToIntersection<AllModules["listeners"]>;
1018
- type ExtractMethodParams<T extends Record<string, {
1365
+ type ExtractMethodParams<T extends Record<string, AnyFunction | {
1019
1366
  request: {
1020
1367
  params?: any;
1021
1368
  };
1022
1369
  response: any;
1023
1370
  }>> = {
1024
- [K in keyof T]: {
1371
+ [K in keyof T]: T[K] extends {
1372
+ request: {
1373
+ params?: any;
1374
+ };
1375
+ response: any;
1376
+ } ? {
1025
1377
  request: T[K]["request"]["params"];
1026
1378
  response: T[K]["response"];
1027
- };
1379
+ } : T[K];
1028
1380
  };
1029
1381
  type ExtractListenerParams<T extends Record<string, {
1030
1382
  options: any;
@@ -1035,8 +1387,9 @@ type ExtractListenerParams<T extends Record<string, {
1035
1387
  eventParams: T[K]["eventParams"];
1036
1388
  };
1037
1389
  };
1390
+ type AnyFunction = (...args: any[]) => any;
1038
1391
  type MethodHandlers<T> = {
1039
- [K in keyof T]: (request: T[K] extends {
1392
+ [K in keyof T]: T[K] extends AnyFunction ? T[K] : (request: T[K] extends {
1040
1393
  request: any;
1041
1394
  } ? T[K]["request"] : never) => PromiseOrNot<T[K] extends {
1042
1395
  response: any;