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

@atomic-class/svelte

v0.2.0

Published

a tool that supports component to configure atomic style

Downloads

12

Readme

Atomic-Class

A reactive framework for component to control classsheet.

Usage

<script lang=ts>
    import { mouse, keyboard } from '@atomic-class/action';
    import { css } from '@atomic-class/process';
    import { Status } from '@atomic-class/core';

    export let state = ['default'];
    export let props;
    
    /** Accept customized styles and state **/
    $: status = new Status(props, state);
    $: classes = css(status);

    function mouseHandler(event) { 
        status = mouse({status, event});
    }

    export let text;
</script>
<span
    on:mousedown={mouseHandler} on:mouseup={mouseHandler}
    on:mouseenter={mouseHandler} on:mouseleave={mouseHandler}
    class="px-12 py-5 bw-2 br-5 text-white weight {classes}"

    ac-props={props}
    ac-default="bg-black-700" ac-hover="bg-blue cursor-pointer"
    ac-active="bg-purple"
    ac-disabled="bg-black-400 text-white-900 cursor-not-allowed">{text}
</span>

After Compile:

<script lang=ts>
    import { mouse, keyboard } from '@atomic-class/action';
    import { tailwindcss} from '@atomic-class/process';
    import { Status } from '@atomic-class/core';

    export let keycode;
    export let state = ['default'];
    export let props;

    /** The next line is generated by the plugin **/
    props = {...{"default":{"classes":"bg-black-700"},"hover":{"classes":"bg-blue cursor-pointer"},"active":{"classes":"bg-purple"},"disabled":{"classes":"bg-black-400 text-white-900 cursor-not-allowed"},"base":{"classes":"px-12 py-5 bw-2 br-5 text-white weight"}}, ...props};
    
    $: status = new Status(props, state);
    $: classes = css(status);

    function mouseHandler(event) {
        status = mouse({status, event});
    }
    export let text;
</script>
<span
    on:mousedown={mouseHandler} on:mouseup={mouseHandler}
    on:mouseenter={mouseHandler} on:mouseleave={mouseHandler}
    class={classes} >{text}
</span>

You can try this demo in Atomic Class REPL.

Working With RxJS

<script lang=ts>
    import { mouse, keyboard } from '@atomic-class/action';
    import { tailwindcss} from '@atomic-class/process';
    import { Status } from '@atomic-class/core';
    import { from, fromEvent, map } from 'rxjs'

    export let keycode;
    export let state = ['default'];
    export let props;
    
    $: status = new Status(props, state);

    function mouseAction(node) {
        fromEvent(node, 'mouseup')
            .pipe(map(mouse))
            .pipe(map(states => ({states, status})))
            .pipe(tailwindcss)
            .subscribe(rs => classes = rs);
    }
    export let text;
</script>
<span
    use:mouseAction
    class="px-12 py-5 bw-2 br-5 text-white weight {classes}"
    ac-props={props}
    ac-default="bg-black-700" ac-hover="bg-blue cursor-pointer"
    ac-active="bg-purple"
    ac-disabled="bg-black-400 text-white-900 cursor-not-allowed">
    {text}
</span>

Configuration

npm install @atomic-class/svelte -D

Building with Rollup:


import ac from '@atomic-class/svelte';

export default {
	input: 'src/demo/index.ts',
	output: {
		sourcemap: true,
		format: 'es',
		name: 'app',
		file: '../demo/svelte/dist.js'
	},
	external: ['@atomic-class/core', '@atomic-class/action', '@atomic-class/process'],
	plugins: [
        ac(),
        // ac({prefix: 'ac', include: [], exclude: []})
    ]
}

Features

Export Inline Style

TODO

Export SCSS/SASS/LESS

TODO

Tree Shaking

TODO