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

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,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { MenuItem } from '@page-sections/core';
3
3
  import type { Snippet } from 'svelte';
4
+ import { preventBrowserPinch } from '@spatial-elements/core/stage/browserPinch';
4
5
  import '@page-sections/svelte/styles.css';
5
6
  import { retainDeviceOrientationPermission } from '@spatial-elements/core/catalog/listDeviceOrientation';
6
7
  import Stage from '../stage/Stage.svelte';
@@ -54,9 +55,10 @@
54
55
  provideSpatialMessages(() => messages);
55
56
 
56
57
  const brandStyle = $derived(getSpatialThemeStyle(theme));
58
+ function attachPinchPolicy(node: HTMLElement) { return { destroy: preventBrowserPinch(node) }; }
57
59
  </script>
58
60
 
59
- <div class="brand-stage-shell" style={brandStyle} style:color-scheme={colorScheme} data-color-scheme={colorScheme}>
61
+ <div use:attachPinchPolicy class="brand-stage-shell" style={brandStyle} style:color-scheme={colorScheme} data-color-scheme={colorScheme}>
60
62
  <Stage
61
63
  {deviceOrientation}
62
64
  brandId={theme.id}
@@ -29,7 +29,7 @@
29
29
  });
30
30
  const resolved = $derived(items.map(item => ({ ...item, href: item.href ? resolve(...([item.href] as unknown as Parameters<typeof resolve>)) : undefined })));
31
31
  </script>
32
- <div bind:this={element} class="breadcrumbs spatial-content-width" style:translate={travel} data-stage-dom-content data-catalog-transition-dom={transition}>
32
+ <div bind:this={element} class="breadcrumbs spatial-content-width" style:translate={travel} style:filter={focus > 0 ? `blur(${focus * 4}px)` : 'none'} data-stage-dom-content data-catalog-transition-dom={transition}>
33
33
  <Breadcrumbs items={resolved} />
34
34
  </div>
35
35
  <style>
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { getContext, onMount } from 'svelte';
3
3
  import { mouseHover } from '@spatial-elements/core/stage/mouseHover';
4
+ import { getPanelFocusOpacity } from '@spatial-elements/core/stage/panelFocusMath';
4
5
  import { STAGE_CONTEXT_KEY, type StageContext } from '@spatial-elements/core/stage/panelContext';
5
6
  import Play from 'lucide-svelte/icons/play';
6
7
  import OverflowControls from './OverflowControls.svelte';
@@ -92,6 +93,7 @@
92
93
  class="spatial-element-rail"
93
94
  class:focused
94
95
  data-spatial-element-media-rail
96
+ inert={getPanelFocusOpacity(stage.getZoomUiFocus?.() ?? 0) < 0.12 || (stage.isFullscreen?.() ?? false)}
95
97
  aria-label="Product media"
96
98
  >
97
99
  {#each spatialElement.media as media (media.id)}
@@ -35,6 +35,7 @@
35
35
  import { resolveSpatialElementData } from '@spatial-elements/core/spatial-element/spatialElement';
36
36
  import { registerSpatialPage } from './spatialPageContext.js';
37
37
  import { STAGE_CONTEXT_KEY, type StageContext } from '@spatial-elements/core/stage/panelContext';
38
+ import { getPanelFocusProgress } from '@spatial-elements/core/stage/panelFocusMath';
38
39
 
39
40
  const SPATIAL_ELEMENT_OVERVIEW_SECTION = {
40
41
  id: 'overview',
@@ -75,6 +76,7 @@
75
76
  let mainElement: HTMLElement;
76
77
  let tabList = $state<HTMLElement>();
77
78
  let splitPane = $state(false);
79
+ const contentFocus = $derived(splitPane ? 0 : getPanelFocusProgress(stageContext?.getZoomUiFocus?.() ?? 0));
78
80
  let paneController = $state.raw<SpatialElementPaneController>();
79
81
  const paneTint = $derived(typeof brand.panelTheme.tint === 'number'
80
82
  ? `#${brand.panelTheme.tint.toString(16).padStart(6, '0')}`
@@ -204,9 +206,12 @@
204
206
  data-spatial-element-id={spatialElement.id}
205
207
  data-brand-id={spatialElement.brandId}
206
208
  data-spatial-selected-media={selectedMedia.kind}
209
+ data-spatial-content-zooming={contentFocus > 0 || undefined}
207
210
  style:--spatial-pane-tint={paneTint}
208
- style:--spatial-pane-tint-opacity={`${Math.min(1, Math.max(0, brand.panelTheme.tintOpacity ?? 0.28)) * 100}%`}
211
+ style:--spatial-pane-tint-opacity={`${Math.min(1, Math.max(0.8, brand.panelTheme.tintOpacity ?? 0.28)) * 100}%`}
209
212
  style:--spatial-pane-blur={`${Math.min(100, Math.max(0, brand.panelTheme.backdropBlur ?? 5))}px`}
213
+ style:--spatial-detail-content-fallback-travel={`${contentFocus * 60}svh`}
214
+ style:--spatial-detail-content-blur={contentFocus > 0 ? `blur(${contentFocus * 4}px)` : 'none'}
210
215
  >
211
216
  <div class="spatial-element-pane-heading" data-spatial-detail-pane-header data-spatial-detail-fixed data-spatial-element-handoff-header>
212
217
  <SpatialElementBreadcrumbs items={spatialElement.breadcrumbs} focusReactive={!splitPane} />
@@ -265,9 +270,11 @@
265
270
  <div class="spatial-element-pane-body" data-spatial-detail-pane-body data-stage-scroll-viewport>
266
271
  {#key spatialElement.id}<SpatialElementSummaryPanel {spatialElement} nativeContent={splitPane} />{/key}
267
272
  <div class="spatial-element-content">
273
+ <div class="spatial-element-section-viewport">
268
274
  <div class="spatial-element-section-list spatial-content-width spatial-content-container" data-catalog-transition-dom="enter">
269
275
  <SectionSurfaceGroup>{@render children?.()}</SectionSurfaceGroup>
270
276
  </div>
277
+ </div>
271
278
  <!-- Read after the section snippet has registered its metadata during SSR. -->
272
279
  <SpatialElementTabs bind:tabList {activeSectionId} sections={[SPATIAL_ELEMENT_OVERVIEW_SECTION, ...sections]} />
273
280
  </div>
@@ -306,6 +313,15 @@
306
313
  .spatial-element-section-list {
307
314
  order: 2;
308
315
  margin-top: var(--spatial-detail-submenu-after-gap, 0px);
316
+ translate: 0 var(--spatial-detail-content-travel, var(--spatial-detail-content-fallback-travel, 0px));
317
+ }
318
+ .spatial-element-section-viewport { order: 2; display: flow-root; }
319
+ /* Keep translated sections from extending the document's scroll range. */
320
+ [data-spatial-content-zooming] .spatial-element-section-viewport { overflow: clip; }
321
+ /* Filter only nearby sections, not the full document-sized layer. Offscreen
322
+ * sections retain content-visibility culling; text is crisp at rest. */
323
+ .spatial-element-section-list :global(.content-section[data-spatial-element-section-near-viewport]) {
324
+ filter: var(--spatial-detail-content-blur, none);
309
325
  }
310
326
 
311
327
  .spatial-element-content :global(.spatial-element-tabs-anchor) {
@@ -326,7 +342,7 @@
326
342
  background: transparent;
327
343
  pointer-events: none;
328
344
  }
329
- @media (width < 840px) { .spatial-element-content { padding-top: 12px; } }
345
+ @media (width < 840px) { .spatial-element-content { padding-top: 0; } }
330
346
  @media (min-width: 840px) {
331
347
  .spatial-element-hero { height: var(--spatial-detail-fit-height); }
332
348
  .spatial-element-content { padding-top: 8px; }
@@ -337,6 +353,8 @@
337
353
  }
338
354
  @media (min-width: 1600px) {
339
355
  .spatial-element-content { padding-top: 12px; }
340
- .spatial-element-content :global(.spatial-element-tabs-anchor) { margin-left: calc((100% - var(--spatial-detail-content-width)) / 2); max-width: var(--spatial-detail-content-width); }
356
+ }
357
+ @media (min-width: 1537px) {
358
+ .spatial-element-content :global(.spatial-element-tabs-anchor) { margin-left: max(12px, calc((100% - var(--spatial-detail-content-width)) / 2)); max-width: min(var(--spatial-detail-content-width), calc(100% - 24px)); }
341
359
  }
342
360
  </style>
@@ -13,6 +13,7 @@
13
13
  const contentInset = $derived(theme.panelShape.contentInset ?? Math.max(16, Math.round(theme.panelShape.radius * 0.7)));
14
14
  let presentation = $state<HTMLDivElement>(null!);
15
15
  let panelHeight = $state<number>();
16
+ let viewportWidth = $state<number>();
16
17
 
17
18
  onMount(() => {
18
19
  // The stage reparents the rendered content. Keep its layout placeholder in
@@ -33,6 +34,8 @@
33
34
  });
34
35
  </script>
35
36
 
37
+ <svelte:window bind:innerWidth={viewportWidth} />
38
+
36
39
  <div class="spatial-element-aside" data-spatial-summary-aside style:--summary-panel-height={panelHeight === undefined ? undefined : `${panelHeight}px`}>
37
40
  <Panel
38
41
  {nativeContent}
@@ -47,7 +50,7 @@
47
50
  focusReactive={!nativeContent}
48
51
  transitionGroup="shared"
49
52
  class="spatial-element-panel"
50
- shape={{ ...theme.panelShape, radius: radii.panel, contentInset }}
53
+ shape={{ ...theme.panelShape, radius: radii.panel, squareBottom: viewportWidth !== undefined && viewportWidth < 840, contentInset }}
51
54
  theme={theme.panelTheme}
52
55
  contentClass="stage-panel-content spatial-element-content"
53
56
  aria-labelledby="spatial-element-title"
@@ -90,4 +93,9 @@
90
93
  @media (min-width: 840px) {
91
94
  .spatial-element-aside { position: absolute; top: 0; right: var(--spatial-detail-summary-right); margin: 0; }
92
95
  }
96
+ @media (width < 840px) {
97
+ :global(.spatial-element-panel .stage-panel-surface), :global(.spatial-element-panel) {
98
+ border-bottom-left-radius: 0; border-bottom-right-radius: 0;
99
+ }
100
+ }
93
101
  </style>
@@ -4,6 +4,18 @@
4
4
 
5
5
  .spatial-content-container { container: ps-content / inline-size; min-width: 0; }
6
6
 
7
+ @media (min-width: 1537px) and (max-width: 1599px) {
8
+ .stage .content-section { width: min(var(--ps-section-width, 100%), 100%, 1536px); }
9
+ /* The shared registry exposes joined/outer edges through its shadow clips
10
+ * below XL too. Reuse those markers for the newly inset L surfaces. */
11
+ .stage .content-section[data-section-background-size='standard'] > .ps-section-surface {
12
+ border-top-left-radius: clamp(0px, calc(var(--ps-shadow-top-clip, 0px) * -100), var(--ps-radius));
13
+ border-top-right-radius: clamp(0px, calc(var(--ps-shadow-top-clip, 0px) * -100), var(--ps-radius));
14
+ border-bottom-left-radius: clamp(0px, calc(var(--ps-shadow-bottom-clip, 0px) * -100), var(--ps-radius));
15
+ border-bottom-right-radius: clamp(0px, calc(var(--ps-shadow-bottom-clip, 0px) * -100), var(--ps-radius));
16
+ }
17
+ }
18
+
7
19
  @media (min-width: 1600px) {
8
20
  .spatial-content-width { width: min(1536px, max(0px, calc(100% - 272px))); }
9
21
  }
@@ -263,6 +275,18 @@
263
275
  .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .spatial-element-pane-body .spatial-summary-query { max-height: none; overflow: visible; overscroll-behavior: auto; }
264
276
  .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .spatial-element-pane-body .spatial-element-panel .stage-panel-surface::before,
265
277
  .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .spatial-element-pane-body .spatial-element-panel .stage-panel-surface::after { display: none; }
278
+ .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .spatial-element-pane-body .spatial-element-panel .stage-panel-surface {
279
+ border-radius: 0;
280
+ background: color-mix(in srgb, var(--spatial-pane-tint) var(--spatial-pane-tint-opacity), transparent);
281
+ -webkit-backdrop-filter: none; backdrop-filter: none;
282
+ }
283
+ .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .ps-section { --spatial-pane-section-color: var(--spatial-pane-tint); }
284
+ .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .ps-section[data-background-color='standard'] { --spatial-pane-section-color: var(--ps-section-standard); }
285
+ .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .ps-section[data-background-color='muted'] { --spatial-pane-section-color: var(--ps-section-muted); }
286
+ .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .ps-section > .ps-section-surface {
287
+ background: color-mix(in srgb, var(--spatial-pane-section-color) var(--spatial-pane-tint-opacity), transparent) !important;
288
+ -webkit-backdrop-filter: none; backdrop-filter: none; border-radius: 0; box-shadow: none;
289
+ }
266
290
  .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .spatial-element-pane-body .panel-copy {
267
291
  position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%);
268
292
  }
@@ -274,8 +298,13 @@
274
298
  display: block; position: fixed; z-index: 0; top: var(--spatial-pane-top); left: var(--spatial-pane-left);
275
299
  width: var(--spatial-pane-width); height: var(--spatial-pane-height);
276
300
  border-radius: var(--spatial-element-panel-radius); pointer-events: none;
277
- background: color-mix(in srgb, var(--spatial-pane-tint) var(--spatial-pane-tint-opacity), transparent);
278
- backdrop-filter: blur(var(--spatial-pane-blur)); box-shadow: var(--spatial-element-docked-panel-box-shadow);
301
+ background: transparent;
302
+ /* The scrolling body's clip-path is a Backdrop Root: child filters cannot
303
+ * sample the stage canvas. Blur once on this unclipped sibling, then paint
304
+ * the individual (at least 80% opaque) section colors above it. */
305
+ -webkit-backdrop-filter: blur(var(--spatial-pane-blur));
306
+ backdrop-filter: blur(var(--spatial-pane-blur));
307
+ box-shadow: var(--spatial-element-docked-panel-box-shadow);
279
308
  transform: translateY(var(--spatial-pane-fixed-compensation, 0px));
280
309
  }
281
310
  .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .spatial-element-pane-heading {
@@ -283,7 +312,7 @@
283
312
  top: var(--spatial-pane-top); left: var(--spatial-pane-left); width: var(--spatial-pane-width); height: 86px;
284
313
  border-radius: var(--spatial-element-panel-radius) var(--spatial-element-panel-radius) 0 0;
285
314
  background: color-mix(in srgb, var(--spatial-pane-tint) var(--spatial-pane-tint-opacity), transparent);
286
- backdrop-filter: blur(var(--spatial-pane-blur)); pointer-events: auto;
315
+ -webkit-backdrop-filter: none; backdrop-filter: none; pointer-events: auto;
287
316
  border-bottom: 1px solid color-mix(in srgb, var(--spatial-element-ink) 14%, transparent);
288
317
  box-shadow: 0 4px 10px rgb(0 0 0 / 0.08);
289
318
  transform: translateY(var(--spatial-pane-fixed-compensation, 0px));
@@ -143,7 +143,8 @@
143
143
  return {
144
144
  ...visualTheme,
145
145
  ...(pose ?? {}),
146
- radius: shape.radius
146
+ radius: shape.radius,
147
+ squareBottom: shape.squareBottom
147
148
  };
148
149
  }
149
150
 
@@ -197,6 +198,7 @@
197
198
  const backdropBlur = Math.max(theme.backdropBlur ?? 5, 0);
198
199
  const style = [
199
200
  `--stage-panel-radius: ${shape.radius}px`,
201
+ `--stage-panel-bottom-radius: ${shape.squareBottom ? 0 : shape.radius}px`,
200
202
  `--stage-panel-content-inset: ${getContentInset()}px`,
201
203
  `--stage-panel-tint-rgb: ${getTintRgb()}`,
202
204
  `--stage-panel-tint-opacity: ${tintOpacity}`,
@@ -317,7 +319,7 @@
317
319
  .stage-panel-fallback {
318
320
  z-index: 2;
319
321
  box-sizing: border-box;
320
- border-radius: var(--stage-panel-radius);
322
+ border-radius: var(--stage-panel-radius) var(--stage-panel-radius) var(--stage-panel-bottom-radius, var(--stage-panel-radius)) var(--stage-panel-bottom-radius, var(--stage-panel-radius));
321
323
  }
322
324
 
323
325
  .stage-panel-posed {
@@ -335,7 +337,7 @@
335
337
  width: 100%;
336
338
  height: 100%;
337
339
  padding: var(--stage-panel-content-inset);
338
- border-radius: var(--stage-panel-radius);
340
+ border-radius: var(--stage-panel-radius) var(--stage-panel-radius) var(--stage-panel-bottom-radius, var(--stage-panel-radius)) var(--stage-panel-bottom-radius, var(--stage-panel-radius));
339
341
  /* Keep opacity/filter off the element that owns backdrop-filter. Chrome
340
342
  * otherwise creates a new Backdrop Root as soon as zoom starts. */
341
343
  opacity: 1;
@@ -810,6 +810,7 @@
810
810
  captureHeroPresentation: () => experience?.captureHeroPresentation() ?? false,
811
811
  getSpatialCapture: () => experience?.getSpatialCapture() ?? null,
812
812
  getDetailProjection: kind => experience?.getVisualTestDetailProjection(kind) ?? null,
813
+ getOutlinePose: () => experience?.getVisualTestOutlinePose() ?? null,
813
814
  releaseSpatialCapture: () => experience?.releaseSpatialCapture(),
814
815
  registerCatalogEndpoint: (address, element) => catalogEndpoints.register(address, element),
815
816
  getCatalogPresentation: () => experience?.getCatalogPresentation() ?? null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spatial-elements/sveltekit",
3
- "version": "1.0.0-beta.12",
3
+ "version": "1.0.0-beta.14",
4
4
  "description": "SvelteKit components and navigation for Spatial Elements.",
5
5
  "license": "MPL-2.0",
6
6
  "type": "module",
@@ -42,7 +42,7 @@
42
42
  "dependencies": {
43
43
  "@page-sections/core": "0.4.1",
44
44
  "@page-sections/svelte": "0.4.1",
45
- "@spatial-elements/core": "1.0.0-beta.12",
45
+ "@spatial-elements/core": "1.0.0-beta.14",
46
46
  "lucide-svelte": "^1.0.1"
47
47
  },
48
48
  "peerDependencies": {