@spatial-elements/sveltekit 0.1.0-beta.1 → 1.0.0-beta.10
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 +19 -9
- 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 +150 -197
- 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 +125 -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/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 +752 -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 +292 -0
- package/dist/spatial-element/SpatialElementHelp.svelte.d.ts +6 -0
- package/dist/spatial-element/SpatialElementMediaRail.svelte +321 -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 +150 -70
- package/dist/spatial-element/SpatialElementPage.svelte.d.ts +6 -3
- package/dist/spatial-element/SpatialElementStickyHeader.svelte +76 -104
- package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +3 -1
- package/dist/spatial-element/SpatialElementSummaryContent.svelte +185 -0
- package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +18 -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 +59 -0
- package/dist/spatial-element/SpatialIconButton.svelte.d.ts +14 -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 +136 -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 +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/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 +18 -3
- package/dist/spatial-element/index.js +11 -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 +151 -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 +405 -48
- 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 +188 -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
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { ContentPageData } from '@spatial-elements/core/spatial-element/types';
|
|
3
|
-
|
|
3
|
+
import './layout.generated.css';
|
|
4
|
+
interface Props {
|
|
5
|
+
/** Explicit HDR used to light this page's shared 3D scene; never inferred from an element. */
|
|
6
|
+
hdr: string;
|
|
7
|
+
/** Category metadata. Only title is required; pageTitle defaults to title. */
|
|
4
8
|
page: ContentPageData;
|
|
9
|
+
/** Flat page color override, using the same color format as SpatialTheme.background. */
|
|
10
|
+
background?: string;
|
|
11
|
+
/** SpatialCardGridSection, SpatialCarouselSection and ordinary Section children. */
|
|
5
12
|
children?: Snippet;
|
|
6
|
-
|
|
7
|
-
|
|
13
|
+
leftSidebar?: Snippet;
|
|
14
|
+
footer?: Snippet;
|
|
15
|
+
showContentMenu?: boolean;
|
|
16
|
+
contentMenuLabel?: string;
|
|
17
|
+
}
|
|
18
|
+
declare const ContentPage: import("svelte").Component<Props, {}, "">;
|
|
8
19
|
type ContentPage = ReturnType<typeof ContentPage>;
|
|
9
20
|
export default ContentPage;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let { action, touch = false }: { action: 'rotate' | 'zoom' | 'pan'; touch?: boolean } = $props();
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<!-- Decorative diagrams; the adjacent definition list supplies localized instructions. -->
|
|
6
|
+
<svg width="48" height="44" viewBox="0 0 48 44" fill="none" stroke="currentColor" stroke-width="1.6"
|
|
7
|
+
stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-gesture={action} data-input={touch ? 'touch' : 'mouse'}>
|
|
8
|
+
{#if !touch}
|
|
9
|
+
{#if action === 'rotate'}
|
|
10
|
+
<path class="input-highlight" d="M24 5 C17.4 5 13 9.8 13 16 V19 H24 Z" />
|
|
11
|
+
{:else if action === 'pan'}
|
|
12
|
+
<path class="input-highlight" d="M24 5 C30.6 5 35 9.8 35 16 V19 H24 Z" />
|
|
13
|
+
{/if}
|
|
14
|
+
<rect x="13" y="5" width="22" height="34" rx="11" />
|
|
15
|
+
<path d="M13 19 H35 M24 5 V10 M24 16 V19" />
|
|
16
|
+
<rect x="22" y="10" width="4" height="7" rx="2" class:input-highlight={action === 'zoom'} />
|
|
17
|
+
{#if action === 'zoom'}
|
|
18
|
+
<path class="motion" d="M41 10 V32 M38 13 L41 10 L44 13 M38 29 L41 32 L44 29" />
|
|
19
|
+
{/if}
|
|
20
|
+
{:else if action === 'zoom'}
|
|
21
|
+
<!-- Two fingertips moving apart/together. -->
|
|
22
|
+
<path d="M6 34 L14 26 Q17 23 20 26 Q23 29 20 32 L13 39 M28 13 L35 6 Q38 3 41 6 Q44 9 41 12 L33 20" />
|
|
23
|
+
<path class="motion" d="M17 22 L7 22 L7 12 M7 22 L17 12 M28 24 L39 24 L39 35 M39 24 L29 34" />
|
|
24
|
+
{:else}
|
|
25
|
+
<!-- A raised index finger, or two raised fingers for panning. -->
|
|
26
|
+
{#if action === 'pan'}
|
|
27
|
+
<path d="M13 28 V15 A3 3 0 0 1 19 15 V24 V12 A3 3 0 0 1 25 12 V24 L28 22 Q30 21 32 23 L36 27 V32 Q36 36 32 40 H19 L10 30 Q8 27 10 25 Q12 23 15 26 L19 30" />
|
|
28
|
+
{:else}
|
|
29
|
+
<path d="M19 30 V14 A3 3 0 0 1 25 14 V24 L28 22 Q30 21 32 23 L36 27 V32 Q36 36 32 40 H19 L10 30 Q8 27 10 25 Q12 23 15 26 Z" />
|
|
30
|
+
{/if}
|
|
31
|
+
<path class="motion" d="M10 6 H35 M14 2 L10 6 L14 10 M31 2 L35 6 L31 10" />
|
|
32
|
+
{/if}
|
|
33
|
+
</svg>
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
svg { display: block; flex: none; }
|
|
37
|
+
.input-highlight { fill: var(--spatial-element-accent); stroke: var(--spatial-element-accent); }
|
|
38
|
+
.motion { stroke: var(--spatial-element-accent); }
|
|
39
|
+
</style>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
action: 'rotate' | 'zoom' | 'pan';
|
|
3
|
+
touch?: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare const InteractionGesture: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
+
type InteractionGesture = ReturnType<typeof InteractionGesture>;
|
|
7
|
+
export default InteractionGesture;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import ChevronUp from 'lucide-svelte/icons/chevron-up';
|
|
3
|
+
import ChevronDown from 'lucide-svelte/icons/chevron-down';
|
|
4
|
+
import ChevronLeft from 'lucide-svelte/icons/chevron-left';
|
|
5
|
+
import ChevronRight from 'lucide-svelte/icons/chevron-right';
|
|
6
|
+
let {
|
|
7
|
+
target,
|
|
8
|
+
responsive = false,
|
|
9
|
+
label,
|
|
10
|
+
hidden = false
|
|
11
|
+
}: {
|
|
12
|
+
target?: HTMLElement;
|
|
13
|
+
responsive?: boolean;
|
|
14
|
+
label: string;
|
|
15
|
+
hidden?: boolean;
|
|
16
|
+
} = $props();
|
|
17
|
+
let vertical = $state(false);
|
|
18
|
+
let before = $state(false);
|
|
19
|
+
let after = $state(false);
|
|
20
|
+
$effect(() => {
|
|
21
|
+
if (!target) return;
|
|
22
|
+
const element = target;
|
|
23
|
+
const breakpoint = matchMedia('(min-width: 840px)');
|
|
24
|
+
const measure = () => {
|
|
25
|
+
vertical = responsive && breakpoint.matches;
|
|
26
|
+
const position = vertical ? element.scrollTop : element.scrollLeft;
|
|
27
|
+
const size = vertical ? element.clientHeight : element.clientWidth;
|
|
28
|
+
const extent = vertical ? element.scrollHeight : element.scrollWidth;
|
|
29
|
+
before = position > 1;
|
|
30
|
+
after = position + size < extent - 1;
|
|
31
|
+
};
|
|
32
|
+
const observer = new ResizeObserver(measure);
|
|
33
|
+
observer.observe(element);
|
|
34
|
+
for (const child of element.children) observer.observe(child);
|
|
35
|
+
element.addEventListener('scroll', measure, { passive: true });
|
|
36
|
+
breakpoint.addEventListener('change', measure);
|
|
37
|
+
measure();
|
|
38
|
+
return () => {
|
|
39
|
+
observer.disconnect();
|
|
40
|
+
element.removeEventListener('scroll', measure);
|
|
41
|
+
breakpoint.removeEventListener('change', measure);
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
function move(direction: number) {
|
|
45
|
+
if (!target) return;
|
|
46
|
+
const amount = direction * (vertical ? target.clientHeight : target.clientWidth) * 0.8;
|
|
47
|
+
target.scrollBy({
|
|
48
|
+
left: vertical ? 0 : amount,
|
|
49
|
+
top: vertical ? amount : 0,
|
|
50
|
+
behavior: matchMedia('(prefers-reduced-motion: reduce)').matches ? 'instant' : 'smooth'
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<div class="overflow-controls" class:vertical class:hidden data-overflow-controls={label}>
|
|
56
|
+
{#if before}<button
|
|
57
|
+
class="before"
|
|
58
|
+
type="button"
|
|
59
|
+
aria-label={`Previous ${label}`}
|
|
60
|
+
onclick={() => move(-1)}
|
|
61
|
+
tabindex={hidden ? -1 : 0}
|
|
62
|
+
>
|
|
63
|
+
{#if vertical}<ChevronUp size={18} />{:else}<ChevronLeft size={18} />{/if}
|
|
64
|
+
</button>{/if}
|
|
65
|
+
{#if after}<button
|
|
66
|
+
class="after"
|
|
67
|
+
type="button"
|
|
68
|
+
aria-label={`Next ${label}`}
|
|
69
|
+
onclick={() => move(1)}
|
|
70
|
+
tabindex={hidden ? -1 : 0}
|
|
71
|
+
>
|
|
72
|
+
{#if vertical}<ChevronDown size={18} />{:else}<ChevronRight size={18} />{/if}
|
|
73
|
+
</button>{/if}
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<style>
|
|
77
|
+
.overflow-controls {
|
|
78
|
+
position: absolute;
|
|
79
|
+
inset: 0;
|
|
80
|
+
z-index: 3;
|
|
81
|
+
pointer-events: none;
|
|
82
|
+
}
|
|
83
|
+
.hidden {
|
|
84
|
+
visibility: hidden;
|
|
85
|
+
}
|
|
86
|
+
button {
|
|
87
|
+
position: absolute;
|
|
88
|
+
top: 0;
|
|
89
|
+
display: grid;
|
|
90
|
+
place-items: center;
|
|
91
|
+
width: 28px;
|
|
92
|
+
height: 100%;
|
|
93
|
+
padding: 0;
|
|
94
|
+
border: 1px solid var(--ps-border, transparent);
|
|
95
|
+
border-radius: var(--spatial-element-control-radius, 12px);
|
|
96
|
+
background: var(--ps-section-standard, #fff);
|
|
97
|
+
color: var(--spatial-element-navigation-ink, var(--spatial-element-ink));
|
|
98
|
+
box-shadow: 0 2px 8px #0003;
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
pointer-events: auto;
|
|
101
|
+
}
|
|
102
|
+
.before {
|
|
103
|
+
left: 0;
|
|
104
|
+
}
|
|
105
|
+
.after {
|
|
106
|
+
right: 0;
|
|
107
|
+
}
|
|
108
|
+
.vertical button {
|
|
109
|
+
left: 0;
|
|
110
|
+
right: auto;
|
|
111
|
+
width: 100%;
|
|
112
|
+
height: 28px;
|
|
113
|
+
}
|
|
114
|
+
.vertical .before {
|
|
115
|
+
top: 0;
|
|
116
|
+
}
|
|
117
|
+
.vertical .after {
|
|
118
|
+
top: auto;
|
|
119
|
+
bottom: 0;
|
|
120
|
+
}
|
|
121
|
+
button:focus-visible {
|
|
122
|
+
outline: 2px solid var(--spatial-element-accent);
|
|
123
|
+
outline-offset: 2px;
|
|
124
|
+
}
|
|
125
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
target?: HTMLElement;
|
|
3
|
+
responsive?: boolean;
|
|
4
|
+
label: string;
|
|
5
|
+
hidden?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const OverflowControls: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type OverflowControls = ReturnType<typeof OverflowControls>;
|
|
9
|
+
export default OverflowControls;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from 'svelte';
|
|
3
|
+
import MoveHorizontal from 'lucide-svelte/icons/move-horizontal';
|
|
4
|
+
import Search from 'lucide-svelte/icons/search';
|
|
5
|
+
import Rotate3D from 'lucide-svelte/icons/rotate-3d';
|
|
6
|
+
import { carouselTextHit } from './carouselTextHit.js';
|
|
7
|
+
let badge: HTMLDivElement;
|
|
8
|
+
let action = $state<'move' | 'details' | 'rotate' | undefined>();
|
|
9
|
+
onMount(() => {
|
|
10
|
+
let frame = 0, x = 0, y = 0, buttons = 0;
|
|
11
|
+
let text: HTMLElement | undefined;
|
|
12
|
+
const clearText = () => { text?.removeAttribute('data-carousel-text-hit'); text = undefined; };
|
|
13
|
+
const hide = () => { cancelAnimationFrame(frame); frame = 0; action = undefined; clearText(); };
|
|
14
|
+
const update = () => {
|
|
15
|
+
frame = 0;
|
|
16
|
+
clearText();
|
|
17
|
+
const target = document.elementFromPoint(x, y);
|
|
18
|
+
const shell = badge.closest('.brand-stage-shell');
|
|
19
|
+
if (!target || !shell?.contains(target) || target.closest('[data-catalog-transition]')) { action = undefined; return; }
|
|
20
|
+
const section = target.closest('.carousel-drag-section');
|
|
21
|
+
const dragging = section?.hasAttribute('data-carousel-dragging');
|
|
22
|
+
if (section?.querySelector('.carousel.interactive')) {
|
|
23
|
+
text = !dragging ? carouselTextHit(target, x, y) : undefined;
|
|
24
|
+
text?.setAttribute('data-carousel-text-hit', '');
|
|
25
|
+
const geometry = target.closest('.spatial-element-target');
|
|
26
|
+
action = dragging ? 'move' : text || (buttons & 1) || (!geometry && target.closest('a, button, input, textarea, select, [contenteditable]'))
|
|
27
|
+
? undefined : geometry?.closest('.selected') ? 'details' : 'move';
|
|
28
|
+
} else {
|
|
29
|
+
const cursor = target instanceof HTMLCanvasElement ? target.style.cursor : '';
|
|
30
|
+
action = cursor === 'grab' || cursor === 'grabbing' ? 'rotate' : undefined;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const move = (event: PointerEvent) => {
|
|
34
|
+
if (event.pointerType !== 'mouse') { hide(); return; }
|
|
35
|
+
x = event.clientX; y = event.clientY; buttons = event.buttons;
|
|
36
|
+
// Position immediately, independently of the frame-batched hit testing.
|
|
37
|
+
// No reactive update or interpolation between the pointer and its hint.
|
|
38
|
+
badge.style.transform = `translate3d(${Math.max(0, Math.min(x + 10, innerWidth - 22))}px, ${Math.max(0, Math.min(y + 14, innerHeight - 22))}px, 0)`;
|
|
39
|
+
if (!frame) frame = requestAnimationFrame(update);
|
|
40
|
+
};
|
|
41
|
+
window.addEventListener('pointermove', move);
|
|
42
|
+
window.addEventListener('pointerdown', move);
|
|
43
|
+
window.addEventListener('pointerup', move);
|
|
44
|
+
window.addEventListener('blur', hide);
|
|
45
|
+
window.addEventListener('pointercancel', hide);
|
|
46
|
+
window.addEventListener('keydown', hide);
|
|
47
|
+
window.addEventListener('scroll', hide, true);
|
|
48
|
+
document.documentElement.addEventListener('pointerleave', hide);
|
|
49
|
+
const observer = new MutationObserver(hide);
|
|
50
|
+
observer.observe(badge.closest('.brand-stage-shell')!, {subtree:true, attributes:true, attributeFilter:['data-catalog-transition']});
|
|
51
|
+
return () => {
|
|
52
|
+
hide();
|
|
53
|
+
observer.disconnect();
|
|
54
|
+
window.removeEventListener('pointermove', move);
|
|
55
|
+
window.removeEventListener('pointerdown', move);
|
|
56
|
+
window.removeEventListener('pointerup', move);
|
|
57
|
+
window.removeEventListener('blur', hide);
|
|
58
|
+
window.removeEventListener('pointercancel', hide);
|
|
59
|
+
window.removeEventListener('keydown', hide);
|
|
60
|
+
window.removeEventListener('scroll', hide, true);
|
|
61
|
+
document.documentElement.removeEventListener('pointerleave', hide);
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<div bind:this={badge} class="pointer-hint" data-pointer-hint={action} hidden={!action} aria-hidden="true">
|
|
67
|
+
{#if action === 'move'}<MoveHorizontal size={20} strokeWidth={1.8} />
|
|
68
|
+
{:else if action === 'details'}<Search size={20} strokeWidth={1.8} />
|
|
69
|
+
{:else if action === 'rotate'}<Rotate3D size={20} strokeWidth={1.8} />{/if}
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<style>
|
|
73
|
+
.pointer-hint { position: fixed; left: 0; top: 0; z-index: 2147483647; pointer-events: none;
|
|
74
|
+
display: grid; place-items: center; width: 20px; height: 20px;
|
|
75
|
+
color: var(--spatial-element-ink); will-change: transform;
|
|
76
|
+
/* Contrast follows the strokes only, without a button-like surface. */
|
|
77
|
+
filter: drop-shadow(0 0 1px var(--spatial-element-background))
|
|
78
|
+
drop-shadow(0 0 1px var(--spatial-element-background)); }
|
|
79
|
+
.pointer-hint[hidden] { display: none; }
|
|
80
|
+
</style>
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { Section as PageSection } from '@page-sections/svelte';
|
|
3
|
+
import { getContext, onMount } from 'svelte';
|
|
4
|
+
import { dev } from '$app/environment';
|
|
5
|
+
import './layout.generated.css';
|
|
6
|
+
import { createSectionBackgroundNormalizer } from '@spatial-elements/core/spatial-element/sectionBackground';
|
|
3
7
|
import type { Snippet } from 'svelte';
|
|
4
8
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
9
|
import { getSpatialElementSectionStyle } from '@spatial-elements/core/spatial-element/spatialElement';
|
|
6
10
|
import {
|
|
7
|
-
|
|
8
|
-
SECTION_PAGE_KIND,
|
|
9
|
-
type SpatialElementSectionRegistry
|
|
11
|
+
SECTION_PAGE_KIND
|
|
10
12
|
} from '@spatial-elements/core/spatial-element/spatialElementSectionRegistry';
|
|
11
13
|
import type { SpatialElementSectionDefinition } from '@spatial-elements/core/spatial-element/types';
|
|
12
14
|
|
|
@@ -29,24 +31,13 @@
|
|
|
29
31
|
let sectionElement: HTMLElement;
|
|
30
32
|
|
|
31
33
|
const contentPage = getContext(SECTION_PAGE_KIND) === 'content';
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
34
|
+
const normalizeBackground = createSectionBackgroundNormalizer(dev ? (diagnostic) => console.warn(diagnostic.message) : undefined);
|
|
35
|
+
const background = $derived(normalizeBackground(section.background, { pageKind: contentPage ? 'content' : 'detail' }));
|
|
36
|
+
const legacyMaterial = $derived(!section.background && Boolean(section.style &&
|
|
37
|
+
(section.style.tint !== undefined || section.style.tintOpacity !== undefined || section.style.backdropBlur !== undefined)));
|
|
38
|
+
const surface = $derived(legacyMaterial ? { ...background, color: 'standard' as const } : background);
|
|
49
39
|
onMount(() => {
|
|
40
|
+
sectionElement = document.getElementById(section.id)!;
|
|
50
41
|
// Content-page card endpoints must stay measurable, including restored offscreen lists.
|
|
51
42
|
if (contentPage) return;
|
|
52
43
|
let measurementFrame = 0;
|
|
@@ -102,90 +93,18 @@
|
|
|
102
93
|
});
|
|
103
94
|
</script>
|
|
104
95
|
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
96
|
+
<PageSection
|
|
97
|
+
{...rest} section={{ ...section, style: { width: section.style?.width, color: section.style?.textColor }, background: legacyMaterial ? { color: 'standard', size: surface.size } : section.background }}
|
|
98
|
+
class={['content-section spatial-grid-scope ps-grid-scope', contentPage ? 'content-page-section' : '', className].filter(Boolean).join(' ')}
|
|
99
|
+
data-spatial-legacy-material={legacyMaterial || undefined} data-stage-dom-content data-spatial-element-tab-target={!contentPage || undefined}
|
|
100
|
+
data-catalog-transition-dom={contentPage ? 'exit' : undefined} data-section-presentation={presentation}
|
|
101
|
+
data-section-background={surface.color} data-section-background-size={surface.size}
|
|
102
|
+
style={getSpatialElementSectionStyle(section.style)}>
|
|
103
|
+
{@render children?.()}
|
|
104
|
+
</PageSection>
|
|
125
105
|
<style>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
-
}
|
|
106
|
+
:global(.content-section) { pointer-events: auto; }
|
|
107
|
+
:global(.content-section[data-spatial-element-section-culling-ready]) { content-visibility: auto; contain-intrinsic-block-size: auto var(--spatial-element-section-intrinsic-height); }
|
|
108
|
+
:global(.content-section[data-spatial-legacy-material] > .ps-section-surface) { background: color-mix(in srgb, var(--spatial-element-section-tint) var(--spatial-element-section-tint-opacity), transparent) !important; backdrop-filter: blur(min(var(--spatial-element-section-backdrop-blur), 18px)); }
|
|
109
|
+
:global(.content-section[data-spatial-element-section-culled] > .ps-section-surface) { backdrop-filter: none; }
|
|
191
110
|
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { SectionSurfaceGroup } from '@page-sections/svelte';
|
|
3
|
+
import { getContext, type Snippet } from 'svelte';
|
|
4
|
+
import { SECTION_PAGE_KIND } from '@spatial-elements/core/spatial-element/spatialElementSectionRegistry';
|
|
5
|
+
let { children }: { children?: Snippet } = $props();
|
|
6
|
+
const pageKind = getContext<'content' | 'detail'>(SECTION_PAGE_KIND) ?? 'detail';
|
|
7
|
+
</script>
|
|
8
|
+
<SectionSurfaceGroup {pageKind}>{@render children?.()}</SectionSurfaceGroup>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SectionSurfaceGroup } from '@page-sections/svelte';
|
|
2
|
+
import { type Snippet } from 'svelte';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
};
|
|
6
|
+
declare const SectionSurfaceGroup: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type SectionSurfaceGroup = ReturnType<typeof SectionSurfaceGroup>;
|
|
8
|
+
export default SectionSurfaceGroup;
|
|
@@ -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;
|