@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
@@ -0,0 +1,300 @@
1
+ <script lang="ts">
2
+ import { resolveSpatialThemeRadii } from '@spatial-elements/core/spatial-element/spatialTheme';
3
+ import { getContext, onMount, tick } from 'svelte';
4
+ import CircleHelp from 'lucide-svelte/icons/circle-help';
5
+ import X from 'lucide-svelte/icons/x';
6
+ import InteractionGesture from './InteractionGesture.svelte';
7
+ import { getCssPanelBoxShadow } from '@spatial-elements/core/stage/panelShadow';
8
+ import { getInteractionGuidance, MODEL_INPUT_EVENT, type ModelInputState, type InteractionGuidance } from '@spatial-elements/core/stage/interactionGuidance';
9
+ import { STAGE_SCROLL_PRIORITY, subscribeStageScrollFrame } from '@spatial-elements/core/stage/scrollFrame';
10
+ import { STAGE_CONTEXT_KEY, STAGE_PANEL_LAYOUT_EVENT, type StageContext } from '@spatial-elements/core/stage/panelContext';
11
+ import SpatialElementViewToggle from './SpatialElementViewToggle.svelte';
12
+ import Panel from '../stage/Panel.svelte';
13
+ import SpatialIconButton from './SpatialIconButton.svelte';
14
+ import SpaceMouseControl from './SpaceMouseControl.svelte';
15
+ import { useSpatialTheme } from './brandContext.js';
16
+ import { useSpatialMessages } from './messagesContext.js';
17
+
18
+ const readTheme = useSpatialTheme();
19
+ const theme = $derived(readTheme());
20
+ const radii = $derived(resolveSpatialThemeRadii(theme));
21
+ const stageContext = getContext<StageContext>(STAGE_CONTEXT_KEY);
22
+ const fullscreen = $derived(stageContext.isFullscreen?.() ?? false);
23
+ const spaceMouseDesktop = $derived(stageContext.isSpaceMouseDesktop?.() ?? false);
24
+ const readMessages = useSpatialMessages();
25
+ const messages = $derived(readMessages());
26
+ const help = $derived(messages.interactionHelp);
27
+ const id = $props.id();
28
+ let { active = true }: { active?: boolean } = $props();
29
+ let root: HTMLDivElement;
30
+ let focusAnchor = $state<HTMLElement>();
31
+ let button = $state<HTMLButtonElement>(null!);
32
+ let popover: HTMLDivElement;
33
+ let closeButton: HTMLButtonElement;
34
+ let open = $state(false);
35
+ $effect(() => { if (!active) close(); });
36
+ let enhanced = $state(false);
37
+ let visible = false;
38
+ let interacted = $state(false);
39
+ let touchInput = $state(false);
40
+ let guidance: InteractionGuidance | undefined;
41
+ let delay: ReturnType<typeof setTimeout> | undefined;
42
+ let hideDelay: ReturnType<typeof setTimeout> | undefined;
43
+ let manual = false;
44
+ let helpHovered = false;
45
+ let buttonHovered = false;
46
+ let modelInput: ModelInputState = { hovered: false, active: false };
47
+ const surfaceStyle = $derived([
48
+ `--help-tint: ${typeof theme.panelTheme.tint === 'number' ? '#' + theme.panelTheme.tint.toString(16).padStart(6, '0') : theme.panelTheme.tint ?? '#ffffff'}`,
49
+ `--help-tint-opacity: ${(theme.panelTheme.tintOpacity ?? 0.65) * 100}%`,
50
+ `--help-blur: ${Math.min(100, Math.max(0, theme.panelTheme.backdropBlur ?? 8))}px`,
51
+ `--help-shadow: ${getCssPanelBoxShadow(theme.panelTheme.shadowIntensity ?? 0.2)}`,
52
+ `--help-radius: ${radii.panel}px`
53
+ ].join(';'));
54
+
55
+ function clearDelay() { clearTimeout(delay); delay = undefined; }
56
+ function clearHideDelay() { clearTimeout(hideDelay); hideDelay = undefined; }
57
+ function close(returnFocus = false) {
58
+ clearDelay(); clearHideDelay();
59
+ if (!open) return;
60
+ const restoreFocus = returnFocus && popover.contains(document.activeElement);
61
+ popover.hidePopover();
62
+ open = false;
63
+ manual = false;
64
+ helpHovered = false;
65
+ if (restoreFocus) button?.focus({ preventScroll: true });
66
+ }
67
+ function position() {
68
+ if (!open) return;
69
+ const rect = button.getBoundingClientRect();
70
+ const viewport = window.visualViewport;
71
+ const leftEdge = (viewport?.offsetLeft ?? 0) + 16;
72
+ const topEdge = (viewport?.offsetTop ?? 0) + 16;
73
+ const width = Math.min(viewport?.width ?? window.innerWidth, document.documentElement.clientWidth);
74
+ const height = Math.min(viewport?.height ?? window.innerHeight, document.documentElement.clientHeight);
75
+ popover.style.maxWidth = `${Math.max(0, width - 32)}px`;
76
+ popover.style.maxHeight = `${Math.max(0, height - 32)}px`;
77
+ popover.style.setProperty('--help-max-height', `${Math.max(0, height - 32)}px`);
78
+ const box = popover.getBoundingClientRect();
79
+ const left = Math.max(leftEdge, Math.min(rect.right - box.width, leftEdge + width - 32 - box.width));
80
+ const below = rect.bottom + 12;
81
+ const top = below + box.height <= topEdge + height - 32 ? below : Math.max(topEdge, rect.top - box.height - 12);
82
+ const nextLeft = `${left}px`, nextTop = `${top}px`;
83
+ if (popover.style.left !== nextLeft || popover.style.top !== nextTop) {
84
+ popover.style.left = nextLeft;
85
+ popover.style.top = nextTop;
86
+ }
87
+ }
88
+ function requestPosition() {
89
+ if (open) window.dispatchEvent(new Event(STAGE_PANEL_LAYOUT_EVENT));
90
+ }
91
+ async function show(keyboard = false) {
92
+ if (!active || !enhanced || (!visible && !fullscreen)) return;
93
+ clearDelay(); clearHideDelay();
94
+ popover.showPopover();
95
+ open = true;
96
+ await tick();
97
+ if (!open || !enhanced) return;
98
+ requestPosition();
99
+ if (keyboard) {
100
+ // The stage restores the native panel's visibility on its next layout frame.
101
+ // Focusing immediately after Svelte's tick still targets a hidden button.
102
+ await new Promise<void>(resolve => requestAnimationFrame(() => resolve()));
103
+ if (open && enhanced) closeButton.focus({ preventScroll: true });
104
+ }
105
+ }
106
+ function toggleHelp(event: MouseEvent) {
107
+ if (open) close();
108
+ else {
109
+ manual = true;
110
+ void show(event.detail === 0);
111
+ }
112
+ }
113
+ function schedule() {
114
+ clearDelay(); clearHideDelay();
115
+ if (!active || manual || !enhanced || !visible || modelInput.active || touchInput || guidance?.snapshot.interacted) return;
116
+ if (modelInput.hovered) {
117
+ if (!open) delay = setTimeout(() => { void show(); }, 600);
118
+ } else if (open && !helpHovered && !buttonHovered && !popover.contains(document.activeElement)) {
119
+ hideDelay = setTimeout(() => close(), 350);
120
+ }
121
+ }
122
+
123
+ onMount(() => {
124
+ // The child component can clear bind:element before this mount cleanup runs.
125
+ // Remove listeners from the same node they were registered on.
126
+ const helpButton = button;
127
+ guidance = getInteractionGuidance();
128
+ touchInput = window.matchMedia('(pointer: coarse)').matches;
129
+ const stopGuidance = guidance.subscribe((state) => {
130
+ interacted = state.interacted;
131
+ if (state.interacted) close();
132
+ });
133
+ const stage = root.closest<HTMLElement>('.stage')!;
134
+ // The summary shares the detail page with the media but lives in the
135
+ // neighbouring pane body, including the regular single-column layout.
136
+ focusAnchor = root.closest('[data-spatial-element-root]')?.querySelector<HTMLElement>('.spatial-element-panel') ?? undefined;
137
+ // Keep the non-modal help accessible when close-up hides the ordinary DOM layer.
138
+ stage.appendChild(popover);
139
+ // Measure the nearest wide panel above the hero, without relying on a host CSS class.
140
+ const top = root.getBoundingClientRect().top;
141
+ const header = Array.from(stage.querySelectorAll<HTMLElement>('[data-stage-panel-fallback]'))
142
+ .filter((node) => { const rect = node.getBoundingClientRect(); return rect.width > innerWidth * 0.4 && rect.bottom <= top && rect.height > 0; })
143
+ .sort((a, b) => b.getBoundingClientRect().bottom - a.getBoundingClientRect().bottom)[0];
144
+ const measureSpacing = () => {
145
+ if (header && !fullscreen) {
146
+ const gap = Math.max(16, root.getBoundingClientRect().top - header.getBoundingClientRect().bottom - 12);
147
+ root.style.setProperty('--model-tools-gap', `${gap}px`);
148
+ }
149
+ requestPosition();
150
+ };
151
+ measureSpacing();
152
+ const headerSize = new ResizeObserver(measureSpacing);
153
+ if (header) headerSize.observe(header);
154
+ const stageChanged = () => {
155
+ enhanced = stage.dataset.stageState === 'enhanced' && !stage.hasAttribute('data-catalog-transition');
156
+ if (!enhanced) close();
157
+ };
158
+ stageChanged();
159
+ const mutation = new MutationObserver(stageChanged);
160
+ mutation.observe(stage, { attributes: true, attributeFilter: ['data-stage-state', 'data-catalog-transition'] });
161
+ const observer = new IntersectionObserver(([entry]) => {
162
+ visible = entry.isIntersecting;
163
+ if (!visible) close();
164
+ });
165
+ observer.observe(root);
166
+ const size = new ResizeObserver(requestPosition);
167
+ size.observe(popover);
168
+ const modelChanged = (event: Event) => {
169
+ modelInput = (event as CustomEvent<ModelInputState>).detail;
170
+ if (modelInput.active) close();
171
+ schedule();
172
+ };
173
+ const inputChanged = (event: PointerEvent) => {
174
+ if (!event.isTrusted) return;
175
+ const next = event.pointerType !== 'mouse';
176
+ if (next !== touchInput) { touchInput = next; if (next) { clearDelay(); clearHideDelay(); if (!manual) close(); } }
177
+ };
178
+ const buttonEnter = (event: PointerEvent) => { buttonHovered = event.pointerType === 'mouse'; schedule(); };
179
+ const buttonLeave = () => { buttonHovered = false; schedule(); };
180
+ const keydown = (event: KeyboardEvent) => {
181
+ if (event.key === 'Escape' && open) { event.preventDefault(); close(true); }
182
+ };
183
+ const stopScroll = subscribeStageScrollFrame(() => {
184
+ if (!open) return;
185
+ const rect = helpButton.getBoundingClientRect();
186
+ if (rect.bottom < 0 || rect.top > innerHeight) close();
187
+ else requestPosition();
188
+ }, STAGE_SCROLL_PRIORITY.stage + 1);
189
+ stage.addEventListener(MODEL_INPUT_EVENT, modelChanged);
190
+ helpButton.addEventListener('pointerenter', buttonEnter);
191
+ helpButton.addEventListener('pointerleave', buttonLeave);
192
+ window.addEventListener('pointerdown', inputChanged, { capture: true, passive: true });
193
+ window.addEventListener('pointermove', inputChanged, { capture: true, passive: true });
194
+ window.addEventListener('keydown', keydown);
195
+ window.addEventListener('resize', measureSpacing, { passive: true });
196
+ window.visualViewport?.addEventListener('resize', requestPosition, { passive: true });
197
+ window.visualViewport?.addEventListener('scroll', requestPosition, { passive: true });
198
+ return () => {
199
+ // A queued focusout microtask must not restart the hover timer after teardown.
200
+ enhanced = false; visible = false;
201
+ close(); stopGuidance(); stopScroll(); mutation.disconnect(); observer.disconnect(); size.disconnect(); headerSize.disconnect();
202
+ root.appendChild(popover);
203
+ stage.removeEventListener(MODEL_INPUT_EVENT, modelChanged);
204
+ helpButton.removeEventListener('pointerenter', buttonEnter);
205
+ helpButton.removeEventListener('pointerleave', buttonLeave);
206
+ window.removeEventListener('pointerdown', inputChanged, true);
207
+ window.removeEventListener('pointermove', inputChanged, true);
208
+ window.removeEventListener('keydown', keydown);
209
+ window.removeEventListener('resize', measureSpacing);
210
+ window.visualViewport?.removeEventListener('resize', requestPosition);
211
+ window.visualViewport?.removeEventListener('scroll', requestPosition);
212
+ };
213
+ });
214
+ </script>
215
+
216
+ <div bind:this={root} class="model-tools" class:enhanced class:with-spacemouse={spaceMouseDesktop} style={surfaceStyle} style:visibility={active ? undefined : 'hidden'} inert={!active} data-spatial-element-tools data-spatial-model-controls>
217
+ <div class="model-tools-buttons">
218
+ <SpatialIconButton bind:element={button} {focusAnchor} label={messages.controls.help} onclick={toggleHelp} expanded={open} controls={id} enabled={enhanced && active}>
219
+ <CircleHelp size={21} strokeWidth={1.8} aria-hidden="true" />
220
+ </SpatialIconButton>
221
+ {#if spaceMouseDesktop}
222
+ <SpaceMouseControl {focusAnchor} enabled={enhanced && active} />
223
+ {/if}
224
+ <SpatialElementViewToggle enabled={enhanced && active} {focusAnchor} onchange={() => close()} />
225
+ </div>
226
+ {#if active && enhanced && touchInput && !interacted && !open && !fullscreen}
227
+ <p class="touch-hint" data-spatial-element-touch-hint>{help.touchHint}</p>
228
+ {/if}
229
+ <div bind:this={popover} {id} popover="auto" role="dialog" tabindex="-1" aria-modal="false" aria-labelledby={`${id}-title`}
230
+ style={surfaceStyle}
231
+ class="interaction-help" data-spatial-element-help data-surface={theme.panelTheme.surface ?? 'glass'}
232
+ onpointerenter={(event) => { helpHovered = event.pointerType === 'mouse'; schedule(); }}
233
+ onpointerleave={() => { helpHovered = false; schedule(); }}
234
+ onfocusin={clearHideDelay} onfocusout={() => { queueMicrotask(schedule); }}
235
+ ontoggle={(event) => { open = event.newState === 'open'; if (!open) { manual = false; clearHideDelay(); } }}>
236
+ <Panel class="interaction-help-panel" data-stage-fullscreen-visible nativeContent nativeLayout={position} visible={open} pointerReactive={false} focusReactive={false}
237
+ shape={{ ...theme.panelShape, radius: radii.panel, contentInset: 0 }} theme={theme.panelTheme}>
238
+ <div class="help-copy">
239
+ <div class="help-heading">
240
+ <h2 id={`${id}-title`}>{help.title}</h2>
241
+ <button bind:this={closeButton} type="button" class="close-help" onclick={() => close(true)}
242
+ aria-label={messages.controls.closeHelp} title={messages.controls.closeHelp}>
243
+ <X size={19} aria-hidden="true" />
244
+ </button>
245
+ </div>
246
+ <dl>
247
+ <div><InteractionGesture action="rotate" touch={touchInput} /><dt>{help.rotate}</dt><dd>{touchInput ? help.touchRotate : help.mouseRotate}</dd></div>
248
+ <div><InteractionGesture action="zoom" touch={touchInput} /><dt>{help.zoom}</dt><dd>{touchInput ? help.touchZoom : help.mouseZoom}</dd></div>
249
+ <div><InteractionGesture action="pan" touch={touchInput} /><dt>{help.pan}</dt><dd>{touchInput ? help.touchPan : help.mousePan}</dd></div>
250
+ </dl>
251
+ {#if touchInput && !fullscreen}<p class="navigation-hint">{help.touchScrollHint}</p>{/if}
252
+ {#if spaceMouseDesktop}
253
+ <p class="navigation-hint">{#each help.mouseNavigationHint.split('{spacemouse}') as part, index}{#if index > 0}<a href="https://3dconnexion.com/" target="_blank" rel="noopener noreferrer">SpaceMouse</a>{/if}{part}{/each}</p>
254
+ {/if}
255
+ </div>
256
+ </Panel>
257
+ </div>
258
+ </div>
259
+
260
+ <style>
261
+ .model-tools {
262
+ position: absolute; top: 0; right: var(--spatial-detail-fit-right);
263
+ margin: 0;
264
+ width: 128px; height: 40px; z-index: 6; visibility: hidden; pointer-events: none;
265
+ }
266
+ .model-tools.enhanced { visibility: visible; pointer-events: auto; }
267
+ .model-tools.with-spacemouse { width: 176px; }
268
+ .model-tools-buttons { display: flex; gap: 8px; justify-content: flex-end; }
269
+ .touch-hint {
270
+ position: absolute; right: 0; top: 48px; width: max-content; max-width: min(260px, calc(100vw - 48px));
271
+ margin: 0; padding: 8px 12px; border-radius: var(--spatial-element-control-radius); font-size: 12px; line-height: 1.45;
272
+ color: var(--spatial-element-ink); pointer-events: none;
273
+ background: color-mix(in srgb, var(--help-tint) var(--help-tint-opacity), transparent);
274
+ backdrop-filter: blur(var(--help-blur)); box-shadow: var(--help-shadow);
275
+ }
276
+ .interaction-help {
277
+ position: fixed; inset: auto; box-sizing: border-box; width: 248px;
278
+ margin: 0; padding: 0; overflow: visible;
279
+ border: 0; border-radius: var(--help-radius); color: var(--spatial-element-ink);
280
+ background: transparent;
281
+ font: inherit; font-size: 14px; line-height: 1.45; touch-action: manipulation;
282
+ }
283
+ .help-copy { box-sizing: border-box; padding: 12px 16px 16px; max-height: var(--help-max-height); overflow: auto; border-radius: var(--help-radius); }
284
+ .interaction-help::backdrop { background: transparent; pointer-events: none; }
285
+ .help-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
286
+ h2 { margin: 0; font-size: 15px; font-weight: 650; }
287
+ .close-help {
288
+ width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center;
289
+ padding: 0; border: 0; border-radius: var(--spatial-element-control-radius); color: inherit; background: transparent; cursor: pointer;
290
+ }
291
+ .close-help:focus-visible { outline: 2px solid var(--spatial-element-accent); }
292
+ dl { display: grid; gap: 8px; margin: 8px 0 0; }
293
+ dl > div { display: grid; grid-template-columns: 48px 1fr; column-gap: 14px; align-items: center; }
294
+ dt { font-weight: 650; }
295
+ /* Keep complete host-localized instructions available to assistive technology. */
296
+ dd { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
297
+ .navigation-hint { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid currentColor; font-size: 12px; }
298
+ .navigation-hint a { color: var(--spatial-element-accent); text-decoration: underline; text-underline-offset: 2px; }
299
+ .navigation-hint a:focus-visible { outline: 2px solid var(--spatial-element-accent); outline-offset: 3px; border-radius: 2px; }
300
+ </style>
@@ -0,0 +1,6 @@
1
+ type $$ComponentProps = {
2
+ active?: boolean;
3
+ };
4
+ declare const SpatialElementHelp: import("svelte").Component<$$ComponentProps, {}, "">;
5
+ type SpatialElementHelp = ReturnType<typeof SpatialElementHelp>;
6
+ export default SpatialElementHelp;