@spatial-elements/sveltekit 0.1.0-beta.1 → 1.0.0-beta.10
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 +19 -9
- package/dist/catalog/ScrollNavigationBridge.svelte +172 -47
- package/dist/catalog/ScrollNavigationBridge.svelte.d.ts +9 -2
- package/dist/catalog/catalogNavigation.js +3 -2
- package/dist/catalog/catalogSummaryTransfer.d.ts +16 -0
- package/dist/catalog/catalogSummaryTransfer.js +79 -0
- package/dist/catalog/catalogTransition.css +58 -3
- package/dist/catalog/interruptedPresentation.d.ts +10 -0
- package/dist/catalog/interruptedPresentation.js +29 -0
- package/dist/catalog/presentationCleanup.d.ts +4 -0
- package/dist/catalog/presentationCleanup.js +20 -0
- package/dist/catalog/stagedCatalogNavigation.d.ts +44 -0
- package/dist/catalog/stagedCatalogNavigation.js +403 -0
- package/dist/catalog/stagedDomReveal.d.ts +8 -0
- package/dist/catalog/stagedDomReveal.js +76 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/spatial-element/BrandStageShell.svelte +52 -71
- package/dist/spatial-element/BrandStageShell.svelte.d.ts +31 -4
- package/dist/spatial-element/CarouselSpatialElement.svelte +150 -197
- package/dist/spatial-element/CarouselSpatialElement.svelte.d.ts +5 -1
- package/dist/spatial-element/ContentBlock.svelte +7 -0
- package/dist/spatial-element/ContentBlock.svelte.d.ts +9 -0
- package/dist/spatial-element/ContentGrid.svelte +7 -0
- package/dist/spatial-element/ContentGrid.svelte.d.ts +8 -0
- package/dist/spatial-element/ContentPage.svelte +51 -55
- package/dist/spatial-element/ContentPage.svelte.d.ts +14 -3
- package/dist/spatial-element/InteractionGesture.svelte +39 -0
- package/dist/spatial-element/InteractionGesture.svelte.d.ts +7 -0
- package/dist/spatial-element/OverflowControls.svelte +125 -0
- package/dist/spatial-element/OverflowControls.svelte.d.ts +9 -0
- package/dist/spatial-element/PointerHint.svelte +80 -0
- package/dist/spatial-element/PointerHint.svelte.d.ts +3 -0
- package/dist/spatial-element/Section.svelte +25 -106
- package/dist/spatial-element/Section.svelte.d.ts +1 -0
- package/dist/spatial-element/SectionSurfaceGroup.svelte +8 -0
- package/dist/spatial-element/SectionSurfaceGroup.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialCardGridSection.svelte +79 -0
- package/dist/spatial-element/SpatialCardGridSection.svelte.d.ts +11 -0
- package/dist/spatial-element/SpatialCardPresentation.svelte +311 -0
- package/dist/spatial-element/SpatialCardPresentation.svelte.d.ts +19 -0
- package/dist/spatial-element/SpatialCardSlot.svelte +33 -0
- package/dist/spatial-element/SpatialCardSlot.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialCarouselSection.svelte +752 -0
- package/dist/spatial-element/{CarouselSection.svelte.d.ts → SpatialCarouselSection.svelte.d.ts} +5 -5
- package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +12 -65
- package/dist/spatial-element/SpatialElementCard.svelte +54 -238
- package/dist/spatial-element/SpatialElementCard.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialElementHelp.svelte +292 -0
- package/dist/spatial-element/SpatialElementHelp.svelte.d.ts +6 -0
- package/dist/spatial-element/SpatialElementMediaRail.svelte +321 -52
- package/dist/spatial-element/SpatialElementMediaRail.svelte.d.ts +4 -1
- package/dist/spatial-element/SpatialElementNativeMedia.svelte +101 -0
- package/dist/spatial-element/SpatialElementNativeMedia.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialElementPage.svelte +150 -70
- package/dist/spatial-element/SpatialElementPage.svelte.d.ts +6 -3
- package/dist/spatial-element/SpatialElementStickyHeader.svelte +76 -104
- package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +3 -1
- package/dist/spatial-element/SpatialElementSummaryContent.svelte +185 -0
- package/dist/spatial-element/SpatialElementSummaryContent.svelte.d.ts +18 -0
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte +48 -380
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte.d.ts +2 -1
- package/dist/spatial-element/SpatialElementTabList.svelte +40 -17
- package/dist/spatial-element/SpatialElementTabList.svelte.d.ts +2 -1
- package/dist/spatial-element/SpatialElementTabs.svelte +61 -18
- package/dist/spatial-element/SpatialElementTabs.svelte.d.ts +3 -1
- package/dist/spatial-element/SpatialElementViewToggle.svelte +54 -0
- package/dist/spatial-element/SpatialElementViewToggle.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialIconButton.svelte +59 -0
- package/dist/spatial-element/SpatialIconButton.svelte.d.ts +14 -0
- package/dist/spatial-element/SpatialListPage.svelte +37 -8
- package/dist/spatial-element/SpatialListPage.svelte.d.ts +4 -1
- package/dist/spatial-element/SpatialMediaIndicator.svelte +16 -0
- package/dist/spatial-element/SpatialMediaIndicator.svelte.d.ts +26 -0
- package/dist/spatial-element/SpatialNavigationShell.svelte +136 -0
- package/dist/spatial-element/SpatialNavigationShell.svelte.d.ts +15 -0
- package/dist/spatial-element/SpatialSummaryHost.svelte +19 -0
- package/dist/spatial-element/SpatialSummaryHost.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialSummaryRoot.svelte +78 -0
- package/dist/spatial-element/SpatialSummaryRoot.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialSummarySlot.svelte +39 -0
- package/dist/spatial-element/SpatialSummarySlot.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialViewIcon.svelte +29 -0
- package/dist/spatial-element/SpatialViewIcon.svelte.d.ts +6 -0
- package/dist/spatial-element/brandContext.d.ts +1 -1
- package/dist/spatial-element/brandContext.js +1 -1
- package/dist/spatial-element/cardAppearanceFreeze.d.ts +5 -0
- package/dist/spatial-element/cardAppearanceFreeze.js +72 -0
- package/dist/spatial-element/carouselTextHit.d.ts +2 -0
- package/dist/spatial-element/carouselTextHit.js +17 -0
- package/dist/spatial-element/contentSidebars.d.ts +3 -0
- package/dist/spatial-element/contentSidebars.js +56 -0
- package/dist/spatial-element/index.d.ts +18 -3
- package/dist/spatial-element/index.js +11 -2
- package/dist/spatial-element/layout.generated.css +363 -0
- package/dist/spatial-element/messagesContext.d.ts +3 -0
- package/dist/spatial-element/messagesContext.js +10 -0
- package/dist/spatial-element/presentationBoxFreeze.d.ts +8 -0
- package/dist/spatial-element/presentationBoxFreeze.js +35 -0
- package/dist/spatial-element/spatialCardGrid.d.ts +12 -0
- package/dist/spatial-element/spatialCardGrid.js +1 -0
- package/dist/spatial-element/spatialPageContext.d.ts +4 -0
- package/dist/spatial-element/spatialPageContext.js +9 -0
- package/dist/spatial-element/spatialPresentationOwner.d.ts +6 -0
- package/dist/spatial-element/spatialPresentationOwner.js +2 -0
- package/dist/spatial-element/spatialSummary.d.ts +43 -0
- package/dist/spatial-element/spatialSummary.js +1 -0
- package/dist/spatial-element/spatialSummaryHost.svelte.d.ts +60 -0
- package/dist/spatial-element/spatialSummaryHost.svelte.js +233 -0
- package/dist/spatial-element/spatialThemeStyle.d.ts +3 -0
- package/dist/spatial-element/spatialThemeStyle.js +69 -0
- package/dist/spatial-element/truncatedTitle.d.ts +5 -0
- package/dist/spatial-element/truncatedTitle.js +28 -0
- package/dist/stage/ButtonGroup.svelte +151 -0
- package/dist/stage/ButtonGroup.svelte.d.ts +24 -0
- package/dist/stage/Panel.svelte +72 -14
- package/dist/stage/Panel.svelte.d.ts +14 -2
- package/dist/stage/Stage.svelte +405 -48
- package/dist/stage/Stage.svelte.d.ts +8 -1
- package/dist/stage/StageViewport.svelte +15 -2
- 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/logo.svg +188 -0
- package/package.json +9 -6
- package/dist/spatial-element/CarouselSection.svelte +0 -350
- package/dist/spatial-element/ListSection.svelte +0 -30
- package/dist/spatial-element/ListSection.svelte.d.ts +0 -8
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { SpatialElementLodPair } from '@spatial-elements/core/catalog/spatialElementLodPair';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import type { BackgroundSettings, StageCameraSettings, StageInteractionTheme, StageModelSettings } from '@spatial-elements/core/stage/StageExperience';
|
|
3
|
+
import type { BackgroundSettings, StageCameraSettings, StageInteractionTheme, StageModelSettings, StageRenderSettings } from '@spatial-elements/core/stage/StageExperience';
|
|
4
4
|
import '../catalog/catalogTransition.css';
|
|
5
5
|
import type { CatalogPage } from '@spatial-elements/core/catalog/catalogPage';
|
|
6
6
|
interface Props {
|
|
7
|
+
deviceOrientation?: boolean;
|
|
8
|
+
/** Namespace for automatic ContentPage/SpatialElementPage registration. Supplied by BrandStageShell. */
|
|
9
|
+
brandId?: string;
|
|
10
|
+
renderSettings?: StageRenderSettings;
|
|
7
11
|
dracoDecoderPath?: string;
|
|
8
12
|
ariaLabel?: string;
|
|
9
13
|
background?: BackgroundSettings;
|
|
14
|
+
/** Theme overrides applied after each element's HDR background settings. */
|
|
15
|
+
sceneBackground?: Partial<BackgroundSettings>;
|
|
10
16
|
pageBackground?: string;
|
|
11
17
|
hdr?: string;
|
|
12
18
|
glb?: string;
|
|
@@ -14,6 +20,7 @@ interface Props {
|
|
|
14
20
|
model?: StageModelSettings;
|
|
15
21
|
camera?: StageCameraSettings;
|
|
16
22
|
interactionTheme?: Partial<StageInteractionTheme>;
|
|
23
|
+
/** @deprecated Low-level manual adapter. BrandStageShell manages catalog state from its pages. */
|
|
17
24
|
catalog?: CatalogPage;
|
|
18
25
|
children?: Snippet;
|
|
19
26
|
}
|
|
@@ -65,9 +65,22 @@
|
|
|
65
65
|
width: 100%;
|
|
66
66
|
height: 100%;
|
|
67
67
|
object-fit: contain;
|
|
68
|
+
opacity: 1;
|
|
69
|
+
transition: opacity 240ms ease;
|
|
68
70
|
}
|
|
69
71
|
|
|
70
|
-
:global(.stage-enhanced) .stage-viewport-fallback-image {
|
|
71
|
-
|
|
72
|
+
:global(.stage-enhanced[data-stage-page-ready]) .stage-viewport-fallback-image {
|
|
73
|
+
opacity: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* A captured GPU model already owns the image while the destination binds.
|
|
77
|
+
* Showing its newly mounted fallback here duplicates the moving product. */
|
|
78
|
+
:global(.stage-enhanced[data-catalog-transition]) .stage-viewport-fallback-image {
|
|
79
|
+
opacity: 0;
|
|
80
|
+
transition: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@media (prefers-reduced-motion: reduce) {
|
|
84
|
+
.stage-viewport-fallback-image { transition: none; }
|
|
72
85
|
}
|
|
73
86
|
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Patch authored declarations without erasing the renderer's position, transform or visibility. */
|
|
2
|
+
export function authoredStyle(node, value) {
|
|
3
|
+
let previous = new Set();
|
|
4
|
+
function update(next) {
|
|
5
|
+
const parsed = document.createElement('div').style;
|
|
6
|
+
parsed.cssText = next;
|
|
7
|
+
const properties = new Set(Array.from(parsed));
|
|
8
|
+
for (const name of previous)
|
|
9
|
+
if (!properties.has(name))
|
|
10
|
+
node.style.removeProperty(name);
|
|
11
|
+
for (const name of properties)
|
|
12
|
+
node.style.setProperty(name, parsed.getPropertyValue(name), parsed.getPropertyPriority(name));
|
|
13
|
+
previous = properties;
|
|
14
|
+
}
|
|
15
|
+
update(value);
|
|
16
|
+
return { update };
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/logo.svg
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
width="44.490986mm"
|
|
6
|
+
height="40.392185mm"
|
|
7
|
+
viewBox="0 0 44.490985 40.392186"
|
|
8
|
+
version="1.1"
|
|
9
|
+
id="svg1"
|
|
10
|
+
xml:space="preserve"
|
|
11
|
+
inkscape:version="1.4.4 (dcaf3e7, 2026-05-05)"
|
|
12
|
+
sodipodi:docname="spatial-elements-logo.svg"
|
|
13
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
14
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
15
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
16
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
17
|
+
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
|
|
18
|
+
id="namedview1"
|
|
19
|
+
pagecolor="#ffffff"
|
|
20
|
+
bordercolor="#000000"
|
|
21
|
+
borderopacity="0.25"
|
|
22
|
+
inkscape:showpageshadow="2"
|
|
23
|
+
inkscape:pageopacity="0.0"
|
|
24
|
+
inkscape:pagecheckerboard="0"
|
|
25
|
+
inkscape:deskcolor="#d1d1d1"
|
|
26
|
+
inkscape:document-units="mm"
|
|
27
|
+
inkscape:zoom="1.0167041"
|
|
28
|
+
inkscape:cx="329.49606"
|
|
29
|
+
inkscape:cy="266.05578"
|
|
30
|
+
inkscape:window-width="1920"
|
|
31
|
+
inkscape:window-height="1009"
|
|
32
|
+
inkscape:window-x="4912"
|
|
33
|
+
inkscape:window-y="443"
|
|
34
|
+
inkscape:window-maximized="1"
|
|
35
|
+
inkscape:current-layer="g3"><inkscape:page
|
|
36
|
+
x="0"
|
|
37
|
+
y="0"
|
|
38
|
+
width="44.490986"
|
|
39
|
+
height="40.392185"
|
|
40
|
+
id="page1"
|
|
41
|
+
margin="0"
|
|
42
|
+
bleed="0" /></sodipodi:namedview><defs
|
|
43
|
+
id="defs1"><linearGradient
|
|
44
|
+
id="linearGradient9"
|
|
45
|
+
x1="594.448"
|
|
46
|
+
y1="603.10071"
|
|
47
|
+
x2="826.05109"
|
|
48
|
+
y2="834.7038"
|
|
49
|
+
gradientTransform="scale(0.77719164,1.2866839)"
|
|
50
|
+
gradientUnits="userSpaceOnUse"><stop
|
|
51
|
+
offset="0"
|
|
52
|
+
stop-color="#029A80"
|
|
53
|
+
id="stop8"
|
|
54
|
+
style="stop-color:#00a982;stop-opacity:0.93333334;" /><stop
|
|
55
|
+
offset="1"
|
|
56
|
+
stop-color="#006A57"
|
|
57
|
+
id="stop9"
|
|
58
|
+
style="stop-color:#004a39;stop-opacity:1;" /></linearGradient><linearGradient
|
|
59
|
+
id="linearGradient7"
|
|
60
|
+
x1="360.55801"
|
|
61
|
+
y1="604.77368"
|
|
62
|
+
x2="592.80359"
|
|
63
|
+
y2="837.01923"
|
|
64
|
+
gradientTransform="scale(0.77934752,1.2831246)"
|
|
65
|
+
gradientUnits="userSpaceOnUse"><stop
|
|
66
|
+
offset="0"
|
|
67
|
+
stop-color="#16CBB2"
|
|
68
|
+
id="stop6"
|
|
69
|
+
style="stop-color:#00ba90;stop-opacity:1;" /><stop
|
|
70
|
+
offset="1"
|
|
71
|
+
stop-color="#05957B"
|
|
72
|
+
id="stop7"
|
|
73
|
+
style="stop-color:#00795d;stop-opacity:1;" /></linearGradient><linearGradient
|
|
74
|
+
id="linearGradient5"
|
|
75
|
+
x1="209.15474"
|
|
76
|
+
y1="909.55145"
|
|
77
|
+
x2="477.85532"
|
|
78
|
+
y2="1178.252"
|
|
79
|
+
gradientTransform="scale(1.3435029,0.74432293)"
|
|
80
|
+
gradientUnits="userSpaceOnUse"><stop
|
|
81
|
+
offset="0"
|
|
82
|
+
stop-color="#69F6E2"
|
|
83
|
+
id="stop4"
|
|
84
|
+
style="stop-color:#00ebb6;stop-opacity:0.93333334;" /><stop
|
|
85
|
+
offset="1"
|
|
86
|
+
stop-color="#3FEAD3"
|
|
87
|
+
id="stop5"
|
|
88
|
+
style="stop-color:#00cd9b;stop-opacity:1;" /></linearGradient><linearGradient
|
|
89
|
+
inkscape:collect="always"
|
|
90
|
+
xlink:href="#linearGradient5"
|
|
91
|
+
id="linearGradient1"
|
|
92
|
+
gradientUnits="userSpaceOnUse"
|
|
93
|
+
gradientTransform="scale(1.3435029,0.74432293)"
|
|
94
|
+
x1="209.15474"
|
|
95
|
+
y1="909.55145"
|
|
96
|
+
x2="477.85532"
|
|
97
|
+
y2="1178.252" /><linearGradient
|
|
98
|
+
inkscape:collect="always"
|
|
99
|
+
xlink:href="#linearGradient7"
|
|
100
|
+
id="linearGradient3"
|
|
101
|
+
gradientUnits="userSpaceOnUse"
|
|
102
|
+
gradientTransform="scale(0.77934752,1.2831246)"
|
|
103
|
+
x1="360.55801"
|
|
104
|
+
y1="604.77368"
|
|
105
|
+
x2="592.80359"
|
|
106
|
+
y2="837.01923" /><linearGradient
|
|
107
|
+
inkscape:collect="always"
|
|
108
|
+
xlink:href="#linearGradient9"
|
|
109
|
+
id="linearGradient4"
|
|
110
|
+
gradientUnits="userSpaceOnUse"
|
|
111
|
+
gradientTransform="scale(0.77719164,1.2866839)"
|
|
112
|
+
x1="594.448"
|
|
113
|
+
y1="603.10071"
|
|
114
|
+
x2="826.05109"
|
|
115
|
+
y2="834.7038" /></defs><g
|
|
116
|
+
inkscape:label="Ebene 1"
|
|
117
|
+
inkscape:groupmode="layer"
|
|
118
|
+
id="layer1"
|
|
119
|
+
transform="translate(-5.6997991,-4.2593934)"><g
|
|
120
|
+
id="g10"
|
|
121
|
+
transform="translate(-49.560711,-0.44665427)"
|
|
122
|
+
inkscape:export-filename="g10.svg"
|
|
123
|
+
inkscape:export-xdpi="96"
|
|
124
|
+
inkscape:export-ydpi="96"><g
|
|
125
|
+
transform="matrix(0.10951629,-0.03285489,0,0.10951629,41.242425,6.4630304)"
|
|
126
|
+
id="g9-2"><rect
|
|
127
|
+
x="130"
|
|
128
|
+
y="94"
|
|
129
|
+
width="252"
|
|
130
|
+
height="258"
|
|
131
|
+
rx="26"
|
|
132
|
+
ry="26"
|
|
133
|
+
fill="url(#gMiddle)"
|
|
134
|
+
fill-opacity="0.95"
|
|
135
|
+
stroke="#8bc6ff"
|
|
136
|
+
stroke-width="4"
|
|
137
|
+
id="rect9-1"
|
|
138
|
+
style="fill:#007b5f;fill-opacity:0.930678;stroke:#00be92;stroke-opacity:1" /></g><rect
|
|
139
|
+
x="61.369076"
|
|
140
|
+
y="33.856007"
|
|
141
|
+
width="9.6044226"
|
|
142
|
+
height="6.3519449"
|
|
143
|
+
rx="1.3720603"
|
|
144
|
+
ry="1.3141955"
|
|
145
|
+
fill="#ffffff"
|
|
146
|
+
fill-opacity="0.96"
|
|
147
|
+
id="rect11-6"
|
|
148
|
+
transform="matrix(0.9578263,-0.28734785,0,1,0,0)"
|
|
149
|
+
style="stroke-width:0.111902" /><rect
|
|
150
|
+
x="61.369076"
|
|
151
|
+
y="42.507793"
|
|
152
|
+
width="17.608107"
|
|
153
|
+
height="1.8617769"
|
|
154
|
+
rx="0.97187608"
|
|
155
|
+
ry="0.93088847"
|
|
156
|
+
fill="#ffffff"
|
|
157
|
+
fill-opacity="0.96"
|
|
158
|
+
id="rect12-1"
|
|
159
|
+
transform="matrix(0.9578263,-0.28734785,0,1,0,0)"
|
|
160
|
+
style="stroke-width:0.111902" /><rect
|
|
161
|
+
x="61.369076"
|
|
162
|
+
y="46.231346"
|
|
163
|
+
width="13.720604"
|
|
164
|
+
height="1.8617769"
|
|
165
|
+
rx="0.97187608"
|
|
166
|
+
ry="0.93088847"
|
|
167
|
+
fill="#ffffff"
|
|
168
|
+
fill-opacity="0.96"
|
|
169
|
+
id="rect13-5-8"
|
|
170
|
+
transform="matrix(0.9578263,-0.28734785,0,1,0,0)"
|
|
171
|
+
style="stroke-width:0.111902" /></g><g
|
|
172
|
+
id="g11"
|
|
173
|
+
transform="translate(-53.594374,3.5870086)"><polygon
|
|
174
|
+
points="462,877 281,776 461,677 642,776 "
|
|
175
|
+
fill="url(#gCubeTop)"
|
|
176
|
+
id="polygon24-5"
|
|
177
|
+
style="fill:url(#linearGradient1)"
|
|
178
|
+
transform="matrix(0.06893572,0,0,0.06893572,59.528427,-32.972395)" /><polygon
|
|
179
|
+
points="281,973 281,776 462,877 462,1074 "
|
|
180
|
+
fill="url(#gCubeLeft)"
|
|
181
|
+
id="polygon25-2"
|
|
182
|
+
style="fill:url(#linearGradient3)"
|
|
183
|
+
transform="matrix(0.06893572,0,0,0.06893572,59.528427,-32.972395)" /><polygon
|
|
184
|
+
points="642,973 642,776 462,877 462,1074 "
|
|
185
|
+
fill="url(#gCubeRight)"
|
|
186
|
+
id="polygon26-7"
|
|
187
|
+
style="fill:url(#linearGradient4)"
|
|
188
|
+
transform="matrix(0.06893572,0,0,0.06893572,59.528427,-32.972395)" /></g></g></svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spatial-elements/sveltekit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
4
|
"description": "SvelteKit components and navigation for Spatial Elements.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -9,14 +9,15 @@
|
|
|
9
9
|
"url": "https://github.com/LauridBergjohann/spatial-elements.git",
|
|
10
10
|
"directory": "packages/sveltekit"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://
|
|
12
|
+
"homepage": "https://spatial-elements.bergjohann.com/",
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/LauridBergjohann/spatial-elements/issues"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
18
|
"LICENSE",
|
|
19
|
-
"README.md"
|
|
19
|
+
"README.md",
|
|
20
|
+
"logo.svg"
|
|
20
21
|
],
|
|
21
22
|
"exports": {
|
|
22
23
|
".": {
|
|
@@ -39,13 +40,15 @@
|
|
|
39
40
|
"prepack": "npm run build"
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
|
-
"@
|
|
43
|
+
"@page-sections/core": "0.4.1",
|
|
44
|
+
"@page-sections/svelte": "0.4.1",
|
|
45
|
+
"@spatial-elements/core": "1.0.0-beta.10",
|
|
43
46
|
"lucide-svelte": "^1.0.1"
|
|
44
47
|
},
|
|
45
48
|
"peerDependencies": {
|
|
46
|
-
"svelte": "^5.56.4",
|
|
47
49
|
"@sveltejs/kit": "^2.70.3",
|
|
48
|
-
"
|
|
50
|
+
"svelte": "^5.56.4",
|
|
51
|
+
"three": "^0.186.1"
|
|
49
52
|
},
|
|
50
53
|
"publishConfig": {
|
|
51
54
|
"access": "public",
|
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { getContext, onMount, tick, untrack } from 'svelte';
|
|
3
|
-
import Section from './Section.svelte';
|
|
4
|
-
import CarouselSpatialElement from './CarouselSpatialElement.svelte';
|
|
5
|
-
import { CATALOG_POSE_CHANGED } from '@spatial-elements/core/catalog/catalogPose';
|
|
6
|
-
import type { CarouselPresentation } from '@spatial-elements/core/catalog/catalogPose';
|
|
7
|
-
import type { SpatialListItem, SpatialElementSectionDefinition } from '@spatial-elements/core/spatial-element/types';
|
|
8
|
-
import { CATALOG_SECTIONS, type CatalogSections } from '@spatial-elements/core/catalog/CatalogSections';
|
|
9
|
-
import {
|
|
10
|
-
carouselKey,
|
|
11
|
-
resolveCarouselSelection,
|
|
12
|
-
stepCarouselSelection
|
|
13
|
-
} from '@spatial-elements/core/catalog/carouselSelection';
|
|
14
|
-
|
|
15
|
-
let {
|
|
16
|
-
section,
|
|
17
|
-
presentation,
|
|
18
|
-
list,
|
|
19
|
-
initialItemKey,
|
|
20
|
-
onselectionchange
|
|
21
|
-
}: {
|
|
22
|
-
section: SpatialElementSectionDefinition;
|
|
23
|
-
list: SpatialListItem[];
|
|
24
|
-
presentation?: CarouselPresentation;
|
|
25
|
-
initialItemKey?: string;
|
|
26
|
-
onselectionchange?: (selection: { itemKey: string; spatialElementId: string }) => void;
|
|
27
|
-
} = $props();
|
|
28
|
-
const sections = getContext<CatalogSections | undefined>(CATALOG_SECTIONS);
|
|
29
|
-
|
|
30
|
-
let requested = $state<string>();
|
|
31
|
-
let interactive = $state(false);
|
|
32
|
-
let phase = $state(0);
|
|
33
|
-
let windowPhase = $state(0);
|
|
34
|
-
$effect(() => {
|
|
35
|
-
if (Math.abs(phase - windowPhase) > 0.75) windowPhase = Math.round(phase);
|
|
36
|
-
});
|
|
37
|
-
let ring: HTMLDivElement;
|
|
38
|
-
let frame = 0;
|
|
39
|
-
let visible = true;
|
|
40
|
-
let suppressClick = false;
|
|
41
|
-
let clickTimer: ReturnType<typeof setTimeout>;
|
|
42
|
-
let announced = $state<string>();
|
|
43
|
-
let selectionDirty = false;
|
|
44
|
-
let previousKeys: string | undefined;
|
|
45
|
-
function rememberSelection() {
|
|
46
|
-
if (!selectionDirty) return;
|
|
47
|
-
selectionDirty = false;
|
|
48
|
-
sections?.remember();
|
|
49
|
-
}
|
|
50
|
-
let drag: { id: number; x: number; y: number; phase: number; active: boolean } | undefined;
|
|
51
|
-
function invalidate() {
|
|
52
|
-
window.dispatchEvent(new Event(CATALOG_POSE_CHANGED));
|
|
53
|
-
}
|
|
54
|
-
function releaseDrag() {
|
|
55
|
-
const current = drag;
|
|
56
|
-
drag = undefined;
|
|
57
|
-
if (current && ring?.hasPointerCapture(current.id)) ring.releasePointerCapture(current.id);
|
|
58
|
-
}
|
|
59
|
-
function settle() {
|
|
60
|
-
cancelAnimationFrame(frame);
|
|
61
|
-
frame = 0;
|
|
62
|
-
releaseDrag();
|
|
63
|
-
phase = Math.max(0, keys.indexOf(selected ?? ''));
|
|
64
|
-
announced = selected;
|
|
65
|
-
void tick().then(invalidate);
|
|
66
|
-
rememberSelection();
|
|
67
|
-
}
|
|
68
|
-
function animate(target: number) {
|
|
69
|
-
cancelAnimationFrame(frame);
|
|
70
|
-
const start = phase;
|
|
71
|
-
const started = performance.now();
|
|
72
|
-
if (
|
|
73
|
-
Math.abs(target - start) > 1.5 ||
|
|
74
|
-
!visible ||
|
|
75
|
-
document.hidden ||
|
|
76
|
-
matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
77
|
-
) {
|
|
78
|
-
phase = target;
|
|
79
|
-
announced = selected;
|
|
80
|
-
invalidate();
|
|
81
|
-
rememberSelection();
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
const advance = (now: number) => {
|
|
85
|
-
if (ring?.closest('[data-catalog-transition]')) {
|
|
86
|
-
frame = 0;
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
const t = Math.min(1, (now - started) / 320);
|
|
90
|
-
phase = start + (target - start) * (1 - (1 - t) ** 2);
|
|
91
|
-
void tick().then(invalidate);
|
|
92
|
-
if (t < 1) frame = requestAnimationFrame(advance);
|
|
93
|
-
else {
|
|
94
|
-
frame = 0;
|
|
95
|
-
announced = selected;
|
|
96
|
-
rememberSelection();
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
frame = requestAnimationFrame(advance);
|
|
100
|
-
}
|
|
101
|
-
function pointerdown(event: PointerEvent) {
|
|
102
|
-
if (
|
|
103
|
-
list.length < 2 ||
|
|
104
|
-
event.button !== 0 ||
|
|
105
|
-
!(event.target as Element).closest('.spatial-element-visual')
|
|
106
|
-
)
|
|
107
|
-
return;
|
|
108
|
-
drag = { id: event.pointerId, x: event.clientX, y: event.clientY, phase, active: false };
|
|
109
|
-
}
|
|
110
|
-
function pointermove(event: PointerEvent) {
|
|
111
|
-
if (!drag || drag.id !== event.pointerId) return;
|
|
112
|
-
const x = event.clientX - drag.x,
|
|
113
|
-
y = event.clientY - drag.y;
|
|
114
|
-
if (!drag.active) {
|
|
115
|
-
if (Math.abs(y) > 10 && Math.abs(y) > Math.abs(x)) {
|
|
116
|
-
drag = undefined;
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (Math.abs(x) < 10 || Math.abs(x) < Math.abs(y) * 1.2) return;
|
|
120
|
-
drag.active = true;
|
|
121
|
-
suppressClick = true;
|
|
122
|
-
cancelAnimationFrame(frame);
|
|
123
|
-
ring.setPointerCapture(event.pointerId);
|
|
124
|
-
}
|
|
125
|
-
phase = Math.max(0, Math.min(keys.length - 1, drag.phase - x / 220));
|
|
126
|
-
invalidate();
|
|
127
|
-
}
|
|
128
|
-
function pointerup(event: PointerEvent) {
|
|
129
|
-
if (!drag || drag.id !== event.pointerId) return;
|
|
130
|
-
const active = drag.active;
|
|
131
|
-
releaseDrag();
|
|
132
|
-
if (active) select(keys[Math.round(phase)]);
|
|
133
|
-
clearTimeout(clickTimer);
|
|
134
|
-
clickTimer = setTimeout(() => (suppressClick = false), 0);
|
|
135
|
-
}
|
|
136
|
-
function pointercancel() {
|
|
137
|
-
releaseDrag();
|
|
138
|
-
suppressClick = false;
|
|
139
|
-
animate(Math.max(0, keys.indexOf(selected ?? '')));
|
|
140
|
-
}
|
|
141
|
-
const keys = $derived(list.map(carouselKey));
|
|
142
|
-
const selected = $derived(resolveCarouselSelection(keys, requested ?? initialItemKey));
|
|
143
|
-
$effect(() => {
|
|
144
|
-
// Data reordering/removal changes indices, never the stable selection identity.
|
|
145
|
-
const signature = JSON.stringify(keys);
|
|
146
|
-
if (interactive)
|
|
147
|
-
untrack(() => {
|
|
148
|
-
if (previousKeys !== undefined && previousKeys !== signature) selectionDirty = true;
|
|
149
|
-
previousKeys = signature;
|
|
150
|
-
settle();
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
function select(key: string | undefined) {
|
|
154
|
-
selectionDirty = true;
|
|
155
|
-
requested = key;
|
|
156
|
-
// Persist in the current entry before a possible popstate changes the history index.
|
|
157
|
-
rememberSelection();
|
|
158
|
-
const target = Math.max(0, keys.indexOf(key ?? ''));
|
|
159
|
-
animate(target);
|
|
160
|
-
const spatialElement = list.find((item) => carouselKey(item) === selected);
|
|
161
|
-
if (spatialElement && selected) onselectionchange?.({ itemKey: selected, spatialElementId: spatialElement.id });
|
|
162
|
-
}
|
|
163
|
-
function keydown(event: KeyboardEvent) {
|
|
164
|
-
const step = event.key === 'ArrowRight' ? 1 : event.key === 'ArrowLeft' ? -1 : 0;
|
|
165
|
-
if (step) select(stepCarouselSelection(keys, selected, step));
|
|
166
|
-
else if (event.key === 'Home') select(keys[0]);
|
|
167
|
-
else if (event.key === 'End') select(keys.at(-1));
|
|
168
|
-
else return;
|
|
169
|
-
event.preventDefault();
|
|
170
|
-
}
|
|
171
|
-
onMount(() => {
|
|
172
|
-
interactive = true;
|
|
173
|
-
const release = sections?.register(section.id, {
|
|
174
|
-
read: () => selected,
|
|
175
|
-
restore: (key) => {
|
|
176
|
-
selectionDirty = false;
|
|
177
|
-
requested = resolveCarouselSelection(keys, key ?? initialItemKey);
|
|
178
|
-
cancelAnimationFrame(frame);
|
|
179
|
-
phase = Math.max(0, keys.indexOf(requested ?? ''));
|
|
180
|
-
announced = requested;
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
const observer = new IntersectionObserver(([entry]) => {
|
|
184
|
-
visible = entry.isIntersecting;
|
|
185
|
-
if (!visible) {
|
|
186
|
-
settle();
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
observer.observe(ring);
|
|
190
|
-
let sizingFrame = 0;
|
|
191
|
-
const measure = () => {
|
|
192
|
-
sizingFrame = 0;
|
|
193
|
-
const heights = [...ring.querySelectorAll<HTMLElement>('.summary')].map(
|
|
194
|
-
(panel) => panel.offsetHeight
|
|
195
|
-
);
|
|
196
|
-
const contentHeight = Math.max(0, ...heights);
|
|
197
|
-
const height =
|
|
198
|
-
ring.clientWidth < 700 ? 408 + contentHeight : Math.max(560, contentHeight + 64);
|
|
199
|
-
const value = height + 'px';
|
|
200
|
-
if (ring.style.getPropertyValue('--carousel-height') !== value)
|
|
201
|
-
ring.style.setProperty('--carousel-height', value);
|
|
202
|
-
};
|
|
203
|
-
const scheduleSize = () => {
|
|
204
|
-
if (!sizingFrame) sizingFrame = requestAnimationFrame(measure);
|
|
205
|
-
};
|
|
206
|
-
const sizing = new ResizeObserver(scheduleSize);
|
|
207
|
-
const contentChanges = new MutationObserver(() => {
|
|
208
|
-
sizing.disconnect();
|
|
209
|
-
sizing.observe(ring);
|
|
210
|
-
for (const panel of ring.querySelectorAll('.summary')) sizing.observe(panel);
|
|
211
|
-
scheduleSize();
|
|
212
|
-
});
|
|
213
|
-
contentChanges.observe(ring, { childList: true, subtree: true });
|
|
214
|
-
sizing.observe(ring);
|
|
215
|
-
for (const panel of ring.querySelectorAll('.summary')) sizing.observe(panel);
|
|
216
|
-
const stop = () => pointercancel();
|
|
217
|
-
window.addEventListener('resize', stop);
|
|
218
|
-
const hidden = () => {
|
|
219
|
-
if (document.hidden) settle();
|
|
220
|
-
};
|
|
221
|
-
document.addEventListener('visibilitychange', hidden);
|
|
222
|
-
const escape = (event: KeyboardEvent) => {
|
|
223
|
-
if (event.key === 'Escape') stop();
|
|
224
|
-
};
|
|
225
|
-
window.addEventListener('keydown', escape);
|
|
226
|
-
return () => {
|
|
227
|
-
cancelAnimationFrame(frame);
|
|
228
|
-
clearTimeout(clickTimer);
|
|
229
|
-
releaseDrag();
|
|
230
|
-
observer.disconnect();
|
|
231
|
-
sizing.disconnect();
|
|
232
|
-
contentChanges.disconnect();
|
|
233
|
-
cancelAnimationFrame(sizingFrame);
|
|
234
|
-
release?.();
|
|
235
|
-
window.removeEventListener('resize', stop);
|
|
236
|
-
window.removeEventListener('keydown', escape);
|
|
237
|
-
document.removeEventListener('visibilitychange', hidden);
|
|
238
|
-
};
|
|
239
|
-
});
|
|
240
|
-
</script>
|
|
241
|
-
|
|
242
|
-
<Section {section} presentation="list">
|
|
243
|
-
<div
|
|
244
|
-
class="carousel"
|
|
245
|
-
class:interactive
|
|
246
|
-
class:populated={list.length > 0}
|
|
247
|
-
data-carousel-section={section.id}
|
|
248
|
-
>
|
|
249
|
-
<div
|
|
250
|
-
class="ring"
|
|
251
|
-
bind:this={ring}
|
|
252
|
-
onpointerdown={pointerdown}
|
|
253
|
-
onpointermove={pointermove}
|
|
254
|
-
onpointerup={pointerup}
|
|
255
|
-
onpointercancel={pointercancel}
|
|
256
|
-
onlostpointercapture={() => {
|
|
257
|
-
if (drag) pointercancel();
|
|
258
|
-
}}
|
|
259
|
-
role="group"
|
|
260
|
-
aria-label={section.title}
|
|
261
|
-
>
|
|
262
|
-
{#each list as spatialElement, index (carouselKey(spatialElement))}
|
|
263
|
-
<CarouselSpatialElement
|
|
264
|
-
{spatialElement}
|
|
265
|
-
sectionId={section.id}
|
|
266
|
-
{presentation}
|
|
267
|
-
{index}
|
|
268
|
-
count={list.length}
|
|
269
|
-
{phase}
|
|
270
|
-
{windowPhase}
|
|
271
|
-
selected={selected === carouselKey(spatialElement)}
|
|
272
|
-
{interactive}
|
|
273
|
-
onselect={() => {
|
|
274
|
-
if (!suppressClick) select(carouselKey(spatialElement));
|
|
275
|
-
}}
|
|
276
|
-
/>
|
|
277
|
-
{/each}
|
|
278
|
-
</div>
|
|
279
|
-
{#if interactive && list.length > 1}
|
|
280
|
-
<div class="controls" role="group" aria-label={`${section.title}: element selection`}>
|
|
281
|
-
{#each list as spatialElement (carouselKey(spatialElement))}
|
|
282
|
-
<button
|
|
283
|
-
onkeydown={keydown}
|
|
284
|
-
aria-label={spatialElement.eyebrow}
|
|
285
|
-
aria-pressed={selected === carouselKey(spatialElement)}
|
|
286
|
-
onclick={() => select(carouselKey(spatialElement))}><span aria-hidden="true"></span></button
|
|
287
|
-
>
|
|
288
|
-
{/each}
|
|
289
|
-
</div>
|
|
290
|
-
{/if}
|
|
291
|
-
{#if interactive}<p class="sr-only" role="status">
|
|
292
|
-
{list.find((item) => carouselKey(item) === announced)?.title ?? ''}
|
|
293
|
-
</p>{/if}
|
|
294
|
-
</div>
|
|
295
|
-
</Section>
|
|
296
|
-
|
|
297
|
-
<style>
|
|
298
|
-
.carousel {
|
|
299
|
-
pointer-events: auto;
|
|
300
|
-
margin-top: 24px;
|
|
301
|
-
}
|
|
302
|
-
.ring {
|
|
303
|
-
container-type: inline-size;
|
|
304
|
-
position: relative;
|
|
305
|
-
touch-action: pan-y;
|
|
306
|
-
}
|
|
307
|
-
.interactive.populated .ring {
|
|
308
|
-
min-height: var(--carousel-height, 560px);
|
|
309
|
-
}
|
|
310
|
-
.controls {
|
|
311
|
-
display: flex;
|
|
312
|
-
justify-content: center;
|
|
313
|
-
flex-wrap: wrap;
|
|
314
|
-
margin-top: 16px;
|
|
315
|
-
}
|
|
316
|
-
.controls button {
|
|
317
|
-
display: grid;
|
|
318
|
-
place-items: center;
|
|
319
|
-
width: 44px;
|
|
320
|
-
height: 44px;
|
|
321
|
-
padding: 0;
|
|
322
|
-
border: 0;
|
|
323
|
-
background: transparent;
|
|
324
|
-
border-radius: 50%;
|
|
325
|
-
cursor: pointer;
|
|
326
|
-
}
|
|
327
|
-
.controls span {
|
|
328
|
-
width: 10px;
|
|
329
|
-
height: 10px;
|
|
330
|
-
border: 1px solid var(--spatial-element-accent);
|
|
331
|
-
border-radius: 50%;
|
|
332
|
-
}
|
|
333
|
-
.controls button[aria-pressed='true'] span {
|
|
334
|
-
background: var(--spatial-element-accent);
|
|
335
|
-
}
|
|
336
|
-
.controls button:focus-visible {
|
|
337
|
-
outline: 2px solid var(--spatial-element-accent);
|
|
338
|
-
outline-offset: -4px;
|
|
339
|
-
}
|
|
340
|
-
.sr-only {
|
|
341
|
-
position: absolute;
|
|
342
|
-
width: 1px;
|
|
343
|
-
height: 1px;
|
|
344
|
-
padding: 0;
|
|
345
|
-
margin: -1px;
|
|
346
|
-
overflow: hidden;
|
|
347
|
-
clip-path: inset(50%);
|
|
348
|
-
white-space: nowrap;
|
|
349
|
-
}
|
|
350
|
-
</style>
|