@spatial-elements/sveltekit 1.0.0-beta.6 → 1.0.0-beta.8

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 (87) hide show
  1. package/dist/catalog/ScrollNavigationBridge.svelte +170 -45
  2. package/dist/catalog/ScrollNavigationBridge.svelte.d.ts +9 -2
  3. package/dist/catalog/catalogSummaryTransfer.d.ts +16 -0
  4. package/dist/catalog/catalogSummaryTransfer.js +79 -0
  5. package/dist/catalog/catalogTransition.css +46 -3
  6. package/dist/catalog/interruptedPresentation.d.ts +10 -0
  7. package/dist/catalog/interruptedPresentation.js +29 -0
  8. package/dist/catalog/presentationCleanup.d.ts +4 -0
  9. package/dist/catalog/presentationCleanup.js +20 -0
  10. package/dist/catalog/stagedCatalogNavigation.d.ts +44 -0
  11. package/dist/catalog/stagedCatalogNavigation.js +403 -0
  12. package/dist/catalog/stagedDomReveal.d.ts +8 -0
  13. package/dist/catalog/stagedDomReveal.js +76 -0
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.js +1 -0
  16. package/dist/spatial-element/BrandStageShell.svelte +20 -2
  17. package/dist/spatial-element/BrandStageShell.svelte.d.ts +10 -0
  18. package/dist/spatial-element/CarouselSection.svelte +40 -21
  19. package/dist/spatial-element/CarouselSpatialElement.svelte +49 -115
  20. package/dist/spatial-element/ContentBlock.svelte +53 -0
  21. package/dist/spatial-element/ContentBlock.svelte.d.ts +11 -0
  22. package/dist/spatial-element/ContentGrid.svelte +28 -0
  23. package/dist/spatial-element/ContentGrid.svelte.d.ts +10 -0
  24. package/dist/spatial-element/ContentPage.svelte +28 -20
  25. package/dist/spatial-element/ContentPage.svelte.d.ts +3 -0
  26. package/dist/spatial-element/ListSection.svelte +17 -5
  27. package/dist/spatial-element/ListSection.svelte.d.ts +5 -0
  28. package/dist/spatial-element/PointerHint.svelte +3 -1
  29. package/dist/spatial-element/Section.svelte +51 -40
  30. package/dist/spatial-element/Section.svelte.d.ts +1 -0
  31. package/dist/spatial-element/SectionSurfaceGroup.svelte +34 -0
  32. package/dist/spatial-element/SectionSurfaceGroup.svelte.d.ts +7 -0
  33. package/dist/spatial-element/SpatialCardPresentation.svelte +378 -0
  34. package/dist/spatial-element/SpatialCardPresentation.svelte.d.ts +13 -0
  35. package/dist/spatial-element/SpatialCardSlot.svelte +33 -0
  36. package/dist/spatial-element/SpatialCardSlot.svelte.d.ts +8 -0
  37. package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +20 -12
  38. package/dist/spatial-element/SpatialElementBreadcrumbs.svelte.d.ts +1 -0
  39. package/dist/spatial-element/SpatialElementCard.svelte +19 -318
  40. package/dist/spatial-element/SpatialElementCard.svelte.d.ts +3 -0
  41. package/dist/spatial-element/SpatialElementHelp.svelte +21 -15
  42. package/dist/spatial-element/SpatialElementHelp.svelte.d.ts +4 -1
  43. package/dist/spatial-element/SpatialElementMediaRail.svelte +75 -21
  44. package/dist/spatial-element/SpatialElementMediaRail.svelte.d.ts +3 -0
  45. package/dist/spatial-element/SpatialElementNativeMedia.svelte +36 -0
  46. package/dist/spatial-element/SpatialElementNativeMedia.svelte.d.ts +9 -0
  47. package/dist/spatial-element/SpatialElementPage.svelte +127 -68
  48. package/dist/spatial-element/SpatialElementPage.svelte.d.ts +1 -0
  49. package/dist/spatial-element/SpatialElementStickyHeader.svelte +36 -69
  50. package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +1 -0
  51. package/dist/spatial-element/SpatialElementSummaryContent.svelte +14 -11
  52. package/dist/spatial-element/SpatialElementSummaryPanel.svelte +29 -20
  53. package/dist/spatial-element/SpatialElementSummaryPanel.svelte.d.ts +1 -0
  54. package/dist/spatial-element/SpatialElementTabList.svelte +19 -3
  55. package/dist/spatial-element/SpatialElementTabs.svelte +56 -16
  56. package/dist/spatial-element/SpatialElementTabs.svelte.d.ts +1 -0
  57. package/dist/spatial-element/SpatialElementViewToggle.svelte +5 -4
  58. package/dist/spatial-element/SpatialIconButton.svelte +4 -2
  59. package/dist/spatial-element/SpatialNavigationShell.svelte +129 -0
  60. package/dist/spatial-element/SpatialNavigationShell.svelte.d.ts +10 -0
  61. package/dist/spatial-element/SpatialSummaryHost.svelte +19 -0
  62. package/dist/spatial-element/SpatialSummaryHost.svelte.d.ts +9 -0
  63. package/dist/spatial-element/SpatialSummaryRoot.svelte +78 -0
  64. package/dist/spatial-element/SpatialSummaryRoot.svelte.d.ts +8 -0
  65. package/dist/spatial-element/SpatialSummarySlot.svelte +39 -0
  66. package/dist/spatial-element/SpatialSummarySlot.svelte.d.ts +9 -0
  67. package/dist/spatial-element/SpatialViewIcon.svelte +29 -0
  68. package/dist/spatial-element/SpatialViewIcon.svelte.d.ts +6 -0
  69. package/dist/spatial-element/cardAppearanceFreeze.d.ts +5 -0
  70. package/dist/spatial-element/cardAppearanceFreeze.js +72 -0
  71. package/dist/spatial-element/index.d.ts +6 -2
  72. package/dist/spatial-element/index.js +3 -1
  73. package/dist/spatial-element/layout.generated.css +455 -0
  74. package/dist/spatial-element/presentationBoxFreeze.d.ts +8 -0
  75. package/dist/spatial-element/presentationBoxFreeze.js +35 -0
  76. package/dist/spatial-element/spatialPresentationOwner.d.ts +6 -0
  77. package/dist/spatial-element/spatialPresentationOwner.js +2 -0
  78. package/dist/spatial-element/spatialSummary.d.ts +37 -0
  79. package/dist/spatial-element/spatialSummary.js +1 -0
  80. package/dist/spatial-element/spatialSummaryHost.svelte.d.ts +60 -0
  81. package/dist/spatial-element/spatialSummaryHost.svelte.js +233 -0
  82. package/dist/spatial-element/spatialThemeStyle.js +10 -4
  83. package/dist/stage/ButtonGroup.svelte +1 -1
  84. package/dist/stage/Panel.svelte +16 -4
  85. package/dist/stage/Stage.svelte +183 -26
  86. package/dist/stage/Stage.svelte.d.ts +1 -0
  87. package/package.json +2 -2
@@ -1,14 +1,15 @@
1
1
  <script lang="ts">
2
2
  import { getContext, onMount, tick, untrack } from 'svelte';
3
3
  import Section from './Section.svelte';
4
+ import { retainListDeviceOrientation } from '@spatial-elements/core/catalog/listDeviceOrientation';
4
5
  import { carouselTextHit } from './carouselTextHit.js';
5
6
  import CarouselSpatialElement from './CarouselSpatialElement.svelte';
6
- import { CATALOG_POSE_CHANGED, carouselEmphasis, CarouselDragEmphasis, type CarouselEmphasis, type CarouselLayout, type CarouselPresentation } from '@spatial-elements/core/catalog/catalogPose';
7
+ import { CATALOG_POSE_CHANGED, carouselEmphasis, CarouselDragEmphasis, resolveCarouselPoseLayout, type CarouselEmphasis, type CarouselLayout, type CarouselPresentation } from '@spatial-elements/core/catalog/catalogPose';
7
8
  import type { SpatialListItem, SpatialElementSectionDefinition } from '@spatial-elements/core/spatial-element/types';
8
9
  import { CATALOG_SECTIONS, type CatalogSections } from '@spatial-elements/core/catalog/CatalogSections';
9
10
  import { carouselKey, resolveCarouselSelection, stepCarouselSelection } from '@spatial-elements/core/catalog/carouselSelection';
10
11
  import { CarouselDrag, CarouselWheelInput, clampCarouselPhase, sampleCarouselInertia } from '@spatial-elements/core/catalog/carouselMotion';
11
- import { STAGE_CONTEXT_KEY, type StageContext } from '@spatial-elements/core/stage/panelContext';
12
+ import { STAGE_CONTEXT_KEY, STAGE_PANEL_LAYOUT_EVENT, type StageContext } from '@spatial-elements/core/stage/panelContext';
12
13
 
13
14
  let { section, presentation, list, initialItemKey, onselectionchange }: {
14
15
  section: SpatialElementSectionDefinition;
@@ -33,6 +34,9 @@
33
34
  const indicated = $derived(keys[Math.round(clampCarouselPhase(phase, keys.length))]);
34
35
  let announced = $state<string>();
35
36
  let ring: HTMLDivElement;
37
+ $effect(() => {
38
+ if (interactive && ring) return retainListDeviceOrientation(ring, () => {});
39
+ });
36
40
  let layout = $state<CarouselLayout>({ width: 1320, height: 600, left: 60, viewportWidth: 1440 });
37
41
  let frame = 0;
38
42
  let nativeFrame = 0;
@@ -51,8 +55,9 @@
51
55
  }
52
56
  function measureLayout() {
53
57
  if (!ring) return;
54
- const { width, height, left } = ring.getBoundingClientRect();
55
- layout = { width, height, left, viewportWidth: document.documentElement.clientWidth };
58
+ const { width, left } = ring.getBoundingClientRect();
59
+ const metrics = stage?.getLayoutMetrics?.('stable') ?? { width: innerWidth, height: innerHeight, scrollbarWidth: innerWidth - document.documentElement.clientWidth };
60
+ layout = resolveCarouselPoseLayout({ ...metrics, hasHeadline: Boolean(section.headline), hasEyebrow: true }, { width, left });
56
61
  invalidate();
57
62
  }
58
63
  function commit(key: string | undefined) {
@@ -291,6 +296,7 @@
291
296
  window.addEventListener('blur', stop);
292
297
  window.addEventListener('keydown', escape);
293
298
  window.addEventListener('resize', measureLayout);
299
+ window.addEventListener(STAGE_PANEL_LAYOUT_EVENT, measureLayout);
294
300
  document.addEventListener('visibilitychange', hidden);
295
301
  return () => {
296
302
  mounted = false;
@@ -305,6 +311,7 @@
305
311
  window.removeEventListener('blur', stop);
306
312
  window.removeEventListener('keydown', escape);
307
313
  window.removeEventListener('resize', measureLayout);
314
+ window.removeEventListener(STAGE_PANEL_LAYOUT_EVENT, measureLayout);
308
315
  document.removeEventListener('visibilitychange', hidden);
309
316
  };
310
317
  });
@@ -327,6 +334,7 @@
327
334
  class:interactive
328
335
  class:populated={list.length > 0}
329
336
  data-carousel-section={section.id}
337
+ data-device-orientation=""
330
338
  >
331
339
  <!-- svelte-ignore a11y_no_noninteractive_tabindex (The native scroll rail must be keyboard-scrollable without JavaScript.) -->
332
340
  <div
@@ -374,16 +382,24 @@
374
382
  </div>
375
383
  {/if}
376
384
  </div>
377
- {#if interactive && list.length > 1}
385
+ {#if list.length > 0}
378
386
  <div class="controls" role="group" aria-label={`${section.title}: element selection`}>
387
+ {#if list.length > 1}
379
388
  {#each list as spatialElement (carouselKey(spatialElement))}
389
+ {#if interactive}
380
390
  <button
381
391
  onkeydown={keydown}
382
- aria-label={spatialElement.eyebrow}
392
+ aria-label={spatialElement.eyebrow || spatialElement.title}
383
393
  aria-pressed={indicated === carouselKey(spatialElement)}
384
394
  onclick={() => select(carouselKey(spatialElement))}><span aria-hidden="true"></span></button
385
395
  >
396
+ {:else}
397
+ <a href={`#carousel-${section.id}-${list.indexOf(spatialElement)}`} aria-label={spatialElement.eyebrow || spatialElement.title}
398
+ aria-current={selected === carouselKey(spatialElement) ? 'true' : undefined}
399
+ onclick={(event) => { event.preventDefault(); select(carouselKey(spatialElement)); }}><span aria-hidden="true"></span></a>
400
+ {/if}
386
401
  {/each}
402
+ {/if}
387
403
  </div>
388
404
  {/if}
389
405
  {#if interactive}<p class="sr-only" role="status">
@@ -413,7 +429,7 @@
413
429
  .carousel.interactive { pointer-events: none; }
414
430
  .carousel {
415
431
  pointer-events: auto;
416
- margin-top: 24px;
432
+ margin-top: 0;
417
433
  }
418
434
  .ring {
419
435
  container-type: inline-size;
@@ -421,10 +437,12 @@
421
437
  grid-auto-flow: column;
422
438
  grid-auto-columns: 100%;
423
439
  position: relative;
440
+ height: calc(var(--spatial-carousel-title-reserve) + var(--spatial-carousel-fit-height));
424
441
  overflow-x: auto;
442
+ overflow-y: hidden;
425
443
  scroll-snap-type: x mandatory;
426
444
  overscroll-behavior-x: contain;
427
- scrollbar-width: auto;
445
+ scrollbar-width: none;
428
446
  scrollbar-color: var(--spatial-element-accent) transparent;
429
447
  touch-action: manipulation;
430
448
  }
@@ -438,9 +456,9 @@
438
456
  }
439
457
  .carousel-arrows {
440
458
  position: absolute;
441
- left: 12%;
442
- right: 50%;
443
- top: 50%;
459
+ left: var(--spatial-carousel-fit-left);
460
+ width: var(--spatial-carousel-fit-width);
461
+ top: calc(var(--spatial-carousel-title-reserve) + var(--spatial-carousel-fit-height) / 2);
444
462
  transform: translateY(-50%);
445
463
  z-index: 1500;
446
464
  display: flex;
@@ -464,22 +482,23 @@
464
482
  .carousel-arrows button:hover { background: color-mix(in srgb, var(--spatial-element-accent) 12%, transparent); }
465
483
  .carousel-arrows button:focus-visible { outline: 2px solid var(--spatial-element-accent); }
466
484
  .carousel-arrows svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
467
- @container (max-width: 700px) {
468
- .carousel-arrows { left: 0; right: 0; top: 180px; }
469
- }
470
485
  .controls {
471
486
  position: relative;
472
487
  display: flex;
473
488
  justify-content: center;
474
- flex-wrap: wrap;
475
- margin-top: 16px;
489
+ flex-wrap: nowrap;
490
+ height: var(--spatial-carousel-dots-height);
491
+ margin-top: var(--spatial-carousel-dots-gap);
492
+ overflow-x: auto;
493
+ scrollbar-width: none;
476
494
  }
477
- .controls button {
495
+ .controls button, .controls a {
478
496
  pointer-events: auto;
479
497
  display: grid;
480
498
  place-items: center;
481
- width: 44px;
482
- height: 44px;
499
+ flex: 0 0 var(--spatial-carousel-dots-height);
500
+ width: var(--spatial-carousel-dots-height);
501
+ height: var(--spatial-carousel-dots-height);
483
502
  padding: 0;
484
503
  border: 0;
485
504
  background: transparent;
@@ -492,10 +511,10 @@
492
511
  border: 1px solid var(--spatial-element-accent);
493
512
  border-radius: 50%;
494
513
  }
495
- .controls button[aria-pressed='true'] span {
514
+ .controls button[aria-pressed='true'] span, .controls a[aria-current='true'] span {
496
515
  background: var(--spatial-element-accent);
497
516
  }
498
- .controls button:focus-visible {
517
+ .controls button:focus-visible, .controls a:focus-visible {
499
518
  outline: 2px solid var(--spatial-element-accent);
500
519
  outline-offset: -4px;
501
520
  }
@@ -1,5 +1,8 @@
1
1
  <script lang="ts">
2
- import SpatialElementSummaryContent from './SpatialElementSummaryContent.svelte';
2
+ import { catalogViewLink } from '@spatial-elements/core/catalog/catalogViewLink';
3
+ import { focusCatalogLink } from '@spatial-elements/core/catalog/catalogActivationFocus';
4
+ import { resolveSpatialThemeRadii } from '@spatial-elements/core/spatial-element/spatialTheme';
5
+ import SpatialSummarySlot from './SpatialSummarySlot.svelte';
3
6
  import { getContext } from 'svelte';
4
7
  import { getCssPanelBoxShadow } from '@spatial-elements/core/stage/panelShadow';
5
8
  import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
@@ -53,6 +56,7 @@
53
56
  const sections = getContext<CatalogSections | undefined>(CATALOG_SECTIONS);
54
57
  const readTheme = useSpatialTheme();
55
58
  const brand = $derived(readTheme());
59
+ const radii = $derived(resolveSpatialThemeRadii(brand));
56
60
  const contentInset = $derived(brand.panelShape.contentInset ?? Math.max(16, Math.round(brand.panelShape.radius * 0.7)));
57
61
  const catalogEndpoint = createCatalogEndpointAction();
58
62
  function address(role: CatalogEndpointRole) {
@@ -82,6 +86,8 @@
82
86
  const occurrence = $derived(JSON.stringify([sectionId, carouselKey(spatialElement)]));
83
87
  const tooltip = $derived(spatialElement.title);
84
88
  const pose = $derived(carouselPose(index, phase, count, presentation, layout, emphasis, focus));
89
+ const compact = $derived(layout.framing?.compact ?? false);
90
+ const modelFrameSize = $derived(layout.framing ? Math.min(layout.framing.fit.width, layout.framing.fit.height) : Math.min(layout.width, layout.height));
85
91
  const resident = $derived(carouselResident(index, windowPhase, count, presentation, layout));
86
92
  function activate(event: MouseEvent) {
87
93
  endpoints?.prefer(brand.id, spatialElement.id, occurrence, 'carousel.front');
@@ -91,7 +97,7 @@
91
97
  occurrence,
92
98
  slot: 'carousel.front'
93
99
  });
94
- (event.currentTarget as HTMLElement).focus({ preventScroll: true });
100
+ focusCatalogLink(event.currentTarget as HTMLAnchorElement, event);
95
101
  }
96
102
  $effect(() => {
97
103
  if (!interactive || !resident) return;
@@ -117,7 +123,7 @@
117
123
  data-carousel-surface={brand.panelTheme.surface ?? 'glass'}
118
124
  data-carousel-theme={JSON.stringify({
119
125
  ...brand.panelTheme,
120
- radius: brand.panelShape.radius,
126
+ radius: radii.panel,
121
127
  tintOpacity: Math.min(brand.panelTheme.tintOpacity ?? 0.28, 0.72)
122
128
  })}
123
129
  data-catalog-occurrence={occurrence}
@@ -129,11 +135,13 @@
129
135
  data-spatial-element-id={spatialElement.id}
130
136
  data-catalog-occurrence={occurrence}
131
137
  style={interactive
132
- ? `--carousel-poster-x:${(pose.x - 0.19) * 100}%;--carousel-poster-mobile-x:${pose.x * 100}%;--carousel-poster-y:${pose.y * 100}%;--carousel-poster-size:${pose.size};--carousel-poster-opacity:${pose.opacity}`
138
+ ? `--carousel-poster-x:${pose.x * 100}%;--carousel-poster-y:${pose.y * 100}%;--carousel-poster-width:${pose.size * modelFrameSize}px;--carousel-poster-opacity:${pose.opacity}`
133
139
  : undefined}
134
140
  >
141
+ <div data-carousel-fit-anchor aria-hidden="true"></div>
135
142
  <a
136
143
  use:mouseHover
144
+ use:catalogViewLink={{ spatialElementId: spatialElement.id, targetPresentation: spatialElement.targetPresentation }}
137
145
  draggable="false"
138
146
  class="spatial-element-target"
139
147
  title={tooltip}
@@ -175,6 +183,7 @@
175
183
  </div>
176
184
  <div
177
185
  class="summary"
186
+ class:has-eyebrow={Boolean(spatialElement.eyebrow)}
178
187
  style:--summary-content-inset={`${contentInset}px`}
179
188
  hidden={interactive && pose.panelOpacity < 0.001}
180
189
  inert={interactive && !selected}
@@ -192,49 +201,25 @@
192
201
  '%'}
193
202
  style:--carousel-panel-blur={(brand.panelTheme.backdropBlur ?? 5) + 'px'}
194
203
  style:--carousel-focus-blur={interactive && pose.panelOpacity < 1 ? `blur(${(1 - pose.panelOpacity) * 6}px)` : 'none'}
195
- style:--carousel-panel-radius={brand.panelShape.radius + 'px'}
204
+ style:--carousel-panel-radius={radii.panel + 'px'}
196
205
  use:catalogEndpoint={address('summary-surface')}
197
206
  >
198
- <SpatialElementSummaryContent {address} {contentInset} spatialElement={{
199
- id: spatialElement.id, eyebrow: spatialElement.eyebrow, title: spatialElement.title,
200
- features: spatialElement.summary?.features ?? spatialElement.features.map((label) => ({ label })),
201
- action: spatialElement.summary?.action
202
- }} />
203
- <div class="information-links">
204
- <a
205
- data-catalog-focus-key={`catalog:${JSON.stringify([brand.id, spatialElement.id, occurrence, 'carousel.front'])}`}
206
- aria-busy={busy || undefined}
207
- onclick={activate}
208
- class="information"
209
- href={href(spatialElement.href)}
210
- onpointerenter={() => prepare(spatialElement)}
211
- onfocus={() => prepare(spatialElement)}
212
- onpointerdown={() => prepare(spatialElement)}
213
- >More information<span class="sr-only">: {spatialElement.title}</span></a
214
- >
215
- {#if spatialElement.summary?.sectionLink}
216
- <a
217
- class="information"
218
- href={href(spatialElement.summary.sectionLink.href)}
219
- onclick={activate}
220
- data-catalog-focus-key={`catalog-section:${occurrence}`}
221
- >{spatialElement.summary.sectionLink.label}</a
222
- >
223
- {/if}
224
- </div>
207
+ <SpatialSummarySlot instanceKey={`carousel:${brand.id}:${occurrence}`}
208
+ context={{ spatialElement: { id: spatialElement.id, brandId: brand.id, eyebrow: spatialElement.eyebrow, title: spatialElement.title,
209
+ features: spatialElement.summary?.features ?? spatialElement.features.map((label) => ({ label })), action: spatialElement.summary?.action },
210
+ contentInset, heading: 'h3', mode: 'carousel', address,
211
+ carousel: { item: spatialElement, occurrence, compact } }} />
225
212
  </div>
226
213
  </article>
227
214
 
228
215
  <style>
229
216
  .carousel-spatial-element {
230
- display: grid;
231
- grid-template-columns: minmax(0, 1fr);
232
- grid-template-rows: 1fr;
233
- align-items: center;
217
+ display: block;
234
218
  position: relative;
235
219
  min-width: 0;
236
- min-height: 600px;
237
- padding: 32px 0 64px;
220
+ height: calc(var(--spatial-carousel-title-reserve) + var(--spatial-carousel-fit-height));
221
+ min-height: 0;
222
+ padding: 0;
238
223
  box-sizing: border-box;
239
224
  scroll-snap-align: start;
240
225
  scroll-snap-stop: always;
@@ -247,7 +232,7 @@
247
232
  .spatial-element-visual {
248
233
  position: absolute;
249
234
  inset: 0;
250
- display: grid;
235
+ display: block;
251
236
  place-items: center;
252
237
  touch-action: manipulation;
253
238
  }
@@ -264,13 +249,20 @@
264
249
  z-index: 1400;
265
250
  transform-origin: 0 0;
266
251
  }
252
+ /* Keep only the selected source's compositing layers ready before navigation.
253
+ * Promoting its rounded/frosted surface at the click can compile a new browser
254
+ * raster shader during motion even when all WebGPU passes are already warm. */
255
+ .interactive.selected .summary,
256
+ .interactive.selected .summary :global(.spatial-summary-island) {
257
+ will-change: transform;
258
+ }
267
259
  .spatial-element-target,
268
260
  .spatial-element-poster {
269
261
  position: absolute;
270
- left: var(--carousel-poster-x, 31%);
271
- top: var(--carousel-poster-y, 50%);
272
- width: calc(var(--carousel-poster-size, 0.82) * 100cqw);
273
- max-width: calc(var(--carousel-poster-size, 0.82) * 560px);
262
+ left: var(--carousel-poster-x, calc(var(--spatial-carousel-fit-left) + var(--spatial-carousel-fit-width) / 2));
263
+ top: var(--carousel-poster-y, calc(var(--spatial-carousel-title-reserve) + var(--spatial-carousel-fit-height) / 2));
264
+ width: var(--carousel-poster-width, calc(min(var(--spatial-carousel-fit-width), var(--spatial-carousel-fit-height)) * 0.82));
265
+ max-width: none;
274
266
  transform: translate(-50%, -50%);
275
267
  aspect-ratio: 1;
276
268
  }
@@ -291,7 +283,7 @@
291
283
  .spatial-element-target:focus-visible {
292
284
  outline: 2px solid var(--spatial-element-accent);
293
285
  outline-offset: 4px;
294
- border-radius: 12px;
286
+ border-radius: var(--spatial-element-control-radius);
295
287
  }
296
288
  /* Enhanced geometry already has a silhouette focus outline in the renderer. */
297
289
  .interactive:global([data-catalog-model-ready]) .spatial-element-target:focus-visible {
@@ -317,89 +309,31 @@
317
309
  transition: filter 180ms ease;
318
310
  }
319
311
  .summary {
320
- position: relative;
321
- width: min(494px, 100%);
322
- min-height: 504px;
323
- margin-left: 50%;
312
+ position: absolute;
313
+ left: var(--spatial-carousel-summary-left);
314
+ top: calc(var(--spatial-carousel-title-reserve) - var(--spatial-carousel-compact-height));
315
+ width: var(--spatial-carousel-summary-width);
316
+ height: var(--spatial-carousel-compact-height);
317
+ min-height: 0;
318
+ margin: 0;
319
+ --spatial-carousel-compact-height: 40px;
324
320
  box-sizing: border-box;
325
321
  filter: var(--carousel-focus-blur, none);
326
322
 
327
323
  border-radius: var(--carousel-panel-radius, 14px);
328
- padding: var(--summary-content-inset);
324
+ padding: 0;
329
325
 
330
326
  color: color-mix(in srgb, var(--spatial-element-ink) 92%, transparent);
331
327
  pointer-events: auto;
332
328
  }
333
- .summary::before {
334
- content: '';
335
- position: absolute;
336
- inset: 0;
337
- border-radius: inherit;
338
- background: color-mix(
339
- in srgb,
340
- var(--carousel-panel-tint, white) var(--carousel-panel-tint-opacity, 65%),
341
- transparent
342
- );
343
- border: 1px solid color-mix(in srgb, var(--spatial-element-accent) 12%, transparent);
344
- backdrop-filter: blur(var(--carousel-panel-blur, 5px));
345
- box-shadow: var(--carousel-panel-shadow);
346
- opacity: var(--carousel-panel-opacity, 1);
347
- pointer-events: none;
348
- }
349
- .summary > :global(*) {
350
- position: relative;
351
- opacity: var(--carousel-panel-opacity, 1);
352
- }
353
- :global([data-carousel-glass-ready]) .summary::before {
354
- visibility: hidden;
355
- }
356
329
  .summary[hidden] {
357
330
  display: block;
358
331
  visibility: hidden;
359
332
  }
360
- .summary > .information-links {
361
- position: absolute;
362
- top: 100%;
363
- left: 0;
364
- width: 100%;
365
- display: flex;
366
- flex-wrap: wrap;
367
- gap: 0 16px;
368
- }
369
- .information {
370
- display: inline-block;
371
- margin-top: 20px;
372
- color: var(--spatial-element-accent);
373
- }
374
- .information[aria-busy='true'] {
375
- opacity: 0.55;
376
- cursor: progress;
377
- }
378
- .sr-only {
379
- position: absolute;
380
- width: 1px;
381
- height: 1px;
382
- padding: 0;
383
- margin: -1px;
384
- overflow: hidden;
385
- clip-path: inset(50%);
386
- white-space: nowrap;
387
- }
388
- @container (max-width: 700px) {
389
- .carousel-spatial-element {
390
- min-height: 0;
391
- padding: 360px 0 80px;
392
- align-items: start;
393
- }
394
- .summary {
395
- margin-inline: auto;
396
- }
397
- .spatial-element-target,
398
- .spatial-element-poster {
399
- left: var(--carousel-poster-mobile-x, 50%);
400
- top: 180px;
401
- max-width: calc(var(--carousel-poster-size, 0.82) * 360px);
402
- }
333
+ .has-eyebrow { --spatial-carousel-compact-height: 66px; }
334
+ [data-carousel-fit-anchor] { position: absolute; left: var(--spatial-carousel-fit-left); top: var(--spatial-carousel-title-reserve); width: var(--spatial-carousel-fit-width); height: var(--spatial-carousel-fit-height); pointer-events: none; }
335
+ @media (min-width: 840px) {
336
+ .summary { top: calc(var(--spatial-carousel-fit-height) / 2); height: auto; max-height: var(--spatial-carousel-fit-height); padding: 0; transform: translateY(-50%); }
403
337
  }
404
338
  @media (prefers-reduced-motion: reduce) {
405
339
  img { transition: none; }
@@ -0,0 +1,53 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { HTMLAttributes } from 'svelte/elements';
4
+ import { dev } from '$app/environment';
5
+ import {
6
+ contentGridSizes,
7
+ resolveContentSpan,
8
+ spatialLayoutTokens,
9
+ type ContentSpan
10
+ } from '@spatial-elements/core/spatial-element/responsiveLayout';
11
+
12
+ type Props = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
13
+ /** Column count, or mobile-first counts by content grid size. Omitted values fill the row. */
14
+ span?: ContentSpan;
15
+ children?: Snippet;
16
+ };
17
+ let { span, children, class: className = '', ...rest }: Props = $props();
18
+ const warned = new Set<string>();
19
+ $effect(() => {
20
+ if (!dev || span === undefined) return;
21
+ let requested: number | undefined = typeof span === 'number' ? span : undefined;
22
+ for (const grid of contentGridSizes) {
23
+ if (typeof span === 'object' && span[grid] !== undefined) requested = span[grid];
24
+ if (requested === undefined) continue;
25
+ const columns = spatialLayoutTokens.grid[grid].columns;
26
+ if (Number.isInteger(requested) && requested > 0 && requested <= columns) continue;
27
+ const message = `ContentBlock span ${requested} resolves to ${resolveContentSpan(span, grid)} columns in grid ${grid}. Use a positive integer no greater than ${columns}.`;
28
+ if (!warned.has(message)) {
29
+ warned.add(message);
30
+ console.warn(message);
31
+ }
32
+ }
33
+ });
34
+ </script>
35
+
36
+ <div
37
+ {...rest}
38
+ class={['spatial-content-block', className].filter(Boolean).join(' ')}
39
+ style:--spatial-content-block-span-xs={resolveContentSpan(span, 'xs')}
40
+ style:--spatial-content-block-span-s={resolveContentSpan(span, 's')}
41
+ style:--spatial-content-block-span-m={resolveContentSpan(span, 'm')}
42
+ style:--spatial-content-block-span-l={resolveContentSpan(span, 'l')}
43
+ >
44
+ {@render children?.()}
45
+ </div>
46
+
47
+ <style>
48
+ .spatial-content-block {
49
+ grid-column: span var(--spatial-content-block-span);
50
+ min-width: 0;
51
+ overflow-wrap: anywhere;
52
+ }
53
+ </style>
@@ -0,0 +1,11 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import { type ContentSpan } from '@spatial-elements/core/spatial-element/responsiveLayout';
4
+ type Props = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
5
+ /** Column count, or mobile-first counts by content grid size. Omitted values fill the row. */
6
+ span?: ContentSpan;
7
+ children?: Snippet;
8
+ };
9
+ declare const ContentBlock: import("svelte").Component<Props, {}, "">;
10
+ type ContentBlock = ReturnType<typeof ContentBlock>;
11
+ export default ContentBlock;
@@ -0,0 +1,28 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { HTMLAttributes } from 'svelte/elements';
4
+ import './layout.generated.css';
5
+
6
+ type Props = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
7
+ /** Explicit ContentBlock children; the enclosing Section owns the grid's outer padding. */
8
+ children?: Snippet;
9
+ };
10
+ let { children, class: className = '', ...rest }: Props = $props();
11
+ </script>
12
+
13
+ <div {...rest} class={['spatial-content-grid', 'spatial-grid-scope', className].filter(Boolean).join(' ')}>
14
+ {@render children?.()}
15
+ </div>
16
+
17
+ <style>
18
+ .spatial-content-grid {
19
+ display: grid;
20
+ grid-template-columns: repeat(var(--spatial-grid-columns), minmax(0, 1fr));
21
+ grid-auto-flow: row;
22
+ gap: var(--spatial-grid-gap);
23
+ min-width: 0;
24
+ align-items: start;
25
+ font-size: var(--spatial-grid-body-size);
26
+ line-height: var(--spatial-grid-body-line-height);
27
+ }
28
+ </style>
@@ -0,0 +1,10 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import './layout.generated.css';
4
+ type Props = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
5
+ /** Explicit ContentBlock children; the enclosing Section owns the grid's outer padding. */
6
+ children?: Snippet;
7
+ };
8
+ declare const ContentGrid: import("svelte").Component<Props, {}, "">;
9
+ type ContentGrid = ReturnType<typeof ContentGrid>;
10
+ export default ContentGrid;
@@ -5,6 +5,8 @@
5
5
  import { useSpatialTheme } from './brandContext.js';
6
6
  import SpatialElementBreadcrumbs from './SpatialElementBreadcrumbs.svelte';
7
7
  import { registerSpatialPage } from './spatialPageContext.js';
8
+ import SectionSurfaceGroup from './SectionSurfaceGroup.svelte';
9
+ import './layout.generated.css';
8
10
  import {
9
11
  SPATIAL_ELEMENT_SECTION_REGISTRY_KEY,
10
12
  SpatialElementSectionRegistry,
@@ -15,40 +17,50 @@
15
17
  hdr: string;
16
18
  /** Category metadata. Only title is required; pageTitle defaults to title. */
17
19
  page: ContentPageData;
20
+ /** Flat page color override, using the same color format as SpatialTheme.background. */
21
+ background?: string;
18
22
  /** ListSection, CarouselSection and ordinary Section children. */
19
23
  children?: Snippet;
20
24
  }
21
- let { page, hdr, children }: Props = $props();
25
+ let { page, hdr, background, children }: Props = $props();
26
+ const backgroundId = $props.id();
27
+ const backgroundScope = backgroundId.replace(/[^a-zA-Z0-9_-]/g, '_');
28
+ const backgroundRules = $derived.by(() => {
29
+ if (!background) return '';
30
+ if (/[;{}<>]/.test(background)) throw new Error('ContentPage.background must be a color value.');
31
+ // A child page cannot inherit a custom property upwards. This page-scoped rule
32
+ // supplies the native SSR surface before the browser registers GPU ownership.
33
+ return `.stage:has([data-spatial-page-background="${backgroundScope}"]) { --stage-page-background: ${background} !important; }`;
34
+ });
22
35
  const readTheme = useSpatialTheme();
23
36
  const brand = $derived(readTheme());
24
- registerSpatialPage(() => ({ kind: 'content', hdr }));
37
+ registerSpatialPage(() => ({ kind: 'content', hdr, background }));
25
38
  setContext(SPATIAL_ELEMENT_SECTION_REGISTRY_KEY, new SpatialElementSectionRegistry());
26
39
  setContext(SECTION_PAGE_KIND, 'content');
27
40
  </script>
28
41
 
29
42
  <svelte:head><title>{page.pageTitle ?? page.title}</title></svelte:head>
30
- <main class="content-page" data-catalog-list data-brand-id={brand.id}>
43
+ <main class="content-page spatial-content-width spatial-content-container" data-catalog-list data-brand-id={brand.id}
44
+ data-spatial-page-background={background ? backgroundScope : undefined}>
45
+ {#if background}<svelte:element this={'style'}>{backgroundRules}</svelte:element>{/if}
31
46
  {#if page.breadcrumbs?.length}<SpatialElementBreadcrumbs
32
47
  items={page.breadcrumbs}
33
48
  transition="exit"
34
49
  />{/if}
35
- <header data-stage-dom-content data-catalog-transition-dom="exit">
50
+ <header class="spatial-grid-scope" data-stage-dom-content data-catalog-transition-dom="exit">
36
51
  {#if page.eyebrow}<p class="eyebrow">{page.eyebrow}</p>{/if}
37
52
  <h1 id="catalog-title" tabindex="-1">{page.title}</h1>
38
53
  {#if page.intro}<p class="intro">{page.intro}</p>{/if}
39
54
  </header>
40
- {@render children?.()}
55
+ <SectionSurfaceGroup>{@render children?.()}</SectionSurfaceGroup>
41
56
  </main>
42
57
 
43
58
  <style>
44
59
  .content-page {
45
- width: min(1500px, calc(100vw - 120px));
46
- margin: 0 auto;
47
60
  padding-bottom: 120px;
48
61
  }
49
62
  header {
50
- max-width: 780px;
51
- padding: 12px 0 32px;
63
+ padding: var(--spatial-grid-gap);
52
64
  pointer-events: auto;
53
65
  }
54
66
  .eyebrow {
@@ -59,21 +71,17 @@
59
71
  text-transform: uppercase;
60
72
  }
61
73
  h1 {
62
- margin: 10px 0 14px;
74
+ margin: 0;
63
75
  color: var(--spatial-element-ink);
64
- font-size: clamp(30px, 3.4vw, 46px);
65
- line-height: 1.1;
76
+ font-size: var(--spatial-grid-headline-size);
77
+ font-weight: 600;
78
+ line-height: var(--spatial-grid-headline-line-height);
66
79
  }
67
80
  .intro {
68
81
  max-width: 64ch;
69
- margin: 0;
82
+ margin: var(--spatial-grid-headline-gap) 0 0;
70
83
  color: var(--spatial-element-body);
71
- font-size: 17px;
72
- line-height: 1.6;
73
- }
74
- @media (max-width: 900px) {
75
- .content-page {
76
- width: calc(100vw - 40px);
77
- }
84
+ font-size: var(--spatial-grid-body-size);
85
+ line-height: var(--spatial-grid-body-line-height);
78
86
  }
79
87
  </style>
@@ -1,10 +1,13 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { ContentPageData } from '@spatial-elements/core/spatial-element/types';
3
+ import './layout.generated.css';
3
4
  interface Props {
4
5
  /** Explicit HDR used to light this page's shared 3D scene; never inferred from an element. */
5
6
  hdr: string;
6
7
  /** Category metadata. Only title is required; pageTitle defaults to title. */
7
8
  page: ContentPageData;
9
+ /** Flat page color override, using the same color format as SpatialTheme.background. */
10
+ background?: string;
8
11
  /** ListSection, CarouselSection and ordinary Section children. */
9
12
  children?: Snippet;
10
13
  }