stack-site-builder 1.25.3 → 1.25.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -11,6 +11,30 @@ content schema, while a consuming site supplies only content, taxonomy data and
11
11
  config. Sites track the theme with `pnpm up stack-site-builder`, so each release
12
12
  here is a plain version bump they pull in.
13
13
 
14
+ ## [1.25.4] - 2026-09-02
15
+
16
+ Print/PDF export of a deck now reproduces what the screen shows: images load
17
+ before the dialog opens, and nothing that fit on screen gets clipped.
18
+
19
+ ### Fixed
20
+
21
+ - **Lazy images printed as empty boxes.** Slides never scrolled into view had
22
+ not fetched their `loading="lazy"` images, so the PDF showed blank
23
+ placeholders — and the unsized box could inflate and push the rest of the
24
+ slide off the page. The print button now flips every deck image to eager,
25
+ waits (capped at 5s) for them to decode, then opens the dialog. A
26
+ `beforeprint` fallback covers Cmd/Ctrl+P: it reveals all steps and starts
27
+ the image loads, though only the button can await them.
28
+ - **Code blocks clipped at the PDF's right edge.** The print page was the
29
+ PowerPoint 13.333in × 7.5in; rem-based type (code, `clamp()` caps) does not
30
+ shrink with the page, so it ate proportionally more width than on the
31
+ desktop windows slides are authored against, and `overflow: auto` boxes
32
+ cannot scroll on paper. The page is now 18in × 10.125in (1728 × 972 CSS
33
+ px) — same 16:9, but big enough that every `clamp()` saturates at its rem
34
+ cap and the content column hits its 96rem cap (now applied in print too),
35
+ the same saturated state as a full-size desktop monitor. The PDF reproduces
36
+ what the author saw; paper printing shrinks to fit.
37
+
14
38
  ## [1.25.3] - 2026-09-01
15
39
 
16
40
  ### Fixed
@@ -614,6 +638,10 @@ catalog sites from a thin content-only repository.
614
638
  - **Standalone development setup** — a devcontainer and a minimal `playground/`
615
639
  consuming site for developing and previewing the theme on its own.
616
640
 
641
+ [1.25.4]: https://github.com/CodeComposeStudio/stack-site-builder/compare/v1.25.3...v1.25.4
642
+ [1.25.3]: https://github.com/CodeComposeStudio/stack-site-builder/compare/v1.25.2...v1.25.3
643
+ [1.25.2]: https://github.com/CodeComposeStudio/stack-site-builder/compare/v1.25.1...v1.25.2
644
+ [1.25.1]: https://github.com/CodeComposeStudio/stack-site-builder/compare/v1.25.0...v1.25.1
617
645
  [1.25.0]: https://github.com/CodeComposeStudio/stack-site-builder/compare/v1.24.0...v1.25.0
618
646
  [1.24.0]: https://github.com/CodeComposeStudio/stack-site-builder/compare/v1.23.2...v1.24.0
619
647
  [1.23.2]: https://github.com/CodeComposeStudio/stack-site-builder/compare/v1.23.1...v1.23.2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stack-site-builder",
3
3
  "type": "module",
4
- "version": "1.25.3",
4
+ "version": "1.25.4",
5
5
  "license": "MIT",
6
6
  "description": "The engine behind the awesome-*-stack catalog sites: an Astro theme with the catalog/concepts/articles/slides/samples routes, components, styles and markdown pipeline. Sites provide content, taxonomy data and config.",
7
7
  "repository": {
@@ -474,6 +474,17 @@ const priv = entry.data.private;
474
474
  }
475
475
  }
476
476
 
477
+ // Cmd/Ctrl+P bypasses the print button: reveal every step and kick off
478
+ // the lazy-image loads here too. This handler cannot await, so a very
479
+ // first Cmd+P may still catch an image mid-flight — the button is the
480
+ // reliable path — but the loads it starts survive for a reprint.
481
+ window.addEventListener('beforeprint', () => {
482
+ slides.forEach((_, i) => revealAllSteps(i));
483
+ deck
484
+ .querySelectorAll<HTMLImageElement>('img[loading="lazy"]')
485
+ .forEach((img) => (img.loading = 'eager'));
486
+ });
487
+
477
488
  // Actions menu (top-left): print/PDF and fullscreen.
478
489
  const menuRoot = chrome<HTMLElement>('[data-menu-root]');
479
490
  const menuPanel = chrome<HTMLElement>('[data-menu-panel]');
@@ -491,10 +502,20 @@ const priv = entry.data.private;
491
502
  });
492
503
  // The drawer stays open until the tab is toggled again — an outside
493
504
  // click must not close it (same as the TOC panel).
494
- menuPanel.querySelector('[data-action="print"]')?.addEventListener('click', () => {
505
+ menuPanel.querySelector('[data-action="print"]')?.addEventListener('click', async () => {
495
506
  closeMenu();
496
507
  // Reveal every step so nothing is hidden in the PDF.
497
508
  slides.forEach((_, i) => revealAllSteps(i));
509
+ // Images on slides never scrolled into view are still lazy-unloaded
510
+ // and would print as empty placeholder boxes — worse, the unsized
511
+ // box can inflate and push the rest of the slide off the page. Load
512
+ // them first, with a time cap so a dead image can't block printing.
513
+ const lazy = Array.from(deck.querySelectorAll<HTMLImageElement>('img[loading="lazy"]'));
514
+ lazy.forEach((img) => (img.loading = 'eager'));
515
+ await Promise.race([
516
+ Promise.all(lazy.map((img) => img.decode().catch(() => undefined))),
517
+ new Promise((resolve) => setTimeout(resolve, 5000)),
518
+ ]);
498
519
  window.print();
499
520
  });
500
521
  menuPanel.querySelector('[data-action="fullscreen"]')?.addEventListener('click', () => {
@@ -2350,9 +2350,18 @@ summary {
2350
2350
  a stray extra page, and wide enough that image splits never stack. Enable
2351
2351
  "Background graphics" in the print dialog for themed/image backgrounds. */
2352
2352
  @media print {
2353
- /* PowerPoint-style 16:9 page (13.333in × 7.5in). */
2353
+ /* A 16:9 page, sized 18in × 10.125in (1728 × 972 CSS px) rather than the
2354
+ PowerPoint 13.333in: rem-based type (code blocks, clamp() caps) does not
2355
+ shrink with the page, so on a smaller page it eats proportionally more
2356
+ width than on the desktop windows slides are authored against — and code
2357
+ that fit on screen came out clipped at the right edge of the PDF. This
2358
+ page is big enough that every clamp() saturates at its rem cap and the
2359
+ content column below hits its 96rem cap — the same saturated state as a
2360
+ full-size desktop monitor, so the PDF reproduces what the author saw.
2361
+ PDF pages are vector; the physical inches are irrelevant on screen and
2362
+ shrink-to-fit when printed on paper. */
2354
2363
  @page {
2355
- size: 13.333in 7.5in;
2364
+ size: 18in 10.125in;
2356
2365
  margin: 0;
2357
2366
  }
2358
2367
  .aas-deck-body {
@@ -2379,8 +2388,8 @@ summary {
2379
2388
  scroll-snap-type: none;
2380
2389
  }
2381
2390
  .aas-slide {
2382
- width: 13.333in;
2383
- height: 7.5in;
2391
+ width: 18in;
2392
+ height: 10.125in;
2384
2393
  overflow: hidden;
2385
2394
  scroll-snap-align: none;
2386
2395
  break-inside: avoid;
@@ -2388,9 +2397,11 @@ summary {
2388
2397
  .aas-slide:not(:last-child) {
2389
2398
  break-after: page;
2390
2399
  }
2391
- /* Fixed page size, so don't derive the content width from viewport units. */
2400
+ /* Fixed page size, so don't derive the content width from viewport units —
2401
+ but keep the same 96rem cap the screen layout has, so the column is
2402
+ exactly as wide as on a large desktop window, no wider. */
2392
2403
  .aas-slide-inner {
2393
- max-width: 92%;
2404
+ max-width: min(96rem, 92%);
2394
2405
  }
2395
2406
  }
2396
2407