@spatial-elements/sveltekit 0.1.0-beta.2 → 1.0.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/README.md +18 -13
  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 +152 -200
  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 +129 -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/SpaceMouseControl.svelte +159 -0
  39. package/dist/spatial-element/SpaceMouseControl.svelte.d.ts +7 -0
  40. package/dist/spatial-element/SpaceMouseIcon.svelte +12 -0
  41. package/dist/spatial-element/SpaceMouseIcon.svelte.d.ts +26 -0
  42. package/dist/spatial-element/SpatialCardGridSection.svelte +79 -0
  43. package/dist/spatial-element/SpatialCardGridSection.svelte.d.ts +11 -0
  44. package/dist/spatial-element/SpatialCardPresentation.svelte +311 -0
  45. package/dist/spatial-element/SpatialCardPresentation.svelte.d.ts +19 -0
  46. package/dist/spatial-element/SpatialCardSlot.svelte +33 -0
  47. package/dist/spatial-element/SpatialCardSlot.svelte.d.ts +8 -0
  48. package/dist/spatial-element/SpatialCarouselSection.svelte +754 -0
  49. package/dist/spatial-element/{CarouselSection.svelte.d.ts → SpatialCarouselSection.svelte.d.ts} +5 -5
  50. package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +12 -65
  51. package/dist/spatial-element/SpatialElementCard.svelte +54 -238
  52. package/dist/spatial-element/SpatialElementCard.svelte.d.ts +9 -0
  53. package/dist/spatial-element/SpatialElementHelp.svelte +300 -0
  54. package/dist/spatial-element/SpatialElementHelp.svelte.d.ts +6 -0
  55. package/dist/spatial-element/SpatialElementMediaRail.svelte +322 -52
  56. package/dist/spatial-element/SpatialElementMediaRail.svelte.d.ts +4 -1
  57. package/dist/spatial-element/SpatialElementNativeMedia.svelte +101 -0
  58. package/dist/spatial-element/SpatialElementNativeMedia.svelte.d.ts +9 -0
  59. package/dist/spatial-element/SpatialElementPage.svelte +156 -71
  60. package/dist/spatial-element/SpatialElementPage.svelte.d.ts +10 -3
  61. package/dist/spatial-element/SpatialElementStickyHeader.svelte +89 -105
  62. package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +6 -1
  63. package/dist/spatial-element/SpatialElementSummaryContent.svelte +198 -0
  64. package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +23 -0
  65. package/dist/spatial-element/SpatialElementSummaryPanel.svelte +48 -380
  66. package/dist/spatial-element/SpatialElementSummaryPanel.svelte.d.ts +2 -1
  67. package/dist/spatial-element/SpatialElementTabList.svelte +40 -17
  68. package/dist/spatial-element/SpatialElementTabList.svelte.d.ts +2 -1
  69. package/dist/spatial-element/SpatialElementTabs.svelte +61 -18
  70. package/dist/spatial-element/SpatialElementTabs.svelte.d.ts +3 -1
  71. package/dist/spatial-element/SpatialElementViewToggle.svelte +54 -0
  72. package/dist/spatial-element/SpatialElementViewToggle.svelte.d.ts +8 -0
  73. package/dist/spatial-element/SpatialIconButton.svelte +66 -0
  74. package/dist/spatial-element/SpatialIconButton.svelte.d.ts +17 -0
  75. package/dist/spatial-element/SpatialListPage.svelte +37 -8
  76. package/dist/spatial-element/SpatialListPage.svelte.d.ts +4 -1
  77. package/dist/spatial-element/SpatialMediaIndicator.svelte +16 -0
  78. package/dist/spatial-element/SpatialMediaIndicator.svelte.d.ts +26 -0
  79. package/dist/spatial-element/SpatialNavigationShell.svelte +138 -0
  80. package/dist/spatial-element/SpatialNavigationShell.svelte.d.ts +15 -0
  81. package/dist/spatial-element/SpatialSummaryHost.svelte +19 -0
  82. package/dist/spatial-element/SpatialSummaryHost.svelte.d.ts +9 -0
  83. package/dist/spatial-element/SpatialSummaryRoot.svelte +80 -0
  84. package/dist/spatial-element/SpatialSummaryRoot.svelte.d.ts +8 -0
  85. package/dist/spatial-element/SpatialSummarySlot.svelte +39 -0
  86. package/dist/spatial-element/SpatialSummarySlot.svelte.d.ts +9 -0
  87. package/dist/spatial-element/SpatialViewIcon.svelte +29 -0
  88. package/dist/spatial-element/SpatialViewIcon.svelte.d.ts +6 -0
  89. package/dist/spatial-element/brandContext.d.ts +1 -1
  90. package/dist/spatial-element/brandContext.js +1 -1
  91. package/dist/spatial-element/cardAppearanceFreeze.d.ts +5 -0
  92. package/dist/spatial-element/cardAppearanceFreeze.js +72 -0
  93. package/dist/spatial-element/carouselTextHit.d.ts +2 -0
  94. package/dist/spatial-element/carouselTextHit.js +17 -0
  95. package/dist/spatial-element/contentSidebars.d.ts +3 -0
  96. package/dist/spatial-element/contentSidebars.js +56 -0
  97. package/dist/spatial-element/index.d.ts +19 -3
  98. package/dist/spatial-element/index.js +12 -2
  99. package/dist/spatial-element/layout.generated.css +363 -0
  100. package/dist/spatial-element/messagesContext.d.ts +3 -0
  101. package/dist/spatial-element/messagesContext.js +10 -0
  102. package/dist/spatial-element/presentationBoxFreeze.d.ts +8 -0
  103. package/dist/spatial-element/presentationBoxFreeze.js +35 -0
  104. package/dist/spatial-element/spatialCardGrid.d.ts +12 -0
  105. package/dist/spatial-element/spatialCardGrid.js +1 -0
  106. package/dist/spatial-element/spatialPageContext.d.ts +4 -0
  107. package/dist/spatial-element/spatialPageContext.js +9 -0
  108. package/dist/spatial-element/spatialPresentationOwner.d.ts +6 -0
  109. package/dist/spatial-element/spatialPresentationOwner.js +2 -0
  110. package/dist/spatial-element/spatialSummary.d.ts +43 -0
  111. package/dist/spatial-element/spatialSummary.js +1 -0
  112. package/dist/spatial-element/spatialSummaryHost.svelte.d.ts +60 -0
  113. package/dist/spatial-element/spatialSummaryHost.svelte.js +233 -0
  114. package/dist/spatial-element/spatialThemeStyle.d.ts +3 -0
  115. package/dist/spatial-element/spatialThemeStyle.js +69 -0
  116. package/dist/spatial-element/truncatedTitle.d.ts +5 -0
  117. package/dist/spatial-element/truncatedTitle.js +28 -0
  118. package/dist/stage/ButtonGroup.svelte +152 -0
  119. package/dist/stage/ButtonGroup.svelte.d.ts +24 -0
  120. package/dist/stage/Panel.svelte +72 -14
  121. package/dist/stage/Panel.svelte.d.ts +14 -2
  122. package/dist/stage/Stage.svelte +471 -51
  123. package/dist/stage/Stage.svelte.d.ts +8 -1
  124. package/dist/stage/StageViewport.svelte +15 -2
  125. package/dist/stage/authoredStyle.d.ts +4 -0
  126. package/dist/stage/authoredStyle.js +17 -0
  127. package/dist/stage/buttonGroup.d.ts +9 -0
  128. package/dist/stage/buttonGroup.js +1 -0
  129. package/logo.svg +225 -0
  130. package/package.json +9 -6
  131. package/dist/spatial-element/CarouselSection.svelte +0 -350
  132. package/dist/spatial-element/ListSection.svelte +0 -30
  133. package/dist/spatial-element/ListSection.svelte.d.ts +0 -8
@@ -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,66 @@
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, pressed, busy, expanded, controls, focusAnchor, wide = false, enabled = true, element = $bindable() }: {
9
+ label: string;
10
+ children: Snippet;
11
+ onclick: (event: MouseEvent) => void;
12
+ pressed?: boolean;
13
+ busy?: boolean;
14
+ expanded?: boolean;
15
+ controls?: string;
16
+ focusAnchor?: HTMLElement;
17
+ wide?: boolean;
18
+ enabled?: boolean;
19
+ element?: HTMLButtonElement;
20
+ } = $props();
21
+ const readTheme = useSpatialTheme();
22
+ const theme = $derived(readTheme());
23
+ const radii = $derived(resolveSpatialThemeRadii(theme));
24
+ </script>
25
+
26
+ <div class="icon-frame" class:wide data-spatial-control={label}>
27
+ <Panel
28
+ class="spatial-icon-panel"
29
+ shape={{ radius: radii.control, contentInset: 0 }}
30
+ theme={theme.panelTheme}
31
+ pointerReactive={false}
32
+ focusReactive="top-right"
33
+ {focusAnchor}
34
+ transitionGroup="enter"
35
+ >
36
+ <!-- Keep visibility on the button: Panel's content style also holds renderer positioning. -->
37
+ <button bind:this={element} use:mouseHover type="button" {onclick} aria-label={label} title={label}
38
+ disabled={!enabled}
39
+ style:visibility={enabled ? 'visible' : 'hidden'}
40
+ aria-pressed={pressed} aria-busy={busy || undefined} aria-expanded={expanded} aria-controls={controls} aria-haspopup={controls ? 'dialog' : undefined}
41
+ class="spatial-icon-button" class:wide>
42
+ {@render children()}
43
+ </button>
44
+ </Panel>
45
+ </div>
46
+
47
+ <style>
48
+ .icon-frame { width: 40px; height: 40px; flex: 0 0 40px; }
49
+ .icon-frame.wide { width: 104px; flex-basis: 104px; }
50
+ .icon-frame.wide :global(.spatial-icon-panel), .spatial-icon-button.wide { width: 104px; }
51
+ /* The renderer moves panel contents into its projection layer; retain the anchor size. */
52
+ .icon-frame :global(.spatial-icon-panel) { width: 40px; height: 40px; }
53
+ .spatial-icon-button {
54
+ box-sizing: border-box; display: grid; place-items: center; width: 40px; height: 40px;
55
+ padding: 0; border: 0; border-radius: var(--spatial-element-control-radius); background: transparent;
56
+ font: inherit; font-size: 13px;
57
+ color: var(--spatial-element-ink); cursor: pointer; touch-action: manipulation;
58
+ transition: background-color 180ms ease;
59
+ }
60
+ .spatial-icon-button:global([data-mouse-hover]):hover {
61
+ background: color-mix(in srgb, var(--spatial-element-body) 8%, transparent);
62
+ }
63
+ .spatial-icon-button[aria-pressed="true"] { color: var(--spatial-element-accent); background: var(--ps-selection, var(--ps-section-muted, #eeeeee)); }
64
+ .spatial-icon-button:focus-visible { outline: 2px solid var(--spatial-element-accent); outline-offset: 3px; }
65
+ @media (prefers-reduced-motion: reduce) { .spatial-icon-button { transition: none; } }
66
+ </style>
@@ -0,0 +1,17 @@
1
+ import type { Snippet } from 'svelte';
2
+ type $$ComponentProps = {
3
+ label: string;
4
+ children: Snippet;
5
+ onclick: (event: MouseEvent) => void;
6
+ pressed?: boolean;
7
+ busy?: boolean;
8
+ expanded?: boolean;
9
+ controls?: string;
10
+ focusAnchor?: HTMLElement;
11
+ wide?: boolean;
12
+ enabled?: boolean;
13
+ element?: HTMLButtonElement;
14
+ };
15
+ declare const SpatialIconButton: import("svelte").Component<$$ComponentProps, {}, "element">;
16
+ type SpatialIconButton = ReturnType<typeof SpatialIconButton>;
17
+ 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
+ }
@@ -0,0 +1,138 @@
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: () => theme.panelTheme.surface ?? '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={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
+ .spatial-shell-rack :global(.header) { border-radius: var(--spatial-element-panel-radius); }
135
+ .spatial-shell-rack :global(.satellite) { border-radius: var(--spatial-element-control-radius); }
136
+ :global(.stage-virtual-scroll-active) .spatial-shell-rack { position: relative; transform: translateY(var(--spatial-shell-scroll-compensation, 0px)); }
137
+ [data-spatial-navigation-glass] :global([data-stage-panel-bound]) { background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
138
+ </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;