@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.
Files changed (129) hide show
  1. package/README.md +19 -9
  2. package/dist/catalog/ScrollNavigationBridge.svelte +172 -47
  3. package/dist/catalog/ScrollNavigationBridge.svelte.d.ts +9 -2
  4. package/dist/catalog/catalogNavigation.js +3 -2
  5. package/dist/catalog/catalogSummaryTransfer.d.ts +16 -0
  6. package/dist/catalog/catalogSummaryTransfer.js +79 -0
  7. package/dist/catalog/catalogTransition.css +58 -3
  8. package/dist/catalog/interruptedPresentation.d.ts +10 -0
  9. package/dist/catalog/interruptedPresentation.js +29 -0
  10. package/dist/catalog/presentationCleanup.d.ts +4 -0
  11. package/dist/catalog/presentationCleanup.js +20 -0
  12. package/dist/catalog/stagedCatalogNavigation.d.ts +44 -0
  13. package/dist/catalog/stagedCatalogNavigation.js +403 -0
  14. package/dist/catalog/stagedDomReveal.d.ts +8 -0
  15. package/dist/catalog/stagedDomReveal.js +76 -0
  16. package/dist/index.d.ts +4 -0
  17. package/dist/index.js +3 -0
  18. package/dist/spatial-element/BrandStageShell.svelte +52 -71
  19. package/dist/spatial-element/BrandStageShell.svelte.d.ts +31 -4
  20. package/dist/spatial-element/CarouselSpatialElement.svelte +150 -197
  21. package/dist/spatial-element/CarouselSpatialElement.svelte.d.ts +5 -1
  22. package/dist/spatial-element/ContentBlock.svelte +7 -0
  23. package/dist/spatial-element/ContentBlock.svelte.d.ts +9 -0
  24. package/dist/spatial-element/ContentGrid.svelte +7 -0
  25. package/dist/spatial-element/ContentGrid.svelte.d.ts +8 -0
  26. package/dist/spatial-element/ContentPage.svelte +51 -55
  27. package/dist/spatial-element/ContentPage.svelte.d.ts +14 -3
  28. package/dist/spatial-element/InteractionGesture.svelte +39 -0
  29. package/dist/spatial-element/InteractionGesture.svelte.d.ts +7 -0
  30. package/dist/spatial-element/OverflowControls.svelte +125 -0
  31. package/dist/spatial-element/OverflowControls.svelte.d.ts +9 -0
  32. package/dist/spatial-element/PointerHint.svelte +80 -0
  33. package/dist/spatial-element/PointerHint.svelte.d.ts +3 -0
  34. package/dist/spatial-element/Section.svelte +25 -106
  35. package/dist/spatial-element/Section.svelte.d.ts +1 -0
  36. package/dist/spatial-element/SectionSurfaceGroup.svelte +8 -0
  37. package/dist/spatial-element/SectionSurfaceGroup.svelte.d.ts +8 -0
  38. package/dist/spatial-element/SpatialCardGridSection.svelte +79 -0
  39. package/dist/spatial-element/SpatialCardGridSection.svelte.d.ts +11 -0
  40. package/dist/spatial-element/SpatialCardPresentation.svelte +311 -0
  41. package/dist/spatial-element/SpatialCardPresentation.svelte.d.ts +19 -0
  42. package/dist/spatial-element/SpatialCardSlot.svelte +33 -0
  43. package/dist/spatial-element/SpatialCardSlot.svelte.d.ts +8 -0
  44. package/dist/spatial-element/SpatialCarouselSection.svelte +752 -0
  45. package/dist/spatial-element/{CarouselSection.svelte.d.ts → SpatialCarouselSection.svelte.d.ts} +5 -5
  46. package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +12 -65
  47. package/dist/spatial-element/SpatialElementCard.svelte +54 -238
  48. package/dist/spatial-element/SpatialElementCard.svelte.d.ts +9 -0
  49. package/dist/spatial-element/SpatialElementHelp.svelte +292 -0
  50. package/dist/spatial-element/SpatialElementHelp.svelte.d.ts +6 -0
  51. package/dist/spatial-element/SpatialElementMediaRail.svelte +321 -52
  52. package/dist/spatial-element/SpatialElementMediaRail.svelte.d.ts +4 -1
  53. package/dist/spatial-element/SpatialElementNativeMedia.svelte +101 -0
  54. package/dist/spatial-element/SpatialElementNativeMedia.svelte.d.ts +9 -0
  55. package/dist/spatial-element/SpatialElementPage.svelte +150 -70
  56. package/dist/spatial-element/SpatialElementPage.svelte.d.ts +6 -3
  57. package/dist/spatial-element/SpatialElementStickyHeader.svelte +76 -104
  58. package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +3 -1
  59. package/dist/spatial-element/SpatialElementSummaryContent.svelte +185 -0
  60. package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +18 -0
  61. package/dist/spatial-element/SpatialElementSummaryPanel.svelte +48 -380
  62. package/dist/spatial-element/SpatialElementSummaryPanel.svelte.d.ts +2 -1
  63. package/dist/spatial-element/SpatialElementTabList.svelte +40 -17
  64. package/dist/spatial-element/SpatialElementTabList.svelte.d.ts +2 -1
  65. package/dist/spatial-element/SpatialElementTabs.svelte +61 -18
  66. package/dist/spatial-element/SpatialElementTabs.svelte.d.ts +3 -1
  67. package/dist/spatial-element/SpatialElementViewToggle.svelte +54 -0
  68. package/dist/spatial-element/SpatialElementViewToggle.svelte.d.ts +8 -0
  69. package/dist/spatial-element/SpatialIconButton.svelte +59 -0
  70. package/dist/spatial-element/SpatialIconButton.svelte.d.ts +14 -0
  71. package/dist/spatial-element/SpatialListPage.svelte +37 -8
  72. package/dist/spatial-element/SpatialListPage.svelte.d.ts +4 -1
  73. package/dist/spatial-element/SpatialMediaIndicator.svelte +16 -0
  74. package/dist/spatial-element/SpatialMediaIndicator.svelte.d.ts +26 -0
  75. package/dist/spatial-element/SpatialNavigationShell.svelte +136 -0
  76. package/dist/spatial-element/SpatialNavigationShell.svelte.d.ts +15 -0
  77. package/dist/spatial-element/SpatialSummaryHost.svelte +19 -0
  78. package/dist/spatial-element/SpatialSummaryHost.svelte.d.ts +9 -0
  79. package/dist/spatial-element/SpatialSummaryRoot.svelte +78 -0
  80. package/dist/spatial-element/SpatialSummaryRoot.svelte.d.ts +8 -0
  81. package/dist/spatial-element/SpatialSummarySlot.svelte +39 -0
  82. package/dist/spatial-element/SpatialSummarySlot.svelte.d.ts +9 -0
  83. package/dist/spatial-element/SpatialViewIcon.svelte +29 -0
  84. package/dist/spatial-element/SpatialViewIcon.svelte.d.ts +6 -0
  85. package/dist/spatial-element/brandContext.d.ts +1 -1
  86. package/dist/spatial-element/brandContext.js +1 -1
  87. package/dist/spatial-element/cardAppearanceFreeze.d.ts +5 -0
  88. package/dist/spatial-element/cardAppearanceFreeze.js +72 -0
  89. package/dist/spatial-element/carouselTextHit.d.ts +2 -0
  90. package/dist/spatial-element/carouselTextHit.js +17 -0
  91. package/dist/spatial-element/contentSidebars.d.ts +3 -0
  92. package/dist/spatial-element/contentSidebars.js +56 -0
  93. package/dist/spatial-element/index.d.ts +18 -3
  94. package/dist/spatial-element/index.js +11 -2
  95. package/dist/spatial-element/layout.generated.css +363 -0
  96. package/dist/spatial-element/messagesContext.d.ts +3 -0
  97. package/dist/spatial-element/messagesContext.js +10 -0
  98. package/dist/spatial-element/presentationBoxFreeze.d.ts +8 -0
  99. package/dist/spatial-element/presentationBoxFreeze.js +35 -0
  100. package/dist/spatial-element/spatialCardGrid.d.ts +12 -0
  101. package/dist/spatial-element/spatialCardGrid.js +1 -0
  102. package/dist/spatial-element/spatialPageContext.d.ts +4 -0
  103. package/dist/spatial-element/spatialPageContext.js +9 -0
  104. package/dist/spatial-element/spatialPresentationOwner.d.ts +6 -0
  105. package/dist/spatial-element/spatialPresentationOwner.js +2 -0
  106. package/dist/spatial-element/spatialSummary.d.ts +43 -0
  107. package/dist/spatial-element/spatialSummary.js +1 -0
  108. package/dist/spatial-element/spatialSummaryHost.svelte.d.ts +60 -0
  109. package/dist/spatial-element/spatialSummaryHost.svelte.js +233 -0
  110. package/dist/spatial-element/spatialThemeStyle.d.ts +3 -0
  111. package/dist/spatial-element/spatialThemeStyle.js +69 -0
  112. package/dist/spatial-element/truncatedTitle.d.ts +5 -0
  113. package/dist/spatial-element/truncatedTitle.js +28 -0
  114. package/dist/stage/ButtonGroup.svelte +151 -0
  115. package/dist/stage/ButtonGroup.svelte.d.ts +24 -0
  116. package/dist/stage/Panel.svelte +72 -14
  117. package/dist/stage/Panel.svelte.d.ts +14 -2
  118. package/dist/stage/Stage.svelte +405 -48
  119. package/dist/stage/Stage.svelte.d.ts +8 -1
  120. package/dist/stage/StageViewport.svelte +15 -2
  121. package/dist/stage/authoredStyle.d.ts +4 -0
  122. package/dist/stage/authoredStyle.js +17 -0
  123. package/dist/stage/buttonGroup.d.ts +9 -0
  124. package/dist/stage/buttonGroup.js +1 -0
  125. package/logo.svg +188 -0
  126. package/package.json +9 -6
  127. package/dist/spatial-element/CarouselSection.svelte +0 -350
  128. package/dist/spatial-element/ListSection.svelte +0 -30
  129. package/dist/spatial-element/ListSection.svelte.d.ts +0 -8
@@ -1,5 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { onMount } from 'svelte';
3
+ import OverflowControls from './OverflowControls.svelte';
4
+ import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
3
5
  import {
4
6
  STAGE_ANCHOR_SCROLL_DURATION_MS,
5
7
  STAGE_ANCHOR_SCROLL_EASING
@@ -7,13 +9,14 @@
7
9
  import type { SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
8
10
 
9
11
  interface Props {
12
+ element?: HTMLElement;
10
13
  activeSectionId?: string;
11
14
  sections: SpatialElementSectionNavigationItem[];
12
15
  variant: 'panel' | 'docked';
13
16
  }
14
17
 
15
- let { activeSectionId, sections, variant }: Props = $props();
16
- let linksElement: HTMLDivElement;
18
+ let { activeSectionId, sections, variant, element = $bindable() }: Props = $props();
19
+ let linksElement = $state<HTMLDivElement>(null!);
17
20
  let presentationFrame = 0;
18
21
  let readyFrame = 0;
19
22
  const currentSectionId = $derived(activeSectionId ?? sections[0]?.id);
@@ -81,6 +84,8 @@
81
84
  </script>
82
85
 
83
86
  <nav
87
+ bind:this={element}
88
+ use:mouseHover
84
89
  class="spatial-element-tab-list"
85
90
  data-spatial-element-tab-list={variant}
86
91
  aria-label="Elementbereiche"
@@ -94,11 +99,21 @@
94
99
  data-spatial-element-tab-id={section.id}
95
100
  data-spatial-element-tab-label={section.title}
96
101
  aria-current={currentSectionId === section.id ? 'location' : undefined}
102
+ aria-label={section.id === 'overview' ? section.title : undefined}
103
+ class:overview={section.id === 'overview'}
97
104
  >
98
- <span>{section.title}</span>
105
+ {#if section.id === 'overview'}
106
+ <!-- Author-supplied detail-overview.svg; see layout source manifest. -->
107
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor"
108
+ stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
109
+ <path d="M12 10.5 L9 13.5 M12 16.5 L12 10.5 M15 13.5 L12 10.5 M2 6.5 L22 6.5" />
110
+ <rect x="2" y="3" width="20" height="18" rx="2" />
111
+ </svg>
112
+ {:else}<span>{section.title}</span>{/if}
99
113
  </a>
100
114
  {/each}
101
115
  </div>
116
+ <OverflowControls target={linksElement} label="sections" />
102
117
  </nav>
103
118
 
104
119
  <style>
@@ -106,13 +121,14 @@
106
121
  --spatial-element-tab-font-size: 16px;
107
122
  --spatial-element-tab-highlight-top-radius: var(
108
123
  --spatial-element-tabs-dock-top-radius,
109
- var(--spatial-element-panel-radius, 9px)
124
+ var(--spatial-element-control-radius, 12px)
110
125
  );
111
126
  --spatial-element-tab-highlight-bottom-radius: var(
112
127
  --spatial-element-tabs-dock-bottom-radius,
113
- var(--spatial-element-panel-radius, 9px)
128
+ var(--spatial-element-control-radius, 12px)
114
129
  );
115
130
 
131
+ position: relative;
116
132
  display: flex;
117
133
  align-items: center;
118
134
  box-sizing: border-box;
@@ -120,7 +136,7 @@
120
136
  max-width: 100%;
121
137
  height: 100%;
122
138
  min-width: 0;
123
- color: var(--spatial-element-body);
139
+ color: var(--spatial-element-navigation-ink, var(--spatial-element-ink));
124
140
  pointer-events: auto;
125
141
  }
126
142
 
@@ -171,7 +187,7 @@
171
187
  position: absolute;
172
188
  bottom: 3px;
173
189
  left: 50%;
174
- width: 40px;
190
+ width: 24px;
175
191
  height: 3px;
176
192
  border-radius: 3px 3px 0 0;
177
193
  background: var(--spatial-element-accent);
@@ -184,7 +200,7 @@
184
200
  visibility: visible;
185
201
  }
186
202
 
187
- a {
203
+ .spatial-element-tab-list a {
188
204
  display: grid;
189
205
  position: relative;
190
206
  z-index: 1;
@@ -195,12 +211,10 @@
195
211
  padding: 0 16px;
196
212
  border-radius: var(--spatial-element-tab-highlight-top-radius) var(--spatial-element-tab-highlight-top-radius)
197
213
  var(--spatial-element-tab-highlight-bottom-radius) var(--spatial-element-tab-highlight-bottom-radius);
198
- color: var(--spatial-element-body);
214
+ color: var(--spatial-element-navigation-ink, var(--spatial-element-ink));
199
215
  background: transparent;
200
- /* Sturdier glyphs retain more edge contrast in the spatial panel and keep
201
- * the source-to-dock handoff typographically identical. */
202
216
  font-size: var(--spatial-element-tab-font-size);
203
- font-weight: 600;
217
+ font-weight: 400;
204
218
  line-height: 1;
205
219
  text-decoration: none;
206
220
  white-space: nowrap;
@@ -213,18 +227,22 @@
213
227
  }
214
228
 
215
229
  a::before {
216
- font-weight: 600;
230
+ font-weight: 650;
217
231
  content: attr(data-spatial-element-tab-label);
218
232
  visibility: hidden;
219
233
  }
234
+ a.overview { width: 48px; padding: 0 12px; }
235
+ a.overview::before { content: none; }
220
236
 
221
- a:hover:not([aria-current='location']) {
237
+ .spatial-element-tab-list:global([data-mouse-hover]) a:hover:not([aria-current='location']) {
222
238
  background: color-mix(in srgb, var(--spatial-element-body) 8%, transparent);
223
239
  }
224
240
 
225
- a[aria-current='location'] {
226
- font-weight: 600;
241
+ .spatial-element-tab-list a[aria-current='location'] {
242
+ font-weight: 650;
227
243
  }
244
+ a.overview svg { opacity: 0.55; transition: opacity 180ms ease; }
245
+ a.overview[aria-current='location'] svg { opacity: 1; }
228
246
 
229
247
  .spatial-element-tab-links:not([data-spatial-element-tab-indicator-ready]) a[aria-current='location'] {
230
248
  background: color-mix(in srgb, var(--spatial-element-body) 8%, transparent);
@@ -234,7 +252,7 @@
234
252
  position: absolute;
235
253
  bottom: 3px;
236
254
  left: 50%;
237
- width: 40px;
255
+ width: 24px;
238
256
  height: 3px;
239
257
  border-radius: 3px 3px 0 0;
240
258
  background: var(--spatial-element-accent);
@@ -247,6 +265,11 @@
247
265
  outline-offset: -2px;
248
266
  }
249
267
 
268
+ /* This node keeps its own visibility contract after leaving the source panel. */
269
+ @media (width < 840px) {
270
+ .spatial-element-tab-list { display: none; }
271
+ }
272
+
250
273
  @media (max-width: 620px) {
251
274
  .spatial-element-tab-list {
252
275
  --spatial-element-tab-font-size: 15px;
@@ -1,9 +1,10 @@
1
1
  import type { SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
2
2
  interface Props {
3
+ element?: HTMLElement;
3
4
  activeSectionId?: string;
4
5
  sections: SpatialElementSectionNavigationItem[];
5
6
  variant: 'panel' | 'docked';
6
7
  }
7
- declare const SpatialElementTabList: import("svelte").Component<Props, {}, "">;
8
+ declare const SpatialElementTabList: import("svelte").Component<Props, {}, "element">;
8
9
  type SpatialElementTabList = ReturnType<typeof SpatialElementTabList>;
9
10
  export default SpatialElementTabList;
@@ -1,20 +1,26 @@
1
1
  <script lang="ts">
2
+ import { resolveSpatialThemeRadii } from '@spatial-elements/core/spatial-element/spatialTheme';
2
3
  import { onMount, tick } from 'svelte';
3
4
  import Panel from '../stage/Panel.svelte';
4
5
  import { STAGE_PANEL_LAYOUT_EVENT } from '@spatial-elements/core/stage/panelContext';
5
6
  import SpatialElementTabList from './SpatialElementTabList.svelte';
6
7
  import { useSpatialTheme } from './brandContext.js';
8
+ import './layout.generated.css';
7
9
  import type { SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
8
10
 
9
11
  let {
12
+ tabList = $bindable(),
10
13
  activeSectionId,
11
14
  sections
12
15
  }: {
16
+ tabList?: HTMLElement;
13
17
  activeSectionId?: string;
14
18
  sections: SpatialElementSectionNavigationItem[];
15
19
  } = $props();
16
- let anchorElement: HTMLDivElement;
17
- const theme = useSpatialTheme();
20
+ let anchorElement: HTMLDivElement | null | undefined;
21
+ const readTheme = useSpatialTheme();
22
+ const theme = $derived(readTheme());
23
+ const radii = $derived(resolveSpatialThemeRadii(theme));
18
24
 
19
25
  onMount(() => {
20
26
  let resizeObserver: ResizeObserver | undefined;
@@ -24,32 +30,65 @@
24
30
  let disposed = false;
25
31
 
26
32
  const measure = () => {
27
- measureFrame = 0;
28
- const frame = anchorElement.querySelector<HTMLElement>('[data-stage-panel-fallback]');
29
- const tabList = anchorElement.querySelector<HTMLElement>('[data-spatial-element-tab-list="panel"]');
33
+ // bind:this can already be cleared while a queued measurement still owns
34
+ // this callback. Cleanup cancels pending RAFs, but is not a DOM lease.
35
+ const anchor = anchorElement;
36
+ if (disposed || !anchor?.isConnected) return;
37
+ const frame = anchor.querySelector<HTMLElement>('[data-stage-panel-fallback]');
38
+ // The panel renderer can portal the list before the first measurement.
39
+ // Keep its bound reference instead of searching the emptied frame.
30
40
  const links = tabList?.querySelector<HTMLElement>('[data-spatial-element-tab-links]');
31
41
  if (!frame || !tabList || !links) return;
42
+ if (getComputedStyle(anchor).display === 'none') return;
32
43
 
33
- const linksWidth = links.scrollWidth;
44
+ let linksWidth = links.scrollWidth;
45
+ if (linksWidth < 1) {
46
+ // A submenu first opened at XS/S has no intrinsic width yet. Once
47
+ // it enters M, its portaled runtime is still culled by that zero-width
48
+ // source frame. Measure the same nodes without painting them, then
49
+ // restore the exact renderer-owned styles in this synchronous turn.
50
+ const hidden: { node: HTMLElement; display: string; displayPriority: string;
51
+ visibility: string; visibilityPriority: string }[] = [];
52
+ for (let node: HTMLElement | null = tabList; node && !node.classList.contains('stage'); node = node.parentElement) {
53
+ if (getComputedStyle(node).display !== 'none') continue;
54
+ hidden.push({ node, display: node.style.getPropertyValue('display'),
55
+ displayPriority: node.style.getPropertyPriority('display'),
56
+ visibility: node.style.getPropertyValue('visibility'),
57
+ visibilityPriority: node.style.getPropertyPriority('visibility') });
58
+ node.style.setProperty('visibility', 'hidden', 'important');
59
+ node.style.setProperty('display', 'block', 'important');
60
+ }
61
+ try { linksWidth = links.scrollWidth; }
62
+ finally {
63
+ for (const state of hidden) {
64
+ if (state.display) state.node.style.setProperty('display', state.display, state.displayPriority);
65
+ else state.node.style.removeProperty('display');
66
+ if (state.visibility) state.node.style.setProperty('visibility', state.visibility, state.visibilityPriority);
67
+ else state.node.style.removeProperty('visibility');
68
+ }
69
+ }
70
+ }
34
71
  if (linksWidth < 1) return;
35
- measuredNaturalWidth = Math.max(measuredNaturalWidth, Math.ceil(linksWidth));
36
- const currentHeight = Math.max(frame.getBoundingClientRect().height, 52);
72
+ const naturalWidth = Math.ceil(linksWidth);
73
+ if (naturalWidth === measuredNaturalWidth) return;
74
+ measuredNaturalWidth = naturalWidth;
37
75
 
38
- anchorElement.style.setProperty('--spatial-element-tabs-natural-width', `${measuredNaturalWidth}px`);
39
- anchorElement.style.setProperty('--spatial-element-tabs-height', `${Math.ceil(currentHeight)}px`);
40
- anchorElement.toggleAttribute('data-spatial-element-tabs-measured', true);
76
+ anchor.style.setProperty('--spatial-element-tabs-natural-width', `${measuredNaturalWidth}px`);
77
+ anchor.toggleAttribute('data-spatial-element-tabs-measured', true);
41
78
  window.dispatchEvent(new Event(STAGE_PANEL_LAYOUT_EVENT));
42
79
  };
43
80
 
44
81
  const scheduleMeasure = () => {
45
82
  if (disposed || measureFrame) return;
46
- measureFrame = requestAnimationFrame(measure);
83
+ measureFrame = requestAnimationFrame(() => {
84
+ measureFrame = 0;
85
+ measure();
86
+ });
47
87
  };
48
88
 
49
89
  void tick().then(() => {
50
90
  if (disposed) return;
51
91
  measure();
52
- const tabList = anchorElement.querySelector<HTMLElement>('[data-spatial-element-tab-list="panel"]');
53
92
  if ('ResizeObserver' in window && tabList) {
54
93
  resizeObserver = new ResizeObserver(scheduleMeasure);
55
94
  resizeObserver.observe(tabList);
@@ -64,6 +103,7 @@
64
103
  }
65
104
  });
66
105
  window.addEventListener('resize', scheduleMeasure, { passive: true });
106
+ void document.fonts?.ready.then(scheduleMeasure);
67
107
 
68
108
  return () => {
69
109
  disposed = true;
@@ -80,11 +120,11 @@
80
120
  transitionGroup="enter"
81
121
  class="spatial-element-tabs-panel"
82
122
  pointerReactive={false}
83
- shape={{ ...theme.panelShape, contentInset: 0 }}
123
+ shape={{ ...theme.panelShape, radius: radii.control, contentInset: 0 }}
84
124
  theme={theme.panelTheme}
85
125
  contentClass="spatial-element-tabs-panel-content"
86
126
  >
87
- <SpatialElementTabList {activeSectionId} {sections} variant="panel" />
127
+ <SpatialElementTabList bind:element={tabList} {activeSectionId} {sections} variant="panel" />
88
128
  </Panel>
89
129
  </div>
90
130
 
@@ -94,7 +134,7 @@
94
134
  z-index: 4;
95
135
  width: fit-content;
96
136
  max-width: 100%;
97
- height: var(--spatial-element-tabs-height, 52px);
137
+ height: var(--spatial-detail-submenu-height);
98
138
  pointer-events: auto;
99
139
  }
100
140
 
@@ -105,8 +145,8 @@
105
145
  :global(.spatial-element-tabs-panel) {
106
146
  width: max-content;
107
147
  max-width: 100%;
108
- height: var(--spatial-element-tabs-height, 52px);
109
- min-height: var(--spatial-element-tabs-height, 52px);
148
+ height: var(--spatial-detail-submenu-height);
149
+ min-height: var(--spatial-detail-submenu-height);
110
150
  pointer-events: auto;
111
151
  }
112
152
 
@@ -120,4 +160,7 @@
120
160
  border-radius: inherit;
121
161
  overflow: hidden;
122
162
  }
163
+ @media (width < 840px) {
164
+ .spatial-element-tabs-anchor { display: none; }
165
+ }
123
166
  </style>
@@ -1,8 +1,10 @@
1
+ import './layout.generated.css';
1
2
  import type { SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
2
3
  type $$ComponentProps = {
4
+ tabList?: HTMLElement;
3
5
  activeSectionId?: string;
4
6
  sections: SpatialElementSectionNavigationItem[];
5
7
  };
6
- declare const SpatialElementTabs: import("svelte").Component<$$ComponentProps, {}, "">;
8
+ declare const SpatialElementTabs: import("svelte").Component<$$ComponentProps, {}, "tabList">;
7
9
  type SpatialElementTabs = ReturnType<typeof SpatialElementTabs>;
8
10
  export default SpatialElementTabs;
@@ -0,0 +1,54 @@
1
+ <script lang="ts">
2
+ import { resolveSpatialThemeRadii } from '@spatial-elements/core/spatial-element/spatialTheme';
3
+ import { getContext } from 'svelte';
4
+ import SpatialViewIcon from './SpatialViewIcon.svelte';
5
+ import { STAGE_CONTEXT_KEY, type StageContext } from '@spatial-elements/core/stage/panelContext';
6
+ import ButtonGroup from '../stage/ButtonGroup.svelte';
7
+ import { useSpatialTheme } from './brandContext.js';
8
+ import { useSpatialMessages } from './messagesContext.js';
9
+ let {
10
+ enabled,
11
+ focusAnchor,
12
+ onchange
13
+ }: { enabled: boolean; focusAnchor?: HTMLElement; onchange: () => void } = $props();
14
+ const stage = getContext<StageContext>(STAGE_CONTEXT_KEY);
15
+ const readTheme = useSpatialTheme();
16
+ const theme = $derived(readTheme());
17
+ const radii = $derived(resolveSpatialThemeRadii(theme));
18
+ const readMessages = useSpatialMessages();
19
+ const messages = $derived(readMessages());
20
+ const fullscreen = $derived(stage.isFullscreen?.() ?? false);
21
+ const zoomFocus = $derived(stage.getZoomUiFocus?.() ?? stage.getZoomFocus?.() ?? 0);
22
+ function select(value: string) {
23
+ onchange();
24
+ stage.setFullscreen?.(value === 'fullscreen');
25
+ if (value === 'detail') stage.resetView();
26
+ }
27
+ </script>
28
+
29
+ <ButtonGroup
30
+ data-spatial-element-view-toggle
31
+ label={messages.controls.detailView}
32
+ iconOnly
33
+ items={[
34
+ {
35
+ value: 'detail',
36
+ label: messages.controls.detailView,
37
+ selection: fullscreen ? 0 : 1 - zoomFocus
38
+ },
39
+ { value: 'fullscreen', label: messages.controls.fullscreen }
40
+ ]}
41
+ value={fullscreen ? 'fullscreen' : zoomFocus < 0.001 ? 'detail' : undefined}
42
+ onchange={select}
43
+ disabled={!enabled}
44
+ visible={enabled}
45
+ shape={{ ...theme.panelShape, radius: radii.control }}
46
+ theme={theme.panelTheme}
47
+ focusReactive="top-right"
48
+ {focusAnchor}
49
+ transitionGroup="enter"
50
+ >
51
+ {#snippet content(item)}
52
+ <SpatialViewIcon kind={item.value === 'detail' ? 'detail' : 'fullscreen'} />
53
+ {/snippet}
54
+ </ButtonGroup>
@@ -0,0 +1,8 @@
1
+ type $$ComponentProps = {
2
+ enabled: boolean;
3
+ focusAnchor?: HTMLElement;
4
+ onchange: () => void;
5
+ };
6
+ declare const SpatialElementViewToggle: import("svelte").Component<$$ComponentProps, {}, "">;
7
+ type SpatialElementViewToggle = ReturnType<typeof SpatialElementViewToggle>;
8
+ export default SpatialElementViewToggle;
@@ -0,0 +1,59 @@
1
+ <script lang="ts">
2
+ import { resolveSpatialThemeRadii } from '@spatial-elements/core/spatial-element/spatialTheme';
3
+ import type { Snippet } from 'svelte';
4
+ import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
5
+ import Panel from '../stage/Panel.svelte';
6
+ import { useSpatialTheme } from './brandContext.js';
7
+
8
+ let { label, children, onclick, expanded, controls, focusAnchor, enabled = true, element = $bindable() }: {
9
+ label: string;
10
+ children: Snippet;
11
+ onclick: (event: MouseEvent) => void;
12
+ expanded?: boolean;
13
+ controls?: string;
14
+ focusAnchor?: HTMLElement;
15
+ enabled?: boolean;
16
+ element?: HTMLButtonElement;
17
+ } = $props();
18
+ const readTheme = useSpatialTheme();
19
+ const theme = $derived(readTheme());
20
+ const radii = $derived(resolveSpatialThemeRadii(theme));
21
+ </script>
22
+
23
+ <div class="icon-frame">
24
+ <Panel
25
+ class="spatial-icon-panel"
26
+ shape={{ radius: radii.control, contentInset: 0 }}
27
+ theme={theme.panelTheme}
28
+ pointerReactive={false}
29
+ focusReactive="top-right"
30
+ {focusAnchor}
31
+ transitionGroup="enter"
32
+ >
33
+ <!-- Keep visibility on the button: Panel's content style also holds renderer positioning. -->
34
+ <button bind:this={element} use:mouseHover type="button" {onclick} aria-label={label} title={label}
35
+ disabled={!enabled}
36
+ style:visibility={enabled ? 'visible' : 'hidden'}
37
+ aria-expanded={expanded} aria-controls={controls} aria-haspopup={controls ? 'dialog' : undefined}
38
+ class="spatial-icon-button">
39
+ {@render children()}
40
+ </button>
41
+ </Panel>
42
+ </div>
43
+
44
+ <style>
45
+ .icon-frame { width: 40px; height: 40px; flex: 0 0 40px; }
46
+ /* The renderer moves panel contents into its projection layer; retain the anchor size. */
47
+ .icon-frame :global(.spatial-icon-panel) { width: 40px; height: 40px; }
48
+ .spatial-icon-button {
49
+ box-sizing: border-box; display: grid; place-items: center; width: 40px; height: 40px;
50
+ padding: 0; border: 0; border-radius: var(--spatial-element-control-radius); background: transparent;
51
+ color: var(--spatial-element-ink); cursor: pointer; touch-action: manipulation;
52
+ transition: background-color 180ms ease;
53
+ }
54
+ .spatial-icon-button:global([data-mouse-hover]):hover {
55
+ background: color-mix(in srgb, var(--spatial-element-body) 8%, transparent);
56
+ }
57
+ .spatial-icon-button:focus-visible { outline: 2px solid var(--spatial-element-accent); outline-offset: 3px; }
58
+ @media (prefers-reduced-motion: reduce) { .spatial-icon-button { transition: none; } }
59
+ </style>
@@ -0,0 +1,14 @@
1
+ import type { Snippet } from 'svelte';
2
+ type $$ComponentProps = {
3
+ label: string;
4
+ children: Snippet;
5
+ onclick: (event: MouseEvent) => void;
6
+ expanded?: boolean;
7
+ controls?: string;
8
+ focusAnchor?: HTMLElement;
9
+ enabled?: boolean;
10
+ element?: HTMLButtonElement;
11
+ };
12
+ declare const SpatialIconButton: import("svelte").Component<$$ComponentProps, {}, "element">;
13
+ type SpatialIconButton = ReturnType<typeof SpatialIconButton>;
14
+ export default SpatialIconButton;
@@ -1,22 +1,51 @@
1
1
  <script lang="ts">
2
+ import { HeadingSection } from '@page-sections/svelte';
3
+
4
+ import type { SpatialCardGridOptions } from './spatialCardGrid.js';
2
5
  import ContentPage from './ContentPage.svelte';
3
- import ListSection from './ListSection.svelte';
6
+ import SpatialCardGridSection from './SpatialCardGridSection.svelte';
4
7
  import Section from './Section.svelte';
5
8
  import { useCatalogNavigation } from '../catalog/catalogNavigation.js';
6
- import type { SpatialListItem, ContentPageData } from '@spatial-elements/core/spatial-element/types';
9
+ import type {
10
+ SpatialListItem,
11
+ ContentPageData
12
+ } from '@spatial-elements/core/spatial-element/types';
7
13
  let {
8
14
  spatialElements,
15
+ hdr,
9
16
  sectionLink,
17
+ cardSize,
18
+ cardVariant,
19
+ itemSpan,
20
+ textAlign,
21
+ mediaAspect,
22
+ mediaFit,
23
+ cardTone,
10
24
  ...page
11
- }: ContentPageData & {
12
- spatialElements: SpatialListItem[];
13
- sectionLink?: { href: string; label: string };
14
- } = $props();
25
+ }: ContentPageData &
26
+ SpatialCardGridOptions & {
27
+ /** Explicit environment for the collection. */
28
+ hdr: string;
29
+ spatialElements: SpatialListItem[];
30
+ sectionLink?: { href: string; label: string };
31
+ } = $props();
15
32
  const { href } = useCatalogNavigation();
16
33
  </script>
17
34
 
18
- <ContentPage {page}>
19
- <ListSection section={{ id: 'elements', title: 'Elements' }} list={spatialElements} />
35
+ <ContentPage {page} {hdr}>
36
+ <HeadingSection section={{ id: 'catalog', title: (page).title, eyebrow: (page).eyebrow, introduction: (page).intro, headingLevel: 1 }} />
37
+
38
+ <SpatialCardGridSection
39
+ section={{ id: 'elements', title: 'Elements' }}
40
+ list={spatialElements}
41
+ {cardSize}
42
+ {cardVariant}
43
+ {itemSpan}
44
+ {textAlign}
45
+ {mediaAspect}
46
+ {mediaFit}
47
+ {cardTone}
48
+ />
20
49
  {#if sectionLink}<Section section={{ id: 'more', title: 'More information' }}
21
50
  ><a href={href(sectionLink.href)}>{sectionLink.label}</a></Section
22
51
  >{/if}
@@ -1,5 +1,8 @@
1
+ import type { SpatialCardGridOptions } from './spatialCardGrid.js';
1
2
  import type { SpatialListItem, ContentPageData } from '@spatial-elements/core/spatial-element/types';
2
- type $$ComponentProps = ContentPageData & {
3
+ type $$ComponentProps = ContentPageData & SpatialCardGridOptions & {
4
+ /** Explicit environment for the collection. */
5
+ hdr: string;
3
6
  spatialElements: SpatialListItem[];
4
7
  sectionLink?: {
5
8
  href: string;
@@ -0,0 +1,16 @@
1
+ <!-- Author supplied assets/box3d-indicator.svg. -->
2
+ <svg
3
+ aria-hidden="true"
4
+ width="14"
5
+ height="14"
6
+ viewBox="0 0 12 12"
7
+ fill="none"
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ >
10
+ <path
11
+ d="M1.65 3.5L6 6M6 6L10.35 3.5M6 6V11M10.5 4C10.4998 3.82463 10.4535 3.6524 10.3658 3.50058C10.278 3.34875 10.1519 3.22268 10 3.135L6.5 1.135C6.34798 1.04723 6.17554 1.00102 6 1.00102C5.82446 1.00102 5.65202 1.04723 5.5 1.135L2 3.135C1.84813 3.22268 1.72199 3.34875 1.63423 3.50058C1.54647 3.6524 1.50018 3.82463 1.5 4V8C1.50018 8.17536 1.54647 8.34759 1.63423 8.49942C1.72199 8.65124 1.84813 8.77732 2 8.865L5.5 10.865C5.65202 10.9528 5.82446 10.999 6 10.999C6.17554 10.999 6.34798 10.9528 6.5 10.865L10 8.865C10.1519 8.77732 10.278 8.65124 10.3658 8.49942C10.4535 8.34759 10.4998 8.17536 10.5 8V4Z"
12
+ stroke-linecap="round"
13
+ stroke-linejoin="round"
14
+ stroke="currentColor"
15
+ />
16
+ </svg>
@@ -0,0 +1,26 @@
1
+ export default SpatialMediaIndicator;
2
+ type SpatialMediaIndicator = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const SpatialMediaIndicator: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }