@skeletonlabs/skeleton 1.7.1 → 1.8.0-dev.a448a023
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/InputChip/InputChip.svelte +4 -4
- package/dist/components/Ratings/Ratings.svelte +31 -0
- package/dist/components/Ratings/Ratings.svelte.d.ts +34 -0
- package/dist/components/Tab/Tab.svelte +2 -1
- package/dist/components/Tab/Tab.svelte.d.ts +2 -0
- package/dist/components/Tab/TabAnchor.svelte +44 -0
- package/dist/components/Tab/TabAnchor.svelte.d.ts +44 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/styles/partials/typography-prose.css +3 -3
- package/dist/tailwind/generated/intellisense-classes.cjs +1 -1
- package/dist/tailwind/generated/intellisense-classes.d.cts +2038 -237
- package/dist/utilities/Drawer/Drawer.svelte +4 -2
- package/dist/utilities/Toast/Toast.svelte +25 -5
- package/dist/utilities/Toast/stores.d.ts +6 -2
- package/dist/utilities/Toast/stores.js +32 -14
- package/dist/utilities/Toast/types.d.ts +4 -0
- package/package.json +19 -22
|
@@ -7,7 +7,7 @@ import { drawerStore } from "./stores.js";
|
|
|
7
7
|
export let position = "left";
|
|
8
8
|
export let duration = 150;
|
|
9
9
|
export let bgBackdrop = "bg-surface-backdrop-token";
|
|
10
|
-
export let blur = "
|
|
10
|
+
export let blur = "";
|
|
11
11
|
export let padding = "";
|
|
12
12
|
export let bgDrawer = "bg-surface-100-800-token";
|
|
13
13
|
export let border = "";
|
|
@@ -136,6 +136,7 @@ $:
|
|
|
136
136
|
use:focusTrap={true}
|
|
137
137
|
>
|
|
138
138
|
<!-- Drawer -->
|
|
139
|
+
<!-- separate In/Out so anim values update -->
|
|
139
140
|
<div
|
|
140
141
|
bind:this={elemDrawer}
|
|
141
142
|
class="drawer {classesDrawer}"
|
|
@@ -144,7 +145,8 @@ $:
|
|
|
144
145
|
aria-modal="true"
|
|
145
146
|
aria-labelledby={labelledby}
|
|
146
147
|
aria-describedby={describedby}
|
|
147
|
-
|
|
148
|
+
in:fly|local={{ x: anim.x, y: anim.y, duration }}
|
|
149
|
+
out:fly|local={{ x: anim.x, y: anim.y, duration }}
|
|
148
150
|
>
|
|
149
151
|
<!-- Slot: Default -->
|
|
150
152
|
<slot />
|
|
@@ -69,6 +69,18 @@ function onAction(index) {
|
|
|
69
69
|
$toastStore[index]?.action?.response();
|
|
70
70
|
toastStore.close($toastStore[index].id);
|
|
71
71
|
}
|
|
72
|
+
function onMouseEnter(index) {
|
|
73
|
+
if ($toastStore[index]?.hoverable) {
|
|
74
|
+
toastStore.freeze(index);
|
|
75
|
+
classesSnackbar += " scale-[105%]";
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function onMouseLeave(index) {
|
|
79
|
+
if ($toastStore[index]?.hoverable) {
|
|
80
|
+
toastStore.unfreeze(index);
|
|
81
|
+
classesSnackbar = classesSnackbar.replace(" scale-[105%]", "");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
72
84
|
$:
|
|
73
85
|
classesWrapper = `${cWrapper} ${cPosition} ${zIndex} ${$$props.class || ""}`;
|
|
74
86
|
$:
|
|
@@ -100,7 +112,13 @@ const [send, receive] = crossfade({
|
|
|
100
112
|
<!-- List -->
|
|
101
113
|
<div class="snackbar {classesSnackbar}">
|
|
102
114
|
{#each filteredToasts as t, i (t)}
|
|
103
|
-
<div
|
|
115
|
+
<div
|
|
116
|
+
animate:flip={{ duration }}
|
|
117
|
+
in:receive={{ key: t.id }}
|
|
118
|
+
out:send={{ key: t.id }}
|
|
119
|
+
on:mouseenter={() => onMouseEnter(i)}
|
|
120
|
+
on:mouseleave={() => onMouseLeave(i)}
|
|
121
|
+
>
|
|
104
122
|
<!-- Toast -->
|
|
105
123
|
<div
|
|
106
124
|
class="toast {classesToast} {t.background ?? background} {t.classes ?? ''}"
|
|
@@ -109,10 +127,12 @@ const [send, receive] = crossfade({
|
|
|
109
127
|
data-testid="toast"
|
|
110
128
|
>
|
|
111
129
|
<div class="text-base">{@html t.message}</div>
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
130
|
+
{#if t.action || !t.hideDismiss}
|
|
131
|
+
<div class="toast-actions {cToastActions}">
|
|
132
|
+
{#if t.action}<button class={buttonAction} on:click={() => onAction(i)}>{@html t.action.label}</button>{/if}
|
|
133
|
+
{#if !t.hideDismiss}<button class={buttonDismiss} on:click={() => toastStore.close(t.id)}>{buttonDismissLabel}</button>{/if}
|
|
134
|
+
</div>
|
|
135
|
+
{/if}
|
|
116
136
|
</div>
|
|
117
137
|
</div>
|
|
118
138
|
{/each}
|
|
@@ -2,9 +2,13 @@ import type { ToastSettings, Toast } from './types.js';
|
|
|
2
2
|
export declare const toastStore: {
|
|
3
3
|
subscribe: (this: void, run: import("svelte/store").Subscriber<Toast[]>, invalidate?: ((value?: Toast[] | undefined) => void) | undefined) => import("svelte/store").Unsubscriber;
|
|
4
4
|
/** Add a new toast to the queue. */
|
|
5
|
-
trigger: (toast: ToastSettings) =>
|
|
6
|
-
/** Remove
|
|
5
|
+
trigger: (toast: ToastSettings) => string;
|
|
6
|
+
/** Remove toast in queue*/
|
|
7
7
|
close: (id: string) => void;
|
|
8
|
+
/** remain visible on hover */
|
|
9
|
+
freeze: (index: number) => void;
|
|
10
|
+
/** cancel remain visible on leave */
|
|
11
|
+
unfreeze: (index: number) => void;
|
|
8
12
|
/** Remove all toasts from queue */
|
|
9
13
|
clear: () => void;
|
|
10
14
|
};
|
|
@@ -19,21 +19,27 @@ function toastService() {
|
|
|
19
19
|
return {
|
|
20
20
|
subscribe,
|
|
21
21
|
/** Add a new toast to the queue. */
|
|
22
|
-
trigger: (toast) =>
|
|
22
|
+
trigger: (toast) => {
|
|
23
23
|
const id = randomUUID();
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
toast.callback
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
update((tStore) => {
|
|
25
|
+
// Trigger Callback
|
|
26
|
+
if (toast && toast.callback)
|
|
27
|
+
toast.callback({ id, status: 'queued' });
|
|
28
|
+
// activate autohide when dismiss button is hidden.
|
|
29
|
+
if (toast.hideDismiss)
|
|
30
|
+
toast.autohide = true;
|
|
31
|
+
// Merge with defaults
|
|
32
|
+
const tMerged = { ...toastDefaults, ...toast, id };
|
|
33
|
+
// Handle auto-hide, if needed
|
|
34
|
+
tMerged.timeoutId = handleAutoHide(tMerged);
|
|
35
|
+
// Push into store
|
|
36
|
+
tStore.push(tMerged);
|
|
37
|
+
// Return
|
|
38
|
+
return tStore;
|
|
39
|
+
});
|
|
40
|
+
return id;
|
|
41
|
+
},
|
|
42
|
+
/** Remove toast in queue*/
|
|
37
43
|
close: (id) => update((tStore) => {
|
|
38
44
|
if (tStore.length > 0) {
|
|
39
45
|
const index = tStore.findIndex((t) => t.id === id);
|
|
@@ -51,6 +57,18 @@ function toastService() {
|
|
|
51
57
|
}
|
|
52
58
|
return tStore;
|
|
53
59
|
}),
|
|
60
|
+
/** remain visible on hover */
|
|
61
|
+
freeze: (index) => update((tStore) => {
|
|
62
|
+
if (tStore.length > 0)
|
|
63
|
+
clearTimeout(tStore[index].timeoutId);
|
|
64
|
+
return tStore;
|
|
65
|
+
}),
|
|
66
|
+
/** cancel remain visible on leave */
|
|
67
|
+
unfreeze: (index) => update((tStore) => {
|
|
68
|
+
if (tStore.length > 0)
|
|
69
|
+
tStore[index].timeoutId = handleAutoHide(tStore[index]);
|
|
70
|
+
return tStore;
|
|
71
|
+
}),
|
|
54
72
|
/** Remove all toasts from queue */
|
|
55
73
|
clear: () => set([])
|
|
56
74
|
};
|
|
@@ -14,6 +14,10 @@ export interface ToastSettings {
|
|
|
14
14
|
/** The function triggered when the button is pressed. */
|
|
15
15
|
response: () => void;
|
|
16
16
|
};
|
|
17
|
+
/** Hide dismiss button */
|
|
18
|
+
hideDismiss?: boolean;
|
|
19
|
+
/** Remain visible on Hover */
|
|
20
|
+
hoverable?: boolean;
|
|
17
21
|
/** Provide arbitrary CSS classes to style the toast. */
|
|
18
22
|
classes?: string;
|
|
19
23
|
/** Callback function that fires on trigger and close. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skeletonlabs/skeleton",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0-dev.a448a023",
|
|
4
4
|
"description": "A SvelteKit component library.",
|
|
5
5
|
"author": "endigo9740 <chris@skeletonlabs.dev>",
|
|
6
6
|
"repository": {
|
|
@@ -27,34 +27,31 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"homepage": "https://skeleton.dev/",
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@
|
|
31
|
-
"@sveltejs/
|
|
32
|
-
"@sveltejs/kit": "1.15.0",
|
|
30
|
+
"@sveltejs/adapter-auto": "2.1.0",
|
|
31
|
+
"@sveltejs/kit": "1.20.2",
|
|
33
32
|
"@sveltejs/package": "2.0.2",
|
|
34
|
-
"@
|
|
35
|
-
"@tailwindcss/typography": "0.5.9",
|
|
36
|
-
"@testing-library/dom": "9.2.0",
|
|
33
|
+
"@testing-library/dom": "9.3.0",
|
|
37
34
|
"@testing-library/svelte": "3.2.2",
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
39
|
-
"@typescript-eslint/parser": "5.
|
|
40
|
-
"@vitest/coverage-c8": "0.
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "5.59.9",
|
|
36
|
+
"@typescript-eslint/parser": "5.59.9",
|
|
37
|
+
"@vitest/coverage-c8": "0.32.0",
|
|
41
38
|
"autoprefixer": "10.4.14",
|
|
42
|
-
"eslint": "8.
|
|
39
|
+
"eslint": "8.42.0",
|
|
43
40
|
"eslint-config-prettier": "8.8.0",
|
|
44
|
-
"eslint-plugin-svelte": "^2.
|
|
41
|
+
"eslint-plugin-svelte": "^2.30.0",
|
|
45
42
|
"jsdom": "21.1.1",
|
|
46
|
-
"postcss": "8.4.
|
|
43
|
+
"postcss": "8.4.24",
|
|
47
44
|
"postcss-import": "15.1.0",
|
|
48
45
|
"postcss-js": "4.0.1",
|
|
49
46
|
"postcss-load-config": "4.0.1",
|
|
50
|
-
"prettier": "2.8.
|
|
51
|
-
"prettier-plugin-svelte": "2.10.
|
|
52
|
-
"svelte-check": "3.
|
|
53
|
-
"tailwindcss": "3.3.
|
|
54
|
-
"tslib": "2.5.
|
|
55
|
-
"typescript": "
|
|
56
|
-
"vite": "4.
|
|
57
|
-
"vitest": "0.
|
|
47
|
+
"prettier": "2.8.8",
|
|
48
|
+
"prettier-plugin-svelte": "2.10.1",
|
|
49
|
+
"svelte-check": "3.4.3",
|
|
50
|
+
"tailwindcss": "3.3.2",
|
|
51
|
+
"tslib": "2.5.3",
|
|
52
|
+
"typescript": "5.0.3",
|
|
53
|
+
"vite": "4.3.9",
|
|
54
|
+
"vitest": "0.32.0"
|
|
58
55
|
},
|
|
59
56
|
"type": "module",
|
|
60
57
|
"dependencies": {
|
|
@@ -97,7 +94,7 @@
|
|
|
97
94
|
"format": "prettier --ignore-path .prettierignore --write --plugin-search-dir=. .",
|
|
98
95
|
"test": "vitest",
|
|
99
96
|
"coverage": "vitest run --coverage",
|
|
100
|
-
"sync": "svelte-kit sync",
|
|
97
|
+
"sync": "svelte-kit sync && pnpm build:jss",
|
|
101
98
|
"build:jss": "node ./scripts/generate-jss.js --package"
|
|
102
99
|
},
|
|
103
100
|
"typesVersions": {
|