npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@golocalinteractive/se-facility-map

v2.0.0

Published

## Install

Downloads

561

Readme

Facility Map

Install

Install with npm:

npm install --save @golocalinteractive/se-facility-map

Getting Started

The Storage Essentials Facility Map is a wrapper class for Google Maps and is used to provide a flexible standard for implementing maps. Functions that are public or marked @api are meant for general use.

Usage

Below is a base example with zero customization. This does assume your markup uses the default values.

Javascript

import SeFacilityMap from '@golocalinteractive/se-facility-map';

const map = new SeFacilityMap();

HTML

<div id="marketMap" class="h-100"></div>
<!-- Location element with data-lat and data-lng attributes. Used to create your location markers. -->
<div class="facility-item" data-lat="38.930243" data-lng="-94.687515">
    <!-- HTML of your choosing -->
    <!-- Info window container (optional to include info windows) - display: none; so it's hidden from view. -->
    <div class="map-info-window-container" style="display:none;">
        <!-- Inner HTML (contents of your marker info window) -->
        <div class="map-info-window">
            <div class="map-info-window-content">
                <h4 class="infowindow-title">Go Local Interactive</h4>
                <p class="infowindow-p">10975 Benson Dr #250
                    <br />Overland Park, KS 66210
                    <br />(913) 689-3170
                </p>
                <a role="button" class="btn btn-primary btn-sm btn-infowin" href="https://www.google.com/maps/dir/?api=1&destination=38.930243,-94.687515" target="_blank">Get Directions</a>
            </div>
        </div>
    </div>
</div>

...

<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap" async defer></script>

Reset

If you filter results with javascript you may want to update the map with the filtered results.

reset() will reset locations based on your locationClass setting which also checks :not(.filtered). This allows you to change the markup to add more/less of locationClass or add or remove the class .filtered to those elements to provide different results.

const map = new SeFacilityMap();

// Listen for custom seGeoSearch event and trigger a rerender of your map.
document.addEventListener("seGeoSearch", function (event) {
    map.reset();
});

// Listen for custom seMarketFilter event and trigger a rerender of your map.
document.addEventListener("seMarketFilter", function (event) {
    map.reset();
});

Options

The following are options that will allow you to customize the map to your needs.

Base Options

| Key | Type | Default | Description | |----------------|--------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | el | string | #marketMap | Unique HTML id to mount the map. | | locationClass | string | .facility-item | CSS selector for each location. HTML element requires data-lat & data-lng attributes to set marker coordinates and nested element .map-info-window-container containing the HTML for your info window. It's recommended that .map-info-window-container be set to display: none; to remain hidden when rendering location results. | | clustered | boolean | false | Enable/disable marker clustering. | | clusterOptions | SeClusterOptions (see src/types/index.d.ts) | {} | Customize marker cluster options. Optionally add Renderer - render() function required. | | infoWindow | google.maps.InfoWindowOptions | {} | Customize info window options. | | map | SeMapOptions (see src/types/index.d.ts) | {} | Customize Google map options. Optionally set center of map with lat/lng. | | marker | SeMarkerOptions | see Marker Options | Specify custom attributes for the marker - size, image, etc. See Marker Options | | getLocations | () => Location[] | see Custom getLocations() | Handle where content, lat and lng pulled to form the location InfoWindow. Can be used to override default location fetching with locationClass and .map-info-window-container. See Custom getLocations() for more information. | | onCreated | (map?: google.maps.Map) => void | () => console.log('Map created'); | Custom callback fired when map has been created. |

Marker Options

Below you can find the custom options for the Marker options.

| Key | Type | Default | Description | |--------|---------------|-------------------------------------|---------------------| | labels | SeMarkerLabel | see SeMarkerLabel | Custom label config | | icon | SeMarkerIcon | see SeMarkerIcon | Custom icon config |

SeMarkerLabel

Extends google.maps.MarkerLabel, see google.maps.MarkerLabel for more information.

| Key | Type | Default | Description | |------------|---------|--------------|----------------------------------------------------------------------------------------| | enable | boolean | false | Enable/disable marker labels. When enabled, renders the index of the filtered results. |

SeMarkerIcon

Extends google.maps.Symbol, see google.maps.Symbol for more information.

| Key | Type | Default | Description | |---------------|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------| | path | google.maps.SymbolPath | M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0z | SVG path for marker pin icon. | | size | google.maps.Size | new google.maps.Size(32, 32) | The width/height of a pin. Used for offsetting the info window. Don't use unless you know you need to. |

Custom getLocations()

Chances are you don't need to create a custom getLocations() function. If you pass the appropriate locationClass for your needs and use .map-info-window-container (display: none) to wrap your info window HTML then you can ignore this. By default we use SeFacilityMap@getLocations(). This option is deprecated and likely will be removed entirely in a future major release.