@spatial-elements/sveltekit 0.1.0-beta.2 → 1.0.0-beta.11
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 +18 -13
- package/dist/catalog/ScrollNavigationBridge.svelte +172 -47
- package/dist/catalog/ScrollNavigationBridge.svelte.d.ts +9 -2
- package/dist/catalog/catalogNavigation.js +3 -2
- package/dist/catalog/catalogSummaryTransfer.d.ts +16 -0
- package/dist/catalog/catalogSummaryTransfer.js +79 -0
- package/dist/catalog/catalogTransition.css +58 -3
- package/dist/catalog/interruptedPresentation.d.ts +10 -0
- package/dist/catalog/interruptedPresentation.js +29 -0
- package/dist/catalog/presentationCleanup.d.ts +4 -0
- package/dist/catalog/presentationCleanup.js +20 -0
- package/dist/catalog/stagedCatalogNavigation.d.ts +44 -0
- package/dist/catalog/stagedCatalogNavigation.js +403 -0
- package/dist/catalog/stagedDomReveal.d.ts +8 -0
- package/dist/catalog/stagedDomReveal.js +76 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/spatial-element/BrandStageShell.svelte +52 -71
- package/dist/spatial-element/BrandStageShell.svelte.d.ts +31 -4
- package/dist/spatial-element/CarouselSpatialElement.svelte +152 -200
- package/dist/spatial-element/CarouselSpatialElement.svelte.d.ts +5 -1
- package/dist/spatial-element/ContentBlock.svelte +7 -0
- package/dist/spatial-element/ContentBlock.svelte.d.ts +9 -0
- package/dist/spatial-element/ContentGrid.svelte +7 -0
- package/dist/spatial-element/ContentGrid.svelte.d.ts +8 -0
- package/dist/spatial-element/ContentPage.svelte +51 -55
- package/dist/spatial-element/ContentPage.svelte.d.ts +14 -3
- package/dist/spatial-element/InteractionGesture.svelte +39 -0
- package/dist/spatial-element/InteractionGesture.svelte.d.ts +7 -0
- package/dist/spatial-element/OverflowControls.svelte +129 -0
- package/dist/spatial-element/OverflowControls.svelte.d.ts +9 -0
- package/dist/spatial-element/PointerHint.svelte +80 -0
- package/dist/spatial-element/PointerHint.svelte.d.ts +3 -0
- package/dist/spatial-element/Section.svelte +25 -106
- package/dist/spatial-element/Section.svelte.d.ts +1 -0
- package/dist/spatial-element/SectionSurfaceGroup.svelte +8 -0
- package/dist/spatial-element/SectionSurfaceGroup.svelte.d.ts +8 -0
- package/dist/spatial-element/SpaceMouseControl.svelte +159 -0
- package/dist/spatial-element/SpaceMouseControl.svelte.d.ts +7 -0
- package/dist/spatial-element/SpaceMouseIcon.svelte +12 -0
- package/dist/spatial-element/SpaceMouseIcon.svelte.d.ts +26 -0
- package/dist/spatial-element/SpatialCardGridSection.svelte +79 -0
- package/dist/spatial-element/SpatialCardGridSection.svelte.d.ts +11 -0
- package/dist/spatial-element/SpatialCardPresentation.svelte +311 -0
- package/dist/spatial-element/SpatialCardPresentation.svelte.d.ts +19 -0
- package/dist/spatial-element/SpatialCardSlot.svelte +33 -0
- package/dist/spatial-element/SpatialCardSlot.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialCarouselSection.svelte +754 -0
- package/dist/spatial-element/{CarouselSection.svelte.d.ts → SpatialCarouselSection.svelte.d.ts} +5 -5
- package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +12 -65
- package/dist/spatial-element/SpatialElementCard.svelte +54 -238
- package/dist/spatial-element/SpatialElementCard.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialElementHelp.svelte +300 -0
- package/dist/spatial-element/SpatialElementHelp.svelte.d.ts +6 -0
- package/dist/spatial-element/SpatialElementMediaRail.svelte +322 -52
- package/dist/spatial-element/SpatialElementMediaRail.svelte.d.ts +4 -1
- package/dist/spatial-element/SpatialElementNativeMedia.svelte +101 -0
- package/dist/spatial-element/SpatialElementNativeMedia.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialElementPage.svelte +156 -71
- package/dist/spatial-element/SpatialElementPage.svelte.d.ts +10 -3
- package/dist/spatial-element/SpatialElementStickyHeader.svelte +89 -105
- package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +6 -1
- package/dist/spatial-element/SpatialElementSummaryContent.svelte +198 -0
- package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +23 -0
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte +48 -380
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte.d.ts +2 -1
- package/dist/spatial-element/SpatialElementTabList.svelte +40 -17
- package/dist/spatial-element/SpatialElementTabList.svelte.d.ts +2 -1
- package/dist/spatial-element/SpatialElementTabs.svelte +61 -18
- package/dist/spatial-element/SpatialElementTabs.svelte.d.ts +3 -1
- package/dist/spatial-element/SpatialElementViewToggle.svelte +54 -0
- package/dist/spatial-element/SpatialElementViewToggle.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialIconButton.svelte +66 -0
- package/dist/spatial-element/SpatialIconButton.svelte.d.ts +17 -0
- package/dist/spatial-element/SpatialListPage.svelte +37 -8
- package/dist/spatial-element/SpatialListPage.svelte.d.ts +4 -1
- package/dist/spatial-element/SpatialMediaIndicator.svelte +16 -0
- package/dist/spatial-element/SpatialMediaIndicator.svelte.d.ts +26 -0
- package/dist/spatial-element/SpatialNavigationShell.svelte +138 -0
- package/dist/spatial-element/SpatialNavigationShell.svelte.d.ts +15 -0
- package/dist/spatial-element/SpatialSummaryHost.svelte +19 -0
- package/dist/spatial-element/SpatialSummaryHost.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialSummaryRoot.svelte +80 -0
- package/dist/spatial-element/SpatialSummaryRoot.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialSummarySlot.svelte +39 -0
- package/dist/spatial-element/SpatialSummarySlot.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialViewIcon.svelte +29 -0
- package/dist/spatial-element/SpatialViewIcon.svelte.d.ts +6 -0
- package/dist/spatial-element/brandContext.d.ts +1 -1
- package/dist/spatial-element/brandContext.js +1 -1
- package/dist/spatial-element/cardAppearanceFreeze.d.ts +5 -0
- package/dist/spatial-element/cardAppearanceFreeze.js +72 -0
- package/dist/spatial-element/carouselTextHit.d.ts +2 -0
- package/dist/spatial-element/carouselTextHit.js +17 -0
- package/dist/spatial-element/contentSidebars.d.ts +3 -0
- package/dist/spatial-element/contentSidebars.js +56 -0
- package/dist/spatial-element/index.d.ts +19 -3
- package/dist/spatial-element/index.js +12 -2
- package/dist/spatial-element/layout.generated.css +363 -0
- package/dist/spatial-element/messagesContext.d.ts +3 -0
- package/dist/spatial-element/messagesContext.js +10 -0
- package/dist/spatial-element/presentationBoxFreeze.d.ts +8 -0
- package/dist/spatial-element/presentationBoxFreeze.js +35 -0
- package/dist/spatial-element/spatialCardGrid.d.ts +12 -0
- package/dist/spatial-element/spatialCardGrid.js +1 -0
- package/dist/spatial-element/spatialPageContext.d.ts +4 -0
- package/dist/spatial-element/spatialPageContext.js +9 -0
- package/dist/spatial-element/spatialPresentationOwner.d.ts +6 -0
- package/dist/spatial-element/spatialPresentationOwner.js +2 -0
- package/dist/spatial-element/spatialSummary.d.ts +43 -0
- package/dist/spatial-element/spatialSummary.js +1 -0
- package/dist/spatial-element/spatialSummaryHost.svelte.d.ts +60 -0
- package/dist/spatial-element/spatialSummaryHost.svelte.js +233 -0
- package/dist/spatial-element/spatialThemeStyle.d.ts +3 -0
- package/dist/spatial-element/spatialThemeStyle.js +69 -0
- package/dist/spatial-element/truncatedTitle.d.ts +5 -0
- package/dist/spatial-element/truncatedTitle.js +28 -0
- package/dist/stage/ButtonGroup.svelte +152 -0
- package/dist/stage/ButtonGroup.svelte.d.ts +24 -0
- package/dist/stage/Panel.svelte +72 -14
- package/dist/stage/Panel.svelte.d.ts +14 -2
- package/dist/stage/Stage.svelte +471 -51
- package/dist/stage/Stage.svelte.d.ts +8 -1
- package/dist/stage/StageViewport.svelte +15 -2
- package/dist/stage/authoredStyle.d.ts +4 -0
- package/dist/stage/authoredStyle.js +17 -0
- package/dist/stage/buttonGroup.d.ts +9 -0
- package/dist/stage/buttonGroup.js +1 -0
- package/logo.svg +225 -0
- package/package.json +9 -6
- package/dist/spatial-element/CarouselSection.svelte +0 -350
- package/dist/spatial-element/ListSection.svelte +0 -30
- package/dist/spatial-element/ListSection.svelte.d.ts +0 -8
package/dist/stage/Stage.svelte
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { isSpaceMouseDesktop, type SpaceMouseState } from '@spatial-elements/core/stage/spaceMousePlatform';
|
|
3
|
+
import { hasUsableWebGPU } from '@spatial-elements/core/stage/webgpuSupport';
|
|
2
4
|
import type { SpatialElementLodPair } from '@spatial-elements/core/catalog/spatialElementLodPair';
|
|
5
|
+
import { DEFAULT_BACKGROUND } from '@spatial-elements/core/stage/stageConstants';
|
|
3
6
|
import { onMount, setContext, tick } from 'svelte';
|
|
7
|
+
import {
|
|
8
|
+
observeSpaceMousePermission,
|
|
9
|
+
rememberSpaceMouseConnection,
|
|
10
|
+
shouldReconnectSpaceMouse,
|
|
11
|
+
type SpaceMousePermission
|
|
12
|
+
} from '@spatial-elements/core/stage/spaceMousePermission';
|
|
13
|
+
import { ResponsiveViewportMetrics } from '@spatial-elements/core/spatial-element/ResponsiveViewportMetrics';
|
|
14
|
+
import { SPATIAL_PRESENTATION_OWNER, type SpatialPresentationOwner } from '../spatial-element/spatialPresentationOwner.js';
|
|
15
|
+
import type { SpatialSummaryHostController } from '../spatial-element/spatialSummaryHost.svelte.js';
|
|
4
16
|
import type { Snippet } from 'svelte';
|
|
5
17
|
import type {
|
|
6
18
|
BackgroundSettings,
|
|
@@ -9,33 +21,65 @@
|
|
|
9
21
|
StageInteractionTheme,
|
|
10
22
|
StageModelSettings,
|
|
11
23
|
StagePanelTarget,
|
|
24
|
+
StageRenderSettings,
|
|
12
25
|
StageVisualTestView,
|
|
13
26
|
StageViewportTarget,
|
|
14
27
|
StageZoomFocusState
|
|
15
28
|
} from '@spatial-elements/core/stage/StageExperience';
|
|
16
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
isStageVisualTestMode,
|
|
31
|
+
type StageVisualTestController
|
|
32
|
+
} from '@spatial-elements/core/stage/stageVisualTest';
|
|
33
|
+
import { resolveStageRenderSettings } from '@spatial-elements/core/stage/renderSettings';
|
|
17
34
|
import { VirtualScrollController } from '@spatial-elements/core/stage/VirtualScrollController';
|
|
35
|
+
import { StageFullscreenController } from '@spatial-elements/core/stage/StageFullscreenController';
|
|
18
36
|
import ScrollNavigationBridge from '../catalog/ScrollNavigationBridge.svelte';
|
|
37
|
+
import type { startStagedCatalogNavigation as StartStagedCatalogNavigation, InterruptedCatalogPresentation } from '../catalog/stagedCatalogNavigation.js';
|
|
38
|
+
import { prepareCatalogSummaryTransfer } from '../catalog/catalogSummaryTransfer.js';
|
|
39
|
+
import type { EarlyNavigationCancelReason } from '@spatial-elements/core/catalog/EarlyNavigationCoordinator';
|
|
40
|
+
import { NavigationFeedback } from '@spatial-elements/core/catalog/NavigationFeedback';
|
|
19
41
|
import { CatalogTransition } from '@spatial-elements/core/catalog/CatalogTransition';
|
|
20
|
-
import {
|
|
42
|
+
import {
|
|
43
|
+
CATALOG_ENDPOINTS,
|
|
44
|
+
CatalogEndpointRegistry
|
|
45
|
+
} from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
|
|
21
46
|
import '../catalog/catalogTransition.css';
|
|
22
47
|
import { createStageSpatialElementAssetManifest } from '@spatial-elements/core/catalog/spatialElementAssets';
|
|
23
48
|
import { CATALOG_ITEMS, CatalogItems } from '@spatial-elements/core/catalog/catalogItems';
|
|
24
|
-
import {
|
|
25
|
-
|
|
49
|
+
import {
|
|
50
|
+
CATALOG_SECTIONS,
|
|
51
|
+
CatalogSections
|
|
52
|
+
} from '@spatial-elements/core/catalog/CatalogSections';
|
|
53
|
+
import type { SpatialListItem, SpatialElementMediaItem } from '@spatial-elements/core/spatial-element/types';
|
|
26
54
|
import type { CatalogPage } from '@spatial-elements/core/catalog/catalogPage';
|
|
27
|
-
import
|
|
55
|
+
import {
|
|
56
|
+
SpatialPageRegistry,
|
|
57
|
+
type SpatialPage
|
|
58
|
+
} from '@spatial-elements/core/catalog/SpatialPageRegistry';
|
|
59
|
+
import {
|
|
60
|
+
getSpatialElementScene,
|
|
61
|
+
hasSpatialElementScene
|
|
62
|
+
} from '@spatial-elements/core/spatial-element/spatialElementScene';
|
|
63
|
+
import { SPATIAL_PAGE } from '../spatial-element/spatialPageContext.js';
|
|
64
|
+
import type { BeforeNavigate, OnNavigate } from '@sveltejs/kit';
|
|
28
65
|
import {
|
|
29
66
|
STAGE_CONTEXT_KEY,
|
|
67
|
+
STAGE_PANEL_LAYOUT_EVENT,
|
|
30
68
|
type StageContext,
|
|
31
69
|
type StagePanelRegistration,
|
|
32
70
|
type StageViewportRegistration
|
|
33
71
|
} from '@spatial-elements/core/stage/panelContext';
|
|
34
72
|
|
|
35
73
|
interface Props {
|
|
74
|
+
deviceOrientation?: boolean;
|
|
75
|
+
/** Namespace for automatic ContentPage/SpatialElementPage registration. Supplied by BrandStageShell. */
|
|
76
|
+
brandId?: string;
|
|
77
|
+
renderSettings?: StageRenderSettings;
|
|
36
78
|
dracoDecoderPath?: string;
|
|
37
79
|
ariaLabel?: string;
|
|
38
80
|
background?: BackgroundSettings;
|
|
81
|
+
/** Theme overrides applied after each element's HDR background settings. */
|
|
82
|
+
sceneBackground?: Partial<BackgroundSettings>;
|
|
39
83
|
pageBackground?: string;
|
|
40
84
|
hdr?: string;
|
|
41
85
|
glb?: string;
|
|
@@ -43,31 +87,67 @@
|
|
|
43
87
|
model?: StageModelSettings;
|
|
44
88
|
camera?: StageCameraSettings;
|
|
45
89
|
interactionTheme?: Partial<StageInteractionTheme>;
|
|
90
|
+
/** @deprecated Low-level manual adapter. BrandStageShell manages catalog state from its pages. */
|
|
46
91
|
catalog?: CatalogPage;
|
|
47
92
|
children?: Snippet;
|
|
48
93
|
}
|
|
49
94
|
|
|
50
95
|
let {
|
|
96
|
+
deviceOrientation = false,
|
|
97
|
+
brandId,
|
|
51
98
|
ariaLabel = 'WebGPU 3D stage',
|
|
99
|
+
renderSettings,
|
|
52
100
|
dracoDecoderPath,
|
|
53
101
|
pageBackground = '#ffffff',
|
|
54
|
-
background,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
102
|
+
background: standaloneBackground,
|
|
103
|
+
sceneBackground,
|
|
104
|
+
hdr: standaloneHdr,
|
|
105
|
+
glb: standaloneGlb,
|
|
106
|
+
lodPair: standaloneLodPair,
|
|
107
|
+
model: standaloneModel,
|
|
108
|
+
camera: standaloneCamera,
|
|
60
109
|
interactionTheme,
|
|
61
|
-
catalog,
|
|
110
|
+
catalog: explicitCatalog,
|
|
62
111
|
children
|
|
63
112
|
}: Props = $props();
|
|
64
113
|
|
|
114
|
+
let readPage = $state.raw<(() => SpatialPage) | undefined>();
|
|
115
|
+
setContext(
|
|
116
|
+
SPATIAL_PAGE,
|
|
117
|
+
new SpatialPageRegistry((read) => {
|
|
118
|
+
readPage = read;
|
|
119
|
+
})
|
|
120
|
+
);
|
|
121
|
+
const activePage = $derived(readPage?.());
|
|
122
|
+
const resolvedPageBackground = $derived(activePage?.kind === 'content' ? activePage.background ?? pageBackground : pageBackground);
|
|
123
|
+
const activeElement = $derived(activePage?.kind === 'detail' ? activePage.element : undefined);
|
|
124
|
+
const activeScene = $derived(activeElement ? getSpatialElementScene(activeElement) : undefined);
|
|
125
|
+
const catalog = $derived<CatalogPage | undefined>(
|
|
126
|
+
brandId
|
|
127
|
+
? {
|
|
128
|
+
brandId,
|
|
129
|
+
view: activeElement ? 'detail' : 'content',
|
|
130
|
+
spatialElementId: activeElement?.id,
|
|
131
|
+
spatialElementStage: activeScene,
|
|
132
|
+
spatialElements: []
|
|
133
|
+
}
|
|
134
|
+
: explicitCatalog
|
|
135
|
+
);
|
|
65
136
|
let displayedSpatialElements = $state<SpatialListItem[]>([]);
|
|
66
137
|
setContext(CATALOG_ITEMS, new CatalogItems((items) => (displayedSpatialElements = items)));
|
|
67
138
|
setContext(CATALOG_SECTIONS, new CatalogSections());
|
|
68
139
|
const catalogSpatialElements = $derived(
|
|
69
140
|
displayedSpatialElements.length ? displayedSpatialElements : (catalog?.spatialElements ?? [])
|
|
70
141
|
);
|
|
142
|
+
const background = $derived({ ...DEFAULT_BACKGROUND, ...(brandId ? activeElement?.background : standaloneBackground), ...sceneBackground });
|
|
143
|
+
const hdr = $derived(brandId
|
|
144
|
+
? (activePage?.kind === 'content' ? activePage.hdr : activeScene?.hdr ?? '')
|
|
145
|
+
: standaloneHdr);
|
|
146
|
+
const glb = $derived(brandId ? (activeScene?.glb ?? '') : standaloneGlb);
|
|
147
|
+
const lodPair = $derived(brandId ? activeScene?.lodPair : standaloneLodPair);
|
|
148
|
+
const model = $derived(brandId ? activeElement?.model : standaloneModel);
|
|
149
|
+
const camera = $derived(brandId ? activeElement?.camera : standaloneCamera);
|
|
150
|
+
|
|
71
151
|
const registeredPanels: StagePanelRegistration[] = [];
|
|
72
152
|
const catalogEndpoints = new CatalogEndpointRegistry();
|
|
73
153
|
setContext(CATALOG_ENDPOINTS, catalogEndpoints);
|
|
@@ -76,12 +156,54 @@
|
|
|
76
156
|
let virtualScrollSpacer: HTMLDivElement;
|
|
77
157
|
let domLayer: HTMLDivElement;
|
|
78
158
|
let status = $state('Loading stage');
|
|
79
|
-
let showStatus = $state(
|
|
159
|
+
let showStatus = $state(false);
|
|
80
160
|
let isEnhanced = $state(false);
|
|
161
|
+
// The device survives navigation; the destination still needs its own first
|
|
162
|
+
// submitted frame before its detail and minimap posters can fade away.
|
|
163
|
+
let isPageReady = $state(false);
|
|
164
|
+
let fullscreen = $state(false);
|
|
165
|
+
let fullscreenController: StageFullscreenController | undefined;
|
|
81
166
|
let isFallback = $state(true);
|
|
82
167
|
let domLayerHidden = $state(false);
|
|
83
168
|
let domLayerOpacity = $state(1);
|
|
84
169
|
let experience = $state<StageExperience | null>(null);
|
|
170
|
+
let spaceMouseEnabled = $state(false);
|
|
171
|
+
let spaceMousePermission = $state<SpaceMousePermission>('unknown');
|
|
172
|
+
let spaceMouseDisabledByUser = false;
|
|
173
|
+
let spaceMouseDesktop = $state(false);
|
|
174
|
+
let spaceMouseState = $state<SpaceMouseState>('idle');
|
|
175
|
+
onMount(() => {
|
|
176
|
+
spaceMouseDesktop = isSpaceMouseDesktop(navigator);
|
|
177
|
+
if (!spaceMouseDesktop) return;
|
|
178
|
+
let first = true;
|
|
179
|
+
return observeSpaceMousePermission((state) => {
|
|
180
|
+
const newlyGranted = state === 'granted' && spaceMousePermission !== 'granted';
|
|
181
|
+
spaceMousePermission = state;
|
|
182
|
+
if (
|
|
183
|
+
(first || newlyGranted) && shouldReconnectSpaceMouse(state) &&
|
|
184
|
+
!spaceMouseDisabledByUser && !spaceMouseEnabled
|
|
185
|
+
) {
|
|
186
|
+
spaceMouseEnabled = true;
|
|
187
|
+
experience?.setSpaceMouseEnabled(true);
|
|
188
|
+
} else if (state === 'denied' && spaceMouseEnabled) {
|
|
189
|
+
spaceMouseEnabled = false;
|
|
190
|
+
experience?.setSpaceMouseEnabled(false);
|
|
191
|
+
spaceMouseState = 'permission-required';
|
|
192
|
+
}
|
|
193
|
+
first = false;
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
let layoutMetrics: ResponsiveViewportMetrics | undefined;
|
|
197
|
+
let presentationHost: SpatialSummaryHostController | undefined;
|
|
198
|
+
setContext<SpatialPresentationOwner>(SPATIAL_PRESENTATION_OWNER, {
|
|
199
|
+
register(host) {
|
|
200
|
+
presentationHost = host;
|
|
201
|
+
return () => { if (presentationHost === host) presentationHost = undefined; };
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
let readDetailMedia = $state.raw<(() => SpatialElementMediaItem['kind']) | undefined>();
|
|
205
|
+
let detailMediaOwner: symbol | undefined;
|
|
206
|
+
const detailMedia = $derived(readDetailMedia?.() ?? 'minimap');
|
|
85
207
|
let stageState = $state<'loading' | 'enhanced' | 'fallback'>('loading');
|
|
86
208
|
let zoomFocusState = $state<StageZoomFocusState>({
|
|
87
209
|
focus: 0,
|
|
@@ -92,8 +214,14 @@
|
|
|
92
214
|
let visualTestController: StageVisualTestController | undefined;
|
|
93
215
|
let virtualScroll = $state<VirtualScrollController>();
|
|
94
216
|
let transition: CatalogTransition | undefined;
|
|
217
|
+
let startStagedCatalogNavigation: typeof StartStagedCatalogNavigation | undefined;
|
|
218
|
+
let earlyTransition: ReturnType<typeof StartStagedCatalogNavigation>;
|
|
219
|
+
let interruptedPresentation: InterruptedCatalogPresentation | undefined;
|
|
220
|
+
let summaryTransfer: ReturnType<typeof prepareCatalogSummaryTransfer>;
|
|
221
|
+
let lastEarlyTimings: NonNullable<typeof earlyTransition>['timings'] | undefined;
|
|
95
222
|
let initialized: Promise<void> | undefined;
|
|
96
223
|
let navigationGeneration = 0;
|
|
224
|
+
let navigationFeedback: NavigationFeedback | undefined;
|
|
97
225
|
let destroyed = false;
|
|
98
226
|
let nextPageBinding: Promise<void> | undefined;
|
|
99
227
|
let releasePageBinding: (() => void) | undefined;
|
|
@@ -102,7 +230,8 @@
|
|
|
102
230
|
let retainedPageSignature: string | undefined;
|
|
103
231
|
const pageSignature = () =>
|
|
104
232
|
JSON.stringify([
|
|
105
|
-
|
|
233
|
+
renderSettings,
|
|
234
|
+
resolvedPageBackground,
|
|
106
235
|
background,
|
|
107
236
|
hdr,
|
|
108
237
|
glb,
|
|
@@ -119,6 +248,25 @@
|
|
|
119
248
|
};
|
|
120
249
|
|
|
121
250
|
setContext<StageContext>(STAGE_CONTEXT_KEY, {
|
|
251
|
+
registerDetailMedia(read) {
|
|
252
|
+
const owner = Symbol(); detailMediaOwner = owner; readDetailMedia = read;
|
|
253
|
+
return () => { if (detailMediaOwner === owner) { detailMediaOwner = undefined; readDetailMedia = undefined; } };
|
|
254
|
+
},
|
|
255
|
+
getLayoutMetrics: (mode) => layoutMetrics?.read(mode),
|
|
256
|
+
isEnhanced: () => isEnhanced,
|
|
257
|
+
isSpaceMouseEnabled: () => spaceMouseState === 'connected',
|
|
258
|
+
isSpaceMouseDesktop: () => spaceMouseDesktop,
|
|
259
|
+
getSpaceMouseState: () => spaceMouseState,
|
|
260
|
+
getSpaceMousePermission: () => spaceMousePermission,
|
|
261
|
+
setSpaceMouseEnabled(enabled) {
|
|
262
|
+
if (!spaceMouseDesktop) return;
|
|
263
|
+
experience?.setSpaceMouseEnabled(false);
|
|
264
|
+
spaceMouseState = enabled ? 'connecting' : 'idle';
|
|
265
|
+
spaceMouseDisabledByUser = !enabled;
|
|
266
|
+
spaceMouseEnabled = enabled;
|
|
267
|
+
experience?.setSpaceMouseEnabled(enabled);
|
|
268
|
+
},
|
|
269
|
+
updatePanelAppearance: scheduleAppearanceUpdate,
|
|
122
270
|
prefetchSpatialElement: (config) => experience?.prefetchSpatialElement(config),
|
|
123
271
|
registerPanel(panel) {
|
|
124
272
|
registeredPanels.push(panel);
|
|
@@ -137,15 +285,32 @@
|
|
|
137
285
|
},
|
|
138
286
|
resetView() {
|
|
139
287
|
experience?.resetView();
|
|
140
|
-
}
|
|
288
|
+
},
|
|
289
|
+
isFullscreen: () => fullscreen,
|
|
290
|
+
getZoomFocus: () => zoomFocusState.focus,
|
|
291
|
+
getZoomUiFocus: () => zoomFocusState.uiFocus,
|
|
292
|
+
setFullscreen: (active) => fullscreenController?.setFullscreen(active)
|
|
141
293
|
});
|
|
142
294
|
|
|
143
295
|
onMount(() => {
|
|
296
|
+
layoutMetrics = new ResponsiveViewportMetrics(stage);
|
|
297
|
+
layoutMetrics.start();
|
|
298
|
+
// The semantic page is already usable. Only announce unusually slow enhancement.
|
|
299
|
+
const statusTimer = window.setTimeout(() => {
|
|
300
|
+
if (stageState === 'loading') showStatus = true;
|
|
301
|
+
}, 1000);
|
|
302
|
+
fullscreenController = new StageFullscreenController(stage, (active) => {
|
|
303
|
+
fullscreen = active;
|
|
304
|
+
experience?.setFullscreen(active);
|
|
305
|
+
});
|
|
144
306
|
document.documentElement.classList.add('stage-route');
|
|
145
307
|
document.body.classList.add('stage-route');
|
|
146
308
|
virtualScroll = new VirtualScrollController(stage, domLayer, virtualScrollSpacer);
|
|
147
|
-
|
|
309
|
+
// Native fallback pages keep native document scrolling and browser anchor behavior.
|
|
310
|
+
// Start virtual scrolling only after the WebGPU capability probe.
|
|
311
|
+
navigationFeedback = new NavigationFeedback(stage);
|
|
148
312
|
transition = new CatalogTransition(stage, catalogEndpoints, {
|
|
313
|
+
diagnose: reason => { if (visualTestController) stage.dataset.catalogTransitionDecision = reason; },
|
|
149
314
|
captureContentGeometry: (endpoint, secondary) =>
|
|
150
315
|
experience?.captureContentGeometry(endpoint.spatialElementId, secondary) ?? false,
|
|
151
316
|
prepareContentParticipants: (pairs) => experience?.prepareContentParticipants(pairs),
|
|
@@ -159,7 +324,10 @@
|
|
|
159
324
|
prepareDestination: (destination) =>
|
|
160
325
|
experience?.prepareGeometryDestination(destination) ?? false,
|
|
161
326
|
setGeometryProgress: (progress) => experience?.setCatalogGeometryProgress(progress),
|
|
162
|
-
flushFrame: () =>
|
|
327
|
+
flushFrame: () => {
|
|
328
|
+
if (stage.dataset.catalogTransition === 'animating') navigationFeedback?.end();
|
|
329
|
+
experience?.flushCatalogFrame();
|
|
330
|
+
},
|
|
163
331
|
finishGeometry: () => {
|
|
164
332
|
try {
|
|
165
333
|
experience?.finishCatalogGeometry();
|
|
@@ -179,17 +347,27 @@
|
|
|
179
347
|
const init = async () => {
|
|
180
348
|
await tick();
|
|
181
349
|
if (disposed) return;
|
|
182
|
-
if (!
|
|
350
|
+
if (!await hasUsableWebGPU()) {
|
|
183
351
|
stageState = 'fallback';
|
|
184
352
|
showStatus = false;
|
|
185
353
|
return;
|
|
186
354
|
}
|
|
187
355
|
|
|
188
|
-
const { StageExperience } = await import('@spatial-elements/core/stage/StageExperience');
|
|
189
356
|
if (disposed) return;
|
|
357
|
+
const [{ StageExperience }, navigationModule] = await Promise.all([
|
|
358
|
+
import('@spatial-elements/core/stage/StageExperience'),
|
|
359
|
+
import('../catalog/stagedCatalogNavigation.js')
|
|
360
|
+
]);
|
|
361
|
+
startStagedCatalogNavigation = navigationModule.startStagedCatalogNavigation;
|
|
362
|
+
if (disposed) return;
|
|
363
|
+
virtualScroll?.start();
|
|
190
364
|
const panels = getPanelTargets();
|
|
191
365
|
const viewport = getViewportTarget();
|
|
192
366
|
const instance = new StageExperience(stage, {
|
|
367
|
+
detailMedia,
|
|
368
|
+
readLayoutMetrics: (mode) => layoutMetrics?.read(mode),
|
|
369
|
+
deviceOrientation,
|
|
370
|
+
renderSettings,
|
|
193
371
|
dracoDecoderPath,
|
|
194
372
|
catalog: Boolean(catalog),
|
|
195
373
|
heroIsPresented: () =>
|
|
@@ -199,7 +377,7 @@
|
|
|
199
377
|
spatialElementId: catalog.spatialElementId
|
|
200
378
|
}) !== 'dock',
|
|
201
379
|
background,
|
|
202
|
-
pageBackground,
|
|
380
|
+
pageBackground: resolvedPageBackground,
|
|
203
381
|
hdr,
|
|
204
382
|
glb,
|
|
205
383
|
lodPair,
|
|
@@ -208,10 +386,23 @@
|
|
|
208
386
|
interactionTheme,
|
|
209
387
|
panels,
|
|
210
388
|
viewport,
|
|
211
|
-
enableSpaceMouse:
|
|
389
|
+
enableSpaceMouse: spaceMouseEnabled,
|
|
390
|
+
onSpaceMouseStateChange: (state) => {
|
|
391
|
+
if (disposed) return;
|
|
392
|
+
if (state === 'connected') rememberSpaceMouseConnection();
|
|
393
|
+
if (state === 'permission-required' || state === 'unavailable') {
|
|
394
|
+
// A failed attempt must not keep reconnecting on every route change.
|
|
395
|
+
spaceMouseEnabled = false;
|
|
396
|
+
instance.setSpaceMouseEnabled(false);
|
|
397
|
+
}
|
|
398
|
+
spaceMouseState = state;
|
|
399
|
+
},
|
|
212
400
|
onDeviceLost: () => {
|
|
213
401
|
if (disposed || experience !== instance) return;
|
|
402
|
+
fullscreenController?.setFullscreen(false);
|
|
403
|
+
navigationFeedback?.end();
|
|
214
404
|
navigationGeneration += 1;
|
|
405
|
+
earlyTransition?.cancel('error');
|
|
215
406
|
transition?.cancel();
|
|
216
407
|
experience = null;
|
|
217
408
|
try {
|
|
@@ -220,6 +411,7 @@
|
|
|
220
411
|
setZoomFocusState(restingZoomFocus);
|
|
221
412
|
isEnhanced = false;
|
|
222
413
|
isFallback = true;
|
|
414
|
+
virtualScroll?.destroy();
|
|
223
415
|
stageState = 'fallback';
|
|
224
416
|
showStatus = false;
|
|
225
417
|
}
|
|
@@ -237,6 +429,9 @@
|
|
|
237
429
|
return;
|
|
238
430
|
}
|
|
239
431
|
|
|
432
|
+
// Paint the prepared scene before posters and fallback surfaces start fading.
|
|
433
|
+
instance.flushCatalogFrame();
|
|
434
|
+
isPageReady = true;
|
|
240
435
|
isEnhanced = true;
|
|
241
436
|
isFallback = false;
|
|
242
437
|
showStatus = false;
|
|
@@ -256,6 +451,7 @@
|
|
|
256
451
|
experience?.dispose();
|
|
257
452
|
experience = null;
|
|
258
453
|
status = error instanceof Error ? error.message : 'Unable to initialize WebGPU stage';
|
|
454
|
+
virtualScroll?.destroy();
|
|
259
455
|
isEnhanced = false;
|
|
260
456
|
isFallback = true;
|
|
261
457
|
stageState = 'fallback';
|
|
@@ -264,11 +460,20 @@
|
|
|
264
460
|
});
|
|
265
461
|
|
|
266
462
|
return () => {
|
|
463
|
+
window.clearTimeout(statusTimer);
|
|
464
|
+
layoutMetrics?.destroy();
|
|
465
|
+
layoutMetrics = undefined;
|
|
466
|
+
fullscreenController?.dispose();
|
|
467
|
+
fullscreenController = undefined;
|
|
267
468
|
virtualScroll?.destroy();
|
|
268
469
|
virtualScroll = undefined;
|
|
269
470
|
destroyed = true;
|
|
270
471
|
releasePageBinding?.();
|
|
271
472
|
navigationGeneration += 1;
|
|
473
|
+
navigationFeedback?.end();
|
|
474
|
+
earlyTransition?.cancel('destroyed');
|
|
475
|
+
interruptedPresentation?.cancel(); interruptedPresentation = undefined;
|
|
476
|
+
summaryTransfer?.cancel(); summaryTransfer = undefined;
|
|
272
477
|
transition?.dispose();
|
|
273
478
|
document.documentElement.classList.remove('stage-route');
|
|
274
479
|
document.body.classList.remove('stage-route');
|
|
@@ -282,6 +487,23 @@
|
|
|
282
487
|
};
|
|
283
488
|
});
|
|
284
489
|
|
|
490
|
+
$effect(() => { experience?.setDetailMedia(detailMedia); });
|
|
491
|
+
$effect(() => {
|
|
492
|
+
void resolvedPageBackground; void background; void isEnhanced;
|
|
493
|
+
Object.values(interactionTheme ?? {});
|
|
494
|
+
scheduleAppearanceUpdate();
|
|
495
|
+
});
|
|
496
|
+
let appearanceUpdatePending = false;
|
|
497
|
+
function scheduleAppearanceUpdate() {
|
|
498
|
+
if (appearanceUpdatePending) return;
|
|
499
|
+
appearanceUpdatePending = true;
|
|
500
|
+
void tick().then(() => {
|
|
501
|
+
appearanceUpdatePending = false;
|
|
502
|
+
if (!destroyed && isEnhanced) experience?.updateAppearance({
|
|
503
|
+
pageBackground: resolvedPageBackground, background, interactionTheme, panels: getPanelTargets()
|
|
504
|
+
});
|
|
505
|
+
});
|
|
506
|
+
}
|
|
285
507
|
$effect(() => {
|
|
286
508
|
const spatialElements = catalogSpatialElements;
|
|
287
509
|
if (experience && catalog && isEnhanced) {
|
|
@@ -292,52 +514,154 @@
|
|
|
292
514
|
function registerSpatialElements() {
|
|
293
515
|
if (!catalog || !experience) return;
|
|
294
516
|
for (const spatialElement of catalogSpatialElements) {
|
|
295
|
-
if (spatialElement
|
|
517
|
+
if (hasSpatialElementScene(spatialElement))
|
|
296
518
|
experience.spatialElements.setManifest(
|
|
297
|
-
createStageSpatialElementAssetManifest(
|
|
519
|
+
createStageSpatialElementAssetManifest(
|
|
520
|
+
catalog.brandId,
|
|
521
|
+
spatialElement.id,
|
|
522
|
+
getSpatialElementScene(spatialElement)
|
|
523
|
+
)
|
|
298
524
|
);
|
|
299
525
|
}
|
|
300
526
|
if (catalog.spatialElementId && catalog.spatialElementStage) {
|
|
301
527
|
experience.spatialElements.setManifest(
|
|
302
|
-
createStageSpatialElementAssetManifest(
|
|
528
|
+
createStageSpatialElementAssetManifest(
|
|
529
|
+
catalog.brandId,
|
|
530
|
+
catalog.spatialElementId,
|
|
531
|
+
catalog.spatialElementStage
|
|
532
|
+
)
|
|
303
533
|
);
|
|
304
534
|
}
|
|
305
535
|
}
|
|
306
536
|
|
|
307
537
|
function interruptNavigation() {
|
|
538
|
+
earlyTransition?.cancel('cancelled');
|
|
539
|
+
interruptedPresentation?.cancel(); interruptedPresentation = undefined;
|
|
540
|
+
navigationFeedback?.end();
|
|
308
541
|
navigationGeneration += 1;
|
|
309
542
|
reuseCatalogPage = false;
|
|
310
543
|
transition?.cancel();
|
|
311
544
|
if (pageBindingConsumed) releasePageBinding?.();
|
|
312
545
|
}
|
|
313
546
|
|
|
547
|
+
function interruptCommittedNavigation(reason: EarlyNavigationCancelReason) {
|
|
548
|
+
if (!earlyTransition) return false;
|
|
549
|
+
// The destination owns the route already. Release only the visual source;
|
|
550
|
+
// restoreNavigation must keep its generation and finish updatePage normally.
|
|
551
|
+
interruptedPresentation = earlyTransition.cancelCommitted(reason);
|
|
552
|
+
navigationFeedback?.end();
|
|
553
|
+
if (pageBindingConsumed) releasePageBinding?.();
|
|
554
|
+
return true;
|
|
555
|
+
}
|
|
556
|
+
|
|
314
557
|
function supersedeNavigation(destination: URL) {
|
|
558
|
+
if (earlyTransition?.destination !== destination.href) earlyTransition?.cancel('superseded');
|
|
559
|
+
interruptedPresentation?.cancel(); interruptedPresentation = undefined;
|
|
560
|
+
summaryTransfer?.cancel(); summaryTransfer = undefined;
|
|
561
|
+
navigationFeedback?.end();
|
|
315
562
|
navigationGeneration += 1;
|
|
316
563
|
transition?.supersede(destination);
|
|
317
564
|
if (pageBindingConsumed) releasePageBinding?.();
|
|
318
565
|
}
|
|
319
566
|
|
|
320
567
|
let navigationTimings = { dataReady: 0, captured: 0, restoring: 0, bound: 0 };
|
|
321
|
-
function
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
);
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
568
|
+
function startEarlyNavigation(navigation: BeforeNavigate) {
|
|
569
|
+
if (navigation.from) recordNavigationPage(navigation.from.url);
|
|
570
|
+
// The opt-in is temporary while production frame/ownership gates are verified.
|
|
571
|
+
if (visualTestController) stage.dataset.catalogStagedDecision = `gate:${isEnhanced}:${Boolean(experience)}:${Boolean(presentationHost)}`;
|
|
572
|
+
if (!new URL(location.href).searchParams.has('stagedNavigation') || !isEnhanced || !experience || !presentationHost) return;
|
|
573
|
+
const metrics = layoutMetrics?.read();
|
|
574
|
+
if (!metrics) return;
|
|
575
|
+
earlyTransition?.cancel('superseded');
|
|
576
|
+
const candidate = startStagedCatalogNavigation?.({ root: stage, navigation, endpoints: catalogEndpoints,
|
|
577
|
+
host: presentationHost, experience, metrics, items: catalogSpatialElements, diagnostics: Boolean(visualTestController),
|
|
578
|
+
onFinish() {
|
|
579
|
+
if (earlyTransition) lastEarlyTimings = earlyTransition.timings;
|
|
580
|
+
earlyTransition = undefined;
|
|
581
|
+
navigationFeedback?.end();
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
earlyTransition = candidate;
|
|
585
|
+
return candidate?.handle;
|
|
586
|
+
}
|
|
587
|
+
function captureNavigation(navigation: OnNavigate): undefined {
|
|
588
|
+
try {
|
|
589
|
+
if (navigation.from && !destroyed) recordNavigationPage(navigation.from.url);
|
|
590
|
+
navigationTimings = { dataReady: performance.now(), captured: 0, restoring: 0, bound: 0 };
|
|
591
|
+
const generation = ++navigationGeneration;
|
|
592
|
+
if (earlyTransition?.phase === 'held' && navigation.to?.url.href === earlyTransition.destination) {
|
|
593
|
+
earlyTransition.commit();
|
|
594
|
+
reuseCatalogPage = false;
|
|
595
|
+
navigationTimings.captured = performance.now();
|
|
596
|
+
experience?.releasePage();
|
|
597
|
+
setZoomFocusState(restingZoomFocus);
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
// Snapshot the still-mounted source synchronously. Waiting for feedback to
|
|
601
|
+
// paint here would hold Kit after its URL update but before its DOM commit.
|
|
602
|
+
// Feedback stays nonblocking; destination/GPU preparation follows commit.
|
|
603
|
+
if (destroyed || generation !== navigationGeneration) return;
|
|
604
|
+
summaryTransfer?.cancel();
|
|
605
|
+
summaryTransfer = navigation.from && navigation.to && presentationHost
|
|
606
|
+
? prepareCatalogSummaryTransfer({ from: navigation.from.url, to: navigation.to.url,
|
|
607
|
+
type: navigation.type, endpoints: catalogEndpoints, host: presentationHost }) : undefined;
|
|
608
|
+
reuseCatalogPage = Boolean(
|
|
609
|
+
navigation.from &&
|
|
610
|
+
navigation.to &&
|
|
611
|
+
transition?.capture(navigation.from.url, navigation.to.url, navigation.type)
|
|
612
|
+
);
|
|
613
|
+
navigationTimings.captured = performance.now();
|
|
614
|
+
if (reuseCatalogPage) {
|
|
615
|
+
summaryTransfer?.cancel(); summaryTransfer = undefined;
|
|
616
|
+
retainedPageSignature = pageSignature();
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
summaryTransfer?.hold();
|
|
620
|
+
experience?.releasePage();
|
|
621
|
+
setZoomFocusState(restingZoomFocus);
|
|
622
|
+
} finally {
|
|
623
|
+
if (!reuseCatalogPage) isPageReady = false;
|
|
624
|
+
// Leaving fullscreen refits the live camera and restores source DOM/scroll.
|
|
625
|
+
// Retain its visible pose and release page bindings before that mutation.
|
|
626
|
+
fullscreenController?.setFullscreen(false);
|
|
333
627
|
}
|
|
334
|
-
|
|
335
|
-
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
async function settleInterruptedPresentation(generation: number, rebind = false) {
|
|
631
|
+
const pending = interruptedPresentation;
|
|
632
|
+
if (!pending) return;
|
|
633
|
+
await pending.finished;
|
|
634
|
+
if (interruptedPresentation === pending) interruptedPresentation = undefined;
|
|
635
|
+
if (destroyed || generation !== navigationGeneration || !rebind) return;
|
|
636
|
+
experience?.updateAppearance({ pageBackground: resolvedPageBackground, background, interactionTheme, panels: getPanelTargets() });
|
|
637
|
+
window.dispatchEvent(new Event(STAGE_PANEL_LAYOUT_EVENT));
|
|
638
|
+
experience?.flushCatalogFrame();
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
function recordNavigationPage(url: URL) {
|
|
642
|
+
const current = catalog;
|
|
643
|
+
const items = catalogSpatialElements;
|
|
644
|
+
catalogEndpoints.navigation.record(url,
|
|
645
|
+
current?.spatialElementId ? { kind: 'detail', brandId: current.brandId, spatialElementId: current.spatialElementId } :
|
|
646
|
+
current && items.length ? { kind: 'content', brandId: current.brandId, elements: items.map(item => item.id) } : { kind: 'ordinary' },
|
|
647
|
+
current ? items.map(item => ({ brandId: current.brandId, spatialElementId: item.id, href: item.href })) : []);
|
|
336
648
|
}
|
|
337
649
|
|
|
338
650
|
async function restoreNavigation() {
|
|
339
651
|
navigationTimings.restoring = performance.now();
|
|
340
652
|
const generation = navigationGeneration;
|
|
653
|
+
await tick();
|
|
654
|
+
if (destroyed || generation !== navigationGeneration) return;
|
|
655
|
+
recordNavigationPage(new URL(location.href));
|
|
656
|
+
// Preserve the real Svelte instance before page binding measures the new
|
|
657
|
+
// summary. This also applies when GPU motion is disabled or declined.
|
|
658
|
+
const transferredSlot = summaryTransfer?.adopt(); summaryTransfer = undefined;
|
|
659
|
+
if (transferredSlot) {
|
|
660
|
+
await tick();
|
|
661
|
+
if (destroyed || generation !== navigationGeneration) return;
|
|
662
|
+
transferredSlot.dispatchEvent(new Event('spatial-summary-measure'));
|
|
663
|
+
await tick();
|
|
664
|
+
}
|
|
341
665
|
await initialized;
|
|
342
666
|
await tick();
|
|
343
667
|
if (destroyed || generation !== navigationGeneration || !experience) return;
|
|
@@ -348,6 +672,7 @@
|
|
|
348
672
|
await transition?.play();
|
|
349
673
|
return;
|
|
350
674
|
}
|
|
675
|
+
isPageReady = false;
|
|
351
676
|
transition?.cancel();
|
|
352
677
|
}
|
|
353
678
|
if (nextPageBinding) {
|
|
@@ -357,11 +682,14 @@
|
|
|
357
682
|
await pending;
|
|
358
683
|
if (destroyed || generation !== navigationGeneration) return;
|
|
359
684
|
}
|
|
685
|
+
if (interruptedPresentation) await settleInterruptedPresentation(generation);
|
|
686
|
+
if (destroyed || generation !== navigationGeneration) return;
|
|
360
687
|
registerSpatialElements();
|
|
361
688
|
const catalogReady = catalog
|
|
362
689
|
? experience.setCatalogSpatialElements(catalog.brandId, catalogSpatialElements)
|
|
363
690
|
: undefined;
|
|
364
691
|
await experience.updatePage({
|
|
692
|
+
renderSettings,
|
|
365
693
|
catalog: Boolean(catalog),
|
|
366
694
|
heroIsPresented: () =>
|
|
367
695
|
!catalog?.spatialElementId ||
|
|
@@ -377,7 +705,7 @@
|
|
|
377
705
|
}) === 'dock'
|
|
378
706
|
),
|
|
379
707
|
background,
|
|
380
|
-
pageBackground,
|
|
708
|
+
pageBackground: resolvedPageBackground,
|
|
381
709
|
hdr,
|
|
382
710
|
glb,
|
|
383
711
|
lodPair,
|
|
@@ -388,6 +716,8 @@
|
|
|
388
716
|
viewport: getViewportTarget()
|
|
389
717
|
});
|
|
390
718
|
if (destroyed || generation !== navigationGeneration) return;
|
|
719
|
+
if (interruptedPresentation) await settleInterruptedPresentation(generation, true);
|
|
720
|
+
if (destroyed || generation !== navigationGeneration) return;
|
|
391
721
|
if (experience.getSpatialCapture()) {
|
|
392
722
|
await Promise.race([
|
|
393
723
|
catalogReady,
|
|
@@ -395,14 +725,22 @@
|
|
|
395
725
|
]);
|
|
396
726
|
if (destroyed || generation !== navigationGeneration) return;
|
|
397
727
|
}
|
|
728
|
+
isPageReady = true;
|
|
398
729
|
isEnhanced = true;
|
|
399
730
|
isFallback = false;
|
|
400
731
|
stageState = 'enhanced';
|
|
401
732
|
navigationTimings.bound = performance.now();
|
|
402
|
-
|
|
733
|
+
if (earlyTransition?.phase === 'held') {
|
|
734
|
+
await earlyTransition.reveal(() => experience?.updateAppearance({
|
|
735
|
+
pageBackground: resolvedPageBackground, background, interactionTheme, panels: getPanelTargets()
|
|
736
|
+
}));
|
|
737
|
+
} else await transition?.play();
|
|
738
|
+
if (interruptedPresentation) await settleInterruptedPresentation(generation, true);
|
|
403
739
|
} catch (error) {
|
|
404
740
|
if (destroyed || generation !== navigationGeneration) return;
|
|
741
|
+
interruptedPresentation?.cancel(); interruptedPresentation = undefined;
|
|
405
742
|
transition?.cancel();
|
|
743
|
+
earlyTransition?.cancel('error');
|
|
406
744
|
try {
|
|
407
745
|
experience.discardFailedPage();
|
|
408
746
|
} catch (cleanupError) {
|
|
@@ -414,6 +752,8 @@
|
|
|
414
752
|
isEnhanced = false;
|
|
415
753
|
isFallback = true;
|
|
416
754
|
stageState = 'fallback';
|
|
755
|
+
} finally {
|
|
756
|
+
if (generation === navigationGeneration) navigationFeedback?.end();
|
|
417
757
|
}
|
|
418
758
|
}
|
|
419
759
|
|
|
@@ -440,9 +780,9 @@
|
|
|
440
780
|
await Promise.resolve();
|
|
441
781
|
};
|
|
442
782
|
|
|
443
|
-
const setView = async (view: StageVisualTestView) => {
|
|
783
|
+
const setView = async (view: StageVisualTestView, frames = 18) => {
|
|
444
784
|
experience?.setVisualTestView(view);
|
|
445
|
-
await settle(
|
|
785
|
+
await settle(frames);
|
|
446
786
|
};
|
|
447
787
|
const setSpaceMouseZoom = async (zoom: number) => {
|
|
448
788
|
experience?.setVisualTestSpaceMouseZoom(zoom);
|
|
@@ -461,11 +801,13 @@
|
|
|
461
801
|
loseDevice: () => experience?.loseDeviceForTest(),
|
|
462
802
|
getCarouselStats: () => experience?.getCarouselStats() ?? null,
|
|
463
803
|
getCatalogStats: () => experience?.assets.getStats() ?? null,
|
|
804
|
+
getRenderActivity: () => experience?.getVisualTestRenderActivity() ?? null,
|
|
464
805
|
getCatalogEndpoints: () => catalogEndpoints.getSnapshot(),
|
|
465
806
|
getCatalogOwnership: () => transition?.getOwnership() ?? null,
|
|
466
|
-
getNavigationTimings: () => ({ ...navigationTimings }),
|
|
807
|
+
getNavigationTimings: () => ({ ...navigationTimings, early: earlyTransition?.timings ?? lastEarlyTimings }),
|
|
467
808
|
captureHeroPresentation: () => experience?.captureHeroPresentation() ?? false,
|
|
468
809
|
getSpatialCapture: () => experience?.getSpatialCapture() ?? null,
|
|
810
|
+
getDetailProjection: kind => experience?.getVisualTestDetailProjection(kind) ?? null,
|
|
469
811
|
releaseSpatialCapture: () => experience?.releaseSpatialCapture(),
|
|
470
812
|
registerCatalogEndpoint: (address, element) => catalogEndpoints.register(address, element),
|
|
471
813
|
getCatalogPresentation: () => experience?.getCatalogPresentation() ?? null,
|
|
@@ -487,8 +829,10 @@
|
|
|
487
829
|
driveSpaceMouseZoom,
|
|
488
830
|
stopSpaceMouse,
|
|
489
831
|
getMinimapRect: () => experience?.getVisualTestMinimapRect() ?? null,
|
|
832
|
+
getPanelRect: (frame) => experience?.getVisualTestPanelRect(frame) ?? null,
|
|
490
833
|
getModelRect: () => experience?.getVisualTestModelRect() ?? null,
|
|
491
834
|
getMinimapModelRect: () => experience?.getVisualTestMinimapModelRect() ?? null,
|
|
835
|
+
getMinimapViewportRect: () => experience?.getVisualTestMinimapViewportRect() ?? null,
|
|
492
836
|
getMinimapOrientation: () => experience?.getVisualTestMinimapOrientation() ?? null,
|
|
493
837
|
getMinimapRenderStats: () =>
|
|
494
838
|
experience?.getVisualTestMinimapRenderStats() ?? {
|
|
@@ -499,12 +843,20 @@
|
|
|
499
843
|
},
|
|
500
844
|
getRenderTargetStats: () =>
|
|
501
845
|
experience?.getVisualTestRenderTargetStats() ?? {
|
|
846
|
+
pixelRatio: 0,
|
|
847
|
+
renderSettings: resolveStageRenderSettings(renderSettings),
|
|
502
848
|
liveTargets: 0,
|
|
503
849
|
targets: [],
|
|
504
850
|
canvases: [],
|
|
505
851
|
creations: 0,
|
|
506
852
|
resizes: 0,
|
|
507
853
|
warmups: 0,
|
|
854
|
+
inactiveScrollWarmups: 0,
|
|
855
|
+
backgroundOutput: {
|
|
856
|
+
requested: false, initialized: false, mode: 'legacy', held: false,
|
|
857
|
+
targetTextureId: null, implicitBackgroundTarget: null,
|
|
858
|
+
catalogProfile: null, catalogProfileCurrent: false
|
|
859
|
+
},
|
|
508
860
|
activeScale: 0
|
|
509
861
|
},
|
|
510
862
|
getVisibilityStats: () =>
|
|
@@ -547,12 +899,19 @@
|
|
|
547
899
|
getMinimapDockProgress: panel.getMinimapDockProgress,
|
|
548
900
|
getMinimapModelScale: panel.getMinimapModelScale,
|
|
549
901
|
getMinimapModelTop: panel.getMinimapModelTop,
|
|
902
|
+
getMinimapModelLeft: panel.getMinimapModelLeft,
|
|
550
903
|
getSurfaceOpacity: panel.getSurfaceOpacity,
|
|
904
|
+
getVisible: panel.getVisible,
|
|
905
|
+
getMinimapSelected: panel.getMinimapSelected,
|
|
906
|
+
getFocusAnchor: panel.getFocusAnchor,
|
|
907
|
+
updateNativeLayout: panel.updateNativeLayout,
|
|
908
|
+
nativeContent: panel.getNativeContent?.() ?? false,
|
|
551
909
|
minimap: panel.getMinimapOptions(),
|
|
552
910
|
options: panel.getOptions(),
|
|
553
911
|
surface: panel.getSurface(),
|
|
554
912
|
surfaceElement,
|
|
555
|
-
pointerReactive: panel.getPointerReactive()
|
|
913
|
+
pointerReactive: panel.getPointerReactive(),
|
|
914
|
+
focusReactive: panel.getFocusReactive?.() ?? true
|
|
556
915
|
});
|
|
557
916
|
});
|
|
558
917
|
|
|
@@ -563,21 +922,25 @@
|
|
|
563
922
|
{#if catalog}
|
|
564
923
|
<ScrollNavigationBridge
|
|
565
924
|
controller={virtualScroll}
|
|
925
|
+
onEarlyStart={startEarlyNavigation}
|
|
926
|
+
onStart={() => { if (isEnhanced) navigationFeedback?.begin(); }}
|
|
566
927
|
onCapture={captureNavigation}
|
|
567
928
|
onSupersede={supersedeNavigation}
|
|
568
929
|
onInterrupt={interruptNavigation}
|
|
930
|
+
onInterruptCommitted={interruptCommittedNavigation}
|
|
569
931
|
onRestored={restoreNavigation}
|
|
570
932
|
/>
|
|
571
933
|
{/if}
|
|
572
934
|
|
|
573
935
|
<div
|
|
574
936
|
bind:this={stage}
|
|
575
|
-
style:--stage-page-background={
|
|
937
|
+
style:--stage-page-background={resolvedPageBackground}
|
|
576
938
|
class="stage"
|
|
577
939
|
class:stage-enhanced={isEnhanced}
|
|
578
940
|
class:stage-fallback={isFallback}
|
|
579
941
|
style:--stage-dom-opacity={domLayerOpacity}
|
|
580
942
|
data-stage-state={stageState}
|
|
943
|
+
data-stage-page-ready={isEnhanced && isPageReady ? '' : undefined}
|
|
581
944
|
data-stage-focus={zoomFocusState.focus.toFixed(3)}
|
|
582
945
|
data-stage-ui-focus={zoomFocusState.uiFocus.toFixed(3)}
|
|
583
946
|
data-stage-minimap-focus={zoomFocusState.minimapFocus.toFixed(3)}
|
|
@@ -586,7 +949,7 @@
|
|
|
586
949
|
>
|
|
587
950
|
<div bind:this={virtualScrollSpacer} class="stage-virtual-scroll-spacer" aria-hidden="true"></div>
|
|
588
951
|
|
|
589
|
-
<div class="stage-virtual-viewport">
|
|
952
|
+
<div class="stage-virtual-viewport" inert={fullscreen}>
|
|
590
953
|
<div
|
|
591
954
|
bind:this={domLayer}
|
|
592
955
|
class="stage-dom-layer"
|
|
@@ -603,6 +966,10 @@
|
|
|
603
966
|
</div>
|
|
604
967
|
|
|
605
968
|
<style>
|
|
969
|
+
/* Apply the same document metrics before hydration; the class remains useful
|
|
970
|
+
* to hosts that do not support :has(). */
|
|
971
|
+
:global(html:has(.stage)),
|
|
972
|
+
:global(body:has(.stage)),
|
|
606
973
|
:global(html.stage-route),
|
|
607
974
|
:global(body.stage-route) {
|
|
608
975
|
margin: 0;
|
|
@@ -611,6 +978,7 @@
|
|
|
611
978
|
background: #ffffff;
|
|
612
979
|
}
|
|
613
980
|
|
|
981
|
+
:global(body:has(.stage)),
|
|
614
982
|
:global(body.stage-route) {
|
|
615
983
|
overflow-x: hidden;
|
|
616
984
|
}
|
|
@@ -623,6 +991,19 @@
|
|
|
623
991
|
background: var(--stage-page-background, #ffffff);
|
|
624
992
|
}
|
|
625
993
|
|
|
994
|
+
.stage:global([data-stage-fullscreen]) {
|
|
995
|
+
z-index: 2147483000;
|
|
996
|
+
isolation: isolate;
|
|
997
|
+
}
|
|
998
|
+
.stage:global([data-stage-fullscreen]) .stage-virtual-viewport {
|
|
999
|
+
visibility: hidden;
|
|
1000
|
+
pointer-events: none;
|
|
1001
|
+
}
|
|
1002
|
+
.stage:global([data-stage-fullscreen]) .stage-virtual-viewport :global(*) {
|
|
1003
|
+
visibility: hidden !important;
|
|
1004
|
+
pointer-events: none !important;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
626
1007
|
.stage-virtual-scroll-spacer {
|
|
627
1008
|
display: none;
|
|
628
1009
|
width: 1px;
|
|
@@ -632,7 +1013,7 @@
|
|
|
632
1013
|
|
|
633
1014
|
.stage-virtual-viewport {
|
|
634
1015
|
position: relative;
|
|
635
|
-
z-index:
|
|
1016
|
+
z-index: 3;
|
|
636
1017
|
}
|
|
637
1018
|
|
|
638
1019
|
.stage:global(.stage-virtual-scroll-active) .stage-virtual-scroll-spacer {
|
|
@@ -663,10 +1044,23 @@
|
|
|
663
1044
|
}
|
|
664
1045
|
|
|
665
1046
|
.stage :global(.stage-webgpu-carousel-rear) {
|
|
666
|
-
z-index:
|
|
1047
|
+
z-index: 2;
|
|
667
1048
|
pointer-events: none;
|
|
668
1049
|
}
|
|
669
1050
|
|
|
1051
|
+
.stage :global(.stage-webgpu-background),
|
|
1052
|
+
.stage :global(.stage-webgpu-carousel-rear),
|
|
1053
|
+
.stage :global(.stage-webgpu-foreground) {
|
|
1054
|
+
opacity: 0;
|
|
1055
|
+
transition: opacity 240ms ease;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
.stage.stage-enhanced :global(.stage-webgpu-background),
|
|
1059
|
+
.stage.stage-enhanced :global(.stage-webgpu-carousel-rear),
|
|
1060
|
+
.stage.stage-enhanced :global(.stage-webgpu-foreground) {
|
|
1061
|
+
opacity: 1;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
670
1064
|
.stage :global(.stage-webgpu-foreground) {
|
|
671
1065
|
/* Keep rendered minimaps above the fixed element header (z-index 20). */
|
|
672
1066
|
z-index: 21;
|
|
@@ -675,13 +1069,26 @@
|
|
|
675
1069
|
|
|
676
1070
|
.stage :global(.stage-css3d),
|
|
677
1071
|
.stage :global(.stage-css3d-flat) {
|
|
678
|
-
z-index:
|
|
1072
|
+
z-index: 5;
|
|
679
1073
|
}
|
|
680
1074
|
|
|
681
1075
|
.stage :global(.stage-panel-native) {
|
|
682
|
-
z-index:
|
|
1076
|
+
z-index: 4;
|
|
683
1077
|
}
|
|
684
1078
|
|
|
1079
|
+
/* Carousel surfaces must be below the rear canvas while live summaries stay above it. */
|
|
1080
|
+
.stage :global(.stage-carousel-surface) {
|
|
1081
|
+
position: fixed;
|
|
1082
|
+
left: 0;
|
|
1083
|
+
top: 0;
|
|
1084
|
+
z-index: 1;
|
|
1085
|
+
pointer-events: none;
|
|
1086
|
+
visibility: hidden;
|
|
1087
|
+
}
|
|
1088
|
+
.stage.stage-enhanced :global(.stage-carousel-surface) { visibility: visible; }
|
|
1089
|
+
.stage.stage-enhanced :global([data-carousel-surface-projected]) { visibility: hidden; }
|
|
1090
|
+
.stage:global([data-stage-fullscreen]) :global(.stage-carousel-surface) { visibility: hidden; }
|
|
1091
|
+
|
|
685
1092
|
.stage-dom-layer {
|
|
686
1093
|
position: relative;
|
|
687
1094
|
z-index: 1;
|
|
@@ -715,12 +1122,17 @@
|
|
|
715
1122
|
pointer-events: none !important;
|
|
716
1123
|
}
|
|
717
1124
|
|
|
718
|
-
:global(.stage.stage-enhanced [data-stage-panel-fallback][data-stage-panel-bound]) {
|
|
1125
|
+
:global(.stage.stage-enhanced [data-stage-panel-fallback][data-stage-panel-bound]:not([data-stage-panel-native-content])) {
|
|
719
1126
|
visibility: hidden !important;
|
|
720
1127
|
opacity: 0 !important;
|
|
721
1128
|
pointer-events: none !important;
|
|
722
1129
|
}
|
|
723
1130
|
|
|
1131
|
+
:global(.stage.stage-enhanced [data-stage-panel-native-content][data-stage-panel-bound][data-stage-panel-surface='glass'] > .stage-panel-surface::before),
|
|
1132
|
+
:global(.stage.stage-enhanced [data-stage-panel-native-content][data-stage-panel-bound][data-stage-panel-surface='glass'] > .stage-panel-surface::after) {
|
|
1133
|
+
display: none;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
724
1136
|
/* A failed binding may leave pixels in either canvas; the poster owns fallback paint. */
|
|
725
1137
|
.stage.stage-fallback :global(.stage-webgpu-background),
|
|
726
1138
|
.stage.stage-fallback :global(.stage-webgpu-carousel-rear),
|
|
@@ -744,4 +1156,12 @@
|
|
|
744
1156
|
13px/1.35 system-ui,
|
|
745
1157
|
sans-serif;
|
|
746
1158
|
}
|
|
1159
|
+
|
|
1160
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1161
|
+
.stage :global(.stage-webgpu-background),
|
|
1162
|
+
.stage :global(.stage-webgpu-carousel-rear),
|
|
1163
|
+
.stage :global(.stage-webgpu-foreground) {
|
|
1164
|
+
transition: none;
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
747
1167
|
</style>
|