@spatial-elements/sveltekit 0.1.0-beta.1
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/LICENSE +373 -0
- package/README.md +17 -0
- package/dist/catalog/ScrollNavigationBridge.svelte +394 -0
- package/dist/catalog/ScrollNavigationBridge.svelte.d.ts +13 -0
- package/dist/catalog/catalogEndpointAction.d.ts +6 -0
- package/dist/catalog/catalogEndpointAction.js +18 -0
- package/dist/catalog/catalogNavigation.d.ts +7 -0
- package/dist/catalog/catalogNavigation.js +19 -0
- package/dist/catalog/catalogTransition.css +59 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/spatial-element/BrandStageShell.svelte +106 -0
- package/dist/spatial-element/BrandStageShell.svelte.d.ts +12 -0
- package/dist/spatial-element/CarouselSection.svelte +350 -0
- package/dist/spatial-element/CarouselSection.svelte.d.ts +15 -0
- package/dist/spatial-element/CarouselSpatialElement.svelte +388 -0
- package/dist/spatial-element/CarouselSpatialElement.svelte.d.ts +17 -0
- package/dist/spatial-element/ContentPage.svelte +68 -0
- package/dist/spatial-element/ContentPage.svelte.d.ts +9 -0
- package/dist/spatial-element/ListSection.svelte +30 -0
- package/dist/spatial-element/ListSection.svelte.d.ts +8 -0
- package/dist/spatial-element/Section.svelte +191 -0
- package/dist/spatial-element/Section.svelte.d.ts +14 -0
- package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +69 -0
- package/dist/spatial-element/SpatialElementBreadcrumbs.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialElementCard.svelte +256 -0
- package/dist/spatial-element/SpatialElementCard.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialElementMediaRail.svelte +144 -0
- package/dist/spatial-element/SpatialElementMediaRail.svelte.d.ts +7 -0
- package/dist/spatial-element/SpatialElementPage.svelte +249 -0
- package/dist/spatial-element/SpatialElementPage.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialElementStickyHeader.svelte +351 -0
- package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte +423 -0
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte.d.ts +7 -0
- package/dist/spatial-element/SpatialElementTabList.svelte +266 -0
- package/dist/spatial-element/SpatialElementTabList.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialElementTabs.svelte +123 -0
- package/dist/spatial-element/SpatialElementTabs.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialListPage.svelte +23 -0
- package/dist/spatial-element/SpatialListPage.svelte.d.ts +11 -0
- package/dist/spatial-element/brandContext.d.ts +5 -0
- package/dist/spatial-element/brandContext.js +14 -0
- package/dist/spatial-element/index.d.ts +11 -0
- package/dist/spatial-element/index.js +8 -0
- package/dist/stage/Panel.svelte +355 -0
- package/dist/stage/Panel.svelte.d.ts +24 -0
- package/dist/stage/Stage.svelte +747 -0
- package/dist/stage/Stage.svelte.d.ts +22 -0
- package/dist/stage/StageViewport.svelte +73 -0
- package/dist/stage/StageViewport.svelte.d.ts +13 -0
- package/package.json +55 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getContext, onMount, setContext } from 'svelte';
|
|
3
|
+
import {
|
|
4
|
+
CATALOG_ENDPOINTS,
|
|
5
|
+
type CatalogEndpointRegistry
|
|
6
|
+
} from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
|
|
7
|
+
import type { Snippet } from 'svelte';
|
|
8
|
+
import StageViewport from '../stage/StageViewport.svelte';
|
|
9
|
+
import {
|
|
10
|
+
STAGE_ANCHOR_NAVIGATION_END_EVENT,
|
|
11
|
+
STAGE_ANCHOR_NAVIGATION_EVENT,
|
|
12
|
+
type StageAnchorNavigationDetail
|
|
13
|
+
} from '@spatial-elements/core/stage/scrollAnimation';
|
|
14
|
+
import { STAGE_SCROLL_PRIORITY, subscribeStageScrollFrame } from '@spatial-elements/core/stage/scrollFrame';
|
|
15
|
+
import SpatialElementBreadcrumbs from './SpatialElementBreadcrumbs.svelte';
|
|
16
|
+
import { useSpatialTheme } from './brandContext.js';
|
|
17
|
+
import SpatialElementMediaRail from './SpatialElementMediaRail.svelte';
|
|
18
|
+
import SpatialElementSummaryPanel from './SpatialElementSummaryPanel.svelte';
|
|
19
|
+
import SpatialElementStickyHeader from './SpatialElementStickyHeader.svelte';
|
|
20
|
+
import SpatialElementTabs from './SpatialElementTabs.svelte';
|
|
21
|
+
import { SpatialElementDockController } from '@spatial-elements/core/spatial-element/SpatialElementDockController';
|
|
22
|
+
import { SPATIAL_ELEMENT_SECTION_REGISTRY_KEY, SpatialElementSectionRegistry } from '@spatial-elements/core/spatial-element/spatialElementSectionRegistry';
|
|
23
|
+
import type { SpatialElementData, SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
|
|
24
|
+
|
|
25
|
+
const SPATIAL_ELEMENT_OVERVIEW_SECTION = {
|
|
26
|
+
id: 'overview',
|
|
27
|
+
title: 'Übersicht'
|
|
28
|
+
} satisfies SpatialElementSectionNavigationItem;
|
|
29
|
+
// Switch while the next panel enters the upper reading area, before it reaches the sticky tabs.
|
|
30
|
+
const SPATIAL_ELEMENT_SECTION_ACTIVATION_VIEWPORT_RATIO = 0.25;
|
|
31
|
+
|
|
32
|
+
let { spatialElement, children }: { spatialElement: SpatialElementData; children?: Snippet } = $props();
|
|
33
|
+
const brand = useSpatialTheme();
|
|
34
|
+
const endpoints = getContext<CatalogEndpointRegistry | undefined>(CATALOG_ENDPOINTS);
|
|
35
|
+
let sections = $state<SpatialElementSectionNavigationItem[]>([]);
|
|
36
|
+
let activeSectionId = $state<string | undefined>(SPATIAL_ELEMENT_OVERVIEW_SECTION.id);
|
|
37
|
+
let mainElement: HTMLElement;
|
|
38
|
+
let navigationTargetId: string | undefined;
|
|
39
|
+
let scrollSpyFrame = 0;
|
|
40
|
+
const navigationSections = $derived([SPATIAL_ELEMENT_OVERVIEW_SECTION, ...sections]);
|
|
41
|
+
|
|
42
|
+
const sectionRegistry = new SpatialElementSectionRegistry((nextSections) => {
|
|
43
|
+
sections = nextSections;
|
|
44
|
+
});
|
|
45
|
+
setContext(SPATIAL_ELEMENT_SECTION_REGISTRY_KEY, sectionRegistry);
|
|
46
|
+
|
|
47
|
+
$effect(() => {
|
|
48
|
+
if (!navigationSections.some(({ id }) => id === activeSectionId)) {
|
|
49
|
+
activeSectionId = SPATIAL_ELEMENT_OVERVIEW_SECTION.id;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
function updateActiveSection() {
|
|
54
|
+
if (navigationTargetId || !mainElement?.isConnected) return;
|
|
55
|
+
const offset =
|
|
56
|
+
Number.parseFloat(
|
|
57
|
+
getComputedStyle(mainElement).getPropertyValue('--spatial-element-section-scroll-offset')
|
|
58
|
+
) || 24;
|
|
59
|
+
const readingAreaHeight = Math.max(window.innerHeight - offset, 0);
|
|
60
|
+
const activationLine = offset + readingAreaHeight * SPATIAL_ELEMENT_SECTION_ACTIVATION_VIEWPORT_RATIO;
|
|
61
|
+
let nextActiveId = SPATIAL_ELEMENT_OVERVIEW_SECTION.id;
|
|
62
|
+
|
|
63
|
+
for (const section of sections) {
|
|
64
|
+
const element = document.getElementById(section.id);
|
|
65
|
+
if (!element || element.getBoundingClientRect().top > activationLine + 1) break;
|
|
66
|
+
nextActiveId = section.id;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (nextActiveId !== activeSectionId) activeSectionId = nextActiveId;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function handleSectionNavigation(sectionId: string) {
|
|
73
|
+
if (!navigationSections.some(({ id }) => id === sectionId)) return;
|
|
74
|
+
activeSectionId = sectionId;
|
|
75
|
+
navigationTargetId = sectionId;
|
|
76
|
+
mainElement.toggleAttribute('data-spatial-element-tab-navigation-active', true);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function completeSectionNavigation(sectionId: string) {
|
|
80
|
+
if (navigationTargetId !== sectionId) return;
|
|
81
|
+
navigationTargetId = undefined;
|
|
82
|
+
mainElement.removeAttribute('data-spatial-element-tab-navigation-active');
|
|
83
|
+
scheduleScrollSpy();
|
|
84
|
+
}
|
|
85
|
+
function scheduleScrollSpy() {
|
|
86
|
+
cancelAnimationFrame(scrollSpyFrame);
|
|
87
|
+
scrollSpyFrame = requestAnimationFrame(updateActiveSection);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
onMount(() => {
|
|
91
|
+
const dock = new SpatialElementDockController(mainElement);
|
|
92
|
+
dock.start();
|
|
93
|
+
const unregisterPresentation = endpoints?.registerPresentation(
|
|
94
|
+
{ brandId: brand.id, spatialElementId: spatialElement.id },
|
|
95
|
+
() => dock.getPresentation().composition
|
|
96
|
+
);
|
|
97
|
+
const handleAnchorNavigation = (event: Event) => {
|
|
98
|
+
handleSectionNavigation((event as CustomEvent<StageAnchorNavigationDetail>).detail.targetId);
|
|
99
|
+
};
|
|
100
|
+
const handleAnchorNavigationEnd = (event: Event) => {
|
|
101
|
+
completeSectionNavigation(
|
|
102
|
+
(event as CustomEvent<StageAnchorNavigationDetail>).detail.targetId
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
window.addEventListener(STAGE_ANCHOR_NAVIGATION_EVENT, handleAnchorNavigation);
|
|
106
|
+
window.addEventListener(STAGE_ANCHOR_NAVIGATION_END_EVENT, handleAnchorNavigationEnd);
|
|
107
|
+
|
|
108
|
+
const stopScrollSpy = subscribeStageScrollFrame(
|
|
109
|
+
updateActiveSection,
|
|
110
|
+
STAGE_SCROLL_PRIORITY.dock + 1
|
|
111
|
+
);
|
|
112
|
+
const updateAfterResize = scheduleScrollSpy;
|
|
113
|
+
window.addEventListener('resize', updateAfterResize, { passive: true });
|
|
114
|
+
scheduleScrollSpy();
|
|
115
|
+
|
|
116
|
+
return () => {
|
|
117
|
+
cancelAnimationFrame(scrollSpyFrame);
|
|
118
|
+
window.removeEventListener(STAGE_ANCHOR_NAVIGATION_EVENT, handleAnchorNavigation);
|
|
119
|
+
window.removeEventListener(STAGE_ANCHOR_NAVIGATION_END_EVENT, handleAnchorNavigationEnd);
|
|
120
|
+
stopScrollSpy();
|
|
121
|
+
window.removeEventListener('resize', updateAfterResize);
|
|
122
|
+
dock.destroy();
|
|
123
|
+
unregisterPresentation?.();
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<svelte:head>
|
|
129
|
+
<title>{spatialElement.pageTitle}</title>
|
|
130
|
+
</svelte:head>
|
|
131
|
+
|
|
132
|
+
<main
|
|
133
|
+
bind:this={mainElement}
|
|
134
|
+
class="spatial-element-main"
|
|
135
|
+
data-spatial-element-root
|
|
136
|
+
data-spatial-element-id={spatialElement.id}
|
|
137
|
+
data-brand-id={spatialElement.brandId}
|
|
138
|
+
>
|
|
139
|
+
<SpatialElementBreadcrumbs
|
|
140
|
+
items={spatialElement.breadcrumbs.map((item) => ({
|
|
141
|
+
...item,
|
|
142
|
+
href: item.href ?? `/${brand.id}/categories/list`
|
|
143
|
+
}))}
|
|
144
|
+
/>
|
|
145
|
+
<SpatialElementStickyHeader {activeSectionId} {spatialElement} sections={navigationSections} />
|
|
146
|
+
|
|
147
|
+
<section
|
|
148
|
+
id={SPATIAL_ELEMENT_OVERVIEW_SECTION.id}
|
|
149
|
+
class="spatial-element-hero"
|
|
150
|
+
data-spatial-element-tab-target
|
|
151
|
+
data-stage-scroll-top
|
|
152
|
+
aria-labelledby="spatial-element-title"
|
|
153
|
+
>
|
|
154
|
+
<SpatialElementMediaRail {spatialElement} />
|
|
155
|
+
|
|
156
|
+
<StageViewport
|
|
157
|
+
catalogEndpoint={{
|
|
158
|
+
brandId: brand.id,
|
|
159
|
+
spatialElementId: spatialElement.id,
|
|
160
|
+
slot: 'detail.hero',
|
|
161
|
+
role: 'geometry'
|
|
162
|
+
}}
|
|
163
|
+
class="spatial-element-visual"
|
|
164
|
+
data-catalog-geometry
|
|
165
|
+
data-spatial-element-id={spatialElement.id}
|
|
166
|
+
data-catalog-slot="detail.hero"
|
|
167
|
+
fallbackSrc={spatialElement.stage.fallbackImage}
|
|
168
|
+
fallbackAlt={`${brand.name} ${spatialElement.title}`}
|
|
169
|
+
aria-hidden={spatialElement.stage.fallbackImage ? undefined : 'true'}
|
|
170
|
+
/>
|
|
171
|
+
|
|
172
|
+
<SpatialElementSummaryPanel {spatialElement} />
|
|
173
|
+
</section>
|
|
174
|
+
|
|
175
|
+
<div class="spatial-element-content">
|
|
176
|
+
<div class="spatial-element-section-list" data-catalog-transition-dom="enter">
|
|
177
|
+
{@render children?.()}
|
|
178
|
+
</div>
|
|
179
|
+
<!-- Read after the section snippet has registered its metadata during SSR. -->
|
|
180
|
+
<SpatialElementTabs {activeSectionId} sections={[SPATIAL_ELEMENT_OVERVIEW_SECTION, ...sections]} />
|
|
181
|
+
</div>
|
|
182
|
+
</main>
|
|
183
|
+
|
|
184
|
+
<style>
|
|
185
|
+
.spatial-element-main {
|
|
186
|
+
--spatial-element-section-scroll-offset: 150px;
|
|
187
|
+
--spatial-element-hero-edge-gap: clamp(32px, 2.2vw, 42px);
|
|
188
|
+
|
|
189
|
+
width: min(1550px, calc(100vw - 120px), 100%);
|
|
190
|
+
margin: 0 auto;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.spatial-element-hero {
|
|
194
|
+
position: relative;
|
|
195
|
+
box-sizing: border-box;
|
|
196
|
+
display: grid;
|
|
197
|
+
grid-template-columns: minmax(420px, 1fr) minmax(360px, 494px);
|
|
198
|
+
gap: clamp(28px, 4vw, 70px);
|
|
199
|
+
align-items: start;
|
|
200
|
+
width: calc(100vw - var(--spatial-element-hero-edge-gap) - var(--spatial-element-hero-edge-gap));
|
|
201
|
+
min-height: clamp(610px, calc(100vh - 230px), 760px);
|
|
202
|
+
margin-left: calc(50% - 50vw + var(--spatial-element-hero-edge-gap));
|
|
203
|
+
padding-left: max(0px, calc(50vw - 50% - var(--spatial-element-hero-edge-gap)));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.spatial-element-content {
|
|
207
|
+
display: flex;
|
|
208
|
+
flex-direction: column;
|
|
209
|
+
width: calc(100vw - var(--spatial-element-content-inline-inset) - var(--spatial-element-content-inline-inset));
|
|
210
|
+
margin-left: calc(50% - 50vw + var(--spatial-element-content-inline-inset));
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.spatial-element-section-list {
|
|
214
|
+
order: 2;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.spatial-element-content :global(.spatial-element-tabs-anchor) {
|
|
218
|
+
order: 1;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.spatial-element-section-list :global(.content-section:first-child) {
|
|
222
|
+
margin-top: 8px;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
:global(.spatial-element-visual) {
|
|
226
|
+
min-height: clamp(540px, calc(100vh - 300px), 680px);
|
|
227
|
+
border-radius: 28px;
|
|
228
|
+
background: transparent;
|
|
229
|
+
pointer-events: none;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@media (max-width: 1100px) {
|
|
233
|
+
.spatial-element-main {
|
|
234
|
+
width: min(calc(100vw - 40px), 100%);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.spatial-element-content {
|
|
238
|
+
width: 100%;
|
|
239
|
+
margin-left: 0;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.spatial-element-hero {
|
|
243
|
+
grid-template-columns: 1fr;
|
|
244
|
+
width: 100%;
|
|
245
|
+
margin-left: 0;
|
|
246
|
+
padding-left: 0;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { SpatialElementData } from '@spatial-elements/core/spatial-element/types';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
spatialElement: SpatialElementData;
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
};
|
|
7
|
+
declare const SpatialElementPage: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type SpatialElementPage = ReturnType<typeof SpatialElementPage>;
|
|
9
|
+
export default SpatialElementPage;
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { catalogActionSemantic } from '@spatial-elements/core/catalog/catalogAction';
|
|
3
|
+
import { ShoppingCart } from 'lucide-svelte';
|
|
4
|
+
import SpatialElementTabList from './SpatialElementTabList.svelte';
|
|
5
|
+
import { createCatalogEndpointAction } from '../catalog/catalogEndpointAction.js';
|
|
6
|
+
const catalogEndpoint = createCatalogEndpointAction();
|
|
7
|
+
import type { SpatialElementData, SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
activeSectionId,
|
|
11
|
+
spatialElement,
|
|
12
|
+
sections
|
|
13
|
+
}: {
|
|
14
|
+
activeSectionId?: string;
|
|
15
|
+
spatialElement: SpatialElementData;
|
|
16
|
+
sections: SpatialElementSectionNavigationItem[];
|
|
17
|
+
} = $props();
|
|
18
|
+
|
|
19
|
+
function handleMinimapActionKeydown(event: KeyboardEvent) {
|
|
20
|
+
if (event.key !== ' ') return;
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
(event.currentTarget as HTMLAnchorElement).click();
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<header
|
|
27
|
+
class="spatial-element-sticky-header"
|
|
28
|
+
data-spatial-element-sticky-header
|
|
29
|
+
data-catalog-transition-dom="enter"
|
|
30
|
+
aria-label="Current element"
|
|
31
|
+
aria-hidden="true"
|
|
32
|
+
inert
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
class="sticky-header-summary-surface"
|
|
36
|
+
data-catalog-dock-surface
|
|
37
|
+
aria-hidden="true"
|
|
38
|
+
use:catalogEndpoint={{
|
|
39
|
+
brandId: spatialElement.brandId,
|
|
40
|
+
spatialElementId: spatialElement.id,
|
|
41
|
+
slot: 'detail.dock',
|
|
42
|
+
role: 'summary-surface'
|
|
43
|
+
}}
|
|
44
|
+
></div>
|
|
45
|
+
<a
|
|
46
|
+
class="sticky-header-minimap-action"
|
|
47
|
+
data-spatial-element-sticky-minimap-action
|
|
48
|
+
data-spatial-element-section-navigation
|
|
49
|
+
href="#overview"
|
|
50
|
+
aria-label="Zur Übersicht"
|
|
51
|
+
onkeydown={handleMinimapActionKeydown}
|
|
52
|
+
></a>
|
|
53
|
+
|
|
54
|
+
<div class="sticky-header-layout">
|
|
55
|
+
<div class="sticky-header-copy">
|
|
56
|
+
<p
|
|
57
|
+
class="sticky-header-kicker"
|
|
58
|
+
use:catalogEndpoint={{
|
|
59
|
+
brandId: spatialElement.brandId,
|
|
60
|
+
spatialElementId: spatialElement.id,
|
|
61
|
+
slot: 'detail.dock',
|
|
62
|
+
role: 'eyebrow'
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
{spatialElement.eyebrow}
|
|
66
|
+
</p>
|
|
67
|
+
<p
|
|
68
|
+
class="sticky-header-title"
|
|
69
|
+
use:catalogEndpoint={{
|
|
70
|
+
brandId: spatialElement.brandId,
|
|
71
|
+
spatialElementId: spatialElement.id,
|
|
72
|
+
slot: 'detail.dock',
|
|
73
|
+
role: 'title'
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
{spatialElement.title}
|
|
77
|
+
</p>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
{#if spatialElement.action.href}
|
|
81
|
+
<a
|
|
82
|
+
class="sticky-header-action"
|
|
83
|
+
use:catalogEndpoint={{
|
|
84
|
+
brandId: spatialElement.brandId,
|
|
85
|
+
spatialElementId: spatialElement.id,
|
|
86
|
+
slot: 'detail.dock',
|
|
87
|
+
role: 'primary-action'
|
|
88
|
+
}}
|
|
89
|
+
data-catalog-rich-shared="primary-action"
|
|
90
|
+
data-catalog-semantic={catalogActionSemantic(spatialElement.action)}
|
|
91
|
+
href={spatialElement.action.href}
|
|
92
|
+
rel="external"
|
|
93
|
+
aria-label={spatialElement.action.ariaLabel}
|
|
94
|
+
>
|
|
95
|
+
<ShoppingCart size={29} strokeWidth={2} aria-hidden="true" />
|
|
96
|
+
</a>
|
|
97
|
+
{:else}
|
|
98
|
+
<button
|
|
99
|
+
use:catalogEndpoint={{
|
|
100
|
+
brandId: spatialElement.brandId,
|
|
101
|
+
spatialElementId: spatialElement.id,
|
|
102
|
+
slot: 'detail.dock',
|
|
103
|
+
role: 'primary-action'
|
|
104
|
+
}}
|
|
105
|
+
data-catalog-rich-shared="primary-action"
|
|
106
|
+
data-catalog-semantic={catalogActionSemantic(spatialElement.action)}
|
|
107
|
+
class="sticky-header-action"
|
|
108
|
+
type="button"
|
|
109
|
+
aria-label={spatialElement.action.ariaLabel}
|
|
110
|
+
>
|
|
111
|
+
<ShoppingCart size={29} strokeWidth={2} aria-hidden="true" />
|
|
112
|
+
</button>
|
|
113
|
+
{/if}
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
<div
|
|
117
|
+
class="spatial-element-sticky-tabs"
|
|
118
|
+
data-spatial-element-sticky-tabs
|
|
119
|
+
data-catalog-transition-dom="enter"
|
|
120
|
+
aria-hidden="true"
|
|
121
|
+
inert
|
|
122
|
+
>
|
|
123
|
+
<SpatialElementTabList {activeSectionId} {sections} variant="docked" />
|
|
124
|
+
</div>
|
|
125
|
+
</header>
|
|
126
|
+
|
|
127
|
+
<style>
|
|
128
|
+
.sticky-header-summary-surface {
|
|
129
|
+
position: absolute;
|
|
130
|
+
inset: 0 88px 0 0;
|
|
131
|
+
border-radius: inherit;
|
|
132
|
+
pointer-events: none;
|
|
133
|
+
}
|
|
134
|
+
@media (max-width: 1100px) {
|
|
135
|
+
.sticky-header-summary-surface {
|
|
136
|
+
right: 66px;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
.spatial-element-sticky-header {
|
|
140
|
+
position: fixed;
|
|
141
|
+
/* SpatialElementDockController portals this element outside the translated document. */
|
|
142
|
+
top: 8px;
|
|
143
|
+
left: 16px;
|
|
144
|
+
z-index: 20;
|
|
145
|
+
box-sizing: border-box;
|
|
146
|
+
width: calc(100vw - 32px);
|
|
147
|
+
height: 86px;
|
|
148
|
+
border: 0;
|
|
149
|
+
border-radius: var(--spatial-element-panel-radius);
|
|
150
|
+
visibility: hidden;
|
|
151
|
+
background: transparent;
|
|
152
|
+
box-shadow: none;
|
|
153
|
+
pointer-events: none;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.spatial-element-sticky-header:global([data-presented]) {
|
|
157
|
+
visibility: visible;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.spatial-element-sticky-header:global([data-active]) {
|
|
161
|
+
pointer-events: auto;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.sticky-header-minimap-action {
|
|
165
|
+
position: fixed;
|
|
166
|
+
z-index: 4;
|
|
167
|
+
display: block;
|
|
168
|
+
border-radius: var(--spatial-element-panel-radius);
|
|
169
|
+
background: transparent;
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.sticky-header-minimap-action:focus-visible {
|
|
174
|
+
outline: 2px solid var(--spatial-element-accent);
|
|
175
|
+
outline-offset: -3px;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.spatial-element-sticky-tabs {
|
|
179
|
+
--spatial-element-tabs-dock-top-radius: var(--spatial-element-panel-radius);
|
|
180
|
+
--spatial-element-tabs-dock-bottom-radius: var(--spatial-element-panel-radius);
|
|
181
|
+
|
|
182
|
+
position: fixed;
|
|
183
|
+
z-index: 19;
|
|
184
|
+
box-sizing: border-box;
|
|
185
|
+
height: 52px;
|
|
186
|
+
padding: 0;
|
|
187
|
+
border: 0;
|
|
188
|
+
border-radius: var(--spatial-element-tabs-dock-top-radius) var(--spatial-element-tabs-dock-top-radius)
|
|
189
|
+
var(--spatial-element-tabs-dock-bottom-radius) var(--spatial-element-tabs-dock-bottom-radius);
|
|
190
|
+
overflow: clip;
|
|
191
|
+
opacity: 0;
|
|
192
|
+
visibility: hidden;
|
|
193
|
+
background: transparent;
|
|
194
|
+
box-shadow: var(--spatial-element-docked-panel-box-shadow);
|
|
195
|
+
pointer-events: none;
|
|
196
|
+
will-change: border-radius;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.spatial-element-sticky-header::before,
|
|
200
|
+
.spatial-element-sticky-header::after,
|
|
201
|
+
.spatial-element-sticky-tabs::before {
|
|
202
|
+
position: absolute;
|
|
203
|
+
inset: 0;
|
|
204
|
+
border-radius: inherit;
|
|
205
|
+
content: '';
|
|
206
|
+
pointer-events: none;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.spatial-element-sticky-header::before,
|
|
210
|
+
.spatial-element-sticky-tabs::before {
|
|
211
|
+
background: rgb(
|
|
212
|
+
var(--spatial-element-docked-panel-tint-rgb) / var(--spatial-element-docked-panel-tint-opacity)
|
|
213
|
+
);
|
|
214
|
+
box-shadow: inset 0 0 0 1px
|
|
215
|
+
rgb(0 0 0 / calc(var(--spatial-element-docked-panel-shadow-strength) * 0.18));
|
|
216
|
+
-webkit-backdrop-filter: blur(var(--spatial-element-docked-panel-backdrop-blur));
|
|
217
|
+
backdrop-filter: blur(var(--spatial-element-docked-panel-backdrop-blur));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.spatial-element-sticky-header::before {
|
|
221
|
+
z-index: 2;
|
|
222
|
+
opacity: var(--spatial-element-sticky-header-progress, 0);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.spatial-element-sticky-header::after {
|
|
226
|
+
z-index: 1;
|
|
227
|
+
box-shadow: var(--spatial-element-docked-panel-box-shadow);
|
|
228
|
+
opacity: var(--spatial-element-sticky-header-progress, 0);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.spatial-element-sticky-tabs::before {
|
|
232
|
+
z-index: 0;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.spatial-element-sticky-tabs::before {
|
|
236
|
+
/* Shift the filtered surface itself across the physical box overlap. Chrome otherwise
|
|
237
|
+
* exposes the backdrop-filter edge as a dark one-pixel seam. */
|
|
238
|
+
bottom: -1px;
|
|
239
|
+
transform: translateY(-1px);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.spatial-element-sticky-tabs:global([data-active]) {
|
|
243
|
+
opacity: 1;
|
|
244
|
+
visibility: visible;
|
|
245
|
+
pointer-events: auto;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.sticky-header-layout {
|
|
249
|
+
display: grid;
|
|
250
|
+
position: relative;
|
|
251
|
+
z-index: 3;
|
|
252
|
+
grid-template-columns: minmax(0, 1fr) 56px;
|
|
253
|
+
align-items: center;
|
|
254
|
+
gap: 16px;
|
|
255
|
+
box-sizing: border-box;
|
|
256
|
+
width: 100%;
|
|
257
|
+
height: 100%;
|
|
258
|
+
padding: 14px 16px 14px var(--spatial-element-sticky-minimap-reserve, 150px);
|
|
259
|
+
opacity: var(--spatial-element-sticky-header-progress, 0);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.spatial-element-sticky-tabs :global([data-spatial-element-tab-list]) {
|
|
263
|
+
position: relative;
|
|
264
|
+
z-index: 1;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.sticky-header-copy {
|
|
268
|
+
display: grid;
|
|
269
|
+
gap: 4px;
|
|
270
|
+
min-width: 0;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.sticky-header-kicker,
|
|
274
|
+
.sticky-header-title {
|
|
275
|
+
margin: 0;
|
|
276
|
+
color: var(--spatial-element-ink);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.sticky-header-kicker {
|
|
280
|
+
font-size: 18px;
|
|
281
|
+
font-weight: 400;
|
|
282
|
+
line-height: 1.1;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.sticky-header-title {
|
|
286
|
+
overflow: hidden;
|
|
287
|
+
font-size: 24px;
|
|
288
|
+
font-weight: 520;
|
|
289
|
+
line-height: 1.15;
|
|
290
|
+
text-overflow: ellipsis;
|
|
291
|
+
white-space: nowrap;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.sticky-header-action {
|
|
295
|
+
display: grid;
|
|
296
|
+
place-items: center;
|
|
297
|
+
width: 56px;
|
|
298
|
+
height: 56px;
|
|
299
|
+
padding: 0;
|
|
300
|
+
border: 0;
|
|
301
|
+
border-radius: 7px;
|
|
302
|
+
color: var(--spatial-element-on-accent);
|
|
303
|
+
background: var(--spatial-element-accent);
|
|
304
|
+
text-decoration: none;
|
|
305
|
+
cursor: pointer;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
@media (max-width: 1100px) {
|
|
309
|
+
.spatial-element-sticky-header {
|
|
310
|
+
top: 8px;
|
|
311
|
+
left: 8px;
|
|
312
|
+
width: calc(100vw - 16px);
|
|
313
|
+
height: 72px;
|
|
314
|
+
border-radius: min(var(--spatial-element-panel-radius), 14px);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.sticky-header-layout {
|
|
318
|
+
grid-template-columns: minmax(0, 1fr) 48px;
|
|
319
|
+
gap: 8px;
|
|
320
|
+
padding: 10px 10px 10px var(--spatial-element-sticky-minimap-reserve, 112px);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.sticky-header-copy {
|
|
324
|
+
gap: 2px;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.sticky-header-kicker {
|
|
328
|
+
font-size: 13px;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.sticky-header-title {
|
|
332
|
+
font-size: 17px;
|
|
333
|
+
font-weight: 600;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.sticky-header-action {
|
|
337
|
+
width: 48px;
|
|
338
|
+
height: 48px;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
@media (max-width: 460px) {
|
|
343
|
+
.sticky-header-kicker {
|
|
344
|
+
font-size: 12px;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.sticky-header-title {
|
|
348
|
+
font-size: 15px;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SpatialElementData, SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
activeSectionId?: string;
|
|
4
|
+
spatialElement: SpatialElementData;
|
|
5
|
+
sections: SpatialElementSectionNavigationItem[];
|
|
6
|
+
};
|
|
7
|
+
declare const SpatialElementStickyHeader: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type SpatialElementStickyHeader = ReturnType<typeof SpatialElementStickyHeader>;
|
|
9
|
+
export default SpatialElementStickyHeader;
|