Introducing a new way to review your PRs.

Read the announcement

spartan-ng / spartan

Cutting-edge tools powering Angular full-stack development.

View on GitHub

18 documents · Updated Nov 23, 2026

docs / registry-schema-and-style-assets

Registry schemas and theme style assets

The registry is the shared contract for installable Spartan assets and their visual choices. It gives the CLI, the documentation site, and other consumers one model for registry records, theme tokens, and style bundles. See Component registry and theming for the wider registry flow and CLI and UI library generation for the consuming generation flow.

Registry contract

The registry contract turns asset data into checked records. The public registry library exports the schema and style catalog through libs/…/index.ts. The schemas in libs/…/schema.ts define the shapes that consumers can trust.

Workspace configuration

Workspace configuration connects a consumer project to a visual style, its Tailwind CSS entry point, its aliases, and optional remote registries. A registry URL must include the {name} placeholder so a requested item can map to a remote record. The advanced form also permits request parameters and headers.

The raw configuration describes user choices. The resolved configuration adds the paths that the workspace uses for source, components, utilities, library code, hooks, and Tailwind files. This separation keeps input choices distinct from paths derived for one workspace.

References: libs/…/schema.ts• L6-59

Registry item records

A registry item is the unit that describes an installable or distributable asset. Each item has a name. It can also carry a title, description, run-time dependencies, development dependencies, files, and CSS variables. Its type identifies its role, such as a component, UI library, block, hook, page, theme, style, base, or font.

Files carry a path and optional content. Page and file records require a target path. Other item types can use a target when their consumer needs one. This lets one item model describe both a file to place in a project and a higher-level asset with its own delivery rules.

Two item types add focused records to the common fields:

Item typeAdditional meaning
registry:baseCarries partial workspace configuration for a base setup.
registry:fontCarries font family, provider, import, variable, and optional weight and subset data.

References: libs/…/schema.ts• L61-157

Registry envelopes

The registry envelope groups a registry name and homepage with its item records. An index is the smaller form used when a consumer needs only an array of items. Related schemas describe style labels, icon maps, search results, remote registry summaries, and preset records. These shapes let registry data support both installation and discovery.

References: libs/…/schema.ts• L159-218

Theme metadata

Theme metadata describes the colors and surface tokens that a generated or previewed application can apply in light and dark modes. The exported THEMES collection in libs/…/themes.ts uses the registry item model. A theme is therefore discoverable as a registry:theme item with a stable machine name and display title.

Theme token sets

Each theme supplies optional light and dark maps under cssVars. The maps use semantic names instead of component-specific colors. They cover page surfaces and text, cards and popovers, actions, muted and accent states, destructive states, borders, inputs, focus rings, and sidebar surfaces.

The catalog includes neutral palettes such as Neutral, Stone, Zinc, and Gray. It also includes color-led variants such as Amber, Blue, Cyan, Emerald, Fuchsia, Green, Indigo, Lime, Orange, Pink, Purple, Red, Rose, Sky, Teal, Violet, and Yellow. These variants mainly change primary and sidebar-primary values while keeping the same semantic vocabulary.

Theme values use OKLCH color strings. The radius token belongs to the same semantic map. A theme can therefore change the visual tone without changing component markup or the names that components use to request a color.

References: libs/…/schema.ts• L96-100 libs/…/themes.ts• L3-68 libs/…/themes.ts• L269-316 libs/…/themes.ts• L669-696

Theme and style roles

A theme supplies semantic color and surface values. A style supplies the visual treatment of component parts, such as shape, spacing, size, and density. The two choices work together. A project can keep one style while changing its color theme, or preview the same component under several style bundles.

The registry exports six styles: nova, vega, lyra, maia, mira, and luma. Nova is the default entry. The CLI keeps a local copy of this catalog because its published package cannot depend on the unpublished registry package.

References: libs/…/style.ts• L1-3 libs/…/supported-styles.ts• L1-4 libs/…/index.ts• L1-2

CSS style bundles

The CSS assets are the visual layer for the style catalog. Each bundle groups rules below a style selector and maps semantic spartan-* component hooks to Tailwind utilities. The same component structure can therefore take a different visual form without changing its behavior.

Style catalog

The six bundles share one contract but express different visual systems:

BundleBroad visual role
style-nova.cssDefault baseline style for documentation and generated component previews.
style-vega.cssRoomier style with larger controls and more space around content.
style-lyra.cssSharp style with square corners and a zero-radius basis.
style-maia.cssRounded style with larger surfaces and strong pill-like controls.
style-mira.cssCompact style with smaller controls, text, and spacing.
style-luma.cssRounded style with strong input, slider, switch, and surface treatment.

These descriptions give visual direction rather than separate component APIs. All bundles target the same family of semantic hooks. Each bundle chooses its own shape, spacing, and emphasis. The bundles also keep chart presentation within the selected style through shared chart hooks and style-specific tooltip values.

References: libs/…/style-nova.css• L1-31 libs/…/style-vega.css• L1-50 libs/…/style-lyra.css• L1-57 libs/…/style-maia.css• L1-54 libs/…/style-mira.css• L1-54 libs/…/style-luma.css• L1-54

Component style hooks

The bundles describe visual states through semantic hooks such as spartan-button, spartan-input, spartan-card, spartan-dialog-content, and spartan-sidebar-menu-button. Variant and size hooks extend the same vocabulary for states such as default, secondary, destructive, outline, small, large, and icon-only.

The shared hook names are the key contract. A component can request a hook without knowing which style bundle is active. The active bundle supplies the visual rules for that hook and its interaction states. This model also covers broader surfaces such as code blocks, menus, messages, and questionnaires.

References: libs/…/style-nova.css• L215-347 libs/…/style-vega.css• L181-317 libs/…/style-lyra.css• L184-299 libs/…/style-maia.css• L185-317 libs/…/style-mira.css• L185-317 libs/…/style-luma.css• L83-142

Chart style hooks

Charts use the same style-bundle contract as other components. Every bundle provides a spartan-chart layout hook and a spartan-chart-tooltip hook. The tooltip hook connects chart settings to the active theme's popover, border, text, font, padding, and shadow values.

The chart contract keeps layout and theme integration stable while allowing style differences. Lyra uses a square tooltip. Mira uses a tighter text scale. Luma uses a larger radius with a softer shadow. Nova keeps the tooltip radius tied to the active theme radius. The other bundles keep the shared rounded tooltip treatment.

References: libs/…/chart-styles.spec.ts• L1-48 libs/…/style-lyra.css• L292-299 libs/…/style-mira.css• L310-317 libs/…/style-nova.css• L340-347 libs/…/style-luma.css• L1462-1469 libs/…/style-maia.css• L310-317 libs/…/style-vega.css• L310-317

Style bundle boundaries

The documentation site loads the bundles together so it can show several styles on one page. Nova acts as the page-wide baseline. The other styles form separate preview areas. Nova uses a scoped boundary to stop its baseline rules from entering those areas. The boundary names every non-Nova style so a new or renamed preview cannot silently inherit Nova rules.

Consumer projects do not need to ship that preview boundary. The CLI treats the bundles as a source of style mappings and carries the matching utility classes into generated component code. This preserves the selected style in a single-style consumer without requiring every preview bundle.

This flow shows how shared style source becomes either a documentation preview or a selected project style.

flowchart LR
    A[Style catalog] --> B[CSS style bundle]
    B --> C[Documentation previews]
    B --> D[Style mapping]
    D --> E[Generated consumer components]

References: libs/…/style-nova.css• L1-31 apps/…/styles.css• L15-21 libs/…/create-style-map.ts• L5-52 libs/…/transform-style-map.ts• L32-41

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the TypeScript registry schema aligned with the published JSON schema mirror named in libs/…/schema.ts.
  • Keep the registry style catalog and the CLI's local supported-style catalog in the same order. The first entry is the default style.
  • When adding or removing a style, update the preview containment boundary in style-nova.css so Nova does not leak into another style area.
  • Keep every style bundle's selector and spartan-* hook vocabulary compatible with the style-map extraction and transformation flow.
  • When changing chart hooks or tooltip variables, preserve the common chart contract and the style-specific treatments checked by chart-styles.spec.ts.
  • When changing theme token names, check both the theme metadata contract and the generated CSS variables that consume those names.
  • When changing a theme or style name, check discovery and selection surfaces that import STYLES or the theme metadata.

Important failure modes

TriggerConsequenceGuard
A registry URL omits {name}.A remote item cannot be addressed through the configured registry pattern.Validate the registry configuration with registryConfigSchema.
A registry:file or registry:page item omits target.The consumer has no required destination for the file or page.Use the discriminated file schema that requires target for those types.
A style is added to one style catalog but not the other.The CLI and registry can offer different style choices.Keep libs/…/style.ts and libs/…/supported-styles.ts synchronized.
A style bundle drops a needed spartan-* hook.A component can lose its style in previews or generated output.Preserve the shared hook vocabulary used by the style-map flow.
A chart bundle drops a tooltip variable or layout hook.A chart can lose its theme integration or fail the shared chart style contract.Keep the chart hooks in every bundle and run the catalog-wide chart style specification.
The Nova scope omits a preview style.Nova rules can cross into that preview and alter its appearance.Keep the Nova to (...) boundary aligned with every non-Nova style.
A semantic token name changes without matching generated CSS.Components can request a variable that is not defined in the selected theme.Treat token names in cssVars and generated :root blocks as one contract.

Key files

FileWhy to read it
libs/…/schema.tsDefines the registry, configuration, item, theme-token, style-list, and preset contracts.
libs/…/themes.tsDefines exported theme names, labels, light and dark token maps, and the derived theme type.
libs/…/style.tsDefines canonical style names and default ordering.
libs/…/index.tsShows the public registry exports used by consumers.
libs/…/chart-styles.spec.tsStates the shared chart layout and tooltip contract for every registered style.
libs/…/style-nova.cssShows the default style and the scoped boundary used to isolate other preview styles.
libs/…/style-vega.cssShows a complete alternate style bundle and its shared component hook vocabulary.
libs/…/style-lyra.cssShows the sharp, zero-radius style direction and its chart treatment.
libs/…/style-maia.cssShows the large rounded style direction.
libs/…/style-mira.cssShows the compact style direction and its chart text treatment.
libs/…/style-luma.cssShows the rounded surface and control style direction with its chart treatment.
libs/…/supported-styles.tsDefines the CLI copy of the style catalog and its default order.
libs/…/create-style-map.tsShows how style hooks become a mapping for generated output.
libs/…/transform-style-map.tsShows how the mapping is applied to generated component class strings.