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

@ionic-enterprise/cs-demo-weather-widgets-vue

v3.1.3

Published

Vue specific proxies for @ionic-enterprise/cs-demo-weather-widgets

Downloads

15

Readme

Demo Weather Widgets - Vue

This is a sample custom element library that contains some simple weather related elements. This library contains the following custom elements:

  • Simple
    • csdemo-temperature - takes a temperature in Kelvin and displays the value in either Celsius or Fahrenheit
    • csdemo-uv-index - takes a UV Index value and displays the value with a description and color coding
    • csdemo-condition - given a mapping of condition types to image URLs and a condition code, determines which code to use and displays the image with a label
  • Compound
    • csdemo-daily-forecast - condition, date, low, high

Usage

npm i @ionic-enterprise/cs-demo-weather-widgets-vue

Handling Icons

This library includes a set of images under node_modules/@ionic-enterprise/cs-demo-weather-widgets/dist/images. If you copy all of these images to public/assets/images they will be automatically loaded by the components that need them.

You are also free to use your own images, copy them to a different location, and/or name some of the images differently.

If you use a different location or name, you need to let the components know the proper paths or names through a mapping. For example:

  const icons = {
    sunny: 'alt-location/images/sunny.png',
    cloudy: 'alt-location/images/cloudy.png',
    lightRain: 'alt-location/images/light-rain.png',
    shower: 'alt-location/images/shower.png',
    sunnyThunderstorm: 'alt-location/images/sunny-tstorm.png',
    thunderstorm: 'alt-location/images/tstorm.png',
    fog: 'alt-location/images/fog.png',
    snow: 'alt-location/images/snow.png',
    unknown: 'alt-location/images/unknown.png',
  };

You can also use a partial mapping if only a couple of names have changed:

  const icons = {
    sunnyThunderstorm: 'assets/images/partial-tstorm.png',
    unknown: 'assets/images/dunno.png',
  };

The overrides can be specified on any component that has a iconPaths property:

  <csdemo-condition :condition="condition" :iconPaths="icons"></csdemo-condition>
  <csdemo-daily-forecast :scale="scale" :forecast="forecast" :iconPaths="icons"></csdemo-daily-forecast>

csdemo-temperature

Displays the temperature, supplied in Kelvin, in the specified scale (C or F).

<template>
  <csdemo-temperature
    :scale="scale"
    :temperature="temperature"
    @click="toggleScale"
  ></csdemo-temperature>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue';
import { CsdemoTemperature } from '@ionic-enterprise/cs-demo-weather-widgets-vue';

export default defineComponent({
  name: 'SomePage',
  components: { CsdemoTemperature },
  setup() {
    const scale = ref('F');
    const temperature = ref(297);

    const toggleScale = () => {
      scale.value = scale.value === 'F' ? 'C' : 'F';
    };

    return { scale, temperature, toggleScale };
  },
});
</script>

csdemo-condition

Displays the current condition in both text and icon form. The condition is one of the condition codes used by OpenWeatherMap.org.

<template>
  <csdemo-condition :condition="condition"></csdemo-condition>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue';
import { CsdemoCondition } from '@ionic-enterprise/cs-demo-weather-widgets-vue';

export default defineComponent({
  name: 'SomePage',
  components: { CsdemoCondition },
  setup() {
    const condition = ref(200);
    return { condition };
  },
});

csdemo-uv-index

Displays the UV index along with a risk level, in a color appropriate for the level of risk.

<template>
  <csdemo-uv-index :uvIndex="uvIndex"></csdemo-uv-index>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue';
import { CsdemoUvIndex } from '@ionic-enterprise/cs-demo-weather-widgets-vue';

export default defineComponent({
  name: 'SomePage',
  components: { CsdemoUvIndex },
  setup() {
    const uvIndex = ref(2.5);

    return { uvIndex };
  },
});

csdemo-daily-forecast

Displays the forecast for a given day.

<template>
  <csdemo-daily-forecast :scale="scale" :forecast="forecast"></csdemo-daily-forecast>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue';
import { CsdemoDailyForecast } from '@ionic-enterprise/cs-demo-weather-widgets-vue';

export default defineComponent({
  name: 'SomePage',
  components: { CsdemoDailyForecast },
  setup() {
    const forecasts = ref([ array-of-forecasts-for-day ]);
    const scale = ref('F');
    return { forecasts, scale };
  },
});

The forecast property is a forecast data object in the following format:

export interface Forecast {
  date: Date;
  condition: number;
  low: number;
  high: number;
}

The low and high temperatures are specified in Kelvin.

The condition is one of the condition codes used by OpenWeatherMap.org.

Conclusion

That is it. We also have a demo application you can check out if you would like to.

Happy Coding!!