@r2digisolutions/components 0.12.0 → 0.13.0
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.
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
framed = false,
|
|
74
74
|
mainClass = '',
|
|
75
75
|
class: className = '',
|
|
76
|
-
actions,
|
|
76
|
+
actions: actionsSlot,
|
|
77
77
|
children
|
|
78
78
|
}: AppShellProps = $props();
|
|
79
79
|
|
|
@@ -98,7 +98,12 @@
|
|
|
98
98
|
};
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
-
const resolvedContextual = $derived(chrome.
|
|
101
|
+
const resolvedContextual = $derived(chrome.source?.() ?? propContextual);
|
|
102
|
+
const contextualKey = $derived(
|
|
103
|
+
resolvedContextual
|
|
104
|
+
? `${resolvedContextual.parentHref ?? ''}:${resolvedContextual.brand ?? ''}:${resolvedContextual.description ?? ''}`
|
|
105
|
+
: ''
|
|
106
|
+
);
|
|
102
107
|
const showRail = $derived(rail.length > 0 || railFooter.length > 0);
|
|
103
108
|
let mobileOpen = $state(false);
|
|
104
109
|
|
|
@@ -198,26 +203,28 @@
|
|
|
198
203
|
{/if}
|
|
199
204
|
|
|
200
205
|
{#if resolvedContextual}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
206
|
+
{#key contextualKey}
|
|
207
|
+
<div
|
|
208
|
+
class={[
|
|
209
|
+
'z-40 h-full shrink-0',
|
|
210
|
+
!mobileOpen && 'max-md:hidden',
|
|
211
|
+
mobileOpen &&
|
|
212
|
+
mobileShowsContextual &&
|
|
213
|
+
'max-md:fixed max-md:inset-y-0 max-md:z-40 max-md:shadow-xl',
|
|
214
|
+
mobileOpen && mobileShowsContextual && showRail && 'max-md:left-14',
|
|
215
|
+
mobileOpen && mobileShowsContextual && !showRail && 'max-md:left-0'
|
|
216
|
+
]}
|
|
217
|
+
>
|
|
218
|
+
<Sidebar
|
|
219
|
+
brand={resolvedContextual.brand ?? brand}
|
|
220
|
+
groups={resolvedContextual.groups}
|
|
221
|
+
value={resolvedContextual.value}
|
|
222
|
+
collapsible={false}
|
|
223
|
+
header={resolvedContextual.header ?? contextualHeaderDefault}
|
|
224
|
+
onchange={onContextualNav}
|
|
225
|
+
/>
|
|
226
|
+
</div>
|
|
227
|
+
{/key}
|
|
221
228
|
{/if}
|
|
222
229
|
|
|
223
230
|
<div class="min-h-0 min-w-0 flex flex-1 flex-col">
|
|
@@ -261,7 +268,7 @@
|
|
|
261
268
|
</div>
|
|
262
269
|
{/snippet}
|
|
263
270
|
{#snippet actions()}
|
|
264
|
-
{#if
|
|
271
|
+
{#if actionsSlot}{@render actionsSlot()}{/if}
|
|
265
272
|
{/snippet}
|
|
266
273
|
</Navbar>
|
|
267
274
|
{/if}
|
|
@@ -12,7 +12,9 @@ export interface AppShellContextual {
|
|
|
12
12
|
onchange?: (id: string) => void;
|
|
13
13
|
}
|
|
14
14
|
export declare class AppChrome {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
/** Live reader so nested layouts stay reactive when `[id]` is reused. */
|
|
16
|
+
source: (() => AppShellContextual | null) | null;
|
|
17
|
+
get contextual(): AppShellContextual | null;
|
|
18
|
+
setContextual(nav: AppShellContextual | (() => AppShellContextual | null) | null): void;
|
|
17
19
|
}
|
|
18
20
|
export declare const getAppChrome: () => AppChrome, setAppChrome: (context: AppChrome) => AppChrome;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { createContext } from 'svelte';
|
|
2
2
|
export class AppChrome {
|
|
3
|
-
|
|
3
|
+
/** Live reader so nested layouts stay reactive when `[id]` is reused. */
|
|
4
|
+
source = $state.raw(null);
|
|
5
|
+
get contextual() {
|
|
6
|
+
return this.source?.() ?? null;
|
|
7
|
+
}
|
|
4
8
|
setContextual(nav) {
|
|
5
|
-
|
|
9
|
+
if (nav === null) {
|
|
10
|
+
this.source = null;
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
this.source = typeof nav === 'function' ? nav : () => nav;
|
|
6
14
|
}
|
|
7
15
|
}
|
|
8
16
|
export const [getAppChrome, setAppChrome] = createContext();
|