@ttoss/google-maps 1.25.2 → 1.25.4

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/esm/index.js CHANGED
@@ -1,13 +1,10 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
2
 
3
- // tsup.inject.js
4
- import * as React from "react";
5
-
6
3
  // src/GoogleMapsProvider.tsx
7
- import * as React2 from "react";
4
+ import * as React from "react";
8
5
  import { useScript } from "@ttoss/react-hooks";
9
6
  import { jsx } from "react/jsx-runtime";
10
- var GoogleMapsContext = /*#__PURE__*/React2.createContext({
7
+ var GoogleMapsContext = /*#__PURE__*/React.createContext({
11
8
  status: "idle",
12
9
  googleMaps: null
13
10
  });
@@ -30,13 +27,13 @@ var GoogleMapsProvider = ({
30
27
  const {
31
28
  status
32
29
  } = useScript(src);
33
- const googleMaps = React2.useMemo(() => {
30
+ const googleMaps = React.useMemo(() => {
34
31
  if (status === "ready" && window.google.maps) {
35
32
  return window.google.maps;
36
33
  }
37
34
  return null;
38
35
  }, [status]);
39
- const value = React2.useMemo(() => {
36
+ const value = React.useMemo(() => {
40
37
  if (status === "ready" && googleMaps) {
41
38
  return {
42
39
  status,
@@ -54,17 +51,17 @@ var GoogleMapsProvider = ({
54
51
  });
55
52
  };
56
53
  var useGoogleMaps = () => {
57
- return React2.useContext(GoogleMapsContext);
54
+ return React.useContext(GoogleMapsContext);
58
55
  };
59
56
 
60
57
  // src/useGeocoder.ts
61
- import * as React3 from "react";
58
+ import * as React2 from "react";
62
59
  var useGeocoder = () => {
63
60
  const {
64
61
  googleMaps
65
62
  } = useGoogleMaps();
66
- const [isGeocoderInitialized, setIsGeocoderInitialized] = React3.useState(false);
67
- const geocoder = React3.useMemo(() => {
63
+ const [isGeocoderInitialized, setIsGeocoderInitialized] = React2.useState(false);
64
+ const geocoder = React2.useMemo(() => {
68
65
  if (googleMaps) {
69
66
  const googleMapsGeocoder = new googleMaps.Geocoder();
70
67
  setIsGeocoderInitialized(true);
@@ -79,22 +76,22 @@ var useGeocoder = () => {
79
76
  };
80
77
 
81
78
  // src/useMap.ts
82
- import * as React4 from "react";
79
+ import * as React3 from "react";
83
80
  import { useCallbackRef } from "use-callback-ref";
84
81
  var useMap = (options = {}) => {
85
- const [, forceUpdate] = React4.useState(0);
82
+ const [, forceUpdate] = React3.useState(0);
86
83
  const ref = useCallbackRef(null, () => forceUpdate(n => n + 1));
87
84
  const {
88
85
  googleMaps
89
86
  } = useGoogleMaps();
90
- const map = React4.useMemo(() => {
87
+ const map = React3.useMemo(() => {
91
88
  if (googleMaps && ref.current) {
92
89
  return new googleMaps.Map(ref.current, options);
93
90
  }
94
91
  return null;
95
92
  }, [googleMaps, ref.current]);
96
93
  const optionsStringify = JSON.stringify(options);
97
- React4.useEffect(() => {
94
+ React3.useEffect(() => {
98
95
  if (map) {
99
96
  const parsedOptions = JSON.parse(optionsStringify);
100
97
  map.setOptions(parsedOptions);
package/dist/index.js CHANGED
@@ -46,14 +46,11 @@ __export(src_exports, {
46
46
  });
47
47
  module.exports = __toCommonJS(src_exports);
48
48
 
49
- // tsup.inject.js
50
- var React = __toESM(require("react"));
51
-
52
49
  // src/GoogleMapsProvider.tsx
53
- var React2 = __toESM(require("react"));
50
+ var React = __toESM(require("react"));
54
51
  var import_react_hooks = require("@ttoss/react-hooks");
55
52
  var import_jsx_runtime = require("react/jsx-runtime");
56
- var GoogleMapsContext = React2.createContext({
53
+ var GoogleMapsContext = React.createContext({
57
54
  status: "idle",
58
55
  googleMaps: null
59
56
  });
@@ -76,13 +73,13 @@ var GoogleMapsProvider = ({
76
73
  const {
77
74
  status
78
75
  } = (0, import_react_hooks.useScript)(src);
79
- const googleMaps = React2.useMemo(() => {
76
+ const googleMaps = React.useMemo(() => {
80
77
  if (status === "ready" && window.google.maps) {
81
78
  return window.google.maps;
82
79
  }
83
80
  return null;
84
81
  }, [status]);
85
- const value = React2.useMemo(() => {
82
+ const value = React.useMemo(() => {
86
83
  if (status === "ready" && googleMaps) {
87
84
  return {
88
85
  status,
@@ -100,17 +97,17 @@ var GoogleMapsProvider = ({
100
97
  });
101
98
  };
102
99
  var useGoogleMaps = () => {
103
- return React2.useContext(GoogleMapsContext);
100
+ return React.useContext(GoogleMapsContext);
104
101
  };
105
102
 
106
103
  // src/useGeocoder.ts
107
- var React3 = __toESM(require("react"));
104
+ var React2 = __toESM(require("react"));
108
105
  var useGeocoder = () => {
109
106
  const {
110
107
  googleMaps
111
108
  } = useGoogleMaps();
112
- const [isGeocoderInitialized, setIsGeocoderInitialized] = React3.useState(false);
113
- const geocoder = React3.useMemo(() => {
109
+ const [isGeocoderInitialized, setIsGeocoderInitialized] = React2.useState(false);
110
+ const geocoder = React2.useMemo(() => {
114
111
  if (googleMaps) {
115
112
  const googleMapsGeocoder = new googleMaps.Geocoder();
116
113
  setIsGeocoderInitialized(true);
@@ -125,22 +122,22 @@ var useGeocoder = () => {
125
122
  };
126
123
 
127
124
  // src/useMap.ts
128
- var React4 = __toESM(require("react"));
125
+ var React3 = __toESM(require("react"));
129
126
  var import_use_callback_ref = require("use-callback-ref");
130
127
  var useMap = (options = {}) => {
131
- const [, forceUpdate] = React4.useState(0);
128
+ const [, forceUpdate] = React3.useState(0);
132
129
  const ref = (0, import_use_callback_ref.useCallbackRef)(null, () => forceUpdate(n => n + 1));
133
130
  const {
134
131
  googleMaps
135
132
  } = useGoogleMaps();
136
- const map = React4.useMemo(() => {
133
+ const map = React3.useMemo(() => {
137
134
  if (googleMaps && ref.current) {
138
135
  return new googleMaps.Map(ref.current, options);
139
136
  }
140
137
  return null;
141
138
  }, [googleMaps, ref.current]);
142
139
  const optionsStringify = JSON.stringify(options);
143
- React4.useEffect(() => {
140
+ React3.useEffect(() => {
144
141
  if (map) {
145
142
  const parsedOptions = JSON.parse(optionsStringify);
146
143
  map.setOptions(parsedOptions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/google-maps",
3
- "version": "1.25.2",
3
+ "version": "1.25.4",
4
4
  "author": "ttoss",
5
5
  "contributors": [
6
6
  "Pedro Arantes <pedro@arantespp.com> (https://arantespp.com/contact)",
@@ -19,20 +19,20 @@
19
19
  ],
20
20
  "typings": "dist/index.d.ts",
21
21
  "dependencies": {
22
- "@types/google.maps": "^3.49.2",
22
+ "@types/google.maps": "^3.54.10",
23
23
  "use-callback-ref": "^1.3.0",
24
- "@ttoss/react-hooks": "^1.24.2"
24
+ "@ttoss/react-hooks": "^1.24.4"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "react": ">=16.8.0",
28
28
  "react-dom": ">=16.8.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@types/react": "^18.2.38",
31
+ "@types/react": "^18.2.39",
32
32
  "jest": "^29.7.0",
33
33
  "tsup": "^8.0.1",
34
- "@ttoss/config": "^1.31.1",
35
- "@ttoss/test-utils": "^2.0.0"
34
+ "@ttoss/config": "^1.31.3",
35
+ "@ttoss/test-utils": "^2.0.2"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public",