Skip to content

Commit a7d47e6

Browse files
committed
Release v2.2.2
1 parent dba5478 commit a7d47e6

File tree

8 files changed

+58
-36
lines changed

8 files changed

+58
-36
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9-
[Unreleased]: https://github.com/fylgja/alpinejs-dialog/compare/v2.2.1...HEAD
9+
[Unreleased]: https://github.com/fylgja/alpinejs-dialog/compare/v2.2.2...HEAD
10+
11+
## [2.2.2] - 2025-10-16
12+
[2.2.2]: https://github.com/fylgja/alpinejs-dialog/compare/v2.2.1...v2.2.2
13+
14+
### Fixed
15+
16+
- Escape key still triggering the native close event.
1017

1118
## [2.2.1] - 2025-10-09
1219
[2.2.1]: https://github.com/fylgja/alpinejs-dialog/compare/v2.2.0...v2.2.1

dist/index.cjs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@ function dialog_default(Alpine) {
5151
}
5252
}
5353
function escapeDialog(event) {
54-
if (event.key !== "Escape") return;
55-
if (closeBy === "none" || !canEvaluate) {
56-
event.preventDefault();
57-
}
54+
if (event.key !== "Escape")
55+
return;
56+
event.preventDefault();
57+
evaluate();
5858
}
5959
function handleCloseByEvent(event) {
60-
if (event.target !== el) return;
60+
if (event.target !== el)
61+
return;
6162
const rect = el.getBoundingClientRect();
6263
const isInDialog = rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
6364
if (!isInDialog) {
@@ -73,12 +74,14 @@ function dialog_default(Alpine) {
7374
evaluate();
7475
}
7576
function open() {
76-
if (el.hasAttribute("open")) return;
77+
if (el.hasAttribute("open"))
78+
return;
7779
el.showModal();
7880
scrollLock(lockPageScroll);
7981
}
8082
function close() {
81-
if (!el.hasAttribute("open")) return;
83+
if (!el.hasAttribute("open"))
84+
return;
8285
el.close();
8386
scrollLock(false);
8487
}
@@ -98,9 +101,11 @@ function dialog_default(Alpine) {
98101
}
99102
}
100103
function modifierValue(modifiers, key, fallback) {
101-
if (modifiers.indexOf(key) === -1) return fallback;
104+
if (modifiers.indexOf(key) === -1)
105+
return fallback;
102106
const rawValue = modifiers[modifiers.indexOf(key) + 1];
103-
if (!rawValue) return fallback;
107+
if (!rawValue)
108+
return fallback;
104109
if (key === "closeby") {
105110
const allowedValues = ["auto", "none", "closerequest", "any"];
106111
const options = allowedValues.join(", ");
@@ -116,3 +121,5 @@ function modifierValue(modifiers, key, fallback) {
116121

117122
// src/module.js
118123
var module_default = dialog_default;
124+
// Annotate the CommonJS export names for ESM import in node:
125+
0 && (module.exports = {});

dist/index.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@
2626
}
2727
}
2828
function escapeDialog(event) {
29-
if (event.key !== "Escape") return;
30-
if (closeBy === "none" || !canEvaluate) {
31-
event.preventDefault();
32-
}
29+
if (event.key !== "Escape")
30+
return;
31+
event.preventDefault();
32+
evaluate();
3333
}
3434
function handleCloseByEvent(event) {
35-
if (event.target !== el) return;
35+
if (event.target !== el)
36+
return;
3637
const rect = el.getBoundingClientRect();
3738
const isInDialog = rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
3839
if (!isInDialog) {
@@ -48,12 +49,14 @@
4849
evaluate();
4950
}
5051
function open() {
51-
if (el.hasAttribute("open")) return;
52+
if (el.hasAttribute("open"))
53+
return;
5254
el.showModal();
5355
scrollLock(lockPageScroll);
5456
}
5557
function close() {
56-
if (!el.hasAttribute("open")) return;
58+
if (!el.hasAttribute("open"))
59+
return;
5760
el.close();
5861
scrollLock(false);
5962
}
@@ -73,9 +76,11 @@
7376
}
7477
}
7578
function modifierValue(modifiers, key, fallback) {
76-
if (modifiers.indexOf(key) === -1) return fallback;
79+
if (modifiers.indexOf(key) === -1)
80+
return fallback;
7781
const rawValue = modifiers[modifiers.indexOf(key) + 1];
78-
if (!rawValue) return fallback;
82+
if (!rawValue)
83+
return fallback;
7984
if (key === "closeby") {
8085
const allowedValues = ["auto", "none", "closerequest", "any"];
8186
const options = allowedValues.join(", ");

dist/index.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.mjs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ function dialog_default(Alpine) {
2525
}
2626
}
2727
function escapeDialog(event) {
28-
if (event.key !== "Escape") return;
29-
if (closeBy === "none" || !canEvaluate) {
30-
event.preventDefault();
31-
}
28+
if (event.key !== "Escape")
29+
return;
30+
event.preventDefault();
31+
evaluate();
3232
}
3333
function handleCloseByEvent(event) {
34-
if (event.target !== el) return;
34+
if (event.target !== el)
35+
return;
3536
const rect = el.getBoundingClientRect();
3637
const isInDialog = rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
3738
if (!isInDialog) {
@@ -47,12 +48,14 @@ function dialog_default(Alpine) {
4748
evaluate();
4849
}
4950
function open() {
50-
if (el.hasAttribute("open")) return;
51+
if (el.hasAttribute("open"))
52+
return;
5153
el.showModal();
5254
scrollLock(lockPageScroll);
5355
}
5456
function close() {
55-
if (!el.hasAttribute("open")) return;
57+
if (!el.hasAttribute("open"))
58+
return;
5659
el.close();
5760
scrollLock(false);
5861
}
@@ -72,9 +75,11 @@ function dialog_default(Alpine) {
7275
}
7376
}
7477
function modifierValue(modifiers, key, fallback) {
75-
if (modifiers.indexOf(key) === -1) return fallback;
78+
if (modifiers.indexOf(key) === -1)
79+
return fallback;
7680
const rawValue = modifiers[modifiers.indexOf(key) + 1];
77-
if (!rawValue) return fallback;
81+
if (!rawValue)
82+
return fallback;
7883
if (key === "closeby") {
7984
const allowedValues = ["auto", "none", "closerequest", "any"];
8085
const options = allowedValues.join(", ");

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fylgja/alpinejs-dialog",
3-
"version": "2.2.1",
3+
"version": "2.2.2",
44
"description": "Bring the power of AlpineJs to the HTML dialog",
55
"homepage": "https://fylgja.dev/",
66
"author": "Fylgja",

src/dialog.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,8 @@ export default function (Alpine) {
5050
*/
5151
function escapeDialog(event) {
5252
if (event.key !== "Escape") return;
53-
54-
if (closeBy === "none" || !canEvaluate) {
55-
event.preventDefault();
56-
}
53+
event.preventDefault();
54+
evaluate();
5755
}
5856

5957
function handleCloseByEvent(event) {

0 commit comments

Comments
 (0)