@spatial-elements/sveltekit 1.0.0-beta.13 → 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.
- package/dist/spatial-element/Section.svelte +3 -32
- package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +15 -3
- package/dist/spatial-element/SpatialElementPage.svelte +19 -1
- package/dist/spatial-element/layout.generated.css +12 -0
- package/dist/stage/Stage.svelte +5 -0
- package/package.json +2 -2
|
@@ -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
|
-
|
|
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
|
-
|
|
20
|
-
|
|
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';
|
|
@@ -29,7 +41,7 @@
|
|
|
29
41
|
});
|
|
30
42
|
const resolved = $derived(items.map(item => ({ ...item, href: item.href ? resolve(...([item.href] as unknown as Parameters<typeof resolve>)) : undefined })));
|
|
31
43
|
</script>
|
|
32
|
-
<div bind:this={element} class="breadcrumbs spatial-content-width" style:translate={travel} data-stage-dom-content data-catalog-transition-dom={transition}>
|
|
44
|
+
<div bind:this={element} class="breadcrumbs spatial-content-width" style:translate={travel} style:filter={focus > 0 ? `blur(${focus * 4}px)` : 'none'} data-stage-dom-content data-catalog-transition-dom={transition}>
|
|
33
45
|
<Breadcrumbs items={resolved} />
|
|
34
46
|
</div>
|
|
35
47
|
<style>
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
import { resolveSpatialElementData } from '@spatial-elements/core/spatial-element/spatialElement';
|
|
36
36
|
import { registerSpatialPage } from './spatialPageContext.js';
|
|
37
37
|
import { STAGE_CONTEXT_KEY, type StageContext } from '@spatial-elements/core/stage/panelContext';
|
|
38
|
+
import { getPanelFocusProgress } from '@spatial-elements/core/stage/panelFocusMath';
|
|
38
39
|
|
|
39
40
|
const SPATIAL_ELEMENT_OVERVIEW_SECTION = {
|
|
40
41
|
id: 'overview',
|
|
@@ -75,6 +76,7 @@
|
|
|
75
76
|
let mainElement: HTMLElement;
|
|
76
77
|
let tabList = $state<HTMLElement>();
|
|
77
78
|
let splitPane = $state(false);
|
|
79
|
+
const contentFocus = $derived(splitPane ? 0 : getPanelFocusProgress(stageContext?.getZoomUiFocus?.() ?? 0));
|
|
78
80
|
let paneController = $state.raw<SpatialElementPaneController>();
|
|
79
81
|
const paneTint = $derived(typeof brand.panelTheme.tint === 'number'
|
|
80
82
|
? `#${brand.panelTheme.tint.toString(16).padStart(6, '0')}`
|
|
@@ -204,9 +206,12 @@
|
|
|
204
206
|
data-spatial-element-id={spatialElement.id}
|
|
205
207
|
data-brand-id={spatialElement.brandId}
|
|
206
208
|
data-spatial-selected-media={selectedMedia.kind}
|
|
209
|
+
data-spatial-content-zooming={contentFocus > 0 || undefined}
|
|
207
210
|
style:--spatial-pane-tint={paneTint}
|
|
208
211
|
style:--spatial-pane-tint-opacity={`${Math.min(1, Math.max(0.8, brand.panelTheme.tintOpacity ?? 0.28)) * 100}%`}
|
|
209
212
|
style:--spatial-pane-blur={`${Math.min(100, Math.max(0, brand.panelTheme.backdropBlur ?? 5))}px`}
|
|
213
|
+
style:--spatial-detail-content-fallback-travel={`${contentFocus * 60}svh`}
|
|
214
|
+
style:--spatial-detail-content-blur={contentFocus > 0 ? `blur(${contentFocus * 4}px)` : 'none'}
|
|
210
215
|
>
|
|
211
216
|
<div class="spatial-element-pane-heading" data-spatial-detail-pane-header data-spatial-detail-fixed data-spatial-element-handoff-header>
|
|
212
217
|
<SpatialElementBreadcrumbs items={spatialElement.breadcrumbs} focusReactive={!splitPane} />
|
|
@@ -265,9 +270,11 @@
|
|
|
265
270
|
<div class="spatial-element-pane-body" data-spatial-detail-pane-body data-stage-scroll-viewport>
|
|
266
271
|
{#key spatialElement.id}<SpatialElementSummaryPanel {spatialElement} nativeContent={splitPane} />{/key}
|
|
267
272
|
<div class="spatial-element-content">
|
|
273
|
+
<div class="spatial-element-section-viewport">
|
|
268
274
|
<div class="spatial-element-section-list spatial-content-width spatial-content-container" data-catalog-transition-dom="enter">
|
|
269
275
|
<SectionSurfaceGroup>{@render children?.()}</SectionSurfaceGroup>
|
|
270
276
|
</div>
|
|
277
|
+
</div>
|
|
271
278
|
<!-- Read after the section snippet has registered its metadata during SSR. -->
|
|
272
279
|
<SpatialElementTabs bind:tabList {activeSectionId} sections={[SPATIAL_ELEMENT_OVERVIEW_SECTION, ...sections]} />
|
|
273
280
|
</div>
|
|
@@ -306,6 +313,15 @@
|
|
|
306
313
|
.spatial-element-section-list {
|
|
307
314
|
order: 2;
|
|
308
315
|
margin-top: var(--spatial-detail-submenu-after-gap, 0px);
|
|
316
|
+
translate: 0 var(--spatial-detail-content-travel, var(--spatial-detail-content-fallback-travel, 0px));
|
|
317
|
+
}
|
|
318
|
+
.spatial-element-section-viewport { order: 2; display: flow-root; }
|
|
319
|
+
/* Keep translated sections from extending the document's scroll range. */
|
|
320
|
+
[data-spatial-content-zooming] .spatial-element-section-viewport { overflow: clip; }
|
|
321
|
+
/* Filter only nearby sections, not the full document-sized layer. Offscreen
|
|
322
|
+
* sections retain backdrop culling; text is crisp at rest. */
|
|
323
|
+
.spatial-element-section-list :global(.content-section[data-spatial-element-section-near-viewport]) {
|
|
324
|
+
filter: var(--spatial-detail-content-blur, none);
|
|
309
325
|
}
|
|
310
326
|
|
|
311
327
|
.spatial-element-content :global(.spatial-element-tabs-anchor) {
|
|
@@ -337,6 +353,8 @@
|
|
|
337
353
|
}
|
|
338
354
|
@media (min-width: 1600px) {
|
|
339
355
|
.spatial-element-content { padding-top: 12px; }
|
|
340
|
-
|
|
356
|
+
}
|
|
357
|
+
@media (min-width: 1537px) {
|
|
358
|
+
.spatial-element-content :global(.spatial-element-tabs-anchor) { margin-left: max(12px, calc((100% - var(--spatial-detail-content-width)) / 2)); max-width: min(var(--spatial-detail-content-width), calc(100% - 24px)); }
|
|
341
359
|
}
|
|
342
360
|
</style>
|
|
@@ -4,6 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
.spatial-content-container { container: ps-content / inline-size; min-width: 0; }
|
|
6
6
|
|
|
7
|
+
@media (min-width: 1537px) and (max-width: 1599px) {
|
|
8
|
+
.stage .content-section { width: min(var(--ps-section-width, 100%), 100%, 1536px); }
|
|
9
|
+
/* The shared registry exposes joined/outer edges through its shadow clips
|
|
10
|
+
* below XL too. Reuse those markers for the newly inset L surfaces. */
|
|
11
|
+
.stage .content-section[data-section-background-size='standard'] > .ps-section-surface {
|
|
12
|
+
border-top-left-radius: clamp(0px, calc(var(--ps-shadow-top-clip, 0px) * -100), var(--ps-radius));
|
|
13
|
+
border-top-right-radius: clamp(0px, calc(var(--ps-shadow-top-clip, 0px) * -100), var(--ps-radius));
|
|
14
|
+
border-bottom-left-radius: clamp(0px, calc(var(--ps-shadow-bottom-clip, 0px) * -100), var(--ps-radius));
|
|
15
|
+
border-bottom-right-radius: clamp(0px, calc(var(--ps-shadow-bottom-clip, 0px) * -100), var(--ps-radius));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
7
19
|
@media (min-width: 1600px) {
|
|
8
20
|
.spatial-content-width { width: min(1536px, max(0px, calc(100% - 272px))); }
|
|
9
21
|
}
|
package/dist/stage/Stage.svelte
CHANGED
|
@@ -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.
|
|
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.
|
|
45
|
+
"@spatial-elements/core": "1.0.0-beta.15",
|
|
46
46
|
"lucide-svelte": "^1.0.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|