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

@we-are-singular/svelte-chop-chop

v1.1.0

Published

Headless-first image cropping and editing SDK for Svelte 5. Zero runtime dependencies.

Downloads

380

Readme

svelte-chop-chop

Headless-first image cropping and editing SDK for Svelte 5. Zero dependencies beyond Svelte.

npm license

Documentation & Demo →


Features

  • <Cropper> — Lightweight crop component with handles, grid overlays, and transforms
  • <ImageEditor> — Full-featured editor with plugin-driven toolbar
  • Headless composablescreateCropper and createImageEditor for fully custom UI
  • Plugin system — filters, finetune, frame, watermark, resize (all opt-in)
  • PresetsprofilePicture, coverPhoto, productImage
  • Three themes — default, dark, minimal (CSS custom properties)
  • Zero runtime dependencies — peer dep: svelte ^5.0.0 only

Install

npm install @we-are-singular/svelte-chop-chop

Quick Start

Cropper

<script lang="ts">
  import { Cropper } from '@we-are-singular/svelte-chop-chop';
  import '@we-are-singular/svelte-chop-chop/themes/default';
</script>

<Cropper src="/photo.jpg" aspectRatio={16 / 9} style="height: 400px;" />

Image Editor

<script lang="ts">
  import { ImageEditor } from '@we-are-singular/svelte-chop-chop';
  import { pluginFilters } from '@we-are-singular/svelte-chop-chop/plugins/filters';
  import { pluginFinetune } from '@we-are-singular/svelte-chop-chop/plugins/finetune';
  import { pluginFrame } from '@we-are-singular/svelte-chop-chop/plugins/frame';
  import { pluginWatermark } from '@we-are-singular/svelte-chop-chop/plugins/watermark';
  import { pluginResize } from '@we-are-singular/svelte-chop-chop/plugins/resize';
  import type { ExportResult } from '@we-are-singular/svelte-chop-chop';
  import '@we-are-singular/svelte-chop-chop/themes/default';

  function handleExport(result: ExportResult) {
    const url = URL.createObjectURL(result.blob!);
    const a = document.createElement('a');
    a.href = url;
    a.download = 'edited.jpg';
    a.click();
    URL.revokeObjectURL(url);
  }
</script>

<ImageEditor
  src="/photo.jpg"
  plugins={[pluginFilters(), pluginFinetune(), pluginFrame(), pluginWatermark(), pluginResize()]}
  onexport={handleExport}
  style="height: 500px;"
/>

Cropper Props

| Prop | Type | Default | Description | | ------------------ | -------------------------------------------------------- | ------------------ | ----------------------------------------------------------- | | src | ImageSource | — | URL, data URL, File, Blob, or HTMLImageElement | | aspectRatio | number \| { min?: number; max?: number } \| null | null | Aspect ratio constraint | | sizeConstraints | SizeConstraints | — | Min/max width/height in pixels | | initialCropScale | number | 1 | Initial crop as fraction of image (0–1). 0.8 = 80% centered | | grid | "none" \| "rule-of-thirds" \| "grid" \| "golden-ratio" | "rule-of-thirds" | Grid overlay | | transitions | boolean | true | CSS transitions | | stencil | Component | CropStencil | Custom stencil component | | readOnly | boolean | false | Disable interaction | | class / style | string | '' | Root element styling |

Bindable: coordinates (CropCoordinates), transforms (TransformState) Events: onchange, onready, onerror


Headless Usage

import { createCropper } from "@we-are-singular/svelte-chop-chop/headless";
import { createImageEditor } from "@we-are-singular/svelte-chop-chop";

// Lightweight cropper (export uses full resolution — original image pixels)
const cropper = createCropper({ aspectRatio: 16 / 9 });
await cropper.loadImage("/photo.jpg");
const result = await cropper.export({ format: "image/webp", quality: 0.9 });

// Full editor
const editor = createImageEditor({ plugins: [pluginFilters()] });
await editor.loadImage("/photo.jpg");
editor.applyFilter("clarendon");
editor.rotate(90);
const result = await editor.export({ format: "image/webp", quality: 0.9 });
// result.blob, result.dataURL, result.canvas, result.coordinates, result.filters

Plugins

| Import | Description | | ----------------------------------------------------- | ------------------------------------------------ | | @we-are-singular/svelte-chop-chop/plugins/filters | 16 Instagram-style color filter presets | | @we-are-singular/svelte-chop-chop/plugins/finetune | Brightness, contrast, saturation, exposure, etc. | | @we-are-singular/svelte-chop-chop/plugins/frame | Decorative frame at export (solid, line, hook) | | @we-are-singular/svelte-chop-chop/plugins/watermark | Text watermark at export | | @we-are-singular/svelte-chop-chop/plugins/resize | Output width/height controls |

Custom Plugin

import type { ChopPlugin } from "@we-are-singular/svelte-chop-chop";

const myPlugin: ChopPlugin = {
  name: "my-plugin",
  setup(ctx) {
    ctx.registerAction({
      id: "my-action",
      label: "My Action",
      group: "tabs",
      execute: () => ctx.showPanel("my-panel"),
    });

    ctx.registerPostProcessor(async (drawCtx, canvas) => {
      // draw on canvas at export time
    });

    return () => {
      /* cleanup */
    };
  },
};

Presets

import { profilePicture, coverPhoto, productImage } from '@we-are-singular/svelte-chop-chop/presets';

// Spread into component props
<Cropper src="/photo.jpg" {...profilePicture} />

| Preset | Aspect | Max Size | Format | | ---------------- | ------ | --------------- | ------ | | profilePicture | 1:1 | 512px | JPEG | | coverPhoto | 16:9 | min 1200px wide | JPEG | | productImage | 1:1 | — | PNG |


Theming

@import "@we-are-singular/svelte-chop-chop/themes/default"; /* or dark, minimal */

Override any CSS custom property:

:root {
  --chop-bg: #1a1a2e;
  --chop-stencil-border: #e94560;
  --chop-toolbar-active: #e94560;
}

Available variables: --chop-bg, --chop-canvas-bg, --chop-color, --chop-border-radius, --chop-stencil-border, --chop-stencil-border-active, --chop-grid-color, --chop-overlay, --chop-toolbar-bg, --chop-toolbar-color, --chop-toolbar-active, --chop-transition-duration, --chop-transition-easing


Package Exports

| Path | Description | | -------------------------------------------------- | ------------------------------ | | @we-are-singular/svelte-chop-chop | Components, composables, types | | @we-are-singular/svelte-chop-chop/headless | createCropper composable | | @we-are-singular/svelte-chop-chop/plugins | All plugin factories | | @we-are-singular/svelte-chop-chop/presets | Preset bundles | | @we-are-singular/svelte-chop-chop/themes/default | Default CSS theme | | @we-are-singular/svelte-chop-chop/themes/dark | Dark CSS theme | | @we-are-singular/svelte-chop-chop/themes/minimal | Minimal CSS theme |


Keyboard Shortcuts

| Key | Action | | ------------------------- | ------------------------------- | | R / Shift+R | Rotate 90° CW / CCW | | H / V | Flip horizontal / vertical | | Ctrl+Z / Ctrl+Shift+Z | Undo / Redo | | + / - | Zoom in / out | | 0 | Reset crop to image bounds | | Escape | Reset all transforms | | Ctrl+F | Toggle filters panel | | Arrow keys | Move crop 1px (10px with Shift) |


License

MIT © We Are Singular