UI icon package builds
The UI icon build system turns one generated icon catalog into raw SVG files, framework components, and a web-served SVG distribution. It keeps the icon names, seven looks, metadata, and visual output aligned across the site and the published @thesvg/ui* packages.
Generated UI icon data
The generated data is the contract shared by the website and all UI icon packages. Source set files describe the glyphs, while the build records the available looks, sets, tags, release dates, quality results, and paths that downstream builders use. Current package releases also expose richer per-icon meaning data such as domain, concept, and modifiers.
Source and manifest contract
src/…/*.json is the source for the UI icon catalog. scripts/…/build-data.ts reads these sets, renders every glyph in the seven looks, checks slugs and quality, and writes the manifest at src/…/ui-icons.json together with one JSON file per look. The generated set import list at src/…/sets.generated.ts lets the site load the same source sets without maintaining a second list.
The manifest is the hand-off point for package builds. It names the icons and looks and points consumers to the generated look data or to the web path ui/…/{look}.svg.
References: scripts/…/build-data.ts• L1-13 scripts/…/build-data.ts• L27-39 scripts/…/build-data.ts• L63-75 scripts/…/build-data.ts• L90-103 src/…/ui-icons.json• L1 packages/…/CHANGELOG.md• L7-11
Derived SVG and site files
The look JSON files hold complete SVG text for each icon and look. @thesvg/ui copies that data into its published dist layout and also writes one plain SVG file per icon and look. The site build uses the same look files to create public/…/<look>.svg, which supports direct web and CDN-style access without treating those files as source.
Icons with a defined motion preset also have an animated SVG form in the raw package and in the site output. The shared motion rules remain plain CSS so the same idea works in an image file and in framework components.
References: packages/…/build.mjs• L1-26 scripts/…/emit-svgs.mjs• L1-24 scripts/…/anim-runtime.mjs• L1-22
Package surfaces
The package family offers different forms of the same catalog. The raw package serves tools and plain-file consumers, while framework packages wrap the same SVG markup in typed components and preserve per-icon imports for small bundles. The current package line is version 4.4.0 across the raw and framework packages.
Raw SVG package
@thesvg/ui is the web-neutral distribution. Its dist folder contains the manifest, the per-look JSON files, and svg/…/<look>.svg files. Its export map exposes these paths rather than a component runtime, so a build tool, CDN URL, design tool, or plain HTML page can consume the artwork directly.
The package uses the seven look names from the manifest. The SVG artwork uses currentColor, which lets inline use follow the surrounding text color; an image URL does not inherit that color from its page.
References: packages/…/package.json• L16-28 packages/…/build.mjs• L11-26 packages/…/README.md• L7-17 packages/…/README.md• L37-50 packages/…/CHANGELOG.md• L3-11
Framework binding packages
The framework packages share one package builder and differ only in the component profile for their target runtime. The builder creates shared support files, one module per icon, declarations, and root barrels. Each icon module contains an export for every look, which gives consumers both a simple package import and a focused per-icon subpath. React, Vue, and React Native publish ESM, CommonJS, and type entry points; Svelte publishes Svelte-aware component and type entry points.
| Package | Binding surface | Main package concern |
|---|---|---|
@thesvg/ui-react | Typed React SVG components | React props, refs, motion, and optional lift shadow |
@thesvg/ui-vue | Typed Vue 3 components | Vue attributes, motion, and optional lift shadow |
@thesvg/ui-svelte | Svelte component files and declarations | Svelte-native component resolution and attributes |
@thesvg/ui-react-native | React components backed by react-native-svg | Native color input and native SVG support |
The browser-oriented bindings use inner SVG markup and a shared runtime for scoped IDs and optional motion. The React Native binding uses full SVG text because its renderer does not provide browser currentColor or CSS filter behavior in the same way. This is a target-runtime difference, not a second icon catalog.
References: scripts/…/package-builder.mjs• L62-79 scripts/…/package-builder.mjs• L81-118 scripts/…/package-builder.mjs• L121-147 packages/…/build.mjs• L4-32 packages/…/build.mjs• L4-35 packages/…/build.mjs• L1-4 packages/…/build.mjs• L4-29 packages/…/package.json• L16-40 packages/…/package.json• L25-61 packages/…/package.json• L25-61 packages/…/package.json• L25-63
Web distribution
The web distribution has two related roles. @thesvg/ui is the installable raw-file package, while public/ui is a site build artifact served at the UI icon routes. Both are projections of the generated look files, so a change to the catalog must reach the data build before either distribution is rebuilt.
The UI icon web experience uses the catalog and the generated SVG paths for browsing and detail views. This page covers the build boundary; that page covers how people interact with the resulting web experience.
References: scripts/…/emit-svgs.mjs• L1-10 scripts/…/emit-svgs.mjs• L12-24 packages/…/build.mjs• L13-24 package.json• L8-16
Build pipeline
The build pipeline moves from source sets to committed generated data, then from that data to package and site outputs. A check mode compares generated content with the repository instead of changing it, which makes stale data visible in local and CI checks.
Data generation
Run pnpm ui:build after a source set changes. The data builder validates slug shape, duplicate names, tag coverage, SVG output, and quality thresholds before it writes the manifest, look files, and generated set list. pnpm ui:check runs the same generation logic in comparison mode and fails when those outputs are stale.
The root build runs SVG emission as part of the wider site build. It does not replace the data build; it consumes the committed look files produced by the data step.
References: package.json• L8-16 scripts/…/build-data.ts• L27-39 scripts/…/build-data.ts• L67-89 scripts/…/build-data.ts• L106-124
Package generation
Each UI package has a local build script. The raw package reads the manifest and look files directly. The React, Vue, Svelte, and React Native packages use the shared package builder, which reads the same manifest and embeds the matching SVG content into their generated dist files. Each package publishes only its generated dist output and README, so the package export map must continue to match that layout.
The generators clear their package dist directory before writing. This prevents removed icons and old look files from remaining as accidental public imports. Package metadata then limits publication to the generated dist content and its README.
References: scripts/…/package-builder.mjs• L13-23 scripts/…/package-builder.mjs• L66-79 scripts/…/package-builder.mjs• L122-147 packages/…/package.json• L22-28 packages/…/package.json• L32-40 packages/…/package.json• L41-47 packages/…/package.json• L39-45 packages/…/package.json• L41-47
Validation contract
The package checks protect the relationship between the manifest and generated output. Framework package tests rebuild the package and then verify that every icon and look has the expected files and barrel exports. They also check shared ID scoping and the animation runtime. The root UI test combines data freshness checks with these package checks.
The export maps are part of the contract. A generated file is not a usable public entry point unless the package map and barrel expose it for the intended module system. The package metadata also declares the peer runtime each binding needs, including React Native and react-native-svg for the native package.
References: scripts/…/validate-package.mjs• L1-18 scripts/…/validate-package.mjs• L24-50 package.json• L14-16 packages/…/package.json• L16-38 packages/…/package.json• L25-51 packages/…/package.json• L25-55
Package relationships
The package family has one data source and several consumer projections. The UI icons and design system page gives the broader model of the catalog, rendering engine, product routes, and distributions; this page narrows the view to the hand-off from generated data to published artifacts.
Source-to-consumer flow
When a UI icon source set changes, the system follows this sequence:
- The data build renders the source glyphs in every supported look.
- The manifest and look files become the shared generated contract.
- The raw package and framework packages read that contract and rebuild their
distdirectories. - The site build emits web SVG files from the same look files.
- Package and root checks confirm that names, looks, files, and exports remain aligned.
This diagram shows how one generated catalog feeds the installable and web-facing surfaces.
flowchart TD
A[UI source sets] --> B[UI data build]
B --> C[Manifest and look JSON]
C --> D[@thesvg/ui raw package]
C --> E[Framework package builder]
E --> F[@thesvg/ui-react]
E --> G[@thesvg/ui-vue]
E --> H[@thesvg/ui-svelte]
E --> I[@thesvg/ui-react-native]
C --> J[Site SVG emission]
J --> K[public/ui web distribution]
References: scripts/…/build-data.ts• L1-6 packages/…/build.mjs• L11-24 scripts/…/package-builder.mjs• L66-118 scripts/…/emit-svgs.mjs• L7-24
Change checklist
When these files or sections are changed, remember to consider these:
- Changes to a source set or to the list of looks require
pnpm ui:buildbefore package or site builds. The generated manifest, look files, and set import list must stay together. - Changes to manifest slugs or look names affect raw SVG paths, framework file names, component exports, and package barrels at the same time.
- Changes to SVG markup must remain valid for browser SVG and for
react-native-svg; the native package does not share every browser behavior. - Changes to animation presets must cover both standalone SVG output and the copied framework runtime.
- Changes to a package export map must match the generated file layout. Root exports and per-icon subpaths are separate public contracts.
- Removing an icon or look requires a clean package rebuild so stale files do not remain importable.
- Changes to package peer dependencies or entry-point conditions must stay aligned with the binding runtime and generated module format.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A source set changes without a data rebuild | Packages and the site publish old or incomplete icon data | Run pnpm ui:build and pnpm ui:check |
| A generated manifest lists a slug or look that a package builder cannot read | A package build stops or misses an icon export | Keep manifest, look files, and set data generated as one output group |
A package build does not clear dist | Removed icons or looks remain as stale public imports | Use the package build scripts that remove dist first |
| A file exists but its export map or barrel omits it | Consumers cannot resolve the expected root or subpath import | Check package exports and generated index files together |
| Browser SVG behavior is assumed in React Native | Color, filters, motion, or markup can render incorrectly | Review native binding rules and run the package validator |
| A source SVG contains invalid output or falls below the quality limit | The data build fails before packages can publish | Correct the source set or rendering input and rerun the data check |
| A binding declares the wrong peer runtime or module condition | A consumer can install the package but cannot load or render it | Keep package metadata aligned with the generated binding surface |
Key files
| File | Why to read it |
|---|---|
| scripts/…/build-data.ts | Defines the generated manifest, look files, set list, and data checks. |
| src/…/ui-icons.json | Shows the shared icon, look, set, and web-path contract consumed by package builders. |
| src/…/sets.generated.ts | Shows the generated link from the site back to the source icon sets. |
| scripts/…/package-builder.mjs | Defines the common framework package layout and generated module contract. |
| packages/…/build.mjs | Defines the raw SVG package contents. |
| packages/…/build.mjs | Shows the React binding profile used by the shared builder. |
| packages/…/build.mjs | Shows the Vue binding profile used by the shared builder. |
| packages/…/build.mjs | Connects the Svelte package to its generated component layout. |
| packages/…/build.mjs | Shows the native binding profile and its renderer-specific contract. |
| scripts/…/emit-svgs.mjs | Creates the site-facing SVG distribution from generated look files. |
| scripts/…/validate-package.mjs | Checks icon coverage, look exports, ID scoping, and animation support. |
| packages/…/package.json | Defines the raw package name, export paths, build checks, and published files. |
| packages/…/package.json | Defines the React package entry points, peer runtime, and publication contract. |
| packages/…/package.json | Defines the Vue package entry points, peer runtime, and publication contract. |
| packages/…/package.json | Defines the Svelte package entry points, peer runtime, and publication contract. |
| packages/…/package.json | Defines the native package entry points and its React Native SVG peer contract. |