@spatial-elements/sveltekit 0.1.0-beta.2 → 1.0.0-beta.11

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 (133) hide show
  1. package/README.md +18 -13
  2. package/dist/catalog/ScrollNavigationBridge.svelte +172 -47
  3. package/dist/catalog/ScrollNavigationBridge.svelte.d.ts +9 -2
  4. package/dist/catalog/catalogNavigation.js +3 -2
  5. package/dist/catalog/catalogSummaryTransfer.d.ts +16 -0
  6. package/dist/catalog/catalogSummaryTransfer.js +79 -0
  7. package/dist/catalog/catalogTransition.css +58 -3
  8. package/dist/catalog/interruptedPresentation.d.ts +10 -0
  9. package/dist/catalog/interruptedPresentation.js +29 -0
  10. package/dist/catalog/presentationCleanup.d.ts +4 -0
  11. package/dist/catalog/presentationCleanup.js +20 -0
  12. package/dist/catalog/stagedCatalogNavigation.d.ts +44 -0
  13. package/dist/catalog/stagedCatalogNavigation.js +403 -0
  14. package/dist/catalog/stagedDomReveal.d.ts +8 -0
  15. package/dist/catalog/stagedDomReveal.js +76 -0
  16. package/dist/index.d.ts +4 -0
  17. package/dist/index.js +3 -0
  18. package/dist/spatial-element/BrandStageShell.svelte +52 -71
  19. package/dist/spatial-element/BrandStageShell.svelte.d.ts +31 -4
  20. package/dist/spatial-element/CarouselSpatialElement.svelte +152 -200
  21. package/dist/spatial-element/CarouselSpatialElement.svelte.d.ts +5 -1
  22. package/dist/spatial-element/ContentBlock.svelte +7 -0
  23. package/dist/spatial-element/ContentBlock.svelte.d.ts +9 -0
  24. package/dist/spatial-element/ContentGrid.svelte +7 -0
  25. package/dist/spatial-element/ContentGrid.svelte.d.ts +8 -0
  26. package/dist/spatial-element/ContentPage.svelte +51 -55
  27. package/dist/spatial-element/ContentPage.svelte.d.ts +14 -3
  28. package/dist/spatial-element/InteractionGesture.svelte +39 -0
  29. package/dist/spatial-element/InteractionGesture.svelte.d.ts +7 -0
  30. package/dist/spatial-element/OverflowControls.svelte +129 -0
  31. package/dist/spatial-element/OverflowControls.svelte.d.ts +9 -0
  32. package/dist/spatial-element/PointerHint.svelte +80 -0
  33. package/dist/spatial-element/PointerHint.svelte.d.ts +3 -0
  34. package/dist/spatial-element/Section.svelte +25 -106
  35. package/dist/spatial-element/Section.svelte.d.ts +1 -0
  36. package/dist/spatial-element/SectionSurfaceGroup.svelte +8 -0
  37. package/dist/spatial-element/SectionSurfaceGroup.svelte.d.ts +8 -0
  38. package/dist/spatial-element/SpaceMouseControl.svelte +159 -0
  39. package/dist/spatial-element/SpaceMouseControl.svelte.d.ts +7 -0
  40. package/dist/spatial-element/SpaceMouseIcon.svelte +12 -0
  41. package/dist/spatial-element/SpaceMouseIcon.svelte.d.ts +26 -0
  42. package/dist/spatial-element/SpatialCardGridSection.svelte +79 -0
  43. package/dist/spatial-element/SpatialCardGridSection.svelte.d.ts +11 -0
  44. package/dist/spatial-element/SpatialCardPresentation.svelte +311 -0
  45. package/dist/spatial-element/SpatialCardPresentation.svelte.d.ts +19 -0
  46. package/dist/spatial-element/SpatialCardSlot.svelte +33 -0
  47. package/dist/spatial-element/SpatialCardSlot.svelte.d.ts +8 -0
  48. package/dist/spatial-element/SpatialCarouselSection.svelte +754 -0
  49. package/dist/spatial-element/{CarouselSection.svelte.d.ts → SpatialCarouselSection.svelte.d.ts} +5 -5
  50. package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +12 -65
  51. package/dist/spatial-element/SpatialElementCard.svelte +54 -238
  52. package/dist/spatial-element/SpatialElementCard.svelte.d.ts +9 -0
  53. package/dist/spatial-element/SpatialElementHelp.svelte +300 -0
  54. package/dist/spatial-element/SpatialElementHelp.svelte.d.ts +6 -0
  55. package/dist/spatial-element/SpatialElementMediaRail.svelte +322 -52
  56. package/dist/spatial-element/SpatialElementMediaRail.svelte.d.ts +4 -1
  57. package/dist/spatial-element/SpatialElementNativeMedia.svelte +101 -0
  58. package/dist/spatial-element/SpatialElementNativeMedia.svelte.d.ts +9 -0
  59. package/dist/spatial-element/SpatialElementPage.svelte +156 -71
  60. package/dist/spatial-element/SpatialElementPage.svelte.d.ts +10 -3
  61. package/dist/spatial-element/SpatialElementStickyHeader.svelte +89 -105
  62. package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +6 -1
  63. package/dist/spatial-element/SpatialElementSummaryContent.svelte +198 -0
  64. package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +23 -0
  65. package/dist/spatial-element/SpatialElementSummaryPanel.svelte +48 -380
  66. package/dist/spatial-element/SpatialElementSummaryPanel.svelte.d.ts +2 -1
  67. package/dist/spatial-element/SpatialElementTabList.svelte +40 -17
  68. package/dist/spatial-element/SpatialElementTabList.svelte.d.ts +2 -1
  69. package/dist/spatial-element/SpatialElementTabs.svelte +61 -18
  70. package/dist/spatial-element/SpatialElementTabs.svelte.d.ts +3 -1
  71. package/dist/spatial-element/SpatialElementViewToggle.svelte +54 -0
  72. package/dist/spatial-element/SpatialElementViewToggle.svelte.d.ts +8 -0
  73. package/dist/spatial-element/SpatialIconButton.svelte +66 -0
  74. package/dist/spatial-element/SpatialIconButton.svelte.d.ts +17 -0
  75. package/dist/spatial-element/SpatialListPage.svelte +37 -8
  76. package/dist/spatial-element/SpatialListPage.svelte.d.ts +4 -1
  77. package/dist/spatial-element/SpatialMediaIndicator.svelte +16 -0
  78. package/dist/spatial-element/SpatialMediaIndicator.svelte.d.ts +26 -0
  79. package/dist/spatial-element/SpatialNavigationShell.svelte +138 -0
  80. package/dist/spatial-element/SpatialNavigationShell.svelte.d.ts +15 -0
  81. package/dist/spatial-element/SpatialSummaryHost.svelte +19 -0
  82. package/dist/spatial-element/SpatialSummaryHost.svelte.d.ts +9 -0
  83. package/dist/spatial-element/SpatialSummaryRoot.svelte +80 -0
  84. package/dist/spatial-element/SpatialSummaryRoot.svelte.d.ts +8 -0
  85. package/dist/spatial-element/SpatialSummarySlot.svelte +39 -0
  86. package/dist/spatial-element/SpatialSummarySlot.svelte.d.ts +9 -0
  87. package/dist/spatial-element/SpatialViewIcon.svelte +29 -0
  88. package/dist/spatial-element/SpatialViewIcon.svelte.d.ts +6 -0
  89. package/dist/spatial-element/brandContext.d.ts +1 -1
  90. package/dist/spatial-element/brandContext.js +1 -1
  91. package/dist/spatial-element/cardAppearanceFreeze.d.ts +5 -0
  92. package/dist/spatial-element/cardAppearanceFreeze.js +72 -0
  93. package/dist/spatial-element/carouselTextHit.d.ts +2 -0
  94. package/dist/spatial-element/carouselTextHit.js +17 -0
  95. package/dist/spatial-element/contentSidebars.d.ts +3 -0
  96. package/dist/spatial-element/contentSidebars.js +56 -0
  97. package/dist/spatial-element/index.d.ts +19 -3
  98. package/dist/spatial-element/index.js +12 -2
  99. package/dist/spatial-element/layout.generated.css +363 -0
  100. package/dist/spatial-element/messagesContext.d.ts +3 -0
  101. package/dist/spatial-element/messagesContext.js +10 -0
  102. package/dist/spatial-element/presentationBoxFreeze.d.ts +8 -0
  103. package/dist/spatial-element/presentationBoxFreeze.js +35 -0
  104. package/dist/spatial-element/spatialCardGrid.d.ts +12 -0
  105. package/dist/spatial-element/spatialCardGrid.js +1 -0
  106. package/dist/spatial-element/spatialPageContext.d.ts +4 -0
  107. package/dist/spatial-element/spatialPageContext.js +9 -0
  108. package/dist/spatial-element/spatialPresentationOwner.d.ts +6 -0
  109. package/dist/spatial-element/spatialPresentationOwner.js +2 -0
  110. package/dist/spatial-element/spatialSummary.d.ts +43 -0
  111. package/dist/spatial-element/spatialSummary.js +1 -0
  112. package/dist/spatial-element/spatialSummaryHost.svelte.d.ts +60 -0
  113. package/dist/spatial-element/spatialSummaryHost.svelte.js +233 -0
  114. package/dist/spatial-element/spatialThemeStyle.d.ts +3 -0
  115. package/dist/spatial-element/spatialThemeStyle.js +69 -0
  116. package/dist/spatial-element/truncatedTitle.d.ts +5 -0
  117. package/dist/spatial-element/truncatedTitle.js +28 -0
  118. package/dist/stage/ButtonGroup.svelte +152 -0
  119. package/dist/stage/ButtonGroup.svelte.d.ts +24 -0
  120. package/dist/stage/Panel.svelte +72 -14
  121. package/dist/stage/Panel.svelte.d.ts +14 -2
  122. package/dist/stage/Stage.svelte +471 -51
  123. package/dist/stage/Stage.svelte.d.ts +8 -1
  124. package/dist/stage/StageViewport.svelte +15 -2
  125. package/dist/stage/authoredStyle.d.ts +4 -0
  126. package/dist/stage/authoredStyle.js +17 -0
  127. package/dist/stage/buttonGroup.d.ts +9 -0
  128. package/dist/stage/buttonGroup.js +1 -0
  129. package/logo.svg +225 -0
  130. package/package.json +9 -6
  131. package/dist/spatial-element/CarouselSection.svelte +0 -350
  132. package/dist/spatial-element/ListSection.svelte +0 -30
  133. package/dist/spatial-element/ListSection.svelte.d.ts +0 -8
@@ -1,95 +1,76 @@
1
1
  <script lang="ts">
2
+ import type { MenuItem } from '@page-sections/core';
2
3
  import type { Snippet } from 'svelte';
4
+ import '@page-sections/svelte/styles.css';
5
+ import { retainDeviceOrientationPermission } from '@spatial-elements/core/catalog/listDeviceOrientation';
3
6
  import Stage from '../stage/Stage.svelte';
4
- import type { CatalogPage } from '@spatial-elements/core/catalog/catalogPage';
5
- import { getCssPanelBoxShadow, resolvePanelShadowStrength } from '@spatial-elements/core/stage/panelShadow';
7
+ import PointerHint from './PointerHint.svelte';
8
+ import SpatialNavigationShell from './SpatialNavigationShell.svelte';
9
+ import SpatialSummaryHost from './SpatialSummaryHost.svelte';
10
+ import type { SpatialSummarySnippet } from './spatialSummary.js';
11
+ import type { StageRenderSettings } from '@spatial-elements/core';
12
+ import { getSpatialThemeStyle } from './spatialThemeStyle.js';
6
13
  import { provideSpatialTheme } from './brandContext.js';
7
- import type { SpatialTheme, SpatialStageConfig } from '@spatial-elements/core/spatial-element/types';
14
+ import { provideSpatialMessages } from './messagesContext.js';
15
+ import type { SpatialMessagesInput } from '@spatial-elements/core/spatial-element/messages';
16
+ import type { SpatialTheme } from '@spatial-elements/core/spatial-element/types';
8
17
 
9
18
  interface Props {
19
+ /** Enable sensor motion on detail geometry and minimaps. Lists opt in independently. */
20
+ deviceOrientation?: boolean;
21
+ /** Shared appearance and namespace. Use createSpatialTheme for defaults. */
10
22
  theme: SpatialTheme;
11
- stage: SpatialStageConfig;
12
- catalog?: CatalogPage;
23
+ /** Resolved by the host. System preference and persistence belong to the shell. */
24
+ colorScheme?: 'light' | 'dark';
25
+ /** Localized interface copy. Missing groups/strings fall back to English; updates are reactive. */
26
+ messages?: SpatialMessagesInput;
27
+ /** Optional GPU resolution budget; defaults to DPR 1 and 2,073,600 pixels. */
28
+ renderSettings?: StageRenderSettings;
29
+ /** Draco decoder directory, including trailing slash. Default: /assets/draco/gltf/; the host must serve the files. */
30
+ dracoDecoderPath?: string;
31
+ /** Layout contents. ContentPage and SpatialElementPage register their own data. */
13
32
  children?: Snippet;
33
+ /** Persistent main-menu content. The shell owns its box and surface. */
34
+ menu?: Snippet;
35
+ /** Complete application navigation; the spatial shell supplies positioning and surfaces. */
36
+ navigation?: Snippet;
37
+ /** Shared responsive navigation; menu remains a custom-content escape hatch. */
38
+ items?: MenuItem[];
39
+ brand?: Snippet;
40
+ tools?: Snippet;
41
+ /** Persistent, synchronous summary content. Receives element data and the presentation mode. */
42
+ summary?: SpatialSummarySnippet;
43
+ /** Optional 80x40 satellite contents, visible from XL and available through Settings on smaller layouts. */
44
+ left?: Snippet;
45
+ right?: Snippet;
14
46
  }
15
47
 
16
- let { theme, stage, catalog, children }: Props = $props();
48
+ let { theme, colorScheme, messages, renderSettings, dracoDecoderPath, children, menu, navigation, items, brand, tools, summary, left, right, deviceOrientation = false }: Props = $props();
49
+ $effect(() => {
50
+ if (deviceOrientation) return retainDeviceOrientationPermission();
51
+ });
17
52
 
18
53
  provideSpatialTheme(() => theme);
54
+ provideSpatialMessages(() => messages);
19
55
 
20
- const brandStyle = $derived(
21
- [
22
- `--spatial-element-background: ${theme.background}`,
23
- `--spatial-element-ink: ${theme.colors.ink}`,
24
- `--spatial-element-body: ${theme.colors.body}`,
25
- `--spatial-element-accent: ${theme.colors.accent}`,
26
- `--spatial-element-on-accent: ${theme.colors.onAccent}`,
27
- `--spatial-element-section-tint: ${theme.sectionTheme.tint}`,
28
- `--spatial-element-section-tint-opacity: ${toPercentage(theme.sectionTheme.tintOpacity)}`,
29
- `--spatial-element-section-backdrop-blur: ${Math.max(theme.sectionTheme.backdropBlur, 0)}px`,
30
- `--spatial-element-tab-background: ${theme.colors.tabBackground}`,
31
- `--spatial-element-panel-radius: ${theme.panelShape.radius}px`,
32
- `--spatial-element-docked-panel-tint-rgb: ${getDockedPanelTintRgb(theme.dockedPanelTheme.tint)}`,
33
- `--spatial-element-docked-panel-tint-opacity: ${clamp(theme.dockedPanelTheme.tintOpacity, 0, 1)}`,
34
- `--spatial-element-docked-panel-shadow-intensity: ${clamp(theme.dockedPanelTheme.shadowIntensity, 0, 1)}`,
35
- `--spatial-element-docked-panel-shadow-strength: ${resolvePanelShadowStrength(theme.dockedPanelTheme.shadowIntensity)}`,
36
- `--spatial-element-docked-panel-box-shadow: ${getCssPanelBoxShadow(theme.dockedPanelTheme.shadowIntensity)}`,
37
- `--spatial-element-docked-panel-backdrop-blur: ${Math.min(
38
- Math.max(theme.dockedPanelTheme.backdropBlur, 0),
39
- 100
40
- )}px`
41
- ].join('; ')
42
- );
43
-
44
- function toPercentage(value: number) {
45
- return `${clamp(value, 0, 1) * 100}%`;
46
- }
47
-
48
- function getDockedPanelTintRgb(tint: SpatialTheme['dockedPanelTheme']['tint']) {
49
- const value = tint;
50
-
51
- if (typeof value === 'number') {
52
- return hexToRgb(value.toString(16).padStart(6, '0'));
53
- }
54
-
55
- if (typeof value === 'string') {
56
- const hex = value.trim().replace(/^#/, '');
57
- if (/^[0-9a-f]{3}$/i.test(hex)) {
58
- return hexToRgb(hex.replace(/(.)/g, '$1$1'));
59
- }
60
- if (/^[0-9a-f]{6}$/i.test(hex)) {
61
- return hexToRgb(hex);
62
- }
63
- }
64
-
65
- return '255 255 255';
66
- }
67
-
68
- function hexToRgb(hex: string) {
69
- const value = Number.parseInt(hex, 16);
70
- return `${(value >> 16) & 255} ${(value >> 8) & 255} ${value & 255}`;
71
- }
72
-
73
- function clamp(value: number, min: number, max: number) {
74
- return Math.min(Math.max(value, min), max);
75
- }
56
+ const brandStyle = $derived(getSpatialThemeStyle(theme));
76
57
  </script>
77
58
 
78
- <div class="brand-stage-shell" style={brandStyle}>
59
+ <div class="brand-stage-shell" style={brandStyle} style:color-scheme={colorScheme} data-color-scheme={colorScheme}>
79
60
  <Stage
80
- {catalog}
81
- background={stage.background}
61
+ {deviceOrientation}
62
+ brandId={theme.id}
63
+ {renderSettings}
64
+ {dracoDecoderPath}
82
65
  pageBackground={theme.background}
83
- hdr={stage.hdr}
84
- glb={stage.glb}
85
- lodPair={stage.lodPair}
86
- model={stage.model}
87
- camera={stage.camera}
66
+ sceneBackground={theme.sceneBackground}
88
67
  interactionTheme={theme.interactionTheme}
89
68
  ariaLabel={`${theme.name} spatialElement stage`}
90
69
  >
91
- {@render children?.()}
70
+ {#if navigation || menu || items || brand || left || right}<SpatialNavigationShell {navigation} {menu} {items} {brand} {tools} {left} {right} />{/if}
71
+ <SpatialSummaryHost {summary}>{@render children?.()}</SpatialSummaryHost>
92
72
  </Stage>
73
+ <PointerHint />
93
74
  </div>
94
75
 
95
76
  <style>
@@ -1,11 +1,38 @@
1
+ import type { MenuItem } from '@page-sections/core';
1
2
  import type { Snippet } from 'svelte';
2
- import type { CatalogPage } from '@spatial-elements/core/catalog/catalogPage';
3
- import type { SpatialTheme, SpatialStageConfig } from '@spatial-elements/core/spatial-element/types';
3
+ import '@page-sections/svelte/styles.css';
4
+ import type { SpatialSummarySnippet } from './spatialSummary.js';
5
+ import type { StageRenderSettings } from '@spatial-elements/core';
6
+ import type { SpatialMessagesInput } from '@spatial-elements/core/spatial-element/messages';
7
+ import type { SpatialTheme } from '@spatial-elements/core/spatial-element/types';
4
8
  interface Props {
9
+ /** Enable sensor motion on detail geometry and minimaps. Lists opt in independently. */
10
+ deviceOrientation?: boolean;
11
+ /** Shared appearance and namespace. Use createSpatialTheme for defaults. */
5
12
  theme: SpatialTheme;
6
- stage: SpatialStageConfig;
7
- catalog?: CatalogPage;
13
+ /** Resolved by the host. System preference and persistence belong to the shell. */
14
+ colorScheme?: 'light' | 'dark';
15
+ /** Localized interface copy. Missing groups/strings fall back to English; updates are reactive. */
16
+ messages?: SpatialMessagesInput;
17
+ /** Optional GPU resolution budget; defaults to DPR 1 and 2,073,600 pixels. */
18
+ renderSettings?: StageRenderSettings;
19
+ /** Draco decoder directory, including trailing slash. Default: /assets/draco/gltf/; the host must serve the files. */
20
+ dracoDecoderPath?: string;
21
+ /** Layout contents. ContentPage and SpatialElementPage register their own data. */
8
22
  children?: Snippet;
23
+ /** Persistent main-menu content. The shell owns its box and surface. */
24
+ menu?: Snippet;
25
+ /** Complete application navigation; the spatial shell supplies positioning and surfaces. */
26
+ navigation?: Snippet;
27
+ /** Shared responsive navigation; menu remains a custom-content escape hatch. */
28
+ items?: MenuItem[];
29
+ brand?: Snippet;
30
+ tools?: Snippet;
31
+ /** Persistent, synchronous summary content. Receives element data and the presentation mode. */
32
+ summary?: SpatialSummarySnippet;
33
+ /** Optional 80x40 satellite contents, visible from XL and available through Settings on smaller layouts. */
34
+ left?: Snippet;
35
+ right?: Snippet;
9
36
  }
10
37
  declare const BrandStageShell: import("svelte").Component<Props, {}, "">;
11
38
  type BrandStageShell = ReturnType<typeof BrandStageShell>;