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

vuetify-algolia-places

v1.0.1

Published

Algolia places for Vuetify

Downloads

57

Readme

Vuetify Algolia Places

Use Algolia Places with Vuetify.

Travis VueJS 2.x npm license

Demo

A demo is available here.

Installation

Run in your terminal:

yarn add vuetify-algolia-places

You also need to install algoliasearch and places.js:

yarn add 'algoliasearch@^3' 'places.js@^1'

Then install the plugin:

import Vue from 'vue';
import VuetifyAlgoliaPlaces from 'vuetify-algolia-places';

Vue.use(VuetifyAlgoliaPlaces, {
  algolia: {
    appId: '...', // Optional
    apiKey: '...', // Optional
  },
});

Usage

Vuetify Algolia Places is still under development, so for now there is no way to specify props nor events.

<vuetify-algolia-places v-model="place" />

The variable place looks like this:

{
  "name": "30 Rue du Sergent Michel Berthet",
  "administrative": "Auvergne-Rhône-Alpes",
  "city": "Lyon 9e Arrondissement",
  "country": "France",
  "countryCode": "fr",
  "type": "address",
  "latlng": {
    "lat": 45.7704,
    "lng": 4.80536
  },
  "postcode": "69009",
  "highlight": {
    "name": "<em>30</em> <em>Rue</em> <em>du</em> <em>Sergent</em> <em>Michel</em> <em>Be</em>rthet",
    "city": "Lyon 9e Arrondissement",
    "administrative": "Auvergne-Rhône-Alpes",
    "country": "France"
  },
  "hitIndex": 0,
  "query": "30 rue du sergent michel berthet",
  "value": "30 Rue du Sergent Michel Berthet, Lyon 9e Arrondissement, Auvergne-Rhône-Alpes, France"
}
Note about initial value

If you don't store this kind of object in your application, you can still pass a plain string that is equivalent to the value value, e.g.: 30 Rue du Sergent Michel Berthet, Lyon.

If this value is not null during the initialization of the component, it will automatically request Algolia API and use the first hit.

That means if place is equal to 30 Rue du Sergent Michel Berthet, Lyon, it will be automatically transformed to the above JSON object.

Props

| Name | Type | Algolia Places documentation | | ------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------- | | type |  String | Check type option | | language | String | Check language option | | countries | String[] | Check countries option | | aroundLatLng | String | Check aroundLatLng option | | aroundLatLngViaIp | Boolean | Check aroundLatLngViaIP option | | aroundRadius | Number | Check aroundRadius option | | debounce | Number|Boolean | Pass true to debounce for 250ms, or pass a custom delay. Default: false | | custom-highlight | Function | See Custom Highlighting |

Every props from Vuetify Autocomplete component are supported, except items, loading, search-input.sync, filter and return-object that are used internally.

Events

| Name | Description | Arguments | | ------- | ------------------------------------------------------------------------------- | ----------------------------------------- | | input | Emitted when the user select a place | @input="onInput", onInput(place) { } | | error | Emitted when there is an error with Algolia API |  @error="onError", onError(error) { } | | clear |  Emitted when the user click on the clear button (used with prop clearable) | @clear="onClear", onClear() { } |

Custom highlighting

You can override the default behavior of highlighted search query hits via a custom function and/or slot. When using both, the returned value of your custom highlight function will become the highlight prop in the slot. Read more about Algolia Places highlight object here.

Via function

<vuetify-algolia-places :custom-highlight="someFunction" />

Via slot

Note that this slot's parent element is a <v-list-tile-content>

<vuetify-algolia-places>
  <template slot="highlight" slot-scope="{ highlight }">
    <v-list-tile-title>{{ highlight }}</v-list-tile-title>
  </template>
</vuetify-algolia-places>