@sveltek/attachments 0.2.4 → 0.2.5
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/README.md +1 -1
- package/dist/index.js +3 -6
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
>
|
|
9
9
|
> Since [attachments](https://svelte.dev/docs/svelte/svelte-attachments) are a new feature in **Svelte**, this project is in an early testing phase to experiment with their implementation. As a result, breaking changes are very likely before the first stable release.
|
|
10
10
|
>
|
|
11
|
-
> If you find any issues or bugs, please [report](https://github.com/sveltek/
|
|
11
|
+
> If you find any issues or bugs, please [report](https://github.com/sveltek/attachments/issues/new/choose) them so the project can be improved.
|
|
12
12
|
|
|
13
13
|
<br>
|
|
14
14
|
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,8 @@ function clickOutside(callback, options = {}) {
|
|
|
4
4
|
const { event: { target = document } = {}, trigger } = options;
|
|
5
5
|
const triggers = Array.isArray(trigger) ? trigger : [trigger];
|
|
6
6
|
const handler = (event) => {
|
|
7
|
-
const target
|
|
8
|
-
if (el.contains(target
|
|
7
|
+
const target = event.target;
|
|
8
|
+
if (el.contains(target) || triggers.some((v) => v?.contains(target))) return;
|
|
9
9
|
callback(event);
|
|
10
10
|
};
|
|
11
11
|
target.addEventListener("click", handler, true);
|
|
@@ -14,7 +14,6 @@ function clickOutside(callback, options = {}) {
|
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
|
|
18
17
|
//#endregion
|
|
19
18
|
//#region src/attachments/keyboard/attachment.ts
|
|
20
19
|
function keyboard(callback, options = {}) {
|
|
@@ -29,7 +28,6 @@ function keyboard(callback, options = {}) {
|
|
|
29
28
|
};
|
|
30
29
|
};
|
|
31
30
|
}
|
|
32
|
-
|
|
33
31
|
//#endregion
|
|
34
32
|
//#region src/attachments/prevent-scroll/attachment.ts
|
|
35
33
|
function preventScroll(options = {}) {
|
|
@@ -61,6 +59,5 @@ function preventScroll(options = {}) {
|
|
|
61
59
|
};
|
|
62
60
|
};
|
|
63
61
|
}
|
|
64
|
-
|
|
65
62
|
//#endregion
|
|
66
|
-
export { clickOutside, keyboard, preventScroll };
|
|
63
|
+
export { clickOutside, keyboard, preventScroll };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltek/attachments",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"author": "Sveltek",
|
|
5
5
|
"description": "A collection of custom attachments for Svelte.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,15 +45,15 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@hypernym/bundler": "^0.
|
|
48
|
+
"@hypernym/bundler": "^0.32.1",
|
|
49
49
|
"@sveltejs/adapter-static": "^3.0.10",
|
|
50
|
-
"@sveltejs/kit": "^2.
|
|
51
|
-
"@sveltek/eslint-config": "^1.1.
|
|
52
|
-
"@sveltek/prettier-config": "^1.0.
|
|
53
|
-
"@types/node": "^
|
|
54
|
-
"eslint": "^9.39.
|
|
55
|
-
"prettier": "^3.8.
|
|
56
|
-
"svelte": "^5.
|
|
50
|
+
"@sveltejs/kit": "^2.53.4",
|
|
51
|
+
"@sveltek/eslint-config": "^1.1.5",
|
|
52
|
+
"@sveltek/prettier-config": "^1.0.7",
|
|
53
|
+
"@types/node": "^25.4.0",
|
|
54
|
+
"eslint": "^9.39.4",
|
|
55
|
+
"prettier": "^3.8.1",
|
|
56
|
+
"svelte": "^5.53.9",
|
|
57
57
|
"typescript": "^5.9.3",
|
|
58
58
|
"vite": "^7.3.1"
|
|
59
59
|
},
|