Design lenses
Two lenses for the project's design, on the lens shell: the style specimen (a calm document of every token of the chosen style by group, in the page's theme, its pictures and pages) and the component catalog (the chosen one on the stage; the components by level, its States and its Settings in the right panel; links to the source and the page). They read any style and any library that keep the token contract.
About the package
Two lenses built with the lens kit of the lenses package. They read the installed style and library through the token
contract and the component data, so they work for any pair: swap the style in /design/design.md and rebuild.
What it puts in the project:
/design/style.html— the style specimen: one document column; colours as rows (a swatch, the name, the value, what it is for), hues as a table of their steps, type as a line in each family, radii, shadows, glows and edges, motion; each value in the page's theme (switch the theme for the other); the style's pictures (/design/<style>/assets/) and its own pages (/design/<style>/*.md). The contents are a section of the right panel./design/components.html— the component catalog (layoutcatalog): the stage fills the page, with the chosen component's name once, its description and quiet links (page, HTML, CSS, React, uses, used by); "All components" is a gallery. The right panel has three sections: Components (the tree: "All components", then the levels as folding rows with their components and counts, the chosen level open, built of the library's tree items), States (all side by side, or any one interaction or data state) and Settings (every control of the component; values on its root asdata-<control>, a slider as--<id>-<control>; kept in the link). The theme is the page's./design/design-lenses.md— this description for the project.
Data
lib/design/style.data.js(window.SB_STYLE) — written by this package'sbuildfrom the style named bystyle:in the header of/design/design.md: itstokens.jsonandtokens.dark.json(DTCG; a path maps to a name as indesign-tokens:sb.hue.1→--sb-hue-1), else its builttokens.css.checksays when it is stale.lib/design/components.data.js(window.SB_COMPONENTS) — written byshtuk run design-components sync.lib/explore.js,lib/explore.css— the panel of theexplore-kitpackage. Without them the catalog uses a small stand-in panel with the same call.
After installing or changing the style: shtuk run lenses build, shtuk run design-components sync,
shtuk run design-lenses build. Both lenses open from disk (a double click) and from the live server.
The look of the lenses
The lenses stand on the lens shell (/design/conventions/lens-shell.md of design-components): no top header, settings only
in the right panel (ui.settings, else the explore kit's panel, else plain selects), white surfaces, no frame inside a frame,
names once. Components are drawn in borderless frames that link only the chosen style's CSS and the resolved lib/design/ui.css, so the
lens's own CSS never touches them.
Where the boundary is
- Here: the two lenses and the build of the specimen's data.
- The component data, its checks, the Custom Elements Manifest and the stories:
design-components. - The panel:
explore-kit. The style: a style package such asshtukbase-style. The kit and its build:lenses.
Actions 2
| Name | What it does | File | When |
|---|---|---|---|
| build | Build the style specimen's data (lib/design/style.data.js) from the chosen style | actions/build.ts | shtuk run |
| check | Check that lib/design/style.data.js matches the chosen style | actions/check.ts | shtuk run |
shtuk check runs the checks; shtuk run design-lenses <name> runs any action. "After install" actions run by themselves only if the package comes from a trusted source.
Pages 3
They go into the project at these paths.
- /design/
- components.html lens
- Design lenses page
- style.html lens
Package files 17
They go into .shtukbase/packages/design-lenses/; actions run from there.