@spatial-elements/sveltekit 1.0.0-beta.10 → 1.0.0-beta.12

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 (34) hide show
  1. package/dist/spatial-element/BrandStageShell.svelte +1 -1
  2. package/dist/spatial-element/BrandStageShell.svelte.d.ts +1 -1
  3. package/dist/spatial-element/CarouselSpatialElement.svelte +3 -4
  4. package/dist/spatial-element/OverflowControls.svelte +5 -1
  5. package/dist/spatial-element/SpaceMouseControl.svelte +168 -0
  6. package/dist/spatial-element/SpaceMouseControl.svelte.d.ts +7 -0
  7. package/dist/spatial-element/SpaceMouseIcon.svelte +12 -0
  8. package/dist/spatial-element/SpaceMouseIcon.svelte.d.ts +26 -0
  9. package/dist/spatial-element/SpatialCarouselSection.svelte +4 -2
  10. package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +26 -2
  11. package/dist/spatial-element/SpatialElementBreadcrumbs.svelte.d.ts +1 -0
  12. package/dist/spatial-element/SpatialElementHelp.svelte +18 -10
  13. package/dist/spatial-element/SpatialElementMediaRail.svelte +14 -5
  14. package/dist/spatial-element/SpatialElementPage.svelte +19 -6
  15. package/dist/spatial-element/SpatialElementPage.svelte.d.ts +5 -0
  16. package/dist/spatial-element/SpatialElementStickyHeader.svelte +28 -8
  17. package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +3 -0
  18. package/dist/spatial-element/SpatialElementSummaryContent.svelte +35 -8
  19. package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +5 -0
  20. package/dist/spatial-element/SpatialElementSummaryPanel.svelte +3 -1
  21. package/dist/spatial-element/SpatialIconButton.svelte +19 -5
  22. package/dist/spatial-element/SpatialIconButton.svelte.d.ts +3 -0
  23. package/dist/spatial-element/SpatialNavigationShell.svelte +9 -4
  24. package/dist/spatial-element/SpatialSummaryRoot.svelte +6 -4
  25. package/dist/spatial-element/SpatialViewIcon.svelte +1 -1
  26. package/dist/spatial-element/headerFields.css +21 -0
  27. package/dist/spatial-element/index.d.ts +1 -0
  28. package/dist/spatial-element/index.js +1 -0
  29. package/dist/spatial-element/layout.generated.css +8 -7
  30. package/dist/stage/ButtonGroup.svelte +2 -1
  31. package/dist/stage/Panel.svelte +6 -0
  32. package/dist/stage/Stage.svelte +73 -7
  33. package/logo.svg +90 -53
  34. package/package.json +2 -2
@@ -16,7 +16,7 @@
16
16
  import type { SpatialTheme } from '@spatial-elements/core/spatial-element/types';
17
17
 
18
18
  interface Props {
19
- /** Enable automatic sensor access / permission on internal navigation for opted-in lists. */
19
+ /** Enable sensor motion on detail geometry and minimaps. Lists opt in independently. */
20
20
  deviceOrientation?: boolean;
21
21
  /** Shared appearance and namespace. Use createSpatialTheme for defaults. */
22
22
  theme: SpatialTheme;
@@ -6,7 +6,7 @@ import type { StageRenderSettings } from '@spatial-elements/core';
6
6
  import type { SpatialMessagesInput } from '@spatial-elements/core/spatial-element/messages';
7
7
  import type { SpatialTheme } from '@spatial-elements/core/spatial-element/types';
8
8
  interface Props {
9
- /** Enable automatic sensor access / permission on internal navigation for opted-in lists. */
9
+ /** Enable sensor motion on detail geometry and minimaps. Lists opt in independently. */
10
10
  deviceOrientation?: boolean;
11
11
  /** Shared appearance and namespace. Use createSpatialTheme for defaults. */
12
12
  theme: SpatialTheme;
@@ -124,7 +124,7 @@
124
124
  data-carousel-theme={JSON.stringify({
125
125
  ...brand.panelTheme,
126
126
  radius: radii.panel,
127
- tintOpacity: Math.min(brand.panelTheme.tintOpacity ?? 0.28, 0.72)
127
+ tintOpacity: Math.max(0, Math.min(brand.panelTheme.tintOpacity ?? 0.28, 1))
128
128
  })}
129
129
  data-catalog-occurrence={occurrence}
130
130
  >
@@ -196,10 +196,10 @@
196
196
  : typeof brand.panelTheme.tint === 'object'
197
197
  ? brand.panelTheme.tint.getStyle()
198
198
  : (brand.panelTheme.tint ?? '#ffffff')}
199
- style:--carousel-panel-tint-opacity={Math.min(brand.panelTheme.tintOpacity ?? 0.28, 0.72) *
199
+ style:--carousel-panel-tint-opacity={Math.max(0, Math.min(brand.panelTheme.tintOpacity ?? 0.28, 1)) *
200
200
  100 +
201
201
  '%'}
202
- style:--carousel-panel-blur={(brand.panelTheme.backdropBlur ?? 5) + 'px'}
202
+ style:--carousel-panel-backdrop={brand.panelTheme.surface === 'solid' ? 'none' : `blur(${Math.max(0, Math.min(brand.panelTheme.backdropBlur ?? 5, 100))}px)`}
203
203
  style:--carousel-focus-blur={interactive && pose.panelOpacity < 1 ? `blur(${(1 - pose.panelOpacity) * 6}px)` : 'none'}
204
204
  style:--carousel-panel-radius={radii.panel + 'px'}
205
205
  use:catalogEndpoint={address('summary-surface')}
@@ -318,7 +318,6 @@
318
318
  margin: 0;
319
319
  --spatial-carousel-compact-height: 40px;
320
320
  box-sizing: border-box;
321
- filter: var(--carousel-focus-blur, none);
322
321
 
323
322
  border-radius: var(--carousel-panel-radius, 14px);
324
323
  padding: 0;
@@ -92,7 +92,7 @@
92
92
  height: 100%;
93
93
  padding: 0;
94
94
  border: 1px solid var(--ps-border, transparent);
95
- border-radius: var(--spatial-element-control-radius, 12px);
95
+ --scroll-button-radius: var(--spatial-element-control-radius, 12px);
96
96
  background: var(--ps-section-standard, #fff);
97
97
  color: var(--spatial-element-navigation-ink, var(--spatial-element-ink));
98
98
  box-shadow: 0 2px 8px #0003;
@@ -101,9 +101,11 @@
101
101
  }
102
102
  .before {
103
103
  left: 0;
104
+ border-radius: 0 var(--scroll-button-radius) var(--scroll-button-radius) 0;
104
105
  }
105
106
  .after {
106
107
  right: 0;
108
+ border-radius: var(--scroll-button-radius) 0 0 var(--scroll-button-radius);
107
109
  }
108
110
  .vertical button {
109
111
  left: 0;
@@ -113,10 +115,12 @@
113
115
  }
114
116
  .vertical .before {
115
117
  top: 0;
118
+ border-radius: 0 0 var(--scroll-button-radius) var(--scroll-button-radius);
116
119
  }
117
120
  .vertical .after {
118
121
  top: auto;
119
122
  bottom: 0;
123
+ border-radius: var(--scroll-button-radius) var(--scroll-button-radius) 0 0;
120
124
  }
121
125
  button:focus-visible {
122
126
  outline: 2px solid var(--spatial-element-accent);
@@ -0,0 +1,168 @@
1
+ <script lang="ts">
2
+ import { getContext, onMount } from 'svelte';
3
+ import { STAGE_CONTEXT_KEY, type StageContext } from '@spatial-elements/core/stage/panelContext';
4
+ import SpatialIconButton from './SpatialIconButton.svelte';
5
+ import SpaceMouseIcon from './SpaceMouseIcon.svelte';
6
+ import { useSpatialMessages } from './messagesContext.js';
7
+
8
+ let { focusAnchor, enabled = true }: { focusAnchor?: HTMLElement; enabled?: boolean } = $props();
9
+ const stage = getContext<StageContext>(STAGE_CONTEXT_KEY);
10
+ const readMessages = useSpatialMessages();
11
+ const copy = $derived(readMessages().interactionHelp);
12
+ const connectionState = $derived(stage.getSpaceMouseState?.() ?? 'idle');
13
+ const connected = $derived(connectionState === 'connected');
14
+ const connecting = $derived(connectionState === 'connecting');
15
+ const label = $derived(
16
+ connected
17
+ ? copy.spaceMouseConnected
18
+ : connecting
19
+ ? copy.spaceMouseConnecting
20
+ : copy.spaceMouseTitle
21
+ );
22
+ const id = $props.id();
23
+ let dialog: HTMLDialogElement;
24
+ let toast: HTMLDivElement;
25
+ let failure = $state<'permission-required' | 'unavailable'>('unavailable');
26
+ let requested = $state(false);
27
+ let toastMessage = $state('');
28
+ let toastTimer: ReturnType<typeof setTimeout> | undefined;
29
+ function showToast(message: string) {
30
+ toastMessage = message;
31
+ toast.showPopover();
32
+ clearTimeout(toastTimer);
33
+ toastTimer = setTimeout(() => toast.hidePopover(), 3500);
34
+ }
35
+
36
+ function connect() {
37
+ dialog.close();
38
+ toast.hidePopover();
39
+ clearTimeout(toastTimer);
40
+ requested = true;
41
+ stage.setSpaceMouseEnabled?.(true);
42
+ }
43
+ function toggle() {
44
+ if (connected || connecting) {
45
+ const cancelled = connecting;
46
+ requested = false;
47
+ toast.hidePopover();
48
+ stage.setSpaceMouseEnabled?.(false);
49
+ if (cancelled) showToast(copy.spaceMouseCancelled);
50
+ } else connect();
51
+ }
52
+ $effect(() => {
53
+ if (!requested) return;
54
+ if (connectionState === 'connected') {
55
+ requested = false;
56
+ showToast(copy.spaceMouseReady);
57
+ } else if (connectionState === 'permission-required' || connectionState === 'unavailable') {
58
+ requested = false;
59
+ failure = connectionState;
60
+ dialog.showModal();
61
+ }
62
+ });
63
+ $effect(() => {
64
+ if (!enabled) {
65
+ requested = false;
66
+ dialog?.close();
67
+ toast?.hidePopover();
68
+ }
69
+ });
70
+ onMount(() => () => {
71
+ clearTimeout(toastTimer);
72
+ dialog.close();
73
+ toast.hidePopover();
74
+ });
75
+ </script>
76
+
77
+ <SpatialIconButton
78
+ {label}
79
+ {focusAnchor}
80
+ {enabled}
81
+ pressed={connected}
82
+ busy={connecting}
83
+ onclick={toggle}
84
+ >
85
+ <SpaceMouseIcon />
86
+ </SpatialIconButton>
87
+ <dialog bind:this={dialog} aria-labelledby={`${id}-title`} aria-describedby={`${id}-description`}>
88
+ <h2 id={`${id}-title`}>
89
+ {failure === 'permission-required'
90
+ ? copy.spaceMousePermissionTitle
91
+ : copy.spaceMouseUnavailableTitle}
92
+ </h2>
93
+ <p id={`${id}-description`}>
94
+ {failure === 'permission-required' ? copy.spaceMousePermission : copy.spaceMouseUnavailable}
95
+ </p>
96
+ {#if failure === 'permission-required'}
97
+ <p>{copy.spaceMouseDenied}</p>
98
+ {:else}
99
+ <p>
100
+ <a href="https://3dconnexion.com/" target="_blank" rel="noopener noreferrer"
101
+ >{copy.spaceMouseDiscover}</a
102
+ >
103
+ </p>
104
+ {/if}
105
+ <div class="actions">
106
+ <button type="button" onclick={() => dialog.close()}>{copy.spaceMouseClose}</button>
107
+ {#if failure === 'permission-required'}<button type="button" onclick={connect}
108
+ >{copy.spaceMouseConfirm}</button
109
+ >{/if}
110
+ </div>
111
+ </dialog>
112
+ <div bind:this={toast} popover="manual" role="status" class="connection-toast">
113
+ {toastMessage}
114
+ </div>
115
+
116
+ <style>
117
+ dialog,
118
+ .connection-toast {
119
+ box-sizing: border-box;
120
+ padding: 24px;
121
+ border: 1px solid color-mix(in srgb, var(--spatial-element-ink) 15%, transparent);
122
+ border-radius: var(--spatial-element-panel-radius, 12px);
123
+ color: var(--spatial-element-ink);
124
+ background: var(--ps-section-standard, var(--ps-background, #fff));
125
+ font: inherit;
126
+ box-shadow: 0 8px 32px #0003;
127
+ max-width: min(440px, calc(100vw - 32px));
128
+ }
129
+ dialog::backdrop {
130
+ background: #0006;
131
+ }
132
+ h2 {
133
+ margin: 0 0 12px;
134
+ font-size: 20px;
135
+ }
136
+ p {
137
+ line-height: 1.5;
138
+ }
139
+ a {
140
+ color: var(--spatial-element-accent);
141
+ }
142
+ .actions {
143
+ display: flex;
144
+ justify-content: flex-end;
145
+ gap: 12px;
146
+ }
147
+ button {
148
+ padding: 10px 16px;
149
+ border: 1px solid currentColor;
150
+ border-radius: var(--spatial-element-control-radius);
151
+ background: transparent;
152
+ color: var(--spatial-element-accent);
153
+ font: inherit;
154
+ cursor: pointer;
155
+ }
156
+ button:focus-visible,
157
+ a:focus-visible {
158
+ outline: 2px solid var(--spatial-element-accent);
159
+ outline-offset: 3px;
160
+ }
161
+ .connection-toast {
162
+ position: fixed;
163
+ inset: auto 16px 24px auto;
164
+ margin: 0;
165
+ padding: 12px 20px;
166
+ pointer-events: none;
167
+ }
168
+ </style>
@@ -0,0 +1,7 @@
1
+ type $$ComponentProps = {
2
+ focusAnchor?: HTMLElement;
3
+ enabled?: boolean;
4
+ };
5
+ declare const SpaceMouseControl: import("svelte").Component<$$ComponentProps, {}, "">;
6
+ type SpaceMouseControl = ReturnType<typeof SpaceMouseControl>;
7
+ export default SpaceMouseControl;
@@ -0,0 +1,12 @@
1
+ <svg
2
+ xmlns="http://www.w3.org/2000/svg"
3
+ width="24"
4
+ height="24"
5
+ viewBox="0 0 583.92242 514.26245"
6
+ fill="currentColor"
7
+ aria-hidden="true"
8
+ >
9
+ <g transform="translate(-296.70282,-553.67371)">
10
+ <path d="m 554.50876,1067.6884 c -93.63185,-2.4763 -146.89661,-15.1443 -196.80245,-38.3441 -7.90309,-3.6739 -27.52684,-14.2376 -35.3451,-20.7389 -4.95526,-4.1206 -14.71558,-18.74412 -17.55026,-24.37032 -5.92473,-11.7593 -9.3009,-29.15544 -7.71932,-46.08693 2.36538,-25.32251 6.44223,-53.71222 18.92407,-78.71134 9.73392,-19.49545 20.41716,-34.58715 34.37139,-49.07913 10.5443,-10.95065 10.69779,-8.84994 21.69314,-30.19782 12.47546,-24.22156 15.81707,-30.34236 21.53714,-46.8922 7.3483,-21.26079 8.32574,-24.71626 8.27719,-46.66914 -0.037,-16.72496 -0.49572,-22.4716 -3.22349,-40.38116 -3.62645,-23.80995 -2.97533,-29.43781 -0.88867,-36.46437 6.5133,-21.93265 43.21203,-41.8034 96.59305,-49.75993 63.22017,-9.42308 150.55274,-8.19971 204.88476,2.94671 20.34811,4.17449 37.59715,12.05695 51.3195,18.78692 8.69396,4.26386 12.60226,9.57588 18.88783,15.85633 12.25097,12.24102 15.62703,20.71188 10.36093,49.50345 -4.28226,23.412 -5.50427,34.51885 -4.84541,50.95065 1.06092,26.45901 9.3427,42.53016 26.7819,79.11957 5.80302,12.1754 9.0665,20.24676 12.40184,25.44166 1.95606,3.04663 3.54243,5.62169 7.19828,10.81369 28.09231,34.17855 56.62782,78.7844 58.98322,124.68648 1.3425,26.16237 -1.80727,47.24235 -18.09957,62.78268 -7.6188,7.267 -34.86364,27.4573 -46.99304,32.9935 -29.7177,13.5642 -74.87319,24.4254 -117.64816,28.9585 -35.67214,3.7804 -105.54271,5.8484 -143.09877,4.8552 z m 90.69755,-38.0949 c 70.82211,-4.1061 118.77643,-13.1562 155.09299,-29.2696 21.33,-9.46391 37.8697,-22.38891 43.9127,-34.31581 2.9678,-5.8573 2.9942,-6.0556 2.983,-22.40957 -0.01,-13.58453 -0.4224,-18.3459 -2.3384,-26.94685 -2.3199,-10.41466 -9.2648,-27.56768 -10.9016,-29.20445 -0.4826,-0.48264 -4.29247,5.29345 -10.13987,9.17095 -29.9304,19.84723 -83.01812,34.12709 -152.10882,41.51302 -32.49802,3.47411 -112.52172,5.58253 -151.04609,3.31354 -75.70697,-4.45897 -138.88983,-23.56148 -169.55491,-47.55525 -3.90755,-3.05745 -7.64708,-6.58224 -7.84719,-6.38213 -0.8514,0.85141 -6.39699,13.16119 -8.32201,19.59117 -4.91445,16.41534 -7.25836,38.47752 -5.25225,49.43697 1.64962,9.012 4.79609,14.5195 12.69442,22.2201 28.73775,28.01821 93.93343,45.97661 184.32803,50.77381 21.65526,1.1493 99.06135,1.1911 118.5,0.064 z m 13.50323,-118.93733 c 66.25435,-5.40349 110.85716,-15.87706 144.99676,-34.04792 7.822,-4.16328 18.4492,-14.39664 17.5053,-16.85657 -1.2386,-3.22803 -9.7907,-15.02599 -13.5602,-18.70678 l -3.8275,-3.73745 -5.2156,4.68931 c -17.8432,16.04255 -61.14455,29.20966 -116.90199,35.54766 -32.68241,3.71503 -40.74089,5.52674 -84.27469,6.10276 -85.11311,1.12619 -133.3187,-5.59297 -178.0884,-21.0407 -18.21254,-6.28421 -30.36824,-12.93498 -39.84774,-21.80194 l -5.0238,-4.69918 -3.47374,3.99658 c -3.98669,4.58674 -14.29163,18.97702 -14.29163,19.95748 0,2.11283 7.6121,9.47996 14.5,14.03338 10.85483,7.17586 20.15195,11.68977 33.64754,16.33644 37.58018,12.93924 85.59881,20.47138 143.85246,22.5645 24.84493,0.8927 86.44606,-0.41632 110.00323,-2.33757 z m -15.00323,-61.14426 c 38.44955,-3.47429 59.23004,-4.62776 83.05247,-10.45744 35.05906,-8.57943 56.94752,-15.0978 56.94752,-26.37364 0,-3.77132 -1.4615,-6.77743 -8.7331,-17.96221 -29.81029,-45.85289 -38.52647,-80.88959 -32.11078,-129.07679 0.66049,-4.96081 0.95768,0.73715 0.66043,0.43989 -0.29726,-0.29725 -4.09008,0.82734 -8.4285,2.49908 -30.96294,11.93111 -72.03027,17.90377 -134.88804,19.61756 -32.99059,0.89947 -80.16875,-1.59543 -107,-5.65844 -21.28658,-3.22339 -40.67307,-8.24791 -52.34294,-13.56604 -4.10531,-1.87085 -7.64259,-3.22316 -7.86061,-3.00514 -0.21803,0.21803 0.11941,-2.85998 0.74985,5.3822 1.92899,25.2187 -1.1048,48.62117 -9.56029,73.74758 -5.53968,16.46177 -12.6948,32.69141 -21.16164,48 -5.42984,9.81751 -6.71998,12.47816 -7.09359,17.10042 -0.44456,5.50002 3.63006,6.09288 8.41974,9.99466 8.4948,6.92005 22.92895,12.35681 41.95683,17.60119 29.25057,8.06192 52.38104,11.51515 89.89265,13.90721 23.06044,1.47052 89.15096,-0.53208 107.5,-2.19009 z m -194.5,-39.70054 c -3.64277,-0.74189 -7.5,-5.30401 -7.5,-8.87058 0,-1.80596 2.01373,-9.48427 4.47496,-17.06291 6.73739,-20.74588 11.52504,-47.64223 11.52504,-64.7461 0,-13.77713 2.57089,-18.53326 10.01799,-18.53326 8.64078,0 15.37711,4.25797 15.37711,17.94526 0,13.66799 -1.26717,33.00559 -3.5596,44.43435 -3.50968,17.4972 -12.0748,41.64092 -16.12242,44.96179 -2.07803,1.70492 -11.71298,2.38062 -14.21308,1.87145 z m 266.70408,-1.78246 c -4.8138,-3.37172 -12.4686,-23.53165 -16.73901,-44.08443 -2.13811,-10.29035 -2.77647,-16.64339 -3.20876,-31.93401 -0.60771,-21.49525 -0.14435,-25.61482 3.26451,-29.02368 3.65917,-3.65917 12.94024,-3.92811 16.26115,0.0186 2.24429,2.66718 3.9192,4.10941 4.45644,14.75 1.49052,29.52084 4.50334,48.8841 12.24616,69.5536 4.56098,12.17555 2.94134,16.74601 -1.50845,20.24622 -3.15846,2.48444 -11.55363,2.72798 -14.77204,0.47372 z M 640.20631,652.02656 c 38.14469,-3.0218 61.92896,-7.58298 84.6279,-16.22932 8.91632,-3.39635 19.20802,-9.41252 21.36167,-12.4873 5.33323,-7.61424 -4.11685,-15.5743 -27.98957,-23.57639 -30.48608,-10.21887 -71.881,-15.08883 -128.51707,-15.11956 -31.99271,-0.0174 -52.93487,1.08506 -76.48293,4.02614 -50.09323,6.25648 -87.0664,20.64883 -82.59726,32.15219 2.1636,5.56899 12.24618,11.77731 27.99203,17.236 40.35152,13.98886 112.00482,19.51194 181.60523,13.99824 z" />
11
+ </g>
12
+ </svg>
@@ -0,0 +1,26 @@
1
+ export default SpaceMouseIcon;
2
+ type SpaceMouseIcon = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const SpaceMouseIcon: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }
@@ -587,10 +587,12 @@
587
587
  /* Clip projected DOM hit regions to the same surface as the GPU models. */
588
588
  :global(.carousel-drag-section) {
589
589
  position: relative;
590
- clip-path: inset(0);
590
+ /* clip-path creates a Backdrop Root and prevents frosted panels from
591
+ sampling the stage canvas. Overflow clipping preserves that backdrop. */
592
+ overflow: clip;
591
593
  }
592
594
  :global(.carousel-drag-section[data-section-background-size='full']) {
593
- clip-path: inset(0 calc(50% - 50vw));
595
+ overflow-x: visible;
594
596
  }
595
597
  :global(.carousel-drag-section:has(.interactive)) {
596
598
  touch-action: pan-y pinch-zoom;
@@ -1,11 +1,35 @@
1
1
  <script lang="ts">
2
2
  import { resolve } from '$app/paths';
3
3
  import { Breadcrumbs } from '@page-sections/svelte';
4
+ import { getContext, onMount } from 'svelte';
5
+ import { STAGE_CONTEXT_KEY, type StageContext } from '@spatial-elements/core/stage/panelContext';
6
+ import { getPanelFocusProgress } from '@spatial-elements/core/stage/panelFocusMath';
4
7
  import type { SpatialElementBreadcrumb } from '@spatial-elements/core/spatial-element/types';
5
- let { items, transition = 'enter' }: { items: SpatialElementBreadcrumb[]; transition?: 'enter' | 'exit' } = $props();
8
+ let { items, transition = 'enter', focusReactive = true }: { items: SpatialElementBreadcrumb[]; transition?: 'enter' | 'exit'; focusReactive?: boolean } = $props();
9
+ const stage = getContext<StageContext | undefined>(STAGE_CONTEXT_KEY);
10
+ const focus = $derived(focusReactive ? getPanelFocusProgress(stage?.getZoomUiFocus?.() ?? 0) : 0);
11
+ let element: HTMLDivElement;
12
+ let menu = $state<HTMLElement>();
13
+ let menuSize = $state({ width: 0, height: 0 });
14
+ onMount(() => {
15
+ menu = element.closest('.stage')?.querySelector<HTMLElement>('[data-spatial-shell-menu]') ?? undefined;
16
+ if (!menu) return;
17
+ const measure = () => { menuSize = { width: menu!.offsetWidth, height: menu!.offsetHeight }; };
18
+ measure();
19
+ const observer = new ResizeObserver(measure); observer.observe(menu);
20
+ return () => observer.disconnect();
21
+ });
22
+ const travel = $derived.by(() => {
23
+ if (!focus) return '0px 0px';
24
+ if (!menu) return `0px ${-112 * focus}px`;
25
+ // The native shell receives the exact GPU projection in the same frame.
26
+ // Follow its lower-left corner, including perspective expansion.
27
+ const matrix = new DOMMatrixReadOnly(menu.style.transform || undefined);
28
+ return `${matrix.m41 - menuSize.width * (matrix.a - 1) / 2}px ${matrix.m42 + menuSize.height * (matrix.d - 1) / 2}px`;
29
+ });
6
30
  const resolved = $derived(items.map(item => ({ ...item, href: item.href ? resolve(...([item.href] as unknown as Parameters<typeof resolve>)) : undefined })));
7
31
  </script>
8
- <div class="breadcrumbs spatial-content-width" data-stage-dom-content data-catalog-transition-dom={transition}>
32
+ <div bind:this={element} class="breadcrumbs spatial-content-width" style:translate={travel} data-stage-dom-content data-catalog-transition-dom={transition}>
9
33
  <Breadcrumbs items={resolved} />
10
34
  </div>
11
35
  <style>
@@ -2,6 +2,7 @@ import type { SpatialElementBreadcrumb } from '@spatial-elements/core/spatial-el
2
2
  type $$ComponentProps = {
3
3
  items: SpatialElementBreadcrumb[];
4
4
  transition?: 'enter' | 'exit';
5
+ focusReactive?: boolean;
5
6
  };
6
7
  declare const SpatialElementBreadcrumbs: import("svelte").Component<$$ComponentProps, {}, "">;
7
8
  type SpatialElementBreadcrumbs = ReturnType<typeof SpatialElementBreadcrumbs>;
@@ -11,6 +11,7 @@
11
11
  import SpatialElementViewToggle from './SpatialElementViewToggle.svelte';
12
12
  import Panel from '../stage/Panel.svelte';
13
13
  import SpatialIconButton from './SpatialIconButton.svelte';
14
+ import SpaceMouseControl from './SpaceMouseControl.svelte';
14
15
  import { useSpatialTheme } from './brandContext.js';
15
16
  import { useSpatialMessages } from './messagesContext.js';
16
17
 
@@ -19,6 +20,7 @@
19
20
  const radii = $derived(resolveSpatialThemeRadii(theme));
20
21
  const stageContext = getContext<StageContext>(STAGE_CONTEXT_KEY);
21
22
  const fullscreen = $derived(stageContext.isFullscreen?.() ?? false);
23
+ const spaceMouseDesktop = $derived(stageContext.isSpaceMouseDesktop?.() ?? false);
22
24
  const readMessages = useSpatialMessages();
23
25
  const messages = $derived(readMessages());
24
26
  const help = $derived(messages.interactionHelp);
@@ -60,7 +62,7 @@
60
62
  open = false;
61
63
  manual = false;
62
64
  helpHovered = false;
63
- if (restoreFocus) button.focus({ preventScroll: true });
65
+ if (restoreFocus) button?.focus({ preventScroll: true });
64
66
  }
65
67
  function position() {
66
68
  if (!open) return;
@@ -94,7 +96,12 @@
94
96
  await tick();
95
97
  if (!open || !enhanced) return;
96
98
  requestPosition();
97
- if (keyboard) closeButton.focus({ preventScroll: true });
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
+ }
98
105
  }
99
106
  function toggleHelp(event: MouseEvent) {
100
107
  if (open) close();
@@ -206,11 +213,14 @@
206
213
  });
207
214
  </script>
208
215
 
209
- <div bind:this={root} class="model-tools" class:enhanced style={surfaceStyle} style:visibility={active ? undefined : 'hidden'} inert={!active} data-spatial-element-tools data-spatial-model-controls>
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>
210
217
  <div class="model-tools-buttons">
211
218
  <SpatialIconButton bind:element={button} {focusAnchor} label={messages.controls.help} onclick={toggleHelp} expanded={open} controls={id} enabled={enhanced && active}>
212
219
  <CircleHelp size={21} strokeWidth={1.8} aria-hidden="true" />
213
220
  </SpatialIconButton>
221
+ {#if spaceMouseDesktop}
222
+ <SpaceMouseControl {focusAnchor} enabled={enhanced && active} />
223
+ {/if}
214
224
  <SpatialElementViewToggle enabled={enhanced && active} {focusAnchor} onchange={() => close()} />
215
225
  </div>
216
226
  {#if active && enhanced && touchInput && !interacted && !open && !fullscreen}
@@ -238,13 +248,10 @@
238
248
  <div><InteractionGesture action="zoom" touch={touchInput} /><dt>{help.zoom}</dt><dd>{touchInput ? help.touchZoom : help.mouseZoom}</dd></div>
239
249
  <div><InteractionGesture action="pan" touch={touchInput} /><dt>{help.pan}</dt><dd>{touchInput ? help.touchPan : help.mousePan}</dd></div>
240
250
  </dl>
241
- <p class="navigation-hint">
242
- {#if touchInput}
243
- {#if !fullscreen}{help.touchScrollHint}{/if}
244
- {:else}
245
- {#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}
246
- {/if}
247
- </p>
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}
248
255
  </div>
249
256
  </Panel>
250
257
  </div>
@@ -257,6 +264,7 @@
257
264
  width: 128px; height: 40px; z-index: 6; visibility: hidden; pointer-events: none;
258
265
  }
259
266
  .model-tools.enhanced { visibility: visible; pointer-events: auto; }
267
+ .model-tools.with-spacemouse { width: 176px; }
260
268
  .model-tools-buttons { display: flex; gap: 8px; justify-content: flex-end; }
261
269
  .touch-hint {
262
270
  position: absolute; right: 0; top: 48px; width: max-content; max-width: min(260px, calc(100vw - 48px));
@@ -63,13 +63,15 @@
63
63
  });
64
64
  onMount(() => {
65
65
  const element = rail!;
66
- const minimapFrame = element.querySelector<HTMLElement>('[data-spatial-element-dock-minimap-anchor] .stage-panel-fallback');
67
- const updateDock = () => { minimapDocked = Number(minimapFrame?.dataset.stageMinimapDockProgress ?? 0) > 0; };
66
+ const root = element.closest('[data-spatial-element-root]');
67
+ const updateDock = () => { minimapDocked = root?.hasAttribute('data-spatial-element-dock-active') ?? false; };
68
68
  window.addEventListener(STAGE_PANEL_VISUAL_EVENT, updateDock);
69
+ window.addEventListener(STAGE_PANEL_LAYOUT_EVENT, updateDock);
69
70
  updateDock();
70
71
  element.addEventListener('scroll', refreshProjection, { passive: true });
71
72
  return () => {
72
73
  window.removeEventListener(STAGE_PANEL_VISUAL_EVENT, updateDock);
74
+ window.removeEventListener(STAGE_PANEL_LAYOUT_EVENT, updateDock);
73
75
  element.removeEventListener('scroll', refreshProjection);
74
76
  cancelAnimationFrame(refreshFrame);
75
77
  };
@@ -88,6 +90,7 @@
88
90
  <aside
89
91
  bind:this={rail}
90
92
  class="spatial-element-rail"
93
+ class:focused
91
94
  data-spatial-element-media-rail
92
95
  aria-label="Product media"
93
96
  >
@@ -220,6 +223,11 @@
220
223
  .spatial-element-rail::-webkit-scrollbar {
221
224
  display: none;
222
225
  }
226
+ @media (width < 840px) {
227
+ /* Let the row travel down with the summary; keep off-rail thumbnails
228
+ * clipped horizontally while removing the stationary vertical cut-off. */
229
+ .spatial-element-rail.focused { overflow: visible; clip-path: inset(-100vh 0 -100vh 0); }
230
+ }
223
231
 
224
232
  .spatial-element-media-anchor {
225
233
  width: 100%;
@@ -260,7 +268,7 @@
260
268
  position: absolute;
261
269
  inset: 0;
262
270
  border-radius: inherit;
263
- box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--spatial-element-accent) 96%, transparent);
271
+ box-shadow: inset 0 0 0 3px var(--spatial-element-accent);
264
272
  pointer-events: none;
265
273
  }
266
274
  :global(.stage-enhanced[data-stage-page-ready]) .thumb-minimap.active::after {
@@ -268,8 +276,9 @@
268
276
  }
269
277
  .media-indicator {
270
278
  position: absolute;
271
- bottom: 4px;
272
- right: 4px;
279
+ /* Inset along the rounded corner's diagonal; retain a 4px safety margin. */
280
+ bottom: calc(4px + var(--spatial-element-control-radius) * 0.293);
281
+ right: calc(4px + var(--spatial-element-control-radius) * 0.293);
273
282
  display: grid;
274
283
  color: color-mix(in srgb, var(--spatial-element-ink) 45%, transparent);
275
284
  opacity: var(--stage-panel-surface-opacity, 1);
@@ -2,6 +2,8 @@
2
2
  import { getContext, onMount, setContext } from 'svelte';
3
3
  import ShoppingCart from 'lucide-svelte/icons/shopping-cart';
4
4
  import { SpatialElementPaneController } from '@spatial-elements/core/spatial-element/SpatialElementPaneController';
5
+ import { SpatialElementHeaderFields } from '@spatial-elements/core/spatial-element/SpatialElementHeaderFields';
6
+ import './headerFields.css';
5
7
  import { resolveActiveDetailSection } from '@spatial-elements/core/spatial-element/activeDetailSection';
6
8
  import { resolveDetailLayout } from '@spatial-elements/core/spatial-element/responsiveLayout';
7
9
  import {
@@ -42,10 +44,14 @@
42
44
  interface Props {
43
45
  /** Complete element document from this page's load function. Registers assets with the enclosing shell. */
44
46
  spatialElement: SpatialElementData;
47
+ /** Optional compact controls beside the action in both scroll and 3XL pane headers. */
48
+ headerDetails?: Snippet;
49
+ /** Shared header action icon. Use the same snippet as the summary actionIcon. */
50
+ actionIcon?: Snippet;
45
51
  /** Detail sections; Section components automatically populate the tab navigation. */
46
52
  children?: Snippet;
47
53
  }
48
- let { spatialElement: element, children }: Props = $props();
54
+ let { spatialElement: element, children, headerDetails, actionIcon }: Props = $props();
49
55
  const readTheme = useSpatialTheme();
50
56
  const brand = $derived(readTheme());
51
57
  const spatialElement = $derived.by(() => {
@@ -136,6 +142,8 @@
136
142
  }
137
143
 
138
144
  onMount(() => {
145
+ const headerFields = new SpatialElementHeaderFields(mainElement);
146
+ headerFields.start();
139
147
  const orderSections = () => sectionRegistry.order([...mainElement.querySelectorAll<HTMLElement>('[data-ps-section]')].map(node => node.id));
140
148
  const sectionOrder = new MutationObserver(orderSections);
141
149
  sectionOrder.observe(mainElement, { childList: true, subtree: true });
@@ -170,6 +178,7 @@
170
178
  scheduleScrollSpy();
171
179
 
172
180
  return () => {
181
+ headerFields.destroy();
173
182
  sectionOrder.disconnect();
174
183
  unregisterMedia?.();
175
184
  paneController?.destroy();
@@ -199,20 +208,23 @@
199
208
  style:--spatial-pane-tint-opacity={`${Math.min(1, Math.max(0, brand.panelTheme.tintOpacity ?? 0.28)) * 100}%`}
200
209
  style:--spatial-pane-blur={`${Math.min(100, Math.max(0, brand.panelTheme.backdropBlur ?? 5))}px`}
201
210
  >
202
- <div class="spatial-element-pane-heading" data-spatial-detail-pane-header data-spatial-detail-fixed>
203
- <SpatialElementBreadcrumbs items={spatialElement.breadcrumbs} />
211
+ <div class="spatial-element-pane-heading" data-spatial-detail-pane-header data-spatial-detail-fixed data-spatial-element-handoff-header>
212
+ <SpatialElementBreadcrumbs items={spatialElement.breadcrumbs} focusReactive={!splitPane} />
204
213
  <div class="spatial-element-pane-title-row">
214
+ <div class="spatial-element-pane-copy">
205
215
  <p class="spatial-element-pane-title">{spatialElement.title}</p>
206
216
  {#if spatialElement.eyebrow}<p class="spatial-element-pane-eyebrow">{spatialElement.eyebrow}</p>{/if}
217
+ </div>
218
+ {#if headerDetails}<div class="spatial-element-pane-order">{@render headerDetails()}</div>{/if}
207
219
  {#if spatialElement.action}
208
- <button type="button" class="spatial-element-pane-action" onclick={invokePaneAction}
220
+ <button type="button" class="spatial-element-pane-action" data-spatial-element-dock-action onclick={invokePaneAction}
209
221
  aria-label={spatialElement.action.ariaLabel ?? spatialElement.action.label}>
210
- <ShoppingCart size={24} aria-hidden="true" />
222
+ {#if actionIcon}{@render actionIcon()}{:else}<ShoppingCart size={24} aria-hidden="true" />{/if}
211
223
  </button>
212
224
  {/if}
213
225
  </div>
214
226
  </div>
215
- <SpatialElementStickyHeader {activeSectionId} {spatialElement} sections={navigationSections} />
227
+ <SpatialElementStickyHeader {headerDetails} {actionIcon} {activeSectionId} {spatialElement} sections={navigationSections} />
216
228
  <div class="spatial-element-pane-surface" data-spatial-detail-pane-surface data-spatial-detail-fixed aria-hidden="true"></div>
217
229
  <div class="spatial-element-pane-cover spatial-element-pane-cover-top" data-spatial-detail-fixed aria-hidden="true"></div>
218
230
  <div class="spatial-element-pane-cover spatial-element-pane-cover-bottom" data-spatial-detail-fixed aria-hidden="true"></div>
@@ -314,6 +326,7 @@
314
326
  background: transparent;
315
327
  pointer-events: none;
316
328
  }
329
+ @media (width < 840px) { .spatial-element-content { padding-top: 12px; } }
317
330
  @media (min-width: 840px) {
318
331
  .spatial-element-hero { height: var(--spatial-detail-fit-height); }
319
332
  .spatial-element-content { padding-top: 8px; }
@@ -1,9 +1,14 @@
1
+ import './headerFields.css';
1
2
  import type { Snippet } from 'svelte';
2
3
  import './layout.generated.css';
3
4
  import type { SpatialElementData } from '@spatial-elements/core/spatial-element/types';
4
5
  interface Props {
5
6
  /** Complete element document from this page's load function. Registers assets with the enclosing shell. */
6
7
  spatialElement: SpatialElementData;
8
+ /** Optional compact controls beside the action in both scroll and 3XL pane headers. */
9
+ headerDetails?: Snippet;
10
+ /** Shared header action icon. Use the same snippet as the summary actionIcon. */
11
+ actionIcon?: Snippet;
7
12
  /** Detail sections; Section components automatically populate the tab navigation. */
8
13
  children?: Snippet;
9
14
  }