@spatial-elements/sveltekit 1.0.0-beta.6 → 1.0.0-beta.8
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/catalog/ScrollNavigationBridge.svelte +170 -45
- package/dist/catalog/ScrollNavigationBridge.svelte.d.ts +9 -2
- package/dist/catalog/catalogSummaryTransfer.d.ts +16 -0
- package/dist/catalog/catalogSummaryTransfer.js +79 -0
- package/dist/catalog/catalogTransition.css +46 -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 +1 -0
- package/dist/index.js +1 -0
- package/dist/spatial-element/BrandStageShell.svelte +20 -2
- package/dist/spatial-element/BrandStageShell.svelte.d.ts +10 -0
- package/dist/spatial-element/CarouselSection.svelte +40 -21
- package/dist/spatial-element/CarouselSpatialElement.svelte +49 -115
- package/dist/spatial-element/ContentBlock.svelte +53 -0
- package/dist/spatial-element/ContentBlock.svelte.d.ts +11 -0
- package/dist/spatial-element/ContentGrid.svelte +28 -0
- package/dist/spatial-element/ContentGrid.svelte.d.ts +10 -0
- package/dist/spatial-element/ContentPage.svelte +28 -20
- package/dist/spatial-element/ContentPage.svelte.d.ts +3 -0
- package/dist/spatial-element/ListSection.svelte +17 -5
- package/dist/spatial-element/ListSection.svelte.d.ts +5 -0
- package/dist/spatial-element/PointerHint.svelte +3 -1
- package/dist/spatial-element/Section.svelte +51 -40
- package/dist/spatial-element/Section.svelte.d.ts +1 -0
- package/dist/spatial-element/SectionSurfaceGroup.svelte +34 -0
- package/dist/spatial-element/SectionSurfaceGroup.svelte.d.ts +7 -0
- package/dist/spatial-element/SpatialCardPresentation.svelte +378 -0
- package/dist/spatial-element/SpatialCardPresentation.svelte.d.ts +13 -0
- package/dist/spatial-element/SpatialCardSlot.svelte +33 -0
- package/dist/spatial-element/SpatialCardSlot.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +20 -12
- package/dist/spatial-element/SpatialElementBreadcrumbs.svelte.d.ts +1 -0
- package/dist/spatial-element/SpatialElementCard.svelte +19 -318
- package/dist/spatial-element/SpatialElementCard.svelte.d.ts +3 -0
- package/dist/spatial-element/SpatialElementHelp.svelte +21 -15
- package/dist/spatial-element/SpatialElementHelp.svelte.d.ts +4 -1
- package/dist/spatial-element/SpatialElementMediaRail.svelte +75 -21
- package/dist/spatial-element/SpatialElementMediaRail.svelte.d.ts +3 -0
- package/dist/spatial-element/SpatialElementNativeMedia.svelte +36 -0
- package/dist/spatial-element/SpatialElementNativeMedia.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialElementPage.svelte +127 -68
- package/dist/spatial-element/SpatialElementPage.svelte.d.ts +1 -0
- package/dist/spatial-element/SpatialElementStickyHeader.svelte +36 -69
- package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +1 -0
- package/dist/spatial-element/SpatialElementSummaryContent.svelte +14 -11
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte +29 -20
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte.d.ts +1 -0
- package/dist/spatial-element/SpatialElementTabList.svelte +19 -3
- package/dist/spatial-element/SpatialElementTabs.svelte +56 -16
- package/dist/spatial-element/SpatialElementTabs.svelte.d.ts +1 -0
- package/dist/spatial-element/SpatialElementViewToggle.svelte +5 -4
- package/dist/spatial-element/SpatialIconButton.svelte +4 -2
- package/dist/spatial-element/SpatialNavigationShell.svelte +129 -0
- package/dist/spatial-element/SpatialNavigationShell.svelte.d.ts +10 -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 +78 -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/cardAppearanceFreeze.d.ts +5 -0
- package/dist/spatial-element/cardAppearanceFreeze.js +72 -0
- package/dist/spatial-element/index.d.ts +6 -2
- package/dist/spatial-element/index.js +3 -1
- package/dist/spatial-element/layout.generated.css +455 -0
- package/dist/spatial-element/presentationBoxFreeze.d.ts +8 -0
- package/dist/spatial-element/presentationBoxFreeze.js +35 -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 +37 -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.js +10 -4
- package/dist/stage/ButtonGroup.svelte +1 -1
- package/dist/stage/Panel.svelte +16 -4
- package/dist/stage/Stage.svelte +183 -26
- package/dist/stage/Stage.svelte.d.ts +1 -0
- package/package.json +2 -2
package/dist/stage/Stage.svelte
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import type { SpatialElementLodPair } from '@spatial-elements/core/catalog/spatialElementLodPair';
|
|
3
3
|
import { DEFAULT_BACKGROUND } from '@spatial-elements/core/stage/stageConstants';
|
|
4
4
|
import { onMount, setContext, tick } from 'svelte';
|
|
5
|
+
import { ResponsiveViewportMetrics } from '@spatial-elements/core/spatial-element/ResponsiveViewportMetrics';
|
|
6
|
+
import { SPATIAL_PRESENTATION_OWNER, type SpatialPresentationOwner } from '../spatial-element/spatialPresentationOwner.js';
|
|
7
|
+
import type { SpatialSummaryHostController } from '../spatial-element/spatialSummaryHost.svelte.js';
|
|
5
8
|
import type { Snippet } from 'svelte';
|
|
6
9
|
import type {
|
|
7
10
|
BackgroundSettings,
|
|
@@ -23,6 +26,10 @@
|
|
|
23
26
|
import { VirtualScrollController } from '@spatial-elements/core/stage/VirtualScrollController';
|
|
24
27
|
import { StageFullscreenController } from '@spatial-elements/core/stage/StageFullscreenController';
|
|
25
28
|
import ScrollNavigationBridge from '../catalog/ScrollNavigationBridge.svelte';
|
|
29
|
+
import { startStagedCatalogNavigation, type InterruptedCatalogPresentation } from '../catalog/stagedCatalogNavigation.js';
|
|
30
|
+
import { prepareCatalogSummaryTransfer } from '../catalog/catalogSummaryTransfer.js';
|
|
31
|
+
import type { EarlyNavigationCancelReason } from '@spatial-elements/core/catalog/EarlyNavigationCoordinator';
|
|
32
|
+
import { NavigationFeedback } from '@spatial-elements/core/catalog/NavigationFeedback';
|
|
26
33
|
import { CatalogTransition } from '@spatial-elements/core/catalog/CatalogTransition';
|
|
27
34
|
import {
|
|
28
35
|
CATALOG_ENDPOINTS,
|
|
@@ -35,7 +42,7 @@
|
|
|
35
42
|
CATALOG_SECTIONS,
|
|
36
43
|
CatalogSections
|
|
37
44
|
} from '@spatial-elements/core/catalog/CatalogSections';
|
|
38
|
-
import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
|
|
45
|
+
import type { SpatialListItem, SpatialElementMediaItem } from '@spatial-elements/core/spatial-element/types';
|
|
39
46
|
import type { CatalogPage } from '@spatial-elements/core/catalog/catalogPage';
|
|
40
47
|
import {
|
|
41
48
|
SpatialPageRegistry,
|
|
@@ -46,15 +53,17 @@
|
|
|
46
53
|
hasSpatialElementScene
|
|
47
54
|
} from '@spatial-elements/core/spatial-element/spatialElementScene';
|
|
48
55
|
import { SPATIAL_PAGE } from '../spatial-element/spatialPageContext.js';
|
|
49
|
-
import type { OnNavigate } from '@sveltejs/kit';
|
|
56
|
+
import type { BeforeNavigate, OnNavigate } from '@sveltejs/kit';
|
|
50
57
|
import {
|
|
51
58
|
STAGE_CONTEXT_KEY,
|
|
59
|
+
STAGE_PANEL_LAYOUT_EVENT,
|
|
52
60
|
type StageContext,
|
|
53
61
|
type StagePanelRegistration,
|
|
54
62
|
type StageViewportRegistration
|
|
55
63
|
} from '@spatial-elements/core/stage/panelContext';
|
|
56
64
|
|
|
57
65
|
interface Props {
|
|
66
|
+
deviceOrientation?: boolean;
|
|
58
67
|
/** Namespace for automatic ContentPage/SpatialElementPage registration. Supplied by BrandStageShell. */
|
|
59
68
|
brandId?: string;
|
|
60
69
|
renderSettings?: StageRenderSettings;
|
|
@@ -76,6 +85,7 @@
|
|
|
76
85
|
}
|
|
77
86
|
|
|
78
87
|
let {
|
|
88
|
+
deviceOrientation = false,
|
|
79
89
|
brandId,
|
|
80
90
|
ariaLabel = 'WebGPU 3D stage',
|
|
81
91
|
renderSettings,
|
|
@@ -101,6 +111,7 @@
|
|
|
101
111
|
})
|
|
102
112
|
);
|
|
103
113
|
const activePage = $derived(readPage?.());
|
|
114
|
+
const resolvedPageBackground = $derived(activePage?.kind === 'content' ? activePage.background ?? pageBackground : pageBackground);
|
|
104
115
|
const activeElement = $derived(activePage?.kind === 'detail' ? activePage.element : undefined);
|
|
105
116
|
const activeScene = $derived(activeElement ? getSpatialElementScene(activeElement) : undefined);
|
|
106
117
|
const catalog = $derived<CatalogPage | undefined>(
|
|
@@ -145,6 +156,17 @@
|
|
|
145
156
|
let domLayerHidden = $state(false);
|
|
146
157
|
let domLayerOpacity = $state(1);
|
|
147
158
|
let experience = $state<StageExperience | null>(null);
|
|
159
|
+
let layoutMetrics: ResponsiveViewportMetrics | undefined;
|
|
160
|
+
let presentationHost: SpatialSummaryHostController | undefined;
|
|
161
|
+
setContext<SpatialPresentationOwner>(SPATIAL_PRESENTATION_OWNER, {
|
|
162
|
+
register(host) {
|
|
163
|
+
presentationHost = host;
|
|
164
|
+
return () => { if (presentationHost === host) presentationHost = undefined; };
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
let readDetailMedia = $state.raw<(() => SpatialElementMediaItem['kind']) | undefined>();
|
|
168
|
+
let detailMediaOwner: symbol | undefined;
|
|
169
|
+
const detailMedia = $derived(readDetailMedia?.() ?? 'minimap');
|
|
148
170
|
let stageState = $state<'loading' | 'enhanced' | 'fallback'>('loading');
|
|
149
171
|
let zoomFocusState = $state<StageZoomFocusState>({
|
|
150
172
|
focus: 0,
|
|
@@ -155,8 +177,13 @@
|
|
|
155
177
|
let visualTestController: StageVisualTestController | undefined;
|
|
156
178
|
let virtualScroll = $state<VirtualScrollController>();
|
|
157
179
|
let transition: CatalogTransition | undefined;
|
|
180
|
+
let earlyTransition: ReturnType<typeof startStagedCatalogNavigation>;
|
|
181
|
+
let interruptedPresentation: InterruptedCatalogPresentation | undefined;
|
|
182
|
+
let summaryTransfer: ReturnType<typeof prepareCatalogSummaryTransfer>;
|
|
183
|
+
let lastEarlyTimings: NonNullable<typeof earlyTransition>['timings'] | undefined;
|
|
158
184
|
let initialized: Promise<void> | undefined;
|
|
159
185
|
let navigationGeneration = 0;
|
|
186
|
+
let navigationFeedback: NavigationFeedback | undefined;
|
|
160
187
|
let destroyed = false;
|
|
161
188
|
let nextPageBinding: Promise<void> | undefined;
|
|
162
189
|
let releasePageBinding: (() => void) | undefined;
|
|
@@ -166,7 +193,7 @@
|
|
|
166
193
|
const pageSignature = () =>
|
|
167
194
|
JSON.stringify([
|
|
168
195
|
renderSettings,
|
|
169
|
-
|
|
196
|
+
resolvedPageBackground,
|
|
170
197
|
background,
|
|
171
198
|
hdr,
|
|
172
199
|
glb,
|
|
@@ -183,6 +210,11 @@
|
|
|
183
210
|
};
|
|
184
211
|
|
|
185
212
|
setContext<StageContext>(STAGE_CONTEXT_KEY, {
|
|
213
|
+
registerDetailMedia(read) {
|
|
214
|
+
const owner = Symbol(); detailMediaOwner = owner; readDetailMedia = read;
|
|
215
|
+
return () => { if (detailMediaOwner === owner) { detailMediaOwner = undefined; readDetailMedia = undefined; } };
|
|
216
|
+
},
|
|
217
|
+
getLayoutMetrics: (mode) => layoutMetrics?.read(mode),
|
|
186
218
|
isEnhanced: () => isEnhanced,
|
|
187
219
|
updatePanelAppearance: scheduleAppearanceUpdate,
|
|
188
220
|
prefetchSpatialElement: (config) => experience?.prefetchSpatialElement(config),
|
|
@@ -206,10 +238,13 @@
|
|
|
206
238
|
},
|
|
207
239
|
isFullscreen: () => fullscreen,
|
|
208
240
|
getZoomFocus: () => zoomFocusState.focus,
|
|
241
|
+
getZoomUiFocus: () => zoomFocusState.uiFocus,
|
|
209
242
|
setFullscreen: (active) => fullscreenController?.setFullscreen(active)
|
|
210
243
|
});
|
|
211
244
|
|
|
212
245
|
onMount(() => {
|
|
246
|
+
layoutMetrics = new ResponsiveViewportMetrics(stage);
|
|
247
|
+
layoutMetrics.start();
|
|
213
248
|
// The semantic page is already usable. Only announce unusually slow enhancement.
|
|
214
249
|
const statusTimer = window.setTimeout(() => {
|
|
215
250
|
if (stageState === 'loading') showStatus = true;
|
|
@@ -223,7 +258,9 @@
|
|
|
223
258
|
virtualScroll = new VirtualScrollController(stage, domLayer, virtualScrollSpacer);
|
|
224
259
|
// Native fallback pages keep native document scrolling and browser anchor behavior.
|
|
225
260
|
if (navigator.gpu) virtualScroll.start();
|
|
261
|
+
navigationFeedback = new NavigationFeedback(stage);
|
|
226
262
|
transition = new CatalogTransition(stage, catalogEndpoints, {
|
|
263
|
+
diagnose: reason => { if (visualTestController) stage.dataset.catalogTransitionDecision = reason; },
|
|
227
264
|
captureContentGeometry: (endpoint, secondary) =>
|
|
228
265
|
experience?.captureContentGeometry(endpoint.spatialElementId, secondary) ?? false,
|
|
229
266
|
prepareContentParticipants: (pairs) => experience?.prepareContentParticipants(pairs),
|
|
@@ -237,7 +274,10 @@
|
|
|
237
274
|
prepareDestination: (destination) =>
|
|
238
275
|
experience?.prepareGeometryDestination(destination) ?? false,
|
|
239
276
|
setGeometryProgress: (progress) => experience?.setCatalogGeometryProgress(progress),
|
|
240
|
-
flushFrame: () =>
|
|
277
|
+
flushFrame: () => {
|
|
278
|
+
if (stage.dataset.catalogTransition === 'animating') navigationFeedback?.end();
|
|
279
|
+
experience?.flushCatalogFrame();
|
|
280
|
+
},
|
|
241
281
|
finishGeometry: () => {
|
|
242
282
|
try {
|
|
243
283
|
experience?.finishCatalogGeometry();
|
|
@@ -268,6 +308,9 @@
|
|
|
268
308
|
const panels = getPanelTargets();
|
|
269
309
|
const viewport = getViewportTarget();
|
|
270
310
|
const instance = new StageExperience(stage, {
|
|
311
|
+
detailMedia,
|
|
312
|
+
readLayoutMetrics: (mode) => layoutMetrics?.read(mode),
|
|
313
|
+
deviceOrientation,
|
|
271
314
|
renderSettings,
|
|
272
315
|
dracoDecoderPath,
|
|
273
316
|
catalog: Boolean(catalog),
|
|
@@ -278,7 +321,7 @@
|
|
|
278
321
|
spatialElementId: catalog.spatialElementId
|
|
279
322
|
}) !== 'dock',
|
|
280
323
|
background,
|
|
281
|
-
pageBackground,
|
|
324
|
+
pageBackground: resolvedPageBackground,
|
|
282
325
|
hdr,
|
|
283
326
|
glb,
|
|
284
327
|
lodPair,
|
|
@@ -291,7 +334,9 @@
|
|
|
291
334
|
onDeviceLost: () => {
|
|
292
335
|
if (disposed || experience !== instance) return;
|
|
293
336
|
fullscreenController?.setFullscreen(false);
|
|
337
|
+
navigationFeedback?.end();
|
|
294
338
|
navigationGeneration += 1;
|
|
339
|
+
earlyTransition?.cancel('error');
|
|
295
340
|
transition?.cancel();
|
|
296
341
|
experience = null;
|
|
297
342
|
try {
|
|
@@ -349,6 +394,8 @@
|
|
|
349
394
|
|
|
350
395
|
return () => {
|
|
351
396
|
window.clearTimeout(statusTimer);
|
|
397
|
+
layoutMetrics?.destroy();
|
|
398
|
+
layoutMetrics = undefined;
|
|
352
399
|
fullscreenController?.dispose();
|
|
353
400
|
fullscreenController = undefined;
|
|
354
401
|
virtualScroll?.destroy();
|
|
@@ -356,6 +403,10 @@
|
|
|
356
403
|
destroyed = true;
|
|
357
404
|
releasePageBinding?.();
|
|
358
405
|
navigationGeneration += 1;
|
|
406
|
+
navigationFeedback?.end();
|
|
407
|
+
earlyTransition?.cancel('destroyed');
|
|
408
|
+
interruptedPresentation?.cancel(); interruptedPresentation = undefined;
|
|
409
|
+
summaryTransfer?.cancel(); summaryTransfer = undefined;
|
|
359
410
|
transition?.dispose();
|
|
360
411
|
document.documentElement.classList.remove('stage-route');
|
|
361
412
|
document.body.classList.remove('stage-route');
|
|
@@ -369,8 +420,9 @@
|
|
|
369
420
|
};
|
|
370
421
|
});
|
|
371
422
|
|
|
423
|
+
$effect(() => { experience?.setDetailMedia(detailMedia); });
|
|
372
424
|
$effect(() => {
|
|
373
|
-
void
|
|
425
|
+
void resolvedPageBackground; void background; void isEnhanced;
|
|
374
426
|
Object.values(interactionTheme ?? {});
|
|
375
427
|
scheduleAppearanceUpdate();
|
|
376
428
|
});
|
|
@@ -381,7 +433,7 @@
|
|
|
381
433
|
void tick().then(() => {
|
|
382
434
|
appearanceUpdatePending = false;
|
|
383
435
|
if (!destroyed && isEnhanced) experience?.updateAppearance({
|
|
384
|
-
pageBackground, background, interactionTheme, panels: getPanelTargets()
|
|
436
|
+
pageBackground: resolvedPageBackground, background, interactionTheme, panels: getPanelTargets()
|
|
385
437
|
});
|
|
386
438
|
});
|
|
387
439
|
}
|
|
@@ -416,40 +468,120 @@
|
|
|
416
468
|
}
|
|
417
469
|
|
|
418
470
|
function interruptNavigation() {
|
|
471
|
+
earlyTransition?.cancel('cancelled');
|
|
472
|
+
interruptedPresentation?.cancel(); interruptedPresentation = undefined;
|
|
473
|
+
navigationFeedback?.end();
|
|
419
474
|
navigationGeneration += 1;
|
|
420
475
|
reuseCatalogPage = false;
|
|
421
476
|
transition?.cancel();
|
|
422
477
|
if (pageBindingConsumed) releasePageBinding?.();
|
|
423
478
|
}
|
|
424
479
|
|
|
480
|
+
function interruptCommittedNavigation(reason: EarlyNavigationCancelReason) {
|
|
481
|
+
if (!earlyTransition) return false;
|
|
482
|
+
// The destination owns the route already. Release only the visual source;
|
|
483
|
+
// restoreNavigation must keep its generation and finish updatePage normally.
|
|
484
|
+
interruptedPresentation = earlyTransition.cancelCommitted(reason);
|
|
485
|
+
navigationFeedback?.end();
|
|
486
|
+
if (pageBindingConsumed) releasePageBinding?.();
|
|
487
|
+
return true;
|
|
488
|
+
}
|
|
489
|
+
|
|
425
490
|
function supersedeNavigation(destination: URL) {
|
|
491
|
+
if (earlyTransition?.destination !== destination.href) earlyTransition?.cancel('superseded');
|
|
492
|
+
interruptedPresentation?.cancel(); interruptedPresentation = undefined;
|
|
493
|
+
summaryTransfer?.cancel(); summaryTransfer = undefined;
|
|
494
|
+
navigationFeedback?.end();
|
|
426
495
|
navigationGeneration += 1;
|
|
427
496
|
transition?.supersede(destination);
|
|
428
497
|
if (pageBindingConsumed) releasePageBinding?.();
|
|
429
498
|
}
|
|
430
499
|
|
|
431
500
|
let navigationTimings = { dataReady: 0, captured: 0, restoring: 0, bound: 0 };
|
|
432
|
-
function
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
501
|
+
function startEarlyNavigation(navigation: BeforeNavigate) {
|
|
502
|
+
// The opt-in is temporary while production frame/ownership gates are verified.
|
|
503
|
+
if (visualTestController) stage.dataset.catalogStagedDecision = `gate:${isEnhanced}:${Boolean(experience)}:${Boolean(presentationHost)}`;
|
|
504
|
+
if (!new URL(location.href).searchParams.has('stagedNavigation') || !isEnhanced || !experience || !presentationHost) return;
|
|
505
|
+
const metrics = layoutMetrics?.read();
|
|
506
|
+
if (!metrics) return;
|
|
507
|
+
earlyTransition?.cancel('superseded');
|
|
508
|
+
const candidate = startStagedCatalogNavigation({ root: stage, navigation, endpoints: catalogEndpoints,
|
|
509
|
+
host: presentationHost, experience, metrics, items: catalogSpatialElements, diagnostics: Boolean(visualTestController),
|
|
510
|
+
onFinish() {
|
|
511
|
+
if (earlyTransition) lastEarlyTimings = earlyTransition.timings;
|
|
512
|
+
earlyTransition = undefined;
|
|
513
|
+
navigationFeedback?.end();
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
earlyTransition = candidate;
|
|
517
|
+
return candidate?.handle;
|
|
518
|
+
}
|
|
519
|
+
function captureNavigation(navigation: OnNavigate): undefined {
|
|
520
|
+
try {
|
|
521
|
+
navigationTimings = { dataReady: performance.now(), captured: 0, restoring: 0, bound: 0 };
|
|
522
|
+
const generation = ++navigationGeneration;
|
|
523
|
+
if (earlyTransition?.phase === 'held' && navigation.to?.url.href === earlyTransition.destination) {
|
|
524
|
+
earlyTransition.commit();
|
|
525
|
+
reuseCatalogPage = false;
|
|
526
|
+
navigationTimings.captured = performance.now();
|
|
527
|
+
experience?.releasePage();
|
|
528
|
+
setZoomFocusState(restingZoomFocus);
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
// Snapshot the still-mounted source synchronously. Waiting for feedback to
|
|
532
|
+
// paint here would hold Kit after its URL update but before its DOM commit.
|
|
533
|
+
// Feedback stays nonblocking; destination/GPU preparation follows commit.
|
|
534
|
+
if (destroyed || generation !== navigationGeneration) return;
|
|
535
|
+
summaryTransfer?.cancel();
|
|
536
|
+
summaryTransfer = navigation.from && navigation.to && presentationHost
|
|
537
|
+
? prepareCatalogSummaryTransfer({ from: navigation.from.url, to: navigation.to.url,
|
|
538
|
+
type: navigation.type, endpoints: catalogEndpoints, host: presentationHost }) : undefined;
|
|
539
|
+
reuseCatalogPage = Boolean(
|
|
540
|
+
navigation.from &&
|
|
541
|
+
navigation.to &&
|
|
542
|
+
transition?.capture(navigation.from.url, navigation.to.url, navigation.type)
|
|
543
|
+
);
|
|
544
|
+
navigationTimings.captured = performance.now();
|
|
545
|
+
if (reuseCatalogPage) {
|
|
546
|
+
summaryTransfer?.cancel(); summaryTransfer = undefined;
|
|
547
|
+
retainedPageSignature = pageSignature();
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
summaryTransfer?.hold();
|
|
551
|
+
experience?.releasePage();
|
|
552
|
+
setZoomFocusState(restingZoomFocus);
|
|
553
|
+
} finally {
|
|
554
|
+
// Leaving fullscreen refits the live camera and restores source DOM/scroll.
|
|
555
|
+
// Retain its visible pose and release page bindings before that mutation.
|
|
556
|
+
fullscreenController?.setFullscreen(false);
|
|
445
557
|
}
|
|
446
|
-
|
|
447
|
-
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
async function settleInterruptedPresentation(generation: number, rebind = false) {
|
|
561
|
+
const pending = interruptedPresentation;
|
|
562
|
+
if (!pending) return;
|
|
563
|
+
await pending.finished;
|
|
564
|
+
if (interruptedPresentation === pending) interruptedPresentation = undefined;
|
|
565
|
+
if (destroyed || generation !== navigationGeneration || !rebind) return;
|
|
566
|
+
experience?.updateAppearance({ pageBackground: resolvedPageBackground, background, interactionTheme, panels: getPanelTargets() });
|
|
567
|
+
window.dispatchEvent(new Event(STAGE_PANEL_LAYOUT_EVENT));
|
|
568
|
+
experience?.flushCatalogFrame();
|
|
448
569
|
}
|
|
449
570
|
|
|
450
571
|
async function restoreNavigation() {
|
|
451
572
|
navigationTimings.restoring = performance.now();
|
|
452
573
|
const generation = navigationGeneration;
|
|
574
|
+
await tick();
|
|
575
|
+
if (destroyed || generation !== navigationGeneration) return;
|
|
576
|
+
// Preserve the real Svelte instance before page binding measures the new
|
|
577
|
+
// summary. This also applies when GPU motion is disabled or declined.
|
|
578
|
+
const transferredSlot = summaryTransfer?.adopt(); summaryTransfer = undefined;
|
|
579
|
+
if (transferredSlot) {
|
|
580
|
+
await tick();
|
|
581
|
+
if (destroyed || generation !== navigationGeneration) return;
|
|
582
|
+
transferredSlot.dispatchEvent(new Event('spatial-summary-measure'));
|
|
583
|
+
await tick();
|
|
584
|
+
}
|
|
453
585
|
await initialized;
|
|
454
586
|
await tick();
|
|
455
587
|
if (destroyed || generation !== navigationGeneration || !experience) return;
|
|
@@ -469,6 +601,8 @@
|
|
|
469
601
|
await pending;
|
|
470
602
|
if (destroyed || generation !== navigationGeneration) return;
|
|
471
603
|
}
|
|
604
|
+
if (interruptedPresentation) await settleInterruptedPresentation(generation);
|
|
605
|
+
if (destroyed || generation !== navigationGeneration) return;
|
|
472
606
|
registerSpatialElements();
|
|
473
607
|
const catalogReady = catalog
|
|
474
608
|
? experience.setCatalogSpatialElements(catalog.brandId, catalogSpatialElements)
|
|
@@ -490,7 +624,7 @@
|
|
|
490
624
|
}) === 'dock'
|
|
491
625
|
),
|
|
492
626
|
background,
|
|
493
|
-
pageBackground,
|
|
627
|
+
pageBackground: resolvedPageBackground,
|
|
494
628
|
hdr,
|
|
495
629
|
glb,
|
|
496
630
|
lodPair,
|
|
@@ -501,6 +635,8 @@
|
|
|
501
635
|
viewport: getViewportTarget()
|
|
502
636
|
});
|
|
503
637
|
if (destroyed || generation !== navigationGeneration) return;
|
|
638
|
+
if (interruptedPresentation) await settleInterruptedPresentation(generation, true);
|
|
639
|
+
if (destroyed || generation !== navigationGeneration) return;
|
|
504
640
|
if (experience.getSpatialCapture()) {
|
|
505
641
|
await Promise.race([
|
|
506
642
|
catalogReady,
|
|
@@ -512,10 +648,17 @@
|
|
|
512
648
|
isFallback = false;
|
|
513
649
|
stageState = 'enhanced';
|
|
514
650
|
navigationTimings.bound = performance.now();
|
|
515
|
-
|
|
651
|
+
if (earlyTransition?.phase === 'held') {
|
|
652
|
+
await earlyTransition.reveal(() => experience?.updateAppearance({
|
|
653
|
+
pageBackground: resolvedPageBackground, background, interactionTheme, panels: getPanelTargets()
|
|
654
|
+
}));
|
|
655
|
+
} else await transition?.play();
|
|
656
|
+
if (interruptedPresentation) await settleInterruptedPresentation(generation, true);
|
|
516
657
|
} catch (error) {
|
|
517
658
|
if (destroyed || generation !== navigationGeneration) return;
|
|
659
|
+
interruptedPresentation?.cancel(); interruptedPresentation = undefined;
|
|
518
660
|
transition?.cancel();
|
|
661
|
+
earlyTransition?.cancel('error');
|
|
519
662
|
try {
|
|
520
663
|
experience.discardFailedPage();
|
|
521
664
|
} catch (cleanupError) {
|
|
@@ -527,6 +670,8 @@
|
|
|
527
670
|
isEnhanced = false;
|
|
528
671
|
isFallback = true;
|
|
529
672
|
stageState = 'fallback';
|
|
673
|
+
} finally {
|
|
674
|
+
if (generation === navigationGeneration) navigationFeedback?.end();
|
|
530
675
|
}
|
|
531
676
|
}
|
|
532
677
|
|
|
@@ -574,11 +719,13 @@
|
|
|
574
719
|
loseDevice: () => experience?.loseDeviceForTest(),
|
|
575
720
|
getCarouselStats: () => experience?.getCarouselStats() ?? null,
|
|
576
721
|
getCatalogStats: () => experience?.assets.getStats() ?? null,
|
|
722
|
+
getRenderActivity: () => experience?.getVisualTestRenderActivity() ?? null,
|
|
577
723
|
getCatalogEndpoints: () => catalogEndpoints.getSnapshot(),
|
|
578
724
|
getCatalogOwnership: () => transition?.getOwnership() ?? null,
|
|
579
|
-
getNavigationTimings: () => ({ ...navigationTimings }),
|
|
725
|
+
getNavigationTimings: () => ({ ...navigationTimings, early: earlyTransition?.timings ?? lastEarlyTimings }),
|
|
580
726
|
captureHeroPresentation: () => experience?.captureHeroPresentation() ?? false,
|
|
581
727
|
getSpatialCapture: () => experience?.getSpatialCapture() ?? null,
|
|
728
|
+
getDetailProjection: kind => experience?.getVisualTestDetailProjection(kind) ?? null,
|
|
582
729
|
releaseSpatialCapture: () => experience?.releaseSpatialCapture(),
|
|
583
730
|
registerCatalogEndpoint: (address, element) => catalogEndpoints.register(address, element),
|
|
584
731
|
getCatalogPresentation: () => experience?.getCatalogPresentation() ?? null,
|
|
@@ -622,6 +769,12 @@
|
|
|
622
769
|
creations: 0,
|
|
623
770
|
resizes: 0,
|
|
624
771
|
warmups: 0,
|
|
772
|
+
inactiveScrollWarmups: 0,
|
|
773
|
+
backgroundOutput: {
|
|
774
|
+
requested: false, initialized: false, mode: 'legacy', held: false,
|
|
775
|
+
targetTextureId: null, implicitBackgroundTarget: null,
|
|
776
|
+
catalogProfile: null, catalogProfileCurrent: false
|
|
777
|
+
},
|
|
625
778
|
activeScale: 0
|
|
626
779
|
},
|
|
627
780
|
getVisibilityStats: () =>
|
|
@@ -664,6 +817,7 @@
|
|
|
664
817
|
getMinimapDockProgress: panel.getMinimapDockProgress,
|
|
665
818
|
getMinimapModelScale: panel.getMinimapModelScale,
|
|
666
819
|
getMinimapModelTop: panel.getMinimapModelTop,
|
|
820
|
+
getMinimapModelLeft: panel.getMinimapModelLeft,
|
|
667
821
|
getSurfaceOpacity: panel.getSurfaceOpacity,
|
|
668
822
|
getVisible: panel.getVisible,
|
|
669
823
|
getFocusAnchor: panel.getFocusAnchor,
|
|
@@ -685,16 +839,19 @@
|
|
|
685
839
|
{#if catalog}
|
|
686
840
|
<ScrollNavigationBridge
|
|
687
841
|
controller={virtualScroll}
|
|
842
|
+
onEarlyStart={startEarlyNavigation}
|
|
843
|
+
onStart={() => { if (isEnhanced) navigationFeedback?.begin(); }}
|
|
688
844
|
onCapture={captureNavigation}
|
|
689
845
|
onSupersede={supersedeNavigation}
|
|
690
846
|
onInterrupt={interruptNavigation}
|
|
847
|
+
onInterruptCommitted={interruptCommittedNavigation}
|
|
691
848
|
onRestored={restoreNavigation}
|
|
692
849
|
/>
|
|
693
850
|
{/if}
|
|
694
851
|
|
|
695
852
|
<div
|
|
696
853
|
bind:this={stage}
|
|
697
|
-
style:--stage-page-background={
|
|
854
|
+
style:--stage-page-background={resolvedPageBackground}
|
|
698
855
|
class="stage"
|
|
699
856
|
class:stage-enhanced={isEnhanced}
|
|
700
857
|
class:stage-fallback={isFallback}
|
|
@@ -4,6 +4,7 @@ import type { BackgroundSettings, StageCameraSettings, StageInteractionTheme, St
|
|
|
4
4
|
import '../catalog/catalogTransition.css';
|
|
5
5
|
import type { CatalogPage } from '@spatial-elements/core/catalog/catalogPage';
|
|
6
6
|
interface Props {
|
|
7
|
+
deviceOrientation?: boolean;
|
|
7
8
|
/** Namespace for automatic ContentPage/SpatialElementPage registration. Supplied by BrandStageShell. */
|
|
8
9
|
brandId?: string;
|
|
9
10
|
renderSettings?: StageRenderSettings;
|
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.8",
|
|
4
4
|
"description": "SvelteKit components and navigation for Spatial Elements.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"prepack": "npm run build"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@spatial-elements/core": "1.0.0-beta.
|
|
42
|
+
"@spatial-elements/core": "1.0.0-beta.8",
|
|
43
43
|
"lucide-svelte": "^1.0.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|