@spatial-elements/sveltekit 1.0.0-beta.7 → 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 (86) 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 +13 -2
  17. package/dist/spatial-element/BrandStageShell.svelte.d.ts +8 -0
  18. package/dist/spatial-element/CarouselSection.svelte +35 -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 +11 -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 +180 -26
  86. package/package.json +2 -2
@@ -2,6 +2,7 @@
2
2
  import { retainListDeviceOrientation } from '@spatial-elements/core/catalog/listDeviceOrientation';
3
3
  import Section from './Section.svelte';
4
4
  import SpatialElementCard from './SpatialElementCard.svelte';
5
+ import type { SpatialCardSize } from '@spatial-elements/core/spatial-element/responsiveLayout';
5
6
  import type {
6
7
  SpatialListItem,
7
8
  SpatialElementSectionDefinition
@@ -11,8 +12,12 @@
11
12
  section: SpatialElementSectionDefinition;
12
13
  /** Project element documents with getSpatialListItems; assets register automatically. */
13
14
  list: SpatialListItem[];
15
+ /** Uniform card size for this list; spans follow the current content grid. */
16
+ cardSize?: SpatialCardSize;
17
+ /** Align both title and optional eyebrow inside the card. */
18
+ textAlign?: 'start' | 'center';
14
19
  }
15
- let { section, list }: Props = $props();
20
+ let { section, list, cardSize = 'm', textAlign = 'start' }: Props = $props();
16
21
  let catalog: HTMLDivElement;
17
22
  $effect(() => {
18
23
  if (catalog)
@@ -21,10 +26,12 @@
21
26
  </script>
22
27
 
23
28
  <Section {section} presentation="list">
24
- <div class="catalog" bind:this={catalog} data-device-orientation="">
29
+ <div class="catalog" bind:this={catalog} data-device-orientation="" data-card-size={cardSize} data-card-text-align={textAlign}>
25
30
  {#each list as spatialElement, index (spatialElement.itemKey ?? spatialElement.id)}
26
31
  <SpatialElementCard
27
32
  {spatialElement}
33
+ {cardSize}
34
+ {textAlign}
28
35
  order={index}
29
36
  occurrence={JSON.stringify([section.id, spatialElement.itemKey ?? spatialElement.id])}
30
37
  />
@@ -35,10 +42,9 @@
35
42
  <style>
36
43
  .catalog {
37
44
  display: grid;
38
- grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
39
- gap: 24px;
45
+ grid-template-columns: repeat(var(--spatial-grid-columns), minmax(0, 1fr));
46
+ gap: var(--spatial-grid-gap);
40
47
  align-items: start;
41
48
  pointer-events: auto;
42
- margin-top: 20px;
43
49
  }
44
50
  </style>
@@ -1,9 +1,14 @@
1
+ import type { SpatialCardSize } from '@spatial-elements/core/spatial-element/responsiveLayout';
1
2
  import type { SpatialListItem, SpatialElementSectionDefinition } from '@spatial-elements/core/spatial-element/types';
2
3
  interface Props {
3
4
  /** Unique page-local anchor, heading and optional CSS appearance overrides. */
4
5
  section: SpatialElementSectionDefinition;
5
6
  /** Project element documents with getSpatialListItems; assets register automatically. */
6
7
  list: SpatialListItem[];
8
+ /** Uniform card size for this list; spans follow the current content grid. */
9
+ cardSize?: SpatialCardSize;
10
+ /** Align both title and optional eyebrow inside the card. */
11
+ textAlign?: 'start' | 'center';
7
12
  }
8
13
  declare const ListSection: import("svelte").Component<Props, {}, "">;
9
14
  type ListSection = ReturnType<typeof ListSection>;
@@ -1,6 +1,8 @@
1
1
  <script lang="ts">
2
2
  import { onMount } from 'svelte';
3
- import { MoveHorizontal, Search, Rotate3D } from 'lucide-svelte';
3
+ import MoveHorizontal from 'lucide-svelte/icons/move-horizontal';
4
+ import Search from 'lucide-svelte/icons/search';
5
+ import Rotate3D from 'lucide-svelte/icons/rotate-3d';
4
6
  import { carouselTextHit } from './carouselTextHit.js';
5
7
  let badge: HTMLDivElement;
6
8
  let action = $state<'move' | 'details' | 'rotate' | undefined>();
@@ -1,5 +1,9 @@
1
1
  <script lang="ts">
2
2
  import { getContext, onDestroy, onMount } from 'svelte';
3
+ import { dev } from '$app/environment';
4
+ import './layout.generated.css';
5
+ import { createSectionBackgroundNormalizer } from '@spatial-elements/core/spatial-element/sectionBackground';
6
+ import { SECTION_SURFACES, type SectionSurfaceRegistry } from '@spatial-elements/core/spatial-element/SectionSurfaceRegistry';
3
7
  import type { Snippet } from 'svelte';
4
8
  import type { HTMLAttributes } from 'svelte/elements';
5
9
  import { getSpatialElementSectionStyle } from '@spatial-elements/core/spatial-element/spatialElement';
@@ -29,6 +33,16 @@
29
33
  let sectionElement: HTMLElement;
30
34
 
31
35
  const contentPage = getContext(SECTION_PAGE_KIND) === 'content';
36
+ const normalizeBackground = createSectionBackgroundNormalizer(dev ? (diagnostic) => console.warn(diagnostic.message) : undefined);
37
+ const background = $derived(normalizeBackground(section.background, { pageKind: contentPage ? 'content' : 'detail' }));
38
+ const legacyMaterial = $derived(!section.background && Boolean(section.style &&
39
+ (section.style.tint !== undefined || section.style.tintOpacity !== undefined || section.style.backdropBlur !== undefined)));
40
+ const surface = $derived(legacyMaterial ? { ...background, color: 'standard' as const } : background);
41
+ const surfaces = getContext<SectionSurfaceRegistry | undefined>(SECTION_SURFACES);
42
+ function registerSurface() { return surfaces?.register(surface); }
43
+ const surfaceRegistration = registerSurface();
44
+ onDestroy(() => surfaceRegistration?.unregister());
45
+ $effect(() => surfaceRegistration?.update(surface));
32
46
  const registry = getContext<SpatialElementSectionRegistry>(SPATIAL_ELEMENT_SECTION_REGISTRY_KEY);
33
47
  if (!registry) {
34
48
  throw new Error(
@@ -106,42 +120,55 @@
106
120
  bind:this={sectionElement}
107
121
  {...rest}
108
122
  id={section.id}
109
- class={['content-section', contentPage ? 'content-page-section' : '', className]
123
+ class={['content-section spatial-grid-scope', contentPage ? 'content-page-section' : '', className]
110
124
  .filter(Boolean)
111
125
  .join(' ')}
112
126
  data-stage-dom-content
113
127
  data-spatial-element-tab-target={!contentPage || undefined}
114
128
  data-catalog-transition-dom={contentPage ? 'exit' : undefined}
115
129
  data-section-presentation={presentation}
116
- aria-labelledby={`${section.id}-title`}
130
+ data-section-background={surface.color}
131
+ data-section-background-size={surface.size}
132
+ data-spatial-section-surface={surfaceRegistration?.id}
133
+ aria-labelledby={section.headline ? `${section.id}-title` : undefined}
134
+ aria-label={section.headline ? undefined : section.title}
117
135
  style={getSpatialElementSectionStyle(section.style)}
118
136
  >
119
- <svelte:element this={contentPage ? 'h2' : 'p'} id={`${section.id}-title`} class="section-kicker"
120
- >{section.title}</svelte:element
121
- >
137
+ <span class="section-surface spatial-section-surface" class:legacy-material={legacyMaterial}
138
+ style:background={legacyMaterial ? undefined : background.cssBackground} aria-hidden="true"></span>
139
+ {#if section.headline}
140
+ <h2 id={`${section.id}-title`} class="section-kicker">{section.headline}</h2>
141
+ {/if}
122
142
  {@render children?.()}
123
143
  </section>
124
144
 
125
145
  <style>
126
- .content-section.content-page-section {
127
- margin-top: 24px;
128
- padding: 24px;
129
- }
130
- .content-section[data-section-presentation='list'] {
131
- padding: 0;
132
- background: none;
133
- box-shadow: none;
134
- -webkit-backdrop-filter: none;
135
- backdrop-filter: none;
136
- }
137
146
  .content-section {
147
+ position: relative;
148
+ isolation: isolate;
138
149
  scroll-margin-top: var(--spatial-element-section-scroll-offset, 150px);
139
150
  width: min(var(--spatial-element-section-width, 100%), 100%);
140
151
  box-sizing: border-box;
141
- margin: 42px 0 0;
142
- padding: clamp(30px, 4vw, 56px);
143
- border-radius: 18px;
152
+ margin: 0;
153
+ padding: var(--spatial-grid-gap);
144
154
  color: var(--spatial-element-section-color, var(--spatial-element-ink));
155
+ font-size: var(--spatial-grid-body-size);
156
+ line-height: var(--spatial-grid-body-line-height);
157
+ pointer-events: auto;
158
+ }
159
+ .section-surface {
160
+ position: absolute;
161
+ inset: 0;
162
+ z-index: -1;
163
+ pointer-events: none;
164
+ }
165
+ .content-section[data-section-background-size='full'] .section-surface {
166
+ left: 50%;
167
+ right: auto;
168
+ width: 100vw;
169
+ transform: translateX(-50%);
170
+ }
171
+ .legacy-material {
145
172
  background: color-mix(
146
173
  in srgb,
147
174
  var(--spatial-element-section-tint) var(--spatial-element-section-tint-opacity),
@@ -150,7 +177,6 @@
150
177
  box-shadow: 0 20px 45px rgb(27 55 89 / 0.08);
151
178
  -webkit-backdrop-filter: blur(min(var(--spatial-element-section-backdrop-blur), 18px));
152
179
  backdrop-filter: blur(min(var(--spatial-element-section-backdrop-blur), 18px));
153
- pointer-events: auto;
154
180
  }
155
181
 
156
182
  .content-section[data-spatial-element-section-culling-ready] {
@@ -162,30 +188,15 @@
162
188
  * Do not retain a full-width backdrop-compositing layer for distant sections.
163
189
  * The 240px observer margin recreates it before the section can enter the viewport.
164
190
  */
165
- .content-section[data-spatial-element-section-culled] {
191
+ .content-section[data-spatial-element-section-culled] .section-surface {
166
192
  -webkit-backdrop-filter: none;
167
193
  backdrop-filter: none;
168
194
  }
169
195
 
170
- .content-section:last-child {
171
- margin-bottom: 180px;
172
- }
173
-
174
196
  .section-kicker {
175
- max-width: 780px;
176
- margin: 0;
177
- color: color-mix(in srgb, currentColor 70%, transparent);
178
- font-size: 18px;
179
- font-weight: 720;
180
- line-height: 1.65;
181
- letter-spacing: 0.05em;
182
- text-transform: uppercase;
183
- }
184
-
185
- @media (max-width: 1100px) {
186
- .content-section {
187
- width: 100%;
188
- margin-left: 0;
189
- }
197
+ margin: 0 0 var(--spatial-grid-headline-gap);
198
+ font-size: var(--spatial-grid-headline-size);
199
+ font-weight: 600;
200
+ line-height: var(--spatial-grid-headline-line-height);
190
201
  }
191
202
  </style>
@@ -1,3 +1,4 @@
1
+ import './layout.generated.css';
1
2
  import type { Snippet } from 'svelte';
2
3
  import type { HTMLAttributes } from 'svelte/elements';
3
4
  import type { SpatialElementSectionDefinition } from '@spatial-elements/core/spatial-element/types';
@@ -0,0 +1,34 @@
1
+ <script lang="ts">
2
+ import { onMount, setContext, type Snippet } from 'svelte';
3
+ import { SECTION_SURFACES, SectionSurfaceRegistry } from '@spatial-elements/core/spatial-element/SectionSurfaceRegistry';
4
+ let { children }: { children?: Snippet } = $props();
5
+ const componentId = $props.id();
6
+ const scope = componentId.replace(/[^a-zA-Z0-9_-]/g, '_');
7
+ let host: HTMLDivElement;
8
+ let revision = $state(0);
9
+ const surfaces = new SectionSurfaceRegistry(() => { revision += 1; });
10
+ setContext(SECTION_SURFACES, surfaces);
11
+ onMount(() => {
12
+ const reorder = () => surfaces.order(Array.from(host.querySelectorAll<HTMLElement>('[data-spatial-section-surface]'))
13
+ .filter(element => element.closest('[data-spatial-section-group]') === host)
14
+ .map(element => Number(element.dataset.spatialSectionSurface)));
15
+ const observer = new MutationObserver(reorder);
16
+ observer.observe(host, { childList: true, subtree: true });
17
+ reorder();
18
+ return () => observer.disconnect();
19
+ });
20
+ const rules = $derived.by(() => {
21
+ void revision;
22
+ return surfaces.corners.map(({ id, top, bottom }) =>
23
+ `[data-spatial-section-group="${scope}"] [data-spatial-section-surface="${id}"] {` +
24
+ `--spatial-section-top-radius:${top ? 'var(--spatial-element-panel-radius)' : '0px'};` +
25
+ `--spatial-section-bottom-radius:${bottom ? 'var(--spatial-element-panel-radius)' : '0px'};}`
26
+ ).join('\n');
27
+ });
28
+ </script>
29
+
30
+ <div bind:this={host} data-spatial-section-group={scope} style="display: contents">
31
+ {@render children?.()}
32
+ <!-- Evaluate after children register during SSR; helper DOM cannot split surface groups. -->
33
+ <svelte:element this={'style'}>{rules}</svelte:element>
34
+ </div>
@@ -0,0 +1,7 @@
1
+ import { type Snippet } from 'svelte';
2
+ type $$ComponentProps = {
3
+ children?: Snippet;
4
+ };
5
+ declare const SectionSurfaceGroup: import("svelte").Component<$$ComponentProps, {}, "">;
6
+ type SectionSurfaceGroup = ReturnType<typeof SectionSurfaceGroup>;
7
+ export default SectionSurfaceGroup;
@@ -0,0 +1,378 @@
1
+ <script lang="ts">
2
+ import { getContext } from 'svelte';
3
+ import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
4
+ import { truncatedTitle } from './truncatedTitle.js';
5
+ import { useSpatialTheme } from './brandContext.js';
6
+ import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
7
+ import { spatialLayoutTokens, type SpatialCardSize } from '@spatial-elements/core/spatial-element/responsiveLayout';
8
+ import { createCatalogEndpointAction } from '../catalog/catalogEndpointAction.js';
9
+ import {
10
+ CATALOG_ENDPOINTS,
11
+ type CatalogEndpointRegistry
12
+ } from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
13
+
14
+ import { CATALOG_SECTIONS, type CatalogSections } from '@spatial-elements/core/catalog/CatalogSections';
15
+ import { useCatalogNavigation } from '../catalog/catalogNavigation.js';
16
+ import { catalogViewLink } from '@spatial-elements/core/catalog/catalogViewLink';
17
+ let {
18
+ spatialElement,
19
+ occurrence,
20
+ order = 0,
21
+ cardSize = 'm',
22
+ textAlign = 'start',
23
+ active = true
24
+ }: {
25
+ spatialElement: SpatialListItem;
26
+ occurrence: string;
27
+ order?: number;
28
+ cardSize?: SpatialCardSize;
29
+ textAlign?: 'start' | 'center';
30
+ active?: boolean;
31
+ } = $props();
32
+ const card = $derived(spatialLayoutTokens.cards[cardSize]);
33
+ const hasEyebrow = $derived(cardSize !== 's' && Boolean(spatialElement.eyebrow?.trim()));
34
+ const readTheme = useSpatialTheme();
35
+ const brand = $derived(readTheme());
36
+ const catalogEndpoint = createCatalogEndpointAction();
37
+ const endpoints = getContext<CatalogEndpointRegistry | undefined>(CATALOG_ENDPOINTS);
38
+
39
+ const sections = getContext<CatalogSections | undefined>(CATALOG_SECTIONS);
40
+ const { href, prepare, pending } = useCatalogNavigation();
41
+ const resolve = href;
42
+ let busySpatialElement = $state<string>();
43
+
44
+ $effect(() => {
45
+ const target = pending();
46
+ busySpatialElement = undefined;
47
+ if (!active || !target || new URL(href(spatialElement.href), target).pathname !== target.pathname) return;
48
+ const timer = setTimeout(() => (busySpatialElement = spatialElement.id), 150);
49
+ return () => clearTimeout(timer);
50
+ });
51
+ </script>
52
+
53
+ <a
54
+ use:mouseHover
55
+ use:catalogViewLink={{ spatialElementId: spatialElement.id, targetPresentation: spatialElement.targetPresentation }}
56
+ use:catalogEndpoint={active ? {
57
+ brandId: brand.id,
58
+ spatialElementId: spatialElement.id,
59
+ slot: 'catalog.card',
60
+ occurrence,
61
+ role: 'container'
62
+ } : undefined}
63
+ class="spatial-element-card"
64
+ style:--card-grid-span={cardSize === 'l' ? `var(--spatial-card-large-span, ${card.span})` : card.span}
65
+ style:--card-title-size={`${card.titleSize}px`}
66
+ style:--card-title-weight={card.titleWeight}
67
+ style:--card-eyebrow-size={`${card.eyebrowSize}px`}
68
+ style:--card-eyebrow-weight={card.eyebrowWeight}
69
+ style:--card-line-height={`${card.lineHeight}px`}
70
+ style:--card-text-rows={card.rows}
71
+ style:--card-title-rows={card.rows - (hasEyebrow ? 1 : 0)}
72
+ style:--card-text-inset-inline={`${spatialLayoutTokens.cardTextInset.inline}px`}
73
+ style:--card-text-inset-block={`${spatialLayoutTokens.cardTextInset.block}px`}
74
+ style:--card-text-align={textAlign}
75
+ data-card-size={cardSize}
76
+ href={resolve(spatialElement.href)}
77
+ onpointerenter={() => { if (active) prepare(spatialElement); }}
78
+ onfocus={(event) => {
79
+ if (active && !event.currentTarget.hasAttribute('data-catalog-restoring-focus')) prepare(spatialElement);
80
+ }}
81
+ onpointerdown={() => { if (active) prepare(spatialElement); }}
82
+ onclick={(event) => {
83
+ if (!active) { event.preventDefault(); return; }
84
+ endpoints?.prefer(brand.id, spatialElement.id, occurrence);
85
+ sections?.activate({
86
+ brandId: brand.id,
87
+ spatialElementId: spatialElement.id,
88
+ occurrence,
89
+ slot: 'catalog.card'
90
+ });
91
+ // Touch activation need not focus links natively; record the same history origin as keyboard use.
92
+ event.currentTarget.focus({ preventScroll: true });
93
+ }}
94
+ aria-busy={busySpatialElement === spatialElement.id ? true : undefined}
95
+ data-catalog-card
96
+ data-catalog-order={order}
97
+ data-catalog-occurrence={occurrence}
98
+ data-spatial-element-id={spatialElement.id}
99
+ data-catalog-focus-key={`catalog:${JSON.stringify([brand.id, spatialElement.id, occurrence])}`}
100
+ aria-labelledby={`catalog-spatial-element-${encodeURIComponent(occurrence)}`}
101
+ >
102
+ {#if busySpatialElement === spatialElement.id}
103
+ <span class="catalog-loading" aria-hidden="true"></span>
104
+ {/if}
105
+ <div
106
+ class="spatial-element-card-surface"
107
+ style:--card-panel-tint={typeof brand.panelTheme.tint === 'number'
108
+ ? '#' + brand.panelTheme.tint.toString(16).padStart(6, '0')
109
+ : typeof brand.panelTheme.tint === 'object'
110
+ ? brand.panelTheme.tint.getStyle()
111
+ : (brand.panelTheme.tint ?? '#ffffff')}
112
+ style:--card-panel-tint-opacity={Math.min(
113
+ 1,
114
+ Math.max(0, brand.panelTheme.tintOpacity ?? 0.28)
115
+ ) *
116
+ 100 +
117
+ '%'}
118
+ use:catalogEndpoint={active ? {
119
+ brandId: brand.id,
120
+ spatialElementId: spatialElement.id,
121
+ slot: 'catalog.card',
122
+ occurrence,
123
+ role: 'summary-surface'
124
+ } : undefined}
125
+ data-shared-role="summary-surface"
126
+ data-spatial-element-id={spatialElement.id}
127
+ aria-hidden="true"
128
+ ></div>
129
+ <div
130
+ class="spatial-element-card-geometry"
131
+ use:catalogEndpoint={active ? {
132
+ brandId: brand.id,
133
+ spatialElementId: spatialElement.id,
134
+ slot: 'catalog.card',
135
+ occurrence,
136
+ role: 'geometry'
137
+ } : undefined}
138
+ data-catalog-geometry
139
+ data-catalog-occurrence={occurrence}
140
+ data-spatial-element-id={spatialElement.id}
141
+ data-catalog-slot="catalog.card"
142
+ >
143
+ {#if spatialElement.fallbackImage}
144
+ <img
145
+ class="catalog-poster"
146
+ data-catalog-poster
147
+ loading="lazy"
148
+ decoding="async"
149
+ src={spatialElement.fallbackImage}
150
+ alt={`${brand.name} ${spatialElement.title}`}
151
+ />
152
+ {/if}
153
+ </div>
154
+ <div class="spatial-element-card-copy">
155
+ {#if hasEyebrow}
156
+ <p
157
+ class="spatial-element-card-eyebrow"
158
+ data-shared-role="eyebrow"
159
+ data-spatial-element-id={spatialElement.id}
160
+ use:catalogEndpoint={active ? {
161
+ brandId: brand.id,
162
+ spatialElementId: spatialElement.id,
163
+ slot: 'catalog.card',
164
+ occurrence,
165
+ role: 'eyebrow'
166
+ } : undefined}
167
+ >
168
+ {spatialElement.eyebrow}
169
+ </p>
170
+ {/if}
171
+ <h3
172
+ use:truncatedTitle={spatialElement.title}
173
+ use:catalogEndpoint={active ? {
174
+ brandId: brand.id,
175
+ spatialElementId: spatialElement.id,
176
+ slot: 'catalog.card',
177
+ occurrence,
178
+ role: 'title'
179
+ } : undefined}
180
+ id={`catalog-spatial-element-${encodeURIComponent(occurrence)}`}
181
+ data-shared-role="title"
182
+ data-spatial-element-id={spatialElement.id}
183
+ >
184
+ {spatialElement.title}
185
+ </h3>
186
+ </div>
187
+ </a>
188
+ <span class="catalog-status" role="status">{busySpatialElement ? 'Opening spatialElement…' : ''}</span>
189
+
190
+ <style>
191
+ .spatial-element-card-eyebrow {
192
+ margin: 0;
193
+ color: var(--spatial-element-accent);
194
+ font-size: var(--card-eyebrow-size);
195
+ font-weight: var(--card-eyebrow-weight);
196
+ line-height: var(--card-line-height);
197
+ flex: 0 0 var(--card-line-height);
198
+ min-width: 0;
199
+ overflow: hidden;
200
+ white-space: nowrap;
201
+ text-overflow: ellipsis;
202
+ transform: translateZ(var(--card-eyebrow-depth, 0px));
203
+ }
204
+ .catalog-loading {
205
+ position: absolute;
206
+ right: 14px;
207
+ top: 14px;
208
+ width: 18px;
209
+ height: 18px;
210
+ border: 2px solid color-mix(in srgb, var(--spatial-element-accent) 20%, transparent);
211
+ border-top-color: var(--spatial-element-accent);
212
+ border-radius: 50%;
213
+ animation: catalog-loading-spin 0.8s linear infinite;
214
+ }
215
+ .catalog-status {
216
+ position: absolute;
217
+ width: 1px;
218
+ height: 1px;
219
+ overflow: hidden;
220
+ clip-path: inset(50%);
221
+ }
222
+ @keyframes catalog-loading-spin {
223
+ to {
224
+ transform: rotate(360deg);
225
+ }
226
+ }
227
+
228
+ .spatial-element-card {
229
+ position: relative;
230
+ display: grid;
231
+ width: 100%;
232
+ height: 100%;
233
+ grid-template-columns: minmax(0, 1fr);
234
+ grid-template-rows: minmax(0, 1fr) min(100%, max(25%, calc(var(--card-text-rows) * var(--card-line-height) + 2 * var(--card-text-inset-block))));
235
+ aspect-ratio: 1;
236
+ box-sizing: border-box;
237
+ min-width: 0;
238
+ min-height: 0;
239
+ border-radius: var(--spatial-element-control-radius, var(--spatial-element-panel-radius));
240
+ color: var(--spatial-element-ink);
241
+ text-decoration: none;
242
+ transform-origin: center;
243
+ transform-style: preserve-3d;
244
+ transform: perspective(1000px) translate3d(0, var(--catalog-lift, 0px), 0)
245
+ rotateX(var(--catalog-rotate-x, 0deg)) rotateY(var(--catalog-rotate-y, 0deg));
246
+ }
247
+
248
+ .spatial-element-card:focus-visible {
249
+ outline: 3px solid var(--spatial-element-accent);
250
+ outline-offset: 5px;
251
+ }
252
+
253
+ .spatial-element-card-surface {
254
+ position: absolute;
255
+ inset: 0;
256
+ z-index: -1;
257
+ border: 1px solid color-mix(in srgb, var(--spatial-element-ink) 12%, transparent);
258
+ border-radius: inherit;
259
+ background: color-mix(
260
+ in srgb,
261
+ var(--card-panel-tint) var(--card-panel-tint-opacity),
262
+ transparent
263
+ );
264
+ box-shadow: 0 12px 32px rgb(0 0 0 / 0.06);
265
+ transition: border-color 180ms ease;
266
+ pointer-events: none;
267
+ }
268
+ .spatial-element-card:global([data-mouse-hover]) .spatial-element-card-surface,
269
+ .spatial-element-card:focus-visible .spatial-element-card-surface {
270
+ border-color: var(--spatial-element-accent);
271
+ }
272
+ .spatial-element-card-surface::after {
273
+ content: '';
274
+ position: absolute;
275
+ inset: -1px;
276
+ border-radius: inherit;
277
+ box-shadow: 0 0 0 1px color-mix(in srgb, var(--spatial-element-accent) 25%, transparent),
278
+ 0 0 18px color-mix(in srgb, var(--spatial-element-accent) 18%, transparent);
279
+ opacity: 0;
280
+ transition: opacity 180ms ease;
281
+ }
282
+ .spatial-element-card:global([data-mouse-hover]) .spatial-element-card-surface::after,
283
+ .spatial-element-card:focus-visible .spatial-element-card-surface::after {
284
+ opacity: 1;
285
+ }
286
+ .spatial-element-card-surface:global([data-spatial-card-appearance-frozen])::after {
287
+ opacity: var(--spatial-card-frozen-after-opacity) !important;
288
+ transition-property: none !important;
289
+ }
290
+
291
+ .spatial-element-card-geometry {
292
+ position: relative;
293
+ grid-area: 1 / 1;
294
+ justify-self: center;
295
+ align-self: center;
296
+ transform-style: preserve-3d;
297
+ height: 100%;
298
+ width: auto;
299
+ max-width: 100%;
300
+ min-height: 0;
301
+ aspect-ratio: 4 / 3;
302
+ pointer-events: none;
303
+ }
304
+
305
+ .catalog-poster {
306
+ display: block;
307
+ width: 100%;
308
+ height: 100%;
309
+ object-fit: contain;
310
+ transform: translateZ(var(--card-model-depth, 0px)) scale(var(--card-model-scale, 1));
311
+ transition: transform 260ms cubic-bezier(0.22, 0.75, 0.25, 1), opacity 240ms ease;
312
+ }
313
+
314
+ .spatial-element-card:global([data-catalog-model-ready]) .catalog-poster {
315
+ opacity: 0;
316
+ }
317
+ :global([data-spatial-presentation-model-ready]) .catalog-poster {
318
+ opacity: 0;
319
+ }
320
+
321
+ .spatial-element-card-copy {
322
+ position: relative;
323
+ grid-area: 2 / 1;
324
+ display: flex;
325
+ flex-direction: column;
326
+ justify-content: center;
327
+ min-width: 0;
328
+ min-height: 0;
329
+ box-sizing: border-box;
330
+ padding: var(--card-text-inset-block) var(--card-text-inset-inline);
331
+ text-align: var(--card-text-align);
332
+ transform-style: preserve-3d;
333
+ }
334
+
335
+ .spatial-element-card-eyebrow,
336
+ h3 {
337
+ text-shadow: var(--card-text-shadow, 0 0 0 transparent);
338
+ transition: transform 260ms cubic-bezier(0.22, 0.75, 0.25, 1),
339
+ text-shadow 260ms cubic-bezier(0.22, 0.75, 0.25, 1);
340
+ }
341
+
342
+ .spatial-element-card:global([data-mouse-hover]),
343
+ .spatial-element-card:focus-visible {
344
+ --card-eyebrow-depth: 40px;
345
+ --card-title-depth: 64px;
346
+ --card-model-depth: 96px;
347
+ --card-model-scale: 1.12;
348
+ --card-text-shadow: 0 4px 10px rgb(0 0 0 / 0.16);
349
+ }
350
+
351
+ h3 {
352
+ display: -webkit-box;
353
+ -webkit-box-orient: vertical;
354
+ -webkit-line-clamp: var(--card-title-rows);
355
+ line-clamp: var(--card-title-rows);
356
+ max-height: calc(var(--card-title-rows) * var(--card-line-height));
357
+ flex-shrink: 0;
358
+ overflow: hidden;
359
+ text-overflow: ellipsis;
360
+ overflow-wrap: anywhere;
361
+ margin: 0;
362
+ font-size: var(--card-title-size);
363
+ font-weight: var(--card-title-weight);
364
+ line-height: var(--card-line-height);
365
+ transform: translateZ(var(--card-title-depth, 0px));
366
+ }
367
+
368
+ @media (prefers-reduced-motion: reduce) {
369
+ .spatial-element-card,
370
+ .spatial-element-card-eyebrow,
371
+ .catalog-poster,
372
+ h3 {
373
+ transform: none;
374
+ transition: none;
375
+ text-shadow: none;
376
+ }
377
+ }
378
+ </style>
@@ -0,0 +1,13 @@
1
+ import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
2
+ import { type SpatialCardSize } from '@spatial-elements/core/spatial-element/responsiveLayout';
3
+ type $$ComponentProps = {
4
+ spatialElement: SpatialListItem;
5
+ occurrence: string;
6
+ order?: number;
7
+ cardSize?: SpatialCardSize;
8
+ textAlign?: 'start' | 'center';
9
+ active?: boolean;
10
+ };
11
+ declare const SpatialCardPresentation: import("svelte").Component<$$ComponentProps, {}, "">;
12
+ type SpatialCardPresentation = ReturnType<typeof SpatialCardPresentation>;
13
+ export default SpatialCardPresentation;