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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ A glyph a part takes as an input or a model field, such as `IconButtonComponent.

### Kit bundles

The Kit bundles check builds twelve small apps against the packed kit, with production settings, and reads which modules each chunk of the build holds.
The Kit bundles check builds thirteen small apps against the packed kit, with production settings, and reads which modules each chunk of the build holds.
It runs on Linux x64 only, as the Kit copies and the Kit manifest checks do, since the release builds, packs and publishes the kit on Linux x64 (`.github`'s shared `release-npm.yml`), and the other targets' CI jobs are the longer ones; elsewhere `npm test` says it skipped them and Angular's newest.
The apps are in `src/noldova.ui.components.angular/tests/fixtures/kit-bundles/`, each with its own TypeScript configuration there and its project in the kit's `angular.json`, and they resolve `@noldova/ui.components.angular` to the installed package instead of its source.

Expand All @@ -156,9 +156,10 @@ The apps are in `src/noldova.ui.components.angular/tests/fixtures/kit-bundles/`,
| `bundle-typography`, which takes only the typography | No initial chunk holds the code highlighter, and no chunk holds its library or a grammar. |
| `bundle-code-block`, which shows a code block without highlighting | The same. |
| `bundle-code-block-entry`, which imports `CodeBlockComponent` and `ClipboardWriter` from `@noldova/ui.components.angular/code-block` alone, never the main entry, and provides its own writer | The same, and no chunk holds KaTeX or `markdown-it`. Its initial chunks hold the code block, its toolbar or its tooltip, so the cap can't pass on a start that dropped the block, and at most 345,000 bytes of code, about a twentieth above the 329,001 they held when the cap was set; the check writes the bytes on every run. |
| `bundle-site-code-block`, whose start shows `SiteCodeBlockComponent` with `ClipboardWriter` from `@noldova/ui.components.angular/site/code-block`, never the main entry, and provides its own writer | No chunk holds the code highlighter's library, a grammar, KaTeX or `markdown-it`. Its initial chunks hold the code block, but neither the tooltip's engine, `tooltip-engine.js`, nor the anchored overlay and the Angular CDK's dialog, overlay and portal the engine brings, which come in a lazy chunk once the block renders, as the kit's README, Lazy pages, says; the check prints the start's size. |
| `bundle-highlighted-code-block`, which adds `provideCodeHighlighting()` | No initial chunk holds the highlighter's library, and the grammars come in lazy chunks. |
| `bundle-highlighting-worker`, which adds `provideCodeHighlightingWorker` with a worker file that calls `serveCodeHighlighting` | The same, and a chunk built from the worker file holds every grammar the page's lazy chunks hold and imports no other chunk, since Angular's build leaves out the chunks a worker's lazy imports share. |
| `bundle-message`, which shows a message and adds `provideMarkdown()` | `markdown-it` comes in a lazy chunk; no chunk of the other eleven apps holds it. |
| `bundle-message`, which shows a message and adds `provideMarkdown()` | `markdown-it` comes in a lazy chunk; no chunk of the other twelve apps holds it. |
| `bundle-progress`, which binds `isDelayed` on a spinner and a progress bar | It builds, as an app that binds an input of a host directive needs that directive exported from the entry point, and no chunk holds the code highlighter, a grammar or `markdown-it`. |
| `bundle-menu`, which binds `disabled` and `triggered` on a menu group action | The same as `bundle-progress`. |
| `bundle-button`, which imports `ButtonComponent` alone | The same as `bundle-progress`. Of the kit's strings files, named `resources.js`, its chunks hold only the DOM names, `dom-resources.js`, and those of the classes the button reaches: the spinner's delay, `reveal-delay.resources.js`, the busy guard's, `busy-guard.resources.js`, and the clock's, `clock-tokens.resources.js` and `system-time-source.resources.js`. Its initial chunks hold at most 21,200 bytes of them, about a tenth above the 19,250 they held when the cap was set; the check writes the bytes on every run. |
Expand Down
2 changes: 1 addition & 1 deletion documents/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
| Fonts | The typefaces the text roles name, kept in `assets/fonts` with their licenses. |
| Icons | The icon set the components and products draw from. |
| Components | The Angular components that products build their interfaces from. |
| Lazy pages | The entries an app's start imports instead of the main one, `@noldova/ui.components.angular/button`, `@noldova/ui.components.angular/typography` and, for a website, `@noldova/ui.components.angular/site` or, for a start that shows only the site's header and footer, their own entries, `@noldova/ui.components.angular/site/header` and `/site/footer`, with the stage service's, `/site/stage`, and the code block's and the other site parts', `@noldova/ui.components.angular/code-block` and `/site/hero`, `/site/section`, `/site/card` and `/site/closing`, which a lazy page imports; each exports the same classes as the main entry, so the parts only a lazy page uses come in its own chunk, but for the site's header, footer and search slot, which only the site entry and theirs export: their tooltips import the tooltip's engine lazily, and a lazy import anywhere in the main entry's graph would split the engine out of every app's start. The Kit bundles check keeps the code block out of the start of such an app, the Angular CDK out of a website's, and the site's hero, sections, cards and closing out of the start of a website that shows only its header and footer there and takes the stage service from its entry. |
| Lazy pages | The entries an app's start imports instead of the main one, `@noldova/ui.components.angular/button`, `@noldova/ui.components.angular/typography` and, for a website, `@noldova/ui.components.angular/site` or, for a start that shows only the site's header and footer, their own entries, `@noldova/ui.components.angular/site/header` and `/site/footer`, with the stage service's, `/site/stage`, and the code block's and the other site parts', `@noldova/ui.components.angular/code-block` and `/site/hero`, `/site/section`, `/site/card` and `/site/closing`, which a lazy page imports; each exports the same classes as the main entry, so the parts only a lazy page uses come in its own chunk, but for the site's header, footer and search slot, which only the site entry and theirs export, and the site's code block, `SiteCodeBlockComponent`, which only `/site/code-block` exports: their tooltips import the tooltip's engine lazily, and a lazy import anywhere in the main entry's graph would split the engine out of every app's start. The Kit bundles check keeps the code block out of the start of such an app, the Angular CDK out of a website's, the tooltip's engine out of the start of an app that shows the site's code block, and the site's hero, sections, cards and closing out of the start of a website that shows only its header and footer there and takes the stage service from its entry. |
| Code highlighting | The highlighter and its grammars, which an app turns on with `provideCodeHighlighting()` from `@noldova/ui.components.angular/code-highlighting` and which then load lazily, or ahead while the page is idle for the languages it names in `preload`; with `provideCodeHighlightingWorker`, they load and tokenize in the app's worker, whose file calls `serveCodeHighlighting` from `@noldova/ui.components.angular/code-highlighting/worker` and holds every grammar, with no lazy import. The package declares no side effects, and the Kit bundles check keeps an app without the provider free of them. |
| Markdown | The parser of a message's text, `markdown-it`, which an app turns on with `provideMarkdown()` from `@noldova/ui.components.angular/markdown` and which then loads lazily; without it a message shows its text plain. The same entry point exports the markdown view, `MarkdownViewComponent`, for an app that lays out its own message. The Kit bundles check keeps an app without the provider free of it. |
| Symbol subsets | A Node.js tool, `MaterialSymbols` in `src/symbols`, which a site imports from `@noldova/ui.components.angular/symbols` to serve only the symbol glyphs it draws, with `styles/kit-without-symbol-font.css` in place of `styles/kit.css`, as [KIT.md](KIT.md#icons-a-site-subsets) says; no browser loads it. |
Expand Down
2 changes: 2 additions & 0 deletions documents/kit/code-block.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
The themes, the tokens and the rules every control shares are in [KIT.md](../KIT.md), whose [Controls](../KIT.md#controls) section says how this specification reads.

A page an app loads lazily imports the code block from its own entry, `@noldova/ui.components.angular/code-block`, and the main entry exports it too; it stays in that page's chunk only while the app's start never imports the main entry, as the kit's README, [Lazy pages](../../src/noldova.ui.components.angular/README.md#lazy-pages), says.
Those entries give `CodeBlockComponent`, `nol-code-block`, whose toolbar's tooltips hold their engine, with the Angular CDK's dialog, overlay and portal, in the start of an app that shows the block there.
A website imports `SiteCodeBlockComponent`, `nol-site-code-block`, from `@noldova/ui.components.angular/site/code-block` instead: the same block, by every rule below, whose tooltips load their engine once the block renders, as the site header's do, so a start that shows it holds none of them.

## Default geometry

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export class DocsCatalog {
"SiteCardComponent",
"SiteCardGridComponent",
"SiteClosingComponent",
"SiteCodeBlockComponent",
"SiteFooterComponent",
"SiteHeaderComponent",
"SiteHeroComponent",
Expand Down
3 changes: 3 additions & 0 deletions src/noldova.ui.components.angular.docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"@noldova/ui.components.angular/site/closing": [
"../noldova.ui.components.angular/src/api/site-closing.ts"
],
"@noldova/ui.components.angular/site/code-block": [
"../noldova.ui.components.angular/src/api/site-code-block.ts"
],
"@noldova/ui.components.angular/site/footer": [
"../noldova.ui.components.angular/src/api/site-footer.ts"
],
Expand Down
5 changes: 3 additions & 2 deletions src/noldova.ui.components.angular/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# @noldova/ui.components.angular

Noldova's interface kit: the design tokens, the fonts and the Angular components that Noldova's products build their interfaces from.
Its public API is everything the package exports through its entries: `@noldova/ui.components.angular`, `@noldova/ui.components.angular/button`, `@noldova/ui.components.angular/code-block`, `@noldova/ui.components.angular/code-highlighting`, `@noldova/ui.components.angular/code-highlighting/worker`, `@noldova/ui.components.angular/gallery`, `@noldova/ui.components.angular/markdown`, `@noldova/ui.components.angular/site`, its part entries `@noldova/ui.components.angular/site/card`, `@noldova/ui.components.angular/site/closing`, `@noldova/ui.components.angular/site/footer`, `@noldova/ui.components.angular/site/header`, `@noldova/ui.components.angular/site/hero` and `@noldova/ui.components.angular/site/section`, its stage entry `@noldova/ui.components.angular/site/stage`, `@noldova/ui.components.angular/symbols`, a Node.js tool that serves a site only the symbol glyphs it draws, as [KIT.md](../../documents/KIT.md#icons-a-site-subsets) says, `@noldova/ui.components.angular/testing` and `@noldova/ui.components.angular/typography`.
Its public API is everything the package exports through its entries: `@noldova/ui.components.angular`, `@noldova/ui.components.angular/button`, `@noldova/ui.components.angular/code-block`, `@noldova/ui.components.angular/code-highlighting`, `@noldova/ui.components.angular/code-highlighting/worker`, `@noldova/ui.components.angular/gallery`, `@noldova/ui.components.angular/markdown`, `@noldova/ui.components.angular/site`, its part entries `@noldova/ui.components.angular/site/card`, `@noldova/ui.components.angular/site/closing`, `@noldova/ui.components.angular/site/footer`, `@noldova/ui.components.angular/site/header`, `@noldova/ui.components.angular/site/hero` and `@noldova/ui.components.angular/site/section`, its code block entry `@noldova/ui.components.angular/site/code-block`, its stage entry `@noldova/ui.components.angular/site/stage`, `@noldova/ui.components.angular/symbols`, a Node.js tool that serves a site only the symbol glyphs it draws, as [KIT.md](../../documents/KIT.md#icons-a-site-subsets) says, `@noldova/ui.components.angular/testing` and `@noldova/ui.components.angular/typography`.
Its type declarations carry the documentation of every export and public member, which editors show on hover and in completions.

## What an app needs
Expand Down Expand Up @@ -46,9 +46,10 @@ So the start imports from entries that hold only what it needs, and a lazy page
| `@noldova/ui.components.angular/site/header`, `/site/footer`, `/site/hero`, `/site/section`, `/site/card` and `/site/closing` | One site part each, with the models its inputs take, the same classes as the site entry: the header with `SiteSearchDirective`, `SiteLink`, `SiteSocialLink` and `SiteWordmarkSize`; the footer with `SiteLinkGroup`, `SiteLink` and `SiteWordmarkSize`; the hero with `SiteAction` and `SiteShot`; the section with `SiteShot`; the card with its grid, `SiteCardGridComponent`; and the closing with `SiteAction`. A website whose start shows only the header and footer imports them from their entries, and each lazy page imports its parts from theirs: when the start imports anything from the site entry, the app's build puts in the start every part it exports that any page uses, lazy or not. |
| `@noldova/ui.components.angular/site/stage` | `SiteStageService`, with the `SiteStage` it tells and the `SiteLink` its `link` takes, the same classes as the site entry. A website whose start shows only the header and footer imports the service from here beside their entries, since the site entry and the main entry would bring the page parts into its start. |
| `@noldova/ui.components.angular/code-block` | The code block, `CodeBlockComponent` (`nol-code-block`), with what an app binds on it: `ShellRunOutputDirective`, `ShellRun`, `ShellRunState` and `IShellRunOutputContext`; and `ClipboardWriter`, the same class as the main entry's, which the block's Copy writes through and the app provides. An app that imports the block and its writer from here alone ships neither KaTeX nor `markdown-it`, which the main entry's math and Markdown would bring as lazy chunks. |
| `@noldova/ui.components.angular/site/code-block` | A website's code block, `SiteCodeBlockComponent` (`nol-site-code-block`), the code-block entry's `CodeBlockComponent` with the same inputs, output, look and behavior, with what an app binds on it, `ShellRun` and `ShellRunState`, and `ClipboardWriter`, the same classes as the code-block entry's. Its toolbar's tooltips load their engine, with the Angular CDK's dialog, overlay and portal, once the block renders, as the site header's do, so a website's start that shows the block holds none of them; `CodeBlockComponent` keeps the engine in its app's start, since a lazy import of the engine that the main entry reaches would make the start of every app that imports from the main entry bigger. |

The code block, its toolbar and its tooltips then come in that page's chunk of the app's build.
The main entry exports the same classes too, but for the site's header, footer and search slot, so an app's imports from it keep working.
The main entry exports the same classes too, but for the site's header, footer, search slot and code block, so an app's imports from it keep working.

```ts
// main.ts, the app's start
Expand Down
20 changes: 20 additions & 0 deletions src/noldova.ui.components.angular/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,26 @@
}
}
},
"bundle-site-code-block": {
"projectType": "application",
"root": "",
"sourceRoot": ".",
"prefix": "nol",
"architect": {
"build": {
"builder": "@angular/build:application",
"options": {
"outputPath": "../../_build/kit-bundles/bundle-site-code-block",
"browser": "tests/fixtures/kit-bundles/site-code-block-app.fixture.ts",
"index": false,
"tsConfig": "tests/fixtures/kit-bundles/tsconfig.site-code-block.json",
"optimization": true,
"outputHashing": "none",
"statsJson": true
}
}
}
},
"bundle-highlighted-code-block": {
"projectType": "application",
"root": "",
Expand Down
4 changes: 4 additions & 0 deletions src/noldova.ui.components.angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
"types": "./api/site-closing.d.ts",
"default": "./api/site-closing.js"
},
"./site/code-block": {
"types": "./api/site-code-block.d.ts",
"default": "./api/site-code-block.js"
},
"./site/footer": {
"types": "./api/site-footer.d.ts",
"default": "./api/site-footer.js"
Expand Down
Loading
Loading