@spatial-elements/sveltekit 1.0.0-beta.6 → 1.0.0-beta.8
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/dist/catalog/ScrollNavigationBridge.svelte +170 -45
- package/dist/catalog/ScrollNavigationBridge.svelte.d.ts +9 -2
- package/dist/catalog/catalogSummaryTransfer.d.ts +16 -0
- package/dist/catalog/catalogSummaryTransfer.js +79 -0
- package/dist/catalog/catalogTransition.css +46 -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 +1 -0
- package/dist/index.js +1 -0
- package/dist/spatial-element/BrandStageShell.svelte +20 -2
- package/dist/spatial-element/BrandStageShell.svelte.d.ts +10 -0
- package/dist/spatial-element/CarouselSection.svelte +40 -21
- package/dist/spatial-element/CarouselSpatialElement.svelte +49 -115
- package/dist/spatial-element/ContentBlock.svelte +53 -0
- package/dist/spatial-element/ContentBlock.svelte.d.ts +11 -0
- package/dist/spatial-element/ContentGrid.svelte +28 -0
- package/dist/spatial-element/ContentGrid.svelte.d.ts +10 -0
- package/dist/spatial-element/ContentPage.svelte +28 -20
- package/dist/spatial-element/ContentPage.svelte.d.ts +3 -0
- package/dist/spatial-element/ListSection.svelte +17 -5
- package/dist/spatial-element/ListSection.svelte.d.ts +5 -0
- package/dist/spatial-element/PointerHint.svelte +3 -1
- package/dist/spatial-element/Section.svelte +51 -40
- package/dist/spatial-element/Section.svelte.d.ts +1 -0
- package/dist/spatial-element/SectionSurfaceGroup.svelte +34 -0
- package/dist/spatial-element/SectionSurfaceGroup.svelte.d.ts +7 -0
- package/dist/spatial-element/SpatialCardPresentation.svelte +378 -0
- package/dist/spatial-element/SpatialCardPresentation.svelte.d.ts +13 -0
- package/dist/spatial-element/SpatialCardSlot.svelte +33 -0
- package/dist/spatial-element/SpatialCardSlot.svelte.d.ts +8 -0
- package/dist/spatial-element/SpatialElementBreadcrumbs.svelte +20 -12
- package/dist/spatial-element/SpatialElementBreadcrumbs.svelte.d.ts +1 -0
- package/dist/spatial-element/SpatialElementCard.svelte +19 -318
- package/dist/spatial-element/SpatialElementCard.svelte.d.ts +3 -0
- package/dist/spatial-element/SpatialElementHelp.svelte +21 -15
- package/dist/spatial-element/SpatialElementHelp.svelte.d.ts +4 -1
- package/dist/spatial-element/SpatialElementMediaRail.svelte +75 -21
- package/dist/spatial-element/SpatialElementMediaRail.svelte.d.ts +3 -0
- package/dist/spatial-element/SpatialElementNativeMedia.svelte +36 -0
- package/dist/spatial-element/SpatialElementNativeMedia.svelte.d.ts +9 -0
- package/dist/spatial-element/SpatialElementPage.svelte +127 -68
- package/dist/spatial-element/SpatialElementPage.svelte.d.ts +1 -0
- package/dist/spatial-element/SpatialElementStickyHeader.svelte +36 -69
- package/dist/spatial-element/SpatialElementStickyHeader.svelte.d.ts +1 -0
- package/dist/spatial-element/SpatialElementSummaryContent.svelte +14 -11
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte +29 -20
- package/dist/spatial-element/SpatialElementSummaryPanel.svelte.d.ts +1 -0
- package/dist/spatial-element/SpatialElementTabList.svelte +19 -3
- package/dist/spatial-element/SpatialElementTabs.svelte +56 -16
- package/dist/spatial-element/SpatialElementTabs.svelte.d.ts +1 -0
- package/dist/spatial-element/SpatialElementViewToggle.svelte +5 -4
- package/dist/spatial-element/SpatialIconButton.svelte +4 -2
- package/dist/spatial-element/SpatialNavigationShell.svelte +129 -0
- package/dist/spatial-element/SpatialNavigationShell.svelte.d.ts +10 -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/cardAppearanceFreeze.d.ts +5 -0
- package/dist/spatial-element/cardAppearanceFreeze.js +72 -0
- package/dist/spatial-element/index.d.ts +6 -2
- package/dist/spatial-element/index.js +3 -1
- package/dist/spatial-element/layout.generated.css +455 -0
- package/dist/spatial-element/presentationBoxFreeze.d.ts +8 -0
- package/dist/spatial-element/presentationBoxFreeze.js +35 -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 +37 -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.js +10 -4
- package/dist/stage/ButtonGroup.svelte +1 -1
- package/dist/stage/Panel.svelte +16 -4
- package/dist/stage/Stage.svelte +183 -26
- package/dist/stage/Stage.svelte.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { ResolvedSpatialElementData as SpatialElementData } from '@spatial-elements/core/spatial-element/spatialElement';
|
|
3
3
|
import { catalogActionSemantic } from '@spatial-elements/core/catalog/catalogAction';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import ShoppingCart from 'lucide-svelte/icons/shopping-cart';
|
|
5
|
+
import './layout.generated.css';
|
|
6
6
|
import { createCatalogEndpointAction } from '../catalog/catalogEndpointAction.js';
|
|
7
7
|
const catalogEndpoint = createCatalogEndpointAction();
|
|
8
8
|
import type { SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
|
|
9
9
|
|
|
10
10
|
let {
|
|
11
|
-
activeSectionId,
|
|
12
11
|
spatialElement,
|
|
13
|
-
sections
|
|
14
12
|
}: {
|
|
15
13
|
activeSectionId?: string;
|
|
16
14
|
spatialElement: SpatialElementData;
|
|
@@ -54,6 +52,7 @@
|
|
|
54
52
|
|
|
55
53
|
<div class="sticky-header-layout">
|
|
56
54
|
<div class="sticky-header-copy">
|
|
55
|
+
{#if spatialElement.eyebrow}
|
|
57
56
|
<p
|
|
58
57
|
class="sticky-header-kicker"
|
|
59
58
|
use:catalogEndpoint={{
|
|
@@ -65,6 +64,7 @@
|
|
|
65
64
|
>
|
|
66
65
|
{spatialElement.eyebrow}
|
|
67
66
|
</p>
|
|
67
|
+
{/if}
|
|
68
68
|
<p
|
|
69
69
|
class="sticky-header-title"
|
|
70
70
|
use:catalogEndpoint={{
|
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
{#if spatialElement.action.href}
|
|
83
83
|
<a
|
|
84
84
|
class="sticky-header-action"
|
|
85
|
+
data-spatial-element-dock-action
|
|
85
86
|
use:catalogEndpoint={{
|
|
86
87
|
brandId: spatialElement.brandId,
|
|
87
88
|
spatialElementId: spatialElement.id,
|
|
@@ -92,7 +93,7 @@
|
|
|
92
93
|
data-catalog-semantic={catalogActionSemantic(spatialElement.action)}
|
|
93
94
|
href={spatialElement.action.href}
|
|
94
95
|
rel="external"
|
|
95
|
-
aria-label={spatialElement.action.ariaLabel}
|
|
96
|
+
aria-label={spatialElement.action.ariaLabel ?? spatialElement.action.label}
|
|
96
97
|
>
|
|
97
98
|
<ShoppingCart size={29} strokeWidth={2} aria-hidden="true" />
|
|
98
99
|
</a>
|
|
@@ -107,8 +108,9 @@
|
|
|
107
108
|
data-catalog-rich-shared="primary-action"
|
|
108
109
|
data-catalog-semantic={catalogActionSemantic(spatialElement.action)}
|
|
109
110
|
class="sticky-header-action"
|
|
111
|
+
data-spatial-element-dock-action
|
|
110
112
|
type="button"
|
|
111
|
-
|
|
113
|
+
aria-label={spatialElement.action.ariaLabel ?? spatialElement.action.label}
|
|
112
114
|
>
|
|
113
115
|
<ShoppingCart size={29} strokeWidth={2} aria-hidden="true" />
|
|
114
116
|
</button>
|
|
@@ -123,7 +125,7 @@
|
|
|
123
125
|
aria-hidden="true"
|
|
124
126
|
inert
|
|
125
127
|
>
|
|
126
|
-
|
|
128
|
+
<!-- The controller moves the existing live tab list here when it docks. -->
|
|
127
129
|
</div>
|
|
128
130
|
</header>
|
|
129
131
|
|
|
@@ -134,20 +136,15 @@
|
|
|
134
136
|
border-radius: inherit;
|
|
135
137
|
pointer-events: none;
|
|
136
138
|
}
|
|
137
|
-
@media (max-width: 1100px) {
|
|
138
|
-
.sticky-header-summary-surface {
|
|
139
|
-
right: 66px;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
139
|
.spatial-element-sticky-header {
|
|
143
140
|
position: fixed;
|
|
144
141
|
/* SpatialElementDockController portals this element outside the translated document. */
|
|
145
|
-
top:
|
|
146
|
-
left:
|
|
142
|
+
top: 0;
|
|
143
|
+
left: 0;
|
|
147
144
|
z-index: 20;
|
|
148
145
|
box-sizing: border-box;
|
|
149
|
-
width:
|
|
150
|
-
height:
|
|
146
|
+
width: 100%;
|
|
147
|
+
height: var(--spatial-detail-dock-height);
|
|
151
148
|
border: 0;
|
|
152
149
|
border-radius: var(--spatial-element-panel-radius);
|
|
153
150
|
visibility: hidden;
|
|
@@ -168,7 +165,7 @@
|
|
|
168
165
|
position: fixed;
|
|
169
166
|
z-index: 4;
|
|
170
167
|
display: block;
|
|
171
|
-
border-radius: var(--spatial-element-
|
|
168
|
+
border-radius: var(--spatial-element-control-radius);
|
|
172
169
|
background: transparent;
|
|
173
170
|
cursor: pointer;
|
|
174
171
|
}
|
|
@@ -179,13 +176,13 @@
|
|
|
179
176
|
}
|
|
180
177
|
|
|
181
178
|
.spatial-element-sticky-tabs {
|
|
182
|
-
--spatial-element-tabs-dock-top-radius: var(--spatial-element-
|
|
183
|
-
--spatial-element-tabs-dock-bottom-radius: var(--spatial-element-
|
|
179
|
+
--spatial-element-tabs-dock-top-radius: var(--spatial-element-control-radius);
|
|
180
|
+
--spatial-element-tabs-dock-bottom-radius: var(--spatial-element-control-radius);
|
|
184
181
|
|
|
185
182
|
position: fixed;
|
|
186
183
|
z-index: 19;
|
|
187
184
|
box-sizing: border-box;
|
|
188
|
-
height:
|
|
185
|
+
height: var(--spatial-detail-submenu-height);
|
|
189
186
|
padding: 0;
|
|
190
187
|
border: 0;
|
|
191
188
|
border-radius: var(--spatial-element-tabs-dock-top-radius)
|
|
@@ -254,13 +251,13 @@
|
|
|
254
251
|
display: grid;
|
|
255
252
|
position: relative;
|
|
256
253
|
z-index: 3;
|
|
257
|
-
grid-template-columns: minmax(0, 1fr)
|
|
254
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
258
255
|
align-items: center;
|
|
259
256
|
gap: 16px;
|
|
260
257
|
box-sizing: border-box;
|
|
261
258
|
width: 100%;
|
|
262
259
|
height: 100%;
|
|
263
|
-
padding:
|
|
260
|
+
padding: 8px 16px 8px var(--spatial-element-sticky-minimap-reserve, 96px);
|
|
264
261
|
opacity: var(--spatial-element-sticky-header-progress, 0);
|
|
265
262
|
}
|
|
266
263
|
|
|
@@ -271,7 +268,7 @@
|
|
|
271
268
|
|
|
272
269
|
.sticky-header-copy {
|
|
273
270
|
display: grid;
|
|
274
|
-
gap:
|
|
271
|
+
gap: 0;
|
|
275
272
|
min-width: 0;
|
|
276
273
|
}
|
|
277
274
|
|
|
@@ -282,75 +279,45 @@
|
|
|
282
279
|
}
|
|
283
280
|
|
|
284
281
|
.sticky-header-kicker {
|
|
285
|
-
|
|
282
|
+
overflow: hidden;
|
|
283
|
+
text-overflow: ellipsis;
|
|
284
|
+
white-space: nowrap;
|
|
285
|
+
font-size: 14px;
|
|
286
286
|
font-weight: 400;
|
|
287
|
-
line-height:
|
|
287
|
+
line-height: 20px;
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
.sticky-header-title {
|
|
291
291
|
overflow: hidden;
|
|
292
292
|
font-size: 24px;
|
|
293
|
-
font-weight:
|
|
294
|
-
line-height:
|
|
293
|
+
font-weight: 600;
|
|
294
|
+
line-height: 32px;
|
|
295
295
|
text-overflow: ellipsis;
|
|
296
296
|
white-space: nowrap;
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
.sticky-header-action {
|
|
300
|
+
visibility: hidden;
|
|
300
301
|
display: grid;
|
|
301
302
|
place-items: center;
|
|
302
|
-
width:
|
|
303
|
-
height:
|
|
303
|
+
width: 40px;
|
|
304
|
+
height: 40px;
|
|
304
305
|
padding: 0;
|
|
305
306
|
border: 0;
|
|
306
|
-
border-radius:
|
|
307
|
+
border-radius: var(--spatial-element-control-radius);
|
|
307
308
|
color: var(--spatial-element-on-accent);
|
|
308
309
|
background: var(--spatial-element-accent);
|
|
309
310
|
text-decoration: none;
|
|
310
311
|
cursor: pointer;
|
|
311
312
|
}
|
|
313
|
+
.spatial-element-sticky-header:global([data-action-active]) .sticky-header-action { visibility: visible; }
|
|
312
314
|
|
|
313
|
-
@media (
|
|
314
|
-
.spatial-element-sticky-header {
|
|
315
|
-
top: 8px;
|
|
316
|
-
left: 8px;
|
|
317
|
-
width: calc(100vw - 16px);
|
|
318
|
-
height: 72px;
|
|
319
|
-
border-radius: min(var(--spatial-element-panel-radius), 14px);
|
|
320
|
-
}
|
|
321
|
-
|
|
315
|
+
@media (width < 840px) {
|
|
322
316
|
.sticky-header-layout {
|
|
323
|
-
grid-template-columns: minmax(0, 1fr) 48px;
|
|
324
317
|
gap: 8px;
|
|
325
|
-
padding:
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
.sticky-header-copy {
|
|
329
|
-
gap: 2px;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
.sticky-header-kicker {
|
|
333
|
-
font-size: 13px;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
.sticky-header-title {
|
|
337
|
-
font-size: 17px;
|
|
338
|
-
font-weight: 600;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
.sticky-header-action {
|
|
342
|
-
width: 48px;
|
|
343
|
-
height: 48px;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
@media (max-width: 460px) {
|
|
348
|
-
.sticky-header-kicker {
|
|
349
|
-
font-size: 12px;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
.sticky-header-title {
|
|
353
|
-
font-size: 15px;
|
|
318
|
+
padding-right: 8px;
|
|
354
319
|
}
|
|
320
|
+
.sticky-header-title { font-size: 18px; line-height: 24px; }
|
|
321
|
+
.spatial-element-sticky-tabs { display: none; }
|
|
355
322
|
}
|
|
356
323
|
</style>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ResolvedSpatialElementData as SpatialElementData } from '@spatial-elements/core/spatial-element/spatialElement';
|
|
2
|
+
import './layout.generated.css';
|
|
2
3
|
import type { SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
|
|
3
4
|
type $$ComponentProps = {
|
|
4
5
|
activeSectionId?: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { catalogActionSemantic } from '@spatial-elements/core/catalog/catalogAction';
|
|
3
3
|
import type { CatalogEndpointAddress, CatalogEndpointRole } from '@spatial-elements/core/catalog/CatalogEndpointRegistry';
|
|
4
4
|
import type { SpatialElementFeature, SpatialElementAction } from '@spatial-elements/core/spatial-element/types';
|
|
5
|
-
import
|
|
5
|
+
import ShoppingCart from 'lucide-svelte/icons/shopping-cart';
|
|
6
6
|
import { createCatalogEndpointAction } from '../catalog/catalogEndpointAction.js';
|
|
7
7
|
let { spatialElement, address, contentInset, heading = 'h3', element = $bindable() }: {
|
|
8
8
|
spatialElement: { id: string; eyebrow: string; title: string; features: SpatialElementFeature[]; action?: SpatialElementAction };
|
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
} = $props();
|
|
14
14
|
const catalogEndpoint = createCatalogEndpointAction();
|
|
15
15
|
</script>
|
|
16
|
-
<div bind:this={element} class="summary-presentation"
|
|
16
|
+
<div bind:this={element} class="summary-presentation">
|
|
17
17
|
<div class="panel-copy">
|
|
18
|
+
{#if spatialElement.eyebrow}
|
|
18
19
|
<p
|
|
19
20
|
class="panel-kicker"
|
|
20
21
|
data-shared-role="eyebrow"
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
>
|
|
24
25
|
{spatialElement.eyebrow}
|
|
25
26
|
</p>
|
|
27
|
+
{/if}
|
|
26
28
|
<svelte:element this={heading} class="summary-title"
|
|
27
29
|
id={heading === 'h1' ? 'spatial-element-title' : undefined}
|
|
28
30
|
tabindex={heading === 'h1' ? -1 : undefined}
|
|
@@ -34,7 +36,7 @@
|
|
|
34
36
|
</svelte:element>
|
|
35
37
|
</div>
|
|
36
38
|
|
|
37
|
-
<ul
|
|
39
|
+
{#if spatialElement.features.length}<ul
|
|
38
40
|
class="feature-list"
|
|
39
41
|
aria-label="SpatialElement highlights"
|
|
40
42
|
use:catalogEndpoint={address('features')}
|
|
@@ -49,7 +51,7 @@
|
|
|
49
51
|
</span>
|
|
50
52
|
</li>
|
|
51
53
|
{/each}
|
|
52
|
-
</ul>
|
|
54
|
+
</ul>{/if}
|
|
53
55
|
|
|
54
56
|
{#if spatialElement.action}
|
|
55
57
|
{#if spatialElement.action.href}
|
|
@@ -100,15 +102,15 @@
|
|
|
100
102
|
box-sizing: border-box;
|
|
101
103
|
display: flex;
|
|
102
104
|
flex-direction: column;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
gap: 20px;
|
|
106
|
+
/* The same live panel can leave a Section for the stage's detail layer. */
|
|
107
|
+
line-height: 24px;
|
|
105
108
|
pointer-events: auto;
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
.summary-title {
|
|
109
|
-
max-width: 390px;
|
|
110
112
|
margin: 10px 0 0;
|
|
111
|
-
font-size:
|
|
113
|
+
font-size: 24px;
|
|
112
114
|
font-weight: 780;
|
|
113
115
|
line-height: 1.16;
|
|
114
116
|
}
|
|
@@ -123,11 +125,11 @@
|
|
|
123
125
|
|
|
124
126
|
.feature-list {
|
|
125
127
|
display: grid;
|
|
126
|
-
gap:
|
|
128
|
+
gap: 12px;
|
|
127
129
|
margin: 0;
|
|
128
130
|
padding: 0;
|
|
129
131
|
color: var(--spatial-element-body);
|
|
130
|
-
font-size:
|
|
132
|
+
font-size: 16px;
|
|
131
133
|
list-style: none;
|
|
132
134
|
}
|
|
133
135
|
|
|
@@ -176,7 +178,8 @@
|
|
|
176
178
|
}
|
|
177
179
|
|
|
178
180
|
.spatial-element-action-label {
|
|
179
|
-
white-space:
|
|
181
|
+
white-space: normal;
|
|
180
182
|
}
|
|
183
|
+
@container spatial-summary (min-width: 420px) { .summary-title { font-size: 32px; } }
|
|
181
184
|
|
|
182
185
|
</style>
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { resolveSpatialThemeRadii } from '@spatial-elements/core/spatial-element/spatialTheme';
|
|
2
3
|
import { onMount } from 'svelte';
|
|
3
|
-
import
|
|
4
|
+
import SpatialSummarySlot from './SpatialSummarySlot.svelte';
|
|
4
5
|
import Panel from '../stage/Panel.svelte';
|
|
5
6
|
import { useSpatialTheme } from './brandContext.js';
|
|
6
7
|
import type { ResolvedSpatialElementData as SpatialElementData } from '@spatial-elements/core/spatial-element/spatialElement';
|
|
7
8
|
|
|
8
|
-
let { spatialElement }: { spatialElement: SpatialElementData } = $props();
|
|
9
|
+
let { spatialElement, nativeContent = false }: { spatialElement: SpatialElementData; nativeContent?: boolean } = $props();
|
|
9
10
|
const readTheme = useSpatialTheme();
|
|
10
11
|
const theme = $derived(readTheme());
|
|
12
|
+
const radii = $derived(resolveSpatialThemeRadii(theme));
|
|
11
13
|
const contentInset = $derived(theme.panelShape.contentInset ?? Math.max(16, Math.round(theme.panelShape.radius * 0.7)));
|
|
12
14
|
let presentation = $state<HTMLDivElement>(null!);
|
|
13
15
|
let panelHeight = $state<number>();
|
|
@@ -15,18 +17,24 @@
|
|
|
15
17
|
onMount(() => {
|
|
16
18
|
// The stage reparents the rendered content. Keep its layout placeholder in
|
|
17
19
|
// sync using untransformed content size, including wrapping and font loads.
|
|
18
|
-
|
|
20
|
+
// Explicit ownership transfers finish their reflow before revealing pixels.
|
|
21
|
+
// offsetHeight is untransformed, unlike the projected CSS3D bounding box.
|
|
22
|
+
const measureTransfer = () => { panelHeight = presentation.offsetHeight + contentInset * 2; };
|
|
23
|
+
measureTransfer();
|
|
24
|
+
presentation.addEventListener('spatial-summary-measure', measureTransfer);
|
|
19
25
|
const observer = new ResizeObserver(([entry]) => {
|
|
20
26
|
const height = entry.borderBoxSize?.[0]?.blockSize ?? presentation.offsetHeight;
|
|
21
|
-
panelHeight = Math.
|
|
27
|
+
panelHeight = Math.ceil(height + contentInset * 2);
|
|
22
28
|
});
|
|
23
29
|
observer.observe(presentation);
|
|
24
|
-
return () => observer.disconnect();
|
|
30
|
+
return () => { observer.disconnect(); presentation.removeEventListener('spatial-summary-measure', measureTransfer); };
|
|
25
31
|
});
|
|
26
32
|
</script>
|
|
27
33
|
|
|
28
|
-
<div class="spatial-element-aside" style:--summary-panel-height={panelHeight === undefined ? undefined : `${panelHeight}px`}>
|
|
34
|
+
<div class="spatial-element-aside" data-spatial-summary-aside style:--summary-panel-height={panelHeight === undefined ? undefined : `${panelHeight}px`}>
|
|
29
35
|
<Panel
|
|
36
|
+
{nativeContent}
|
|
37
|
+
surface={nativeContent ? 'frosted' : undefined}
|
|
30
38
|
catalogEndpoint={{
|
|
31
39
|
brandId: theme.id,
|
|
32
40
|
spatialElementId: spatialElement.id,
|
|
@@ -34,9 +42,10 @@
|
|
|
34
42
|
role: 'summary-surface'
|
|
35
43
|
}}
|
|
36
44
|
pointerReactive={false}
|
|
45
|
+
focusReactive={!nativeContent}
|
|
37
46
|
transitionGroup="shared"
|
|
38
47
|
class="spatial-element-panel"
|
|
39
|
-
shape={theme.panelShape}
|
|
48
|
+
shape={{ ...theme.panelShape, radius: radii.panel, contentInset }}
|
|
40
49
|
theme={theme.panelTheme}
|
|
41
50
|
contentClass="stage-panel-content spatial-element-content"
|
|
42
51
|
aria-labelledby="spatial-element-title"
|
|
@@ -44,23 +53,27 @@
|
|
|
44
53
|
data-shared-role="summary-surface"
|
|
45
54
|
data-spatial-element-id={spatialElement.id}
|
|
46
55
|
>
|
|
47
|
-
|
|
48
|
-
|
|
56
|
+
<SpatialSummarySlot instanceKey={`detail:${theme.id}:${spatialElement.id}`} bind:element={presentation}
|
|
57
|
+
context={{ spatialElement, contentInset, heading: 'h1', mode: 'detail',
|
|
58
|
+
address: (role) => ({ brandId: theme.id, spatialElementId: spatialElement.id, slot: 'detail.summary', role }) }} />
|
|
49
59
|
</Panel>
|
|
50
60
|
</div>
|
|
51
61
|
|
|
52
62
|
<style>
|
|
53
63
|
.spatial-element-aside {
|
|
54
64
|
position: relative;
|
|
55
|
-
min-
|
|
65
|
+
min-width: 0;
|
|
66
|
+
width: var(--spatial-detail-summary-width);
|
|
67
|
+
margin-top: var(--spatial-detail-summary-gap);
|
|
68
|
+
margin-inline: auto;
|
|
56
69
|
}
|
|
57
70
|
|
|
58
71
|
:global(.spatial-element-panel) {
|
|
59
|
-
position:
|
|
60
|
-
|
|
61
|
-
width: min(494px, 100%);
|
|
72
|
+
position: relative;
|
|
73
|
+
width: 100%;
|
|
62
74
|
height: var(--summary-panel-height, auto);
|
|
63
|
-
|
|
75
|
+
max-height: var(--spatial-detail-summary-max-height);
|
|
76
|
+
min-height: 0;
|
|
64
77
|
pointer-events: auto;
|
|
65
78
|
}
|
|
66
79
|
|
|
@@ -72,11 +85,7 @@
|
|
|
72
85
|
}
|
|
73
86
|
|
|
74
87
|
|
|
75
|
-
@media (
|
|
76
|
-
.spatial-element-aside {
|
|
77
|
-
:global(.spatial-element-panel) {
|
|
78
|
-
position: relative;
|
|
79
|
-
top: auto;
|
|
80
|
-
}
|
|
88
|
+
@media (min-width: 840px) {
|
|
89
|
+
.spatial-element-aside { position: absolute; top: 0; right: var(--spatial-detail-summary-right); margin: 0; }
|
|
81
90
|
}
|
|
82
91
|
</style>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ResolvedSpatialElementData as SpatialElementData } from '@spatial-elements/core/spatial-element/spatialElement';
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
spatialElement: SpatialElementData;
|
|
4
|
+
nativeContent?: boolean;
|
|
4
5
|
};
|
|
5
6
|
declare const SpatialElementSummaryPanel: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
7
|
type SpatialElementSummaryPanel = ReturnType<typeof SpatialElementSummaryPanel>;
|
|
@@ -96,8 +96,17 @@
|
|
|
96
96
|
data-spatial-element-tab-id={section.id}
|
|
97
97
|
data-spatial-element-tab-label={section.title}
|
|
98
98
|
aria-current={currentSectionId === section.id ? 'location' : undefined}
|
|
99
|
+
aria-label={section.id === 'overview' ? section.title : undefined}
|
|
100
|
+
class:overview={section.id === 'overview'}
|
|
99
101
|
>
|
|
100
|
-
|
|
102
|
+
{#if section.id === 'overview'}
|
|
103
|
+
<!-- Author-supplied detail-overview.svg; see layout source manifest. -->
|
|
104
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
105
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
106
|
+
<path d="M12 10.5 L9 13.5 M12 16.5 L12 10.5 M15 13.5 L12 10.5 M2 6.5 L22 6.5" />
|
|
107
|
+
<rect x="2" y="3" width="20" height="18" rx="2" />
|
|
108
|
+
</svg>
|
|
109
|
+
{:else}<span>{section.title}</span>{/if}
|
|
101
110
|
</a>
|
|
102
111
|
{/each}
|
|
103
112
|
</div>
|
|
@@ -108,11 +117,11 @@
|
|
|
108
117
|
--spatial-element-tab-font-size: 16px;
|
|
109
118
|
--spatial-element-tab-highlight-top-radius: var(
|
|
110
119
|
--spatial-element-tabs-dock-top-radius,
|
|
111
|
-
var(--spatial-element-
|
|
120
|
+
var(--spatial-element-control-radius, 12px)
|
|
112
121
|
);
|
|
113
122
|
--spatial-element-tab-highlight-bottom-radius: var(
|
|
114
123
|
--spatial-element-tabs-dock-bottom-radius,
|
|
115
|
-
var(--spatial-element-
|
|
124
|
+
var(--spatial-element-control-radius, 12px)
|
|
116
125
|
);
|
|
117
126
|
|
|
118
127
|
display: flex;
|
|
@@ -219,6 +228,8 @@
|
|
|
219
228
|
content: attr(data-spatial-element-tab-label);
|
|
220
229
|
visibility: hidden;
|
|
221
230
|
}
|
|
231
|
+
a.overview { width: 48px; padding: 0 12px; }
|
|
232
|
+
a.overview::before { content: none; }
|
|
222
233
|
|
|
223
234
|
.spatial-element-tab-list:global([data-mouse-hover]) a:hover:not([aria-current='location']) {
|
|
224
235
|
background: color-mix(in srgb, var(--spatial-element-body) 8%, transparent);
|
|
@@ -249,6 +260,11 @@
|
|
|
249
260
|
outline-offset: -2px;
|
|
250
261
|
}
|
|
251
262
|
|
|
263
|
+
/* This node keeps its own visibility contract after leaving the source panel. */
|
|
264
|
+
@media (width < 840px) {
|
|
265
|
+
.spatial-element-tab-list { display: none; }
|
|
266
|
+
}
|
|
267
|
+
|
|
252
268
|
@media (max-width: 620px) {
|
|
253
269
|
.spatial-element-tab-list {
|
|
254
270
|
--spatial-element-tab-font-size: 15px;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { resolveSpatialThemeRadii } from '@spatial-elements/core/spatial-element/spatialTheme';
|
|
2
3
|
import { onMount, tick } from 'svelte';
|
|
3
4
|
import Panel from '../stage/Panel.svelte';
|
|
4
5
|
import { STAGE_PANEL_LAYOUT_EVENT } from '@spatial-elements/core/stage/panelContext';
|
|
5
6
|
import SpatialElementTabList from './SpatialElementTabList.svelte';
|
|
6
7
|
import { useSpatialTheme } from './brandContext.js';
|
|
8
|
+
import './layout.generated.css';
|
|
7
9
|
import type { SpatialElementSectionNavigationItem } from '@spatial-elements/core/spatial-element/types';
|
|
8
10
|
|
|
9
11
|
let {
|
|
@@ -13,44 +15,78 @@
|
|
|
13
15
|
activeSectionId?: string;
|
|
14
16
|
sections: SpatialElementSectionNavigationItem[];
|
|
15
17
|
} = $props();
|
|
16
|
-
let anchorElement: HTMLDivElement;
|
|
18
|
+
let anchorElement: HTMLDivElement | null | undefined;
|
|
17
19
|
const readTheme = useSpatialTheme();
|
|
18
20
|
const theme = $derived(readTheme());
|
|
21
|
+
const radii = $derived(resolveSpatialThemeRadii(theme));
|
|
19
22
|
|
|
20
23
|
onMount(() => {
|
|
21
24
|
let resizeObserver: ResizeObserver | undefined;
|
|
22
25
|
let mutationObserver: MutationObserver | undefined;
|
|
23
26
|
let measureFrame = 0;
|
|
24
27
|
let measuredNaturalWidth = 0;
|
|
28
|
+
let tabList: HTMLElement | null = null;
|
|
25
29
|
let disposed = false;
|
|
26
30
|
|
|
27
31
|
const measure = () => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
32
|
+
// bind:this can already be cleared while a queued measurement still owns
|
|
33
|
+
// this callback. Cleanup cancels pending RAFs, but is not a DOM lease.
|
|
34
|
+
const anchor = anchorElement;
|
|
35
|
+
if (disposed || !anchor?.isConnected) return;
|
|
36
|
+
const frame = anchor.querySelector<HTMLElement>('[data-stage-panel-fallback]');
|
|
37
|
+
tabList ??= anchor.querySelector<HTMLElement>('[data-spatial-element-tab-list]');
|
|
31
38
|
const links = tabList?.querySelector<HTMLElement>('[data-spatial-element-tab-links]');
|
|
32
39
|
if (!frame || !tabList || !links) return;
|
|
40
|
+
if (getComputedStyle(anchor).display === 'none') return;
|
|
33
41
|
|
|
34
|
-
|
|
42
|
+
let linksWidth = links.scrollWidth;
|
|
43
|
+
if (linksWidth < 1) {
|
|
44
|
+
// A submenu first opened at XS/S has no intrinsic width yet. Once
|
|
45
|
+
// it enters M, its portaled runtime is still culled by that zero-width
|
|
46
|
+
// source frame. Measure the same nodes without painting them, then
|
|
47
|
+
// restore the exact renderer-owned styles in this synchronous turn.
|
|
48
|
+
const hidden: { node: HTMLElement; display: string; displayPriority: string;
|
|
49
|
+
visibility: string; visibilityPriority: string }[] = [];
|
|
50
|
+
for (let node: HTMLElement | null = tabList; node && !node.classList.contains('stage'); node = node.parentElement) {
|
|
51
|
+
if (getComputedStyle(node).display !== 'none') continue;
|
|
52
|
+
hidden.push({ node, display: node.style.getPropertyValue('display'),
|
|
53
|
+
displayPriority: node.style.getPropertyPriority('display'),
|
|
54
|
+
visibility: node.style.getPropertyValue('visibility'),
|
|
55
|
+
visibilityPriority: node.style.getPropertyPriority('visibility') });
|
|
56
|
+
node.style.setProperty('visibility', 'hidden', 'important');
|
|
57
|
+
node.style.setProperty('display', 'block', 'important');
|
|
58
|
+
}
|
|
59
|
+
try { linksWidth = links.scrollWidth; }
|
|
60
|
+
finally {
|
|
61
|
+
for (const state of hidden) {
|
|
62
|
+
if (state.display) state.node.style.setProperty('display', state.display, state.displayPriority);
|
|
63
|
+
else state.node.style.removeProperty('display');
|
|
64
|
+
if (state.visibility) state.node.style.setProperty('visibility', state.visibility, state.visibilityPriority);
|
|
65
|
+
else state.node.style.removeProperty('visibility');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
35
69
|
if (linksWidth < 1) return;
|
|
36
|
-
|
|
37
|
-
|
|
70
|
+
const naturalWidth = Math.ceil(linksWidth);
|
|
71
|
+
if (naturalWidth === measuredNaturalWidth) return;
|
|
72
|
+
measuredNaturalWidth = naturalWidth;
|
|
38
73
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
anchorElement.toggleAttribute('data-spatial-element-tabs-measured', true);
|
|
74
|
+
anchor.style.setProperty('--spatial-element-tabs-natural-width', `${measuredNaturalWidth}px`);
|
|
75
|
+
anchor.toggleAttribute('data-spatial-element-tabs-measured', true);
|
|
42
76
|
window.dispatchEvent(new Event(STAGE_PANEL_LAYOUT_EVENT));
|
|
43
77
|
};
|
|
44
78
|
|
|
45
79
|
const scheduleMeasure = () => {
|
|
46
80
|
if (disposed || measureFrame) return;
|
|
47
|
-
measureFrame = requestAnimationFrame(
|
|
81
|
+
measureFrame = requestAnimationFrame(() => {
|
|
82
|
+
measureFrame = 0;
|
|
83
|
+
measure();
|
|
84
|
+
});
|
|
48
85
|
};
|
|
49
86
|
|
|
50
87
|
void tick().then(() => {
|
|
51
88
|
if (disposed) return;
|
|
52
89
|
measure();
|
|
53
|
-
const tabList = anchorElement.querySelector<HTMLElement>('[data-spatial-element-tab-list="panel"]');
|
|
54
90
|
if ('ResizeObserver' in window && tabList) {
|
|
55
91
|
resizeObserver = new ResizeObserver(scheduleMeasure);
|
|
56
92
|
resizeObserver.observe(tabList);
|
|
@@ -65,6 +101,7 @@
|
|
|
65
101
|
}
|
|
66
102
|
});
|
|
67
103
|
window.addEventListener('resize', scheduleMeasure, { passive: true });
|
|
104
|
+
void document.fonts?.ready.then(scheduleMeasure);
|
|
68
105
|
|
|
69
106
|
return () => {
|
|
70
107
|
disposed = true;
|
|
@@ -81,7 +118,7 @@
|
|
|
81
118
|
transitionGroup="enter"
|
|
82
119
|
class="spatial-element-tabs-panel"
|
|
83
120
|
pointerReactive={false}
|
|
84
|
-
shape={{ ...theme.panelShape, contentInset: 0 }}
|
|
121
|
+
shape={{ ...theme.panelShape, radius: radii.control, contentInset: 0 }}
|
|
85
122
|
theme={theme.panelTheme}
|
|
86
123
|
contentClass="spatial-element-tabs-panel-content"
|
|
87
124
|
>
|
|
@@ -95,7 +132,7 @@
|
|
|
95
132
|
z-index: 4;
|
|
96
133
|
width: fit-content;
|
|
97
134
|
max-width: 100%;
|
|
98
|
-
height: var(--spatial-
|
|
135
|
+
height: var(--spatial-detail-submenu-height);
|
|
99
136
|
pointer-events: auto;
|
|
100
137
|
}
|
|
101
138
|
|
|
@@ -106,8 +143,8 @@
|
|
|
106
143
|
:global(.spatial-element-tabs-panel) {
|
|
107
144
|
width: max-content;
|
|
108
145
|
max-width: 100%;
|
|
109
|
-
height: var(--spatial-
|
|
110
|
-
min-height: var(--spatial-
|
|
146
|
+
height: var(--spatial-detail-submenu-height);
|
|
147
|
+
min-height: var(--spatial-detail-submenu-height);
|
|
111
148
|
pointer-events: auto;
|
|
112
149
|
}
|
|
113
150
|
|
|
@@ -121,4 +158,7 @@
|
|
|
121
158
|
border-radius: inherit;
|
|
122
159
|
overflow: hidden;
|
|
123
160
|
}
|
|
161
|
+
@media (width < 840px) {
|
|
162
|
+
.spatial-element-tabs-anchor { display: none; }
|
|
163
|
+
}
|
|
124
164
|
</style>
|