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

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}
@@ -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)}
@@ -205,7 +205,7 @@
205
205
  data-brand-id={spatialElement.brandId}
206
206
  data-spatial-selected-media={selectedMedia.kind}
207
207
  style:--spatial-pane-tint={paneTint}
208
- style:--spatial-pane-tint-opacity={`${Math.min(1, Math.max(0, brand.panelTheme.tintOpacity ?? 0.28)) * 100}%`}
208
+ style:--spatial-pane-tint-opacity={`${Math.min(1, Math.max(0.8, brand.panelTheme.tintOpacity ?? 0.28)) * 100}%`}
209
209
  style:--spatial-pane-blur={`${Math.min(100, Math.max(0, brand.panelTheme.backdropBlur ?? 5))}px`}
210
210
  >
211
211
  <div class="spatial-element-pane-heading" data-spatial-detail-pane-header data-spatial-detail-fixed data-spatial-element-handoff-header>
@@ -326,7 +326,7 @@
326
326
  background: transparent;
327
327
  pointer-events: none;
328
328
  }
329
- @media (width < 840px) { .spatial-element-content { padding-top: 12px; } }
329
+ @media (width < 840px) { .spatial-element-content { padding-top: 0; } }
330
330
  @media (min-width: 840px) {
331
331
  .spatial-element-hero { height: var(--spatial-detail-fit-height); }
332
332
  .spatial-element-content { padding-top: 8px; }
@@ -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>
@@ -263,6 +263,18 @@
263
263
  .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
264
  .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .spatial-element-pane-body .spatial-element-panel .stage-panel-surface::before,
265
265
  .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .spatial-element-pane-body .spatial-element-panel .stage-panel-surface::after { display: none; }
266
+ .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .spatial-element-pane-body .spatial-element-panel .stage-panel-surface {
267
+ border-radius: 0;
268
+ background: color-mix(in srgb, var(--spatial-pane-tint) var(--spatial-pane-tint-opacity), transparent);
269
+ -webkit-backdrop-filter: none; backdrop-filter: none;
270
+ }
271
+ .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .ps-section { --spatial-pane-section-color: var(--spatial-pane-tint); }
272
+ .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .ps-section[data-background-color='standard'] { --spatial-pane-section-color: var(--ps-section-standard); }
273
+ .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .ps-section[data-background-color='muted'] { --spatial-pane-section-color: var(--ps-section-muted); }
274
+ .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .ps-section > .ps-section-surface {
275
+ background: color-mix(in srgb, var(--spatial-pane-section-color) var(--spatial-pane-tint-opacity), transparent) !important;
276
+ -webkit-backdrop-filter: none; backdrop-filter: none; border-radius: 0; box-shadow: none;
277
+ }
266
278
  .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .spatial-element-pane-body .panel-copy {
267
279
  position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%);
268
280
  }
@@ -274,8 +286,13 @@
274
286
  display: block; position: fixed; z-index: 0; top: var(--spatial-pane-top); left: var(--spatial-pane-left);
275
287
  width: var(--spatial-pane-width); height: var(--spatial-pane-height);
276
288
  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);
289
+ background: transparent;
290
+ /* The scrolling body's clip-path is a Backdrop Root: child filters cannot
291
+ * sample the stage canvas. Blur once on this unclipped sibling, then paint
292
+ * the individual (at least 80% opaque) section colors above it. */
293
+ -webkit-backdrop-filter: blur(var(--spatial-pane-blur));
294
+ backdrop-filter: blur(var(--spatial-pane-blur));
295
+ box-shadow: var(--spatial-element-docked-panel-box-shadow);
279
296
  transform: translateY(var(--spatial-pane-fixed-compensation, 0px));
280
297
  }
281
298
  .stage [data-spatial-element-root]:not([data-spatial-detail-flow]) .spatial-element-pane-heading {
@@ -283,7 +300,7 @@
283
300
  top: var(--spatial-pane-top); left: var(--spatial-pane-left); width: var(--spatial-pane-width); height: 86px;
284
301
  border-radius: var(--spatial-element-panel-radius) var(--spatial-element-panel-radius) 0 0;
285
302
  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;
303
+ -webkit-backdrop-filter: none; backdrop-filter: none; pointer-events: auto;
287
304
  border-bottom: 1px solid color-mix(in srgb, var(--spatial-element-ink) 14%, transparent);
288
305
  box-shadow: 0 4px 10px rgb(0 0 0 / 0.08);
289
306
  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.13",
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.13",
46
46
  "lucide-svelte": "^1.0.1"
47
47
  },
48
48
  "peerDependencies": {