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

@genetik/context-events

v0.0.2

Published

Framework-agnostic **contract and utilities** for page context and events in the Genetik render tree. Context is namespaced state (e.g. `context.forms`, `context.auth`) that blocks can read and update; events are emitted to the host with a payload (e.g. `

Readme

@genetik/context-events

Framework-agnostic contract and utilities for page context and events in the Genetik render tree. Context is namespaced state (e.g. context.forms, context.auth) that blocks can read and update; events are emitted to the host with a payload (e.g. forms:submit). React integration (providing context via React context, consuming in blocks) lives in @genetik/renderer-react and @genetik/editor-react; this package defines only types and utilities.

Installation

pnpm add @genetik/context-events

API summary

Types

  • PageContext — Namespaced context object (Record<string, unknown>).
  • PageEventPayload — Event payload (unknown).
  • PageEventCallback(eventName: string, payload: PageEventPayload) => void.
  • PageRuntimeOptions{ context?: PageContext; onEvent?: PageEventCallback } (passed to renderer/editor).

Utilities

  • getContextValue(context, path) — Read value at dot-separated path (e.g. "forms.values.email"). Returns undefined if missing or path empty.
  • setContextValue(context, path, value) — Set value at path; creates nested objects. Mutates context. No-op if path empty.
  • hasContextValue(context, path) — True if value at path is not undefined.
  • createEventEmitter(onEvent) — Returns (eventName, payload) => void that calls onEvent or no-ops if onEvent is undefined.

Minimal example

import {
  getContextValue,
  setContextValue,
  createEventEmitter,
  type PageContext,
  type PageRuntimeOptions,
} from "@genetik/context-events";

const context: PageContext = { forms: { values: {} } };

setContextValue(context, "forms.values.email", "[email protected]");
getContextValue(context, "forms.values.email"); // "[email protected]"

const onEvent = (name: string, payload: unknown) => {
  console.log(name, payload);
};
const emit = createEventEmitter(onEvent);
emit("forms:submit", context);

const options: PageRuntimeOptions = { context, onEvent };
// Pass options to the renderer (e.g. renderer-react) so the tree can use context and emit events.

Conventions

  • Context is namespaced (e.g. context.forms, context.auth) so plugins don't collide.
  • Events are prefixed (e.g. forms:submit). The host can route by prefix.

See also

  • Architecture and implementation plans are in the repo under docs/ (context-and-events-plan.md, context-events-implementation-plan.md).
  • Docs site: @genetik/context-events — concepts and integration with the renderer.