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

@geoblocks/ga-search

v0.0.22

Published

A web component element to access the [GeoAdmin search API](https://api3.geo.admin.ch/services/sdiservices.html#search).

Downloads

93

Readme

<ga-search>

A web component element to access the GeoAdmin search API.

Installation

npm install @geoblocks/ga-search

Example Usage

<ga-search limit="42">
  <input placeholder="Search...">
  <ul></ul>
</ga-search>

The component has to have an input and ul as children element. The query text is taken from the input and the results are displayed in the ul.

API

Properties/Attributes

| Name | Type | Default | Description | ------------------ | ---------- | ---------------- | ----------- | minlength | number | 1 | The minimum number of characters of the input to start a search. | limit | number | 15 | The number of result per type. | debounceTime | number | 200 | Time in milliseconds that the component should wait after last keystroke before calling search function. | lang | string | | Language code (de, fr, it , rm, or en). Default is the value of the lang attribute of the HTML document. | types | string | 'location' | A comma separated list of types of search to use. Can be a combination of 'location', 'layer', 'feature' and 'additionalSource'. The order of this list is used as the display order. | sr | string | '4326' | The spatial reference code for output geometries. Can be 21781, 2056, 3857 or 4326 | locationOrigins | string | 'zipcode,gg25' | A comma separated list of location origins. Possible origins are: zipcode, gg25, district, kantone, gazetteer, address and parcel. | featureLayers | string | | A comma separated list of technical layer names to be used by the feature search. | filterResults | function | | Optional filter function applied to the result array. The function accepts three arguments: element, index and array and must return a boolean. | renderResult | function | | Optional function to change the result line. The function accepts two arguments: result and label and must return a string. | additionalSource | object | | | historyEnabled | boolean | true | Enable search history or not. If enabled, show history as result list when the input length is less than minlength | storage | object | Storage | Define which storage to be use to store search history. Should implement methods addEntry(entry) to add a new entry to the history and getHistory() to return the history. The default Storage support a default limit of 10 entry. This can be changed by setting storage.setLimit(limit).

Events

| Name | Detail | Description | -------- | ------------------- | ----------- | submit | {result: Feature} | Fired when a search result is selected.

Running the demo

npm i
npm run start