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

power-styles

v5.0.4

Published

The power styles provider dynamic style properties for svelte

Downloads

7

Readme

license

The power styles provides dynamic style properties for svelte

Prerequisites

This library requires Svelte 3.x.x (version 3 or later). Svelte are really easy to install.

Table of contents

Getting Started

Provide style actions for each css rule. Provide style actions for each css rule. and can be applied to any HTML element by applying svelte's reactivity to css properties.

Installation

BEFORE YOU INSTALL: please read the prerequisites

To install and set up the library, run:

$ npm install power-styles

Or if you prefer using Yarn:

$ yarn add power-styles

Usage for Svelte Kit

Font.svelte:

Font

<!-- Font.svelte -->
<script>
  import powerStyles from "power-styles";
	import { browser } from '$app/env';
	const { FontSize } = powerStyles();

  export let fontSize = CSS.em(2);
</script>

<p use:FontSize={fontSize}>
  <slot />
</p>

you can use like that

<script>
  import Font from "./Font.svelte";
</script>

<main>
  <Font fontSize={CSS.em(4)}> Ex fugiat laboris dolore id culpa. </Font>

  <Font>
    Pariatur reprehenderit pariatur voluptate ea ipsum ullamco Lorem aliquip
    magna duis qui proident.
  </Font>
</main>

Usage for Svelte

Font.svelte:

Font

<!-- Font.svelte -->
<script>
  import powerStyles from "power-styles";
  const { FontSize } = powerStyles();

  export let fontSize = CSS.em(2);
</script>

<p use:FontSize={fontSize}>
  <slot />
</p>

you can use like that

<script>
  import Font from "./Font.svelte";
</script>

<main>
  <Font fontSize={CSS.em(4)}> Ex fugiat laboris dolore id culpa. </Font>

  <Font>
    Pariatur reprehenderit pariatur voluptate ea ipsum ullamco Lorem aliquip
    magna duis qui proident.
  </Font>
</main>

Flip.svelte:

Flip

<!-- Flip.svelte -->
<script>
  import powerStyles from "power-styles";
  export let onActive = new Function();

  const ACTIVE = 0,
    MOVE = 90,
    INACTIVE = 180;

  const { CustomRotateFlip } = powerStyles();
  let customRotateFlip = CSS.deg(90);

  const launchOnActive = () => {
    if (onActive instanceof Function) {
      onActive(customRotateFlip.value === ACTIVE);
    }
  };

  const activeOff = () => {
    customRotateFlip =
      customRotateFlip.value == INACTIVE
        ? CSS.deg(90)
        : CSS.deg(customRotateFlip.value + MOVE);
    launchOnActive();
  };

  const activeOn = () => {
    customRotateFlip =
      customRotateFlip.value == ACTIVE
        ? CSS.deg(MOVE)
        : CSS.deg(customRotateFlip.value - MOVE);
    launchOnActive();
  };
</script>

<div class="flip">
  <span class="on" on:click={activeOn}>ON</span>
  <span class="off" on:click={activeOff}>OFF</span>
  <div class="door" use:CustomRotateFlip={customRotateFlip} />
</div>

<style>
  .flip {
    margin: auto;
    height: 100px;
    width: 400px;
    display: grid;
    position: relative;
    grid-template-columns: repeat(2, 1fr);
    border-radius: 25px;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
  }
  .flip :is(.on, .off, .door) {
    color: aliceblue;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    font-size: 2em;
    font-weight: 900;
    word-spacing: 0pt;
    display: grid;
    place-content: center;
    background-color: brown;
  }
  .flip .on {
    background-color: green;
  }
  .door {
    box-shadow: -1px 0px 0px 0px aliceblue;
    position: absolute;
    transition: 300ms all;
    left: 50%;
    height: 100%;
    width: 50%;
    transform-origin: left;
    transform-style: preserve-3d;
    transform: rotateY(var(--rotate-flip));
  }
  .door:after {
    position: absolute;
    background-color: green;
    content: "";
    height: 100%;
    width: 100%;
    backface-visibility: hidden;
  }
</style>

you can use like that

<script>
  import Flip from "./Flip.svelte";
</script>

<main>
  <Flip />
</main>

or

<script>
  import Flip from "./Flip.svelte";
  const onActive = (state) => {
    console.log(state ? "Is active" : "Is not active");
  };
</script>

<main>
  <Flip onActive={onActive} />
</main>

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Add your changes: git add .
  4. Commit your changes: git commit -am 'Add some feature'
  5. Push to the branch: git push origin my-new-feature
  6. Submit a pull request :sunglasses:

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

MIT License