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

@pixwell/city-performer-widget

v1.1.11

Published

Widgets from city performer

Downloads

6

Readme

City performer widgets

npm version

Getting started

  1. Insert div with wanted id somewhere in your html
    <div id="someId"></div>

  2. Import library

    • as ES6 module
      • yarn add @pixwell/city-performer-widget
      • import {CpWidgets} from '@pixwell/city-performer-widget'
    • or with CDN
      • <script src="https://unpkg.com/@pixwell/city-performer-widget@^1.1.0/dist/city-performer-widget.js"></script>
  3. Initialize widgets with options. Description below.

  • using npm
import {CpWidgets} from '@pixwell/city-performer-widget'
new CpWidgets({
    //options described bellow
})
  • or using CDN
<script src="https://unpkg.com/@pixwell/city-performer-widget@^1.1.0/dist/city-performer-widget.js"></script>
<script>
new CityPerformerWidget.CpWidgets({ 
    //options described bellow
})
</script>
let cpwidgets = new CityPerformerWidget.CpWidgets({
    key: '<api-key>', // 'API key
    model: {
      id: 'vendor_test_10',
      name: 'test1',
      type: 'rent',
      kind: 'studio',
      usable_area: 76,
      price: 1000,
      energy_price: 80,
      description: 'Test description',
      location: {
        lat: 48.161341,
        lng: 17.046456
      },
      address: {
        full: 'Hattalova 8, 831 03 Bratislava, Slovakia',
        line_1: 'Hattalova 8',
        city: 'Bratislava',
        country: 'Slovakia',
        postal_code: '83103',
        state: 'Slovakia'
      }
    },
    widgets: [{
      id: '#someId',
      type: 'nearby',
      onDataVisible: (visible) => {
        if (visible) {{
          // nearby widget is visible  
          return
        }}
        // nearby widget is not vissible (there is data for this widget) ie: hide borders of widget 
      }
    },{
      id: '#urban',
      type: 'urban'
    },{
      id: '#stats',
      type: 'stats'
    },{
      id: '#environment',
      type: 'env'
    }],
    locale: 'sk',
    onDataLoaded: () => {
      // ie: hide loader or do something when data loaded 
    }
})

Configuration

User can set options and locale via published methods setOptions(<OptionsObject>) and setLocale('<locale>')

Options object
key

API key provided

model

id - vendor id (identificator of property). It has to be unique identifier, since we cache property by this id.
name - name shown in maps
type - rent or sale. important for stats widget, where is displayed price compared to other rents/seller respectively
kind - kind of property

  • studio
  • beds_1 - 1 Bedroom
  • beds_2 - 2 Bedrooms
  • beds_3 - 3 Bedrooms
  • beds_4 - 4 Bedrooms
  • beds_5_more - 5 or more Bedrooms
  • apartment - Apartment
  • villa - Villa
  • duplex - Duplex
  • house - House
  • other - Other

price - Total price or price per sq m based on rent sale mode
energy_price - Price for utilities
usable_area - Usable area in sq m
description - (optional)
location - object

  • lat
  • lng

address - object

  • full - string full address
  • line_1 - address line 1
  • city
  • country
  • postal_code
  • state
widgets

Array of objects

{
    id: '<id>' // identificator of div to put widget into
    type: '<type>' // which widget to put it into
    onDataVisible: (visible: boolean) => {} // returns visibility of data, if there is no data visible = false, if there is visible = true
}

List of available types:

  • urban - Widget with total and partials urban indexes
  • nearby - Nearby points of interest
  • env - Environment widget with analysis of green places around property
  • wellbeing - Wellbeing widget with analysis of neighbourhood (industry zones, etc.)
  • safety - Data analysis widget of safety
  • mobility - Mobility widget with analysis of bus stops, bike rentals, etc.
  • services - Services widget with analysis of nearby services like shopping, public and health services and more
  • relax - Relax widget with analysis of culture, areas to spend free time and similar
  • stats - Statistics widget
locale

Our widgets support two languages:

  • english (default) en
  • slovak sk
  • czech cz
  • french fr
  • polish pl
  • german de
onDataLoaded

When widgets loads all data and is prepared to show data (doesn't mean, it has data for all widgets, just that requests had finished). Accepts function.

Contribution

Install dependencies

yarn install

Build

yarn build:prod - build and minify with production url to dist/city-performer-widget.js
yarn build - build and minify to dist/city-performer-widget.js
yarn dev - development