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

@platformbuilders/theme-toolkit

v0.3.0

Published

Theme helpers to use combined with Fluid Design System.

Downloads

534

Readme

Theme Toolkit

Descrição

Este toolkit foi desenvolvido para auxiliar na gestão de temas e tornar mais fácil a manipulação de temas em aplicações.

Instalação

Use o gerenciador de pacotes de sua escolha:

# Usando npm
npm install @platformbuilders/theme-toolkit

# Usando yarn
yarn add @platformbuilders/theme-toolkit

Breakpoints

A toolkit define uma série de pontos de interrupção para responder a diferentes tamanhos de tela.

Exemplo:


    import styled from 'styled-components';
    import { breakpoints } from 'theme-toolkit';
    
    const ResponsiveDiv = styled.div`
      width: 100%;
    
      @media ${breakpoints.inMobile} {
        background-color: blue;
      }
    
      @media ${breakpoints.inDesktop} {
        background-color: red;
      }
    `;

Font Size Helper

getFontSize(props): Retorna o tamanho da fonte baseado na propriedade variant fornecida.

Exemplo:

import styled from 'styled-components';
import { getFontSize } from 'theme-toolkit';

const Text = styled.span`
  font-size: ${(props) => getFontSize(props)}px;
`;

Line Height Helper

getLineHeight(props): Calcula e retorna a altura da linha baseado nas propriedades variant e lineHeightVariant.

Exemplo:

import styled from 'styled-components';
import { getLineHeight } from 'theme-toolkit';

const Text = styled.span`
  line-height: ${getLineHeight({ variant: 'medium', lineHeightVariant: 'tight' })}px;
`;

Theme Getter

getTheme(themeProp)(props): Retorna o valor de uma propriedade específica do tema.

Exemplo:

import styled from 'styled-components';
import { getTheme } from 'theme-toolkit';

const successMain = getTheme('success.main');

const Button = styled.button`
   background-color: ${successMain};
`;

Conditional Styler

ifStyle(prop)(truthy, falsy): Retorna estilos condicionalmente baseado na existência de uma propriedade.

Exemplo:

import { ifStyle } from 'theme-toolkit';

const isActive = ifStyle('$isActive');

const Button = styled.button`
  width: ${isActive('80px', '60px')};
`;

Web Checker

isWeb(): Verifica se o ambiente de execução é web. Exemplo:

import isWeb from 'theme-toolkit';

if (isWeb()) {
  // Lógica específica para a web
}

Pixel to REM converter

pxToRem(pixels, baseline): Converte pixels para a unidade rem.

Exemplo:

import styled from 'styled-components';
import { pxToRem } from 'theme-toolkit';

const SpacedDiv = styled.div`
  margin-top: ${pxToRem(20)};
  padding: ${pxToRem(15)} ${pxToRem(30)};
`;

Switch Styler

switchStyle(name)(stylesObj): Retorna estilos com base no valor de uma propriedade específica.

Exemplo:

import { switchStyle } from 'theme-toolkit';

const Button = styled.button`
  ${switchStyle('size')({
    small: 'font-size: 12px;',
    medium: 'font-size: 16px;',
    large: 'font-size: 20px;',
  })}
`;

Theme Formatter

themeFormatter(rawTheme): Transforma um tema bruto em um tema fluido. Exemplo:

import { themeFormatter } from 'theme-toolkit';

const fluidTheme = themeFormatter(myRawTheme);

Contribuição

Aceitamos contribuições! Sinta-se à vontade para enviar um Pull Request ou abrir uma Issue.