@heycar/heycars-map 2.0.0-switchMap3 → 2.0.0-switchMap5

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 (75) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/v2/Demo/DemoBusinessRecomendPlace.js +1 -1
  4. package/dist/v2/api/pingConnection.d.ts +9 -0
  5. package/dist/v2/api/pingConnection.js +107 -0
  6. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +1 -1
  7. package/dist/v2/business-components/BusinessRecomendPlaceMap/index.js +1 -1
  8. package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +1 -1
  9. package/dist/v2/chunks/{BusinessRecomendPlaceMap.f589ebf7.js → BusinessRecomendPlaceMap.4b641c71.js} +6 -3
  10. package/dist/v2/chunks/{Loading.da68a2a6.js → Loading.492acbc2.js} +10 -12
  11. package/dist/v2/components/Loading/Loading.css.d.ts +2 -2
  12. package/dist/v2/components/Loading/Loading.js +3 -3
  13. package/dist/v2/components/Loading/index.js +3 -3
  14. package/dist/v2/components/MapProvider/MapProvider.js +13 -10
  15. package/dist/v2/css/{Loading-0e058b68.css → Loading-49e58ced.css} +6 -11
  16. package/dist/v2/hooks/useDeviceOrientation.js +17 -1
  17. package/dist/v2/hooks/useMapGCJ02.js +0 -3
  18. package/dist/v2/hooks/useMapGeometry.d.ts +1 -3
  19. package/dist/v2/hooks/useMapGeometry.js +4 -4
  20. package/dist/v2/hooks/useMapLoader.d.ts +4 -2
  21. package/dist/v2/hooks/useMapLoader.js +110 -85
  22. package/dist/v2/hooks/useMapPlace.js +42 -35
  23. package/dist/v2/hooks/useMapRecomendPlace.js +4 -4
  24. package/dist/v2/hooks/useMapSupplier.d.ts +2 -0
  25. package/dist/v2/hooks/usePingConnection.d.ts +10 -0
  26. package/dist/v2/hooks/usePingConnection.js +26 -0
  27. package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.js +1 -1
  28. package/dist/v2/index.js +1 -1
  29. package/dist/v2/types/global.d.ts +3 -0
  30. package/dist/v2/types/interface.d.ts +1 -1
  31. package/dist/v2/utils/helper.d.ts +1 -0
  32. package/dist/v2/utils/helper.js +12 -0
  33. package/dist/v2/utils/log.js +1 -1
  34. package/dist/v3/Demo/DemoBusinessRecomendPlace.js +1 -1
  35. package/dist/v3/api/pingConnection.d.ts +9 -0
  36. package/dist/v3/api/pingConnection.js +107 -0
  37. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +1 -1
  38. package/dist/v3/business-components/BusinessRecomendPlaceMap/index.js +1 -1
  39. package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +1 -1
  40. package/dist/v3/chunks/{BusinessRecomendPlaceMap.86e9c287.js → BusinessRecomendPlaceMap.4befb6c7.js} +6 -3
  41. package/dist/v3/chunks/{Loading.98d687c0.js → Loading.21d8e759.js} +10 -12
  42. package/dist/v3/components/Loading/Loading.css.d.ts +2 -2
  43. package/dist/v3/components/Loading/Loading.js +3 -3
  44. package/dist/v3/components/Loading/index.js +3 -3
  45. package/dist/v3/components/MapProvider/MapProvider.js +13 -10
  46. package/dist/v3/css/{Loading-0e058b68.css → Loading-49e58ced.css} +6 -11
  47. package/dist/v3/hooks/useDeviceOrientation.js +17 -1
  48. package/dist/v3/hooks/useMapGCJ02.js +0 -3
  49. package/dist/v3/hooks/useMapGeometry.d.ts +1 -3
  50. package/dist/v3/hooks/useMapGeometry.js +4 -4
  51. package/dist/v3/hooks/useMapLoader.d.ts +4 -2
  52. package/dist/v3/hooks/useMapLoader.js +110 -85
  53. package/dist/v3/hooks/useMapPlace.js +42 -35
  54. package/dist/v3/hooks/useMapRecomendPlace.js +4 -4
  55. package/dist/v3/hooks/useMapSupplier.d.ts +2 -0
  56. package/dist/v3/hooks/usePingConnection.d.ts +10 -0
  57. package/dist/v3/hooks/usePingConnection.js +26 -0
  58. package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.js +1 -1
  59. package/dist/v3/index.js +1 -1
  60. package/dist/v3/types/global.d.ts +3 -0
  61. package/dist/v3/types/interface.d.ts +1 -1
  62. package/dist/v3/utils/helper.d.ts +1 -0
  63. package/dist/v3/utils/helper.js +12 -0
  64. package/dist/v3/utils/log.js +1 -1
  65. package/package.json +1 -1
  66. package/dist/v2/api/googleConnection.d.ts +0 -5
  67. package/dist/v2/api/googleConnection.js +0 -51
  68. package/dist/v2/chunks/throttle.8bdd8d3b.js +0 -20
  69. package/dist/v2/hooks/useGoogleConnection.d.ts +0 -7
  70. package/dist/v2/hooks/useGoogleConnection.js +0 -15
  71. package/dist/v3/api/googleConnection.d.ts +0 -5
  72. package/dist/v3/api/googleConnection.js +0 -51
  73. package/dist/v3/chunks/throttle.8bdd8d3b.js +0 -20
  74. package/dist/v3/hooks/useGoogleConnection.d.ts +0 -7
  75. package/dist/v3/hooks/useGoogleConnection.js +0 -15
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./v3"
1
+ export * from "./v2"
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export * from "./v3"
1
+ export * from "./v2"
@@ -1,5 +1,5 @@
1
1
  import { h } from "vue";
2
- import { B as BusinessRecomendPlaceMap } from "../chunks/BusinessRecomendPlaceMap.f589ebf7.js";
2
+ import { B as BusinessRecomendPlaceMap } from "../chunks/BusinessRecomendPlaceMap.4b641c71.js";
3
3
  import { useBusinessRecomendPlaceMap } from "../hooks-business/useBusinessRecomendPlaceMap.js";
4
4
  import { defineSetup } from "../types/helper.js";
5
5
  import { d as demo } from "../chunks/Demo.css.e921a2f6.js";
@@ -0,0 +1,9 @@
1
+ import type { ConnectionStatus } from "../types/interface";
2
+ export type PingConnectionOnChangeHandler = (status: ConnectionStatus) => void;
3
+ export type PingConnectionOnChangeCleanup = () => void;
4
+ export declare const apiGetPingAmapStatus: () => ConnectionStatus;
5
+ export declare const apiGetPingGmapStatus: () => ConnectionStatus;
6
+ export declare const apiPingAmap: () => Promise<ConnectionStatus>;
7
+ export declare const apiPingGmap: () => Promise<ConnectionStatus>;
8
+ export declare const apiSubscribePingAmapChange: (handler: PingConnectionOnChangeHandler) => PingConnectionOnChangeCleanup;
9
+ export declare const apiSubscribePingGmapChange: (handler: PingConnectionOnChangeHandler) => PingConnectionOnChangeCleanup;
@@ -0,0 +1,107 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import { sleep } from "../utils/helper.js";
8
+ const PING_AMAP_URL = "https://webapi.amap.com/favicon.ico";
9
+ const PING_AMAP_TIMEOUT = 5e3;
10
+ const PING_AMAP_INTERVAL = 5e3;
11
+ const PING_GMAP_URL = "https://maps.googleapis.com/";
12
+ const PING_GMAP_TIMEOUT = 5e3;
13
+ const PING_GMAP_INTERVAL = 5e3;
14
+ const noop = () => {
15
+ };
16
+ const toUncachableUrl = (url, label = "") => {
17
+ const parsedUrl = new URL(url);
18
+ const randomKey = `ping${Date.now()}`;
19
+ parsedUrl.searchParams.set(randomKey, label);
20
+ return parsedUrl.toString();
21
+ };
22
+ class PingConnection {
23
+ constructor({ timeout, url }) {
24
+ __publicField(this, "timeout");
25
+ __publicField(this, "url");
26
+ __publicField(this, "status", "pending");
27
+ __publicField(this, "listeners", /* @__PURE__ */ new Set());
28
+ __publicField(this, "updatingPromise");
29
+ this.timeout = timeout;
30
+ this.url = url;
31
+ }
32
+ // 只有订阅了 onChange 事件,listen 才会更新状态
33
+ async listen(interval) {
34
+ while (true) {
35
+ if (this.listeners.size > 0)
36
+ await this.updateStatus();
37
+ await sleep(interval);
38
+ }
39
+ }
40
+ async updateStatus() {
41
+ const { url, timeout } = this;
42
+ if (this.updatingPromise)
43
+ return this.updatingPromise;
44
+ return this.updatingPromise = this.check(url, timeout).then((status) => {
45
+ this.status = status;
46
+ this.updatingPromise = void 0;
47
+ for (const handler of this.listeners) {
48
+ try {
49
+ handler(status);
50
+ } catch (err) {
51
+ console.error(err);
52
+ }
53
+ }
54
+ return status;
55
+ });
56
+ }
57
+ check(url, timeout) {
58
+ const controller = new AbortController();
59
+ const timer = setTimeout(() => controller.abort(), timeout);
60
+ return fetch(toUncachableUrl(url, timeout.toString()), {
61
+ signal: controller.signal,
62
+ method: "HEAD",
63
+ mode: "no-cors"
64
+ }).then(() => "connected").catch(() => "unconnected").finally(() => clearTimeout(timer));
65
+ }
66
+ onChange(handler) {
67
+ if (typeof handler !== "function")
68
+ return noop;
69
+ this.listeners.add(handler);
70
+ const clear = () => {
71
+ this.listeners.delete(handler);
72
+ };
73
+ return clear;
74
+ }
75
+ }
76
+ const pingAmapConnection = new PingConnection({
77
+ timeout: PING_AMAP_TIMEOUT,
78
+ url: PING_AMAP_URL
79
+ });
80
+ const pingGmapConnection = new PingConnection({
81
+ timeout: PING_GMAP_TIMEOUT,
82
+ url: PING_GMAP_URL
83
+ });
84
+ pingAmapConnection.listen(PING_AMAP_INTERVAL);
85
+ pingGmapConnection.listen(PING_GMAP_INTERVAL);
86
+ const apiGetPingAmapStatus = () => {
87
+ return pingAmapConnection.status;
88
+ };
89
+ const apiGetPingGmapStatus = () => {
90
+ return pingGmapConnection.status;
91
+ };
92
+ const apiPingAmap = () => {
93
+ return pingAmapConnection.updateStatus();
94
+ };
95
+ const apiPingGmap = () => {
96
+ return pingGmapConnection.updateStatus();
97
+ };
98
+ const apiSubscribePingAmapChange = (handler) => pingAmapConnection.onChange(handler);
99
+ const apiSubscribePingGmapChange = (handler) => pingGmapConnection.onChange(handler);
100
+ export {
101
+ apiGetPingAmapStatus,
102
+ apiGetPingGmapStatus,
103
+ apiPingAmap,
104
+ apiPingGmap,
105
+ apiSubscribePingAmapChange,
106
+ apiSubscribePingGmapChange
107
+ };
@@ -26,7 +26,7 @@ import "../GreenZone/GreenZone.js";
26
26
  import "../PassengerCircle/PassengerCircle.js";
27
27
  import "../PickupPoints/PickupPoints.js";
28
28
  import "./useCacheCenterPlace.js";
29
- import { B, f, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.f589ebf7.js";
29
+ import { B, f, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.4b641c71.js";
30
30
  export {
31
31
  B as BusinessRecomendPlaceMap,
32
32
  f as BusinessRecomendPlaceMapInner,
@@ -1,4 +1,4 @@
1
- import { B, f, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.f589ebf7.js";
1
+ import { B, f, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.4b641c71.js";
2
2
  export {
3
3
  B as BusinessRecomendPlaceMap,
4
4
  f as BusinessRecomendPlaceMapInner,
@@ -20,7 +20,7 @@ import { detectBrowserPlatform } from "../../utils/platform.js";
20
20
  import { place2point, isPlaceEqual, pipeOnlyLastEffect, isZoneEqual, geoPositionError2businessTimeout } from "../../utils/transform.js";
21
21
  import { toCoordinatePlaceType, toCoordinatePointType, toCoordinateRecommendZonePlacesType } from "../../utils/typeChecking.js";
22
22
  import { AbsoluteAddressBox } from "../AbsoluteAddressBox/AbsoluteAddressBox.js";
23
- import { E as EMPTY_PLACE, m as memoize, R as RECOMMEND_PLACE_LARGE_LIMIT, a as RECOMMEND_PLACE_DRAG_LIMIT, Z as ZONE_ZOOM, b as RECOMMEND_PLACE_ZONE_ICON_MIN, c as RECOMMEND_PLACE_ICON_ZOOM_MIN, d as RECOMMEND_PLACE_ZONE_TEXT_MIN, e as RECOMMEND_PLACE_TEXT_ZOOM_MIN, D as DEFAULT_ZOOM } from "../../chunks/BusinessRecomendPlaceMap.f589ebf7.js";
23
+ import { E as EMPTY_PLACE, m as memoize, R as RECOMMEND_PLACE_LARGE_LIMIT, a as RECOMMEND_PLACE_DRAG_LIMIT, Z as ZONE_ZOOM, b as RECOMMEND_PLACE_ZONE_ICON_MIN, c as RECOMMEND_PLACE_ICON_ZOOM_MIN, d as RECOMMEND_PLACE_ZONE_TEXT_MIN, e as RECOMMEND_PLACE_TEXT_ZOOM_MIN, D as DEFAULT_ZOOM } from "../../chunks/BusinessRecomendPlaceMap.4b641c71.js";
24
24
  import { DeviceOrientation } from "../DeviceOrientation/DeviceOrientation.js";
25
25
  import { GreenZone } from "../GreenZone/GreenZone.js";
26
26
  import { PassengerCircle } from "../PassengerCircle/PassengerCircle.js";
@@ -316,7 +316,8 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
316
316
  defaultValue: DEFAULT_ZOOM
317
317
  });
318
318
  const {
319
- readyPromise
319
+ readyPromise,
320
+ supplier
320
321
  } = useMapSupplier();
321
322
  const {
322
323
  assertSupplier
@@ -400,7 +401,8 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
400
401
  if (!isFirstLoad)
401
402
  return;
402
403
  const [lng, lat] = value.position;
403
- await readyPromise;
404
+ if (supplier === "amap")
405
+ await readyPromise;
404
406
  centerSource.source = "geo";
405
407
  centerPlace.lng = lng;
406
408
  centerPlace.lat = lat;
@@ -410,7 +412,8 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
410
412
  emit("loadDefaultGeoLocation", coordinatifyGeoPosition(value));
411
413
  if (!isFirstLoad)
412
414
  return;
413
- await readyPromise;
415
+ if (supplier === "amap")
416
+ await readyPromise;
414
417
  centerSource.source = "geo";
415
418
  updatePlace(value.position);
416
419
  },
@@ -1,17 +1,17 @@
1
- import "../css/Loading-0e058b68.css";
1
+ import "../css/Loading-49e58ced.css";
2
2
  import { h } from "vue";
3
3
  import { ICON_LOAD_FAILED_URL } from "../api/cdn.js";
4
4
  import { AbsoluteAddressBox } from "../business-components/AbsoluteAddressBox/AbsoluteAddressBox.js";
5
5
  import { defineSetup } from "../types/helper.js";
6
6
  const imgGrid = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzg1IiBoZWlnaHQ9IjgxNyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBzdHJva2U9IiNEOERCRTIiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc3Ryb2tlLWRhc2hhcnJheT0iMSI+PHBhdGggZD0iTS41IDgxN1YwTTI0LjUgODE3VjBNNDguNSA4MTdWME03Mi41IDgxN1YwTTk2LjUgODE3VjBNMTIwLjUgODE3VjBNMTQ0LjUgODE3VjBNMTY4LjUgODE3VjBNMTkyLjUgODE3VjBNMjE2LjUgODE3VjBNMjQwLjUgODE3VjBNMjY0LjUgODE3VjBNMjg4LjUgODE3VjBNMzEyLjUgODE3VjBNMzM2LjUgODE3VjBNMzYwLjUgODE3VjBNMzg0LjUgODE3VjBNMCAuNWgzODVNMCAyNC41aDM4NU0wIDQ4LjVoMzg1TTAgNzIuNWgzODVNMCA5Ni41aDM4NU0wIDEyMC41aDM4NU0wIDE0NC41aDM4NU0wIDE2OC41aDM4NU0wIDE5Mi41aDM4NU0wIDIxNi41aDM4NU0wIDI0MC41aDM4NU0wIDI2NC41aDM4NU0wIDI4OC41aDM4NU0wIDMxMi41aDM4NU0wIDMzNi41aDM4NU0wIDM2MC41aDM4NU0wIDM4NC41aDM4NU0wIDQwOC41aDM4NU0wIDQzMi41aDM4NU0wIDQ1Ni41aDM4NU0wIDQ4MC41aDM4NU0wIDUwNC41aDM4NU0wIDUyOC41aDM4NU0wIDU1Mi41aDM4NU0wIDU3Ni41aDM4NU0wIDYwMC41aDM4NU0wIDYyNC41aDM4NU0wIDY0OC41aDM4NU0wIDY3Mi41aDM4NU0wIDY5Ni41aDM4NU0wIDcyMC41aDM4NU0wIDc0NC41aDM4NU0wIDc2OC41aDM4NU0wIDc5Mi41aDM4NU0wIDgxNi41aDM4NSIvPjwvZz48L3N2Zz4=";
7
7
  const Loading_css_ts_vanilla = "";
8
+ var contentLayout = "_17ify492";
8
9
  var description = "_17ify496";
9
- var iconLayout = "_17ify492";
10
10
  var iconLoadFailed = "_17ify493";
11
11
  var loadingBg = "_17ify491";
12
12
  var loadingLayout = "_17ify490";
13
- var textLayout = "_17ify494";
14
13
  var title = "_17ify495";
14
+ var verticalGap = "_17ify494";
15
15
  const Loading = defineSetup("Loading", function() {
16
16
  return () => h("div", {
17
17
  "class": loadingLayout
@@ -36,22 +36,20 @@ const LoadFailed = defineSetup("LoadFailed", function(props) {
36
36
  "src": imgGrid
37
37
  }
38
38
  }), h("div", {
39
- "class": iconLayout
39
+ "class": contentLayout
40
40
  }, [h("img", {
41
41
  "class": iconLoadFailed,
42
42
  "attrs": {
43
43
  "src": ICON_LOAD_FAILED_URL
44
44
  }
45
- }), h("div", {
46
- "class": textLayout
47
- }, [h("span", {
48
- "class": title
45
+ }), h("span", {
46
+ "class": `${title} ${verticalGap}`
49
47
  }, [props.title]), h("span", {
50
- "class": description
51
- }, [props.description])])])]);
48
+ "class": `${description} ${verticalGap}`
49
+ }, [props.description])])]);
52
50
  });
53
51
  export {
54
- Loading as L,
55
- LoadFailed as a,
52
+ LoadFailed as L,
53
+ Loading as a,
56
54
  imgGrid as i
57
55
  };
@@ -1,7 +1,7 @@
1
1
  export declare const loadingLayout: string;
2
2
  export declare const loadingBg: string;
3
- export declare const iconLayout: string;
3
+ export declare const contentLayout: string;
4
4
  export declare const iconLoadFailed: string;
5
- export declare const textLayout: string;
5
+ export declare const verticalGap: string;
6
6
  export declare const title: string;
7
7
  export declare const description: string;
@@ -1,9 +1,9 @@
1
1
  import "vue";
2
2
  import "../../api/cdn.js";
3
- import { a, L } from "../../chunks/Loading.da68a2a6.js";
3
+ import { L, a } from "../../chunks/Loading.492acbc2.js";
4
4
  import "../../business-components/AbsoluteAddressBox/AbsoluteAddressBox.js";
5
5
  import "../../types/helper.js";
6
6
  export {
7
- a as LoadFailed,
8
- L as Loading
7
+ L as LoadFailed,
8
+ a as Loading
9
9
  };
@@ -1,5 +1,5 @@
1
- import { a, L } from "../../chunks/Loading.da68a2a6.js";
1
+ import { L, a } from "../../chunks/Loading.492acbc2.js";
2
2
  export {
3
- a as LoadFailed,
4
- L as Loading
3
+ L as LoadFailed,
4
+ a as Loading
5
5
  };
@@ -1,6 +1,6 @@
1
1
  import "../../css/MapProvider-156bfd53.css";
2
2
  import { h } from "vue";
3
- import { L as Loading, a as LoadFailed, i as imgGrid } from "../../chunks/Loading.da68a2a6.js";
3
+ import { L as LoadFailed, a as Loading, i as imgGrid } from "../../chunks/Loading.492acbc2.js";
4
4
  import { useMapLoader, Status } from "../../hooks/useMapLoader.js";
5
5
  import { provideMapSupplier, useMapSupplier } from "../../hooks/useMapSupplier.js";
6
6
  import { defineLagecySetup } from "../../types/helper.js";
@@ -26,6 +26,8 @@ const MapProvider = defineLagecySetup("MapProvider", function(props, {
26
26
  get(target, name, receiver) {
27
27
  if (name === "status")
28
28
  return payload.statusRef.value;
29
+ if (name === "pingStatus")
30
+ return payload.pingStatusRef.value;
29
31
  if (name === "readyPromise")
30
32
  return payload.readyPromise;
31
33
  return Reflect.get(target, name, receiver);
@@ -70,7 +72,8 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
70
72
  gmapId,
71
73
  gmapRasterId,
72
74
  language = "zh",
73
- status
75
+ status,
76
+ pingStatus
74
77
  } = payload;
75
78
  const {
76
79
  mapRef: setMap,
@@ -79,14 +82,10 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
79
82
  touchEnable = true,
80
83
  touchZoomCenter
81
84
  } = props;
82
- if (status === Status.LOADING) {
83
- const node = (_a = slots.loading) == null ? void 0 : _a.call(slots);
84
- return node ? h("div", [node]) : h(Loading);
85
- }
86
- if (status === Status.FAILURE || status === Status.TIMEOUT) {
87
- const node = (_b = slots.fallback) == null ? void 0 : _b.call(slots);
88
- const title = (_c = payload.renderLoadFailedTitle) == null ? void 0 : _c.call(payload, status);
89
- const description = (_d = payload.renderLoadFailedDescription) == null ? void 0 : _d.call(payload, status);
85
+ if (status === Status.FAILURE || pingStatus === "unconnected") {
86
+ const node = (_a = slots.fallback) == null ? void 0 : _a.call(slots);
87
+ const title = (_b = payload.renderLoadFailedTitle) == null ? void 0 : _b.call(payload, status);
88
+ const description = (_c = payload.renderLoadFailedDescription) == null ? void 0 : _c.call(payload, status);
90
89
  return node ? h("div", [node]) : h(LoadFailed, {
91
90
  "attrs": {
92
91
  "title": title,
@@ -94,6 +93,10 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
94
93
  }
95
94
  });
96
95
  }
96
+ if (status === Status.LOADING || status === Status.SUCCESS && pingStatus === "pending") {
97
+ const node = (_d = slots.loading) == null ? void 0 : _d.call(slots);
98
+ return node ? h("div", [node]) : h(Loading);
99
+ }
97
100
  const children = (_e = slots.default) == null ? void 0 : _e.call(slots);
98
101
  const outArea = (_f = slots.outerArea) == null ? void 0 : _f.call(slots);
99
102
  const mapId = patchGmapIdForAlipayCompatible({
@@ -3,6 +3,7 @@
3
3
  background-color: #EDF1F5;
4
4
  }
5
5
  ._17ify491 {
6
+ position: absolute;
6
7
  width: 100%;
7
8
  height: 100%;
8
9
  object-fit: cover;
@@ -10,29 +11,24 @@
10
11
  ._17ify492 {
11
12
  position: absolute;
12
13
  margin: auto;
13
- top: 0;
14
+ top: -5vh;
14
15
  left: 0;
15
16
  right: 0;
16
17
  bottom: 0;
17
18
  width: fit-content;
18
19
  height: fit-content;
20
+ display: flex;
21
+ flex-direction: column;
22
+ align-items: center;
19
23
  }
20
24
  ._17ify493 {
21
25
  width: 40.8vw;
22
26
  height: 24.53vw;
23
27
  }
24
28
  ._17ify494 {
25
- position: absolute;
26
- top: 100%;
27
- display: flex;
28
- flex-direction: column;
29
- align-items: center;
30
- width: max-content;
31
- left: 50%;
32
- transform: translate(-50%, 0);
29
+ margin-top: 1.6vw;
33
30
  }
34
31
  ._17ify495 {
35
- margin-top: 1.6vw;
36
32
  font-family: var(--HEYCAR_MAP_CSS_VAR_FONT_REGULAR);
37
33
  font-weight: 500;
38
34
  font-size: 4vw;
@@ -40,7 +36,6 @@
40
36
  line-height: 6.4vw;
41
37
  }
42
38
  ._17ify496 {
43
- margin-top: 1.6vw;
44
39
  font-family: var(--HEYCAR_MAP_CSS_VAR_FONT_REGULAR);
45
40
  font-weight: 400;
46
41
  font-size: 3.73vw;
@@ -1,7 +1,23 @@
1
1
  import { reactive, watch } from "vue-demi";
2
2
  import { MINI_PROGRAM_WEB_VIEW_CLOSE_EVENT } from "../utils/patchMiniprogram.js";
3
3
  import { OS_PLATFORM, detectOSPlatform } from "../utils/platform.js";
4
- import { t as throttle } from "../chunks/throttle.8bdd8d3b.js";
4
+ import { i as isObject, d as debounce } from "../chunks/debounce.5afe7867.js";
5
+ var FUNC_ERROR_TEXT = "Expected a function";
6
+ function throttle(func, wait, options) {
7
+ var leading = true, trailing = true;
8
+ if (typeof func != "function") {
9
+ throw new TypeError(FUNC_ERROR_TEXT);
10
+ }
11
+ if (isObject(options)) {
12
+ leading = "leading" in options ? !!options.leading : leading;
13
+ trailing = "trailing" in options ? !!options.trailing : trailing;
14
+ }
15
+ return debounce(func, wait, {
16
+ "leading": leading,
17
+ "maxWait": wait,
18
+ "trailing": trailing
19
+ });
20
+ }
5
21
  const DEVICE_ORIENTATION_INTERVAL = 200;
6
22
  const CSS_DEVICE_ORIENTATION_VAR_PREFIX = "--CSS_DEVICE_ORIENTATION_VAR_ROTATION_DEGREE_";
7
23
  const useDeviceOrientation = (props) => {
@@ -565,7 +565,6 @@ const useAmapGCJ02 = () => {
565
565
  return { toCoordinateType, toGcj02, toGcj02Points, toLocalGcj02, toLocalGcj02Points };
566
566
  };
567
567
  const useGmapGCJ02 = () => {
568
- const { readyPromise } = useMapSupplier();
569
568
  const toCoordinateType = (p) => {
570
569
  return inChina(p) && !inHongkong(p) && !inMacau(p) ? "gcj02" : "wgs84";
571
570
  };
@@ -583,11 +582,9 @@ const useGmapGCJ02 = () => {
583
582
  };
584
583
  const toLocalGcj02Points = (points) => points.map(toLocalGcj02);
585
584
  const toGcj02 = async (point) => {
586
- await readyPromise;
587
585
  return toLocalGcj02Points([point])[0];
588
586
  };
589
587
  const toGcj02Points = async (points) => {
590
- await readyPromise;
591
588
  return toLocalGcj02Points(points);
592
589
  };
593
590
  return { toCoordinateType, toGcj02, toGcj02Points, toLocalGcj02, toLocalGcj02Points };
@@ -1,19 +1,17 @@
1
1
  import type { Point } from "../types/interface";
2
+ export declare const apiLocalIsPointInRing: (point: Point, path: Point[]) => boolean;
2
3
  export declare const useAmapGeometry: () => {
3
4
  apiMapDistance: (from: Point, to: Point) => number | undefined;
4
5
  apiMapDistanceToLine: (from: Point, line: Point[]) => number | undefined;
5
- apiMapIsPointInRing: (point: Point, path: Point[]) => boolean;
6
6
  apiMapDistanceOfLine: (line: Point[]) => number | undefined;
7
7
  };
8
8
  export declare const useGmapGeometry: () => {
9
9
  apiMapDistance: (from: Point, to: Point) => number | undefined;
10
10
  apiMapDistanceToLine: (from: Point, line: Point[]) => 0 | undefined;
11
- apiMapIsPointInRing: (point: Point, path: Point[]) => boolean;
12
11
  apiMapDistanceOfLine: (line: Point[]) => number | undefined;
13
12
  };
14
13
  export declare const useMapGeometry: () => {
15
14
  apiMapDistance: (from: Point, to: Point) => number | undefined;
16
15
  apiMapDistanceToLine: (from: Point, line: Point[]) => number | undefined;
17
- apiMapIsPointInRing: (point: Point, path: Point[]) => boolean;
18
16
  apiMapDistanceOfLine: (line: Point[]) => number | undefined;
19
17
  };
@@ -2,6 +2,7 @@ import { pointInPolygon } from "../utils/geometryPolygon.js";
2
2
  import { vec2lnglat } from "../utils/transform.js";
3
3
  import { Status } from "./useMapLoader.js";
4
4
  import { useMapSupplier } from "./useMapSupplier.js";
5
+ const apiLocalIsPointInRing = (point, path) => pointInPolygon(point, path) >= 0;
5
6
  const useAmapGeometry = () => {
6
7
  const payload = useMapSupplier();
7
8
  const apiMapDistance = (from, to) => {
@@ -19,8 +20,7 @@ const useAmapGeometry = () => {
19
20
  return void 0;
20
21
  return AMap.GeometryUtil.distanceOfLine(line);
21
22
  };
22
- const apiMapIsPointInRing = (point, path) => pointInPolygon(point, path) >= 0;
23
- return { apiMapDistance, apiMapDistanceToLine, apiMapIsPointInRing, apiMapDistanceOfLine };
23
+ return { apiMapDistance, apiMapDistanceToLine, apiMapDistanceOfLine };
24
24
  };
25
25
  const useGmapGeometry = () => {
26
26
  const payload = useMapSupplier();
@@ -39,14 +39,14 @@ const useGmapGeometry = () => {
39
39
  return void 0;
40
40
  return google.maps.geometry.spherical.computeLength(line.map(vec2lnglat));
41
41
  };
42
- const apiMapIsPointInRing = (point, path) => pointInPolygon(point, path) >= 0;
43
- return { apiMapDistance, apiMapDistanceToLine, apiMapIsPointInRing, apiMapDistanceOfLine };
42
+ return { apiMapDistance, apiMapDistanceToLine, apiMapDistanceOfLine };
44
43
  };
45
44
  const useMapGeometry = () => {
46
45
  const { supplier } = useMapSupplier();
47
46
  return supplier === "gmap" ? useGmapGeometry() : useAmapGeometry();
48
47
  };
49
48
  export {
49
+ apiLocalIsPointInRing,
50
50
  useAmapGeometry,
51
51
  useGmapGeometry,
52
52
  useMapGeometry
@@ -2,12 +2,11 @@ import { load as loadAmap } from "@amap/amap-jsapi-loader";
2
2
  import { type LoaderOptions } from "@googlemaps/js-api-loader";
3
3
  import { type Ref } from "vue-demi";
4
4
  import type { VNodeChild } from "../demi-polyfill";
5
- import type { Language } from "../types/interface";
5
+ import type { ConnectionStatus, Language } from "../types/interface";
6
6
  export declare const DEFAULT_AMAP_PLUGINS: AmapLoaderProps["plugins"];
7
7
  export declare const DEFAULT_GMAP_LIBRARIES: LoaderOptions["libraries"];
8
8
  export declare enum Status {
9
9
  LOADING = "LOADING",
10
- TIMEOUT = "TIMEOUT",
11
10
  FAILURE = "FAILURE",
12
11
  SUCCESS = "SUCCESS"
13
12
  }
@@ -30,6 +29,7 @@ export interface AmapLoaderProps extends Pick<GmapLoaderProps, "fallback" | "loa
30
29
  }
31
30
  export declare const useAmapLoader: (props: AmapLoaderProps) => {
32
31
  statusRef: import("vue-demi").ShallowRef<Status>;
32
+ pingStatusRef: import("vue-demi").ShallowRef<ConnectionStatus>;
33
33
  readyPromise: Promise<undefined>;
34
34
  };
35
35
  export interface GmapLoaderProps extends LoaderOptions {
@@ -53,11 +53,13 @@ export interface GmapLoaderProps extends LoaderOptions {
53
53
  }
54
54
  export declare const useGmapLoader: (props: GmapLoaderProps) => {
55
55
  statusRef: import("vue-demi").ShallowRef<Status>;
56
+ pingStatusRef: import("vue-demi").ShallowRef<ConnectionStatus>;
56
57
  readyPromise: Promise<undefined>;
57
58
  };
58
59
  export type MapSupplier = "gmap" | "amap";
59
60
  export interface UseMapLoaderOutput {
60
61
  statusRef: Ref<Status>;
62
+ pingStatusRef: Ref<ConnectionStatus>;
61
63
  readyPromise: Promise<undefined>;
62
64
  }
63
65
  export interface UseMapLoaderProps {