@spatial-elements/sveltekit 0.1.0-beta.2 → 1.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -13
- package/dist/catalog/ScrollNavigationBridge.svelte +172 -47
- package/dist/catalog/ScrollNavigationBridge.svelte.d.ts +9 -2
- package/dist/catalog/catalogNavigation.js +3 -2
- package/dist/catalog/catalogSummaryTransfer.d.ts +16 -0
- package/dist/catalog/catalogSummaryTransfer.js +79 -0
- package/dist/catalog/catalogTransition.css +58 -3
- package/dist/catalog/interruptedPresentation.d.ts +10 -0
- package/dist/catalog/interruptedPresentation.js +29 -0
- package/dist/catalog/presentationCleanup.d.ts +4 -0
- package/dist/catalog/presentationCleanup.js +20 -0
- package/dist/catalog/stagedCatalogNavigation.d.ts +44 -0
- package/dist/catalog/stagedCatalogNavigation.js +403 -0
- package/dist/catalog/stagedDomReveal.d.ts +8 -0
- package/dist/catalog/stagedDomReveal.js +76 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/spatial-element/BrandStageShell.svelte +52 -71
- package/dist/spatial-element/BrandStageShell.svelte.d.ts +31 -4
- package/dist/spatial-element/CarouselSpatialElement.svelte +152 -200
- package/dist/spatial-element/CarouselSpatialElement.svelte.d.ts +5 -1
- package/dist/spatial-element/ContentBlock.svelte +7 -0
- package/dist/spatial-element/ContentBlock.svelte.d.ts +9 -0
- package/dist/spatial-element/ContentGrid.svelte +7 -0
- package/dist/spatial-element/ContentGrid.svelte.d.ts +8 -0
- package/dist/spatial-element/ContentPage.svelte +51 -55
- package/dist/spatial-element/ContentPage.svelte.d.ts +14 -3
- package/dist/spatial-element/InteractionGesture.svelte +39 -0
- package/dist/spatial-element/InteractionGesture.svelte.d.ts +7 -0
- package/dist/spatial-element/OverflowControls.svelte +129 -0
- package/dist/spatial-element/OverflowControls.svelte.d.ts +9 -0
- package/dist/spatial-element/PointerHint.svelte +80 -0
- package/dist/spatial-element/PointerHint.svelte.d.ts +3 -0
- package/dist/spatial-element/Section.svelte +25 -106
- package/dist/spatial-element/Section.svelte.d.ts +1 -0
- package/dist/spatial-element/SectionSurfaceGroup.svelte +8 -0
- package/dist/spatial-element/SectionSurfaceGroup.svelte.d.ts +8 -0
- package/dist/spatial-element/SpaceMouseControl.svelte +159 -0
- package/dist/spatial-element/SpaceMouseControl.svelte.d.ts +7 -0
- package/dist/spatial-element/SpaceMouseIcon.svelte +12 -0
- package/dist/spatial-element/SpaceMouseIcon.svelte.d.ts +26 -0
- package/dist/spatial-element/SpatialCardGridSection.svelte +79 -0
- package/dist/spatial-element/SpatialCardGridSection.svelte.d.ts +11 -0
- package/dist/spatial-element/SpatialCardPresentation.svelte +311 -0
- package/dist/spatial-element/SpatialCardPresentation.svelte.d.ts +19 -0
- package/dist/spatial-element/SpatialCardSlot.svelte +33 -0
- package/dist/spatial-element/SpatialCardSlot.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialCarouselSection.svelte +754 -0
- package/dist/spatial-element/{CarouselSection.svelte.d.ts → SpatialCarouselSection.svelte.d.ts} +5 -5
- package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +12 -65
- package/dist/spatial-element/SpatialElementCard.svelte +54 -238
- package/dist/spatial-element/SpatialElementCard.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialElementHelp.svelte +300 -0
- package/dist/spatial-element/SpatialElementHelp.svelte.d.ts +6 -0
- package/dist/spatial-element/SpatialElementMediaRail.svelte +322 -52
- package/dist/spatial-element/SpatialElementMediaRail.svelte.d.ts +4 -1
- package/dist/spatial-element/SpatialElementNativeMedia.svelte +101 -0
- package/dist/spatial-element/SpatialElementNativeMedia.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialElementPage.svelte +156 -71
- package/dist/spatial-element/SpatialElementPage.svelte.d.ts +10 -3
- package/dist/spatial-element/SpatialElementStickyHeader.svelte +89 -105
- package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +6 -1
- package/dist/spatial-element/SpatialElementSummaryContent.svelte +198 -0
- package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +23 -0
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte +48 -380
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte.d.ts +2 -1
- package/dist/spatial-element/SpatialElementTabList.svelte +40 -17
- package/dist/spatial-element/SpatialElementTabList.svelte.d.ts +2 -1
- package/dist/spatial-element/SpatialElementTabs.svelte +61 -18
- package/dist/spatial-element/SpatialElementTabs.svelte.d.ts +3 -1
- package/dist/spatial-element/SpatialElementViewToggle.svelte +54 -0
- package/dist/spatial-element/SpatialElementViewToggle.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialIconButton.svelte +66 -0
- package/dist/spatial-element/SpatialIconButton.svelte.d.ts +17 -0
- package/dist/spatial-element/SpatialListPage.svelte +37 -8
- package/dist/spatial-element/SpatialListPage.svelte.d.ts +4 -1
- package/dist/spatial-element/SpatialMediaIndicator.svelte +16 -0
- package/dist/spatial-element/SpatialMediaIndicator.svelte.d.ts +26 -0
- package/dist/spatial-element/SpatialNavigationShell.svelte +138 -0
- package/dist/spatial-element/SpatialNavigationShell.svelte.d.ts +15 -0
- package/dist/spatial-element/SpatialSummaryHost.svelte +19 -0
- package/dist/spatial-element/SpatialSummaryHost.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialSummaryRoot.svelte +80 -0
- package/dist/spatial-element/SpatialSummaryRoot.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialSummarySlot.svelte +39 -0
- package/dist/spatial-element/SpatialSummarySlot.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialViewIcon.svelte +29 -0
- package/dist/spatial-element/SpatialViewIcon.svelte.d.ts +6 -0
- package/dist/spatial-element/brandContext.d.ts +1 -1
- package/dist/spatial-element/brandContext.js +1 -1
- package/dist/spatial-element/cardAppearanceFreeze.d.ts +5 -0
- package/dist/spatial-element/cardAppearanceFreeze.js +72 -0
- package/dist/spatial-element/carouselTextHit.d.ts +2 -0
- package/dist/spatial-element/carouselTextHit.js +17 -0
- package/dist/spatial-element/contentSidebars.d.ts +3 -0
- package/dist/spatial-element/contentSidebars.js +56 -0
- package/dist/spatial-element/index.d.ts +19 -3
- package/dist/spatial-element/index.js +12 -2
- package/dist/spatial-element/layout.generated.css +363 -0
- package/dist/spatial-element/messagesContext.d.ts +3 -0
- package/dist/spatial-element/messagesContext.js +10 -0
- package/dist/spatial-element/presentationBoxFreeze.d.ts +8 -0
- package/dist/spatial-element/presentationBoxFreeze.js +35 -0
- package/dist/spatial-element/spatialCardGrid.d.ts +12 -0
- package/dist/spatial-element/spatialCardGrid.js +1 -0
- package/dist/spatial-element/spatialPageContext.d.ts +4 -0
- package/dist/spatial-element/spatialPageContext.js +9 -0
- package/dist/spatial-element/spatialPresentationOwner.d.ts +6 -0
- package/dist/spatial-element/spatialPresentationOwner.js +2 -0
- package/dist/spatial-element/spatialSummary.d.ts +43 -0
- package/dist/spatial-element/spatialSummary.js +1 -0
- package/dist/spatial-element/spatialSummaryHost.svelte.d.ts +60 -0
- package/dist/spatial-element/spatialSummaryHost.svelte.js +233 -0
- package/dist/spatial-element/spatialThemeStyle.d.ts +3 -0
- package/dist/spatial-element/spatialThemeStyle.js +69 -0
- package/dist/spatial-element/truncatedTitle.d.ts +5 -0
- package/dist/spatial-element/truncatedTitle.js +28 -0
- package/dist/stage/ButtonGroup.svelte +152 -0
- package/dist/stage/ButtonGroup.svelte.d.ts +24 -0
- package/dist/stage/Panel.svelte +72 -14
- package/dist/stage/Panel.svelte.d.ts +14 -2
- package/dist/stage/Stage.svelte +471 -51
- package/dist/stage/Stage.svelte.d.ts +8 -1
- package/dist/stage/StageViewport.svelte +15 -2
- package/dist/stage/authoredStyle.d.ts +4 -0
- package/dist/stage/authoredStyle.js +17 -0
- package/dist/stage/buttonGroup.d.ts +9 -0
- package/dist/stage/buttonGroup.js +1 -0
- package/logo.svg +225 -0
- package/package.json +9 -6
- package/dist/spatial-element/CarouselSection.svelte +0 -350
- package/dist/spatial-element/ListSection.svelte +0 -30
- package/dist/spatial-element/ListSection.svelte.d.ts +0 -8
|
@@ -1,10 +1,82 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { getContext, onMount } from 'svelte';
|
|
3
|
+
import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
|
|
4
|
+
import { STAGE_CONTEXT_KEY, type StageContext } from '@spatial-elements/core/stage/panelContext';
|
|
5
|
+
import Play from 'lucide-svelte/icons/play';
|
|
6
|
+
import OverflowControls from './OverflowControls.svelte';
|
|
7
|
+
import SpatialMediaIndicator from './SpatialMediaIndicator.svelte';
|
|
8
|
+
import { STAGE_PANEL_LAYOUT_EVENT, STAGE_PANEL_VISUAL_EVENT } from '@spatial-elements/core/stage/panelContext';
|
|
9
|
+
import { resolveSpatialThemeRadii } from '@spatial-elements/core/spatial-element/spatialTheme';
|
|
2
10
|
import Panel from '../stage/Panel.svelte';
|
|
3
11
|
import { useSpatialTheme } from './brandContext.js';
|
|
4
|
-
import type { SpatialElementData } from '@spatial-elements/core/spatial-element/
|
|
12
|
+
import type { ResolvedSpatialElementData as SpatialElementData } from '@spatial-elements/core/spatial-element/spatialElement';
|
|
13
|
+
import type { SpatialElementMediaItem } from '@spatial-elements/core/spatial-element/types';
|
|
5
14
|
|
|
6
|
-
let {
|
|
7
|
-
|
|
15
|
+
let {
|
|
16
|
+
spatialElement,
|
|
17
|
+
selectedId,
|
|
18
|
+
onselect
|
|
19
|
+
}: {
|
|
20
|
+
spatialElement: SpatialElementData;
|
|
21
|
+
selectedId?: string;
|
|
22
|
+
onselect?: (media: SpatialElementMediaItem) => void;
|
|
23
|
+
} = $props();
|
|
24
|
+
let rail = $state<HTMLElement>();
|
|
25
|
+
const stage = getContext<StageContext>(STAGE_CONTEXT_KEY);
|
|
26
|
+
const focused = $derived(
|
|
27
|
+
(stage.getZoomUiFocus?.() ?? 0) > 0.01 || (stage.isFullscreen?.() ?? false)
|
|
28
|
+
);
|
|
29
|
+
let minimapInRail = $state(true);
|
|
30
|
+
let minimapDocked = $state(false);
|
|
31
|
+
$effect(() => {
|
|
32
|
+
if (!focused || !rail) return;
|
|
33
|
+
// Zoom keeps the live minimap available even after browsing a long rail.
|
|
34
|
+
// Its projected anchor must start inside the rail before it expands.
|
|
35
|
+
rail.scrollTo({ top: 0, left: 0, behavior: 'instant' });
|
|
36
|
+
minimapInRail = true;
|
|
37
|
+
refreshProjection();
|
|
38
|
+
});
|
|
39
|
+
let refreshFrame = 0;
|
|
40
|
+
function refreshProjection() {
|
|
41
|
+
if (!refreshFrame)
|
|
42
|
+
refreshFrame = requestAnimationFrame(() => {
|
|
43
|
+
refreshFrame = 0;
|
|
44
|
+
minimapInRail = !rail || (rail.scrollTop < 1 && rail.scrollLeft < 1);
|
|
45
|
+
window.dispatchEvent(new Event(STAGE_PANEL_LAYOUT_EVENT));
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
$effect(() => {
|
|
49
|
+
const id = selectedId;
|
|
50
|
+
if (!rail || !id) return;
|
|
51
|
+
const anchor = Array.from(rail.querySelectorAll<HTMLElement>('[data-media-id]')).find(
|
|
52
|
+
(node) => node.dataset.mediaId === id
|
|
53
|
+
);
|
|
54
|
+
if (!anchor) return;
|
|
55
|
+
const left = anchor.offsetLeft,
|
|
56
|
+
top = anchor.offsetTop;
|
|
57
|
+
if (left < rail.scrollLeft) rail.scrollLeft = left;
|
|
58
|
+
else if (left + anchor.offsetWidth > rail.scrollLeft + rail.clientWidth)
|
|
59
|
+
rail.scrollLeft = left + anchor.offsetWidth - rail.clientWidth;
|
|
60
|
+
if (top < rail.scrollTop) rail.scrollTop = top;
|
|
61
|
+
else if (top + anchor.offsetHeight > rail.scrollTop + rail.clientHeight)
|
|
62
|
+
rail.scrollTop = top + anchor.offsetHeight - rail.clientHeight;
|
|
63
|
+
});
|
|
64
|
+
onMount(() => {
|
|
65
|
+
const element = rail!;
|
|
66
|
+
const minimapFrame = element.querySelector<HTMLElement>('[data-spatial-element-dock-minimap-anchor] .stage-panel-fallback');
|
|
67
|
+
const updateDock = () => { minimapDocked = Number(minimapFrame?.dataset.stageMinimapDockProgress ?? 0) > 0; };
|
|
68
|
+
window.addEventListener(STAGE_PANEL_VISUAL_EVENT, updateDock);
|
|
69
|
+
updateDock();
|
|
70
|
+
element.addEventListener('scroll', refreshProjection, { passive: true });
|
|
71
|
+
return () => {
|
|
72
|
+
window.removeEventListener(STAGE_PANEL_VISUAL_EVENT, updateDock);
|
|
73
|
+
element.removeEventListener('scroll', refreshProjection);
|
|
74
|
+
cancelAnimationFrame(refreshFrame);
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
const readTheme = useSpatialTheme();
|
|
78
|
+
const theme = $derived(readTheme());
|
|
79
|
+
const radii = $derived(resolveSpatialThemeRadii(theme));
|
|
8
80
|
const minimap = $derived({
|
|
9
81
|
...spatialElement.minimap,
|
|
10
82
|
...theme.minimapTheme,
|
|
@@ -12,55 +84,146 @@
|
|
|
12
84
|
});
|
|
13
85
|
</script>
|
|
14
86
|
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
theme={theme.panelTheme}
|
|
29
|
-
contentClass="thumbnail-panel-content"
|
|
30
|
-
minimap={media.kind === 'minimap' ? minimap : false}
|
|
31
|
-
data-spatial-element-departing-media-content={media.kind === 'minimap' ? undefined : ''}
|
|
87
|
+
<div class="rail-frame">
|
|
88
|
+
<aside
|
|
89
|
+
bind:this={rail}
|
|
90
|
+
class="spatial-element-rail"
|
|
91
|
+
data-spatial-element-media-rail
|
|
92
|
+
aria-label="Product media"
|
|
93
|
+
>
|
|
94
|
+
{#each spatialElement.media as media (media.id)}
|
|
95
|
+
{@const active = selectedId ? selectedId === media.id : media.kind === 'minimap'}
|
|
96
|
+
<div
|
|
97
|
+
class="spatial-element-media-anchor"
|
|
98
|
+
data-media-id={media.id}
|
|
99
|
+
data-spatial-element-dock-minimap-anchor={media.kind === 'minimap' ? '' : undefined}
|
|
32
100
|
>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
101
|
+
<Panel
|
|
102
|
+
catalogEndpoint={media.kind === 'minimap'
|
|
103
|
+
? {
|
|
104
|
+
brandId: theme.id,
|
|
105
|
+
spatialElementId: spatialElement.id,
|
|
106
|
+
slot: 'detail.dock',
|
|
107
|
+
role: 'geometry'
|
|
108
|
+
}
|
|
109
|
+
: undefined}
|
|
110
|
+
transitionGroup="enter"
|
|
111
|
+
nativeContent={media.kind !== 'minimap'}
|
|
112
|
+
pointerReactive={media.kind === 'minimap'}
|
|
113
|
+
visible={media.kind !== 'minimap' || minimapInRail || focused || minimapDocked}
|
|
114
|
+
minimapSelected={active}
|
|
115
|
+
class={`thumbnail-panel ${active ? 'active' : ''}`}
|
|
116
|
+
shape={{ ...theme.panelShape, radius: radii.control, contentInset: 0 }}
|
|
117
|
+
theme={theme.panelTheme}
|
|
118
|
+
contentClass="thumbnail-panel-content"
|
|
119
|
+
minimap={media.kind === 'minimap' ? minimap : false}
|
|
120
|
+
data-spatial-element-departing-media-content={media.kind === 'minimap' ? undefined : ''}
|
|
121
|
+
>
|
|
122
|
+
{#if media.kind === 'minimap'}
|
|
123
|
+
<button
|
|
124
|
+
type="button"
|
|
125
|
+
aria-label={media.label}
|
|
126
|
+
aria-pressed={active}
|
|
127
|
+
onclick={() => onselect?.(media)}
|
|
128
|
+
class="thumb thumb-minimap"
|
|
129
|
+
class:active
|
|
130
|
+
>
|
|
131
|
+
{#if spatialElement.fallbackImage}
|
|
132
|
+
<img class="minimap-poster" src={spatialElement.fallbackImage} alt="" />
|
|
133
|
+
{/if}
|
|
134
|
+
<span class="media-indicator"><SpatialMediaIndicator /></span>
|
|
135
|
+
</button>
|
|
136
|
+
{:else if media.kind === 'drawing'}
|
|
137
|
+
<button
|
|
138
|
+
type="button"
|
|
139
|
+
aria-label={media.label}
|
|
140
|
+
aria-pressed={active}
|
|
141
|
+
onclick={() => onselect?.(media)}
|
|
142
|
+
class="thumb thumb-drawing"
|
|
143
|
+
class:active
|
|
144
|
+
>
|
|
145
|
+
<span class="drawing-sheet" aria-hidden="true"></span>
|
|
146
|
+
</button>
|
|
147
|
+
{:else if media.kind === 'image'}
|
|
148
|
+
<button
|
|
149
|
+
use:mouseHover
|
|
150
|
+
data-media-fit={media.fit ?? 'contain'}
|
|
151
|
+
type="button"
|
|
152
|
+
aria-label={media.label}
|
|
153
|
+
aria-pressed={active}
|
|
154
|
+
onclick={() => onselect?.(media)}
|
|
155
|
+
class="thumb thumb-image"
|
|
156
|
+
class:active
|
|
157
|
+
>
|
|
158
|
+
<img
|
|
159
|
+
style:object-fit={media.fit ?? 'contain'}
|
|
160
|
+
src={media.thumbnail ?? media.src}
|
|
161
|
+
alt={media.alt}
|
|
162
|
+
loading="lazy"
|
|
163
|
+
decoding="async"
|
|
164
|
+
/>
|
|
165
|
+
</button>
|
|
166
|
+
{:else}
|
|
167
|
+
<button
|
|
168
|
+
use:mouseHover
|
|
169
|
+
type="button"
|
|
170
|
+
aria-label={media.label}
|
|
171
|
+
aria-pressed={active}
|
|
172
|
+
onclick={() => onselect?.(media)}
|
|
173
|
+
class="thumb thumb-image thumb-video"
|
|
174
|
+
class:active
|
|
175
|
+
>
|
|
176
|
+
{#if media.poster}<img
|
|
177
|
+
src={media.poster}
|
|
178
|
+
alt=""
|
|
179
|
+
loading="lazy"
|
|
180
|
+
decoding="async"
|
|
181
|
+
/>{/if}<span class="play-indicator"><Play size={28} fill="currentColor" /></span>
|
|
182
|
+
</button>
|
|
183
|
+
{/if}
|
|
184
|
+
</Panel>
|
|
185
|
+
</div>
|
|
186
|
+
{/each}
|
|
187
|
+
</aside>
|
|
188
|
+
<OverflowControls target={rail} responsive label="media" hidden={focused} />
|
|
189
|
+
</div>
|
|
49
190
|
|
|
50
191
|
<style>
|
|
192
|
+
.rail-frame {
|
|
193
|
+
position: relative;
|
|
194
|
+
flex: none;
|
|
195
|
+
width: calc(100% - var(--spatial-detail-media-left) * 2);
|
|
196
|
+
height: var(--spatial-detail-media-size);
|
|
197
|
+
margin-top: var(--spatial-detail-media-stage-gap);
|
|
198
|
+
margin-left: var(--spatial-detail-media-left);
|
|
199
|
+
}
|
|
51
200
|
.spatial-element-rail {
|
|
52
|
-
position:
|
|
53
|
-
|
|
54
|
-
|
|
201
|
+
position: relative;
|
|
202
|
+
width: 100%;
|
|
203
|
+
height: 100%;
|
|
204
|
+
scrollbar-width: none;
|
|
55
205
|
display: grid;
|
|
56
|
-
|
|
206
|
+
grid-auto-flow: column;
|
|
207
|
+
grid-auto-columns: var(--spatial-detail-media-size);
|
|
208
|
+
gap: var(--spatial-detail-media-gap);
|
|
209
|
+
justify-content: start;
|
|
57
210
|
justify-items: start;
|
|
211
|
+
overflow-x: auto;
|
|
212
|
+
overflow-y: hidden;
|
|
213
|
+
/* Keep horizontal swipes in the rail, but let vertical gestures scroll
|
|
214
|
+
* the document, including when this rail has no vertical overflow. */
|
|
215
|
+
overscroll-behavior-x: contain;
|
|
216
|
+
overscroll-behavior-y: auto;
|
|
58
217
|
pointer-events: auto;
|
|
59
218
|
}
|
|
60
219
|
|
|
220
|
+
.spatial-element-rail::-webkit-scrollbar {
|
|
221
|
+
display: none;
|
|
222
|
+
}
|
|
223
|
+
|
|
61
224
|
.spatial-element-media-anchor {
|
|
62
|
-
width:
|
|
63
|
-
|
|
225
|
+
width: 100%;
|
|
226
|
+
aspect-ratio: 1;
|
|
64
227
|
}
|
|
65
228
|
|
|
66
229
|
:global(.thumbnail-panel) {
|
|
@@ -76,18 +239,55 @@
|
|
|
76
239
|
}
|
|
77
240
|
|
|
78
241
|
.thumb {
|
|
242
|
+
position: relative;
|
|
243
|
+
padding: 0;
|
|
244
|
+
overflow: hidden;
|
|
245
|
+
min-width: 0;
|
|
246
|
+
min-height: 0;
|
|
247
|
+
color: var(--spatial-element-ink);
|
|
79
248
|
display: grid;
|
|
80
249
|
place-items: center;
|
|
81
250
|
width: 100%;
|
|
82
251
|
height: 100%;
|
|
83
252
|
border: 0;
|
|
84
|
-
border-radius: var(--spatial-element-
|
|
253
|
+
border-radius: var(--spatial-element-control-radius);
|
|
85
254
|
background: transparent;
|
|
86
255
|
cursor: pointer;
|
|
87
256
|
}
|
|
88
257
|
|
|
89
|
-
.thumb.active
|
|
90
|
-
|
|
258
|
+
.thumb.active::after {
|
|
259
|
+
content: '';
|
|
260
|
+
position: absolute;
|
|
261
|
+
inset: 0;
|
|
262
|
+
border-radius: inherit;
|
|
263
|
+
box-shadow: inset 0 0 0 3px var(--spatial-element-accent);
|
|
264
|
+
pointer-events: none;
|
|
265
|
+
}
|
|
266
|
+
:global(.stage-enhanced[data-stage-page-ready]) .thumb-minimap.active::after {
|
|
267
|
+
display: none;
|
|
268
|
+
}
|
|
269
|
+
.media-indicator {
|
|
270
|
+
position: absolute;
|
|
271
|
+
/* Inset along the rounded corner's diagonal; retain a 4px safety margin. */
|
|
272
|
+
bottom: calc(4px + var(--spatial-element-control-radius) * 0.293);
|
|
273
|
+
right: calc(4px + var(--spatial-element-control-radius) * 0.293);
|
|
274
|
+
display: grid;
|
|
275
|
+
color: color-mix(in srgb, var(--spatial-element-ink) 45%, transparent);
|
|
276
|
+
opacity: var(--stage-panel-surface-opacity, 1);
|
|
277
|
+
pointer-events: none;
|
|
278
|
+
}
|
|
279
|
+
.play-indicator {
|
|
280
|
+
position: absolute;
|
|
281
|
+
left: 50%;
|
|
282
|
+
top: 50%;
|
|
283
|
+
transform: translate(-50%, -50%);
|
|
284
|
+
display: grid;
|
|
285
|
+
place-items: center;
|
|
286
|
+
width: 44px;
|
|
287
|
+
height: 44px;
|
|
288
|
+
border-radius: 50%;
|
|
289
|
+
color: #fff;
|
|
290
|
+
background: #0009;
|
|
91
291
|
}
|
|
92
292
|
|
|
93
293
|
.thumb-minimap {
|
|
@@ -95,11 +295,71 @@
|
|
|
95
295
|
overflow: hidden;
|
|
96
296
|
}
|
|
97
297
|
|
|
298
|
+
.minimap-poster {
|
|
299
|
+
position: absolute;
|
|
300
|
+
inset: 10%;
|
|
301
|
+
width: 80%;
|
|
302
|
+
height: 80%;
|
|
303
|
+
object-fit: contain;
|
|
304
|
+
transition: opacity 240ms ease;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
:global(.stage-enhanced[data-stage-page-ready]) .minimap-poster {
|
|
308
|
+
opacity: 0;
|
|
309
|
+
}
|
|
310
|
+
:global(.stage-enhanced[data-catalog-transition]) .minimap-poster {
|
|
311
|
+
opacity: 0;
|
|
312
|
+
transition: none;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
@media (prefers-reduced-motion: reduce) {
|
|
316
|
+
.minimap-poster {
|
|
317
|
+
transition: none;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
98
321
|
.thumb-image img {
|
|
322
|
+
position: absolute;
|
|
323
|
+
left: 0;
|
|
324
|
+
top: 0;
|
|
99
325
|
display: block;
|
|
100
|
-
|
|
101
|
-
|
|
326
|
+
width: 100%;
|
|
327
|
+
height: 100%;
|
|
328
|
+
min-height: 0;
|
|
329
|
+
min-width: 0;
|
|
102
330
|
object-fit: contain;
|
|
331
|
+
transition: width 220ms ease, height 220ms ease, left 220ms ease, top 220ms ease, transform 220ms ease;
|
|
332
|
+
}
|
|
333
|
+
.thumb-image[data-media-fit='contain'] img {
|
|
334
|
+
left: 8px;
|
|
335
|
+
top: 8px;
|
|
336
|
+
width: calc(100% - 16px);
|
|
337
|
+
height: calc(100% - 16px);
|
|
338
|
+
}
|
|
339
|
+
.play-indicator { transition: transform 220ms ease; }
|
|
340
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
341
|
+
/* Cut-out products expand into their inset, never beyond the frame. */
|
|
342
|
+
.thumb-image:global([data-mouse-hover])[data-media-fit='contain'] img,
|
|
343
|
+
.thumb-image[data-media-fit='contain']:focus-visible img {
|
|
344
|
+
left: 0;
|
|
345
|
+
top: 0;
|
|
346
|
+
width: 100%;
|
|
347
|
+
height: 100%;
|
|
348
|
+
}
|
|
349
|
+
.thumb-image:global([data-mouse-hover])[data-media-fit='cover'] img,
|
|
350
|
+
.thumb-image[data-media-fit='cover']:focus-visible img {
|
|
351
|
+
left: -8px;
|
|
352
|
+
top: -8px;
|
|
353
|
+
width: calc(100% + 16px);
|
|
354
|
+
height: calc(100% + 16px);
|
|
355
|
+
}
|
|
356
|
+
.thumb-video:global([data-mouse-hover]) img,
|
|
357
|
+
.thumb-video:focus-visible img { transform: scale(1.04); }
|
|
358
|
+
.thumb-video:global([data-mouse-hover]) .play-indicator,
|
|
359
|
+
.thumb-video:focus-visible .play-indicator { transform: translate(-50%, -50%) scale(1.15); }
|
|
360
|
+
}
|
|
361
|
+
@media (prefers-reduced-motion: reduce) {
|
|
362
|
+
.thumb-image img, .play-indicator { transition: none; }
|
|
103
363
|
}
|
|
104
364
|
|
|
105
365
|
.drawing-sheet {
|
|
@@ -133,12 +393,22 @@
|
|
|
133
393
|
content: '100 mm';
|
|
134
394
|
}
|
|
135
395
|
|
|
136
|
-
@media (
|
|
396
|
+
@media (min-width: 840px) {
|
|
397
|
+
.rail-frame {
|
|
398
|
+
position: absolute;
|
|
399
|
+
top: 0;
|
|
400
|
+
left: var(--spatial-detail-media-left);
|
|
401
|
+
width: var(--spatial-detail-media-size);
|
|
402
|
+
height: var(--spatial-detail-fit-height);
|
|
403
|
+
margin: 0;
|
|
404
|
+
}
|
|
137
405
|
.spatial-element-rail {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
grid-auto-
|
|
141
|
-
|
|
406
|
+
grid-auto-flow: row;
|
|
407
|
+
grid-auto-columns: 100%;
|
|
408
|
+
grid-auto-rows: max-content;
|
|
409
|
+
align-content: start;
|
|
410
|
+
overflow-x: hidden;
|
|
411
|
+
overflow-y: auto;
|
|
142
412
|
}
|
|
143
413
|
}
|
|
144
414
|
</style>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type { SpatialElementData } from '@spatial-elements/core/spatial-element/
|
|
1
|
+
import type { ResolvedSpatialElementData as SpatialElementData } from '@spatial-elements/core/spatial-element/spatialElement';
|
|
2
|
+
import type { SpatialElementMediaItem } from '@spatial-elements/core/spatial-element/types';
|
|
2
3
|
type $$ComponentProps = {
|
|
3
4
|
spatialElement: SpatialElementData;
|
|
5
|
+
selectedId?: string;
|
|
6
|
+
onselect?: (media: SpatialElementMediaItem) => void;
|
|
4
7
|
};
|
|
5
8
|
declare const SpatialElementMediaRail: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
9
|
type SpatialElementMediaRail = ReturnType<typeof SpatialElementMediaRail>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SpatialElementMediaItem } from '@spatial-elements/core/spatial-element/types';
|
|
3
|
+
import { spatialYoutubeEmbedUrl } from '@spatial-elements/core/spatial-element/spatialElementMedia';
|
|
4
|
+
let { media }: { media: Exclude<SpatialElementMediaItem, { kind: 'minimap' }> } = $props();
|
|
5
|
+
let failed = $state(false);
|
|
6
|
+
const embedUrl = $derived(
|
|
7
|
+
media.kind === 'youtube' ? spatialYoutubeEmbedUrl(media.videoId) : undefined
|
|
8
|
+
);
|
|
9
|
+
$effect(() => {
|
|
10
|
+
media.id;
|
|
11
|
+
failed = false;
|
|
12
|
+
});
|
|
13
|
+
function releaseVideo(video: HTMLVideoElement) {
|
|
14
|
+
return {
|
|
15
|
+
destroy() {
|
|
16
|
+
video.pause();
|
|
17
|
+
video.removeAttribute('src');
|
|
18
|
+
video.load();
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<div
|
|
25
|
+
class="spatial-native-media"
|
|
26
|
+
data-spatial-native-media={media.kind}
|
|
27
|
+
data-stage-ui
|
|
28
|
+
style:--media-fit={media.kind === 'image' ? (media.fit ?? 'contain') : 'contain'}
|
|
29
|
+
>
|
|
30
|
+
{#if failed || media.kind === 'drawing' || (media.kind === 'youtube' && !embedUrl)}
|
|
31
|
+
<p role="status">{media.label}: media unavailable.</p>
|
|
32
|
+
{:else if media.kind === 'image'}
|
|
33
|
+
<img src={media.src} alt={media.alt} onerror={() => (failed = true)} />
|
|
34
|
+
{:else if media.kind === 'video'}
|
|
35
|
+
<!-- Captions are supplied through the typed media track collection below. -->
|
|
36
|
+
<!-- svelte-ignore a11y_media_has_caption -->
|
|
37
|
+
<video
|
|
38
|
+
use:releaseVideo
|
|
39
|
+
src={media.src}
|
|
40
|
+
poster={media.poster}
|
|
41
|
+
controls
|
|
42
|
+
playsinline
|
|
43
|
+
preload="metadata"
|
|
44
|
+
aria-label={media.label}
|
|
45
|
+
onerror={() => (failed = true)}
|
|
46
|
+
>
|
|
47
|
+
{#each media.captions ?? [] as track}
|
|
48
|
+
<track
|
|
49
|
+
kind="captions"
|
|
50
|
+
src={track.src}
|
|
51
|
+
srclang={track.language}
|
|
52
|
+
label={track.label}
|
|
53
|
+
default={track.default}
|
|
54
|
+
/>
|
|
55
|
+
{/each}
|
|
56
|
+
</video>
|
|
57
|
+
{:else if media.kind === 'youtube' && embedUrl}
|
|
58
|
+
<iframe
|
|
59
|
+
src={embedUrl}
|
|
60
|
+
title={media.label}
|
|
61
|
+
allow="fullscreen; picture-in-picture"
|
|
62
|
+
allowfullscreen
|
|
63
|
+
referrerpolicy="strict-origin-when-cross-origin"
|
|
64
|
+
></iframe>
|
|
65
|
+
{/if}
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<style>
|
|
69
|
+
.spatial-native-media {
|
|
70
|
+
position: absolute;
|
|
71
|
+
inset: 0;
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
grid-template: minmax(0, 1fr) / minmax(0, 1fr);
|
|
74
|
+
display: grid;
|
|
75
|
+
place-items: center;
|
|
76
|
+
width: 100%;
|
|
77
|
+
height: 100%;
|
|
78
|
+
min-width: 0;
|
|
79
|
+
min-height: 0;
|
|
80
|
+
pointer-events: auto;
|
|
81
|
+
}
|
|
82
|
+
img,
|
|
83
|
+
video {
|
|
84
|
+
display: block;
|
|
85
|
+
width: 100%;
|
|
86
|
+
height: 100%;
|
|
87
|
+
min-width: 0;
|
|
88
|
+
min-height: 0;
|
|
89
|
+
object-fit: var(--media-fit);
|
|
90
|
+
}
|
|
91
|
+
iframe {
|
|
92
|
+
border: 0;
|
|
93
|
+
width: 100%;
|
|
94
|
+
height: 100%;
|
|
95
|
+
}
|
|
96
|
+
p {
|
|
97
|
+
max-width: 32rem;
|
|
98
|
+
padding: 24px;
|
|
99
|
+
text-align: center;
|
|
100
|
+
}
|
|
101
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SpatialElementMediaItem } from '@spatial-elements/core/spatial-element/types';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
media: Exclude<SpatialElementMediaItem, {
|
|
4
|
+
kind: 'minimap';
|
|
5
|
+
}>;
|
|
6
|
+
};
|
|
7
|
+
declare const SpatialElementNativeMedia: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type SpatialElementNativeMedia = ReturnType<typeof SpatialElementNativeMedia>;
|
|
9
|
+
export default SpatialElementNativeMedia;
|