@spatial-elements/sveltekit 0.1.0-beta.2 → 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 +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 +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
|
@@ -0,0 +1,752 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getContext, onMount, tick, untrack } from 'svelte';
|
|
3
|
+
import Section from './Section.svelte';
|
|
4
|
+
import { retainListDeviceOrientation } from '@spatial-elements/core/catalog/listDeviceOrientation';
|
|
5
|
+
import { carouselTextHit } from './carouselTextHit.js';
|
|
6
|
+
import CarouselSpatialElement from './CarouselSpatialElement.svelte';
|
|
7
|
+
import {
|
|
8
|
+
CATALOG_POSE_CHANGED,
|
|
9
|
+
carouselEmphasis,
|
|
10
|
+
CarouselDragEmphasis,
|
|
11
|
+
resolveCarouselPoseLayout,
|
|
12
|
+
type CarouselEmphasis,
|
|
13
|
+
type CarouselLayout,
|
|
14
|
+
type CarouselPresentation
|
|
15
|
+
} from '@spatial-elements/core/catalog/catalogPose';
|
|
16
|
+
import type {
|
|
17
|
+
SpatialListItem,
|
|
18
|
+
SpatialElementSectionDefinition
|
|
19
|
+
} from '@spatial-elements/core/spatial-element/types';
|
|
20
|
+
import {
|
|
21
|
+
CATALOG_SECTIONS,
|
|
22
|
+
type CatalogSections
|
|
23
|
+
} from '@spatial-elements/core/catalog/CatalogSections';
|
|
24
|
+
import {
|
|
25
|
+
carouselKey,
|
|
26
|
+
resolveCarouselSelection,
|
|
27
|
+
stepCarouselSelection
|
|
28
|
+
} from '@spatial-elements/core/catalog/carouselSelection';
|
|
29
|
+
import {
|
|
30
|
+
CarouselDrag,
|
|
31
|
+
CarouselWheelInput,
|
|
32
|
+
clampCarouselPhase,
|
|
33
|
+
sampleCarouselInertia
|
|
34
|
+
} from '@spatial-elements/core/catalog/carouselMotion';
|
|
35
|
+
import {
|
|
36
|
+
STAGE_CONTEXT_KEY,
|
|
37
|
+
STAGE_PANEL_LAYOUT_EVENT,
|
|
38
|
+
type StageContext
|
|
39
|
+
} from '@spatial-elements/core/stage/panelContext';
|
|
40
|
+
|
|
41
|
+
let {
|
|
42
|
+
section,
|
|
43
|
+
presentation,
|
|
44
|
+
list,
|
|
45
|
+
initialItemKey,
|
|
46
|
+
onselectionchange
|
|
47
|
+
}: {
|
|
48
|
+
section: SpatialElementSectionDefinition;
|
|
49
|
+
presentation?: CarouselPresentation;
|
|
50
|
+
list: SpatialListItem[];
|
|
51
|
+
initialItemKey?: string;
|
|
52
|
+
onselectionchange?: (selection: { itemKey: string; spatialElementId: string }) => void;
|
|
53
|
+
} = $props();
|
|
54
|
+
const sections = getContext<CatalogSections | undefined>(CATALOG_SECTIONS);
|
|
55
|
+
const stage = getContext<StageContext | undefined>(STAGE_CONTEXT_KEY);
|
|
56
|
+
const interactive = $derived(stage?.isEnhanced?.() ?? false);
|
|
57
|
+
const keys = $derived(list.map(carouselKey));
|
|
58
|
+
let requested = $state<string>();
|
|
59
|
+
const selected = $derived(resolveCarouselSelection(keys, requested ?? initialItemKey));
|
|
60
|
+
const initialIndex = $derived(
|
|
61
|
+
Math.max(0, keys.indexOf(resolveCarouselSelection(keys, initialItemKey) ?? ''))
|
|
62
|
+
);
|
|
63
|
+
const orderedItems = $derived(
|
|
64
|
+
interactive
|
|
65
|
+
? [...list.entries()]
|
|
66
|
+
: [...list.entries()].slice(initialIndex).concat([...list.entries()].slice(0, initialIndex))
|
|
67
|
+
);
|
|
68
|
+
let phase = $state(0);
|
|
69
|
+
let windowPhase = $state(0);
|
|
70
|
+
let emphasis = $state<CarouselEmphasis[] | undefined>();
|
|
71
|
+
const focus = $derived(emphasis ? Math.max(0, ...emphasis.map((value) => value.advance)) : 1);
|
|
72
|
+
const arrowOpacity = $derived(
|
|
73
|
+
Math.max(0, ...list.map((_, i) => emphasis?.[i]?.panel ?? carouselEmphasis(i - phase).panel))
|
|
74
|
+
);
|
|
75
|
+
const indicated = $derived(keys[Math.round(clampCarouselPhase(phase, keys.length))]);
|
|
76
|
+
let announced = $state<string>();
|
|
77
|
+
let ring: HTMLDivElement;
|
|
78
|
+
$effect(() => {
|
|
79
|
+
if (interactive && ring) return retainListDeviceOrientation(ring, () => {});
|
|
80
|
+
});
|
|
81
|
+
let layout = $state<CarouselLayout>({ width: 1320, height: 600, left: 60, viewportWidth: 1440 });
|
|
82
|
+
let frame = 0;
|
|
83
|
+
let nativeFrame = 0;
|
|
84
|
+
let mounted = false;
|
|
85
|
+
let generation = 0;
|
|
86
|
+
let suppressClick = false;
|
|
87
|
+
let clickTimer: ReturnType<typeof setTimeout>;
|
|
88
|
+
let wheelTimer: ReturnType<typeof setTimeout>;
|
|
89
|
+
let drag:
|
|
90
|
+
| {
|
|
91
|
+
id: number;
|
|
92
|
+
kind: 'pointer' | 'wheel';
|
|
93
|
+
motion: CarouselDrag;
|
|
94
|
+
emphasis: CarouselDragEmphasis;
|
|
95
|
+
x: number;
|
|
96
|
+
y: number;
|
|
97
|
+
time: number;
|
|
98
|
+
touch: boolean;
|
|
99
|
+
}
|
|
100
|
+
| undefined;
|
|
101
|
+
let wheelInput: CarouselWheelInput | undefined;
|
|
102
|
+
const currentEmphasis = () => keys.map((_, i) => emphasis?.[i] ?? carouselEmphasis(i - phase));
|
|
103
|
+
const blocked = () => !!ring?.closest('[data-catalog-transition]');
|
|
104
|
+
function invalidate() {
|
|
105
|
+
if (Math.abs(phase - windowPhase) > 0.75) windowPhase = Math.round(phase);
|
|
106
|
+
void tick().then(() => {
|
|
107
|
+
if (mounted) window.dispatchEvent(new Event(CATALOG_POSE_CHANGED));
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function measureLayout() {
|
|
111
|
+
if (!ring) return;
|
|
112
|
+
const { width, left } = ring.getBoundingClientRect();
|
|
113
|
+
const metrics = stage?.getLayoutMetrics?.('stable') ?? {
|
|
114
|
+
width: innerWidth,
|
|
115
|
+
height: innerHeight,
|
|
116
|
+
scrollbarWidth: innerWidth - document.documentElement.clientWidth
|
|
117
|
+
};
|
|
118
|
+
layout = resolveCarouselPoseLayout(
|
|
119
|
+
{ ...metrics, hasHeadline: Boolean(section.headline), hasEyebrow: true },
|
|
120
|
+
{ width, left }
|
|
121
|
+
);
|
|
122
|
+
invalidate();
|
|
123
|
+
}
|
|
124
|
+
function commit(key: string | undefined) {
|
|
125
|
+
const changed = key !== selected;
|
|
126
|
+
requested = key;
|
|
127
|
+
if (changed) {
|
|
128
|
+
sections?.remember();
|
|
129
|
+
const item = list.find((item) => carouselKey(item) === key);
|
|
130
|
+
if (item && key) onselectionchange?.({ itemKey: key, spatialElementId: item.id });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function releaseDrag() {
|
|
134
|
+
ring?.closest('section')?.removeAttribute('data-carousel-dragging');
|
|
135
|
+
clearTimeout(wheelTimer);
|
|
136
|
+
const current = drag;
|
|
137
|
+
drag = undefined;
|
|
138
|
+
wheelInput = undefined;
|
|
139
|
+
window.removeEventListener('pointermove', pointermove);
|
|
140
|
+
window.removeEventListener('pointerup', pointerup);
|
|
141
|
+
window.removeEventListener('pointercancel', pointercancel);
|
|
142
|
+
if (current?.kind === 'pointer' && ring?.hasPointerCapture(current.id))
|
|
143
|
+
ring.releasePointerCapture(current.id);
|
|
144
|
+
}
|
|
145
|
+
// One clock drives the turntable and foreground reveal. No scrollLeft writes,
|
|
146
|
+
// snap handoff or velocity overshoot can move the destination sideways first.
|
|
147
|
+
function animate(target: number, reveal = false, velocity = 0) {
|
|
148
|
+
cancelAnimationFrame(frame);
|
|
149
|
+
const start = phase,
|
|
150
|
+
initial = reveal ? currentEmphasis() : undefined;
|
|
151
|
+
if (!reveal) emphasis = undefined;
|
|
152
|
+
const started = performance.now();
|
|
153
|
+
const duration = reveal ? 240 : Math.min(600, 280 + Math.abs(target - start) * 40);
|
|
154
|
+
const reduced = document.hidden || matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
155
|
+
const advance = (now: number) => {
|
|
156
|
+
frame = 0;
|
|
157
|
+
if (blocked()) return;
|
|
158
|
+
// A queued frame timestamp can precede the release event within that frame.
|
|
159
|
+
const t = reduced ? 1 : Math.max(0, Math.min(1, (now - started) / duration));
|
|
160
|
+
const inertia =
|
|
161
|
+
!reduced && velocity * (target - start) > 0
|
|
162
|
+
? sampleCarouselInertia(start, velocity, target, now - started)
|
|
163
|
+
: undefined;
|
|
164
|
+
const amount = inertia?.progress ?? 1 - (1 - t) ** 2;
|
|
165
|
+
// A nearby endpoint can absorb the horizontal speed in one frame. Keep
|
|
166
|
+
// foreground travel continuous, starting now, even in that limiting case.
|
|
167
|
+
const revealAmount = inertia ? Math.min(amount, 1 - (1 - t) ** 2) : amount;
|
|
168
|
+
const finished = inertia ? inertia.finished && t === 1 : t === 1;
|
|
169
|
+
phase = inertia?.phase ?? start + (target - start) * amount;
|
|
170
|
+
if (initial)
|
|
171
|
+
emphasis = initial.map((value, i) => ({
|
|
172
|
+
advance: value.advance * (1 - revealAmount) + (i === target ? revealAmount : 0),
|
|
173
|
+
panel: value.panel * (1 - revealAmount) + (i === target ? revealAmount : 0)
|
|
174
|
+
}));
|
|
175
|
+
if (finished) {
|
|
176
|
+
emphasis = undefined;
|
|
177
|
+
announced = selected;
|
|
178
|
+
}
|
|
179
|
+
invalidate();
|
|
180
|
+
if (!finished) frame = requestAnimationFrame(advance);
|
|
181
|
+
};
|
|
182
|
+
if (reduced) advance(started);
|
|
183
|
+
else frame = requestAnimationFrame(advance);
|
|
184
|
+
}
|
|
185
|
+
function beginDrag(id: number, kind: 'pointer' | 'wheel', x: number, y = 0, touch = false) {
|
|
186
|
+
// A tap or zero wheel sample must not interrupt a running selection.
|
|
187
|
+
const time = performance.now();
|
|
188
|
+
drag = {
|
|
189
|
+
id,
|
|
190
|
+
kind,
|
|
191
|
+
x,
|
|
192
|
+
y,
|
|
193
|
+
touch,
|
|
194
|
+
time,
|
|
195
|
+
motion: new CarouselDrag(x, phase, time),
|
|
196
|
+
emphasis: new CarouselDragEmphasis(phase, currentEmphasis())
|
|
197
|
+
};
|
|
198
|
+
clearTimeout(clickTimer);
|
|
199
|
+
suppressClick = false;
|
|
200
|
+
}
|
|
201
|
+
function moveDrag(x: number) {
|
|
202
|
+
if (!drag) return;
|
|
203
|
+
if (!drag.motion.active) {
|
|
204
|
+
drag.motion = new CarouselDrag(drag.x, phase, drag.time);
|
|
205
|
+
drag.emphasis = new CarouselDragEmphasis(phase, currentEmphasis());
|
|
206
|
+
}
|
|
207
|
+
drag.motion.move(x, performance.now(), keys.length);
|
|
208
|
+
if (!drag.motion.active) return;
|
|
209
|
+
if (drag.kind === 'pointer' && !drag.touch)
|
|
210
|
+
ring.closest('section')?.setAttribute('data-carousel-dragging', '');
|
|
211
|
+
cancelAnimationFrame(frame);
|
|
212
|
+
suppressClick = true;
|
|
213
|
+
phase = drag.motion.phase;
|
|
214
|
+
emphasis = drag.emphasis.move(phase);
|
|
215
|
+
invalidate();
|
|
216
|
+
}
|
|
217
|
+
function endDrag(x?: number, inertia = false) {
|
|
218
|
+
if (!drag) return;
|
|
219
|
+
const { motion, touch, kind } = drag;
|
|
220
|
+
// An idle timeout detects wheel release after the fact; use the final
|
|
221
|
+
// sample's time so this bookkeeping delay does not discard its velocity.
|
|
222
|
+
const wheelRelease = kind === 'wheel' && inertia && (wheelInput?.samples ?? 0) > 1;
|
|
223
|
+
const release = motion.release(
|
|
224
|
+
wheelRelease ? wheelInput!.lastTime! : performance.now(),
|
|
225
|
+
keys.length,
|
|
226
|
+
x
|
|
227
|
+
);
|
|
228
|
+
const active = motion.active;
|
|
229
|
+
if (active) {
|
|
230
|
+
phase = motion.phase;
|
|
231
|
+
emphasis = drag.emphasis.move(phase);
|
|
232
|
+
}
|
|
233
|
+
const velocity =
|
|
234
|
+
inertia &&
|
|
235
|
+
(kind === 'pointer' || wheelRelease) &&
|
|
236
|
+
Math.abs(release.velocity) >= 0.0005 &&
|
|
237
|
+
!matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
238
|
+
? release.velocity
|
|
239
|
+
: 0;
|
|
240
|
+
releaseDrag();
|
|
241
|
+
if (active) {
|
|
242
|
+
const target = velocity ? release.target : Math.round(clampCarouselPhase(phase, keys.length));
|
|
243
|
+
commit(keys[target]);
|
|
244
|
+
animate(target, true, velocity);
|
|
245
|
+
}
|
|
246
|
+
clearTimeout(clickTimer);
|
|
247
|
+
clickTimer = setTimeout(
|
|
248
|
+
() => {
|
|
249
|
+
suppressClick = false;
|
|
250
|
+
},
|
|
251
|
+
touch ? 400 : 0
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
function canStartDrag(target: EventTarget | null, touch = false) {
|
|
255
|
+
if (
|
|
256
|
+
!(target instanceof Element) ||
|
|
257
|
+
target.closest('.controls, .carousel-arrows, input, textarea, select, [contenteditable]')
|
|
258
|
+
)
|
|
259
|
+
return false;
|
|
260
|
+
return touch || !target.closest('a, button') || !!target.closest('.spatial-element-target');
|
|
261
|
+
}
|
|
262
|
+
function pointerdown(event: PointerEvent) {
|
|
263
|
+
if (!interactive || blocked() || list.length < 2) return;
|
|
264
|
+
if (!event.isPrimary) {
|
|
265
|
+
if (drag?.kind === 'pointer') endDrag();
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (drag?.kind === 'wheel') endDrag();
|
|
269
|
+
const touch = event.pointerType !== 'mouse';
|
|
270
|
+
if (!touch && carouselTextHit(event.target, event.clientX, event.clientY)) return;
|
|
271
|
+
if (drag || event.button !== 0 || !canStartDrag(event.target, touch)) return;
|
|
272
|
+
if (!touch) event.preventDefault();
|
|
273
|
+
beginDrag(event.pointerId, 'pointer', event.clientX, event.clientY, touch);
|
|
274
|
+
window.addEventListener('pointermove', pointermove);
|
|
275
|
+
window.addEventListener('pointerup', pointerup);
|
|
276
|
+
window.addEventListener('pointercancel', pointercancel);
|
|
277
|
+
}
|
|
278
|
+
function pointermove(event: PointerEvent) {
|
|
279
|
+
if (drag?.kind !== 'pointer' || drag.id !== event.pointerId || blocked()) return;
|
|
280
|
+
if (
|
|
281
|
+
drag.touch &&
|
|
282
|
+
!drag.motion.active &&
|
|
283
|
+
Math.abs(event.clientX - drag.x) <= Math.abs(event.clientY - drag.y) * 1.2
|
|
284
|
+
)
|
|
285
|
+
return;
|
|
286
|
+
moveDrag(event.clientX);
|
|
287
|
+
if (drag?.motion.active && !ring.hasPointerCapture(event.pointerId))
|
|
288
|
+
ring.setPointerCapture(event.pointerId);
|
|
289
|
+
}
|
|
290
|
+
function pointerup(event: PointerEvent) {
|
|
291
|
+
if (drag?.kind !== 'pointer' || drag.id !== event.pointerId) return;
|
|
292
|
+
// Do not turn a native vertical gesture or a tap into a horizontal release.
|
|
293
|
+
endDrag(drag.motion.active ? event.clientX : undefined, true);
|
|
294
|
+
}
|
|
295
|
+
function pointercancel(event: PointerEvent) {
|
|
296
|
+
if (drag?.kind === 'pointer' && drag.id === event.pointerId) endDrag();
|
|
297
|
+
}
|
|
298
|
+
function wheel(event: WheelEvent) {
|
|
299
|
+
if (
|
|
300
|
+
!interactive ||
|
|
301
|
+
blocked() ||
|
|
302
|
+
list.length < 2 ||
|
|
303
|
+
event.ctrlKey ||
|
|
304
|
+
(drag && drag.kind !== 'wheel')
|
|
305
|
+
)
|
|
306
|
+
return;
|
|
307
|
+
const scale = event.deltaMode === 1 ? 16 : event.deltaMode === 2 ? ring.clientWidth : 1;
|
|
308
|
+
const dx = (event.shiftKey && !event.deltaX ? event.deltaY : event.deltaX) * scale;
|
|
309
|
+
const dy = event.shiftKey && !event.deltaX ? 0 : event.deltaY * scale;
|
|
310
|
+
if (!drag && (!dx || Math.abs(dx) <= Math.abs(dy) * 1.2)) return;
|
|
311
|
+
if (event.cancelable) event.preventDefault();
|
|
312
|
+
// Newer browsers identify the platform's inertial tail. Finish once and
|
|
313
|
+
// ignore that tail; never add a second fling or reopen the withdrawn panel.
|
|
314
|
+
if ((event as WheelEvent & { momentum?: boolean }).momentum === true) {
|
|
315
|
+
if (drag?.kind === 'wheel') endDrag(undefined, true);
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
if (!dx && !drag) return;
|
|
319
|
+
if (!drag) {
|
|
320
|
+
beginDrag(0, 'wheel', 0);
|
|
321
|
+
wheelInput = new CarouselWheelInput();
|
|
322
|
+
}
|
|
323
|
+
if (!wheelInput) return;
|
|
324
|
+
wheelInput.move(dx, performance.now());
|
|
325
|
+
moveDrag(wheelInput.x);
|
|
326
|
+
clearTimeout(wheelTimer);
|
|
327
|
+
wheelTimer = setTimeout(() => {
|
|
328
|
+
if (drag?.kind === 'wheel') endDrag(undefined, true);
|
|
329
|
+
}, wheelInput.idleMs);
|
|
330
|
+
}
|
|
331
|
+
function select(key: string | undefined) {
|
|
332
|
+
releaseDrag();
|
|
333
|
+
commit(key);
|
|
334
|
+
if (interactive) animate(Math.max(0, keys.indexOf(key ?? '')));
|
|
335
|
+
else scrollNative(key, true);
|
|
336
|
+
}
|
|
337
|
+
function scrollNative(key: string | undefined, smooth = false) {
|
|
338
|
+
if (!ring || !keys.length || interactive) return;
|
|
339
|
+
const index = Math.max(0, keys.indexOf(key ?? ''));
|
|
340
|
+
const seat = (index - initialIndex + keys.length) % keys.length;
|
|
341
|
+
ring.scrollTo({
|
|
342
|
+
left: seat * ring.clientWidth,
|
|
343
|
+
behavior:
|
|
344
|
+
smooth && !matchMedia('(prefers-reduced-motion: reduce)').matches ? 'smooth' : 'instant'
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
function nativeScroll() {
|
|
348
|
+
if (interactive || nativeFrame || !keys.length) return;
|
|
349
|
+
nativeFrame = requestAnimationFrame(() => {
|
|
350
|
+
nativeFrame = 0;
|
|
351
|
+
if (interactive) return;
|
|
352
|
+
const seat = Math.round(ring.scrollLeft / Math.max(1, ring.clientWidth));
|
|
353
|
+
const index = (seat + initialIndex) % keys.length;
|
|
354
|
+
phase = windowPhase = index;
|
|
355
|
+
announced = keys[index];
|
|
356
|
+
commit(keys[index]);
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
function keydown(event: KeyboardEvent) {
|
|
360
|
+
const step = event.key === 'ArrowRight' ? 1 : event.key === 'ArrowLeft' ? -1 : 0;
|
|
361
|
+
if (step) select(stepCarouselSelection(keys, selected, step));
|
|
362
|
+
else if (event.key === 'Home') select(keys[0]);
|
|
363
|
+
else if (event.key === 'End') select(keys.at(-1));
|
|
364
|
+
else return;
|
|
365
|
+
event.preventDefault();
|
|
366
|
+
}
|
|
367
|
+
function resetMotion() {
|
|
368
|
+
cancelAnimationFrame(frame);
|
|
369
|
+
cancelAnimationFrame(nativeFrame);
|
|
370
|
+
frame = nativeFrame = 0;
|
|
371
|
+
releaseDrag();
|
|
372
|
+
phase = windowPhase = Math.max(0, keys.indexOf(selected ?? ''));
|
|
373
|
+
emphasis = undefined;
|
|
374
|
+
announced = selected;
|
|
375
|
+
invalidate();
|
|
376
|
+
}
|
|
377
|
+
$effect(() => {
|
|
378
|
+
const enhanced = interactive,
|
|
379
|
+
signature = JSON.stringify(keys);
|
|
380
|
+
untrack(() => {
|
|
381
|
+
if (!mounted) return;
|
|
382
|
+
const token = ++generation;
|
|
383
|
+
resetMotion();
|
|
384
|
+
void tick().then(() => {
|
|
385
|
+
if (!mounted || token !== generation) return;
|
|
386
|
+
if (enhanced) ring.scrollLeft = 0;
|
|
387
|
+
else {
|
|
388
|
+
for (const panel of ring.querySelectorAll<HTMLElement>('.summary'))
|
|
389
|
+
panel.style.removeProperty('transform');
|
|
390
|
+
for (const target of ring.querySelectorAll<HTMLElement>('.spatial-element-target'))
|
|
391
|
+
for (const property of ['left', 'top', 'width', 'height', 'max-width'])
|
|
392
|
+
target.style.removeProperty(property);
|
|
393
|
+
scrollNative(selected);
|
|
394
|
+
}
|
|
395
|
+
measureLayout();
|
|
396
|
+
});
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
onMount(() => {
|
|
400
|
+
mounted = true;
|
|
401
|
+
const carouselRing = ring;
|
|
402
|
+
const nativeSeat = Math.round(ring.scrollLeft / Math.max(1, ring.clientWidth));
|
|
403
|
+
const nativeInitialKey = keys[(nativeSeat + initialIndex) % Math.max(1, keys.length)];
|
|
404
|
+
let restored = false;
|
|
405
|
+
const release = sections?.register(section.id, {
|
|
406
|
+
read: () => selected,
|
|
407
|
+
restore: (key) => {
|
|
408
|
+
requested = resolveCarouselSelection(
|
|
409
|
+
keys,
|
|
410
|
+
key ?? (!restored && !interactive ? nativeInitialKey : initialItemKey)
|
|
411
|
+
);
|
|
412
|
+
restored = true;
|
|
413
|
+
resetMotion();
|
|
414
|
+
void tick().then(() => {
|
|
415
|
+
if (mounted) scrollNative(requested);
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
measureLayout();
|
|
420
|
+
const observer = new ResizeObserver(measureLayout);
|
|
421
|
+
observer.observe(carouselRing);
|
|
422
|
+
const dragSection = ring.closest('section')!;
|
|
423
|
+
dragSection.addEventListener('wheel', wheel, { passive: false });
|
|
424
|
+
const stop = () => {
|
|
425
|
+
if (drag) endDrag();
|
|
426
|
+
};
|
|
427
|
+
const hidden = () => {
|
|
428
|
+
if (document.hidden) resetMotion();
|
|
429
|
+
};
|
|
430
|
+
const escape = (event: KeyboardEvent) => {
|
|
431
|
+
if (event.key === 'Escape') stop();
|
|
432
|
+
};
|
|
433
|
+
window.addEventListener('blur', stop);
|
|
434
|
+
window.addEventListener('keydown', escape);
|
|
435
|
+
window.addEventListener('resize', measureLayout);
|
|
436
|
+
window.addEventListener(STAGE_PANEL_LAYOUT_EVENT, measureLayout);
|
|
437
|
+
document.addEventListener('visibilitychange', hidden);
|
|
438
|
+
return () => {
|
|
439
|
+
mounted = false;
|
|
440
|
+
generation++;
|
|
441
|
+
cancelAnimationFrame(frame);
|
|
442
|
+
cancelAnimationFrame(nativeFrame);
|
|
443
|
+
clearTimeout(clickTimer);
|
|
444
|
+
releaseDrag();
|
|
445
|
+
observer.disconnect();
|
|
446
|
+
release?.();
|
|
447
|
+
dragSection.removeEventListener('wheel', wheel);
|
|
448
|
+
window.removeEventListener('blur', stop);
|
|
449
|
+
window.removeEventListener('keydown', escape);
|
|
450
|
+
window.removeEventListener('resize', measureLayout);
|
|
451
|
+
window.removeEventListener(STAGE_PANEL_LAYOUT_EVENT, measureLayout);
|
|
452
|
+
document.removeEventListener('visibilitychange', hidden);
|
|
453
|
+
};
|
|
454
|
+
});
|
|
455
|
+
</script>
|
|
456
|
+
|
|
457
|
+
<Section
|
|
458
|
+
{section}
|
|
459
|
+
presentation="list"
|
|
460
|
+
class="carousel-drag-section"
|
|
461
|
+
ondragstart={(event) => {
|
|
462
|
+
if (interactive && canStartDrag(event.target)) event.preventDefault();
|
|
463
|
+
}}
|
|
464
|
+
onpointerdown={pointerdown}
|
|
465
|
+
onclickcapture={(event) => {
|
|
466
|
+
if (suppressClick) {
|
|
467
|
+
event.preventDefault();
|
|
468
|
+
event.stopPropagation();
|
|
469
|
+
}
|
|
470
|
+
}}
|
|
471
|
+
onlostpointercapture={(event) => {
|
|
472
|
+
// Touch starts with implicit capture on its hit target. Moving capture to
|
|
473
|
+
// the ring must not be mistaken for the end of that same gesture.
|
|
474
|
+
if (event.target === ring && drag?.kind === 'pointer' && drag.id === event.pointerId) endDrag();
|
|
475
|
+
}}
|
|
476
|
+
>
|
|
477
|
+
{#if interactive}
|
|
478
|
+
<div
|
|
479
|
+
class="drag-surface"
|
|
480
|
+
aria-hidden="true"
|
|
481
|
+
style:left={section.background?.size === 'full' ? `${-layout.left}px` : '0'}
|
|
482
|
+
style:width={section.background?.size === 'full' ? `${layout.viewportWidth}px` : '100%'}
|
|
483
|
+
></div>
|
|
484
|
+
{/if}
|
|
485
|
+
<div
|
|
486
|
+
class="carousel"
|
|
487
|
+
class:interactive
|
|
488
|
+
class:populated={list.length > 0}
|
|
489
|
+
data-carousel-section={section.id}
|
|
490
|
+
data-device-orientation=""
|
|
491
|
+
>
|
|
492
|
+
<!-- svelte-ignore a11y_no_noninteractive_tabindex (The native scroll rail must be keyboard-scrollable without JavaScript.) -->
|
|
493
|
+
<div
|
|
494
|
+
class="ring"
|
|
495
|
+
id={`carousel-ring-${section.id}`}
|
|
496
|
+
tabindex={interactive ? undefined : 0}
|
|
497
|
+
bind:this={ring}
|
|
498
|
+
onscroll={nativeScroll}
|
|
499
|
+
role="group"
|
|
500
|
+
aria-label={section.title}
|
|
501
|
+
>
|
|
502
|
+
{#each orderedItems as [index, spatialElement] (carouselKey(spatialElement))}
|
|
503
|
+
<CarouselSpatialElement
|
|
504
|
+
{spatialElement}
|
|
505
|
+
sectionId={section.id}
|
|
506
|
+
{presentation}
|
|
507
|
+
{layout}
|
|
508
|
+
{index}
|
|
509
|
+
count={list.length}
|
|
510
|
+
{phase}
|
|
511
|
+
emphasis={emphasis?.[index]}
|
|
512
|
+
{focus}
|
|
513
|
+
{windowPhase}
|
|
514
|
+
selected={selected === carouselKey(spatialElement)}
|
|
515
|
+
{interactive}
|
|
516
|
+
onselect={() => {
|
|
517
|
+
if (!suppressClick) select(carouselKey(spatialElement));
|
|
518
|
+
}}
|
|
519
|
+
canActivate={() => !suppressClick}
|
|
520
|
+
/>
|
|
521
|
+
{/each}
|
|
522
|
+
{#if interactive && list.length > 1}
|
|
523
|
+
<div
|
|
524
|
+
class="carousel-arrows"
|
|
525
|
+
role="group"
|
|
526
|
+
aria-label="Carousel navigation"
|
|
527
|
+
style:opacity={arrowOpacity}
|
|
528
|
+
inert={arrowOpacity < 0.05}
|
|
529
|
+
>
|
|
530
|
+
<button
|
|
531
|
+
type="button"
|
|
532
|
+
class="previous"
|
|
533
|
+
hidden={selected === keys[0]}
|
|
534
|
+
aria-label="Previous product"
|
|
535
|
+
aria-controls={`carousel-ring-${section.id}`}
|
|
536
|
+
onclick={() => select(stepCarouselSelection(keys, selected, -1))}
|
|
537
|
+
>
|
|
538
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m14 6-6 6 6 6" /></svg>
|
|
539
|
+
</button>
|
|
540
|
+
<button
|
|
541
|
+
type="button"
|
|
542
|
+
class="next"
|
|
543
|
+
hidden={selected === keys.at(-1)}
|
|
544
|
+
aria-label="Next product"
|
|
545
|
+
aria-controls={`carousel-ring-${section.id}`}
|
|
546
|
+
onclick={() => select(stepCarouselSelection(keys, selected, 1))}
|
|
547
|
+
>
|
|
548
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m10 6 6 6-6 6" /></svg>
|
|
549
|
+
</button>
|
|
550
|
+
</div>
|
|
551
|
+
{/if}
|
|
552
|
+
</div>
|
|
553
|
+
{#if list.length > 0}
|
|
554
|
+
<div class="controls" role="group" aria-label={`${section.title}: element selection`}>
|
|
555
|
+
{#if list.length > 1}
|
|
556
|
+
{#each list as spatialElement (carouselKey(spatialElement))}
|
|
557
|
+
{#if interactive}
|
|
558
|
+
<button
|
|
559
|
+
onkeydown={keydown}
|
|
560
|
+
aria-label={spatialElement.eyebrow || spatialElement.title}
|
|
561
|
+
aria-pressed={indicated === carouselKey(spatialElement)}
|
|
562
|
+
onclick={() => select(carouselKey(spatialElement))}
|
|
563
|
+
><span aria-hidden="true"></span></button
|
|
564
|
+
>
|
|
565
|
+
{:else}
|
|
566
|
+
<a
|
|
567
|
+
href={`#carousel-${section.id}-${list.indexOf(spatialElement)}`}
|
|
568
|
+
aria-label={spatialElement.eyebrow || spatialElement.title}
|
|
569
|
+
aria-current={selected === carouselKey(spatialElement) ? 'true' : undefined}
|
|
570
|
+
onclick={(event) => {
|
|
571
|
+
event.preventDefault();
|
|
572
|
+
select(carouselKey(spatialElement));
|
|
573
|
+
}}><span aria-hidden="true"></span></a
|
|
574
|
+
>
|
|
575
|
+
{/if}
|
|
576
|
+
{/each}
|
|
577
|
+
{/if}
|
|
578
|
+
</div>
|
|
579
|
+
{/if}
|
|
580
|
+
{#if interactive}<p class="sr-only" role="status">
|
|
581
|
+
{list.find((item) => carouselKey(item) === announced)?.title ?? ''}
|
|
582
|
+
</p>{/if}
|
|
583
|
+
</div>
|
|
584
|
+
</Section>
|
|
585
|
+
|
|
586
|
+
<style>
|
|
587
|
+
/* Clip projected DOM hit regions to the same surface as the GPU models. */
|
|
588
|
+
:global(.carousel-drag-section) {
|
|
589
|
+
position: relative;
|
|
590
|
+
clip-path: inset(0);
|
|
591
|
+
}
|
|
592
|
+
:global(.carousel-drag-section[data-section-background-size='full']) {
|
|
593
|
+
clip-path: inset(0 calc(50% - 50vw));
|
|
594
|
+
}
|
|
595
|
+
:global(.carousel-drag-section:has(.interactive)) {
|
|
596
|
+
touch-action: pan-y pinch-zoom;
|
|
597
|
+
}
|
|
598
|
+
:global(.carousel-drag-section > .ps-section-content > .section-heading .headline) {
|
|
599
|
+
/* Match the carousel resolver's measured heading budget. */
|
|
600
|
+
font-size: var(--spatial-grid-headline-size);
|
|
601
|
+
line-height: var(--spatial-grid-headline-line-height);
|
|
602
|
+
pointer-events: none;
|
|
603
|
+
}
|
|
604
|
+
.drag-surface {
|
|
605
|
+
position: absolute;
|
|
606
|
+
top: 0;
|
|
607
|
+
bottom: 0;
|
|
608
|
+
pointer-events: auto;
|
|
609
|
+
touch-action: pan-y pinch-zoom;
|
|
610
|
+
cursor: grab;
|
|
611
|
+
}
|
|
612
|
+
:global(.carousel.interactive .summary) {
|
|
613
|
+
cursor: grab;
|
|
614
|
+
}
|
|
615
|
+
:global(.carousel.interactive .summary a),
|
|
616
|
+
:global(.carousel.interactive .summary button) {
|
|
617
|
+
cursor: pointer;
|
|
618
|
+
}
|
|
619
|
+
:global(.carousel.interactive [data-carousel-text-hit]) {
|
|
620
|
+
cursor: text;
|
|
621
|
+
}
|
|
622
|
+
:global(.carousel-drag-section[data-carousel-dragging]),
|
|
623
|
+
:global(.carousel-drag-section[data-carousel-dragging] *) {
|
|
624
|
+
cursor: grabbing !important;
|
|
625
|
+
user-select: none;
|
|
626
|
+
}
|
|
627
|
+
.carousel.interactive {
|
|
628
|
+
pointer-events: none;
|
|
629
|
+
}
|
|
630
|
+
.carousel {
|
|
631
|
+
pointer-events: auto;
|
|
632
|
+
margin-top: 0;
|
|
633
|
+
}
|
|
634
|
+
.ring {
|
|
635
|
+
container-type: inline-size;
|
|
636
|
+
display: grid;
|
|
637
|
+
grid-auto-flow: column;
|
|
638
|
+
grid-auto-columns: 100%;
|
|
639
|
+
position: relative;
|
|
640
|
+
height: calc(var(--spatial-carousel-title-reserve) + var(--spatial-carousel-fit-height));
|
|
641
|
+
overflow-x: auto;
|
|
642
|
+
overflow-y: hidden;
|
|
643
|
+
scroll-snap-type: x mandatory;
|
|
644
|
+
overscroll-behavior-x: contain;
|
|
645
|
+
scrollbar-width: none;
|
|
646
|
+
scrollbar-color: var(--spatial-element-accent) transparent;
|
|
647
|
+
touch-action: manipulation;
|
|
648
|
+
}
|
|
649
|
+
.ring:focus-visible {
|
|
650
|
+
outline: 2px solid var(--spatial-element-accent);
|
|
651
|
+
outline-offset: 4px;
|
|
652
|
+
}
|
|
653
|
+
.interactive .ring {
|
|
654
|
+
scrollbar-width: none;
|
|
655
|
+
grid-auto-flow: row;
|
|
656
|
+
grid-template-columns: 100%;
|
|
657
|
+
overflow: visible;
|
|
658
|
+
scroll-snap-type: none;
|
|
659
|
+
}
|
|
660
|
+
.carousel-arrows {
|
|
661
|
+
position: absolute;
|
|
662
|
+
left: var(--spatial-carousel-fit-left);
|
|
663
|
+
width: var(--spatial-carousel-fit-width);
|
|
664
|
+
top: calc(var(--spatial-carousel-title-reserve) + var(--spatial-carousel-fit-height) / 2);
|
|
665
|
+
transform: translateY(-50%);
|
|
666
|
+
z-index: 1500;
|
|
667
|
+
display: flex;
|
|
668
|
+
justify-content: space-between;
|
|
669
|
+
pointer-events: none;
|
|
670
|
+
}
|
|
671
|
+
.carousel-arrows button {
|
|
672
|
+
pointer-events: auto;
|
|
673
|
+
width: 44px;
|
|
674
|
+
height: 44px;
|
|
675
|
+
display: grid;
|
|
676
|
+
place-items: center;
|
|
677
|
+
padding: 8px;
|
|
678
|
+
border: 0;
|
|
679
|
+
border-radius: 50%;
|
|
680
|
+
color: var(--spatial-element-accent);
|
|
681
|
+
background: transparent;
|
|
682
|
+
cursor: pointer;
|
|
683
|
+
}
|
|
684
|
+
.carousel-arrows button[hidden] {
|
|
685
|
+
visibility: hidden;
|
|
686
|
+
pointer-events: none;
|
|
687
|
+
}
|
|
688
|
+
.carousel-arrows button:hover {
|
|
689
|
+
background: color-mix(in srgb, var(--spatial-element-accent) 12%, transparent);
|
|
690
|
+
}
|
|
691
|
+
.carousel-arrows button:focus-visible {
|
|
692
|
+
outline: 2px solid var(--spatial-element-accent);
|
|
693
|
+
}
|
|
694
|
+
.carousel-arrows svg {
|
|
695
|
+
width: 24px;
|
|
696
|
+
height: 24px;
|
|
697
|
+
fill: none;
|
|
698
|
+
stroke: currentColor;
|
|
699
|
+
stroke-width: 2;
|
|
700
|
+
stroke-linecap: round;
|
|
701
|
+
stroke-linejoin: round;
|
|
702
|
+
}
|
|
703
|
+
.controls {
|
|
704
|
+
position: relative;
|
|
705
|
+
display: flex;
|
|
706
|
+
justify-content: center;
|
|
707
|
+
flex-wrap: nowrap;
|
|
708
|
+
height: var(--spatial-carousel-dots-height);
|
|
709
|
+
margin-top: var(--spatial-carousel-dots-gap);
|
|
710
|
+
overflow-x: auto;
|
|
711
|
+
scrollbar-width: none;
|
|
712
|
+
}
|
|
713
|
+
.controls button,
|
|
714
|
+
.controls a {
|
|
715
|
+
pointer-events: auto;
|
|
716
|
+
display: grid;
|
|
717
|
+
place-items: center;
|
|
718
|
+
flex: 0 0 var(--spatial-carousel-dots-height);
|
|
719
|
+
width: var(--spatial-carousel-dots-height);
|
|
720
|
+
height: var(--spatial-carousel-dots-height);
|
|
721
|
+
padding: 0;
|
|
722
|
+
border: 0;
|
|
723
|
+
background: transparent;
|
|
724
|
+
border-radius: 50%;
|
|
725
|
+
cursor: pointer;
|
|
726
|
+
}
|
|
727
|
+
.controls span {
|
|
728
|
+
width: 10px;
|
|
729
|
+
height: 10px;
|
|
730
|
+
border: 1px solid var(--spatial-element-accent);
|
|
731
|
+
border-radius: 50%;
|
|
732
|
+
}
|
|
733
|
+
.controls button[aria-pressed='true'] span,
|
|
734
|
+
.controls a[aria-current='true'] span {
|
|
735
|
+
background: var(--spatial-element-accent);
|
|
736
|
+
}
|
|
737
|
+
.controls button:focus-visible,
|
|
738
|
+
.controls a:focus-visible {
|
|
739
|
+
outline: 2px solid var(--spatial-element-accent);
|
|
740
|
+
outline-offset: -4px;
|
|
741
|
+
}
|
|
742
|
+
.sr-only {
|
|
743
|
+
position: absolute;
|
|
744
|
+
width: 1px;
|
|
745
|
+
height: 1px;
|
|
746
|
+
padding: 0;
|
|
747
|
+
margin: -1px;
|
|
748
|
+
overflow: hidden;
|
|
749
|
+
clip-path: inset(50%);
|
|
750
|
+
white-space: nowrap;
|
|
751
|
+
}
|
|
752
|
+
</style>
|