@spatial-elements/sveltekit 0.1.0-beta.1 → 1.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/README.md +19 -9
  2. package/dist/catalog/ScrollNavigationBridge.svelte +172 -47
  3. package/dist/catalog/ScrollNavigationBridge.svelte.d.ts +9 -2
  4. package/dist/catalog/catalogNavigation.js +3 -2
  5. package/dist/catalog/catalogSummaryTransfer.d.ts +16 -0
  6. package/dist/catalog/catalogSummaryTransfer.js +79 -0
  7. package/dist/catalog/catalogTransition.css +58 -3
  8. package/dist/catalog/interruptedPresentation.d.ts +10 -0
  9. package/dist/catalog/interruptedPresentation.js +29 -0
  10. package/dist/catalog/presentationCleanup.d.ts +4 -0
  11. package/dist/catalog/presentationCleanup.js +20 -0
  12. package/dist/catalog/stagedCatalogNavigation.d.ts +44 -0
  13. package/dist/catalog/stagedCatalogNavigation.js +403 -0
  14. package/dist/catalog/stagedDomReveal.d.ts +8 -0
  15. package/dist/catalog/stagedDomReveal.js +76 -0
  16. package/dist/index.d.ts +4 -0
  17. package/dist/index.js +3 -0
  18. package/dist/spatial-element/BrandStageShell.svelte +52 -71
  19. package/dist/spatial-element/BrandStageShell.svelte.d.ts +31 -4
  20. package/dist/spatial-element/CarouselSpatialElement.svelte +150 -197
  21. package/dist/spatial-element/CarouselSpatialElement.svelte.d.ts +5 -1
  22. package/dist/spatial-element/ContentBlock.svelte +7 -0
  23. package/dist/spatial-element/ContentBlock.svelte.d.ts +9 -0
  24. package/dist/spatial-element/ContentGrid.svelte +7 -0
  25. package/dist/spatial-element/ContentGrid.svelte.d.ts +8 -0
  26. package/dist/spatial-element/ContentPage.svelte +51 -55
  27. package/dist/spatial-element/ContentPage.svelte.d.ts +14 -3
  28. package/dist/spatial-element/InteractionGesture.svelte +39 -0
  29. package/dist/spatial-element/InteractionGesture.svelte.d.ts +7 -0
  30. package/dist/spatial-element/OverflowControls.svelte +125 -0
  31. package/dist/spatial-element/OverflowControls.svelte.d.ts +9 -0
  32. package/dist/spatial-element/PointerHint.svelte +80 -0
  33. package/dist/spatial-element/PointerHint.svelte.d.ts +3 -0
  34. package/dist/spatial-element/Section.svelte +25 -106
  35. package/dist/spatial-element/Section.svelte.d.ts +1 -0
  36. package/dist/spatial-element/SectionSurfaceGroup.svelte +8 -0
  37. package/dist/spatial-element/SectionSurfaceGroup.svelte.d.ts +8 -0
  38. package/dist/spatial-element/SpatialCardGridSection.svelte +79 -0
  39. package/dist/spatial-element/SpatialCardGridSection.svelte.d.ts +11 -0
  40. package/dist/spatial-element/SpatialCardPresentation.svelte +311 -0
  41. package/dist/spatial-element/SpatialCardPresentation.svelte.d.ts +19 -0
  42. package/dist/spatial-element/SpatialCardSlot.svelte +33 -0
  43. package/dist/spatial-element/SpatialCardSlot.svelte.d.ts +8 -0
  44. package/dist/spatial-element/SpatialCarouselSection.svelte +752 -0
  45. package/dist/spatial-element/{CarouselSection.svelte.d.ts → SpatialCarouselSection.svelte.d.ts} +5 -5
  46. package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +12 -65
  47. package/dist/spatial-element/SpatialElementCard.svelte +54 -238
  48. package/dist/spatial-element/SpatialElementCard.svelte.d.ts +9 -0
  49. package/dist/spatial-element/SpatialElementHelp.svelte +292 -0
  50. package/dist/spatial-element/SpatialElementHelp.svelte.d.ts +6 -0
  51. package/dist/spatial-element/SpatialElementMediaRail.svelte +321 -52
  52. package/dist/spatial-element/SpatialElementMediaRail.svelte.d.ts +4 -1
  53. package/dist/spatial-element/SpatialElementNativeMedia.svelte +101 -0
  54. package/dist/spatial-element/SpatialElementNativeMedia.svelte.d.ts +9 -0
  55. package/dist/spatial-element/SpatialElementPage.svelte +150 -70
  56. package/dist/spatial-element/SpatialElementPage.svelte.d.ts +6 -3
  57. package/dist/spatial-element/SpatialElementStickyHeader.svelte +76 -104
  58. package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +3 -1
  59. package/dist/spatial-element/SpatialElementSummaryContent.svelte +185 -0
  60. package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +18 -0
  61. package/dist/spatial-element/SpatialElementSummaryPanel.svelte +48 -380
  62. package/dist/spatial-element/SpatialElementSummaryPanel.svelte.d.ts +2 -1
  63. package/dist/spatial-element/SpatialElementTabList.svelte +40 -17
  64. package/dist/spatial-element/SpatialElementTabList.svelte.d.ts +2 -1
  65. package/dist/spatial-element/SpatialElementTabs.svelte +61 -18
  66. package/dist/spatial-element/SpatialElementTabs.svelte.d.ts +3 -1
  67. package/dist/spatial-element/SpatialElementViewToggle.svelte +54 -0
  68. package/dist/spatial-element/SpatialElementViewToggle.svelte.d.ts +8 -0
  69. package/dist/spatial-element/SpatialIconButton.svelte +59 -0
  70. package/dist/spatial-element/SpatialIconButton.svelte.d.ts +14 -0
  71. package/dist/spatial-element/SpatialListPage.svelte +37 -8
  72. package/dist/spatial-element/SpatialListPage.svelte.d.ts +4 -1
  73. package/dist/spatial-element/SpatialMediaIndicator.svelte +16 -0
  74. package/dist/spatial-element/SpatialMediaIndicator.svelte.d.ts +26 -0
  75. package/dist/spatial-element/SpatialNavigationShell.svelte +136 -0
  76. package/dist/spatial-element/SpatialNavigationShell.svelte.d.ts +15 -0
  77. package/dist/spatial-element/SpatialSummaryHost.svelte +19 -0
  78. package/dist/spatial-element/SpatialSummaryHost.svelte.d.ts +9 -0
  79. package/dist/spatial-element/SpatialSummaryRoot.svelte +78 -0
  80. package/dist/spatial-element/SpatialSummaryRoot.svelte.d.ts +8 -0
  81. package/dist/spatial-element/SpatialSummarySlot.svelte +39 -0
  82. package/dist/spatial-element/SpatialSummarySlot.svelte.d.ts +9 -0
  83. package/dist/spatial-element/SpatialViewIcon.svelte +29 -0
  84. package/dist/spatial-element/SpatialViewIcon.svelte.d.ts +6 -0
  85. package/dist/spatial-element/brandContext.d.ts +1 -1
  86. package/dist/spatial-element/brandContext.js +1 -1
  87. package/dist/spatial-element/cardAppearanceFreeze.d.ts +5 -0
  88. package/dist/spatial-element/cardAppearanceFreeze.js +72 -0
  89. package/dist/spatial-element/carouselTextHit.d.ts +2 -0
  90. package/dist/spatial-element/carouselTextHit.js +17 -0
  91. package/dist/spatial-element/contentSidebars.d.ts +3 -0
  92. package/dist/spatial-element/contentSidebars.js +56 -0
  93. package/dist/spatial-element/index.d.ts +18 -3
  94. package/dist/spatial-element/index.js +11 -2
  95. package/dist/spatial-element/layout.generated.css +363 -0
  96. package/dist/spatial-element/messagesContext.d.ts +3 -0
  97. package/dist/spatial-element/messagesContext.js +10 -0
  98. package/dist/spatial-element/presentationBoxFreeze.d.ts +8 -0
  99. package/dist/spatial-element/presentationBoxFreeze.js +35 -0
  100. package/dist/spatial-element/spatialCardGrid.d.ts +12 -0
  101. package/dist/spatial-element/spatialCardGrid.js +1 -0
  102. package/dist/spatial-element/spatialPageContext.d.ts +4 -0
  103. package/dist/spatial-element/spatialPageContext.js +9 -0
  104. package/dist/spatial-element/spatialPresentationOwner.d.ts +6 -0
  105. package/dist/spatial-element/spatialPresentationOwner.js +2 -0
  106. package/dist/spatial-element/spatialSummary.d.ts +43 -0
  107. package/dist/spatial-element/spatialSummary.js +1 -0
  108. package/dist/spatial-element/spatialSummaryHost.svelte.d.ts +60 -0
  109. package/dist/spatial-element/spatialSummaryHost.svelte.js +233 -0
  110. package/dist/spatial-element/spatialThemeStyle.d.ts +3 -0
  111. package/dist/spatial-element/spatialThemeStyle.js +69 -0
  112. package/dist/spatial-element/truncatedTitle.d.ts +5 -0
  113. package/dist/spatial-element/truncatedTitle.js +28 -0
  114. package/dist/stage/ButtonGroup.svelte +151 -0
  115. package/dist/stage/ButtonGroup.svelte.d.ts +24 -0
  116. package/dist/stage/Panel.svelte +72 -14
  117. package/dist/stage/Panel.svelte.d.ts +14 -2
  118. package/dist/stage/Stage.svelte +405 -48
  119. package/dist/stage/Stage.svelte.d.ts +8 -1
  120. package/dist/stage/StageViewport.svelte +15 -2
  121. package/dist/stage/authoredStyle.d.ts +4 -0
  122. package/dist/stage/authoredStyle.js +17 -0
  123. package/dist/stage/buttonGroup.d.ts +9 -0
  124. package/dist/stage/buttonGroup.js +1 -0
  125. package/logo.svg +188 -0
  126. package/package.json +9 -6
  127. package/dist/spatial-element/CarouselSection.svelte +0 -350
  128. package/dist/spatial-element/ListSection.svelte +0 -30
  129. 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/types';
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 { spatialElement }: { spatialElement: SpatialElementData } = $props();
7
- const theme = useSpatialTheme();
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
- <aside class="spatial-element-rail" aria-label="SpatialElement images">
16
- {#each spatialElement.media as media (media.id)}
17
- <div
18
- class="spatial-element-media-anchor"
19
- data-spatial-element-dock-minimap-anchor={media.kind === 'minimap' ? '' : undefined}
20
- >
21
- <Panel
22
- catalogEndpoint={media.kind === 'minimap'
23
- ? { brandId: theme.id, spatialElementId: spatialElement.id, slot: 'detail.dock', role: 'geometry' }
24
- : undefined}
25
- transitionGroup="enter"
26
- class={`thumbnail-panel ${media.kind === 'minimap' ? 'active' : ''}`}
27
- shape={{ ...theme.panelShape, contentInset: 0 }}
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
- {#if media.kind === 'minimap'}
34
- <button type="button" aria-label={media.label} class="thumb thumb-minimap active"
35
- ></button>
36
- {:else if media.kind === 'drawing'}
37
- <button type="button" aria-label={media.label} class="thumb thumb-drawing">
38
- <span class="drawing-sheet" aria-hidden="true"></span>
39
- </button>
40
- {:else}
41
- <button type="button" aria-label={media.label} class="thumb thumb-image">
42
- <img src={media.src} alt={media.alt} />
43
- </button>
44
- {/if}
45
- </Panel>
46
- </div>
47
- {/each}
48
- </aside>
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: absolute;
53
- top: 0;
54
- left: 0;
201
+ position: relative;
202
+ width: 100%;
203
+ height: 100%;
204
+ scrollbar-width: none;
55
205
  display: grid;
56
- gap: 14px;
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: 120px;
63
- height: 120px;
225
+ width: 100%;
226
+ aspect-ratio: 1;
64
227
  }
65
228
 
66
229
  :global(.thumbnail-panel) {
@@ -76,18 +239,54 @@
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-panel-radius);
253
+ border-radius: var(--spatial-element-control-radius);
85
254
  background: transparent;
86
255
  cursor: pointer;
87
256
  }
88
257
 
89
- .thumb.active:not(.thumb-minimap) {
90
- box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--spatial-element-accent) 82%, transparent);
258
+ .thumb.active::after {
259
+ content: '';
260
+ position: absolute;
261
+ inset: 0;
262
+ border-radius: inherit;
263
+ box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--spatial-element-accent) 96%, transparent);
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
+ bottom: 4px;
272
+ right: 4px;
273
+ display: grid;
274
+ color: color-mix(in srgb, var(--spatial-element-ink) 45%, transparent);
275
+ opacity: var(--stage-panel-surface-opacity, 1);
276
+ pointer-events: none;
277
+ }
278
+ .play-indicator {
279
+ position: absolute;
280
+ left: 50%;
281
+ top: 50%;
282
+ transform: translate(-50%, -50%);
283
+ display: grid;
284
+ place-items: center;
285
+ width: 44px;
286
+ height: 44px;
287
+ border-radius: 50%;
288
+ color: #fff;
289
+ background: #0009;
91
290
  }
92
291
 
93
292
  .thumb-minimap {
@@ -95,11 +294,71 @@
95
294
  overflow: hidden;
96
295
  }
97
296
 
297
+ .minimap-poster {
298
+ position: absolute;
299
+ inset: 10%;
300
+ width: 80%;
301
+ height: 80%;
302
+ object-fit: contain;
303
+ transition: opacity 240ms ease;
304
+ }
305
+
306
+ :global(.stage-enhanced[data-stage-page-ready]) .minimap-poster {
307
+ opacity: 0;
308
+ }
309
+ :global(.stage-enhanced[data-catalog-transition]) .minimap-poster {
310
+ opacity: 0;
311
+ transition: none;
312
+ }
313
+
314
+ @media (prefers-reduced-motion: reduce) {
315
+ .minimap-poster {
316
+ transition: none;
317
+ }
318
+ }
319
+
98
320
  .thumb-image img {
321
+ position: absolute;
322
+ left: 0;
323
+ top: 0;
99
324
  display: block;
100
- max-width: calc(100% - 18px);
101
- max-height: calc(100% - 18px);
325
+ width: 100%;
326
+ height: 100%;
327
+ min-height: 0;
328
+ min-width: 0;
102
329
  object-fit: contain;
330
+ transition: width 220ms ease, height 220ms ease, left 220ms ease, top 220ms ease, transform 220ms ease;
331
+ }
332
+ .thumb-image[data-media-fit='contain'] img {
333
+ left: 8px;
334
+ top: 8px;
335
+ width: calc(100% - 16px);
336
+ height: calc(100% - 16px);
337
+ }
338
+ .play-indicator { transition: transform 220ms ease; }
339
+ @media (prefers-reduced-motion: no-preference) {
340
+ /* Cut-out products expand into their inset, never beyond the frame. */
341
+ .thumb-image:global([data-mouse-hover])[data-media-fit='contain'] img,
342
+ .thumb-image[data-media-fit='contain']:focus-visible img {
343
+ left: 0;
344
+ top: 0;
345
+ width: 100%;
346
+ height: 100%;
347
+ }
348
+ .thumb-image:global([data-mouse-hover])[data-media-fit='cover'] img,
349
+ .thumb-image[data-media-fit='cover']:focus-visible img {
350
+ left: -8px;
351
+ top: -8px;
352
+ width: calc(100% + 16px);
353
+ height: calc(100% + 16px);
354
+ }
355
+ .thumb-video:global([data-mouse-hover]) img,
356
+ .thumb-video:focus-visible img { transform: scale(1.04); }
357
+ .thumb-video:global([data-mouse-hover]) .play-indicator,
358
+ .thumb-video:focus-visible .play-indicator { transform: translate(-50%, -50%) scale(1.15); }
359
+ }
360
+ @media (prefers-reduced-motion: reduce) {
361
+ .thumb-image img, .play-indicator { transition: none; }
103
362
  }
104
363
 
105
364
  .drawing-sheet {
@@ -133,12 +392,22 @@
133
392
  content: '100 mm';
134
393
  }
135
394
 
136
- @media (max-width: 1100px) {
395
+ @media (min-width: 840px) {
396
+ .rail-frame {
397
+ position: absolute;
398
+ top: 0;
399
+ left: var(--spatial-detail-media-left);
400
+ width: var(--spatial-detail-media-size);
401
+ height: var(--spatial-detail-fit-height);
402
+ margin: 0;
403
+ }
137
404
  .spatial-element-rail {
138
- position: relative;
139
- left: 0;
140
- grid-auto-flow: column;
141
- justify-content: start;
405
+ grid-auto-flow: row;
406
+ grid-auto-columns: 100%;
407
+ grid-auto-rows: max-content;
408
+ align-content: start;
409
+ overflow-x: hidden;
410
+ overflow-y: auto;
142
411
  }
143
412
  }
144
413
  </style>
@@ -1,6 +1,9 @@
1
- import type { SpatialElementData } from '@spatial-elements/core/spatial-element/types';
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;