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

@nderscore/tamagui-typescript-plugin

v0.6.0

Published

Typescript Language Server Plugin for [Tamagui](https://tamagui.dev).

Downloads

10,900

Readme

@nderscore/tamagui-typescript-plugin

Typescript Language Server Plugin for Tamagui.

Features

  • Show Tamagui theme/token values in TypeScript autocomplete suggestions

  • Show Tamagui theme/token values on hover

  • Graphical previews for color and theme tokens

  • Automatically reloads when your config is updated by the Tamagui compiler

  • Granular filtering options for autocomplete suggestions

  • Translations for shorthand properties (e.g. p -> padding)

  • Smart sorting of autocomplete suggestions:

    • Tokens with numbers get sorted in numeric order

    • Negative space tokens get sorted after postive ones

    • Theme tokens always come before any Color tokens

    • Unprefixed tokens sort before scale-specific tokens ($scale.token)

Screenshots

Theme tokens

Theme Token Screenshot

Translucent Color Screenshot

Quick info on hover

Quick Info Color Hover Screenshot

Quick Info Space Hover Screenshot

Quick Info Shorthand Hover Screenshot

Sorted space tokens

Space Token Screenshot

Changelog

See the changelog for the latest changes.

Setup

  1. Install @nderscore/tamagui-typescript-plugin package in your project:

    yarn add @nderscore/tamagui-typescript-plugin
    # or
    pnpm add @nderscore/tamagui-typescript-plugin
    # or
    npm add @nderscore/tamagui-typescript-plugin
  2. Add plugin to your tsconfig.json with settings:

    {
      "compilerOptions": {
        "plugins": [
          {
            "name": "@nderscore/tamagui-typescript-plugin",
            // all settings are optional, the defaults are shown below as an example:
            //
            // relative or absolute path to a tamagui app (parent folder of .tamagui)
            "pathToApp": "apps/next",
            //
            // the default theme to show for theme tokens when inlined
            "defaultTheme": "light",
            //
            // the size (in pixels) of color tiles in previews
            "colorTileSize": 18,
            //
            // set false to hide translations for shorthand properties
            "showShorthandTranslations": true,
            //
            // options for filtering autocomplete suggestions
            "completionFilters": {
              //
              // set false to hide non-theme color tokens
              "showColorTokens": true,
              //
              // set false to hide $true and $-true tokens from all scales
              "showTrueTokens": true,
              //
              // per-scale lists of specific token names to exclude from autocomplete results
              "custom": {
                // "themeColor": [],
                // "color": [],
                // "size": [],
                // "space": [],
                // "radius": [],
                // "zIndex": []
              }
            }
          }
        ]
      }
    }

    For monorepos:

    In a monorepo, like the tamagui starter template, you may have multiple tsconfig.json for each of your workspace packages. If your packages' configurations extend from one or more base configurations, you should add the plugin to each one of those base configs and not to the individual packages.

    For the tamagui starter project, the base tsconfigs are:

    • tsconfig.json
    • tsconfig.base.json
    • apps/next/tsconfig.json
  3. Make sure your VSCode is configured to use typescript from your workspace:

    • Open VSCode Command Palette -> Select Typescript Version... -> Use Workspace Version

Usage in Expo-only (no-Next.js) Tamagui projects

Currently, the @tamagui/babel-plugin may not generate a .tamagui directory with your configuration cached inside.

If you encounter this issue, you can use a temporary workaround to generate it manually:

Expo-only workaround

  1. Add @tamagui/static to your project:

    yarn add @tamagui/static
  2. Create a script generate-tamagui-json.js and fill in with your settings if needed:

    // generate-tamagui-json.js
    const { loadTamagui } = require('@tamagui/static');
    
    loadTamagui({
      config: 'tamagui.config.ts',
      components: ['tamagui'],
    });
  3. Execute node generate-tamagui-json.js to generate a .tamagui directory in your Expo project folder.

    This script will need to be ran manually after changing your theme/tokens.

Contributing

If you would like to contribute to this project, please see the contributing guide.