@spatial-elements/sveltekit 1.0.0-beta.14 → 1.0.0-beta.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +1 -1
  2. package/dist/catalog/ScrollNavigationBridge.svelte +5 -1
  3. package/dist/catalog/ScrollNavigationBridge.svelte.d.ts +1 -1
  4. package/dist/catalog/stagedCatalogNavigation.d.ts +1 -1
  5. package/dist/spatial-element/BrandStageShell.svelte +27 -2
  6. package/dist/spatial-element/BrandStageShell.svelte.d.ts +2 -0
  7. package/dist/spatial-element/CarouselSpatialElement.svelte +7 -7
  8. package/dist/spatial-element/ContentPage.svelte +5 -2
  9. package/dist/spatial-element/ContentPage.svelte.d.ts +3 -0
  10. package/dist/spatial-element/OverflowControls.svelte +6 -6
  11. package/dist/spatial-element/PointerHint.svelte +5 -4
  12. package/dist/spatial-element/Section.svelte +4 -33
  13. package/dist/spatial-element/SpaceMouseControl.svelte +4 -4
  14. package/dist/spatial-element/SpatialCardGridSection.svelte +6 -9
  15. package/dist/spatial-element/SpatialCardPresentation.svelte +129 -33
  16. package/dist/spatial-element/SpatialCardPresentation.svelte.d.ts +2 -2
  17. package/dist/spatial-element/SpatialCardSlot.svelte +1 -1
  18. package/dist/spatial-element/SpatialCarouselSection.svelte +10 -2
  19. package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +14 -2
  20. package/dist/spatial-element/SpatialElementCard.svelte +7 -13
  21. package/dist/spatial-element/SpatialElementCard.svelte.d.ts +2 -2
  22. package/dist/spatial-element/SpatialElementHelp.svelte +7 -5
  23. package/dist/spatial-element/SpatialElementMediaRail.svelte +2 -1
  24. package/dist/spatial-element/SpatialElementPage.svelte +2 -2
  25. package/dist/spatial-element/SpatialElementStickyHeader.svelte +29 -5
  26. package/dist/spatial-element/SpatialElementSummaryContent.svelte +16 -8
  27. package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +4 -0
  28. package/dist/spatial-element/SpatialElementSummaryPanel.svelte +2 -1
  29. package/dist/spatial-element/SpatialElementTabList.svelte +32 -10
  30. package/dist/spatial-element/SpatialIconButton.svelte +2 -0
  31. package/dist/spatial-element/SpatialListPage.svelte +2 -2
  32. package/dist/spatial-element/SpatialNavigationShell.svelte +10 -44
  33. package/dist/spatial-element/SpatialSummaryHost.svelte +1 -1
  34. package/dist/spatial-element/SpatialSummaryRoot.svelte +33 -10
  35. package/dist/spatial-element/SpatialSummarySlot.svelte +1 -1
  36. package/dist/spatial-element/cardAppearanceFreeze.js +1 -1
  37. package/dist/spatial-element/carouselTextHit.js +2 -1
  38. package/dist/spatial-element/contentSidebars.js +15 -7
  39. package/dist/spatial-element/index.d.ts +1 -2
  40. package/dist/spatial-element/layout.generated.css +41 -17
  41. package/dist/spatial-element/spatialCardGrid.d.ts +3 -3
  42. package/dist/spatial-element/spatialSummary.d.ts +4 -2
  43. package/dist/spatial-element/spatialThemeStyle.js +4 -4
  44. package/dist/stage/ButtonGroup.svelte +2 -0
  45. package/dist/stage/Panel.svelte +11 -3
  46. package/dist/stage/Panel.svelte.d.ts +2 -0
  47. package/dist/stage/Stage.svelte +11 -3
  48. package/dist/stage/panelShadowStyle.d.ts +3 -0
  49. package/dist/stage/panelShadowStyle.js +11 -0
  50. package/package.json +9 -9
@@ -1,15 +1,20 @@
1
1
  <script lang="ts">
2
+ import { catalogViewLink } from '@spatial-elements/core/catalog/catalogViewLink';
3
+ import type { SpatialSummaryContext } from './spatialSummary.js';
2
4
  import type { Snippet } from "svelte";
3
5
  import { catalogActionSemantic } from '@spatial-elements/core/catalog/catalogAction';
4
6
  import type { CatalogEndpointAddress, CatalogEndpointRole } from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
5
7
  import type { SpatialElementFeature, SpatialElementAction } from '@spatial-elements/core/spatial-element/types';
6
- import ShoppingCart from 'lucide-svelte/icons/shopping-cart';
8
+ import ShoppingCart from '@lucide/svelte/icons/shopping-cart';
7
9
  import { createCatalogEndpointAction } from '../catalog/catalogEndpointAction.js';
8
- let { spatialElement, address, contentInset, heading = 'h3', leading, beforeAction, actionIcon, element = $bindable() }: {
10
+ let { spatialElement, address, contentInset, heading = 'h3', detailHref, carousel, leading, beforeAction, actionIcon, element = $bindable() }: {
9
11
  spatialElement: { id: string; eyebrow: string; title: string; features: SpatialElementFeature[]; action?: SpatialElementAction };
10
12
  address: (role: CatalogEndpointRole) => CatalogEndpointAddress | undefined;
11
13
  contentInset: number;
12
14
  heading?: 'h1' | 'h3';
15
+ /** Link for the eyebrow and title, normally provided by SpatialSummaryContext. */
16
+ detailHref?: string;
17
+ carousel?: SpatialSummaryContext['carousel'];
13
18
  leading?: Snippet;
14
19
  /** Optional content above the CTA, for example a price and quantity field. */
15
20
  beforeAction?: Snippet;
@@ -23,7 +28,7 @@
23
28
  data-catalog-rich-shared="leading" data-catalog-semantic={spatialElement.id}>
24
29
  {@render leading()}
25
30
  </div>{/if}
26
- <div class="panel-copy">
31
+ <a draggable="false" class="panel-copy" href={detailHref} data-spatial-summary-link data-catalog-focus-key={`summary-title:${JSON.stringify([spatialElement.id, carousel?.occurrence ?? 'detail'])}`} use:catalogViewLink={{ spatialElementId: spatialElement.id, targetPresentation: carousel?.item.targetPresentation }}>
27
32
  {#if spatialElement.eyebrow}
28
33
  <p
29
34
  class="panel-kicker"
@@ -43,7 +48,7 @@
43
48
  >
44
49
  {spatialElement.title}
45
50
  </svelte:element>
46
- </div>
51
+ </a>
47
52
 
48
53
  {#if spatialElement.features.length}<ul
49
54
  class="feature-list"
@@ -117,21 +122,24 @@
117
122
  box-sizing: border-box;
118
123
  display: flex;
119
124
  flex-direction: column;
120
- gap: 20px;
125
+ gap: 12px;
121
126
  /* The same live panel can leave a Section for the stage's detail layer. */
122
127
  line-height: 24px;
123
128
  pointer-events: auto;
124
129
  }
125
130
 
126
131
  .summary-title {
127
- margin: 10px 0 0;
132
+ margin: 6px 0 0;
128
133
  font-size: 24px;
129
134
  font-weight: 780;
130
135
  line-height: 1.16;
131
136
  }
132
- .summary-commerce { display: grid; gap: 20px; min-width: 0; align-content: start; }
137
+ .summary-commerce { display: grid; gap: 12px; min-width: 0; align-content: start; }
133
138
  .summary-leading, .panel-copy { min-width: 0; }
134
139
 
140
+ .panel-copy { user-select: text; display: block; color: inherit; text-decoration: none; }
141
+ .panel-copy:hover { text-decoration: none; }
142
+ .panel-copy:focus-visible { outline: 2px solid var(--spatial-element-accent); outline-offset: 4px; }
135
143
  .panel-kicker {
136
144
  margin: 0;
137
145
  font-size: 14px;
@@ -142,7 +150,7 @@
142
150
 
143
151
  .feature-list {
144
152
  display: grid;
145
- gap: 12px;
153
+ gap: 8px;
146
154
  margin: 0;
147
155
  padding: 0;
148
156
  color: var(--spatial-element-body);
@@ -1,3 +1,4 @@
1
+ import type { SpatialSummaryContext } from './spatialSummary.js';
1
2
  import type { Snippet } from "svelte";
2
3
  import type { CatalogEndpointAddress, CatalogEndpointRole } from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
3
4
  import type { SpatialElementFeature, SpatialElementAction } from '@spatial-elements/core/spatial-element/types';
@@ -12,6 +13,9 @@ type $$ComponentProps = {
12
13
  address: (role: CatalogEndpointRole) => CatalogEndpointAddress | undefined;
13
14
  contentInset: number;
14
15
  heading?: 'h1' | 'h3';
16
+ /** Link for the eyebrow and title, normally provided by SpatialSummaryContext. */
17
+ detailHref?: string;
18
+ carousel?: SpatialSummaryContext['carousel'];
15
19
  leading?: Snippet;
16
20
  /** Optional content above the CTA, for example a price and quantity field. */
17
21
  beforeAction?: Snippet;
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { page } from '$app/state';
2
3
  import { resolveSpatialThemeRadii } from '@spatial-elements/core/spatial-element/spatialTheme';
3
4
  import { onMount } from 'svelte';
4
5
  import SpatialSummarySlot from './SpatialSummarySlot.svelte';
@@ -59,7 +60,7 @@
59
60
  data-spatial-element-id={spatialElement.id}
60
61
  >
61
62
  <SpatialSummarySlot instanceKey={`detail:${theme.id}:${spatialElement.id}`} bind:element={presentation}
62
- context={{ spatialElement, contentInset, heading: 'h1', mode: 'detail',
63
+ context={{ spatialElement, contentInset, heading: 'h1', mode: 'detail', detailHref: page.url.pathname,
63
64
  address: (role) => ({ brandId: theme.id, spatialElementId: spatialElement.id, slot: 'detail.summary', role }) }} />
64
65
  </Panel>
65
66
  </div>
@@ -26,11 +26,20 @@
26
26
  const sectionId = currentSectionId;
27
27
  if (!linksElement || !sectionId) return;
28
28
 
29
- const activeLink = Array.from(
29
+ const links = Array.from(
30
30
  linksElement.querySelectorAll<HTMLElement>('[data-spatial-element-tab-id]')
31
- ).find((element) => element.dataset.spatialElementTabId === sectionId);
31
+ );
32
+ const activeLink = links.find((element) => element.dataset.spatialElementTabId === sectionId);
32
33
  if (!activeLink) return;
33
34
 
35
+ // Keep the dock's changing radii live; only select which group edges are rounded.
36
+ const rtl = getComputedStyle(linksElement).direction === 'rtl';
37
+ linksElement.style.setProperty(
38
+ '--spatial-element-tab-round-left', activeLink === links[rtl ? links.length - 1 : 0] ? '1' : '0'
39
+ );
40
+ linksElement.style.setProperty(
41
+ '--spatial-element-tab-round-right', activeLink === links[rtl ? 0 : links.length - 1] ? '1' : '0'
42
+ );
34
43
  linksElement.style.setProperty('--spatial-element-tab-active-left', `${activeLink.offsetLeft}px`);
35
44
  linksElement.style.setProperty('--spatial-element-tab-active-width', `${activeLink.offsetWidth}px`);
36
45
  if (!linksElement.hasAttribute('data-spatial-element-tab-indicator-ready') && !readyFrame) {
@@ -169,9 +178,12 @@
169
178
  left: 0;
170
179
  z-index: 0;
171
180
  width: var(--spatial-element-tab-active-width, 0px);
172
- border-radius: var(--spatial-element-tab-highlight-top-radius) var(--spatial-element-tab-highlight-top-radius)
173
- var(--spatial-element-tab-highlight-bottom-radius) var(--spatial-element-tab-highlight-bottom-radius);
174
- background: color-mix(in srgb, var(--spatial-element-body) 8%, transparent);
181
+ border-radius:
182
+ calc(var(--spatial-element-tab-round-left, 0) * var(--spatial-element-tab-highlight-top-radius))
183
+ calc(var(--spatial-element-tab-round-right, 0) * var(--spatial-element-tab-highlight-top-radius))
184
+ calc(var(--spatial-element-tab-round-right, 0) * var(--spatial-element-tab-highlight-bottom-radius))
185
+ calc(var(--spatial-element-tab-round-left, 0) * var(--spatial-element-tab-highlight-bottom-radius));
186
+ background: var(--spatial-element-tab-background);
175
187
  transform: translate3d(var(--spatial-element-tab-active-left, 0px), 0, 0);
176
188
  pointer-events: none;
177
189
  will-change: border-radius;
@@ -180,7 +192,8 @@
180
192
  .spatial-element-tab-links:global([data-spatial-element-tab-indicator-ready]) .spatial-element-tab-selection {
181
193
  transition:
182
194
  width var(--spatial-element-tab-navigation-duration) var(--spatial-element-tab-navigation-easing),
183
- transform var(--spatial-element-tab-navigation-duration) var(--spatial-element-tab-navigation-easing);
195
+ transform var(--spatial-element-tab-navigation-duration) var(--spatial-element-tab-navigation-easing),
196
+ border-radius var(--spatial-element-tab-navigation-duration) var(--spatial-element-tab-navigation-easing);
184
197
  }
185
198
 
186
199
  .spatial-element-tab-selection::after {
@@ -209,8 +222,7 @@
209
222
  box-sizing: border-box;
210
223
  height: 100%;
211
224
  padding: 0 16px;
212
- border-radius: var(--spatial-element-tab-highlight-top-radius) var(--spatial-element-tab-highlight-top-radius)
213
- var(--spatial-element-tab-highlight-bottom-radius) var(--spatial-element-tab-highlight-bottom-radius);
225
+ border-radius: 0;
214
226
  color: var(--spatial-element-navigation-ink, var(--spatial-element-ink));
215
227
  background: transparent;
216
228
  font-size: var(--spatial-element-tab-font-size);
@@ -221,6 +233,16 @@
221
233
  transition: background-color 180ms ease;
222
234
  }
223
235
 
236
+ .spatial-element-tab-list a:first-of-type {
237
+ border-start-start-radius: var(--spatial-element-tab-highlight-top-radius);
238
+ border-end-start-radius: var(--spatial-element-tab-highlight-bottom-radius);
239
+ }
240
+
241
+ .spatial-element-tab-list a:last-of-type {
242
+ border-start-end-radius: var(--spatial-element-tab-highlight-top-radius);
243
+ border-end-end-radius: var(--spatial-element-tab-highlight-bottom-radius);
244
+ }
245
+
224
246
  a::before,
225
247
  a > span {
226
248
  grid-area: 1 / 1;
@@ -245,7 +267,7 @@
245
267
  a.overview[aria-current='location'] svg { opacity: 1; }
246
268
 
247
269
  .spatial-element-tab-links:not([data-spatial-element-tab-indicator-ready]) a[aria-current='location'] {
248
- background: color-mix(in srgb, var(--spatial-element-body) 8%, transparent);
270
+ background: var(--spatial-element-tab-background);
249
271
  }
250
272
 
251
273
  .spatial-element-tab-links:not([data-spatial-element-tab-indicator-ready]) a[aria-current='location']::after {
@@ -282,7 +304,7 @@
282
304
 
283
305
  @media (prefers-reduced-motion: reduce) {
284
306
  a,
285
- .spatial-element-tab-selection {
307
+ .spatial-element-tab-links:global([data-spatial-element-tab-indicator-ready]) .spatial-element-tab-selection {
286
308
  transition: none;
287
309
  }
288
310
  }
@@ -26,6 +26,7 @@
26
26
  <div class="icon-frame" class:wide data-spatial-control={label}>
27
27
  <Panel
28
28
  class="spatial-icon-panel"
29
+ borderColor="transparent"
29
30
  shape={{ radius: radii.control, contentInset: 0 }}
30
31
  theme={theme.panelTheme}
31
32
  pointerReactive={false}
@@ -51,6 +52,7 @@
51
52
  /* The renderer moves panel contents into its projection layer; retain the anchor size. */
52
53
  .icon-frame :global(.spatial-icon-panel) { width: 40px; height: 40px; }
53
54
  .spatial-icon-button {
55
+ outline: 1px solid var(--ps-border); outline-offset: -1px;
54
56
  box-sizing: border-box; display: grid; place-items: center; width: 40px; height: 40px;
55
57
  padding: 0; border: 0; border-radius: var(--spatial-element-control-radius); background: transparent;
56
58
  font: inherit; font-size: 13px;
@@ -15,7 +15,7 @@ import { HeadingSection } from '@page-sections/svelte';
15
15
  hdr,
16
16
  sectionLink,
17
17
  cardSize,
18
- cardVariant,
18
+ cardShadow,
19
19
  itemSpan,
20
20
  textAlign,
21
21
  mediaAspect,
@@ -39,7 +39,7 @@ import { HeadingSection } from '@page-sections/svelte';
39
39
  section={{ id: 'elements', title: 'Elements' }}
40
40
  list={spatialElements}
41
41
  {cardSize}
42
- {cardVariant}
42
+ {cardShadow}
43
43
  {itemSpan}
44
44
  {textAlign}
45
45
  {mediaAspect}
@@ -5,7 +5,8 @@
5
5
  import { resolveSpatialThemeRadii } from '@spatial-elements/core/spatial-element/spatialTheme';
6
6
  import { getStageVisualScrollPosition, STAGE_SCROLL_PRIORITY, subscribeStageScrollFrame } from '@spatial-elements/core/stage/scrollFrame';
7
7
  import { STAGE_PANEL_LAYOUT_EVENT } from '@spatial-elements/core/stage/panelContext';
8
- import { Navigation } from '@page-sections/svelte';
8
+ import { getSharedPanelBoxShadow } from '@spatial-elements/core/stage/panelShadow';
9
+ import { Header } from '@page-sections/svelte';
9
10
  import { layoutTokens, type MenuItem } from '@page-sections/core';
10
11
  import { STAGE_CONTEXT_KEY, type StageContext } from '@spatial-elements/core/stage/panelContext';
11
12
  import { useSpatialTheme } from './brandContext.js';
@@ -15,7 +16,7 @@
15
16
  const stageContext = getContext<StageContext | undefined>(STAGE_CONTEXT_KEY);
16
17
  const readTheme = useSpatialTheme();
17
18
  const theme = $derived(readTheme());
18
- $effect(() => { void theme; void fixedDetail; void edgeToEdge; stageContext?.updatePanelAppearance?.(); });
19
+ $effect(() => { for (const element of rack?.querySelectorAll<HTMLElement>('.header, .satellite') ?? []) element.style.setProperty('--spatial-panel-default-shadow', getSharedPanelBoxShadow(theme.panelTheme.shadowIntensity ?? 0.2, theme.panelTheme.shadowColor)); void theme; void fixedDetail; void edgeToEdge; stageContext?.updatePanelAppearance?.(); });
19
20
  const radii = $derived(resolveSpatialThemeRadii(theme));
20
21
  let rack: HTMLDivElement;
21
22
  let stage: HTMLElement | undefined;
@@ -43,48 +44,16 @@
43
44
  if (previousMode !== `${enhancedScroll}/${fixedDetail}`) window.dispatchEvent(new Event(STAGE_PANEL_LAYOUT_EVENT));
44
45
  }
45
46
  function closePopovers() {
46
- for (const element of rack?.querySelectorAll<HTMLElement>(':popover-open') ?? []) element.hidePopover();
47
+ // Let the owning components close their state as well as their top-layer panels.
48
+ if (rack?.querySelector(':popover-open')) window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }));
47
49
  for (const details of rack?.querySelectorAll<HTMLDetailsElement>('details[open]') ?? []) details.open = false;
48
50
  }
49
51
  afterNavigate(() => { void tick().then(updateMode); });
50
- beforeNavigate(closePopovers);
52
+ beforeNavigate((navigation) => { if (!navigation.shallow || navigation.type === 'popstate') closePopovers(); });
51
53
 
52
54
  onMount(() => {
53
55
  stage = rack.closest<HTMLElement>('.stage') ?? undefined;
54
56
  updateMode();
55
- // Projected panel content lives above the ordinary DOM layer. Promote only
56
- // open navigation dropdowns to the browser top layer, retaining their DOM
57
- // ownership, shared markup and delegated events.
58
- const dropdownStyles = new Map<HTMLElement, string | null>();
59
- function restoreDropdown(panel: HTMLElement) {
60
- if (!dropdownStyles.has(panel)) return;
61
- if (panel.matches(':popover-open')) panel.hidePopover();
62
- panel.removeAttribute('popover');
63
- const style = dropdownStyles.get(panel);
64
- if (style === null) panel.removeAttribute('style');
65
- else panel.setAttribute('style', style!);
66
- dropdownStyles.delete(panel);
67
- }
68
- function toggleDropdown(event: Event) {
69
- if (!(event.target instanceof HTMLDetailsElement)) return;
70
- const details = event.target;
71
- const panel = details.querySelector<HTMLElement>(':scope > .settings-panel, :scope > .mobile-panel, :scope > .ps-submenu');
72
- if (!panel || !('showPopover' in panel)) return;
73
- // Nested menu entries stay inside their already elevated parent panel.
74
- if (details.closest('.mobile-panel, .ps-submenu')) return;
75
- if (!details.open) { restoreDropdown(panel); return; }
76
- if (dropdownStyles.has(panel)) return;
77
- const rect = panel.getBoundingClientRect();
78
- dropdownStyles.set(panel, panel.getAttribute('style'));
79
- panel.popover = 'manual';
80
- Object.assign(panel.style, { position: 'fixed', inset: 'auto', margin: '0',
81
- left: rect.left + 'px', top: rect.top + 'px', width: rect.width + 'px',
82
- boxSizing: 'border-box', maxHeight: Math.max(0, innerHeight - rect.top - 12) + 'px', overflowY: 'auto' });
83
- panel.showPopover();
84
- }
85
- rack.addEventListener('toggle', toggleDropdown, true);
86
- window.addEventListener('scroll', closePopovers, { passive: true });
87
- window.addEventListener('resize', closePopovers, { passive: true });
88
57
  const observer = new MutationObserver(updateMode);
89
58
  if (stage) observer.observe(stage, { attributes: true, attributeFilter: ['class'] });
90
59
  // Shared navigation owns the boxes; the stage only enhances their surfaces.
@@ -92,6 +61,7 @@
92
61
  const role = element.classList.contains('header') ? 'menu' : element.classList.contains('left') ? 'left' : 'right';
93
62
  element.setAttribute('data-spatial-shell-' + role, '');
94
63
  element.classList.add('spatial-shell-' + (role === 'menu' ? 'menu' : 'satellite'));
64
+ element.style.setProperty('--spatial-panel-default-shadow', getSharedPanelBoxShadow(theme.panelTheme.shadowIntensity ?? 0.2, theme.panelTheme.shadowColor));
95
65
  element.dataset.stagePanelNativeContent = '';
96
66
  return stageContext?.registerPanel({
97
67
  getElement: () => element, getFrameElement: () => element, getSurfaceElement: () => element,
@@ -107,17 +77,13 @@
107
77
  const stop = subscribeStageScrollFrame(frame => position(frame.scrollY), STAGE_SCROLL_PRIORITY.virtualDocument + 1);
108
78
  window.addEventListener('resize', updateMode, { passive: true });
109
79
  return () => {
110
- rack.removeEventListener('toggle', toggleDropdown, true);
111
- window.removeEventListener('scroll', closePopovers);
112
- window.removeEventListener('resize', closePopovers);
113
- for (const panel of dropdownStyles.keys()) restoreDropdown(panel);
114
80
  releases.forEach(release => release?.()); stop(); observer.disconnect(); window.removeEventListener('resize', updateMode); };
115
81
  });
116
82
  </script>
117
83
 
118
84
  <div class="spatial-shell-track" style:--ps-sticky-range={`${spatialLayoutTokens.menu.scrollThreshold}px`} data-spatial-navigation-shell>
119
- <div bind:this={rack} class="spatial-shell-rack" data-stage-scroll-shell data-catalog-shell data-spatial-navigation-glass={theme.panelTheme.surface === 'glass' ? '' : undefined}>
120
- {#if navigation}{@render navigation()}{:else}<Navigation {menu} {items} {brand} {tools} {left} {right} />{/if}
85
+ <div bind:this={rack} class="spatial-shell-rack" style:--spatial-panel-default-shadow={getSharedPanelBoxShadow(theme.panelTheme.shadowIntensity ?? 0.2, theme.panelTheme.shadowColor)} data-stage-scroll-shell data-catalog-shell data-spatial-navigation-glass={theme.panelTheme.surface === 'glass' ? '' : undefined}>
86
+ {#if navigation}{@render navigation()}{:else}<Header scrollBehavior="static" {menu} {items} {brand} {tools} {left} {right} />{/if}
121
87
  </div>
122
88
  </div>
123
89
  <style>
@@ -131,7 +97,7 @@
131
97
  background: rgb(var(--spatial-element-panel-tint-rgb) / var(--spatial-element-panel-tint-opacity));
132
98
  -webkit-backdrop-filter: blur(var(--spatial-element-panel-backdrop-blur));
133
99
  backdrop-filter: blur(var(--spatial-element-panel-backdrop-blur));
134
- box-shadow: var(--spatial-element-panel-box-shadow);
100
+ box-shadow: var(--ps-navigation-shadow, var(--ps-panel-shadow, var(--spatial-element-panel-box-shadow, var(--spatial-panel-default-shadow))));
135
101
  }
136
102
  .spatial-shell-rack :global(.header) { border-radius: var(--spatial-element-panel-radius); }
137
103
  .spatial-shell-rack :global(.satellite) { border-radius: var(--spatial-element-control-radius); }
@@ -13,7 +13,7 @@
13
13
  </script>
14
14
  {#snippet renderSummary(context: SpatialSummaryContext)}
15
15
  {#if summary}{@render summary(context)}{:else}
16
- <SpatialElementSummaryContent spatialElement={context.spatialElement} address={context.address} heading={context.heading} contentInset={context.contentInset} />
16
+ <SpatialElementSummaryContent {...context} />
17
17
  {/if}
18
18
  {/snippet}
19
19
  {@render children?.()}
@@ -4,6 +4,7 @@
4
4
  import SpatialCardPresentation from './SpatialCardPresentation.svelte';
5
5
  import { createCatalogEndpointAction } from '../catalog/catalogEndpointAction.js';
6
6
  import { useCatalogNavigation } from '../catalog/catalogNavigation.js';
7
+ import { focusCatalogLink } from '@spatial-elements/core/catalog/catalogActivationFocus';
7
8
  import { catalogViewLink } from '@spatial-elements/core/catalog/catalogViewLink';
8
9
  import { CATALOG_ENDPOINTS, type CatalogEndpointRegistry } from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
9
10
  import { CATALOG_SECTIONS, type CatalogSections } from '@spatial-elements/core/catalog/CatalogSections';
@@ -14,25 +15,41 @@
14
15
  const endpoints = getContext<CatalogEndpointRegistry | undefined>(CATALOG_ENDPOINTS);
15
16
  const sections = getContext<CatalogSections | undefined>(CATALOG_SECTIONS);
16
17
  const { href, prepare } = useCatalogNavigation();
17
- function activate(event: MouseEvent) {
18
+ function activate(event: MouseEvent, anchor = event.currentTarget as HTMLAnchorElement) {
18
19
  if (!model.active || !context || !carousel) { event.preventDefault(); return; }
19
20
  endpoints?.prefer(context.spatialElement.brandId, context.spatialElement.id, carousel.occurrence, 'carousel.front');
20
21
  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
+ focusCatalogLink(anchor, event);
22
23
  }
23
- function prepareCarousel() { if (model.active && carousel) prepare(carousel.item); }
24
+ function summaryLinks(node: HTMLElement) {
25
+ const click = (event: MouseEvent) => {
26
+ const selection = window.getSelection();
27
+ // A text-selection release still produces a click on an anchor. Keep it from
28
+ // focusing/navigating before the native selection can be copied.
29
+ if (event.detail > 0 && selection && !selection.isCollapsed && node.contains(selection.anchorNode) && node.contains(selection.focusNode)) {
30
+ event.preventDefault(); event.stopImmediatePropagation(); return;
31
+ }
32
+ if (context?.mode === 'carousel' && event.target instanceof Element && event.target.closest('[data-spatial-summary-link]')) activate(event, event.target.closest<HTMLAnchorElement>('[data-spatial-summary-link]')!);
33
+ };
34
+ node.addEventListener('click', click, true); node.addEventListener('pointerenter', prepareCarousel); node.addEventListener('focusin', prepareCarousel);
35
+ return { destroy() { node.removeEventListener('click', click, true); node.removeEventListener('pointerenter', prepareCarousel); node.removeEventListener('focusin', prepareCarousel); } };
36
+ }
37
+ function prepareCarousel(event?: Event) { if (event?.target instanceof Element && event.target.closest('[data-catalog-restoring-focus]')) return; if (model.active && carousel) prepare(carousel.item); }
24
38
  </script>
25
39
  {#if model.kind === 'card'}
26
40
  <SpatialCardPresentation {...model.current} active={model.active} />
27
41
  {:else}
28
42
  <div class="spatial-summary-surface" hidden={model.current.mode !== 'carousel'} aria-hidden="true"></div>
29
43
  {#if model.current.carousel}
30
- <div class="compact-copy" hidden={model.current.mode !== 'carousel'}>
44
+ <a use:summaryLinks draggable="false" class="compact-copy" hidden={model.current.mode !== 'carousel'} href={href(model.current.carousel.item.href)} onclick={activate} onpointerenter={prepareCarousel} onfocus={prepareCarousel} onpointerdown={prepareCarousel}
45
+ use:catalogViewLink={{ spatialElementId: model.current.spatialElement.id, targetPresentation: model.current.carousel.item.targetPresentation }}
46
+ aria-label={`More information: ${model.current.spatialElement.title}`} data-catalog-focus-key={`catalog-compact:${model.current.carousel.occurrence}`}>
31
47
  {#if model.current.spatialElement.eyebrow}<p use:catalogEndpoint={model.active && carousel?.compact ? model.current.address('eyebrow') : undefined}>{model.current.spatialElement.eyebrow}</p>{/if}
32
48
  <h3 use:catalogEndpoint={model.active && carousel?.compact ? model.current.address('title') : undefined}>{model.current.spatialElement.title}</h3>
33
- </div>
49
+ <svg class="compact-arrow" viewBox="0 0 24 24" aria-hidden="true"><path d="M7 17 17 7M7 7h10v10" /></svg>
50
+ </a>
34
51
  {/if}
35
- <div data-spatial-summary-root class="spatial-summary-query" class:full-summary={model.current.mode === 'carousel'}>
52
+ <div use:summaryLinks data-spatial-summary-root class="spatial-summary-query" class:full-summary={model.current.mode === 'carousel'}>
36
53
  {@render content(model.active && !carousel?.compact ? model.current : { ...model.current, address: () => undefined })}
37
54
  </div>
38
55
  {#if model.current.carousel}
@@ -59,16 +76,22 @@
59
76
  :global(.spatial-summary-island[data-presentation-mode='carousel']) > * { opacity: var(--carousel-panel-opacity, 1); filter: var(--carousel-focus-blur, none); }
60
77
  .spatial-summary-surface {
61
78
  position: absolute; inset: 0; border-radius: inherit; background: color-mix(in srgb, var(--carousel-panel-tint, white) var(--carousel-panel-tint-opacity, 65%), transparent);
62
- border: 1px solid color-mix(in srgb, var(--spatial-element-accent) 12%, transparent); backdrop-filter: var(--carousel-panel-backdrop, blur(5px)); box-shadow: var(--carousel-panel-shadow); pointer-events: none;
79
+ border: 1px solid var(--ps-panel-border); backdrop-filter: var(--carousel-panel-backdrop, blur(5px)); box-shadow: var(--carousel-panel-shadow); pointer-events: none;
63
80
  }
64
81
  .spatial-summary-surface[hidden] { display: none; }
65
82
  :global([data-carousel-glass-ready]) .spatial-summary-surface,
66
83
  :global([data-spatial-presentation-glass]) .spatial-summary-surface { visibility: hidden; }
67
- .compact-copy { position: relative; box-sizing: border-box; padding: 8px 52px 8px 12px; }
84
+ .compact-copy { user-select: text; position: relative; display: flex; flex-direction: column; justify-content: center; height: 100%; box-sizing: border-box; padding: 8px 40px 8px 12px; color: inherit; text-decoration: none; }
85
+ .compact-copy:hover { text-decoration: none; }
86
+ .compact-arrow { position: absolute; right: 10px; top: 10px; width: 20px; height: 20px; fill: none; stroke: var(--spatial-element-accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
87
+ .compact-copy:focus-visible { outline: 2px solid var(--spatial-element-accent); outline-offset: -2px; border-radius: inherit; }
88
+ .compact-copy[hidden] { display: none; }
68
89
  .compact-copy p { height: 26px; margin: 0; font-size: 12px; line-height: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
69
- .compact-copy h3 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 1; height: 24px; margin: 0; overflow: hidden; font-size: 18px; line-height: 24px; }
90
+ .compact-copy h3 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; line-clamp: 1; height: 24px; margin: 0; overflow: hidden; font-size: 18px; line-height: 24px; }
70
91
  .full-summary, .section-information { display: none; }
71
- .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; }
92
+ .information { display: none; }
93
+ @media (min-width: 840px) { .information { display: grid; } }
94
+ .information { position: absolute; top: 0; right: 0; place-items: center; width: 40px; height: 40px; margin: 0; color: var(--spatial-element-accent); pointer-events: auto; }
72
95
  .information svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
73
96
  @media (min-width: 840px) {
74
97
  :global(.spatial-summary-island[data-presentation-mode='carousel']) { height: auto; padding: var(--spatial-summary-content-inset); }
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { browser } from '$app/environment';
2
+ import { browser } from '$app/env';
3
3
  import { createRawSnippet, getContext, onMount, untrack } from 'svelte';
4
4
  import { render } from 'svelte/server';
5
5
  import { SpatialSummaryHostController, SPATIAL_SUMMARY_HOST } from './spatialSummaryHost.svelte.js';
@@ -16,7 +16,7 @@ export function freezeCardAppearance(card) {
16
16
  }
17
17
  if (surface)
18
18
  targets.push({ element: surface,
19
- properties: ['border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color'] });
19
+ properties: ['box-shadow', 'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color'] });
20
20
  const poster = card.querySelector('[data-catalog-poster]');
21
21
  if (poster)
22
22
  targets.push({ element: poster, properties: ['transform', 'opacity'] });
@@ -1,7 +1,8 @@
1
1
  /** Test rendered text fragments, not the full width of their block container. */
2
2
  export function carouselTextHit(target, x, y) {
3
3
  if (!(target instanceof HTMLElement) || !target.closest('.summary') ||
4
- target.closest('a, button, input, textarea, select, [contenteditable]'))
4
+ target.closest('button, input, textarea, select, [contenteditable]') ||
5
+ (target.closest('a') && !target.closest('[data-spatial-summary-link], .compact-copy')))
5
6
  return;
6
7
  const walker = document.createTreeWalker(target, NodeFilter.SHOW_TEXT);
7
8
  const range = document.createRange();
@@ -5,17 +5,20 @@ import { layoutTokens } from '@page-sections/core';
5
5
  export function attachContentSidebars(host) {
6
6
  const stage = host.closest('.stage');
7
7
  const offsets = new Map();
8
+ const body = host.querySelector('.ps-page-content .page-body');
9
+ let menu = host.querySelector('.ps-content-menu-slot');
8
10
  const reset = (node) => {
9
11
  node.style.removeProperty('translate');
10
12
  node.removeAttribute('data-spatial-sticky-sidebar');
11
13
  offsets.delete(node);
12
14
  };
13
15
  const update = () => {
16
+ menu = host.querySelector('.ps-content-menu-slot');
14
17
  const enhanced = stage?.classList.contains('stage-virtual-scroll-active');
15
18
  const desktop = window.innerWidth >= layoutTokens.layoutMinWidths.xl;
16
19
  const selector = desktop
17
20
  ? '.ps-left-sidebar > .sidebar-panel, .ps-content-menu-slot > .desktop'
18
- : '.ps-content-menu-slot';
21
+ : '.ps-content-menu-slot > .mobile';
19
22
  const nodes = new Set(enhanced ? host.querySelectorAll(selector) : []);
20
23
  for (const node of offsets.keys())
21
24
  if (!nodes.has(node))
@@ -23,23 +26,28 @@ export function attachContentSidebars(host) {
23
26
  if (!nodes.size)
24
27
  return;
25
28
  const boundary = host.querySelector('.ps-page-frame')?.getBoundingClientRect().bottom ?? Infinity;
29
+ const contentBottom = body?.getBoundingClientRect().bottom ?? boundary;
26
30
  for (const node of nodes) {
27
31
  node.setAttribute('data-spatial-sticky-sidebar', '');
28
32
  const rect = node.getBoundingClientRect();
29
33
  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
+ const inset = desktop ? parseFloat(getComputedStyle(node).getPropertyValue('--ps-sidebar-sticky-top')) || 16 : 12;
35
+ const isContentMenu = menu?.contains(node);
36
+ const bottom = isContentMenu ? contentBottom - (desktop ? parseFloat(getComputedStyle(menu).paddingBottom) || 0 : 0) : boundary;
37
+ const offset = Math.max(0, Math.min(inset - top, bottom - top - rect.height));
38
+ if (offsets.get(node) !== offset)
39
+ node.style.translate = `0 ${offset}px`;
34
40
  offsets.set(node, offset);
35
41
  if (desktop)
36
42
  node.style.setProperty('--ps-sidebar-available-height', `${Math.max(0, innerHeight - Math.max(inset, top + offset) - inset)}px`);
37
43
  }
38
44
  };
39
45
  const stop = subscribeStageScrollFrame(update, STAGE_SCROLL_PRIORITY.virtualDocument + 2);
40
- const resize = new ResizeObserver(update);
46
+ const resize = new ResizeObserver(() => { update(); });
41
47
  resize.observe(host);
42
- const observer = new MutationObserver(update);
48
+ if (body)
49
+ resize.observe(body);
50
+ const observer = new MutationObserver(() => { update(); });
43
51
  observer.observe(host, { childList: true, subtree: true });
44
52
  if (stage)
45
53
  observer.observe(stage, { attributes: true, attributeFilter: ['class'] });
@@ -6,7 +6,7 @@ export { default as SpatialElementPage } from './SpatialElementPage.svelte';
6
6
  export { default as SpatialListPage } from './SpatialListPage.svelte';
7
7
  export { default as Section } from './Section.svelte';
8
8
  export { findSpatialElement, getSpatialListItems } from '@spatial-elements/core/spatial-element/spatialElement';
9
- 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';
9
+ export type { SpatialElementAction, SpatialTheme, SpatialThemeRadii, SpatialSectionBackgrounds, SectionBackground, SectionBackgroundColor, SpatialElementBreadcrumb, SpatialElementData, SpatialCollectionPose, SpatialDockedPanelTheme, SpatialElementFeature, SpatialElementMediaItem, SpatialMinimapTheme, SpatialListItem, SpatialElementSectionDefinition, SpatialElementSectionNavigationItem, SpatialElementSectionStyle, SpatialSectionTheme } from '@spatial-elements/core/spatial-element/types';
10
10
  export { default as ContentPage } from './ContentPage.svelte';
11
11
  export { default as ContentGrid } from './ContentGrid.svelte';
12
12
  export { default as ContentBlock } from './ContentBlock.svelte';
@@ -24,4 +24,3 @@ export { default as ListSection } from './SpatialCardGridSection.svelte';
24
24
  /** @deprecated Use SpatialCarouselSection. */
25
25
  export { default as CarouselSection } from './SpatialCarouselSection.svelte';
26
26
  export type { SpatialCardGridOptions } from './spatialCardGrid.js';
27
- export type { CardVariant } from '@page-sections/core';