@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.
- package/dist/catalog/ScrollNavigationBridge.svelte +170 -45
- package/dist/catalog/ScrollNavigationBridge.svelte.d.ts +9 -2
- package/dist/catalog/catalogSummaryTransfer.d.ts +16 -0
- package/dist/catalog/catalogSummaryTransfer.js +79 -0
- package/dist/catalog/catalogTransition.css +46 -3
- package/dist/catalog/interruptedPresentation.d.ts +10 -0
- package/dist/catalog/interruptedPresentation.js +29 -0
- package/dist/catalog/presentationCleanup.d.ts +4 -0
- package/dist/catalog/presentationCleanup.js +20 -0
- package/dist/catalog/stagedCatalogNavigation.d.ts +44 -0
- package/dist/catalog/stagedCatalogNavigation.js +403 -0
- package/dist/catalog/stagedDomReveal.d.ts +8 -0
- package/dist/catalog/stagedDomReveal.js +76 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/spatial-element/BrandStageShell.svelte +13 -2
- package/dist/spatial-element/BrandStageShell.svelte.d.ts +8 -0
- package/dist/spatial-element/CarouselSection.svelte +35 -21
- package/dist/spatial-element/CarouselSpatialElement.svelte +49 -115
- package/dist/spatial-element/ContentBlock.svelte +53 -0
- package/dist/spatial-element/ContentBlock.svelte.d.ts +11 -0
- package/dist/spatial-element/ContentGrid.svelte +28 -0
- package/dist/spatial-element/ContentGrid.svelte.d.ts +10 -0
- package/dist/spatial-element/ContentPage.svelte +28 -20
- package/dist/spatial-element/ContentPage.svelte.d.ts +3 -0
- package/dist/spatial-element/ListSection.svelte +11 -5
- package/dist/spatial-element/ListSection.svelte.d.ts +5 -0
- package/dist/spatial-element/PointerHint.svelte +3 -1
- package/dist/spatial-element/Section.svelte +51 -40
- package/dist/spatial-element/Section.svelte.d.ts +1 -0
- package/dist/spatial-element/SectionSurfaceGroup.svelte +34 -0
- package/dist/spatial-element/SectionSurfaceGroup.svelte.d.ts +7 -0
- package/dist/spatial-element/SpatialCardPresentation.svelte +378 -0
- package/dist/spatial-element/SpatialCardPresentation.svelte.d.ts +13 -0
- package/dist/spatial-element/SpatialCardSlot.svelte +33 -0
- package/dist/spatial-element/SpatialCardSlot.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +20 -12
- package/dist/spatial-element/SpatialElementBreadcrumbs.svelte.d.ts +1 -0
- package/dist/spatial-element/SpatialElementCard.svelte +19 -318
- package/dist/spatial-element/SpatialElementCard.svelte.d.ts +3 -0
- package/dist/spatial-element/SpatialElementHelp.svelte +21 -15
- package/dist/spatial-element/SpatialElementHelp.svelte.d.ts +4 -1
- package/dist/spatial-element/SpatialElementMediaRail.svelte +75 -21
- package/dist/spatial-element/SpatialElementMediaRail.svelte.d.ts +3 -0
- package/dist/spatial-element/SpatialElementNativeMedia.svelte +36 -0
- package/dist/spatial-element/SpatialElementNativeMedia.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialElementPage.svelte +127 -68
- package/dist/spatial-element/SpatialElementPage.svelte.d.ts +1 -0
- package/dist/spatial-element/SpatialElementStickyHeader.svelte +36 -69
- package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +1 -0
- package/dist/spatial-element/SpatialElementSummaryContent.svelte +14 -11
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte +29 -20
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte.d.ts +1 -0
- package/dist/spatial-element/SpatialElementTabList.svelte +19 -3
- package/dist/spatial-element/SpatialElementTabs.svelte +56 -16
- package/dist/spatial-element/SpatialElementTabs.svelte.d.ts +1 -0
- package/dist/spatial-element/SpatialElementViewToggle.svelte +5 -4
- package/dist/spatial-element/SpatialIconButton.svelte +4 -2
- package/dist/spatial-element/SpatialNavigationShell.svelte +129 -0
- package/dist/spatial-element/SpatialNavigationShell.svelte.d.ts +10 -0
- package/dist/spatial-element/SpatialSummaryHost.svelte +19 -0
- package/dist/spatial-element/SpatialSummaryHost.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialSummaryRoot.svelte +78 -0
- package/dist/spatial-element/SpatialSummaryRoot.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialSummarySlot.svelte +39 -0
- package/dist/spatial-element/SpatialSummarySlot.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialViewIcon.svelte +29 -0
- package/dist/spatial-element/SpatialViewIcon.svelte.d.ts +6 -0
- package/dist/spatial-element/cardAppearanceFreeze.d.ts +5 -0
- package/dist/spatial-element/cardAppearanceFreeze.js +72 -0
- package/dist/spatial-element/index.d.ts +6 -2
- package/dist/spatial-element/index.js +3 -1
- package/dist/spatial-element/layout.generated.css +455 -0
- package/dist/spatial-element/presentationBoxFreeze.d.ts +8 -0
- package/dist/spatial-element/presentationBoxFreeze.js +35 -0
- package/dist/spatial-element/spatialPresentationOwner.d.ts +6 -0
- package/dist/spatial-element/spatialPresentationOwner.js +2 -0
- package/dist/spatial-element/spatialSummary.d.ts +37 -0
- package/dist/spatial-element/spatialSummary.js +1 -0
- package/dist/spatial-element/spatialSummaryHost.svelte.d.ts +60 -0
- package/dist/spatial-element/spatialSummaryHost.svelte.js +233 -0
- package/dist/spatial-element/spatialThemeStyle.js +10 -4
- package/dist/stage/ButtonGroup.svelte +1 -1
- package/dist/stage/Panel.svelte +16 -4
- package/dist/stage/Stage.svelte +180 -26
- package/package.json +2 -2
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { browser } from '$app/environment';
|
|
3
|
+
import { createRawSnippet, getContext, onMount, untrack } from 'svelte';
|
|
4
|
+
import { render } from 'svelte/server';
|
|
5
|
+
import { SpatialSummaryHostController, SPATIAL_SUMMARY_HOST } from './spatialSummaryHost.svelte.js';
|
|
6
|
+
import SpatialSummaryRoot from './SpatialSummaryRoot.svelte';
|
|
7
|
+
import type { SpatialCardContext } from './spatialSummary.js';
|
|
8
|
+
let { instanceKey, context }: { instanceKey: string; context: SpatialCardContext } = $props();
|
|
9
|
+
const host = getContext<SpatialSummaryHostController | undefined>(SPATIAL_SUMMARY_HOST);
|
|
10
|
+
if (!host) throw new Error('Spatial card slots require a BrandStageShell');
|
|
11
|
+
const key = untrack(() => instanceKey);
|
|
12
|
+
let mounted = $state(false);
|
|
13
|
+
const raw = createRawSnippet(() => ({
|
|
14
|
+
render: () => {
|
|
15
|
+
if (browser) return '<div data-spatial-card-slot></div>';
|
|
16
|
+
const output = render(SpatialSummaryRoot, {
|
|
17
|
+
props: { content: host.content(), model: { kind: 'card', current: context, active: true } },
|
|
18
|
+
context: host.contexts, idPrefix: `card-${encodeURIComponent(key).replaceAll('-', '%2D')}`
|
|
19
|
+
});
|
|
20
|
+
if (output.head) throw new Error('A persistent card must render synchronous content without svelte:head');
|
|
21
|
+
return `<div data-spatial-card-slot><div data-spatial-presentation-root class="spatial-card-root">${output.body}</div></div>`;
|
|
22
|
+
},
|
|
23
|
+
setup: (slot) => host.attachCard(slot as HTMLElement, key, context)
|
|
24
|
+
}));
|
|
25
|
+
onMount(() => { mounted = true; });
|
|
26
|
+
$effect(() => { if (mounted) host.updateCard(key, context); });
|
|
27
|
+
</script>
|
|
28
|
+
{@render raw()}
|
|
29
|
+
<style>
|
|
30
|
+
:global([data-spatial-card-slot]), :global(.spatial-card-root) {
|
|
31
|
+
width: 100%; height: 100%; min-width: 0; min-height: 0; transform-style: preserve-3d;
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SpatialCardContext } from './spatialSummary.js';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
instanceKey: string;
|
|
4
|
+
context: SpatialCardContext;
|
|
5
|
+
};
|
|
6
|
+
declare const SpatialCardSlot: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type SpatialCardSlot = ReturnType<typeof SpatialCardSlot>;
|
|
8
|
+
export default SpatialCardSlot;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { resolve } from '$app/paths';
|
|
3
|
+
import './layout.generated.css';
|
|
3
4
|
import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
|
|
4
5
|
import type { SpatialElementBreadcrumb } from '@spatial-elements/core/spatial-element/types';
|
|
5
6
|
|
|
@@ -11,7 +12,7 @@
|
|
|
11
12
|
|
|
12
13
|
<nav
|
|
13
14
|
use:mouseHover
|
|
14
|
-
class="breadcrumbs"
|
|
15
|
+
class="breadcrumbs spatial-grid-scope spatial-content-width"
|
|
15
16
|
data-stage-dom-content
|
|
16
17
|
aria-label="Breadcrumb"
|
|
17
18
|
data-catalog-transition-dom={transition}
|
|
@@ -31,21 +32,34 @@
|
|
|
31
32
|
|
|
32
33
|
<style>
|
|
33
34
|
.breadcrumbs {
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
height: var(--spatial-breadcrumb-height);
|
|
37
|
+
margin-block: 0;
|
|
38
|
+
padding-inline: var(--spatial-grid-gap, 12px);
|
|
39
|
+
overflow-x: auto;
|
|
40
|
+
overflow-y: hidden;
|
|
41
|
+
/* Start at the trailing end even before hydration; the list keeps its reading order. */
|
|
42
|
+
direction: rtl;
|
|
43
|
+
scrollbar-width: none;
|
|
36
44
|
color: color-mix(in srgb, var(--spatial-element-body) 72%, transparent);
|
|
37
|
-
font-size:
|
|
38
|
-
line-height:
|
|
45
|
+
font-size: var(--spatial-breadcrumb-font-size);
|
|
46
|
+
line-height: var(--spatial-breadcrumb-height);
|
|
47
|
+
pointer-events: auto;
|
|
39
48
|
}
|
|
40
49
|
|
|
41
50
|
ol {
|
|
42
51
|
display: flex;
|
|
43
|
-
flex-wrap:
|
|
52
|
+
flex-wrap: nowrap;
|
|
53
|
+
direction: ltr;
|
|
54
|
+
width: max-content;
|
|
55
|
+
min-width: 100%;
|
|
44
56
|
gap: 0;
|
|
45
57
|
margin: 0;
|
|
46
58
|
padding: 0;
|
|
47
59
|
list-style: none;
|
|
48
60
|
}
|
|
61
|
+
li { flex: none; white-space: nowrap; }
|
|
62
|
+
.breadcrumbs::-webkit-scrollbar { display: none; }
|
|
49
63
|
|
|
50
64
|
li:not(:last-child)::after {
|
|
51
65
|
margin-inline: 0.45rem;
|
|
@@ -62,10 +76,4 @@
|
|
|
62
76
|
text-decoration: underline;
|
|
63
77
|
}
|
|
64
78
|
|
|
65
|
-
@media (max-width: 1100px) {
|
|
66
|
-
.breadcrumbs {
|
|
67
|
-
width: 100%;
|
|
68
|
-
margin-left: 0;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
79
|
</style>
|
|
@@ -1,322 +1,23 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
occurrence,
|
|
18
|
-
order = 0
|
|
19
|
-
}: { spatialElement: SpatialListItem; occurrence: string; order?: number } = $props();
|
|
20
|
-
const readTheme = useSpatialTheme();
|
|
21
|
-
const brand = $derived(readTheme());
|
|
22
|
-
const catalogEndpoint = createCatalogEndpointAction();
|
|
23
|
-
const endpoints = getContext<CatalogEndpointRegistry | undefined>(CATALOG_ENDPOINTS);
|
|
24
|
-
const items = getContext<CatalogItems | undefined>(CATALOG_ITEMS);
|
|
25
|
-
const sections = getContext<CatalogSections | undefined>(CATALOG_SECTIONS);
|
|
26
|
-
const { href, prepare, pending } = useCatalogNavigation();
|
|
27
|
-
const resolve = href;
|
|
28
|
-
let busySpatialElement = $state<string>();
|
|
29
|
-
$effect(() => items?.register({ ...spatialElement, occurrence }));
|
|
30
|
-
$effect(() => {
|
|
31
|
-
const target = pending();
|
|
32
|
-
busySpatialElement = undefined;
|
|
33
|
-
if (!target || new URL(href(spatialElement.href), target).pathname !== target.pathname) return;
|
|
34
|
-
const timer = setTimeout(() => (busySpatialElement = spatialElement.id), 150);
|
|
35
|
-
return () => clearTimeout(timer);
|
|
36
|
-
});
|
|
2
|
+
import { getContext } from 'svelte';
|
|
3
|
+
import { CATALOG_ITEMS, type CatalogItems } from '@spatial-elements/core/catalog/catalogItems';
|
|
4
|
+
import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
|
|
5
|
+
import { spatialLayoutTokens, type SpatialCardSize } from '@spatial-elements/core/spatial-element/responsiveLayout';
|
|
6
|
+
import { useSpatialTheme } from './brandContext.js';
|
|
7
|
+
import SpatialCardSlot from './SpatialCardSlot.svelte';
|
|
8
|
+
let { spatialElement, occurrence, order = 0, cardSize = 'm', textAlign = 'start' }: {
|
|
9
|
+
spatialElement: SpatialListItem; occurrence: string; order?: number; cardSize?: SpatialCardSize; textAlign?: 'start' | 'center';
|
|
10
|
+
} = $props();
|
|
11
|
+
const items = getContext<CatalogItems | undefined>(CATALOG_ITEMS);
|
|
12
|
+
const readTheme = useSpatialTheme();
|
|
13
|
+
const brand = $derived(readTheme());
|
|
14
|
+
const span = $derived(cardSize === 'l' ? `var(--spatial-card-large-span, ${spatialLayoutTokens.cards.l.span})` : spatialLayoutTokens.cards[cardSize].span);
|
|
15
|
+
// Asset/catalog membership follows the route; a retained visual island never adds an old page again.
|
|
16
|
+
$effect(() => items?.register({ ...spatialElement, occurrence }));
|
|
37
17
|
</script>
|
|
38
|
-
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
use:catalogEndpoint={{
|
|
42
|
-
brandId: brand.id,
|
|
43
|
-
spatialElementId: spatialElement.id,
|
|
44
|
-
slot: 'catalog.card',
|
|
45
|
-
occurrence,
|
|
46
|
-
role: 'container'
|
|
47
|
-
}}
|
|
48
|
-
class="spatial-element-card"
|
|
49
|
-
href={resolve(spatialElement.href)}
|
|
50
|
-
onpointerenter={() => prepare(spatialElement)}
|
|
51
|
-
onfocus={(event) => {
|
|
52
|
-
if (!event.currentTarget.hasAttribute('data-catalog-restoring-focus')) prepare(spatialElement);
|
|
53
|
-
}}
|
|
54
|
-
onpointerdown={() => prepare(spatialElement)}
|
|
55
|
-
onclick={(event) => {
|
|
56
|
-
endpoints?.prefer(brand.id, spatialElement.id, occurrence);
|
|
57
|
-
sections?.activate({
|
|
58
|
-
brandId: brand.id,
|
|
59
|
-
spatialElementId: spatialElement.id,
|
|
60
|
-
occurrence,
|
|
61
|
-
slot: 'catalog.card'
|
|
62
|
-
});
|
|
63
|
-
// Touch activation need not focus links natively; record the same history origin as keyboard use.
|
|
64
|
-
event.currentTarget.focus({ preventScroll: true });
|
|
65
|
-
}}
|
|
66
|
-
aria-busy={busySpatialElement === spatialElement.id ? true : undefined}
|
|
67
|
-
data-catalog-card
|
|
68
|
-
data-catalog-order={order}
|
|
69
|
-
data-catalog-occurrence={occurrence}
|
|
70
|
-
data-spatial-element-id={spatialElement.id}
|
|
71
|
-
data-catalog-focus-key={`catalog:${JSON.stringify([brand.id, spatialElement.id, occurrence])}`}
|
|
72
|
-
aria-labelledby={`catalog-spatial-element-${encodeURIComponent(occurrence)}`}
|
|
73
|
-
>
|
|
74
|
-
{#if busySpatialElement === spatialElement.id}
|
|
75
|
-
<span class="catalog-loading" aria-hidden="true"></span>
|
|
76
|
-
{/if}
|
|
77
|
-
<div
|
|
78
|
-
class="spatial-element-card-surface"
|
|
79
|
-
style:--card-panel-tint={typeof brand.panelTheme.tint === 'number'
|
|
80
|
-
? '#' + brand.panelTheme.tint.toString(16).padStart(6, '0')
|
|
81
|
-
: typeof brand.panelTheme.tint === 'object'
|
|
82
|
-
? brand.panelTheme.tint.getStyle()
|
|
83
|
-
: (brand.panelTheme.tint ?? '#ffffff')}
|
|
84
|
-
style:--card-panel-tint-opacity={Math.min(
|
|
85
|
-
1,
|
|
86
|
-
Math.max(0, brand.panelTheme.tintOpacity ?? 0.28)
|
|
87
|
-
) *
|
|
88
|
-
100 +
|
|
89
|
-
'%'}
|
|
90
|
-
use:catalogEndpoint={{
|
|
91
|
-
brandId: brand.id,
|
|
92
|
-
spatialElementId: spatialElement.id,
|
|
93
|
-
slot: 'catalog.card',
|
|
94
|
-
occurrence,
|
|
95
|
-
role: 'summary-surface'
|
|
96
|
-
}}
|
|
97
|
-
data-shared-role="summary-surface"
|
|
98
|
-
data-spatial-element-id={spatialElement.id}
|
|
99
|
-
aria-hidden="true"
|
|
100
|
-
></div>
|
|
101
|
-
<div
|
|
102
|
-
class="spatial-element-card-geometry"
|
|
103
|
-
use:catalogEndpoint={{
|
|
104
|
-
brandId: brand.id,
|
|
105
|
-
spatialElementId: spatialElement.id,
|
|
106
|
-
slot: 'catalog.card',
|
|
107
|
-
occurrence,
|
|
108
|
-
role: 'geometry'
|
|
109
|
-
}}
|
|
110
|
-
data-catalog-geometry
|
|
111
|
-
data-catalog-occurrence={occurrence}
|
|
112
|
-
data-spatial-element-id={spatialElement.id}
|
|
113
|
-
data-catalog-slot="catalog.card"
|
|
114
|
-
>
|
|
115
|
-
{#if spatialElement.fallbackImage}
|
|
116
|
-
<img
|
|
117
|
-
class="catalog-poster"
|
|
118
|
-
data-catalog-poster
|
|
119
|
-
loading="lazy"
|
|
120
|
-
decoding="async"
|
|
121
|
-
src={spatialElement.fallbackImage}
|
|
122
|
-
alt={`${brand.name} ${spatialElement.title}`}
|
|
123
|
-
/>
|
|
124
|
-
{/if}
|
|
125
|
-
</div>
|
|
126
|
-
<div class="spatial-element-card-copy">
|
|
127
|
-
<p
|
|
128
|
-
class="spatial-element-card-eyebrow"
|
|
129
|
-
data-shared-role="eyebrow"
|
|
130
|
-
data-spatial-element-id={spatialElement.id}
|
|
131
|
-
use:catalogEndpoint={{
|
|
132
|
-
brandId: brand.id,
|
|
133
|
-
spatialElementId: spatialElement.id,
|
|
134
|
-
slot: 'catalog.card',
|
|
135
|
-
occurrence,
|
|
136
|
-
role: 'eyebrow'
|
|
137
|
-
}}
|
|
138
|
-
>
|
|
139
|
-
{spatialElement.eyebrow}
|
|
140
|
-
</p>
|
|
141
|
-
<h3
|
|
142
|
-
use:truncatedTitle={spatialElement.title}
|
|
143
|
-
use:catalogEndpoint={{
|
|
144
|
-
brandId: brand.id,
|
|
145
|
-
spatialElementId: spatialElement.id,
|
|
146
|
-
slot: 'catalog.card',
|
|
147
|
-
occurrence,
|
|
148
|
-
role: 'title'
|
|
149
|
-
}}
|
|
150
|
-
id={`catalog-spatial-element-${encodeURIComponent(occurrence)}`}
|
|
151
|
-
data-shared-role="title"
|
|
152
|
-
data-spatial-element-id={spatialElement.id}
|
|
153
|
-
>
|
|
154
|
-
{spatialElement.title}
|
|
155
|
-
</h3>
|
|
156
|
-
</div>
|
|
157
|
-
</a>
|
|
158
|
-
<span class="catalog-status" role="status">{busySpatialElement ? 'Opening spatialElement…' : ''}</span>
|
|
159
|
-
|
|
18
|
+
<div class="spatial-card-placement" style:--card-grid-span={span}>
|
|
19
|
+
<SpatialCardSlot instanceKey={`card:${brand.id}:${occurrence}`} context={{ spatialElement, occurrence, order, cardSize, textAlign }} />
|
|
20
|
+
</div>
|
|
160
21
|
<style>
|
|
161
|
-
|
|
162
|
-
margin: 0;
|
|
163
|
-
color: var(--spatial-element-accent);
|
|
164
|
-
font-size: 13px;
|
|
165
|
-
font-weight: 720;
|
|
166
|
-
letter-spacing: 0.04em;
|
|
167
|
-
text-transform: uppercase;
|
|
168
|
-
line-height: 1.4;
|
|
169
|
-
height: 1lh;
|
|
170
|
-
overflow: hidden;
|
|
171
|
-
white-space: nowrap;
|
|
172
|
-
text-overflow: ellipsis;
|
|
173
|
-
transform: translateZ(var(--card-eyebrow-depth, 0px));
|
|
174
|
-
}
|
|
175
|
-
.catalog-loading {
|
|
176
|
-
position: absolute;
|
|
177
|
-
right: 14px;
|
|
178
|
-
top: 14px;
|
|
179
|
-
width: 18px;
|
|
180
|
-
height: 18px;
|
|
181
|
-
border: 2px solid color-mix(in srgb, var(--spatial-element-accent) 20%, transparent);
|
|
182
|
-
border-top-color: var(--spatial-element-accent);
|
|
183
|
-
border-radius: 50%;
|
|
184
|
-
animation: catalog-loading-spin 0.8s linear infinite;
|
|
185
|
-
}
|
|
186
|
-
.catalog-status {
|
|
187
|
-
position: absolute;
|
|
188
|
-
width: 1px;
|
|
189
|
-
height: 1px;
|
|
190
|
-
overflow: hidden;
|
|
191
|
-
clip-path: inset(50%);
|
|
192
|
-
}
|
|
193
|
-
@keyframes catalog-loading-spin {
|
|
194
|
-
to {
|
|
195
|
-
transform: rotate(360deg);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
.spatial-element-card {
|
|
200
|
-
position: relative;
|
|
201
|
-
display: block;
|
|
202
|
-
box-sizing: border-box;
|
|
203
|
-
min-width: 0;
|
|
204
|
-
max-width: 360px;
|
|
205
|
-
border-radius: var(--spatial-element-panel-radius, 12px);
|
|
206
|
-
color: var(--spatial-element-ink);
|
|
207
|
-
text-decoration: none;
|
|
208
|
-
transform-origin: center;
|
|
209
|
-
transform-style: preserve-3d;
|
|
210
|
-
transform: perspective(1000px) translate3d(0, var(--catalog-lift, 0px), 0)
|
|
211
|
-
rotateX(var(--catalog-rotate-x, 0deg)) rotateY(var(--catalog-rotate-y, 0deg));
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.spatial-element-card:focus-visible {
|
|
215
|
-
outline: 3px solid var(--spatial-element-accent);
|
|
216
|
-
outline-offset: 5px;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.spatial-element-card-surface {
|
|
220
|
-
position: absolute;
|
|
221
|
-
inset: 0;
|
|
222
|
-
z-index: -1;
|
|
223
|
-
border: 1px solid color-mix(in srgb, var(--spatial-element-ink) 12%, transparent);
|
|
224
|
-
border-radius: inherit;
|
|
225
|
-
background: color-mix(
|
|
226
|
-
in srgb,
|
|
227
|
-
var(--card-panel-tint) var(--card-panel-tint-opacity),
|
|
228
|
-
transparent
|
|
229
|
-
);
|
|
230
|
-
box-shadow: 0 12px 32px rgb(0 0 0 / 0.06);
|
|
231
|
-
transition: border-color 180ms ease;
|
|
232
|
-
pointer-events: none;
|
|
233
|
-
}
|
|
234
|
-
.spatial-element-card:global([data-mouse-hover]) .spatial-element-card-surface,
|
|
235
|
-
.spatial-element-card:focus-visible .spatial-element-card-surface {
|
|
236
|
-
border-color: var(--spatial-element-accent);
|
|
237
|
-
}
|
|
238
|
-
.spatial-element-card-surface::after {
|
|
239
|
-
content: '';
|
|
240
|
-
position: absolute;
|
|
241
|
-
inset: -1px;
|
|
242
|
-
border-radius: inherit;
|
|
243
|
-
box-shadow: 0 0 0 1px color-mix(in srgb, var(--spatial-element-accent) 25%, transparent),
|
|
244
|
-
0 0 18px color-mix(in srgb, var(--spatial-element-accent) 18%, transparent);
|
|
245
|
-
opacity: 0;
|
|
246
|
-
transition: opacity 180ms ease;
|
|
247
|
-
}
|
|
248
|
-
.spatial-element-card:global([data-mouse-hover]) .spatial-element-card-surface::after,
|
|
249
|
-
.spatial-element-card:focus-visible .spatial-element-card-surface::after {
|
|
250
|
-
opacity: 1;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.spatial-element-card-geometry {
|
|
254
|
-
position: relative;
|
|
255
|
-
transform-style: preserve-3d;
|
|
256
|
-
height: 228px;
|
|
257
|
-
margin: 12px 12px 0;
|
|
258
|
-
pointer-events: none;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
.catalog-poster {
|
|
262
|
-
display: block;
|
|
263
|
-
width: 100%;
|
|
264
|
-
height: 100%;
|
|
265
|
-
object-fit: contain;
|
|
266
|
-
transform: translateZ(var(--card-model-depth, 0px)) scale(var(--card-model-scale, 1));
|
|
267
|
-
transition: transform 260ms cubic-bezier(0.22, 0.75, 0.25, 1), opacity 240ms ease;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
.spatial-element-card:global([data-catalog-model-ready]) .catalog-poster {
|
|
271
|
-
opacity: 0;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
.spatial-element-card-copy {
|
|
275
|
-
position: relative;
|
|
276
|
-
padding: 14px 22px 24px;
|
|
277
|
-
transform-style: preserve-3d;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
.spatial-element-card-eyebrow,
|
|
281
|
-
h3 {
|
|
282
|
-
text-shadow: var(--card-text-shadow, 0 0 0 transparent);
|
|
283
|
-
transition: transform 260ms cubic-bezier(0.22, 0.75, 0.25, 1),
|
|
284
|
-
text-shadow 260ms cubic-bezier(0.22, 0.75, 0.25, 1);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
.spatial-element-card:global([data-mouse-hover]),
|
|
288
|
-
.spatial-element-card:focus-visible {
|
|
289
|
-
--card-eyebrow-depth: 40px;
|
|
290
|
-
--card-title-depth: 64px;
|
|
291
|
-
--card-model-depth: 96px;
|
|
292
|
-
--card-model-scale: 1.12;
|
|
293
|
-
--card-text-shadow: 0 4px 10px rgb(0 0 0 / 0.16);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
h3 {
|
|
297
|
-
display: -webkit-box;
|
|
298
|
-
-webkit-box-orient: vertical;
|
|
299
|
-
-webkit-line-clamp: 2;
|
|
300
|
-
line-clamp: 2;
|
|
301
|
-
height: 2lh;
|
|
302
|
-
overflow: hidden;
|
|
303
|
-
text-overflow: ellipsis;
|
|
304
|
-
overflow-wrap: anywhere;
|
|
305
|
-
margin: 8px 0 0;
|
|
306
|
-
font-size: 21px;
|
|
307
|
-
font-weight: 720;
|
|
308
|
-
line-height: 1.24;
|
|
309
|
-
transform: translateZ(var(--card-title-depth, 0px));
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
@media (prefers-reduced-motion: reduce) {
|
|
313
|
-
.spatial-element-card,
|
|
314
|
-
.spatial-element-card-eyebrow,
|
|
315
|
-
.catalog-poster,
|
|
316
|
-
h3 {
|
|
317
|
-
transform: none;
|
|
318
|
-
transition: none;
|
|
319
|
-
text-shadow: none;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
22
|
+
.spatial-card-placement { grid-column: span var(--card-grid-span); aspect-ratio: 1; min-width: 0; min-height: 0; transform-style: preserve-3d; }
|
|
322
23
|
</style>
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
|
|
2
|
+
import { type SpatialCardSize } from '@spatial-elements/core/spatial-element/responsiveLayout';
|
|
2
3
|
type $$ComponentProps = {
|
|
3
4
|
spatialElement: SpatialListItem;
|
|
4
5
|
occurrence: string;
|
|
5
6
|
order?: number;
|
|
7
|
+
cardSize?: SpatialCardSize;
|
|
8
|
+
textAlign?: 'start' | 'center';
|
|
6
9
|
};
|
|
7
10
|
declare const SpatialElementCard: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
11
|
type SpatialElementCard = ReturnType<typeof SpatialElementCard>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { resolveSpatialThemeRadii } from '@spatial-elements/core/spatial-element/spatialTheme';
|
|
2
3
|
import { getContext, onMount, tick } from 'svelte';
|
|
3
|
-
import
|
|
4
|
+
import CircleHelp from 'lucide-svelte/icons/circle-help';
|
|
5
|
+
import X from 'lucide-svelte/icons/x';
|
|
4
6
|
import InteractionGesture from './InteractionGesture.svelte';
|
|
5
7
|
import { getCssPanelBoxShadow } from '@spatial-elements/core/stage/panelShadow';
|
|
6
8
|
import { getInteractionGuidance, MODEL_INPUT_EVENT, type ModelInputState, type InteractionGuidance } from '@spatial-elements/core/stage/interactionGuidance';
|
|
@@ -14,18 +16,21 @@
|
|
|
14
16
|
|
|
15
17
|
const readTheme = useSpatialTheme();
|
|
16
18
|
const theme = $derived(readTheme());
|
|
19
|
+
const radii = $derived(resolveSpatialThemeRadii(theme));
|
|
17
20
|
const stageContext = getContext<StageContext>(STAGE_CONTEXT_KEY);
|
|
18
21
|
const fullscreen = $derived(stageContext.isFullscreen?.() ?? false);
|
|
19
22
|
const readMessages = useSpatialMessages();
|
|
20
23
|
const messages = $derived(readMessages());
|
|
21
24
|
const help = $derived(messages.interactionHelp);
|
|
22
25
|
const id = $props.id();
|
|
26
|
+
let { active = true }: { active?: boolean } = $props();
|
|
23
27
|
let root: HTMLDivElement;
|
|
24
28
|
let focusAnchor = $state<HTMLElement>();
|
|
25
29
|
let button = $state<HTMLButtonElement>(null!);
|
|
26
30
|
let popover: HTMLDivElement;
|
|
27
31
|
let closeButton: HTMLButtonElement;
|
|
28
32
|
let open = $state(false);
|
|
33
|
+
$effect(() => { if (!active) close(); });
|
|
29
34
|
let enhanced = $state(false);
|
|
30
35
|
let visible = false;
|
|
31
36
|
let interacted = $state(false);
|
|
@@ -42,7 +47,7 @@
|
|
|
42
47
|
`--help-tint-opacity: ${(theme.panelTheme.tintOpacity ?? 0.65) * 100}%`,
|
|
43
48
|
`--help-blur: ${Math.min(100, Math.max(0, theme.panelTheme.backdropBlur ?? 8))}px`,
|
|
44
49
|
`--help-shadow: ${getCssPanelBoxShadow(theme.panelTheme.shadowIntensity ?? 0.2)}`,
|
|
45
|
-
`--help-radius: ${
|
|
50
|
+
`--help-radius: ${radii.panel}px`
|
|
46
51
|
].join(';'));
|
|
47
52
|
|
|
48
53
|
function clearDelay() { clearTimeout(delay); delay = undefined; }
|
|
@@ -82,7 +87,7 @@
|
|
|
82
87
|
if (open) window.dispatchEvent(new Event(STAGE_PANEL_LAYOUT_EVENT));
|
|
83
88
|
}
|
|
84
89
|
async function show(keyboard = false) {
|
|
85
|
-
if (!enhanced || (!visible && !fullscreen)) return;
|
|
90
|
+
if (!active || !enhanced || (!visible && !fullscreen)) return;
|
|
86
91
|
clearDelay(); clearHideDelay();
|
|
87
92
|
popover.showPopover();
|
|
88
93
|
open = true;
|
|
@@ -100,7 +105,7 @@
|
|
|
100
105
|
}
|
|
101
106
|
function schedule() {
|
|
102
107
|
clearDelay(); clearHideDelay();
|
|
103
|
-
if (manual || !enhanced || !visible || modelInput.active || touchInput || guidance?.snapshot.interacted) return;
|
|
108
|
+
if (!active || manual || !enhanced || !visible || modelInput.active || touchInput || guidance?.snapshot.interacted) return;
|
|
104
109
|
if (modelInput.hovered) {
|
|
105
110
|
if (!open) delay = setTimeout(() => { void show(); }, 600);
|
|
106
111
|
} else if (open && !helpHovered && !buttonHovered && !popover.contains(document.activeElement)) {
|
|
@@ -119,7 +124,9 @@
|
|
|
119
124
|
if (state.interacted) close();
|
|
120
125
|
});
|
|
121
126
|
const stage = root.closest<HTMLElement>('.stage')!;
|
|
122
|
-
|
|
127
|
+
// The summary shares the detail page with the media but lives in the
|
|
128
|
+
// neighbouring pane body, including the regular single-column layout.
|
|
129
|
+
focusAnchor = root.closest('[data-spatial-element-root]')?.querySelector<HTMLElement>('.spatial-element-panel') ?? undefined;
|
|
123
130
|
// Keep the non-modal help accessible when close-up hides the ordinary DOM layer.
|
|
124
131
|
stage.appendChild(popover);
|
|
125
132
|
// Measure the nearest wide panel above the hero, without relying on a host CSS class.
|
|
@@ -199,14 +206,14 @@
|
|
|
199
206
|
});
|
|
200
207
|
</script>
|
|
201
208
|
|
|
202
|
-
<div bind:this={root} class="model-tools" class:enhanced style={surfaceStyle} data-spatial-element-tools>
|
|
209
|
+
<div bind:this={root} class="model-tools" class:enhanced style={surfaceStyle} style:visibility={active ? undefined : 'hidden'} inert={!active} data-spatial-element-tools data-spatial-model-controls>
|
|
203
210
|
<div class="model-tools-buttons">
|
|
204
|
-
<SpatialIconButton bind:element={button} {focusAnchor} label={messages.controls.help} onclick={toggleHelp} expanded={open} controls={id} enabled={enhanced}>
|
|
211
|
+
<SpatialIconButton bind:element={button} {focusAnchor} label={messages.controls.help} onclick={toggleHelp} expanded={open} controls={id} enabled={enhanced && active}>
|
|
205
212
|
<CircleHelp size={21} strokeWidth={1.8} aria-hidden="true" />
|
|
206
213
|
</SpatialIconButton>
|
|
207
|
-
<SpatialElementViewToggle enabled={enhanced} {focusAnchor} onchange={() => close()} />
|
|
214
|
+
<SpatialElementViewToggle enabled={enhanced && active} {focusAnchor} onchange={() => close()} />
|
|
208
215
|
</div>
|
|
209
|
-
{#if enhanced && touchInput && !interacted && !open && !fullscreen}
|
|
216
|
+
{#if active && enhanced && touchInput && !interacted && !open && !fullscreen}
|
|
210
217
|
<p class="touch-hint" data-spatial-element-touch-hint>{help.touchHint}</p>
|
|
211
218
|
{/if}
|
|
212
219
|
<div bind:this={popover} {id} popover="auto" role="dialog" tabindex="-1" aria-modal="false" aria-labelledby={`${id}-title`}
|
|
@@ -217,7 +224,7 @@
|
|
|
217
224
|
onfocusin={clearHideDelay} onfocusout={() => { queueMicrotask(schedule); }}
|
|
218
225
|
ontoggle={(event) => { open = event.newState === 'open'; if (!open) { manual = false; clearHideDelay(); } }}>
|
|
219
226
|
<Panel class="interaction-help-panel" data-stage-fullscreen-visible nativeContent nativeLayout={position} visible={open} pointerReactive={false} focusReactive={false}
|
|
220
|
-
shape={{ ...theme.panelShape, contentInset: 0 }} theme={theme.panelTheme}>
|
|
227
|
+
shape={{ ...theme.panelShape, radius: radii.panel, contentInset: 0 }} theme={theme.panelTheme}>
|
|
221
228
|
<div class="help-copy">
|
|
222
229
|
<div class="help-heading">
|
|
223
230
|
<h2 id={`${id}-title`}>{help.title}</h2>
|
|
@@ -245,15 +252,15 @@
|
|
|
245
252
|
|
|
246
253
|
<style>
|
|
247
254
|
.model-tools {
|
|
248
|
-
|
|
249
|
-
margin
|
|
255
|
+
position: absolute; top: 0; right: var(--spatial-detail-fit-right);
|
|
256
|
+
margin: 0;
|
|
250
257
|
width: 128px; height: 40px; z-index: 6; visibility: hidden; pointer-events: none;
|
|
251
258
|
}
|
|
252
259
|
.model-tools.enhanced { visibility: visible; pointer-events: auto; }
|
|
253
260
|
.model-tools-buttons { display: flex; gap: 8px; justify-content: flex-end; }
|
|
254
261
|
.touch-hint {
|
|
255
262
|
position: absolute; right: 0; top: 48px; width: max-content; max-width: min(260px, calc(100vw - 48px));
|
|
256
|
-
margin: 0; padding: 8px 12px; border-radius:
|
|
263
|
+
margin: 0; padding: 8px 12px; border-radius: var(--spatial-element-control-radius); font-size: 12px; line-height: 1.45;
|
|
257
264
|
color: var(--spatial-element-ink); pointer-events: none;
|
|
258
265
|
background: color-mix(in srgb, var(--help-tint) var(--help-tint-opacity), transparent);
|
|
259
266
|
backdrop-filter: blur(var(--help-blur)); box-shadow: var(--help-shadow);
|
|
@@ -271,7 +278,7 @@
|
|
|
271
278
|
h2 { margin: 0; font-size: 15px; font-weight: 650; }
|
|
272
279
|
.close-help {
|
|
273
280
|
width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center;
|
|
274
|
-
padding: 0; border: 0; border-radius:
|
|
281
|
+
padding: 0; border: 0; border-radius: var(--spatial-element-control-radius); color: inherit; background: transparent; cursor: pointer;
|
|
275
282
|
}
|
|
276
283
|
.close-help:focus-visible { outline: 2px solid var(--spatial-element-accent); }
|
|
277
284
|
dl { display: grid; gap: 8px; margin: 8px 0 0; }
|
|
@@ -282,5 +289,4 @@
|
|
|
282
289
|
.navigation-hint { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid currentColor; font-size: 12px; }
|
|
283
290
|
.navigation-hint a { color: var(--spatial-element-accent); text-decoration: underline; text-underline-offset: 2px; }
|
|
284
291
|
.navigation-hint a:focus-visible { outline: 2px solid var(--spatial-element-accent); outline-offset: 3px; border-radius: 2px; }
|
|
285
|
-
@media (max-width: 1100px) { .model-tools { margin-inline-end: 0; } }
|
|
286
292
|
</style>
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
active?: boolean;
|
|
3
|
+
};
|
|
4
|
+
declare const SpatialElementHelp: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
2
5
|
type SpatialElementHelp = ReturnType<typeof SpatialElementHelp>;
|
|
3
6
|
export default SpatialElementHelp;
|