@spatial-elements/sveltekit 0.1.0-beta.1

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 (52) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +17 -0
  3. package/dist/catalog/ScrollNavigationBridge.svelte +394 -0
  4. package/dist/catalog/ScrollNavigationBridge.svelte.d.ts +13 -0
  5. package/dist/catalog/catalogEndpointAction.d.ts +6 -0
  6. package/dist/catalog/catalogEndpointAction.js +18 -0
  7. package/dist/catalog/catalogNavigation.d.ts +7 -0
  8. package/dist/catalog/catalogNavigation.js +19 -0
  9. package/dist/catalog/catalogTransition.css +59 -0
  10. package/dist/index.d.ts +6 -0
  11. package/dist/index.js +6 -0
  12. package/dist/spatial-element/BrandStageShell.svelte +106 -0
  13. package/dist/spatial-element/BrandStageShell.svelte.d.ts +12 -0
  14. package/dist/spatial-element/CarouselSection.svelte +350 -0
  15. package/dist/spatial-element/CarouselSection.svelte.d.ts +15 -0
  16. package/dist/spatial-element/CarouselSpatialElement.svelte +388 -0
  17. package/dist/spatial-element/CarouselSpatialElement.svelte.d.ts +17 -0
  18. package/dist/spatial-element/ContentPage.svelte +68 -0
  19. package/dist/spatial-element/ContentPage.svelte.d.ts +9 -0
  20. package/dist/spatial-element/ListSection.svelte +30 -0
  21. package/dist/spatial-element/ListSection.svelte.d.ts +8 -0
  22. package/dist/spatial-element/Section.svelte +191 -0
  23. package/dist/spatial-element/Section.svelte.d.ts +14 -0
  24. package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +69 -0
  25. package/dist/spatial-element/SpatialElementBreadcrumbs.svelte.d.ts +8 -0
  26. package/dist/spatial-element/SpatialElementCard.svelte +256 -0
  27. package/dist/spatial-element/SpatialElementCard.svelte.d.ts +9 -0
  28. package/dist/spatial-element/SpatialElementMediaRail.svelte +144 -0
  29. package/dist/spatial-element/SpatialElementMediaRail.svelte.d.ts +7 -0
  30. package/dist/spatial-element/SpatialElementPage.svelte +249 -0
  31. package/dist/spatial-element/SpatialElementPage.svelte.d.ts +9 -0
  32. package/dist/spatial-element/SpatialElementStickyHeader.svelte +351 -0
  33. package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +9 -0
  34. package/dist/spatial-element/SpatialElementSummaryPanel.svelte +423 -0
  35. package/dist/spatial-element/SpatialElementSummaryPanel.svelte.d.ts +7 -0
  36. package/dist/spatial-element/SpatialElementTabList.svelte +266 -0
  37. package/dist/spatial-element/SpatialElementTabList.svelte.d.ts +9 -0
  38. package/dist/spatial-element/SpatialElementTabs.svelte +123 -0
  39. package/dist/spatial-element/SpatialElementTabs.svelte.d.ts +8 -0
  40. package/dist/spatial-element/SpatialListPage.svelte +23 -0
  41. package/dist/spatial-element/SpatialListPage.svelte.d.ts +11 -0
  42. package/dist/spatial-element/brandContext.d.ts +5 -0
  43. package/dist/spatial-element/brandContext.js +14 -0
  44. package/dist/spatial-element/index.d.ts +11 -0
  45. package/dist/spatial-element/index.js +8 -0
  46. package/dist/stage/Panel.svelte +355 -0
  47. package/dist/stage/Panel.svelte.d.ts +24 -0
  48. package/dist/stage/Stage.svelte +747 -0
  49. package/dist/stage/Stage.svelte.d.ts +22 -0
  50. package/dist/stage/StageViewport.svelte +73 -0
  51. package/dist/stage/StageViewport.svelte.d.ts +13 -0
  52. package/package.json +55 -0
@@ -0,0 +1,123 @@
1
+ <script lang="ts">
2
+ import { onMount, tick } from 'svelte';
3
+ import Panel from '../stage/Panel.svelte';
4
+ import { STAGE_PANEL_LAYOUT_EVENT } from '@spatial-elements/core/stage/panelContext';
5
+ import SpatialElementTabList from './SpatialElementTabList.svelte';
6
+ import { useSpatialTheme } from './brandContext.js';
7
+ import type { SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
8
+
9
+ let {
10
+ activeSectionId,
11
+ sections
12
+ }: {
13
+ activeSectionId?: string;
14
+ sections: SpatialElementSectionNavigationItem[];
15
+ } = $props();
16
+ let anchorElement: HTMLDivElement;
17
+ const theme = useSpatialTheme();
18
+
19
+ onMount(() => {
20
+ let resizeObserver: ResizeObserver | undefined;
21
+ let mutationObserver: MutationObserver | undefined;
22
+ let measureFrame = 0;
23
+ let measuredNaturalWidth = 0;
24
+ let disposed = false;
25
+
26
+ const measure = () => {
27
+ measureFrame = 0;
28
+ const frame = anchorElement.querySelector<HTMLElement>('[data-stage-panel-fallback]');
29
+ const tabList = anchorElement.querySelector<HTMLElement>('[data-spatial-element-tab-list="panel"]');
30
+ const links = tabList?.querySelector<HTMLElement>('[data-spatial-element-tab-links]');
31
+ if (!frame || !tabList || !links) return;
32
+
33
+ const linksWidth = links.scrollWidth;
34
+ if (linksWidth < 1) return;
35
+ measuredNaturalWidth = Math.max(measuredNaturalWidth, Math.ceil(linksWidth));
36
+ const currentHeight = Math.max(frame.getBoundingClientRect().height, 52);
37
+
38
+ anchorElement.style.setProperty('--spatial-element-tabs-natural-width', `${measuredNaturalWidth}px`);
39
+ anchorElement.style.setProperty('--spatial-element-tabs-height', `${Math.ceil(currentHeight)}px`);
40
+ anchorElement.toggleAttribute('data-spatial-element-tabs-measured', true);
41
+ window.dispatchEvent(new Event(STAGE_PANEL_LAYOUT_EVENT));
42
+ };
43
+
44
+ const scheduleMeasure = () => {
45
+ if (disposed || measureFrame) return;
46
+ measureFrame = requestAnimationFrame(measure);
47
+ };
48
+
49
+ void tick().then(() => {
50
+ if (disposed) return;
51
+ measure();
52
+ const tabList = anchorElement.querySelector<HTMLElement>('[data-spatial-element-tab-list="panel"]');
53
+ if ('ResizeObserver' in window && tabList) {
54
+ resizeObserver = new ResizeObserver(scheduleMeasure);
55
+ resizeObserver.observe(tabList);
56
+ }
57
+ if ('MutationObserver' in window && tabList) {
58
+ mutationObserver = new MutationObserver(scheduleMeasure);
59
+ mutationObserver.observe(tabList, {
60
+ childList: true,
61
+ characterData: true,
62
+ subtree: true
63
+ });
64
+ }
65
+ });
66
+ window.addEventListener('resize', scheduleMeasure, { passive: true });
67
+
68
+ return () => {
69
+ disposed = true;
70
+ window.removeEventListener('resize', scheduleMeasure);
71
+ resizeObserver?.disconnect();
72
+ mutationObserver?.disconnect();
73
+ if (measureFrame) cancelAnimationFrame(measureFrame);
74
+ };
75
+ });
76
+ </script>
77
+
78
+ <div bind:this={anchorElement} class="spatial-element-tabs-anchor" data-spatial-element-tabs-panel-anchor>
79
+ <Panel
80
+ transitionGroup="enter"
81
+ class="spatial-element-tabs-panel"
82
+ pointerReactive={false}
83
+ shape={{ ...theme.panelShape, contentInset: 0 }}
84
+ theme={theme.panelTheme}
85
+ contentClass="spatial-element-tabs-panel-content"
86
+ >
87
+ <SpatialElementTabList {activeSectionId} {sections} variant="panel" />
88
+ </Panel>
89
+ </div>
90
+
91
+ <style>
92
+ .spatial-element-tabs-anchor {
93
+ position: relative;
94
+ z-index: 4;
95
+ width: fit-content;
96
+ max-width: 100%;
97
+ height: var(--spatial-element-tabs-height, 52px);
98
+ pointer-events: auto;
99
+ }
100
+
101
+ .spatial-element-tabs-anchor:global([data-spatial-element-tabs-measured]) {
102
+ width: min(var(--spatial-element-tabs-natural-width), 100%);
103
+ }
104
+
105
+ :global(.spatial-element-tabs-panel) {
106
+ width: max-content;
107
+ max-width: 100%;
108
+ height: var(--spatial-element-tabs-height, 52px);
109
+ min-height: var(--spatial-element-tabs-height, 52px);
110
+ pointer-events: auto;
111
+ }
112
+
113
+ .spatial-element-tabs-anchor:global([data-spatial-element-tabs-measured]) :global(.spatial-element-tabs-panel) {
114
+ width: 100%;
115
+ }
116
+
117
+ :global(.spatial-element-tabs-panel-content) {
118
+ display: flex;
119
+ align-items: center;
120
+ border-radius: inherit;
121
+ overflow: hidden;
122
+ }
123
+ </style>
@@ -0,0 +1,8 @@
1
+ import type { SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
2
+ type $$ComponentProps = {
3
+ activeSectionId?: string;
4
+ sections: SpatialElementSectionNavigationItem[];
5
+ };
6
+ declare const SpatialElementTabs: import("svelte").Component<$$ComponentProps, {}, "">;
7
+ type SpatialElementTabs = ReturnType<typeof SpatialElementTabs>;
8
+ export default SpatialElementTabs;
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import ContentPage from './ContentPage.svelte';
3
+ import ListSection from './ListSection.svelte';
4
+ import Section from './Section.svelte';
5
+ import { useCatalogNavigation } from '../catalog/catalogNavigation.js';
6
+ import type { SpatialListItem, ContentPageData } from '@spatial-elements/core/spatial-element/types';
7
+ let {
8
+ spatialElements,
9
+ sectionLink,
10
+ ...page
11
+ }: ContentPageData & {
12
+ spatialElements: SpatialListItem[];
13
+ sectionLink?: { href: string; label: string };
14
+ } = $props();
15
+ const { href } = useCatalogNavigation();
16
+ </script>
17
+
18
+ <ContentPage {page}>
19
+ <ListSection section={{ id: 'elements', title: 'Elements' }} list={spatialElements} />
20
+ {#if sectionLink}<Section section={{ id: 'more', title: 'More information' }}
21
+ ><a href={href(sectionLink.href)}>{sectionLink.label}</a></Section
22
+ >{/if}
23
+ </ContentPage>
@@ -0,0 +1,11 @@
1
+ import type { SpatialListItem, ContentPageData } from '@spatial-elements/core/spatial-element/types';
2
+ type $$ComponentProps = ContentPageData & {
3
+ spatialElements: SpatialListItem[];
4
+ sectionLink?: {
5
+ href: string;
6
+ label: string;
7
+ };
8
+ };
9
+ declare const SpatialListPage: import("svelte").Component<$$ComponentProps, {}, "">;
10
+ type SpatialListPage = ReturnType<typeof SpatialListPage>;
11
+ export default SpatialListPage;
@@ -0,0 +1,5 @@
1
+ import type { SpatialTheme } from '@spatial-elements/core/spatial-element/types';
2
+ /** Makes the current brand theme available to all spatial-element descendants. */
3
+ export declare function provideSpatialTheme(getTheme: () => SpatialTheme): void;
4
+ /** Returns the nearest brand theme or throws when the element shell is incomplete. */
5
+ export declare function useSpatialTheme(): SpatialTheme;
@@ -0,0 +1,14 @@
1
+ import { getContext, setContext } from 'svelte';
2
+ const SPATIAL_ELEMENT_BRAND_CONTEXT = Symbol('spatial-element-brand');
3
+ /** Makes the current brand theme available to all spatial-element descendants. */
4
+ export function provideSpatialTheme(getTheme) {
5
+ setContext(SPATIAL_ELEMENT_BRAND_CONTEXT, getTheme);
6
+ }
7
+ /** Returns the nearest brand theme or throws when the element shell is incomplete. */
8
+ export function useSpatialTheme() {
9
+ const getTheme = getContext(SPATIAL_ELEMENT_BRAND_CONTEXT);
10
+ if (!getTheme) {
11
+ throw new Error('SpatialElement detail components must be rendered inside a brand layout');
12
+ }
13
+ return getTheme();
14
+ }
@@ -0,0 +1,11 @@
1
+ export { default as BrandStageShell } from './BrandStageShell.svelte';
2
+ export { default as SpatialElementPage } from './SpatialElementPage.svelte';
3
+ export { default as SpatialListPage } from './SpatialListPage.svelte';
4
+ export { default as Section } from './Section.svelte';
5
+ export { findSpatialElement, getSpatialListItems } from '@spatial-elements/core/spatial-element/spatialElement';
6
+ export type { SpatialElementAction, SpatialTheme, SpatialElementBreadcrumb, SpatialElementData, SpatialDockedPanelTheme, SpatialElementFeature, SpatialElementMediaItem, SpatialMinimapTheme, SpatialListItem, SpatialElementSectionDefinition, SpatialElementSectionNavigationItem, SpatialElementSectionStyle, SpatialSectionTheme, SpatialStageConfig } from '@spatial-elements/core/spatial-element/types';
7
+ export { default as ContentPage } from './ContentPage.svelte';
8
+ export { default as CarouselSection } from './CarouselSection.svelte';
9
+ export { default as ListSection } from './ListSection.svelte';
10
+ export type { ContentPageData } from '@spatial-elements/core/spatial-element/types';
11
+ export type { CarouselPresentation } from '@spatial-elements/core/catalog/catalogPose';
@@ -0,0 +1,8 @@
1
+ export { default as BrandStageShell } from './BrandStageShell.svelte';
2
+ export { default as SpatialElementPage } from './SpatialElementPage.svelte';
3
+ export { default as SpatialListPage } from './SpatialListPage.svelte';
4
+ export { default as Section } from './Section.svelte';
5
+ export { findSpatialElement, getSpatialListItems } from '@spatial-elements/core/spatial-element/spatialElement';
6
+ export { default as ContentPage } from './ContentPage.svelte';
7
+ export { default as CarouselSection } from './CarouselSection.svelte';
8
+ export { default as ListSection } from './ListSection.svelte';
@@ -0,0 +1,355 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from "svelte/elements";
3
+ type StagePanelAttributes = HTMLAttributes<HTMLDivElement>;
4
+ import { getContext, onDestroy, onMount } from 'svelte';
5
+ import type { Snippet } from 'svelte';
6
+ import {
7
+ STAGE_CONTEXT_KEY,
8
+ type StageContext,
9
+
10
+ type StagePanelMinimapOptions,
11
+ type StagePanelPose,
12
+ type StagePanelShape,
13
+ type StagePanelTheme
14
+ } from '@spatial-elements/core/stage/panelContext';
15
+ import { getCssPanelBoxShadow, resolvePanelShadowStrength } from '@spatial-elements/core/stage/panelShadow';
16
+ import type { StagePanelSurface } from '@spatial-elements/core/stage/stageTypes';
17
+ import type { CatalogTransitionGroup } from '@spatial-elements/core/catalog/catalogPresentation';
18
+ import type { CatalogEndpointAddress } from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
19
+ import { createCatalogEndpointAction } from '../catalog/catalogEndpointAction.js';
20
+
21
+ type Props = Omit<StagePanelAttributes, 'class'> & {
22
+ children?: Snippet;
23
+ class?: string;
24
+ contentClass?: string;
25
+ minimap?: boolean | StagePanelMinimapOptions;
26
+ /** Enables proximity lift and pointer-driven tilt. Defaults to true. */
27
+ pointerReactive?: boolean;
28
+ pose?: StagePanelPose;
29
+ shape: StagePanelShape;
30
+ surface?: StagePanelSurface;
31
+ theme?: StagePanelTheme;
32
+ transitionGroup?: CatalogTransitionGroup;
33
+ catalogEndpoint?: CatalogEndpointAddress;
34
+ };
35
+
36
+ let {
37
+ children,
38
+ class: frameClass = '',
39
+ contentClass = '',
40
+ minimap = false,
41
+ pointerReactive = true,
42
+ pose,
43
+ shape,
44
+ style: contentStyle = '',
45
+ surface,
46
+ theme = {},
47
+ transitionGroup,
48
+ catalogEndpoint,
49
+ ...rest
50
+ }: Props = $props();
51
+
52
+ let frameElement: HTMLDivElement;
53
+ let surfaceElement: HTMLDivElement;
54
+ let contentElement: HTMLDivElement;
55
+ const stage = getContext<StageContext | undefined>(STAGE_CONTEXT_KEY);
56
+ const registerEndpoint = createCatalogEndpointAction();
57
+ const resolvedSurface = $derived(surface ?? theme.surface ?? 'glass');
58
+
59
+ if (!stage) {
60
+ throw new Error('Panel must be rendered inside a Stage component');
61
+ }
62
+
63
+ const unregister = stage.registerPanel({
64
+ getContentInset,
65
+ getElement: () => contentElement,
66
+ getFrameElement: () => frameElement,
67
+ getSurfaceElement: () => surfaceElement,
68
+ getPointerReactive: () => pointerReactive,
69
+ getMinimapOptions: () => getMinimapOptions(),
70
+ getMinimapDockProgress,
71
+ getMinimapModelScale,
72
+ getMinimapModelTop,
73
+ getSurface: () => resolvedSurface,
74
+ getSurfaceOpacity,
75
+ getOptions: getPanelOptions
76
+ });
77
+
78
+ onDestroy(unregister);
79
+
80
+ onMount(() => {
81
+ if (!getMinimapOptions()) return;
82
+
83
+ const resetView = (event: MouseEvent) => {
84
+ if (event.defaultPrevented || event.button !== 0) return;
85
+ stage.resetView();
86
+ };
87
+
88
+ contentElement.addEventListener('click', resetView);
89
+ return () => contentElement.removeEventListener('click', resetView);
90
+ });
91
+
92
+ function getContentInset() {
93
+ return shape.contentInset ?? Math.max(16, Math.round(shape.radius * 0.7));
94
+ }
95
+
96
+ function getPanelOptions() {
97
+ const visualTheme = { ...theme };
98
+ delete visualTheme.surface;
99
+ return {
100
+ ...visualTheme,
101
+ ...(pose ?? {}),
102
+ radius: shape.radius
103
+ };
104
+ }
105
+
106
+ function getMinimapOptions() {
107
+ if (!minimap) return undefined;
108
+ return minimap === true ? {} : minimap;
109
+ }
110
+
111
+ /** Reads the dock-controlled surface alpha while leaving HTML content untouched. */
112
+ function getSurfaceOpacity() {
113
+ const value = Number.parseFloat(
114
+ frameElement?.style.getPropertyValue('--stage-panel-surface-opacity') || '1'
115
+ );
116
+ return Number.isFinite(value) ? clamp(value, 0, 1) : 1;
117
+ }
118
+
119
+ /** Reads a transient model-only scale without changing the panel geometry. */
120
+ function getMinimapModelScale() {
121
+ const value = Number.parseFloat(frameElement?.dataset.stageMinimapModelScale || '1');
122
+ return Number.isFinite(value) ? clamp(value, 0.2, 2) : 1;
123
+ }
124
+
125
+ /** Reads the dock controller's normalized view transition. */
126
+ function getMinimapDockProgress() {
127
+ const value = Number.parseFloat(frameElement?.dataset.stageMinimapDockProgress || '0');
128
+ return Number.isFinite(value) ? clamp(value, 0, 1) : 0;
129
+ }
130
+
131
+ /** Reads the dock-controlled viewport anchor independently of model scale. */
132
+ function getMinimapModelTop() {
133
+ const value = Number.parseFloat(frameElement?.dataset.stageMinimapModelTop ?? '');
134
+ return Number.isFinite(value) ? value : undefined;
135
+ }
136
+
137
+ function getFallbackStyle() {
138
+ const tintOpacity = clamp(theme.tintOpacity ?? 0.28, 0, 1);
139
+ const shadowIntensity = getShadowIntensity();
140
+ const specularOpacity = clamp(theme.specularOpacity ?? 0.18, 0, 1);
141
+ const thickness = clamp(theme.thickness ?? 0.35, 0, 1);
142
+ const bezel = Math.max(theme.bezel ?? 18, 0);
143
+ const backdropBlur = Math.max(theme.backdropBlur ?? 5, 0);
144
+ const style = [
145
+ `--stage-panel-radius: ${shape.radius}px`,
146
+ `--stage-panel-content-inset: ${getContentInset()}px`,
147
+ `--stage-panel-tint-rgb: ${getTintRgb()}`,
148
+ `--stage-panel-tint-opacity: ${tintOpacity}`,
149
+ `--stage-panel-shadow-intensity: ${shadowIntensity}`,
150
+ `--stage-panel-shadow-strength: ${resolvePanelShadowStrength(shadowIntensity)}`,
151
+ `--stage-panel-box-shadow: ${getCssPanelBoxShadow(shadowIntensity)}`,
152
+ `--stage-panel-specular-opacity: ${specularOpacity}`,
153
+ `--stage-panel-thickness: ${thickness}`,
154
+ `--stage-panel-bezel: ${bezel}px`,
155
+ `--stage-panel-opacity: ${clamp(theme.opacity ?? 1, 0, 1)}`,
156
+ '--stage-panel-surface-opacity: 1',
157
+ '--stage-panel-focus-opacity: 1',
158
+ '--stage-panel-content-opacity: 1',
159
+ `--stage-panel-css-blur: ${Math.min(backdropBlur, 100)}px`
160
+ ];
161
+
162
+ if (pose) {
163
+ style.push(
164
+ `--stage-panel-width: ${pose.width}px`,
165
+ `--stage-panel-height: ${pose.height}px`,
166
+ `--stage-panel-x: ${pose.position.x}px`,
167
+ `--stage-panel-y: ${pose.position.y}px`
168
+ );
169
+ }
170
+
171
+ return style.join('; ');
172
+ }
173
+
174
+ function getContentThemeStyle() {
175
+ const shadowIntensity = getShadowIntensity();
176
+ return [
177
+ contentStyle,
178
+ `--stage-panel-opacity: ${clamp(theme.opacity ?? 1, 0, 1)}`,
179
+ `--stage-panel-shadow-intensity: ${shadowIntensity}`,
180
+ `--stage-panel-shadow-strength: ${resolvePanelShadowStrength(shadowIntensity)}`
181
+ ]
182
+ .filter(Boolean)
183
+ .join('; ');
184
+ }
185
+
186
+ function getShadowIntensity() {
187
+ return clamp(theme.shadowIntensity ?? 0.28, 0, 1);
188
+ }
189
+
190
+ function getTintRgb() {
191
+ const tint = theme.tint ?? '#ffffff';
192
+
193
+ if (typeof tint === 'number') {
194
+ return hexToRgb(tint.toString(16).padStart(6, '0'));
195
+ }
196
+
197
+ if (typeof tint === 'string') {
198
+ const value = tint.trim().replace(/^#/, '');
199
+ if (/^[0-9a-f]{3}$/i.test(value)) {
200
+ return hexToRgb(value.replace(/(.)/g, '$1$1'));
201
+ }
202
+ if (/^[0-9a-f]{6}$/i.test(value)) {
203
+ return hexToRgb(value);
204
+ }
205
+ }
206
+
207
+ return '255 255 255';
208
+ }
209
+
210
+ function hexToRgb(hex: string) {
211
+ const value = Number.parseInt(hex, 16);
212
+ return `${(value >> 16) & 255} ${(value >> 8) & 255} ${value & 255}`;
213
+ }
214
+
215
+ function clamp(value: number, min: number, max: number) {
216
+ return Math.min(Math.max(value, min), max);
217
+ }
218
+ </script>
219
+
220
+ <div
221
+ bind:this={frameElement}
222
+ data-stage-panel-fallback
223
+ data-catalog-transition-group={transitionGroup}
224
+ data-stage-panel-minimap={minimap ? '' : undefined}
225
+ data-stage-minimap-docked-view-scale={getMinimapOptions()?.dockedView?.scale}
226
+ data-stage-panel-surface={resolvedSurface}
227
+ class={[frameClass, 'stage-panel-fallback', pose ? 'stage-panel-posed' : '']
228
+ .filter(Boolean)
229
+ .join(' ')}
230
+ style={getFallbackStyle()}
231
+ >
232
+ <div
233
+ bind:this={surfaceElement}
234
+ data-stage-panel-css-surface
235
+ data-catalog-transition-group={transitionGroup}
236
+ data-stage-panel-minimap={minimap ? '' : undefined}
237
+ data-stage-panel-surface={resolvedSurface}
238
+ class="stage-panel-surface"
239
+ style={getFallbackStyle()}
240
+ >
241
+ <div
242
+ {...rest}
243
+ bind:this={contentElement}
244
+ use:registerEndpoint={catalogEndpoint}
245
+ data-stage-panel-content
246
+ data-catalog-transition-group={transitionGroup}
247
+ class={contentClass}
248
+ style={getContentThemeStyle()}
249
+ >
250
+ {@render children?.()}
251
+ </div>
252
+ </div>
253
+ </div>
254
+
255
+ <style>
256
+ .stage-panel-fallback {
257
+ z-index: 2;
258
+ box-sizing: border-box;
259
+ border-radius: var(--stage-panel-radius);
260
+ }
261
+
262
+ .stage-panel-posed {
263
+ position: absolute;
264
+ left: calc(50% + var(--stage-panel-x) - var(--stage-panel-width) / 2);
265
+ top: calc(50% - var(--stage-panel-y) - var(--stage-panel-height) / 2);
266
+ width: var(--stage-panel-width);
267
+ height: var(--stage-panel-height);
268
+ }
269
+
270
+ .stage-panel-surface {
271
+ position: relative;
272
+ z-index: 1;
273
+ box-sizing: border-box;
274
+ width: 100%;
275
+ height: 100%;
276
+ padding: var(--stage-panel-content-inset);
277
+ border-radius: var(--stage-panel-radius);
278
+ /* Keep opacity/filter off the element that owns backdrop-filter. Chrome
279
+ * otherwise creates a new Backdrop Root as soon as zoom starts. */
280
+ opacity: 1;
281
+ transform: translateZ(0);
282
+ transform-style: preserve-3d;
283
+ }
284
+
285
+ :global([data-stage-panel-content]) {
286
+ transform-style: preserve-3d;
287
+ /* Content can leave its CSS surface when glass uses the DOM projection layer. */
288
+ opacity: calc(
289
+ var(--stage-panel-opacity, 1) * var(--stage-panel-content-opacity, 1) *
290
+ var(--stage-transition-opacity, 1)
291
+ );
292
+ }
293
+
294
+ /* A settled panel leaves every perspective ancestor so browser-native text
295
+ * rasterization can be used until spatial motion starts again. */
296
+ :global([data-stage-panel-render-mode='native']),
297
+ :global([data-stage-panel-content][data-stage-panel-render-mode='native']),
298
+ :global([data-stage-panel-render-mode='native'] [data-stage-panel-content]) {
299
+ transform-style: flat;
300
+ }
301
+
302
+ .stage-panel-surface::before,
303
+ .stage-panel-surface::after {
304
+ position: absolute;
305
+ inset: 0;
306
+ border-radius: inherit;
307
+ pointer-events: none;
308
+ content: '';
309
+ opacity: calc(
310
+ var(--stage-panel-opacity) * var(--stage-panel-surface-opacity, 1) *
311
+ var(--stage-panel-focus-opacity, 1) * var(--stage-transition-opacity, 1)
312
+ );
313
+ }
314
+
315
+ .stage-panel-surface::before {
316
+ background: rgb(var(--stage-panel-tint-rgb) / var(--stage-panel-tint-opacity));
317
+ box-shadow:
318
+ var(--stage-panel-box-shadow),
319
+ inset 0 0 var(--stage-panel-bezel) rgb(16 24 32 / calc(var(--stage-panel-thickness) * 0.12));
320
+ -webkit-backdrop-filter: blur(var(--stage-panel-css-blur));
321
+ backdrop-filter: blur(var(--stage-panel-css-blur));
322
+ }
323
+
324
+ .stage-panel-surface[data-stage-panel-surface='solid']::before {
325
+ -webkit-backdrop-filter: none;
326
+ backdrop-filter: none;
327
+ }
328
+
329
+ .stage-panel-surface::after {
330
+ inset: 0;
331
+ background:
332
+ radial-gradient(120% 72% at 50% 0%, rgb(255 255 255 / 0.72), transparent 58%),
333
+ linear-gradient(145deg, rgb(255 255 255 / 0.58), transparent 42%);
334
+ box-shadow: inset 0 0 var(--stage-panel-bezel) rgb(255 255 255 / 0.36);
335
+ mix-blend-mode: screen;
336
+ opacity: calc(
337
+ var(--stage-panel-opacity) * var(--stage-panel-surface-opacity, 1) *
338
+ var(--stage-panel-focus-opacity, 1) * var(--stage-panel-specular-opacity) *
339
+ var(--stage-transition-opacity, 1)
340
+ );
341
+ }
342
+
343
+ .stage-panel-surface[data-stage-panel-surface='solid']::after,
344
+ .stage-panel-surface[data-stage-panel-surface='frosted']::after {
345
+ display: none;
346
+ }
347
+
348
+ .stage-panel-surface :global([data-stage-panel-content]) {
349
+ position: relative;
350
+ z-index: 1;
351
+ box-sizing: border-box;
352
+ width: 100%;
353
+ height: 100%;
354
+ }
355
+ </style>
@@ -0,0 +1,24 @@
1
+ import type { HTMLAttributes } from "svelte/elements";
2
+ import type { Snippet } from 'svelte';
3
+ import { type StagePanelMinimapOptions, type StagePanelPose, type StagePanelShape, type StagePanelTheme } from '@spatial-elements/core/stage/panelContext';
4
+ import type { StagePanelSurface } from '@spatial-elements/core/stage/stageTypes';
5
+ import type { CatalogTransitionGroup } from '@spatial-elements/core/catalog/catalogPresentation';
6
+ import type { CatalogEndpointAddress } from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
7
+ type StagePanelAttributes = HTMLAttributes<HTMLDivElement>;
8
+ type Props = Omit<StagePanelAttributes, 'class'> & {
9
+ children?: Snippet;
10
+ class?: string;
11
+ contentClass?: string;
12
+ minimap?: boolean | StagePanelMinimapOptions;
13
+ /** Enables proximity lift and pointer-driven tilt. Defaults to true. */
14
+ pointerReactive?: boolean;
15
+ pose?: StagePanelPose;
16
+ shape: StagePanelShape;
17
+ surface?: StagePanelSurface;
18
+ theme?: StagePanelTheme;
19
+ transitionGroup?: CatalogTransitionGroup;
20
+ catalogEndpoint?: CatalogEndpointAddress;
21
+ };
22
+ declare const Panel: import("svelte").Component<Props, {}, "">;
23
+ type Panel = ReturnType<typeof Panel>;
24
+ export default Panel;