@spatial-elements/sveltekit 1.0.0-beta.3 → 1.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/spatial-element/BrandStageShell.svelte +6 -1
- package/dist/spatial-element/BrandStageShell.svelte.d.ts +3 -0
- package/dist/spatial-element/CarouselSection.svelte +179 -38
- package/dist/spatial-element/CarouselSpatialElement.svelte +5 -1
- package/dist/spatial-element/InteractionGesture.svelte +39 -0
- package/dist/spatial-element/InteractionGesture.svelte.d.ts +7 -0
- package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +3 -1
- package/dist/spatial-element/SpatialElementHelp.svelte +277 -0
- package/dist/spatial-element/SpatialElementHelp.svelte.d.ts +3 -0
- package/dist/spatial-element/SpatialElementPage.svelte +9 -1
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte +8 -5
- package/dist/spatial-element/SpatialElementTabList.svelte +3 -1
- package/dist/spatial-element/SpatialIconButton.svelte +56 -0
- package/dist/spatial-element/SpatialIconButton.svelte.d.ts +14 -0
- package/dist/spatial-element/index.d.ts +1 -0
- package/dist/spatial-element/index.js +1 -0
- package/dist/spatial-element/messagesContext.d.ts +3 -0
- package/dist/spatial-element/messagesContext.js +10 -0
- package/dist/stage/Panel.svelte +30 -2
- package/dist/stage/Panel.svelte.d.ts +12 -2
- package/dist/stage/Stage.svelte +15 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
SvelteKit components and navigation for Spatial Elements.
|
|
4
4
|
|
|
5
|
+
Detail pages include a compact 3D help button. Pass optional `messages` to `BrandStageShell` to translate its labels, tooltips and instructions; missing strings use English defaults. See [interface texts and help](https://github.com/LauridBergjohann/spatial-elements/blob/main/docs/interface-texts.md) for the complete typed dictionary and examples.
|
|
6
|
+
|
|
5
7
|
See the [authoring guide](https://github.com/LauridBergjohann/spatial-elements/blob/main/docs/authoring.md) and [development guide](https://github.com/LauridBergjohann/spatial-elements/blob/main/docs/development.md).
|
|
6
8
|
|
|
7
9
|
Beta API; MPL-2.0; see LICENSE.
|
|
@@ -4,11 +4,15 @@
|
|
|
4
4
|
import type { StageRenderSettings } from '@spatial-elements/core';
|
|
5
5
|
import { getCssPanelBoxShadow, resolvePanelShadowStrength } from '@spatial-elements/core/stage/panelShadow';
|
|
6
6
|
import { provideSpatialTheme } from './brandContext.js';
|
|
7
|
+
import { provideSpatialMessages } from './messagesContext.js';
|
|
8
|
+
import type { SpatialMessagesInput } from '@spatial-elements/core/spatial-element/messages';
|
|
7
9
|
import type { SpatialTheme } from '@spatial-elements/core/spatial-element/types';
|
|
8
10
|
|
|
9
11
|
interface Props {
|
|
10
12
|
/** Shared appearance and namespace. Use createSpatialTheme for defaults. */
|
|
11
13
|
theme: SpatialTheme;
|
|
14
|
+
/** Localized interface copy. Missing groups/strings fall back to English; updates are reactive. */
|
|
15
|
+
messages?: SpatialMessagesInput;
|
|
12
16
|
/** Optional GPU resolution budget; defaults to DPR 1 and 2,073,600 pixels. */
|
|
13
17
|
renderSettings?: StageRenderSettings;
|
|
14
18
|
/** Draco decoder directory, including trailing slash. Default: /assets/draco/gltf/; the host must serve the files. */
|
|
@@ -17,9 +21,10 @@
|
|
|
17
21
|
children?: Snippet;
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
let { theme, renderSettings, dracoDecoderPath, children }: Props = $props();
|
|
24
|
+
let { theme, messages, renderSettings, dracoDecoderPath, children }: Props = $props();
|
|
21
25
|
|
|
22
26
|
provideSpatialTheme(() => theme);
|
|
27
|
+
provideSpatialMessages(() => messages);
|
|
23
28
|
|
|
24
29
|
const brandStyle = $derived(
|
|
25
30
|
[
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { StageRenderSettings } from '@spatial-elements/core';
|
|
3
|
+
import type { SpatialMessagesInput } from '@spatial-elements/core/spatial-element/messages';
|
|
3
4
|
import type { SpatialTheme } from '@spatial-elements/core/spatial-element/types';
|
|
4
5
|
interface Props {
|
|
5
6
|
/** Shared appearance and namespace. Use createSpatialTheme for defaults. */
|
|
6
7
|
theme: SpatialTheme;
|
|
8
|
+
/** Localized interface copy. Missing groups/strings fall back to English; updates are reactive. */
|
|
9
|
+
messages?: SpatialMessagesInput;
|
|
7
10
|
/** Optional GPU resolution budget; defaults to DPR 1 and 2,073,600 pixels. */
|
|
8
11
|
renderSettings?: StageRenderSettings;
|
|
9
12
|
/** Draco decoder directory, including trailing slash. Default: /assets/draco/gltf/; the host must serve the files. */
|
|
@@ -11,6 +11,14 @@
|
|
|
11
11
|
resolveCarouselSelection,
|
|
12
12
|
stepCarouselSelection
|
|
13
13
|
} from '@spatial-elements/core/catalog/carouselSelection';
|
|
14
|
+
import {
|
|
15
|
+
CarouselDrag,
|
|
16
|
+
CarouselScrollDrag,
|
|
17
|
+
clampCarouselPhase,
|
|
18
|
+
sampleCarouselSpring,
|
|
19
|
+
sampleCarouselScrollMomentum
|
|
20
|
+
} from '@spatial-elements/core/catalog/carouselMotion';
|
|
21
|
+
import { markStageScrollInput } from '@spatial-elements/core/stage/scrollFrame';
|
|
14
22
|
|
|
15
23
|
let {
|
|
16
24
|
section,
|
|
@@ -41,6 +49,7 @@
|
|
|
41
49
|
});
|
|
42
50
|
let ring: HTMLDivElement;
|
|
43
51
|
let frame = 0;
|
|
52
|
+
let scrollFrame = 0;
|
|
44
53
|
let visible = true;
|
|
45
54
|
let suppressClick = false;
|
|
46
55
|
let clickTimer: ReturnType<typeof setTimeout>;
|
|
@@ -52,14 +61,53 @@
|
|
|
52
61
|
selectionDirty = false;
|
|
53
62
|
sections?.remember();
|
|
54
63
|
}
|
|
55
|
-
let drag: { id: number;
|
|
64
|
+
let drag: { id: number; kind: 'pointer' | 'touch'; motion: CarouselDrag; scroll?: CarouselScrollDrag } | undefined;
|
|
65
|
+
function writeScroll(position: number) {
|
|
66
|
+
markStageScrollInput('touch');
|
|
67
|
+
window.scrollTo({ top: position, behavior: 'instant' });
|
|
68
|
+
}
|
|
69
|
+
function stopScrollMomentum() {
|
|
70
|
+
cancelAnimationFrame(scrollFrame);
|
|
71
|
+
scrollFrame = 0;
|
|
72
|
+
window.removeEventListener('touchstart', stopScrollMomentum, true);
|
|
73
|
+
window.removeEventListener('pointerdown', stopScrollMomentum, true);
|
|
74
|
+
window.removeEventListener('wheel', stopScrollMomentum, true);
|
|
75
|
+
window.removeEventListener('keydown', stopScrollMomentum, true);
|
|
76
|
+
window.removeEventListener('popstate', stopScrollMomentum);
|
|
77
|
+
}
|
|
78
|
+
function scrollMomentum(scroll: CarouselScrollDrag, velocity: number) {
|
|
79
|
+
stopScrollMomentum();
|
|
80
|
+
if (Math.abs(velocity) < 0.02 || matchMedia('(prefers-reduced-motion: reduce)').matches) return;
|
|
81
|
+
const start = scroll.position;
|
|
82
|
+
const started = performance.now();
|
|
83
|
+
for (const name of ['touchstart', 'pointerdown', 'wheel', 'keydown'])
|
|
84
|
+
window.addEventListener(name, stopScrollMomentum, { capture: true, passive: true });
|
|
85
|
+
window.addEventListener('popstate', stopScrollMomentum);
|
|
86
|
+
const advance = (now: number) => {
|
|
87
|
+
if (ring?.closest('[data-catalog-transition]')) {
|
|
88
|
+
stopScrollMomentum();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const sample = sampleCarouselScrollMomentum(start, velocity, now - started, scroll.maximum);
|
|
92
|
+
writeScroll(sample.position);
|
|
93
|
+
if (sample.finished) stopScrollMomentum();
|
|
94
|
+
else scrollFrame = requestAnimationFrame(advance);
|
|
95
|
+
};
|
|
96
|
+
scrollFrame = requestAnimationFrame(advance);
|
|
97
|
+
}
|
|
56
98
|
function invalidate() {
|
|
57
99
|
window.dispatchEvent(new Event(CATALOG_POSE_CHANGED));
|
|
58
100
|
}
|
|
59
101
|
function releaseDrag() {
|
|
60
102
|
const current = drag;
|
|
61
103
|
drag = undefined;
|
|
62
|
-
|
|
104
|
+
window.removeEventListener('pointerup', pointerup);
|
|
105
|
+
window.removeEventListener('touchstart', multitouch);
|
|
106
|
+
window.removeEventListener('touchmove', touchmove);
|
|
107
|
+
window.removeEventListener('touchend', touchend);
|
|
108
|
+
window.removeEventListener('touchcancel', touchcancel);
|
|
109
|
+
if (current?.kind === 'pointer' && ring?.hasPointerCapture(current.id))
|
|
110
|
+
ring.releasePointerCapture(current.id);
|
|
63
111
|
}
|
|
64
112
|
function settle() {
|
|
65
113
|
cancelAnimationFrame(frame);
|
|
@@ -70,12 +118,13 @@
|
|
|
70
118
|
void tick().then(invalidate);
|
|
71
119
|
rememberSelection();
|
|
72
120
|
}
|
|
73
|
-
function animate(target: number) {
|
|
121
|
+
function animate(target: number, velocity?: number) {
|
|
74
122
|
cancelAnimationFrame(frame);
|
|
123
|
+
frame = 0;
|
|
75
124
|
const start = phase;
|
|
76
125
|
const started = performance.now();
|
|
77
126
|
if (
|
|
78
|
-
Math.abs(target - start) > 1.5 ||
|
|
127
|
+
(velocity === undefined && Math.abs(target - start) > 1.5) ||
|
|
79
128
|
!visible ||
|
|
80
129
|
document.hidden ||
|
|
81
130
|
matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
@@ -91,10 +140,17 @@
|
|
|
91
140
|
frame = 0;
|
|
92
141
|
return;
|
|
93
142
|
}
|
|
94
|
-
const
|
|
95
|
-
|
|
143
|
+
const elapsed = now - started;
|
|
144
|
+
const spring = velocity === undefined ? undefined : sampleCarouselSpring(start, velocity, target, elapsed);
|
|
145
|
+
const t = Math.min(1, elapsed / 320);
|
|
146
|
+
const finished = spring
|
|
147
|
+
? (Math.abs(spring.phase - target) < 0.001 && Math.abs(spring.velocity) < 0.00005) || elapsed >= 1000
|
|
148
|
+
: t >= 1;
|
|
149
|
+
phase = finished ? target : spring
|
|
150
|
+
? clampCarouselPhase(spring.phase, keys.length)
|
|
151
|
+
: start + (target - start) * (1 - (1 - t) ** 2);
|
|
96
152
|
void tick().then(invalidate);
|
|
97
|
-
if (
|
|
153
|
+
if (!finished) frame = requestAnimationFrame(advance);
|
|
98
154
|
else {
|
|
99
155
|
frame = 0;
|
|
100
156
|
announced = selected;
|
|
@@ -105,44 +161,110 @@
|
|
|
105
161
|
}
|
|
106
162
|
function pointerdown(event: PointerEvent) {
|
|
107
163
|
if (
|
|
164
|
+
event.pointerType === 'touch' ||
|
|
165
|
+
drag ||
|
|
108
166
|
list.length < 2 ||
|
|
109
167
|
event.button !== 0 ||
|
|
110
168
|
!(event.target as Element).closest('.spatial-element-visual')
|
|
111
169
|
)
|
|
112
170
|
return;
|
|
113
|
-
|
|
171
|
+
beginDrag(event.pointerId, 'pointer', event.clientX);
|
|
172
|
+
window.addEventListener('pointerup', pointerup);
|
|
114
173
|
}
|
|
115
174
|
function pointermove(event: PointerEvent) {
|
|
116
|
-
if (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (!drag.active) {
|
|
120
|
-
if (Math.abs(y) > 10 && Math.abs(y) > Math.abs(x)) {
|
|
121
|
-
drag = undefined;
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
if (Math.abs(x) < 10 || Math.abs(x) < Math.abs(y) * 1.2) return;
|
|
125
|
-
drag.active = true;
|
|
126
|
-
suppressClick = true;
|
|
127
|
-
cancelAnimationFrame(frame);
|
|
128
|
-
ring.setPointerCapture(event.pointerId);
|
|
129
|
-
}
|
|
130
|
-
phase = Math.max(0, Math.min(keys.length - 1, drag.phase - x / 220));
|
|
131
|
-
invalidate();
|
|
175
|
+
if (drag?.kind !== 'pointer' || drag.id !== event.pointerId) return;
|
|
176
|
+
moveDrag(event.clientX);
|
|
177
|
+
if (drag.motion.active && !ring.hasPointerCapture(event.pointerId)) ring.setPointerCapture(event.pointerId);
|
|
132
178
|
}
|
|
133
179
|
function pointerup(event: PointerEvent) {
|
|
134
|
-
if (
|
|
135
|
-
|
|
180
|
+
if (drag?.kind !== 'pointer' || drag.id !== event.pointerId) return;
|
|
181
|
+
endDrag(false, event.clientX);
|
|
182
|
+
}
|
|
183
|
+
function beginDrag(id: number, kind: 'pointer' | 'touch', x: number, y?: number) {
|
|
184
|
+
cancelAnimationFrame(frame);
|
|
185
|
+
stopScrollMomentum();
|
|
186
|
+
frame = 0;
|
|
187
|
+
clearTimeout(clickTimer);
|
|
188
|
+
suppressClick = false;
|
|
189
|
+
const now = performance.now();
|
|
190
|
+
drag = {
|
|
191
|
+
id, kind, motion: new CarouselDrag(x, phase, now),
|
|
192
|
+
scroll: y === undefined ? undefined : new CarouselScrollDrag(y, window.scrollY,
|
|
193
|
+
Math.max(0, document.documentElement.scrollHeight - window.innerHeight), now)
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function moveDrag(x: number, y?: number) {
|
|
197
|
+
if (!drag) return;
|
|
198
|
+
const now = performance.now();
|
|
199
|
+
drag.motion.move(x, now, keys.length);
|
|
200
|
+
if (y !== undefined) drag.scroll?.move(y, now);
|
|
201
|
+
if (!drag.motion.active && !drag.scroll?.active) return;
|
|
202
|
+
suppressClick = true;
|
|
203
|
+
// Touch input can arrive faster than rendering. Commit only once per animation frame.
|
|
204
|
+
if (!frame) frame = requestAnimationFrame(() => {
|
|
205
|
+
frame = 0;
|
|
206
|
+
if (!drag) return;
|
|
207
|
+
phase = drag.motion.phase;
|
|
208
|
+
if (drag.scroll?.active) writeScroll(drag.scroll.position);
|
|
209
|
+
void tick().then(invalidate);
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
function endDrag(cancelled = false, x?: number, y?: number) {
|
|
213
|
+
if (!drag) return;
|
|
214
|
+
const { motion, kind, scroll } = drag;
|
|
215
|
+
const now = performance.now();
|
|
216
|
+
const release = motion.release(now, keys.length, x);
|
|
217
|
+
const scrollVelocity = scroll?.release(now, y) ?? 0;
|
|
218
|
+
if (motion.active || scroll?.active) suppressClick = true;
|
|
219
|
+
cancelAnimationFrame(frame);
|
|
220
|
+
frame = 0;
|
|
221
|
+
phase = motion.phase;
|
|
222
|
+
if (scroll?.active) writeScroll(scroll.position);
|
|
136
223
|
releaseDrag();
|
|
137
|
-
|
|
224
|
+
const momentum = !cancelled && !matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
225
|
+
if (motion.active) select(keys[momentum ? release.target : Math.round(phase)], momentum ? release.velocity : 0);
|
|
226
|
+
else animate(Math.max(0, keys.indexOf(selected ?? '')));
|
|
227
|
+
if (!cancelled && scroll?.active) scrollMomentum(scroll, scrollVelocity);
|
|
138
228
|
clearTimeout(clickTimer);
|
|
139
|
-
|
|
229
|
+
// Cover compatibility clicks after touch release; a new gesture always clears this.
|
|
230
|
+
clickTimer = setTimeout(() => (suppressClick = false), kind === 'touch' ? 400 : 0);
|
|
140
231
|
}
|
|
141
|
-
function pointercancel() {
|
|
232
|
+
function pointercancel(event?: PointerEvent) {
|
|
233
|
+
// Native pinch zoom may cancel PointerEvents; TouchEvents own gesture cleanup.
|
|
234
|
+
if (event?.pointerType === 'touch') return;
|
|
235
|
+
stopScrollMomentum();
|
|
142
236
|
releaseDrag();
|
|
143
|
-
|
|
237
|
+
clearTimeout(clickTimer);
|
|
238
|
+
clickTimer = setTimeout(() => (suppressClick = false), 400);
|
|
144
239
|
animate(Math.max(0, keys.indexOf(selected ?? '')));
|
|
145
240
|
}
|
|
241
|
+
function touchstart(event: TouchEvent) {
|
|
242
|
+
if (drag || event.touches.length !== 1 ||
|
|
243
|
+
!(event.target as Element).closest('.spatial-element-visual')) return;
|
|
244
|
+
const touch = event.touches[0];
|
|
245
|
+
beginDrag(touch.identifier, 'touch', touch.clientX, touch.clientY);
|
|
246
|
+
window.addEventListener('touchstart', multitouch, { passive: true });
|
|
247
|
+
window.addEventListener('touchmove', touchmove, { passive: true });
|
|
248
|
+
window.addEventListener('touchend', touchend, { passive: true });
|
|
249
|
+
window.addEventListener('touchcancel', touchcancel, { passive: true });
|
|
250
|
+
}
|
|
251
|
+
function multitouch(event: TouchEvent) {
|
|
252
|
+
if (drag?.kind === 'touch' && event.touches.length > 1) endDrag(true);
|
|
253
|
+
}
|
|
254
|
+
function touchmove(event: TouchEvent) {
|
|
255
|
+
if (drag?.kind !== 'touch') return;
|
|
256
|
+
if (event.touches.length !== 1) return endDrag(true);
|
|
257
|
+
const touch = event.touches[0];
|
|
258
|
+
if (touch.identifier === drag.id) moveDrag(touch.clientX, touch.clientY);
|
|
259
|
+
}
|
|
260
|
+
function touchend(event: TouchEvent) {
|
|
261
|
+
if (drag?.kind !== 'touch') return;
|
|
262
|
+
const touch = Array.from(event.changedTouches).find((touch) => touch.identifier === drag?.id);
|
|
263
|
+
if (touch) endDrag(false, touch.clientX, touch.clientY);
|
|
264
|
+
}
|
|
265
|
+
function touchcancel() {
|
|
266
|
+
if (drag?.kind === 'touch') endDrag(true);
|
|
267
|
+
}
|
|
146
268
|
const keys = $derived(list.map(carouselKey));
|
|
147
269
|
const selected = $derived(resolveCarouselSelection(keys, requested ?? initialItemKey));
|
|
148
270
|
$effect(() => {
|
|
@@ -155,13 +277,13 @@
|
|
|
155
277
|
settle();
|
|
156
278
|
});
|
|
157
279
|
});
|
|
158
|
-
function select(key: string | undefined) {
|
|
280
|
+
function select(key: string | undefined, velocity?: number) {
|
|
159
281
|
selectionDirty = true;
|
|
160
282
|
requested = key;
|
|
161
283
|
// Persist in the current entry before a possible popstate changes the history index.
|
|
162
284
|
rememberSelection();
|
|
163
285
|
const target = Math.max(0, keys.indexOf(key ?? ''));
|
|
164
|
-
animate(target);
|
|
286
|
+
animate(target, velocity);
|
|
165
287
|
const spatialElement = list.find((item) => carouselKey(item) === selected);
|
|
166
288
|
if (spatialElement && selected) onselectionchange?.({ itemKey: selected, spatialElementId: spatialElement.id });
|
|
167
289
|
}
|
|
@@ -175,19 +297,25 @@
|
|
|
175
297
|
}
|
|
176
298
|
onMount(() => {
|
|
177
299
|
interactive = true;
|
|
300
|
+
// The model owns both single-finger axes; passive events still allow native pinch zoom.
|
|
301
|
+
ring.addEventListener('touchstart', touchstart, { passive: true });
|
|
178
302
|
const release = sections?.register(section.id, {
|
|
179
303
|
read: () => selected,
|
|
180
304
|
restore: (key) => {
|
|
305
|
+
stopScrollMomentum();
|
|
181
306
|
selectionDirty = false;
|
|
182
307
|
requested = resolveCarouselSelection(keys, key ?? initialItemKey);
|
|
183
308
|
cancelAnimationFrame(frame);
|
|
309
|
+
frame = 0;
|
|
310
|
+
releaseDrag();
|
|
184
311
|
phase = Math.max(0, keys.indexOf(requested ?? ''));
|
|
185
312
|
announced = requested;
|
|
186
313
|
}
|
|
187
314
|
});
|
|
188
315
|
const observer = new IntersectionObserver(([entry]) => {
|
|
189
316
|
visible = entry.isIntersecting;
|
|
190
|
-
|
|
317
|
+
// The same touch must keep scrolling after carrying the carousel out of view.
|
|
318
|
+
if (!visible && drag?.kind !== 'touch') {
|
|
191
319
|
settle();
|
|
192
320
|
}
|
|
193
321
|
});
|
|
@@ -219,9 +347,19 @@
|
|
|
219
347
|
sizing.observe(ring);
|
|
220
348
|
for (const panel of ring.querySelectorAll('.summary')) sizing.observe(panel);
|
|
221
349
|
const stop = () => pointercancel();
|
|
222
|
-
window.
|
|
350
|
+
let viewportWidth = window.innerWidth;
|
|
351
|
+
const resize = () => {
|
|
352
|
+
// Mobile browser chrome resizes the height during scrolling; keep that gesture alive.
|
|
353
|
+
if (window.innerWidth !== viewportWidth) stop();
|
|
354
|
+
viewportWidth = window.innerWidth;
|
|
355
|
+
};
|
|
356
|
+
window.addEventListener('resize', resize);
|
|
357
|
+
window.addEventListener('blur', stop);
|
|
223
358
|
const hidden = () => {
|
|
224
|
-
if (document.hidden)
|
|
359
|
+
if (document.hidden) {
|
|
360
|
+
stopScrollMomentum();
|
|
361
|
+
settle();
|
|
362
|
+
}
|
|
225
363
|
};
|
|
226
364
|
document.addEventListener('visibilitychange', hidden);
|
|
227
365
|
const escape = (event: KeyboardEvent) => {
|
|
@@ -230,14 +368,17 @@
|
|
|
230
368
|
window.addEventListener('keydown', escape);
|
|
231
369
|
return () => {
|
|
232
370
|
cancelAnimationFrame(frame);
|
|
371
|
+
stopScrollMomentum();
|
|
233
372
|
clearTimeout(clickTimer);
|
|
234
373
|
releaseDrag();
|
|
374
|
+
ring.removeEventListener('touchstart', touchstart);
|
|
235
375
|
observer.disconnect();
|
|
236
376
|
sizing.disconnect();
|
|
237
377
|
contentChanges.disconnect();
|
|
238
378
|
cancelAnimationFrame(sizingFrame);
|
|
239
379
|
release?.();
|
|
240
|
-
window.removeEventListener('resize',
|
|
380
|
+
window.removeEventListener('resize', resize);
|
|
381
|
+
window.removeEventListener('blur', stop);
|
|
241
382
|
window.removeEventListener('keydown', escape);
|
|
242
383
|
document.removeEventListener('visibilitychange', hidden);
|
|
243
384
|
};
|
|
@@ -259,7 +400,7 @@
|
|
|
259
400
|
onpointerup={pointerup}
|
|
260
401
|
onpointercancel={pointercancel}
|
|
261
402
|
onlostpointercapture={() => {
|
|
262
|
-
if (drag) pointercancel();
|
|
403
|
+
if (drag?.kind === 'pointer') pointercancel();
|
|
263
404
|
}}
|
|
264
405
|
role="group"
|
|
265
406
|
aria-label={section.title}
|
|
@@ -307,7 +448,7 @@
|
|
|
307
448
|
.ring {
|
|
308
449
|
container-type: inline-size;
|
|
309
450
|
position: relative;
|
|
310
|
-
touch-action:
|
|
451
|
+
touch-action: manipulation;
|
|
311
452
|
}
|
|
312
453
|
.interactive.populated .ring {
|
|
313
454
|
min-height: var(--carousel-height, 560px);
|
|
@@ -239,12 +239,16 @@
|
|
|
239
239
|
position: relative;
|
|
240
240
|
display: grid;
|
|
241
241
|
place-items: center;
|
|
242
|
-
touch-action:
|
|
242
|
+
touch-action: manipulation;
|
|
243
243
|
}
|
|
244
244
|
.interactive {
|
|
245
245
|
display: block;
|
|
246
246
|
margin: 0;
|
|
247
247
|
}
|
|
248
|
+
.interactive .spatial-element-visual {
|
|
249
|
+
/* One owner for diagonal single-finger motion; two-finger page zoom stays native. */
|
|
250
|
+
touch-action: pinch-zoom;
|
|
251
|
+
}
|
|
248
252
|
.interactive[hidden] {
|
|
249
253
|
/* Keep known summary dimensions measurable without painting or registering GPU actors. */
|
|
250
254
|
display: block;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let { action, touch = false }: { action: 'rotate' | 'zoom' | 'pan'; touch?: boolean } = $props();
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<!-- Decorative diagrams; the adjacent definition list supplies localized instructions. -->
|
|
6
|
+
<svg width="48" height="44" viewBox="0 0 48 44" fill="none" stroke="currentColor" stroke-width="1.6"
|
|
7
|
+
stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-gesture={action} data-input={touch ? 'touch' : 'mouse'}>
|
|
8
|
+
{#if !touch}
|
|
9
|
+
{#if action === 'rotate'}
|
|
10
|
+
<path class="input-highlight" d="M24 5 C17.4 5 13 9.8 13 16 V19 H24 Z" />
|
|
11
|
+
{:else if action === 'pan'}
|
|
12
|
+
<path class="input-highlight" d="M24 5 C30.6 5 35 9.8 35 16 V19 H24 Z" />
|
|
13
|
+
{/if}
|
|
14
|
+
<rect x="13" y="5" width="22" height="34" rx="11" />
|
|
15
|
+
<path d="M13 19 H35 M24 5 V10 M24 16 V19" />
|
|
16
|
+
<rect x="22" y="10" width="4" height="7" rx="2" class:input-highlight={action === 'zoom'} />
|
|
17
|
+
{#if action === 'zoom'}
|
|
18
|
+
<path class="motion" d="M41 10 V32 M38 13 L41 10 L44 13 M38 29 L41 32 L44 29" />
|
|
19
|
+
{/if}
|
|
20
|
+
{:else if action === 'zoom'}
|
|
21
|
+
<!-- Two fingertips moving apart/together. -->
|
|
22
|
+
<path d="M6 34 L14 26 Q17 23 20 26 Q23 29 20 32 L13 39 M28 13 L35 6 Q38 3 41 6 Q44 9 41 12 L33 20" />
|
|
23
|
+
<path class="motion" d="M17 22 L7 22 L7 12 M7 22 L17 12 M28 24 L39 24 L39 35 M39 24 L29 34" />
|
|
24
|
+
{:else}
|
|
25
|
+
<!-- A raised index finger, or two raised fingers for panning. -->
|
|
26
|
+
{#if action === 'pan'}
|
|
27
|
+
<path d="M13 28 V15 A3 3 0 0 1 19 15 V24 V12 A3 3 0 0 1 25 12 V24 L28 22 Q30 21 32 23 L36 27 V32 Q36 36 32 40 H19 L10 30 Q8 27 10 25 Q12 23 15 26 L19 30" />
|
|
28
|
+
{:else}
|
|
29
|
+
<path d="M19 30 V14 A3 3 0 0 1 25 14 V24 L28 22 Q30 21 32 23 L36 27 V32 Q36 36 32 40 H19 L10 30 Q8 27 10 25 Q12 23 15 26 Z" />
|
|
30
|
+
{/if}
|
|
31
|
+
<path class="motion" d="M10 6 H35 M14 2 L10 6 L14 10 M31 2 L35 6 L31 10" />
|
|
32
|
+
{/if}
|
|
33
|
+
</svg>
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
svg { display: block; flex: none; }
|
|
37
|
+
.input-highlight { fill: var(--spatial-element-accent); stroke: var(--spatial-element-accent); }
|
|
38
|
+
.motion { stroke: var(--spatial-element-accent); }
|
|
39
|
+
</style>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
action: 'rotate' | 'zoom' | 'pan';
|
|
3
|
+
touch?: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare const InteractionGesture: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
+
type InteractionGesture = ReturnType<typeof InteractionGesture>;
|
|
7
|
+
export default InteractionGesture;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { resolve } from '$app/paths';
|
|
3
|
+
import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
|
|
3
4
|
import type { SpatialElementBreadcrumb } from '@spatial-elements/core/spatial-element/types';
|
|
4
5
|
|
|
5
6
|
let {
|
|
@@ -9,6 +10,7 @@
|
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
12
|
<nav
|
|
13
|
+
use:mouseHover
|
|
12
14
|
class="breadcrumbs"
|
|
13
15
|
data-stage-dom-content
|
|
14
16
|
aria-label="Breadcrumb"
|
|
@@ -56,7 +58,7 @@
|
|
|
56
58
|
pointer-events: auto;
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
a:hover {
|
|
61
|
+
.breadcrumbs:global([data-mouse-hover]) a:hover {
|
|
60
62
|
text-decoration: underline;
|
|
61
63
|
}
|
|
62
64
|
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount, tick } from 'svelte';
|
|
3
|
+
import { CircleHelp, X } from 'lucide-svelte';
|
|
4
|
+
import InteractionGesture from './InteractionGesture.svelte';
|
|
5
|
+
import { getCssPanelBoxShadow } from '@spatial-elements/core/stage/panelShadow';
|
|
6
|
+
import { getInteractionGuidance, MODEL_INPUT_EVENT, type ModelInputState, type InteractionGuidance } from '@spatial-elements/core/stage/interactionGuidance';
|
|
7
|
+
import { STAGE_SCROLL_PRIORITY, subscribeStageScrollFrame } from '@spatial-elements/core/stage/scrollFrame';
|
|
8
|
+
import { STAGE_PANEL_LAYOUT_EVENT } from '@spatial-elements/core/stage/panelContext';
|
|
9
|
+
import Panel from '../stage/Panel.svelte';
|
|
10
|
+
import SpatialIconButton from './SpatialIconButton.svelte';
|
|
11
|
+
import { useSpatialTheme } from './brandContext.js';
|
|
12
|
+
import { useSpatialMessages } from './messagesContext.js';
|
|
13
|
+
|
|
14
|
+
const theme = useSpatialTheme();
|
|
15
|
+
const readMessages = useSpatialMessages();
|
|
16
|
+
const messages = $derived(readMessages());
|
|
17
|
+
const help = $derived(messages.interactionHelp);
|
|
18
|
+
const id = $props.id();
|
|
19
|
+
let root: HTMLDivElement;
|
|
20
|
+
let focusAnchor = $state<HTMLElement>();
|
|
21
|
+
let button = $state<HTMLButtonElement>(null!);
|
|
22
|
+
let popover: HTMLDivElement;
|
|
23
|
+
let closeButton: HTMLButtonElement;
|
|
24
|
+
let open = $state(false);
|
|
25
|
+
let enhanced = $state(false);
|
|
26
|
+
let visible = false;
|
|
27
|
+
let interacted = $state(false);
|
|
28
|
+
let touchInput = $state(false);
|
|
29
|
+
let guidance: InteractionGuidance | undefined;
|
|
30
|
+
let delay: ReturnType<typeof setTimeout> | undefined;
|
|
31
|
+
let hideDelay: ReturnType<typeof setTimeout> | undefined;
|
|
32
|
+
let manual = false;
|
|
33
|
+
let helpHovered = false;
|
|
34
|
+
let buttonHovered = false;
|
|
35
|
+
let modelInput: ModelInputState = { hovered: false, active: false };
|
|
36
|
+
const surfaceStyle = $derived([
|
|
37
|
+
`--help-tint: ${typeof theme.panelTheme.tint === 'number' ? '#' + theme.panelTheme.tint.toString(16).padStart(6, '0') : theme.panelTheme.tint ?? '#ffffff'}`,
|
|
38
|
+
`--help-tint-opacity: ${(theme.panelTheme.tintOpacity ?? 0.65) * 100}%`,
|
|
39
|
+
`--help-blur: ${Math.min(100, Math.max(0, theme.panelTheme.backdropBlur ?? 8))}px`,
|
|
40
|
+
`--help-shadow: ${getCssPanelBoxShadow(theme.panelTheme.shadowIntensity ?? 0.2)}`,
|
|
41
|
+
`--help-radius: ${theme.panelShape.radius}px`
|
|
42
|
+
].join(';'));
|
|
43
|
+
|
|
44
|
+
function clearDelay() { clearTimeout(delay); delay = undefined; }
|
|
45
|
+
function clearHideDelay() { clearTimeout(hideDelay); hideDelay = undefined; }
|
|
46
|
+
function close(returnFocus = false) {
|
|
47
|
+
clearDelay(); clearHideDelay();
|
|
48
|
+
if (!open) return;
|
|
49
|
+
const restoreFocus = returnFocus && popover.contains(document.activeElement);
|
|
50
|
+
popover.hidePopover();
|
|
51
|
+
open = false;
|
|
52
|
+
manual = false;
|
|
53
|
+
helpHovered = false;
|
|
54
|
+
if (restoreFocus) button.focus({ preventScroll: true });
|
|
55
|
+
}
|
|
56
|
+
function position() {
|
|
57
|
+
if (!open) return;
|
|
58
|
+
const rect = button.getBoundingClientRect();
|
|
59
|
+
const viewport = window.visualViewport;
|
|
60
|
+
const leftEdge = (viewport?.offsetLeft ?? 0) + 16;
|
|
61
|
+
const topEdge = (viewport?.offsetTop ?? 0) + 16;
|
|
62
|
+
const width = Math.min(viewport?.width ?? window.innerWidth, document.documentElement.clientWidth);
|
|
63
|
+
const height = Math.min(viewport?.height ?? window.innerHeight, document.documentElement.clientHeight);
|
|
64
|
+
popover.style.maxWidth = `${Math.max(0, width - 32)}px`;
|
|
65
|
+
popover.style.maxHeight = `${Math.max(0, height - 32)}px`;
|
|
66
|
+
popover.style.setProperty('--help-max-height', `${Math.max(0, height - 32)}px`);
|
|
67
|
+
const box = popover.getBoundingClientRect();
|
|
68
|
+
const left = Math.max(leftEdge, Math.min(rect.right - box.width, leftEdge + width - 32 - box.width));
|
|
69
|
+
const below = rect.bottom + 12;
|
|
70
|
+
const top = below + box.height <= topEdge + height - 32 ? below : Math.max(topEdge, rect.top - box.height - 12);
|
|
71
|
+
const nextLeft = `${left}px`, nextTop = `${top}px`;
|
|
72
|
+
if (popover.style.left !== nextLeft || popover.style.top !== nextTop) {
|
|
73
|
+
popover.style.left = nextLeft;
|
|
74
|
+
popover.style.top = nextTop;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function requestPosition() {
|
|
78
|
+
if (open) window.dispatchEvent(new Event(STAGE_PANEL_LAYOUT_EVENT));
|
|
79
|
+
}
|
|
80
|
+
async function show(keyboard = false) {
|
|
81
|
+
if (!enhanced || !visible) return;
|
|
82
|
+
clearDelay(); clearHideDelay();
|
|
83
|
+
popover.showPopover();
|
|
84
|
+
open = true;
|
|
85
|
+
await tick();
|
|
86
|
+
requestPosition();
|
|
87
|
+
if (keyboard) closeButton.focus({ preventScroll: true });
|
|
88
|
+
}
|
|
89
|
+
function toggleHelp(event: MouseEvent) {
|
|
90
|
+
if (open) close();
|
|
91
|
+
else {
|
|
92
|
+
manual = true;
|
|
93
|
+
void show(event.detail === 0);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function schedule() {
|
|
97
|
+
clearDelay(); clearHideDelay();
|
|
98
|
+
if (manual || !enhanced || !visible || modelInput.active || touchInput || guidance?.snapshot.interacted) return;
|
|
99
|
+
if (modelInput.hovered) {
|
|
100
|
+
if (!open) delay = setTimeout(() => { void show(); }, 600);
|
|
101
|
+
} else if (open && !helpHovered && !buttonHovered && !popover.contains(document.activeElement)) {
|
|
102
|
+
hideDelay = setTimeout(() => close(), 350);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
onMount(() => {
|
|
107
|
+
guidance = getInteractionGuidance();
|
|
108
|
+
touchInput = window.matchMedia('(pointer: coarse)').matches;
|
|
109
|
+
const stopGuidance = guidance.subscribe((state) => {
|
|
110
|
+
interacted = state.interacted;
|
|
111
|
+
if (state.interacted) close();
|
|
112
|
+
});
|
|
113
|
+
const stage = root.closest<HTMLElement>('.stage')!;
|
|
114
|
+
focusAnchor = root.closest('.spatial-element-hero')?.querySelector<HTMLElement>('.spatial-element-panel') ?? undefined;
|
|
115
|
+
// Keep the non-modal help accessible when close-up hides the ordinary DOM layer.
|
|
116
|
+
stage.appendChild(popover);
|
|
117
|
+
// Measure the nearest wide panel above the hero, without relying on a host CSS class.
|
|
118
|
+
const top = root.getBoundingClientRect().top;
|
|
119
|
+
const header = Array.from(stage.querySelectorAll<HTMLElement>('[data-stage-panel-fallback]'))
|
|
120
|
+
.filter((node) => { const rect = node.getBoundingClientRect(); return rect.width > innerWidth * 0.4 && rect.bottom <= top && rect.height > 0; })
|
|
121
|
+
.sort((a, b) => b.getBoundingClientRect().bottom - a.getBoundingClientRect().bottom)[0];
|
|
122
|
+
const measureSpacing = () => {
|
|
123
|
+
if (header) {
|
|
124
|
+
const gap = Math.max(16, root.getBoundingClientRect().top - header.getBoundingClientRect().bottom - 12);
|
|
125
|
+
root.style.setProperty('--model-tools-gap', `${gap}px`);
|
|
126
|
+
}
|
|
127
|
+
requestPosition();
|
|
128
|
+
};
|
|
129
|
+
measureSpacing();
|
|
130
|
+
const headerSize = new ResizeObserver(measureSpacing);
|
|
131
|
+
if (header) headerSize.observe(header);
|
|
132
|
+
const stageChanged = () => {
|
|
133
|
+
enhanced = stage.dataset.stageState === 'enhanced' && !stage.hasAttribute('data-catalog-transition');
|
|
134
|
+
if (!enhanced) close();
|
|
135
|
+
};
|
|
136
|
+
stageChanged();
|
|
137
|
+
const mutation = new MutationObserver(stageChanged);
|
|
138
|
+
mutation.observe(stage, { attributes: true, attributeFilter: ['data-stage-state', 'data-catalog-transition'] });
|
|
139
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
140
|
+
visible = entry.isIntersecting;
|
|
141
|
+
if (!visible) close();
|
|
142
|
+
});
|
|
143
|
+
observer.observe(root);
|
|
144
|
+
const size = new ResizeObserver(requestPosition);
|
|
145
|
+
size.observe(popover);
|
|
146
|
+
const modelChanged = (event: Event) => {
|
|
147
|
+
modelInput = (event as CustomEvent<ModelInputState>).detail;
|
|
148
|
+
if (modelInput.active) close();
|
|
149
|
+
schedule();
|
|
150
|
+
};
|
|
151
|
+
const inputChanged = (event: PointerEvent) => {
|
|
152
|
+
if (!event.isTrusted) return;
|
|
153
|
+
const next = event.pointerType !== 'mouse';
|
|
154
|
+
if (next !== touchInput) { touchInput = next; if (next) { clearDelay(); clearHideDelay(); if (!manual) close(); } }
|
|
155
|
+
};
|
|
156
|
+
const buttonEnter = (event: PointerEvent) => { buttonHovered = event.pointerType === 'mouse'; schedule(); };
|
|
157
|
+
const buttonLeave = () => { buttonHovered = false; schedule(); };
|
|
158
|
+
const keydown = (event: KeyboardEvent) => {
|
|
159
|
+
if (event.key === 'Escape' && open) { event.preventDefault(); close(true); }
|
|
160
|
+
};
|
|
161
|
+
const stopScroll = subscribeStageScrollFrame(() => {
|
|
162
|
+
if (!open) return;
|
|
163
|
+
const rect = button.getBoundingClientRect();
|
|
164
|
+
if (rect.bottom < 0 || rect.top > innerHeight) close();
|
|
165
|
+
else requestPosition();
|
|
166
|
+
}, STAGE_SCROLL_PRIORITY.stage + 1);
|
|
167
|
+
stage.addEventListener(MODEL_INPUT_EVENT, modelChanged);
|
|
168
|
+
button.addEventListener('pointerenter', buttonEnter);
|
|
169
|
+
button.addEventListener('pointerleave', buttonLeave);
|
|
170
|
+
window.addEventListener('pointerdown', inputChanged, { capture: true, passive: true });
|
|
171
|
+
window.addEventListener('pointermove', inputChanged, { capture: true, passive: true });
|
|
172
|
+
window.addEventListener('keydown', keydown);
|
|
173
|
+
window.addEventListener('resize', measureSpacing, { passive: true });
|
|
174
|
+
window.visualViewport?.addEventListener('resize', requestPosition, { passive: true });
|
|
175
|
+
window.visualViewport?.addEventListener('scroll', requestPosition, { passive: true });
|
|
176
|
+
return () => {
|
|
177
|
+
// A queued focusout microtask must not restart the hover timer after teardown.
|
|
178
|
+
enhanced = false; visible = false;
|
|
179
|
+
close(); stopGuidance(); stopScroll(); mutation.disconnect(); observer.disconnect(); size.disconnect(); headerSize.disconnect();
|
|
180
|
+
root.appendChild(popover);
|
|
181
|
+
stage.removeEventListener(MODEL_INPUT_EVENT, modelChanged);
|
|
182
|
+
button.removeEventListener('pointerenter', buttonEnter);
|
|
183
|
+
button.removeEventListener('pointerleave', buttonLeave);
|
|
184
|
+
window.removeEventListener('pointerdown', inputChanged, true);
|
|
185
|
+
window.removeEventListener('pointermove', inputChanged, true);
|
|
186
|
+
window.removeEventListener('keydown', keydown);
|
|
187
|
+
window.removeEventListener('resize', measureSpacing);
|
|
188
|
+
window.visualViewport?.removeEventListener('resize', requestPosition);
|
|
189
|
+
window.visualViewport?.removeEventListener('scroll', requestPosition);
|
|
190
|
+
};
|
|
191
|
+
});
|
|
192
|
+
</script>
|
|
193
|
+
|
|
194
|
+
<div bind:this={root} class="model-tools" class:enhanced style={surfaceStyle} data-spatial-element-tools>
|
|
195
|
+
<div class="model-tools-buttons">
|
|
196
|
+
<SpatialIconButton bind:element={button} {focusAnchor} label={messages.controls.help} onclick={toggleHelp} expanded={open} controls={id} enabled={enhanced}>
|
|
197
|
+
<CircleHelp size={21} strokeWidth={1.8} aria-hidden="true" />
|
|
198
|
+
</SpatialIconButton>
|
|
199
|
+
</div>
|
|
200
|
+
{#if enhanced && touchInput && !interacted && !open}
|
|
201
|
+
<p class="touch-hint" data-spatial-element-touch-hint>{help.touchHint}</p>
|
|
202
|
+
{/if}
|
|
203
|
+
<div bind:this={popover} {id} popover="auto" role="dialog" tabindex="-1" aria-modal="false" aria-labelledby={`${id}-title`}
|
|
204
|
+
style={surfaceStyle}
|
|
205
|
+
class="interaction-help" data-spatial-element-help data-surface={theme.panelTheme.surface ?? 'glass'}
|
|
206
|
+
onpointerenter={(event) => { helpHovered = event.pointerType === 'mouse'; schedule(); }}
|
|
207
|
+
onpointerleave={() => { helpHovered = false; schedule(); }}
|
|
208
|
+
onfocusin={clearHideDelay} onfocusout={() => { queueMicrotask(schedule); }}
|
|
209
|
+
ontoggle={(event) => { open = event.newState === 'open'; if (!open) { manual = false; clearHideDelay(); } }}>
|
|
210
|
+
<Panel class="interaction-help-panel" nativeContent nativeLayout={position} visible={open} pointerReactive={false} focusReactive={false}
|
|
211
|
+
shape={{ ...theme.panelShape, contentInset: 0 }} theme={theme.panelTheme}>
|
|
212
|
+
<div class="help-copy">
|
|
213
|
+
<div class="help-heading">
|
|
214
|
+
<h2 id={`${id}-title`}>{help.title}</h2>
|
|
215
|
+
<button bind:this={closeButton} type="button" class="close-help" onclick={() => close(true)}
|
|
216
|
+
aria-label={messages.controls.closeHelp} title={messages.controls.closeHelp}>
|
|
217
|
+
<X size={19} aria-hidden="true" />
|
|
218
|
+
</button>
|
|
219
|
+
</div>
|
|
220
|
+
<dl>
|
|
221
|
+
<div><InteractionGesture action="rotate" touch={touchInput} /><dt>{help.rotate}</dt><dd>{touchInput ? help.touchRotate : help.mouseRotate}</dd></div>
|
|
222
|
+
<div><InteractionGesture action="zoom" touch={touchInput} /><dt>{help.zoom}</dt><dd>{touchInput ? help.touchZoom : help.mouseZoom}</dd></div>
|
|
223
|
+
<div><InteractionGesture action="pan" touch={touchInput} /><dt>{help.pan}</dt><dd>{touchInput ? help.touchPan : help.mousePan}</dd></div>
|
|
224
|
+
</dl>
|
|
225
|
+
<p class="navigation-hint">
|
|
226
|
+
{#if touchInput}
|
|
227
|
+
{help.touchScrollHint}
|
|
228
|
+
{:else}
|
|
229
|
+
{#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}
|
|
230
|
+
{/if}
|
|
231
|
+
</p>
|
|
232
|
+
</div>
|
|
233
|
+
</Panel>
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
|
|
237
|
+
<style>
|
|
238
|
+
.model-tools {
|
|
239
|
+
grid-column: 1; grid-row: 1; align-self: start; justify-self: end; position: relative;
|
|
240
|
+
margin-top: 6px; margin-inline-end: calc(var(--model-tools-gap, 32px) - var(--spatial-element-hero-column-gap));
|
|
241
|
+
width: 40px; height: 40px; z-index: 6; visibility: hidden; pointer-events: none;
|
|
242
|
+
}
|
|
243
|
+
.model-tools.enhanced { visibility: visible; pointer-events: auto; }
|
|
244
|
+
.model-tools-buttons { display: flex; gap: 8px; justify-content: flex-end; }
|
|
245
|
+
.touch-hint {
|
|
246
|
+
position: absolute; right: 0; top: 48px; width: max-content; max-width: min(260px, calc(100vw - 48px));
|
|
247
|
+
margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 12px; line-height: 1.45;
|
|
248
|
+
color: var(--spatial-element-ink); pointer-events: none;
|
|
249
|
+
background: color-mix(in srgb, var(--help-tint) var(--help-tint-opacity), transparent);
|
|
250
|
+
backdrop-filter: blur(var(--help-blur)); box-shadow: var(--help-shadow);
|
|
251
|
+
}
|
|
252
|
+
.interaction-help {
|
|
253
|
+
position: fixed; inset: auto; box-sizing: border-box; width: 248px;
|
|
254
|
+
margin: 0; padding: 0; overflow: visible;
|
|
255
|
+
border: 0; border-radius: var(--help-radius); color: var(--spatial-element-ink);
|
|
256
|
+
background: transparent;
|
|
257
|
+
font: inherit; font-size: 14px; line-height: 1.45; touch-action: manipulation;
|
|
258
|
+
}
|
|
259
|
+
.help-copy { box-sizing: border-box; padding: 12px 16px 16px; max-height: var(--help-max-height); overflow: auto; border-radius: var(--help-radius); }
|
|
260
|
+
.interaction-help::backdrop { background: transparent; pointer-events: none; }
|
|
261
|
+
.help-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
|
262
|
+
h2 { margin: 0; font-size: 15px; font-weight: 650; }
|
|
263
|
+
.close-help {
|
|
264
|
+
width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center;
|
|
265
|
+
padding: 0; border: 0; border-radius: 8px; color: inherit; background: transparent; cursor: pointer;
|
|
266
|
+
}
|
|
267
|
+
.close-help:focus-visible { outline: 2px solid var(--spatial-element-accent); }
|
|
268
|
+
dl { display: grid; gap: 8px; margin: 8px 0 0; }
|
|
269
|
+
dl > div { display: grid; grid-template-columns: 48px 1fr; column-gap: 14px; align-items: center; }
|
|
270
|
+
dt { font-weight: 650; }
|
|
271
|
+
/* Keep complete host-localized instructions available to assistive technology. */
|
|
272
|
+
dd { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
273
|
+
.navigation-hint { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid currentColor; font-size: 12px; }
|
|
274
|
+
.navigation-hint a { color: var(--spatial-element-accent); text-decoration: underline; text-underline-offset: 2px; }
|
|
275
|
+
.navigation-hint a:focus-visible { outline: 2px solid var(--spatial-element-accent); outline-offset: 3px; border-radius: 2px; }
|
|
276
|
+
@media (max-width: 1100px) { .model-tools { margin-inline-end: 0; } }
|
|
277
|
+
</style>
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import { useSpatialTheme } from './brandContext.js';
|
|
17
17
|
import SpatialElementMediaRail from './SpatialElementMediaRail.svelte';
|
|
18
18
|
import SpatialElementSummaryPanel from './SpatialElementSummaryPanel.svelte';
|
|
19
|
+
import SpatialElementHelp from './SpatialElementHelp.svelte';
|
|
19
20
|
import SpatialElementStickyHeader from './SpatialElementStickyHeader.svelte';
|
|
20
21
|
import SpatialElementTabs from './SpatialElementTabs.svelte';
|
|
21
22
|
import { SpatialElementDockController } from '@spatial-elements/core/spatial-element/SpatialElementDockController';
|
|
@@ -178,6 +179,7 @@
|
|
|
178
179
|
aria-hidden={spatialElement.fallbackImage ? undefined : 'true'}
|
|
179
180
|
/>
|
|
180
181
|
|
|
182
|
+
{#key spatialElement.id}<SpatialElementHelp />{/key}
|
|
181
183
|
<SpatialElementSummaryPanel {spatialElement} />
|
|
182
184
|
</section>
|
|
183
185
|
|
|
@@ -200,11 +202,12 @@
|
|
|
200
202
|
}
|
|
201
203
|
|
|
202
204
|
.spatial-element-hero {
|
|
205
|
+
--spatial-element-hero-column-gap: clamp(28px, 4vw, 70px);
|
|
203
206
|
position: relative;
|
|
204
207
|
box-sizing: border-box;
|
|
205
208
|
display: grid;
|
|
206
209
|
grid-template-columns: minmax(420px, 1fr) minmax(360px, 494px);
|
|
207
|
-
gap:
|
|
210
|
+
gap: var(--spatial-element-hero-column-gap);
|
|
208
211
|
align-items: start;
|
|
209
212
|
width: calc(100vw - var(--spatial-element-hero-edge-gap) - var(--spatial-element-hero-edge-gap));
|
|
210
213
|
min-height: clamp(610px, calc(100vh - 230px), 760px);
|
|
@@ -231,6 +234,11 @@
|
|
|
231
234
|
margin-top: 8px;
|
|
232
235
|
}
|
|
233
236
|
|
|
237
|
+
.spatial-element-hero :global(.spatial-element-visual) {
|
|
238
|
+
grid-column: 1;
|
|
239
|
+
grid-row: 1;
|
|
240
|
+
}
|
|
241
|
+
|
|
234
242
|
:global(.spatial-element-visual) {
|
|
235
243
|
min-height: clamp(540px, calc(100vh - 300px), 680px);
|
|
236
244
|
border-radius: 28px;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { catalogActionSemantic } from '@spatial-elements/core/catalog/catalogAction';
|
|
3
|
+
import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
|
|
3
4
|
import { ShoppingCart } from 'lucide-svelte';
|
|
4
5
|
import Panel from '../stage/Panel.svelte';
|
|
5
6
|
import { useSpatialTheme } from './brandContext.js';
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
data-shared-role="summary-surface"
|
|
30
31
|
data-spatial-element-id={spatialElement.id}
|
|
31
32
|
>
|
|
32
|
-
<div class="summary-presentation">
|
|
33
|
+
<div class="summary-presentation" use:mouseHover>
|
|
33
34
|
<div class="panel-copy">
|
|
34
35
|
<p
|
|
35
36
|
class="panel-kicker"
|
|
@@ -264,7 +265,7 @@
|
|
|
264
265
|
will-change: transform;
|
|
265
266
|
}
|
|
266
267
|
|
|
267
|
-
.feature-list li:hover .feature-content {
|
|
268
|
+
.summary-presentation:global([data-mouse-hover]) .feature-list li:hover .feature-content {
|
|
268
269
|
--summary-feature-hover-progress: 1;
|
|
269
270
|
}
|
|
270
271
|
|
|
@@ -287,7 +288,8 @@
|
|
|
287
288
|
transform-style: preserve-3d;
|
|
288
289
|
}
|
|
289
290
|
|
|
290
|
-
.spatial-element-action:
|
|
291
|
+
.summary-presentation:global([data-mouse-hover]) .spatial-element-action:hover .spatial-element-action-surface,
|
|
292
|
+
.spatial-element-action:focus-visible .spatial-element-action-surface {
|
|
291
293
|
--summary-action-hover-progress: 1;
|
|
292
294
|
}
|
|
293
295
|
|
|
@@ -408,9 +410,10 @@
|
|
|
408
410
|
}
|
|
409
411
|
|
|
410
412
|
.feature-content,
|
|
411
|
-
.feature-list li:hover .feature-content,
|
|
413
|
+
.summary-presentation:global([data-mouse-hover]) .feature-list li:hover .feature-content,
|
|
412
414
|
.spatial-element-action-surface,
|
|
413
|
-
.spatial-element-action:
|
|
415
|
+
.summary-presentation:global([data-mouse-hover]) .spatial-element-action:hover .spatial-element-action-surface,
|
|
416
|
+
.spatial-element-action:focus-visible .spatial-element-action-surface {
|
|
414
417
|
--summary-feature-hover-progress: 0;
|
|
415
418
|
--summary-action-hover-progress: 0;
|
|
416
419
|
transition: none;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount } from 'svelte';
|
|
3
|
+
import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
|
|
3
4
|
import {
|
|
4
5
|
STAGE_ANCHOR_SCROLL_DURATION_MS,
|
|
5
6
|
STAGE_ANCHOR_SCROLL_EASING
|
|
@@ -81,6 +82,7 @@
|
|
|
81
82
|
</script>
|
|
82
83
|
|
|
83
84
|
<nav
|
|
85
|
+
use:mouseHover
|
|
84
86
|
class="spatial-element-tab-list"
|
|
85
87
|
data-spatial-element-tab-list={variant}
|
|
86
88
|
aria-label="Elementbereiche"
|
|
@@ -218,7 +220,7 @@
|
|
|
218
220
|
visibility: hidden;
|
|
219
221
|
}
|
|
220
222
|
|
|
221
|
-
a:hover:not([aria-current='location']) {
|
|
223
|
+
.spatial-element-tab-list:global([data-mouse-hover]) a:hover:not([aria-current='location']) {
|
|
222
224
|
background: color-mix(in srgb, var(--spatial-element-body) 8%, transparent);
|
|
223
225
|
}
|
|
224
226
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
|
|
4
|
+
import Panel from '../stage/Panel.svelte';
|
|
5
|
+
import { useSpatialTheme } from './brandContext.js';
|
|
6
|
+
|
|
7
|
+
let { label, children, onclick, expanded, controls, focusAnchor, enabled = true, element = $bindable() }: {
|
|
8
|
+
label: string;
|
|
9
|
+
children: Snippet;
|
|
10
|
+
onclick: (event: MouseEvent) => void;
|
|
11
|
+
expanded?: boolean;
|
|
12
|
+
controls?: string;
|
|
13
|
+
focusAnchor?: HTMLElement;
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
element?: HTMLButtonElement;
|
|
16
|
+
} = $props();
|
|
17
|
+
const theme = useSpatialTheme();
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<div class="icon-frame">
|
|
21
|
+
<Panel
|
|
22
|
+
class="spatial-icon-panel"
|
|
23
|
+
shape={{ radius: Math.min(12, theme.panelShape.radius), contentInset: 0 }}
|
|
24
|
+
theme={theme.panelTheme}
|
|
25
|
+
pointerReactive={false}
|
|
26
|
+
focusReactive="top-right"
|
|
27
|
+
{focusAnchor}
|
|
28
|
+
transitionGroup="enter"
|
|
29
|
+
>
|
|
30
|
+
<!-- Keep visibility on the button: Panel's content style also holds renderer positioning. -->
|
|
31
|
+
<button bind:this={element} use:mouseHover type="button" {onclick} aria-label={label} title={label}
|
|
32
|
+
disabled={!enabled}
|
|
33
|
+
style:visibility={enabled ? 'visible' : 'hidden'}
|
|
34
|
+
aria-expanded={expanded} aria-controls={controls} aria-haspopup={controls ? 'dialog' : undefined}
|
|
35
|
+
class="spatial-icon-button">
|
|
36
|
+
{@render children()}
|
|
37
|
+
</button>
|
|
38
|
+
</Panel>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<style>
|
|
42
|
+
.icon-frame { width: 40px; height: 40px; flex: 0 0 40px; }
|
|
43
|
+
/* The renderer moves panel contents into its projection layer; retain the anchor size. */
|
|
44
|
+
.icon-frame :global(.spatial-icon-panel) { width: 40px; height: 40px; }
|
|
45
|
+
.spatial-icon-button {
|
|
46
|
+
box-sizing: border-box; display: grid; place-items: center; width: 40px; height: 40px;
|
|
47
|
+
padding: 0; border: 0; border-radius: min(12px, var(--spatial-element-panel-radius)); background: transparent;
|
|
48
|
+
color: var(--spatial-element-ink); cursor: pointer; touch-action: manipulation;
|
|
49
|
+
transition: background-color 180ms ease;
|
|
50
|
+
}
|
|
51
|
+
.spatial-icon-button:global([data-mouse-hover]):hover {
|
|
52
|
+
background: color-mix(in srgb, var(--spatial-element-body) 8%, transparent);
|
|
53
|
+
}
|
|
54
|
+
.spatial-icon-button:focus-visible { outline: 2px solid var(--spatial-element-accent); outline-offset: 3px; }
|
|
55
|
+
@media (prefers-reduced-motion: reduce) { .spatial-icon-button { transition: none; } }
|
|
56
|
+
</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,4 +1,5 @@
|
|
|
1
1
|
export { default as BrandStageShell } from './BrandStageShell.svelte';
|
|
2
|
+
export { defaultSpatialMessages, resolveSpatialMessages, type SpatialMessages, type SpatialMessagesInput } from '@spatial-elements/core/spatial-element/messages';
|
|
2
3
|
export { default as SpatialElementPage } from './SpatialElementPage.svelte';
|
|
3
4
|
export { default as SpatialListPage } from './SpatialListPage.svelte';
|
|
4
5
|
export { default as Section } from './Section.svelte';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as BrandStageShell } from './BrandStageShell.svelte';
|
|
2
|
+
export { defaultSpatialMessages, resolveSpatialMessages } from '@spatial-elements/core/spatial-element/messages';
|
|
2
3
|
export { default as SpatialElementPage } from './SpatialElementPage.svelte';
|
|
3
4
|
export { default as SpatialListPage } from './SpatialListPage.svelte';
|
|
4
5
|
export { default as Section } from './Section.svelte';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type SpatialMessagesInput } from '@spatial-elements/core/spatial-element/messages';
|
|
2
|
+
export declare function provideSpatialMessages(read: () => SpatialMessagesInput | undefined): void;
|
|
3
|
+
export declare function useSpatialMessages(): () => import("@spatial-elements/core").SpatialMessages;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getContext, setContext } from 'svelte';
|
|
2
|
+
import { resolveSpatialMessages } from '@spatial-elements/core/spatial-element/messages';
|
|
3
|
+
const MESSAGES = Symbol('spatial-messages');
|
|
4
|
+
export function provideSpatialMessages(read) {
|
|
5
|
+
setContext(MESSAGES, read);
|
|
6
|
+
}
|
|
7
|
+
export function useSpatialMessages() {
|
|
8
|
+
const read = getContext(MESSAGES);
|
|
9
|
+
return () => resolveSpatialMessages(read?.());
|
|
10
|
+
}
|
package/dist/stage/Panel.svelte
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import type { Snippet } from 'svelte';
|
|
6
6
|
import {
|
|
7
7
|
STAGE_CONTEXT_KEY,
|
|
8
|
+
STAGE_PANEL_LAYOUT_EVENT,
|
|
8
9
|
type StageContext,
|
|
9
10
|
|
|
10
11
|
type StagePanelMinimapOptions,
|
|
@@ -23,8 +24,18 @@
|
|
|
23
24
|
class?: string;
|
|
24
25
|
contentClass?: string;
|
|
25
26
|
minimap?: boolean | StagePanelMinimapOptions;
|
|
26
|
-
/**
|
|
27
|
-
pointerReactive?: boolean;
|
|
27
|
+
/** true: proximity lift and tilt; 'lift': a 2px mouse-hover lift without tilt; false: still. */
|
|
28
|
+
pointerReactive?: boolean | 'lift';
|
|
29
|
+
/** false keeps the pose; 'top-right' reaches the corner as the surrounding UI clears. */
|
|
30
|
+
focusReactive?: boolean | 'top-right';
|
|
31
|
+
/** Optional neighbouring panel frame whose top-left corner moves with a 'top-right' control. */
|
|
32
|
+
focusAnchor?: HTMLElement;
|
|
33
|
+
/** Retain native DOM layout, including popover semantics, while rendering the glass surface. */
|
|
34
|
+
nativeContent?: boolean;
|
|
35
|
+
/** Position native content in the stage render frame, after projected anchors have moved. */
|
|
36
|
+
nativeLayout?: () => void;
|
|
37
|
+
/** Visibility of an optional native-content panel. */
|
|
38
|
+
visible?: boolean;
|
|
28
39
|
pose?: StagePanelPose;
|
|
29
40
|
shape: StagePanelShape;
|
|
30
41
|
surface?: StagePanelSurface;
|
|
@@ -39,6 +50,11 @@
|
|
|
39
50
|
contentClass = '',
|
|
40
51
|
minimap = false,
|
|
41
52
|
pointerReactive = true,
|
|
53
|
+
focusReactive = true,
|
|
54
|
+
focusAnchor,
|
|
55
|
+
nativeContent = false,
|
|
56
|
+
nativeLayout,
|
|
57
|
+
visible = true,
|
|
42
58
|
pose,
|
|
43
59
|
shape,
|
|
44
60
|
style: contentStyle = '',
|
|
@@ -66,6 +82,11 @@
|
|
|
66
82
|
getFrameElement: () => frameElement,
|
|
67
83
|
getSurfaceElement: () => surfaceElement,
|
|
68
84
|
getPointerReactive: () => pointerReactive,
|
|
85
|
+
getFocusReactive: () => focusReactive,
|
|
86
|
+
getFocusAnchor: () => focusAnchor,
|
|
87
|
+
getNativeContent: () => nativeContent,
|
|
88
|
+
updateNativeLayout: () => nativeLayout?.(),
|
|
89
|
+
getVisible: () => visible,
|
|
69
90
|
getMinimapOptions: () => getMinimapOptions(),
|
|
70
91
|
getMinimapDockProgress,
|
|
71
92
|
getMinimapModelScale,
|
|
@@ -76,6 +97,12 @@
|
|
|
76
97
|
});
|
|
77
98
|
|
|
78
99
|
onDestroy(unregister);
|
|
100
|
+
$effect(() => {
|
|
101
|
+
if (nativeContent) {
|
|
102
|
+
void visible;
|
|
103
|
+
window.dispatchEvent(new Event(STAGE_PANEL_LAYOUT_EVENT));
|
|
104
|
+
}
|
|
105
|
+
});
|
|
79
106
|
|
|
80
107
|
onMount(() => {
|
|
81
108
|
if (!getMinimapOptions()) return;
|
|
@@ -220,6 +247,7 @@
|
|
|
220
247
|
<div
|
|
221
248
|
bind:this={frameElement}
|
|
222
249
|
data-stage-panel-fallback
|
|
250
|
+
data-stage-panel-native-content={nativeContent ? '' : undefined}
|
|
223
251
|
data-catalog-transition-group={transitionGroup}
|
|
224
252
|
data-stage-panel-minimap={minimap ? '' : undefined}
|
|
225
253
|
data-stage-minimap-docked-view-scale={getMinimapOptions()?.dockedView?.scale}
|
|
@@ -10,8 +10,18 @@ type Props = Omit<StagePanelAttributes, 'class'> & {
|
|
|
10
10
|
class?: string;
|
|
11
11
|
contentClass?: string;
|
|
12
12
|
minimap?: boolean | StagePanelMinimapOptions;
|
|
13
|
-
/**
|
|
14
|
-
pointerReactive?: boolean;
|
|
13
|
+
/** true: proximity lift and tilt; 'lift': a 2px mouse-hover lift without tilt; false: still. */
|
|
14
|
+
pointerReactive?: boolean | 'lift';
|
|
15
|
+
/** false keeps the pose; 'top-right' reaches the corner as the surrounding UI clears. */
|
|
16
|
+
focusReactive?: boolean | 'top-right';
|
|
17
|
+
/** Optional neighbouring panel frame whose top-left corner moves with a 'top-right' control. */
|
|
18
|
+
focusAnchor?: HTMLElement;
|
|
19
|
+
/** Retain native DOM layout, including popover semantics, while rendering the glass surface. */
|
|
20
|
+
nativeContent?: boolean;
|
|
21
|
+
/** Position native content in the stage render frame, after projected anchors have moved. */
|
|
22
|
+
nativeLayout?: () => void;
|
|
23
|
+
/** Visibility of an optional native-content panel. */
|
|
24
|
+
visible?: boolean;
|
|
15
25
|
pose?: StagePanelPose;
|
|
16
26
|
shape: StagePanelShape;
|
|
17
27
|
surface?: StagePanelSurface;
|
package/dist/stage/Stage.svelte
CHANGED
|
@@ -507,9 +507,9 @@
|
|
|
507
507
|
await Promise.resolve();
|
|
508
508
|
};
|
|
509
509
|
|
|
510
|
-
const setView = async (view: StageVisualTestView) => {
|
|
510
|
+
const setView = async (view: StageVisualTestView, frames = 18) => {
|
|
511
511
|
experience?.setVisualTestView(view);
|
|
512
|
-
await settle(
|
|
512
|
+
await settle(frames);
|
|
513
513
|
};
|
|
514
514
|
const setSpaceMouseZoom = async (zoom: number) => {
|
|
515
515
|
experience?.setVisualTestSpaceMouseZoom(zoom);
|
|
@@ -554,6 +554,7 @@
|
|
|
554
554
|
driveSpaceMouseZoom,
|
|
555
555
|
stopSpaceMouse,
|
|
556
556
|
getMinimapRect: () => experience?.getVisualTestMinimapRect() ?? null,
|
|
557
|
+
getPanelRect: (frame) => experience?.getVisualTestPanelRect(frame) ?? null,
|
|
557
558
|
getModelRect: () => experience?.getVisualTestModelRect() ?? null,
|
|
558
559
|
getMinimapModelRect: () => experience?.getVisualTestMinimapModelRect() ?? null,
|
|
559
560
|
getMinimapOrientation: () => experience?.getVisualTestMinimapOrientation() ?? null,
|
|
@@ -617,11 +618,16 @@
|
|
|
617
618
|
getMinimapModelScale: panel.getMinimapModelScale,
|
|
618
619
|
getMinimapModelTop: panel.getMinimapModelTop,
|
|
619
620
|
getSurfaceOpacity: panel.getSurfaceOpacity,
|
|
621
|
+
getVisible: panel.getVisible,
|
|
622
|
+
getFocusAnchor: panel.getFocusAnchor,
|
|
623
|
+
updateNativeLayout: panel.updateNativeLayout,
|
|
624
|
+
nativeContent: panel.getNativeContent?.() ?? false,
|
|
620
625
|
minimap: panel.getMinimapOptions(),
|
|
621
626
|
options: panel.getOptions(),
|
|
622
627
|
surface: panel.getSurface(),
|
|
623
628
|
surfaceElement,
|
|
624
|
-
pointerReactive: panel.getPointerReactive()
|
|
629
|
+
pointerReactive: panel.getPointerReactive(),
|
|
630
|
+
focusReactive: panel.getFocusReactive?.() ?? true
|
|
625
631
|
});
|
|
626
632
|
});
|
|
627
633
|
|
|
@@ -784,12 +790,17 @@
|
|
|
784
790
|
pointer-events: none !important;
|
|
785
791
|
}
|
|
786
792
|
|
|
787
|
-
:global(.stage.stage-enhanced [data-stage-panel-fallback][data-stage-panel-bound]) {
|
|
793
|
+
:global(.stage.stage-enhanced [data-stage-panel-fallback][data-stage-panel-bound]:not([data-stage-panel-native-content])) {
|
|
788
794
|
visibility: hidden !important;
|
|
789
795
|
opacity: 0 !important;
|
|
790
796
|
pointer-events: none !important;
|
|
791
797
|
}
|
|
792
798
|
|
|
799
|
+
:global(.stage.stage-enhanced [data-stage-panel-native-content][data-stage-panel-bound][data-stage-panel-surface='glass'] > .stage-panel-surface::before),
|
|
800
|
+
:global(.stage.stage-enhanced [data-stage-panel-native-content][data-stage-panel-bound][data-stage-panel-surface='glass'] > .stage-panel-surface::after) {
|
|
801
|
+
display: none;
|
|
802
|
+
}
|
|
803
|
+
|
|
793
804
|
/* A failed binding may leave pixels in either canvas; the poster owns fallback paint. */
|
|
794
805
|
.stage.stage-fallback :global(.stage-webgpu-background),
|
|
795
806
|
.stage.stage-fallback :global(.stage-webgpu-carousel-rear),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spatial-elements/sveltekit",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"description": "SvelteKit components and navigation for Spatial Elements.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"prepack": "npm run build"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@spatial-elements/core": "1.0.0-beta.
|
|
42
|
+
"@spatial-elements/core": "1.0.0-beta.4",
|
|
43
43
|
"lucide-svelte": "^1.0.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|