@spatial-elements/sveltekit 0.1.0-beta.2 → 1.0.0-beta.11
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/README.md +18 -13
- package/dist/catalog/ScrollNavigationBridge.svelte +172 -47
- package/dist/catalog/ScrollNavigationBridge.svelte.d.ts +9 -2
- package/dist/catalog/catalogNavigation.js +3 -2
- package/dist/catalog/catalogSummaryTransfer.d.ts +16 -0
- package/dist/catalog/catalogSummaryTransfer.js +79 -0
- package/dist/catalog/catalogTransition.css +58 -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 +4 -0
- package/dist/index.js +3 -0
- package/dist/spatial-element/BrandStageShell.svelte +52 -71
- package/dist/spatial-element/BrandStageShell.svelte.d.ts +31 -4
- package/dist/spatial-element/CarouselSpatialElement.svelte +152 -200
- package/dist/spatial-element/CarouselSpatialElement.svelte.d.ts +5 -1
- package/dist/spatial-element/ContentBlock.svelte +7 -0
- package/dist/spatial-element/ContentBlock.svelte.d.ts +9 -0
- package/dist/spatial-element/ContentGrid.svelte +7 -0
- package/dist/spatial-element/ContentGrid.svelte.d.ts +8 -0
- package/dist/spatial-element/ContentPage.svelte +51 -55
- package/dist/spatial-element/ContentPage.svelte.d.ts +14 -3
- package/dist/spatial-element/InteractionGesture.svelte +39 -0
- package/dist/spatial-element/InteractionGesture.svelte.d.ts +7 -0
- package/dist/spatial-element/OverflowControls.svelte +129 -0
- package/dist/spatial-element/OverflowControls.svelte.d.ts +9 -0
- package/dist/spatial-element/PointerHint.svelte +80 -0
- package/dist/spatial-element/PointerHint.svelte.d.ts +3 -0
- package/dist/spatial-element/Section.svelte +25 -106
- package/dist/spatial-element/Section.svelte.d.ts +1 -0
- package/dist/spatial-element/SectionSurfaceGroup.svelte +8 -0
- package/dist/spatial-element/SectionSurfaceGroup.svelte.d.ts +8 -0
- package/dist/spatial-element/SpaceMouseControl.svelte +159 -0
- package/dist/spatial-element/SpaceMouseControl.svelte.d.ts +7 -0
- package/dist/spatial-element/SpaceMouseIcon.svelte +12 -0
- package/dist/spatial-element/SpaceMouseIcon.svelte.d.ts +26 -0
- package/dist/spatial-element/SpatialCardGridSection.svelte +79 -0
- package/dist/spatial-element/SpatialCardGridSection.svelte.d.ts +11 -0
- package/dist/spatial-element/SpatialCardPresentation.svelte +311 -0
- package/dist/spatial-element/SpatialCardPresentation.svelte.d.ts +19 -0
- package/dist/spatial-element/SpatialCardSlot.svelte +33 -0
- package/dist/spatial-element/SpatialCardSlot.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialCarouselSection.svelte +754 -0
- package/dist/spatial-element/{CarouselSection.svelte.d.ts → SpatialCarouselSection.svelte.d.ts} +5 -5
- package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +12 -65
- package/dist/spatial-element/SpatialElementCard.svelte +54 -238
- package/dist/spatial-element/SpatialElementCard.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialElementHelp.svelte +300 -0
- package/dist/spatial-element/SpatialElementHelp.svelte.d.ts +6 -0
- package/dist/spatial-element/SpatialElementMediaRail.svelte +322 -52
- package/dist/spatial-element/SpatialElementMediaRail.svelte.d.ts +4 -1
- package/dist/spatial-element/SpatialElementNativeMedia.svelte +101 -0
- package/dist/spatial-element/SpatialElementNativeMedia.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialElementPage.svelte +156 -71
- package/dist/spatial-element/SpatialElementPage.svelte.d.ts +10 -3
- package/dist/spatial-element/SpatialElementStickyHeader.svelte +89 -105
- package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +6 -1
- package/dist/spatial-element/SpatialElementSummaryContent.svelte +198 -0
- package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +23 -0
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte +48 -380
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte.d.ts +2 -1
- package/dist/spatial-element/SpatialElementTabList.svelte +40 -17
- package/dist/spatial-element/SpatialElementTabList.svelte.d.ts +2 -1
- package/dist/spatial-element/SpatialElementTabs.svelte +61 -18
- package/dist/spatial-element/SpatialElementTabs.svelte.d.ts +3 -1
- package/dist/spatial-element/SpatialElementViewToggle.svelte +54 -0
- package/dist/spatial-element/SpatialElementViewToggle.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialIconButton.svelte +66 -0
- package/dist/spatial-element/SpatialIconButton.svelte.d.ts +17 -0
- package/dist/spatial-element/SpatialListPage.svelte +37 -8
- package/dist/spatial-element/SpatialListPage.svelte.d.ts +4 -1
- package/dist/spatial-element/SpatialMediaIndicator.svelte +16 -0
- package/dist/spatial-element/SpatialMediaIndicator.svelte.d.ts +26 -0
- package/dist/spatial-element/SpatialNavigationShell.svelte +138 -0
- package/dist/spatial-element/SpatialNavigationShell.svelte.d.ts +15 -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 +80 -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/brandContext.d.ts +1 -1
- package/dist/spatial-element/brandContext.js +1 -1
- package/dist/spatial-element/cardAppearanceFreeze.d.ts +5 -0
- package/dist/spatial-element/cardAppearanceFreeze.js +72 -0
- package/dist/spatial-element/carouselTextHit.d.ts +2 -0
- package/dist/spatial-element/carouselTextHit.js +17 -0
- package/dist/spatial-element/contentSidebars.d.ts +3 -0
- package/dist/spatial-element/contentSidebars.js +56 -0
- package/dist/spatial-element/index.d.ts +19 -3
- package/dist/spatial-element/index.js +12 -2
- package/dist/spatial-element/layout.generated.css +363 -0
- package/dist/spatial-element/messagesContext.d.ts +3 -0
- package/dist/spatial-element/messagesContext.js +10 -0
- package/dist/spatial-element/presentationBoxFreeze.d.ts +8 -0
- package/dist/spatial-element/presentationBoxFreeze.js +35 -0
- package/dist/spatial-element/spatialCardGrid.d.ts +12 -0
- package/dist/spatial-element/spatialCardGrid.js +1 -0
- package/dist/spatial-element/spatialPageContext.d.ts +4 -0
- package/dist/spatial-element/spatialPageContext.js +9 -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 +43 -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.d.ts +3 -0
- package/dist/spatial-element/spatialThemeStyle.js +69 -0
- package/dist/spatial-element/truncatedTitle.d.ts +5 -0
- package/dist/spatial-element/truncatedTitle.js +28 -0
- package/dist/stage/ButtonGroup.svelte +152 -0
- package/dist/stage/ButtonGroup.svelte.d.ts +24 -0
- package/dist/stage/Panel.svelte +72 -14
- package/dist/stage/Panel.svelte.d.ts +14 -2
- package/dist/stage/Stage.svelte +471 -51
- package/dist/stage/Stage.svelte.d.ts +8 -1
- package/dist/stage/StageViewport.svelte +15 -2
- package/dist/stage/authoredStyle.d.ts +4 -0
- package/dist/stage/authoredStyle.js +17 -0
- package/dist/stage/buttonGroup.d.ts +9 -0
- package/dist/stage/buttonGroup.js +1 -0
- package/logo.svg +225 -0
- package/package.json +9 -6
- package/dist/spatial-element/CarouselSection.svelte +0 -350
- package/dist/spatial-element/ListSection.svelte +0 -30
- package/dist/spatial-element/ListSection.svelte.d.ts +0 -8
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getContext, onMount } from 'svelte';
|
|
3
|
+
import { STAGE_CONTEXT_KEY, type StageContext } from '@spatial-elements/core/stage/panelContext';
|
|
4
|
+
import SpatialIconButton from './SpatialIconButton.svelte';
|
|
5
|
+
import SpaceMouseIcon from './SpaceMouseIcon.svelte';
|
|
6
|
+
import { useSpatialMessages } from './messagesContext.js';
|
|
7
|
+
|
|
8
|
+
let { focusAnchor, enabled = true }: { focusAnchor?: HTMLElement; enabled?: boolean } = $props();
|
|
9
|
+
const stage = getContext<StageContext>(STAGE_CONTEXT_KEY);
|
|
10
|
+
const readMessages = useSpatialMessages();
|
|
11
|
+
const copy = $derived(readMessages().interactionHelp);
|
|
12
|
+
const connectionState = $derived(stage.getSpaceMouseState?.() ?? 'idle');
|
|
13
|
+
const connected = $derived(connectionState === 'connected');
|
|
14
|
+
const connecting = $derived(connectionState === 'connecting');
|
|
15
|
+
const label = $derived(
|
|
16
|
+
connected
|
|
17
|
+
? copy.spaceMouseConnected
|
|
18
|
+
: connecting
|
|
19
|
+
? copy.spaceMouseConnecting
|
|
20
|
+
: copy.spaceMouseTitle
|
|
21
|
+
);
|
|
22
|
+
const id = $props.id();
|
|
23
|
+
let dialog: HTMLDialogElement;
|
|
24
|
+
let toast: HTMLDivElement;
|
|
25
|
+
let failure = $state<'permission-required' | 'unavailable'>('unavailable');
|
|
26
|
+
let requested = $state(false);
|
|
27
|
+
let toastTimer: ReturnType<typeof setTimeout> | undefined;
|
|
28
|
+
|
|
29
|
+
function connect() {
|
|
30
|
+
dialog.close();
|
|
31
|
+
requested = true;
|
|
32
|
+
stage.setSpaceMouseEnabled?.(true);
|
|
33
|
+
}
|
|
34
|
+
function toggle() {
|
|
35
|
+
if (connected || connecting) {
|
|
36
|
+
requested = false;
|
|
37
|
+
toast.hidePopover();
|
|
38
|
+
stage.setSpaceMouseEnabled?.(false);
|
|
39
|
+
} else connect();
|
|
40
|
+
}
|
|
41
|
+
$effect(() => {
|
|
42
|
+
if (!requested) return;
|
|
43
|
+
if (connectionState === 'connected') {
|
|
44
|
+
requested = false;
|
|
45
|
+
toast.showPopover();
|
|
46
|
+
clearTimeout(toastTimer);
|
|
47
|
+
toastTimer = setTimeout(() => toast.hidePopover(), 3500);
|
|
48
|
+
} else if (connectionState === 'permission-required' || connectionState === 'unavailable') {
|
|
49
|
+
requested = false;
|
|
50
|
+
failure = connectionState;
|
|
51
|
+
dialog.showModal();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
$effect(() => {
|
|
55
|
+
if (!enabled) {
|
|
56
|
+
requested = false;
|
|
57
|
+
dialog?.close();
|
|
58
|
+
toast?.hidePopover();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
onMount(() => () => {
|
|
62
|
+
clearTimeout(toastTimer);
|
|
63
|
+
dialog.close();
|
|
64
|
+
toast.hidePopover();
|
|
65
|
+
});
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<SpatialIconButton
|
|
69
|
+
{label}
|
|
70
|
+
{focusAnchor}
|
|
71
|
+
{enabled}
|
|
72
|
+
pressed={connected}
|
|
73
|
+
busy={connecting}
|
|
74
|
+
onclick={toggle}
|
|
75
|
+
>
|
|
76
|
+
<SpaceMouseIcon />
|
|
77
|
+
</SpatialIconButton>
|
|
78
|
+
<dialog bind:this={dialog} aria-labelledby={`${id}-title`} aria-describedby={`${id}-description`}>
|
|
79
|
+
<h2 id={`${id}-title`}>
|
|
80
|
+
{failure === 'permission-required'
|
|
81
|
+
? copy.spaceMousePermissionTitle
|
|
82
|
+
: copy.spaceMouseUnavailableTitle}
|
|
83
|
+
</h2>
|
|
84
|
+
<p id={`${id}-description`}>
|
|
85
|
+
{failure === 'permission-required' ? copy.spaceMousePermission : copy.spaceMouseUnavailable}
|
|
86
|
+
</p>
|
|
87
|
+
{#if failure === 'permission-required'}
|
|
88
|
+
<p>{copy.spaceMouseDenied}</p>
|
|
89
|
+
{:else}
|
|
90
|
+
<p>
|
|
91
|
+
<a href="https://3dconnexion.com/" target="_blank" rel="noopener noreferrer"
|
|
92
|
+
>{copy.spaceMouseDiscover}</a
|
|
93
|
+
>
|
|
94
|
+
</p>
|
|
95
|
+
{/if}
|
|
96
|
+
<div class="actions">
|
|
97
|
+
<button type="button" onclick={() => dialog.close()}>{copy.spaceMouseClose}</button>
|
|
98
|
+
{#if failure === 'permission-required'}<button type="button" onclick={connect}
|
|
99
|
+
>{copy.spaceMouseConfirm}</button
|
|
100
|
+
>{/if}
|
|
101
|
+
</div>
|
|
102
|
+
</dialog>
|
|
103
|
+
<div bind:this={toast} popover="manual" role="status" class="connection-toast">
|
|
104
|
+
{copy.spaceMouseReady}
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<style>
|
|
108
|
+
dialog,
|
|
109
|
+
.connection-toast {
|
|
110
|
+
box-sizing: border-box;
|
|
111
|
+
padding: 24px;
|
|
112
|
+
border: 1px solid color-mix(in srgb, var(--spatial-element-ink) 15%, transparent);
|
|
113
|
+
border-radius: var(--spatial-element-panel-radius, 12px);
|
|
114
|
+
color: var(--spatial-element-ink);
|
|
115
|
+
background: var(--ps-section-standard, var(--ps-background, #fff));
|
|
116
|
+
font: inherit;
|
|
117
|
+
box-shadow: 0 8px 32px #0003;
|
|
118
|
+
max-width: min(440px, calc(100vw - 32px));
|
|
119
|
+
}
|
|
120
|
+
dialog::backdrop {
|
|
121
|
+
background: #0006;
|
|
122
|
+
}
|
|
123
|
+
h2 {
|
|
124
|
+
margin: 0 0 12px;
|
|
125
|
+
font-size: 20px;
|
|
126
|
+
}
|
|
127
|
+
p {
|
|
128
|
+
line-height: 1.5;
|
|
129
|
+
}
|
|
130
|
+
a {
|
|
131
|
+
color: var(--spatial-element-accent);
|
|
132
|
+
}
|
|
133
|
+
.actions {
|
|
134
|
+
display: flex;
|
|
135
|
+
justify-content: flex-end;
|
|
136
|
+
gap: 12px;
|
|
137
|
+
}
|
|
138
|
+
button {
|
|
139
|
+
padding: 10px 16px;
|
|
140
|
+
border: 1px solid currentColor;
|
|
141
|
+
border-radius: var(--spatial-element-control-radius);
|
|
142
|
+
background: transparent;
|
|
143
|
+
color: var(--spatial-element-accent);
|
|
144
|
+
font: inherit;
|
|
145
|
+
cursor: pointer;
|
|
146
|
+
}
|
|
147
|
+
button:focus-visible,
|
|
148
|
+
a:focus-visible {
|
|
149
|
+
outline: 2px solid var(--spatial-element-accent);
|
|
150
|
+
outline-offset: 3px;
|
|
151
|
+
}
|
|
152
|
+
.connection-toast {
|
|
153
|
+
position: fixed;
|
|
154
|
+
inset: auto 16px 24px auto;
|
|
155
|
+
margin: 0;
|
|
156
|
+
padding: 12px 20px;
|
|
157
|
+
pointer-events: none;
|
|
158
|
+
}
|
|
159
|
+
</style>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
focusAnchor?: HTMLElement;
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare const SpaceMouseControl: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
+
type SpaceMouseControl = ReturnType<typeof SpaceMouseControl>;
|
|
7
|
+
export default SpaceMouseControl;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
+
width="24"
|
|
4
|
+
height="24"
|
|
5
|
+
viewBox="0 0 583.92242 514.26245"
|
|
6
|
+
fill="currentColor"
|
|
7
|
+
aria-hidden="true"
|
|
8
|
+
>
|
|
9
|
+
<g transform="translate(-296.70282,-553.67371)">
|
|
10
|
+
<path d="m 554.50876,1067.6884 c -93.63185,-2.4763 -146.89661,-15.1443 -196.80245,-38.3441 -7.90309,-3.6739 -27.52684,-14.2376 -35.3451,-20.7389 -4.95526,-4.1206 -14.71558,-18.74412 -17.55026,-24.37032 -5.92473,-11.7593 -9.3009,-29.15544 -7.71932,-46.08693 2.36538,-25.32251 6.44223,-53.71222 18.92407,-78.71134 9.73392,-19.49545 20.41716,-34.58715 34.37139,-49.07913 10.5443,-10.95065 10.69779,-8.84994 21.69314,-30.19782 12.47546,-24.22156 15.81707,-30.34236 21.53714,-46.8922 7.3483,-21.26079 8.32574,-24.71626 8.27719,-46.66914 -0.037,-16.72496 -0.49572,-22.4716 -3.22349,-40.38116 -3.62645,-23.80995 -2.97533,-29.43781 -0.88867,-36.46437 6.5133,-21.93265 43.21203,-41.8034 96.59305,-49.75993 63.22017,-9.42308 150.55274,-8.19971 204.88476,2.94671 20.34811,4.17449 37.59715,12.05695 51.3195,18.78692 8.69396,4.26386 12.60226,9.57588 18.88783,15.85633 12.25097,12.24102 15.62703,20.71188 10.36093,49.50345 -4.28226,23.412 -5.50427,34.51885 -4.84541,50.95065 1.06092,26.45901 9.3427,42.53016 26.7819,79.11957 5.80302,12.1754 9.0665,20.24676 12.40184,25.44166 1.95606,3.04663 3.54243,5.62169 7.19828,10.81369 28.09231,34.17855 56.62782,78.7844 58.98322,124.68648 1.3425,26.16237 -1.80727,47.24235 -18.09957,62.78268 -7.6188,7.267 -34.86364,27.4573 -46.99304,32.9935 -29.7177,13.5642 -74.87319,24.4254 -117.64816,28.9585 -35.67214,3.7804 -105.54271,5.8484 -143.09877,4.8552 z m 90.69755,-38.0949 c 70.82211,-4.1061 118.77643,-13.1562 155.09299,-29.2696 21.33,-9.46391 37.8697,-22.38891 43.9127,-34.31581 2.9678,-5.8573 2.9942,-6.0556 2.983,-22.40957 -0.01,-13.58453 -0.4224,-18.3459 -2.3384,-26.94685 -2.3199,-10.41466 -9.2648,-27.56768 -10.9016,-29.20445 -0.4826,-0.48264 -4.29247,5.29345 -10.13987,9.17095 -29.9304,19.84723 -83.01812,34.12709 -152.10882,41.51302 -32.49802,3.47411 -112.52172,5.58253 -151.04609,3.31354 -75.70697,-4.45897 -138.88983,-23.56148 -169.55491,-47.55525 -3.90755,-3.05745 -7.64708,-6.58224 -7.84719,-6.38213 -0.8514,0.85141 -6.39699,13.16119 -8.32201,19.59117 -4.91445,16.41534 -7.25836,38.47752 -5.25225,49.43697 1.64962,9.012 4.79609,14.5195 12.69442,22.2201 28.73775,28.01821 93.93343,45.97661 184.32803,50.77381 21.65526,1.1493 99.06135,1.1911 118.5,0.064 z m 13.50323,-118.93733 c 66.25435,-5.40349 110.85716,-15.87706 144.99676,-34.04792 7.822,-4.16328 18.4492,-14.39664 17.5053,-16.85657 -1.2386,-3.22803 -9.7907,-15.02599 -13.5602,-18.70678 l -3.8275,-3.73745 -5.2156,4.68931 c -17.8432,16.04255 -61.14455,29.20966 -116.90199,35.54766 -32.68241,3.71503 -40.74089,5.52674 -84.27469,6.10276 -85.11311,1.12619 -133.3187,-5.59297 -178.0884,-21.0407 -18.21254,-6.28421 -30.36824,-12.93498 -39.84774,-21.80194 l -5.0238,-4.69918 -3.47374,3.99658 c -3.98669,4.58674 -14.29163,18.97702 -14.29163,19.95748 0,2.11283 7.6121,9.47996 14.5,14.03338 10.85483,7.17586 20.15195,11.68977 33.64754,16.33644 37.58018,12.93924 85.59881,20.47138 143.85246,22.5645 24.84493,0.8927 86.44606,-0.41632 110.00323,-2.33757 z m -15.00323,-61.14426 c 38.44955,-3.47429 59.23004,-4.62776 83.05247,-10.45744 35.05906,-8.57943 56.94752,-15.0978 56.94752,-26.37364 0,-3.77132 -1.4615,-6.77743 -8.7331,-17.96221 -29.81029,-45.85289 -38.52647,-80.88959 -32.11078,-129.07679 0.66049,-4.96081 0.95768,0.73715 0.66043,0.43989 -0.29726,-0.29725 -4.09008,0.82734 -8.4285,2.49908 -30.96294,11.93111 -72.03027,17.90377 -134.88804,19.61756 -32.99059,0.89947 -80.16875,-1.59543 -107,-5.65844 -21.28658,-3.22339 -40.67307,-8.24791 -52.34294,-13.56604 -4.10531,-1.87085 -7.64259,-3.22316 -7.86061,-3.00514 -0.21803,0.21803 0.11941,-2.85998 0.74985,5.3822 1.92899,25.2187 -1.1048,48.62117 -9.56029,73.74758 -5.53968,16.46177 -12.6948,32.69141 -21.16164,48 -5.42984,9.81751 -6.71998,12.47816 -7.09359,17.10042 -0.44456,5.50002 3.63006,6.09288 8.41974,9.99466 8.4948,6.92005 22.92895,12.35681 41.95683,17.60119 29.25057,8.06192 52.38104,11.51515 89.89265,13.90721 23.06044,1.47052 89.15096,-0.53208 107.5,-2.19009 z m -194.5,-39.70054 c -3.64277,-0.74189 -7.5,-5.30401 -7.5,-8.87058 0,-1.80596 2.01373,-9.48427 4.47496,-17.06291 6.73739,-20.74588 11.52504,-47.64223 11.52504,-64.7461 0,-13.77713 2.57089,-18.53326 10.01799,-18.53326 8.64078,0 15.37711,4.25797 15.37711,17.94526 0,13.66799 -1.26717,33.00559 -3.5596,44.43435 -3.50968,17.4972 -12.0748,41.64092 -16.12242,44.96179 -2.07803,1.70492 -11.71298,2.38062 -14.21308,1.87145 z m 266.70408,-1.78246 c -4.8138,-3.37172 -12.4686,-23.53165 -16.73901,-44.08443 -2.13811,-10.29035 -2.77647,-16.64339 -3.20876,-31.93401 -0.60771,-21.49525 -0.14435,-25.61482 3.26451,-29.02368 3.65917,-3.65917 12.94024,-3.92811 16.26115,0.0186 2.24429,2.66718 3.9192,4.10941 4.45644,14.75 1.49052,29.52084 4.50334,48.8841 12.24616,69.5536 4.56098,12.17555 2.94134,16.74601 -1.50845,20.24622 -3.15846,2.48444 -11.55363,2.72798 -14.77204,0.47372 z M 640.20631,652.02656 c 38.14469,-3.0218 61.92896,-7.58298 84.6279,-16.22932 8.91632,-3.39635 19.20802,-9.41252 21.36167,-12.4873 5.33323,-7.61424 -4.11685,-15.5743 -27.98957,-23.57639 -30.48608,-10.21887 -71.881,-15.08883 -128.51707,-15.11956 -31.99271,-0.0174 -52.93487,1.08506 -76.48293,4.02614 -50.09323,6.25648 -87.0664,20.64883 -82.59726,32.15219 2.1636,5.56899 12.24618,11.77731 27.99203,17.236 40.35152,13.98886 112.00482,19.51194 181.60523,13.99824 z" />
|
|
11
|
+
</g>
|
|
12
|
+
</svg>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default SpaceMouseIcon;
|
|
2
|
+
type SpaceMouseIcon = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const SpaceMouseIcon: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { retainListDeviceOrientation } from '@spatial-elements/core/catalog/listDeviceOrientation';
|
|
3
|
+
import Section from './Section.svelte';
|
|
4
|
+
import { ContentGrid, ContentBlock } from '@page-sections/svelte';
|
|
5
|
+
import type { SpatialCardGridOptions } from './spatialCardGrid.js';
|
|
6
|
+
import SpatialElementCard from './SpatialElementCard.svelte';
|
|
7
|
+
import type {
|
|
8
|
+
SpatialListItem,
|
|
9
|
+
SpatialElementSectionDefinition
|
|
10
|
+
} from '@spatial-elements/core/spatial-element/types';
|
|
11
|
+
interface Props extends SpatialCardGridOptions {
|
|
12
|
+
/** Unique page-local anchor, heading and optional CSS appearance overrides. */
|
|
13
|
+
section: SpatialElementSectionDefinition;
|
|
14
|
+
/** Project element documents with getSpatialListItems; assets register automatically. */
|
|
15
|
+
list: SpatialListItem[];
|
|
16
|
+
}
|
|
17
|
+
let {
|
|
18
|
+
section,
|
|
19
|
+
list,
|
|
20
|
+
cardSize = 'm',
|
|
21
|
+
cardVariant = 'catalog',
|
|
22
|
+
itemSpan = { xs: 4, s: 3, m: 4, l: 4 },
|
|
23
|
+
textAlign = 'start',
|
|
24
|
+
mediaAspect = '1/1',
|
|
25
|
+
mediaFit = cardVariant === 'catalog' ? 'contain' : 'cover',
|
|
26
|
+
cardTone = 'standard'
|
|
27
|
+
}: Props = $props();
|
|
28
|
+
const reserveEyebrow = $derived(
|
|
29
|
+
(cardVariant !== 'catalog' || cardSize !== 's') &&
|
|
30
|
+
list.some((item) => Boolean(item.eyebrow?.trim()))
|
|
31
|
+
);
|
|
32
|
+
let catalog: HTMLDivElement;
|
|
33
|
+
$effect(() => {
|
|
34
|
+
if (catalog)
|
|
35
|
+
return retainListDeviceOrientation(catalog.querySelector<HTMLElement>('.catalog')!, () => {});
|
|
36
|
+
});
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<Section {section} presentation="list">
|
|
40
|
+
<div bind:this={catalog} style="display: contents">
|
|
41
|
+
<ContentGrid
|
|
42
|
+
class="catalog"
|
|
43
|
+
data-device-orientation=""
|
|
44
|
+
data-card-size={cardSize}
|
|
45
|
+
data-card-text-align={textAlign}
|
|
46
|
+
>
|
|
47
|
+
{#each list as spatialElement, index (spatialElement.itemKey ?? spatialElement.id)}
|
|
48
|
+
{#snippet card()}<SpatialElementCard
|
|
49
|
+
{spatialElement}
|
|
50
|
+
{cardSize}
|
|
51
|
+
{cardVariant}
|
|
52
|
+
{textAlign}
|
|
53
|
+
{mediaAspect}
|
|
54
|
+
{mediaFit}
|
|
55
|
+
{reserveEyebrow}
|
|
56
|
+
{cardTone}
|
|
57
|
+
order={index}
|
|
58
|
+
occurrence={JSON.stringify([section.id, spatialElement.itemKey ?? spatialElement.id])}
|
|
59
|
+
/>{/snippet}
|
|
60
|
+
{#if cardVariant === 'editorial'}<ContentBlock span={itemSpan}
|
|
61
|
+
>{@render card()}</ContentBlock
|
|
62
|
+
>
|
|
63
|
+
{:else}{@render card()}{/if}
|
|
64
|
+
{/each}
|
|
65
|
+
</ContentGrid>
|
|
66
|
+
</div>
|
|
67
|
+
</Section>
|
|
68
|
+
|
|
69
|
+
<style>
|
|
70
|
+
:global(.catalog > .ps-content-block) {
|
|
71
|
+
align-self: stretch;
|
|
72
|
+
display: grid;
|
|
73
|
+
}
|
|
74
|
+
:global(.catalog) {
|
|
75
|
+
align-items: stretch;
|
|
76
|
+
grid-auto-rows: 1fr;
|
|
77
|
+
pointer-events: auto;
|
|
78
|
+
}
|
|
79
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SpatialCardGridOptions } from './spatialCardGrid.js';
|
|
2
|
+
import type { SpatialListItem, SpatialElementSectionDefinition } from '@spatial-elements/core/spatial-element/types';
|
|
3
|
+
interface Props extends SpatialCardGridOptions {
|
|
4
|
+
/** Unique page-local anchor, heading and optional CSS appearance overrides. */
|
|
5
|
+
section: SpatialElementSectionDefinition;
|
|
6
|
+
/** Project element documents with getSpatialListItems; assets register automatically. */
|
|
7
|
+
list: SpatialListItem[];
|
|
8
|
+
}
|
|
9
|
+
declare const SpatialCardGridSection: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type SpatialCardGridSection = ReturnType<typeof SpatialCardGridSection>;
|
|
11
|
+
export default SpatialCardGridSection;
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getContext } from 'svelte';
|
|
3
|
+
import { Card, type CardElements } from '@page-sections/svelte';
|
|
4
|
+
import type {
|
|
5
|
+
CardMediaAspect,
|
|
6
|
+
CardMediaFit,
|
|
7
|
+
CardVariant,
|
|
8
|
+
SurfaceTone
|
|
9
|
+
} from '@page-sections/core';
|
|
10
|
+
import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
|
|
11
|
+
import { catalogViewLink } from '@spatial-elements/core/catalog/catalogViewLink';
|
|
12
|
+
import {
|
|
13
|
+
CATALOG_ENDPOINTS,
|
|
14
|
+
type CatalogEndpointRegistry,
|
|
15
|
+
type CatalogEndpointRole
|
|
16
|
+
} from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
|
|
17
|
+
import {
|
|
18
|
+
CATALOG_SECTIONS,
|
|
19
|
+
type CatalogSections
|
|
20
|
+
} from '@spatial-elements/core/catalog/CatalogSections';
|
|
21
|
+
import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
|
|
22
|
+
import type { SpatialCardSize } from '@spatial-elements/core/spatial-element/responsiveLayout';
|
|
23
|
+
import { useSpatialTheme } from './brandContext.js';
|
|
24
|
+
import { useCatalogNavigation } from '../catalog/catalogNavigation.js';
|
|
25
|
+
import { truncatedTitle } from './truncatedTitle.js';
|
|
26
|
+
let {
|
|
27
|
+
spatialElement,
|
|
28
|
+
occurrence,
|
|
29
|
+
order = 0,
|
|
30
|
+
cardSize = 'm',
|
|
31
|
+
textAlign = 'start',
|
|
32
|
+
active = true,
|
|
33
|
+
mediaAspect = '1/1',
|
|
34
|
+
mediaFit = 'contain',
|
|
35
|
+
reserveEyebrow = false,
|
|
36
|
+
cardTone = 'standard',
|
|
37
|
+
cardVariant = 'catalog'
|
|
38
|
+
}: {
|
|
39
|
+
spatialElement: SpatialListItem;
|
|
40
|
+
occurrence: string;
|
|
41
|
+
order?: number;
|
|
42
|
+
cardSize?: SpatialCardSize;
|
|
43
|
+
textAlign?: 'start' | 'center';
|
|
44
|
+
active?: boolean;
|
|
45
|
+
mediaAspect?: CardMediaAspect;
|
|
46
|
+
mediaFit?: CardMediaFit;
|
|
47
|
+
reserveEyebrow?: boolean;
|
|
48
|
+
cardTone?: SurfaceTone;
|
|
49
|
+
cardVariant?: CardVariant;
|
|
50
|
+
} = $props();
|
|
51
|
+
const readTheme = useSpatialTheme();
|
|
52
|
+
const brand = $derived(readTheme());
|
|
53
|
+
const endpoints = getContext<CatalogEndpointRegistry | undefined>(CATALOG_ENDPOINTS);
|
|
54
|
+
const sections = getContext<CatalogSections | undefined>(CATALOG_SECTIONS);
|
|
55
|
+
const { href, prepare, pending } = useCatalogNavigation();
|
|
56
|
+
const item = $derived({ ...spatialElement, href: href(spatialElement.href) });
|
|
57
|
+
let busy = $state(false);
|
|
58
|
+
$effect(() => {
|
|
59
|
+
const target = pending();
|
|
60
|
+
busy = false;
|
|
61
|
+
if (
|
|
62
|
+
!active ||
|
|
63
|
+
!target ||
|
|
64
|
+
new URL(href(spatialElement.href), target).pathname !== target.pathname
|
|
65
|
+
)
|
|
66
|
+
return;
|
|
67
|
+
const timer = setTimeout(() => {
|
|
68
|
+
busy = true;
|
|
69
|
+
}, 150);
|
|
70
|
+
return () => clearTimeout(timer);
|
|
71
|
+
});
|
|
72
|
+
// Resizing keeps the same endpoints: spatial measurement uses the actual media rectangle.
|
|
73
|
+
const ready = $derived.by(() => {
|
|
74
|
+
void reserveEyebrow;
|
|
75
|
+
void cardSize;
|
|
76
|
+
void cardVariant;
|
|
77
|
+
const enabled = active,
|
|
78
|
+
themeId = brand.id,
|
|
79
|
+
current = spatialElement,
|
|
80
|
+
key = occurrence;
|
|
81
|
+
return (parts: CardElements) => {
|
|
82
|
+
const cleanups: (() => void)[] = [];
|
|
83
|
+
const bind = (node: HTMLElement | null, role: CatalogEndpointRole, className?: string) => {
|
|
84
|
+
if (!node) return;
|
|
85
|
+
if (className) node.classList.add(className);
|
|
86
|
+
node.dataset.spatialElementId = current.id;
|
|
87
|
+
if (role !== 'container' && role !== 'geometry') node.dataset.sharedRole = role;
|
|
88
|
+
if (enabled) {
|
|
89
|
+
const stop = endpoints?.register(
|
|
90
|
+
{
|
|
91
|
+
brandId: themeId,
|
|
92
|
+
spatialElementId: current.id,
|
|
93
|
+
slot: 'catalog.card',
|
|
94
|
+
occurrence: key,
|
|
95
|
+
role
|
|
96
|
+
},
|
|
97
|
+
node
|
|
98
|
+
);
|
|
99
|
+
if (stop) cleanups.push(stop);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
bind(parts.root, 'container');
|
|
103
|
+
bind(parts.surface, 'summary-surface', 'spatial-element-card-surface');
|
|
104
|
+
bind(parts.media, 'geometry', 'spatial-element-card-geometry');
|
|
105
|
+
bind(parts.title, 'title');
|
|
106
|
+
bind(
|
|
107
|
+
parts.copy.querySelector('[data-ps-card-part="eyebrow"]'),
|
|
108
|
+
'eyebrow',
|
|
109
|
+
'spatial-element-card-eyebrow'
|
|
110
|
+
);
|
|
111
|
+
parts.copy.classList.add('spatial-element-card-copy');
|
|
112
|
+
parts.media.dataset.catalogGeometry = '';
|
|
113
|
+
parts.media.dataset.catalogOccurrence = key;
|
|
114
|
+
parts.media.dataset.catalogSlot = 'catalog.card';
|
|
115
|
+
cleanups.push(mouseHover(parts.root).destroy);
|
|
116
|
+
const link = parts.root.matches('a')
|
|
117
|
+
? (parts.root as HTMLAnchorElement)
|
|
118
|
+
: parts.title.querySelector('a');
|
|
119
|
+
if (link) {
|
|
120
|
+
link.dataset.catalogFocusKey = 'catalog:' + JSON.stringify([themeId, current.id, key]);
|
|
121
|
+
cleanups.push(
|
|
122
|
+
catalogViewLink(link, {
|
|
123
|
+
spatialElementId: current.id,
|
|
124
|
+
targetPresentation: current.targetPresentation
|
|
125
|
+
}).destroy
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
parts.title.removeAttribute('title');
|
|
129
|
+
cleanups.push(truncatedTitle(parts.title, current.title).destroy);
|
|
130
|
+
return () => cleanups.reverse().forEach((stop) => stop());
|
|
131
|
+
};
|
|
132
|
+
});
|
|
133
|
+
function activate(event: MouseEvent) {
|
|
134
|
+
if (!active) {
|
|
135
|
+
event.preventDefault();
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
endpoints?.prefer(brand.id, spatialElement.id, occurrence);
|
|
139
|
+
sections?.activate({
|
|
140
|
+
brandId: brand.id,
|
|
141
|
+
spatialElementId: spatialElement.id,
|
|
142
|
+
occurrence,
|
|
143
|
+
slot: 'catalog.card'
|
|
144
|
+
});
|
|
145
|
+
const link = (event.target as HTMLElement).closest('a');
|
|
146
|
+
link?.focus({ preventScroll: true });
|
|
147
|
+
}
|
|
148
|
+
</script>
|
|
149
|
+
|
|
150
|
+
<Card
|
|
151
|
+
{item}
|
|
152
|
+
{cardSize}
|
|
153
|
+
{textAlign}
|
|
154
|
+
{mediaAspect}
|
|
155
|
+
{mediaFit}
|
|
156
|
+
{reserveEyebrow}
|
|
157
|
+
tone={cardTone}
|
|
158
|
+
variant={cardVariant}
|
|
159
|
+
headingLevel={3}
|
|
160
|
+
class="spatial-element-card"
|
|
161
|
+
onready={ready}
|
|
162
|
+
data-card-size={cardSize}
|
|
163
|
+
data-catalog-card
|
|
164
|
+
data-catalog-order={order}
|
|
165
|
+
data-catalog-occurrence={occurrence}
|
|
166
|
+
data-spatial-element-id={spatialElement.id}
|
|
167
|
+
data-catalog-focus-key={cardVariant === 'catalog'
|
|
168
|
+
? `catalog:${JSON.stringify([brand.id, spatialElement.id, occurrence])}`
|
|
169
|
+
: undefined}
|
|
170
|
+
aria-busy={busy || undefined}
|
|
171
|
+
onclick={activate}
|
|
172
|
+
onpointerenter={() => {
|
|
173
|
+
if (active) prepare(spatialElement);
|
|
174
|
+
}}
|
|
175
|
+
onpointerdown={() => {
|
|
176
|
+
if (active) prepare(spatialElement);
|
|
177
|
+
}}
|
|
178
|
+
onfocus={(event) => {
|
|
179
|
+
if (
|
|
180
|
+
active &&
|
|
181
|
+
!(event.currentTarget as HTMLElement).hasAttribute('data-catalog-restoring-focus')
|
|
182
|
+
)
|
|
183
|
+
prepare(spatialElement);
|
|
184
|
+
}}
|
|
185
|
+
>
|
|
186
|
+
{#snippet media()}
|
|
187
|
+
{#if spatialElement.fallbackImage}<img
|
|
188
|
+
class="catalog-poster"
|
|
189
|
+
data-catalog-poster
|
|
190
|
+
loading="lazy"
|
|
191
|
+
decoding="async"
|
|
192
|
+
src={spatialElement.fallbackImage}
|
|
193
|
+
alt=""
|
|
194
|
+
/>{/if}
|
|
195
|
+
{#if busy}<span class="catalog-loading" aria-hidden="true"></span>{/if}
|
|
196
|
+
{/snippet}
|
|
197
|
+
</Card>
|
|
198
|
+
<span class="catalog-status" role="status">{busy ? 'Opening spatial element…' : ''}</span>
|
|
199
|
+
|
|
200
|
+
<style>
|
|
201
|
+
:global(.ps-card.spatial-element-card[data-catalog-card]) {
|
|
202
|
+
isolation: auto;
|
|
203
|
+
--ps-radius: var(--spatial-element-control-radius);
|
|
204
|
+
pointer-events: auto;
|
|
205
|
+
transform-origin: center;
|
|
206
|
+
transform-style: preserve-3d;
|
|
207
|
+
transform: perspective(1000px) translate3d(0, var(--catalog-lift, 0px), 0)
|
|
208
|
+
rotateX(var(--catalog-rotate-x, 0deg)) rotateY(var(--catalog-rotate-y, 0deg));
|
|
209
|
+
}
|
|
210
|
+
:global(.ps-card.spatial-element-card[data-catalog-card] [data-ps-card-part='media-frame']) {
|
|
211
|
+
overflow: visible;
|
|
212
|
+
}
|
|
213
|
+
:global(.ps-card.spatial-element-card[data-catalog-card] [data-ps-card-part='media']),
|
|
214
|
+
:global(.ps-card.spatial-element-card[data-catalog-card] [data-ps-card-part='copy']) {
|
|
215
|
+
transform-style: preserve-3d;
|
|
216
|
+
}
|
|
217
|
+
:global(.ps-card.spatial-element-card[data-catalog-card] [data-ps-card-part='surface']) {
|
|
218
|
+
box-shadow: 0 12px 32px rgb(0 0 0 / 6%);
|
|
219
|
+
transition: border-color 180ms ease;
|
|
220
|
+
}
|
|
221
|
+
:global(
|
|
222
|
+
.ps-card.spatial-element-card[data-catalog-card]:is([data-mouse-hover], :focus-visible)
|
|
223
|
+
[data-ps-card-part='surface']
|
|
224
|
+
) {
|
|
225
|
+
border-color: var(--ps-accent);
|
|
226
|
+
}
|
|
227
|
+
:global(.ps-card.spatial-element-card[data-catalog-card] [data-ps-card-part='surface']::after) {
|
|
228
|
+
content: '';
|
|
229
|
+
position: absolute;
|
|
230
|
+
inset: -1px;
|
|
231
|
+
border-radius: inherit;
|
|
232
|
+
box-shadow:
|
|
233
|
+
0 0 0 1px color-mix(in srgb, var(--ps-accent) 25%, transparent),
|
|
234
|
+
0 0 18px color-mix(in srgb, var(--ps-accent) 18%, transparent);
|
|
235
|
+
opacity: 0;
|
|
236
|
+
transition: opacity 180ms ease;
|
|
237
|
+
}
|
|
238
|
+
:global(
|
|
239
|
+
.ps-card.spatial-element-card[data-catalog-card]:is([data-mouse-hover], :focus-visible)
|
|
240
|
+
[data-ps-card-part='surface']::after
|
|
241
|
+
) {
|
|
242
|
+
opacity: 1;
|
|
243
|
+
}
|
|
244
|
+
:global([data-spatial-card-appearance-frozen]::after) {
|
|
245
|
+
opacity: var(--spatial-card-frozen-after-opacity) !important;
|
|
246
|
+
transition-property: none !important;
|
|
247
|
+
}
|
|
248
|
+
:global(.ps-card.spatial-element-card[data-catalog-card] [data-ps-card-part='title']) {
|
|
249
|
+
transform: translateZ(var(--card-title-depth, 0px));
|
|
250
|
+
}
|
|
251
|
+
:global(.ps-card.spatial-element-card[data-catalog-card] [data-ps-card-part='eyebrow']) {
|
|
252
|
+
transform: translateZ(var(--card-eyebrow-depth, 0px));
|
|
253
|
+
}
|
|
254
|
+
:global(.ps-card.spatial-element-card[data-catalog-card] [data-shared-role='title']),
|
|
255
|
+
:global(.ps-card.spatial-element-card[data-catalog-card] [data-shared-role='eyebrow']) {
|
|
256
|
+
text-shadow: var(--card-text-shadow, 0 0 0 transparent);
|
|
257
|
+
transition:
|
|
258
|
+
transform 260ms ease,
|
|
259
|
+
text-shadow 260ms ease;
|
|
260
|
+
}
|
|
261
|
+
:global(.ps-card.spatial-element-card[data-catalog-card]:is([data-mouse-hover], :focus-visible)) {
|
|
262
|
+
--card-eyebrow-depth: 40px;
|
|
263
|
+
--card-title-depth: 64px;
|
|
264
|
+
--card-model-depth: 96px;
|
|
265
|
+
--card-model-scale: 1.12;
|
|
266
|
+
--card-text-shadow: 0 4px 10px rgb(0 0 0 / 16%);
|
|
267
|
+
}
|
|
268
|
+
.catalog-poster {
|
|
269
|
+
display: block;
|
|
270
|
+
transform: translateZ(var(--card-model-depth, 0px)) scale(var(--card-model-scale, 1));
|
|
271
|
+
transition:
|
|
272
|
+
transform 260ms ease,
|
|
273
|
+
opacity 240ms ease;
|
|
274
|
+
}
|
|
275
|
+
:global([data-catalog-model-ready]) .catalog-poster,
|
|
276
|
+
:global([data-spatial-presentation-model-ready]) .catalog-poster {
|
|
277
|
+
opacity: 0;
|
|
278
|
+
}
|
|
279
|
+
.catalog-loading {
|
|
280
|
+
position: absolute;
|
|
281
|
+
right: 14px;
|
|
282
|
+
top: 14px;
|
|
283
|
+
width: 18px;
|
|
284
|
+
height: 18px;
|
|
285
|
+
border: 2px solid var(--ps-border);
|
|
286
|
+
border-top-color: var(--ps-accent);
|
|
287
|
+
border-radius: 50%;
|
|
288
|
+
animation: spin 0.8s linear infinite;
|
|
289
|
+
}
|
|
290
|
+
.catalog-status {
|
|
291
|
+
position: absolute;
|
|
292
|
+
width: 1px;
|
|
293
|
+
height: 1px;
|
|
294
|
+
overflow: hidden;
|
|
295
|
+
clip-path: inset(50%);
|
|
296
|
+
}
|
|
297
|
+
@keyframes spin {
|
|
298
|
+
to {
|
|
299
|
+
transform: rotate(360deg);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
@media (prefers-reduced-motion: reduce) {
|
|
303
|
+
:global(.ps-card.spatial-element-card[data-catalog-card]),
|
|
304
|
+
:global(.ps-card.spatial-element-card[data-catalog-card] [data-shared-role]),
|
|
305
|
+
.catalog-poster {
|
|
306
|
+
transform: none;
|
|
307
|
+
transition: none;
|
|
308
|
+
text-shadow: none;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CardMediaAspect, CardMediaFit, CardVariant, SurfaceTone } from '@page-sections/core';
|
|
2
|
+
import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
|
|
3
|
+
import type { SpatialCardSize } from '@spatial-elements/core/spatial-element/responsiveLayout';
|
|
4
|
+
type $$ComponentProps = {
|
|
5
|
+
spatialElement: SpatialListItem;
|
|
6
|
+
occurrence: string;
|
|
7
|
+
order?: number;
|
|
8
|
+
cardSize?: SpatialCardSize;
|
|
9
|
+
textAlign?: 'start' | 'center';
|
|
10
|
+
active?: boolean;
|
|
11
|
+
mediaAspect?: CardMediaAspect;
|
|
12
|
+
mediaFit?: CardMediaFit;
|
|
13
|
+
reserveEyebrow?: boolean;
|
|
14
|
+
cardTone?: SurfaceTone;
|
|
15
|
+
cardVariant?: CardVariant;
|
|
16
|
+
};
|
|
17
|
+
declare const SpatialCardPresentation: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
18
|
+
type SpatialCardPresentation = ReturnType<typeof SpatialCardPresentation>;
|
|
19
|
+
export default SpatialCardPresentation;
|
|
@@ -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;
|