@spatial-elements/sveltekit 1.0.0-beta.4 → 1.0.0-beta.6
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.
- package/README.md +6 -2
- package/dist/catalog/catalogTransition.css +12 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/spatial-element/BrandStageShell.svelte +9 -59
- package/dist/spatial-element/BrandStageShell.svelte.d.ts +2 -0
- package/dist/spatial-element/CarouselSection.svelte +339 -323
- package/dist/spatial-element/CarouselSection.svelte.d.ts +2 -7
- package/dist/spatial-element/CarouselSpatialElement.svelte +142 -127
- package/dist/spatial-element/CarouselSpatialElement.svelte.d.ts +5 -1
- package/dist/spatial-element/ContentPage.svelte +2 -1
- package/dist/spatial-element/PointerHint.svelte +78 -0
- package/dist/spatial-element/PointerHint.svelte.d.ts +3 -0
- package/dist/spatial-element/SpatialElementCard.svelte +68 -2
- package/dist/spatial-element/SpatialElementHelp.svelte +23 -14
- package/dist/spatial-element/SpatialElementMediaRail.svelte +22 -3
- package/dist/spatial-element/SpatialElementPage.svelte +2 -4
- package/dist/spatial-element/SpatialElementSummaryContent.svelte +182 -0
- package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +18 -0
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte +29 -375
- package/dist/spatial-element/SpatialElementTabs.svelte +2 -1
- package/dist/spatial-element/SpatialElementViewToggle.svelte +53 -0
- package/dist/spatial-element/SpatialElementViewToggle.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialIconButton.svelte +2 -1
- package/dist/spatial-element/brandContext.d.ts +1 -1
- package/dist/spatial-element/brandContext.js +1 -1
- package/dist/spatial-element/carouselTextHit.d.ts +2 -0
- package/dist/spatial-element/carouselTextHit.js +17 -0
- package/dist/spatial-element/spatialThemeStyle.d.ts +3 -0
- package/dist/spatial-element/spatialThemeStyle.js +48 -0
- package/dist/spatial-element/truncatedTitle.d.ts +5 -0
- package/dist/spatial-element/truncatedTitle.js +28 -0
- package/dist/stage/ButtonGroup.svelte +163 -0
- package/dist/stage/ButtonGroup.svelte.d.ts +24 -0
- package/dist/stage/Panel.svelte +24 -9
- package/dist/stage/Stage.svelte +91 -5
- package/dist/stage/Stage.svelte.d.ts +2 -0
- package/dist/stage/StageViewport.svelte +7 -1
- package/dist/stage/authoredStyle.d.ts +4 -0
- package/dist/stage/authoredStyle.js +17 -0
- package/dist/stage/buttonGroup.d.ts +9 -0
- package/dist/stage/buttonGroup.js +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
SvelteKit components and navigation for Spatial Elements.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Pass a reactive `theme` and optional resolved `colorScheme` (`light` or `dark`) to `BrandStageShell` for live appearance changes. The host owns system preference and persistence. The public `ButtonGroup` component can implement a theme switch, language selector or other choices. See [runtime themes and ButtonGroup](https://github.com/LauridBergjohann/spatial-elements/blob/main/docs/theming.md).
|
|
6
|
+
|
|
7
|
+
Detail pages include 3D help and a detail/fullscreen view switch, with a viewport fallback when native fullscreen is unavailable. Pass optional `messages` to `BrandStageShell` to translate labels, tooltips and instructions, including `controls.detailView` and `controls.fullscreen`; missing strings use English defaults. See [interface texts and help](https://github.com/LauridBergjohann/spatial-elements/blob/main/docs/interface-texts.md) for the complete typed dictionary and examples.
|
|
8
|
+
|
|
9
|
+
The detail button always restores the fitted camera view, including when already on the detail page. Its selected background fades with camera zoom; the fullscreen button remains selected throughout fullscreen navigation.
|
|
6
10
|
|
|
7
11
|
See the [authoring guide](https://github.com/LauridBergjohann/spatial-elements/blob/main/docs/authoring.md) and [development guide](https://github.com/LauridBergjohann/spatial-elements/blob/main/docs/development.md).
|
|
8
12
|
|
|
@@ -10,7 +14,7 @@ Beta API; MPL-2.0; see LICENSE.
|
|
|
10
14
|
|
|
11
15
|
Read the [getting-started tutorial](https://github.com/LauridBergjohann/spatial-elements/blob/main/docs/getting-started.md), [API reference](https://github.com/LauridBergjohann/spatial-elements/blob/main/docs/api.md) and [configuration migration](https://github.com/LauridBergjohann/spatial-elements/blob/main/docs/configuration-migration.md).
|
|
12
16
|
|
|
13
|
-
Element content and required `geometry: { low, high }` belong in `SpatialElementData`; shared appearance belongs in `SpatialTheme`. Use `createSpatialTheme({ id, name })` for defaults. The SvelteKit shell needs only the theme; pages register their own data. These docs target version `1.0.0-beta.
|
|
17
|
+
Element content and required `geometry: { low, high }` belong in `SpatialElementData`; shared appearance belongs in `SpatialTheme`. Use `createSpatialTheme({ id, name })` for defaults. The SvelteKit shell needs only the theme; pages register their own data. These docs target version `1.0.0-beta.5` and newer.
|
|
14
18
|
|
|
15
19
|
Installation:
|
|
16
20
|
|
|
@@ -57,3 +57,15 @@
|
|
|
57
57
|
.stage[data-catalog-transition] [data-catalog-transition-group] * {
|
|
58
58
|
pointer-events: none !important;
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
/* The persistent shell is already present at both restored scroll positions. */
|
|
62
|
+
.stage[data-catalog-transition] [data-catalog-shell-continuous] {
|
|
63
|
+
--catalog-content-opacity: 1;
|
|
64
|
+
--stage-transition-opacity: 1;
|
|
65
|
+
opacity: 1 !important;
|
|
66
|
+
visibility: visible !important;
|
|
67
|
+
}
|
|
68
|
+
.stage[data-catalog-transition] [data-catalog-shell-continuous] [data-catalog-transition-group='enter'] {
|
|
69
|
+
--stage-transition-opacity: 1;
|
|
70
|
+
visibility: visible !important;
|
|
71
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,3 +4,6 @@ export { default as Stage } from './stage/Stage.svelte';
|
|
|
4
4
|
export { default as StageViewport } from './stage/StageViewport.svelte';
|
|
5
5
|
export { catalogViewLink } from '@spatial-elements/core';
|
|
6
6
|
export { default as ScrollNavigationBridge } from './catalog/ScrollNavigationBridge.svelte';
|
|
7
|
+
export { default as ButtonGroup } from './stage/ButtonGroup.svelte';
|
|
8
|
+
export type { ButtonGroupItem } from './stage/buttonGroup.js';
|
|
9
|
+
export { getSpatialThemeStyle } from './spatial-element/spatialThemeStyle.js';
|
package/dist/index.js
CHANGED
|
@@ -4,3 +4,5 @@ export { default as Stage } from './stage/Stage.svelte';
|
|
|
4
4
|
export { default as StageViewport } from './stage/StageViewport.svelte';
|
|
5
5
|
export { catalogViewLink } from '@spatial-elements/core';
|
|
6
6
|
export { default as ScrollNavigationBridge } from './catalog/ScrollNavigationBridge.svelte';
|
|
7
|
+
export { default as ButtonGroup } from './stage/ButtonGroup.svelte';
|
|
8
|
+
export { getSpatialThemeStyle } from './spatial-element/spatialThemeStyle.js';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import Stage from '../stage/Stage.svelte';
|
|
4
|
+
import PointerHint from './PointerHint.svelte';
|
|
4
5
|
import type { StageRenderSettings } from '@spatial-elements/core';
|
|
5
|
-
import {
|
|
6
|
+
import { getSpatialThemeStyle } from './spatialThemeStyle.js';
|
|
6
7
|
import { provideSpatialTheme } from './brandContext.js';
|
|
7
8
|
import { provideSpatialMessages } from './messagesContext.js';
|
|
8
9
|
import type { SpatialMessagesInput } from '@spatial-elements/core/spatial-element/messages';
|
|
@@ -11,6 +12,8 @@
|
|
|
11
12
|
interface Props {
|
|
12
13
|
/** Shared appearance and namespace. Use createSpatialTheme for defaults. */
|
|
13
14
|
theme: SpatialTheme;
|
|
15
|
+
/** Resolved by the host. System preference and persistence belong to the shell. */
|
|
16
|
+
colorScheme?: 'light' | 'dark';
|
|
14
17
|
/** Localized interface copy. Missing groups/strings fall back to English; updates are reactive. */
|
|
15
18
|
messages?: SpatialMessagesInput;
|
|
16
19
|
/** Optional GPU resolution budget; defaults to DPR 1 and 2,073,600 pixels. */
|
|
@@ -21,80 +24,27 @@
|
|
|
21
24
|
children?: Snippet;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
let { theme, messages, renderSettings, dracoDecoderPath, children }: Props = $props();
|
|
27
|
+
let { theme, colorScheme, messages, renderSettings, dracoDecoderPath, children }: Props = $props();
|
|
25
28
|
|
|
26
29
|
provideSpatialTheme(() => theme);
|
|
27
30
|
provideSpatialMessages(() => messages);
|
|
28
31
|
|
|
29
|
-
const brandStyle = $derived(
|
|
30
|
-
[
|
|
31
|
-
`--spatial-element-background: ${theme.background}`,
|
|
32
|
-
`--spatial-element-ink: ${theme.colors.ink}`,
|
|
33
|
-
`--spatial-element-body: ${theme.colors.body}`,
|
|
34
|
-
`--spatial-element-accent: ${theme.colors.accent}`,
|
|
35
|
-
`--spatial-element-on-accent: ${theme.colors.onAccent}`,
|
|
36
|
-
`--spatial-element-section-tint: ${theme.sectionTheme.tint}`,
|
|
37
|
-
`--spatial-element-section-tint-opacity: ${toPercentage(theme.sectionTheme.tintOpacity)}`,
|
|
38
|
-
`--spatial-element-section-backdrop-blur: ${Math.max(theme.sectionTheme.backdropBlur, 0)}px`,
|
|
39
|
-
`--spatial-element-tab-background: ${theme.colors.tabBackground}`,
|
|
40
|
-
`--spatial-element-panel-radius: ${theme.panelShape.radius}px`,
|
|
41
|
-
`--spatial-element-docked-panel-tint-rgb: ${getDockedPanelTintRgb(theme.dockedPanelTheme.tint)}`,
|
|
42
|
-
`--spatial-element-docked-panel-tint-opacity: ${clamp(theme.dockedPanelTheme.tintOpacity, 0, 1)}`,
|
|
43
|
-
`--spatial-element-docked-panel-shadow-intensity: ${clamp(theme.dockedPanelTheme.shadowIntensity, 0, 1)}`,
|
|
44
|
-
`--spatial-element-docked-panel-shadow-strength: ${resolvePanelShadowStrength(theme.dockedPanelTheme.shadowIntensity)}`,
|
|
45
|
-
`--spatial-element-docked-panel-box-shadow: ${getCssPanelBoxShadow(theme.dockedPanelTheme.shadowIntensity)}`,
|
|
46
|
-
`--spatial-element-docked-panel-backdrop-blur: ${Math.min(
|
|
47
|
-
Math.max(theme.dockedPanelTheme.backdropBlur, 0),
|
|
48
|
-
100
|
|
49
|
-
)}px`
|
|
50
|
-
].join('; ')
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
function toPercentage(value: number) {
|
|
54
|
-
return `${clamp(value, 0, 1) * 100}%`;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function getDockedPanelTintRgb(tint: SpatialTheme['dockedPanelTheme']['tint']) {
|
|
58
|
-
const value = tint;
|
|
59
|
-
|
|
60
|
-
if (typeof value === 'number') {
|
|
61
|
-
return hexToRgb(value.toString(16).padStart(6, '0'));
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (typeof value === 'string') {
|
|
65
|
-
const hex = value.trim().replace(/^#/, '');
|
|
66
|
-
if (/^[0-9a-f]{3}$/i.test(hex)) {
|
|
67
|
-
return hexToRgb(hex.replace(/(.)/g, '$1$1'));
|
|
68
|
-
}
|
|
69
|
-
if (/^[0-9a-f]{6}$/i.test(hex)) {
|
|
70
|
-
return hexToRgb(hex);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return '255 255 255';
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function hexToRgb(hex: string) {
|
|
78
|
-
const value = Number.parseInt(hex, 16);
|
|
79
|
-
return `${(value >> 16) & 255} ${(value >> 8) & 255} ${value & 255}`;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function clamp(value: number, min: number, max: number) {
|
|
83
|
-
return Math.min(Math.max(value, min), max);
|
|
84
|
-
}
|
|
32
|
+
const brandStyle = $derived(getSpatialThemeStyle(theme));
|
|
85
33
|
</script>
|
|
86
34
|
|
|
87
|
-
<div class="brand-stage-shell" style={brandStyle}>
|
|
35
|
+
<div class="brand-stage-shell" style={brandStyle} style:color-scheme={colorScheme} data-color-scheme={colorScheme}>
|
|
88
36
|
<Stage
|
|
89
37
|
brandId={theme.id}
|
|
90
38
|
{renderSettings}
|
|
91
39
|
{dracoDecoderPath}
|
|
92
40
|
pageBackground={theme.background}
|
|
41
|
+
sceneBackground={theme.sceneBackground}
|
|
93
42
|
interactionTheme={theme.interactionTheme}
|
|
94
43
|
ariaLabel={`${theme.name} spatialElement stage`}
|
|
95
44
|
>
|
|
96
45
|
{@render children?.()}
|
|
97
46
|
</Stage>
|
|
47
|
+
<PointerHint />
|
|
98
48
|
</div>
|
|
99
49
|
|
|
100
50
|
<style>
|
|
@@ -5,6 +5,8 @@ import type { SpatialTheme } from '@spatial-elements/core/spatial-element/types'
|
|
|
5
5
|
interface Props {
|
|
6
6
|
/** Shared appearance and namespace. Use createSpatialTheme for defaults. */
|
|
7
7
|
theme: SpatialTheme;
|
|
8
|
+
/** Resolved by the host. System preference and persistence belong to the shell. */
|
|
9
|
+
colorScheme?: 'light' | 'dark';
|
|
8
10
|
/** Localized interface copy. Missing groups/strings fall back to English; updates are reactive. */
|
|
9
11
|
messages?: SpatialMessagesInput;
|
|
10
12
|
/** Optional GPU resolution budget; defaults to DPR 1 and 2,073,600 pixels. */
|