@functionalcms/svelte-components 2.37.0 → 2.38.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/menu/CollapsibleMenu.svelte +6 -9
- package/dist/components/menu/CollapsibleMenu.svelte.d.ts +1 -1
- package/dist/components/menu/DynamicMenu.svelte +4 -6
- package/dist/components/menu/DynamicMenu.svelte.d.ts +1 -1
- package/dist/components/menu/HamburgerMenu.svelte +12 -10
- package/dist/components/menu/HamburgerMenu.svelte.d.ts +1 -2
- package/dist/components/menu/LinkMenuItem.svelte +25 -0
- package/dist/components/menu/LinkMenuItem.svelte.d.ts +29 -0
- package/dist/components/menu/Menu.d.ts +7 -0
- package/dist/components/menu/Menu.js +17 -0
- package/dist/components/menu/NavigationItems.svelte +5 -8
- package/dist/components/menu/NavigationItems.svelte.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/menu/MenuFunctions.d.ts +0 -3
- package/dist/components/menu/MenuFunctions.js +0 -13
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
<script>import { Button } from "agnostic-svelte";
|
|
2
2
|
import { Orientation, Placement } from "../Styling.js";
|
|
3
3
|
import ColumnMenu from "./NavigationItems.svelte";
|
|
4
|
-
import { HeaderNavigationItem } from "./Menu.js";
|
|
4
|
+
import { HeaderNavigationItem, defaultCss } from "./Menu.js";
|
|
5
5
|
import { mergedClasses } from "../CssHelper.js";
|
|
6
|
-
export let css
|
|
7
|
-
buttonCss: [],
|
|
8
|
-
container: ["flex"],
|
|
9
|
-
link: []
|
|
10
|
-
};
|
|
6
|
+
export let css;
|
|
11
7
|
export let contentPosition = Placement.End;
|
|
12
8
|
export let orientation = Orientation.Column;
|
|
13
9
|
export let localPages = [];
|
|
10
|
+
const cssClasses = { ...defaultCss, ...css };
|
|
14
11
|
$: expanded = false;
|
|
15
12
|
$: showContentBeforeButton = contentPosition == Placement.Start;
|
|
16
|
-
$: buttonCss = mergedClasses(
|
|
13
|
+
$: buttonCss = mergedClasses(cssClasses.buttonCss);
|
|
17
14
|
</script>
|
|
18
15
|
|
|
19
16
|
{#if expanded && showContentBeforeButton}
|
|
20
17
|
<div aria-expanded={expanded}>
|
|
21
|
-
<ColumnMenu {localPages} {orientation} {
|
|
18
|
+
<ColumnMenu {localPages} {orientation} css={cssClasses} />
|
|
22
19
|
</div>
|
|
23
20
|
{/if}
|
|
24
21
|
<Button css={buttonCss} on:click={() => (expanded = !expanded)}>
|
|
@@ -26,7 +23,7 @@ $: buttonCss = mergedClasses(css.buttonCss);
|
|
|
26
23
|
</Button>
|
|
27
24
|
{#if expanded && !showContentBeforeButton}
|
|
28
25
|
<div aria-expanded={expanded}>
|
|
29
|
-
<ColumnMenu {localPages} {orientation} {
|
|
26
|
+
<ColumnMenu {localPages} {orientation} css={cssClasses} />
|
|
30
27
|
</div>
|
|
31
28
|
{/if}
|
|
32
29
|
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
<script>import { HeaderNavigationItem } from "./Menu.js";
|
|
2
|
-
import { selectVisible } from "./MenuFunctions.js";
|
|
1
|
+
<script>import { HeaderNavigationItem, selectVisible, defaultCss } from "./Menu.js";
|
|
3
2
|
import { isAuthenticated } from "./authentication.js";
|
|
4
3
|
import { page } from "$app/stores";
|
|
5
4
|
import { mergedClasses } from "../CssHelper.js";
|
|
6
|
-
export let css
|
|
7
|
-
|
|
8
|
-
};
|
|
5
|
+
export let css;
|
|
6
|
+
const cssClasses = { ...defaultCss, ...css };
|
|
9
7
|
export let localPages = [];
|
|
10
8
|
$: pagesVisiblity = isAuthenticated($page);
|
|
11
9
|
$: visibleNavItems = selectVisible(localPages, pagesVisiblity);
|
|
12
|
-
const klasses = mergedClasses("flex", "flex-dynamic-row",
|
|
10
|
+
const klasses = mergedClasses("flex", "flex-dynamic-row", cssClasses.container);
|
|
13
11
|
</script>
|
|
14
12
|
|
|
15
13
|
<nav class={klasses}>
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
<script>import { HeaderNavigationItem } from "./Menu.js";
|
|
1
|
+
<script>import { HeaderNavigationItem, defaultCss } from "./Menu.js";
|
|
2
2
|
import { afterNavigate } from "$app/navigation";
|
|
3
3
|
import { Drawer, Button } from "agnostic-svelte";
|
|
4
4
|
import { Orientation, Placement } from "../Styling.js";
|
|
5
5
|
import ColumnMenu from "./NavigationItems.svelte";
|
|
6
6
|
import { mergedClasses } from "../CssHelper.js";
|
|
7
|
-
export let css
|
|
8
|
-
buttonCss: [],
|
|
9
|
-
container: [],
|
|
10
|
-
link: []
|
|
11
|
-
};
|
|
7
|
+
export let css;
|
|
12
8
|
export let noBorder = false;
|
|
13
9
|
export let placement = Placement.Start;
|
|
14
10
|
export let localPages = [];
|
|
15
|
-
|
|
11
|
+
const cssClasses = { ...defaultCss, ...css };
|
|
16
12
|
let drawer = null;
|
|
17
13
|
const assignDrawerRef = (ev) => {
|
|
18
14
|
drawer = ev.detail.instance;
|
|
19
15
|
};
|
|
20
16
|
afterNavigate((navigation) => drawer?.hide());
|
|
21
|
-
const buttonCss = mergedClasses("hamburger-handle", noBorder,
|
|
17
|
+
const buttonCss = mergedClasses("hamburger-handle", noBorder, cssClasses.buttonCss);
|
|
22
18
|
</script>
|
|
23
19
|
|
|
24
|
-
<Button
|
|
20
|
+
<Button
|
|
21
|
+
type="button"
|
|
22
|
+
data-a11y-dialog-show="hamburger-menu"
|
|
23
|
+
mode="primary"
|
|
24
|
+
noBorder
|
|
25
|
+
css={buttonCss}
|
|
26
|
+
>
|
|
25
27
|
☰
|
|
26
28
|
</Button>
|
|
27
29
|
<Drawer
|
|
@@ -31,7 +33,7 @@ const buttonCss = mergedClasses("hamburger-handle", noBorder, css.buttonCss);
|
|
|
31
33
|
on:instance={assignDrawerRef}
|
|
32
34
|
title="Menu"
|
|
33
35
|
>
|
|
34
|
-
<ColumnMenu {localPages} orientation={Orientation.Column} {
|
|
36
|
+
<ColumnMenu {localPages} orientation={Orientation.Column} css={cssClasses} />
|
|
35
37
|
</Drawer>
|
|
36
38
|
|
|
37
39
|
<style>
|
|
@@ -3,7 +3,7 @@ import { HeaderNavigationItem } from './Menu.js';
|
|
|
3
3
|
import { Placement } from '../Styling.js';
|
|
4
4
|
declare const __propDef: {
|
|
5
5
|
props: {
|
|
6
|
-
css
|
|
6
|
+
css: {
|
|
7
7
|
buttonCss: string[];
|
|
8
8
|
container: string[];
|
|
9
9
|
link: string[];
|
|
@@ -11,7 +11,6 @@ declare const __propDef: {
|
|
|
11
11
|
noBorder?: boolean;
|
|
12
12
|
placement?: Placement;
|
|
13
13
|
localPages?: Array<HeaderNavigationItem>;
|
|
14
|
-
includeSubpagesForSelect?: boolean;
|
|
15
14
|
};
|
|
16
15
|
events: {
|
|
17
16
|
[evt: string]: CustomEvent<any>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script>export let disabled = false;
|
|
2
|
+
export let isSelected = false;
|
|
3
|
+
export let classes;
|
|
4
|
+
let btn;
|
|
5
|
+
export function focus() {
|
|
6
|
+
return btn.focus();
|
|
7
|
+
}
|
|
8
|
+
export function isDisabled() {
|
|
9
|
+
return btn.disabled;
|
|
10
|
+
}
|
|
11
|
+
</script>
|
|
12
|
+
<button
|
|
13
|
+
on:click
|
|
14
|
+
on:keydown
|
|
15
|
+
bind:this={btn}
|
|
16
|
+
role="menuitem"
|
|
17
|
+
tabindex={isSelected ? 0 : -1}
|
|
18
|
+
disabled={disabled}
|
|
19
|
+
class={classes}
|
|
20
|
+
>
|
|
21
|
+
<slot />
|
|
22
|
+
</button>
|
|
23
|
+
|
|
24
|
+
<style>
|
|
25
|
+
</style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
isSelected?: boolean;
|
|
6
|
+
classes: any;
|
|
7
|
+
focus?: () => any;
|
|
8
|
+
isDisabled?: () => any;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
click: MouseEvent;
|
|
12
|
+
keydown: KeyboardEvent;
|
|
13
|
+
} & {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
};
|
|
16
|
+
slots: {
|
|
17
|
+
default: {};
|
|
18
|
+
};
|
|
19
|
+
exports?: {} | undefined;
|
|
20
|
+
bindings?: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
export type LinkMenuItemProps = typeof __propDef.props;
|
|
23
|
+
export type LinkMenuItemEvents = typeof __propDef.events;
|
|
24
|
+
export type LinkMenuItemSlots = typeof __propDef.slots;
|
|
25
|
+
export default class LinkMenuItem extends SvelteComponent<LinkMenuItemProps, LinkMenuItemEvents, LinkMenuItemSlots> {
|
|
26
|
+
get focus(): () => any;
|
|
27
|
+
get isDisabled(): () => any;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -10,4 +10,11 @@ export declare class HeaderNavigationItem {
|
|
|
10
10
|
action?: ClickAction | undefined;
|
|
11
11
|
visiblity: Visiblity;
|
|
12
12
|
}
|
|
13
|
+
export declare function selectVisible(pages: Array<any>, visiblity: Visiblity): any[];
|
|
14
|
+
export declare function isSelected(includeSubpagesForSelect: boolean, page: any, item: HeaderNavigationItem): any;
|
|
15
|
+
export declare const defaultCss: {
|
|
16
|
+
buttonCss: never[];
|
|
17
|
+
container: never[];
|
|
18
|
+
link: never[];
|
|
19
|
+
};
|
|
13
20
|
export {};
|
|
@@ -10,3 +10,20 @@ export class HeaderNavigationItem {
|
|
|
10
10
|
action;
|
|
11
11
|
visiblity = Visiblity.Always;
|
|
12
12
|
}
|
|
13
|
+
export function selectVisible(pages, visiblity) {
|
|
14
|
+
return pages.filter((page) => page?.visiblity === Visiblity.Always ||
|
|
15
|
+
page?.visiblity === visiblity);
|
|
16
|
+
}
|
|
17
|
+
export function isSelected(includeSubpagesForSelect, page, item) {
|
|
18
|
+
if (page?.url?.pathname === '/') {
|
|
19
|
+
return page?.url?.pathname === item.path;
|
|
20
|
+
}
|
|
21
|
+
return includeSubpagesForSelect
|
|
22
|
+
? (page?.url.pathname.startsWith(item.path ?? '-') && item.path !== '/')
|
|
23
|
+
: page?.url.pathname === item.path;
|
|
24
|
+
}
|
|
25
|
+
export const defaultCss = {
|
|
26
|
+
buttonCss: [],
|
|
27
|
+
container: [],
|
|
28
|
+
link: []
|
|
29
|
+
};
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
<script>import { HeaderNavigationItem } from "./Menu.js";
|
|
2
|
-
import { isSelected } from "./MenuFunctions.js";
|
|
1
|
+
<script>import { HeaderNavigationItem, isSelected, defaultCss } from "./Menu.js";
|
|
3
2
|
import { Orientation } from "../Styling.js";
|
|
4
3
|
import Link from "../Link.svelte";
|
|
5
4
|
import { page } from "$app/stores";
|
|
6
5
|
import { mergedClasses } from "../CssHelper.js";
|
|
7
|
-
export let css
|
|
8
|
-
container: [],
|
|
9
|
-
link: []
|
|
10
|
-
};
|
|
6
|
+
export let css;
|
|
11
7
|
export let localPages = [];
|
|
12
8
|
export let orientation = Orientation.Column;
|
|
13
9
|
export let includeSubpagesForSelect = true;
|
|
14
|
-
const
|
|
15
|
-
const
|
|
10
|
+
const cssClasses = { ...defaultCss, ...css };
|
|
11
|
+
const containerCss = mergedClasses("flex", cssClasses.container, orientation);
|
|
12
|
+
const linkCss = mergedClasses(cssClasses.link);
|
|
16
13
|
</script>
|
|
17
14
|
|
|
18
15
|
<ul class={containerCss} role="menu" aria-roledescription="">
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Visiblity } from "./Menu.js";
|
|
2
|
-
export function selectVisible(pages, visiblity) {
|
|
3
|
-
return pages.filter((page) => page?.visiblity === Visiblity.Always ||
|
|
4
|
-
page?.visiblity === visiblity);
|
|
5
|
-
}
|
|
6
|
-
export function isSelected(includeSubpagesForSelect, page, item) {
|
|
7
|
-
if (page?.url?.pathname === '/') {
|
|
8
|
-
return page?.url?.pathname === item.path;
|
|
9
|
-
}
|
|
10
|
-
return includeSubpagesForSelect
|
|
11
|
-
? (page?.url.pathname.startsWith(item.path ?? '-') && item.path !== '/')
|
|
12
|
-
: page?.url.pathname === item.path;
|
|
13
|
-
}
|