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

@peteai/presentation-editor

v0.0.9

Published

This project is a Svelte component library which lets you create a customizable presentation editors.

Readme

@peteai/presentation-editor

Introduction

This project is a Svelte component library which lets you create a customizable presentation editors.

Install

npm install @peteai/presentation-editor

Types

type Image = {
	id: string;
	src: string;
	width: number;
	height: number;
};

interface BaseLayer {
	id: string;
	x: number;
	y: number;
	width: number;
	height: number;
	rotate: number | null;
	opacity: number | null;
	sortOrder: number;
}

interface TextLayer extends BaseLayer {
	type: 'text';
	scale: number | null;
	html: JSONContent;
}

type LayerBorder = {
	borderStyle: 'solid' | 'dashed' | 'dotted' | null;
	borderWidth: number | null;
	borderColor: string | null;
};

interface ImageLayer extends BaseLayer, LayerBorder {
	type: 'image';
	scale: number | null;
	image: Image;
	offsetX: number | null;
	offsetY: number | null;
	cornerRadius: number | null;
	flipX: boolean;
	flipY: boolean;
}

type Layer = TextLayer | ImageLayer;

type Page = {
	id: string;
	backgroundColor: string | null;
	layers: Layer[];
	sortOrder: number;
};

Html editor

PresentationEditor is using Tiptap editor for TextLayer content editing.

JSONContent type provided by @tiptap/core is used for html content of TextLayer to store data in json format.

Settings

The PresentationEditor component accepts a bunch of settings. Here is a typescript definition of all available settings:

interface BaseOptions {
	images?: Image[];
	width?: number;
	height?: number;
	generateId?: () => string;
	onImageUpload?: (file: File) => Promise<Image>;
	onLayerAdd?: (pageId: string, layer: Layer) => Promise<Layer>;
	onLayerUpdate?: (pageId: string, layerId: string, layerType: string, changes: object) => void;
	onLayerRemove?: (pageId: string, layerId: string, layerType: string) => Promise<void>;
}

interface MultipleModeOption extends BaseOptions {
	mode?: 'multiple';
	pages?: Page[];
	onPageAdd?: (page: Page) => Promise<Page>;
	onPageUpdate?: (pageId: string, changes: object) => void;
	onPageRemove?: (pageId: string) => Promise<void>;
}

interface SingleModeOption extends BaseOptions {
	mode: 'single';
	page?: Page;
}

export type PresentationEditorOptions = MultipleModeOption | SingleModeOption;

Getting Started

import { createEditor } from '@peteai/presentation-editor';

// images list
const images: Image[];
// pages list
const pages: Page[];

const editor = new createEditor({
	target: document.querySelector('.target'),
	props: {
		// function for new pages and layers ids generation
		generateId: () => crypto.randomUUID(),
		images,
		pages,
		onImageUpload: async (file) => {
			// called when user uploads image
			// callback to store file and return Image
			// which will be added to the images list
			// new ImageLayer gonna be created if image file was dropped on page
			// ...
			return image;
		},
		onPageAdd: async (page) => {
			// called when new page is added
			// expect Page to be returned to overwrite newly created page
		},
		onPageUpdate: async (pageId, values) => {
			// called when page is updated
		},
		onPageRemove: async (pageId) => {
			// called when page is removed
		},
		onLayerAdd: async (pageId, layer) => {
			// called when new layer is added
			// expect Layer to be returned to overwrite newly created layer
		},
		onLayerUpdate: async (pageId, layerId, layerType, values) => {
			// called when layer is updated
		},
		onLayerRemove: async (pageId, layerId, layerType) => {
			// called when layer is removed
		},
	},
});

Single Page Mode

import { createEditor } from '@peteai/presentation-editor';

// images list
const images: Image[];
// pages list
const page: Page;

const editor = new createEditor({
	target: document.querySelector('.target'),
	props: {
		mode: 'single',
		// function for new pages and layers ids generation
		generateId: () => crypto.randomUUID(),
		images,
		page,
		onImageUpload: async (file) => {
			// called when user uploads image
			// callback to store file and return Image
			// which will be added to the images list
			// new ImageLayer gonna be created if image file was dropped on page
			// ...
			return image;
		},
		onLayerAdd: async (pageId, layer) => {
			// called when new layer is added
			// expect Layer to be returned to overwrite newly created layer
		},
		onLayerUpdate: async (pageId, layerId, layerType, values) => {
			// called when layer is updated
		},
		onLayerRemove: async (pageId, layerId, layerType) => {
			// called when layer is removed
		},
	},
});