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

@cartella/presets

v1.3.0

Published

Built-in document presets for Cartella — id-card, certificate, generic

Downloads

140

Readme

@cartella/presets

Built-in document presets for Cartella — a field registry, default canvas, and preview data set per document kind, ready to drop into <Studio>.

Install

pnpm add @cartella/presets @cartella/core @cartella/studio

Shipped presets

| Preset | documentType | Size | Pages | Field groups | | ------------------- | -------------- | ------------------------------------- | ----------- | ------------------------------------ | | idCardPreset | id-card | 342 × 216 px (ISO ID-1 at ~4×) | Front, Back | Student, School, Guardian, Program | | certificatePreset | certificate | 1123 × 794 px (A4 landscape @ 96 DPI) | Certificate | Recipient, Program, Issuer, Ceremony |

Every preset ships with:

  • A full FieldRegistry — every field has a realistic previewValue
  • A complete defaultCanvas — every declared binding has a layer on the page
  • At least one PreviewDataSet so the editor's live preview is legible without consumer data
  • validatePreset(preset) passes with zero issues (every preset is unit-tested against its own registry)

Usage

Out-of-the-box

import { idCardPreset } from '@cartella/presets';
import { Studio } from '@cartella/studio';

function CardEditor() {
  return (
    <Studio
      preset={idCardPreset}
      onSave={async (canvas) => {
        /* persist to your backend */
      }}
    />
  );
}

The preset prop seeds the canvas, wires the field palette, and registers validators. <Studio> takes care of the rest.

Mix & match

Every piece is exported individually if you want to reuse one part and customise the others:

import { idCardFieldRegistry, ID_CARD_WIDTH, ID_CARD_HEIGHT } from '@cartella/presets';
import { definePreset } from '@cartella/core';

// Use Academia's registry with your own starter canvas.
const customPreset = definePreset({
  documentType: 'id-card',
  label: 'School ID (custom layout)',
  pages: [
    { label: 'Front', width: ID_CARD_WIDTH, height: ID_CARD_HEIGHT },
    { label: 'Back', width: ID_CARD_WIDTH, height: ID_CARD_HEIGHT },
  ],
  fieldRegistry: idCardFieldRegistry,
  defaultCanvas: myOwnCanvas,
});

Validating a custom preset

validatePreset performs the cheap structural checks that catch the mistakes that crash <Studio> at mount time:

import { validatePreset } from '@cartella/presets';
import { myPreset } from './my-preset.js';

const result = validatePreset(myPreset);
if (!result.ok) {
  for (const issue of result.issues) {
    console.error(`${issue.path}: ${issue.message}`);
  }
  throw new Error('Preset failed validation');
}

Checks:

  • documentType + label non-empty
  • fieldRegistry.documentType matches preset.documentType
  • defaultCanvas passes core.validate() against the registry
  • pages[] length + dimensions match defaultCanvas.pages
  • No duplicate previewDataSets labels

Design

License

MIT