@spatial-elements/sveltekit 1.0.0-beta.4 → 1.0.0-beta.6
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 +6 -2
- package/dist/catalog/catalogTransition.css +12 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/spatial-element/BrandStageShell.svelte +9 -59
- package/dist/spatial-element/BrandStageShell.svelte.d.ts +2 -0
- package/dist/spatial-element/CarouselSection.svelte +339 -323
- package/dist/spatial-element/CarouselSection.svelte.d.ts +2 -7
- package/dist/spatial-element/CarouselSpatialElement.svelte +142 -127
- package/dist/spatial-element/CarouselSpatialElement.svelte.d.ts +5 -1
- package/dist/spatial-element/ContentPage.svelte +2 -1
- package/dist/spatial-element/PointerHint.svelte +78 -0
- package/dist/spatial-element/PointerHint.svelte.d.ts +3 -0
- package/dist/spatial-element/SpatialElementCard.svelte +68 -2
- package/dist/spatial-element/SpatialElementHelp.svelte +23 -14
- package/dist/spatial-element/SpatialElementMediaRail.svelte +22 -3
- package/dist/spatial-element/SpatialElementPage.svelte +2 -4
- package/dist/spatial-element/SpatialElementSummaryContent.svelte +182 -0
- package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +18 -0
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte +29 -375
- package/dist/spatial-element/SpatialElementTabs.svelte +2 -1
- package/dist/spatial-element/SpatialElementViewToggle.svelte +53 -0
- package/dist/spatial-element/SpatialElementViewToggle.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialIconButton.svelte +2 -1
- package/dist/spatial-element/brandContext.d.ts +1 -1
- package/dist/spatial-element/brandContext.js +1 -1
- package/dist/spatial-element/carouselTextHit.d.ts +2 -0
- package/dist/spatial-element/carouselTextHit.js +17 -0
- package/dist/spatial-element/spatialThemeStyle.d.ts +3 -0
- package/dist/spatial-element/spatialThemeStyle.js +48 -0
- package/dist/spatial-element/truncatedTitle.d.ts +5 -0
- package/dist/spatial-element/truncatedTitle.js +28 -0
- package/dist/stage/ButtonGroup.svelte +163 -0
- package/dist/stage/ButtonGroup.svelte.d.ts +24 -0
- package/dist/stage/Panel.svelte +24 -9
- package/dist/stage/Stage.svelte +91 -5
- package/dist/stage/Stage.svelte.d.ts +2 -0
- package/dist/stage/StageViewport.svelte +7 -1
- 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/package.json +2 -2
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getContext } from 'svelte';
|
|
3
|
+
import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
|
|
4
|
+
import { truncatedTitle } from './truncatedTitle.js';
|
|
3
5
|
import { useSpatialTheme } from './brandContext.js';
|
|
4
6
|
import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
|
|
5
7
|
import { createCatalogEndpointAction } from '../catalog/catalogEndpointAction.js';
|
|
@@ -15,7 +17,8 @@
|
|
|
15
17
|
occurrence,
|
|
16
18
|
order = 0
|
|
17
19
|
}: { spatialElement: SpatialListItem; occurrence: string; order?: number } = $props();
|
|
18
|
-
const
|
|
20
|
+
const readTheme = useSpatialTheme();
|
|
21
|
+
const brand = $derived(readTheme());
|
|
19
22
|
const catalogEndpoint = createCatalogEndpointAction();
|
|
20
23
|
const endpoints = getContext<CatalogEndpointRegistry | undefined>(CATALOG_ENDPOINTS);
|
|
21
24
|
const items = getContext<CatalogItems | undefined>(CATALOG_ITEMS);
|
|
@@ -34,6 +37,7 @@
|
|
|
34
37
|
</script>
|
|
35
38
|
|
|
36
39
|
<a
|
|
40
|
+
use:mouseHover
|
|
37
41
|
use:catalogEndpoint={{
|
|
38
42
|
brandId: brand.id,
|
|
39
43
|
spatialElementId: spatialElement.id,
|
|
@@ -135,6 +139,7 @@
|
|
|
135
139
|
{spatialElement.eyebrow}
|
|
136
140
|
</p>
|
|
137
141
|
<h3
|
|
142
|
+
use:truncatedTitle={spatialElement.title}
|
|
138
143
|
use:catalogEndpoint={{
|
|
139
144
|
brandId: brand.id,
|
|
140
145
|
spatialElementId: spatialElement.id,
|
|
@@ -160,6 +165,12 @@
|
|
|
160
165
|
font-weight: 720;
|
|
161
166
|
letter-spacing: 0.04em;
|
|
162
167
|
text-transform: uppercase;
|
|
168
|
+
line-height: 1.4;
|
|
169
|
+
height: 1lh;
|
|
170
|
+
overflow: hidden;
|
|
171
|
+
white-space: nowrap;
|
|
172
|
+
text-overflow: ellipsis;
|
|
173
|
+
transform: translateZ(var(--card-eyebrow-depth, 0px));
|
|
163
174
|
}
|
|
164
175
|
.catalog-loading {
|
|
165
176
|
position: absolute;
|
|
@@ -195,6 +206,7 @@
|
|
|
195
206
|
color: var(--spatial-element-ink);
|
|
196
207
|
text-decoration: none;
|
|
197
208
|
transform-origin: center;
|
|
209
|
+
transform-style: preserve-3d;
|
|
198
210
|
transform: perspective(1000px) translate3d(0, var(--catalog-lift, 0px), 0)
|
|
199
211
|
rotateX(var(--catalog-rotate-x, 0deg)) rotateY(var(--catalog-rotate-y, 0deg));
|
|
200
212
|
}
|
|
@@ -216,11 +228,31 @@
|
|
|
216
228
|
transparent
|
|
217
229
|
);
|
|
218
230
|
box-shadow: 0 12px 32px rgb(0 0 0 / 0.06);
|
|
231
|
+
transition: border-color 180ms ease;
|
|
219
232
|
pointer-events: none;
|
|
220
233
|
}
|
|
234
|
+
.spatial-element-card:global([data-mouse-hover]) .spatial-element-card-surface,
|
|
235
|
+
.spatial-element-card:focus-visible .spatial-element-card-surface {
|
|
236
|
+
border-color: var(--spatial-element-accent);
|
|
237
|
+
}
|
|
238
|
+
.spatial-element-card-surface::after {
|
|
239
|
+
content: '';
|
|
240
|
+
position: absolute;
|
|
241
|
+
inset: -1px;
|
|
242
|
+
border-radius: inherit;
|
|
243
|
+
box-shadow: 0 0 0 1px color-mix(in srgb, var(--spatial-element-accent) 25%, transparent),
|
|
244
|
+
0 0 18px color-mix(in srgb, var(--spatial-element-accent) 18%, transparent);
|
|
245
|
+
opacity: 0;
|
|
246
|
+
transition: opacity 180ms ease;
|
|
247
|
+
}
|
|
248
|
+
.spatial-element-card:global([data-mouse-hover]) .spatial-element-card-surface::after,
|
|
249
|
+
.spatial-element-card:focus-visible .spatial-element-card-surface::after {
|
|
250
|
+
opacity: 1;
|
|
251
|
+
}
|
|
221
252
|
|
|
222
253
|
.spatial-element-card-geometry {
|
|
223
254
|
position: relative;
|
|
255
|
+
transform-style: preserve-3d;
|
|
224
256
|
height: 228px;
|
|
225
257
|
margin: 12px 12px 0;
|
|
226
258
|
pointer-events: none;
|
|
@@ -231,6 +263,8 @@
|
|
|
231
263
|
width: 100%;
|
|
232
264
|
height: 100%;
|
|
233
265
|
object-fit: contain;
|
|
266
|
+
transform: translateZ(var(--card-model-depth, 0px)) scale(var(--card-model-scale, 1));
|
|
267
|
+
transition: transform 260ms cubic-bezier(0.22, 0.75, 0.25, 1), opacity 240ms ease;
|
|
234
268
|
}
|
|
235
269
|
|
|
236
270
|
.spatial-element-card:global([data-catalog-model-ready]) .catalog-poster {
|
|
@@ -238,19 +272,51 @@
|
|
|
238
272
|
}
|
|
239
273
|
|
|
240
274
|
.spatial-element-card-copy {
|
|
275
|
+
position: relative;
|
|
241
276
|
padding: 14px 22px 24px;
|
|
277
|
+
transform-style: preserve-3d;
|
|
242
278
|
}
|
|
243
279
|
|
|
280
|
+
.spatial-element-card-eyebrow,
|
|
244
281
|
h3 {
|
|
282
|
+
text-shadow: var(--card-text-shadow, 0 0 0 transparent);
|
|
283
|
+
transition: transform 260ms cubic-bezier(0.22, 0.75, 0.25, 1),
|
|
284
|
+
text-shadow 260ms cubic-bezier(0.22, 0.75, 0.25, 1);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.spatial-element-card:global([data-mouse-hover]),
|
|
288
|
+
.spatial-element-card:focus-visible {
|
|
289
|
+
--card-eyebrow-depth: 40px;
|
|
290
|
+
--card-title-depth: 64px;
|
|
291
|
+
--card-model-depth: 96px;
|
|
292
|
+
--card-model-scale: 1.12;
|
|
293
|
+
--card-text-shadow: 0 4px 10px rgb(0 0 0 / 0.16);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
h3 {
|
|
297
|
+
display: -webkit-box;
|
|
298
|
+
-webkit-box-orient: vertical;
|
|
299
|
+
-webkit-line-clamp: 2;
|
|
300
|
+
line-clamp: 2;
|
|
301
|
+
height: 2lh;
|
|
302
|
+
overflow: hidden;
|
|
303
|
+
text-overflow: ellipsis;
|
|
304
|
+
overflow-wrap: anywhere;
|
|
245
305
|
margin: 8px 0 0;
|
|
246
306
|
font-size: 21px;
|
|
247
307
|
font-weight: 720;
|
|
248
308
|
line-height: 1.24;
|
|
309
|
+
transform: translateZ(var(--card-title-depth, 0px));
|
|
249
310
|
}
|
|
250
311
|
|
|
251
312
|
@media (prefers-reduced-motion: reduce) {
|
|
252
|
-
.spatial-element-card
|
|
313
|
+
.spatial-element-card,
|
|
314
|
+
.spatial-element-card-eyebrow,
|
|
315
|
+
.catalog-poster,
|
|
316
|
+
h3 {
|
|
253
317
|
transform: none;
|
|
318
|
+
transition: none;
|
|
319
|
+
text-shadow: none;
|
|
254
320
|
}
|
|
255
321
|
}
|
|
256
322
|
</style>
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { onMount, tick } from 'svelte';
|
|
2
|
+
import { getContext, onMount, tick } from 'svelte';
|
|
3
3
|
import { CircleHelp, X } from 'lucide-svelte';
|
|
4
4
|
import InteractionGesture from './InteractionGesture.svelte';
|
|
5
5
|
import { getCssPanelBoxShadow } from '@spatial-elements/core/stage/panelShadow';
|
|
6
6
|
import { getInteractionGuidance, MODEL_INPUT_EVENT, type ModelInputState, type InteractionGuidance } from '@spatial-elements/core/stage/interactionGuidance';
|
|
7
7
|
import { STAGE_SCROLL_PRIORITY, subscribeStageScrollFrame } from '@spatial-elements/core/stage/scrollFrame';
|
|
8
|
-
import { STAGE_PANEL_LAYOUT_EVENT } from '@spatial-elements/core/stage/panelContext';
|
|
8
|
+
import { STAGE_CONTEXT_KEY, STAGE_PANEL_LAYOUT_EVENT, type StageContext } from '@spatial-elements/core/stage/panelContext';
|
|
9
|
+
import SpatialElementViewToggle from './SpatialElementViewToggle.svelte';
|
|
9
10
|
import Panel from '../stage/Panel.svelte';
|
|
10
11
|
import SpatialIconButton from './SpatialIconButton.svelte';
|
|
11
12
|
import { useSpatialTheme } from './brandContext.js';
|
|
12
13
|
import { useSpatialMessages } from './messagesContext.js';
|
|
13
14
|
|
|
14
|
-
const
|
|
15
|
+
const readTheme = useSpatialTheme();
|
|
16
|
+
const theme = $derived(readTheme());
|
|
17
|
+
const stageContext = getContext<StageContext>(STAGE_CONTEXT_KEY);
|
|
18
|
+
const fullscreen = $derived(stageContext.isFullscreen?.() ?? false);
|
|
15
19
|
const readMessages = useSpatialMessages();
|
|
16
20
|
const messages = $derived(readMessages());
|
|
17
21
|
const help = $derived(messages.interactionHelp);
|
|
@@ -78,11 +82,12 @@
|
|
|
78
82
|
if (open) window.dispatchEvent(new Event(STAGE_PANEL_LAYOUT_EVENT));
|
|
79
83
|
}
|
|
80
84
|
async function show(keyboard = false) {
|
|
81
|
-
if (!enhanced || !visible) return;
|
|
85
|
+
if (!enhanced || (!visible && !fullscreen)) return;
|
|
82
86
|
clearDelay(); clearHideDelay();
|
|
83
87
|
popover.showPopover();
|
|
84
88
|
open = true;
|
|
85
89
|
await tick();
|
|
90
|
+
if (!open || !enhanced) return;
|
|
86
91
|
requestPosition();
|
|
87
92
|
if (keyboard) closeButton.focus({ preventScroll: true });
|
|
88
93
|
}
|
|
@@ -104,6 +109,9 @@
|
|
|
104
109
|
}
|
|
105
110
|
|
|
106
111
|
onMount(() => {
|
|
112
|
+
// The child component can clear bind:element before this mount cleanup runs.
|
|
113
|
+
// Remove listeners from the same node they were registered on.
|
|
114
|
+
const helpButton = button;
|
|
107
115
|
guidance = getInteractionGuidance();
|
|
108
116
|
touchInput = window.matchMedia('(pointer: coarse)').matches;
|
|
109
117
|
const stopGuidance = guidance.subscribe((state) => {
|
|
@@ -120,7 +128,7 @@
|
|
|
120
128
|
.filter((node) => { const rect = node.getBoundingClientRect(); return rect.width > innerWidth * 0.4 && rect.bottom <= top && rect.height > 0; })
|
|
121
129
|
.sort((a, b) => b.getBoundingClientRect().bottom - a.getBoundingClientRect().bottom)[0];
|
|
122
130
|
const measureSpacing = () => {
|
|
123
|
-
if (header) {
|
|
131
|
+
if (header && !fullscreen) {
|
|
124
132
|
const gap = Math.max(16, root.getBoundingClientRect().top - header.getBoundingClientRect().bottom - 12);
|
|
125
133
|
root.style.setProperty('--model-tools-gap', `${gap}px`);
|
|
126
134
|
}
|
|
@@ -160,13 +168,13 @@
|
|
|
160
168
|
};
|
|
161
169
|
const stopScroll = subscribeStageScrollFrame(() => {
|
|
162
170
|
if (!open) return;
|
|
163
|
-
const rect =
|
|
171
|
+
const rect = helpButton.getBoundingClientRect();
|
|
164
172
|
if (rect.bottom < 0 || rect.top > innerHeight) close();
|
|
165
173
|
else requestPosition();
|
|
166
174
|
}, STAGE_SCROLL_PRIORITY.stage + 1);
|
|
167
175
|
stage.addEventListener(MODEL_INPUT_EVENT, modelChanged);
|
|
168
|
-
|
|
169
|
-
|
|
176
|
+
helpButton.addEventListener('pointerenter', buttonEnter);
|
|
177
|
+
helpButton.addEventListener('pointerleave', buttonLeave);
|
|
170
178
|
window.addEventListener('pointerdown', inputChanged, { capture: true, passive: true });
|
|
171
179
|
window.addEventListener('pointermove', inputChanged, { capture: true, passive: true });
|
|
172
180
|
window.addEventListener('keydown', keydown);
|
|
@@ -179,8 +187,8 @@
|
|
|
179
187
|
close(); stopGuidance(); stopScroll(); mutation.disconnect(); observer.disconnect(); size.disconnect(); headerSize.disconnect();
|
|
180
188
|
root.appendChild(popover);
|
|
181
189
|
stage.removeEventListener(MODEL_INPUT_EVENT, modelChanged);
|
|
182
|
-
|
|
183
|
-
|
|
190
|
+
helpButton.removeEventListener('pointerenter', buttonEnter);
|
|
191
|
+
helpButton.removeEventListener('pointerleave', buttonLeave);
|
|
184
192
|
window.removeEventListener('pointerdown', inputChanged, true);
|
|
185
193
|
window.removeEventListener('pointermove', inputChanged, true);
|
|
186
194
|
window.removeEventListener('keydown', keydown);
|
|
@@ -196,8 +204,9 @@
|
|
|
196
204
|
<SpatialIconButton bind:element={button} {focusAnchor} label={messages.controls.help} onclick={toggleHelp} expanded={open} controls={id} enabled={enhanced}>
|
|
197
205
|
<CircleHelp size={21} strokeWidth={1.8} aria-hidden="true" />
|
|
198
206
|
</SpatialIconButton>
|
|
207
|
+
<SpatialElementViewToggle enabled={enhanced} {focusAnchor} onchange={() => close()} />
|
|
199
208
|
</div>
|
|
200
|
-
{#if enhanced && touchInput && !interacted && !open}
|
|
209
|
+
{#if enhanced && touchInput && !interacted && !open && !fullscreen}
|
|
201
210
|
<p class="touch-hint" data-spatial-element-touch-hint>{help.touchHint}</p>
|
|
202
211
|
{/if}
|
|
203
212
|
<div bind:this={popover} {id} popover="auto" role="dialog" tabindex="-1" aria-modal="false" aria-labelledby={`${id}-title`}
|
|
@@ -207,7 +216,7 @@
|
|
|
207
216
|
onpointerleave={() => { helpHovered = false; schedule(); }}
|
|
208
217
|
onfocusin={clearHideDelay} onfocusout={() => { queueMicrotask(schedule); }}
|
|
209
218
|
ontoggle={(event) => { open = event.newState === 'open'; if (!open) { manual = false; clearHideDelay(); } }}>
|
|
210
|
-
<Panel class="interaction-help-panel" nativeContent nativeLayout={position} visible={open} pointerReactive={false} focusReactive={false}
|
|
219
|
+
<Panel class="interaction-help-panel" data-stage-fullscreen-visible nativeContent nativeLayout={position} visible={open} pointerReactive={false} focusReactive={false}
|
|
211
220
|
shape={{ ...theme.panelShape, contentInset: 0 }} theme={theme.panelTheme}>
|
|
212
221
|
<div class="help-copy">
|
|
213
222
|
<div class="help-heading">
|
|
@@ -224,7 +233,7 @@
|
|
|
224
233
|
</dl>
|
|
225
234
|
<p class="navigation-hint">
|
|
226
235
|
{#if touchInput}
|
|
227
|
-
{help.touchScrollHint}
|
|
236
|
+
{#if !fullscreen}{help.touchScrollHint}{/if}
|
|
228
237
|
{:else}
|
|
229
238
|
{#each help.mouseNavigationHint.split('{spacemouse}') as part, index}{#if index > 0}<a href="https://3dconnexion.com/" target="_blank" rel="noopener noreferrer">SpaceMouse</a>{/if}{part}{/each}
|
|
230
239
|
{/if}
|
|
@@ -238,7 +247,7 @@
|
|
|
238
247
|
.model-tools {
|
|
239
248
|
grid-column: 1; grid-row: 1; align-self: start; justify-self: end; position: relative;
|
|
240
249
|
margin-top: 6px; margin-inline-end: calc(var(--model-tools-gap, 32px) - var(--spatial-element-hero-column-gap));
|
|
241
|
-
width:
|
|
250
|
+
width: 128px; height: 40px; z-index: 6; visibility: hidden; pointer-events: none;
|
|
242
251
|
}
|
|
243
252
|
.model-tools.enhanced { visibility: visible; pointer-events: auto; }
|
|
244
253
|
.model-tools-buttons { display: flex; gap: 8px; justify-content: flex-end; }
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
import type { ResolvedSpatialElementData as SpatialElementData } from '@spatial-elements/core/spatial-element/spatialElement';
|
|
5
5
|
|
|
6
6
|
let { spatialElement }: { spatialElement: SpatialElementData } = $props();
|
|
7
|
-
const
|
|
7
|
+
const readTheme = useSpatialTheme();
|
|
8
|
+
const theme = $derived(readTheme());
|
|
8
9
|
const minimap = $derived({
|
|
9
10
|
...spatialElement.minimap,
|
|
10
11
|
...theme.minimapTheme,
|
|
@@ -31,8 +32,11 @@
|
|
|
31
32
|
data-spatial-element-departing-media-content={media.kind === 'minimap' ? undefined : ''}
|
|
32
33
|
>
|
|
33
34
|
{#if media.kind === 'minimap'}
|
|
34
|
-
<button type="button" aria-label={media.label} class="thumb thumb-minimap active"
|
|
35
|
-
|
|
35
|
+
<button type="button" aria-label={media.label} class="thumb thumb-minimap active">
|
|
36
|
+
{#if spatialElement.fallbackImage}
|
|
37
|
+
<img class="minimap-poster" src={spatialElement.fallbackImage} alt="" />
|
|
38
|
+
{/if}
|
|
39
|
+
</button>
|
|
36
40
|
{:else if media.kind === 'drawing'}
|
|
37
41
|
<button type="button" aria-label={media.label} class="thumb thumb-drawing">
|
|
38
42
|
<span class="drawing-sheet" aria-hidden="true"></span>
|
|
@@ -95,6 +99,21 @@
|
|
|
95
99
|
overflow: hidden;
|
|
96
100
|
}
|
|
97
101
|
|
|
102
|
+
.minimap-poster {
|
|
103
|
+
position: absolute;
|
|
104
|
+
inset: 10%;
|
|
105
|
+
width: 80%;
|
|
106
|
+
height: 80%;
|
|
107
|
+
object-fit: contain;
|
|
108
|
+
transition: opacity 240ms ease;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
:global(.stage-enhanced) .minimap-poster { opacity: 0; }
|
|
112
|
+
|
|
113
|
+
@media (prefers-reduced-motion: reduce) {
|
|
114
|
+
.minimap-poster { transition: none; }
|
|
115
|
+
}
|
|
116
|
+
|
|
98
117
|
.thumb-image img {
|
|
99
118
|
display: block;
|
|
100
119
|
max-width: calc(100% - 18px);
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
children?: Snippet;
|
|
40
40
|
}
|
|
41
41
|
let { spatialElement: element, children }: Props = $props();
|
|
42
|
-
const
|
|
42
|
+
const readTheme = useSpatialTheme();
|
|
43
|
+
const brand = $derived(readTheme());
|
|
43
44
|
const spatialElement = $derived(resolveSpatialElementData(element, brand.id));
|
|
44
45
|
// During route teardown Kit can clear the outgoing page's data before unmount.
|
|
45
46
|
// Read raw assets here, so the parent stage never evaluates outgoing DOM-derived content.
|
|
@@ -237,9 +238,6 @@
|
|
|
237
238
|
.spatial-element-hero :global(.spatial-element-visual) {
|
|
238
239
|
grid-column: 1;
|
|
239
240
|
grid-row: 1;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
:global(.spatial-element-visual) {
|
|
243
241
|
min-height: clamp(540px, calc(100vh - 300px), 680px);
|
|
244
242
|
border-radius: 28px;
|
|
245
243
|
background: transparent;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { catalogActionSemantic } from '@spatial-elements/core/catalog/catalogAction';
|
|
3
|
+
import type { CatalogEndpointAddress, CatalogEndpointRole } from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
|
|
4
|
+
import type { SpatialElementFeature, SpatialElementAction } from '@spatial-elements/core/spatial-element/types';
|
|
5
|
+
import { ShoppingCart } from 'lucide-svelte';
|
|
6
|
+
import { createCatalogEndpointAction } from '../catalog/catalogEndpointAction.js';
|
|
7
|
+
let { spatialElement, address, contentInset, heading = 'h3', element = $bindable() }: {
|
|
8
|
+
spatialElement: { id: string; eyebrow: string; title: string; features: SpatialElementFeature[]; action?: SpatialElementAction };
|
|
9
|
+
address: (role: CatalogEndpointRole) => CatalogEndpointAddress | undefined;
|
|
10
|
+
contentInset: number;
|
|
11
|
+
heading?: 'h1' | 'h3';
|
|
12
|
+
element?: HTMLDivElement;
|
|
13
|
+
} = $props();
|
|
14
|
+
const catalogEndpoint = createCatalogEndpointAction();
|
|
15
|
+
</script>
|
|
16
|
+
<div bind:this={element} class="summary-presentation" style:min-height={`${Math.max(504 - contentInset * 2, 0)}px`}>
|
|
17
|
+
<div class="panel-copy">
|
|
18
|
+
<p
|
|
19
|
+
class="panel-kicker"
|
|
20
|
+
data-shared-role="eyebrow"
|
|
21
|
+
data-spatial-element-id={spatialElement.id}
|
|
22
|
+
use:catalogEndpoint={address('eyebrow')}
|
|
23
|
+
>
|
|
24
|
+
{spatialElement.eyebrow}
|
|
25
|
+
</p>
|
|
26
|
+
<svelte:element this={heading} class="summary-title"
|
|
27
|
+
id={heading === 'h1' ? 'spatial-element-title' : undefined}
|
|
28
|
+
tabindex={heading === 'h1' ? -1 : undefined}
|
|
29
|
+
data-shared-role="title"
|
|
30
|
+
data-spatial-element-id={spatialElement.id}
|
|
31
|
+
use:catalogEndpoint={address('title')}
|
|
32
|
+
>
|
|
33
|
+
{spatialElement.title}
|
|
34
|
+
</svelte:element>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<ul
|
|
38
|
+
class="feature-list"
|
|
39
|
+
aria-label="SpatialElement highlights"
|
|
40
|
+
use:catalogEndpoint={address('features')}
|
|
41
|
+
data-catalog-rich-shared="features"
|
|
42
|
+
data-catalog-semantic={JSON.stringify(spatialElement.features)}
|
|
43
|
+
>
|
|
44
|
+
{#each spatialElement.features as feature (feature.label)}
|
|
45
|
+
<li>
|
|
46
|
+
<span class="feature-content" data-catalog-secondary>
|
|
47
|
+
<span class="feature-marker" aria-hidden="true">{feature.marker ?? 'Link'}</span>
|
|
48
|
+
<span>{feature.label}</span>
|
|
49
|
+
</span>
|
|
50
|
+
</li>
|
|
51
|
+
{/each}
|
|
52
|
+
</ul>
|
|
53
|
+
|
|
54
|
+
{#if spatialElement.action}
|
|
55
|
+
{#if spatialElement.action.href}
|
|
56
|
+
<a
|
|
57
|
+
use:catalogEndpoint={address('primary-action')}
|
|
58
|
+
data-catalog-rich-shared="primary-action"
|
|
59
|
+
data-catalog-semantic={catalogActionSemantic(spatialElement.action)}
|
|
60
|
+
class="spatial-element-action spatial-element-action-expanded"
|
|
61
|
+
href={spatialElement.action.href}
|
|
62
|
+
rel="external"
|
|
63
|
+
aria-label={spatialElement.action.ariaLabel}
|
|
64
|
+
>
|
|
65
|
+
<span class="spatial-element-action-surface" data-catalog-secondary>
|
|
66
|
+
<ShoppingCart
|
|
67
|
+
class="spatial-element-action-icon"
|
|
68
|
+
size={27}
|
|
69
|
+
strokeWidth={2}
|
|
70
|
+
aria-hidden="true"
|
|
71
|
+
/>
|
|
72
|
+
<span class="spatial-element-action-label">{spatialElement.action.label}</span>
|
|
73
|
+
</span>
|
|
74
|
+
</a>
|
|
75
|
+
{:else}
|
|
76
|
+
<button
|
|
77
|
+
use:catalogEndpoint={address('primary-action')}
|
|
78
|
+
data-catalog-rich-shared="primary-action"
|
|
79
|
+
data-catalog-semantic={catalogActionSemantic(spatialElement.action)}
|
|
80
|
+
class="spatial-element-action spatial-element-action-expanded"
|
|
81
|
+
type="button"
|
|
82
|
+
aria-label={spatialElement.action.ariaLabel}
|
|
83
|
+
>
|
|
84
|
+
<span class="spatial-element-action-surface" data-catalog-secondary>
|
|
85
|
+
<ShoppingCart
|
|
86
|
+
class="spatial-element-action-icon"
|
|
87
|
+
size={27}
|
|
88
|
+
strokeWidth={2}
|
|
89
|
+
aria-hidden="true"
|
|
90
|
+
/>
|
|
91
|
+
<span class="spatial-element-action-label">{spatialElement.action.label}</span>
|
|
92
|
+
</span>
|
|
93
|
+
</button>
|
|
94
|
+
{/if}
|
|
95
|
+
{/if}
|
|
96
|
+
</div>
|
|
97
|
+
<style>
|
|
98
|
+
.summary-presentation {
|
|
99
|
+
position: relative;
|
|
100
|
+
box-sizing: border-box;
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
justify-content: space-between;
|
|
104
|
+
gap: 24px;
|
|
105
|
+
pointer-events: auto;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.summary-title {
|
|
109
|
+
max-width: 390px;
|
|
110
|
+
margin: 10px 0 0;
|
|
111
|
+
font-size: clamp(30px, 3vw, 40px);
|
|
112
|
+
font-weight: 780;
|
|
113
|
+
line-height: 1.16;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.panel-kicker {
|
|
117
|
+
margin: 0;
|
|
118
|
+
font-size: 14px;
|
|
119
|
+
font-weight: 720;
|
|
120
|
+
letter-spacing: 0.05em;
|
|
121
|
+
text-transform: uppercase;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.feature-list {
|
|
125
|
+
display: grid;
|
|
126
|
+
gap: 20px;
|
|
127
|
+
margin: 0;
|
|
128
|
+
padding: 0;
|
|
129
|
+
color: var(--spatial-element-body);
|
|
130
|
+
font-size: 18px;
|
|
131
|
+
list-style: none;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.feature-content {
|
|
135
|
+
display: flex;
|
|
136
|
+
align-items: baseline;
|
|
137
|
+
gap: 14px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.feature-marker {
|
|
141
|
+
color: var(--spatial-element-accent);
|
|
142
|
+
font-weight: 800;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.spatial-element-action {
|
|
146
|
+
display: block;
|
|
147
|
+
box-sizing: border-box;
|
|
148
|
+
width: 100%;
|
|
149
|
+
min-height: 62px;
|
|
150
|
+
border: 0;
|
|
151
|
+
padding: 0;
|
|
152
|
+
color: inherit;
|
|
153
|
+
background: transparent;
|
|
154
|
+
text-decoration: none;
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.spatial-element-action-surface {
|
|
159
|
+
display: flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
justify-content: center;
|
|
162
|
+
gap: 10px;
|
|
163
|
+
box-sizing: border-box;
|
|
164
|
+
width: 100%;
|
|
165
|
+
min-height: 62px;
|
|
166
|
+
border-radius: 7px;
|
|
167
|
+
color: var(--spatial-element-on-accent);
|
|
168
|
+
background: var(--spatial-element-accent);
|
|
169
|
+
font:
|
|
170
|
+
760 22px/1 system-ui,
|
|
171
|
+
sans-serif;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
:global(.spatial-element-action-icon) {
|
|
175
|
+
flex: none;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.spatial-element-action-label {
|
|
179
|
+
white-space: nowrap;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CatalogEndpointAddress, CatalogEndpointRole } from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
|
|
2
|
+
import type { SpatialElementFeature, SpatialElementAction } from '@spatial-elements/core/spatial-element/types';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
spatialElement: {
|
|
5
|
+
id: string;
|
|
6
|
+
eyebrow: string;
|
|
7
|
+
title: string;
|
|
8
|
+
features: SpatialElementFeature[];
|
|
9
|
+
action?: SpatialElementAction;
|
|
10
|
+
};
|
|
11
|
+
address: (role: CatalogEndpointRole) => CatalogEndpointAddress | undefined;
|
|
12
|
+
contentInset: number;
|
|
13
|
+
heading?: 'h1' | 'h3';
|
|
14
|
+
element?: HTMLDivElement;
|
|
15
|
+
};
|
|
16
|
+
declare const SpatialElementSummaryContent: import("svelte").Component<$$ComponentProps, {}, "element">;
|
|
17
|
+
type SpatialElementSummaryContent = ReturnType<typeof SpatialElementSummaryContent>;
|
|
18
|
+
export default SpatialElementSummaryContent;
|