@spatial-elements/sveltekit 0.1.0-beta.2 → 1.0.0-beta.11
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 +18 -13
- 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 +152 -200
- 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 +129 -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/SpaceMouseControl.svelte +159 -0
- package/dist/spatial-element/SpaceMouseControl.svelte.d.ts +7 -0
- package/dist/spatial-element/SpaceMouseIcon.svelte +12 -0
- package/dist/spatial-element/SpaceMouseIcon.svelte.d.ts +26 -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 +754 -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 +300 -0
- package/dist/spatial-element/SpatialElementHelp.svelte.d.ts +6 -0
- package/dist/spatial-element/SpatialElementMediaRail.svelte +322 -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 +156 -71
- package/dist/spatial-element/SpatialElementPage.svelte.d.ts +10 -3
- package/dist/spatial-element/SpatialElementStickyHeader.svelte +89 -105
- package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +6 -1
- package/dist/spatial-element/SpatialElementSummaryContent.svelte +198 -0
- package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +23 -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 +66 -0
- package/dist/spatial-element/SpatialIconButton.svelte.d.ts +17 -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 +138 -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 +80 -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 +19 -3
- package/dist/spatial-element/index.js +12 -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 +152 -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 +471 -51
- 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 +225 -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,350 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { getContext, onMount, tick, untrack } from 'svelte';
|
|
3
|
-
import Section from './Section.svelte';
|
|
4
|
-
import CarouselSpatialElement from './CarouselSpatialElement.svelte';
|
|
5
|
-
import { CATALOG_POSE_CHANGED } from '@spatial-elements/core/catalog/catalogPose';
|
|
6
|
-
import type { CarouselPresentation } from '@spatial-elements/core/catalog/catalogPose';
|
|
7
|
-
import type { SpatialListItem, SpatialElementSectionDefinition } from '@spatial-elements/core/spatial-element/types';
|
|
8
|
-
import { CATALOG_SECTIONS, type CatalogSections } from '@spatial-elements/core/catalog/CatalogSections';
|
|
9
|
-
import {
|
|
10
|
-
carouselKey,
|
|
11
|
-
resolveCarouselSelection,
|
|
12
|
-
stepCarouselSelection
|
|
13
|
-
} from '@spatial-elements/core/catalog/carouselSelection';
|
|
14
|
-
|
|
15
|
-
let {
|
|
16
|
-
section,
|
|
17
|
-
presentation,
|
|
18
|
-
list,
|
|
19
|
-
initialItemKey,
|
|
20
|
-
onselectionchange
|
|
21
|
-
}: {
|
|
22
|
-
section: SpatialElementSectionDefinition;
|
|
23
|
-
list: SpatialListItem[];
|
|
24
|
-
presentation?: CarouselPresentation;
|
|
25
|
-
initialItemKey?: string;
|
|
26
|
-
onselectionchange?: (selection: { itemKey: string; spatialElementId: string }) => void;
|
|
27
|
-
} = $props();
|
|
28
|
-
const sections = getContext<CatalogSections | undefined>(CATALOG_SECTIONS);
|
|
29
|
-
|
|
30
|
-
let requested = $state<string>();
|
|
31
|
-
let interactive = $state(false);
|
|
32
|
-
let phase = $state(0);
|
|
33
|
-
let windowPhase = $state(0);
|
|
34
|
-
$effect(() => {
|
|
35
|
-
if (Math.abs(phase - windowPhase) > 0.75) windowPhase = Math.round(phase);
|
|
36
|
-
});
|
|
37
|
-
let ring: HTMLDivElement;
|
|
38
|
-
let frame = 0;
|
|
39
|
-
let visible = true;
|
|
40
|
-
let suppressClick = false;
|
|
41
|
-
let clickTimer: ReturnType<typeof setTimeout>;
|
|
42
|
-
let announced = $state<string>();
|
|
43
|
-
let selectionDirty = false;
|
|
44
|
-
let previousKeys: string | undefined;
|
|
45
|
-
function rememberSelection() {
|
|
46
|
-
if (!selectionDirty) return;
|
|
47
|
-
selectionDirty = false;
|
|
48
|
-
sections?.remember();
|
|
49
|
-
}
|
|
50
|
-
let drag: { id: number; x: number; y: number; phase: number; active: boolean } | undefined;
|
|
51
|
-
function invalidate() {
|
|
52
|
-
window.dispatchEvent(new Event(CATALOG_POSE_CHANGED));
|
|
53
|
-
}
|
|
54
|
-
function releaseDrag() {
|
|
55
|
-
const current = drag;
|
|
56
|
-
drag = undefined;
|
|
57
|
-
if (current && ring?.hasPointerCapture(current.id)) ring.releasePointerCapture(current.id);
|
|
58
|
-
}
|
|
59
|
-
function settle() {
|
|
60
|
-
cancelAnimationFrame(frame);
|
|
61
|
-
frame = 0;
|
|
62
|
-
releaseDrag();
|
|
63
|
-
phase = Math.max(0, keys.indexOf(selected ?? ''));
|
|
64
|
-
announced = selected;
|
|
65
|
-
void tick().then(invalidate);
|
|
66
|
-
rememberSelection();
|
|
67
|
-
}
|
|
68
|
-
function animate(target: number) {
|
|
69
|
-
cancelAnimationFrame(frame);
|
|
70
|
-
const start = phase;
|
|
71
|
-
const started = performance.now();
|
|
72
|
-
if (
|
|
73
|
-
Math.abs(target - start) > 1.5 ||
|
|
74
|
-
!visible ||
|
|
75
|
-
document.hidden ||
|
|
76
|
-
matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
77
|
-
) {
|
|
78
|
-
phase = target;
|
|
79
|
-
announced = selected;
|
|
80
|
-
invalidate();
|
|
81
|
-
rememberSelection();
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
const advance = (now: number) => {
|
|
85
|
-
if (ring?.closest('[data-catalog-transition]')) {
|
|
86
|
-
frame = 0;
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
const t = Math.min(1, (now - started) / 320);
|
|
90
|
-
phase = start + (target - start) * (1 - (1 - t) ** 2);
|
|
91
|
-
void tick().then(invalidate);
|
|
92
|
-
if (t < 1) frame = requestAnimationFrame(advance);
|
|
93
|
-
else {
|
|
94
|
-
frame = 0;
|
|
95
|
-
announced = selected;
|
|
96
|
-
rememberSelection();
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
frame = requestAnimationFrame(advance);
|
|
100
|
-
}
|
|
101
|
-
function pointerdown(event: PointerEvent) {
|
|
102
|
-
if (
|
|
103
|
-
list.length < 2 ||
|
|
104
|
-
event.button !== 0 ||
|
|
105
|
-
!(event.target as Element).closest('.spatial-element-visual')
|
|
106
|
-
)
|
|
107
|
-
return;
|
|
108
|
-
drag = { id: event.pointerId, x: event.clientX, y: event.clientY, phase, active: false };
|
|
109
|
-
}
|
|
110
|
-
function pointermove(event: PointerEvent) {
|
|
111
|
-
if (!drag || drag.id !== event.pointerId) return;
|
|
112
|
-
const x = event.clientX - drag.x,
|
|
113
|
-
y = event.clientY - drag.y;
|
|
114
|
-
if (!drag.active) {
|
|
115
|
-
if (Math.abs(y) > 10 && Math.abs(y) > Math.abs(x)) {
|
|
116
|
-
drag = undefined;
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (Math.abs(x) < 10 || Math.abs(x) < Math.abs(y) * 1.2) return;
|
|
120
|
-
drag.active = true;
|
|
121
|
-
suppressClick = true;
|
|
122
|
-
cancelAnimationFrame(frame);
|
|
123
|
-
ring.setPointerCapture(event.pointerId);
|
|
124
|
-
}
|
|
125
|
-
phase = Math.max(0, Math.min(keys.length - 1, drag.phase - x / 220));
|
|
126
|
-
invalidate();
|
|
127
|
-
}
|
|
128
|
-
function pointerup(event: PointerEvent) {
|
|
129
|
-
if (!drag || drag.id !== event.pointerId) return;
|
|
130
|
-
const active = drag.active;
|
|
131
|
-
releaseDrag();
|
|
132
|
-
if (active) select(keys[Math.round(phase)]);
|
|
133
|
-
clearTimeout(clickTimer);
|
|
134
|
-
clickTimer = setTimeout(() => (suppressClick = false), 0);
|
|
135
|
-
}
|
|
136
|
-
function pointercancel() {
|
|
137
|
-
releaseDrag();
|
|
138
|
-
suppressClick = false;
|
|
139
|
-
animate(Math.max(0, keys.indexOf(selected ?? '')));
|
|
140
|
-
}
|
|
141
|
-
const keys = $derived(list.map(carouselKey));
|
|
142
|
-
const selected = $derived(resolveCarouselSelection(keys, requested ?? initialItemKey));
|
|
143
|
-
$effect(() => {
|
|
144
|
-
// Data reordering/removal changes indices, never the stable selection identity.
|
|
145
|
-
const signature = JSON.stringify(keys);
|
|
146
|
-
if (interactive)
|
|
147
|
-
untrack(() => {
|
|
148
|
-
if (previousKeys !== undefined && previousKeys !== signature) selectionDirty = true;
|
|
149
|
-
previousKeys = signature;
|
|
150
|
-
settle();
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
function select(key: string | undefined) {
|
|
154
|
-
selectionDirty = true;
|
|
155
|
-
requested = key;
|
|
156
|
-
// Persist in the current entry before a possible popstate changes the history index.
|
|
157
|
-
rememberSelection();
|
|
158
|
-
const target = Math.max(0, keys.indexOf(key ?? ''));
|
|
159
|
-
animate(target);
|
|
160
|
-
const spatialElement = list.find((item) => carouselKey(item) === selected);
|
|
161
|
-
if (spatialElement && selected) onselectionchange?.({ itemKey: selected, spatialElementId: spatialElement.id });
|
|
162
|
-
}
|
|
163
|
-
function keydown(event: KeyboardEvent) {
|
|
164
|
-
const step = event.key === 'ArrowRight' ? 1 : event.key === 'ArrowLeft' ? -1 : 0;
|
|
165
|
-
if (step) select(stepCarouselSelection(keys, selected, step));
|
|
166
|
-
else if (event.key === 'Home') select(keys[0]);
|
|
167
|
-
else if (event.key === 'End') select(keys.at(-1));
|
|
168
|
-
else return;
|
|
169
|
-
event.preventDefault();
|
|
170
|
-
}
|
|
171
|
-
onMount(() => {
|
|
172
|
-
interactive = true;
|
|
173
|
-
const release = sections?.register(section.id, {
|
|
174
|
-
read: () => selected,
|
|
175
|
-
restore: (key) => {
|
|
176
|
-
selectionDirty = false;
|
|
177
|
-
requested = resolveCarouselSelection(keys, key ?? initialItemKey);
|
|
178
|
-
cancelAnimationFrame(frame);
|
|
179
|
-
phase = Math.max(0, keys.indexOf(requested ?? ''));
|
|
180
|
-
announced = requested;
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
const observer = new IntersectionObserver(([entry]) => {
|
|
184
|
-
visible = entry.isIntersecting;
|
|
185
|
-
if (!visible) {
|
|
186
|
-
settle();
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
observer.observe(ring);
|
|
190
|
-
let sizingFrame = 0;
|
|
191
|
-
const measure = () => {
|
|
192
|
-
sizingFrame = 0;
|
|
193
|
-
const heights = [...ring.querySelectorAll<HTMLElement>('.summary')].map(
|
|
194
|
-
(panel) => panel.offsetHeight
|
|
195
|
-
);
|
|
196
|
-
const contentHeight = Math.max(0, ...heights);
|
|
197
|
-
const height =
|
|
198
|
-
ring.clientWidth < 700 ? 408 + contentHeight : Math.max(560, contentHeight + 64);
|
|
199
|
-
const value = height + 'px';
|
|
200
|
-
if (ring.style.getPropertyValue('--carousel-height') !== value)
|
|
201
|
-
ring.style.setProperty('--carousel-height', value);
|
|
202
|
-
};
|
|
203
|
-
const scheduleSize = () => {
|
|
204
|
-
if (!sizingFrame) sizingFrame = requestAnimationFrame(measure);
|
|
205
|
-
};
|
|
206
|
-
const sizing = new ResizeObserver(scheduleSize);
|
|
207
|
-
const contentChanges = new MutationObserver(() => {
|
|
208
|
-
sizing.disconnect();
|
|
209
|
-
sizing.observe(ring);
|
|
210
|
-
for (const panel of ring.querySelectorAll('.summary')) sizing.observe(panel);
|
|
211
|
-
scheduleSize();
|
|
212
|
-
});
|
|
213
|
-
contentChanges.observe(ring, { childList: true, subtree: true });
|
|
214
|
-
sizing.observe(ring);
|
|
215
|
-
for (const panel of ring.querySelectorAll('.summary')) sizing.observe(panel);
|
|
216
|
-
const stop = () => pointercancel();
|
|
217
|
-
window.addEventListener('resize', stop);
|
|
218
|
-
const hidden = () => {
|
|
219
|
-
if (document.hidden) settle();
|
|
220
|
-
};
|
|
221
|
-
document.addEventListener('visibilitychange', hidden);
|
|
222
|
-
const escape = (event: KeyboardEvent) => {
|
|
223
|
-
if (event.key === 'Escape') stop();
|
|
224
|
-
};
|
|
225
|
-
window.addEventListener('keydown', escape);
|
|
226
|
-
return () => {
|
|
227
|
-
cancelAnimationFrame(frame);
|
|
228
|
-
clearTimeout(clickTimer);
|
|
229
|
-
releaseDrag();
|
|
230
|
-
observer.disconnect();
|
|
231
|
-
sizing.disconnect();
|
|
232
|
-
contentChanges.disconnect();
|
|
233
|
-
cancelAnimationFrame(sizingFrame);
|
|
234
|
-
release?.();
|
|
235
|
-
window.removeEventListener('resize', stop);
|
|
236
|
-
window.removeEventListener('keydown', escape);
|
|
237
|
-
document.removeEventListener('visibilitychange', hidden);
|
|
238
|
-
};
|
|
239
|
-
});
|
|
240
|
-
</script>
|
|
241
|
-
|
|
242
|
-
<Section {section} presentation="list">
|
|
243
|
-
<div
|
|
244
|
-
class="carousel"
|
|
245
|
-
class:interactive
|
|
246
|
-
class:populated={list.length > 0}
|
|
247
|
-
data-carousel-section={section.id}
|
|
248
|
-
>
|
|
249
|
-
<div
|
|
250
|
-
class="ring"
|
|
251
|
-
bind:this={ring}
|
|
252
|
-
onpointerdown={pointerdown}
|
|
253
|
-
onpointermove={pointermove}
|
|
254
|
-
onpointerup={pointerup}
|
|
255
|
-
onpointercancel={pointercancel}
|
|
256
|
-
onlostpointercapture={() => {
|
|
257
|
-
if (drag) pointercancel();
|
|
258
|
-
}}
|
|
259
|
-
role="group"
|
|
260
|
-
aria-label={section.title}
|
|
261
|
-
>
|
|
262
|
-
{#each list as spatialElement, index (carouselKey(spatialElement))}
|
|
263
|
-
<CarouselSpatialElement
|
|
264
|
-
{spatialElement}
|
|
265
|
-
sectionId={section.id}
|
|
266
|
-
{presentation}
|
|
267
|
-
{index}
|
|
268
|
-
count={list.length}
|
|
269
|
-
{phase}
|
|
270
|
-
{windowPhase}
|
|
271
|
-
selected={selected === carouselKey(spatialElement)}
|
|
272
|
-
{interactive}
|
|
273
|
-
onselect={() => {
|
|
274
|
-
if (!suppressClick) select(carouselKey(spatialElement));
|
|
275
|
-
}}
|
|
276
|
-
/>
|
|
277
|
-
{/each}
|
|
278
|
-
</div>
|
|
279
|
-
{#if interactive && list.length > 1}
|
|
280
|
-
<div class="controls" role="group" aria-label={`${section.title}: element selection`}>
|
|
281
|
-
{#each list as spatialElement (carouselKey(spatialElement))}
|
|
282
|
-
<button
|
|
283
|
-
onkeydown={keydown}
|
|
284
|
-
aria-label={spatialElement.eyebrow}
|
|
285
|
-
aria-pressed={selected === carouselKey(spatialElement)}
|
|
286
|
-
onclick={() => select(carouselKey(spatialElement))}><span aria-hidden="true"></span></button
|
|
287
|
-
>
|
|
288
|
-
{/each}
|
|
289
|
-
</div>
|
|
290
|
-
{/if}
|
|
291
|
-
{#if interactive}<p class="sr-only" role="status">
|
|
292
|
-
{list.find((item) => carouselKey(item) === announced)?.title ?? ''}
|
|
293
|
-
</p>{/if}
|
|
294
|
-
</div>
|
|
295
|
-
</Section>
|
|
296
|
-
|
|
297
|
-
<style>
|
|
298
|
-
.carousel {
|
|
299
|
-
pointer-events: auto;
|
|
300
|
-
margin-top: 24px;
|
|
301
|
-
}
|
|
302
|
-
.ring {
|
|
303
|
-
container-type: inline-size;
|
|
304
|
-
position: relative;
|
|
305
|
-
touch-action: pan-y;
|
|
306
|
-
}
|
|
307
|
-
.interactive.populated .ring {
|
|
308
|
-
min-height: var(--carousel-height, 560px);
|
|
309
|
-
}
|
|
310
|
-
.controls {
|
|
311
|
-
display: flex;
|
|
312
|
-
justify-content: center;
|
|
313
|
-
flex-wrap: wrap;
|
|
314
|
-
margin-top: 16px;
|
|
315
|
-
}
|
|
316
|
-
.controls button {
|
|
317
|
-
display: grid;
|
|
318
|
-
place-items: center;
|
|
319
|
-
width: 44px;
|
|
320
|
-
height: 44px;
|
|
321
|
-
padding: 0;
|
|
322
|
-
border: 0;
|
|
323
|
-
background: transparent;
|
|
324
|
-
border-radius: 50%;
|
|
325
|
-
cursor: pointer;
|
|
326
|
-
}
|
|
327
|
-
.controls span {
|
|
328
|
-
width: 10px;
|
|
329
|
-
height: 10px;
|
|
330
|
-
border: 1px solid var(--spatial-element-accent);
|
|
331
|
-
border-radius: 50%;
|
|
332
|
-
}
|
|
333
|
-
.controls button[aria-pressed='true'] span {
|
|
334
|
-
background: var(--spatial-element-accent);
|
|
335
|
-
}
|
|
336
|
-
.controls button:focus-visible {
|
|
337
|
-
outline: 2px solid var(--spatial-element-accent);
|
|
338
|
-
outline-offset: -4px;
|
|
339
|
-
}
|
|
340
|
-
.sr-only {
|
|
341
|
-
position: absolute;
|
|
342
|
-
width: 1px;
|
|
343
|
-
height: 1px;
|
|
344
|
-
padding: 0;
|
|
345
|
-
margin: -1px;
|
|
346
|
-
overflow: hidden;
|
|
347
|
-
clip-path: inset(50%);
|
|
348
|
-
white-space: nowrap;
|
|
349
|
-
}
|
|
350
|
-
</style>
|
|
@@ -1,30 +0,0 @@
|
|
|
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>
|
|
@@ -1,8 +0,0 @@
|
|
|
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;
|