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

@morfeo/web

v0.9.3

Published

![Morfeo logo](https://morfeo.dev/img/morfeo.png)

Downloads

11

Readme

@morfeo/spec

Morfeo logo

@morfeo/web adds to @morfeo/core additional parsers and typings to make it perfect for a web environment.

@morfeo/web is part of the @morfeo eco-system, a set of framework-agnostic tools that help you to create beautiful design systems for your web and mobile apps.


Documentation | API | Contributing | Discord


Table of contents

Installation

Usage

Supported Pseudos

Installation

with npm:

npm install @morfeo/web

or yarn:

yarn add @morfeo/web

Usage

@morfeo/web re-export all the @morfeo/core library, check out its documentation before continue.

In addition to the core library, the web package adds the parsers to handle pseudo classes, pseudo elements and gradients.

pseudos

You can pass to the resolve method any pseudo class with the format '&:{pseudo}', for example:

import { morfeo } from '@morfeo/web';

const style = morfeo.resolve({
  bg: 'primary',
  '&:hover': {
    bg: 'secondary',
  },
});

Will generate the style:

{
  "backgroundColor": "black",
  "&:hover": {
    "backgroundColor": "grey"
  }
}

If you're using @morfeo/web to directly style a component without any other css-in-js library, you can use getStyles :

import { getStyles } from '@morfeo/web';

const element = document.querySelector('#myButton');

const { classes } = getStyles({
  button: {
    bg: 'primary',
    '&:hover': {
      bg: 'secondary',
    },
  },
});

element.classList.add(classes.button);

In this case, @morfeo will generate plain css. To understand more about this topic we suggest you check our documentation about @morfeo/jss, in fact, the function getStyles is re-exported from @morfeo/jss.

Supported Pseudos

For now morfeo support this pseudos:

&:active
&:checked
&:disabled
&:empty
&:enabled
&:first-child
&:first-of-type
&:focus
&:hover
&:in-range
&:invalid
&:last-child
&:last-of-type
&:link
&:only-of-type
&:only-child
&:optional
&:out-of-range
&:read-only
&:read-write
&:required
&:root
&:target
&:valid
&:visited
&::after
&::before

as specified here yuo can always add more parser to extends morfeo, or simply add more pseudos in this list by editing this file and open a pull request.

gradients

You can specify inside the theme a set of gradients to use inside your application by using the gradients theme slice:

const myTheme = {
  ...restOfTheTheme,
  gradients: {
    ...restOfTheTheme.gradients,
    primary: {
      start: 0,
      angle: 90,
      end: 100,
      colors: ['primary', 'secondary'],
      kind: 'linear',
    },
  },
};

An example of usage is:

const buttonStyle = button.resolve({ gradient: 'primary' });
const textStyle = button.resolve({ textGradient: 'primary' });

with the results:

gradient-Button.png

gradient-Text.png

check out @morfeo/spec for the complete specification of the type GradientConfig used inside the gradients theme slice.