Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions documents/DOCS-SITE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The docs site

**Scope:** The docs site's commands, its generated sources, the rules its pages keep, its theme and what it leaves to hosting.
**Scope:** The docs site's commands, its symbol font, its generated sources, the rules its pages keep, its theme and what it leaves to hosting.

The docs site shows each component of `@noldova/ui.components.angular` with its description, live examples and their code, its states and its API.
It is an Angular app in `src/noldova.ui.components.angular.docs`, built against the kit's source, never published as a package, and drawn only with the kit's own components, tokens, fonts and icons, apart from the GitHub and X marks its header shows.
Expand All @@ -11,13 +11,21 @@ It is an Angular app in `src/noldova.ui.components.angular.docs`, built against
|---|---|
| `npm run docs:api -w src/noldova.ui.components.angular.docs` | Writes the API reference alone. |
| `npm run docs:build -w src/noldova.ui.components.angular.docs` | Writes the generated sources, then prerenders every page into `_build/docs`. |
| `npm run docs:test -w src/noldova.ui.components.angular.docs` | Writes the generated sources, then runs the site's tests in Chromium, held to 100% coverage of `src/` without the files the README's coverage table names, and fails when a spec file reports no result or a function, statement or branch goes unreached. It then serves the site `npm run docs:build` wrote to `_build/docs/browser`, which must run first, opens each page the menu links in Chromium, and fails when a page or a favicon the page links isn't served, a favicon's type isn't an image, its one h1 isn't its menu title, a component page shows no example or an empty one, an example's code shows no highlighted token, a table, the docs' own or a Markdown one, breaks a word across lines or wraps a name, a key name or a type but before a `|`, at 1280 or 375px wide, or the browser logs an error, as a failed hydration does. |
| `npm run symbols -w src/noldova.ui.components.angular.docs` | Refreshes the site's subset of the symbol font, as the [kit's symbols tool](KIT.md) does for any site, then needs `npm run docs:build` again. |
| `npm run symbols:check -w src/noldova.ui.components.angular.docs` | Fails when the committed subset, its record, `src/styles.css` or the glyphs the site draws disagree. |
| `npm run docs:test -w src/noldova.ui.components.angular.docs` | Writes the generated sources, then runs the site's tests in Chromium, held to 100% coverage of `src/` without the files the README's coverage table names, and fails when a spec file reports no result or a function, statement or branch goes unreached. It then serves the site `npm run docs:build` wrote to `_build/docs/browser`, which must run first, opens each page the menu links in Chromium, and fails when a page or a favicon the page links isn't served, a favicon's type isn't an image, its one h1 isn't its menu title, a component page shows no example or an empty one, an example's code shows no highlighted token, a page draws a glyph the subset lacks or loads another copy of the symbol font, the icon chooser's page aside, which must load the whole font, a table, the docs' own or a Markdown one, breaks a word across lines or wraps a name, a key name or a type but before a `|`, at 1280 or 375px wide, or the browser logs an error, as a failed hydration does. |

The site compiles the kit's source, through the docs package's `tsconfig.json` paths and the kit's stylesheets in its `angular.json`, not the kit that `npm run build:components` installs; still, each command needs `npm run build:components` first, which installs the root's packages and the browser the site's tests use, and checks only that the kit is installed at the root as the sign that it ran; the root's `npm run build:docs` runs only this package's `docs:build`, which fails with a line saying to run `npm run build:components` first when the kit isn't built, and the root's `npm run build` runs `npm run build:components` then `npm run build:docs`; the API reference is read from the kit's declarations, `src/noldova.ui.components.angular/src/api/*.d.ts`, and its source.
The docs package's own `test`, which an unfiltered `npm test` runs after the kit's, builds and tests the site on Linux; on other platforms, in a filtered run, and with `NOLDOVA_SEPARATE_TEST=docs`, which the CI targets set, it leaves them out, and the CI run's "Separate test" job checks the site once, on Linux x64, with `npm run build` and `npm run test:docs`, as the [README](../README.md#checks) says.
Its spec run prints each test as it ends, with its file and name, through Vitest's `verbose` reporter, so a long spec file, such as the component page's, shows its progress, and a run that stops making progress shows the last test that ended.
The commands' scripts are in the package's `scripts/`, and its Angular workspace is its own `angular.json`.

## Symbol font

The site loads the kit's `styles/kit-without-symbol-font.css` and its own subset of Material Symbols Rounded, `public/assets/fonts/material-symbols-<SHA-256>.woff2`, with its notice and license in `public/assets/licenses`, rather than the whole font, as [KIT.md](KIT.md) says.
`scripts/docs/docs-symbols.ts` reads the site's `src/`, the kit's gallery source the site renders and the `glyphs.json` the kit's source gives, written to `_build/docs-symbols`, and leaves the icon chooser's list out: only its page shows it, and `src/styles.css` gives its glyphs the whole font from `node_modules/material-symbols` under a family of their own, which the build copies to `media/`.
The docs package's scripts load the kit's `scripts/source-imports.ts`, which resolves the kit source's `.js` imports to its `.ts` files.

## Generated sources

The folder `_build/docs-generated` is written by every docs command, emptied first so that a warm build writes what a clean one does, and is never edited by hand; nothing is written under the docs app's `src/`.
Expand Down
4 changes: 2 additions & 2 deletions documents/KIT.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,12 @@ The icon chooser's and the gallery's lists hold every name of the set, since the

A site gets its subset from the entry `@noldova/ui.components.angular/symbols`, a Node.js tool that loads in no browser:
- Its `MaterialSymbols` takes where the site keeps its subset as a `MaterialSymbolsSite`, whose defaults a site overrides in a class of its own, and fails with a `MaterialSymbolsException`, a `UiComponentsException`.
It reads the union of the `glyphs.json` lists of the kit's parts the site's code imports, the icons its templates draw between the symbol class's span tags or give a part as `icon="…"`, the glyphs its code keeps in a field whose name ends in glyph, as an `IconName` or a string, and the names the site gives it for icons its code builds; a refresh, which the site runs as `npm run symbols`, downloads that subset from Google Fonts with its license, keeps it in the site's fonts folder named by its SHA-256, points the site's `@font-face` at it and records the address the site serves it at, its SHA-256 and its source in the site's license notice.
It reads the union of the `glyphs.json` lists of the kit's parts the site's code imports, the icons its templates draw between the symbol class's span tags or give a part as `icon="…"`, the glyphs its code keeps in a field whose name ends in glyph or starts with glyph and a capital, such as `glyphShield`, as an `IconName` or a string, the same icons and glyphs of the other folders of code its pages show, its `moreCode`, and the names the site gives it for icons its code builds; a refresh, which the site runs as `npm run symbols`, downloads that subset from Google Fonts with its license, keeps it in the site's fonts folder named by its SHA-256, points the site's `@font-face` at it and records the address the site serves it at, its SHA-256 and its source in the site's license notice.
- Its check, `npm run symbols -- --check` in the site's checks, fails when the committed font, its record, its stylesheet or the glyphs the site draws disagree.
- Its `drawnGlyphs` and `loadedFonts` page expressions and `findPageProblemsAsync` let the site's check of its built pages fail on a page that draws a glyph the subset lacks, or that loads another copy of the font, such as the whole font `kit.css` brings.

Such a site loads `styles/kit-without-symbol-font.css` in place of `styles/kit.css`: everything `kit.css` loads but the whole font, with the symbol class's rule from material-symbols' own `rounded.css`, every declaration but the font, in `styles/symbols.css`, first, so the class gets the same declarations from either; it declares the subset's `@font-face` for the family `Material Symbols Rounded` itself.
The icon chooser draws any glyph of the set in that class, so a site that shows it keeps `styles/kit.css` and the whole font.
The icon chooser draws any glyph of the set in that class, so a site that shows it keeps `styles/kit.css` and the whole font, or shows it only on a page that loads the whole font under a family of its own for the chooser's glyphs and names the chooser in its `wholeFontParts`, which the subset then leaves out, as the kit's docs site does.

## Controls

Expand Down
2 changes: 1 addition & 1 deletion src/noldova.ui.components.angular.docs/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
],
"styles": [
"../noldova.ui.components.angular/src/styles/theme.css",
"../noldova.ui.components.angular/src/styles/kit.css",
"../noldova.ui.components.angular/src/styles/kit-without-symbol-font.css",
"src/styles.css"
]
},
Expand Down
8 changes: 5 additions & 3 deletions src/noldova.ui.components.angular.docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
"scripts": {
"docs:api": "node scripts/generate-api.ts",
"docs:build": "node scripts/build-docs.ts",
"docs:test": "node scripts/test-docs.ts",
"test": "node scripts/test-docs.ts --suite",
"test:timing": "node scripts/test-docs-timing.ts"
"docs:test": "node --import ../noldova.ui.components.angular/scripts/source-imports.ts scripts/test-docs.ts",
"test": "node --import ../noldova.ui.components.angular/scripts/source-imports.ts scripts/test-docs.ts --suite",
"test:timing": "node scripts/test-docs-timing.ts",
"symbols": "node --import ../noldova.ui.components.angular/scripts/source-imports.ts scripts/prepare-symbols.ts",
"symbols:check": "node --import ../noldova.ui.components.angular/scripts/source-imports.ts scripts/prepare-symbols.ts --check"
},
"dependencies": {
"@angular/common": "22.3.0",
Expand Down
Binary file not shown.
Loading
Loading