Skip to content

Give websites a code block whose tooltips load their engine lazily - #250

Merged
rostislavrotaru merged 1 commit into
mainfrom
dev3/245-code-block-lazy-tooltip
Nov 29, 2026
Merged

rostislavrotaru merged 1 commit into
mainfrom
dev3/245-code-block-lazy-tooltip

Conversation

@rostislavrotaru

@rostislavrotaru rostislavrotaru commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Part of #245.

Websites get a code block whose toolbar's tooltips load their engine once the block renders, so a website's start that shows a code block holds neither the tooltip's engine nor the Angular CDK's dialog, overlay and portal. Apps that import from the main entry or the code-block entry keep CodeBlockComponent with its tooltip in the start, as before.

What changed

  • New entry @noldova/ui.components.angular/site/code-block (src/api/site-code-block.ts, .d.ts, package.json exports, both tsconfig.json paths): SiteCodeBlockComponent (nol-site-code-block), with ShellRun, ShellRunState and ClipboardWriter, the same classes as the code-block entry's. The main entry and the other entries are unchanged.
  • src/app/components/code-block/code-block-behavior.ts: the block's logic, moved from code-block.component.ts unchanged except that it reads the inputs through ICodeBlockSource and the template's elements through CodeBlockElements. Both components build one in their injection context, as the two choice pills components share ChoicePillsBehavior.
  • code-block.component.ts keeps its selector, inputs, output, block, constructor and TooltipDirective; its template reaches the logic through view.. site-code-block.component.ts uses the same template and styles with LazyTooltipDirective.
  • Kit bundles check: a thirteenth app, bundle-site-code-block, whose start shows SiteCodeBlockComponent from the new entry. Its initial chunks must hold the code block but none of tooltip-engine.js, anchored-overlay.js or the CDK's dialog, overlay, _overlay-module-chunk and portal, and a lazy chunk must hold the engine.
  • Docs: the kit README (entries and the Lazy pages table), the root README (Kit bundles table), documents/ARCHITECTURE.md (Lazy pages) and documents/kit/code-block.md say which entry gives which block. The docs site lists SiteCodeBlockComponent with the other site parts it leaves out.
  • Tests: site-code-block.component.spec.ts checks the same geometry as CodeBlockComponent (header, language, Word wrap, Run, Copy and body, in rem, in light and dark), wrap, run and copy, the lazy directive on its buttons and the eager one on the code block's, and its tooltips once the engine arrives. tests/api/site-code-block.spec.ts checks the entry's exports, and the node-load fixture imports the entry.

Start sizes

Bytes of code in each Kit bundles app's initial chunks, built against the packed kit on Linux, at main 2449206 and at this head:

App Main This PR Tooltip engine
bundle-site-code-block (new) — 272,749 lazy
bundle-code-block-entry 329,001 329,630 (+629) in the start
bundle-code-block 326,917 327,546 (+629) in the start
bundle-highlighted-code-block 421,013 421,613 (+600) in the start
bundle-highlighting-worker 421,176 421,779 (+603) in the start
bundle-message 523,101 523,730 (+629) in the start
bundle-menu 340,957 340,957 in the start
bundle-button 137,572 137,572 none
bundle-progress 121,719 121,719 none
bundle-typography 21,889 21,889 none
bundle-lazy-code-block 271,068 271,068 lazy
bundle-site 383,353 383,353 lazy
bundle-site-frame 270,329 270,329 lazy

The apps that show CodeBlockComponent grow about 600 bytes, the cost of the shared behavior's delegation; keeping one copy of the logic was chosen over a second copy in the site component. The site code block app's start holds 27,270 bytes of the Angular CDK, against 65,696 for the code-block entry's.

Checks

  • Linux: the whole suite, the docs site's tests and npm run test:docs pass; the Kit bundles check passes with 13 apps.
  • macOS and Windows: the tests of the code block, the tooltip, shell runs, the message, the Markdown view, the tool call, the gallery and the API entries pass.

Not in this PR

The 0.0.48 notes go in the version PR. The websites move to SiteCodeBlockComponent in their own pin PRs.

Agent: DEV3 (developer)
Agent-Model: Anthropic Opus 5.5, Medium

)

A new entry, @noldova/ui.components.angular/site/code-block, exports
SiteCodeBlockComponent (nol-site-code-block): the code block with the same
inputs, output, template, styles and behavior, whose toolbar takes the lazy
tooltip, so a website's start that shows it holds neither the tooltip's
engine nor the Angular CDK's dialog, overlay and portal. The block's logic
moves into CodeBlockBehavior, which both components build; CodeBlockComponent
keeps its API and its eager tooltip, so apps that import the main or the
code-block entry keep the same start. The Kit bundles check builds a
thirteenth app from the new entry and holds it to that.

Agent: DEV3 (developer)
Agent-Model: Anthropic Opus 5.5, Medium
@rostislavrotaru rostislavrotaru self-assigned this Nov 29, 2026
@rostislavrotaru
rostislavrotaru marked this pull request as ready for review November 29, 2026 23:10

@rostislavrotaru rostislavrotaru left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: #250 at f9e9576
Verdict: Approve
Findings: 0 Should fix, 0 Low, as line comments
Why it's right: SiteCodeBlockComponent loads the tooltip engine lazily, and the new Kit bundles app checks the start holds no engine, overlay or CDK dialog; CodeBlockComponent's selector, inputs, outputs and eager tooltip are unchanged, at the accepted +~600 B. The sites' measured first loads come with their pin PRs, so this is part of #245.

Agent: LEAD (lead)
Agent-Model: Anthropic Opus 5.5, High

@rostislavrotaru
rostislavrotaru merged commit a485633 into main Nov 29, 2026
17 checks passed
@rostislavrotaru
rostislavrotaru deleted the dev3/245-code-block-lazy-tooltip branch November 29, 2026 23:13
rostislavrotaru added a commit that referenced this pull request Dec 1, 2026
Closes #286

Moves the kit to 0.0.48, with what has merged since 0.0.47, so apps can
take the binary file note and the path tooltip from #282, and the tab
marker's tone, close place and dot from #299.

## What changes

- `version.json` is at 0.0.48.
- `CHANGELOG.md` has the 0.0.48 section, one entry per change a consumer
or docs-site reader sees, from #303 (#299), #291 (#280), #281 (#275),
#285 (#282), #263 (#151), #250 (#245), #262 (#138, #223), #260 (#16),
#248 (#233), #258 (#18), #268 (#28), #255 (#234), #254 (#239), #256
(#236), #253 (#238), #252 (#160), #249 (#244), #242 (#231), #269 (#261)
and #259 (#26).
- Left out, as changing nothing the package or the docs site shows: #251
(the header's phone-bar rules written once, the same look), #247
(workflow pins), #264 and #277 (build scripts), #266 (example names and
their check), #267, #271, #272, #273, #274, #276, #289 and #290 (tests
and their tools), #279 and #295 (workflow pins).

## Checks

No test covers these two files. The product names check reads the new
section in CI; it names no product.

Agent: DEV2 (developer)
Agent-Model: Anthropic Opus 5.5, Medium
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant