@spatial-elements/sveltekit 1.0.0-beta.14 → 1.0.0-beta.18
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 +1 -1
- package/dist/catalog/ScrollNavigationBridge.svelte +5 -1
- package/dist/catalog/ScrollNavigationBridge.svelte.d.ts +1 -1
- package/dist/catalog/stagedCatalogNavigation.d.ts +1 -1
- package/dist/spatial-element/BrandStageShell.svelte +27 -2
- package/dist/spatial-element/BrandStageShell.svelte.d.ts +2 -0
- package/dist/spatial-element/CarouselSpatialElement.svelte +7 -7
- package/dist/spatial-element/ContentPage.svelte +5 -2
- package/dist/spatial-element/ContentPage.svelte.d.ts +3 -0
- package/dist/spatial-element/OverflowControls.svelte +6 -6
- package/dist/spatial-element/PointerHint.svelte +5 -4
- package/dist/spatial-element/Section.svelte +4 -33
- package/dist/spatial-element/SpaceMouseControl.svelte +4 -4
- package/dist/spatial-element/SpatialCardGridSection.svelte +6 -9
- package/dist/spatial-element/SpatialCardPresentation.svelte +129 -33
- package/dist/spatial-element/SpatialCardPresentation.svelte.d.ts +2 -2
- package/dist/spatial-element/SpatialCardSlot.svelte +1 -1
- package/dist/spatial-element/SpatialCarouselSection.svelte +10 -2
- package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +14 -2
- package/dist/spatial-element/SpatialElementCard.svelte +7 -13
- package/dist/spatial-element/SpatialElementCard.svelte.d.ts +2 -2
- package/dist/spatial-element/SpatialElementHelp.svelte +7 -5
- package/dist/spatial-element/SpatialElementMediaRail.svelte +2 -1
- package/dist/spatial-element/SpatialElementPage.svelte +2 -2
- package/dist/spatial-element/SpatialElementStickyHeader.svelte +29 -5
- package/dist/spatial-element/SpatialElementSummaryContent.svelte +16 -8
- package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +4 -0
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte +2 -1
- package/dist/spatial-element/SpatialElementTabList.svelte +32 -10
- package/dist/spatial-element/SpatialIconButton.svelte +2 -0
- package/dist/spatial-element/SpatialListPage.svelte +2 -2
- package/dist/spatial-element/SpatialNavigationShell.svelte +10 -44
- package/dist/spatial-element/SpatialSummaryHost.svelte +1 -1
- package/dist/spatial-element/SpatialSummaryRoot.svelte +33 -10
- package/dist/spatial-element/SpatialSummarySlot.svelte +1 -1
- package/dist/spatial-element/cardAppearanceFreeze.js +1 -1
- package/dist/spatial-element/carouselTextHit.js +2 -1
- package/dist/spatial-element/contentSidebars.js +15 -7
- package/dist/spatial-element/index.d.ts +1 -2
- package/dist/spatial-element/layout.generated.css +41 -17
- package/dist/spatial-element/spatialCardGrid.d.ts +3 -3
- package/dist/spatial-element/spatialSummary.d.ts +4 -2
- package/dist/spatial-element/spatialThemeStyle.js +4 -4
- package/dist/stage/ButtonGroup.svelte +2 -0
- package/dist/stage/Panel.svelte +11 -3
- package/dist/stage/Panel.svelte.d.ts +2 -0
- package/dist/stage/Stage.svelte +11 -3
- package/dist/stage/panelShadowStyle.d.ts +3 -0
- package/dist/stage/panelShadowStyle.js +11 -0
- package/package.json +9 -9
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getContext } from 'svelte';
|
|
3
3
|
import { Card, type CardElements } from '@page-sections/svelte';
|
|
4
|
-
import type {
|
|
5
|
-
CardMediaAspect,
|
|
6
|
-
CardMediaFit,
|
|
7
|
-
CardVariant,
|
|
8
|
-
SurfaceTone
|
|
9
|
-
} from '@page-sections/core';
|
|
4
|
+
import type { CardMediaAspect, CardMediaFit, SurfaceTone } from '@page-sections/core';
|
|
10
5
|
import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
|
|
11
6
|
import { catalogViewLink } from '@spatial-elements/core/catalog/catalogViewLink';
|
|
12
7
|
import {
|
|
@@ -34,7 +29,7 @@
|
|
|
34
29
|
mediaFit = 'contain',
|
|
35
30
|
reserveEyebrow = false,
|
|
36
31
|
cardTone = 'standard',
|
|
37
|
-
|
|
32
|
+
cardShadow = false
|
|
38
33
|
}: {
|
|
39
34
|
spatialElement: SpatialListItem;
|
|
40
35
|
occurrence: string;
|
|
@@ -46,7 +41,7 @@
|
|
|
46
41
|
mediaFit?: CardMediaFit;
|
|
47
42
|
reserveEyebrow?: boolean;
|
|
48
43
|
cardTone?: SurfaceTone;
|
|
49
|
-
|
|
44
|
+
cardShadow?: boolean;
|
|
50
45
|
} = $props();
|
|
51
46
|
const readTheme = useSpatialTheme();
|
|
52
47
|
const brand = $derived(readTheme());
|
|
@@ -73,7 +68,6 @@
|
|
|
73
68
|
const ready = $derived.by(() => {
|
|
74
69
|
void reserveEyebrow;
|
|
75
70
|
void cardSize;
|
|
76
|
-
void cardVariant;
|
|
77
71
|
const enabled = active,
|
|
78
72
|
themeId = brand.id,
|
|
79
73
|
current = spatialElement,
|
|
@@ -102,7 +96,9 @@
|
|
|
102
96
|
bind(parts.root, 'container');
|
|
103
97
|
bind(parts.surface, 'summary-surface', 'spatial-element-card-surface');
|
|
104
98
|
bind(parts.media, 'geometry', 'spatial-element-card-geometry');
|
|
105
|
-
|
|
99
|
+
// Register the actual clipped label as the spatial text endpoint.
|
|
100
|
+
const titleLabel = parts.title.querySelector<HTMLElement>('.title-label') ?? parts.title;
|
|
101
|
+
bind(titleLabel, 'title');
|
|
106
102
|
bind(
|
|
107
103
|
parts.copy.querySelector('[data-ps-card-part="eyebrow"]'),
|
|
108
104
|
'eyebrow',
|
|
@@ -113,10 +109,45 @@
|
|
|
113
109
|
parts.media.dataset.catalogOccurrence = key;
|
|
114
110
|
parts.media.dataset.catalogSlot = 'catalog.card';
|
|
115
111
|
cleanups.push(mouseHover(parts.root).destroy);
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
// The tilted card can briefly move behind its stationary presentation root.
|
|
113
|
+
// Keep that part of the card's hit area linked as well, without replaying
|
|
114
|
+
// events from the actual link or any nested interactive content.
|
|
115
|
+
const presentation = parts.root.closest<HTMLElement>('.spatial-card-root');
|
|
116
|
+
if (presentation) {
|
|
117
|
+
const activatePresentation = (event: MouseEvent) => {
|
|
118
|
+
if (event.target === presentation) activate(event);
|
|
119
|
+
};
|
|
120
|
+
presentation.addEventListener('click', activatePresentation);
|
|
121
|
+
cleanups.push(() => presentation.removeEventListener('click', activatePresentation));
|
|
122
|
+
}
|
|
123
|
+
const link = parts.title.querySelector('a');
|
|
119
124
|
if (link) {
|
|
125
|
+
// preserve-3d creates containing blocks. Size the stretched hit area from
|
|
126
|
+
// untransformed layout offsets so it still covers the complete card.
|
|
127
|
+
parts.root.dataset.spatialCardLinkReady = '';
|
|
128
|
+
const sizeLink = () => {
|
|
129
|
+
let left = 0,
|
|
130
|
+
top = 0;
|
|
131
|
+
for (
|
|
132
|
+
let node: HTMLElement | null = link;
|
|
133
|
+
node && node !== parts.root;
|
|
134
|
+
node = node.offsetParent as HTMLElement | null
|
|
135
|
+
) {
|
|
136
|
+
left += node.offsetLeft;
|
|
137
|
+
top += node.offsetTop;
|
|
138
|
+
}
|
|
139
|
+
link.style.setProperty('--spatial-card-link-left', -left + 'px');
|
|
140
|
+
link.style.setProperty('--spatial-card-link-top', -top + 'px');
|
|
141
|
+
link.style.setProperty('--spatial-card-link-width', parts.root.offsetWidth + 'px');
|
|
142
|
+
link.style.setProperty('--spatial-card-link-height', parts.root.offsetHeight + 'px');
|
|
143
|
+
};
|
|
144
|
+
const observer = new ResizeObserver(sizeLink);
|
|
145
|
+
for (const node of [parts.root, parts.copy, parts.title, link]) observer.observe(node);
|
|
146
|
+
sizeLink();
|
|
147
|
+
cleanups.push(() => {
|
|
148
|
+
observer.disconnect();
|
|
149
|
+
delete parts.root.dataset.spatialCardLinkReady;
|
|
150
|
+
});
|
|
120
151
|
link.dataset.catalogFocusKey = 'catalog:' + JSON.stringify([themeId, current.id, key]);
|
|
121
152
|
cleanups.push(
|
|
122
153
|
catalogViewLink(link, {
|
|
@@ -126,7 +157,7 @@
|
|
|
126
157
|
);
|
|
127
158
|
}
|
|
128
159
|
parts.title.removeAttribute('title');
|
|
129
|
-
cleanups.push(truncatedTitle(
|
|
160
|
+
cleanups.push(truncatedTitle(titleLabel, current.title).destroy);
|
|
130
161
|
return () => cleanups.reverse().forEach((stop) => stop());
|
|
131
162
|
};
|
|
132
163
|
});
|
|
@@ -135,6 +166,40 @@
|
|
|
135
166
|
event.preventDefault();
|
|
136
167
|
return;
|
|
137
168
|
}
|
|
169
|
+
|
|
170
|
+
const target = event.target as HTMLElement;
|
|
171
|
+
if (
|
|
172
|
+
!event.defaultPrevented &&
|
|
173
|
+
event.button === 0 &&
|
|
174
|
+
!target.closest('a, button, input, select, textarea')
|
|
175
|
+
) {
|
|
176
|
+
// A tilted card can move its hit plane between pointerdown and pointerup.
|
|
177
|
+
// The browser then targets their common article instead of its stretched
|
|
178
|
+
// anchor. Replay through the native link, preserving modifier-key behavior.
|
|
179
|
+
const link = (event.currentTarget as HTMLElement).querySelector<HTMLAnchorElement>(
|
|
180
|
+
'a.primary-link'
|
|
181
|
+
);
|
|
182
|
+
if (link) {
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
event.stopPropagation();
|
|
185
|
+
link.dispatchEvent(
|
|
186
|
+
new MouseEvent('click', {
|
|
187
|
+
bubbles: true,
|
|
188
|
+
cancelable: true,
|
|
189
|
+
button: event.button,
|
|
190
|
+
detail: event.detail,
|
|
191
|
+
ctrlKey: event.ctrlKey,
|
|
192
|
+
metaKey: event.metaKey,
|
|
193
|
+
shiftKey: event.shiftKey,
|
|
194
|
+
altKey: event.altKey,
|
|
195
|
+
clientX: event.clientX,
|
|
196
|
+
clientY: event.clientY,
|
|
197
|
+
view: event.view
|
|
198
|
+
})
|
|
199
|
+
);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
138
203
|
endpoints?.prefer(brand.id, spatialElement.id, occurrence);
|
|
139
204
|
sections?.activate({
|
|
140
205
|
brandId: brand.id,
|
|
@@ -155,7 +220,7 @@
|
|
|
155
220
|
{mediaFit}
|
|
156
221
|
{reserveEyebrow}
|
|
157
222
|
tone={cardTone}
|
|
158
|
-
|
|
223
|
+
shadow={cardShadow}
|
|
159
224
|
headingLevel={3}
|
|
160
225
|
class="spatial-element-card"
|
|
161
226
|
onready={ready}
|
|
@@ -164,9 +229,6 @@
|
|
|
164
229
|
data-catalog-order={order}
|
|
165
230
|
data-catalog-occurrence={occurrence}
|
|
166
231
|
data-spatial-element-id={spatialElement.id}
|
|
167
|
-
data-catalog-focus-key={cardVariant === 'catalog'
|
|
168
|
-
? `catalog:${JSON.stringify([brand.id, spatialElement.id, occurrence])}`
|
|
169
|
-
: undefined}
|
|
170
232
|
aria-busy={busy || undefined}
|
|
171
233
|
onclick={activate}
|
|
172
234
|
onpointerenter={() => {
|
|
@@ -175,11 +237,8 @@
|
|
|
175
237
|
onpointerdown={() => {
|
|
176
238
|
if (active) prepare(spatialElement);
|
|
177
239
|
}}
|
|
178
|
-
|
|
179
|
-
if (
|
|
180
|
-
active &&
|
|
181
|
-
!(event.currentTarget as HTMLElement).hasAttribute('data-catalog-restoring-focus')
|
|
182
|
-
)
|
|
240
|
+
onfocusin={(event) => {
|
|
241
|
+
if (active && !(event.target as HTMLElement).hasAttribute('data-catalog-restoring-focus'))
|
|
183
242
|
prepare(spatialElement);
|
|
184
243
|
}}
|
|
185
244
|
>
|
|
@@ -198,6 +257,42 @@
|
|
|
198
257
|
<span class="catalog-status" role="status">{busy ? 'Opening spatial element…' : ''}</span>
|
|
199
258
|
|
|
200
259
|
<style>
|
|
260
|
+
:global(
|
|
261
|
+
.ps-card.spatial-element-card[data-catalog-card][data-spatial-card-link-ready]
|
|
262
|
+
[data-ps-card-part='copy']
|
|
263
|
+
),
|
|
264
|
+
:global(
|
|
265
|
+
.ps-card.spatial-element-card[data-catalog-card][data-spatial-card-link-ready]
|
|
266
|
+
[data-ps-card-part='title']
|
|
267
|
+
),
|
|
268
|
+
:global(
|
|
269
|
+
.ps-card.spatial-element-card[data-catalog-card][data-spatial-card-link-ready] .primary-link
|
|
270
|
+
) {
|
|
271
|
+
transform-style: preserve-3d;
|
|
272
|
+
}
|
|
273
|
+
:global(
|
|
274
|
+
.ps-card.spatial-element-card[data-catalog-card][data-spatial-card-link-ready] .primary-link
|
|
275
|
+
) {
|
|
276
|
+
display: block;
|
|
277
|
+
}
|
|
278
|
+
:global(
|
|
279
|
+
.ps-card.spatial-element-card[data-catalog-card][data-spatial-card-link-ready]
|
|
280
|
+
.primary-link::after
|
|
281
|
+
) {
|
|
282
|
+
inset: auto;
|
|
283
|
+
left: var(--spatial-card-link-left);
|
|
284
|
+
top: var(--spatial-card-link-top);
|
|
285
|
+
width: var(--spatial-card-link-width);
|
|
286
|
+
height: var(--spatial-card-link-height);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
:global(.ps-card.spatial-element-card[data-catalog-card]:has(.primary-link:focus-visible)) {
|
|
290
|
+
outline: 3px solid var(--ps-accent);
|
|
291
|
+
outline-offset: 4px;
|
|
292
|
+
}
|
|
293
|
+
:global(.ps-card.spatial-element-card[data-catalog-card] .primary-link:focus-visible::after) {
|
|
294
|
+
outline: none;
|
|
295
|
+
}
|
|
201
296
|
:global(.ps-card.spatial-element-card[data-catalog-card]) {
|
|
202
297
|
isolation: auto;
|
|
203
298
|
--ps-radius: var(--spatial-element-control-radius);
|
|
@@ -208,18 +303,14 @@
|
|
|
208
303
|
rotateX(var(--catalog-rotate-x, 0deg)) rotateY(var(--catalog-rotate-y, 0deg));
|
|
209
304
|
}
|
|
210
305
|
:global(.ps-card.spatial-element-card[data-catalog-card] [data-ps-card-part='media-frame']) {
|
|
306
|
+
pointer-events: none;
|
|
211
307
|
overflow: visible;
|
|
212
308
|
}
|
|
213
|
-
:global(.ps-card.spatial-element-card[data-catalog-card] [data-ps-card-part='media'])
|
|
214
|
-
:global(.ps-card.spatial-element-card[data-catalog-card] [data-ps-card-part='copy']) {
|
|
309
|
+
:global(.ps-card.spatial-element-card[data-catalog-card] [data-ps-card-part='media']) {
|
|
215
310
|
transform-style: preserve-3d;
|
|
216
311
|
}
|
|
217
|
-
:global(.ps-card.spatial-element-card[data-catalog-card] [data-ps-card-part='surface']) {
|
|
218
|
-
box-shadow: 0 12px 32px rgb(0 0 0 / 6%);
|
|
219
|
-
transition: border-color 180ms ease;
|
|
220
|
-
}
|
|
221
312
|
:global(
|
|
222
|
-
.ps-card.spatial-element-card[data-catalog-card]:is([data-mouse-hover], :focus-visible)
|
|
313
|
+
.ps-card.spatial-element-card[data-catalog-card]:is([data-mouse-hover], :has(:focus-visible))
|
|
223
314
|
[data-ps-card-part='surface']
|
|
224
315
|
) {
|
|
225
316
|
border-color: var(--ps-accent);
|
|
@@ -236,7 +327,7 @@
|
|
|
236
327
|
transition: opacity 180ms ease;
|
|
237
328
|
}
|
|
238
329
|
:global(
|
|
239
|
-
.ps-card.spatial-element-card[data-catalog-card]:is([data-mouse-hover], :focus-visible)
|
|
330
|
+
.ps-card.spatial-element-card[data-catalog-card]:is([data-mouse-hover], :has(:focus-visible))
|
|
240
331
|
[data-ps-card-part='surface']::after
|
|
241
332
|
) {
|
|
242
333
|
opacity: 1;
|
|
@@ -245,7 +336,9 @@
|
|
|
245
336
|
opacity: var(--spatial-card-frozen-after-opacity) !important;
|
|
246
337
|
transition-property: none !important;
|
|
247
338
|
}
|
|
248
|
-
:global(
|
|
339
|
+
:global(
|
|
340
|
+
.ps-card.spatial-element-card[data-catalog-card] [data-ps-card-part='title'] .title-label
|
|
341
|
+
) {
|
|
249
342
|
transform: translateZ(var(--card-title-depth, 0px));
|
|
250
343
|
}
|
|
251
344
|
:global(.ps-card.spatial-element-card[data-catalog-card] [data-ps-card-part='eyebrow']) {
|
|
@@ -258,7 +351,9 @@
|
|
|
258
351
|
transform 260ms ease,
|
|
259
352
|
text-shadow 260ms ease;
|
|
260
353
|
}
|
|
261
|
-
:global(
|
|
354
|
+
:global(
|
|
355
|
+
.ps-card.spatial-element-card[data-catalog-card]:is([data-mouse-hover], :has(:focus-visible))
|
|
356
|
+
) {
|
|
262
357
|
--card-eyebrow-depth: 40px;
|
|
263
358
|
--card-title-depth: 64px;
|
|
264
359
|
--card-model-depth: 96px;
|
|
@@ -302,6 +397,7 @@
|
|
|
302
397
|
@media (prefers-reduced-motion: reduce) {
|
|
303
398
|
:global(.ps-card.spatial-element-card[data-catalog-card]),
|
|
304
399
|
:global(.ps-card.spatial-element-card[data-catalog-card] [data-shared-role]),
|
|
400
|
+
:global(.ps-card.spatial-element-card[data-catalog-card] [data-ps-card-part='title'] .title-label),
|
|
305
401
|
.catalog-poster {
|
|
306
402
|
transform: none;
|
|
307
403
|
transition: none;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CardMediaAspect, CardMediaFit,
|
|
1
|
+
import type { CardMediaAspect, CardMediaFit, SurfaceTone } from '@page-sections/core';
|
|
2
2
|
import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
|
|
3
3
|
import type { SpatialCardSize } from '@spatial-elements/core/spatial-element/responsiveLayout';
|
|
4
4
|
type $$ComponentProps = {
|
|
@@ -12,7 +12,7 @@ type $$ComponentProps = {
|
|
|
12
12
|
mediaFit?: CardMediaFit;
|
|
13
13
|
reserveEyebrow?: boolean;
|
|
14
14
|
cardTone?: SurfaceTone;
|
|
15
|
-
|
|
15
|
+
cardShadow?: boolean;
|
|
16
16
|
};
|
|
17
17
|
declare const SpatialCardPresentation: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
18
18
|
type SpatialCardPresentation = ReturnType<typeof SpatialCardPresentation>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { browser } from '$app/
|
|
2
|
+
import { browser } from '$app/env';
|
|
3
3
|
import { createRawSnippet, getContext, onMount, untrack } from 'svelte';
|
|
4
4
|
import { render } from 'svelte/server';
|
|
5
5
|
import { SpatialSummaryHostController, SPATIAL_SUMMARY_HOST } from './spatialSummaryHost.svelte.js';
|
|
@@ -257,7 +257,7 @@
|
|
|
257
257
|
target.closest('.controls, .carousel-arrows, input, textarea, select, [contenteditable]')
|
|
258
258
|
)
|
|
259
259
|
return false;
|
|
260
|
-
return touch || !target.closest('a, button') || !!target.closest('.spatial-element-target');
|
|
260
|
+
return touch || !target.closest('a, button') || !!target.closest('.spatial-element-target, [data-spatial-summary-link], .compact-copy');
|
|
261
261
|
}
|
|
262
262
|
function pointerdown(event: PointerEvent) {
|
|
263
263
|
if (!interactive || blocked() || list.length < 2) return;
|
|
@@ -618,6 +618,10 @@
|
|
|
618
618
|
:global(.carousel.interactive .summary button) {
|
|
619
619
|
cursor: pointer;
|
|
620
620
|
}
|
|
621
|
+
:global(.carousel.interactive .summary [data-spatial-summary-link]),
|
|
622
|
+
:global(.carousel.interactive .summary .compact-copy) {
|
|
623
|
+
cursor: grab;
|
|
624
|
+
}
|
|
621
625
|
:global(.carousel.interactive [data-carousel-text-hit]) {
|
|
622
626
|
cursor: text;
|
|
623
627
|
}
|
|
@@ -639,7 +643,7 @@
|
|
|
639
643
|
grid-auto-flow: column;
|
|
640
644
|
grid-auto-columns: 100%;
|
|
641
645
|
position: relative;
|
|
642
|
-
height: calc(var(--spatial-carousel-
|
|
646
|
+
height: calc(var(--spatial-carousel-panel-reserve) + var(--spatial-carousel-fit-height));
|
|
643
647
|
overflow-x: auto;
|
|
644
648
|
overflow-y: hidden;
|
|
645
649
|
scroll-snap-type: x mandatory;
|
|
@@ -670,7 +674,11 @@
|
|
|
670
674
|
justify-content: space-between;
|
|
671
675
|
pointer-events: none;
|
|
672
676
|
}
|
|
677
|
+
@media (width < 840px) {
|
|
678
|
+
.carousel-arrows { top: calc(var(--spatial-carousel-fit-height) - var(--spatial-carousel-compact-overlap) + var(--spatial-carousel-compact-height) / 2); }
|
|
679
|
+
}
|
|
673
680
|
.carousel-arrows button {
|
|
681
|
+
outline: none;
|
|
674
682
|
pointer-events: auto;
|
|
675
683
|
width: 44px;
|
|
676
684
|
height: 44px;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { getContext, onMount } from 'svelte';
|
|
5
5
|
import { STAGE_CONTEXT_KEY, type StageContext } from '@spatial-elements/core/stage/panelContext';
|
|
6
6
|
import { getPanelFocusProgress } from '@spatial-elements/core/stage/panelFocusMath';
|
|
7
|
+
import { subscribeStageScrollFrame, STAGE_SCROLL_PRIORITY } from '@spatial-elements/core/stage/scrollFrame';
|
|
7
8
|
import type { SpatialElementBreadcrumb } from '@spatial-elements/core/spatial-element/types';
|
|
8
9
|
let { items, transition = 'enter', focusReactive = true }: { items: SpatialElementBreadcrumb[]; transition?: 'enter' | 'exit'; focusReactive?: boolean } = $props();
|
|
9
10
|
const stage = getContext<StageContext | undefined>(STAGE_CONTEXT_KEY);
|
|
@@ -15,9 +16,20 @@
|
|
|
15
16
|
menu = element.closest('.stage')?.querySelector<HTMLElement>('[data-spatial-shell-menu]') ?? undefined;
|
|
16
17
|
if (!menu) return;
|
|
17
18
|
const measure = () => { menuSize = { width: menu!.offsetWidth, height: menu!.offsetHeight }; };
|
|
19
|
+
const occlude = () => {
|
|
20
|
+
const rect = element.getBoundingClientRect(), header = menu!.getBoundingClientRect();
|
|
21
|
+
const overlap = header.bottom - rect.top;
|
|
22
|
+
// The breadcrumb stays in its own document/zoom path. Hide its overlap
|
|
23
|
+
// with the glass surface rather than making that surface opaque.
|
|
24
|
+
const mask = overlap > 0 && rect.left < header.right && rect.right > header.left
|
|
25
|
+
? `linear-gradient(to bottom, transparent ${overlap}px, #000 ${overlap + Math.min(overlap, 12)}px)` : '';
|
|
26
|
+
if (element.style.maskImage !== mask) element.style.maskImage = mask;
|
|
27
|
+
};
|
|
18
28
|
measure();
|
|
19
|
-
|
|
20
|
-
|
|
29
|
+
occlude();
|
|
30
|
+
const stopScroll = subscribeStageScrollFrame(occlude, STAGE_SCROLL_PRIORITY.stage + 1);
|
|
31
|
+
const observer = new ResizeObserver(() => { measure(); occlude(); }); observer.observe(menu);
|
|
32
|
+
return () => { observer.disconnect(); stopScroll(); };
|
|
21
33
|
});
|
|
22
34
|
const travel = $derived.by(() => {
|
|
23
35
|
if (!focus) return '0px 0px';
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
CardMediaAspect,
|
|
4
|
-
CardMediaFit,
|
|
5
|
-
CardVariant,
|
|
6
|
-
SurfaceTone
|
|
7
|
-
} from '@page-sections/core';
|
|
2
|
+
import type { CardMediaAspect, CardMediaFit, SurfaceTone } from '@page-sections/core';
|
|
8
3
|
import { getContext } from 'svelte';
|
|
9
4
|
import { CATALOG_ITEMS, type CatalogItems } from '@spatial-elements/core/catalog/catalogItems';
|
|
10
5
|
import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
|
|
@@ -21,7 +16,7 @@
|
|
|
21
16
|
mediaFit = 'contain',
|
|
22
17
|
reserveEyebrow = false,
|
|
23
18
|
cardTone = 'standard',
|
|
24
|
-
|
|
19
|
+
cardShadow = false
|
|
25
20
|
}: {
|
|
26
21
|
spatialElement: SpatialListItem;
|
|
27
22
|
occurrence: string;
|
|
@@ -32,7 +27,7 @@
|
|
|
32
27
|
mediaFit?: CardMediaFit;
|
|
33
28
|
reserveEyebrow?: boolean;
|
|
34
29
|
cardTone?: SurfaceTone;
|
|
35
|
-
|
|
30
|
+
cardShadow?: boolean;
|
|
36
31
|
} = $props();
|
|
37
32
|
const items = getContext<CatalogItems | undefined>(CATALOG_ITEMS);
|
|
38
33
|
const readTheme = useSpatialTheme();
|
|
@@ -41,10 +36,7 @@
|
|
|
41
36
|
$effect(() => items?.register({ ...spatialElement, occurrence }));
|
|
42
37
|
</script>
|
|
43
38
|
|
|
44
|
-
<div
|
|
45
|
-
class="spatial-card-placement"
|
|
46
|
-
data-ps-card-size={cardVariant === 'catalog' ? cardSize : undefined}
|
|
47
|
-
>
|
|
39
|
+
<div class="spatial-card-placement" data-ps-card-size={cardSize}>
|
|
48
40
|
<SpatialCardSlot
|
|
49
41
|
instanceKey={`card:${brand.id}:${occurrence}`}
|
|
50
42
|
context={{
|
|
@@ -57,13 +49,15 @@
|
|
|
57
49
|
mediaFit,
|
|
58
50
|
reserveEyebrow,
|
|
59
51
|
cardTone,
|
|
60
|
-
|
|
52
|
+
cardShadow
|
|
61
53
|
}}
|
|
62
54
|
/>
|
|
63
55
|
</div>
|
|
64
56
|
|
|
65
57
|
<style>
|
|
66
58
|
.spatial-card-placement {
|
|
59
|
+
align-self: stretch;
|
|
60
|
+
display: grid;
|
|
67
61
|
grid-column: span var(--ps-card-span, 1);
|
|
68
62
|
min-width: 0;
|
|
69
63
|
min-height: 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CardMediaAspect, CardMediaFit,
|
|
1
|
+
import type { CardMediaAspect, CardMediaFit, SurfaceTone } from '@page-sections/core';
|
|
2
2
|
import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
|
|
3
3
|
import { type SpatialCardSize } from '@spatial-elements/core/spatial-element/responsiveLayout';
|
|
4
4
|
type $$ComponentProps = {
|
|
@@ -11,7 +11,7 @@ type $$ComponentProps = {
|
|
|
11
11
|
mediaFit?: CardMediaFit;
|
|
12
12
|
reserveEyebrow?: boolean;
|
|
13
13
|
cardTone?: SurfaceTone;
|
|
14
|
-
|
|
14
|
+
cardShadow?: boolean;
|
|
15
15
|
};
|
|
16
16
|
declare const SpatialElementCard: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
17
17
|
type SpatialElementCard = ReturnType<typeof SpatialElementCard>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { resolveSpatialThemeRadii } from '@spatial-elements/core/spatial-element/spatialTheme';
|
|
3
3
|
import { getContext, onMount, tick } from 'svelte';
|
|
4
|
-
import CircleHelp from 'lucide
|
|
5
|
-
import X from 'lucide
|
|
4
|
+
import CircleHelp from '@lucide/svelte/icons/circle-help';
|
|
5
|
+
import X from '@lucide/svelte/icons/x';
|
|
6
6
|
import InteractionGesture from './InteractionGesture.svelte';
|
|
7
|
-
import {
|
|
7
|
+
import { getSharedPanelBoxShadow } from '@spatial-elements/core/stage/panelShadow';
|
|
8
8
|
import { getInteractionGuidance, MODEL_INPUT_EVENT, type ModelInputState, type InteractionGuidance } from '@spatial-elements/core/stage/interactionGuidance';
|
|
9
9
|
import { STAGE_SCROLL_PRIORITY, subscribeStageScrollFrame } from '@spatial-elements/core/stage/scrollFrame';
|
|
10
10
|
import { STAGE_CONTEXT_KEY, STAGE_PANEL_LAYOUT_EVENT, type StageContext } from '@spatial-elements/core/stage/panelContext';
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
`--help-tint: ${typeof theme.panelTheme.tint === 'number' ? '#' + theme.panelTheme.tint.toString(16).padStart(6, '0') : theme.panelTheme.tint ?? '#ffffff'}`,
|
|
49
49
|
`--help-tint-opacity: ${(theme.panelTheme.tintOpacity ?? 0.65) * 100}%`,
|
|
50
50
|
`--help-blur: ${Math.min(100, Math.max(0, theme.panelTheme.backdropBlur ?? 8))}px`,
|
|
51
|
-
`--help-shadow: ${
|
|
51
|
+
`--help-shadow: ${getSharedPanelBoxShadow(theme.panelTheme.shadowIntensity ?? 0.2, theme.panelTheme.shadowColor)}`,
|
|
52
52
|
`--help-radius: ${radii.panel}px`
|
|
53
53
|
].join(';'));
|
|
54
54
|
|
|
@@ -285,6 +285,7 @@
|
|
|
285
285
|
.help-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
|
286
286
|
h2 { margin: 0; font-size: 15px; font-weight: 650; }
|
|
287
287
|
.close-help {
|
|
288
|
+
outline: 1px solid var(--ps-border); outline-offset: -1px;
|
|
288
289
|
width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center;
|
|
289
290
|
padding: 0; border: 0; border-radius: var(--spatial-element-control-radius); color: inherit; background: transparent; cursor: pointer;
|
|
290
291
|
}
|
|
@@ -295,6 +296,7 @@
|
|
|
295
296
|
/* Keep complete host-localized instructions available to assistive technology. */
|
|
296
297
|
dd { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
297
298
|
.navigation-hint { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid currentColor; font-size: 12px; }
|
|
298
|
-
.navigation-hint a { color: var(--spatial-element-accent); text-decoration:
|
|
299
|
+
.navigation-hint a { color: var(--spatial-element-accent); text-decoration: none; text-underline-offset: 2px; }
|
|
300
|
+
.navigation-hint a:hover { text-decoration: underline; }
|
|
299
301
|
.navigation-hint a:focus-visible { outline: 2px solid var(--spatial-element-accent); outline-offset: 3px; border-radius: 2px; }
|
|
300
302
|
</style>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
|
|
4
4
|
import { getPanelFocusOpacity } from '@spatial-elements/core/stage/panelFocusMath';
|
|
5
5
|
import { STAGE_CONTEXT_KEY, type StageContext } from '@spatial-elements/core/stage/panelContext';
|
|
6
|
-
import Play from 'lucide
|
|
6
|
+
import Play from '@lucide/svelte/icons/play';
|
|
7
7
|
import OverflowControls from './OverflowControls.svelte';
|
|
8
8
|
import SpatialMediaIndicator from './SpatialMediaIndicator.svelte';
|
|
9
9
|
import { STAGE_PANEL_LAYOUT_EVENT, STAGE_PANEL_VISUAL_EVENT } from '@spatial-elements/core/stage/panelContext';
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
visible={media.kind !== 'minimap' || minimapInRail || focused || minimapDocked}
|
|
119
119
|
minimapSelected={active}
|
|
120
120
|
class={`thumbnail-panel ${active ? 'active' : ''}`}
|
|
121
|
+
borderColor={active ? 'transparent' : 'var(--ps-border)'}
|
|
121
122
|
shape={{ ...theme.panelShape, radius: radii.control, contentInset: 0 }}
|
|
122
123
|
theme={theme.panelTheme}
|
|
123
124
|
contentClass="thumbnail-panel-content"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getContext, onMount, setContext } from 'svelte';
|
|
3
|
-
import ShoppingCart from 'lucide
|
|
3
|
+
import ShoppingCart from '@lucide/svelte/icons/shopping-cart';
|
|
4
4
|
import { SpatialElementPaneController } from '@spatial-elements/core/spatial-element/SpatialElementPaneController';
|
|
5
5
|
import { SpatialElementHeaderFields } from '@spatial-elements/core/spatial-element/SpatialElementHeaderFields';
|
|
6
6
|
import './headerFields.css';
|
|
@@ -319,7 +319,7 @@
|
|
|
319
319
|
/* Keep translated sections from extending the document's scroll range. */
|
|
320
320
|
[data-spatial-content-zooming] .spatial-element-section-viewport { overflow: clip; }
|
|
321
321
|
/* Filter only nearby sections, not the full document-sized layer. Offscreen
|
|
322
|
-
* sections retain
|
|
322
|
+
* sections retain backdrop culling; text is crisp at rest. */
|
|
323
323
|
.spatial-element-section-list :global(.content-section[data-spatial-element-section-near-viewport]) {
|
|
324
324
|
filter: var(--spatial-detail-content-blur, none);
|
|
325
325
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { getSharedPanelBoxShadow } from '@spatial-elements/core/stage/panelShadow';
|
|
3
|
+
import { useSpatialTheme } from './brandContext.js';
|
|
4
|
+
const readTheme = useSpatialTheme();
|
|
5
|
+
const shadow = $derived(getSharedPanelBoxShadow(readTheme().dockedPanelTheme.shadowIntensity, readTheme().dockedPanelTheme.shadowColor));
|
|
2
6
|
import type { Snippet } from 'svelte';
|
|
3
7
|
import type { ResolvedSpatialElementData as SpatialElementData } from '@spatial-elements/core/spatial-element/spatialElement';
|
|
4
8
|
import { catalogActionSemantic } from '@spatial-elements/core/catalog/catalogAction';
|
|
5
|
-
import ShoppingCart from 'lucide
|
|
9
|
+
import ShoppingCart from '@lucide/svelte/icons/shopping-cart';
|
|
6
10
|
import './layout.generated.css';
|
|
7
11
|
import { createCatalogEndpointAction } from '../catalog/catalogEndpointAction.js';
|
|
8
12
|
const catalogEndpoint = createCatalogEndpointAction();
|
|
@@ -27,6 +31,7 @@
|
|
|
27
31
|
|
|
28
32
|
<header
|
|
29
33
|
class="spatial-element-sticky-header"
|
|
34
|
+
style:--spatial-docked-default-shadow={shadow}
|
|
30
35
|
data-spatial-element-sticky-header
|
|
31
36
|
data-spatial-element-handoff-header
|
|
32
37
|
data-catalog-transition-dom="enter"
|
|
@@ -127,6 +132,7 @@
|
|
|
127
132
|
|
|
128
133
|
<div
|
|
129
134
|
class="spatial-element-sticky-tabs"
|
|
135
|
+
style:--spatial-docked-default-shadow={shadow}
|
|
130
136
|
data-spatial-element-sticky-tabs
|
|
131
137
|
data-catalog-transition-dom="enter"
|
|
132
138
|
aria-hidden="true"
|
|
@@ -199,7 +205,7 @@
|
|
|
199
205
|
opacity: 0;
|
|
200
206
|
visibility: hidden;
|
|
201
207
|
background: transparent;
|
|
202
|
-
box-shadow: var(--spatial-element-docked-panel-box-shadow);
|
|
208
|
+
box-shadow: var(--ps-panel-shadow, var(--spatial-element-docked-panel-box-shadow, var(--spatial-docked-default-shadow)));
|
|
203
209
|
pointer-events: none;
|
|
204
210
|
will-change: border-radius;
|
|
205
211
|
}
|
|
@@ -220,23 +226,41 @@
|
|
|
220
226
|
var(--spatial-element-docked-panel-tint-rgb) /
|
|
221
227
|
var(--spatial-element-docked-panel-tint-opacity)
|
|
222
228
|
);
|
|
223
|
-
box-shadow:
|
|
224
|
-
rgb(0 0 0 / calc(var(--spatial-element-docked-panel-shadow-strength) * 0.18));
|
|
229
|
+
box-shadow: none;
|
|
225
230
|
-webkit-backdrop-filter: blur(var(--spatial-element-docked-panel-backdrop-blur));
|
|
226
231
|
backdrop-filter: blur(var(--spatial-element-docked-panel-backdrop-blur));
|
|
227
232
|
}
|
|
228
233
|
|
|
229
234
|
.spatial-element-sticky-header::before {
|
|
235
|
+
box-sizing: border-box;
|
|
236
|
+
border-bottom: 1px solid var(--ps-panel-border);
|
|
230
237
|
z-index: 2;
|
|
231
238
|
opacity: var(--spatial-element-sticky-header-progress, 0);
|
|
232
239
|
}
|
|
233
240
|
|
|
234
241
|
.spatial-element-sticky-header::after {
|
|
235
242
|
z-index: 1;
|
|
236
|
-
box-shadow: var(--spatial-element-docked-panel-box-shadow);
|
|
243
|
+
box-shadow: var(--ps-panel-shadow, var(--spatial-element-docked-panel-box-shadow, var(--spatial-docked-default-shadow)));
|
|
237
244
|
opacity: var(--spatial-element-sticky-header-progress, 0);
|
|
238
245
|
}
|
|
239
246
|
|
|
247
|
+
.spatial-element-sticky-tabs::after {
|
|
248
|
+
content: '';
|
|
249
|
+
position: absolute;
|
|
250
|
+
inset: 0;
|
|
251
|
+
border: 1px solid var(--ps-panel-border);
|
|
252
|
+
/* Fade only the shared edge with the corner morph. Keep the surface and
|
|
253
|
+
* its existing header overlap intact so docking cannot expose a gap. */
|
|
254
|
+
border-top-color: color-mix(
|
|
255
|
+
in srgb,
|
|
256
|
+
var(--ps-panel-border) var(--spatial-element-tabs-dock-top-border-opacity, 100%),
|
|
257
|
+
transparent
|
|
258
|
+
);
|
|
259
|
+
border-radius: inherit;
|
|
260
|
+
pointer-events: none;
|
|
261
|
+
z-index: 3;
|
|
262
|
+
}
|
|
263
|
+
|
|
240
264
|
.spatial-element-sticky-tabs::before {
|
|
241
265
|
z-index: 0;
|
|
242
266
|
}
|