flowbite-svelte 1.8.0 → 1.8.2
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.
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
let forward = $state(true);
|
|
21
|
+
let initialized = false;
|
|
21
22
|
|
|
22
23
|
subscribe((_state) => {
|
|
23
24
|
index = _state.index;
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
|
|
28
29
|
onMount(() => {
|
|
29
30
|
onchange?.(images[index]);
|
|
31
|
+
initialized = true;
|
|
30
32
|
});
|
|
31
33
|
|
|
32
34
|
const nextSlide = () => {
|
|
@@ -49,20 +51,17 @@
|
|
|
49
51
|
});
|
|
50
52
|
};
|
|
51
53
|
|
|
52
|
-
const loop = (node: HTMLElement
|
|
54
|
+
const loop = (node: HTMLElement) => {
|
|
53
55
|
// loop timer
|
|
54
56
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
55
57
|
let intervalId: any;
|
|
56
58
|
|
|
57
|
-
if (duration > 0)
|
|
59
|
+
if (duration > 0) {
|
|
60
|
+
intervalId = setInterval(nextSlide, duration);
|
|
61
|
+
if (initialized) forward ? nextSlide() : prevSlide();
|
|
62
|
+
}
|
|
58
63
|
|
|
59
|
-
return
|
|
60
|
-
update: (duration: number) => {
|
|
61
|
-
clearInterval(intervalId);
|
|
62
|
-
if (duration > 0) intervalId = setInterval(nextSlide, duration);
|
|
63
|
-
},
|
|
64
|
-
destroy: () => clearInterval(intervalId)
|
|
65
|
-
};
|
|
64
|
+
return () => clearInterval(intervalId);
|
|
66
65
|
};
|
|
67
66
|
|
|
68
67
|
type ActiveDragGesture = {
|
|
@@ -167,7 +166,7 @@
|
|
|
167
166
|
<!-- The move listeners go here, so things keep working if the touch strays out of the element. -->
|
|
168
167
|
<svelte:document onmousemove={onDragMove} onmouseup={onDragStop} ontouchmove={onDragMove} ontouchend={onDragStop} />
|
|
169
168
|
<div bind:this={carouselDiv} class={cn("relative", divClass)} onmousedown={onDragStart} ontouchstart={onDragStart} onmousemove={onDragMove} onmouseup={onDragStop} ontouchmove={onDragMove} ontouchend={onDragStop} role="button" aria-label={ariaLabel} tabindex="0">
|
|
170
|
-
<div {...restProps} class={cn(carousel(), activeDragGesture === undefined ? "transition-transform" : "", className)}
|
|
169
|
+
<div {...restProps} class={cn(carousel(), activeDragGesture === undefined ? "transition-transform" : "", className)} {@attach loop}>
|
|
171
170
|
{#if slide}
|
|
172
171
|
{@render slide({ index, Slide })}
|
|
173
172
|
{:else}
|
package/dist/modal/Modal.svelte
CHANGED
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
</script>
|
|
64
64
|
|
|
65
65
|
{#if open}
|
|
66
|
-
<dialog use:trapFocus={{ onEscape: handleEscape }} bind:this={dlg} {...restProps} class={twMerge(base(), clsx(className))} tabindex="-1" oncancel={_oncancel} onclick={_onclick} transition:transition={paramsOptions as ParamsType} onintrostart={() => (modal ? dlg?.showModal() : dlg?.show())} onoutroend={() => dlg?.close()}>
|
|
66
|
+
<dialog use:trapFocus={{ onEscape: handleEscape }} bind:this={dlg} {...restProps} class={twMerge(base(), clsx(className))} tabindex="-1" oncancel={_oncancel} onclick={_onclick} transition:transition|global={paramsOptions as ParamsType} onintrostart={() => (modal ? dlg?.showModal() : dlg?.show())} onoutroend={() => dlg?.close()}>
|
|
67
67
|
{#if title || header}
|
|
68
68
|
<div class={twMerge(headerCls(), clsx(headerClass))}>
|
|
69
69
|
{#if title}
|
package/dist/uiHelpers.svelte.js
CHANGED
package/dist/utils/actions.js
CHANGED
|
@@ -51,7 +51,8 @@ export function trapFocus(node, options = {}) {
|
|
|
51
51
|
isFocusMovedOutside = true;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
// Initialize the action
|
|
55
|
+
function initialize() {
|
|
55
56
|
// Only add event listeners if options is not null
|
|
56
57
|
if (options !== null) {
|
|
57
58
|
// Check if we're currently in a closing state
|
|
@@ -65,50 +66,42 @@ export function trapFocus(node, options = {}) {
|
|
|
65
66
|
}
|
|
66
67
|
node.addEventListener("keydown", handleKeydown);
|
|
67
68
|
node.addEventListener("focusout", handleFocusOut);
|
|
68
|
-
return () => {
|
|
69
|
-
node.removeEventListener("keydown", handleKeydown);
|
|
70
|
-
node.removeEventListener("focusout", handleFocusOut);
|
|
71
|
-
// Only restore focus if not closing via outside click and focus hasn't moved outside
|
|
72
|
-
if (!isClosingViaOutsideClick && !isFocusMovedOutside && previous) {
|
|
73
|
-
setTimeout(() => {
|
|
74
|
-
previous.focus({ preventScroll: true });
|
|
75
|
-
}, 0);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
69
|
}
|
|
79
|
-
}
|
|
80
|
-
//
|
|
70
|
+
}
|
|
71
|
+
// Cleanup function
|
|
72
|
+
function cleanup() {
|
|
73
|
+
if (options !== null) {
|
|
74
|
+
node.removeEventListener("keydown", handleKeydown);
|
|
75
|
+
node.removeEventListener("focusout", handleFocusOut);
|
|
76
|
+
// Only restore focus if not closing via outside click and focus hasn't moved outside
|
|
77
|
+
if (!isClosingViaOutsideClick && !isFocusMovedOutside && previous) {
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
previous.focus({ preventScroll: true });
|
|
80
|
+
}, 0);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Initialize on mount
|
|
85
|
+
initialize();
|
|
86
|
+
// Return the action object with update and destroy methods
|
|
81
87
|
return {
|
|
82
88
|
update(newOptions = {}) {
|
|
89
|
+
// Clean up existing listeners first
|
|
90
|
+
node.removeEventListener("keydown", handleKeydown);
|
|
91
|
+
node.removeEventListener("focusout", handleFocusOut);
|
|
83
92
|
// Update the closing state
|
|
84
93
|
if (newOptions && newOptions.isClosing !== undefined) {
|
|
85
94
|
isClosingViaOutsideClick = newOptions.isClosing;
|
|
86
95
|
}
|
|
87
96
|
options = newOptions;
|
|
88
|
-
//
|
|
89
|
-
if (options
|
|
90
|
-
node.removeEventListener("keydown", handleKeydown);
|
|
91
|
-
node.removeEventListener("focusout", handleFocusOut);
|
|
92
|
-
}
|
|
93
|
-
else if (options !== null) {
|
|
94
|
-
// Add listener if it wasn't already there
|
|
95
|
-
node.removeEventListener("keydown", handleKeydown);
|
|
96
|
-
node.removeEventListener("focusout", handleFocusOut);
|
|
97
|
+
// Reinitialize with new options
|
|
98
|
+
if (options !== null) {
|
|
97
99
|
node.addEventListener("keydown", handleKeydown);
|
|
98
100
|
node.addEventListener("focusout", handleFocusOut);
|
|
99
101
|
}
|
|
100
102
|
},
|
|
101
103
|
destroy() {
|
|
102
|
-
|
|
103
|
-
node.removeEventListener("keydown", handleKeydown);
|
|
104
|
-
node.removeEventListener("focusout", handleFocusOut);
|
|
105
|
-
// Only restore focus if not closing via outside click and focus hasn't moved outside
|
|
106
|
-
if (!isClosingViaOutsideClick && !isFocusMovedOutside && previous) {
|
|
107
|
-
setTimeout(() => {
|
|
108
|
-
previous.focus({ preventScroll: true });
|
|
109
|
-
}, 0);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
104
|
+
cleanup();
|
|
112
105
|
}
|
|
113
106
|
};
|
|
114
107
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowbite-svelte",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"description": "Flowbite components for Svelte",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@eslint/js": "^9.29.0",
|
|
20
20
|
"@flowbite-svelte-plugins/chart": "^0.2.4",
|
|
21
21
|
"@flowbite-svelte-plugins/datatable": "^0.3.4",
|
|
22
|
-
"@flowbite-svelte-plugins/texteditor": "^0.
|
|
22
|
+
"@flowbite-svelte-plugins/texteditor": "^0.13.3",
|
|
23
23
|
"@playwright/test": "^1.53.1",
|
|
24
24
|
"@sveltejs/adapter-auto": "^6.0.1",
|
|
25
25
|
"@sveltejs/adapter-vercel": "^5.7.2",
|
|
@@ -40,11 +40,12 @@
|
|
|
40
40
|
"flowbite-svelte-icons": "^2.2.1",
|
|
41
41
|
"flowbite-typography": "^1.0.5",
|
|
42
42
|
"globals": "^16.2.0",
|
|
43
|
+
"highlight.js": "^11.11.1",
|
|
43
44
|
"jsdom": "^26.1.0",
|
|
44
45
|
"lowlight": "^3.3.0",
|
|
45
46
|
"mdsvex": "^0.12.6",
|
|
46
47
|
"mdsvexamples": "^0.5.0",
|
|
47
|
-
"prettier": "^3.
|
|
48
|
+
"prettier": "^3.6.0",
|
|
48
49
|
"prettier-plugin-svelte": "^3.4.0",
|
|
49
50
|
"prettier-plugin-tailwindcss": "^0.6.13",
|
|
50
51
|
"prism-themes": "^1.9.0",
|