@particlesui/shared
v1.2.1
Published
Shared TypeScript interfaces and token schemas for Particles UI
Readme
@particlesui/shared
Shared Zod schemas, inferred TypeScript types, and token utilities for the Particles UI platform.
This package is consumed internally by
@particlesui/cliand the Particles UI backend and studio. You generally do not need to install it directly unless you are building integrations against the Particles UI API.
Installation
npm install @particlesui/sharedToken utilities
resolveTokenValue
Resolve a design token's value, following alias references to their final primitive value.
import { resolveTokenValue } from '@particlesui/shared'
const resolved = resolveTokenValue(token, tokensById)generateTailwindV4ThemeFromFlatTokens
Generate a Tailwind CSS v4 @theme block from a flat list of design tokens.
import { generateTailwindV4ThemeFromFlatTokens } from '@particlesui/shared'
const css = generateTailwindV4ThemeFromFlatTokens(tokens)
// → "@theme { --color-primary: #3b82f6; ... }"hasPermission
Check whether a role has a given RBAC permission.
import { hasPermission } from '@particlesui/shared'
hasPermission('developer', 'tokens:write') // → true
hasPermission('designer', 'branch:merge') // → falseSchemas
All data shapes are defined as Zod schemas. Types are always inferred — never hand-written.
import type { DesignToken, Project, Branch, Release } from '@particlesui/shared'Key schema groups:
| Export | Description |
|---|---|
| DesignTokenSchema | Single design token with value, type, and alias support |
| ProjectSchema | Project with org membership |
| BranchSchema | Branch with commit history |
| ReleaseSchema | Published token release |
| CreateTokenRequestSchema | Token change request payload |
| AccessTokenSchema | Personal access token (pat_…) for programmatic/MCP access |
ID generation
import { generateId } from '@particlesui/shared'
const id = generateId() // UUID v7License
MIT