@spatial-elements/sveltekit 1.0.0-beta.14 → 1.0.0-beta.15

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.
@@ -40,42 +40,17 @@
40
40
  sectionElement = document.getElementById(section.id)!;
41
41
  // Content-page card endpoints must stay measurable, including restored offscreen lists.
42
42
  if (contentPage) return;
43
- let measurementFrame = 0;
43
+ // Scrollspy and the virtual document need real section geometry. Skipped
44
+ // content-visibility placeholders can change size when layout resumes and
45
+ // move the browser's scroll anchor. Cull backdrop work, not layout height.
44
46
  let observer: IntersectionObserver | undefined;
45
47
 
46
48
  const setNearViewport = (nearViewport: boolean) => {
47
49
  sectionElement.toggleAttribute('data-spatial-element-section-near-viewport', nearViewport);
48
50
  sectionElement.toggleAttribute('data-spatial-element-section-culled', !nearViewport);
49
51
  };
50
- const measureIntrinsicHeight = () => {
51
- measurementFrame = 0;
52
- const style = getComputedStyle(sectionElement);
53
- const blockChrome =
54
- (Number.parseFloat(style.paddingTop) || 0) +
55
- (Number.parseFloat(style.paddingBottom) || 0) +
56
- (Number.parseFloat(style.borderTopWidth) || 0) +
57
- (Number.parseFloat(style.borderBottomWidth) || 0);
58
- // contain-intrinsic-block-size describes the content box. Supplying the
59
- // measured border-box height would add padding a second time while skipped.
60
- const intrinsicHeight = Math.max(
61
- sectionElement.getBoundingClientRect().height - blockChrome,
62
- 1
63
- );
64
- sectionElement.style.setProperty(
65
- '--spatial-element-section-intrinsic-height',
66
- `${intrinsicHeight}px`
67
- );
68
- sectionElement.setAttribute('data-spatial-element-section-culling-ready', '');
69
- };
70
- const prepareMeasurement = () => {
71
- sectionElement.removeAttribute('data-spatial-element-section-culling-ready');
72
- if (measurementFrame) cancelAnimationFrame(measurementFrame);
73
- measurementFrame = requestAnimationFrame(measureIntrinsicHeight);
74
- };
75
-
76
52
  const rect = sectionElement.getBoundingClientRect();
77
53
  setNearViewport(rect.bottom >= -240 && rect.top <= window.innerHeight + 240);
78
- measureIntrinsicHeight();
79
54
 
80
55
  if ('IntersectionObserver' in window) {
81
56
  observer = new IntersectionObserver(([entry]) => setNearViewport(entry.isIntersecting), {
@@ -83,12 +58,9 @@
83
58
  });
84
59
  observer.observe(sectionElement);
85
60
  }
86
- window.addEventListener('resize', prepareMeasurement, { passive: true });
87
61
 
88
62
  return () => {
89
63
  observer?.disconnect();
90
- window.removeEventListener('resize', prepareMeasurement);
91
- if (measurementFrame) cancelAnimationFrame(measurementFrame);
92
64
  };
93
65
  });
94
66
  </script>
@@ -104,7 +76,6 @@
104
76
  </PageSection>
105
77
  <style>
106
78
  :global(.content-section) { pointer-events: auto; }
107
- :global(.content-section[data-spatial-element-section-culling-ready]) { content-visibility: auto; contain-intrinsic-block-size: auto var(--spatial-element-section-intrinsic-height); }
108
79
  :global(.content-section[data-spatial-legacy-material] > .ps-section-surface) { background: color-mix(in srgb, var(--spatial-element-section-tint) var(--spatial-element-section-tint-opacity), transparent) !important; backdrop-filter: blur(min(var(--spatial-element-section-backdrop-blur), 18px)); }
109
80
  :global(.content-section[data-spatial-element-section-culled] > .ps-section-surface) { backdrop-filter: none; }
110
81
  </style>
@@ -4,6 +4,7 @@
4
4
  import { getContext, onMount } from 'svelte';
5
5
  import { STAGE_CONTEXT_KEY, type StageContext } from '@spatial-elements/core/stage/panelContext';
6
6
  import { getPanelFocusProgress } from '@spatial-elements/core/stage/panelFocusMath';
7
+ import { subscribeStageScrollFrame, STAGE_SCROLL_PRIORITY } from '@spatial-elements/core/stage/scrollFrame';
7
8
  import type { SpatialElementBreadcrumb } from '@spatial-elements/core/spatial-element/types';
8
9
  let { items, transition = 'enter', focusReactive = true }: { items: SpatialElementBreadcrumb[]; transition?: 'enter' | 'exit'; focusReactive?: boolean } = $props();
9
10
  const stage = getContext<StageContext | undefined>(STAGE_CONTEXT_KEY);
@@ -15,9 +16,20 @@
15
16
  menu = element.closest('.stage')?.querySelector<HTMLElement>('[data-spatial-shell-menu]') ?? undefined;
16
17
  if (!menu) return;
17
18
  const measure = () => { menuSize = { width: menu!.offsetWidth, height: menu!.offsetHeight }; };
19
+ const occlude = () => {
20
+ const rect = element.getBoundingClientRect(), header = menu!.getBoundingClientRect();
21
+ const overlap = header.bottom - rect.top;
22
+ // The breadcrumb stays in its own document/zoom path. Hide its overlap
23
+ // with the glass surface rather than making that surface opaque.
24
+ const mask = overlap > 0 && rect.left < header.right && rect.right > header.left
25
+ ? `linear-gradient(to bottom, transparent ${overlap}px, #000 ${overlap + Math.min(overlap, 12)}px)` : '';
26
+ if (element.style.maskImage !== mask) element.style.maskImage = mask;
27
+ };
18
28
  measure();
19
- const observer = new ResizeObserver(measure); observer.observe(menu);
20
- return () => observer.disconnect();
29
+ occlude();
30
+ const stopScroll = subscribeStageScrollFrame(occlude, STAGE_SCROLL_PRIORITY.stage + 1);
31
+ const observer = new ResizeObserver(() => { measure(); occlude(); }); observer.observe(menu);
32
+ return () => { observer.disconnect(); stopScroll(); };
21
33
  });
22
34
  const travel = $derived.by(() => {
23
35
  if (!focus) return '0px 0px';
@@ -319,7 +319,7 @@
319
319
  /* Keep translated sections from extending the document's scroll range. */
320
320
  [data-spatial-content-zooming] .spatial-element-section-viewport { overflow: clip; }
321
321
  /* Filter only nearby sections, not the full document-sized layer. Offscreen
322
- * sections retain content-visibility culling; text is crisp at rest. */
322
+ * sections retain backdrop culling; text is crisp at rest. */
323
323
  .spatial-element-section-list :global(.content-section[data-spatial-element-section-near-viewport]) {
324
324
  filter: var(--spatial-detail-content-blur, none);
325
325
  }
@@ -1023,6 +1023,11 @@
1023
1023
  .stage:global(.stage-virtual-scroll-active) .stage-virtual-scroll-spacer {
1024
1024
  display: block;
1025
1025
  }
1026
+ .stage:global(.stage-virtual-scroll-active) {
1027
+ /* The shared scroll frame owns visual positioning. Native anchoring must
1028
+ * not counteract moving/portaled panels or scrollspy typography changes. */
1029
+ overflow-anchor: none;
1030
+ }
1026
1031
 
1027
1032
  .stage:global(.stage-virtual-scroll-active) .stage-virtual-viewport {
1028
1033
  position: fixed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spatial-elements/sveltekit",
3
- "version": "1.0.0-beta.14",
3
+ "version": "1.0.0-beta.15",
4
4
  "description": "SvelteKit components and navigation for Spatial Elements.",
5
5
  "license": "MPL-2.0",
6
6
  "type": "module",
@@ -42,7 +42,7 @@
42
42
  "dependencies": {
43
43
  "@page-sections/core": "0.4.1",
44
44
  "@page-sections/svelte": "0.4.1",
45
- "@spatial-elements/core": "1.0.0-beta.14",
45
+ "@spatial-elements/core": "1.0.0-beta.15",
46
46
  "lucide-svelte": "^1.0.1"
47
47
  },
48
48
  "peerDependencies": {