@spatial-elements/sveltekit 0.1.0-beta.2 → 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 +18 -13
  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,5 +1,9 @@
1
1
  <script lang="ts">
2
2
  import { getContext, onMount, setContext } from 'svelte';
3
+ import ShoppingCart from 'lucide-svelte/icons/shopping-cart';
4
+ import { SpatialElementPaneController } from '@spatial-elements/core/spatial-element/SpatialElementPaneController';
5
+ import { resolveActiveDetailSection } from '@spatial-elements/core/spatial-element/activeDetailSection';
6
+ import { resolveDetailLayout } from '@spatial-elements/core/spatial-element/responsiveLayout';
3
7
  import {
4
8
  CATALOG_ENDPOINTS,
5
9
  type CatalogEndpointRegistry
@@ -11,30 +15,65 @@
11
15
  STAGE_ANCHOR_NAVIGATION_EVENT,
12
16
  type StageAnchorNavigationDetail
13
17
  } from '@spatial-elements/core/stage/scrollAnimation';
14
- import { STAGE_SCROLL_PRIORITY, subscribeStageScrollFrame } from '@spatial-elements/core/stage/scrollFrame';
18
+ import { getStageVisualScrollPosition, STAGE_SCROLL_PRIORITY, subscribeStageScrollFrame } from '@spatial-elements/core/stage/scrollFrame';
15
19
  import SpatialElementBreadcrumbs from './SpatialElementBreadcrumbs.svelte';
16
20
  import { useSpatialTheme } from './brandContext.js';
17
21
  import SpatialElementMediaRail from './SpatialElementMediaRail.svelte';
22
+ import SpatialElementNativeMedia from './SpatialElementNativeMedia.svelte';
23
+ import { resolveSpatialElementMedia } from '@spatial-elements/core/spatial-element/spatialElementMedia';
18
24
  import SpatialElementSummaryPanel from './SpatialElementSummaryPanel.svelte';
25
+ import SpatialElementHelp from './SpatialElementHelp.svelte';
19
26
  import SpatialElementStickyHeader from './SpatialElementStickyHeader.svelte';
20
27
  import SpatialElementTabs from './SpatialElementTabs.svelte';
28
+ import SectionSurfaceGroup from './SectionSurfaceGroup.svelte';
29
+ import './layout.generated.css';
21
30
  import { SpatialElementDockController } from '@spatial-elements/core/spatial-element/SpatialElementDockController';
22
31
  import { SPATIAL_ELEMENT_SECTION_REGISTRY_KEY, SpatialElementSectionRegistry } from '@spatial-elements/core/spatial-element/spatialElementSectionRegistry';
23
- import type { SpatialElementData, SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
32
+ import type { SpatialElementData, SpatialElementMediaItem, SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
33
+ import { resolveSpatialElementData } from '@spatial-elements/core/spatial-element/spatialElement';
34
+ import { registerSpatialPage } from './spatialPageContext.js';
35
+ import { STAGE_CONTEXT_KEY, type StageContext } from '@spatial-elements/core/stage/panelContext';
24
36
 
25
37
  const SPATIAL_ELEMENT_OVERVIEW_SECTION = {
26
38
  id: 'overview',
27
39
  title: 'Übersicht'
28
40
  } satisfies SpatialElementSectionNavigationItem;
29
- // Switch while the next panel enters the upper reading area, before it reaches the sticky tabs.
30
- const SPATIAL_ELEMENT_SECTION_ACTIVATION_VIEWPORT_RATIO = 0.25;
31
41
 
32
- let { spatialElement, children }: { spatialElement: SpatialElementData; children?: Snippet } = $props();
33
- const brand = useSpatialTheme();
42
+ interface Props {
43
+ /** Complete element document from this page's load function. Registers assets with the enclosing shell. */
44
+ spatialElement: SpatialElementData;
45
+ /** Detail sections; Section components automatically populate the tab navigation. */
46
+ children?: Snippet;
47
+ }
48
+ let { spatialElement: element, children }: Props = $props();
49
+ const readTheme = useSpatialTheme();
50
+ const brand = $derived(readTheme());
51
+ const spatialElement = $derived.by(() => {
52
+ const resolved = resolveSpatialElementData(element, brand.id);
53
+ return { ...resolved, media: resolveSpatialElementMedia(resolved.media) };
54
+ });
55
+ let mediaSelection = $state<{ elementId: string; mediaId: string }>();
56
+ const selectedMedia = $derived(spatialElement.media.find(media =>
57
+ mediaSelection?.elementId === spatialElement.id && media.id === mediaSelection.mediaId) ?? spatialElement.media[0]);
58
+ function selectMedia(media: SpatialElementMediaItem) {
59
+ mediaSelection = { elementId: spatialElement.id, mediaId: media.id };
60
+ }
61
+ $effect(() => { if (mediaSelection?.elementId !== element?.id) mediaSelection = undefined; });
62
+ // During route teardown Kit can clear the outgoing page's data before unmount.
63
+ // Read raw assets here, so the parent stage never evaluates outgoing DOM-derived content.
64
+ registerSpatialPage(() => element ? { kind: 'detail', element } : { kind: 'content', hdr: '' });
34
65
  const endpoints = getContext<CatalogEndpointRegistry | undefined>(CATALOG_ENDPOINTS);
66
+ const stageContext = getContext<StageContext | undefined>(STAGE_CONTEXT_KEY);
35
67
  let sections = $state<SpatialElementSectionNavigationItem[]>([]);
36
68
  let activeSectionId = $state<string | undefined>(SPATIAL_ELEMENT_OVERVIEW_SECTION.id);
37
69
  let mainElement: HTMLElement;
70
+ let tabList = $state<HTMLElement>();
71
+ let splitPane = $state(false);
72
+ let paneController = $state.raw<SpatialElementPaneController>();
73
+ const paneTint = $derived(typeof brand.panelTheme.tint === 'number'
74
+ ? `#${brand.panelTheme.tint.toString(16).padStart(6, '0')}`
75
+ : typeof brand.panelTheme.tint === 'object' ? brand.panelTheme.tint.getStyle()
76
+ : brand.panelTheme.tint ?? '#ffffff');
38
77
  let navigationTargetId: string | undefined;
39
78
  let scrollSpyFrame = 0;
40
79
  const navigationSections = $derived([SPATIAL_ELEMENT_OVERVIEW_SECTION, ...sections]);
@@ -49,23 +88,32 @@
49
88
  activeSectionId = SPATIAL_ELEMENT_OVERVIEW_SECTION.id;
50
89
  }
51
90
  });
91
+ $effect(() => {
92
+ paneController?.setFocus(stageContext?.getZoomUiFocus?.() ?? stageContext?.getZoomFocus?.() ?? 0,
93
+ Boolean(stageContext?.isFullscreen?.()));
94
+ });
95
+ function invokePaneAction() {
96
+ mainElement.querySelector<HTMLElement>('[data-spatial-detail-pane-body] [data-catalog-rich-shared="primary-action"]')?.click();
97
+ }
52
98
 
53
99
  function updateActiveSection() {
54
100
  if (navigationTargetId || !mainElement?.isConnected) return;
55
- const offset =
101
+ const metrics = stageContext?.getLayoutMetrics?.('stable');
102
+ const pane = metrics ? resolveDetailLayout(metrics).pane : undefined;
103
+ const offset = pane?.body.y ?? (
56
104
  Number.parseFloat(
57
105
  getComputedStyle(mainElement).getPropertyValue('--spatial-element-section-scroll-offset')
58
- ) || 24;
59
- const readingAreaHeight = Math.max(window.innerHeight - offset, 0);
60
- const activationLine = offset + readingAreaHeight * SPATIAL_ELEMENT_SECTION_ACTIVATION_VIEWPORT_RATIO;
61
- let nextActiveId = SPATIAL_ELEMENT_OVERVIEW_SECTION.id;
62
-
63
- for (const section of sections) {
64
- const element = document.getElementById(section.id);
65
- if (!element || element.getBoundingClientRect().top > activationLine + 1) break;
66
- nextActiveId = section.id;
67
- }
68
-
106
+ ) || 24);
107
+ const readingBottom = pane ? pane.body.y + pane.body.height : window.innerHeight;
108
+ const bounds = sections.flatMap(section => {
109
+ const rect = document.getElementById(section.id)?.getBoundingClientRect();
110
+ return rect ? [{ id: section.id, top: rect.top, bottom: rect.bottom }] : [];
111
+ });
112
+ const scrollOwner = document.scrollingElement ?? document.documentElement;
113
+ const nextActiveId = resolveActiveDetailSection(bounds, offset, readingBottom,
114
+ getStageVisualScrollPosition().scrollY,
115
+ Math.max(0, scrollOwner.scrollHeight - scrollOwner.clientHeight),
116
+ SPATIAL_ELEMENT_OVERVIEW_SECTION.id);
69
117
  if (nextActiveId !== activeSectionId) activeSectionId = nextActiveId;
70
118
  }
71
119
 
@@ -88,7 +136,15 @@
88
136
  }
89
137
 
90
138
  onMount(() => {
91
- const dock = new SpatialElementDockController(mainElement);
139
+ const orderSections = () => sectionRegistry.order([...mainElement.querySelectorAll<HTMLElement>('[data-ps-section]')].map(node => node.id));
140
+ const sectionOrder = new MutationObserver(orderSections);
141
+ sectionOrder.observe(mainElement, { childList: true, subtree: true });
142
+ orderSections();
143
+ const unregisterMedia = stageContext?.registerDetailMedia?.(() => element ? selectedMedia.kind : 'minimap');
144
+ paneController = new SpatialElementPaneController(mainElement,
145
+ () => stageContext?.getLayoutMetrics?.('stable'), (split) => { splitPane = split; });
146
+ paneController.start();
147
+ const dock = new SpatialElementDockController(mainElement, () => stageContext?.getLayoutMetrics?.('stable'), () => tabList);
92
148
  dock.start();
93
149
  const unregisterPresentation = endpoints?.registerPresentation(
94
150
  { brandId: brand.id, spatialElementId: spatialElement.id },
@@ -114,6 +170,9 @@
114
170
  scheduleScrollSpy();
115
171
 
116
172
  return () => {
173
+ sectionOrder.disconnect();
174
+ unregisterMedia?.();
175
+ paneController?.destroy();
117
176
  cancelAnimationFrame(scrollSpyFrame);
118
177
  window.removeEventListener(STAGE_ANCHOR_NAVIGATION_EVENT, handleAnchorNavigation);
119
178
  window.removeEventListener(STAGE_ANCHOR_NAVIGATION_END_EVENT, handleAnchorNavigationEnd);
@@ -135,23 +194,39 @@
135
194
  data-spatial-element-root
136
195
  data-spatial-element-id={spatialElement.id}
137
196
  data-brand-id={spatialElement.brandId}
197
+ data-spatial-selected-media={selectedMedia.kind}
198
+ style:--spatial-pane-tint={paneTint}
199
+ style:--spatial-pane-tint-opacity={`${Math.min(1, Math.max(0, brand.panelTheme.tintOpacity ?? 0.28)) * 100}%`}
200
+ style:--spatial-pane-blur={`${Math.min(100, Math.max(0, brand.panelTheme.backdropBlur ?? 5))}px`}
138
201
  >
139
- <SpatialElementBreadcrumbs
140
- items={spatialElement.breadcrumbs.map((item) => ({
141
- ...item,
142
- href: item.href ?? `/${brand.id}/categories/list`
143
- }))}
144
- />
202
+ <div class="spatial-element-pane-heading" data-spatial-detail-pane-header data-spatial-detail-fixed>
203
+ <SpatialElementBreadcrumbs items={spatialElement.breadcrumbs} />
204
+ <div class="spatial-element-pane-title-row">
205
+ <p class="spatial-element-pane-title">{spatialElement.title}</p>
206
+ {#if spatialElement.eyebrow}<p class="spatial-element-pane-eyebrow">{spatialElement.eyebrow}</p>{/if}
207
+ {#if spatialElement.action}
208
+ <button type="button" class="spatial-element-pane-action" onclick={invokePaneAction}
209
+ aria-label={spatialElement.action.ariaLabel ?? spatialElement.action.label}>
210
+ <ShoppingCart size={24} aria-hidden="true" />
211
+ </button>
212
+ {/if}
213
+ </div>
214
+ </div>
145
215
  <SpatialElementStickyHeader {activeSectionId} {spatialElement} sections={navigationSections} />
146
-
216
+ <div class="spatial-element-pane-surface" data-spatial-detail-pane-surface data-spatial-detail-fixed aria-hidden="true"></div>
217
+ <div class="spatial-element-pane-cover spatial-element-pane-cover-top" data-spatial-detail-fixed aria-hidden="true"></div>
218
+ <div class="spatial-element-pane-cover spatial-element-pane-cover-bottom" data-spatial-detail-fixed aria-hidden="true"></div>
219
+ <div class="spatial-element-presentation">
147
220
  <section
148
221
  id={SPATIAL_ELEMENT_OVERVIEW_SECTION.id}
149
222
  class="spatial-element-hero"
150
223
  data-spatial-element-tab-target
151
224
  data-stage-scroll-top
152
225
  aria-labelledby="spatial-element-title"
226
+ data-spatial-detail-media-region
227
+ data-spatial-detail-fixed
153
228
  >
154
- <SpatialElementMediaRail {spatialElement} />
229
+ <SpatialElementMediaRail {spatialElement} selectedId={selectedMedia.id} onselect={selectMedia} />
155
230
 
156
231
  <StageViewport
157
232
  catalogEndpoint={{
@@ -164,54 +239,61 @@
164
239
  data-catalog-geometry
165
240
  data-spatial-element-id={spatialElement.id}
166
241
  data-catalog-slot="detail.hero"
167
- fallbackSrc={spatialElement.stage.fallbackImage}
242
+ fallbackSrc={selectedMedia.kind === 'minimap' ? spatialElement.fallbackImage : undefined}
168
243
  fallbackAlt={`${brand.name} ${spatialElement.title}`}
169
- aria-hidden={spatialElement.stage.fallbackImage ? undefined : 'true'}
170
- />
244
+ aria-hidden={selectedMedia.kind === 'minimap' && !spatialElement.fallbackImage ? 'true' : undefined}
245
+ >
246
+ {#if selectedMedia.kind !== 'minimap'}
247
+ {#key `${spatialElement.id}:${selectedMedia.id}`}<SpatialElementNativeMedia media={selectedMedia} />{/key}
248
+ {/if}
249
+ </StageViewport>
171
250
 
172
- <SpatialElementSummaryPanel {spatialElement} />
251
+ {#key spatialElement.id}<SpatialElementHelp active={selectedMedia.kind === 'minimap'} />{/key}
173
252
  </section>
174
-
253
+ <div class="spatial-element-pane-body" data-spatial-detail-pane-body data-stage-scroll-viewport>
254
+ {#key spatialElement.id}<SpatialElementSummaryPanel {spatialElement} nativeContent={splitPane} />{/key}
175
255
  <div class="spatial-element-content">
176
- <div class="spatial-element-section-list" data-catalog-transition-dom="enter">
177
- {@render children?.()}
256
+ <div class="spatial-element-section-list spatial-content-width spatial-content-container" data-catalog-transition-dom="enter">
257
+ <SectionSurfaceGroup>{@render children?.()}</SectionSurfaceGroup>
178
258
  </div>
179
259
  <!-- Read after the section snippet has registered its metadata during SSR. -->
180
- <SpatialElementTabs {activeSectionId} sections={[SPATIAL_ELEMENT_OVERVIEW_SECTION, ...sections]} />
260
+ <SpatialElementTabs bind:tabList {activeSectionId} sections={[SPATIAL_ELEMENT_OVERVIEW_SECTION, ...sections]} />
261
+ </div>
262
+ </div>
263
+ </div>
264
+ <div class="spatial-element-pane-submenu-shell" data-spatial-detail-pane-submenu-shell data-spatial-detail-fixed>
265
+ <div class="spatial-element-pane-submenu" data-spatial-detail-pane-submenu aria-hidden="true" inert></div>
181
266
  </div>
182
267
  </main>
183
268
 
184
269
  <style>
185
270
  .spatial-element-main {
186
271
  --spatial-element-section-scroll-offset: 150px;
187
- --spatial-element-hero-edge-gap: clamp(32px, 2.2vw, 42px);
188
-
189
- width: min(1550px, calc(100vw - 120px), 100%);
190
- margin: 0 auto;
272
+ width: 100%;
273
+ margin: 0;
191
274
  }
275
+ .spatial-element-presentation { position: relative; }
276
+ .spatial-element-pane-heading { display: contents; }
277
+ .spatial-element-pane-title-row, .spatial-element-pane-surface,
278
+ .spatial-element-pane-cover, .spatial-element-pane-submenu-shell { display: none; }
192
279
 
193
280
  .spatial-element-hero {
194
281
  position: relative;
195
282
  box-sizing: border-box;
196
- display: grid;
197
- grid-template-columns: minmax(420px, 1fr) minmax(360px, 494px);
198
- gap: clamp(28px, 4vw, 70px);
199
- align-items: start;
200
- width: calc(100vw - var(--spatial-element-hero-edge-gap) - var(--spatial-element-hero-edge-gap));
201
- min-height: clamp(610px, calc(100vh - 230px), 760px);
202
- margin-left: calc(50% - 50vw + var(--spatial-element-hero-edge-gap));
203
- padding-left: max(0px, calc(50vw - 50% - var(--spatial-element-hero-edge-gap)));
283
+ display: flex;
284
+ flex-direction: column;
285
+ width: 100%;
204
286
  }
205
287
 
206
288
  .spatial-element-content {
207
289
  display: flex;
208
290
  flex-direction: column;
209
- width: calc(100vw - var(--spatial-element-content-inline-inset) - var(--spatial-element-content-inline-inset));
210
- margin-left: calc(50% - 50vw + var(--spatial-element-content-inline-inset));
291
+ width: 100%;
211
292
  }
212
293
 
213
294
  .spatial-element-section-list {
214
295
  order: 2;
296
+ margin-top: var(--spatial-detail-submenu-after-gap, 0px);
215
297
  }
216
298
 
217
299
  .spatial-element-content :global(.spatial-element-tabs-anchor) {
@@ -219,31 +301,29 @@
219
301
  }
220
302
 
221
303
  .spatial-element-section-list :global(.content-section:first-child) {
222
- margin-top: 8px;
304
+ margin-top: 0;
223
305
  }
224
306
 
225
- :global(.spatial-element-visual) {
226
- min-height: clamp(540px, calc(100vh - 300px), 680px);
227
- border-radius: 28px;
307
+ .spatial-element-hero :global(.spatial-element-visual) {
308
+ order: -1;
309
+ flex: none;
310
+ margin-left: var(--spatial-detail-fit-left);
311
+ width: calc(100% - var(--spatial-detail-fit-left) - var(--spatial-detail-fit-right));
312
+ height: var(--spatial-detail-fit-height);
313
+ min-height: 0;
228
314
  background: transparent;
229
315
  pointer-events: none;
230
316
  }
231
-
232
- @media (max-width: 1100px) {
233
- .spatial-element-main {
234
- width: min(calc(100vw - 40px), 100%);
235
- }
236
-
237
- .spatial-element-content {
238
- width: 100%;
239
- margin-left: 0;
240
- }
241
-
242
- .spatial-element-hero {
243
- grid-template-columns: 1fr;
244
- width: 100%;
245
- margin-left: 0;
246
- padding-left: 0;
247
- }
317
+ @media (min-width: 840px) {
318
+ .spatial-element-hero { height: var(--spatial-detail-fit-height); }
319
+ .spatial-element-content { padding-top: 8px; }
320
+ .spatial-element-content :global(.spatial-element-tabs-anchor) { margin-left: 8px; max-width: calc(100% - 16px); }
321
+ }
322
+ @media (min-width: 1200px) {
323
+ .spatial-element-content :global(.spatial-element-tabs-anchor) { max-width: calc(100% - 32px); }
324
+ }
325
+ @media (min-width: 1600px) {
326
+ .spatial-element-content { padding-top: 12px; }
327
+ .spatial-element-content :global(.spatial-element-tabs-anchor) { margin-left: calc((100% - var(--spatial-detail-content-width)) / 2); max-width: var(--spatial-detail-content-width); }
248
328
  }
249
329
  </style>
@@ -1,9 +1,12 @@
1
1
  import type { Snippet } from 'svelte';
2
+ import './layout.generated.css';
2
3
  import type { SpatialElementData } from '@spatial-elements/core/spatial-element/types';
3
- type $$ComponentProps = {
4
+ interface Props {
5
+ /** Complete element document from this page's load function. Registers assets with the enclosing shell. */
4
6
  spatialElement: SpatialElementData;
7
+ /** Detail sections; Section components automatically populate the tab navigation. */
5
8
  children?: Snippet;
6
- };
7
- declare const SpatialElementPage: import("svelte").Component<$$ComponentProps, {}, "">;
9
+ }
10
+ declare const SpatialElementPage: import("svelte").Component<Props, {}, "">;
8
11
  type SpatialElementPage = ReturnType<typeof SpatialElementPage>;
9
12
  export default SpatialElementPage;
@@ -1,15 +1,14 @@
1
1
  <script lang="ts">
2
+ import type { ResolvedSpatialElementData as SpatialElementData } from '@spatial-elements/core/spatial-element/spatialElement';
2
3
  import { catalogActionSemantic } from '@spatial-elements/core/catalog/catalogAction';
3
- import { ShoppingCart } from 'lucide-svelte';
4
- import SpatialElementTabList from './SpatialElementTabList.svelte';
4
+ import ShoppingCart from 'lucide-svelte/icons/shopping-cart';
5
+ import './layout.generated.css';
5
6
  import { createCatalogEndpointAction } from '../catalog/catalogEndpointAction.js';
6
7
  const catalogEndpoint = createCatalogEndpointAction();
7
- import type { SpatialElementData, SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
8
+ import type { SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
8
9
 
9
10
  let {
10
- activeSectionId,
11
11
  spatialElement,
12
- sections
13
12
  }: {
14
13
  activeSectionId?: string;
15
14
  spatialElement: SpatialElementData;
@@ -53,6 +52,7 @@
53
52
 
54
53
  <div class="sticky-header-layout">
55
54
  <div class="sticky-header-copy">
55
+ {#if spatialElement.eyebrow}
56
56
  <p
57
57
  class="sticky-header-kicker"
58
58
  use:catalogEndpoint={{
@@ -64,6 +64,7 @@
64
64
  >
65
65
  {spatialElement.eyebrow}
66
66
  </p>
67
+ {/if}
67
68
  <p
68
69
  class="sticky-header-title"
69
70
  use:catalogEndpoint={{
@@ -77,39 +78,43 @@
77
78
  </p>
78
79
  </div>
79
80
 
80
- {#if spatialElement.action.href}
81
- <a
82
- class="sticky-header-action"
83
- use:catalogEndpoint={{
84
- brandId: spatialElement.brandId,
85
- spatialElementId: spatialElement.id,
86
- slot: 'detail.dock',
87
- role: 'primary-action'
88
- }}
89
- data-catalog-rich-shared="primary-action"
90
- data-catalog-semantic={catalogActionSemantic(spatialElement.action)}
91
- href={spatialElement.action.href}
92
- rel="external"
93
- aria-label={spatialElement.action.ariaLabel}
94
- >
95
- <ShoppingCart size={29} strokeWidth={2} aria-hidden="true" />
96
- </a>
97
- {:else}
98
- <button
99
- use:catalogEndpoint={{
100
- brandId: spatialElement.brandId,
101
- spatialElementId: spatialElement.id,
102
- slot: 'detail.dock',
103
- role: 'primary-action'
104
- }}
105
- data-catalog-rich-shared="primary-action"
106
- data-catalog-semantic={catalogActionSemantic(spatialElement.action)}
107
- class="sticky-header-action"
108
- type="button"
109
- aria-label={spatialElement.action.ariaLabel}
110
- >
111
- <ShoppingCart size={29} strokeWidth={2} aria-hidden="true" />
112
- </button>
81
+ {#if spatialElement.action}
82
+ {#if spatialElement.action.href}
83
+ <a
84
+ class="sticky-header-action"
85
+ data-spatial-element-dock-action
86
+ use:catalogEndpoint={{
87
+ brandId: spatialElement.brandId,
88
+ spatialElementId: spatialElement.id,
89
+ slot: 'detail.dock',
90
+ role: 'primary-action'
91
+ }}
92
+ data-catalog-rich-shared="primary-action"
93
+ data-catalog-semantic={catalogActionSemantic(spatialElement.action)}
94
+ href={spatialElement.action.href}
95
+ rel="external"
96
+ aria-label={spatialElement.action.ariaLabel ?? spatialElement.action.label}
97
+ >
98
+ <ShoppingCart size={29} strokeWidth={2} aria-hidden="true" />
99
+ </a>
100
+ {:else}
101
+ <button
102
+ use:catalogEndpoint={{
103
+ brandId: spatialElement.brandId,
104
+ spatialElementId: spatialElement.id,
105
+ slot: 'detail.dock',
106
+ role: 'primary-action'
107
+ }}
108
+ data-catalog-rich-shared="primary-action"
109
+ data-catalog-semantic={catalogActionSemantic(spatialElement.action)}
110
+ class="sticky-header-action"
111
+ data-spatial-element-dock-action
112
+ type="button"
113
+ aria-label={spatialElement.action.ariaLabel ?? spatialElement.action.label}
114
+ >
115
+ <ShoppingCart size={29} strokeWidth={2} aria-hidden="true" />
116
+ </button>
117
+ {/if}
113
118
  {/if}
114
119
  </div>
115
120
 
@@ -120,7 +125,7 @@
120
125
  aria-hidden="true"
121
126
  inert
122
127
  >
123
- <SpatialElementTabList {activeSectionId} {sections} variant="docked" />
128
+ <!-- The controller moves the existing live tab list here when it docks. -->
124
129
  </div>
125
130
  </header>
126
131
 
@@ -131,20 +136,15 @@
131
136
  border-radius: inherit;
132
137
  pointer-events: none;
133
138
  }
134
- @media (max-width: 1100px) {
135
- .sticky-header-summary-surface {
136
- right: 66px;
137
- }
138
- }
139
139
  .spatial-element-sticky-header {
140
140
  position: fixed;
141
141
  /* SpatialElementDockController portals this element outside the translated document. */
142
- top: 8px;
143
- left: 16px;
142
+ top: 0;
143
+ left: 0;
144
144
  z-index: 20;
145
145
  box-sizing: border-box;
146
- width: calc(100vw - 32px);
147
- height: 86px;
146
+ width: 100%;
147
+ height: var(--spatial-detail-dock-height);
148
148
  border: 0;
149
149
  border-radius: var(--spatial-element-panel-radius);
150
150
  visibility: hidden;
@@ -165,7 +165,7 @@
165
165
  position: fixed;
166
166
  z-index: 4;
167
167
  display: block;
168
- border-radius: var(--spatial-element-panel-radius);
168
+ border-radius: var(--spatial-element-control-radius);
169
169
  background: transparent;
170
170
  cursor: pointer;
171
171
  }
@@ -176,17 +176,18 @@
176
176
  }
177
177
 
178
178
  .spatial-element-sticky-tabs {
179
- --spatial-element-tabs-dock-top-radius: var(--spatial-element-panel-radius);
180
- --spatial-element-tabs-dock-bottom-radius: var(--spatial-element-panel-radius);
179
+ --spatial-element-tabs-dock-top-radius: var(--spatial-element-control-radius);
180
+ --spatial-element-tabs-dock-bottom-radius: var(--spatial-element-control-radius);
181
181
 
182
182
  position: fixed;
183
183
  z-index: 19;
184
184
  box-sizing: border-box;
185
- height: 52px;
185
+ height: var(--spatial-detail-submenu-height);
186
186
  padding: 0;
187
187
  border: 0;
188
- border-radius: var(--spatial-element-tabs-dock-top-radius) var(--spatial-element-tabs-dock-top-radius)
189
- var(--spatial-element-tabs-dock-bottom-radius) var(--spatial-element-tabs-dock-bottom-radius);
188
+ border-radius: var(--spatial-element-tabs-dock-top-radius)
189
+ var(--spatial-element-tabs-dock-top-radius) var(--spatial-element-tabs-dock-bottom-radius)
190
+ var(--spatial-element-tabs-dock-bottom-radius);
190
191
  overflow: clip;
191
192
  opacity: 0;
192
193
  visibility: hidden;
@@ -209,7 +210,8 @@
209
210
  .spatial-element-sticky-header::before,
210
211
  .spatial-element-sticky-tabs::before {
211
212
  background: rgb(
212
- var(--spatial-element-docked-panel-tint-rgb) / var(--spatial-element-docked-panel-tint-opacity)
213
+ var(--spatial-element-docked-panel-tint-rgb) /
214
+ var(--spatial-element-docked-panel-tint-opacity)
213
215
  );
214
216
  box-shadow: inset 0 0 0 1px
215
217
  rgb(0 0 0 / calc(var(--spatial-element-docked-panel-shadow-strength) * 0.18));
@@ -249,13 +251,13 @@
249
251
  display: grid;
250
252
  position: relative;
251
253
  z-index: 3;
252
- grid-template-columns: minmax(0, 1fr) 56px;
254
+ grid-template-columns: minmax(0, 1fr) auto;
253
255
  align-items: center;
254
256
  gap: 16px;
255
257
  box-sizing: border-box;
256
258
  width: 100%;
257
259
  height: 100%;
258
- padding: 14px 16px 14px var(--spatial-element-sticky-minimap-reserve, 150px);
260
+ padding: 8px 16px 8px var(--spatial-element-sticky-minimap-reserve, 96px);
259
261
  opacity: var(--spatial-element-sticky-header-progress, 0);
260
262
  }
261
263
 
@@ -266,7 +268,7 @@
266
268
 
267
269
  .sticky-header-copy {
268
270
  display: grid;
269
- gap: 4px;
271
+ gap: 0;
270
272
  min-width: 0;
271
273
  }
272
274
 
@@ -277,75 +279,45 @@
277
279
  }
278
280
 
279
281
  .sticky-header-kicker {
280
- font-size: 18px;
282
+ overflow: hidden;
283
+ text-overflow: ellipsis;
284
+ white-space: nowrap;
285
+ font-size: 14px;
281
286
  font-weight: 400;
282
- line-height: 1.1;
287
+ line-height: 20px;
283
288
  }
284
289
 
285
290
  .sticky-header-title {
286
291
  overflow: hidden;
287
292
  font-size: 24px;
288
- font-weight: 520;
289
- line-height: 1.15;
293
+ font-weight: 600;
294
+ line-height: 32px;
290
295
  text-overflow: ellipsis;
291
296
  white-space: nowrap;
292
297
  }
293
298
 
294
299
  .sticky-header-action {
300
+ visibility: hidden;
295
301
  display: grid;
296
302
  place-items: center;
297
- width: 56px;
298
- height: 56px;
303
+ width: 40px;
304
+ height: 40px;
299
305
  padding: 0;
300
306
  border: 0;
301
- border-radius: 7px;
307
+ border-radius: var(--spatial-element-control-radius);
302
308
  color: var(--spatial-element-on-accent);
303
309
  background: var(--spatial-element-accent);
304
310
  text-decoration: none;
305
311
  cursor: pointer;
306
312
  }
313
+ .spatial-element-sticky-header:global([data-action-active]) .sticky-header-action { visibility: visible; }
307
314
 
308
- @media (max-width: 1100px) {
309
- .spatial-element-sticky-header {
310
- top: 8px;
311
- left: 8px;
312
- width: calc(100vw - 16px);
313
- height: 72px;
314
- border-radius: min(var(--spatial-element-panel-radius), 14px);
315
- }
316
-
315
+ @media (width < 840px) {
317
316
  .sticky-header-layout {
318
- grid-template-columns: minmax(0, 1fr) 48px;
319
317
  gap: 8px;
320
- padding: 10px 10px 10px var(--spatial-element-sticky-minimap-reserve, 112px);
321
- }
322
-
323
- .sticky-header-copy {
324
- gap: 2px;
325
- }
326
-
327
- .sticky-header-kicker {
328
- font-size: 13px;
329
- }
330
-
331
- .sticky-header-title {
332
- font-size: 17px;
333
- font-weight: 600;
334
- }
335
-
336
- .sticky-header-action {
337
- width: 48px;
338
- height: 48px;
339
- }
340
- }
341
-
342
- @media (max-width: 460px) {
343
- .sticky-header-kicker {
344
- font-size: 12px;
345
- }
346
-
347
- .sticky-header-title {
348
- font-size: 15px;
318
+ padding-right: 8px;
349
319
  }
320
+ .sticky-header-title { font-size: 18px; line-height: 24px; }
321
+ .spatial-element-sticky-tabs { display: none; }
350
322
  }
351
323
  </style>
@@ -1,4 +1,6 @@
1
- import type { SpatialElementData, SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
1
+ import type { ResolvedSpatialElementData as SpatialElementData } from '@spatial-elements/core/spatial-element/spatialElement';
2
+ import './layout.generated.css';
3
+ import type { SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
2
4
  type $$ComponentProps = {
3
5
  activeSectionId?: string;
4
6
  spatialElement: SpatialElementData;