@spatial-elements/sveltekit 1.0.0-beta.7 → 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 +13 -2
- package/dist/spatial-element/BrandStageShell.svelte.d.ts +8 -0
- package/dist/spatial-element/CarouselSection.svelte +35 -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 +11 -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 +180 -26
- 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,9 +53,10 @@
|
|
|
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
|
|
@@ -103,6 +111,7 @@
|
|
|
103
111
|
})
|
|
104
112
|
);
|
|
105
113
|
const activePage = $derived(readPage?.());
|
|
114
|
+
const resolvedPageBackground = $derived(activePage?.kind === 'content' ? activePage.background ?? pageBackground : pageBackground);
|
|
106
115
|
const activeElement = $derived(activePage?.kind === 'detail' ? activePage.element : undefined);
|
|
107
116
|
const activeScene = $derived(activeElement ? getSpatialElementScene(activeElement) : undefined);
|
|
108
117
|
const catalog = $derived<CatalogPage | undefined>(
|
|
@@ -147,6 +156,17 @@
|
|
|
147
156
|
let domLayerHidden = $state(false);
|
|
148
157
|
let domLayerOpacity = $state(1);
|
|
149
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');
|
|
150
170
|
let stageState = $state<'loading' | 'enhanced' | 'fallback'>('loading');
|
|
151
171
|
let zoomFocusState = $state<StageZoomFocusState>({
|
|
152
172
|
focus: 0,
|
|
@@ -157,8 +177,13 @@
|
|
|
157
177
|
let visualTestController: StageVisualTestController | undefined;
|
|
158
178
|
let virtualScroll = $state<VirtualScrollController>();
|
|
159
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;
|
|
160
184
|
let initialized: Promise<void> | undefined;
|
|
161
185
|
let navigationGeneration = 0;
|
|
186
|
+
let navigationFeedback: NavigationFeedback | undefined;
|
|
162
187
|
let destroyed = false;
|
|
163
188
|
let nextPageBinding: Promise<void> | undefined;
|
|
164
189
|
let releasePageBinding: (() => void) | undefined;
|
|
@@ -168,7 +193,7 @@
|
|
|
168
193
|
const pageSignature = () =>
|
|
169
194
|
JSON.stringify([
|
|
170
195
|
renderSettings,
|
|
171
|
-
|
|
196
|
+
resolvedPageBackground,
|
|
172
197
|
background,
|
|
173
198
|
hdr,
|
|
174
199
|
glb,
|
|
@@ -185,6 +210,11 @@
|
|
|
185
210
|
};
|
|
186
211
|
|
|
187
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),
|
|
188
218
|
isEnhanced: () => isEnhanced,
|
|
189
219
|
updatePanelAppearance: scheduleAppearanceUpdate,
|
|
190
220
|
prefetchSpatialElement: (config) => experience?.prefetchSpatialElement(config),
|
|
@@ -208,10 +238,13 @@
|
|
|
208
238
|
},
|
|
209
239
|
isFullscreen: () => fullscreen,
|
|
210
240
|
getZoomFocus: () => zoomFocusState.focus,
|
|
241
|
+
getZoomUiFocus: () => zoomFocusState.uiFocus,
|
|
211
242
|
setFullscreen: (active) => fullscreenController?.setFullscreen(active)
|
|
212
243
|
});
|
|
213
244
|
|
|
214
245
|
onMount(() => {
|
|
246
|
+
layoutMetrics = new ResponsiveViewportMetrics(stage);
|
|
247
|
+
layoutMetrics.start();
|
|
215
248
|
// The semantic page is already usable. Only announce unusually slow enhancement.
|
|
216
249
|
const statusTimer = window.setTimeout(() => {
|
|
217
250
|
if (stageState === 'loading') showStatus = true;
|
|
@@ -225,7 +258,9 @@
|
|
|
225
258
|
virtualScroll = new VirtualScrollController(stage, domLayer, virtualScrollSpacer);
|
|
226
259
|
// Native fallback pages keep native document scrolling and browser anchor behavior.
|
|
227
260
|
if (navigator.gpu) virtualScroll.start();
|
|
261
|
+
navigationFeedback = new NavigationFeedback(stage);
|
|
228
262
|
transition = new CatalogTransition(stage, catalogEndpoints, {
|
|
263
|
+
diagnose: reason => { if (visualTestController) stage.dataset.catalogTransitionDecision = reason; },
|
|
229
264
|
captureContentGeometry: (endpoint, secondary) =>
|
|
230
265
|
experience?.captureContentGeometry(endpoint.spatialElementId, secondary) ?? false,
|
|
231
266
|
prepareContentParticipants: (pairs) => experience?.prepareContentParticipants(pairs),
|
|
@@ -239,7 +274,10 @@
|
|
|
239
274
|
prepareDestination: (destination) =>
|
|
240
275
|
experience?.prepareGeometryDestination(destination) ?? false,
|
|
241
276
|
setGeometryProgress: (progress) => experience?.setCatalogGeometryProgress(progress),
|
|
242
|
-
flushFrame: () =>
|
|
277
|
+
flushFrame: () => {
|
|
278
|
+
if (stage.dataset.catalogTransition === 'animating') navigationFeedback?.end();
|
|
279
|
+
experience?.flushCatalogFrame();
|
|
280
|
+
},
|
|
243
281
|
finishGeometry: () => {
|
|
244
282
|
try {
|
|
245
283
|
experience?.finishCatalogGeometry();
|
|
@@ -270,6 +308,8 @@
|
|
|
270
308
|
const panels = getPanelTargets();
|
|
271
309
|
const viewport = getViewportTarget();
|
|
272
310
|
const instance = new StageExperience(stage, {
|
|
311
|
+
detailMedia,
|
|
312
|
+
readLayoutMetrics: (mode) => layoutMetrics?.read(mode),
|
|
273
313
|
deviceOrientation,
|
|
274
314
|
renderSettings,
|
|
275
315
|
dracoDecoderPath,
|
|
@@ -281,7 +321,7 @@
|
|
|
281
321
|
spatialElementId: catalog.spatialElementId
|
|
282
322
|
}) !== 'dock',
|
|
283
323
|
background,
|
|
284
|
-
pageBackground,
|
|
324
|
+
pageBackground: resolvedPageBackground,
|
|
285
325
|
hdr,
|
|
286
326
|
glb,
|
|
287
327
|
lodPair,
|
|
@@ -294,7 +334,9 @@
|
|
|
294
334
|
onDeviceLost: () => {
|
|
295
335
|
if (disposed || experience !== instance) return;
|
|
296
336
|
fullscreenController?.setFullscreen(false);
|
|
337
|
+
navigationFeedback?.end();
|
|
297
338
|
navigationGeneration += 1;
|
|
339
|
+
earlyTransition?.cancel('error');
|
|
298
340
|
transition?.cancel();
|
|
299
341
|
experience = null;
|
|
300
342
|
try {
|
|
@@ -352,6 +394,8 @@
|
|
|
352
394
|
|
|
353
395
|
return () => {
|
|
354
396
|
window.clearTimeout(statusTimer);
|
|
397
|
+
layoutMetrics?.destroy();
|
|
398
|
+
layoutMetrics = undefined;
|
|
355
399
|
fullscreenController?.dispose();
|
|
356
400
|
fullscreenController = undefined;
|
|
357
401
|
virtualScroll?.destroy();
|
|
@@ -359,6 +403,10 @@
|
|
|
359
403
|
destroyed = true;
|
|
360
404
|
releasePageBinding?.();
|
|
361
405
|
navigationGeneration += 1;
|
|
406
|
+
navigationFeedback?.end();
|
|
407
|
+
earlyTransition?.cancel('destroyed');
|
|
408
|
+
interruptedPresentation?.cancel(); interruptedPresentation = undefined;
|
|
409
|
+
summaryTransfer?.cancel(); summaryTransfer = undefined;
|
|
362
410
|
transition?.dispose();
|
|
363
411
|
document.documentElement.classList.remove('stage-route');
|
|
364
412
|
document.body.classList.remove('stage-route');
|
|
@@ -372,8 +420,9 @@
|
|
|
372
420
|
};
|
|
373
421
|
});
|
|
374
422
|
|
|
423
|
+
$effect(() => { experience?.setDetailMedia(detailMedia); });
|
|
375
424
|
$effect(() => {
|
|
376
|
-
void
|
|
425
|
+
void resolvedPageBackground; void background; void isEnhanced;
|
|
377
426
|
Object.values(interactionTheme ?? {});
|
|
378
427
|
scheduleAppearanceUpdate();
|
|
379
428
|
});
|
|
@@ -384,7 +433,7 @@
|
|
|
384
433
|
void tick().then(() => {
|
|
385
434
|
appearanceUpdatePending = false;
|
|
386
435
|
if (!destroyed && isEnhanced) experience?.updateAppearance({
|
|
387
|
-
pageBackground, background, interactionTheme, panels: getPanelTargets()
|
|
436
|
+
pageBackground: resolvedPageBackground, background, interactionTheme, panels: getPanelTargets()
|
|
388
437
|
});
|
|
389
438
|
});
|
|
390
439
|
}
|
|
@@ -419,40 +468,120 @@
|
|
|
419
468
|
}
|
|
420
469
|
|
|
421
470
|
function interruptNavigation() {
|
|
471
|
+
earlyTransition?.cancel('cancelled');
|
|
472
|
+
interruptedPresentation?.cancel(); interruptedPresentation = undefined;
|
|
473
|
+
navigationFeedback?.end();
|
|
422
474
|
navigationGeneration += 1;
|
|
423
475
|
reuseCatalogPage = false;
|
|
424
476
|
transition?.cancel();
|
|
425
477
|
if (pageBindingConsumed) releasePageBinding?.();
|
|
426
478
|
}
|
|
427
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
|
+
|
|
428
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();
|
|
429
495
|
navigationGeneration += 1;
|
|
430
496
|
transition?.supersede(destination);
|
|
431
497
|
if (pageBindingConsumed) releasePageBinding?.();
|
|
432
498
|
}
|
|
433
499
|
|
|
434
500
|
let navigationTimings = { dataReady: 0, captured: 0, restoring: 0, bound: 0 };
|
|
435
|
-
function
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
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);
|
|
448
557
|
}
|
|
449
|
-
|
|
450
|
-
|
|
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();
|
|
451
569
|
}
|
|
452
570
|
|
|
453
571
|
async function restoreNavigation() {
|
|
454
572
|
navigationTimings.restoring = performance.now();
|
|
455
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
|
+
}
|
|
456
585
|
await initialized;
|
|
457
586
|
await tick();
|
|
458
587
|
if (destroyed || generation !== navigationGeneration || !experience) return;
|
|
@@ -472,6 +601,8 @@
|
|
|
472
601
|
await pending;
|
|
473
602
|
if (destroyed || generation !== navigationGeneration) return;
|
|
474
603
|
}
|
|
604
|
+
if (interruptedPresentation) await settleInterruptedPresentation(generation);
|
|
605
|
+
if (destroyed || generation !== navigationGeneration) return;
|
|
475
606
|
registerSpatialElements();
|
|
476
607
|
const catalogReady = catalog
|
|
477
608
|
? experience.setCatalogSpatialElements(catalog.brandId, catalogSpatialElements)
|
|
@@ -493,7 +624,7 @@
|
|
|
493
624
|
}) === 'dock'
|
|
494
625
|
),
|
|
495
626
|
background,
|
|
496
|
-
pageBackground,
|
|
627
|
+
pageBackground: resolvedPageBackground,
|
|
497
628
|
hdr,
|
|
498
629
|
glb,
|
|
499
630
|
lodPair,
|
|
@@ -504,6 +635,8 @@
|
|
|
504
635
|
viewport: getViewportTarget()
|
|
505
636
|
});
|
|
506
637
|
if (destroyed || generation !== navigationGeneration) return;
|
|
638
|
+
if (interruptedPresentation) await settleInterruptedPresentation(generation, true);
|
|
639
|
+
if (destroyed || generation !== navigationGeneration) return;
|
|
507
640
|
if (experience.getSpatialCapture()) {
|
|
508
641
|
await Promise.race([
|
|
509
642
|
catalogReady,
|
|
@@ -515,10 +648,17 @@
|
|
|
515
648
|
isFallback = false;
|
|
516
649
|
stageState = 'enhanced';
|
|
517
650
|
navigationTimings.bound = performance.now();
|
|
518
|
-
|
|
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);
|
|
519
657
|
} catch (error) {
|
|
520
658
|
if (destroyed || generation !== navigationGeneration) return;
|
|
659
|
+
interruptedPresentation?.cancel(); interruptedPresentation = undefined;
|
|
521
660
|
transition?.cancel();
|
|
661
|
+
earlyTransition?.cancel('error');
|
|
522
662
|
try {
|
|
523
663
|
experience.discardFailedPage();
|
|
524
664
|
} catch (cleanupError) {
|
|
@@ -530,6 +670,8 @@
|
|
|
530
670
|
isEnhanced = false;
|
|
531
671
|
isFallback = true;
|
|
532
672
|
stageState = 'fallback';
|
|
673
|
+
} finally {
|
|
674
|
+
if (generation === navigationGeneration) navigationFeedback?.end();
|
|
533
675
|
}
|
|
534
676
|
}
|
|
535
677
|
|
|
@@ -577,11 +719,13 @@
|
|
|
577
719
|
loseDevice: () => experience?.loseDeviceForTest(),
|
|
578
720
|
getCarouselStats: () => experience?.getCarouselStats() ?? null,
|
|
579
721
|
getCatalogStats: () => experience?.assets.getStats() ?? null,
|
|
722
|
+
getRenderActivity: () => experience?.getVisualTestRenderActivity() ?? null,
|
|
580
723
|
getCatalogEndpoints: () => catalogEndpoints.getSnapshot(),
|
|
581
724
|
getCatalogOwnership: () => transition?.getOwnership() ?? null,
|
|
582
|
-
getNavigationTimings: () => ({ ...navigationTimings }),
|
|
725
|
+
getNavigationTimings: () => ({ ...navigationTimings, early: earlyTransition?.timings ?? lastEarlyTimings }),
|
|
583
726
|
captureHeroPresentation: () => experience?.captureHeroPresentation() ?? false,
|
|
584
727
|
getSpatialCapture: () => experience?.getSpatialCapture() ?? null,
|
|
728
|
+
getDetailProjection: kind => experience?.getVisualTestDetailProjection(kind) ?? null,
|
|
585
729
|
releaseSpatialCapture: () => experience?.releaseSpatialCapture(),
|
|
586
730
|
registerCatalogEndpoint: (address, element) => catalogEndpoints.register(address, element),
|
|
587
731
|
getCatalogPresentation: () => experience?.getCatalogPresentation() ?? null,
|
|
@@ -625,6 +769,12 @@
|
|
|
625
769
|
creations: 0,
|
|
626
770
|
resizes: 0,
|
|
627
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
|
+
},
|
|
628
778
|
activeScale: 0
|
|
629
779
|
},
|
|
630
780
|
getVisibilityStats: () =>
|
|
@@ -667,6 +817,7 @@
|
|
|
667
817
|
getMinimapDockProgress: panel.getMinimapDockProgress,
|
|
668
818
|
getMinimapModelScale: panel.getMinimapModelScale,
|
|
669
819
|
getMinimapModelTop: panel.getMinimapModelTop,
|
|
820
|
+
getMinimapModelLeft: panel.getMinimapModelLeft,
|
|
670
821
|
getSurfaceOpacity: panel.getSurfaceOpacity,
|
|
671
822
|
getVisible: panel.getVisible,
|
|
672
823
|
getFocusAnchor: panel.getFocusAnchor,
|
|
@@ -688,16 +839,19 @@
|
|
|
688
839
|
{#if catalog}
|
|
689
840
|
<ScrollNavigationBridge
|
|
690
841
|
controller={virtualScroll}
|
|
842
|
+
onEarlyStart={startEarlyNavigation}
|
|
843
|
+
onStart={() => { if (isEnhanced) navigationFeedback?.begin(); }}
|
|
691
844
|
onCapture={captureNavigation}
|
|
692
845
|
onSupersede={supersedeNavigation}
|
|
693
846
|
onInterrupt={interruptNavigation}
|
|
847
|
+
onInterruptCommitted={interruptCommittedNavigation}
|
|
694
848
|
onRestored={restoreNavigation}
|
|
695
849
|
/>
|
|
696
850
|
{/if}
|
|
697
851
|
|
|
698
852
|
<div
|
|
699
853
|
bind:this={stage}
|
|
700
|
-
style:--stage-page-background={
|
|
854
|
+
style:--stage-page-background={resolvedPageBackground}
|
|
701
855
|
class="stage"
|
|
702
856
|
class:stage-enhanced={isEnhanced}
|
|
703
857
|
class:stage-fallback={isFallback}
|
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": {
|