stack-site-builder 1.25.2 → 1.25.3

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,22 @@ 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.3] - 2026-09-01
15
+
16
+ ### Fixed
17
+
18
+ - **A slide's own content could be mistaken for the deck's chrome.** The deck
19
+ marks its pager, progress bar, TOC and menu with short `data-*` names
20
+ (`data-total`, `data-current`, `data-next` …) and looked each one up with
21
+ `document.querySelector`, which returns whichever comes first in the
22
+ document — and a slide comes before the pager. A site component sitting in a
23
+ slide that used any of those names was found instead, so a stepping demo
24
+ carrying `data-total` had its entire subtree replaced by the slide count and
25
+ the pager then read `1 / 1`. Chrome lookups now skip anything inside
26
+ `.aas-slide`: slide content is never chrome. The `sample-layouts` deck gained
27
+ a slide that deliberately carries four of those attributes so the collision
28
+ stays covered.
29
+
14
30
  ## [1.25.2] - 2026-08-31
15
31
 
16
32
  ### Fixed
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stack-site-builder",
3
3
  "type": "module",
4
- "version": "1.25.2",
4
+ "version": "1.25.3",
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": {
@@ -164,6 +164,19 @@ const priv = entry.data.private;
164
164
  // encrypted payload, so this no-ops at load and runs after decryption.
165
165
  initOnReady(() => {
166
166
  const deck = document.querySelector<HTMLElement>('[data-deck]');
167
+ // The chrome marks itself with short data-* names (data-total, data-next,
168
+ // data-progress …), and a site's own component sitting inside a slide may
169
+ // reasonably use the same one — a stepping demo carrying `data-total` had
170
+ // its entire subtree replaced by the slide count, because
171
+ // document.querySelector returns whichever comes first in the document
172
+ // and the slide comes before the pager. Chrome lookups therefore skip
173
+ // anything inside a slide: slide content is never chrome.
174
+ const chrome = <T extends Element>(sel: string): T | null => {
175
+ for (const el of Array.from(document.querySelectorAll<T>(sel))) {
176
+ if (!el.closest('.aas-slide')) return el;
177
+ }
178
+ return null;
179
+ };
167
180
  if (deck && !deck.dataset.aasInit) {
168
181
  deck.dataset.aasInit = '1';
169
182
  // Animate slide changes unless the deck opts out (data-transition="none")
@@ -172,11 +185,11 @@ const priv = entry.data.private;
172
185
  const animate = deck.dataset.transition !== 'none' && !reduceMotion;
173
186
  const slides = Array.from(deck.querySelectorAll<HTMLElement>('.aas-slide'));
174
187
  const total = slides.length;
175
- const elCur = document.querySelector<HTMLElement>('[data-current]');
176
- const elTot = document.querySelector<HTMLElement>('[data-total]');
177
- const elFill = document.querySelector<HTMLElement>('[data-progress]');
178
- const btnPrev = document.querySelector<HTMLButtonElement>('[data-prev]');
179
- const btnNext = document.querySelector<HTMLButtonElement>('[data-next]');
188
+ const elCur = chrome<HTMLElement>('[data-current]');
189
+ const elTot = chrome<HTMLElement>('[data-total]');
190
+ const elFill = chrome<HTMLElement>('[data-progress]');
191
+ const btnPrev = chrome<HTMLButtonElement>('[data-prev]');
192
+ const btnNext = chrome<HTMLButtonElement>('[data-next]');
180
193
  if (elTot) elTot.textContent = String(total);
181
194
 
182
195
  // Heavy embeds (interactive demo iframes) jank slide transitions the
@@ -416,9 +429,9 @@ const priv = entry.data.private;
416
429
  // Collect headings h2..h{toc_level} from slides not marked data-no-toc,
417
430
  // each linking to the slide it lives on. Reveal the top-right control
418
431
  // only if there's at least one entry.
419
- const tocRoot = document.querySelector<HTMLElement>('[data-toc-root]');
420
- const tocPanel = document.querySelector<HTMLElement>('[data-toc-panel]');
421
- const tocToggle = document.querySelector<HTMLButtonElement>('[data-toc-toggle]');
432
+ const tocRoot = chrome<HTMLElement>('[data-toc-root]');
433
+ const tocPanel = chrome<HTMLElement>('[data-toc-panel]');
434
+ const tocToggle = chrome<HTMLButtonElement>('[data-toc-toggle]');
422
435
  const closeToc = () => {
423
436
  if (tocPanel) tocPanel.hidden = true;
424
437
  tocToggle?.setAttribute('aria-expanded', 'false');
@@ -462,9 +475,9 @@ const priv = entry.data.private;
462
475
  }
463
476
 
464
477
  // Actions menu (top-left): print/PDF and fullscreen.
465
- const menuRoot = document.querySelector<HTMLElement>('[data-menu-root]');
466
- const menuPanel = document.querySelector<HTMLElement>('[data-menu-panel]');
467
- const menuToggle = document.querySelector<HTMLButtonElement>('[data-menu-toggle]');
478
+ const menuRoot = chrome<HTMLElement>('[data-menu-root]');
479
+ const menuPanel = chrome<HTMLElement>('[data-menu-panel]');
480
+ const menuToggle = chrome<HTMLButtonElement>('[data-menu-toggle]');
468
481
  if (menuRoot && menuPanel && menuToggle) {
469
482
  const closeMenu = () => {
470
483
  menuRoot.classList.remove('is-open');
@@ -574,8 +587,8 @@ const priv = entry.data.private;
574
587
  // Zoom / lightbox: enlarge a diagram or image in an overlay. Diagrams get
575
588
  // a button inside their (.aas-diagram) box; images are wrapped so the
576
589
  // button can sit in the corner. Clicking the media works too.
577
- const zoom = document.querySelector<HTMLElement>('[data-zoom]');
578
- const zoomStage = document.querySelector<HTMLElement>('[data-zoom-stage]');
590
+ const zoom = chrome<HTMLElement>('[data-zoom]');
591
+ const zoomStage = chrome<HTMLElement>('[data-zoom-stage]');
579
592
  if (zoom && zoomStage) {
580
593
  const zoomLabel = zoom.dataset.zoomLabel || 'Enlarge';
581
594
  let zoomOpen = false;
@@ -744,7 +757,7 @@ const priv = entry.data.private;
744
757
 
745
758
  // Overview grid (press `o`): scaled thumbnails of every slide; click one
746
759
  // to jump there. Built lazily and rebuilt when the viewport changes.
747
- const ov = document.querySelector<HTMLElement>('[data-ov]');
760
+ const ov = chrome<HTMLElement>('[data-ov]');
748
761
  let ovOpen = false;
749
762
  const buildOv = () => {
750
763
  if (!ov) return;