@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
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getContext, onMount, tick, type Snippet } from 'svelte';
|
|
3
|
+
import { afterNavigate, beforeNavigate } from '$app/navigation';
|
|
4
|
+
import { resolveMenuOffset, spatialLayoutTokens } from '@spatial-elements/core/spatial-element/responsiveLayout';
|
|
5
|
+
import { resolveSpatialThemeRadii } from '@spatial-elements/core/spatial-element/spatialTheme';
|
|
6
|
+
import { getStageVisualScrollPosition, STAGE_SCROLL_PRIORITY, subscribeStageScrollFrame } from '@spatial-elements/core/stage/scrollFrame';
|
|
7
|
+
import { STAGE_PANEL_LAYOUT_EVENT } from '@spatial-elements/core/stage/panelContext';
|
|
8
|
+
import { Navigation } from '@page-sections/svelte';
|
|
9
|
+
import { layoutTokens, type MenuItem } from '@page-sections/core';
|
|
10
|
+
import { STAGE_CONTEXT_KEY, type StageContext } from '@spatial-elements/core/stage/panelContext';
|
|
11
|
+
import { useSpatialTheme } from './brandContext.js';
|
|
12
|
+
import './layout.generated.css';
|
|
13
|
+
|
|
14
|
+
let { navigation, menu, items, brand, tools, left, right }: { navigation?: Snippet; menu?: Snippet; items?: MenuItem[]; brand?: Snippet; tools?: Snippet; left?: Snippet; right?: Snippet } = $props();
|
|
15
|
+
const stageContext = getContext<StageContext | undefined>(STAGE_CONTEXT_KEY);
|
|
16
|
+
const readTheme = useSpatialTheme();
|
|
17
|
+
const theme = $derived(readTheme());
|
|
18
|
+
$effect(() => { void theme; void fixedDetail; stageContext?.updatePanelAppearance?.(); });
|
|
19
|
+
const radii = $derived(resolveSpatialThemeRadii(theme));
|
|
20
|
+
let rack: HTMLDivElement;
|
|
21
|
+
let stage: HTMLElement | undefined;
|
|
22
|
+
let enhancedScroll = false;
|
|
23
|
+
let satellitesVisible = false;
|
|
24
|
+
let fixedDetail = $state(false);
|
|
25
|
+
|
|
26
|
+
function position(scrollY = getStageVisualScrollPosition().scrollY) {
|
|
27
|
+
if (!rack) return;
|
|
28
|
+
const compensation = enhancedScroll ? Math.max(0, scrollY) + resolveMenuOffset(scrollY, fixedDetail) : 0;
|
|
29
|
+
rack.style.setProperty('--spatial-shell-scroll-compensation', `${compensation}px`);
|
|
30
|
+
// PageBinding removes precisely this DOM compensation before caching document coordinates.
|
|
31
|
+
rack.dataset.stageScrollCompensation = String(compensation);
|
|
32
|
+
rack.toggleAttribute('data-stage-scroll-shell-fixed', fixedDetail);
|
|
33
|
+
}
|
|
34
|
+
function updateMode() {
|
|
35
|
+
if (!rack || !stage) return;
|
|
36
|
+
const previousMode = `${enhancedScroll}/${fixedDetail}`;
|
|
37
|
+
enhancedScroll = stage.classList.contains('stage-virtual-scroll-active');
|
|
38
|
+
satellitesVisible = window.innerWidth >= layoutTokens.layoutMinWidths.xl;
|
|
39
|
+
fixedDetail = getComputedStyle(rack).getPropertyValue('--spatial-shell-fixed').trim() === '1';
|
|
40
|
+
position();
|
|
41
|
+
if (previousMode !== `${enhancedScroll}/${fixedDetail}`) window.dispatchEvent(new Event(STAGE_PANEL_LAYOUT_EVENT));
|
|
42
|
+
}
|
|
43
|
+
function closePopovers() {
|
|
44
|
+
for (const element of rack?.querySelectorAll<HTMLElement>(':popover-open') ?? []) element.hidePopover();
|
|
45
|
+
for (const details of rack?.querySelectorAll<HTMLDetailsElement>('details[open]') ?? []) details.open = false;
|
|
46
|
+
}
|
|
47
|
+
afterNavigate(() => { void tick().then(updateMode); });
|
|
48
|
+
beforeNavigate(closePopovers);
|
|
49
|
+
|
|
50
|
+
onMount(() => {
|
|
51
|
+
stage = rack.closest<HTMLElement>('.stage') ?? undefined;
|
|
52
|
+
updateMode();
|
|
53
|
+
// Projected panel content lives above the ordinary DOM layer. Promote only
|
|
54
|
+
// open navigation dropdowns to the browser top layer, retaining their DOM
|
|
55
|
+
// ownership, shared markup and delegated events.
|
|
56
|
+
const dropdownStyles = new Map<HTMLElement, string | null>();
|
|
57
|
+
function restoreDropdown(panel: HTMLElement) {
|
|
58
|
+
if (!dropdownStyles.has(panel)) return;
|
|
59
|
+
if (panel.matches(':popover-open')) panel.hidePopover();
|
|
60
|
+
panel.removeAttribute('popover');
|
|
61
|
+
const style = dropdownStyles.get(panel);
|
|
62
|
+
if (style === null) panel.removeAttribute('style');
|
|
63
|
+
else panel.setAttribute('style', style!);
|
|
64
|
+
dropdownStyles.delete(panel);
|
|
65
|
+
}
|
|
66
|
+
function toggleDropdown(event: Event) {
|
|
67
|
+
if (!(event.target instanceof HTMLDetailsElement)) return;
|
|
68
|
+
const details = event.target;
|
|
69
|
+
const panel = details.querySelector<HTMLElement>(':scope > .settings-panel, :scope > .mobile-panel, :scope > .ps-submenu');
|
|
70
|
+
if (!panel || !('showPopover' in panel)) return;
|
|
71
|
+
// Nested menu entries stay inside their already elevated parent panel.
|
|
72
|
+
if (details.closest('.mobile-panel, .ps-submenu')) return;
|
|
73
|
+
if (!details.open) { restoreDropdown(panel); return; }
|
|
74
|
+
if (dropdownStyles.has(panel)) return;
|
|
75
|
+
const rect = panel.getBoundingClientRect();
|
|
76
|
+
dropdownStyles.set(panel, panel.getAttribute('style'));
|
|
77
|
+
panel.popover = 'manual';
|
|
78
|
+
Object.assign(panel.style, { position: 'fixed', inset: 'auto', margin: '0',
|
|
79
|
+
left: rect.left + 'px', top: rect.top + 'px', width: rect.width + 'px',
|
|
80
|
+
boxSizing: 'border-box', maxHeight: Math.max(0, innerHeight - rect.top - 12) + 'px', overflowY: 'auto' });
|
|
81
|
+
panel.showPopover();
|
|
82
|
+
}
|
|
83
|
+
rack.addEventListener('toggle', toggleDropdown, true);
|
|
84
|
+
window.addEventListener('scroll', closePopovers, { passive: true });
|
|
85
|
+
window.addEventListener('resize', closePopovers, { passive: true });
|
|
86
|
+
const observer = new MutationObserver(updateMode);
|
|
87
|
+
if (stage) observer.observe(stage, { attributes: true, attributeFilter: ['class'] });
|
|
88
|
+
// Shared navigation owns the boxes; the stage only enhances their surfaces.
|
|
89
|
+
const releases = [...rack.querySelectorAll<HTMLElement>('.header, .satellite')].map(element => {
|
|
90
|
+
const role = element.classList.contains('header') ? 'menu' : element.classList.contains('left') ? 'left' : 'right';
|
|
91
|
+
element.setAttribute('data-spatial-shell-' + role, '');
|
|
92
|
+
element.classList.add('spatial-shell-' + (role === 'menu' ? 'menu' : 'satellite'));
|
|
93
|
+
element.dataset.stagePanelNativeContent = '';
|
|
94
|
+
return stageContext?.registerPanel({
|
|
95
|
+
getElement: () => element, getFrameElement: () => element, getSurfaceElement: () => element,
|
|
96
|
+
getContentInset: () => 0, getPointerReactive: () => false, getFocusReactive: () => true,
|
|
97
|
+
getNativeContent: () => true, getVisible: () => role === 'menu' || satellitesVisible,
|
|
98
|
+
getMinimapOptions: () => undefined, getMinimapDockProgress: () => 0,
|
|
99
|
+
getMinimapModelScale: () => 1, getMinimapModelTop: () => undefined,
|
|
100
|
+
getSurface: () => fixedDetail ? theme.panelTheme.surface ?? 'glass' : 'frosted',
|
|
101
|
+
getSurfaceOpacity: () => 1,
|
|
102
|
+
getOptions: () => ({ ...theme.panelTheme, radius: role === 'menu' ? radii.panel : radii.control })
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
const stop = subscribeStageScrollFrame(frame => position(frame.scrollY), STAGE_SCROLL_PRIORITY.virtualDocument + 1);
|
|
106
|
+
window.addEventListener('resize', updateMode, { passive: true });
|
|
107
|
+
return () => {
|
|
108
|
+
rack.removeEventListener('toggle', toggleDropdown, true);
|
|
109
|
+
window.removeEventListener('scroll', closePopovers);
|
|
110
|
+
window.removeEventListener('resize', closePopovers);
|
|
111
|
+
for (const panel of dropdownStyles.keys()) restoreDropdown(panel);
|
|
112
|
+
releases.forEach(release => release?.()); stop(); observer.disconnect(); window.removeEventListener('resize', updateMode); };
|
|
113
|
+
});
|
|
114
|
+
</script>
|
|
115
|
+
|
|
116
|
+
<div class="spatial-shell-track" style:--ps-sticky-range={`${spatialLayoutTokens.menu.scrollThreshold}px`} data-spatial-navigation-shell>
|
|
117
|
+
<div bind:this={rack} class="spatial-shell-rack" data-stage-scroll-shell data-catalog-shell data-spatial-navigation-glass={fixedDetail && theme.panelTheme.surface === 'glass' ? '' : undefined}>
|
|
118
|
+
{#if navigation}{@render navigation()}{:else}<Navigation {menu} {items} {brand} {tools} {left} {right} />{/if}
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
<style>
|
|
122
|
+
.spatial-shell-track { position: relative; z-index: 30; height: calc(var(--ps-nav-height) + var(--ps-sticky-range)); margin-bottom: calc(-1 * var(--ps-sticky-range)); pointer-events: none; }
|
|
123
|
+
.spatial-shell-rack { position: sticky; top: 0; height: var(--ps-nav-height); pointer-events: none; }
|
|
124
|
+
.spatial-shell-rack :global(.ps-navigation) { pointer-events: auto; }
|
|
125
|
+
/* Native navigation retains its semantic DOM and shares the spatial material,
|
|
126
|
+
* including the SSR/no-GPU fallback. GPU glass replaces only its surface. */
|
|
127
|
+
.spatial-shell-rack :global(.header),
|
|
128
|
+
.spatial-shell-rack :global(.satellite) {
|
|
129
|
+
background: rgb(var(--spatial-element-panel-tint-rgb) / var(--spatial-element-panel-tint-opacity));
|
|
130
|
+
-webkit-backdrop-filter: blur(var(--spatial-element-panel-backdrop-blur));
|
|
131
|
+
backdrop-filter: blur(var(--spatial-element-panel-backdrop-blur));
|
|
132
|
+
box-shadow: var(--spatial-element-panel-box-shadow);
|
|
133
|
+
}
|
|
134
|
+
:global(.stage-virtual-scroll-active) .spatial-shell-rack { position: relative; transform: translateY(var(--spatial-shell-scroll-compensation, 0px)); }
|
|
135
|
+
[data-spatial-navigation-glass] :global([data-stage-panel-bound]) { background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
|
|
136
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import { type MenuItem } from '@page-sections/core';
|
|
3
|
+
import './layout.generated.css';
|
|
4
|
+
type $$ComponentProps = {
|
|
5
|
+
navigation?: Snippet;
|
|
6
|
+
menu?: Snippet;
|
|
7
|
+
items?: MenuItem[];
|
|
8
|
+
brand?: Snippet;
|
|
9
|
+
tools?: Snippet;
|
|
10
|
+
left?: Snippet;
|
|
11
|
+
right?: Snippet;
|
|
12
|
+
};
|
|
13
|
+
declare const SpatialNavigationShell: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
14
|
+
type SpatialNavigationShell = ReturnType<typeof SpatialNavigationShell>;
|
|
15
|
+
export default SpatialNavigationShell;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getAllContexts, getContext, onDestroy, onMount, setContext, type Snippet } from 'svelte';
|
|
3
|
+
import { SpatialSummaryHostController, SPATIAL_SUMMARY_HOST } from './spatialSummaryHost.svelte.js';
|
|
4
|
+
import type { SpatialSummaryContext, SpatialSummarySnippet } from './spatialSummary.js';
|
|
5
|
+
import SpatialElementSummaryContent from './SpatialElementSummaryContent.svelte';
|
|
6
|
+
import { SPATIAL_PRESENTATION_OWNER, type SpatialPresentationOwner } from './spatialPresentationOwner.js';
|
|
7
|
+
let { summary, children }: { summary?: SpatialSummarySnippet; children?: Snippet } = $props();
|
|
8
|
+
const controller = new SpatialSummaryHostController(() => renderSummary, getAllContexts());
|
|
9
|
+
setContext(SPATIAL_SUMMARY_HOST, controller);
|
|
10
|
+
const owner = getContext<SpatialPresentationOwner | undefined>(SPATIAL_PRESENTATION_OWNER);
|
|
11
|
+
onMount(() => owner?.register(controller));
|
|
12
|
+
onDestroy(() => controller.destroy());
|
|
13
|
+
</script>
|
|
14
|
+
{#snippet renderSummary(context: SpatialSummaryContext)}
|
|
15
|
+
{#if summary}{@render summary(context)}{:else}
|
|
16
|
+
<SpatialElementSummaryContent spatialElement={context.spatialElement} address={context.address} heading={context.heading} contentInset={context.contentInset} />
|
|
17
|
+
{/if}
|
|
18
|
+
{/snippet}
|
|
19
|
+
{@render children?.()}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import type { SpatialSummarySnippet } from './spatialSummary.js';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
summary?: SpatialSummarySnippet;
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
};
|
|
7
|
+
declare const SpatialSummaryHost: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type SpatialSummaryHost = ReturnType<typeof SpatialSummaryHost>;
|
|
9
|
+
export default SpatialSummaryHost;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getContext } from 'svelte';
|
|
3
|
+
import type { SpatialPresentationModel, SpatialSummarySnippet } from './spatialSummary.js';
|
|
4
|
+
import SpatialCardPresentation from './SpatialCardPresentation.svelte';
|
|
5
|
+
import { createCatalogEndpointAction } from '../catalog/catalogEndpointAction.js';
|
|
6
|
+
import { useCatalogNavigation } from '../catalog/catalogNavigation.js';
|
|
7
|
+
import { catalogViewLink } from '@spatial-elements/core/catalog/catalogViewLink';
|
|
8
|
+
import { CATALOG_ENDPOINTS, type CatalogEndpointRegistry } from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
|
|
9
|
+
import { CATALOG_SECTIONS, type CatalogSections } from '@spatial-elements/core/catalog/CatalogSections';
|
|
10
|
+
let { content, model }: { content: SpatialSummarySnippet; model: SpatialPresentationModel } = $props();
|
|
11
|
+
const context = $derived(model.kind === 'summary' ? model.current : undefined);
|
|
12
|
+
const carousel = $derived(context?.carousel);
|
|
13
|
+
const catalogEndpoint = createCatalogEndpointAction();
|
|
14
|
+
const endpoints = getContext<CatalogEndpointRegistry | undefined>(CATALOG_ENDPOINTS);
|
|
15
|
+
const sections = getContext<CatalogSections | undefined>(CATALOG_SECTIONS);
|
|
16
|
+
const { href, prepare } = useCatalogNavigation();
|
|
17
|
+
function activate(event: MouseEvent) {
|
|
18
|
+
if (!model.active || !context || !carousel) { event.preventDefault(); return; }
|
|
19
|
+
endpoints?.prefer(context.spatialElement.brandId, context.spatialElement.id, carousel.occurrence, 'carousel.front');
|
|
20
|
+
sections?.activate({ brandId: context.spatialElement.brandId, spatialElementId: context.spatialElement.id, occurrence: carousel.occurrence, slot: 'carousel.front' });
|
|
21
|
+
(event.currentTarget as HTMLElement).focus({ preventScroll: true });
|
|
22
|
+
}
|
|
23
|
+
function prepareCarousel() { if (model.active && carousel) prepare(carousel.item); }
|
|
24
|
+
</script>
|
|
25
|
+
{#if model.kind === 'card'}
|
|
26
|
+
<SpatialCardPresentation {...model.current} active={model.active} />
|
|
27
|
+
{:else}
|
|
28
|
+
<div class="spatial-summary-surface" hidden={model.current.mode !== 'carousel'} aria-hidden="true"></div>
|
|
29
|
+
{#if model.current.carousel}
|
|
30
|
+
<div class="compact-copy" hidden={model.current.mode !== 'carousel'}>
|
|
31
|
+
{#if model.current.spatialElement.eyebrow}<p use:catalogEndpoint={model.active && carousel?.compact ? model.current.address('eyebrow') : undefined}>{model.current.spatialElement.eyebrow}</p>{/if}
|
|
32
|
+
<h3 use:catalogEndpoint={model.active && carousel?.compact ? model.current.address('title') : undefined}>{model.current.spatialElement.title}</h3>
|
|
33
|
+
</div>
|
|
34
|
+
{/if}
|
|
35
|
+
<div data-spatial-summary-root class="spatial-summary-query" class:full-summary={model.current.mode === 'carousel'}>
|
|
36
|
+
{@render content(model.active && !carousel?.compact ? model.current : { ...model.current, address: () => undefined })}
|
|
37
|
+
</div>
|
|
38
|
+
{#if model.current.carousel}
|
|
39
|
+
{#if model.current.carousel.item.summary?.sectionLink}<a class="section-information" href={href(model.current.carousel.item.summary.sectionLink.href)} onclick={activate}
|
|
40
|
+
use:catalogViewLink={{ spatialElementId: model.current.spatialElement.id, targetPresentation: model.current.carousel.item.summary.sectionLink.targetPresentation }}
|
|
41
|
+
data-catalog-focus-key={`catalog-section:${model.current.carousel.occurrence}`}>{model.current.carousel.item.summary.sectionLink.label}</a>{/if}
|
|
42
|
+
<a class="information" href={href(model.current.carousel.item.href)} onclick={activate} onpointerenter={prepareCarousel} onfocus={prepareCarousel} onpointerdown={prepareCarousel}
|
|
43
|
+
use:catalogViewLink={{ spatialElementId: model.current.spatialElement.id, targetPresentation: model.current.carousel.item.targetPresentation }}
|
|
44
|
+
aria-label={`More information: ${model.current.spatialElement.title}`}
|
|
45
|
+
data-catalog-focus-key={`catalog:${JSON.stringify([model.current.spatialElement.brandId, model.current.spatialElement.id, model.current.carousel.occurrence, 'carousel.front'])}`}>
|
|
46
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 17 17 7M7 7h10v10" /></svg>
|
|
47
|
+
</a>
|
|
48
|
+
{/if}
|
|
49
|
+
{/if}
|
|
50
|
+
<style>
|
|
51
|
+
:global(.spatial-summary-island) { position: relative; width: 100%; min-width: 0; box-sizing: border-box; }
|
|
52
|
+
.spatial-summary-query {
|
|
53
|
+
container: spatial-summary / inline-size; width: 100%; min-width: 0; pointer-events: auto;
|
|
54
|
+
max-height: max(0px, calc(var(--spatial-detail-summary-max-height, 100000px) - var(--spatial-summary-content-inset, 0px) * 2 - var(--spatial-summary-height-reserve, 0px)));
|
|
55
|
+
overflow: auto; overscroll-behavior: auto;
|
|
56
|
+
}
|
|
57
|
+
:global(.spatial-summary-island[data-presentation-mode='carousel']) { height: 100%; border-radius: var(--carousel-panel-radius, 14px); opacity: var(--carousel-panel-opacity, 1); }
|
|
58
|
+
.spatial-summary-surface {
|
|
59
|
+
position: absolute; inset: 0; border-radius: inherit; background: color-mix(in srgb, var(--carousel-panel-tint, white) var(--carousel-panel-tint-opacity, 65%), transparent);
|
|
60
|
+
border: 1px solid color-mix(in srgb, var(--spatial-element-accent) 12%, transparent); backdrop-filter: blur(var(--carousel-panel-blur, 5px)); box-shadow: var(--carousel-panel-shadow); pointer-events: none;
|
|
61
|
+
}
|
|
62
|
+
.spatial-summary-surface[hidden] { display: none; }
|
|
63
|
+
:global([data-carousel-glass-ready]) .spatial-summary-surface,
|
|
64
|
+
:global([data-spatial-presentation-glass]) .spatial-summary-surface { visibility: hidden; }
|
|
65
|
+
.compact-copy { position: relative; padding-right: 44px; }
|
|
66
|
+
.compact-copy p { height: 26px; margin: 0; font-size: 12px; line-height: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
67
|
+
.compact-copy h3 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; height: 40px; margin: 0; overflow: hidden; font-size: 18px; line-height: 20px; }
|
|
68
|
+
.full-summary, .section-information { display: none; }
|
|
69
|
+
.information { position: absolute; top: 0; right: 0; display: grid; place-items: center; width: 40px; height: 40px; margin: 0; color: var(--spatial-element-accent); pointer-events: auto; }
|
|
70
|
+
.information svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
|
71
|
+
@media (min-width: 840px) {
|
|
72
|
+
:global(.spatial-summary-island[data-presentation-mode='carousel']) { height: auto; padding: var(--spatial-summary-content-inset); }
|
|
73
|
+
.compact-copy { display: none; }
|
|
74
|
+
.full-summary { display: block; position: relative; }
|
|
75
|
+
/* Optional section navigation belongs outside the shared property surface. */
|
|
76
|
+
.section-information { display: block; position: absolute; top: calc(100% + 8px); left: 0; right: 0; height: 32px; line-height: 32px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--spatial-element-accent); }
|
|
77
|
+
}
|
|
78
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SpatialPresentationModel, SpatialSummarySnippet } from './spatialSummary.js';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
content: SpatialSummarySnippet;
|
|
4
|
+
model: SpatialPresentationModel;
|
|
5
|
+
};
|
|
6
|
+
declare const SpatialSummaryRoot: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type SpatialSummaryRoot = ReturnType<typeof SpatialSummaryRoot>;
|
|
8
|
+
export default SpatialSummaryRoot;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { SpatialSummaryContext } from './spatialSummary.js';
|
|
8
|
+
let { instanceKey, context, element = $bindable() }: {
|
|
9
|
+
instanceKey: string;
|
|
10
|
+
context: SpatialSummaryContext;
|
|
11
|
+
element?: HTMLDivElement;
|
|
12
|
+
} = $props();
|
|
13
|
+
const host = getContext<SpatialSummaryHostController | undefined>(SPATIAL_SUMMARY_HOST);
|
|
14
|
+
if (!host) throw new Error('Spatial summary slots require a BrandStageShell');
|
|
15
|
+
const key = untrack(() => instanceKey);
|
|
16
|
+
let mounted = $state(false);
|
|
17
|
+
const raw = createRawSnippet(() => ({
|
|
18
|
+
render: () => {
|
|
19
|
+
if (browser) return '<div data-spatial-summary-slot></div>';
|
|
20
|
+
const output = render(SpatialSummaryRoot, {
|
|
21
|
+
props: { content: host.content(), model: { kind: 'summary', current: context, active: true } }, context: host.contexts,
|
|
22
|
+
idPrefix: `summary-${encodeURIComponent(key).replaceAll('-', '%2D')}`
|
|
23
|
+
});
|
|
24
|
+
const body = output.body;
|
|
25
|
+
if (output.head) throw new Error('A persistent summary must render synchronous content without svelte:head');
|
|
26
|
+
return `<div data-spatial-summary-slot><div data-spatial-presentation-root class="spatial-summary-island" data-presentation-mode="${context.mode}" style="--spatial-summary-content-inset:${context.contentInset}px">${body}</div></div>`;
|
|
27
|
+
},
|
|
28
|
+
setup: (slot) => {
|
|
29
|
+
element = slot as HTMLDivElement;
|
|
30
|
+
return host.attach(element, key, context);
|
|
31
|
+
}
|
|
32
|
+
}));
|
|
33
|
+
onMount(() => { mounted = true; });
|
|
34
|
+
$effect(() => { if (mounted) host.update(key, context); });
|
|
35
|
+
</script>
|
|
36
|
+
{@render raw()}
|
|
37
|
+
<style>
|
|
38
|
+
:global([data-spatial-summary-slot]) { min-width: 0; }
|
|
39
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SpatialSummaryContext } from './spatialSummary.js';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
instanceKey: string;
|
|
4
|
+
context: SpatialSummaryContext;
|
|
5
|
+
element?: HTMLDivElement;
|
|
6
|
+
};
|
|
7
|
+
declare const SpatialSummarySlot: import("svelte").Component<$$ComponentProps, {}, "element">;
|
|
8
|
+
type SpatialSummarySlot = ReturnType<typeof SpatialSummarySlot>;
|
|
9
|
+
export default SpatialSummarySlot;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let { kind }: { kind: 'detail' | 'fullscreen' } = $props();
|
|
3
|
+
// Authored layout icons: assets/box-details.svg and assets/box-fullscreen.svg.
|
|
4
|
+
const detail = [
|
|
5
|
+
'M10.504 19.23 L13.504 17.49', 'M10.505 8.771 A2 2 0 0 0 8.613 8.707',
|
|
6
|
+
'M13.504 17.49 A2 2 0 0 0 14.5 15.76', 'M13.505 10.513 L10.505 8.771',
|
|
7
|
+
'M14.5 12.243 A2 2 0 0 0 13.505 10.513', 'M14.5 15.76 L14.5 12.243',
|
|
8
|
+
'M19.5 17.5 L19.5 8.5', 'M2 5 L22 5', 'M4.5 12.244 L4.5 15.76',
|
|
9
|
+
'M4.5 15.76 A2 2 0 0 0 5.496 17.49', 'M4.764 11.252 L9.5 14',
|
|
10
|
+
'M5.495 10.514 A2 2 0 0 0 4.5 12.244', 'M5.496 17.49 L8.496 19.23',
|
|
11
|
+
'M8.496 19.23 A2 2 0 0 0 10.504 19.23', 'M8.613 8.707 L5.495 10.514',
|
|
12
|
+
'M9.5 14 L14.237 11.252', 'M9.5 14 L9.5 19.5'
|
|
13
|
+
];
|
|
14
|
+
const fullscreen = [
|
|
15
|
+
'M11.333 18.819 A1.33 1.33 0 0 0 12.667 18.819', 'M11.333 5.846 L6.667 8.513',
|
|
16
|
+
'M12 12.333 L17.8 9', 'M12 19 L12 12.333', 'M12.667 18.819 L17.333 16.153',
|
|
17
|
+
'M12.667 5.846 A1.33 1.33 0 0 0 11.333 5.846', 'M17.333 16.153 A1.33 1.33 0 0 0 18 15',
|
|
18
|
+
'M17.333 8.513 L12.667 5.846', 'M18 15 L18 9.666',
|
|
19
|
+
'M18 9.666 A1.33 1.33 0 0 0 17.333 8.513', 'M6 15 A1.33 1.33 0 0 0 6.667 16.153',
|
|
20
|
+
'M6 9.666 L6 15', 'M6.2 9 L12 12.333', 'M6.667 16.153 L11.333 18.819',
|
|
21
|
+
'M6.667 8.513 A1.33 1.33 0 0 0 6 9.666'
|
|
22
|
+
];
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
26
|
+
stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-spatial-view-icon={kind}>
|
|
27
|
+
{#each kind === 'detail' ? detail : fullscreen as path}<path d={path} />{/each}
|
|
28
|
+
<rect x="1" y="2" width="22" height="20" rx="2" />
|
|
29
|
+
</svg>
|
|
@@ -2,4 +2,4 @@ import type { SpatialTheme } from '@spatial-elements/core/spatial-element/types'
|
|
|
2
2
|
/** Makes the current brand theme available to all spatial-element descendants. */
|
|
3
3
|
export declare function provideSpatialTheme(getTheme: () => SpatialTheme): void;
|
|
4
4
|
/** Returns the nearest brand theme or throws when the element shell is incomplete. */
|
|
5
|
-
export declare function useSpatialTheme(): SpatialTheme;
|
|
5
|
+
export declare function useSpatialTheme(): () => SpatialTheme;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Freeze the displayed (possibly interpolated) appearance, not the hover state.
|
|
2
|
+
* Read all known paint owners before any write. Motion may subsequently own an
|
|
3
|
+
* actor's transform; restore its motion first, then this appearance snapshot.
|
|
4
|
+
*/
|
|
5
|
+
export declare function freezeCardAppearance(card: HTMLElement): () => void;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const FROZEN = 'data-spatial-card-appearance-frozen';
|
|
2
|
+
const AFTER_OPACITY = '--spatial-card-frozen-after-opacity';
|
|
3
|
+
const TRANSITION = 'transition-property';
|
|
4
|
+
const TRANSITION_LONGHANDS = ['transition-duration', 'transition-timing-function', 'transition-delay', 'transition-behavior'];
|
|
5
|
+
/** Freeze the displayed (possibly interpolated) appearance, not the hover state.
|
|
6
|
+
* Read all known paint owners before any write. Motion may subsequently own an
|
|
7
|
+
* actor's transform; restore its motion first, then this appearance snapshot.
|
|
8
|
+
*/
|
|
9
|
+
export function freezeCardAppearance(card) {
|
|
10
|
+
const surface = card.querySelector('.spatial-element-card-surface');
|
|
11
|
+
const targets = [
|
|
12
|
+
{ element: card, properties: ['outline-color', 'outline-style', 'outline-width', 'outline-offset'] }
|
|
13
|
+
];
|
|
14
|
+
for (const element of card.querySelectorAll('[data-shared-role="title"], [data-shared-role="eyebrow"]')) {
|
|
15
|
+
targets.push({ element, properties: ['transform', 'text-shadow'] });
|
|
16
|
+
}
|
|
17
|
+
if (surface)
|
|
18
|
+
targets.push({ element: surface,
|
|
19
|
+
properties: ['border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color'] });
|
|
20
|
+
const poster = card.querySelector('[data-catalog-poster]');
|
|
21
|
+
if (poster)
|
|
22
|
+
targets.push({ element: poster, properties: ['transform', 'opacity'] });
|
|
23
|
+
const writes = [];
|
|
24
|
+
const snapshot = (element, name, frozen) => writes.push({ element, name, frozen,
|
|
25
|
+
original: element.style.getPropertyValue(name), priority: element.style.getPropertyPriority(name) });
|
|
26
|
+
for (const { element, properties } of targets) {
|
|
27
|
+
const computed = getComputedStyle(element);
|
|
28
|
+
for (const name of properties)
|
|
29
|
+
snapshot(element, name, computed.getPropertyValue(name));
|
|
30
|
+
// Suppressing the transition alone would jump to its final cascade value.
|
|
31
|
+
// Pin its current value first, and leave unrelated authored longhands alone.
|
|
32
|
+
if (element !== card) {
|
|
33
|
+
snapshot(element, TRANSITION, 'none');
|
|
34
|
+
// Motion saves/restores the shorthand on Dock actors. Retain these
|
|
35
|
+
// authored longhands too, even if that shorthand cannot serialize.
|
|
36
|
+
for (const name of TRANSITION_LONGHANDS)
|
|
37
|
+
snapshot(element, name);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const previousMarker = surface?.getAttribute(FROZEN);
|
|
41
|
+
if (surface)
|
|
42
|
+
snapshot(surface, AFTER_OPACITY, getComputedStyle(surface, '::after').opacity);
|
|
43
|
+
let restored = false;
|
|
44
|
+
const restore = () => {
|
|
45
|
+
if (restored)
|
|
46
|
+
return;
|
|
47
|
+
restored = true;
|
|
48
|
+
for (const { element, name, original, priority } of writes) {
|
|
49
|
+
if (original)
|
|
50
|
+
element.style.setProperty(name, original, priority);
|
|
51
|
+
else
|
|
52
|
+
element.style.removeProperty(name);
|
|
53
|
+
}
|
|
54
|
+
if (surface) {
|
|
55
|
+
if (previousMarker === null)
|
|
56
|
+
surface.removeAttribute(FROZEN);
|
|
57
|
+
else if (previousMarker !== undefined)
|
|
58
|
+
surface.setAttribute(FROZEN, previousMarker);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
try {
|
|
62
|
+
for (const { element, name, frozen } of writes)
|
|
63
|
+
if (frozen !== undefined)
|
|
64
|
+
element.style.setProperty(name, frozen, 'important');
|
|
65
|
+
surface?.setAttribute(FROZEN, '');
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
restore();
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
return restore;
|
|
72
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Test rendered text fragments, not the full width of their block container. */
|
|
2
|
+
export function carouselTextHit(target, x, y) {
|
|
3
|
+
if (!(target instanceof HTMLElement) || !target.closest('.summary') ||
|
|
4
|
+
target.closest('a, button, input, textarea, select, [contenteditable]'))
|
|
5
|
+
return;
|
|
6
|
+
const walker = document.createTreeWalker(target, NodeFilter.SHOW_TEXT);
|
|
7
|
+
const range = document.createRange();
|
|
8
|
+
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
|
|
9
|
+
if (!node.textContent?.trim())
|
|
10
|
+
continue;
|
|
11
|
+
range.selectNodeContents(node);
|
|
12
|
+
for (const rect of range.getClientRects()) {
|
|
13
|
+
if (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom)
|
|
14
|
+
return target;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { STAGE_SCROLL_PRIORITY, subscribeStageScrollFrame } from '@spatial-elements/core/stage/scrollFrame';
|
|
2
|
+
import { layoutTokens } from '@page-sections/core';
|
|
3
|
+
/** CSS sticky cannot follow a document translated by the shared stage. Keep the
|
|
4
|
+
* shared Page Sections markup, internal scrolling and native fallback intact. */
|
|
5
|
+
export function attachContentSidebars(host) {
|
|
6
|
+
const stage = host.closest('.stage');
|
|
7
|
+
const offsets = new Map();
|
|
8
|
+
const reset = (node) => {
|
|
9
|
+
node.style.removeProperty('translate');
|
|
10
|
+
node.removeAttribute('data-spatial-sticky-sidebar');
|
|
11
|
+
offsets.delete(node);
|
|
12
|
+
};
|
|
13
|
+
const update = () => {
|
|
14
|
+
const enhanced = stage?.classList.contains('stage-virtual-scroll-active');
|
|
15
|
+
const desktop = window.innerWidth >= layoutTokens.layoutMinWidths.xl;
|
|
16
|
+
const selector = desktop
|
|
17
|
+
? '.ps-left-sidebar > .sidebar-panel, .ps-content-menu-slot > .desktop'
|
|
18
|
+
: '.ps-content-menu-slot';
|
|
19
|
+
const nodes = new Set(enhanced ? host.querySelectorAll(selector) : []);
|
|
20
|
+
for (const node of offsets.keys())
|
|
21
|
+
if (!nodes.has(node))
|
|
22
|
+
reset(node);
|
|
23
|
+
if (!nodes.size)
|
|
24
|
+
return;
|
|
25
|
+
const boundary = host.querySelector('.ps-page-frame')?.getBoundingClientRect().bottom ?? Infinity;
|
|
26
|
+
for (const node of nodes) {
|
|
27
|
+
node.setAttribute('data-spatial-sticky-sidebar', '');
|
|
28
|
+
const rect = node.getBoundingClientRect();
|
|
29
|
+
const top = rect.top - (offsets.get(node) ?? 0);
|
|
30
|
+
const inset = parseFloat(getComputedStyle(node).getPropertyValue('--ps-sidebar-sticky-top')) || 16;
|
|
31
|
+
const height = desktop ? rect.height : 40;
|
|
32
|
+
const offset = Math.max(0, Math.min(inset - top, boundary - top - height));
|
|
33
|
+
node.style.translate = `0 ${offset}px`;
|
|
34
|
+
offsets.set(node, offset);
|
|
35
|
+
if (desktop)
|
|
36
|
+
node.style.setProperty('--ps-sidebar-available-height', `${Math.max(0, innerHeight - Math.max(inset, top + offset) - inset)}px`);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const stop = subscribeStageScrollFrame(update, STAGE_SCROLL_PRIORITY.virtualDocument + 2);
|
|
40
|
+
const resize = new ResizeObserver(update);
|
|
41
|
+
resize.observe(host);
|
|
42
|
+
const observer = new MutationObserver(update);
|
|
43
|
+
observer.observe(host, { childList: true, subtree: true });
|
|
44
|
+
if (stage)
|
|
45
|
+
observer.observe(stage, { attributes: true, attributeFilter: ['class'] });
|
|
46
|
+
window.addEventListener('resize', update);
|
|
47
|
+
update();
|
|
48
|
+
return () => {
|
|
49
|
+
stop();
|
|
50
|
+
resize.disconnect();
|
|
51
|
+
observer.disconnect();
|
|
52
|
+
window.removeEventListener('resize', update);
|
|
53
|
+
for (const node of offsets.keys())
|
|
54
|
+
reset(node);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
export { default as BrandStageShell } from './BrandStageShell.svelte';
|
|
2
|
+
export type { SpatialSummaryContext, SpatialSummarySnippet } from './spatialSummary.js';
|
|
3
|
+
export { defaultSpatialMessages, resolveSpatialMessages, type SpatialMessages, type SpatialMessagesInput } from '@spatial-elements/core/spatial-element/messages';
|
|
2
4
|
export { default as SpatialElementPage } from './SpatialElementPage.svelte';
|
|
3
5
|
export { default as SpatialListPage } from './SpatialListPage.svelte';
|
|
4
6
|
export { default as Section } from './Section.svelte';
|
|
5
7
|
export { findSpatialElement, getSpatialListItems } from '@spatial-elements/core/spatial-element/spatialElement';
|
|
6
|
-
export type { SpatialElementAction, SpatialTheme, SpatialElementBreadcrumb, SpatialElementData, SpatialDockedPanelTheme, SpatialElementFeature, SpatialElementMediaItem, SpatialMinimapTheme, SpatialListItem, SpatialElementSectionDefinition, SpatialElementSectionNavigationItem, SpatialElementSectionStyle, SpatialSectionTheme
|
|
8
|
+
export type { SpatialElementAction, SpatialTheme, SpatialThemeRadii, SpatialSectionBackgrounds, SectionBackground, SectionBackgroundColor, SpatialElementBreadcrumb, SpatialElementData, SpatialDockedPanelTheme, SpatialElementFeature, SpatialElementMediaItem, SpatialMinimapTheme, SpatialListItem, SpatialElementSectionDefinition, SpatialElementSectionNavigationItem, SpatialElementSectionStyle, SpatialSectionTheme } from '@spatial-elements/core/spatial-element/types';
|
|
7
9
|
export { default as ContentPage } from './ContentPage.svelte';
|
|
8
|
-
export { default as
|
|
9
|
-
export { default as
|
|
10
|
+
export { default as ContentGrid } from './ContentGrid.svelte';
|
|
11
|
+
export { default as ContentBlock } from './ContentBlock.svelte';
|
|
12
|
+
export type { ContentGridSize, ContentSpan, SpatialCardSize } from '@spatial-elements/core/spatial-element/responsiveLayout';
|
|
13
|
+
export { default as SpatialCarouselSection } from './SpatialCarouselSection.svelte';
|
|
14
|
+
export { default as SpatialCardGridSection } from './SpatialCardGridSection.svelte';
|
|
10
15
|
export type { ContentPageData } from '@spatial-elements/core/spatial-element/types';
|
|
11
16
|
export type { CarouselPresentation } from '@spatial-elements/core/catalog/catalogPose';
|
|
17
|
+
export { createSpatialTheme, resolveSpatialThemeRadii, resolveSpatialSectionBackgrounds, type SpatialThemeOptions } from '@spatial-elements/core/spatial-element/spatialTheme';
|
|
18
|
+
export type { StageRenderSettings, BackgroundSettings, StageModelSettings, StageCameraSettings } from '@spatial-elements/core/stage/stageTypes';
|
|
19
|
+
export { geometryFromLodPair, type SpatialElementGeometry } from '@spatial-elements/core/spatial-element/spatialElementGeometry';
|
|
20
|
+
export type { CardMediaAspect, CardMediaFit, SurfaceTone } from '@page-sections/core';
|
|
21
|
+
/** @deprecated Use SpatialCardGridSection. */
|
|
22
|
+
export { default as ListSection } from './SpatialCardGridSection.svelte';
|
|
23
|
+
/** @deprecated Use SpatialCarouselSection. */
|
|
24
|
+
export { default as CarouselSection } from './SpatialCarouselSection.svelte';
|
|
25
|
+
export type { SpatialCardGridOptions } from './spatialCardGrid.js';
|
|
26
|
+
export type { CardVariant } from '@page-sections/core';
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
export { default as BrandStageShell } from './BrandStageShell.svelte';
|
|
2
|
+
export { defaultSpatialMessages, resolveSpatialMessages } from '@spatial-elements/core/spatial-element/messages';
|
|
2
3
|
export { default as SpatialElementPage } from './SpatialElementPage.svelte';
|
|
3
4
|
export { default as SpatialListPage } from './SpatialListPage.svelte';
|
|
4
5
|
export { default as Section } from './Section.svelte';
|
|
5
6
|
export { findSpatialElement, getSpatialListItems } from '@spatial-elements/core/spatial-element/spatialElement';
|
|
6
7
|
export { default as ContentPage } from './ContentPage.svelte';
|
|
7
|
-
export { default as
|
|
8
|
-
export { default as
|
|
8
|
+
export { default as ContentGrid } from './ContentGrid.svelte';
|
|
9
|
+
export { default as ContentBlock } from './ContentBlock.svelte';
|
|
10
|
+
export { default as SpatialCarouselSection } from './SpatialCarouselSection.svelte';
|
|
11
|
+
export { default as SpatialCardGridSection } from './SpatialCardGridSection.svelte';
|
|
12
|
+
export { createSpatialTheme, resolveSpatialThemeRadii, resolveSpatialSectionBackgrounds } from '@spatial-elements/core/spatial-element/spatialTheme';
|
|
13
|
+
export { geometryFromLodPair } from '@spatial-elements/core/spatial-element/spatialElementGeometry';
|
|
14
|
+
/** @deprecated Use SpatialCardGridSection. */
|
|
15
|
+
export { default as ListSection } from './SpatialCardGridSection.svelte';
|
|
16
|
+
/** @deprecated Use SpatialCarouselSection. */
|
|
17
|
+
export { default as CarouselSection } from './SpatialCarouselSection.svelte';
|