@spatial-elements/sveltekit 1.0.0-beta.4 → 1.0.0-beta.6

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 (43) hide show
  1. package/README.md +6 -2
  2. package/dist/catalog/catalogTransition.css +12 -0
  3. package/dist/index.d.ts +3 -0
  4. package/dist/index.js +2 -0
  5. package/dist/spatial-element/BrandStageShell.svelte +9 -59
  6. package/dist/spatial-element/BrandStageShell.svelte.d.ts +2 -0
  7. package/dist/spatial-element/CarouselSection.svelte +339 -323
  8. package/dist/spatial-element/CarouselSection.svelte.d.ts +2 -7
  9. package/dist/spatial-element/CarouselSpatialElement.svelte +142 -127
  10. package/dist/spatial-element/CarouselSpatialElement.svelte.d.ts +5 -1
  11. package/dist/spatial-element/ContentPage.svelte +2 -1
  12. package/dist/spatial-element/PointerHint.svelte +78 -0
  13. package/dist/spatial-element/PointerHint.svelte.d.ts +3 -0
  14. package/dist/spatial-element/SpatialElementCard.svelte +68 -2
  15. package/dist/spatial-element/SpatialElementHelp.svelte +23 -14
  16. package/dist/spatial-element/SpatialElementMediaRail.svelte +22 -3
  17. package/dist/spatial-element/SpatialElementPage.svelte +2 -4
  18. package/dist/spatial-element/SpatialElementSummaryContent.svelte +182 -0
  19. package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +18 -0
  20. package/dist/spatial-element/SpatialElementSummaryPanel.svelte +29 -375
  21. package/dist/spatial-element/SpatialElementTabs.svelte +2 -1
  22. package/dist/spatial-element/SpatialElementViewToggle.svelte +53 -0
  23. package/dist/spatial-element/SpatialElementViewToggle.svelte.d.ts +8 -0
  24. package/dist/spatial-element/SpatialIconButton.svelte +2 -1
  25. package/dist/spatial-element/brandContext.d.ts +1 -1
  26. package/dist/spatial-element/brandContext.js +1 -1
  27. package/dist/spatial-element/carouselTextHit.d.ts +2 -0
  28. package/dist/spatial-element/carouselTextHit.js +17 -0
  29. package/dist/spatial-element/spatialThemeStyle.d.ts +3 -0
  30. package/dist/spatial-element/spatialThemeStyle.js +48 -0
  31. package/dist/spatial-element/truncatedTitle.d.ts +5 -0
  32. package/dist/spatial-element/truncatedTitle.js +28 -0
  33. package/dist/stage/ButtonGroup.svelte +163 -0
  34. package/dist/stage/ButtonGroup.svelte.d.ts +24 -0
  35. package/dist/stage/Panel.svelte +24 -9
  36. package/dist/stage/Stage.svelte +91 -5
  37. package/dist/stage/Stage.svelte.d.ts +2 -0
  38. package/dist/stage/StageViewport.svelte +7 -1
  39. package/dist/stage/authoredStyle.d.ts +4 -0
  40. package/dist/stage/authoredStyle.js +17 -0
  41. package/dist/stage/buttonGroup.d.ts +9 -0
  42. package/dist/stage/buttonGroup.js +1 -0
  43. package/package.json +2 -2
@@ -0,0 +1,163 @@
1
+ <script lang="ts">
2
+ import { onMount, type Snippet } from 'svelte';
3
+ import type { HTMLAttributes } from 'svelte/elements';
4
+ import type { StagePanelShape, StagePanelTheme } from '@spatial-elements/core/stage/panelContext';
5
+ import type { CatalogTransitionGroup } from '@spatial-elements/core/catalog/catalogPresentation';
6
+ import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
7
+ import Panel from './Panel.svelte';
8
+ import type { ButtonGroupItem } from './buttonGroup.js';
9
+ type Props = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onchange'> & {
10
+ items: readonly ButtonGroupItem[];
11
+ /** Controlled selection. Omit when no button is selected. */
12
+ value?: string;
13
+ onchange?: (value: string) => void;
14
+ label: string;
15
+ content?: Snippet<[ButtonGroupItem]>;
16
+ iconOnly?: boolean;
17
+ disabled?: boolean;
18
+ visible?: boolean;
19
+ shape: StagePanelShape;
20
+ theme?: StagePanelTheme;
21
+ focusReactive?: boolean | 'top-right';
22
+ focusAnchor?: HTMLElement;
23
+ transitionGroup?: CatalogTransitionGroup;
24
+ };
25
+ let {
26
+ items,
27
+ value,
28
+ onchange,
29
+ label,
30
+ content,
31
+ iconOnly = false,
32
+ disabled = false,
33
+ visible = true,
34
+ shape,
35
+ theme,
36
+ focusReactive = false,
37
+ focusAnchor,
38
+ transitionGroup,
39
+ class: className = '',
40
+ ...rest
41
+ }: Props = $props();
42
+ let group: HTMLDivElement;
43
+ let measuredWidth = $state<number>();
44
+ const radius = $derived(Math.min(12, Math.max(0, shape.radius)));
45
+ const width = $derived(
46
+ iconOnly ? `${items.length * 40}px` : measuredWidth ? `${measuredWidth}px` : 'max-content'
47
+ );
48
+ onMount(() => {
49
+ const observer = new ResizeObserver(() => {
50
+ measuredWidth = group.offsetWidth;
51
+ });
52
+ observer.observe(group);
53
+ return () => observer.disconnect();
54
+ });
55
+ </script>
56
+
57
+ <div class="button-group-frame" style:width>
58
+ <Panel
59
+ class="button-group-panel"
60
+ shape={{ ...shape, radius, contentInset: 0 }}
61
+ {theme}
62
+ pointerReactive={false}
63
+ {focusReactive}
64
+ {focusAnchor}
65
+ {transitionGroup}
66
+ >
67
+ <div
68
+ {...rest}
69
+ bind:this={group}
70
+ role="group"
71
+ aria-label={label}
72
+ class={['button-group', className]}
73
+ use:mouseHover
74
+ style:--control-radius={`${radius}px`}
75
+ style:visibility={visible ? 'visible' : 'hidden'}
76
+ >
77
+ {#each items as item (item.value)}
78
+ <button
79
+ type="button"
80
+ class:icon-only={iconOnly}
81
+ disabled={disabled || item.disabled}
82
+ aria-label={item.label}
83
+ title={item.tooltip ?? item.label}
84
+ aria-pressed={item.value === value}
85
+ style:--selection={`${Math.min(1, Math.max(0, item.selection ?? (item.value === value ? 1 : 0))) * 8}%`}
86
+ onclick={() => onchange?.(item.value)}
87
+ >
88
+ {#if content}{@render content(item)}{:else}{item.label}{/if}
89
+ </button>
90
+ {/each}
91
+ </div>
92
+ </Panel>
93
+ </div>
94
+
95
+ <style>
96
+ .button-group-frame {
97
+ height: 40px;
98
+ flex: none;
99
+ }
100
+ .button-group-frame :global(.button-group-panel) {
101
+ width: 100%;
102
+ height: 40px;
103
+ }
104
+ .button-group {
105
+ display: flex;
106
+ width: max-content;
107
+ height: 40px;
108
+ border-radius: var(--control-radius);
109
+ }
110
+ button {
111
+ box-sizing: border-box;
112
+ display: grid;
113
+ place-items: center;
114
+ min-width: 40px;
115
+ height: 40px;
116
+ padding: 0 12px;
117
+ border: 0;
118
+ font: inherit;
119
+ white-space: nowrap;
120
+ background: color-mix(
121
+ in srgb,
122
+ var(--spatial-element-body, currentColor) var(--selection),
123
+ transparent
124
+ );
125
+ color: var(--spatial-element-ink, inherit);
126
+ cursor: pointer;
127
+ touch-action: manipulation;
128
+ transition: background-color 180ms ease;
129
+ }
130
+ button.icon-only {
131
+ width: 40px;
132
+ padding: 0;
133
+ }
134
+ button:first-child {
135
+ border-radius: var(--control-radius) 0 0 var(--control-radius);
136
+ }
137
+ button:last-child {
138
+ border-radius: 0 var(--control-radius) var(--control-radius) 0;
139
+ }
140
+ button:only-child {
141
+ border-radius: var(--control-radius);
142
+ }
143
+ button + button {
144
+ border-left: 1px solid
145
+ color-mix(in srgb, var(--spatial-element-body, currentColor) 12%, transparent);
146
+ }
147
+ .button-group:global([data-mouse-hover]) button:enabled:hover {
148
+ background: color-mix(in srgb, var(--spatial-element-body, currentColor) 8%, transparent);
149
+ }
150
+ button:focus-visible {
151
+ outline: 2px solid var(--spatial-element-accent, currentColor);
152
+ outline-offset: -2px;
153
+ }
154
+ button:disabled {
155
+ cursor: default;
156
+ opacity: 0.45;
157
+ }
158
+ @media (prefers-reduced-motion: reduce) {
159
+ button {
160
+ transition: none;
161
+ }
162
+ }
163
+ </style>
@@ -0,0 +1,24 @@
1
+ import { type Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import type { StagePanelShape, StagePanelTheme } from '@spatial-elements/core/stage/panelContext';
4
+ import type { CatalogTransitionGroup } from '@spatial-elements/core/catalog/catalogPresentation';
5
+ import type { ButtonGroupItem } from './buttonGroup.js';
6
+ type Props = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onchange'> & {
7
+ items: readonly ButtonGroupItem[];
8
+ /** Controlled selection. Omit when no button is selected. */
9
+ value?: string;
10
+ onchange?: (value: string) => void;
11
+ label: string;
12
+ content?: Snippet<[ButtonGroupItem]>;
13
+ iconOnly?: boolean;
14
+ disabled?: boolean;
15
+ visible?: boolean;
16
+ shape: StagePanelShape;
17
+ theme?: StagePanelTheme;
18
+ focusReactive?: boolean | 'top-right';
19
+ focusAnchor?: HTMLElement;
20
+ transitionGroup?: CatalogTransitionGroup;
21
+ };
22
+ declare const ButtonGroup: import("svelte").Component<Props, {}, "">;
23
+ type ButtonGroup = ReturnType<typeof ButtonGroup>;
24
+ export default ButtonGroup;
@@ -1,7 +1,8 @@
1
1
  <script lang="ts">
2
2
  import type { HTMLAttributes } from "svelte/elements";
3
3
  type StagePanelAttributes = HTMLAttributes<HTMLDivElement>;
4
- import { getContext, onDestroy, onMount } from 'svelte';
4
+ import { getContext, onDestroy, onMount, untrack } from 'svelte';
5
+ import { authoredStyle } from './authoredStyle.js';
5
6
  import type { Snippet } from 'svelte';
6
7
  import {
7
8
  STAGE_CONTEXT_KEY,
@@ -97,6 +98,13 @@
97
98
  });
98
99
 
99
100
  onDestroy(unregister);
101
+ $effect(() => {
102
+ getPanelOptions();
103
+ getContentInset();
104
+ Object.values(getMinimapOptions() ?? {});
105
+ void resolvedSurface;
106
+ stage.updatePanelAppearance?.();
107
+ });
100
108
  $effect(() => {
101
109
  if (nativeContent) {
102
110
  void visible;
@@ -106,14 +114,15 @@
106
114
 
107
115
  onMount(() => {
108
116
  if (!getMinimapOptions()) return;
117
+ const minimapContent = contentElement;
109
118
 
110
119
  const resetView = (event: MouseEvent) => {
111
120
  if (event.defaultPrevented || event.button !== 0) return;
112
121
  stage.resetView();
113
122
  };
114
123
 
115
- contentElement.addEventListener('click', resetView);
116
- return () => contentElement.removeEventListener('click', resetView);
124
+ minimapContent.addEventListener('click', resetView);
125
+ return () => minimapContent.removeEventListener('click', resetView);
117
126
  });
118
127
 
119
128
  function getContentInset() {
@@ -180,9 +189,6 @@
180
189
  `--stage-panel-thickness: ${thickness}`,
181
190
  `--stage-panel-bezel: ${bezel}px`,
182
191
  `--stage-panel-opacity: ${clamp(theme.opacity ?? 1, 0, 1)}`,
183
- '--stage-panel-surface-opacity: 1',
184
- '--stage-panel-focus-opacity: 1',
185
- '--stage-panel-content-opacity: 1',
186
192
  `--stage-panel-css-blur: ${Math.min(backdropBlur, 100)}px`
187
193
  ];
188
194
 
@@ -242,6 +248,9 @@
242
248
  function clamp(value: number, min: number, max: number) {
243
249
  return Math.min(Math.max(value, min), max);
244
250
  }
251
+ // SSR styles are static; the action patches only authored properties after hydration.
252
+ const initialFallbackStyle = untrack(getFallbackStyle);
253
+ const initialContentStyle = untrack(getContentThemeStyle);
245
254
  </script>
246
255
 
247
256
  <div
@@ -255,7 +264,8 @@
255
264
  class={[frameClass, 'stage-panel-fallback', pose ? 'stage-panel-posed' : '']
256
265
  .filter(Boolean)
257
266
  .join(' ')}
258
- style={getFallbackStyle()}
267
+ style={initialFallbackStyle}
268
+ use:authoredStyle={getFallbackStyle()}
259
269
  >
260
270
  <div
261
271
  bind:this={surfaceElement}
@@ -264,16 +274,21 @@
264
274
  data-stage-panel-minimap={minimap ? '' : undefined}
265
275
  data-stage-panel-surface={resolvedSurface}
266
276
  class="stage-panel-surface"
267
- style={getFallbackStyle()}
277
+ style={initialFallbackStyle}
278
+ data-stage-panel-authored-style={getFallbackStyle()}
279
+ use:authoredStyle={getFallbackStyle()}
268
280
  >
269
281
  <div
270
282
  {...rest}
271
283
  bind:this={contentElement}
272
284
  use:registerEndpoint={catalogEndpoint}
273
285
  data-stage-panel-content
286
+ data-stage-corner-control={focusReactive === 'top-right' ? '' : undefined}
274
287
  data-catalog-transition-group={transitionGroup}
275
288
  class={contentClass}
276
- style={getContentThemeStyle()}
289
+ style={initialContentStyle}
290
+ data-stage-panel-authored-style={getContentThemeStyle()}
291
+ use:authoredStyle={getContentThemeStyle()}
277
292
  >
278
293
  {@render children?.()}
279
294
  </div>
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { SpatialElementLodPair } from '@spatial-elements/core/catalog/spatialElementLodPair';
3
+ import { DEFAULT_BACKGROUND } from '@spatial-elements/core/stage/stageConstants';
3
4
  import { onMount, setContext, tick } from 'svelte';
4
5
  import type { Snippet } from 'svelte';
5
6
  import type {
@@ -20,6 +21,7 @@
20
21
  } from '@spatial-elements/core/stage/stageVisualTest';
21
22
  import { resolveStageRenderSettings } from '@spatial-elements/core/stage/renderSettings';
22
23
  import { VirtualScrollController } from '@spatial-elements/core/stage/VirtualScrollController';
24
+ import { StageFullscreenController } from '@spatial-elements/core/stage/StageFullscreenController';
23
25
  import ScrollNavigationBridge from '../catalog/ScrollNavigationBridge.svelte';
24
26
  import { CatalogTransition } from '@spatial-elements/core/catalog/CatalogTransition';
25
27
  import {
@@ -59,6 +61,8 @@
59
61
  dracoDecoderPath?: string;
60
62
  ariaLabel?: string;
61
63
  background?: BackgroundSettings;
64
+ /** Theme overrides applied after each element's HDR background settings. */
65
+ sceneBackground?: Partial<BackgroundSettings>;
62
66
  pageBackground?: string;
63
67
  hdr?: string;
64
68
  glb?: string;
@@ -78,6 +82,7 @@
78
82
  dracoDecoderPath,
79
83
  pageBackground = '#ffffff',
80
84
  background: standaloneBackground,
85
+ sceneBackground,
81
86
  hdr: standaloneHdr,
82
87
  glb: standaloneGlb,
83
88
  lodPair: standaloneLodPair,
@@ -115,7 +120,7 @@
115
120
  const catalogSpatialElements = $derived(
116
121
  displayedSpatialElements.length ? displayedSpatialElements : (catalog?.spatialElements ?? [])
117
122
  );
118
- const background = $derived(brandId ? activeElement?.background : standaloneBackground);
123
+ const background = $derived({ ...DEFAULT_BACKGROUND, ...(brandId ? activeElement?.background : standaloneBackground), ...sceneBackground });
119
124
  const hdr = $derived(brandId
120
125
  ? (activePage?.kind === 'content' ? activePage.hdr : activeScene?.hdr ?? '')
121
126
  : standaloneHdr);
@@ -132,8 +137,10 @@
132
137
  let virtualScrollSpacer: HTMLDivElement;
133
138
  let domLayer: HTMLDivElement;
134
139
  let status = $state('Loading stage');
135
- let showStatus = $state(true);
140
+ let showStatus = $state(false);
136
141
  let isEnhanced = $state(false);
142
+ let fullscreen = $state(false);
143
+ let fullscreenController: StageFullscreenController | undefined;
137
144
  let isFallback = $state(true);
138
145
  let domLayerHidden = $state(false);
139
146
  let domLayerOpacity = $state(1);
@@ -176,6 +183,8 @@
176
183
  };
177
184
 
178
185
  setContext<StageContext>(STAGE_CONTEXT_KEY, {
186
+ isEnhanced: () => isEnhanced,
187
+ updatePanelAppearance: scheduleAppearanceUpdate,
179
188
  prefetchSpatialElement: (config) => experience?.prefetchSpatialElement(config),
180
189
  registerPanel(panel) {
181
190
  registeredPanels.push(panel);
@@ -194,14 +203,26 @@
194
203
  },
195
204
  resetView() {
196
205
  experience?.resetView();
197
- }
206
+ },
207
+ isFullscreen: () => fullscreen,
208
+ getZoomFocus: () => zoomFocusState.focus,
209
+ setFullscreen: (active) => fullscreenController?.setFullscreen(active)
198
210
  });
199
211
 
200
212
  onMount(() => {
213
+ // The semantic page is already usable. Only announce unusually slow enhancement.
214
+ const statusTimer = window.setTimeout(() => {
215
+ if (stageState === 'loading') showStatus = true;
216
+ }, 1000);
217
+ fullscreenController = new StageFullscreenController(stage, (active) => {
218
+ fullscreen = active;
219
+ experience?.setFullscreen(active);
220
+ });
201
221
  document.documentElement.classList.add('stage-route');
202
222
  document.body.classList.add('stage-route');
203
223
  virtualScroll = new VirtualScrollController(stage, domLayer, virtualScrollSpacer);
204
- virtualScroll.start();
224
+ // Native fallback pages keep native document scrolling and browser anchor behavior.
225
+ if (navigator.gpu) virtualScroll.start();
205
226
  transition = new CatalogTransition(stage, catalogEndpoints, {
206
227
  captureContentGeometry: (endpoint, secondary) =>
207
228
  experience?.captureContentGeometry(endpoint.spatialElementId, secondary) ?? false,
@@ -269,6 +290,7 @@
269
290
  enableSpaceMouse: !isStageVisualTestMode(),
270
291
  onDeviceLost: () => {
271
292
  if (disposed || experience !== instance) return;
293
+ fullscreenController?.setFullscreen(false);
272
294
  navigationGeneration += 1;
273
295
  transition?.cancel();
274
296
  experience = null;
@@ -278,6 +300,7 @@
278
300
  setZoomFocusState(restingZoomFocus);
279
301
  isEnhanced = false;
280
302
  isFallback = true;
303
+ virtualScroll?.destroy();
281
304
  stageState = 'fallback';
282
305
  showStatus = false;
283
306
  }
@@ -295,6 +318,8 @@
295
318
  return;
296
319
  }
297
320
 
321
+ // Paint the prepared scene before posters and fallback surfaces start fading.
322
+ instance.flushCatalogFrame();
298
323
  isEnhanced = true;
299
324
  isFallback = false;
300
325
  showStatus = false;
@@ -314,6 +339,7 @@
314
339
  experience?.dispose();
315
340
  experience = null;
316
341
  status = error instanceof Error ? error.message : 'Unable to initialize WebGPU stage';
342
+ virtualScroll?.destroy();
317
343
  isEnhanced = false;
318
344
  isFallback = true;
319
345
  stageState = 'fallback';
@@ -322,6 +348,9 @@
322
348
  });
323
349
 
324
350
  return () => {
351
+ window.clearTimeout(statusTimer);
352
+ fullscreenController?.dispose();
353
+ fullscreenController = undefined;
325
354
  virtualScroll?.destroy();
326
355
  virtualScroll = undefined;
327
356
  destroyed = true;
@@ -340,6 +369,22 @@
340
369
  };
341
370
  });
342
371
 
372
+ $effect(() => {
373
+ void pageBackground; void background; void isEnhanced;
374
+ Object.values(interactionTheme ?? {});
375
+ scheduleAppearanceUpdate();
376
+ });
377
+ let appearanceUpdatePending = false;
378
+ function scheduleAppearanceUpdate() {
379
+ if (appearanceUpdatePending) return;
380
+ appearanceUpdatePending = true;
381
+ void tick().then(() => {
382
+ appearanceUpdatePending = false;
383
+ if (!destroyed && isEnhanced) experience?.updateAppearance({
384
+ pageBackground, background, interactionTheme, panels: getPanelTargets()
385
+ });
386
+ });
387
+ }
343
388
  $effect(() => {
344
389
  const spatialElements = catalogSpatialElements;
345
390
  if (experience && catalog && isEnhanced) {
@@ -385,6 +430,7 @@
385
430
 
386
431
  let navigationTimings = { dataReady: 0, captured: 0, restoring: 0, bound: 0 };
387
432
  function captureNavigation(navigation: OnNavigate) {
433
+ fullscreenController?.setFullscreen(false);
388
434
  navigationTimings = { dataReady: performance.now(), captured: 0, restoring: 0, bound: 0 };
389
435
  navigationGeneration += 1;
390
436
  reuseCatalogPage = Boolean(
@@ -557,6 +603,7 @@
557
603
  getPanelRect: (frame) => experience?.getVisualTestPanelRect(frame) ?? null,
558
604
  getModelRect: () => experience?.getVisualTestModelRect() ?? null,
559
605
  getMinimapModelRect: () => experience?.getVisualTestMinimapModelRect() ?? null,
606
+ getMinimapViewportRect: () => experience?.getVisualTestMinimapViewportRect() ?? null,
560
607
  getMinimapOrientation: () => experience?.getVisualTestMinimapOrientation() ?? null,
561
608
  getMinimapRenderStats: () =>
562
609
  experience?.getVisualTestMinimapRenderStats() ?? {
@@ -661,7 +708,7 @@
661
708
  >
662
709
  <div bind:this={virtualScrollSpacer} class="stage-virtual-scroll-spacer" aria-hidden="true"></div>
663
710
 
664
- <div class="stage-virtual-viewport">
711
+ <div class="stage-virtual-viewport" inert={fullscreen}>
665
712
  <div
666
713
  bind:this={domLayer}
667
714
  class="stage-dom-layer"
@@ -678,6 +725,10 @@
678
725
  </div>
679
726
 
680
727
  <style>
728
+ /* Apply the same document metrics before hydration; the class remains useful
729
+ * to hosts that do not support :has(). */
730
+ :global(html:has(.stage)),
731
+ :global(body:has(.stage)),
681
732
  :global(html.stage-route),
682
733
  :global(body.stage-route) {
683
734
  margin: 0;
@@ -686,6 +737,7 @@
686
737
  background: #ffffff;
687
738
  }
688
739
 
740
+ :global(body:has(.stage)),
689
741
  :global(body.stage-route) {
690
742
  overflow-x: hidden;
691
743
  }
@@ -698,6 +750,19 @@
698
750
  background: var(--stage-page-background, #ffffff);
699
751
  }
700
752
 
753
+ .stage:global([data-stage-fullscreen]) {
754
+ z-index: 2147483000;
755
+ isolation: isolate;
756
+ }
757
+ .stage:global([data-stage-fullscreen]) .stage-virtual-viewport {
758
+ visibility: hidden;
759
+ pointer-events: none;
760
+ }
761
+ .stage:global([data-stage-fullscreen]) .stage-virtual-viewport :global(*) {
762
+ visibility: hidden !important;
763
+ pointer-events: none !important;
764
+ }
765
+
701
766
  .stage-virtual-scroll-spacer {
702
767
  display: none;
703
768
  width: 1px;
@@ -742,6 +807,19 @@
742
807
  pointer-events: none;
743
808
  }
744
809
 
810
+ .stage :global(.stage-webgpu-background),
811
+ .stage :global(.stage-webgpu-carousel-rear),
812
+ .stage :global(.stage-webgpu-foreground) {
813
+ opacity: 0;
814
+ transition: opacity 240ms ease;
815
+ }
816
+
817
+ .stage.stage-enhanced :global(.stage-webgpu-background),
818
+ .stage.stage-enhanced :global(.stage-webgpu-carousel-rear),
819
+ .stage.stage-enhanced :global(.stage-webgpu-foreground) {
820
+ opacity: 1;
821
+ }
822
+
745
823
  .stage :global(.stage-webgpu-foreground) {
746
824
  /* Keep rendered minimaps above the fixed element header (z-index 20). */
747
825
  z-index: 21;
@@ -824,4 +902,12 @@
824
902
  13px/1.35 system-ui,
825
903
  sans-serif;
826
904
  }
905
+
906
+ @media (prefers-reduced-motion: reduce) {
907
+ .stage :global(.stage-webgpu-background),
908
+ .stage :global(.stage-webgpu-carousel-rear),
909
+ .stage :global(.stage-webgpu-foreground) {
910
+ transition: none;
911
+ }
912
+ }
827
913
  </style>
@@ -10,6 +10,8 @@ interface Props {
10
10
  dracoDecoderPath?: string;
11
11
  ariaLabel?: string;
12
12
  background?: BackgroundSettings;
13
+ /** Theme overrides applied after each element's HDR background settings. */
14
+ sceneBackground?: Partial<BackgroundSettings>;
13
15
  pageBackground?: string;
14
16
  hdr?: string;
15
17
  glb?: string;
@@ -65,9 +65,15 @@
65
65
  width: 100%;
66
66
  height: 100%;
67
67
  object-fit: contain;
68
+ opacity: 1;
69
+ transition: opacity 240ms ease;
68
70
  }
69
71
 
70
72
  :global(.stage-enhanced) .stage-viewport-fallback-image {
71
- visibility: hidden;
73
+ opacity: 0;
74
+ }
75
+
76
+ @media (prefers-reduced-motion: reduce) {
77
+ .stage-viewport-fallback-image { transition: none; }
72
78
  }
73
79
  </style>
@@ -0,0 +1,4 @@
1
+ /** Patch authored declarations without erasing the renderer's position, transform or visibility. */
2
+ export declare function authoredStyle(node: HTMLElement, value: string): {
3
+ update: (next: string) => void;
4
+ };
@@ -0,0 +1,17 @@
1
+ /** Patch authored declarations without erasing the renderer's position, transform or visibility. */
2
+ export function authoredStyle(node, value) {
3
+ let previous = new Set();
4
+ function update(next) {
5
+ const parsed = document.createElement('div').style;
6
+ parsed.cssText = next;
7
+ const properties = new Set(Array.from(parsed));
8
+ for (const name of previous)
9
+ if (!properties.has(name))
10
+ node.style.removeProperty(name);
11
+ for (const name of properties)
12
+ node.style.setProperty(name, parsed.getPropertyValue(name), parsed.getPropertyPriority(name));
13
+ previous = properties;
14
+ }
15
+ update(value);
16
+ return { update };
17
+ }
@@ -0,0 +1,9 @@
1
+ export interface ButtonGroupItem {
2
+ value: string;
3
+ /** Accessible name and default tooltip. */
4
+ label: string;
5
+ tooltip?: string;
6
+ disabled?: boolean;
7
+ /** Visual selection strength (0–1), independent of aria-pressed. */
8
+ selection?: number;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spatial-elements/sveltekit",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.6",
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.4",
42
+ "@spatial-elements/core": "1.0.0-beta.6",
43
43
  "lucide-svelte": "^1.0.1"
44
44
  },
45
45
  "peerDependencies": {