Libraries
A library is a stylesheet that sets Design system 1’s --ds-* and --one-* tokens: type, colours, corners and the other documented component choices. Load it after Design system 1’s stylesheet, and the Lit elements follow it.
The component module is still required. A library is CSS only: it does not register custom elements or implement their behavior.
Try one in the browser
Section titled “Try one in the browser”The playground opens the components beside the visual box-model controls. Its changes are temporary: copy the stylesheet to keep it.
Library sites and Library apps show whole pages, each drawn by a different library. The downloadable HTML examples use the components directly in HTML, with no build step.
Published libraries
Section titled “Published libraries”A published library is a public stylesheet at /ds1/<id>/latest.css. Every version also stays at its own address, /ds1/<id>/v/<n>.css, written once and never changed. Keep secrets and private content out of a library.
Pin a version in a product
Section titled “Pin a version in a product”latest.css changes with every publish. A product that wants to know what it carries pins one version instead.
Name the library and version under Design system 1 in the product’s sync.json:
{ "library": { "to": "src/design", "id": "<library id>", "version": 4 } }Sync 1 fetches that version, checks it against the hash the publish recorded and its stamp, and copies it unchanged to ds1-library/<id>/v/4.css with ds1-library/library-manifest.json (its address, revision and sha256). sync.lock.json records both files’ hashes at the Design system 1 commit, and sync1 check fails if either is edited. "sha256" also checks the version against a hash you name; "styles": false leaves out the run-time connector, library-styles.ts, for a to in public/. Import the copy as any stylesheet. To move to a new version, change version and run sync1.
A version published before publishing stamped libraries cannot be pinned.
Keep a library as a file
Section titled “Keep a library as a file”A product can also keep its library as a file it edits itself and prepare it as publishing does. Take library-prepare under Design system 1 in its sync.json:
{ "library-prepare": { "to": "tools/design" } }Sync 1 copies one Node script with no dependencies, prepare-library.mjs. The draft sets only the library’s own --one-* tokens; the script writes, after each one, the --ds-* component tokens that follow it, the link-as-button faces and the revision stamp:
node tools/design/prepare-library.mjs library.css > public/library.css- reads the draft from standard input. Preparing a prepared library gives the same library. When the components take a new library token, the next sync1 brings it, and preparing the draft again writes it.