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

@openfantasymap/lcars-react

v0.2.0

Published

React components + hooks for the LCARS design system, wrapping @openfantasymap/lcars-core.

Readme

@openfantasymap/lcars-react

React components + hooks for the LCARS design system — thin, typed wrappers over @openfantasymap/lcars-core (the Stylus/CSS + data-binding runtime). No styling lives here; this package maps props → classes / CSS variables and adds React-idiomatic reactivity.

Install

npm install @openfantasymap/lcars-react @openfantasymap/lcars-core react react-dom

Load the core stylesheet once, and wrap your UI in <Lcars> (or any element with class="lcars"):

import '@openfantasymap/lcars-core/dist/lcars.css';
import { Lcars, LcarsButton, LcarsGauge } from '@openfantasymap/lcars-react';

export function App() {
  return (
    <Lcars theme="tng">
      <LcarsGauge value={68} color="primary" label="Shields" />
      <LcarsButton color="danger" shape="rounded" onClick={engage}>Engage</LcarsButton>
    </Lcars>
  );
}

<Lcars theme="…"> applies a theme/faction skin: tng · picard · ds9 · voyager · klingon · romulan · cardassian · ferengi.

Components

Every core component has a wrapper, grouped by category:

  • LayoutLcars, LcarsRow, LcarsColumn, LcarsPanel, LcarsApp (+ …Sidebar/Header/Content), LcarsSpacer, LcarsGrow
  • PrimitivesLcarsElbow, LcarsBar, LcarsBarGroup, LcarsBarVertical, LcarsBracket, LcarsTextBox, LcarsReadout
  • ToolsLcarsButton, LcarsToggle, LcarsSlider, LcarsKeypad (+ LcarsKeypadKey), LcarsIndicator
  • SystemsLcarsGauge, LcarsBarGraph, LcarsDataCascade, LcarsWarpCore, LcarsAlert
  • NavigationLcarsNav (+ Item/Spacer/Group), LcarsTabs (+ LcarsTab), LcarsBreadcrumb (+ LcarsCrumb)
  • ConnLcarsCompass, LcarsScanner (+ LcarsScannerContact), LcarsStarmap (+ Star/Ship/Waypoint/Course/Label), LcarsHelm
  • EngineeringLcarsConduit, LcarsPower (+ LcarsPowerRow), LcarsMsd
  • CommsLcarsComms (+ LcarsCommsChannel), LcarsWaveform, LcarsHail
  • TransporterLcarsTransporterPad, LcarsTransporter
  • ControlsLcarsDpad (8-way directional pad)
  • OverviewLcarsOverview (annotated-SVG schematic)

Data-driven components take their value as a prop (mapped to a CSS variable):

<LcarsSlider value={72} color="secondary" showValue />
<LcarsCompass heading={87} mark={21} />
<LcarsHelm warp={6.2} impulse={75} throttle={80} readouts={[{label:'ETA', value:'00:14'}]} />
<LcarsMsd saucer="nominal" hull="warning" nacelleRight="critical" />

Hooks (live data)

Reactivity is built on the core store via useSyncExternalStore:

import { useLcarsStore, useLcarsValue, useSimulate } from '@openfantasymap/lcars-react';

function Bridge() {
  const store = useLcarsStore({ shields: 98, heading: 87 });
  useSimulate(store, { shields: [20, 100], heading: { min: 0, max: 359, step: 8, wrap: true } });

  const shields = useLcarsValue<number>(store, 'shields');
  const heading = useLcarsValue<number>(store, 'heading');
  return (
    <Lcars>
      <LcarsGauge value={shields} label="Shields" color={shields < 30 ? 'danger' : 'primary'} />
      <LcarsCompass heading={heading} />
    </Lcars>
  );
}
  • useLcarsStore(init) — create/memoise a store (or adopt an existing one)
  • useLcarsValue(store, key) — subscribe to one key
  • useLcarsValues(store, keys) — subscribe to several
  • useSimulate(store, spec) — demo telemetry for the component's lifetime
  • useLcarsBind(store) — a ref that binds raw data-bind-* markup / inline SVG

Wire a real feed by calling store.set(...) from MQTT/WebSocket/etc.

Directional pad

<LcarsDpad onSelect={(dir) => console.log(dir)} />  // dir: 'N' | 'NE' | … | 'NW'

Config-driven rendering

Describe a screen as JSON and render it through a widget registry. Structural types (row/column/panel/spacer/grow) recurse over content; any other type resolves through the registry. (Angular inputs/outputs/events/text → React props/children.)

import { LcarsRender, type LcarsWidgetRegistry } from '@openfantasymap/lcars-react';

const registry: LcarsWidgetRegistry = {
  button: { component: LcarsButton, props: (n) => ({ color: n.color, onClick: () => fire(n.action) }), children: (n) => n.label },
  gauge:  { component: LcarsGauge,  props: (n) => ({ value: n.value, label: n.label }) },
};

const screen = {
  type: 'row', fill: true,
  content: [
    { type: 'gauge', value: 72, label: 'Shields' },
    { type: 'spacer' },
    { type: 'button', color: 'danger', label: 'Red Alert', action: 'alert' },
  ],
};

<LcarsRender node={screen} registry={registry} />

Overview (annotated SVG)

import svg from './deck.svg?raw'; // or a URL string

<LcarsOverview svg={svg} title="Deck 5" autoConnect
  onSelect={(id) => console.log(id)} />

autoConnect seeds + binds a store from the SVG's annotations (see core docs). Pass your own store via store={…} to drive it from app state.

Build

npm run build       # tsup → dist (ESM + CJS + .d.ts)
npm run typecheck   # tsc --noEmit
npm run verify      # SSR render sanity checks

Targets React ≥ 18 (peer). Builds on Node ≥ 16.

Releasing

.github/workflows/publish.yml publishes to npm (public) on a v* tag (provenance enabled). Add the repo secret NPM_TOKEN. CI builds against the published @openfantasymap/lcars-core (it swaps the local file: dev link for a real version — override via the workflow's core-version input), so publish core first.

npm version patch && git push --follow-tags