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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@three-flatland/skia

v0.1.0-alpha.3

Published

Lightweight CanvasKit alternative — Skia's core GPU rendering in ~1 MB of WASM, built with Zig

Downloads

492

Readme

@three-flatland/skia

GPU-accelerated 2D vector graphics for three-flatland and Three.js — Skia compiled to WASM with Zig. Includes a native WebGPU backend (Graphite/Dawn) alongside WebGL — a lightweight CanvasKit alternative at less than half the size.

Alpha Release — this package is in active development. The API will evolve and breaking changes are expected between releases. Pin your version and check the changelog before upgrading.

npm license

Install

npm install @three-flatland/skia@alpha

Requirements

  • three >= 0.183.1 (WebGPU/TSL support)
  • React >= 19.0.0 (for @three-flatland/skia/react)
  • @react-three/fiber >= 10.0.0-alpha.2 (for React)

Features

  • Dual Backend — auto-detects WebGPU (Graphite/Dawn) or WebGL (Ganesh) from your Three.js renderer
  • Vector Graphics — rects, circles, ovals, lines, paths, rounded rects, clipping
  • Path Operations — boolean ops (union, intersect, difference, XOR), simplify, path effects
  • Text — FreeType rendering, font loading (TTF/OTF), measurement, metrics, text on path
  • Gradients & Shaders — linear, radial, sweep gradients, Perlin noise, image tiling
  • Image Filters — blur, drop shadow, morphology, displacement, color matrix
  • Three.js Scene GraphSkiaCanvas, SkiaGroup, shape nodes as Object3D children
  • React Three Fiber<SkiaCanvas>, JSX shape elements, useSkiaContext(), useLoader for fonts, attachSkiaTexture
  • 857 KB brotli (WebGPU) / 1 MB (WebGL) — vs CanvasKit's 2.2 MB (see what we include and exclude)

Quick Start

Three.js

import { Skia } from '@three-flatland/skia'
import { SkiaCanvas, SkiaRect, SkiaFontLoader } from '@three-flatland/skia/three'

const skia = await Skia.init(renderer) // auto-detects WebGPU or WebGL

const canvas = new SkiaCanvas({ renderer, width: 512, height: 512 })
const rect = new SkiaRect()
rect.x = 10; rect.y = 10; rect.width = 200; rect.height = 100
rect.fill = [1, 0, 0, 1]
canvas.add(rect)

// In your animation loop:
canvas.render(true) // true = invalidate + draw
material.map = canvas.texture

React Three Fiber

import { useLoader } from '@react-three/fiber/webgpu'
import { SkiaCanvas, SkiaRect, SkiaFontLoader, attachSkiaTexture } from '@three-flatland/skia/react'

function SkiaPanel() {
  const renderer = useThree((s) => s.gl)
  return (
    <mesh>
      <meshBasicMaterial transparent premultipliedAlpha>
        <SkiaCanvas attach={attachSkiaTexture} renderer={renderer} width={512} height={512}>
          <skiaRect x={10} y={10} width={200} height={100} fill={[1, 0, 0, 1]} />
        </SkiaCanvas>
      </meshBasicMaterial>
    </mesh>
  )
}

// Fonts: useLoader returns a SkiaTypeface, call .atSize() for sized font
function TextDemo() {
  const typeface = useLoader(SkiaFontLoader, '/fonts/Inter.ttf')
  const font = typeface.atSize(24)
  return <skiaTextNode text="Hello Skia" font={font} fill={[1, 1, 1, 1]} x={10} y={30} />
}

Import Paths

| Path | Contents | |------|----------| | @three-flatland/skia | Core API — Skia, SkiaPaint, SkiaPath, SkiaFont, SkiaTypeface | | @three-flatland/skia/three | Three.js scene graph — SkiaCanvas, SkiaRect, SkiaGroup, shape nodes, loaders | | @three-flatland/skia/react | R3F integration — re-exports everything + useSkiaContext, attachSkiaTexture, JSX types |

WASM Setup

Vite works with zero config — the WASM loads from node_modules automatically during development.

For production or non-Vite bundlers, copy the WASM files to your public directory:

npx skia-wasm public/skia

Then point Skia to them:

// Option 1: explicit URL
const skia = await Skia.init(renderer, { wasmUrl: '/skia/skia-gl.wasm' })

// Option 2: env vars (replaced at build time by your bundler)
// webpack.config.js
new DefinePlugin({
  'process.env.SKIA_WASM_URL_GL': JSON.stringify('/skia/skia-gl.wasm'),
  'process.env.SKIA_WASM_URL_WGPU': JSON.stringify('/skia/skia-wgpu.wasm'),
})

Building from Source

Requires Zig 0.15.1. All other tools are downloaded automatically.

pnpm --filter=@three-flatland/skia skia:setup

| Prerequisite | Install | |------|---------| | Zig 0.15.1 | brew install zig (macOS) / ziglang.org | | Python 3 | System package manager | | C/C++ compiler | xcode-select --install (macOS) / build-essential (Linux) |

WASM toolchain (wasm-tools, wit-bindgen, wasm-opt) is installed locally to .tools/ with pinned versions and SHA256 verification.

Skia Version

Pinned to chrome/m147 (Chrome 147 stable release branch).

Documentation

Full docs, interactive examples, and API reference at thejustinwalsh.com/three-flatland

License

MIT


This README was created with AI assistance. AI can make mistakes — please verify claims and test code examples. Submit corrections here.