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

@openseat/editor

v0.1.0

Published

Visual layout designer for OpenSeat: tools, inspector, layers, undo/redo, import/export and save with conflict handling.

Readme

@openseat/editor

The OpenSeat visual layout designer: tool palette, canvas, properties inspector, layers panel, undo/redo, JSON import/export and saving with conflict detection.

import { LayoutEditor, type SaveHandler } from "@openseat/editor";
import "@openseat/editor/styles.css";

const save: SaveHandler = async ({ layout, baseRevision, manifest }) => {
  const res = await fetch(`/api/layouts/${encodeURIComponent(layout.id)}`, {
    method: "PUT",
    headers: { "Content-Type": "application/json", "If-Match": `"${baseRevision}"` },
    body: JSON.stringify({ layout, manifest }),
  });
  if (res.status === 409) return { status: "conflict", remote: (await res.json()).current };
  if (!res.ok) throw new Error(`Saving failed (${res.status}).`); // the edits are kept
  return { status: "saved", revision: (await res.json()).revision };
};

<div style={{ height: 720 }}>
  <LayoutEditor initialLayout={layout} onSave={save} />
</div>;

With @openseat/adapter-rest, adapter.saveLayout already has this signature: <LayoutEditor onSave={adapter.saveLayout} />.

Guides: Embedding the designer (props, saving and revisions, your own store, autosaved drafts, templates, prices), Integrating end to end.

What it does

| Area | Features | | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Tools | Select, pan, seat, generate rows (straight, curved, fill a section), section, table, booth, stage, rectangle, polygon, label, delete | | Canvas | Drag to move (rows and tables bring their seats), box select, rotate/resize handles, grid snapping, alignment guides to other objects' edges and centres, double-click a seat to select its row or table | | Inspector | Per-type fields (seat ID, label, row, section, category, shape, accessibility; table shape and capacity; section boundary and seats), align and distribute, group seats into a row, bulk category/section, layout and categories | | Layers | Objects topmost first with seats folded into their rows, filter, select, hide, lock | | History | One undo step per drag gesture, per inspector field edit (typing merges), per generated block; selection restored with undo/redo | | Templates | Venue template gallery (College events first, search, event chips, "How many people?" fitted across sizes, sizes, parameters, live preview); replace or insert, at a right-clicked point too; regenerate table and booth blocks; renumber tables and booths | | Files | Import from file or pasted JSON (validated, undoable); export only when valid | | Saving | Sends the base revision; on conflict shows both choices and never overwrites silently |

Keyboard: V select, H pan, S seat, R rows, A section, T table, B booth, G stage, M rectangle, P polygon, L label · Delete · Ctrl/⌘+Z, Ctrl/⌘+Shift+Z (Ctrl+Y) · Ctrl/⌘+D duplicate · Ctrl/⌘+A · Ctrl/⌘+S · arrows nudge (Shift for 10) · +/− zoom · 0 fit · Enter finishes a polygon · Esc cancels. Shortcuts are scoped to the editor and ignored while typing in a field. Rotation snaps to 15°; hold Shift for 90°, Alt for free rotation. Hold Alt while moving to turn snapping off (Alt at drag start duplicates). Slider drags are one undo step each.

Props

| Prop | Type | Notes | | --------------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | initialLayout | LayoutDocument | Or pass store to control the editor from outside. | | onSave | SaveHandler | Without it the Save button is disabled. | | onChange | (layout) => void | After every change (only when the editor creates its own store). | | categoryPrices | Readonly<Record<string, string>> | Display prices per category ID ({ vip: "₹1,499" }). Prices belong to the host, not the layout. Shown in the preview, the ticket-type legend and the Ticket types list. | | onCategoryPricesChange | (next: Record<string, string>) => void | Adds a Price column to the categories editor; receives the whole new map (an emptied price is removed). | | currency | CurrencyControl | A currency picker ({ code: "INR", options, onChange }) at the top of the Ticket types panel; hidden when omitted. | | previewMapRef | { current: BookingMapHandle \| null } | The buyer preview's BookingMap handle while the preview is open. | | mapRef | { current: SeatMapHandle \| null } | The canvas handle, for host zoom controls or screenshots. | | wheelMode | "zoom" \| "pan" | Default for the mouse wheel. The top-bar Wheel toggle overrides it and is remembered per browser (localStorage, when available). | | theme, showLayers | | Canvas colours; hide the layers panel with showLayers={false}. | | onBeforeDestructiveChange | (change) => boolean \| Promise<boolean> | Asked before a template replace, template re-run or block regeneration removes inventory (change.removedInventoryIds); return false to cancel. Without it the user types REPLACE. | | isCategoryLocked | (id: string) => boolean | Ticket type IDs that can no longer change (an event sells them): their Ticket type ID field is read-only with "Used by an event". Without it every ID can change. |

import { useState } from "react";
import { LayoutEditor } from "@openseat/editor";

export function PricedEditor() {
  // Format with the event's currency, not the browser's language.
  const [prices, setPrices] = useState<Record<string, string>>({ vip: "₹1,499", std: "₹299" });
  return (
    <LayoutEditor initialLayout={layout} onSave={save} categoryPrices={prices} onCategoryPricesChange={setPrices} />
  );
}

The buyer preview (top-bar Preview) shows the BookingMap with prices in the legend, tooltips and summary. A layout with sections opens on the section overview with seats hidden until a section is chosen, as buyers see it.

Venue templates

The Templates button (and the "Start from a venue template" card on an empty layout) opens the template gallery: the College events tab first, then all venues and ten categories, search by venue or event ("auditorium", "hackathon", "garba"), event chips, How many people? first ("400", fitted to the setup and, when the current size is more than 5% off, to the closest size), size presets, the setup's parameters, a live preview and a summary with what is not for sale. Replace layout keeps the layout's ID; Insert into layout namespaces IDs (t1:…), suffixes clashing section labels with (2) and keeps your ticket types. Creating is one undo step and, with onCategoryPricesChange, moves to the first price field, showing the template's suggested price ("e.g. ₹499") as a placeholder. A Next steps card in the side panel then lists Set ticket prices (with onCategoryPricesChange), Check it as a buyer and Save (with onSave), ticking each off as it is done.

The gallery, its thumbnails and @openseat/core/templates load lazily, in their own chunks, the first time they are needed; nothing template-related is in the editor's main bundle. Selecting a table or booth from a template block shows Regenerate block in the inspector; Selecting several booths, tables, sections or zones shows a Number… / Name… card at the top of the inspector (also Number all N booths… on one booth, and Renumber tables/booths… on the right-click menu) that relabels them in reading order with a prefix and first number, without touching IDs. Hosts can open the gallery from outside with store.getState().requestDialog("template").

A host that shows the gallery in its own UI can import it from the @openseat/editor/templates entry point (TemplateGalleryDialog and TemplateGalleryDialogProps), lazily with a dynamic import() so it stays out of the host's main bundle. It edits the editor's store, so render it inside EditorContext.Provider.

src/react/templates/thumbnails.generated.ts is generated: after a builder change, run pnpm --filter @openseat/core build && pnpm --filter @openseat/editor thumbnails (a test fails while it is stale).

Saving and conflicts

onSave receives { layout, baseRevision, force, manifest } (the inventory manifest) and resolves with { status: "saved", revision } or { status: "conflict", remote }. Your server should reject the save when its stored revision differs from baseRevision.

On conflict the editor offers Load their version (undoable, so local work is recoverable) or Overwrite with mine (saves again with force: true and the remote revision as the new base). Edits made while a save is in flight stay marked unsaved.

Save guard

Before saving, the editor compares the inventory with the last saved layout. When seats would be removed and the host passes isInventoryInUse (an InventoryInUseCheck: given the removed seat IDs, return the ones with tickets sold or held), a save that removes only unsold seats goes ahead without asking. Otherwise the editor shows a plain SaveRemovalDialog that names the seats ("Row C, Seat 5 (Stalls) and 3 more will be removed. 2 of them have tickets sold or held; those buyers will need new seats."), never seat IDs. Save and remove calls save({ confirmRemovals: true }); Cancel (the default) calls cancelPendingSave(). Hosts driving the store read pendingSaveDiff ({ removedSeatIds, addedSeatIds, changedSeatIds, inUse?, described, total }), and saveRemovalMessage(diff) gives the dialog's sentence for custom shells. The export dialog's Inventory manifest tab shows the same counts since the last save. Custom shells can also use the TableGridDialog component and the store actions requestDialog, setNotForSale and addCategory (see the docs' editor reference).

Limits

| What | Limit | | ---------------------------- | ---------------------------------------------------------------------------------------------------------------- | | Import (file or pasted JSON) | 20 MB (MAX_IMPORT_BYTES); larger files are refused before they are read | | Arena preset | 8 tiers, 100 rows per tier, 50 sections per side, field 100,000 units, 200,000 seats (refused before generating) | | Table seats | 500; with Auto-grow off a smaller table drops the chairs that no longer fit | | Number fields | Out-of-range values are clamped and the field says so ("Max 500") |

Download file names are the layout ID made safe (filenameSlug): letters, digits, ., _ and - only, at most 80 characters.

Driving it from outside

import { createEditorStore } from "@openseat/editor";

const store = createEditorStore({ layout, onSave, onChange: (l) => autosaveDraft(l) });
store.getState().apply("Rename", (l) => ({ ...l, name: "Main hall" }));
store.getState().undo();
// <LayoutEditor store={store} onSave={onSave} />

The store is framework-independent (Zustand vanilla). history, snapping, shortcuts and tools modules are exported for custom UIs, with helpers a host's own pages can share with the designer:

  • ticket types: ticketAmounts, amountText and revenueEstimate (seats, standing places and booths, so booth income counts), samePriceGroups with removeCategoryMovingTo (merge types that cost the same), neverSoldCategoryIds and withCategorySellable (the Sell link), and for ticket type IDs store.getState().renameCategoryId(from, to) (one undo step, core renameCategory), ticketTypeIdProblem, isPortableTicketTypeId (1 to 128 printable ASCII characters) and withRenamedPrice;
  • rows: setCategoryOnRowRange(store, sectionIds, "A", "D", "vip") ("front 4 rows VIP" in several sections as one undo step), sectionRowLabels, rowsInRange; and paintTargetsAt / seatNearPoint, the seats a paint click at a point changes;
  • words: plainErrorMessage(store.message) turns core's developer errors into sentences an organiser can act on, and isUntitledName(name).

For a custom shell, the React panels are exported too. Render them inside an EditorContext.Provider (as LayoutEditor does): Inspector, LayersPanel, ScopeBar, IssuesPanel with useLayoutIssues(), and PreviewPane. The context's ui object (EditorUi) opens dialogs (EditorDialogKind), runs commands as their shortcuts do (runCommand({ type: "delete" }) asks before deleting a section with seats) and carries the category prices.

Styling

Import @openseat/editor/styles.css once. Override the custom properties on .os-editor (--os-accent, --os-bg, --os-border, --os-font, …) to re-theme; each defaults to the shared interface token (--os-ui-accent, …) from uiTokenCssVariables in @openseat/theme-default, so setting those themes the editor and your own pages together. Pass a theme from @openseat/theme-default for canvas colours.