Skip to content

The @sypnia/design package

One npm package for reading tokens, running the check, serving the gallery and reading Design files.

Applies to EngineCloud
View as Markdown
ImportFor
@sypnia/design/tokensreading your tokens in code (for charts, canvas, e-mails): readTokens(), token('color.accent')
@sypnia/design/checkrunning design check from your own scripts or tests
@sypnia/design/galleryserving the gallery from your own dev server
@sypnia/design/filesreading and validating the [design] table of sypnia.toml, gallery.yaml, screen files and icon rules
@sypnia/design/clientthe API: proposals, renders, exports Cloud or your engine
npx @sypnia/designthe CLI
TypeScript
import { readTokens, token } from '@sypnia/design/tokens';
const t = await readTokens();                 // reads design/tokens.json
t.color.accent.light;                         // "#E0A526"
token('color.accent');                        // "var(--espiga-color-accent)"
TypeScript
import { check } from '@sypnia/design/check';
const { errors, findings } = await check({ root: '.', renders: 'local' });
TypeScript
import { createDesign } from '@sypnia/design/client';
const design = createDesign({ token: process.env.SYPNIA_DESIGN_TOKEN! }); // or { baseUrl } for your engine
const p = await design.proposals.create({ project: 'la-espiga', kind: 'tokens', reason: 'Darker accent for the counter tablet', changes: { 'color.accent': '#C98E12' } });

The pieces themselves are not in this package: they are generated into your repository on top of @sypnia/base. ESM with types; Node 20 or later.

    Search pages, sections and terms