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

@xmachines/play-solid

v2.0.0

Published

Solid renderer for XMachines Play architecture

Readme

@xmachines/play-solid

Solid renderer for XMachines Play architecture

License: MIT Version

SolidJS rendering layer that passively observes actor signals and renders UI components via @xmachines/json-render-solid. SolidJS reactivity is used solely to trigger re-renders — TC39 Signals are the source of truth.

Part of the xmachines-js monorepo.

Installation

pnpm add @xmachines/play-solid

Peer dependencies — install alongside the package:

pnpm add solid-js xstate @xstate/store @xmachines/json-render-solid @xmachines/json-render-core @xmachines/json-render-xstate

Quick Start

import { PlayUIProvider, PlayRenderer, defineRegistry } from "@xmachines/play-solid";
import { definePlayer } from "@xmachines/play-xstate";
import { defineCatalog } from "@xmachines/json-render-core";
import { schema } from "@xmachines/json-render-solid/schema";

// 1. Define a catalog (authCatalogDef is a plain object describing components/actions)
const catalog = defineCatalog(schema, authCatalogDef);

// 2. Build a component registry
const registryResult = defineRegistry(catalog, {
	components: {
		Home: () => <div>Welcome home!</div>,
		Login: (ctx) => <div>Login {ctx.props.error && <span>{ctx.props.error}</span>}</div>,
	},
	actions: {
		login: async (args) => actor.send({ type: "auth.login", username: args.username }),
		logout: async () => actor.send({ type: "auth.logout" }),
	},
});

// 3. Create and start an actor
const createPlayer = definePlayer({ machine: myMachine });
const actor = createPlayer();
actor.start();

// 4. Render
function App() {
	return (
		<PlayUIProvider actor={actor} registryResult={registryResult}>
			<PlayRenderer />
		</PlayUIProvider>
	);
}

Usage

PlayUIProvider + PlayRenderer (recommended)

PlayUIProvider is the batteries-included entry point. It wraps ActorProvider and JSONUIProvider into a single composite provider. PlayRenderer is a zero-prop leaf component that reads view context and renders the current spec.

import { PlayUIProvider, PlayRenderer, defineRegistry } from "@xmachines/play-solid";

<PlayUIProvider
	actor={actor}
	registryResult={registryResult}
	fallback={<div>Loading…</div>}
	onError={(err) => console.error(err)}
	navigate={navigateFn} // optional: passed to JSONUIProvider
	validationFunctions={valFns} // optional: form validation helpers
>
	<PlayRenderer />
</PlayUIProvider>;

ActorProvider (escape hatch)

For library authors who need direct control over provider composition:

import { ActorProvider, PlayRenderer } from "@xmachines/play-solid";

<ActorProvider actor={actor} registryResult={registryResult}>
	<PlayRenderer />
</ActorProvider>;

useActor hook

Access the raw actor instance anywhere inside an ActorProvider or PlayUIProvider tree:

import { useActor } from "@xmachines/play-solid";

function SubmitButton() {
	const actor = useActor();
	return <button onClick={() => actor.send({ type: "SUBMIT" })}>Submit</button>;
}

usePlayView hook

Access the resolved view context (spec, handlers, registry, store) from within the provider tree:

import { usePlayView } from "@xmachines/play-solid";
import { Renderer } from "@xmachines/json-render-solid";

const MyRenderer = () => {
	const view = usePlayView();
	return <Renderer spec={view.spec} registry={view.registry} />;
};

API Summary

Components

| Export | Description | | ---------------- | ------------------------------------------------------------------------------ | | PlayUIProvider | Batteries-included composite provider (recommended entry point) | | PlayRenderer | Zero-prop leaf component; renders the current view spec inside a provider tree | | ActorProvider | Lower-level smart provider for escape-hatch composition |

Hooks

| Export | Description | | --------------- | --------------------------------------------------------------------------------------------- | | useActor() | Returns the raw AnyPlayActor instance from context; throws outside a provider tree | | usePlayView() | Returns the current ViewContextValue (spec, handlers, registry, store); throws outside tree |

Context

| Export | Description | | -------------- | -------------------------------------------------------------------------------------- | | ActorContext | SolidJS context for the actor; use ActorContext.Provider directly as an escape hatch |

Re-exports from @xmachines/json-render-solid

This package re-exports the full @xmachines/json-render-solid public API so consumers do not need a direct dependency:

import {
	// Providers
	JSONUIProvider,
	StateProvider,
	ActionProvider,
	VisibilityProvider,
	ValidationProvider,
	// Renderer
	Renderer,
	// Registry factory + hooks
	defineRegistry,
	useBoundProp,
	useStateBinding,
	useStateValue,
	useStateStore,
	useActions,
	useAction,
	useIsVisible,
	useFieldValidation,
	useOptionalValidation,
	useVisibility,
} from "@xmachines/play-solid";

Key Types

| Type | Description | | --------------------- | ------------------------------------------------------------------------------ | | PlayUIProviderProps | Props for PlayUIProvider | | ActorProviderProps | Props for ActorProvider | | ViewContextValue | Shape of the context value from usePlayView() | | AnyPlayActor | AbstractActor<AnyActorLogic> — bare actor type accepted by context providers |

Testing

Run tests for this package in isolation:

pnpm --filter @xmachines/play-solid test

Or from within the package directory:

pnpm test          # single run (jsdom environment)
pnpm run test:watch  # watch mode
pnpm run test:ui     # interactive Vitest UI

Coverage is collected with v8 (80% threshold for lines, functions, branches, and statements). Browser-specific tests live in test/browser/ and are excluded from the default jsdom run.

License

MIT