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

@layera-labs/orbit-shared

v1.0.0-beta.4

Published

Shared utilities and types for Orbit SDK

Readme

@layera-labs/orbit-shared

The type vocabulary and small utilities that the v1 Orbit packages agree on: Layer, SceneGraph, OrbitConfig, the export and AI request/response shapes, plus cn, id generation, colour and number helpers, and a table of constants.

Almost nobody installs this on purpose. It arrives as a dependency of @layera-labs/orbit-core, @layera-labs/orbit-react, @layera-labs/orbit-ui, @layera-labs/orbit-effects and @layera-labs/orbit-agentic. Install it directly when you are writing something that has to name those types — your own AiBackend, your own asset provider, your own panel.

npm i @layera-labs/orbit-shared@beta

Beta. 1.0.0-beta.3 under the beta tag; the API moves without notice.

v1 line, which is legacy. The v2 stack has its own document types in @layera-labs/orbit-model and does not use this package. Layer here and Element there are different models of the same idea; there is no conversion helper in this direction (migrateSceneGraphToDocument in @layera-labs/orbit-model goes the other way).

Why the AI types live here and not in the AI package

This is the one non-obvious thing in the package, and it is load-bearing.

AgenticCanvasAction, CanvasAgentParams and CanvasAgentResponse are declared here rather than in @layera-labs/orbit-agentic, alongside GenerateParams and ExportJob. The reason: @layera-labs/orbit-react has to name them — AiBackend.runCanvasAgent is part of OrbitEditorProps — while @layera-labs/orbit-agentic is an optional peer of that package.

A type-only import erases from the bundle but not from the emitted .d.ts. So anchoring these shapes in the AI package left @layera-labs/orbit-react's declarations referring to a module that a consumer who declined the AI layer cannot resolve: a clean runtime install with a broken tsc. Both packages depend on this one unconditionally, so this is the only place both can point at.

Every member is expressed in terms this package already owns (ShapeContent, BlendMode, SceneGraph), which is what makes it a relocation rather than a duplication.

Utilities

import { cn, generateId, clamp, downloadBlob, hexToRgba } from '@layera-labs/orbit-shared';

cn('px-2', isActive && 'bg-orbit-accent');   // clsx + tailwind-merge

cn is the class merger every @layera-labs/orbit-ui component uses. The rest are grouped as utils/{cn,id,numbers,performance,files,colors} and all re-exported flat: generateId / generateLayerId / generateAssetId; clamp, lerp, mapRange, roundTo, toDegrees, toRadians; debounce, throttle, rafThrottle; downloadBlob, dataUrlToBlob, blobToDataUrl, fileToDataUrl; hexToRgba, rgbaToHex, interpolateColor, isValidHex, getContrastColor.

Several of these touch the DOM (downloadBlob, fileToDataUrl, rafThrottle), so the package is not safe to import wholesale on a server.

Constants

SOCIAL_PRESETS, ASPECT_RATIOS, KEYBOARD_SHORTCUTS, BLEND_MODES, EXPORT_QUALITY, EXPORT_SCALE, DEFAULT_FEATURE_FLAGS, TOOL_CONFIG, AI_MODELS, and canvas/zoom defaults.

ORBIT_VERSION is also exported, and as of 1.0.0-beta.3 it is generated from this package's package.json at the front of the build rather than typed by hand. It had been typed by hand, and it said "0.0.1" in a package published at 1.0.0-beta.3 — two orders of release out of date, because a constant kept in step with a manifest by remembering to is not a constant. A test fails the suite if the generated copy falls behind the manifest, so the two cannot disagree again.

ORBIT_BACKEND_URL has been removed. It defaulted to https://api.orbit.ai, a host nobody operates, and nothing in the SDK ever read it — so its only effect was to imply that a hosted Layera backend exists and that this is its address. A default aimed at a dead host is worse than none: it converts "you have not configured a backend" into a connection error thrown from inside a fetch, at request time, naming a domain the caller has never heard of. There is no Layera-operated backend. The URL of yours is now a required argument to @layera-labs/orbit-agentic's OrbitBackendAdapter, which throws at construction if it is missing.

API_ENDPOINTS stays, because it is not an address: it is the set of route shapes (/v1/generate, /v1/inpaint, …) that adapter posts to, relative to whatever base URL you give it — which is to say, what you implement if you are writing the service.

Links

MIT.