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

@protoyard/core

v1.9.4

Published

Framework-agnostic contracts for Protoyard: manifests, scenarios, personas, permissions, simulation clock, environment, snapshots and themes.

Readme

@protoyard/core

Framework-agnostic contracts for Protoyard: zod schemas, TypeScript interfaces, and the small deterministic primitives every other package builds on. Its only runtime dependency is zod; Faker is imported for types only. Nothing here imports Svelte, Dexie or Node APIs.

Modules

| File | What it defines | | --- | --- | | manifest.ts | PrototypeManifestSchema for protoyard.json (id, slug, kind, platform, preview, storage namespace + schemaVersion, build flags, scenario ids), DevtoolsOptionsSchema (launcher.hidden, pixel offset, tone), DemoBadgeSchema (legacy booleans or { layer, avoid, phone }), ShellSchema, resolveShell, marketplace catalog metadata, parseManifest, MANIFEST_FILENAME | | slug.ts | checkSlug / isValidSlug / slugify, reserved slugs. This is the path-safety gate for the CLI. | | prototype.ts | definePrototype and PrototypeDefinition (manifest, DatabaseDefinition versions/migrations, scenarios, generate, optional context-free generateWorld(scenario) used for scenario loads, generatorVersion, policy, integrity, themes, timeline, applyEvent), WorldSeed, GenerateContext, RESERVED_TABLES | | scenario.ts | ScenarioSchema and its independent axes (organization, actor, density, activity, environment, appearance, generator knobs), defineScenario, parseScenarioLink / buildScenarioLink for safe reproducible links (including ?shell= and ?layout=) | | manifest.ts | PrototypeManifestSchema for protoyard.json (id, slug, kind, platform, preview (viewport, shell, device, orientation, chrome with fictional-only origins), storage namespace + schemaVersion, build flags including the optional build.review (ReviewBuildSchema, resolveReviewBuild: adapter local/cloudflare/http/artifact, safe endpoint, Cloudflare store kv/d1; ADR-025), scenario ids), ShellSchema, resolveShell (auto → phone for mobile, else none), the optional marketplace catalog block (CatalogSchema, CATALOG_CATEGORIES), parseManifest, MANIFEST_FILENAME | | scenario.ts | ScenarioSchema and its independent axes (organization, actor, density, activity, environment, appearance, generator knobs), defineScenario, parseScenarioLink / buildScenarioLink for safe reproducible links (including ?shell=, and review from ?comments=0/1 and ?review=<key>, REVIEW_KEY_PATTERN) | | session.ts | Organization, Persona (optional avatar: an av-NNN library id, an https:// URL or a root-relative path, checked by isPersonaAvatar / PersonaAvatarSchema), Membership, capability-based createPermissionPolicy (wildcards, -denials, record rules), PermissionDeniedError, resolvePrincipal | | clock.ts | createSimulationClock (preview vs committed time), createTimeHelpers, Duration | | time.ts | nextMonotonicIso(lastIso, now) — ISO timestamps that advance by at least 1 ms so rows sorted by at keep insertion order while the simulated clock is paused | | environment.ts | createSimulationEnvironment (network, latency, reproducible failure modes with optional failureScope, subscription, flags), EnvironmentPatchSchema (partial without defaults), SimulatedServiceError | | random.ts | Seeded createRng (mulberry32) with fork, deterministic createIdFactory, createRuntimeId for user-created rows | | events.ts | DomainEvent envelope and deterministic eventId() | | overrides.ts | OverridesSchema, resolveEffective and the value sources (override › preference › scenario › default) | | snapshot.ts | SnapshotSchema, validateSnapshot and parseSnapshotText (size limit, wrong-prototype rejection, schema-version checks). These never throw on untrusted input. | | devices.ts | Brand-neutral device catalog (DEVICES, DeviceSpecSchema: CSS size, corner radius, portrait/landscape safe areas, status bar, home indicator, cutout), getDevice, rotate, orient, safeAreaOf, fitScale. Data only, no DOM. | | layouts.ts | App layout contract (ADR-023): LAYOUT_IDS / LayoutIdSchema (custom is the default: the prototype renders its own), LayoutSettingsSchema for preview.layout ({ id, supported?, options? }), the LAYOUTS catalog (label, platforms, minWidth, fallback), getLayout, layoutChoices, layoutForWidth. Data only, no DOM. | | theme.ts | ThemeSchema, the token palette, the optional style profile (ThemeStyleSchema, DEFAULT_THEME_STYLE, resolveThemeStyle: typography, shape, elevation, surface, motion, focus ring), defineTheme, tokenToCssVar (--tx-*) | | validation.ts | ValidationError (issues: field path → first message, form for root issues) and parseInput(schema, input) for service inputs; runService in @protoyard/renderer-svelte leaves these errors to the form | | review.ts | Subpath @protoyard/core/review only (not in the barrel, so builds without review pay nothing): ReviewCommentSchema (formatVersion 1, plain-text body 1–2,000 characters, self-declared author 1–60 characters, wall-clock ISO timestamps), ReviewAnchorSchema, ReviewContextSchema, ReviewThreadSchema, groupReviewThreads, safeParseReviewComment, REVIEW_LIMITS. Comments are untrusted text: control and bidi-override characters are rejected, and nothing here renders markup. | | runtime.ts | PrototypeRuntime and its controllers (scenarios, session, overrides, theme, snapshots, data inspector), implemented by @protoyard/runtime |

Example

import { createPermissionPolicy, createRng, createSimulationClock } from '@protoyard/core';

const rng = createRng(42);
rng.int(1, 6); // same value on every machine for seed 42

const clock = createSimulationClock({ referenceTime: '2026-10-16T10:00:00Z' });
clock.preview({ days: 7 }); // UI-only; data is untouched
clock.clearPreview();

const policy = createPermissionPolicy({
  roles: { admin: ['*', '-billing:manage'], viewer: ['deals:read'] },
});

Rules for changes

  • Additive changes only, unless every consumer is updated in the same change. Contracts are shared by all packages and prototypes.
  • Erasable TypeScript only (erasableSyntaxOnly): no parameter properties, enums or namespaces. Vite loads configs through Node's type stripping.
  • Tests live in tests/core.test.ts (one file since PLAN_009). Run them with pnpm vitest run packages/core and type-check with pnpm --filter @protoyard/core typecheck.

Package output

The manifest keeps TypeScript source exports for workspace development. pnpm build:packages --filter engine creates the ESM and declaration files under dist/ that the packed manifest exposes.