@spatial-elements/sveltekit 0.1.0-beta.1 → 1.0.0-beta.10
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 +19 -9
- 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 +150 -197
- 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 +125 -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/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 +752 -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 +292 -0
- package/dist/spatial-element/SpatialElementHelp.svelte.d.ts +6 -0
- package/dist/spatial-element/SpatialElementMediaRail.svelte +321 -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 +150 -70
- package/dist/spatial-element/SpatialElementPage.svelte.d.ts +6 -3
- package/dist/spatial-element/SpatialElementStickyHeader.svelte +76 -104
- package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +3 -1
- package/dist/spatial-element/SpatialElementSummaryContent.svelte +185 -0
- package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +18 -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 +59 -0
- package/dist/spatial-element/SpatialIconButton.svelte.d.ts +14 -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 +136 -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 +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/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 +18 -3
- package/dist/spatial-element/index.js +11 -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 +151 -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 +405 -48
- 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 +188 -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
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { catalogViewLink } from '@spatial-elements/core/catalog/catalogViewLink';
|
|
3
|
+
import { focusCatalogLink } from '@spatial-elements/core/catalog/catalogActivationFocus';
|
|
4
|
+
import { resolveSpatialThemeRadii } from '@spatial-elements/core/spatial-element/spatialTheme';
|
|
5
|
+
import SpatialSummarySlot from './SpatialSummarySlot.svelte';
|
|
3
6
|
import { getContext } from 'svelte';
|
|
4
7
|
import { getCssPanelBoxShadow } from '@spatial-elements/core/stage/panelShadow';
|
|
8
|
+
import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
|
|
5
9
|
import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
|
|
6
10
|
import { CATALOG_ITEMS, type CatalogItems } from '@spatial-elements/core/catalog/catalogItems';
|
|
7
11
|
import { carouselKey } from '@spatial-elements/core/catalog/carouselSelection';
|
|
8
12
|
import { carouselPose, carouselResident } from '@spatial-elements/core/catalog/catalogPose';
|
|
9
|
-
import type { CarouselPresentation } from '@spatial-elements/core/catalog/catalogPose';
|
|
13
|
+
import type { CarouselLayout, CarouselPresentation, CarouselEmphasis } from '@spatial-elements/core/catalog/catalogPose';
|
|
10
14
|
import { useCatalogNavigation } from '../catalog/catalogNavigation.js';
|
|
11
15
|
import { createCatalogEndpointAction } from '../catalog/catalogEndpointAction.js';
|
|
12
16
|
import {
|
|
@@ -20,29 +24,40 @@
|
|
|
20
24
|
spatialElement,
|
|
21
25
|
sectionId,
|
|
22
26
|
presentation,
|
|
27
|
+
layout,
|
|
23
28
|
index,
|
|
24
29
|
count,
|
|
25
30
|
phase,
|
|
31
|
+
emphasis,
|
|
32
|
+
focus,
|
|
26
33
|
windowPhase,
|
|
27
34
|
selected,
|
|
28
35
|
interactive,
|
|
29
|
-
onselect
|
|
36
|
+
onselect,
|
|
37
|
+
canActivate
|
|
30
38
|
}: {
|
|
31
39
|
spatialElement: SpatialListItem;
|
|
32
40
|
sectionId: string;
|
|
33
41
|
presentation?: CarouselPresentation;
|
|
42
|
+
layout: CarouselLayout;
|
|
34
43
|
index: number;
|
|
35
44
|
count: number;
|
|
36
45
|
phase: number;
|
|
46
|
+
emphasis?: CarouselEmphasis;
|
|
47
|
+
focus: number;
|
|
37
48
|
windowPhase: number;
|
|
38
49
|
selected: boolean;
|
|
39
50
|
interactive: boolean;
|
|
40
51
|
onselect: () => void;
|
|
52
|
+
canActivate: () => boolean;
|
|
41
53
|
} = $props();
|
|
42
54
|
const items = getContext<CatalogItems | undefined>(CATALOG_ITEMS);
|
|
43
55
|
const endpoints = getContext<CatalogEndpointRegistry | undefined>(CATALOG_ENDPOINTS);
|
|
44
56
|
const sections = getContext<CatalogSections | undefined>(CATALOG_SECTIONS);
|
|
45
|
-
const
|
|
57
|
+
const readTheme = useSpatialTheme();
|
|
58
|
+
const brand = $derived(readTheme());
|
|
59
|
+
const radii = $derived(resolveSpatialThemeRadii(brand));
|
|
60
|
+
const contentInset = $derived(brand.panelShape.contentInset ?? Math.max(16, Math.round(brand.panelShape.radius * 0.7)));
|
|
46
61
|
const catalogEndpoint = createCatalogEndpointAction();
|
|
47
62
|
function address(role: CatalogEndpointRole) {
|
|
48
63
|
return interactive &&
|
|
@@ -69,8 +84,11 @@
|
|
|
69
84
|
return () => clearTimeout(timer);
|
|
70
85
|
});
|
|
71
86
|
const occurrence = $derived(JSON.stringify([sectionId, carouselKey(spatialElement)]));
|
|
72
|
-
const
|
|
73
|
-
const
|
|
87
|
+
const tooltip = $derived(spatialElement.title);
|
|
88
|
+
const pose = $derived(carouselPose(index, phase, count, presentation, layout, emphasis, focus));
|
|
89
|
+
const compact = $derived(layout.framing?.compact ?? false);
|
|
90
|
+
const modelFrameSize = $derived(layout.framing ? Math.min(layout.framing.fit.width, layout.framing.fit.height) : Math.min(layout.width, layout.height));
|
|
91
|
+
const resident = $derived(carouselResident(index, windowPhase, count, presentation, layout));
|
|
74
92
|
function activate(event: MouseEvent) {
|
|
75
93
|
endpoints?.prefer(brand.id, spatialElement.id, occurrence, 'carousel.front');
|
|
76
94
|
sections?.activate({
|
|
@@ -79,19 +97,20 @@
|
|
|
79
97
|
occurrence,
|
|
80
98
|
slot: 'carousel.front'
|
|
81
99
|
});
|
|
82
|
-
(event.currentTarget as
|
|
100
|
+
focusCatalogLink(event.currentTarget as HTMLAnchorElement, event);
|
|
83
101
|
}
|
|
84
102
|
$effect(() => {
|
|
85
103
|
if (!interactive || !resident) return;
|
|
86
104
|
return items?.register({
|
|
87
105
|
...spatialElement,
|
|
88
106
|
occurrence,
|
|
89
|
-
pose: { kind: 'carousel', read: () => carouselPose(index, phase, count, presentation) }
|
|
107
|
+
pose: { kind: 'carousel', read: () => carouselPose(index, phase, count, presentation, layout, emphasis, focus) }
|
|
90
108
|
});
|
|
91
109
|
});
|
|
92
110
|
</script>
|
|
93
111
|
|
|
94
112
|
<article
|
|
113
|
+
id={`carousel-${sectionId}-${index}`}
|
|
95
114
|
use:catalogEndpoint={address('container')}
|
|
96
115
|
class="carousel-spatial-element"
|
|
97
116
|
class:selected
|
|
@@ -104,7 +123,7 @@
|
|
|
104
123
|
data-carousel-surface={brand.panelTheme.surface ?? 'glass'}
|
|
105
124
|
data-carousel-theme={JSON.stringify({
|
|
106
125
|
...brand.panelTheme,
|
|
107
|
-
radius:
|
|
126
|
+
radius: radii.panel,
|
|
108
127
|
tintOpacity: Math.min(brand.panelTheme.tintOpacity ?? 0.28, 0.72)
|
|
109
128
|
})}
|
|
110
129
|
data-catalog-occurrence={occurrence}
|
|
@@ -115,29 +134,57 @@
|
|
|
115
134
|
data-catalog-geometry
|
|
116
135
|
data-spatial-element-id={spatialElement.id}
|
|
117
136
|
data-catalog-occurrence={occurrence}
|
|
137
|
+
style={interactive
|
|
138
|
+
? `--carousel-poster-x:${pose.x * 100}%;--carousel-poster-y:${pose.y * 100}%;--carousel-poster-width:${pose.size * modelFrameSize}px;--carousel-poster-opacity:${pose.opacity}`
|
|
139
|
+
: undefined}
|
|
118
140
|
>
|
|
119
|
-
<
|
|
141
|
+
<div data-carousel-fit-anchor aria-hidden="true"></div>
|
|
142
|
+
<a
|
|
143
|
+
use:mouseHover
|
|
144
|
+
use:catalogViewLink={{ spatialElementId: spatialElement.id, targetPresentation: spatialElement.targetPresentation }}
|
|
120
145
|
draggable="false"
|
|
121
146
|
class="spatial-element-target"
|
|
147
|
+
title={tooltip}
|
|
122
148
|
hidden={interactive && !pose.visible}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
149
|
+
href={href(spatialElement.href)}
|
|
150
|
+
role={interactive && !selected ? 'button' : undefined}
|
|
151
|
+
aria-label={interactive && !selected ? `Select ${tooltip}` : `More information: ${tooltip}`}
|
|
152
|
+
aria-pressed={interactive && !selected ? false : undefined}
|
|
153
|
+
aria-busy={selected && busy || undefined}
|
|
154
|
+
data-catalog-focus-key={`catalog-geometry:${occurrence}`}
|
|
155
|
+
onpointerenter={() => { if (selected) prepare(spatialElement); }}
|
|
156
|
+
onfocus={() => { if (selected) prepare(spatialElement); }}
|
|
157
|
+
onpointerdown={() => { if (selected) prepare(spatialElement); }}
|
|
158
|
+
onkeydown={(event) => {
|
|
159
|
+
if (interactive && !selected && event.key === ' ') {
|
|
160
|
+
event.preventDefault();
|
|
161
|
+
event.currentTarget.click();
|
|
162
|
+
}
|
|
163
|
+
}}
|
|
164
|
+
onclick={(event) => {
|
|
165
|
+
if (!canActivate()) { event.preventDefault(); return; }
|
|
166
|
+
if (interactive && !selected) { event.preventDefault(); onselect(); return; }
|
|
167
|
+
activate(event);
|
|
168
|
+
}}
|
|
169
|
+
style:z-index={interactive ? Math.max(1, Math.round(1200 / (1 + Math.max(0, -pose.depth) / 1000))) : undefined}
|
|
129
170
|
>
|
|
130
|
-
{#if spatialElement.
|
|
171
|
+
{#if !spatialElement.fallbackImage}<span>{spatialElement.eyebrow}</span>{/if}
|
|
172
|
+
</a>
|
|
173
|
+
{#if spatialElement.fallbackImage}<img
|
|
174
|
+
hidden={interactive && !pose.visible}
|
|
175
|
+
class="spatial-element-poster"
|
|
131
176
|
draggable="false"
|
|
132
|
-
src={spatialElement.
|
|
177
|
+
src={spatialElement.fallbackImage}
|
|
133
178
|
alt={`${brand.name} ${spatialElement.title}`}
|
|
179
|
+
style:--carousel-depth-blur={interactive && pose.blur ? `blur(${pose.blur}px)` : 'blur(0px)'}
|
|
134
180
|
width="320"
|
|
135
181
|
height="320"
|
|
136
|
-
/>{
|
|
137
|
-
</button>
|
|
182
|
+
/>{/if}
|
|
138
183
|
</div>
|
|
139
184
|
<div
|
|
140
185
|
class="summary"
|
|
186
|
+
class:has-eyebrow={Boolean(spatialElement.eyebrow)}
|
|
187
|
+
style:--summary-content-inset={`${contentInset}px`}
|
|
141
188
|
hidden={interactive && pose.panelOpacity < 0.001}
|
|
142
189
|
inert={interactive && !selected}
|
|
143
190
|
aria-hidden={interactive && !selected}
|
|
@@ -153,114 +200,76 @@
|
|
|
153
200
|
100 +
|
|
154
201
|
'%'}
|
|
155
202
|
style:--carousel-panel-blur={(brand.panelTheme.backdropBlur ?? 5) + 'px'}
|
|
156
|
-
style:--carousel-
|
|
203
|
+
style:--carousel-focus-blur={interactive && pose.panelOpacity < 1 ? `blur(${(1 - pose.panelOpacity) * 6}px)` : 'none'}
|
|
204
|
+
style:--carousel-panel-radius={radii.panel + 'px'}
|
|
157
205
|
use:catalogEndpoint={address('summary-surface')}
|
|
158
206
|
>
|
|
159
|
-
<
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
data-catalog-semantic={JSON.stringify(
|
|
165
|
-
spatialElement.summary?.features ?? spatialElement.features.map((label) => ({ label }))
|
|
166
|
-
)}
|
|
167
|
-
>
|
|
168
|
-
{#each spatialElement.summary?.features ?? spatialElement.features.map( (label) => ({ label }) ) as feature, index (index)}<li
|
|
169
|
-
>
|
|
170
|
-
{feature.label}
|
|
171
|
-
</li>{/each}
|
|
172
|
-
</ul>
|
|
173
|
-
{#if spatialElement.summary?.action}
|
|
174
|
-
{@const action = spatialElement.summary.action}
|
|
175
|
-
{#if action.href}<a
|
|
176
|
-
use:catalogEndpoint={address('primary-action')}
|
|
177
|
-
data-catalog-rich-shared="primary-action"
|
|
178
|
-
data-catalog-semantic={catalogActionSemantic(action)}
|
|
179
|
-
class="action"
|
|
180
|
-
href={action.href}
|
|
181
|
-
rel="external"
|
|
182
|
-
aria-label={action.ariaLabel}>{action.label}</a
|
|
183
|
-
>
|
|
184
|
-
{:else}<button
|
|
185
|
-
class="action"
|
|
186
|
-
aria-label={action.ariaLabel}
|
|
187
|
-
use:catalogEndpoint={address('primary-action')}
|
|
188
|
-
data-catalog-rich-shared="primary-action"
|
|
189
|
-
data-catalog-semantic={catalogActionSemantic(action)}>{action.label}</button
|
|
190
|
-
>{/if}
|
|
191
|
-
{/if}
|
|
192
|
-
<a
|
|
193
|
-
data-catalog-focus-key={`catalog:${JSON.stringify([brand.id, spatialElement.id, occurrence, 'carousel.front'])}`}
|
|
194
|
-
aria-busy={busy || undefined}
|
|
195
|
-
onclick={(event) => {
|
|
196
|
-
endpoints?.prefer(brand.id, spatialElement.id, occurrence, 'carousel.front');
|
|
197
|
-
sections?.activate({
|
|
198
|
-
brandId: brand.id,
|
|
199
|
-
spatialElementId: spatialElement.id,
|
|
200
|
-
occurrence,
|
|
201
|
-
slot: 'carousel.front'
|
|
202
|
-
});
|
|
203
|
-
event.currentTarget.focus({ preventScroll: true });
|
|
204
|
-
}}
|
|
205
|
-
class="information"
|
|
206
|
-
href={href(spatialElement.href)}
|
|
207
|
-
onpointerenter={() => prepare(spatialElement)}
|
|
208
|
-
onfocus={() => prepare(spatialElement)}
|
|
209
|
-
onpointerdown={() => prepare(spatialElement)}
|
|
210
|
-
>More information<span class="sr-only">: {spatialElement.title}</span></a
|
|
211
|
-
>
|
|
212
|
-
{#if spatialElement.summary?.sectionLink}
|
|
213
|
-
<a
|
|
214
|
-
class="information"
|
|
215
|
-
href={href(spatialElement.summary.sectionLink.href)}
|
|
216
|
-
onclick={activate}
|
|
217
|
-
data-catalog-focus-key={`catalog-section:${occurrence}`}
|
|
218
|
-
>{spatialElement.summary.sectionLink.label}</a
|
|
219
|
-
>
|
|
220
|
-
{/if}
|
|
207
|
+
<SpatialSummarySlot instanceKey={`carousel:${brand.id}:${occurrence}`}
|
|
208
|
+
context={{ spatialElement: { id: spatialElement.id, brandId: brand.id, eyebrow: spatialElement.eyebrow, title: spatialElement.title,
|
|
209
|
+
features: spatialElement.summary?.features ?? spatialElement.features.map((label) => ({ label })), action: spatialElement.summary?.action },
|
|
210
|
+
contentInset, heading: 'h3', mode: 'carousel', address,
|
|
211
|
+
carousel: { item: spatialElement, occurrence, compact } }} />
|
|
221
212
|
</div>
|
|
222
213
|
</article>
|
|
223
214
|
|
|
224
215
|
<style>
|
|
225
216
|
.carousel-spatial-element {
|
|
226
|
-
display:
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
217
|
+
display: block;
|
|
218
|
+
position: relative;
|
|
219
|
+
min-width: 0;
|
|
220
|
+
height: calc(var(--spatial-carousel-title-reserve) + var(--spatial-carousel-fit-height));
|
|
221
|
+
min-height: 0;
|
|
222
|
+
padding: 0;
|
|
223
|
+
box-sizing: border-box;
|
|
224
|
+
scroll-snap-align: start;
|
|
225
|
+
scroll-snap-stop: always;
|
|
226
|
+
scroll-margin-top: 100px;
|
|
231
227
|
}
|
|
232
228
|
.interactive {
|
|
233
|
-
|
|
234
|
-
inset: 0;
|
|
229
|
+
grid-area: 1 / 1;
|
|
235
230
|
pointer-events: none;
|
|
236
231
|
}
|
|
237
232
|
.spatial-element-visual {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
display:
|
|
233
|
+
position: absolute;
|
|
234
|
+
inset: 0;
|
|
235
|
+
display: block;
|
|
241
236
|
place-items: center;
|
|
242
|
-
touch-action:
|
|
237
|
+
touch-action: manipulation;
|
|
243
238
|
}
|
|
244
|
-
.interactive {
|
|
245
|
-
|
|
246
|
-
|
|
239
|
+
.interactive .spatial-element-visual {
|
|
240
|
+
/* The native rail owns horizontal panning; vertical page scroll and zoom stay native. */
|
|
241
|
+
touch-action: manipulation;
|
|
247
242
|
}
|
|
248
243
|
.interactive[hidden] {
|
|
249
244
|
/* Keep known summary dimensions measurable without painting or registering GPU actors. */
|
|
250
|
-
display:
|
|
245
|
+
display: grid;
|
|
251
246
|
visibility: hidden;
|
|
252
247
|
}
|
|
253
248
|
.interactive .summary {
|
|
254
|
-
position: absolute;
|
|
255
|
-
left: 0;
|
|
256
|
-
top: 0;
|
|
257
|
-
width: 40%;
|
|
258
|
-
box-sizing: border-box;
|
|
259
249
|
z-index: 1400;
|
|
260
250
|
transform-origin: 0 0;
|
|
261
|
-
|
|
251
|
+
}
|
|
252
|
+
/* Keep only the selected source's compositing layers ready before navigation.
|
|
253
|
+
* Promoting its rounded/frosted surface at the click can compile a new browser
|
|
254
|
+
* raster shader during motion even when all WebGPU passes are already warm. */
|
|
255
|
+
.interactive.selected .summary,
|
|
256
|
+
.interactive.selected .summary :global(.spatial-summary-island) {
|
|
257
|
+
will-change: transform;
|
|
258
|
+
}
|
|
259
|
+
.spatial-element-target,
|
|
260
|
+
.spatial-element-poster {
|
|
261
|
+
position: absolute;
|
|
262
|
+
left: var(--carousel-poster-x, calc(var(--spatial-carousel-fit-left) + var(--spatial-carousel-fit-width) / 2));
|
|
263
|
+
top: var(--carousel-poster-y, calc(var(--spatial-carousel-title-reserve) + var(--spatial-carousel-fit-height) / 2));
|
|
264
|
+
width: var(--carousel-poster-width, calc(min(var(--spatial-carousel-fit-width), var(--spatial-carousel-fit-height)) * 0.82));
|
|
265
|
+
max-width: none;
|
|
266
|
+
transform: translate(-50%, -50%);
|
|
267
|
+
aspect-ratio: 1;
|
|
262
268
|
}
|
|
263
269
|
.spatial-element-target {
|
|
270
|
+
display: block;
|
|
271
|
+
color: inherit;
|
|
272
|
+
text-decoration: none;
|
|
264
273
|
border: none;
|
|
265
274
|
background: transparent;
|
|
266
275
|
cursor: pointer;
|
|
@@ -268,121 +277,65 @@
|
|
|
268
277
|
padding: 0;
|
|
269
278
|
aspect-ratio: 1;
|
|
270
279
|
}
|
|
271
|
-
.interactive .spatial-element-target {
|
|
272
|
-
position: absolute;
|
|
273
|
-
transform: translate(-50%, -50%);
|
|
274
|
-
}
|
|
275
280
|
.spatial-element-target[hidden] {
|
|
276
281
|
display: none;
|
|
277
282
|
}
|
|
278
283
|
.spatial-element-target:focus-visible {
|
|
279
284
|
outline: 2px solid var(--spatial-element-accent);
|
|
280
285
|
outline-offset: 4px;
|
|
281
|
-
border-radius:
|
|
286
|
+
border-radius: var(--spatial-element-control-radius);
|
|
287
|
+
}
|
|
288
|
+
/* Enhanced geometry already has a silhouette focus outline in the renderer. */
|
|
289
|
+
.interactive:global([data-catalog-model-ready]) .spatial-element-target:focus-visible {
|
|
290
|
+
outline: none;
|
|
282
291
|
}
|
|
283
292
|
img {
|
|
284
|
-
|
|
285
|
-
height:
|
|
293
|
+
opacity: var(--carousel-poster-opacity, 1);
|
|
294
|
+
height: auto;
|
|
295
|
+
pointer-events: none;
|
|
286
296
|
object-fit: contain;
|
|
297
|
+
filter: var(--carousel-hover-blur, var(--carousel-depth-blur, blur(0px))) var(--carousel-hover-shadow, drop-shadow(0 0 0 transparent));
|
|
298
|
+
transition: filter 180ms ease, opacity 240ms ease;
|
|
287
299
|
}
|
|
288
|
-
.
|
|
300
|
+
.spatial-element-target:global([data-mouse-hover]) + img,
|
|
301
|
+
.spatial-element-target:focus-visible + img {
|
|
302
|
+
--carousel-hover-blur: blur(0px);
|
|
303
|
+
--carousel-hover-shadow: drop-shadow(0 0 3px var(--spatial-element-accent));
|
|
304
|
+
}
|
|
305
|
+
.interactive:global([data-catalog-model-ready]) img {
|
|
289
306
|
opacity: 0;
|
|
307
|
+
/* The GPU replaces the poster in this frame. Fading it would draw a second
|
|
308
|
+
product beneath the moving model when a return transition releases it. */
|
|
309
|
+
transition: filter 180ms ease;
|
|
290
310
|
}
|
|
291
311
|
.summary {
|
|
292
|
-
position:
|
|
312
|
+
position: absolute;
|
|
313
|
+
left: var(--spatial-carousel-summary-left);
|
|
314
|
+
top: calc(var(--spatial-carousel-title-reserve) - var(--spatial-carousel-compact-height));
|
|
315
|
+
width: var(--spatial-carousel-summary-width);
|
|
316
|
+
height: var(--spatial-carousel-compact-height);
|
|
317
|
+
min-height: 0;
|
|
318
|
+
margin: 0;
|
|
319
|
+
--spatial-carousel-compact-height: 40px;
|
|
320
|
+
box-sizing: border-box;
|
|
321
|
+
filter: var(--carousel-focus-blur, none);
|
|
293
322
|
|
|
294
323
|
border-radius: var(--carousel-panel-radius, 14px);
|
|
295
|
-
padding:
|
|
324
|
+
padding: 0;
|
|
296
325
|
|
|
297
|
-
color: var(--spatial-element-ink);
|
|
326
|
+
color: color-mix(in srgb, var(--spatial-element-ink) 92%, transparent);
|
|
298
327
|
pointer-events: auto;
|
|
299
328
|
}
|
|
300
|
-
.summary::before {
|
|
301
|
-
content: '';
|
|
302
|
-
position: absolute;
|
|
303
|
-
inset: 0;
|
|
304
|
-
border-radius: inherit;
|
|
305
|
-
background: color-mix(
|
|
306
|
-
in srgb,
|
|
307
|
-
var(--carousel-panel-tint, white) var(--carousel-panel-tint-opacity, 65%),
|
|
308
|
-
transparent
|
|
309
|
-
);
|
|
310
|
-
border: 1px solid color-mix(in srgb, var(--spatial-element-accent) 12%, transparent);
|
|
311
|
-
backdrop-filter: blur(var(--carousel-panel-blur, 5px));
|
|
312
|
-
box-shadow: var(--carousel-panel-shadow);
|
|
313
|
-
opacity: var(--carousel-panel-opacity, 1);
|
|
314
|
-
pointer-events: none;
|
|
315
|
-
}
|
|
316
|
-
.summary > :global(*) {
|
|
317
|
-
position: relative;
|
|
318
|
-
opacity: var(--carousel-panel-opacity, 1);
|
|
319
|
-
}
|
|
320
|
-
:global([data-carousel-glass-ready]) .summary::before {
|
|
321
|
-
visibility: hidden;
|
|
322
|
-
}
|
|
323
329
|
.summary[hidden] {
|
|
324
330
|
display: block;
|
|
325
331
|
visibility: hidden;
|
|
326
332
|
}
|
|
327
|
-
.eyebrow {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
h3 {
|
|
332
|
-
font-size: clamp(24px, 2.5vw, 36px);
|
|
333
|
-
line-height: 1.15;
|
|
334
|
-
margin: 12px 0 28px;
|
|
335
|
-
}
|
|
336
|
-
ul {
|
|
337
|
-
padding-left: 20px;
|
|
338
|
-
line-height: 1.6;
|
|
339
|
-
}
|
|
340
|
-
li {
|
|
341
|
-
margin: 12px 0;
|
|
342
|
-
}
|
|
343
|
-
.action {
|
|
344
|
-
display: block;
|
|
345
|
-
width: 100%;
|
|
346
|
-
box-sizing: border-box;
|
|
347
|
-
padding: 14px;
|
|
348
|
-
margin-top: 24px;
|
|
349
|
-
border: 0;
|
|
350
|
-
border-radius: 8px;
|
|
351
|
-
background: var(--spatial-element-accent);
|
|
352
|
-
color: white;
|
|
353
|
-
text-align: center;
|
|
354
|
-
text-decoration: none;
|
|
355
|
-
font: inherit;
|
|
356
|
-
font-weight: 650;
|
|
357
|
-
}
|
|
358
|
-
.information {
|
|
359
|
-
display: inline-block;
|
|
360
|
-
margin-top: 20px;
|
|
361
|
-
color: var(--spatial-element-accent);
|
|
362
|
-
}
|
|
363
|
-
.information[aria-busy='true'] {
|
|
364
|
-
opacity: 0.55;
|
|
365
|
-
cursor: progress;
|
|
366
|
-
}
|
|
367
|
-
.sr-only {
|
|
368
|
-
position: absolute;
|
|
369
|
-
width: 1px;
|
|
370
|
-
height: 1px;
|
|
371
|
-
padding: 0;
|
|
372
|
-
margin: -1px;
|
|
373
|
-
overflow: hidden;
|
|
374
|
-
clip-path: inset(50%);
|
|
375
|
-
white-space: nowrap;
|
|
376
|
-
}
|
|
377
|
-
@container (max-width: 700px) {
|
|
378
|
-
.interactive .summary {
|
|
379
|
-
width: 92%;
|
|
380
|
-
}
|
|
333
|
+
.has-eyebrow { --spatial-carousel-compact-height: 66px; }
|
|
334
|
+
[data-carousel-fit-anchor] { position: absolute; left: var(--spatial-carousel-fit-left); top: var(--spatial-carousel-title-reserve); width: var(--spatial-carousel-fit-width); height: var(--spatial-carousel-fit-height); pointer-events: none; }
|
|
335
|
+
@media (min-width: 840px) {
|
|
336
|
+
.summary { top: calc(var(--spatial-carousel-fit-height) / 2); height: auto; max-height: var(--spatial-carousel-fit-height); padding: 0; transform: translateY(-50%); }
|
|
381
337
|
}
|
|
382
|
-
@media (
|
|
383
|
-
|
|
384
|
-
grid-template-columns: 1fr;
|
|
385
|
-
gap: 12px;
|
|
386
|
-
}
|
|
338
|
+
@media (prefers-reduced-motion: reduce) {
|
|
339
|
+
img { transition: none; }
|
|
387
340
|
}
|
|
388
341
|
</style>
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
|
|
2
|
-
import type { CarouselPresentation } from '@spatial-elements/core/catalog/catalogPose';
|
|
2
|
+
import type { CarouselLayout, CarouselPresentation, CarouselEmphasis } from '@spatial-elements/core/catalog/catalogPose';
|
|
3
3
|
type $$ComponentProps = {
|
|
4
4
|
spatialElement: SpatialListItem;
|
|
5
5
|
sectionId: string;
|
|
6
6
|
presentation?: CarouselPresentation;
|
|
7
|
+
layout: CarouselLayout;
|
|
7
8
|
index: number;
|
|
8
9
|
count: number;
|
|
9
10
|
phase: number;
|
|
11
|
+
emphasis?: CarouselEmphasis;
|
|
12
|
+
focus: number;
|
|
10
13
|
windowPhase: number;
|
|
11
14
|
selected: boolean;
|
|
12
15
|
interactive: boolean;
|
|
13
16
|
onselect: () => void;
|
|
17
|
+
canActivate: () => boolean;
|
|
14
18
|
};
|
|
15
19
|
declare const CarouselSpatialElement: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
16
20
|
type CarouselSpatialElement = ReturnType<typeof CarouselSpatialElement>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ContentBlock as Shared } from '@page-sections/svelte';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
let { children, class: className = '', ...rest }: Omit<HTMLAttributes<HTMLDivElement>, 'children'> & { children?: Snippet; span?: import('@page-sections/core').ContentSpan; } = $props();
|
|
6
|
+
</script>
|
|
7
|
+
<Shared {...rest} class={['spatial-content-block', className].join(' ')}>{@render children?.()}</Shared>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
type $$ComponentProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
span?: import('@page-sections/core').ContentSpan;
|
|
6
|
+
};
|
|
7
|
+
declare const ContentBlock: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type ContentBlock = ReturnType<typeof ContentBlock>;
|
|
9
|
+
export default ContentBlock;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ContentGrid as Shared } from '@page-sections/svelte';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
let { children, class: className = '', ...rest }: Omit<HTMLAttributes<HTMLDivElement>, 'children'> & { children?: Snippet; } = $props();
|
|
6
|
+
</script>
|
|
7
|
+
<Shared {...rest} class={['spatial-content-grid spatial-grid-scope ps-grid-scope', className].join(' ')}>{@render children?.()}</Shared>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
type $$ComponentProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
};
|
|
6
|
+
declare const ContentGrid: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type ContentGrid = ReturnType<typeof ContentGrid>;
|
|
8
|
+
export default ContentGrid;
|
|
@@ -1,68 +1,64 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { setContext } from 'svelte';
|
|
2
|
+
import { setContext, onMount } from 'svelte';
|
|
3
|
+
import { attachContentSidebars } from './contentSidebars.js';
|
|
4
|
+
import { ContentPage as PageContent } from '@page-sections/svelte';
|
|
3
5
|
import type { Snippet } from 'svelte';
|
|
4
6
|
import type { ContentPageData } from '@spatial-elements/core/spatial-element/types';
|
|
5
7
|
import { useSpatialTheme } from './brandContext.js';
|
|
6
|
-
import
|
|
8
|
+
import { registerSpatialPage } from './spatialPageContext.js';
|
|
9
|
+
import './layout.generated.css';
|
|
7
10
|
import {
|
|
8
|
-
SPATIAL_ELEMENT_SECTION_REGISTRY_KEY,
|
|
9
|
-
SpatialElementSectionRegistry,
|
|
10
11
|
SECTION_PAGE_KIND
|
|
11
12
|
} from '@spatial-elements/core/spatial-element/spatialElementSectionRegistry';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
interface Props {
|
|
14
|
+
/** Explicit HDR used to light this page's shared 3D scene; never inferred from an element. */
|
|
15
|
+
hdr: string;
|
|
16
|
+
/** Category metadata. Only title is required; pageTitle defaults to title. */
|
|
17
|
+
page: ContentPageData;
|
|
18
|
+
/** Flat page color override, using the same color format as SpatialTheme.background. */
|
|
19
|
+
background?: string;
|
|
20
|
+
/** SpatialCardGridSection, SpatialCarouselSection and ordinary Section children. */
|
|
21
|
+
children?: Snippet;
|
|
22
|
+
leftSidebar?: Snippet;
|
|
23
|
+
footer?: Snippet;
|
|
24
|
+
showContentMenu?: boolean;
|
|
25
|
+
contentMenuLabel?: string;
|
|
26
|
+
}
|
|
27
|
+
let { page, hdr, background, children, leftSidebar, footer, showContentMenu = false, contentMenuLabel }: Props = $props();
|
|
28
|
+
const backgroundId = $props.id();
|
|
29
|
+
const backgroundScope = backgroundId.replace(/[^a-zA-Z0-9_-]/g, '_');
|
|
30
|
+
onMount(() => {
|
|
31
|
+
const host = document.querySelector<HTMLElement>(`[data-spatial-content-page="${backgroundScope}"]`);
|
|
32
|
+
if (host) return attachContentSidebars(host);
|
|
33
|
+
});
|
|
34
|
+
const backgroundRules = $derived.by(() => {
|
|
35
|
+
if (!background) return '';
|
|
36
|
+
if (/[;{}<>]/.test(background)) throw new Error('ContentPage.background must be a color value.');
|
|
37
|
+
// A child page cannot inherit a custom property upwards. This page-scoped rule
|
|
38
|
+
// supplies the native SSR surface before the browser registers GPU ownership.
|
|
39
|
+
return `.stage:has([data-spatial-page-background="${backgroundScope}"]) { --stage-page-background: ${background} !important; }`;
|
|
40
|
+
});
|
|
41
|
+
const readTheme = useSpatialTheme();
|
|
42
|
+
const brand = $derived(readTheme());
|
|
43
|
+
registerSpatialPage(() => ({ kind: 'content', hdr, background }));
|
|
15
44
|
setContext(SECTION_PAGE_KIND, 'content');
|
|
16
45
|
</script>
|
|
17
46
|
|
|
18
|
-
<svelte:
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/>{/if}
|
|
24
|
-
<header data-stage-dom-content data-catalog-transition-dom="exit">
|
|
25
|
-
{#if page.eyebrow}<p class="eyebrow">{page.eyebrow}</p>{/if}
|
|
26
|
-
<h1 id="catalog-title" tabindex="-1">{page.title}</h1>
|
|
27
|
-
{#if page.intro}<p class="intro">{page.intro}</p>{/if}
|
|
28
|
-
</header>
|
|
29
|
-
{@render children?.()}
|
|
30
|
-
</main>
|
|
47
|
+
{#if background}<svelte:element this={'style'}>{backgroundRules}</svelte:element>{/if}
|
|
48
|
+
<PageContent {page} {leftSidebar} {footer} {showContentMenu} {contentMenuLabel} class="content-page" data-catalog-list data-brand-id={brand.id}
|
|
49
|
+
data-spatial-content-page={backgroundScope} data-spatial-page-background={background ? backgroundScope : undefined}>
|
|
50
|
+
{@render children?.()}
|
|
51
|
+
</PageContent>
|
|
31
52
|
|
|
32
53
|
<style>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
.eyebrow {
|
|
44
|
-
margin: 0;
|
|
45
|
-
color: var(--spatial-element-accent);
|
|
46
|
-
font-size: 13px;
|
|
47
|
-
font-weight: 720;
|
|
48
|
-
text-transform: uppercase;
|
|
49
|
-
}
|
|
50
|
-
h1 {
|
|
51
|
-
margin: 10px 0 14px;
|
|
52
|
-
color: var(--spatial-element-ink);
|
|
53
|
-
font-size: clamp(30px, 3.4vw, 46px);
|
|
54
|
-
line-height: 1.1;
|
|
55
|
-
}
|
|
56
|
-
.intro {
|
|
57
|
-
max-width: 64ch;
|
|
58
|
-
margin: 0;
|
|
59
|
-
color: var(--spatial-element-body);
|
|
60
|
-
font-size: 17px;
|
|
61
|
-
line-height: 1.6;
|
|
62
|
-
}
|
|
63
|
-
@media (max-width: 900px) {
|
|
64
|
-
.content-page {
|
|
65
|
-
width: calc(100vw - 40px);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
54
|
+
:global(.content-page [data-spatial-sticky-sidebar]) { position: relative !important; top: 0 !important; }
|
|
55
|
+
/* The shared stage leaves its DOM layer transparent to model interaction.
|
|
56
|
+
* Ordinary Page Sections and navigation still need native hit targets. */
|
|
57
|
+
:global(.content-page .ps-section),
|
|
58
|
+
:global(.content-page .ps-left-sidebar),
|
|
59
|
+
:global(.content-page .ps-content-menu-slot),
|
|
60
|
+
:global(.content-page .breadcrumbs),
|
|
61
|
+
:global(.content-page nav) {
|
|
62
|
+
pointer-events: auto;
|
|
63
|
+
}
|
|
68
64
|
</style>
|