@functionalcms/svelte-components 5.0.2 → 5.1.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/layouts/SimpleLayout.svelte +19 -0
- package/dist/components/layouts/SimpleLayout.svelte.d.ts +7 -0
- package/dist/components/layouts copy/DefaultLayout.svelte +115 -0
- package/dist/components/layouts copy/DefaultLayout.svelte.d.ts +21 -0
- package/dist/components/layouts copy/MenuLayout.svelte +63 -0
- package/dist/components/layouts copy/MenuLayout.svelte.d.ts +8 -0
- package/dist/components/layouts copy/menuItems.d.ts +29 -0
- package/dist/components/layouts copy/menuItems.js +28 -0
- package/dist/index-server.d.ts +9 -9
- package/dist/index-server.js +8 -8
- package/dist/index.d.ts +5 -4
- package/dist/index.js +5 -7
- package/dist/{auth → server-side/auth}/redisSessionProvider.js +9 -15
- package/dist/server-side/getServices.d.ts +6 -8
- package/dist/server-side/getServices.js +11 -21
- package/dist/server-side/types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/{layouts → head}/Tracker.svelte +0 -0
- package/dist/components/{layouts → head}/Tracker.svelte.d.ts +0 -0
- package/dist/components/{layouts → presentation}/FlexBox.svelte +0 -0
- package/dist/components/{layouts → presentation}/FlexBox.svelte.d.ts +0 -0
- package/dist/components/{layouts → presentation}/StyleBox.svelte +0 -0
- package/dist/components/{layouts → presentation}/StyleBox.svelte.d.ts +0 -0
- package/dist/components/{layouts → presentation}/Well.svelte +0 -0
- package/dist/components/{layouts → presentation}/Well.svelte.d.ts +0 -0
- package/dist/{auth → server-side/auth}/RedirectResponse.d.ts +0 -0
- package/dist/{auth → server-side/auth}/RedirectResponse.js +0 -0
- package/dist/{auth → server-side/auth}/authenticationHandle.d.ts +0 -0
- package/dist/{auth → server-side/auth}/authenticationHandle.js +0 -0
- package/dist/{auth → server-side/auth}/authorizationHandle.d.ts +0 -0
- package/dist/{auth → server-side/auth}/authorizationHandle.js +0 -0
- package/dist/{auth → server-side/auth}/errorHandle.d.ts +0 -0
- package/dist/{auth → server-side/auth}/errorHandle.js +0 -0
- package/dist/{auth → server-side/auth}/getMachineAccessToken.d.ts +0 -0
- package/dist/{auth → server-side/auth}/getMachineAccessToken.js +0 -0
- package/dist/{auth → server-side/auth}/machineAuthenticationProvider.d.ts +0 -0
- package/dist/{auth → server-side/auth}/machineAuthenticationProvider.js +0 -0
- package/dist/{auth → server-side/auth}/redisSessionProvider.d.ts +1 -1
- /package/dist/{auth → server-side/auth}/sessionIdGenerator.d.ts +0 -0
- /package/dist/{auth → server-side/auth}/sessionIdGenerator.js +0 -0
- /package/dist/{auth → server-side/auth}/tokenRefresh.d.ts +0 -0
- /package/dist/{auth → server-side/auth}/tokenRefresh.js +0 -0
- /package/dist/{auth → server-side/auth}/types.d.ts +0 -0
- /package/dist/{auth → server-side/auth}/types.js +0 -0
- /package/dist/{auth → server-side/auth}/userAuthenticationProvider.d.ts +0 -0
- /package/dist/{auth → server-side/auth}/userAuthenticationProvider.js +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { afterNavigate } from '$app/navigation';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
children: Snippet;
|
|
7
|
+
class: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let { children, class: className }: Partial<Props> = $props();
|
|
11
|
+
|
|
12
|
+
afterNavigate(() => {
|
|
13
|
+
window.scrollTo({ top: 0, behavior: 'instant' });
|
|
14
|
+
});
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<main class={`min-h-screen ${className}`}>
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
</main>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { page } from '$app/state';
|
|
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
|
+
import { afterNavigate } from "$app/navigation";
|
|
16
|
+
|
|
17
|
+
interface Styles {
|
|
18
|
+
logo?: string;
|
|
19
|
+
companyName?: string;
|
|
20
|
+
navigation?: string;
|
|
21
|
+
menuItem?: string;
|
|
22
|
+
activeClass?: string;
|
|
23
|
+
nonActiveClass?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface Props {
|
|
27
|
+
children: Snippet;
|
|
28
|
+
canonicalUrl: string;
|
|
29
|
+
logoUrl?: string;
|
|
30
|
+
companyName?: string;
|
|
31
|
+
renderCompanyName?: boolean;
|
|
32
|
+
menuItems?: Array<MenuOption>;
|
|
33
|
+
footerRender?: Snippet;
|
|
34
|
+
classes?: Styles;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let {
|
|
38
|
+
children,
|
|
39
|
+
canonicalUrl,
|
|
40
|
+
logoUrl = undefined,
|
|
41
|
+
companyName = '',
|
|
42
|
+
renderCompanyName = true,
|
|
43
|
+
menuItems = [],
|
|
44
|
+
footerRender = undefined,
|
|
45
|
+
classes = {},
|
|
46
|
+
}: Partial<Props> = $props();
|
|
47
|
+
|
|
48
|
+
const defaultClasses = {
|
|
49
|
+
logo: 'me-3 h-6 sm:h-9',
|
|
50
|
+
companyName: 'self-center whitespace-nowrap text-xl font-semibold dark:text-white',
|
|
51
|
+
navigation: '',
|
|
52
|
+
menuItem: '',
|
|
53
|
+
activeClass: 'text-blue-700 dark:text-white',
|
|
54
|
+
nonActiveClass: 'text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white',
|
|
55
|
+
footer:
|
|
56
|
+
'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',
|
|
57
|
+
footerLinks: ''
|
|
58
|
+
};
|
|
59
|
+
const mergedClasses = $derived(() => ({ ...defaultClasses, ...classes }));
|
|
60
|
+
|
|
61
|
+
let activeUrl = $state(page.url.pathname);
|
|
62
|
+
|
|
63
|
+
$effect(() => {
|
|
64
|
+
activeUrl = page.url.pathname;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
afterNavigate(() => {
|
|
68
|
+
window.scrollTo({ top: 0, behavior: "instant" });
|
|
69
|
+
});
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<svelte:head>
|
|
73
|
+
<link rel="canonical" href="{canonicalUrl}{page.url.pathname}" />
|
|
74
|
+
</svelte:head>
|
|
75
|
+
|
|
76
|
+
<div class="w-full relative" id="defaultLayout">
|
|
77
|
+
<Navbar class={mergedClasses().navigation}>
|
|
78
|
+
<NavBrand href="/" class="logo">
|
|
79
|
+
<img src={logoUrl} class={mergedClasses().logo} alt={companyName} />
|
|
80
|
+
{#if renderCompanyName}
|
|
81
|
+
<span class={mergedClasses().companyName}>{companyName}</span>
|
|
82
|
+
{/if}
|
|
83
|
+
</NavBrand>
|
|
84
|
+
<NavHamburger />
|
|
85
|
+
<NavUl
|
|
86
|
+
{activeUrl}
|
|
87
|
+
classes={{ active: mergedClasses().activeClass, nonActive: mergedClasses().nonActiveClass }}
|
|
88
|
+
>
|
|
89
|
+
{#each menuItems as item}
|
|
90
|
+
{#if item?.items}
|
|
91
|
+
<NavLi class={mergedClasses().menuItem}>
|
|
92
|
+
<a href={item.href}>{item.label}</a>
|
|
93
|
+
<ChevronDownOutline class="text-primary-800 ms-2 inline h-6 w-6 dark:text-white" />
|
|
94
|
+
</NavLi>
|
|
95
|
+
<Dropdown simple class="w-44">
|
|
96
|
+
{#each item.items as subItem}
|
|
97
|
+
<DropdownItem class={mergedClasses().menuItem} href={subItem.href}
|
|
98
|
+
>{subItem.label}</DropdownItem
|
|
99
|
+
>
|
|
100
|
+
{/each}
|
|
101
|
+
</Dropdown>
|
|
102
|
+
{:else}
|
|
103
|
+
<NavLi class={mergedClasses().menuItem}>
|
|
104
|
+
<a href={item.href}>{item.label}</a>
|
|
105
|
+
</NavLi>
|
|
106
|
+
{/if}
|
|
107
|
+
{/each}
|
|
108
|
+
</NavUl>
|
|
109
|
+
</Navbar>
|
|
110
|
+
<main class="min-h-screen">
|
|
111
|
+
{@render children?.()}
|
|
112
|
+
</main>
|
|
113
|
+
{@render footerRender?.()}
|
|
114
|
+
|
|
115
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import { type MenuOption } from './menuItems.js';
|
|
3
|
+
declare const DefaultLayout: import("svelte").Component<Partial<{
|
|
4
|
+
children: Snippet;
|
|
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
|
+
}>, {}, "">;
|
|
20
|
+
type DefaultLayout = ReturnType<typeof DefaultLayout>;
|
|
21
|
+
export default DefaultLayout;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { MenuItem, MenuSection } from './menuItems.js';
|
|
4
|
+
import Icon from '../Icon.svelte';
|
|
5
|
+
import { afterNavigate } from '$app/navigation';
|
|
6
|
+
import {
|
|
7
|
+
Sidebar,
|
|
8
|
+
SidebarDropdownItem,
|
|
9
|
+
SidebarDropdownWrapper,
|
|
10
|
+
SidebarGroup,
|
|
11
|
+
SidebarItem,
|
|
12
|
+
SidebarButton,
|
|
13
|
+
uiHelpers
|
|
14
|
+
} from 'flowbite-svelte';
|
|
15
|
+
|
|
16
|
+
interface TwoColumnLayoutProps {
|
|
17
|
+
children: Snippet;
|
|
18
|
+
menuItems: Array<MenuSection | MenuItem>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let { children, menuItems = [] }: Partial<TwoColumnLayoutProps> = $props();
|
|
22
|
+
|
|
23
|
+
let container: HTMLElement | undefined = undefined;
|
|
24
|
+
const helpers = uiHelpers();
|
|
25
|
+
afterNavigate(() => {
|
|
26
|
+
window.scrollTo({ top: 0, behavior: 'instant' });
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<section class="flex flex-column md:flex-row" bind:this={container}>
|
|
31
|
+
<SidebarButton onclick={helpers.toggle} class="mb-2" />
|
|
32
|
+
<Sidebar
|
|
33
|
+
backdrop={false}
|
|
34
|
+
isOpen={helpers.isOpen}
|
|
35
|
+
closeSidebar={helpers.close}
|
|
36
|
+
position="fixed"
|
|
37
|
+
class="z-50 h-full"
|
|
38
|
+
>
|
|
39
|
+
<SidebarGroup>
|
|
40
|
+
{#each menuItems as item}
|
|
41
|
+
{#if 'items' in item}
|
|
42
|
+
<SidebarDropdownWrapper label={item.label}>
|
|
43
|
+
{#each item.items as subItem}
|
|
44
|
+
<SidebarDropdownItem label={subItem.label} href={subItem.href} />
|
|
45
|
+
{/each}
|
|
46
|
+
</SidebarDropdownWrapper>
|
|
47
|
+
{:else}
|
|
48
|
+
<SidebarItem label={item.label} href={item.href}>
|
|
49
|
+
{#snippet icon()}
|
|
50
|
+
<Icon icon={item.icon} />
|
|
51
|
+
{/snippet}
|
|
52
|
+
</SidebarItem>
|
|
53
|
+
{/if}
|
|
54
|
+
{/each}
|
|
55
|
+
</SidebarGroup>
|
|
56
|
+
</Sidebar>
|
|
57
|
+
<div class="content" style:flex="1">
|
|
58
|
+
{@render children?.()}
|
|
59
|
+
</div>
|
|
60
|
+
</section>
|
|
61
|
+
|
|
62
|
+
<style>
|
|
63
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { MenuItem, MenuSection } from './menuItems.js';
|
|
3
|
+
declare const MenuLayout: import("svelte").Component<Partial<{
|
|
4
|
+
children: Snippet;
|
|
5
|
+
menuItems: Array<MenuSection | MenuItem>;
|
|
6
|
+
}>, {}, "">;
|
|
7
|
+
type MenuLayout = ReturnType<typeof MenuLayout>;
|
|
8
|
+
export default MenuLayout;
|
|
@@ -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;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export var Visibility;
|
|
2
|
+
(function (Visibility) {
|
|
3
|
+
Visibility[Visibility["Always"] = 0] = "Always";
|
|
4
|
+
Visibility[Visibility["Authenticated"] = 1] = "Authenticated";
|
|
5
|
+
Visibility[Visibility["NotAuthenticated"] = 2] = "NotAuthenticated";
|
|
6
|
+
})(Visibility || (Visibility = {}));
|
|
7
|
+
export function selectVisible(pages, visibility) {
|
|
8
|
+
return pages.filter((page) => page?.visibility === Visibility.Always ||
|
|
9
|
+
page?.visibility === visibility);
|
|
10
|
+
}
|
|
11
|
+
export function isSelected(includeSubpagesForSelect, page, item) {
|
|
12
|
+
if (page?.url?.pathname === '/') {
|
|
13
|
+
return page?.url?.pathname === item.href;
|
|
14
|
+
}
|
|
15
|
+
return includeSubpagesForSelect
|
|
16
|
+
? (page?.url.pathname.startsWith(item.href ?? '-') && item.href !== '/')
|
|
17
|
+
: page?.url.pathname === item.href;
|
|
18
|
+
}
|
|
19
|
+
export const defaultCss = {
|
|
20
|
+
buttonCss: [],
|
|
21
|
+
container: [],
|
|
22
|
+
link: []
|
|
23
|
+
};
|
|
24
|
+
export function isAuthenticated(page) {
|
|
25
|
+
const isAuthenticated = page?.data?.session != null;
|
|
26
|
+
const visibility = isAuthenticated ? Visibility.Authenticated : Visibility.NotAuthenticated;
|
|
27
|
+
return visibility;
|
|
28
|
+
}
|
package/dist/index-server.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { authenticationHandle } from './auth/authenticationHandle.js';
|
|
2
|
-
export { default as authorizationHandle } from './auth/authorizationHandle.js';
|
|
3
|
-
export { default as errorHandler } from './auth/errorHandle.js';
|
|
4
|
-
export { redisSessionProvider } from './auth/redisSessionProvider.js';
|
|
5
|
-
export { machineAuthenticationProvider } from './auth/machineAuthenticationProvider.js';
|
|
6
|
-
export { userAuthenticationProvider } from './auth/userAuthenticationProvider.js';
|
|
7
|
-
export {
|
|
8
|
-
export type { RedirectResponse } from './auth/RedirectResponse.js';
|
|
9
|
-
export { createMachineTokenApprovedLocals } from './auth/getMachineAccessToken.js';
|
|
1
|
+
export { authenticationHandle } from './server-side/auth/authenticationHandle.js';
|
|
2
|
+
export { default as authorizationHandle } from './server-side/auth/authorizationHandle.js';
|
|
3
|
+
export { default as errorHandler } from './server-side/auth/errorHandle.js';
|
|
4
|
+
export { redisSessionProvider } from './server-side/auth/redisSessionProvider.js';
|
|
5
|
+
export { machineAuthenticationProvider } from './server-side/auth/machineAuthenticationProvider.js';
|
|
6
|
+
export { userAuthenticationProvider } from './server-side/auth/userAuthenticationProvider.js';
|
|
7
|
+
export { getCommunicationService, getDataService, getTemplateService, getWebsiteService, getAuthService, getFileService, } from './server-side/getServices.js';
|
|
8
|
+
export type { RedirectResponse } from './server-side/auth/RedirectResponse.js';
|
|
9
|
+
export { createMachineTokenApprovedLocals } from './server-side/auth/getMachineAccessToken.js';
|
|
10
10
|
export { isHuman } from './components/form/AntiBot.js';
|
|
11
11
|
export { paraglideHandler } from './server-side/handlers/paraglideHandler.js';
|
|
12
12
|
export { redirectPipelineHandler } from './server-side/handlers/redirectPipelineHandler.js';
|
package/dist/index-server.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { authenticationHandle } from './auth/authenticationHandle.js';
|
|
2
|
-
export { default as authorizationHandle } from './auth/authorizationHandle.js';
|
|
3
|
-
export { default as errorHandler } from './auth/errorHandle.js';
|
|
4
|
-
export { redisSessionProvider } from './auth/redisSessionProvider.js';
|
|
5
|
-
export { machineAuthenticationProvider } from './auth/machineAuthenticationProvider.js';
|
|
6
|
-
export { userAuthenticationProvider } from './auth/userAuthenticationProvider.js';
|
|
7
|
-
export {
|
|
8
|
-
export { createMachineTokenApprovedLocals } from './auth/getMachineAccessToken.js';
|
|
1
|
+
export { authenticationHandle } from './server-side/auth/authenticationHandle.js';
|
|
2
|
+
export { default as authorizationHandle } from './server-side/auth/authorizationHandle.js';
|
|
3
|
+
export { default as errorHandler } from './server-side/auth/errorHandle.js';
|
|
4
|
+
export { redisSessionProvider } from './server-side/auth/redisSessionProvider.js';
|
|
5
|
+
export { machineAuthenticationProvider } from './server-side/auth/machineAuthenticationProvider.js';
|
|
6
|
+
export { userAuthenticationProvider } from './server-side/auth/userAuthenticationProvider.js';
|
|
7
|
+
export { getCommunicationService, getDataService, getTemplateService, getWebsiteService, getAuthService, getFileService, } from './server-side/getServices.js';
|
|
8
|
+
export { createMachineTokenApprovedLocals } from './server-side/auth/getMachineAccessToken.js';
|
|
9
9
|
export { isHuman } from './components/form/AntiBot.js';
|
|
10
10
|
export { paraglideHandler } from './server-side/handlers/paraglideHandler.js';
|
|
11
11
|
export { redirectPipelineHandler } from './server-side/handlers/redirectPipelineHandler.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
export { default as Meta } from './components/head/Meta.svelte';
|
|
2
2
|
export { default as Font } from './components/head/Font.svelte';
|
|
3
|
-
export { default as Tracker } from './components/
|
|
3
|
+
export { default as Tracker } from './components/head/Tracker.svelte';
|
|
4
4
|
export { default as DefaultLayout } from './components/layouts/DefaultLayout.svelte';
|
|
5
5
|
export { default as MenuLayout } from './components/layouts/MenuLayout.svelte';
|
|
6
|
-
export { default as
|
|
7
|
-
export { default as FlexBox } from './components/layouts/FlexBox.svelte';
|
|
8
|
-
export { default as StyleBox } from './components/layouts/StyleBox.svelte';
|
|
6
|
+
export { default as SimpleLayout } from './components/layouts/SimpleLayout.svelte';
|
|
9
7
|
export type { MenuItem, MenuSection } from './components/layouts/menuItems.js';
|
|
10
8
|
export { Visibility } from './components/layouts/menuItems.js';
|
|
9
|
+
export { default as Well } from './components/presentation/Well.svelte';
|
|
10
|
+
export { default as FlexBox } from './components/presentation/FlexBox.svelte';
|
|
11
|
+
export { default as StyleBox } from './components/presentation/StyleBox.svelte';
|
|
11
12
|
export { default as ImageCompare } from './components/presentation/ImageCompare.svelte';
|
|
12
13
|
export { InputType, FieldType, type Field, type InputField, type TextareaField, type CollectionField, type SelectField, type FilePickerField, type TimePickerField, type PhoneInputField, SubmitResult, createInputField, createTextareaField, createFilePickerField, createCollectionField, createSelectField, createTimePickerField, createPhoneInputField, } from './components/form/form.js';
|
|
13
14
|
export { default as AntiBot } from './components/form/AntiBot.svelte';
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
export { default as Meta } from './components/head/Meta.svelte';
|
|
2
2
|
export { default as Font } from './components/head/Font.svelte';
|
|
3
|
-
export { default as Tracker } from './components/
|
|
3
|
+
export { default as Tracker } from './components/head/Tracker.svelte';
|
|
4
4
|
export { default as DefaultLayout } from './components/layouts/DefaultLayout.svelte';
|
|
5
5
|
export { default as MenuLayout } from './components/layouts/MenuLayout.svelte';
|
|
6
|
-
export { default as
|
|
7
|
-
export { default as FlexBox } from './components/layouts/FlexBox.svelte';
|
|
8
|
-
export { default as StyleBox } from './components/layouts/StyleBox.svelte';
|
|
6
|
+
export { default as SimpleLayout } from './components/layouts/SimpleLayout.svelte';
|
|
9
7
|
export { Visibility } from './components/layouts/menuItems.js';
|
|
8
|
+
export { default as Well } from './components/presentation/Well.svelte';
|
|
9
|
+
export { default as FlexBox } from './components/presentation/FlexBox.svelte';
|
|
10
|
+
export { default as StyleBox } from './components/presentation/StyleBox.svelte';
|
|
10
11
|
export { default as ImageCompare } from './components/presentation/ImageCompare.svelte';
|
|
11
|
-
/*
|
|
12
|
-
* Form
|
|
13
|
-
*/
|
|
14
12
|
export { InputType, FieldType, SubmitResult, createInputField, createTextareaField, createFilePickerField, createCollectionField, createSelectField, createTimePickerField, createPhoneInputField, } from './components/form/form.js';
|
|
15
13
|
export { default as AntiBot } from './components/form/AntiBot.svelte';
|
|
16
14
|
export { default as SmartForm } from './components/form/SmartForm.svelte';
|
|
@@ -1,39 +1,33 @@
|
|
|
1
1
|
import { getSid } from './sessionIdGenerator.js';
|
|
2
|
-
|
|
3
|
-
import { CACHE_SECRET } from '$env/static/private';
|
|
4
|
-
const redis = new Redis.Redis(6380, "functional.redis.cache.windows.net", {
|
|
5
|
-
password: CACHE_SECRET,
|
|
6
|
-
tls: true
|
|
7
|
-
});
|
|
8
|
-
async function clean() {
|
|
9
|
-
}
|
|
2
|
+
const sessionStore = new Map();
|
|
10
3
|
async function createSession(session, maxAge) {
|
|
11
4
|
const sid = getSid();
|
|
12
5
|
const sessionObject = {
|
|
13
6
|
data: session,
|
|
14
7
|
invalidAt: Date.now() + maxAge + 3600
|
|
15
8
|
};
|
|
16
|
-
|
|
9
|
+
sessionStore.set(sid, sessionObject);
|
|
17
10
|
return sid;
|
|
18
11
|
}
|
|
19
12
|
async function updateSession(sid, session, maxAge) {
|
|
20
|
-
|
|
13
|
+
sessionStore.delete(sid);
|
|
21
14
|
const sessionObject = {
|
|
22
15
|
data: session,
|
|
23
16
|
invalidAt: Date.now() + maxAge + 3600
|
|
24
17
|
};
|
|
25
|
-
|
|
18
|
+
sessionStore.set(sid, sessionObject);
|
|
26
19
|
}
|
|
27
20
|
async function getSession(sid) {
|
|
28
|
-
const savedSession =
|
|
21
|
+
const savedSession = sessionStore.get(sid);
|
|
29
22
|
if (savedSession) {
|
|
30
|
-
|
|
31
|
-
return session.data;
|
|
23
|
+
return savedSession.data;
|
|
32
24
|
}
|
|
33
25
|
return null;
|
|
34
26
|
}
|
|
35
27
|
async function deleteSession(sid) {
|
|
36
|
-
|
|
28
|
+
sessionStore.delete(sid);
|
|
29
|
+
}
|
|
30
|
+
async function clean() {
|
|
37
31
|
}
|
|
38
32
|
export const redisSessionProvider = {
|
|
39
33
|
clean: clean,
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { CommunicationService, DataService, TemplateService, WebsitesService,
|
|
1
|
+
import { CommunicationService, DataService, TemplateService, WebsitesService, AuthService, FilesService } from "@functionalcms/services";
|
|
2
2
|
import type { Locals } from "./types.js";
|
|
3
|
-
export declare const getDataService: (locals: Locals,
|
|
4
|
-
export declare const getCommunicationService: (locals: Locals,
|
|
5
|
-
export declare const getWebsiteService: (locals: Locals,
|
|
6
|
-
export declare const getTemplateService: (locals: Locals,
|
|
7
|
-
export declare const getBlobService: (locals: Locals, domain: string, endpoint: string) => BlobService;
|
|
8
|
-
export declare const getAIService: (locals: Locals, domain: string, endpoint: string) => AiService;
|
|
3
|
+
export declare const getDataService: (locals: Locals, endpoint: string) => DataService;
|
|
4
|
+
export declare const getCommunicationService: (locals: Locals, endpoint: string) => CommunicationService;
|
|
5
|
+
export declare const getWebsiteService: (locals: Locals, endpoint: string) => WebsitesService;
|
|
6
|
+
export declare const getTemplateService: (locals: Locals, endpoint: string) => TemplateService;
|
|
9
7
|
export declare const getAuthService: (locals: Locals, endpoint: string) => AuthService;
|
|
10
|
-
export declare const getFileService: (locals: Locals,
|
|
8
|
+
export declare const getFileService: (locals: Locals, endpoint: string) => FilesService;
|
|
@@ -1,35 +1,25 @@
|
|
|
1
|
-
import { CommunicationService, DataService, TemplateService, WebsitesService,
|
|
1
|
+
import { CommunicationService, DataService, TemplateService, WebsitesService, AuthService, FilesService, } from "@functionalcms/services";
|
|
2
2
|
const getAccessToken = (locals) => {
|
|
3
3
|
return locals.token.access_token;
|
|
4
4
|
};
|
|
5
|
-
export const getDataService = (locals,
|
|
5
|
+
export const getDataService = (locals, endpoint) => {
|
|
6
6
|
const accessToken = getAccessToken(locals);
|
|
7
|
-
const service = new DataService(accessToken,
|
|
7
|
+
const service = new DataService(accessToken, endpoint);
|
|
8
8
|
return service;
|
|
9
9
|
};
|
|
10
|
-
export const getCommunicationService = (locals,
|
|
10
|
+
export const getCommunicationService = (locals, endpoint) => {
|
|
11
11
|
const accessToken = getAccessToken(locals);
|
|
12
|
-
const service = new CommunicationService(accessToken,
|
|
12
|
+
const service = new CommunicationService(accessToken, endpoint);
|
|
13
13
|
return service;
|
|
14
14
|
};
|
|
15
|
-
export const getWebsiteService = (locals,
|
|
15
|
+
export const getWebsiteService = (locals, endpoint) => {
|
|
16
16
|
const accessToken = getAccessToken(locals);
|
|
17
|
-
const service = new WebsitesService(accessToken,
|
|
17
|
+
const service = new WebsitesService(accessToken, endpoint);
|
|
18
18
|
return service;
|
|
19
19
|
};
|
|
20
|
-
export const getTemplateService = (locals,
|
|
20
|
+
export const getTemplateService = (locals, endpoint) => {
|
|
21
21
|
const accessToken = getAccessToken(locals);
|
|
22
|
-
const service = new TemplateService(accessToken,
|
|
23
|
-
return service;
|
|
24
|
-
};
|
|
25
|
-
export const getBlobService = (locals, domain, endpoint) => {
|
|
26
|
-
const accessToken = getAccessToken(locals);
|
|
27
|
-
const service = new BlobService(accessToken, domain, endpoint);
|
|
28
|
-
return service;
|
|
29
|
-
};
|
|
30
|
-
export const getAIService = (locals, domain, endpoint) => {
|
|
31
|
-
const accessToken = getAccessToken(locals);
|
|
32
|
-
const service = new AiService(accessToken, domain, endpoint);
|
|
22
|
+
const service = new TemplateService(accessToken, endpoint);
|
|
33
23
|
return service;
|
|
34
24
|
};
|
|
35
25
|
export const getAuthService = (locals, endpoint) => {
|
|
@@ -37,8 +27,8 @@ export const getAuthService = (locals, endpoint) => {
|
|
|
37
27
|
const service = new AuthService(accessToken, endpoint);
|
|
38
28
|
return service;
|
|
39
29
|
};
|
|
40
|
-
export const getFileService = (locals,
|
|
30
|
+
export const getFileService = (locals, endpoint) => {
|
|
41
31
|
const accessToken = getAccessToken(locals);
|
|
42
|
-
const service = new FilesService(accessToken,
|
|
32
|
+
const service = new FilesService(accessToken, endpoint);
|
|
43
33
|
return service;
|
|
44
34
|
};
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ISession, Sid } from './types.js';
|
|
2
|
-
declare function clean(): Promise<void>;
|
|
3
2
|
declare function createSession(session: ISession, maxAge: number): Promise<string>;
|
|
4
3
|
declare function updateSession(sid: string, session: ISession, maxAge: number): Promise<void>;
|
|
5
4
|
declare function getSession(sid: Sid): Promise<any>;
|
|
6
5
|
declare function deleteSession(sid: string): Promise<void>;
|
|
6
|
+
declare function clean(): Promise<void>;
|
|
7
7
|
export declare const redisSessionProvider: {
|
|
8
8
|
clean: typeof clean;
|
|
9
9
|
createSession: typeof createSession;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|