![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
svelte-google-maps-api
Advanced tools
warning: This repository is under development
・Google Map JavaScript API Wrapper for Svelte
・Svelte 4 Supported
npm install svelte-google-maps-api
LoadScript
is a Svelte component that handles the loading of Google Maps JavaScript API script.
Prop | Type | Description |
---|---|---|
apiKey | string | Google Maps API Key |
libraries | string[] | An array of Google Map libraries to be loaded with the script. |
GoogleMap
is a component for rendering a Google Map.
Prop | Type | Description |
---|---|---|
id | string | An identifier for the map container. |
options | google.maps.MapOptions | Google Map options object. |
onClick | (e: google.maps.MapMouseEvent) => void | Callback function that is called when the map is clicked. |
onDblClick | (e: google.maps.MapMouseEvent) => void | Callback function that is called when the map is double clicked. |
onDragEnd | (e: google.maps.MapMouseEvent) => void | Callback function that is called when the drag ends. |
onDragStart | (e: google.maps.MapMouseEvent) => void | Callback function that is called when the drag starts. |
onMouseDown | (e: google.maps.MapMouseEvent) => void | Callback function that is called when the mouse button is pressed. |
onMouseMove | (e: google.maps.MapMouseEvent) => void | Callback function that is called when the mouse pointer moves. |
onMouseOut | (e: google.maps.MapMouseEvent) => void | Callback function that is called when the mouse pointer moves out of the map. |
onMouseOver | (e: google.maps.MapMouseEvent) => void | Callback function that is called when the mouse pointer moves over the map. |
onMouseUp | (e: google.maps.MapMouseEvent) => void | Callback function that is called when the mouse button is released. |
onRightClick | (e: google.maps.MapMouseEvent) => void | Callback function that is called when the map is right clicked. |
onDrag | (e: google.maps.MapMouseEvent) => void | Callback function that is called when the map is dragged. |
onCenterChanged | (e: google.maps.MapMouseEvent) => void | Callback function that is called when the center of the map changes. |
onLoad | (map: google.maps.Map) => void | Callback function that is called when the map is loaded. |
onUnmount | (map: google.maps.Map) => void | Callback function that is called when the map unmounts. |
mapContainerStyle | string | Style for the map container. Default is 'width:100%;height:100%'. |
mapContainerClassName | string | Class name for the map container. |
The GoogleMap
component can be used to render a Google Map:
<script lang="ts">
import LoadScript from 'svelte-google-maps-api/LoadScript.svelte';
import GoogleMap from 'svelte-google-maps-api//GoogleMap.svelte';
const options = {
zoom: 4,
center: {lat: -33, lng: 151},
};
const handleLoad = (map: google.maps.Map) => {
// do something with the loaded map
};
</script>
<LoadScript apiKey={yourApiKey}>
<GoogleMap {options} onLoad={handleLoad} />
</LoadScript>
Property | Type | Description |
---|---|---|
position | google.maps.LatLng | google.maps.LatLngLiteral | Specifies the position of the marker. |
options | google.maps.MarkerOptions | An object containing options for the marker, such as its icon, title, etc. |
onClick | ((e: google.maps.MapMouseEvent) => void) | Event handler for when the marker is clicked. |
onClickableChanged | (() => void) | Event handler for when the marker's 'clickable' property is changed. |
onCursorChanged | (() => void) | Event handler for when the marker's 'cursor' property is changed. |
onAnimationChanged | (() => void) | Event handler for when the marker's 'animation' property is changed. |
onDblClick | ((e: google.maps.MapMouseEvent) => void) | Event handler for when the marker is double-clicked. |
onDrag | ((e: google.maps.MapMouseEvent) => void) | Event handler for when the marker is dragged. |
onDragEnd | ((e: google.maps.MapMouseEvent) => void) | Event handler for when the dragging of the marker ends. |
onDraggableChanged | (() => void) | Event handler for when the marker's 'draggable' property is changed. |
onDragStart | ((e: google.maps.MapMouseEvent) => void) | Event handler for when the dragging of the marker starts. |
onFlatChanged | (() => void) | Event handler for when the marker's 'flat' property is changed. |
onIconChanged | (() => void) | Event handler for when the marker's 'icon' property is changed. |
onMouseDown | ((e: google.maps.MapMouseEvent) => void) | Event handler for when the mouse button is pressed on the marker. |
onMouseOut | ((e: google.maps.MapMouseEvent) => void) | Event handler for when the mouse leaves the area of the marker. |
onMouseOver | ((e: google.maps.MapMouseEvent) => void) | Event handler for when the mouse enters the area of the marker. |
onMouseUp | ((e: google.maps.MapMouseEvent) => void) | Event handler for when the mouse button is released on the marker. |
onPositionChanged | (() => void) | Event handler for when the marker's 'position' property is changed. |
onRightClick | ((e: google.maps.MapMouseEvent) => void) | Event handler for when the marker is right-clicked. |
onShapeChanged | (() => void) | Event handler for when the marker's 'shape' property is changed. |
onTitleChanged | (() => void) | Event handler for when the marker's 'title' property is changed. |
onVisibleChanged | (() => void) | Event handler for when the marker's 'visible' property is changed. |
onZindexChanged | (() => void) | Event handler for when the marker's 'zIndex' property is changed. |
onLoad | ((marker: google.maps.Marker) => void) | Event handler for when the marker is added to the map. This event fires after the marker's position has been changed for the first time, but before the marker's click event and the map's mousemove and idle events. |
onUnmount | ((marker: google.maps.Marker) => void) | Event handler for when the marker is removed from the map. |
<script lang="ts">
import GoogleMap from 'svelte-google-maps-api//GoogleMap.svelte';
import Marker from 'svelte-google-maps-api//Marker.svelte';
const position = {lat: 37.7749, lng: -122.4194};
const options = {
draggable: true,
title: "Hello, World!"
};
</script>
<GoogleMap>
<Marker {position} {options} />
</GoogleMap>
FAQs
**warning: This repository is under development**
The npm package svelte-google-maps-api receives a total of 5 weekly downloads. As such, svelte-google-maps-api popularity was classified as not popular.
We found that svelte-google-maps-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.