@spatial-elements/sveltekit 0.1.0-beta.1

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 (52) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +17 -0
  3. package/dist/catalog/ScrollNavigationBridge.svelte +394 -0
  4. package/dist/catalog/ScrollNavigationBridge.svelte.d.ts +13 -0
  5. package/dist/catalog/catalogEndpointAction.d.ts +6 -0
  6. package/dist/catalog/catalogEndpointAction.js +18 -0
  7. package/dist/catalog/catalogNavigation.d.ts +7 -0
  8. package/dist/catalog/catalogNavigation.js +19 -0
  9. package/dist/catalog/catalogTransition.css +59 -0
  10. package/dist/index.d.ts +6 -0
  11. package/dist/index.js +6 -0
  12. package/dist/spatial-element/BrandStageShell.svelte +106 -0
  13. package/dist/spatial-element/BrandStageShell.svelte.d.ts +12 -0
  14. package/dist/spatial-element/CarouselSection.svelte +350 -0
  15. package/dist/spatial-element/CarouselSection.svelte.d.ts +15 -0
  16. package/dist/spatial-element/CarouselSpatialElement.svelte +388 -0
  17. package/dist/spatial-element/CarouselSpatialElement.svelte.d.ts +17 -0
  18. package/dist/spatial-element/ContentPage.svelte +68 -0
  19. package/dist/spatial-element/ContentPage.svelte.d.ts +9 -0
  20. package/dist/spatial-element/ListSection.svelte +30 -0
  21. package/dist/spatial-element/ListSection.svelte.d.ts +8 -0
  22. package/dist/spatial-element/Section.svelte +191 -0
  23. package/dist/spatial-element/Section.svelte.d.ts +14 -0
  24. package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +69 -0
  25. package/dist/spatial-element/SpatialElementBreadcrumbs.svelte.d.ts +8 -0
  26. package/dist/spatial-element/SpatialElementCard.svelte +256 -0
  27. package/dist/spatial-element/SpatialElementCard.svelte.d.ts +9 -0
  28. package/dist/spatial-element/SpatialElementMediaRail.svelte +144 -0
  29. package/dist/spatial-element/SpatialElementMediaRail.svelte.d.ts +7 -0
  30. package/dist/spatial-element/SpatialElementPage.svelte +249 -0
  31. package/dist/spatial-element/SpatialElementPage.svelte.d.ts +9 -0
  32. package/dist/spatial-element/SpatialElementStickyHeader.svelte +351 -0
  33. package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +9 -0
  34. package/dist/spatial-element/SpatialElementSummaryPanel.svelte +423 -0
  35. package/dist/spatial-element/SpatialElementSummaryPanel.svelte.d.ts +7 -0
  36. package/dist/spatial-element/SpatialElementTabList.svelte +266 -0
  37. package/dist/spatial-element/SpatialElementTabList.svelte.d.ts +9 -0
  38. package/dist/spatial-element/SpatialElementTabs.svelte +123 -0
  39. package/dist/spatial-element/SpatialElementTabs.svelte.d.ts +8 -0
  40. package/dist/spatial-element/SpatialListPage.svelte +23 -0
  41. package/dist/spatial-element/SpatialListPage.svelte.d.ts +11 -0
  42. package/dist/spatial-element/brandContext.d.ts +5 -0
  43. package/dist/spatial-element/brandContext.js +14 -0
  44. package/dist/spatial-element/index.d.ts +11 -0
  45. package/dist/spatial-element/index.js +8 -0
  46. package/dist/stage/Panel.svelte +355 -0
  47. package/dist/stage/Panel.svelte.d.ts +24 -0
  48. package/dist/stage/Stage.svelte +747 -0
  49. package/dist/stage/Stage.svelte.d.ts +22 -0
  50. package/dist/stage/StageViewport.svelte +73 -0
  51. package/dist/stage/StageViewport.svelte.d.ts +13 -0
  52. package/package.json +55 -0
@@ -0,0 +1,191 @@
1
+ <script lang="ts">
2
+ import { getContext, onDestroy, onMount } from 'svelte';
3
+ import type { Snippet } from 'svelte';
4
+ import type { HTMLAttributes } from 'svelte/elements';
5
+ import { getSpatialElementSectionStyle } from '@spatial-elements/core/spatial-element/spatialElement';
6
+ import {
7
+ SPATIAL_ELEMENT_SECTION_REGISTRY_KEY,
8
+ SECTION_PAGE_KIND,
9
+ type SpatialElementSectionRegistry
10
+ } from '@spatial-elements/core/spatial-element/spatialElementSectionRegistry';
11
+ import type { SpatialElementSectionDefinition } from '@spatial-elements/core/spatial-element/types';
12
+
13
+ type Props = Omit<HTMLAttributes<HTMLElement>, 'class' | 'id' | 'style'> & {
14
+ /** Metadata used for the section anchor, heading, generated tab, and optional shell styling. */
15
+ section: SpatialElementSectionDefinition;
16
+ /** Arbitrary Svelte content owned by the consuming element route. */
17
+ children?: Snippet;
18
+ class?: string;
19
+ presentation?: 'panel' | 'list';
20
+ };
21
+
22
+ let {
23
+ section,
24
+ children,
25
+ class: className = '',
26
+ presentation = 'panel',
27
+ ...rest
28
+ }: Props = $props();
29
+ let sectionElement: HTMLElement;
30
+
31
+ const contentPage = getContext(SECTION_PAGE_KIND) === 'content';
32
+ const registry = getContext<SpatialElementSectionRegistry>(SPATIAL_ELEMENT_SECTION_REGISTRY_KEY);
33
+ if (!registry) {
34
+ throw new Error(
35
+ 'Section must be rendered inside a ContentPage or SpatialElementPage component.'
36
+ );
37
+ }
38
+
39
+ function registerSection() {
40
+ return registry.register(section);
41
+ }
42
+
43
+ const registration = registerSection();
44
+ onDestroy(registration.unregister);
45
+
46
+ // Keep generated navigation current when a route changes section metadata reactively.
47
+ $effect(() => registration.update(section));
48
+
49
+ onMount(() => {
50
+ // Content-page card endpoints must stay measurable, including restored offscreen lists.
51
+ if (contentPage) return;
52
+ let measurementFrame = 0;
53
+ let observer: IntersectionObserver | undefined;
54
+
55
+ const setNearViewport = (nearViewport: boolean) => {
56
+ sectionElement.toggleAttribute('data-spatial-element-section-near-viewport', nearViewport);
57
+ sectionElement.toggleAttribute('data-spatial-element-section-culled', !nearViewport);
58
+ };
59
+ const measureIntrinsicHeight = () => {
60
+ measurementFrame = 0;
61
+ const style = getComputedStyle(sectionElement);
62
+ const blockChrome =
63
+ (Number.parseFloat(style.paddingTop) || 0) +
64
+ (Number.parseFloat(style.paddingBottom) || 0) +
65
+ (Number.parseFloat(style.borderTopWidth) || 0) +
66
+ (Number.parseFloat(style.borderBottomWidth) || 0);
67
+ // contain-intrinsic-block-size describes the content box. Supplying the
68
+ // measured border-box height would add padding a second time while skipped.
69
+ const intrinsicHeight = Math.max(
70
+ sectionElement.getBoundingClientRect().height - blockChrome,
71
+ 1
72
+ );
73
+ sectionElement.style.setProperty(
74
+ '--spatial-element-section-intrinsic-height',
75
+ `${intrinsicHeight}px`
76
+ );
77
+ sectionElement.setAttribute('data-spatial-element-section-culling-ready', '');
78
+ };
79
+ const prepareMeasurement = () => {
80
+ sectionElement.removeAttribute('data-spatial-element-section-culling-ready');
81
+ if (measurementFrame) cancelAnimationFrame(measurementFrame);
82
+ measurementFrame = requestAnimationFrame(measureIntrinsicHeight);
83
+ };
84
+
85
+ const rect = sectionElement.getBoundingClientRect();
86
+ setNearViewport(rect.bottom >= -240 && rect.top <= window.innerHeight + 240);
87
+ measureIntrinsicHeight();
88
+
89
+ if ('IntersectionObserver' in window) {
90
+ observer = new IntersectionObserver(([entry]) => setNearViewport(entry.isIntersecting), {
91
+ rootMargin: '240px 0px'
92
+ });
93
+ observer.observe(sectionElement);
94
+ }
95
+ window.addEventListener('resize', prepareMeasurement, { passive: true });
96
+
97
+ return () => {
98
+ observer?.disconnect();
99
+ window.removeEventListener('resize', prepareMeasurement);
100
+ if (measurementFrame) cancelAnimationFrame(measurementFrame);
101
+ };
102
+ });
103
+ </script>
104
+
105
+ <section
106
+ bind:this={sectionElement}
107
+ {...rest}
108
+ id={section.id}
109
+ class={['content-section', contentPage ? 'content-page-section' : '', className]
110
+ .filter(Boolean)
111
+ .join(' ')}
112
+ data-stage-dom-content
113
+ data-spatial-element-tab-target={!contentPage || undefined}
114
+ data-catalog-transition-dom={contentPage ? 'exit' : undefined}
115
+ data-section-presentation={presentation}
116
+ aria-labelledby={`${section.id}-title`}
117
+ style={getSpatialElementSectionStyle(section.style)}
118
+ >
119
+ <svelte:element this={contentPage ? 'h2' : 'p'} id={`${section.id}-title`} class="section-kicker"
120
+ >{section.title}</svelte:element
121
+ >
122
+ {@render children?.()}
123
+ </section>
124
+
125
+ <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
+ .content-section {
138
+ scroll-margin-top: var(--spatial-element-section-scroll-offset, 150px);
139
+ width: min(var(--spatial-element-section-width, 100%), 100%);
140
+ box-sizing: border-box;
141
+ margin: 42px 0 0;
142
+ padding: clamp(30px, 4vw, 56px);
143
+ border-radius: 18px;
144
+ color: var(--spatial-element-section-color, var(--spatial-element-ink));
145
+ background: color-mix(
146
+ in srgb,
147
+ var(--spatial-element-section-tint) var(--spatial-element-section-tint-opacity),
148
+ transparent
149
+ );
150
+ box-shadow: 0 20px 45px rgb(27 55 89 / 0.08);
151
+ -webkit-backdrop-filter: blur(min(var(--spatial-element-section-backdrop-blur), 18px));
152
+ backdrop-filter: blur(min(var(--spatial-element-section-backdrop-blur), 18px));
153
+ pointer-events: auto;
154
+ }
155
+
156
+ .content-section[data-spatial-element-section-culling-ready] {
157
+ content-visibility: auto;
158
+ contain-intrinsic-block-size: auto var(--spatial-element-section-intrinsic-height);
159
+ }
160
+
161
+ /*
162
+ * Do not retain a full-width backdrop-compositing layer for distant sections.
163
+ * The 240px observer margin recreates it before the section can enter the viewport.
164
+ */
165
+ .content-section[data-spatial-element-section-culled] {
166
+ -webkit-backdrop-filter: none;
167
+ backdrop-filter: none;
168
+ }
169
+
170
+ .content-section:last-child {
171
+ margin-bottom: 180px;
172
+ }
173
+
174
+ .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
+ }
190
+ }
191
+ </style>
@@ -0,0 +1,14 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import type { SpatialElementSectionDefinition } from '@spatial-elements/core/spatial-element/types';
4
+ type Props = Omit<HTMLAttributes<HTMLElement>, 'class' | 'id' | 'style'> & {
5
+ /** Metadata used for the section anchor, heading, generated tab, and optional shell styling. */
6
+ section: SpatialElementSectionDefinition;
7
+ /** Arbitrary Svelte content owned by the consuming element route. */
8
+ children?: Snippet;
9
+ class?: string;
10
+ presentation?: 'panel' | 'list';
11
+ };
12
+ declare const Section: import("svelte").Component<Props, {}, "">;
13
+ type Section = ReturnType<typeof Section>;
14
+ export default Section;
@@ -0,0 +1,69 @@
1
+ <script lang="ts">
2
+ import { resolve } from '$app/paths';
3
+ import type { SpatialElementBreadcrumb } from '@spatial-elements/core/spatial-element/types';
4
+
5
+ let {
6
+ items,
7
+ transition = 'enter'
8
+ }: { items: SpatialElementBreadcrumb[]; transition?: 'enter' | 'exit' } = $props();
9
+ </script>
10
+
11
+ <nav
12
+ class="breadcrumbs"
13
+ data-stage-dom-content
14
+ aria-label="Breadcrumb"
15
+ data-catalog-transition-dom={transition}
16
+ >
17
+ <ol>
18
+ {#each items as item, index (item.label)}
19
+ <li>
20
+ {#if item.href}
21
+ <a href={resolve(...([item.href] as unknown as Parameters<typeof resolve>))}>{item.label}</a>
22
+ {:else}
23
+ <span aria-current={index === items.length - 1 ? 'page' : undefined}>{item.label}</span>
24
+ {/if}
25
+ </li>
26
+ {/each}
27
+ </ol>
28
+ </nav>
29
+
30
+ <style>
31
+ .breadcrumbs {
32
+ width: calc(100vw - var(--spatial-element-content-inline-inset) - var(--spatial-element-content-inline-inset));
33
+ margin: 8px 0 12px calc(50% - 50vw + var(--spatial-element-content-inline-inset));
34
+ color: color-mix(in srgb, var(--spatial-element-body) 72%, transparent);
35
+ font-size: 13px;
36
+ line-height: 16px;
37
+ }
38
+
39
+ ol {
40
+ display: flex;
41
+ flex-wrap: wrap;
42
+ gap: 0;
43
+ margin: 0;
44
+ padding: 0;
45
+ list-style: none;
46
+ }
47
+
48
+ li:not(:last-child)::after {
49
+ margin-inline: 0.45rem;
50
+ content: '/';
51
+ }
52
+
53
+ a {
54
+ color: inherit;
55
+ text-decoration: none;
56
+ pointer-events: auto;
57
+ }
58
+
59
+ a:hover {
60
+ text-decoration: underline;
61
+ }
62
+
63
+ @media (max-width: 1100px) {
64
+ .breadcrumbs {
65
+ width: 100%;
66
+ margin-left: 0;
67
+ }
68
+ }
69
+ </style>
@@ -0,0 +1,8 @@
1
+ import type { SpatialElementBreadcrumb } from '@spatial-elements/core/spatial-element/types';
2
+ type $$ComponentProps = {
3
+ items: SpatialElementBreadcrumb[];
4
+ transition?: 'enter' | 'exit';
5
+ };
6
+ declare const SpatialElementBreadcrumbs: import("svelte").Component<$$ComponentProps, {}, "">;
7
+ type SpatialElementBreadcrumbs = ReturnType<typeof SpatialElementBreadcrumbs>;
8
+ export default SpatialElementBreadcrumbs;
@@ -0,0 +1,256 @@
1
+ <script lang="ts">
2
+ import { getContext } from 'svelte';
3
+ import { useSpatialTheme } from './brandContext.js';
4
+ import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
5
+ import { createCatalogEndpointAction } from '../catalog/catalogEndpointAction.js';
6
+ import {
7
+ CATALOG_ENDPOINTS,
8
+ type CatalogEndpointRegistry
9
+ } from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
10
+ import { CATALOG_ITEMS, type CatalogItems } from '@spatial-elements/core/catalog/catalogItems';
11
+ import { CATALOG_SECTIONS, type CatalogSections } from '@spatial-elements/core/catalog/CatalogSections';
12
+ import { useCatalogNavigation } from '../catalog/catalogNavigation.js';
13
+ let {
14
+ spatialElement,
15
+ occurrence,
16
+ order = 0
17
+ }: { spatialElement: SpatialListItem; occurrence: string; order?: number } = $props();
18
+ const brand = useSpatialTheme();
19
+ const catalogEndpoint = createCatalogEndpointAction();
20
+ const endpoints = getContext<CatalogEndpointRegistry | undefined>(CATALOG_ENDPOINTS);
21
+ const items = getContext<CatalogItems | undefined>(CATALOG_ITEMS);
22
+ const sections = getContext<CatalogSections | undefined>(CATALOG_SECTIONS);
23
+ const { href, prepare, pending } = useCatalogNavigation();
24
+ const resolve = href;
25
+ let busySpatialElement = $state<string>();
26
+ $effect(() => items?.register({ ...spatialElement, occurrence }));
27
+ $effect(() => {
28
+ const target = pending();
29
+ busySpatialElement = undefined;
30
+ if (!target || new URL(href(spatialElement.href), target).pathname !== target.pathname) return;
31
+ const timer = setTimeout(() => (busySpatialElement = spatialElement.id), 150);
32
+ return () => clearTimeout(timer);
33
+ });
34
+ </script>
35
+
36
+ <a
37
+ use:catalogEndpoint={{
38
+ brandId: brand.id,
39
+ spatialElementId: spatialElement.id,
40
+ slot: 'catalog.card',
41
+ occurrence,
42
+ role: 'container'
43
+ }}
44
+ class="spatial-element-card"
45
+ href={resolve(spatialElement.href)}
46
+ onpointerenter={() => prepare(spatialElement)}
47
+ onfocus={(event) => {
48
+ if (!event.currentTarget.hasAttribute('data-catalog-restoring-focus')) prepare(spatialElement);
49
+ }}
50
+ onpointerdown={() => prepare(spatialElement)}
51
+ onclick={(event) => {
52
+ endpoints?.prefer(brand.id, spatialElement.id, occurrence);
53
+ sections?.activate({
54
+ brandId: brand.id,
55
+ spatialElementId: spatialElement.id,
56
+ occurrence,
57
+ slot: 'catalog.card'
58
+ });
59
+ // Touch activation need not focus links natively; record the same history origin as keyboard use.
60
+ event.currentTarget.focus({ preventScroll: true });
61
+ }}
62
+ aria-busy={busySpatialElement === spatialElement.id ? true : undefined}
63
+ data-catalog-card
64
+ data-catalog-order={order}
65
+ data-catalog-occurrence={occurrence}
66
+ data-spatial-element-id={spatialElement.id}
67
+ data-catalog-focus-key={`catalog:${JSON.stringify([brand.id, spatialElement.id, occurrence])}`}
68
+ aria-labelledby={`catalog-spatial-element-${encodeURIComponent(occurrence)}`}
69
+ >
70
+ {#if busySpatialElement === spatialElement.id}
71
+ <span class="catalog-loading" aria-hidden="true"></span>
72
+ {/if}
73
+ <div
74
+ class="spatial-element-card-surface"
75
+ style:--card-panel-tint={typeof brand.panelTheme.tint === 'number'
76
+ ? '#' + brand.panelTheme.tint.toString(16).padStart(6, '0')
77
+ : typeof brand.panelTheme.tint === 'object'
78
+ ? brand.panelTheme.tint.getStyle()
79
+ : (brand.panelTheme.tint ?? '#ffffff')}
80
+ style:--card-panel-tint-opacity={Math.min(
81
+ 1,
82
+ Math.max(0, brand.panelTheme.tintOpacity ?? 0.28)
83
+ ) *
84
+ 100 +
85
+ '%'}
86
+ use:catalogEndpoint={{
87
+ brandId: brand.id,
88
+ spatialElementId: spatialElement.id,
89
+ slot: 'catalog.card',
90
+ occurrence,
91
+ role: 'summary-surface'
92
+ }}
93
+ data-shared-role="summary-surface"
94
+ data-spatial-element-id={spatialElement.id}
95
+ aria-hidden="true"
96
+ ></div>
97
+ <div
98
+ class="spatial-element-card-geometry"
99
+ use:catalogEndpoint={{
100
+ brandId: brand.id,
101
+ spatialElementId: spatialElement.id,
102
+ slot: 'catalog.card',
103
+ occurrence,
104
+ role: 'geometry'
105
+ }}
106
+ data-catalog-geometry
107
+ data-catalog-occurrence={occurrence}
108
+ data-spatial-element-id={spatialElement.id}
109
+ data-catalog-slot="catalog.card"
110
+ >
111
+ {#if spatialElement.stage?.fallbackImage}
112
+ <img
113
+ class="catalog-poster"
114
+ data-catalog-poster
115
+ loading="lazy"
116
+ decoding="async"
117
+ src={spatialElement.stage.fallbackImage}
118
+ alt={`${brand.name} ${spatialElement.title}`}
119
+ />
120
+ {/if}
121
+ </div>
122
+ <div class="spatial-element-card-copy">
123
+ <p
124
+ class="spatial-element-card-eyebrow"
125
+ data-shared-role="eyebrow"
126
+ data-spatial-element-id={spatialElement.id}
127
+ use:catalogEndpoint={{
128
+ brandId: brand.id,
129
+ spatialElementId: spatialElement.id,
130
+ slot: 'catalog.card',
131
+ occurrence,
132
+ role: 'eyebrow'
133
+ }}
134
+ >
135
+ {spatialElement.eyebrow}
136
+ </p>
137
+ <h3
138
+ use:catalogEndpoint={{
139
+ brandId: brand.id,
140
+ spatialElementId: spatialElement.id,
141
+ slot: 'catalog.card',
142
+ occurrence,
143
+ role: 'title'
144
+ }}
145
+ id={`catalog-spatial-element-${encodeURIComponent(occurrence)}`}
146
+ data-shared-role="title"
147
+ data-spatial-element-id={spatialElement.id}
148
+ >
149
+ {spatialElement.title}
150
+ </h3>
151
+ </div>
152
+ </a>
153
+ <span class="catalog-status" role="status">{busySpatialElement ? 'Opening spatialElement…' : ''}</span>
154
+
155
+ <style>
156
+ .spatial-element-card-eyebrow {
157
+ margin: 0;
158
+ color: var(--spatial-element-accent);
159
+ font-size: 13px;
160
+ font-weight: 720;
161
+ letter-spacing: 0.04em;
162
+ text-transform: uppercase;
163
+ }
164
+ .catalog-loading {
165
+ position: absolute;
166
+ right: 14px;
167
+ top: 14px;
168
+ width: 18px;
169
+ height: 18px;
170
+ border: 2px solid color-mix(in srgb, var(--spatial-element-accent) 20%, transparent);
171
+ border-top-color: var(--spatial-element-accent);
172
+ border-radius: 50%;
173
+ animation: catalog-loading-spin 0.8s linear infinite;
174
+ }
175
+ .catalog-status {
176
+ position: absolute;
177
+ width: 1px;
178
+ height: 1px;
179
+ overflow: hidden;
180
+ clip-path: inset(50%);
181
+ }
182
+ @keyframes catalog-loading-spin {
183
+ to {
184
+ transform: rotate(360deg);
185
+ }
186
+ }
187
+
188
+ .spatial-element-card {
189
+ position: relative;
190
+ display: block;
191
+ box-sizing: border-box;
192
+ min-width: 0;
193
+ max-width: 360px;
194
+ border-radius: var(--spatial-element-panel-radius, 12px);
195
+ color: var(--spatial-element-ink);
196
+ text-decoration: none;
197
+ transform-origin: center;
198
+ transform: perspective(1000px) translate3d(0, var(--catalog-lift, 0px), 0)
199
+ rotateX(var(--catalog-rotate-x, 0deg)) rotateY(var(--catalog-rotate-y, 0deg));
200
+ }
201
+
202
+ .spatial-element-card:focus-visible {
203
+ outline: 3px solid var(--spatial-element-accent);
204
+ outline-offset: 5px;
205
+ }
206
+
207
+ .spatial-element-card-surface {
208
+ position: absolute;
209
+ inset: 0;
210
+ z-index: -1;
211
+ border: 1px solid color-mix(in srgb, var(--spatial-element-ink) 12%, transparent);
212
+ border-radius: inherit;
213
+ background: color-mix(
214
+ in srgb,
215
+ var(--card-panel-tint) var(--card-panel-tint-opacity),
216
+ transparent
217
+ );
218
+ box-shadow: 0 12px 32px rgb(0 0 0 / 0.06);
219
+ pointer-events: none;
220
+ }
221
+
222
+ .spatial-element-card-geometry {
223
+ position: relative;
224
+ height: 228px;
225
+ margin: 12px 12px 0;
226
+ pointer-events: none;
227
+ }
228
+
229
+ .catalog-poster {
230
+ display: block;
231
+ width: 100%;
232
+ height: 100%;
233
+ object-fit: contain;
234
+ }
235
+
236
+ .spatial-element-card:global([data-catalog-model-ready]) .catalog-poster {
237
+ opacity: 0;
238
+ }
239
+
240
+ .spatial-element-card-copy {
241
+ padding: 14px 22px 24px;
242
+ }
243
+
244
+ h3 {
245
+ margin: 8px 0 0;
246
+ font-size: 21px;
247
+ font-weight: 720;
248
+ line-height: 1.24;
249
+ }
250
+
251
+ @media (prefers-reduced-motion: reduce) {
252
+ .spatial-element-card {
253
+ transform: none;
254
+ }
255
+ }
256
+ </style>
@@ -0,0 +1,9 @@
1
+ import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
2
+ type $$ComponentProps = {
3
+ spatialElement: SpatialListItem;
4
+ occurrence: string;
5
+ order?: number;
6
+ };
7
+ declare const SpatialElementCard: import("svelte").Component<$$ComponentProps, {}, "">;
8
+ type SpatialElementCard = ReturnType<typeof SpatialElementCard>;
9
+ export default SpatialElementCard;
@@ -0,0 +1,144 @@
1
+ <script lang="ts">
2
+ import Panel from '../stage/Panel.svelte';
3
+ import { useSpatialTheme } from './brandContext.js';
4
+ import type { SpatialElementData } from '@spatial-elements/core/spatial-element/types';
5
+
6
+ let { spatialElement }: { spatialElement: SpatialElementData } = $props();
7
+ const theme = useSpatialTheme();
8
+ const minimap = $derived({
9
+ ...spatialElement.minimap,
10
+ ...theme.minimapTheme,
11
+ viewportColor: theme.minimapTheme.viewportColor ?? theme.colors.accent
12
+ });
13
+ </script>
14
+
15
+ <aside class="spatial-element-rail" aria-label="SpatialElement images">
16
+ {#each spatialElement.media as media (media.id)}
17
+ <div
18
+ class="spatial-element-media-anchor"
19
+ data-spatial-element-dock-minimap-anchor={media.kind === 'minimap' ? '' : undefined}
20
+ >
21
+ <Panel
22
+ catalogEndpoint={media.kind === 'minimap'
23
+ ? { brandId: theme.id, spatialElementId: spatialElement.id, slot: 'detail.dock', role: 'geometry' }
24
+ : undefined}
25
+ transitionGroup="enter"
26
+ class={`thumbnail-panel ${media.kind === 'minimap' ? 'active' : ''}`}
27
+ shape={{ ...theme.panelShape, contentInset: 0 }}
28
+ theme={theme.panelTheme}
29
+ contentClass="thumbnail-panel-content"
30
+ minimap={media.kind === 'minimap' ? minimap : false}
31
+ data-spatial-element-departing-media-content={media.kind === 'minimap' ? undefined : ''}
32
+ >
33
+ {#if media.kind === 'minimap'}
34
+ <button type="button" aria-label={media.label} class="thumb thumb-minimap active"
35
+ ></button>
36
+ {:else if media.kind === 'drawing'}
37
+ <button type="button" aria-label={media.label} class="thumb thumb-drawing">
38
+ <span class="drawing-sheet" aria-hidden="true"></span>
39
+ </button>
40
+ {:else}
41
+ <button type="button" aria-label={media.label} class="thumb thumb-image">
42
+ <img src={media.src} alt={media.alt} />
43
+ </button>
44
+ {/if}
45
+ </Panel>
46
+ </div>
47
+ {/each}
48
+ </aside>
49
+
50
+ <style>
51
+ .spatial-element-rail {
52
+ position: absolute;
53
+ top: 0;
54
+ left: 0;
55
+ display: grid;
56
+ gap: 14px;
57
+ justify-items: start;
58
+ pointer-events: auto;
59
+ }
60
+
61
+ .spatial-element-media-anchor {
62
+ width: 120px;
63
+ height: 120px;
64
+ }
65
+
66
+ :global(.thumbnail-panel) {
67
+ width: 100%;
68
+ height: 100%;
69
+ }
70
+
71
+ :global(.thumbnail-panel-content) {
72
+ display: grid;
73
+ place-items: center;
74
+ width: 100%;
75
+ height: 100%;
76
+ }
77
+
78
+ .thumb {
79
+ display: grid;
80
+ place-items: center;
81
+ width: 100%;
82
+ height: 100%;
83
+ border: 0;
84
+ border-radius: var(--spatial-element-panel-radius);
85
+ background: transparent;
86
+ cursor: pointer;
87
+ }
88
+
89
+ .thumb.active:not(.thumb-minimap) {
90
+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--spatial-element-accent) 82%, transparent);
91
+ }
92
+
93
+ .thumb-minimap {
94
+ position: relative;
95
+ overflow: hidden;
96
+ }
97
+
98
+ .thumb-image img {
99
+ display: block;
100
+ max-width: calc(100% - 18px);
101
+ max-height: calc(100% - 18px);
102
+ object-fit: contain;
103
+ }
104
+
105
+ .drawing-sheet {
106
+ position: relative;
107
+ width: 74px;
108
+ height: 74px;
109
+ border: 1px solid rgb(74 137 205 / 0.34);
110
+ background:
111
+ linear-gradient(135deg, transparent 46%, rgb(46 117 191 / 0.26) 46% 54%, transparent 54%),
112
+ repeating-linear-gradient(0deg, transparent 0 12px, rgb(74 137 205 / 0.16) 12px 13px),
113
+ repeating-linear-gradient(90deg, transparent 0 12px, rgb(74 137 205 / 0.16) 12px 13px),
114
+ rgb(255 255 255 / 0.82);
115
+ }
116
+
117
+ .drawing-sheet::before {
118
+ position: absolute;
119
+ inset: 15px 17px 20px 15px;
120
+ border: 1px solid rgb(74 137 205 / 0.8);
121
+ border-radius: 2px;
122
+ content: '';
123
+ }
124
+
125
+ .drawing-sheet::after {
126
+ position: absolute;
127
+ right: 6px;
128
+ bottom: 7px;
129
+ color: rgb(74 137 205 / 0.8);
130
+ font:
131
+ 600 7px/1 system-ui,
132
+ sans-serif;
133
+ content: '100 mm';
134
+ }
135
+
136
+ @media (max-width: 1100px) {
137
+ .spatial-element-rail {
138
+ position: relative;
139
+ left: 0;
140
+ grid-auto-flow: column;
141
+ justify-content: start;
142
+ }
143
+ }
144
+ </style>
@@ -0,0 +1,7 @@
1
+ import type { SpatialElementData } from '@spatial-elements/core/spatial-element/types';
2
+ type $$ComponentProps = {
3
+ spatialElement: SpatialElementData;
4
+ };
5
+ declare const SpatialElementMediaRail: import("svelte").Component<$$ComponentProps, {}, "">;
6
+ type SpatialElementMediaRail = ReturnType<typeof SpatialElementMediaRail>;
7
+ export default SpatialElementMediaRail;