@hyvor/design 0.0.67 → 1.0.3
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/ActionList/ActionList.svelte +21 -13
- package/dist/components/ActionList/ActionList.svelte.d.ts +8 -20
- package/dist/components/ActionList/ActionListGroup.svelte +40 -35
- package/dist/components/ActionList/ActionListGroup.svelte.d.ts +8 -20
- package/dist/components/ActionList/ActionListItem.svelte +129 -107
- package/dist/components/ActionList/ActionListItem.svelte.d.ts +27 -25
- package/dist/components/ActionList/Selected.svelte +27 -24
- package/dist/components/ActionList/Selected.svelte.d.ts +6 -17
- package/dist/components/Avatar/Avatar.svelte +22 -19
- package/dist/components/Avatar/Avatar.svelte.d.ts +7 -18
- package/dist/components/Avatar/AvatarStack.svelte +29 -27
- package/dist/components/Avatar/AvatarStack.svelte.d.ts +6 -18
- package/dist/components/Base/Base.svelte +16 -8
- package/dist/components/Base/Base.svelte.d.ts +6 -18
- package/dist/components/Box/Box.svelte +16 -9
- package/dist/components/Box/Box.svelte.d.ts +7 -19
- package/dist/components/Button/Button.svelte +65 -47
- package/dist/components/Button/Button.svelte.d.ts +16 -39
- package/dist/components/Button/ButtonGroup.svelte +14 -6
- package/dist/components/Button/ButtonGroup.svelte.d.ts +5 -27
- package/dist/components/Callout/Callout.svelte +110 -87
- package/dist/components/Callout/Callout.svelte.d.ts +11 -22
- package/dist/components/Checkbox/Checkbox.svelte +156 -144
- package/dist/components/Checkbox/Checkbox.svelte.d.ts +11 -34
- package/dist/components/CodeBlock/CodeBlock.svelte +45 -32
- package/dist/components/CodeBlock/CodeBlock.svelte.d.ts +6 -17
- package/dist/components/CodeBlock/getCode.js +8 -6
- package/dist/components/CodeBlock/hljs.scss +189 -191
- package/dist/components/CodeBlock/prism.scss +370 -7
- package/dist/components/ColorPicker/ColorPicker.svelte +75 -56
- package/dist/components/ColorPicker/ColorPicker.svelte.d.ts +25 -19
- package/dist/components/Dark/DarkProvider.svelte +16 -14
- package/dist/components/Dark/DarkProvider.svelte.d.ts +16 -12
- package/dist/components/Dark/DarkToggle.svelte +15 -16
- package/dist/components/Dark/DarkToggle.svelte.d.ts +16 -12
- package/dist/components/Divider/Divider.svelte +23 -13
- package/dist/components/Divider/Divider.svelte.d.ts +9 -20
- package/dist/components/Dropdown/Dropdown.svelte +58 -114
- package/dist/components/Dropdown/Dropdown.svelte.d.ts +13 -24
- package/dist/components/Dropdown/DropdownContent.svelte +152 -0
- package/dist/components/Dropdown/DropdownContent.svelte.d.ts +12 -0
- package/dist/components/FormControl/Caption.svelte +18 -11
- package/dist/components/FormControl/Caption.svelte.d.ts +7 -19
- package/dist/components/FormControl/FormControl.svelte +28 -19
- package/dist/components/FormControl/FormControl.svelte.d.ts +6 -27
- package/dist/components/FormControl/InputGroup.svelte +22 -15
- package/dist/components/FormControl/InputGroup.svelte.d.ts +7 -19
- package/dist/components/FormControl/Label.svelte +15 -6
- package/dist/components/FormControl/Label.svelte.d.ts +6 -27
- package/dist/components/FormControl/Validation.svelte +30 -19
- package/dist/components/FormControl/Validation.svelte.d.ts +9 -21
- package/dist/components/HyvorBar/BarProducts.svelte +71 -0
- package/dist/components/HyvorBar/BarProducts.svelte.d.ts +32 -0
- package/dist/components/HyvorBar/BarSupport.svelte +183 -0
- package/dist/components/HyvorBar/BarSupport.svelte.d.ts +8 -0
- package/dist/components/HyvorBar/BarUpdates.svelte +68 -0
- package/dist/components/HyvorBar/BarUpdates.svelte.d.ts +7 -0
- package/dist/components/HyvorBar/BarUpdatesList.svelte +159 -0
- package/dist/components/HyvorBar/BarUpdatesList.svelte.d.ts +7 -0
- package/dist/components/HyvorBar/BarUser.svelte +72 -0
- package/dist/components/HyvorBar/BarUser.svelte.d.ts +5 -0
- package/dist/components/HyvorBar/BarUserPreview.svelte +43 -0
- package/dist/components/HyvorBar/BarUserPreview.svelte.d.ts +18 -0
- package/dist/components/HyvorBar/HyvorBar.svelte +183 -0
- package/dist/components/HyvorBar/HyvorBar.svelte.d.ts +8 -0
- package/dist/components/HyvorBar/bar.d.ts +33 -0
- package/dist/components/HyvorBar/bar.js +74 -0
- package/dist/components/HyvorBar/img/G2.svelte +9 -0
- package/dist/components/HyvorBar/img/G2.svelte.d.ts +26 -0
- package/dist/components/HyvorBar/img/Trustpilot.svelte +11 -0
- package/dist/components/HyvorBar/img/Trustpilot.svelte.d.ts +26 -0
- package/dist/components/IconButton/IconButton.svelte +49 -32
- package/dist/components/IconButton/IconButton.svelte.d.ts +10 -33
- package/dist/components/IconMessage/IconMessage.svelte +157 -51
- package/dist/components/IconMessage/IconMessage.svelte.d.ts +19 -27
- package/dist/components/Internationalization/InternationalizationProvider.svelte +15 -8
- package/dist/components/Internationalization/InternationalizationProvider.svelte.d.ts +7 -19
- package/dist/components/Internationalization/LanguageToggle.svelte +80 -57
- package/dist/components/Internationalization/LanguageToggle.svelte.d.ts +11 -22
- package/dist/components/Internationalization/T.svelte +158 -114
- package/dist/components/Internationalization/T.svelte.d.ts +17 -15
- package/dist/components/Internationalization/i18n.d.ts +3 -5
- package/dist/components/Internationalization/i18n.js +13 -11
- package/dist/components/Internationalization/t.d.ts +2 -3
- package/dist/components/Internationalization/t.js +4 -4
- package/dist/components/Internationalization/types.d.ts +2 -1
- package/dist/components/Link/Link.svelte +68 -61
- package/dist/components/Link/Link.svelte.d.ts +11 -34
- package/dist/components/Loader/LoadButton.svelte +39 -38
- package/dist/components/Loader/LoadButton.svelte.d.ts +29 -42
- package/dist/components/Loader/Loader.svelte +121 -107
- package/dist/components/Loader/Loader.svelte.d.ts +15 -27
- package/dist/components/Modal/ConfirmModalProvider.svelte +41 -51
- package/dist/components/Modal/ConfirmModalProvider.svelte.d.ts +3 -14
- package/dist/components/Modal/Modal.svelte +202 -203
- package/dist/components/Modal/Modal.svelte.d.ts +31 -29
- package/dist/components/Modal/ModalFooter.svelte +36 -31
- package/dist/components/Modal/ModalFooter.svelte.d.ts +22 -18
- package/dist/components/Modal/confirm.d.ts +2 -2
- package/dist/components/Modal/confirm.js +4 -4
- package/dist/components/Modal/modal-types.d.ts +4 -4
- package/dist/components/NavLink/NavLink.svelte +94 -89
- package/dist/components/NavLink/NavLink.svelte.d.ts +11 -33
- package/dist/components/Radio/Radio.svelte +46 -35
- package/dist/components/Radio/Radio.svelte.d.ts +10 -33
- package/dist/components/Slider/Slider.svelte +129 -120
- package/dist/components/Slider/Slider.svelte.d.ts +24 -20
- package/dist/components/SplitControl/SplitControl.svelte +43 -48
- package/dist/components/SplitControl/SplitControl.svelte.d.ts +11 -24
- package/dist/components/Switch/Switch.svelte +77 -67
- package/dist/components/Switch/Switch.svelte.d.ts +8 -31
- package/dist/components/TabNav/TabNav.svelte +33 -23
- package/dist/components/TabNav/TabNav.svelte.d.ts +7 -19
- package/dist/components/TabNav/TabNavItem.svelte +65 -51
- package/dist/components/TabNav/TabNavItem.svelte.d.ts +10 -24
- package/dist/components/Table/Table.svelte +17 -7
- package/dist/components/Table/Table.svelte.d.ts +7 -19
- package/dist/components/Table/TableRow.svelte +32 -24
- package/dist/components/Table/TableRow.svelte.d.ts +7 -19
- package/dist/components/Tag/Tag.svelte +75 -49
- package/dist/components/Tag/Tag.svelte.d.ts +16 -39
- package/dist/components/Text/Text.svelte +33 -26
- package/dist/components/Text/Text.svelte.d.ts +10 -22
- package/dist/components/TextInput/TextInput.svelte +54 -33
- package/dist/components/TextInput/TextInput.svelte.d.ts +12 -36
- package/dist/components/Textarea/Textarea.svelte +68 -46
- package/dist/components/Textarea/Textarea.svelte.d.ts +13 -37
- package/dist/components/Toast/ToastIcon.svelte +55 -46
- package/dist/components/Toast/ToastIcon.svelte.d.ts +5 -16
- package/dist/components/Toast/ToastMessage.svelte +42 -41
- package/dist/components/Toast/ToastMessage.svelte.d.ts +5 -16
- package/dist/components/Toast/ToastProvider.svelte +22 -20
- package/dist/components/Toast/ToastProvider.svelte.d.ts +16 -12
- package/dist/components/Toast/cleaner.js +5 -5
- package/dist/components/Toast/toast.d.ts +3 -3
- package/dist/components/Toast/toast.js +10 -10
- package/dist/components/Tooltip/Tooltip.svelte +163 -148
- package/dist/components/Tooltip/Tooltip.svelte.d.ts +35 -23
- package/dist/components/directives/clickOutside.js +4 -4
- package/dist/components/directives/debounce.d.ts +1 -0
- package/dist/components/directives/debounce.js +8 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/index.css +31 -33
- package/dist/marketing/Container/Container.svelte +15 -9
- package/dist/marketing/Container/Container.svelte.d.ts +6 -18
- package/dist/marketing/Docs/Content/Content.svelte +48 -35
- package/dist/marketing/Docs/Content/Content.svelte.d.ts +5 -16
- package/dist/marketing/Docs/Content/DocsImage.svelte +67 -69
- package/dist/marketing/Docs/Content/DocsImage.svelte.d.ts +9 -20
- package/dist/marketing/Docs/Docs.svelte +28 -25
- package/dist/marketing/Docs/Docs.svelte.d.ts +6 -29
- package/dist/marketing/Docs/Nav/Nav.svelte +96 -70
- package/dist/marketing/Docs/Nav/Nav.svelte.d.ts +5 -16
- package/dist/marketing/Docs/Nav/NavCategory.svelte +39 -29
- package/dist/marketing/Docs/Nav/NavCategory.svelte.d.ts +8 -20
- package/dist/marketing/Docs/Nav/NavItem.svelte +30 -26
- package/dist/marketing/Docs/Nav/NavItem.svelte.d.ts +6 -18
- package/dist/marketing/Docs/Sidebar/Sidebar.svelte +22 -25
- package/dist/marketing/Docs/Sidebar/Sidebar.svelte.d.ts +22 -19
- package/dist/marketing/Docs/Toc.svelte +64 -56
- package/dist/marketing/Docs/Toc.svelte.d.ts +3 -14
- package/dist/marketing/Document/Document.svelte +15 -8
- package/dist/marketing/Document/Document.svelte.d.ts +7 -19
- package/dist/marketing/Document/DocumentTitle.svelte +65 -54
- package/dist/marketing/Document/DocumentTitle.svelte.d.ts +9 -20
- package/dist/marketing/Footer/Footer.svelte +154 -145
- package/dist/marketing/Footer/Footer.svelte.d.ts +8 -20
- package/dist/marketing/Footer/FooterLinkList.svelte +31 -27
- package/dist/marketing/Footer/FooterLinkList.svelte.d.ts +6 -18
- package/dist/marketing/Header/Header.svelte +47 -37
- package/dist/marketing/Header/Header.svelte.d.ts +10 -22
- package/dist/marketing/Logo/LogoBlogs.svelte +46 -0
- package/dist/marketing/Logo/LogoBlogs.svelte.d.ts +5 -0
- package/dist/marketing/Logo/LogoCore.svelte +46 -0
- package/dist/marketing/Logo/LogoCore.svelte.d.ts +5 -0
- package/dist/marketing/Logo/LogoFortguard.svelte +54 -0
- package/dist/marketing/Logo/LogoFortguard.svelte.d.ts +5 -0
- package/dist/marketing/Logo/LogoTalk.svelte +32 -0
- package/dist/marketing/Logo/LogoTalk.svelte.d.ts +5 -0
- package/dist/stores/dark.d.ts +0 -1
- package/dist/stores/dark.js +8 -8
- package/dist/variables.scss +41 -48
- package/package.json +59 -58
|
@@ -1,37 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
keydown: KeyboardEvent;
|
|
15
|
-
keypress: KeyboardEvent;
|
|
16
|
-
focus: FocusEvent;
|
|
17
|
-
blur: FocusEvent;
|
|
18
|
-
click: MouseEvent;
|
|
19
|
-
mouseover: MouseEvent;
|
|
20
|
-
mouseenter: MouseEvent;
|
|
21
|
-
mouseleave: MouseEvent;
|
|
22
|
-
change: Event;
|
|
23
|
-
input: Event;
|
|
24
|
-
} & {
|
|
25
|
-
[evt: string]: CustomEvent<any>;
|
|
26
|
-
};
|
|
27
|
-
slots: {
|
|
28
|
-
start: {};
|
|
29
|
-
end: {};
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
export type TextareaProps = typeof __propDef.props;
|
|
33
|
-
export type TextareaEvents = typeof __propDef.events;
|
|
34
|
-
export type TextareaSlots = typeof __propDef.slots;
|
|
35
|
-
export default class Textarea extends SvelteComponent<TextareaProps, TextareaEvents, TextareaSlots> {
|
|
36
|
-
}
|
|
37
|
-
export {};
|
|
1
|
+
declare const Textarea: import("svelte").Component<{
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
value?: any;
|
|
4
|
+
block?: boolean;
|
|
5
|
+
rows?: number;
|
|
6
|
+
cols?: number;
|
|
7
|
+
state?: "default" | "success" | "warning" | "error";
|
|
8
|
+
textarea?: HTMLTextAreaElement;
|
|
9
|
+
start?: import("svelte").Snippet;
|
|
10
|
+
end?: import("svelte").Snippet;
|
|
11
|
+
}, {}, "value" | "textarea">;
|
|
12
|
+
type Textarea = ReturnType<typeof Textarea>;
|
|
13
|
+
export default Textarea;
|
|
@@ -1,52 +1,61 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Toast } from './toast.ts';
|
|
3
|
+
import Loader from '../Loader/Loader.svelte';
|
|
4
|
+
import {
|
|
5
|
+
IconCheckCircleFill,
|
|
6
|
+
IconXCircleFill,
|
|
7
|
+
IconExclamationCircleFill,
|
|
8
|
+
IconInfoCircleFill
|
|
9
|
+
} from '@hyvor/icons';
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
toast: Toast;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let { toast }: Props = $props();
|
|
16
|
+
|
|
17
|
+
let color = $derived(
|
|
18
|
+
(
|
|
19
|
+
{
|
|
20
|
+
success: 'var(--green)',
|
|
21
|
+
error: 'var(--red)',
|
|
22
|
+
warning: 'var(--orange)',
|
|
23
|
+
info: 'var(--blue)'
|
|
24
|
+
} as any
|
|
25
|
+
)[toast.type] || 'inherit'
|
|
26
|
+
);
|
|
16
27
|
</script>
|
|
17
28
|
|
|
18
|
-
<span
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<Loader size="small" />
|
|
31
|
-
{/if}
|
|
29
|
+
<span style:color>
|
|
30
|
+
{#if toast.type === 'success'}
|
|
31
|
+
<IconCheckCircleFill />
|
|
32
|
+
{:else if toast.type === 'error'}
|
|
33
|
+
<IconXCircleFill />
|
|
34
|
+
{:else if toast.type === 'warning'}
|
|
35
|
+
<IconExclamationCircleFill />
|
|
36
|
+
{:else if toast.type === 'info'}
|
|
37
|
+
<IconInfoCircleFill />
|
|
38
|
+
{:else if toast.type === 'loading'}
|
|
39
|
+
<Loader size="small" />
|
|
40
|
+
{/if}
|
|
32
41
|
</span>
|
|
33
42
|
|
|
34
43
|
<style>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
span {
|
|
45
|
+
display: inline-flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
animation: scale 0.2s ease-in-out;
|
|
49
|
+
}
|
|
41
50
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
</style>
|
|
51
|
+
@keyframes scale {
|
|
52
|
+
0% {
|
|
53
|
+
transform: scale(0.5);
|
|
54
|
+
opacity: 0.4;
|
|
55
|
+
}
|
|
56
|
+
100% {
|
|
57
|
+
transform: scale(1);
|
|
58
|
+
opacity: 1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
</style>
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { Toast } from './toast.ts';
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
[evt: string]: CustomEvent<any>;
|
|
9
|
-
};
|
|
10
|
-
slots: {};
|
|
11
|
-
};
|
|
12
|
-
export type ToastIconProps = typeof __propDef.props;
|
|
13
|
-
export type ToastIconEvents = typeof __propDef.events;
|
|
14
|
-
export type ToastIconSlots = typeof __propDef.slots;
|
|
15
|
-
export default class ToastIcon extends SvelteComponent<ToastIconProps, ToastIconEvents, ToastIconSlots> {
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
2
|
+
declare const ToastIcon: import("svelte").Component<{
|
|
3
|
+
toast: Toast;
|
|
4
|
+
}, {}, "">;
|
|
5
|
+
type ToastIcon = ReturnType<typeof ToastIcon>;
|
|
6
|
+
export default ToastIcon;
|
|
@@ -1,48 +1,49 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import ToastIcon from './ToastIcon.svelte';
|
|
3
|
+
import type { Toast } from './toast.ts';
|
|
4
|
+
import { fade } from 'svelte/transition';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
in:fade={{duration: 50}}
|
|
10
|
-
>
|
|
6
|
+
interface Props {
|
|
7
|
+
toast: Toast;
|
|
8
|
+
}
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<ToastIcon {toast} />
|
|
15
|
-
</div>
|
|
16
|
-
{/if}
|
|
10
|
+
let { toast }: Props = $props();
|
|
11
|
+
</script>
|
|
17
12
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
</div>
|
|
13
|
+
<div class="toast" out:fade={{ duration: 200 }} in:fade={{ duration: 50 }}>
|
|
14
|
+
{#if toast.type !== 'blank'}
|
|
15
|
+
<div class="icon-wrap">
|
|
16
|
+
<ToastIcon {toast} />
|
|
17
|
+
</div>
|
|
18
|
+
{/if}
|
|
25
19
|
|
|
20
|
+
<div class="message-wrap">
|
|
21
|
+
{#if typeof toast.message === 'string' || toast.message === null}
|
|
22
|
+
{@html toast.message}
|
|
23
|
+
{:else}
|
|
24
|
+
<toast.message {toast} />
|
|
25
|
+
{/if}
|
|
26
|
+
</div>
|
|
26
27
|
</div>
|
|
27
28
|
|
|
28
29
|
<style>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
</style>
|
|
30
|
+
.toast {
|
|
31
|
+
margin-bottom: 10px;
|
|
32
|
+
box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.1);
|
|
33
|
+
border-radius: var(--box-radius);
|
|
34
|
+
background-color: var(--box-background);
|
|
35
|
+
padding: 8px 20px;
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
max-width: 350px;
|
|
39
|
+
pointer-events: initial;
|
|
40
|
+
}
|
|
41
|
+
.toast:first-child {
|
|
42
|
+
margin-top: 10px;
|
|
43
|
+
}
|
|
44
|
+
.icon-wrap {
|
|
45
|
+
margin-right: 8px;
|
|
46
|
+
display: inline-flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
}
|
|
49
|
+
</style>
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { Toast } from './toast.ts';
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
[evt: string]: CustomEvent<any>;
|
|
9
|
-
};
|
|
10
|
-
slots: {};
|
|
11
|
-
};
|
|
12
|
-
export type ToastMessageProps = typeof __propDef.props;
|
|
13
|
-
export type ToastMessageEvents = typeof __propDef.events;
|
|
14
|
-
export type ToastMessageSlots = typeof __propDef.slots;
|
|
15
|
-
export default class ToastMessage extends SvelteComponent<ToastMessageProps, ToastMessageEvents, ToastMessageSlots> {
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
2
|
+
declare const ToastMessage: import("svelte").Component<{
|
|
3
|
+
toast: Toast;
|
|
4
|
+
}, {}, "">;
|
|
5
|
+
type ToastMessage = ReturnType<typeof ToastMessage>;
|
|
6
|
+
export default ToastMessage;
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
useCleaner
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import ToastMessage from './ToastMessage.svelte';
|
|
3
|
+
import { toastStore } from './toast.js';
|
|
4
|
+
import { useCleaner } from './cleaner.js';
|
|
5
|
+
|
|
6
|
+
useCleaner();
|
|
5
7
|
</script>
|
|
6
8
|
|
|
7
9
|
<div id="toasts-wrap">
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
{#each $toastStore as toast (toast.id)}
|
|
11
|
+
<ToastMessage {toast} />
|
|
12
|
+
{/each}
|
|
11
13
|
</div>
|
|
12
14
|
|
|
13
15
|
<style>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</style>
|
|
16
|
+
#toasts-wrap {
|
|
17
|
+
position: fixed;
|
|
18
|
+
top: 0;
|
|
19
|
+
left: 0;
|
|
20
|
+
width: 100%;
|
|
21
|
+
z-index: 20000000;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
pointer-events: none;
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
6
11
|
};
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
export type ToastProviderProps = typeof __propDef.props;
|
|
10
|
-
export type ToastProviderEvents = typeof __propDef.events;
|
|
11
|
-
export type ToastProviderSlots = typeof __propDef.slots;
|
|
12
|
-
export default class ToastProvider extends SvelteComponent<ToastProviderProps, ToastProviderEvents, ToastProviderSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
declare const ToastProvider: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type ToastProvider = InstanceType<typeof ToastProvider>;
|
|
18
|
+
export default ToastProvider;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { onDestroy } from
|
|
2
|
-
import { default as toastService, toastStore } from
|
|
1
|
+
import { onDestroy } from 'svelte';
|
|
2
|
+
import { default as toastService, toastStore } from './toast.js';
|
|
3
3
|
const DEFAULT_DURATIONS = {
|
|
4
4
|
success: 2000,
|
|
5
|
-
loading: Infinity
|
|
5
|
+
loading: Infinity
|
|
6
6
|
};
|
|
7
7
|
export function useCleaner() {
|
|
8
8
|
const timeouts = new Map();
|
|
9
|
-
const unsubscribe = toastStore.subscribe(toasts => {
|
|
10
|
-
toasts.forEach(toast => {
|
|
9
|
+
const unsubscribe = toastStore.subscribe((toasts) => {
|
|
10
|
+
toasts.forEach((toast) => {
|
|
11
11
|
if (timeouts.has(toast.id)) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Component } from 'svelte';
|
|
2
2
|
export interface Toast {
|
|
3
3
|
id: number;
|
|
4
4
|
type: ToastType;
|
|
@@ -6,8 +6,8 @@ export interface Toast {
|
|
|
6
6
|
duration?: number;
|
|
7
7
|
}
|
|
8
8
|
export declare const toastStore: import("svelte/store").Writable<Toast[]>;
|
|
9
|
-
export type ToastType =
|
|
10
|
-
export type ToastMessageType =
|
|
9
|
+
export type ToastType = 'success' | 'error' | 'warning' | 'info' | 'loading' | 'blank';
|
|
10
|
+
export type ToastMessageType = Component<any> | string | null;
|
|
11
11
|
declare function createHandler(type: ToastType): (message: ToastMessageType, options?: Partial<Toast>) => number;
|
|
12
12
|
type ToastFunctionSignature = ReturnType<typeof createHandler>;
|
|
13
13
|
interface ToastSignature {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { get, writable } from
|
|
1
|
+
import { get, writable } from 'svelte/store';
|
|
2
2
|
const MAX_TOASTS = 10;
|
|
3
3
|
export const toastStore = writable([]);
|
|
4
4
|
const storeHelper = {
|
|
@@ -6,10 +6,10 @@ const storeHelper = {
|
|
|
6
6
|
toastStore.update((toasts) => [toast, ...toasts].slice(0, MAX_TOASTS));
|
|
7
7
|
},
|
|
8
8
|
update: (toast) => {
|
|
9
|
-
toastStore.update((toasts) => toasts.map(t => t.id === toast.id ? { ...t, ...toast } : t));
|
|
9
|
+
toastStore.update((toasts) => toasts.map((t) => (t.id === toast.id ? { ...t, ...toast } : t)));
|
|
10
10
|
},
|
|
11
11
|
upsert: (toast) => {
|
|
12
|
-
if (get(toastStore).find(t => t.id === toast.id)) {
|
|
12
|
+
if (get(toastStore).find((t) => t.id === toast.id)) {
|
|
13
13
|
storeHelper.update(toast);
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
@@ -17,7 +17,7 @@ const storeHelper = {
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
remove: (id) => {
|
|
20
|
-
toastStore.update((toasts) => toasts.filter(t => t.id !== id));
|
|
20
|
+
toastStore.update((toasts) => toasts.filter((t) => t.id !== id));
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
let id = 0;
|
|
@@ -33,11 +33,11 @@ function createHandler(type) {
|
|
|
33
33
|
return newId;
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
const toast = createHandler(
|
|
37
|
-
toast.success = createHandler(
|
|
38
|
-
toast.error = createHandler(
|
|
39
|
-
toast.warning = createHandler(
|
|
40
|
-
toast.info = createHandler(
|
|
41
|
-
toast.loading = createHandler(
|
|
36
|
+
const toast = createHandler('blank');
|
|
37
|
+
toast.success = createHandler('success');
|
|
38
|
+
toast.error = createHandler('error');
|
|
39
|
+
toast.warning = createHandler('warning');
|
|
40
|
+
toast.info = createHandler('info');
|
|
41
|
+
toast.loading = createHandler('loading');
|
|
42
42
|
toast.close = (id) => storeHelper.remove(id);
|
|
43
43
|
export default toast;
|