0.1.1 • Published 3d ago
@pantoken/flutter
Licence
MIT
Version
0.1.1
Deps
4
Size
7 kB
Vulns
0
Weekly
0
@pantoken/flutter
Emit Instructure design tokens as a Flutter (Dart) class, via Style Dictionary. It flattens the token IR to concrete, single-mode values and keeps the natively-typed tokens (colours, dimensions, numbers).
Install
npm i @pantoken/flutter
Usage
import { generateFlutter } from "@pantoken/flutter";
const file = await generateFlutter({
outDir: "./lib/tokens",
theme: "rebrand",
className: "PanTokens", // the generated Dart class name (default)
icons: ["add", "check"], // optional: also copy SVG assets + a PanTokensIcons manifest
});
Or via the CLI:
pantoken generate flutter --out ./lib/tokens
pantoken generate flutter --out ./lib/tokens --theme canvas --icons add,check
Output
- A single Dart file (named after
className, lower-cased) declaring a class ofColor,double, and numeric constants. - With
iconsset: the requested glyphs copied toassets/pantoken/icons/*.svgplus apantoken_icons.dartmanifest (aPanTokensIconsclass) for use withflutter_svg. Register the asset directory in yourpubspec.yaml.
API
generateFlutter(options): Promise<string>— emit Dart for a named theme (from the vendored@pantoken/tokensIR). Returns the written file path.toFlutter(tokens, options): Promise<string>— same, but for an explicit token IR. Returns the written file path.GenerateFlutterOptions— theoutDir,theme,mode,className, andiconsoptions both take.
Related
- Uses
@pantoken/tokensfor the vendored token IR and@pantoken/sd-configfor the Style Dictionary platforms.
License
MIT