@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,388 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { catalogActionSemantic } from '@spatial-elements/core/catalog/catalogAction';
|
|
3
|
+
import { getContext } from 'svelte';
|
|
4
|
+
import { getCssPanelBoxShadow } from '@spatial-elements/core/stage/panelShadow';
|
|
5
|
+
import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
|
|
6
|
+
import { CATALOG_ITEMS, type CatalogItems } from '@spatial-elements/core/catalog/catalogItems';
|
|
7
|
+
import { carouselKey } from '@spatial-elements/core/catalog/carouselSelection';
|
|
8
|
+
import { carouselPose, carouselResident } from '@spatial-elements/core/catalog/catalogPose';
|
|
9
|
+
import type { CarouselPresentation } from '@spatial-elements/core/catalog/catalogPose';
|
|
10
|
+
import { useCatalogNavigation } from '../catalog/catalogNavigation.js';
|
|
11
|
+
import { createCatalogEndpointAction } from '../catalog/catalogEndpointAction.js';
|
|
12
|
+
import {
|
|
13
|
+
CATALOG_ENDPOINTS,
|
|
14
|
+
type CatalogEndpointRegistry,
|
|
15
|
+
type CatalogEndpointRole
|
|
16
|
+
} from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
|
|
17
|
+
import { CATALOG_SECTIONS, type CatalogSections } from '@spatial-elements/core/catalog/CatalogSections';
|
|
18
|
+
import { useSpatialTheme } from './brandContext.js';
|
|
19
|
+
let {
|
|
20
|
+
spatialElement,
|
|
21
|
+
sectionId,
|
|
22
|
+
presentation,
|
|
23
|
+
index,
|
|
24
|
+
count,
|
|
25
|
+
phase,
|
|
26
|
+
windowPhase,
|
|
27
|
+
selected,
|
|
28
|
+
interactive,
|
|
29
|
+
onselect
|
|
30
|
+
}: {
|
|
31
|
+
spatialElement: SpatialListItem;
|
|
32
|
+
sectionId: string;
|
|
33
|
+
presentation?: CarouselPresentation;
|
|
34
|
+
index: number;
|
|
35
|
+
count: number;
|
|
36
|
+
phase: number;
|
|
37
|
+
windowPhase: number;
|
|
38
|
+
selected: boolean;
|
|
39
|
+
interactive: boolean;
|
|
40
|
+
onselect: () => void;
|
|
41
|
+
} = $props();
|
|
42
|
+
const items = getContext<CatalogItems | undefined>(CATALOG_ITEMS);
|
|
43
|
+
const endpoints = getContext<CatalogEndpointRegistry | undefined>(CATALOG_ENDPOINTS);
|
|
44
|
+
const sections = getContext<CatalogSections | undefined>(CATALOG_SECTIONS);
|
|
45
|
+
const brand = useSpatialTheme();
|
|
46
|
+
const catalogEndpoint = createCatalogEndpointAction();
|
|
47
|
+
function address(role: CatalogEndpointRole) {
|
|
48
|
+
return interactive &&
|
|
49
|
+
resident &&
|
|
50
|
+
pose.visible &&
|
|
51
|
+
(selected || role === 'geometry' || role === 'container')
|
|
52
|
+
? {
|
|
53
|
+
brandId: brand.id,
|
|
54
|
+
spatialElementId: spatialElement.id,
|
|
55
|
+
occurrence,
|
|
56
|
+
slot: selected ? ('carousel.front' as const) : ('carousel.neighbour' as const),
|
|
57
|
+
role
|
|
58
|
+
}
|
|
59
|
+
: undefined;
|
|
60
|
+
}
|
|
61
|
+
const { href, prepare, pending } = useCatalogNavigation();
|
|
62
|
+
let busy = $state(false);
|
|
63
|
+
$effect(() => {
|
|
64
|
+
const target = pending();
|
|
65
|
+
busy = false;
|
|
66
|
+
if (!selected || !target || new URL(href(spatialElement.href), target).pathname !== target.pathname)
|
|
67
|
+
return;
|
|
68
|
+
const timer = setTimeout(() => (busy = true), 150);
|
|
69
|
+
return () => clearTimeout(timer);
|
|
70
|
+
});
|
|
71
|
+
const occurrence = $derived(JSON.stringify([sectionId, carouselKey(spatialElement)]));
|
|
72
|
+
const pose = $derived(carouselPose(index, phase, count, presentation));
|
|
73
|
+
const resident = $derived(carouselResident(index, windowPhase, count));
|
|
74
|
+
function activate(event: MouseEvent) {
|
|
75
|
+
endpoints?.prefer(brand.id, spatialElement.id, occurrence, 'carousel.front');
|
|
76
|
+
sections?.activate({
|
|
77
|
+
brandId: brand.id,
|
|
78
|
+
spatialElementId: spatialElement.id,
|
|
79
|
+
occurrence,
|
|
80
|
+
slot: 'carousel.front'
|
|
81
|
+
});
|
|
82
|
+
(event.currentTarget as HTMLElement).focus({ preventScroll: true });
|
|
83
|
+
}
|
|
84
|
+
$effect(() => {
|
|
85
|
+
if (!interactive || !resident) return;
|
|
86
|
+
return items?.register({
|
|
87
|
+
...spatialElement,
|
|
88
|
+
occurrence,
|
|
89
|
+
pose: { kind: 'carousel', read: () => carouselPose(index, phase, count, presentation) }
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<article
|
|
95
|
+
use:catalogEndpoint={address('container')}
|
|
96
|
+
class="carousel-spatial-element"
|
|
97
|
+
class:selected
|
|
98
|
+
class:interactive
|
|
99
|
+
hidden={interactive && !resident}
|
|
100
|
+
data-carousel-spatial-element
|
|
101
|
+
data-catalog-order={index}
|
|
102
|
+
data-carousel-visible={interactive && pose.visible ? '' : undefined}
|
|
103
|
+
data-carousel-item={carouselKey(spatialElement)}
|
|
104
|
+
data-carousel-surface={brand.panelTheme.surface ?? 'glass'}
|
|
105
|
+
data-carousel-theme={JSON.stringify({
|
|
106
|
+
...brand.panelTheme,
|
|
107
|
+
radius: brand.panelShape.radius,
|
|
108
|
+
tintOpacity: Math.min(brand.panelTheme.tintOpacity ?? 0.28, 0.72)
|
|
109
|
+
})}
|
|
110
|
+
data-catalog-occurrence={occurrence}
|
|
111
|
+
>
|
|
112
|
+
<div
|
|
113
|
+
use:catalogEndpoint={address('geometry')}
|
|
114
|
+
class="spatial-element-visual"
|
|
115
|
+
data-catalog-geometry
|
|
116
|
+
data-spatial-element-id={spatialElement.id}
|
|
117
|
+
data-catalog-occurrence={occurrence}
|
|
118
|
+
>
|
|
119
|
+
<button
|
|
120
|
+
draggable="false"
|
|
121
|
+
class="spatial-element-target"
|
|
122
|
+
hidden={interactive && !pose.visible}
|
|
123
|
+
aria-label={`Select ${spatialElement.eyebrow}`}
|
|
124
|
+
aria-pressed={selected}
|
|
125
|
+
onclick={onselect}
|
|
126
|
+
style={interactive
|
|
127
|
+
? `left:${(pose.x - 0.19 * Math.cos(pose.yaw)) * 100}%;top:${pose.y * 100}%;width:${pose.size * 100}%;max-width:${pose.size * 480}px;z-index:${Math.round(1300 + pose.depth)}`
|
|
128
|
+
: undefined}
|
|
129
|
+
>
|
|
130
|
+
{#if spatialElement.stage?.fallbackImage}<img
|
|
131
|
+
draggable="false"
|
|
132
|
+
src={spatialElement.stage.fallbackImage}
|
|
133
|
+
alt={`${brand.name} ${spatialElement.title}`}
|
|
134
|
+
width="320"
|
|
135
|
+
height="320"
|
|
136
|
+
/>{:else}<span>{spatialElement.eyebrow}</span>{/if}
|
|
137
|
+
</button>
|
|
138
|
+
</div>
|
|
139
|
+
<div
|
|
140
|
+
class="summary"
|
|
141
|
+
hidden={interactive && pose.panelOpacity < 0.001}
|
|
142
|
+
inert={interactive && !selected}
|
|
143
|
+
aria-hidden={interactive && !selected}
|
|
144
|
+
style:--carousel-panel-opacity={(interactive ? pose.panelOpacity : 1) *
|
|
145
|
+
(brand.panelTheme.opacity ?? 1)}
|
|
146
|
+
style:--carousel-panel-shadow={getCssPanelBoxShadow(brand.panelTheme.shadowIntensity ?? 0.28)}
|
|
147
|
+
style:--carousel-panel-tint={typeof brand.panelTheme.tint === 'number'
|
|
148
|
+
? '#' + brand.panelTheme.tint.toString(16).padStart(6, '0')
|
|
149
|
+
: typeof brand.panelTheme.tint === 'object'
|
|
150
|
+
? brand.panelTheme.tint.getStyle()
|
|
151
|
+
: (brand.panelTheme.tint ?? '#ffffff')}
|
|
152
|
+
style:--carousel-panel-tint-opacity={Math.min(brand.panelTheme.tintOpacity ?? 0.28, 0.72) *
|
|
153
|
+
100 +
|
|
154
|
+
'%'}
|
|
155
|
+
style:--carousel-panel-blur={(brand.panelTheme.backdropBlur ?? 5) + 'px'}
|
|
156
|
+
style:--carousel-panel-radius={brand.panelShape.radius + 'px'}
|
|
157
|
+
use:catalogEndpoint={address('summary-surface')}
|
|
158
|
+
>
|
|
159
|
+
<p class="eyebrow" use:catalogEndpoint={address('eyebrow')}>{spatialElement.eyebrow}</p>
|
|
160
|
+
<h3 use:catalogEndpoint={address('title')}>{spatialElement.title}</h3>
|
|
161
|
+
<ul
|
|
162
|
+
use:catalogEndpoint={address('features')}
|
|
163
|
+
data-catalog-rich-shared="features"
|
|
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}
|
|
221
|
+
</div>
|
|
222
|
+
</article>
|
|
223
|
+
|
|
224
|
+
<style>
|
|
225
|
+
.carousel-spatial-element {
|
|
226
|
+
display: grid;
|
|
227
|
+
grid-template-columns: minmax(0, 1fr) minmax(280px, 0.7fr);
|
|
228
|
+
gap: 32px;
|
|
229
|
+
align-items: center;
|
|
230
|
+
margin-bottom: 24px;
|
|
231
|
+
}
|
|
232
|
+
.interactive {
|
|
233
|
+
position: absolute;
|
|
234
|
+
inset: 0;
|
|
235
|
+
pointer-events: none;
|
|
236
|
+
}
|
|
237
|
+
.spatial-element-visual {
|
|
238
|
+
height: var(--carousel-height, 560px);
|
|
239
|
+
position: relative;
|
|
240
|
+
display: grid;
|
|
241
|
+
place-items: center;
|
|
242
|
+
touch-action: pan-y;
|
|
243
|
+
}
|
|
244
|
+
.interactive {
|
|
245
|
+
display: block;
|
|
246
|
+
margin: 0;
|
|
247
|
+
}
|
|
248
|
+
.interactive[hidden] {
|
|
249
|
+
/* Keep known summary dimensions measurable without painting or registering GPU actors. */
|
|
250
|
+
display: block;
|
|
251
|
+
visibility: hidden;
|
|
252
|
+
}
|
|
253
|
+
.interactive .summary {
|
|
254
|
+
position: absolute;
|
|
255
|
+
left: 0;
|
|
256
|
+
top: 0;
|
|
257
|
+
width: 40%;
|
|
258
|
+
box-sizing: border-box;
|
|
259
|
+
z-index: 1400;
|
|
260
|
+
transform-origin: 0 0;
|
|
261
|
+
transform: translate(150%, 24px);
|
|
262
|
+
}
|
|
263
|
+
.spatial-element-target {
|
|
264
|
+
border: none;
|
|
265
|
+
background: transparent;
|
|
266
|
+
cursor: pointer;
|
|
267
|
+
pointer-events: auto;
|
|
268
|
+
padding: 0;
|
|
269
|
+
aspect-ratio: 1;
|
|
270
|
+
}
|
|
271
|
+
.interactive .spatial-element-target {
|
|
272
|
+
position: absolute;
|
|
273
|
+
transform: translate(-50%, -50%);
|
|
274
|
+
}
|
|
275
|
+
.spatial-element-target[hidden] {
|
|
276
|
+
display: none;
|
|
277
|
+
}
|
|
278
|
+
.spatial-element-target:focus-visible {
|
|
279
|
+
outline: 2px solid var(--spatial-element-accent);
|
|
280
|
+
outline-offset: 4px;
|
|
281
|
+
border-radius: 12px;
|
|
282
|
+
}
|
|
283
|
+
img {
|
|
284
|
+
width: 100%;
|
|
285
|
+
height: 100%;
|
|
286
|
+
object-fit: contain;
|
|
287
|
+
}
|
|
288
|
+
.carousel-spatial-element:global([data-catalog-model-ready]) img {
|
|
289
|
+
opacity: 0;
|
|
290
|
+
}
|
|
291
|
+
.summary {
|
|
292
|
+
position: relative;
|
|
293
|
+
|
|
294
|
+
border-radius: var(--carousel-panel-radius, 14px);
|
|
295
|
+
padding: 28px;
|
|
296
|
+
|
|
297
|
+
color: var(--spatial-element-ink);
|
|
298
|
+
pointer-events: auto;
|
|
299
|
+
}
|
|
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
|
+
.summary[hidden] {
|
|
324
|
+
display: block;
|
|
325
|
+
visibility: hidden;
|
|
326
|
+
}
|
|
327
|
+
.eyebrow {
|
|
328
|
+
font-weight: 720;
|
|
329
|
+
font-size: 13px;
|
|
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
|
+
}
|
|
381
|
+
}
|
|
382
|
+
@media (max-width: 850px) {
|
|
383
|
+
.carousel-spatial-element {
|
|
384
|
+
grid-template-columns: 1fr;
|
|
385
|
+
gap: 12px;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
|
|
2
|
+
import type { CarouselPresentation } from '@spatial-elements/core/catalog/catalogPose';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
spatialElement: SpatialListItem;
|
|
5
|
+
sectionId: string;
|
|
6
|
+
presentation?: CarouselPresentation;
|
|
7
|
+
index: number;
|
|
8
|
+
count: number;
|
|
9
|
+
phase: number;
|
|
10
|
+
windowPhase: number;
|
|
11
|
+
selected: boolean;
|
|
12
|
+
interactive: boolean;
|
|
13
|
+
onselect: () => void;
|
|
14
|
+
};
|
|
15
|
+
declare const CarouselSpatialElement: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
16
|
+
type CarouselSpatialElement = ReturnType<typeof CarouselSpatialElement>;
|
|
17
|
+
export default CarouselSpatialElement;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { setContext } from 'svelte';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { ContentPageData } from '@spatial-elements/core/spatial-element/types';
|
|
5
|
+
import { useSpatialTheme } from './brandContext.js';
|
|
6
|
+
import SpatialElementBreadcrumbs from './SpatialElementBreadcrumbs.svelte';
|
|
7
|
+
import {
|
|
8
|
+
SPATIAL_ELEMENT_SECTION_REGISTRY_KEY,
|
|
9
|
+
SpatialElementSectionRegistry,
|
|
10
|
+
SECTION_PAGE_KIND
|
|
11
|
+
} from '@spatial-elements/core/spatial-element/spatialElementSectionRegistry';
|
|
12
|
+
let { page, children }: { page: ContentPageData; children?: Snippet } = $props();
|
|
13
|
+
const brand = useSpatialTheme();
|
|
14
|
+
setContext(SPATIAL_ELEMENT_SECTION_REGISTRY_KEY, new SpatialElementSectionRegistry());
|
|
15
|
+
setContext(SECTION_PAGE_KIND, 'content');
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<svelte:head><title>{page.pageTitle ?? page.title}</title></svelte:head>
|
|
19
|
+
<main class="content-page" data-catalog-list data-brand-id={brand.id}>
|
|
20
|
+
{#if page.breadcrumbs?.length}<SpatialElementBreadcrumbs
|
|
21
|
+
items={page.breadcrumbs}
|
|
22
|
+
transition="exit"
|
|
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>
|
|
31
|
+
|
|
32
|
+
<style>
|
|
33
|
+
.content-page {
|
|
34
|
+
width: min(1500px, calc(100vw - 120px));
|
|
35
|
+
margin: 0 auto;
|
|
36
|
+
padding-bottom: 120px;
|
|
37
|
+
}
|
|
38
|
+
header {
|
|
39
|
+
max-width: 780px;
|
|
40
|
+
padding: 12px 0 32px;
|
|
41
|
+
pointer-events: auto;
|
|
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
|
+
}
|
|
68
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ContentPageData } from '@spatial-elements/core/spatial-element/types';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
page: ContentPageData;
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
};
|
|
7
|
+
declare const ContentPage: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type ContentPage = ReturnType<typeof ContentPage>;
|
|
9
|
+
export default ContentPage;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Section from './Section.svelte';
|
|
3
|
+
import SpatialElementCard from './SpatialElementCard.svelte';
|
|
4
|
+
import type { SpatialListItem, SpatialElementSectionDefinition } from '@spatial-elements/core/spatial-element/types';
|
|
5
|
+
let { section, list }: { section: SpatialElementSectionDefinition; list: SpatialListItem[] } =
|
|
6
|
+
$props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<Section {section} presentation="list">
|
|
10
|
+
<div class="catalog">
|
|
11
|
+
{#each list as spatialElement, index (spatialElement.itemKey ?? spatialElement.id)}
|
|
12
|
+
<SpatialElementCard
|
|
13
|
+
{spatialElement}
|
|
14
|
+
order={index}
|
|
15
|
+
occurrence={JSON.stringify([section.id, spatialElement.itemKey ?? spatialElement.id])}
|
|
16
|
+
/>
|
|
17
|
+
{/each}
|
|
18
|
+
</div>
|
|
19
|
+
</Section>
|
|
20
|
+
|
|
21
|
+
<style>
|
|
22
|
+
.catalog {
|
|
23
|
+
display: grid;
|
|
24
|
+
grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
|
|
25
|
+
gap: 24px;
|
|
26
|
+
align-items: start;
|
|
27
|
+
pointer-events: auto;
|
|
28
|
+
margin-top: 20px;
|
|
29
|
+
}
|
|
30
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SpatialListItem, SpatialElementSectionDefinition } from '@spatial-elements/core/spatial-element/types';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
section: SpatialElementSectionDefinition;
|
|
4
|
+
list: SpatialListItem[];
|
|
5
|
+
};
|
|
6
|
+
declare const ListSection: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type ListSection = ReturnType<typeof ListSection>;
|
|
8
|
+
export default ListSection;
|