@spatial-elements/sveltekit 0.1.0-beta.2 → 1.0.0-beta.4
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 +11 -3
- package/dist/catalog/catalogNavigation.js +3 -2
- package/dist/spatial-element/BrandStageShell.svelte +17 -12
- package/dist/spatial-element/BrandStageShell.svelte.d.ts +11 -4
- package/dist/spatial-element/CarouselSection.svelte +184 -38
- package/dist/spatial-element/CarouselSection.svelte.d.ts +5 -0
- package/dist/spatial-element/CarouselSpatialElement.svelte +7 -3
- package/dist/spatial-element/ContentPage.svelte +11 -1
- package/dist/spatial-element/ContentPage.svelte.d.ts +7 -3
- package/dist/spatial-element/InteractionGesture.svelte +39 -0
- package/dist/spatial-element/InteractionGesture.svelte.d.ts +7 -0
- package/dist/spatial-element/ListSection.svelte +11 -3
- package/dist/spatial-element/ListSection.svelte.d.ts +5 -3
- package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +3 -1
- package/dist/spatial-element/SpatialElementCard.svelte +2 -2
- package/dist/spatial-element/SpatialElementHelp.svelte +277 -0
- package/dist/spatial-element/SpatialElementHelp.svelte.d.ts +3 -0
- package/dist/spatial-element/SpatialElementMediaRail.svelte +1 -1
- package/dist/spatial-element/SpatialElementMediaRail.svelte.d.ts +1 -1
- package/dist/spatial-element/SpatialElementPage.svelte +25 -8
- package/dist/spatial-element/SpatialElementPage.svelte.d.ts +5 -3
- package/dist/spatial-element/SpatialElementStickyHeader.svelte +42 -37
- package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +2 -1
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte +60 -55
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte.d.ts +1 -1
- package/dist/spatial-element/SpatialElementTabList.svelte +3 -1
- package/dist/spatial-element/SpatialIconButton.svelte +56 -0
- package/dist/spatial-element/SpatialIconButton.svelte.d.ts +14 -0
- package/dist/spatial-element/SpatialListPage.svelte +4 -1
- package/dist/spatial-element/SpatialListPage.svelte.d.ts +2 -0
- package/dist/spatial-element/index.d.ts +5 -1
- package/dist/spatial-element/index.js +3 -0
- package/dist/spatial-element/messagesContext.d.ts +3 -0
- package/dist/spatial-element/messagesContext.js +10 -0
- package/dist/spatial-element/spatialPageContext.d.ts +4 -0
- package/dist/spatial-element/spatialPageContext.js +9 -0
- package/dist/stage/Panel.svelte +30 -2
- package/dist/stage/Panel.svelte.d.ts +12 -2
- package/dist/stage/Stage.svelte +97 -17
- package/dist/stage/Stage.svelte.d.ts +5 -1
- package/package.json +4 -4
package/dist/stage/Stage.svelte
CHANGED
|
@@ -9,21 +9,41 @@
|
|
|
9
9
|
StageInteractionTheme,
|
|
10
10
|
StageModelSettings,
|
|
11
11
|
StagePanelTarget,
|
|
12
|
+
StageRenderSettings,
|
|
12
13
|
StageVisualTestView,
|
|
13
14
|
StageViewportTarget,
|
|
14
15
|
StageZoomFocusState
|
|
15
16
|
} from '@spatial-elements/core/stage/StageExperience';
|
|
16
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
isStageVisualTestMode,
|
|
19
|
+
type StageVisualTestController
|
|
20
|
+
} from '@spatial-elements/core/stage/stageVisualTest';
|
|
21
|
+
import { resolveStageRenderSettings } from '@spatial-elements/core/stage/renderSettings';
|
|
17
22
|
import { VirtualScrollController } from '@spatial-elements/core/stage/VirtualScrollController';
|
|
18
23
|
import ScrollNavigationBridge from '../catalog/ScrollNavigationBridge.svelte';
|
|
19
24
|
import { CatalogTransition } from '@spatial-elements/core/catalog/CatalogTransition';
|
|
20
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
CATALOG_ENDPOINTS,
|
|
27
|
+
CatalogEndpointRegistry
|
|
28
|
+
} from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
|
|
21
29
|
import '../catalog/catalogTransition.css';
|
|
22
30
|
import { createStageSpatialElementAssetManifest } from '@spatial-elements/core/catalog/spatialElementAssets';
|
|
23
31
|
import { CATALOG_ITEMS, CatalogItems } from '@spatial-elements/core/catalog/catalogItems';
|
|
24
|
-
import {
|
|
32
|
+
import {
|
|
33
|
+
CATALOG_SECTIONS,
|
|
34
|
+
CatalogSections
|
|
35
|
+
} from '@spatial-elements/core/catalog/CatalogSections';
|
|
25
36
|
import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
|
|
26
37
|
import type { CatalogPage } from '@spatial-elements/core/catalog/catalogPage';
|
|
38
|
+
import {
|
|
39
|
+
SpatialPageRegistry,
|
|
40
|
+
type SpatialPage
|
|
41
|
+
} from '@spatial-elements/core/catalog/SpatialPageRegistry';
|
|
42
|
+
import {
|
|
43
|
+
getSpatialElementScene,
|
|
44
|
+
hasSpatialElementScene
|
|
45
|
+
} from '@spatial-elements/core/spatial-element/spatialElementScene';
|
|
46
|
+
import { SPATIAL_PAGE } from '../spatial-element/spatialPageContext.js';
|
|
27
47
|
import type { OnNavigate } from '@sveltejs/kit';
|
|
28
48
|
import {
|
|
29
49
|
STAGE_CONTEXT_KEY,
|
|
@@ -33,6 +53,9 @@
|
|
|
33
53
|
} from '@spatial-elements/core/stage/panelContext';
|
|
34
54
|
|
|
35
55
|
interface Props {
|
|
56
|
+
/** Namespace for automatic ContentPage/SpatialElementPage registration. Supplied by BrandStageShell. */
|
|
57
|
+
brandId?: string;
|
|
58
|
+
renderSettings?: StageRenderSettings;
|
|
36
59
|
dracoDecoderPath?: string;
|
|
37
60
|
ariaLabel?: string;
|
|
38
61
|
background?: BackgroundSettings;
|
|
@@ -43,31 +66,64 @@
|
|
|
43
66
|
model?: StageModelSettings;
|
|
44
67
|
camera?: StageCameraSettings;
|
|
45
68
|
interactionTheme?: Partial<StageInteractionTheme>;
|
|
69
|
+
/** @deprecated Low-level manual adapter. BrandStageShell manages catalog state from its pages. */
|
|
46
70
|
catalog?: CatalogPage;
|
|
47
71
|
children?: Snippet;
|
|
48
72
|
}
|
|
49
73
|
|
|
50
74
|
let {
|
|
75
|
+
brandId,
|
|
51
76
|
ariaLabel = 'WebGPU 3D stage',
|
|
77
|
+
renderSettings,
|
|
52
78
|
dracoDecoderPath,
|
|
53
79
|
pageBackground = '#ffffff',
|
|
54
|
-
background,
|
|
55
|
-
hdr,
|
|
56
|
-
glb,
|
|
57
|
-
lodPair,
|
|
58
|
-
model,
|
|
59
|
-
camera,
|
|
80
|
+
background: standaloneBackground,
|
|
81
|
+
hdr: standaloneHdr,
|
|
82
|
+
glb: standaloneGlb,
|
|
83
|
+
lodPair: standaloneLodPair,
|
|
84
|
+
model: standaloneModel,
|
|
85
|
+
camera: standaloneCamera,
|
|
60
86
|
interactionTheme,
|
|
61
|
-
catalog,
|
|
87
|
+
catalog: explicitCatalog,
|
|
62
88
|
children
|
|
63
89
|
}: Props = $props();
|
|
64
90
|
|
|
91
|
+
let readPage = $state.raw<(() => SpatialPage) | undefined>();
|
|
92
|
+
setContext(
|
|
93
|
+
SPATIAL_PAGE,
|
|
94
|
+
new SpatialPageRegistry((read) => {
|
|
95
|
+
readPage = read;
|
|
96
|
+
})
|
|
97
|
+
);
|
|
98
|
+
const activePage = $derived(readPage?.());
|
|
99
|
+
const activeElement = $derived(activePage?.kind === 'detail' ? activePage.element : undefined);
|
|
100
|
+
const activeScene = $derived(activeElement ? getSpatialElementScene(activeElement) : undefined);
|
|
101
|
+
const catalog = $derived<CatalogPage | undefined>(
|
|
102
|
+
brandId
|
|
103
|
+
? {
|
|
104
|
+
brandId,
|
|
105
|
+
view: activeElement ? 'detail' : 'content',
|
|
106
|
+
spatialElementId: activeElement?.id,
|
|
107
|
+
spatialElementStage: activeScene,
|
|
108
|
+
spatialElements: []
|
|
109
|
+
}
|
|
110
|
+
: explicitCatalog
|
|
111
|
+
);
|
|
65
112
|
let displayedSpatialElements = $state<SpatialListItem[]>([]);
|
|
66
113
|
setContext(CATALOG_ITEMS, new CatalogItems((items) => (displayedSpatialElements = items)));
|
|
67
114
|
setContext(CATALOG_SECTIONS, new CatalogSections());
|
|
68
115
|
const catalogSpatialElements = $derived(
|
|
69
116
|
displayedSpatialElements.length ? displayedSpatialElements : (catalog?.spatialElements ?? [])
|
|
70
117
|
);
|
|
118
|
+
const background = $derived(brandId ? activeElement?.background : standaloneBackground);
|
|
119
|
+
const hdr = $derived(brandId
|
|
120
|
+
? (activePage?.kind === 'content' ? activePage.hdr : activeScene?.hdr ?? '')
|
|
121
|
+
: standaloneHdr);
|
|
122
|
+
const glb = $derived(brandId ? (activeScene?.glb ?? '') : standaloneGlb);
|
|
123
|
+
const lodPair = $derived(brandId ? activeScene?.lodPair : standaloneLodPair);
|
|
124
|
+
const model = $derived(brandId ? activeElement?.model : standaloneModel);
|
|
125
|
+
const camera = $derived(brandId ? activeElement?.camera : standaloneCamera);
|
|
126
|
+
|
|
71
127
|
const registeredPanels: StagePanelRegistration[] = [];
|
|
72
128
|
const catalogEndpoints = new CatalogEndpointRegistry();
|
|
73
129
|
setContext(CATALOG_ENDPOINTS, catalogEndpoints);
|
|
@@ -102,6 +158,7 @@
|
|
|
102
158
|
let retainedPageSignature: string | undefined;
|
|
103
159
|
const pageSignature = () =>
|
|
104
160
|
JSON.stringify([
|
|
161
|
+
renderSettings,
|
|
105
162
|
pageBackground,
|
|
106
163
|
background,
|
|
107
164
|
hdr,
|
|
@@ -190,6 +247,7 @@
|
|
|
190
247
|
const panels = getPanelTargets();
|
|
191
248
|
const viewport = getViewportTarget();
|
|
192
249
|
const instance = new StageExperience(stage, {
|
|
250
|
+
renderSettings,
|
|
193
251
|
dracoDecoderPath,
|
|
194
252
|
catalog: Boolean(catalog),
|
|
195
253
|
heroIsPresented: () =>
|
|
@@ -292,14 +350,22 @@
|
|
|
292
350
|
function registerSpatialElements() {
|
|
293
351
|
if (!catalog || !experience) return;
|
|
294
352
|
for (const spatialElement of catalogSpatialElements) {
|
|
295
|
-
if (spatialElement
|
|
353
|
+
if (hasSpatialElementScene(spatialElement))
|
|
296
354
|
experience.spatialElements.setManifest(
|
|
297
|
-
createStageSpatialElementAssetManifest(
|
|
355
|
+
createStageSpatialElementAssetManifest(
|
|
356
|
+
catalog.brandId,
|
|
357
|
+
spatialElement.id,
|
|
358
|
+
getSpatialElementScene(spatialElement)
|
|
359
|
+
)
|
|
298
360
|
);
|
|
299
361
|
}
|
|
300
362
|
if (catalog.spatialElementId && catalog.spatialElementStage) {
|
|
301
363
|
experience.spatialElements.setManifest(
|
|
302
|
-
createStageSpatialElementAssetManifest(
|
|
364
|
+
createStageSpatialElementAssetManifest(
|
|
365
|
+
catalog.brandId,
|
|
366
|
+
catalog.spatialElementId,
|
|
367
|
+
catalog.spatialElementStage
|
|
368
|
+
)
|
|
303
369
|
);
|
|
304
370
|
}
|
|
305
371
|
}
|
|
@@ -362,6 +428,7 @@
|
|
|
362
428
|
? experience.setCatalogSpatialElements(catalog.brandId, catalogSpatialElements)
|
|
363
429
|
: undefined;
|
|
364
430
|
await experience.updatePage({
|
|
431
|
+
renderSettings,
|
|
365
432
|
catalog: Boolean(catalog),
|
|
366
433
|
heroIsPresented: () =>
|
|
367
434
|
!catalog?.spatialElementId ||
|
|
@@ -440,9 +507,9 @@
|
|
|
440
507
|
await Promise.resolve();
|
|
441
508
|
};
|
|
442
509
|
|
|
443
|
-
const setView = async (view: StageVisualTestView) => {
|
|
510
|
+
const setView = async (view: StageVisualTestView, frames = 18) => {
|
|
444
511
|
experience?.setVisualTestView(view);
|
|
445
|
-
await settle(
|
|
512
|
+
await settle(frames);
|
|
446
513
|
};
|
|
447
514
|
const setSpaceMouseZoom = async (zoom: number) => {
|
|
448
515
|
experience?.setVisualTestSpaceMouseZoom(zoom);
|
|
@@ -487,6 +554,7 @@
|
|
|
487
554
|
driveSpaceMouseZoom,
|
|
488
555
|
stopSpaceMouse,
|
|
489
556
|
getMinimapRect: () => experience?.getVisualTestMinimapRect() ?? null,
|
|
557
|
+
getPanelRect: (frame) => experience?.getVisualTestPanelRect(frame) ?? null,
|
|
490
558
|
getModelRect: () => experience?.getVisualTestModelRect() ?? null,
|
|
491
559
|
getMinimapModelRect: () => experience?.getVisualTestMinimapModelRect() ?? null,
|
|
492
560
|
getMinimapOrientation: () => experience?.getVisualTestMinimapOrientation() ?? null,
|
|
@@ -499,6 +567,8 @@
|
|
|
499
567
|
},
|
|
500
568
|
getRenderTargetStats: () =>
|
|
501
569
|
experience?.getVisualTestRenderTargetStats() ?? {
|
|
570
|
+
pixelRatio: 0,
|
|
571
|
+
renderSettings: resolveStageRenderSettings(renderSettings),
|
|
502
572
|
liveTargets: 0,
|
|
503
573
|
targets: [],
|
|
504
574
|
canvases: [],
|
|
@@ -548,11 +618,16 @@
|
|
|
548
618
|
getMinimapModelScale: panel.getMinimapModelScale,
|
|
549
619
|
getMinimapModelTop: panel.getMinimapModelTop,
|
|
550
620
|
getSurfaceOpacity: panel.getSurfaceOpacity,
|
|
621
|
+
getVisible: panel.getVisible,
|
|
622
|
+
getFocusAnchor: panel.getFocusAnchor,
|
|
623
|
+
updateNativeLayout: panel.updateNativeLayout,
|
|
624
|
+
nativeContent: panel.getNativeContent?.() ?? false,
|
|
551
625
|
minimap: panel.getMinimapOptions(),
|
|
552
626
|
options: panel.getOptions(),
|
|
553
627
|
surface: panel.getSurface(),
|
|
554
628
|
surfaceElement,
|
|
555
|
-
pointerReactive: panel.getPointerReactive()
|
|
629
|
+
pointerReactive: panel.getPointerReactive(),
|
|
630
|
+
focusReactive: panel.getFocusReactive?.() ?? true
|
|
556
631
|
});
|
|
557
632
|
});
|
|
558
633
|
|
|
@@ -715,12 +790,17 @@
|
|
|
715
790
|
pointer-events: none !important;
|
|
716
791
|
}
|
|
717
792
|
|
|
718
|
-
:global(.stage.stage-enhanced [data-stage-panel-fallback][data-stage-panel-bound]) {
|
|
793
|
+
:global(.stage.stage-enhanced [data-stage-panel-fallback][data-stage-panel-bound]:not([data-stage-panel-native-content])) {
|
|
719
794
|
visibility: hidden !important;
|
|
720
795
|
opacity: 0 !important;
|
|
721
796
|
pointer-events: none !important;
|
|
722
797
|
}
|
|
723
798
|
|
|
799
|
+
:global(.stage.stage-enhanced [data-stage-panel-native-content][data-stage-panel-bound][data-stage-panel-surface='glass'] > .stage-panel-surface::before),
|
|
800
|
+
:global(.stage.stage-enhanced [data-stage-panel-native-content][data-stage-panel-bound][data-stage-panel-surface='glass'] > .stage-panel-surface::after) {
|
|
801
|
+
display: none;
|
|
802
|
+
}
|
|
803
|
+
|
|
724
804
|
/* A failed binding may leave pixels in either canvas; the poster owns fallback paint. */
|
|
725
805
|
.stage.stage-fallback :global(.stage-webgpu-background),
|
|
726
806
|
.stage.stage-fallback :global(.stage-webgpu-carousel-rear),
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { SpatialElementLodPair } from '@spatial-elements/core/catalog/spatialElementLodPair';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import type { BackgroundSettings, StageCameraSettings, StageInteractionTheme, StageModelSettings } from '@spatial-elements/core/stage/StageExperience';
|
|
3
|
+
import type { BackgroundSettings, StageCameraSettings, StageInteractionTheme, StageModelSettings, StageRenderSettings } from '@spatial-elements/core/stage/StageExperience';
|
|
4
4
|
import '../catalog/catalogTransition.css';
|
|
5
5
|
import type { CatalogPage } from '@spatial-elements/core/catalog/catalogPage';
|
|
6
6
|
interface Props {
|
|
7
|
+
/** Namespace for automatic ContentPage/SpatialElementPage registration. Supplied by BrandStageShell. */
|
|
8
|
+
brandId?: string;
|
|
9
|
+
renderSettings?: StageRenderSettings;
|
|
7
10
|
dracoDecoderPath?: string;
|
|
8
11
|
ariaLabel?: string;
|
|
9
12
|
background?: BackgroundSettings;
|
|
@@ -14,6 +17,7 @@ interface Props {
|
|
|
14
17
|
model?: StageModelSettings;
|
|
15
18
|
camera?: StageCameraSettings;
|
|
16
19
|
interactionTheme?: Partial<StageInteractionTheme>;
|
|
20
|
+
/** @deprecated Low-level manual adapter. BrandStageShell manages catalog state from its pages. */
|
|
17
21
|
catalog?: CatalogPage;
|
|
18
22
|
children?: Snippet;
|
|
19
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spatial-elements/sveltekit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"description": "SvelteKit components and navigation for Spatial Elements.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -39,17 +39,17 @@
|
|
|
39
39
|
"prepack": "npm run build"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@spatial-elements/core": "
|
|
42
|
+
"@spatial-elements/core": "1.0.0-beta.4",
|
|
43
43
|
"lucide-svelte": "^1.0.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"svelte": "^5.56.4",
|
|
47
47
|
"@sveltejs/kit": "^2.70.3",
|
|
48
|
-
"three": "^0.
|
|
48
|
+
"three": "^0.186.1"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public",
|
|
52
|
-
"tag": "
|
|
52
|
+
"tag": "latest",
|
|
53
53
|
"registry": "https://registry.npmjs.org/"
|
|
54
54
|
}
|
|
55
55
|
}
|