@functionalcms/svelte-components 4.36.10 → 5.0.0-beta1
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/css/functional.css +48 -1
- package/dist/auth/getMachineAccessToken.d.ts +1 -1
- package/dist/auth/getMachineAccessToken.js +1 -2
- package/dist/auth/machineAuthenticationProvider.d.ts +1 -1
- package/dist/auth/machineAuthenticationProvider.js +1 -2
- package/dist/auth/tokenRefresh.d.ts +1 -1
- package/dist/auth/tokenRefresh.js +4 -5
- package/dist/auth/types.js +4 -8
- package/dist/auth/userAuthenticationProvider.d.ts +1 -1
- package/dist/auth/userAuthenticationProvider.js +1 -2
- package/dist/components/Icon.svelte +16 -0
- package/dist/components/Icon.svelte.d.ts +9 -0
- package/dist/components/content/Markdown.svelte +2 -2
- package/dist/components/content/Markdown.svelte.d.ts +17 -4
- package/dist/components/form/Dropzone.svelte +2 -5
- package/dist/components/form/SmartForm.svelte +206 -60
- package/dist/components/form/SmartForm.svelte.d.ts +2 -2
- package/dist/components/form/form.d.ts +87 -17
- package/dist/components/form/form.js +86 -6
- package/dist/components/icons.d.ts +763 -0
- package/dist/components/icons.js +765 -0
- package/dist/components/integrations/EasyTools.svelte +1 -1
- package/dist/components/layouts/DefaultLayout.svelte +92 -41
- package/dist/components/layouts/DefaultLayout.svelte.d.ts +17 -8
- package/dist/components/layouts/FlexBox.svelte +73 -0
- package/dist/components/layouts/FlexBox.svelte.d.ts +17 -0
- package/dist/components/layouts/MenuLayout.svelte +39 -201
- package/dist/components/layouts/MenuLayout.svelte.d.ts +2 -10
- package/dist/components/layouts/StyleBox.svelte +17 -0
- package/dist/components/layouts/StyleBox.svelte.d.ts +7 -0
- package/dist/components/layouts/Well.svelte +8 -34
- package/dist/components/layouts/Well.svelte.d.ts +4 -8
- package/dist/components/layouts/menuItems.d.ts +29 -0
- package/dist/components/layouts/menuItems.js +28 -0
- package/dist/index-server.d.ts +2 -1
- package/dist/index-server.js +2 -1
- package/dist/index.d.ts +9 -47
- package/dist/index.js +8 -59
- package/dist/server-side/getServices.d.ts +8 -8
- package/dist/server-side/getServices.js +16 -27
- package/dist/server-side/handlers/paraglideHandler.d.ts +2 -0
- package/dist/server-side/handlers/paraglideHandler.js +13 -0
- package/dist/server-side/handlers/redirectPipelineHandler.d.ts +5 -0
- package/dist/server-side/{getRedirectPipeline.js → handlers/redirectPipelineHandler.js} +1 -2
- package/dist/utils/stringHash.d.ts +1 -0
- package/dist/utils/stringHash.js +7 -0
- package/package.json +28 -39
- package/css/functional.css.map +0 -1
- package/dist/components/MaterialIconSet.d.ts +0 -3819
- package/dist/components/MaterialIconSet.js +0 -3823
- package/dist/components/Styling.d.ts +0 -59
- package/dist/components/Styling.js +0 -66
- package/dist/components/blog/blog.d.ts +0 -20
- package/dist/components/blog/blog.js +0 -29
- package/dist/components/dynamic/CopyToClipboard.svelte +0 -16
- package/dist/components/dynamic/CopyToClipboard.svelte.d.ts +0 -36
- package/dist/components/dynamic/DynamicButton.d.ts +0 -1
- package/dist/components/dynamic/DynamicButton.js +0 -10
- package/dist/components/dynamic/DynamicButton.svelte +0 -33
- package/dist/components/dynamic/DynamicButton.svelte.d.ts +0 -9
- package/dist/components/form/Button.svelte +0 -389
- package/dist/components/form/Button.svelte.d.ts +0 -30
- package/dist/components/form/ChoiceInput.svelte +0 -375
- package/dist/components/form/ChoiceInput.svelte.d.ts +0 -3
- package/dist/components/form/Input.svelte +0 -461
- package/dist/components/form/Input.svelte.d.ts +0 -30
- package/dist/components/form/Select.svelte +0 -163
- package/dist/components/form/Select.svelte.d.ts +0 -21
- package/dist/components/form/Switch.svelte +0 -293
- package/dist/components/form/Switch.svelte.d.ts +0 -14
- package/dist/components/indicators/Loader.svelte +0 -114
- package/dist/components/indicators/Loader.svelte.d.ts +0 -30
- package/dist/components/indicators/Spinner.svelte +0 -109
- package/dist/components/indicators/Spinner.svelte.d.ts +0 -28
- package/dist/components/layouts/Banner.svelte +0 -26
- package/dist/components/layouts/Banner.svelte.d.ts +0 -8
- package/dist/components/layouts/FoldablePanel.svelte +0 -16
- package/dist/components/layouts/FoldablePanel.svelte.d.ts +0 -7
- package/dist/components/layouts/SimpleFooter.svelte +0 -23
- package/dist/components/layouts/SimpleFooter.svelte.d.ts +0 -8
- package/dist/components/layouts/Tabs.svelte +0 -362
- package/dist/components/layouts/Tabs.svelte.d.ts +0 -11
- package/dist/components/layouts/TwoColumnsLayout.svelte +0 -44
- package/dist/components/layouts/TwoColumnsLayout.svelte.d.ts +0 -13
- package/dist/components/layouts/menuLayout.d.ts +0 -12
- package/dist/components/layouts/menuLayout.js +0 -1
- package/dist/components/layouts/tabs.d.ts +0 -21
- package/dist/components/layouts/tabs.js +0 -13
- package/dist/components/menu/CollapsibleMenu.svelte +0 -66
- package/dist/components/menu/CollapsibleMenu.svelte.d.ts +0 -18
- package/dist/components/menu/DynamicMenu.svelte +0 -55
- package/dist/components/menu/DynamicMenu.svelte.d.ts +0 -13
- package/dist/components/menu/HamburgerMenu.svelte +0 -62
- package/dist/components/menu/HamburgerMenu.svelte.d.ts +0 -14
- package/dist/components/menu/ListMenu.svelte +0 -61
- package/dist/components/menu/ListMenu.svelte.d.ts +0 -17
- package/dist/components/menu/NavigationDrawer.svelte +0 -53
- package/dist/components/menu/NavigationDrawer.svelte.d.ts +0 -18
- package/dist/components/menu/types.d.ts +0 -23
- package/dist/components/menu/types.js +0 -35
- package/dist/components/presentation/Accordion.svelte +0 -82
- package/dist/components/presentation/Accordion.svelte.d.ts +0 -11
- package/dist/components/presentation/Card.svelte +0 -147
- package/dist/components/presentation/Card.svelte.d.ts +0 -15
- package/dist/components/presentation/Carousel.d.ts +0 -5
- package/dist/components/presentation/Carousel.js +0 -1
- package/dist/components/presentation/Carousel.svelte +0 -119
- package/dist/components/presentation/Carousel.svelte.d.ts +0 -17
- package/dist/components/presentation/Dialog.svelte +0 -75
- package/dist/components/presentation/Dialog.svelte.d.ts +0 -22
- package/dist/components/presentation/Disclose.svelte +0 -116
- package/dist/components/presentation/Disclose.svelte.d.ts +0 -11
- package/dist/components/presentation/Drawer.svelte +0 -118
- package/dist/components/presentation/Drawer.svelte.d.ts +0 -13
- package/dist/components/presentation/EmptyState.svelte +0 -67
- package/dist/components/presentation/EmptyState.svelte.d.ts +0 -10
- package/dist/components/presentation/Gallery.svelte +0 -35
- package/dist/components/presentation/Gallery.svelte.d.ts +0 -14
- package/dist/components/presentation/Link.svelte +0 -362
- package/dist/components/presentation/Link.svelte.d.ts +0 -27
- package/dist/components/utils.d.ts +0 -3
- package/dist/components/utils.js +0 -1
- package/dist/index.server.d.ts +0 -11
- package/dist/index.server.js +0 -10
- package/dist/server-side/getRedirectPipeline.d.ts +0 -6
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +0 -3
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
const handle = `ec_tenant_${userId}`;
|
|
13
13
|
window.addEventListener('message', (e) => {
|
|
14
14
|
!!e.data.frameHeight &&
|
|
15
|
-
|
|
15
|
+
e.data.pricingUuid === handle &&
|
|
16
16
|
(document.getElementById(handle).style.height = e.data.frameHeight);
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -1,59 +1,110 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { page } from '$app/state';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
+
import {
|
|
5
|
+
Navbar,
|
|
6
|
+
NavBrand,
|
|
7
|
+
NavHamburger,
|
|
8
|
+
NavUl,
|
|
9
|
+
NavLi,
|
|
10
|
+
Dropdown,
|
|
11
|
+
DropdownItem,
|
|
12
|
+
} from 'flowbite-svelte';
|
|
13
|
+
import { type MenuOption } from './menuItems.js';
|
|
14
|
+
import { ChevronDownOutline } from 'flowbite-svelte-icons';
|
|
15
|
+
|
|
16
|
+
interface Styles {
|
|
17
|
+
logo?: string;
|
|
18
|
+
companyName?: string;
|
|
19
|
+
navigation?: string;
|
|
20
|
+
menuItem?: string;
|
|
21
|
+
activeClass?: string;
|
|
22
|
+
nonActiveClass?: string;
|
|
23
|
+
}
|
|
4
24
|
|
|
5
25
|
interface Props {
|
|
6
|
-
headerIsSticky?: boolean;
|
|
7
|
-
canonicalUrl?: string;
|
|
8
|
-
header?: Snippet;
|
|
9
|
-
footer?: Snippet;
|
|
10
|
-
stickyFooter?: Snippet;
|
|
11
26
|
children: Snippet;
|
|
27
|
+
canonicalUrl: string;
|
|
28
|
+
logoUrl?: string;
|
|
29
|
+
companyName?: string;
|
|
30
|
+
renderCompanyName?: boolean;
|
|
31
|
+
menuItems?: Array<MenuOption>;
|
|
32
|
+
footerRender?: Snippet;
|
|
33
|
+
classes?: Styles;
|
|
12
34
|
}
|
|
13
35
|
|
|
14
36
|
let {
|
|
15
|
-
children,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
37
|
+
children,
|
|
38
|
+
canonicalUrl,
|
|
39
|
+
logoUrl = undefined,
|
|
40
|
+
companyName = '',
|
|
41
|
+
renderCompanyName = true,
|
|
42
|
+
menuItems = [],
|
|
43
|
+
footerRender = undefined,
|
|
44
|
+
classes = {},
|
|
45
|
+
}: Partial<Props> = $props();
|
|
46
|
+
|
|
47
|
+
const defaultClasses = {
|
|
48
|
+
logo: 'me-3 h-6 sm:h-9',
|
|
49
|
+
companyName: 'self-center whitespace-nowrap text-xl font-semibold dark:text-white',
|
|
50
|
+
navigation: '',
|
|
51
|
+
menuItem: '',
|
|
52
|
+
activeClass: 'text-blue-700 dark:text-white',
|
|
53
|
+
nonActiveClass: 'text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white',
|
|
54
|
+
footer:
|
|
55
|
+
'absolute start-0 bottom-0 z-20 w-full border-t border-gray-200 bg-white p-4 shadow-sm md:flex md:items-center md:justify-between md:p-6 dark:border-gray-600 dark:bg-gray-800',
|
|
56
|
+
footerLinks: ''
|
|
57
|
+
};
|
|
58
|
+
const mergedClasses = $derived(() => ({ ...defaultClasses, ...classes }));
|
|
59
|
+
|
|
60
|
+
let activeUrl = $state(page.url.pathname);
|
|
61
|
+
|
|
62
|
+
$effect(() => {
|
|
63
|
+
activeUrl = page.url.pathname;
|
|
64
|
+
});
|
|
24
65
|
</script>
|
|
25
66
|
|
|
26
67
|
<svelte:head>
|
|
27
68
|
<link rel="canonical" href="{canonicalUrl}{page.url.pathname}" />
|
|
28
69
|
</svelte:head>
|
|
29
70
|
|
|
30
|
-
<div id="defaultLayout">
|
|
31
|
-
{
|
|
32
|
-
<
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
|
|
71
|
+
<div class="w-full relative" id="defaultLayout">
|
|
72
|
+
<Navbar class={mergedClasses().navigation}>
|
|
73
|
+
<NavBrand href="/" class="logo">
|
|
74
|
+
<img src={logoUrl} class={mergedClasses().logo} alt={companyName} />
|
|
75
|
+
{#if renderCompanyName}
|
|
76
|
+
<span class={mergedClasses().companyName}>{companyName}</span>
|
|
77
|
+
{/if}
|
|
78
|
+
</NavBrand>
|
|
79
|
+
<NavHamburger />
|
|
80
|
+
<NavUl
|
|
81
|
+
{activeUrl}
|
|
82
|
+
classes={{ active: mergedClasses().activeClass, nonActive: mergedClasses().nonActiveClass }}
|
|
83
|
+
>
|
|
84
|
+
{#each menuItems as item}
|
|
85
|
+
{#if item?.items}
|
|
86
|
+
<NavLi class={mergedClasses().menuItem}>
|
|
87
|
+
<a href={item.href}>{item.label}</a>
|
|
88
|
+
<ChevronDownOutline class="text-primary-800 ms-2 inline h-6 w-6 dark:text-white" />
|
|
89
|
+
</NavLi>
|
|
90
|
+
<Dropdown simple class="w-44">
|
|
91
|
+
{#each item.items as subItem}
|
|
92
|
+
<DropdownItem class={mergedClasses().menuItem} href={subItem.href}
|
|
93
|
+
>{subItem.label}</DropdownItem
|
|
94
|
+
>
|
|
95
|
+
{/each}
|
|
96
|
+
</Dropdown>
|
|
97
|
+
{:else}
|
|
98
|
+
<NavLi class={mergedClasses().menuItem}>
|
|
99
|
+
<a href={item.href}>{item.label}</a>
|
|
100
|
+
</NavLi>
|
|
101
|
+
{/if}
|
|
102
|
+
{/each}
|
|
103
|
+
</NavUl>
|
|
104
|
+
</Navbar>
|
|
36
105
|
<main>
|
|
37
|
-
{@render children()}
|
|
106
|
+
{@render children?.()}
|
|
38
107
|
</main>
|
|
39
|
-
{
|
|
40
|
-
<footer>
|
|
41
|
-
{@render footer()}
|
|
42
|
-
</footer>
|
|
43
|
-
{/if}
|
|
44
|
-
<div id="drawer-root"></div>
|
|
45
|
-
</div>
|
|
108
|
+
{@render footerRender?.()}
|
|
46
109
|
|
|
47
|
-
|
|
48
|
-
<footer class="sticky">
|
|
49
|
-
{@render stickyFooter()}
|
|
50
|
-
</footer>
|
|
51
|
-
{/if}
|
|
52
|
-
|
|
53
|
-
<style>
|
|
54
|
-
footer.sticky {
|
|
55
|
-
flex-shrink: 0;
|
|
56
|
-
background-color: var(--light-modelight);
|
|
57
|
-
flex-shrink: 0;
|
|
58
|
-
}
|
|
59
|
-
</style>
|
|
110
|
+
</div>
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
canonicalUrl?: string;
|
|
5
|
-
header?: Snippet;
|
|
6
|
-
footer?: Snippet;
|
|
7
|
-
stickyFooter?: Snippet;
|
|
2
|
+
import { type MenuOption } from './menuItems.js';
|
|
3
|
+
declare const DefaultLayout: import("svelte").Component<Partial<{
|
|
8
4
|
children: Snippet;
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
canonicalUrl: string;
|
|
6
|
+
logoUrl?: string;
|
|
7
|
+
companyName?: string;
|
|
8
|
+
renderCompanyName?: boolean;
|
|
9
|
+
menuItems?: Array<MenuOption>;
|
|
10
|
+
footerRender?: Snippet;
|
|
11
|
+
classes?: {
|
|
12
|
+
logo?: string;
|
|
13
|
+
companyName?: string;
|
|
14
|
+
navigation?: string;
|
|
15
|
+
menuItem?: string;
|
|
16
|
+
activeClass?: string;
|
|
17
|
+
nonActiveClass?: string;
|
|
18
|
+
};
|
|
19
|
+
}>, {}, "">;
|
|
11
20
|
type DefaultLayout = ReturnType<typeof DefaultLayout>;
|
|
12
21
|
export default DefaultLayout;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
children: Snippet;
|
|
6
|
+
width?: string;
|
|
7
|
+
height?: string;
|
|
8
|
+
direction: 'row' | 'column' | 'row-reverse' | 'column-reverse';
|
|
9
|
+
justify?:
|
|
10
|
+
| 'start'
|
|
11
|
+
| 'end'
|
|
12
|
+
| 'end-safe'
|
|
13
|
+
| 'center'
|
|
14
|
+
| 'center-safe'
|
|
15
|
+
| 'between'
|
|
16
|
+
| 'around'
|
|
17
|
+
| 'evenly'
|
|
18
|
+
| 'stretch'
|
|
19
|
+
| 'baseline'
|
|
20
|
+
| 'normal';
|
|
21
|
+
align?:
|
|
22
|
+
| 'start'
|
|
23
|
+
| 'end'
|
|
24
|
+
| 'end-safe'
|
|
25
|
+
| 'center'
|
|
26
|
+
| 'center-safe'
|
|
27
|
+
| 'baseline'
|
|
28
|
+
| 'baseline-last'
|
|
29
|
+
| 'stretch';
|
|
30
|
+
wrap: 'wrap' | 'nowrap' | 'wrap-reverse';
|
|
31
|
+
grow?: string;
|
|
32
|
+
shrink?: string;
|
|
33
|
+
gap?: string;
|
|
34
|
+
margin?: string;
|
|
35
|
+
padding?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let {
|
|
39
|
+
children,
|
|
40
|
+
width = 'auto',
|
|
41
|
+
height = 'auto',
|
|
42
|
+
direction = 'row',
|
|
43
|
+
justify = 'start',
|
|
44
|
+
align = 'stretch',
|
|
45
|
+
gap = '0',
|
|
46
|
+
wrap = 'nowrap',
|
|
47
|
+
grow = undefined,
|
|
48
|
+
shrink = undefined,
|
|
49
|
+
margin = undefined,
|
|
50
|
+
padding = undefined,
|
|
51
|
+
}: Partial<Props> = $props();
|
|
52
|
+
|
|
53
|
+
const cssClass = $derived(
|
|
54
|
+
[
|
|
55
|
+
`box`,
|
|
56
|
+
`flex flex-${direction}`,
|
|
57
|
+
`justify-${justify}`,
|
|
58
|
+
`items-${align}`,
|
|
59
|
+
`gap-${gap}`,
|
|
60
|
+
`flex-${wrap}`,
|
|
61
|
+
`w-${width}`,
|
|
62
|
+
`h-${height}`,
|
|
63
|
+
grow ? `flex-grow-${grow}` : '',
|
|
64
|
+
shrink ? `flex-shrink-${shrink}` : '',
|
|
65
|
+
margin ? `m-${margin}` : '',
|
|
66
|
+
padding ? `p-${padding}` : '',
|
|
67
|
+
].join(' ')
|
|
68
|
+
);
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<div class={cssClass}>
|
|
72
|
+
{@render children?.()}
|
|
73
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
declare const FlexBox: import("svelte").Component<Partial<{
|
|
3
|
+
children: Snippet;
|
|
4
|
+
width?: string;
|
|
5
|
+
height?: string;
|
|
6
|
+
direction: "row" | "column" | "row-reverse" | "column-reverse";
|
|
7
|
+
justify?: "start" | "end" | "end-safe" | "center" | "center-safe" | "between" | "around" | "evenly" | "stretch" | "baseline" | "normal";
|
|
8
|
+
align?: "start" | "end" | "end-safe" | "center" | "center-safe" | "baseline" | "baseline-last" | "stretch";
|
|
9
|
+
wrap: "wrap" | "nowrap" | "wrap-reverse";
|
|
10
|
+
grow?: string;
|
|
11
|
+
shrink?: string;
|
|
12
|
+
gap?: string;
|
|
13
|
+
margin?: string;
|
|
14
|
+
padding?: string;
|
|
15
|
+
}>, {}, "">;
|
|
16
|
+
type FlexBox = ReturnType<typeof FlexBox>;
|
|
17
|
+
export default FlexBox;
|
|
@@ -1,222 +1,60 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import type { MenuItem, MenuSection } from './
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import type { MenuItem, MenuSection } from './menuItems.js';
|
|
4
|
+
import Icon from '../Icon.svelte';
|
|
5
|
+
import {
|
|
6
|
+
Sidebar,
|
|
7
|
+
SidebarDropdownItem,
|
|
8
|
+
SidebarDropdownWrapper,
|
|
9
|
+
SidebarGroup,
|
|
10
|
+
SidebarItem,
|
|
11
|
+
SidebarButton,
|
|
12
|
+
uiHelpers } from "flowbite-svelte";
|
|
7
13
|
|
|
8
14
|
interface TwoColumnLayoutProps {
|
|
9
|
-
|
|
10
|
-
containerCss: string;
|
|
11
|
-
spitPercentage: number;
|
|
12
|
-
isResizable: boolean;
|
|
13
|
-
isCollapsible: boolean;
|
|
14
|
-
collapsedWidthPx: number;
|
|
15
|
-
minWidthPercent: number;
|
|
16
|
-
maxWidthPercent: number;
|
|
15
|
+
children: Snippet;
|
|
17
16
|
menuItems: Array<MenuSection | MenuItem>;
|
|
18
|
-
buttonCss: string;
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
let {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
spitPercentage = 15,
|
|
25
|
-
isResizable = true,
|
|
26
|
-
isCollapsible = true,
|
|
27
|
-
collapsedWidthPx = 60,
|
|
28
|
-
minWidthPercent = 10,
|
|
29
|
-
maxWidthPercent = 80,
|
|
30
|
-
menuItems = [],
|
|
31
|
-
buttonCss = ''
|
|
20
|
+
children,
|
|
21
|
+
menuItems = []
|
|
32
22
|
}: Partial<TwoColumnLayoutProps> = $props();
|
|
33
23
|
|
|
34
24
|
let container: HTMLElement | undefined = undefined;
|
|
35
|
-
|
|
36
|
-
let isCollapsed = $state(false);
|
|
37
|
-
let isDragging = $state(false);
|
|
38
|
-
let iconStyleWidth = $derived(isCollapsed ? '2.25rem' : '1.5rem');
|
|
39
|
-
|
|
40
|
-
$effect(() => {
|
|
41
|
-
if (container) {
|
|
42
|
-
const containerWidth = container.getBoundingClientRect().width;
|
|
43
|
-
leftWidthPx = containerWidth * (spitPercentage / 100);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const toggleCollapse = () => {
|
|
48
|
-
isCollapsed = !isCollapsed;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
let startX = 0;
|
|
52
|
-
|
|
53
|
-
const handleMouseDown = (event: MouseEvent) => {
|
|
54
|
-
isDragging = true;
|
|
55
|
-
startX = event.clientX;
|
|
56
|
-
event.preventDefault();
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const handleMouseMove = (event: MouseEvent) => {
|
|
60
|
-
if (!isDragging) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const deltaX = event.clientX - startX;
|
|
65
|
-
const containerWidth = container?.getBoundingClientRect().width || 1;
|
|
66
|
-
const newWidth = leftWidthPx + deltaX;
|
|
67
|
-
const minWidthPx = containerWidth * (minWidthPercent / 100);
|
|
68
|
-
const maxWidthPx = containerWidth * (maxWidthPercent / 100);
|
|
69
|
-
|
|
70
|
-
if (newWidth >= minWidthPx && newWidth <= maxWidthPx) {
|
|
71
|
-
leftWidthPx = newWidth;
|
|
72
|
-
startX = event.clientX;
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const handleMouseUp = () => {
|
|
77
|
-
isDragging = false;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
$effect(() => {
|
|
81
|
-
if (isDragging) {
|
|
82
|
-
document.addEventListener('mousemove', handleMouseMove);
|
|
83
|
-
document.addEventListener('mouseup', handleMouseUp);
|
|
84
|
-
|
|
85
|
-
return () => {
|
|
86
|
-
document.removeEventListener('mousemove', handleMouseMove);
|
|
87
|
-
document.removeEventListener('mouseup', handleMouseUp);
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
});
|
|
25
|
+
const helpers = uiHelpers();
|
|
91
26
|
</script>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
<
|
|
95
|
-
{
|
|
96
|
-
|
|
97
|
-
{
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
<button
|
|
109
|
-
class="toggle-button"
|
|
110
|
-
onclick={toggleCollapse}
|
|
111
|
-
aria-label={isCollapsed ? 'Expand' : 'Collapse'}
|
|
112
|
-
>
|
|
113
|
-
{#if isCollapsed}
|
|
114
|
-
<Icon icon={getIcon(IconsSet.arrow_menu_close)} width="48" height="48" />
|
|
115
|
-
{:else}
|
|
116
|
-
<Icon icon={getIcon(IconsSet.arrow_menu_open)} width="48" height="48" />
|
|
117
|
-
{/if}
|
|
118
|
-
</button>
|
|
119
|
-
</div>
|
|
120
|
-
{/if}
|
|
121
|
-
<section>
|
|
122
|
-
{#each menuItems as section}
|
|
123
|
-
{#if section?.items}
|
|
124
|
-
<Accordion title={section.title} css="section">
|
|
125
|
-
<div class="menu-section">
|
|
126
|
-
{#each section.items as item}
|
|
127
|
-
{@render itemRender(item)}
|
|
128
|
-
{/each}
|
|
129
|
-
</div>
|
|
130
|
-
</Accordion>
|
|
27
|
+
<section class="flex flex-column md:flex-row" bind:this={container}>
|
|
28
|
+
<SidebarButton onclick={helpers.toggle} class="mb-2" />
|
|
29
|
+
<Sidebar
|
|
30
|
+
backdrop={false}
|
|
31
|
+
isOpen={helpers.isOpen}
|
|
32
|
+
closeSidebar={helpers.close}
|
|
33
|
+
position="fixed"
|
|
34
|
+
class="z-50 h-full">
|
|
35
|
+
<SidebarGroup>
|
|
36
|
+
{#each menuItems as item}
|
|
37
|
+
{#if 'items' in item}
|
|
38
|
+
<SidebarDropdownWrapper label={item.label}>
|
|
39
|
+
{#each item.items as subItem}
|
|
40
|
+
<SidebarDropdownItem label={subItem.label} href={subItem.href} />
|
|
41
|
+
{/each}
|
|
42
|
+
</SidebarDropdownWrapper>
|
|
131
43
|
{:else}
|
|
132
|
-
{
|
|
44
|
+
<SidebarItem label={item.label} href={item.href}>
|
|
45
|
+
{#snippet icon()}
|
|
46
|
+
<Icon
|
|
47
|
+
icon={item.icon} />
|
|
48
|
+
{/snippet}
|
|
49
|
+
</SidebarItem>
|
|
133
50
|
{/if}
|
|
134
51
|
{/each}
|
|
135
|
-
</
|
|
136
|
-
</
|
|
137
|
-
|
|
138
|
-
{#if isResizable && !isCollapsed}
|
|
139
|
-
<div
|
|
140
|
-
class="isResizable"
|
|
141
|
-
onmousedown={handleMouseDown}
|
|
142
|
-
role="separator"
|
|
143
|
-
aria-label="Resizer"
|
|
144
|
-
></div>
|
|
145
|
-
{/if}
|
|
146
|
-
|
|
52
|
+
</SidebarGroup>
|
|
53
|
+
</Sidebar>
|
|
147
54
|
<div class="content" style:flex="1">
|
|
148
|
-
{@render
|
|
55
|
+
{@render children?.()}
|
|
149
56
|
</div>
|
|
150
57
|
</section>
|
|
151
58
|
|
|
152
59
|
<style>
|
|
153
|
-
.container {
|
|
154
|
-
display: flex;
|
|
155
|
-
flex-direction: row;
|
|
156
|
-
width: 100%;
|
|
157
|
-
height: 100%;
|
|
158
|
-
position: relative;
|
|
159
|
-
}
|
|
160
|
-
.left {
|
|
161
|
-
transition: width 0.3s ease;
|
|
162
|
-
position: relative;
|
|
163
|
-
overflow-x: hidden;
|
|
164
|
-
}
|
|
165
|
-
.right {
|
|
166
|
-
}
|
|
167
|
-
.isResizable {
|
|
168
|
-
width: 4px;
|
|
169
|
-
background-color: #e0e0e0;
|
|
170
|
-
cursor: col-resize;
|
|
171
|
-
transition: background-color 0.2s;
|
|
172
|
-
flex-shrink: 0;
|
|
173
|
-
}
|
|
174
|
-
.isResizable:hover {
|
|
175
|
-
background-color: #0078d4;
|
|
176
|
-
}
|
|
177
|
-
.toggle-button-container {
|
|
178
|
-
position: sticky;
|
|
179
|
-
top: 0;
|
|
180
|
-
left: 0;
|
|
181
|
-
width: 100%;
|
|
182
|
-
height: 48px;
|
|
183
|
-
display: flex;
|
|
184
|
-
align-items: center;
|
|
185
|
-
justify-content: flex-start;
|
|
186
|
-
padding: 0 8px;
|
|
187
|
-
background-color: transparent;
|
|
188
|
-
z-index: 100;
|
|
189
|
-
}
|
|
190
|
-
.toggle-button {
|
|
191
|
-
background-color: transparent;
|
|
192
|
-
border: none;
|
|
193
|
-
width: 32px;
|
|
194
|
-
height: 32px;
|
|
195
|
-
display: flex;
|
|
196
|
-
align-items: center;
|
|
197
|
-
justify-content: center;
|
|
198
|
-
cursor: pointer;
|
|
199
|
-
border-radius: 2px;
|
|
200
|
-
color: #323130;
|
|
201
|
-
transition: background-color 0.1s;
|
|
202
|
-
padding: 0;
|
|
203
|
-
}
|
|
204
|
-
.toggle-button:hover {
|
|
205
|
-
background-color: rgba(0, 0, 0, 0.05);
|
|
206
|
-
}
|
|
207
|
-
.toggle-button:active {
|
|
208
|
-
background-color: rgba(0, 0, 0, 0.1);
|
|
209
|
-
}
|
|
210
|
-
.menu-section {
|
|
211
|
-
display: flex;
|
|
212
|
-
flex-direction: column;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
.button {
|
|
216
|
-
width: 100%;
|
|
217
|
-
height: 2em;
|
|
218
|
-
text-decoration: none;
|
|
219
|
-
}
|
|
220
|
-
.button:hover {
|
|
221
|
-
}
|
|
222
60
|
</style>
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import type { MenuItem, MenuSection } from './
|
|
2
|
+
import type { MenuItem, MenuSection } from './menuItems.js';
|
|
3
3
|
declare const MenuLayout: import("svelte").Component<Partial<{
|
|
4
|
-
|
|
5
|
-
containerCss: string;
|
|
6
|
-
spitPercentage: number;
|
|
7
|
-
isResizable: boolean;
|
|
8
|
-
isCollapsible: boolean;
|
|
9
|
-
collapsedWidthPx: number;
|
|
10
|
-
minWidthPercent: number;
|
|
11
|
-
maxWidthPercent: number;
|
|
4
|
+
children: Snippet;
|
|
12
5
|
menuItems: Array<MenuSection | MenuItem>;
|
|
13
|
-
buttonCss: string;
|
|
14
6
|
}>, {}, "">;
|
|
15
7
|
type MenuLayout = ReturnType<typeof MenuLayout>;
|
|
16
8
|
export default MenuLayout;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
children: Snippet;
|
|
6
|
+
class: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
children,
|
|
11
|
+
class: css = '',
|
|
12
|
+
}: Partial<Props> = $props();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div class={css}>
|
|
16
|
+
{@render children?.()}
|
|
17
|
+
</div>
|
|
@@ -1,46 +1,20 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import { cn } from '../../utils.js';
|
|
4
|
-
import { AlignItmes, Justify, Orientation } from '../Styling.js';
|
|
5
3
|
|
|
6
4
|
interface Props {
|
|
7
|
-
css?: string;
|
|
8
|
-
orientation?: Orientation;
|
|
9
|
-
justify?: Justify;
|
|
10
|
-
alignItems?: AlignItmes;
|
|
11
5
|
children: Snippet;
|
|
6
|
+
width: number;
|
|
7
|
+
class: string;
|
|
12
8
|
}
|
|
9
|
+
|
|
13
10
|
let {
|
|
14
11
|
children,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
alignItems = AlignItmes.Start
|
|
19
|
-
}: Props = $props();
|
|
12
|
+
width = 95,
|
|
13
|
+
class: css = '',
|
|
14
|
+
}: Partial<Props> = $props();
|
|
20
15
|
|
|
21
|
-
let klasses = cn(
|
|
22
|
-
'flex',
|
|
23
|
-
`${orientation}`,
|
|
24
|
-
`${justify}`,
|
|
25
|
-
`${alignItems}`,
|
|
26
|
-
css ? css : ''
|
|
27
|
-
);
|
|
28
16
|
</script>
|
|
29
17
|
|
|
30
|
-
<div class={
|
|
31
|
-
{@render children()}
|
|
18
|
+
<div class="well w-[{width}%] m-auto p-1 {css}">
|
|
19
|
+
{@render children?.()}
|
|
32
20
|
</div>
|
|
33
|
-
|
|
34
|
-
<style>
|
|
35
|
-
div {
|
|
36
|
-
width: var(--mobile-content-width, 95%);
|
|
37
|
-
margin: var(--mobile-content-margin, var(--fluid-8));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@media (min-width: 960px) {
|
|
41
|
-
div {
|
|
42
|
-
width: var(--content-width, 95%);
|
|
43
|
-
margin: var(--content-margin, var(--fluid-8));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
</style>
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
3
|
-
interface Props {
|
|
4
|
-
css?: string;
|
|
5
|
-
orientation?: Orientation;
|
|
6
|
-
justify?: Justify;
|
|
7
|
-
alignItems?: AlignItmes;
|
|
2
|
+
declare const Well: import("svelte").Component<Partial<{
|
|
8
3
|
children: Snippet;
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
width: number;
|
|
5
|
+
class: string;
|
|
6
|
+
}>, {}, "">;
|
|
11
7
|
type Well = ReturnType<typeof Well>;
|
|
12
8
|
export default Well;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Page } from "@sveltejs/kit";
|
|
2
|
+
export declare enum Visibility {
|
|
3
|
+
Always = 0,
|
|
4
|
+
Authenticated = 1,
|
|
5
|
+
NotAuthenticated = 2
|
|
6
|
+
}
|
|
7
|
+
export type MenuItem = {
|
|
8
|
+
label: string;
|
|
9
|
+
href?: string;
|
|
10
|
+
icon?: string;
|
|
11
|
+
visibility?: Visibility;
|
|
12
|
+
};
|
|
13
|
+
export type MenuSection = {
|
|
14
|
+
label: string;
|
|
15
|
+
items: MenuItem[];
|
|
16
|
+
href?: string;
|
|
17
|
+
icon?: string;
|
|
18
|
+
visibility?: Visibility;
|
|
19
|
+
};
|
|
20
|
+
export type MenuDivider = {};
|
|
21
|
+
export type MenuOption = MenuItem | MenuSection;
|
|
22
|
+
export declare function selectVisible(pages: Array<MenuItem>, visibility: Visibility): MenuItem[];
|
|
23
|
+
export declare function isSelected(includeSubpagesForSelect: boolean, page: any, item: MenuItem): any;
|
|
24
|
+
export declare const defaultCss: {
|
|
25
|
+
buttonCss: never[];
|
|
26
|
+
container: never[];
|
|
27
|
+
link: never[];
|
|
28
|
+
};
|
|
29
|
+
export declare function isAuthenticated(page: Page): Visibility.Authenticated | Visibility.NotAuthenticated;
|