@spatial-elements/sveltekit 1.0.0-beta.18 → 1.0.0-beta.19

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,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { resolve } from '$app/paths';
2
3
  import { setContext, onMount } from 'svelte';
3
4
  import { attachContentSidebars } from './contentSidebars.js';
4
5
  import { ContentPage as PageContent } from '@page-sections/svelte';
@@ -26,8 +27,13 @@
26
27
  footer?: Snippet;
27
28
  showContentMenu?: boolean;
28
29
  contentMenuLabel?: string;
30
+ /** Home destination for the shared breadcrumb; defaults to the application's base route. */
31
+ breadcrumbHomeHref?: string;
32
+ /** Accessible label for the icon-only Home link. */
33
+ breadcrumbHomeLabel?: string;
29
34
  }
30
- let { page, hdr, background, children, leftSidebar, pageEnd, footer, showContentMenu = false, contentMenuLabel }: Props = $props();
35
+ // Libraries cannot assume the consuming application's generated route union.
36
+ let { page, hdr, background, children, leftSidebar, pageEnd, footer, showContentMenu = false, contentMenuLabel, breadcrumbHomeHref = resolve(...(['/'] as unknown as Parameters<typeof resolve>)), breadcrumbHomeLabel }: Props = $props();
31
37
  const backgroundId = $props.id();
32
38
  const backgroundScope = backgroundId.replace(/[^a-zA-Z0-9_-]/g, '_');
33
39
  onMount(() => {
@@ -48,7 +54,7 @@
48
54
  </script>
49
55
 
50
56
  {#if background}<svelte:element this={'style'}>{backgroundRules}</svelte:element>{/if}
51
- <PageContent {page} {leftSidebar} pageEnd={pageEnd ?? footer} {showContentMenu} {contentMenuLabel} class="content-page" data-catalog-list data-brand-id={brand.id}
57
+ <PageContent {page} {leftSidebar} pageEnd={pageEnd ?? footer} {showContentMenu} {contentMenuLabel} {breadcrumbHomeHref} {breadcrumbHomeLabel} class="content-page" data-catalog-list data-brand-id={brand.id}
52
58
  data-spatial-content-page={backgroundScope} data-spatial-page-background={background ? backgroundScope : undefined}>
53
59
  {@render children?.()}
54
60
  </PageContent>
@@ -17,6 +17,10 @@ interface Props {
17
17
  footer?: Snippet;
18
18
  showContentMenu?: boolean;
19
19
  contentMenuLabel?: string;
20
+ /** Home destination for the shared breadcrumb; defaults to the application's base route. */
21
+ breadcrumbHomeHref?: string;
22
+ /** Accessible label for the icon-only Home link. */
23
+ breadcrumbHomeLabel?: string;
20
24
  }
21
25
  declare const ContentPage: import("svelte").Component<Props, {}, "">;
22
26
  type ContentPage = ReturnType<typeof ContentPage>;
@@ -218,6 +218,7 @@
218
218
  {textAlign}
219
219
  {mediaAspect}
220
220
  {mediaFit}
221
+ mediaHoverZoom={false}
221
222
  {reserveEyebrow}
222
223
  tone={cardTone}
223
224
  shadow={cardShadow}
@@ -309,6 +310,13 @@
309
310
  :global(.ps-card.spatial-element-card[data-catalog-card] [data-ps-card-part='media']) {
310
311
  transform-style: preserve-3d;
311
312
  }
313
+ /* Contained spatial posters share the model's depth and may leave the frame.
314
+ * Page Sections' image viewport otherwise flattens and clips that 3D fallback. */
315
+ :global(.ps-card.spatial-element-card[data-catalog-card][data-media-fit='contain'] .media-viewport) {
316
+ overflow: visible;
317
+ isolation: auto;
318
+ transform-style: preserve-3d;
319
+ }
312
320
  :global(
313
321
  .ps-card.spatial-element-card[data-catalog-card]:is([data-mouse-hover], :has(:focus-visible))
314
322
  [data-ps-card-part='surface']
@@ -336,6 +344,9 @@
336
344
  opacity: var(--spatial-card-frozen-after-opacity) !important;
337
345
  transition-property: none !important;
338
346
  }
347
+ :global(.spatial-element-card[data-spatial-card-appearance-frozen]::after) {
348
+ border-color: var(--spatial-card-frozen-after-border) !important;
349
+ }
339
350
  :global(
340
351
  .ps-card.spatial-element-card[data-catalog-card] [data-ps-card-part='title'] .title-label
341
352
  ) {
@@ -42,7 +42,7 @@
42
42
  const resolved = $derived(items.map(item => ({ ...item, href: item.href ? resolve(...([item.href] as unknown as Parameters<typeof resolve>)) : undefined })));
43
43
  </script>
44
44
  <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}>
45
- <Breadcrumbs items={resolved} />
45
+ <Breadcrumbs items={resolved} homeHref={resolve(...(['/'] as unknown as Parameters<typeof resolve>))} />
46
46
  </div>
47
47
  <style>
48
48
  .breadcrumbs { height: var(--ps-breadcrumb-height); padding-inline: var(--ps-grid-gap, 12px); box-sizing: border-box; pointer-events: auto; overflow-x: auto; scrollbar-width: none; direction: rtl; }
@@ -1,7 +1,8 @@
1
1
  <script lang="ts">
2
2
  import { page } from '$app/state';
3
3
  import { resolveSpatialThemeRadii } from '@spatial-elements/core/spatial-element/spatialTheme';
4
- import { onMount } from 'svelte';
4
+ import { onMount, getContext } from 'svelte';
5
+ import { STAGE_CONTEXT_KEY, type StageContext } from '@spatial-elements/core/stage/panelContext';
5
6
  import SpatialSummarySlot from './SpatialSummarySlot.svelte';
6
7
  import Panel from '../stage/Panel.svelte';
7
8
  import { useSpatialTheme } from './brandContext.js';
@@ -10,6 +11,19 @@
10
11
  let { spatialElement, nativeContent = false }: { spatialElement: SpatialElementData; nativeContent?: boolean } = $props();
11
12
  const readTheme = useSpatialTheme();
12
13
  const theme = $derived(readTheme());
14
+ const stage = getContext<StageContext | undefined>(STAGE_CONTEXT_KEY);
15
+ const sequenceKey = $derived(`${theme.id}:${spatialElement.id}`);
16
+ const sequenceState = $derived(stage?.getModelSequence?.(sequenceKey));
17
+ const model = $derived.by(() => {
18
+ if (!spatialElement.modelSequence) return undefined;
19
+ const key = sequenceKey;
20
+ return { sequence: {
21
+ step: sequenceState?.step ?? spatialElement.modelSequence.steps,
22
+ steps: spatialElement.modelSequence.steps,
23
+ ready: Boolean(sequenceState?.ready && stage?.isEnhanced?.()),
24
+ setStep: (step: number) => stage?.setModelSequenceStep?.(key, step) ?? false
25
+ } };
26
+ });
13
27
  const radii = $derived(resolveSpatialThemeRadii(theme));
14
28
  const contentInset = $derived(theme.panelShape.contentInset ?? Math.max(16, Math.round(theme.panelShape.radius * 0.7)));
15
29
  let presentation = $state<HTMLDivElement>(null!);
@@ -60,7 +74,7 @@
60
74
  data-spatial-element-id={spatialElement.id}
61
75
  >
62
76
  <SpatialSummarySlot instanceKey={`detail:${theme.id}:${spatialElement.id}`} bind:element={presentation}
63
- context={{ spatialElement, contentInset, heading: 'h1', mode: 'detail', detailHref: page.url.pathname,
77
+ context={{ spatialElement, model, contentInset, heading: 'h1', mode: 'detail', detailHref: page.url.pathname,
64
78
  address: (role) => ({ brandId: theme.id, spatialElementId: spatialElement.id, slot: 'detail.summary', role }) }} />
65
79
  </Panel>
66
80
  </div>
@@ -100,7 +100,8 @@
100
100
  box-shadow: var(--ps-navigation-shadow, var(--ps-panel-shadow, var(--spatial-element-panel-box-shadow, var(--spatial-panel-default-shadow))));
101
101
  }
102
102
  .spatial-shell-rack :global(.header) { border-radius: var(--spatial-element-panel-radius); }
103
- .spatial-shell-rack :global(.satellite) { border-radius: var(--spatial-element-control-radius); }
103
+ .spatial-shell-rack :global(.satellite),
104
+ .spatial-shell-rack :global(.satellite .ps-button-group) { border-radius: var(--spatial-element-control-radius); }
104
105
  :global(.stage-virtual-scroll-active) .spatial-shell-rack { position: relative; transform: translateY(var(--spatial-shell-scroll-compensation, 0px)); }
105
106
  [data-spatial-navigation-glass] :global([data-stage-panel-bound]) { background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
106
107
  @media (width < 1600px) { .spatial-shell-rack :global(.header) { border-radius: 0; } }
@@ -1,5 +1,6 @@
1
1
  const FROZEN = 'data-spatial-card-appearance-frozen';
2
2
  const AFTER_OPACITY = '--spatial-card-frozen-after-opacity';
3
+ const AFTER_BORDER = '--spatial-card-frozen-after-border';
3
4
  const TRANSITION = 'transition-property';
4
5
  const TRANSITION_LONGHANDS = ['transition-duration', 'transition-timing-function', 'transition-delay', 'transition-behavior'];
5
6
  /** Freeze the displayed (possibly interpolated) appearance, not the hover state.
@@ -37,7 +38,8 @@ export function freezeCardAppearance(card) {
37
38
  snapshot(element, name);
38
39
  }
39
40
  }
40
- const previousMarker = surface?.getAttribute(FROZEN);
41
+ const markers = [card, ...(surface ? [surface] : [])].map(element => ({ element, previous: element.getAttribute(FROZEN) }));
42
+ snapshot(card, AFTER_BORDER, getComputedStyle(card, '::after').borderColor);
41
43
  if (surface)
42
44
  snapshot(surface, AFTER_OPACITY, getComputedStyle(surface, '::after').opacity);
43
45
  let restored = false;
@@ -51,18 +53,19 @@ export function freezeCardAppearance(card) {
51
53
  else
52
54
  element.style.removeProperty(name);
53
55
  }
54
- if (surface) {
55
- if (previousMarker === null)
56
- surface.removeAttribute(FROZEN);
57
- else if (previousMarker !== undefined)
58
- surface.setAttribute(FROZEN, previousMarker);
56
+ for (const { element, previous } of markers) {
57
+ if (previous === null)
58
+ element.removeAttribute(FROZEN);
59
+ else
60
+ element.setAttribute(FROZEN, previous);
59
61
  }
60
62
  };
61
63
  try {
62
64
  for (const { element, name, frozen } of writes)
63
65
  if (frozen !== undefined)
64
66
  element.style.setProperty(name, frozen, 'important');
65
- surface?.setAttribute(FROZEN, '');
67
+ for (const { element } of markers)
68
+ element.setAttribute(FROZEN, '');
66
69
  }
67
70
  catch (error) {
68
71
  restore();
@@ -1,6 +1,7 @@
1
1
  export { default as BrandStageShell } from './BrandStageShell.svelte';
2
2
  export { default as SpatialElementSummaryContent } from './SpatialElementSummaryContent.svelte';
3
3
  export type { SpatialSummaryContext, SpatialSummarySnippet } from './spatialSummary.js';
4
+ export type { SpatialModelSequence, SpatialModelSequenceState, SpatialModelSequenceControls } from '@spatial-elements/core/stage/ModelSequenceController';
4
5
  export { defaultSpatialMessages, resolveSpatialMessages, type SpatialMessages, type SpatialMessagesInput } from '@spatial-elements/core/spatial-element/messages';
5
6
  export { default as SpatialElementPage } from './SpatialElementPage.svelte';
6
7
  export { default as SpatialListPage } from './SpatialListPage.svelte';
@@ -5,6 +5,10 @@ import type { ResolvedSpatialElementData } from '@spatial-elements/core/spatial-
5
5
  import type { SpatialListItem } from '@spatial-elements/core/spatial-element/types';
6
6
  import type { SpatialCardSize } from '@spatial-elements/core/spatial-element/responsiveLayout';
7
7
  export interface SpatialSummaryContext {
8
+ /** Optional controls for this detail instance. Not supplied in collections. */
9
+ model?: {
10
+ sequence: import('@spatial-elements/core').SpatialModelSequenceControls;
11
+ };
8
12
  spatialElement: Pick<ResolvedSpatialElementData, 'id' | 'brandId' | 'title' | 'eyebrow' | 'features' | 'action'>;
9
13
  /** Canonical detail link, retained when the live summary moves between placements. */
10
14
  detailHref?: string;
@@ -16,6 +16,9 @@ export function getSpatialThemeStyle(theme) {
16
16
  `--ps-font-family: Inter, ui-sans-serif, system-ui, sans-serif`,
17
17
  `--ps-border: ${theme.colors.border ?? `color-mix(in srgb, ${theme.colors.ink} 18%, transparent)`}`,
18
18
  `--ps-panel-border: ${theme.colors.panelBorder ?? `color-mix(in srgb, ${theme.colors.ink} 12%, transparent)`}`,
19
+ `--ps-panel-background: rgb(${getDockedPanelTintRgb(theme.panelTheme.tint ?? '#ffffff')})`,
20
+ `--ps-panel-tint-opacity: ${clamp(theme.panelTheme.tintOpacity ?? 0.65, 0, 1)}`,
21
+ `--ps-panel-backdrop-blur: ${clamp(theme.panelTheme.backdropBlur ?? 8, 0, 100)}px`,
19
22
  `--ps-selection: ${theme.colors.tabBackground}`,
20
23
  `--ps-scroll-offset: var(--spatial-element-section-scroll-offset, 150px)`,
21
24
  `--spatial-element-background: ${theme.background}`,
@@ -249,7 +249,11 @@
249
249
  minimapFocus: 0
250
250
  };
251
251
 
252
+ let modelSequenceState = $state<{ key?: string; state?: import('@spatial-elements/core').SpatialModelSequenceState }>({});
253
+ const sequenceOptions = () => activeElement?.modelSequence ? { ...activeElement.modelSequence, key: `${catalog?.brandId}:${activeElement.id}` } : undefined;
252
254
  setContext<StageContext>(STAGE_CONTEXT_KEY, {
255
+ getModelSequence: (key) => modelSequenceState.key === key ? modelSequenceState.state : undefined,
256
+ setModelSequenceStep: (key, step) => experience?.setModelSequenceStep(key, step) ?? false,
253
257
  registerDetailMedia(read) {
254
258
  const owner = Symbol(); detailMediaOwner = owner; readDetailMedia = read;
255
259
  return () => { if (detailMediaOwner === owner) { detailMediaOwner = undefined; readDetailMedia = undefined; } };
@@ -384,6 +388,7 @@
384
388
  hdr,
385
389
  glb,
386
390
  lodPair,
391
+ modelSequence: sequenceOptions(),
387
392
  model,
388
393
  camera,
389
394
  interactionTheme,
@@ -421,7 +426,8 @@
421
426
  },
422
427
  onZoomFocusChange: (focusState) => {
423
428
  setZoomFocusState(focusState);
424
- }
429
+ },
430
+ onModelSequenceChange: (key, state) => { modelSequenceState = { key, state }; }
425
431
  });
426
432
  experience = instance;
427
433
  await instance.init();
@@ -713,6 +719,7 @@
713
719
  hdr,
714
720
  glb,
715
721
  lodPair,
722
+ modelSequence: sequenceOptions(),
716
723
  model,
717
724
  camera,
718
725
  interactionTheme,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spatial-elements/sveltekit",
3
- "version": "1.0.0-beta.18",
3
+ "version": "1.0.0-beta.19",
4
4
  "description": "SvelteKit components and navigation for Spatial Elements.",
5
5
  "license": "MPL-2.0",
6
6
  "type": "module",
@@ -41,9 +41,9 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@lucide/svelte": "1.77.0",
44
- "@page-sections/core": "0.6.0",
45
- "@page-sections/svelte": "0.6.0",
46
- "@spatial-elements/core": "1.0.0-beta.18"
44
+ "@page-sections/core": "0.9.3",
45
+ "@page-sections/svelte": "0.9.3",
46
+ "@spatial-elements/core": "1.0.0-beta.19"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@sveltejs/kit": "^3.4.0",