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

@pandabox/prettier-plugin

v0.1.2

Published

Prettier plugin for Panda css

Downloads

603

Readme

@pandabox/prettier-plugin

Prettier plugin for Panda CSS.

Will sort style props based on your local panda.config.ts:

  • in any Panda function like css({ ... }) or stack({ ... })
  • in the css prop of any JSX component
  • etc...

Installation

pnpm add -D prettier @pandabox/prettier-plugin

Usage

{
  "plugins": ["@pandabox/prettier-plugin"]
}

Options

See below for more details.

{
  "pandaFirstProps": ["as", "className", "layerStyle", "textStyle"],
  "pandaLastProps": [],
  "pandaOnlyComponents": false,
  "pandaOnlyIncluded": false,
  "pandaStylePropsFirst": false,
  "pandaSortOtherProps": false,
  "pandaFunctions": []
}

Sorting

The plugin will dynamically resolve your panda.config.ts file and sort the style properties based on your utilities (keys and shorthands) and their associated group.

Each utility in the @pandacss/preset-base has a group name.

The group names and their order are:

const groupNames = [
  'System',
  'Container',
  'Display',
  'Visibility',
  'Position',
  'Transform',
  'Flex Layout',
  'Grid Layout',
  'Layout',
  'Border',
  'Border Radius',
  'Width',
  'Height',
  'Margin',
  'Padding',
  'Color',
  'Typography',
  'Background',
  'Shadow',
  'Table',
  'List',
  'Scroll',
  'Interactivity',
  'Transition',
  'Effect',
  'Other',
]
  • Conditions (_hover, _dark...) will be sorted after Other and are always sorted in the same order as in the generated CSS
  • Arbitrary conditions will be sorted after Conditions
  • Css will be sorted after Arbitrary conditions, since the JSX css prop will override any other JSX style prop with JSX patterns / styled factory

Finally, other (non-style) props will be sorted alphabetically.

Extending

You can extend the utilities in your panda.config.ts and bind (or re-bind an existing) them to a group name so that they will be sorted with the other utilities in that group.

export default defineConfig({
  utilities: {
    boxSize: {
      values: 'sizes',
      group: 'Width',
      transform: (value) => {
        return {
          width: value,
          height: value,
        }
      },
    },
  },
})

// will be sorted near the `width` prop
css({
  position: 'relative',
  boxSize: '2xl',
  width: '100%',
  fontSize: '2xl',
})

Options

pandaFirstProps

The first props to sort. Defaults to ['as', 'asChild', 'ref', 'className', 'layerStyle', 'textStyle'].

pandaLastProps

The last props to sort. Defaults to [].

pandaOnlyComponents

Only sort props in known Panda components (JSX patterns and <styled.xxx /> factory). Defaults to false.

pandaOnlyIncluded

Only sort props in files that are included in the config. Defaults to false.

pandaStylePropsFirst

Whether to sort the style props before the component props. Defaults to false.

pandaSortOtherProps

Whether to sort the other props alphabetically. Defaults to false.

pandaGroupOrder

The order of the style groups. Defaults to: ['System', 'Container', 'Display', 'Visibility', 'Position', 'Transform', 'Flex Layout', 'Grid Layout', 'Layout', 'Border', 'Border Radius', 'Width', 'Height', 'Margin', 'Padding', 'Color', 'Typography', 'Background', 'Shadow', 'Table', 'List', 'Scroll', 'Interactivity', 'Transition', 'Effect', 'Other', 'Conditions', 'Arbitrary conditions', 'Css']

pandaFunctions

A list of style functions to sort in addition to the default ones (css, cva, patterns, defineRecipe, defineSlotRecipe...). Defaults to [].

pandaConfigPath

The path to the panda config file. Only relevant when used programatically.

pandaCwd

The current working directory from which the config file will be searched for. Only relevant when used programatically.