@noxlovette/material 0.1.36 → 0.2.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.
- package/dist/components/containers/app/App.svelte +13 -4
- package/dist/components/containers/app/App.svelte.d.ts +2 -1
- package/dist/components/containers/app/types.d.ts +8 -0
- package/dist/components/containers/panes/theme.d.ts +9 -0
- package/dist/components/containers/panes/theme.js +5 -2
- package/dist/components/nav/navbar/Navbar.svelte +13 -1
- package/dist/components/nav/navbar/types.d.ts +2 -0
- package/dist/components/nav/rail/Rail.svelte +11 -28
- package/dist/components/nav/rail/types.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
3
|
The core App wrapper that gives default backgrounds and sets up tooltips and icons.
|
|
4
|
-
|
|
4
|
+
By default it also manages the Material 3 Dynamic Theme and dark mode; pass
|
|
5
|
+
`dynamicTheme={false}` to opt out and rely on static theme CSS instead.
|
|
5
6
|
-->
|
|
6
7
|
<script lang="ts">
|
|
7
8
|
import { MaterialSymbolsProvider, Theme } from '../../../utils/index.js';
|
|
@@ -10,13 +11,21 @@ It manages the Material 3 Dynamic Theme, dark mode, and icon providers.
|
|
|
10
11
|
import type { AppProps } from './types';
|
|
11
12
|
import ThemeScript from '../../../utils/ThemeScript.svelte';
|
|
12
13
|
|
|
13
|
-
let {
|
|
14
|
+
let {
|
|
15
|
+
children,
|
|
16
|
+
class: className,
|
|
17
|
+
iconProviderProps = {},
|
|
18
|
+
dynamicTheme = true,
|
|
19
|
+
...restProps
|
|
20
|
+
}: AppProps = $props();
|
|
14
21
|
|
|
15
22
|
const baseCls = $derived(app({ class: className }));
|
|
16
23
|
</script>
|
|
17
24
|
|
|
18
|
-
|
|
19
|
-
<
|
|
25
|
+
{#if dynamicTheme}
|
|
26
|
+
<ThemeScript />
|
|
27
|
+
<Theme />
|
|
28
|
+
{/if}
|
|
20
29
|
<MaterialSymbolsProvider {...iconProviderProps} />
|
|
21
30
|
<Tooltip.Provider>
|
|
22
31
|
<div class={baseCls} {...restProps}>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { AppProps } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* The core App wrapper that gives default backgrounds and sets up tooltips and icons.
|
|
4
|
-
*
|
|
4
|
+
* By default it also manages the Material 3 Dynamic Theme and dark mode; pass
|
|
5
|
+
* `dynamicTheme={false}` to opt out and rely on static theme CSS instead.
|
|
5
6
|
*/
|
|
6
7
|
declare const App: import("svelte").Component<AppProps, {}, "">;
|
|
7
8
|
type App = ReturnType<typeof App>;
|
|
@@ -8,4 +8,12 @@ export type AppProps = DivAttrs & {
|
|
|
8
8
|
class?: string;
|
|
9
9
|
/** Props to pass to the material symbols provider */
|
|
10
10
|
iconProviderProps?: Partial<MaterialSymbolsProviderProps>;
|
|
11
|
+
/**
|
|
12
|
+
* Whether App manages the M3 dynamic theme (source-color extraction, dark-mode
|
|
13
|
+
* sync, and the injected `<ThemeScript>`/`<Theme>` head elements).
|
|
14
|
+
* Set to `false` if you supply your own static `@noxlovette/material/theme/*` CSS
|
|
15
|
+
* and want to opt out of the runtime dynamic-theming machinery entirely.
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
dynamicTheme?: boolean;
|
|
11
19
|
};
|
|
@@ -16,6 +16,7 @@ export declare const splitPane: import("tailwind-variants").TVReturnType<{
|
|
|
16
16
|
};
|
|
17
17
|
full: {
|
|
18
18
|
true: {
|
|
19
|
+
left: string;
|
|
19
20
|
right: string;
|
|
20
21
|
};
|
|
21
22
|
false: string;
|
|
@@ -23,9 +24,11 @@ export declare const splitPane: import("tailwind-variants").TVReturnType<{
|
|
|
23
24
|
rounded: {
|
|
24
25
|
true: {
|
|
25
26
|
left: string;
|
|
27
|
+
right: string;
|
|
26
28
|
};
|
|
27
29
|
false: {
|
|
28
30
|
left: string;
|
|
31
|
+
right: string;
|
|
29
32
|
};
|
|
30
33
|
};
|
|
31
34
|
}, {
|
|
@@ -49,6 +52,7 @@ export declare const splitPane: import("tailwind-variants").TVReturnType<{
|
|
|
49
52
|
};
|
|
50
53
|
full: {
|
|
51
54
|
true: {
|
|
55
|
+
left: string;
|
|
52
56
|
right: string;
|
|
53
57
|
};
|
|
54
58
|
false: string;
|
|
@@ -56,9 +60,11 @@ export declare const splitPane: import("tailwind-variants").TVReturnType<{
|
|
|
56
60
|
rounded: {
|
|
57
61
|
true: {
|
|
58
62
|
left: string;
|
|
63
|
+
right: string;
|
|
59
64
|
};
|
|
60
65
|
false: {
|
|
61
66
|
left: string;
|
|
67
|
+
right: string;
|
|
62
68
|
};
|
|
63
69
|
};
|
|
64
70
|
}, {
|
|
@@ -82,6 +88,7 @@ export declare const splitPane: import("tailwind-variants").TVReturnType<{
|
|
|
82
88
|
};
|
|
83
89
|
full: {
|
|
84
90
|
true: {
|
|
91
|
+
left: string;
|
|
85
92
|
right: string;
|
|
86
93
|
};
|
|
87
94
|
false: string;
|
|
@@ -89,9 +96,11 @@ export declare const splitPane: import("tailwind-variants").TVReturnType<{
|
|
|
89
96
|
rounded: {
|
|
90
97
|
true: {
|
|
91
98
|
left: string;
|
|
99
|
+
right: string;
|
|
92
100
|
};
|
|
93
101
|
false: {
|
|
94
102
|
left: string;
|
|
103
|
+
right: string;
|
|
95
104
|
};
|
|
96
105
|
};
|
|
97
106
|
}, {
|
|
@@ -22,16 +22,19 @@ export const splitPane = tv({
|
|
|
22
22
|
},
|
|
23
23
|
full: {
|
|
24
24
|
true: {
|
|
25
|
+
left: 'md:bottom-[30px]',
|
|
25
26
|
right: 'md:min-h-[calc(100dvh-30px)]'
|
|
26
27
|
},
|
|
27
28
|
false: ''
|
|
28
29
|
},
|
|
29
30
|
rounded: {
|
|
30
31
|
true: {
|
|
31
|
-
left: 'md:rounded-t-lg'
|
|
32
|
+
left: 'md:rounded-t-lg md:rounded-b-lg',
|
|
33
|
+
right: 'md:rounded-b-lg'
|
|
32
34
|
},
|
|
33
35
|
false: {
|
|
34
|
-
left: ''
|
|
36
|
+
left: '',
|
|
37
|
+
right: ''
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
},
|
|
@@ -15,7 +15,14 @@ This component takes NavbarItems as its children
|
|
|
15
15
|
import { navbar } from './theme.js';
|
|
16
16
|
import type { NavBarProps } from './types.js';
|
|
17
17
|
|
|
18
|
-
const {
|
|
18
|
+
const {
|
|
19
|
+
children,
|
|
20
|
+
fab,
|
|
21
|
+
trailing,
|
|
22
|
+
ghost = false,
|
|
23
|
+
class: className,
|
|
24
|
+
...restProps
|
|
25
|
+
}: NavBarProps = $props();
|
|
19
26
|
const { base, items, fab: fabCls, ghost: ghostCls } = $derived(navbar());
|
|
20
27
|
</script>
|
|
21
28
|
|
|
@@ -36,6 +43,11 @@ This component takes NavbarItems as its children
|
|
|
36
43
|
{/snippet}
|
|
37
44
|
</NavigationMenu.List>
|
|
38
45
|
</NavigationMenu.Root>
|
|
46
|
+
{#if trailing}
|
|
47
|
+
<div class="shrink-0 px-2">
|
|
48
|
+
{@render trailing()}
|
|
49
|
+
</div>
|
|
50
|
+
{/if}
|
|
39
51
|
</div>
|
|
40
52
|
{#if ghost}
|
|
41
53
|
<div class={ghostCls()} aria-hidden="true"></div>
|
|
@@ -28,6 +28,8 @@ export type NavBarProps = NavBarVariants & HTMLAttributes<HTMLDivElement> & {
|
|
|
28
28
|
children: Snippet;
|
|
29
29
|
/** An optional Floating Action Button snippet. */
|
|
30
30
|
fab?: Snippet;
|
|
31
|
+
/** An optional snippet rendered after the nav items (e.g. an avatar/settings shortcut). */
|
|
32
|
+
trailing?: Snippet;
|
|
31
33
|
/** Renders an invisible same-height spacer after the fixed bar so page content isn't obscured. */
|
|
32
34
|
ghost?: boolean;
|
|
33
35
|
};
|
|
@@ -17,6 +17,7 @@ On mobile (< md) it automatically renders as a bottom navigation bar.
|
|
|
17
17
|
import { NavigationMenu } from 'bits-ui';
|
|
18
18
|
import { railStore } from './railStore.svelte.js';
|
|
19
19
|
import RailNavContext from './RailNavContext.svelte';
|
|
20
|
+
import Navbar from '../navbar/Navbar.svelte';
|
|
20
21
|
|
|
21
22
|
let {
|
|
22
23
|
children,
|
|
@@ -27,7 +28,7 @@ On mobile (< md) it automatically renders as a bottom navigation bar.
|
|
|
27
28
|
collapsed = $bindable(true),
|
|
28
29
|
anchor = 'viewport',
|
|
29
30
|
railTop = 0,
|
|
30
|
-
|
|
31
|
+
withNavbar = false,
|
|
31
32
|
showMobileFab = true,
|
|
32
33
|
showMobileFooter = false,
|
|
33
34
|
class: className
|
|
@@ -99,34 +100,16 @@ On mobile (< md) it automatically renders as a bottom navigation bar.
|
|
|
99
100
|
</div>
|
|
100
101
|
|
|
101
102
|
<!-- Mobile bottom navbar (md:hidden) -->
|
|
102
|
-
{#if
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
{/if}
|
|
108
|
-
|
|
109
|
-
<nav
|
|
110
|
-
class="bg-md-sys-color-surface-container shadow-elevation-2 fixed right-0 bottom-0 left-0 z-20 flex h-20 items-center py-3 md:hidden"
|
|
111
|
-
aria-label="Mobile navigation"
|
|
103
|
+
{#if withNavbar}
|
|
104
|
+
<Navbar
|
|
105
|
+
fab={showMobileFab ? fab : undefined}
|
|
106
|
+
trailing={showMobileFooter ? railFooter : undefined}
|
|
107
|
+
ghost
|
|
112
108
|
>
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
</RailNavContext>
|
|
118
|
-
</NavigationMenu.List>
|
|
119
|
-
</NavigationMenu.Root>
|
|
120
|
-
|
|
121
|
-
{#if showMobileFooter && railFooter}
|
|
122
|
-
<div class="shrink-0 px-2">
|
|
123
|
-
{@render railFooter()}
|
|
124
|
-
</div>
|
|
125
|
-
{/if}
|
|
126
|
-
</nav>
|
|
127
|
-
|
|
128
|
-
<!-- Spacer so page content clears the fixed mobile navbar -->
|
|
129
|
-
<div class="h-20 w-full shrink-0 md:hidden" aria-hidden="true"></div>
|
|
109
|
+
<RailNavContext mobile={true}>
|
|
110
|
+
{@render children?.()}
|
|
111
|
+
</RailNavContext>
|
|
112
|
+
</Navbar>
|
|
130
113
|
{/if}
|
|
131
114
|
|
|
132
115
|
<style>
|
|
@@ -43,8 +43,8 @@ export type RailProps = RailVariants & HTMLAttributes<HTMLDivElement> & {
|
|
|
43
43
|
anchor?: RailVariants['anchor'];
|
|
44
44
|
/** Top offset in px for viewport/parent anchor (e.g. height of a top bar). Default 0. */
|
|
45
45
|
railTop?: number;
|
|
46
|
-
/** Render a bottom navbar on mobile (< md). Default
|
|
47
|
-
|
|
46
|
+
/** Render a bottom navbar on mobile (< md). Default false — opt in, since consumers may render their own mobile nav. */
|
|
47
|
+
withNavbar?: boolean;
|
|
48
48
|
/** Show the fab slot above the mobile navbar. Default true. */
|
|
49
49
|
showMobileFab?: boolean;
|
|
50
50
|
/** Show the railFooter slot inside the mobile navbar. Default false. */
|