@spatial-elements/sveltekit 1.0.0-beta.14 → 1.0.0-beta.18
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/README.md +1 -1
- package/dist/catalog/ScrollNavigationBridge.svelte +5 -1
- package/dist/catalog/ScrollNavigationBridge.svelte.d.ts +1 -1
- package/dist/catalog/stagedCatalogNavigation.d.ts +1 -1
- package/dist/spatial-element/BrandStageShell.svelte +27 -2
- package/dist/spatial-element/BrandStageShell.svelte.d.ts +2 -0
- package/dist/spatial-element/CarouselSpatialElement.svelte +7 -7
- package/dist/spatial-element/ContentPage.svelte +5 -2
- package/dist/spatial-element/ContentPage.svelte.d.ts +3 -0
- package/dist/spatial-element/OverflowControls.svelte +6 -6
- package/dist/spatial-element/PointerHint.svelte +5 -4
- package/dist/spatial-element/Section.svelte +4 -33
- package/dist/spatial-element/SpaceMouseControl.svelte +4 -4
- package/dist/spatial-element/SpatialCardGridSection.svelte +6 -9
- package/dist/spatial-element/SpatialCardPresentation.svelte +129 -33
- package/dist/spatial-element/SpatialCardPresentation.svelte.d.ts +2 -2
- package/dist/spatial-element/SpatialCardSlot.svelte +1 -1
- package/dist/spatial-element/SpatialCarouselSection.svelte +10 -2
- package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +14 -2
- package/dist/spatial-element/SpatialElementCard.svelte +7 -13
- package/dist/spatial-element/SpatialElementCard.svelte.d.ts +2 -2
- package/dist/spatial-element/SpatialElementHelp.svelte +7 -5
- package/dist/spatial-element/SpatialElementMediaRail.svelte +2 -1
- package/dist/spatial-element/SpatialElementPage.svelte +2 -2
- package/dist/spatial-element/SpatialElementStickyHeader.svelte +29 -5
- package/dist/spatial-element/SpatialElementSummaryContent.svelte +16 -8
- package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +4 -0
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte +2 -1
- package/dist/spatial-element/SpatialElementTabList.svelte +32 -10
- package/dist/spatial-element/SpatialIconButton.svelte +2 -0
- package/dist/spatial-element/SpatialListPage.svelte +2 -2
- package/dist/spatial-element/SpatialNavigationShell.svelte +10 -44
- package/dist/spatial-element/SpatialSummaryHost.svelte +1 -1
- package/dist/spatial-element/SpatialSummaryRoot.svelte +33 -10
- package/dist/spatial-element/SpatialSummarySlot.svelte +1 -1
- package/dist/spatial-element/cardAppearanceFreeze.js +1 -1
- package/dist/spatial-element/carouselTextHit.js +2 -1
- package/dist/spatial-element/contentSidebars.js +15 -7
- package/dist/spatial-element/index.d.ts +1 -2
- package/dist/spatial-element/layout.generated.css +41 -17
- package/dist/spatial-element/spatialCardGrid.d.ts +3 -3
- package/dist/spatial-element/spatialSummary.d.ts +4 -2
- package/dist/spatial-element/spatialThemeStyle.js +4 -4
- package/dist/stage/ButtonGroup.svelte +2 -0
- package/dist/stage/Panel.svelte +11 -3
- package/dist/stage/Panel.svelte.d.ts +2 -0
- package/dist/stage/Stage.svelte +11 -3
- package/dist/stage/panelShadowStyle.d.ts +3 -0
- package/dist/stage/panelShadowStyle.js +11 -0
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ SvelteKit components for interactive 3D collections and detail pages, built on t
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
15
|
```sh
|
|
16
|
-
npm install @spatial-elements/sveltekit@beta three@^0.
|
|
16
|
+
npm install @spatial-elements/sveltekit@beta three@^0.187.0
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
Requires Node >=22.12 for tooling, Svelte ^5.56.4 and SvelteKit ^2.70.3. This is a beta package. Models and environments belong to your application and are not bundled.
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
replaceState
|
|
17
17
|
} from '$app/navigation';
|
|
18
18
|
import { navigating, page } from '$app/state';
|
|
19
|
-
import type { BeforeNavigate, OnNavigate } from '
|
|
19
|
+
import type { BeforeNavigate, OnNavigate } from '$app/navigation';
|
|
20
20
|
import { getContext, onDestroy, onMount, tick } from 'svelte';
|
|
21
21
|
import { CATALOG_ENDPOINTS, type CatalogEndpointRegistry } from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
|
|
22
22
|
import {
|
|
@@ -270,6 +270,9 @@
|
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
beforeNavigate((navigation) => {
|
|
273
|
+
// A history entry can carry shallow metadata while restoring another page.
|
|
274
|
+
// Kit calls these hooks for that full popstate navigation; keep its capture.
|
|
275
|
+
if (navigation.shallow && navigation.type !== 'popstate') return;
|
|
273
276
|
// The single permitted replay continues the existing visual ownership.
|
|
274
277
|
// It must not run stopActive, onSupersede, or the generic feedback again.
|
|
275
278
|
if (navigation.to && earlyNavigation.acceptReplay(navigation.to.url.href)) {
|
|
@@ -360,6 +363,7 @@
|
|
|
360
363
|
});
|
|
361
364
|
|
|
362
365
|
onNavigate((navigation) => {
|
|
366
|
+
if (navigation.shallow && navigation.type !== 'popstate') return;
|
|
363
367
|
const destination = navigation.to;
|
|
364
368
|
if (!destination) return;
|
|
365
369
|
const owner = controller;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type EarlyNavigationCancelReason, type EarlyNavigationHandle } from '@spatial-elements/core/catalog/EarlyNavigationCoordinator';
|
|
2
|
-
import type { BeforeNavigate, OnNavigate } from '
|
|
2
|
+
import type { BeforeNavigate, OnNavigate } from '$app/navigation';
|
|
3
3
|
import type { VirtualScrollController } from '@spatial-elements/core/stage/VirtualScrollController';
|
|
4
4
|
interface Props {
|
|
5
5
|
controller?: VirtualScrollController;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BeforeNavigate } from '
|
|
1
|
+
import type { BeforeNavigate } from '$app/navigation';
|
|
2
2
|
import type { StageExperience } from '@spatial-elements/core/stage/StageExperience';
|
|
3
3
|
import type { CatalogEndpointRegistry } from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
|
|
4
4
|
import type { EarlyNavigationCancelReason } from '@spatial-elements/core/catalog/EarlyNavigationCoordinator';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { MenuItem } from '@page-sections/core';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
+
import { STAGE_SCROLL_PRIORITY, subscribeStageScrollFrame } from '@spatial-elements/core/stage/scrollFrame';
|
|
4
5
|
import { preventBrowserPinch } from '@spatial-elements/core/stage/browserPinch';
|
|
5
6
|
import '@page-sections/svelte/styles.css';
|
|
6
7
|
import { retainDeviceOrientationPermission } from '@spatial-elements/core/catalog/listDeviceOrientation';
|
|
@@ -31,6 +32,8 @@
|
|
|
31
32
|
dracoDecoderPath?: string;
|
|
32
33
|
/** Layout contents. ContentPage and SpatialElementPage register their own data. */
|
|
33
34
|
children?: Snippet;
|
|
35
|
+
/** Document footer; scrolls over the stationary stage in every layout. */
|
|
36
|
+
footer?: Snippet;
|
|
34
37
|
/** Persistent main-menu content. The shell owns its box and surface. */
|
|
35
38
|
menu?: Snippet;
|
|
36
39
|
/** Complete application navigation; the spatial shell supplies positioning and surfaces. */
|
|
@@ -46,7 +49,24 @@
|
|
|
46
49
|
right?: Snippet;
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
let { theme, colorScheme, messages, renderSettings, dracoDecoderPath, children, menu, navigation, items, brand, tools, summary, left, right, deviceOrientation = false }: Props = $props();
|
|
52
|
+
let { theme, colorScheme, messages, renderSettings, dracoDecoderPath, children, footer, menu, navigation, items, brand, tools, summary, left, right, deviceOrientation = false }: Props = $props();
|
|
53
|
+
let shell = $state<HTMLDivElement>();
|
|
54
|
+
let footerHost = $state<HTMLDivElement>();
|
|
55
|
+
$effect(() => {
|
|
56
|
+
const stage = shell?.querySelector<HTMLElement>('.stage');
|
|
57
|
+
if (!stage || !footerHost) return;
|
|
58
|
+
const host = footerHost;
|
|
59
|
+
let previous = 0;
|
|
60
|
+
// Only the footer follows the existing visual wheel smoothing. No stage
|
|
61
|
+
// geometry reads, inherited style writes or canvas displacement are needed.
|
|
62
|
+
const stop = subscribeStageScrollFrame(frame => {
|
|
63
|
+
const offset = stage.classList.contains('stage-virtual-scroll-active') ? frame.targetScrollY - frame.scrollY : 0;
|
|
64
|
+
if (offset === previous) return;
|
|
65
|
+
previous = offset;
|
|
66
|
+
host.style.translate = offset ? `0 ${offset}px` : '';
|
|
67
|
+
}, STAGE_SCROLL_PRIORITY.virtualDocument);
|
|
68
|
+
return () => { stop(); host.style.removeProperty('translate'); };
|
|
69
|
+
});
|
|
50
70
|
$effect(() => {
|
|
51
71
|
if (deviceOrientation) return retainDeviceOrientationPermission();
|
|
52
72
|
});
|
|
@@ -58,7 +78,7 @@
|
|
|
58
78
|
function attachPinchPolicy(node: HTMLElement) { return { destroy: preventBrowserPinch(node) }; }
|
|
59
79
|
</script>
|
|
60
80
|
|
|
61
|
-
<div use:attachPinchPolicy class="brand-stage-shell" style={brandStyle} style:color-scheme={colorScheme} data-color-scheme={colorScheme}>
|
|
81
|
+
<div bind:this={shell} use:attachPinchPolicy class="brand-stage-shell" style={brandStyle} style:color-scheme={colorScheme} data-color-scheme={colorScheme}>
|
|
62
82
|
<Stage
|
|
63
83
|
{deviceOrientation}
|
|
64
84
|
brandId={theme.id}
|
|
@@ -72,10 +92,15 @@
|
|
|
72
92
|
{#if navigation || menu || items || brand || left || right}<SpatialNavigationShell {navigation} {menu} {items} {brand} {tools} {left} {right} />{/if}
|
|
73
93
|
<SpatialSummaryHost {summary}>{@render children?.()}</SpatialSummaryHost>
|
|
74
94
|
</Stage>
|
|
95
|
+
{#if footer}<div bind:this={footerHost} class="spatial-footer">{@render footer()}</div>{/if}
|
|
75
96
|
<PointerHint />
|
|
76
97
|
</div>
|
|
77
98
|
|
|
78
99
|
<style>
|
|
100
|
+
:global(:where(.brand-stage-shell) a) { text-decoration: none; text-underline-offset: 0.2em; }
|
|
101
|
+
:global(:where(.brand-stage-shell) a:hover) { text-decoration: underline; }
|
|
102
|
+
:global(.brand-stage-shell .ps-navigation a:hover) { text-decoration: none; }
|
|
103
|
+
.spatial-footer { position: relative; z-index: 31; padding-top: 48px; }
|
|
79
104
|
.brand-stage-shell {
|
|
80
105
|
background: var(--spatial-element-background);
|
|
81
106
|
--spatial-element-content-inline-inset: 192px;
|
|
@@ -20,6 +20,8 @@ interface Props {
|
|
|
20
20
|
dracoDecoderPath?: string;
|
|
21
21
|
/** Layout contents. ContentPage and SpatialElementPage register their own data. */
|
|
22
22
|
children?: Snippet;
|
|
23
|
+
/** Document footer; scrolls over the stationary stage in every layout. */
|
|
24
|
+
footer?: Snippet;
|
|
23
25
|
/** Persistent main-menu content. The shell owns its box and surface. */
|
|
24
26
|
menu?: Snippet;
|
|
25
27
|
/** Complete application navigation; the spatial shell supplies positioning and surfaces. */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { resolveSpatialThemeRadii } from '@spatial-elements/core/spatial-element/spatialTheme';
|
|
5
5
|
import SpatialSummarySlot from './SpatialSummarySlot.svelte';
|
|
6
6
|
import { getContext } from 'svelte';
|
|
7
|
-
import {
|
|
7
|
+
import { getSharedPanelBoxShadow } from '@spatial-elements/core/stage/panelShadow';
|
|
8
8
|
import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
|
|
9
9
|
import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
|
|
10
10
|
import { CATALOG_ITEMS, type CatalogItems } from '@spatial-elements/core/catalog/catalogItems';
|
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
aria-hidden={interactive && !selected}
|
|
191
191
|
style:--carousel-panel-opacity={(interactive ? pose.panelOpacity : 1) *
|
|
192
192
|
(brand.panelTheme.opacity ?? 1)}
|
|
193
|
-
style:--carousel-panel-shadow={
|
|
193
|
+
style:--carousel-panel-shadow={getSharedPanelBoxShadow(brand.panelTheme.shadowIntensity ?? 0.28, brand.panelTheme.shadowColor)}
|
|
194
194
|
style:--carousel-panel-tint={typeof brand.panelTheme.tint === 'number'
|
|
195
195
|
? '#' + brand.panelTheme.tint.toString(16).padStart(6, '0')
|
|
196
196
|
: typeof brand.panelTheme.tint === 'object'
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
<SpatialSummarySlot instanceKey={`carousel:${brand.id}:${occurrence}`}
|
|
208
208
|
context={{ spatialElement: { id: spatialElement.id, brandId: brand.id, eyebrow: spatialElement.eyebrow, title: spatialElement.title,
|
|
209
209
|
features: spatialElement.summary?.features ?? spatialElement.features.map((label) => ({ label })), action: spatialElement.summary?.action },
|
|
210
|
-
contentInset, heading: 'h3', mode: 'carousel', address,
|
|
210
|
+
contentInset, heading: 'h3', mode: 'carousel', detailHref: href(spatialElement.href), address,
|
|
211
211
|
carousel: { item: spatialElement, occurrence, compact } }} />
|
|
212
212
|
</div>
|
|
213
213
|
</article>
|
|
@@ -217,7 +217,7 @@
|
|
|
217
217
|
display: block;
|
|
218
218
|
position: relative;
|
|
219
219
|
min-width: 0;
|
|
220
|
-
height: calc(var(--spatial-carousel-
|
|
220
|
+
height: calc(var(--spatial-carousel-panel-reserve) + var(--spatial-carousel-fit-height));
|
|
221
221
|
min-height: 0;
|
|
222
222
|
padding: 0;
|
|
223
223
|
box-sizing: border-box;
|
|
@@ -311,12 +311,12 @@
|
|
|
311
311
|
.summary {
|
|
312
312
|
position: absolute;
|
|
313
313
|
left: var(--spatial-carousel-summary-left);
|
|
314
|
-
top: calc(var(--spatial-carousel-
|
|
314
|
+
top: calc(var(--spatial-carousel-fit-height) - var(--spatial-carousel-compact-overlap));
|
|
315
315
|
width: var(--spatial-carousel-summary-width);
|
|
316
316
|
height: var(--spatial-carousel-compact-height);
|
|
317
317
|
min-height: 0;
|
|
318
318
|
margin: 0;
|
|
319
|
-
|
|
319
|
+
|
|
320
320
|
box-sizing: border-box;
|
|
321
321
|
|
|
322
322
|
border-radius: var(--carousel-panel-radius, 14px);
|
|
@@ -329,7 +329,7 @@
|
|
|
329
329
|
display: block;
|
|
330
330
|
visibility: hidden;
|
|
331
331
|
}
|
|
332
|
-
|
|
332
|
+
|
|
333
333
|
[data-carousel-fit-anchor] { position: absolute; left: var(--spatial-carousel-fit-left); top: var(--spatial-carousel-title-reserve); width: var(--spatial-carousel-fit-width); height: var(--spatial-carousel-fit-height); pointer-events: none; }
|
|
334
334
|
@media (min-width: 840px) {
|
|
335
335
|
.summary { top: calc(var(--spatial-carousel-fit-height) / 2); height: auto; max-height: var(--spatial-carousel-fit-height); padding: 0; transform: translateY(-50%); }
|
|
@@ -20,11 +20,14 @@
|
|
|
20
20
|
/** SpatialCardGridSection, SpatialCarouselSection and ordinary Section children. */
|
|
21
21
|
children?: Snippet;
|
|
22
22
|
leftSidebar?: Snippet;
|
|
23
|
+
/** Content after the sections, outside the sticky menu boundary. */
|
|
24
|
+
pageEnd?: Snippet;
|
|
25
|
+
/** @deprecated Use pageEnd. The site footer belongs to BrandStageShell. */
|
|
23
26
|
footer?: Snippet;
|
|
24
27
|
showContentMenu?: boolean;
|
|
25
28
|
contentMenuLabel?: string;
|
|
26
29
|
}
|
|
27
|
-
let { page, hdr, background, children, leftSidebar, footer, showContentMenu = false, contentMenuLabel }: Props = $props();
|
|
30
|
+
let { page, hdr, background, children, leftSidebar, pageEnd, footer, showContentMenu = false, contentMenuLabel }: Props = $props();
|
|
28
31
|
const backgroundId = $props.id();
|
|
29
32
|
const backgroundScope = backgroundId.replace(/[^a-zA-Z0-9_-]/g, '_');
|
|
30
33
|
onMount(() => {
|
|
@@ -45,7 +48,7 @@
|
|
|
45
48
|
</script>
|
|
46
49
|
|
|
47
50
|
{#if background}<svelte:element this={'style'}>{backgroundRules}</svelte:element>{/if}
|
|
48
|
-
<PageContent {page} {leftSidebar} {footer} {showContentMenu} {contentMenuLabel} class="content-page" data-catalog-list data-brand-id={brand.id}
|
|
51
|
+
<PageContent {page} {leftSidebar} pageEnd={pageEnd ?? footer} {showContentMenu} {contentMenuLabel} class="content-page" data-catalog-list data-brand-id={brand.id}
|
|
49
52
|
data-spatial-content-page={backgroundScope} data-spatial-page-background={background ? backgroundScope : undefined}>
|
|
50
53
|
{@render children?.()}
|
|
51
54
|
</PageContent>
|
|
@@ -11,6 +11,9 @@ interface Props {
|
|
|
11
11
|
/** SpatialCardGridSection, SpatialCarouselSection and ordinary Section children. */
|
|
12
12
|
children?: Snippet;
|
|
13
13
|
leftSidebar?: Snippet;
|
|
14
|
+
/** Content after the sections, outside the sticky menu boundary. */
|
|
15
|
+
pageEnd?: Snippet;
|
|
16
|
+
/** @deprecated Use pageEnd. The site footer belongs to BrandStageShell. */
|
|
14
17
|
footer?: Snippet;
|
|
15
18
|
showContentMenu?: boolean;
|
|
16
19
|
contentMenuLabel?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import ChevronUp from 'lucide
|
|
3
|
-
import ChevronDown from 'lucide
|
|
4
|
-
import ChevronLeft from 'lucide
|
|
5
|
-
import ChevronRight from 'lucide
|
|
2
|
+
import ChevronUp from '@lucide/svelte/icons/chevron-up';
|
|
3
|
+
import ChevronDown from '@lucide/svelte/icons/chevron-down';
|
|
4
|
+
import ChevronLeft from '@lucide/svelte/icons/chevron-left';
|
|
5
|
+
import ChevronRight from '@lucide/svelte/icons/chevron-right';
|
|
6
6
|
let {
|
|
7
7
|
target,
|
|
8
8
|
responsive = false,
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
}
|
|
53
53
|
</script>
|
|
54
54
|
|
|
55
|
-
<div class="overflow-controls" class:vertical class:hidden data-overflow-controls={label}>
|
|
55
|
+
<div class="ps-shadow-navigation overflow-controls" class:vertical class:hidden data-overflow-controls={label}>
|
|
56
56
|
{#if before}<button
|
|
57
57
|
class="before"
|
|
58
58
|
type="button"
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
--scroll-button-radius: var(--spatial-element-control-radius, 12px);
|
|
96
96
|
background: var(--ps-section-standard, #fff);
|
|
97
97
|
color: var(--spatial-element-navigation-ink, var(--spatial-element-ink));
|
|
98
|
-
box-shadow:
|
|
98
|
+
box-shadow: var(--ps-navigation-shadow, var(--ps-default-navigation-shadow));
|
|
99
99
|
cursor: pointer;
|
|
100
100
|
pointer-events: auto;
|
|
101
101
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount } from 'svelte';
|
|
3
|
-
import MoveHorizontal from 'lucide
|
|
4
|
-
import Search from 'lucide
|
|
5
|
-
import Rotate3D from 'lucide
|
|
3
|
+
import MoveHorizontal from '@lucide/svelte/icons/move-horizontal';
|
|
4
|
+
import Search from '@lucide/svelte/icons/search';
|
|
5
|
+
import Rotate3D from '@lucide/svelte/icons/rotate-3d';
|
|
6
6
|
import { carouselTextHit } from './carouselTextHit.js';
|
|
7
7
|
let badge: HTMLDivElement;
|
|
8
8
|
let action = $state<'move' | 'details' | 'rotate' | undefined>();
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
text = !dragging ? carouselTextHit(target, x, y) : undefined;
|
|
24
24
|
text?.setAttribute('data-carousel-text-hit', '');
|
|
25
25
|
const geometry = target.closest('.spatial-element-target');
|
|
26
|
-
|
|
26
|
+
const summaryLink = target.closest('[data-spatial-summary-link], .compact-copy');
|
|
27
|
+
action = dragging ? 'move' : text || (buttons & 1) || (!geometry && !summaryLink && target.closest('a, button, input, textarea, select, [contenteditable]'))
|
|
27
28
|
? undefined : geometry?.closest('.selected') ? 'details' : 'move';
|
|
28
29
|
} else {
|
|
29
30
|
const cursor = target instanceof HTMLCanvasElement ? target.style.cursor : '';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Section as PageSection } from '@page-sections/svelte';
|
|
3
3
|
import { getContext, onMount } from 'svelte';
|
|
4
|
-
import { dev } from '$app/
|
|
4
|
+
import { dev } from '$app/env';
|
|
5
5
|
import './layout.generated.css';
|
|
6
6
|
import { createSectionBackgroundNormalizer } from '@spatial-elements/core/spatial-element/sectionBackground';
|
|
7
7
|
import type { Snippet } from 'svelte';
|
|
@@ -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>
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
>
|
|
85
85
|
<SpaceMouseIcon />
|
|
86
86
|
</SpatialIconButton>
|
|
87
|
-
<dialog bind:this={dialog} aria-labelledby={`${id}-title`} aria-describedby={`${id}-description`}>
|
|
87
|
+
<dialog class="ps-shadow-popup" bind:this={dialog} aria-labelledby={`${id}-title`} aria-describedby={`${id}-description`}>
|
|
88
88
|
<h2 id={`${id}-title`}>
|
|
89
89
|
{failure === 'permission-required'
|
|
90
90
|
? copy.spaceMousePermissionTitle
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
>{/if}
|
|
110
110
|
</div>
|
|
111
111
|
</dialog>
|
|
112
|
-
<div bind:this={toast} popover="manual" role="status" class="connection-toast">
|
|
112
|
+
<div bind:this={toast} popover="manual" role="status" class="connection-toast ps-shadow-popup">
|
|
113
113
|
{toastMessage}
|
|
114
114
|
</div>
|
|
115
115
|
|
|
@@ -118,12 +118,12 @@
|
|
|
118
118
|
.connection-toast {
|
|
119
119
|
box-sizing: border-box;
|
|
120
120
|
padding: 24px;
|
|
121
|
-
border: 1px solid
|
|
121
|
+
border: 1px solid var(--ps-panel-border);
|
|
122
122
|
border-radius: var(--spatial-element-panel-radius, 12px);
|
|
123
123
|
color: var(--spatial-element-ink);
|
|
124
124
|
background: var(--ps-section-standard, var(--ps-background, #fff));
|
|
125
125
|
font: inherit;
|
|
126
|
-
box-shadow:
|
|
126
|
+
box-shadow: var(--ps-popup-shadow, var(--ps-navigation-shadow, var(--ps-default-navigation-shadow)));
|
|
127
127
|
max-width: min(440px, calc(100vw - 32px));
|
|
128
128
|
}
|
|
129
129
|
dialog::backdrop {
|
|
@@ -18,16 +18,15 @@
|
|
|
18
18
|
section,
|
|
19
19
|
list,
|
|
20
20
|
cardSize = 'm',
|
|
21
|
-
|
|
22
|
-
itemSpan
|
|
21
|
+
cardShadow = false,
|
|
22
|
+
itemSpan,
|
|
23
23
|
textAlign = 'start',
|
|
24
24
|
mediaAspect = '1/1',
|
|
25
|
-
mediaFit =
|
|
25
|
+
mediaFit = 'contain',
|
|
26
26
|
cardTone = 'standard'
|
|
27
27
|
}: Props = $props();
|
|
28
28
|
const reserveEyebrow = $derived(
|
|
29
|
-
|
|
30
|
-
list.some((item) => Boolean(item.eyebrow?.trim()))
|
|
29
|
+
cardSize !== 's' && list.some((item) => Boolean(item.eyebrow?.trim()))
|
|
31
30
|
);
|
|
32
31
|
let catalog: HTMLDivElement;
|
|
33
32
|
$effect(() => {
|
|
@@ -48,7 +47,7 @@
|
|
|
48
47
|
{#snippet card()}<SpatialElementCard
|
|
49
48
|
{spatialElement}
|
|
50
49
|
{cardSize}
|
|
51
|
-
{
|
|
50
|
+
{cardShadow}
|
|
52
51
|
{textAlign}
|
|
53
52
|
{mediaAspect}
|
|
54
53
|
{mediaFit}
|
|
@@ -57,9 +56,7 @@
|
|
|
57
56
|
order={index}
|
|
58
57
|
occurrence={JSON.stringify([section.id, spatialElement.itemKey ?? spatialElement.id])}
|
|
59
58
|
/>{/snippet}
|
|
60
|
-
{#if
|
|
61
|
-
>{@render card()}</ContentBlock
|
|
62
|
-
>
|
|
59
|
+
{#if itemSpan !== undefined}<ContentBlock span={itemSpan}>{@render card()}</ContentBlock>
|
|
63
60
|
{:else}{@render card()}{/if}
|
|
64
61
|
{/each}
|
|
65
62
|
</ContentGrid>
|