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

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.
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from 'svelte';
3
+ import { retainDeviceOrientationPermission } from '@spatial-elements/core/catalog/listDeviceOrientation';
3
4
  import Stage from '../stage/Stage.svelte';
4
5
  import PointerHint from './PointerHint.svelte';
5
6
  import type { StageRenderSettings } from '@spatial-elements/core';
@@ -10,6 +11,8 @@
10
11
  import type { SpatialTheme } from '@spatial-elements/core/spatial-element/types';
11
12
 
12
13
  interface Props {
14
+ /** Enable automatic sensor access / permission on internal navigation for opted-in lists. */
15
+ deviceOrientation?: boolean;
13
16
  /** Shared appearance and namespace. Use createSpatialTheme for defaults. */
14
17
  theme: SpatialTheme;
15
18
  /** Resolved by the host. System preference and persistence belong to the shell. */
@@ -24,7 +27,10 @@
24
27
  children?: Snippet;
25
28
  }
26
29
 
27
- let { theme, colorScheme, messages, renderSettings, dracoDecoderPath, children }: Props = $props();
30
+ let { theme, colorScheme, messages, renderSettings, dracoDecoderPath, children, deviceOrientation = false }: Props = $props();
31
+ $effect(() => {
32
+ if (deviceOrientation) return retainDeviceOrientationPermission();
33
+ });
28
34
 
29
35
  provideSpatialTheme(() => theme);
30
36
  provideSpatialMessages(() => messages);
@@ -34,6 +40,7 @@
34
40
 
35
41
  <div class="brand-stage-shell" style={brandStyle} style:color-scheme={colorScheme} data-color-scheme={colorScheme}>
36
42
  <Stage
43
+ {deviceOrientation}
37
44
  brandId={theme.id}
38
45
  {renderSettings}
39
46
  {dracoDecoderPath}
@@ -3,6 +3,8 @@ import type { StageRenderSettings } from '@spatial-elements/core';
3
3
  import type { SpatialMessagesInput } from '@spatial-elements/core/spatial-element/messages';
4
4
  import type { SpatialTheme } from '@spatial-elements/core/spatial-element/types';
5
5
  interface Props {
6
+ /** Enable automatic sensor access / permission on internal navigation for opted-in lists. */
7
+ deviceOrientation?: boolean;
6
8
  /** Shared appearance and namespace. Use createSpatialTheme for defaults. */
7
9
  theme: SpatialTheme;
8
10
  /** Resolved by the host. System preference and persistence belong to the shell. */
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { getContext, onMount, tick, untrack } from 'svelte';
3
3
  import Section from './Section.svelte';
4
+ import { retainListDeviceOrientation } from '@spatial-elements/core/catalog/listDeviceOrientation';
4
5
  import { carouselTextHit } from './carouselTextHit.js';
5
6
  import CarouselSpatialElement from './CarouselSpatialElement.svelte';
6
7
  import { CATALOG_POSE_CHANGED, carouselEmphasis, CarouselDragEmphasis, type CarouselEmphasis, type CarouselLayout, type CarouselPresentation } from '@spatial-elements/core/catalog/catalogPose';
@@ -33,6 +34,9 @@
33
34
  const indicated = $derived(keys[Math.round(clampCarouselPhase(phase, keys.length))]);
34
35
  let announced = $state<string>();
35
36
  let ring: HTMLDivElement;
37
+ $effect(() => {
38
+ if (interactive && ring) return retainListDeviceOrientation(ring, () => {});
39
+ });
36
40
  let layout = $state<CarouselLayout>({ width: 1320, height: 600, left: 60, viewportWidth: 1440 });
37
41
  let frame = 0;
38
42
  let nativeFrame = 0;
@@ -327,6 +331,7 @@
327
331
  class:interactive
328
332
  class:populated={list.length > 0}
329
333
  data-carousel-section={section.id}
334
+ data-device-orientation=""
330
335
  >
331
336
  <!-- svelte-ignore a11y_no_noninteractive_tabindex (The native scroll rail must be keyboard-scrollable without JavaScript.) -->
332
337
  <div
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { retainListDeviceOrientation } from '@spatial-elements/core/catalog/listDeviceOrientation';
2
3
  import Section from './Section.svelte';
3
4
  import SpatialElementCard from './SpatialElementCard.svelte';
4
5
  import type {
@@ -12,10 +13,15 @@
12
13
  list: SpatialListItem[];
13
14
  }
14
15
  let { section, list }: Props = $props();
16
+ let catalog: HTMLDivElement;
17
+ $effect(() => {
18
+ if (catalog)
19
+ return retainListDeviceOrientation(catalog, () => {});
20
+ });
15
21
  </script>
16
22
 
17
23
  <Section {section} presentation="list">
18
- <div class="catalog">
24
+ <div class="catalog" bind:this={catalog} data-device-orientation="">
19
25
  {#each list as spatialElement, index (spatialElement.itemKey ?? spatialElement.id)}
20
26
  <SpatialElementCard
21
27
  {spatialElement}
@@ -55,6 +55,7 @@
55
55
  } from '@spatial-elements/core/stage/panelContext';
56
56
 
57
57
  interface Props {
58
+ deviceOrientation?: boolean;
58
59
  /** Namespace for automatic ContentPage/SpatialElementPage registration. Supplied by BrandStageShell. */
59
60
  brandId?: string;
60
61
  renderSettings?: StageRenderSettings;
@@ -76,6 +77,7 @@
76
77
  }
77
78
 
78
79
  let {
80
+ deviceOrientation = false,
79
81
  brandId,
80
82
  ariaLabel = 'WebGPU 3D stage',
81
83
  renderSettings,
@@ -268,6 +270,7 @@
268
270
  const panels = getPanelTargets();
269
271
  const viewport = getViewportTarget();
270
272
  const instance = new StageExperience(stage, {
273
+ deviceOrientation,
271
274
  renderSettings,
272
275
  dracoDecoderPath,
273
276
  catalog: Boolean(catalog),
@@ -4,6 +4,7 @@ import type { BackgroundSettings, StageCameraSettings, StageInteractionTheme, St
4
4
  import '../catalog/catalogTransition.css';
5
5
  import type { CatalogPage } from '@spatial-elements/core/catalog/catalogPage';
6
6
  interface Props {
7
+ deviceOrientation?: boolean;
7
8
  /** Namespace for automatic ContentPage/SpatialElementPage registration. Supplied by BrandStageShell. */
8
9
  brandId?: string;
9
10
  renderSettings?: StageRenderSettings;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spatial-elements/sveltekit",
3
- "version": "1.0.0-beta.6",
3
+ "version": "1.0.0-beta.7",
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.6",
42
+ "@spatial-elements/core": "1.0.0-beta.7",
43
43
  "lucide-svelte": "^1.0.1"
44
44
  },
45
45
  "peerDependencies": {