@functionalcms/svelte-components 3.5.19 → 4.0.0-pre
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 +1 -1
- package/css/functional.css.map +1 -1
- package/dist/auth/authenticationHandle.js +0 -4
- package/dist/auth/redisSessionProvider.js +1 -2
- package/dist/auth/sessionIdGenerator.d.ts +1 -1
- package/dist/components/form/Button.svelte +379 -0
- package/dist/components/form/Button.svelte.d.ts +27 -0
- package/dist/components/form/Input.d.ts +21 -0
- package/dist/components/form/Input.js +23 -0
- package/dist/components/form/Input.svelte +142 -177
- package/dist/components/form/Input.svelte.d.ts +24 -46
- package/dist/components/{Banner.svelte → layouts/Banner.svelte} +5 -5
- package/dist/components/layouts/DefaultLayout.svelte +5 -5
- package/dist/components/layouts/DefaultLayout.svelte.d.ts +4 -4
- package/dist/components/layouts/SimpleFooter.svelte +4 -4
- package/dist/components/layouts/SimpleFooter.svelte.d.ts +3 -3
- package/dist/components/layouts/Well.svelte +46 -0
- package/dist/components/layouts/Well.svelte.d.ts +12 -0
- package/dist/components/menu/CollapsibleMenu.svelte +2 -2
- package/dist/components/menu/CollapsibleMenu.svelte.d.ts +3 -16
- package/dist/components/menu/DynamicMenu.svelte +25 -13
- package/dist/components/menu/DynamicMenu.svelte.d.ts +10 -28
- package/dist/components/menu/HamburgerMenu.svelte +29 -21
- package/dist/components/menu/HamburgerMenu.svelte.d.ts +11 -24
- package/dist/components/menu/ListMenu.svelte +53 -0
- package/dist/components/menu/ListMenu.svelte.d.ts +17 -0
- package/dist/components/menu/{Menu.d.ts → types.d.ts} +2 -0
- package/dist/components/menu/{Menu.js → types.js} +5 -0
- package/dist/components/presentation/Card.svelte +77 -92
- package/dist/components/presentation/Card.svelte.d.ts +10 -13
- package/dist/components/presentation/{Carusele.d.ts → Carousel.d.ts} +1 -1
- package/dist/components/presentation/Carousel.svelte +98 -1
- package/dist/components/presentation/Carousel.svelte.d.ts +14 -15
- package/dist/components/presentation/Drawer.svelte +131 -0
- package/dist/components/presentation/Drawer.svelte.d.ts +13 -0
- package/dist/components/presentation/Gallery.svelte +7 -7
- package/dist/components/presentation/Gallery.svelte.d.ts +3 -3
- package/dist/components/presentation/ImageCompare.svelte +39 -46
- package/dist/components/presentation/ImageCompare.svelte.d.ts +8 -26
- package/dist/components/presentation/Link.svelte +362 -0
- package/dist/components/presentation/Link.svelte.d.ts +27 -0
- package/dist/components/presentation/Logo.svelte +36 -0
- package/dist/components/presentation/Logo.svelte.d.ts +8 -0
- package/dist/components/presentation/ShowItem.d.ts +7 -7
- package/dist/components/presentation/ShowItem.js +1 -8
- package/dist/index-server.d.ts +0 -1
- package/dist/index-server.js +0 -3
- package/dist/index.d.ts +16 -26
- package/dist/index.js +39 -57
- package/dist/server-side/getServices.d.ts +1 -1
- package/dist/server-side/types.d.ts +1 -2
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +54 -0
- package/package.json +27 -27
- package/dist/components/CssHelper.d.ts +0 -1
- package/dist/components/CssHelper.js +0 -3
- package/dist/components/Link.svelte +0 -349
- package/dist/components/Link.svelte.d.ts +0 -48
- package/dist/components/Logo.svelte +0 -38
- package/dist/components/Logo.svelte.d.ts +0 -28
- package/dist/components/Spacer.svelte +0 -22
- package/dist/components/Spacer.svelte.d.ts +0 -6
- package/dist/components/Well.svelte +0 -40
- package/dist/components/Well.svelte.d.ts +0 -12
- package/dist/components/agnostic/Button/Button.svelte +0 -371
- package/dist/components/agnostic/Button/Button.svelte.d.ts +0 -52
- package/dist/components/agnostic/Button/ButtonGroup.svelte +0 -21
- package/dist/components/agnostic/Button/ButtonGroup.svelte.d.ts +0 -32
- package/dist/components/agnostic/Button/button-base.css +0 -12
- package/dist/components/agnostic/Button/button-core.css +0 -237
- package/dist/components/agnostic/Button/button-empty.css +0 -31
- package/dist/components/agnostic/Button/button-group.css +0 -8
- package/dist/components/agnostic/Close/Close.svelte +0 -124
- package/dist/components/agnostic/Close/Close.svelte.d.ts +0 -25
- package/dist/components/agnostic/Close/api.d.ts +0 -1
- package/dist/components/agnostic/Disclose/Disclose.svelte +0 -116
- package/dist/components/agnostic/Disclose/Disclose.svelte.d.ts +0 -11
- package/dist/components/agnostic/Divider/Divider.svelte +0 -141
- package/dist/components/agnostic/Divider/Divider.svelte.d.ts +0 -24
- package/dist/components/agnostic/Divider/api.d.ts +0 -3
- package/dist/components/agnostic/Divider/api.js +0 -1
- package/dist/components/agnostic/Loader/Loader.svelte +0 -116
- package/dist/components/agnostic/Loader/Loader.svelte.d.ts +0 -22
- package/dist/components/agnostic/animation.css +0 -37
- package/dist/components/blog/BlogDescription.svelte +0 -9
- package/dist/components/blog/BlogDescription.svelte.d.ts +0 -23
- package/dist/components/blog/BlogPost.d.ts +0 -13
- package/dist/components/blog/BlogPost.js +0 -1
- package/dist/components/blog/BlogTitle.svelte +0 -19
- package/dist/components/blog/BlogTitle.svelte.d.ts +0 -23
- package/dist/components/blog/blog.d.ts +0 -8
- package/dist/components/blog/blog.js +0 -29
- package/dist/components/converters/ShowItemToNavigationItems.d.ts +0 -3
- package/dist/components/converters/ShowItemToNavigationItems.js +0 -10
- package/dist/components/form/DateTimePicker.svelte +0 -59
- package/dist/components/form/DateTimePicker.svelte.d.ts +0 -18
- package/dist/components/form/InputAddonItem.svelte +0 -42
- package/dist/components/form/InputAddonItem.svelte.d.ts +0 -31
- package/dist/components/form/InputTypes.d.ts +0 -9
- package/dist/components/form/InputTypes.js +0 -10
- package/dist/components/form/Select.svelte +0 -157
- package/dist/components/form/Select.svelte.d.ts +0 -34
- package/dist/components/form/Switch.svelte +0 -275
- package/dist/components/form/Switch.svelte.d.ts +0 -30
- package/dist/components/menu/Menu.svelte +0 -526
- package/dist/components/menu/Menu.svelte.d.ts +0 -33
- package/dist/components/menu/MenuItem.svelte +0 -121
- package/dist/components/menu/MenuItem.svelte.d.ts +0 -39
- package/dist/components/menu/NavigationItems.svelte +0 -44
- package/dist/components/menu/NavigationItems.svelte.d.ts +0 -32
- package/dist/components/menu/authentication.d.ts +0 -1
- package/dist/components/menu/authentication.js +0 -6
- package/dist/components/presentation/Carousel/carousel-content.svelte +0 -35
- package/dist/components/presentation/Carousel/carousel-content.svelte.d.ts +0 -28
- package/dist/components/presentation/Carousel/carousel-item.svelte +0 -25
- package/dist/components/presentation/Carousel/carousel-item.svelte.d.ts +0 -28
- package/dist/components/presentation/Carousel/carousel-next.svelte +0 -39
- package/dist/components/presentation/Carousel/carousel-next.svelte.d.ts +0 -18
- package/dist/components/presentation/Carousel/carousel-previous.svelte +0 -40
- package/dist/components/presentation/Carousel/carousel-previous.svelte.d.ts +0 -18
- package/dist/components/presentation/Carousel/carousel.svelte +0 -99
- package/dist/components/presentation/Carousel/carousel.svelte.d.ts +0 -31
- package/dist/components/presentation/Carousel/context.d.ts +0 -32
- package/dist/components/presentation/Carousel/context.js +0 -12
- package/dist/components/presentation/Carusele.js +0 -5
- /package/dist/components/{Markdown.svelte → content/Markdown.svelte} +0 -0
- /package/dist/components/{Markdown.svelte.d.ts → content/Markdown.svelte.d.ts} +0 -0
- /package/dist/components/{Banner.svelte.d.ts → layouts/Banner.svelte.d.ts} +0 -0
- /package/dist/components/{agnostic/Close/api.js → presentation/Carousel.js} +0 -0
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { type HeaderNavigationItem, isSelected, defaultCss } from './Menu.js';
|
|
3
|
-
import { Orientation } from '../Styling.js';
|
|
4
|
-
import { page } from '$app/state';
|
|
5
|
-
import { mergedClasses } from '../CssHelper.js';
|
|
6
|
-
|
|
7
|
-
interface CssProps {
|
|
8
|
-
container: string[];
|
|
9
|
-
link: string[];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export let css: CssProps = defaultCss;
|
|
13
|
-
|
|
14
|
-
export let localPages: Array<HeaderNavigationItem> = [];
|
|
15
|
-
|
|
16
|
-
export let orientation: Orientation = Orientation.Column;
|
|
17
|
-
|
|
18
|
-
export let includeSubpagesForSelect: boolean = true;
|
|
19
|
-
|
|
20
|
-
const cssClasses: CssProps = { ...defaultCss, ...css };
|
|
21
|
-
const containerCss = mergedClasses('flex', orientation,...cssClasses.container);
|
|
22
|
-
const linkCss = mergedClasses(...cssClasses.link);
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
<ul class={containerCss} role="menu" aria-label="menu">
|
|
26
|
-
{#each localPages as pageItem}
|
|
27
|
-
<li
|
|
28
|
-
data-selected={isSelected(includeSubpagesForSelect, page, pageItem)}
|
|
29
|
-
class={linkCss}
|
|
30
|
-
role="none"
|
|
31
|
-
>
|
|
32
|
-
<span class="screenreader-only">Navigate to {pageItem.name}</span>
|
|
33
|
-
<a href={pageItem.path} role="menuitem">
|
|
34
|
-
{pageItem.name}
|
|
35
|
-
</a>
|
|
36
|
-
{#if pageItem?.subItems?.length > 0}
|
|
37
|
-
<slot name="subItems" subpages={pageItem.subItems} />
|
|
38
|
-
{/if}
|
|
39
|
-
</li>
|
|
40
|
-
{/each}
|
|
41
|
-
</ul>
|
|
42
|
-
|
|
43
|
-
<style>
|
|
44
|
-
</style>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { type HeaderNavigationItem } from './Menu.js';
|
|
2
|
-
import { Orientation } from '../Styling.js';
|
|
3
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
4
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
5
|
-
$$bindings?: Bindings;
|
|
6
|
-
} & Exports;
|
|
7
|
-
(internal: unknown, props: Props & {
|
|
8
|
-
$$events?: Events;
|
|
9
|
-
$$slots?: Slots;
|
|
10
|
-
}): Exports & {
|
|
11
|
-
$set?: any;
|
|
12
|
-
$on?: any;
|
|
13
|
-
};
|
|
14
|
-
z_$$bindings?: Bindings;
|
|
15
|
-
}
|
|
16
|
-
declare const NavigationItems: $$__sveltets_2_IsomorphicComponent<{
|
|
17
|
-
css?: {
|
|
18
|
-
container: string[];
|
|
19
|
-
link: string[];
|
|
20
|
-
};
|
|
21
|
-
localPages?: Array<HeaderNavigationItem>;
|
|
22
|
-
orientation?: Orientation;
|
|
23
|
-
includeSubpagesForSelect?: boolean;
|
|
24
|
-
}, {
|
|
25
|
-
[evt: string]: CustomEvent<any>;
|
|
26
|
-
}, {
|
|
27
|
-
subItems: {
|
|
28
|
-
subpages: HeaderNavigationItem[] | undefined;
|
|
29
|
-
};
|
|
30
|
-
}, {}, string>;
|
|
31
|
-
type NavigationItems = InstanceType<typeof NavigationItems>;
|
|
32
|
-
export default NavigationItems;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isAuthenticated(page: any): any;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Visiblity } from '@functionalcms/svelte-components';
|
|
2
|
-
export function isAuthenticated(page) {
|
|
3
|
-
const isAuthenticated = page?.data?.session != null;
|
|
4
|
-
const visibility = isAuthenticated ? Visiblity.Authenticated : Visiblity.NotAuthenticated;
|
|
5
|
-
return visibility;
|
|
6
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
-
import emblaCarouselSvelte from "embla-carousel-svelte";
|
|
4
|
-
import { getEmblaContext } from "./context.js";
|
|
5
|
-
import { cn } from "../../../utils.js";
|
|
6
|
-
|
|
7
|
-
type $$Props = HTMLAttributes<HTMLDivElement>;
|
|
8
|
-
|
|
9
|
-
let className: string | undefined | null = undefined;
|
|
10
|
-
export { className as class };
|
|
11
|
-
|
|
12
|
-
const { orientation, options, plugins, onInit } = getEmblaContext("<Carousel.Content/>");
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<div
|
|
16
|
-
class="overflow-hidden"
|
|
17
|
-
use:emblaCarouselSvelte={{
|
|
18
|
-
options: {
|
|
19
|
-
container: "[data-embla-container]",
|
|
20
|
-
slides: "[data-embla-slide]",
|
|
21
|
-
...$options,
|
|
22
|
-
axis: $orientation === "horizontal" ? "x" : "y",
|
|
23
|
-
},
|
|
24
|
-
plugins: $plugins,
|
|
25
|
-
}}
|
|
26
|
-
on:emblaInit={onInit}
|
|
27
|
-
>
|
|
28
|
-
<div
|
|
29
|
-
class={cn("flex", $orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className)}
|
|
30
|
-
data-embla-container=""
|
|
31
|
-
{...$$restProps}
|
|
32
|
-
>
|
|
33
|
-
<slot />
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: Props & {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
16
|
-
default: any;
|
|
17
|
-
} ? Props extends Record<string, never> ? any : {
|
|
18
|
-
children?: any;
|
|
19
|
-
} : {});
|
|
20
|
-
declare const CarouselContent: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<HTMLAttributes<HTMLDivElement>, {
|
|
21
|
-
default: {};
|
|
22
|
-
}>, {
|
|
23
|
-
[evt: string]: CustomEvent<any>;
|
|
24
|
-
}, {
|
|
25
|
-
default: {};
|
|
26
|
-
}, {}, string>;
|
|
27
|
-
type CarouselContent = InstanceType<typeof CarouselContent>;
|
|
28
|
-
export default CarouselContent;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
-
import { getEmblaContext } from "./context.js";
|
|
4
|
-
import { cn } from "../../../utils.js";
|
|
5
|
-
|
|
6
|
-
type $$Props = HTMLAttributes<HTMLDivElement>;
|
|
7
|
-
let className: string | undefined | null = undefined;
|
|
8
|
-
export { className as class };
|
|
9
|
-
|
|
10
|
-
const { orientation } = getEmblaContext("<Carousel.Item/>");
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<div
|
|
14
|
-
role="group"
|
|
15
|
-
aria-roledescription="slide"
|
|
16
|
-
class={cn(
|
|
17
|
-
"min-w-0 shrink-0 grow-0 basis-full",
|
|
18
|
-
$orientation === "horizontal" ? "pl-4" : "pt-4",
|
|
19
|
-
className
|
|
20
|
-
)}
|
|
21
|
-
data-embla-slide=""
|
|
22
|
-
{...$$restProps}
|
|
23
|
-
>
|
|
24
|
-
<slot />
|
|
25
|
-
</div>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: Props & {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
16
|
-
default: any;
|
|
17
|
-
} ? Props extends Record<string, never> ? any : {
|
|
18
|
-
children?: any;
|
|
19
|
-
} : {});
|
|
20
|
-
declare const CarouselItem: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<HTMLAttributes<HTMLDivElement>, {
|
|
21
|
-
default: {};
|
|
22
|
-
}>, {
|
|
23
|
-
[evt: string]: CustomEvent<any>;
|
|
24
|
-
}, {
|
|
25
|
-
default: {};
|
|
26
|
-
}, {}, string>;
|
|
27
|
-
type CarouselItem = InstanceType<typeof CarouselItem>;
|
|
28
|
-
export default CarouselItem;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import ArrowRight from "lucide-svelte/icons/arrow-right";
|
|
3
|
-
import type { VariantProps } from "tailwind-variants";
|
|
4
|
-
import { getEmblaContext } from "./context.js";
|
|
5
|
-
import { cn } from "../../../utils.js";
|
|
6
|
-
import {
|
|
7
|
-
Button,
|
|
8
|
-
type Props,
|
|
9
|
-
type buttonVariants,
|
|
10
|
-
} from "../../../registry/default/ui/button/index.js";
|
|
11
|
-
|
|
12
|
-
type $$Props = Props;
|
|
13
|
-
|
|
14
|
-
let className: $$Props["class"] = undefined;
|
|
15
|
-
export { className as class };
|
|
16
|
-
export let variant: VariantProps<typeof buttonVariants>["variant"] = "outline";
|
|
17
|
-
export let size: VariantProps<typeof buttonVariants>["size"] = "icon";
|
|
18
|
-
const { orientation, canScrollNext, scrollNext, handleKeyDown } =
|
|
19
|
-
getEmblaContext("<Carousel.Next/>");
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<Button
|
|
23
|
-
{variant}
|
|
24
|
-
{size}
|
|
25
|
-
class={cn(
|
|
26
|
-
"absolute h-8 w-8 touch-manipulation rounded-full",
|
|
27
|
-
$orientation === "horizontal"
|
|
28
|
-
? "-right-12 top-1/2 -translate-y-1/2"
|
|
29
|
-
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
30
|
-
className
|
|
31
|
-
)}
|
|
32
|
-
disabled={!$canScrollNext}
|
|
33
|
-
on:click={scrollNext}
|
|
34
|
-
on:keydown={handleKeyDown}
|
|
35
|
-
{...$$restProps}
|
|
36
|
-
>
|
|
37
|
-
<ArrowRight class="h-4 w-4" />
|
|
38
|
-
<span class="sr-only">Next slide</span>
|
|
39
|
-
</Button>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const CarouselNext: $$__sveltets_2_IsomorphicComponent<Props, {
|
|
15
|
-
[evt: string]: CustomEvent<any>;
|
|
16
|
-
}, {}, {}, string>;
|
|
17
|
-
type CarouselNext = InstanceType<typeof CarouselNext>;
|
|
18
|
-
export default CarouselNext;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import ArrowLeft from "lucide-svelte/icons/arrow-left";
|
|
3
|
-
import type { VariantProps } from "tailwind-variants";
|
|
4
|
-
import { getEmblaContext } from "./context.js";
|
|
5
|
-
import { cn } from "../../../utils.js";
|
|
6
|
-
import {
|
|
7
|
-
Button,
|
|
8
|
-
type Props,
|
|
9
|
-
type buttonVariants,
|
|
10
|
-
} from "../../../registry/default/ui/button/index.js";
|
|
11
|
-
|
|
12
|
-
type $$Props = Props;
|
|
13
|
-
|
|
14
|
-
let className: $$Props["class"] = undefined;
|
|
15
|
-
export { className as class };
|
|
16
|
-
export let variant: VariantProps<typeof buttonVariants>["variant"] = "outline";
|
|
17
|
-
export let size: VariantProps<typeof buttonVariants>["size"] = "icon";
|
|
18
|
-
|
|
19
|
-
const { orientation, canScrollPrev, scrollPrev, handleKeyDown } =
|
|
20
|
-
getEmblaContext("<Carousel.Previous/>");
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<Button
|
|
24
|
-
{variant}
|
|
25
|
-
{size}
|
|
26
|
-
class={cn(
|
|
27
|
-
"absolute h-8 w-8 touch-manipulation rounded-full",
|
|
28
|
-
$orientation === "horizontal"
|
|
29
|
-
? "-left-12 top-1/2 -translate-y-1/2"
|
|
30
|
-
: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
31
|
-
className
|
|
32
|
-
)}
|
|
33
|
-
disabled={!$canScrollPrev}
|
|
34
|
-
on:click={scrollPrev}
|
|
35
|
-
on:keydown={handleKeyDown}
|
|
36
|
-
{...$$restProps}
|
|
37
|
-
>
|
|
38
|
-
<ArrowLeft class="h-4 w-4" />
|
|
39
|
-
<span class="sr-only">Previous slide</span>
|
|
40
|
-
</Button>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const CarouselPrevious: $$__sveltets_2_IsomorphicComponent<Props, {
|
|
15
|
-
[evt: string]: CustomEvent<any>;
|
|
16
|
-
}, {}, {}, string>;
|
|
17
|
-
type CarouselPrevious = InstanceType<typeof CarouselPrevious>;
|
|
18
|
-
export default CarouselPrevious;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { writable } from "svelte/store";
|
|
3
|
-
import { onDestroy } from "svelte";
|
|
4
|
-
import { type CarouselAPI, type CarouselProps, setEmblaContext } from "./context.js";
|
|
5
|
-
import { mergedClasses } from "../../CssHelper.js";
|
|
6
|
-
|
|
7
|
-
type $$Props = CarouselProps;
|
|
8
|
-
|
|
9
|
-
export let opts = {};
|
|
10
|
-
export let plugins: NonNullable<$$Props["plugins"]> = [];
|
|
11
|
-
export let api: $$Props["api"] = undefined;
|
|
12
|
-
export let orientation: NonNullable<$$Props["orientation"]> = "horizontal";
|
|
13
|
-
|
|
14
|
-
let className: $$Props["class"] = undefined;
|
|
15
|
-
export { className as class };
|
|
16
|
-
|
|
17
|
-
const apiStore = writable<CarouselAPI | undefined>(undefined);
|
|
18
|
-
const orientationStore = writable(orientation);
|
|
19
|
-
const canScrollPrev = writable(false);
|
|
20
|
-
const canScrollNext = writable(false);
|
|
21
|
-
const optionsStore = writable(opts);
|
|
22
|
-
const pluginStore = writable(plugins);
|
|
23
|
-
const scrollSnapsStore = writable<number[]>([]);
|
|
24
|
-
const selectedIndexStore = writable(0);
|
|
25
|
-
|
|
26
|
-
$: orientationStore.set(orientation);
|
|
27
|
-
$: pluginStore.set(plugins);
|
|
28
|
-
$: optionsStore.set(opts);
|
|
29
|
-
|
|
30
|
-
function scrollPrev() {
|
|
31
|
-
api?.scrollPrev();
|
|
32
|
-
}
|
|
33
|
-
function scrollNext() {
|
|
34
|
-
api?.scrollNext();
|
|
35
|
-
}
|
|
36
|
-
function scrollTo(index: number, jump?: boolean) {
|
|
37
|
-
api?.scrollTo(index, jump);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function onSelect(api: CarouselAPI) {
|
|
41
|
-
if (!api) return;
|
|
42
|
-
canScrollPrev.set(api.canScrollPrev());
|
|
43
|
-
canScrollNext.set(api.canScrollNext());
|
|
44
|
-
selectedIndexStore.set(api.selectedScrollSnap());
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
$: if (api) {
|
|
48
|
-
onSelect(api);
|
|
49
|
-
api.on("select", onSelect);
|
|
50
|
-
api.on("reInit", onSelect);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function handleKeyDown(e: KeyboardEvent) {
|
|
54
|
-
if (e.key === "ArrowLeft") {
|
|
55
|
-
e.preventDefault();
|
|
56
|
-
scrollPrev();
|
|
57
|
-
} else if (e.key === "ArrowRight") {
|
|
58
|
-
e.preventDefault();
|
|
59
|
-
scrollNext();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
setEmblaContext({
|
|
64
|
-
api: apiStore,
|
|
65
|
-
scrollPrev,
|
|
66
|
-
scrollNext,
|
|
67
|
-
orientation: orientationStore,
|
|
68
|
-
canScrollNext,
|
|
69
|
-
canScrollPrev,
|
|
70
|
-
handleKeyDown,
|
|
71
|
-
options: optionsStore,
|
|
72
|
-
plugins: pluginStore,
|
|
73
|
-
onInit,
|
|
74
|
-
scrollSnaps: scrollSnapsStore,
|
|
75
|
-
selectedIndex: selectedIndexStore,
|
|
76
|
-
scrollTo,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
function onInit(event: CustomEvent<CarouselAPI>) {
|
|
80
|
-
api = event.detail;
|
|
81
|
-
apiStore.set(api);
|
|
82
|
-
scrollSnapsStore.set(api.scrollSnapList());
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
onDestroy(() => {
|
|
86
|
-
api?.off("select", onSelect);
|
|
87
|
-
});
|
|
88
|
-
</script>
|
|
89
|
-
|
|
90
|
-
<div
|
|
91
|
-
class={mergedClasses("relative", className)}
|
|
92
|
-
on:mouseenter
|
|
93
|
-
on:mouseleave
|
|
94
|
-
role="region"
|
|
95
|
-
aria-roledescription="carousel"
|
|
96
|
-
{...$$restProps}
|
|
97
|
-
>
|
|
98
|
-
<slot />
|
|
99
|
-
</div>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { type CarouselProps } from "./context.js";
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: Props & {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
16
|
-
default: any;
|
|
17
|
-
} ? Props extends Record<string, never> ? any : {
|
|
18
|
-
children?: any;
|
|
19
|
-
} : {});
|
|
20
|
-
declare const Carousel: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<CarouselProps, {
|
|
21
|
-
default: {};
|
|
22
|
-
}>, {
|
|
23
|
-
mouseenter: MouseEvent;
|
|
24
|
-
mouseleave: MouseEvent;
|
|
25
|
-
} & {
|
|
26
|
-
[evt: string]: CustomEvent<any>;
|
|
27
|
-
}, {
|
|
28
|
-
default: {};
|
|
29
|
-
}, {}, string>;
|
|
30
|
-
type Carousel = InstanceType<typeof Carousel>;
|
|
31
|
-
export default Carousel;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { EmblaCarouselSvelteType } from "embla-carousel-svelte";
|
|
2
|
-
import type emblaCarouselSvelte from "embla-carousel-svelte";
|
|
3
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
-
import type { Readable, Writable } from "svelte/store";
|
|
5
|
-
export type CarouselAPI = NonNullable<NonNullable<EmblaCarouselSvelteType["$$_attributes"]>["on:emblaInit"]> extends (evt: CustomEvent<infer CarouselAPI>) => void ? CarouselAPI : never;
|
|
6
|
-
type EmblaCarouselConfig = NonNullable<Parameters<typeof emblaCarouselSvelte>[1]>;
|
|
7
|
-
export type CarouselOptions = EmblaCarouselConfig["options"];
|
|
8
|
-
export type CarouselPlugins = EmblaCarouselConfig["plugins"];
|
|
9
|
-
export type CarouselProps = {
|
|
10
|
-
opts?: CarouselOptions;
|
|
11
|
-
plugins?: CarouselPlugins;
|
|
12
|
-
api?: CarouselAPI;
|
|
13
|
-
orientation?: "horizontal" | "vertical";
|
|
14
|
-
} & HTMLAttributes<HTMLDivElement>;
|
|
15
|
-
type EmblaContext = {
|
|
16
|
-
api: Writable<CarouselAPI | undefined>;
|
|
17
|
-
orientation: Writable<"horizontal" | "vertical">;
|
|
18
|
-
scrollNext: () => void;
|
|
19
|
-
scrollPrev: () => void;
|
|
20
|
-
canScrollNext: Readable<boolean>;
|
|
21
|
-
canScrollPrev: Readable<boolean>;
|
|
22
|
-
handleKeyDown: (e: KeyboardEvent) => void;
|
|
23
|
-
options: Writable<CarouselOptions>;
|
|
24
|
-
plugins: Writable<CarouselPlugins>;
|
|
25
|
-
onInit: (e: CustomEvent<CarouselAPI>) => void;
|
|
26
|
-
scrollTo: (index: number, jump?: boolean) => void;
|
|
27
|
-
scrollSnaps: Readable<number[]>;
|
|
28
|
-
selectedIndex: Readable<number>;
|
|
29
|
-
};
|
|
30
|
-
export declare function setEmblaContext(config: EmblaContext): EmblaContext;
|
|
31
|
-
export declare function getEmblaContext(name?: string): EmblaContext;
|
|
32
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { getContext, hasContext, setContext } from "svelte";
|
|
2
|
-
const EMBLA_CAROUSEL_CONTEXT = Symbol("EMBLA_CAROUSEL_CONTEXT");
|
|
3
|
-
export function setEmblaContext(config) {
|
|
4
|
-
setContext(EMBLA_CAROUSEL_CONTEXT, config);
|
|
5
|
-
return config;
|
|
6
|
-
}
|
|
7
|
-
export function getEmblaContext(name = "This component") {
|
|
8
|
-
if (!hasContext(EMBLA_CAROUSEL_CONTEXT)) {
|
|
9
|
-
throw new Error(`${name} must be used within a <Carousel.Root> component`);
|
|
10
|
-
}
|
|
11
|
-
return getContext(EMBLA_CAROUSEL_CONTEXT);
|
|
12
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|