@heycar/heycars-map 0.1.8 → 0.2.0

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.
Files changed (87) hide show
  1. package/README.md +30 -7
  2. package/dist/business-components/StartEndPoint/StartEndPoint.d.ts +18309 -4
  3. package/dist/components/AmapLoader/AmapLoader.d.ts +5 -20
  4. package/dist/components/AmapMarker/AmapMarker.d.ts +3 -2
  5. package/dist/components/Demo/HeycarDemo.d.ts +3 -3
  6. package/dist/components/Demo/searchResult.d.ts +1 -1
  7. package/dist/components/GmapAdvancedMarkerView/GmapAdvancedMarkerView.d.ts +3 -2
  8. package/dist/components/GmapLoader/GmapLoader.d.ts +3 -35
  9. package/dist/components/GmapMarker/GmapMarker.d.ts +3 -2
  10. package/dist/components/MapProvider/MapProvider.d.ts +4 -5
  11. package/dist/hooks/useGeoLocation.d.ts +2 -2
  12. package/dist/hooks/useMap.d.ts +801 -0
  13. package/dist/hooks/useMapAutoComplete.d.ts +4 -6
  14. package/dist/hooks/useMapCityBound.d.ts +5 -6
  15. package/dist/hooks/useMapEventSource.d.ts +5 -0
  16. package/dist/hooks/useMapFitView.d.ts +4599 -0
  17. package/dist/hooks/useMapLoader.d.ts +67 -0
  18. package/dist/hooks/useMapPlace.d.ts +4 -6
  19. package/dist/hooks/useMapRecomendPlace.d.ts +5 -797
  20. package/dist/hooks/useMapSupplier.d.ts +8 -0
  21. package/dist/hooks/useOverlay.d.ts +12 -0
  22. package/dist/hooks-business/useBusinessMapAutoComplete.d.ts +5 -6
  23. package/dist/hooks-business/useBusinessMapRecomendPlace.d.ts +4 -3
  24. package/dist/index.cjs +52 -52
  25. package/dist/index.d.ts +3 -1
  26. package/dist/index.js +1149 -920
  27. package/dist/types/interface.d.ts +4 -0
  28. package/package.json +1 -1
  29. package/src/App.tsx +1 -1
  30. package/src/api/place.ts +0 -2
  31. package/src/business-components/AddressBox/AddressBox.tsx +1 -1
  32. package/src/business-components/AddressLocator/AddressLocator.tsx +1 -1
  33. package/src/business-components/DrivingLine/DrivingLine.tsx +1 -1
  34. package/src/business-components/DrivingRoute/DrivingRoute.tsx +2 -3
  35. package/src/business-components/PassengerCircle/PassengerCircle.tsx +1 -1
  36. package/src/business-components/PlaceCircle/PlaceCircle.tsx +1 -1
  37. package/src/business-components/StartEndPoint/StartEndPoint.tsx +23 -7
  38. package/src/business-components/TaxiCar/TaxiCar.tsx +1 -1
  39. package/src/business-components/WalkingLine/WalkingLine.tsx +1 -1
  40. package/src/business-components/WalkingRoute/WalkingRoute.tsx +2 -3
  41. package/src/business-components/WaveCircle/WaveCircle.tsx +1 -1
  42. package/src/components/Amap/Amap.ts +1 -1
  43. package/src/components/AmapInfoWindow/AmapInfoWindow.ts +1 -1
  44. package/src/components/AmapLoader/AmapLoader.ts +6 -54
  45. package/src/components/AmapMarker/AmapMarker.ts +5 -2
  46. package/src/components/AmapPolygon/AmapPolygon.ts +1 -1
  47. package/src/components/AmapPolyline/AmapPolyline.ts +1 -1
  48. package/src/components/AmapText/AmapText.ts +1 -1
  49. package/src/components/Demo/Demo.css.ts +1 -1
  50. package/src/components/Demo/HeycarDemo.tsx +50 -33
  51. package/src/components/Demo/SearchDemo.tsx +40 -65
  52. package/src/components/Demo/searchResult.ts +12888 -1
  53. package/src/components/Gmap/Gmap.ts +17 -5
  54. package/src/components/GmapAdvancedMarkerView/GmapAdvancedMarkerView.ts +9 -4
  55. package/src/components/GmapInfoWindow/GmapInfoWindow.ts +1 -1
  56. package/src/components/GmapLoader/GmapLoader.ts +4 -62
  57. package/src/components/GmapMarker/GmapMarker.ts +5 -2
  58. package/src/components/GmapPolygon/GmapPolygon.ts +1 -1
  59. package/src/components/GmapPolyline/GmapPolyline.ts +1 -1
  60. package/src/components/MapProvider/MapProvider.tsx +33 -50
  61. package/src/hooks/useDrivingRoute.ts +1 -1
  62. package/src/hooks/useGeoLocation.ts +4 -2
  63. package/src/hooks/useHeycarMap.ts +1 -1
  64. package/src/hooks/useMap.ts +29 -0
  65. package/src/hooks/useMapAngle.ts +1 -1
  66. package/src/hooks/useMapAutoComplete.ts +16 -19
  67. package/src/hooks/useMapCityBound.ts +36 -24
  68. package/src/hooks/useMapDrag.ts +1 -1
  69. package/src/hooks/useMapEventSource.ts +20 -0
  70. package/src/hooks/useMapFitView.ts +127 -0
  71. package/src/hooks/useMapLoader.ts +164 -0
  72. package/src/hooks/useMapPlace.ts +20 -22
  73. package/src/hooks/useMapRecomendPlace.ts +18 -25
  74. package/src/{components/MapProvider → hooks}/useMapSupplier.ts +4 -7
  75. package/src/hooks/useOverlay.ts +22 -0
  76. package/src/hooks/useWalkingRoute.ts +1 -1
  77. package/src/hooks-business/useBusinessMapAutoComplete.ts +13 -8
  78. package/src/hooks-business/useBusinessMapRecomendPlace.ts +10 -10
  79. package/src/index.ts +3 -1
  80. package/src/types/interface.ts +5 -0
  81. package/dist/components/Amap/useAmap.d.ts +0 -399
  82. package/dist/components/Gmap/useGmap.d.ts +0 -5
  83. package/dist/components/MapProvider/useMapSupplier.d.ts +0 -11
  84. package/dist/hooks/useMapReady.d.ts +0 -4
  85. package/src/components/Amap/useAmap.ts +0 -9
  86. package/src/components/Gmap/useGmap.ts +0 -7
  87. package/src/hooks/useMapReady.ts +0 -14
@@ -0,0 +1,67 @@
1
+ import { load as loadAmap } from "@amap/amap-jsapi-loader";
2
+ import { LoaderOptions } from "@googlemaps/js-api-loader";
3
+ import { Ref } from "vue-demi";
4
+ import type { VueNode } from "../types/helper";
5
+ export declare const DEFAULT_AMAP_PLUGINS: AmapLoaderProps["plugins"];
6
+ export declare const DEFAULT_GMAP_LIBRARIES: LoaderOptions["libraries"];
7
+ export declare enum Status {
8
+ LOADING = "LOADING",
9
+ FAILURE = "FAILURE",
10
+ SUCCESS = "SUCCESS"
11
+ }
12
+ type AMapLoaderOptions = Parameters<typeof loadAmap>[0];
13
+ declare global {
14
+ interface Window {
15
+ _AMapSecurityConfig: {
16
+ securityJsCode?: string;
17
+ serviceHost?: string;
18
+ };
19
+ }
20
+ }
21
+ export interface AmapLoaderProps extends Pick<GmapLoaderProps, "fallback" | "loading" | "onChange">, Omit<AMapLoaderOptions, "key" | "version" | "plugins"> {
22
+ apiKey: string;
23
+ apiSecret?: string;
24
+ apiServiceHost?: string;
25
+ version?: string;
26
+ plugins?: `AMap.${AMap.PluginName}`[];
27
+ }
28
+ export declare const useAmapLoader: (props: AmapLoaderProps) => {
29
+ statusRef: import("vue-demi").ShallowRef<Status>;
30
+ readyPromise: Promise<undefined>;
31
+ };
32
+ export interface GmapLoaderProps extends LoaderOptions {
33
+ /**
34
+ * Render prop used to switch to loading component.
35
+ */
36
+ loading?: () => VueNode;
37
+ /**
38
+ * Render prop used to switch to error fallback component.
39
+ */
40
+ fallback?: () => VueNode;
41
+ /**
42
+ * Callback prop used to access `@googlemaps/js-api-loader` and `Status`.
43
+ *
44
+ * Note: The callback be executed multiple times in the lifecycle of the component.
45
+ */
46
+ onChange?: (status: Status) => void;
47
+ }
48
+ export declare const useGmapLoader: (props: GmapLoaderProps) => {
49
+ statusRef: import("vue-demi").ShallowRef<Status>;
50
+ readyPromise: Promise<undefined>;
51
+ };
52
+ export type MapSupplier = "gmap" | "amap";
53
+ export interface UseMapLoaderOutput {
54
+ statusRef: Ref<Status>;
55
+ readyPromise: Promise<undefined>;
56
+ }
57
+ export interface UseMapLoaderProps {
58
+ gmapKey: string;
59
+ amapKey: string;
60
+ amapSecret?: string;
61
+ amapServiceHost?: string;
62
+ supplier: MapSupplier;
63
+ language?: "en" | "zh";
64
+ onChange?: (status: Status) => any;
65
+ }
66
+ export declare const useMapLoader: (props: UseMapLoaderProps) => UseMapLoaderOutput;
67
+ export {};
@@ -1,12 +1,10 @@
1
- /// <reference types="google.maps" />
2
1
  import { Ref } from "vue-demi";
3
- import type { MapShallowRef, Place, Point } from "../types/interface";
4
- export interface UseMapPlaceProps<M = AMap.Map | google.maps.Map> {
2
+ import type { Place, Point } from "../types/interface";
3
+ export interface UseMapPlaceProps {
5
4
  pointRef: Ref<Point>;
6
- mapRef: MapShallowRef<M>;
7
5
  onChange?: (value: Place) => any;
8
6
  }
9
- export declare const useAmapPlace: (props: UseMapPlaceProps<AMap.Map>) => {
7
+ export declare const useAmapPlace: (props: UseMapPlaceProps) => {
10
8
  place: {
11
9
  lng: number;
12
10
  lat: number;
@@ -15,7 +13,7 @@ export declare const useAmapPlace: (props: UseMapPlaceProps<AMap.Map>) => {
15
13
  };
16
14
  updatePlace: () => void;
17
15
  };
18
- export declare const useGmapPlace: (props: UseMapPlaceProps<google.maps.Map>) => {
16
+ export declare const useGmapPlace: (props: UseMapPlaceProps) => {
19
17
  place: {
20
18
  lng: number;
21
19
  lat: number;