@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,423 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { catalogActionSemantic } from '@spatial-elements/core/catalog/catalogAction';
|
|
3
|
+
import { ShoppingCart } from 'lucide-svelte';
|
|
4
|
+
import Panel from '../stage/Panel.svelte';
|
|
5
|
+
import { useSpatialTheme } from './brandContext.js';
|
|
6
|
+
import type { SpatialElementData } from '@spatial-elements/core/spatial-element/types';
|
|
7
|
+
import { createCatalogEndpointAction } from '../catalog/catalogEndpointAction.js';
|
|
8
|
+
|
|
9
|
+
let { spatialElement }: { spatialElement: SpatialElementData } = $props();
|
|
10
|
+
const theme = useSpatialTheme();
|
|
11
|
+
const catalogEndpoint = createCatalogEndpointAction();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<div class="spatial-element-aside">
|
|
15
|
+
<Panel
|
|
16
|
+
catalogEndpoint={{
|
|
17
|
+
brandId: theme.id,
|
|
18
|
+
spatialElementId: spatialElement.id,
|
|
19
|
+
slot: 'detail.summary',
|
|
20
|
+
role: 'summary-surface'
|
|
21
|
+
}}
|
|
22
|
+
transitionGroup="shared"
|
|
23
|
+
class="spatial-element-panel"
|
|
24
|
+
shape={theme.panelShape}
|
|
25
|
+
theme={theme.panelTheme}
|
|
26
|
+
contentClass="stage-panel-content spatial-element-content"
|
|
27
|
+
aria-labelledby="spatial-element-title"
|
|
28
|
+
data-spatial-element-hero-panel-content
|
|
29
|
+
data-shared-role="summary-surface"
|
|
30
|
+
data-spatial-element-id={spatialElement.id}
|
|
31
|
+
>
|
|
32
|
+
<div class="summary-presentation">
|
|
33
|
+
<div class="panel-copy">
|
|
34
|
+
<p
|
|
35
|
+
class="panel-kicker"
|
|
36
|
+
data-shared-role="eyebrow"
|
|
37
|
+
data-spatial-element-id={spatialElement.id}
|
|
38
|
+
use:catalogEndpoint={{
|
|
39
|
+
brandId: theme.id,
|
|
40
|
+
spatialElementId: spatialElement.id,
|
|
41
|
+
slot: 'detail.summary',
|
|
42
|
+
role: 'eyebrow'
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
{spatialElement.eyebrow}
|
|
46
|
+
</p>
|
|
47
|
+
<h1
|
|
48
|
+
id="spatial-element-title"
|
|
49
|
+
tabindex="-1"
|
|
50
|
+
data-shared-role="title"
|
|
51
|
+
data-spatial-element-id={spatialElement.id}
|
|
52
|
+
use:catalogEndpoint={{
|
|
53
|
+
brandId: theme.id,
|
|
54
|
+
spatialElementId: spatialElement.id,
|
|
55
|
+
slot: 'detail.summary',
|
|
56
|
+
role: 'title'
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
{spatialElement.title}
|
|
60
|
+
</h1>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<ul
|
|
64
|
+
class="feature-list"
|
|
65
|
+
aria-label="SpatialElement highlights"
|
|
66
|
+
use:catalogEndpoint={{
|
|
67
|
+
brandId: theme.id,
|
|
68
|
+
spatialElementId: spatialElement.id,
|
|
69
|
+
slot: 'detail.summary',
|
|
70
|
+
role: 'features'
|
|
71
|
+
}}
|
|
72
|
+
data-catalog-rich-shared="features"
|
|
73
|
+
data-catalog-semantic={JSON.stringify(spatialElement.features)}
|
|
74
|
+
>
|
|
75
|
+
{#each spatialElement.features as feature (feature.label)}
|
|
76
|
+
<li>
|
|
77
|
+
<span class="feature-content" data-catalog-secondary>
|
|
78
|
+
<span class="feature-marker" aria-hidden="true">{feature.marker ?? 'Link'}</span>
|
|
79
|
+
<span>{feature.label}</span>
|
|
80
|
+
</span>
|
|
81
|
+
</li>
|
|
82
|
+
{/each}
|
|
83
|
+
</ul>
|
|
84
|
+
|
|
85
|
+
{#if spatialElement.action.href}
|
|
86
|
+
<a
|
|
87
|
+
use:catalogEndpoint={{
|
|
88
|
+
brandId: theme.id,
|
|
89
|
+
spatialElementId: spatialElement.id,
|
|
90
|
+
slot: 'detail.summary',
|
|
91
|
+
role: 'primary-action'
|
|
92
|
+
}}
|
|
93
|
+
data-catalog-rich-shared="primary-action"
|
|
94
|
+
data-catalog-semantic={catalogActionSemantic(spatialElement.action)}
|
|
95
|
+
class="spatial-element-action spatial-element-action-expanded"
|
|
96
|
+
href={spatialElement.action.href}
|
|
97
|
+
rel="external"
|
|
98
|
+
aria-label={spatialElement.action.ariaLabel}
|
|
99
|
+
>
|
|
100
|
+
<span class="spatial-element-action-surface" data-catalog-secondary>
|
|
101
|
+
<ShoppingCart
|
|
102
|
+
class="spatial-element-action-icon"
|
|
103
|
+
size={27}
|
|
104
|
+
strokeWidth={2}
|
|
105
|
+
aria-hidden="true"
|
|
106
|
+
/>
|
|
107
|
+
<span class="spatial-element-action-label">{spatialElement.action.label}</span>
|
|
108
|
+
</span>
|
|
109
|
+
</a>
|
|
110
|
+
{:else}
|
|
111
|
+
<button
|
|
112
|
+
use:catalogEndpoint={{
|
|
113
|
+
brandId: theme.id,
|
|
114
|
+
spatialElementId: spatialElement.id,
|
|
115
|
+
slot: 'detail.summary',
|
|
116
|
+
role: 'primary-action'
|
|
117
|
+
}}
|
|
118
|
+
data-catalog-rich-shared="primary-action"
|
|
119
|
+
data-catalog-semantic={catalogActionSemantic(spatialElement.action)}
|
|
120
|
+
class="spatial-element-action spatial-element-action-expanded"
|
|
121
|
+
type="button"
|
|
122
|
+
aria-label={spatialElement.action.ariaLabel}
|
|
123
|
+
>
|
|
124
|
+
<span class="spatial-element-action-surface" data-catalog-secondary>
|
|
125
|
+
<ShoppingCart
|
|
126
|
+
class="spatial-element-action-icon"
|
|
127
|
+
size={27}
|
|
128
|
+
strokeWidth={2}
|
|
129
|
+
aria-hidden="true"
|
|
130
|
+
/>
|
|
131
|
+
<span class="spatial-element-action-label">{spatialElement.action.label}</span>
|
|
132
|
+
</span>
|
|
133
|
+
</button>
|
|
134
|
+
{/if}
|
|
135
|
+
</div>
|
|
136
|
+
</Panel>
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<style>
|
|
140
|
+
@property --summary-feature-hover-progress {
|
|
141
|
+
syntax: '<number>';
|
|
142
|
+
inherits: false;
|
|
143
|
+
initial-value: 0;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@property --summary-action-hover-progress {
|
|
147
|
+
syntax: '<number>';
|
|
148
|
+
inherits: false;
|
|
149
|
+
initial-value: 0;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.spatial-element-aside {
|
|
153
|
+
min-height: inherit;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
:global(.spatial-element-panel) {
|
|
157
|
+
position: relative;
|
|
158
|
+
top: 0;
|
|
159
|
+
width: min(494px, 100%);
|
|
160
|
+
height: 504px;
|
|
161
|
+
min-height: 504px;
|
|
162
|
+
pointer-events: auto;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
:global(.spatial-element-content) {
|
|
166
|
+
position: relative;
|
|
167
|
+
display: block;
|
|
168
|
+
overflow: visible;
|
|
169
|
+
color: color-mix(in srgb, var(--spatial-element-ink) 92%, transparent);
|
|
170
|
+
transform-style: preserve-3d;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.summary-presentation {
|
|
174
|
+
--summary-depth-progress: var(--stage-panel-pointer-proximity, 0);
|
|
175
|
+
--summary-shadow-strength: var(--stage-panel-shadow-strength, 0.18);
|
|
176
|
+
--summary-feature-depth: 40;
|
|
177
|
+
--summary-feature-hover-depth: 48;
|
|
178
|
+
--summary-eyebrow-depth: 60;
|
|
179
|
+
--summary-title-depth: 96;
|
|
180
|
+
--summary-action-depth: 76;
|
|
181
|
+
--summary-action-hover-depth: 24;
|
|
182
|
+
|
|
183
|
+
position: absolute;
|
|
184
|
+
inset: 0;
|
|
185
|
+
box-sizing: border-box;
|
|
186
|
+
display: flex;
|
|
187
|
+
flex-direction: column;
|
|
188
|
+
justify-content: space-between;
|
|
189
|
+
gap: 24px;
|
|
190
|
+
pointer-events: auto;
|
|
191
|
+
transform-style: preserve-3d;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.panel-copy {
|
|
195
|
+
transform-style: preserve-3d;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.summary-presentation h1 {
|
|
199
|
+
max-width: 390px;
|
|
200
|
+
margin: 10px 0 0;
|
|
201
|
+
font-size: clamp(30px, 3vw, 40px);
|
|
202
|
+
font-weight: 780;
|
|
203
|
+
line-height: 1.16;
|
|
204
|
+
transform-origin: left center;
|
|
205
|
+
will-change: transform;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.panel-kicker {
|
|
209
|
+
margin: 0;
|
|
210
|
+
font-size: 14px;
|
|
211
|
+
font-weight: 720;
|
|
212
|
+
letter-spacing: 0.05em;
|
|
213
|
+
text-transform: uppercase;
|
|
214
|
+
transform-origin: left center;
|
|
215
|
+
will-change: transform;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.feature-list {
|
|
219
|
+
display: grid;
|
|
220
|
+
gap: 20px;
|
|
221
|
+
margin: 0;
|
|
222
|
+
padding: 0;
|
|
223
|
+
color: var(--spatial-element-body);
|
|
224
|
+
font-size: 18px;
|
|
225
|
+
list-style: none;
|
|
226
|
+
transform-style: preserve-3d;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.feature-list li {
|
|
230
|
+
transform-style: preserve-3d;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.feature-content {
|
|
234
|
+
--summary-feature-hover-progress: 0;
|
|
235
|
+
--summary-feature-effective-depth: calc(
|
|
236
|
+
var(--summary-feature-depth) * var(--summary-depth-progress) +
|
|
237
|
+
var(--summary-feature-hover-depth) * var(--summary-feature-hover-progress)
|
|
238
|
+
);
|
|
239
|
+
--summary-feature-shadow-depth: calc(
|
|
240
|
+
var(--summary-feature-depth) * var(--summary-depth-progress)
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
display: flex;
|
|
244
|
+
align-items: baseline;
|
|
245
|
+
gap: 14px;
|
|
246
|
+
text-shadow:
|
|
247
|
+
0 calc(0.055px * var(--summary-feature-shadow-depth))
|
|
248
|
+
calc(0.055px * var(--summary-feature-shadow-depth))
|
|
249
|
+
rgb(
|
|
250
|
+
0 0 0 /
|
|
251
|
+
calc(0.0168 * var(--summary-shadow-strength) * var(--summary-feature-shadow-depth))
|
|
252
|
+
),
|
|
253
|
+
0 calc(0.194px * var(--summary-feature-shadow-depth))
|
|
254
|
+
calc(0.278px * var(--summary-feature-shadow-depth))
|
|
255
|
+
rgb(
|
|
256
|
+
0 0 0 /
|
|
257
|
+
calc(0.00936 * var(--summary-shadow-strength) * var(--summary-feature-shadow-depth))
|
|
258
|
+
);
|
|
259
|
+
transform: translateZ(calc(1px * var(--summary-feature-effective-depth)));
|
|
260
|
+
transform-origin: left center;
|
|
261
|
+
transition: --summary-feature-hover-progress 260ms cubic-bezier(0.22, 0.75, 0.25, 1);
|
|
262
|
+
will-change: transform;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.feature-list li:hover .feature-content {
|
|
266
|
+
--summary-feature-hover-progress: 1;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.feature-marker {
|
|
270
|
+
color: var(--spatial-element-accent);
|
|
271
|
+
font-weight: 800;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.spatial-element-action {
|
|
275
|
+
display: block;
|
|
276
|
+
box-sizing: border-box;
|
|
277
|
+
width: 100%;
|
|
278
|
+
min-height: 62px;
|
|
279
|
+
border: 0;
|
|
280
|
+
padding: 0;
|
|
281
|
+
color: inherit;
|
|
282
|
+
background: transparent;
|
|
283
|
+
text-decoration: none;
|
|
284
|
+
cursor: pointer;
|
|
285
|
+
transform-style: preserve-3d;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.spatial-element-action:is(:hover, :focus-visible) .spatial-element-action-surface {
|
|
289
|
+
--summary-action-hover-progress: 1;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.spatial-element-action-surface {
|
|
293
|
+
--summary-action-hover-progress: 0;
|
|
294
|
+
|
|
295
|
+
display: flex;
|
|
296
|
+
align-items: center;
|
|
297
|
+
justify-content: center;
|
|
298
|
+
gap: 10px;
|
|
299
|
+
box-sizing: border-box;
|
|
300
|
+
width: 100%;
|
|
301
|
+
min-height: 62px;
|
|
302
|
+
border-radius: 7px;
|
|
303
|
+
color: var(--spatial-element-on-accent);
|
|
304
|
+
background: var(--spatial-element-accent);
|
|
305
|
+
font:
|
|
306
|
+
760 22px/1 system-ui,
|
|
307
|
+
sans-serif;
|
|
308
|
+
transform-origin: center;
|
|
309
|
+
transition: --summary-action-hover-progress 260ms cubic-bezier(0.22, 0.75, 0.25, 1);
|
|
310
|
+
will-change: transform;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.panel-kicker {
|
|
314
|
+
--summary-eyebrow-effective-depth: calc(
|
|
315
|
+
var(--summary-eyebrow-depth) * var(--summary-depth-progress)
|
|
316
|
+
);
|
|
317
|
+
|
|
318
|
+
text-shadow:
|
|
319
|
+
0 calc(0.055px * var(--summary-eyebrow-effective-depth))
|
|
320
|
+
calc(0.04px * var(--summary-eyebrow-effective-depth))
|
|
321
|
+
rgb(
|
|
322
|
+
0 0 0 /
|
|
323
|
+
calc(0.0134 * var(--summary-shadow-strength) * var(--summary-eyebrow-effective-depth))
|
|
324
|
+
),
|
|
325
|
+
0 calc(0.117px * var(--summary-eyebrow-effective-depth))
|
|
326
|
+
calc(0.167px * var(--summary-eyebrow-effective-depth))
|
|
327
|
+
rgb(
|
|
328
|
+
0 0 0 /
|
|
329
|
+
calc(0.0074 * var(--summary-shadow-strength) * var(--summary-eyebrow-effective-depth))
|
|
330
|
+
);
|
|
331
|
+
transform: translateZ(calc(1px * var(--summary-eyebrow-effective-depth)));
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.summary-presentation h1 {
|
|
335
|
+
--summary-title-effective-depth: calc(
|
|
336
|
+
var(--summary-title-depth) * var(--summary-depth-progress)
|
|
337
|
+
);
|
|
338
|
+
|
|
339
|
+
text-shadow:
|
|
340
|
+
0 calc(0.055px * var(--summary-title-effective-depth))
|
|
341
|
+
calc(0.04px * var(--summary-title-effective-depth))
|
|
342
|
+
rgb(
|
|
343
|
+
0 0 0 /
|
|
344
|
+
calc(0.007 * var(--summary-shadow-strength) * var(--summary-title-effective-depth))
|
|
345
|
+
),
|
|
346
|
+
0 calc(0.156px * var(--summary-title-effective-depth))
|
|
347
|
+
calc(0.203px * var(--summary-title-effective-depth))
|
|
348
|
+
rgb(
|
|
349
|
+
0 0 0 /
|
|
350
|
+
calc(0.0039 * var(--summary-shadow-strength) * var(--summary-title-effective-depth))
|
|
351
|
+
);
|
|
352
|
+
transform: translateZ(calc(1px * var(--summary-title-effective-depth)));
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.spatial-element-action-surface {
|
|
356
|
+
--summary-action-effective-depth: calc(
|
|
357
|
+
var(--summary-action-depth) * var(--summary-depth-progress) +
|
|
358
|
+
var(--summary-action-hover-depth) * var(--summary-action-hover-progress)
|
|
359
|
+
);
|
|
360
|
+
|
|
361
|
+
box-shadow:
|
|
362
|
+
0 calc(0.078px * var(--summary-action-effective-depth))
|
|
363
|
+
calc(0.094px * var(--summary-action-effective-depth))
|
|
364
|
+
rgb(
|
|
365
|
+
0 0 0 /
|
|
366
|
+
calc(0.0105 * var(--summary-shadow-strength) * var(--summary-action-effective-depth))
|
|
367
|
+
),
|
|
368
|
+
0 calc(0.237px * var(--summary-action-effective-depth))
|
|
369
|
+
calc(0.316px * var(--summary-action-effective-depth))
|
|
370
|
+
rgb(
|
|
371
|
+
0 0 0 /
|
|
372
|
+
calc(0.0068 * var(--summary-shadow-strength) * var(--summary-action-effective-depth))
|
|
373
|
+
);
|
|
374
|
+
transform: translateZ(calc(1px * var(--summary-action-effective-depth)));
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
:global(.spatial-element-action-icon) {
|
|
378
|
+
flex: none;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.spatial-element-action-label {
|
|
382
|
+
white-space: nowrap;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/* Zero-depth transforms still promote text to composited layers in Chromium.
|
|
386
|
+
* Remove those layers while the complete panel is in its native DOM rest mode. */
|
|
387
|
+
:global([data-stage-panel-render-mode='native']) .summary-presentation,
|
|
388
|
+
:global([data-stage-panel-render-mode='native']) .panel-copy,
|
|
389
|
+
:global([data-stage-panel-render-mode='native']) .feature-list,
|
|
390
|
+
:global([data-stage-panel-render-mode='native']) .feature-list li,
|
|
391
|
+
:global([data-stage-panel-render-mode='native']) .spatial-element-action {
|
|
392
|
+
transform-style: flat;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
:global([data-stage-panel-render-mode='native']) .panel-kicker,
|
|
396
|
+
:global([data-stage-panel-render-mode='native']) .summary-presentation h1,
|
|
397
|
+
:global([data-stage-panel-render-mode='native']) .feature-content,
|
|
398
|
+
:global([data-stage-panel-render-mode='native']) .spatial-element-action-surface {
|
|
399
|
+
transform: none;
|
|
400
|
+
will-change: auto;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
@media (prefers-reduced-motion: reduce) {
|
|
404
|
+
.summary-presentation {
|
|
405
|
+
--summary-depth-progress: 0;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.feature-content,
|
|
409
|
+
.feature-list li:hover .feature-content,
|
|
410
|
+
.spatial-element-action-surface,
|
|
411
|
+
.spatial-element-action:is(:hover, :focus-visible) .spatial-element-action-surface {
|
|
412
|
+
--summary-feature-hover-progress: 0;
|
|
413
|
+
--summary-action-hover-progress: 0;
|
|
414
|
+
transition: none;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
@media (max-width: 1100px) {
|
|
419
|
+
:global(.spatial-element-panel) {
|
|
420
|
+
top: auto;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
</style>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SpatialElementData } from '@spatial-elements/core/spatial-element/types';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
spatialElement: SpatialElementData;
|
|
4
|
+
};
|
|
5
|
+
declare const SpatialElementSummaryPanel: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
+
type SpatialElementSummaryPanel = ReturnType<typeof SpatialElementSummaryPanel>;
|
|
7
|
+
export default SpatialElementSummaryPanel;
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from 'svelte';
|
|
3
|
+
import {
|
|
4
|
+
STAGE_ANCHOR_SCROLL_DURATION_MS,
|
|
5
|
+
STAGE_ANCHOR_SCROLL_EASING
|
|
6
|
+
} from '@spatial-elements/core/stage/scrollAnimation';
|
|
7
|
+
import type { SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
activeSectionId?: string;
|
|
11
|
+
sections: SpatialElementSectionNavigationItem[];
|
|
12
|
+
variant: 'panel' | 'docked';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let { activeSectionId, sections, variant }: Props = $props();
|
|
16
|
+
let linksElement: HTMLDivElement;
|
|
17
|
+
let presentationFrame = 0;
|
|
18
|
+
let readyFrame = 0;
|
|
19
|
+
const currentSectionId = $derived(activeSectionId ?? sections[0]?.id);
|
|
20
|
+
|
|
21
|
+
function updateActivePresentation() {
|
|
22
|
+
presentationFrame = 0;
|
|
23
|
+
const sectionId = currentSectionId;
|
|
24
|
+
if (!linksElement || !sectionId) return;
|
|
25
|
+
|
|
26
|
+
const activeLink = Array.from(
|
|
27
|
+
linksElement.querySelectorAll<HTMLElement>('[data-spatial-element-tab-id]')
|
|
28
|
+
).find((element) => element.dataset.spatialElementTabId === sectionId);
|
|
29
|
+
if (!activeLink) return;
|
|
30
|
+
|
|
31
|
+
linksElement.style.setProperty('--spatial-element-tab-active-left', `${activeLink.offsetLeft}px`);
|
|
32
|
+
linksElement.style.setProperty('--spatial-element-tab-active-width', `${activeLink.offsetWidth}px`);
|
|
33
|
+
if (!linksElement.hasAttribute('data-spatial-element-tab-indicator-ready') && !readyFrame) {
|
|
34
|
+
readyFrame = requestAnimationFrame(() => {
|
|
35
|
+
readyFrame = 0;
|
|
36
|
+
linksElement.toggleAttribute('data-spatial-element-tab-indicator-ready', true);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const containerRect = linksElement.getBoundingClientRect();
|
|
41
|
+
const linkRect = activeLink.getBoundingClientRect();
|
|
42
|
+
const leftOverflow = linkRect.left - containerRect.left;
|
|
43
|
+
const rightOverflow = linkRect.right - containerRect.right;
|
|
44
|
+
if (leftOverflow >= 0 && rightOverflow <= 0) return;
|
|
45
|
+
|
|
46
|
+
linksElement.scrollTo({
|
|
47
|
+
left: linksElement.scrollLeft + (leftOverflow < 0 ? leftOverflow - 8 : rightOverflow + 8),
|
|
48
|
+
behavior: matchMedia('(prefers-reduced-motion: reduce)').matches ? 'instant' : 'smooth'
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function scheduleActivePresentation() {
|
|
53
|
+
if (!linksElement || presentationFrame) return;
|
|
54
|
+
presentationFrame = requestAnimationFrame(updateActivePresentation);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
$effect(() => {
|
|
58
|
+
void currentSectionId;
|
|
59
|
+
void sections;
|
|
60
|
+
scheduleActivePresentation();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
onMount(() => {
|
|
64
|
+
const resizeObserver =
|
|
65
|
+
'ResizeObserver' in window ? new ResizeObserver(scheduleActivePresentation) : undefined;
|
|
66
|
+
resizeObserver?.observe(linksElement);
|
|
67
|
+
for (const link of linksElement.querySelectorAll('[data-spatial-element-tab-id]')) {
|
|
68
|
+
resizeObserver?.observe(link);
|
|
69
|
+
}
|
|
70
|
+
window.addEventListener('resize', scheduleActivePresentation, { passive: true });
|
|
71
|
+
void document.fonts?.ready.then(scheduleActivePresentation);
|
|
72
|
+
scheduleActivePresentation();
|
|
73
|
+
|
|
74
|
+
return () => {
|
|
75
|
+
resizeObserver?.disconnect();
|
|
76
|
+
window.removeEventListener('resize', scheduleActivePresentation);
|
|
77
|
+
if (presentationFrame) cancelAnimationFrame(presentationFrame);
|
|
78
|
+
if (readyFrame) cancelAnimationFrame(readyFrame);
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<nav
|
|
84
|
+
class="spatial-element-tab-list"
|
|
85
|
+
data-spatial-element-tab-list={variant}
|
|
86
|
+
aria-label="Elementbereiche"
|
|
87
|
+
style={`--spatial-element-tab-navigation-duration: ${STAGE_ANCHOR_SCROLL_DURATION_MS}ms; --spatial-element-tab-navigation-easing: ${STAGE_ANCHOR_SCROLL_EASING}`}
|
|
88
|
+
>
|
|
89
|
+
<div bind:this={linksElement} class="spatial-element-tab-links" data-spatial-element-tab-links>
|
|
90
|
+
<span class="spatial-element-tab-selection" data-spatial-element-tab-selection aria-hidden="true"></span>
|
|
91
|
+
{#each sections as section (section.id)}
|
|
92
|
+
<a
|
|
93
|
+
href={`#${section.id}`}
|
|
94
|
+
data-spatial-element-tab-id={section.id}
|
|
95
|
+
data-spatial-element-tab-label={section.title}
|
|
96
|
+
aria-current={currentSectionId === section.id ? 'location' : undefined}
|
|
97
|
+
>
|
|
98
|
+
<span>{section.title}</span>
|
|
99
|
+
</a>
|
|
100
|
+
{/each}
|
|
101
|
+
</div>
|
|
102
|
+
</nav>
|
|
103
|
+
|
|
104
|
+
<style>
|
|
105
|
+
.spatial-element-tab-list {
|
|
106
|
+
--spatial-element-tab-font-size: 16px;
|
|
107
|
+
--spatial-element-tab-highlight-top-radius: var(
|
|
108
|
+
--spatial-element-tabs-dock-top-radius,
|
|
109
|
+
var(--spatial-element-panel-radius, 9px)
|
|
110
|
+
);
|
|
111
|
+
--spatial-element-tab-highlight-bottom-radius: var(
|
|
112
|
+
--spatial-element-tabs-dock-bottom-radius,
|
|
113
|
+
var(--spatial-element-panel-radius, 9px)
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
display: flex;
|
|
117
|
+
align-items: center;
|
|
118
|
+
box-sizing: border-box;
|
|
119
|
+
width: max-content;
|
|
120
|
+
max-width: 100%;
|
|
121
|
+
height: 100%;
|
|
122
|
+
min-width: 0;
|
|
123
|
+
color: var(--spatial-element-body);
|
|
124
|
+
pointer-events: auto;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.spatial-element-tab-list:global([data-spatial-element-tab-list-hidden]) {
|
|
128
|
+
opacity: 0;
|
|
129
|
+
visibility: hidden;
|
|
130
|
+
pointer-events: none;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.spatial-element-tab-links {
|
|
134
|
+
display: flex;
|
|
135
|
+
position: relative;
|
|
136
|
+
align-items: center;
|
|
137
|
+
height: 100%;
|
|
138
|
+
min-width: 0;
|
|
139
|
+
overflow-x: auto;
|
|
140
|
+
overflow-y: hidden;
|
|
141
|
+
overscroll-behavior-inline: contain;
|
|
142
|
+
scrollbar-width: none;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.spatial-element-tab-links::-webkit-scrollbar {
|
|
146
|
+
display: none;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.spatial-element-tab-selection {
|
|
150
|
+
position: absolute;
|
|
151
|
+
top: 0;
|
|
152
|
+
bottom: 0;
|
|
153
|
+
left: 0;
|
|
154
|
+
z-index: 0;
|
|
155
|
+
width: var(--spatial-element-tab-active-width, 0px);
|
|
156
|
+
border-radius: var(--spatial-element-tab-highlight-top-radius) var(--spatial-element-tab-highlight-top-radius)
|
|
157
|
+
var(--spatial-element-tab-highlight-bottom-radius) var(--spatial-element-tab-highlight-bottom-radius);
|
|
158
|
+
background: color-mix(in srgb, var(--spatial-element-body) 8%, transparent);
|
|
159
|
+
transform: translate3d(var(--spatial-element-tab-active-left, 0px), 0, 0);
|
|
160
|
+
pointer-events: none;
|
|
161
|
+
will-change: border-radius;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.spatial-element-tab-links:global([data-spatial-element-tab-indicator-ready]) .spatial-element-tab-selection {
|
|
165
|
+
transition:
|
|
166
|
+
width var(--spatial-element-tab-navigation-duration) var(--spatial-element-tab-navigation-easing),
|
|
167
|
+
transform var(--spatial-element-tab-navigation-duration) var(--spatial-element-tab-navigation-easing);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.spatial-element-tab-selection::after {
|
|
171
|
+
position: absolute;
|
|
172
|
+
bottom: 3px;
|
|
173
|
+
left: 50%;
|
|
174
|
+
width: 40px;
|
|
175
|
+
height: 3px;
|
|
176
|
+
border-radius: 3px 3px 0 0;
|
|
177
|
+
background: var(--spatial-element-accent);
|
|
178
|
+
transform: translateX(-50%);
|
|
179
|
+
content: '';
|
|
180
|
+
visibility: hidden;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.spatial-element-tab-links:global([data-spatial-element-tab-indicator-ready]) .spatial-element-tab-selection::after {
|
|
184
|
+
visibility: visible;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
a {
|
|
188
|
+
display: grid;
|
|
189
|
+
position: relative;
|
|
190
|
+
z-index: 1;
|
|
191
|
+
flex: 0 0 auto;
|
|
192
|
+
place-items: center;
|
|
193
|
+
box-sizing: border-box;
|
|
194
|
+
height: 100%;
|
|
195
|
+
padding: 0 16px;
|
|
196
|
+
border-radius: var(--spatial-element-tab-highlight-top-radius) var(--spatial-element-tab-highlight-top-radius)
|
|
197
|
+
var(--spatial-element-tab-highlight-bottom-radius) var(--spatial-element-tab-highlight-bottom-radius);
|
|
198
|
+
color: var(--spatial-element-body);
|
|
199
|
+
background: transparent;
|
|
200
|
+
/* Sturdier glyphs retain more edge contrast in the spatial panel and keep
|
|
201
|
+
* the source-to-dock handoff typographically identical. */
|
|
202
|
+
font-size: var(--spatial-element-tab-font-size);
|
|
203
|
+
font-weight: 600;
|
|
204
|
+
line-height: 1;
|
|
205
|
+
text-decoration: none;
|
|
206
|
+
white-space: nowrap;
|
|
207
|
+
transition: background-color 180ms ease;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
a::before,
|
|
211
|
+
a > span {
|
|
212
|
+
grid-area: 1 / 1;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
a::before {
|
|
216
|
+
font-weight: 600;
|
|
217
|
+
content: attr(data-spatial-element-tab-label);
|
|
218
|
+
visibility: hidden;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
a:hover:not([aria-current='location']) {
|
|
222
|
+
background: color-mix(in srgb, var(--spatial-element-body) 8%, transparent);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
a[aria-current='location'] {
|
|
226
|
+
font-weight: 600;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.spatial-element-tab-links:not([data-spatial-element-tab-indicator-ready]) a[aria-current='location'] {
|
|
230
|
+
background: color-mix(in srgb, var(--spatial-element-body) 8%, transparent);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.spatial-element-tab-links:not([data-spatial-element-tab-indicator-ready]) a[aria-current='location']::after {
|
|
234
|
+
position: absolute;
|
|
235
|
+
bottom: 3px;
|
|
236
|
+
left: 50%;
|
|
237
|
+
width: 40px;
|
|
238
|
+
height: 3px;
|
|
239
|
+
border-radius: 3px 3px 0 0;
|
|
240
|
+
background: var(--spatial-element-accent);
|
|
241
|
+
transform: translateX(-50%);
|
|
242
|
+
content: '';
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
a:focus-visible {
|
|
246
|
+
outline: 2px solid var(--spatial-element-accent);
|
|
247
|
+
outline-offset: -2px;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
@media (max-width: 620px) {
|
|
251
|
+
.spatial-element-tab-list {
|
|
252
|
+
--spatial-element-tab-font-size: 15px;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
a {
|
|
256
|
+
padding-inline: 12px;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
@media (prefers-reduced-motion: reduce) {
|
|
261
|
+
a,
|
|
262
|
+
.spatial-element-tab-selection {
|
|
263
|
+
transition: none;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
|
|
2
|
+
interface Props {
|
|
3
|
+
activeSectionId?: string;
|
|
4
|
+
sections: SpatialElementSectionNavigationItem[];
|
|
5
|
+
variant: 'panel' | 'docked';
|
|
6
|
+
}
|
|
7
|
+
declare const SpatialElementTabList: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type SpatialElementTabList = ReturnType<typeof SpatialElementTabList>;
|
|
9
|
+
export default SpatialElementTabList;
|