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

@geops/mobility-web-component

v0.1.8

Published

Web components in the domains of mobility and logistics.

Downloads

177

Readme

mobility-web-component

This project contains a set of web components allowing to use easily the geOps APIs:

<geops-mobility> web component

A web component used to display a map using different geOps APIs.

The map displays realtime vehicles, and allow to click on them to display their schedule plan. You can also display MOCO notifications.

Demo

You can see the web component in action using the demo app.

Usage Example

<html>
  <body>
    <script type="module" src="https://www.unpkg.com/@geops/mobility-web-component)"></script>
    <geops-mobility apikey="YOUR_GEOPS_API_KEY" style="display: block;width: 400px;height: 800px;"></geops-mobility>
  </body>
</html>

Attributes

Here an exhaustive list of the <geops-mobility> web component attributes available to customize easily the map.

URL parameters

You can specify all the web component attributes as url parameters to the demo app to customize easily the map.

Another url parameter is used to get a full screen map instead of the documentation:

<geops-mobility-search> web component

A search input to search stops using the geOps Stops API.

Demo

You can see the web component in action using the demo app.

Usage Example

<html>
  <body>
    <script type="module" src="https://www.unpkg.com/@geops/mobility-web-component)"></script>
    <geops-mobility-search
      apikey="YOUR_GEOPS_API_KEY"
      limit="5"
      mots="rail,bus"
      style="display: block;width: 800px;height: 800px;">
    </geops-mobility>
  </body>
</html>

Attributes

Every parameters of the geOps Stops API can be passed as a string attribute of the web component.

The list of parameters of the geOps Stops API can be found here.

URL parameters

All the web component attributes can be specified as url parameters to the demo app to customize easily the search.

Another url parameter is used to get a full screen map instead of the documentation:

Development

If you want only the basic HTML, faster development process.

corepack enable
yarn install
yarn start

If you want the documentation website:

corepack enable
yarn install && cd doc && yarn install
yarn doc

Deployment

The demo app is deployed automatically after a merge on master using Vercel, on https://mobility-web-component.geops.io/.

Guidelines

  • every new components must have a new folder MyComponent with an index.tsx that contains only an export and a MyNewComponent.tsx file. The reason is too simplifx the override in forked project.

Client specific code

If a client, for example trenord, needs a mobility-web-component with custom functionnalities. Never add custom client specific stuff in this repository, instead:

  • create a fork from this repository, and call it trenord-mobility-web-component.
  • change the package name in package.json to @geops/trenord-mobility-web-component.
  • change the README and index.html titles.
  • create a new MobilityMap component in src/ called TrenordMobilityMap. In this component you can copy the content of MobilityMap or just use the MobilityMap component with default values. It depends of your use case.
  • change the MobilityMap import to TrenordMobilityMap in src/index.tsx.
  • create a new npm package on npmjs.com from this repository, and call it @geops/trenord-mobility-web-component.
  • publish a beta version to test the publishing with ỳarn publish:beta

At this point you're ready to create custom code, some rules must be followed to facilitate the merge of upstream mobility-web-component repository:

  • always create new components using the client name as prefix, like TrenordRouteSchedule, or put them in a client specific folder src/trenord/RoutSchedule.
  • to use the overrided components just change the export in the index.tsx of the component to overrided.
  • never modify the original components in the forked repository, do it in the upstream repository then merge it in the forked repository.
  • never update dependencies in the forked repository, do it in the upstream repository then merge it in the forked repository.
  • if you have a doubt, ask.

Merge upstream repository

When you use a fork you can merge the upstream repository using:

// Set up the upstream remote, to do only once
git remote add upstream [email protected]:geops/mobility-web-component.git

git fetch upstream && git merge upstream/main