shtukbasehub

Design components

The component collection of a design: headers in component files become pages, a data file for lenses, a Custom Elements Manifest and Storybook stories; checks that the pages are fresh, uses exist, a level uses only levels below, and component CSS has tokens only.

Packagedesign-componentsv0.1.731 files

Design components

The components of a design, by level (primitive, composite, block, page), as a collection of pages that is made from the code. The record of a component is the YAML header in the first comment of its file (HTML or TS/TSX; the component header); the action sync turns every header into a page of the collection Components and into three files that other tools read.

What it installs

  • The collection Components with its views (by level, all components) and the page the component header.
  • The action place (runs by itself after install and update): adds the kind Component to the placement map /base/ontology/placement.md of the package layers, so that the layers check passes.
  • The action sync (runs by itself after install and update): reads every header under /design/*/components/** and the folders listed in sources: of the collection page, and writes
    • /design/components/<id>.md, one page per id, the HTML and the React implementation joined; the text under the page's header is kept;
    • lib/design/components.data.js (window.SB_COMPONENTS), which the lenses read;
    • /design/custom-elements.json, a Custom Elements Manifest;
    • /design/stories/<id>.stories.js, Storybook CSF 3 stories, one story per state.
  • Norms and their checks:
    • DSC-R01 fresh: the pages and the generated files are what sync writes now.
    • DSC-R02 uses-exist: every id in uses is a component.
    • DSC-R03 no-level-up: a component uses only its own level or below; no circles.
    • DSC-R04 tokens-only: component CSS has no raw colour outside the fallback of a var().
    • DSC-R05 health, mode warn: the health of a library in bands (full, missing, fallbacks, extra); it informs and never fails.
  • The convention A component library (page type Convention, see Conventions): what a library gives (names from shadcn, paths, the header, states), expects from a style (only contract names), may choose freely, the recipe for making an alternative, and its health.
  • Lens layout: the contract for interchangeable layouts. The lens shell lists the component slots and lens author API.
  • The header parser lib/header.ts (parseHeader, validateControls), which other packages import to test their own headers: import { parseHeader } from '../../design-components/lib/header.ts'.

Where the boundary is

  • The components themselves (markup, CSS, React code) are in the libraries (shtukbase-ui-html, shtukbase-ui-react); this package only describes and checks them.
  • The catalog lens that shows the components is in design-lenses; it reads lib/design/components.data.js.
  • The header of /design/design.md selects the style, libraries and layout. The sync action lists their CSS and the selected layout script in the design data.
  • Virtual records ("items from code", no page files) wait for the engine; the header format does not change when they come.