phoenix_duskmoon 9.10.1 → 9.12.1
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.
|
@@ -14,6 +14,9 @@ const DM_EVENTS = [
|
|
|
14
14
|
const COPY_SELECTOR = "[data-copy-value]";
|
|
15
15
|
const COPY_FEEDBACK_DURATION = 2000;
|
|
16
16
|
const COPY_LISTENER = Symbol.for("phoenix-duskmoon.copy-listener");
|
|
17
|
+
const DIALOG_SELECTOR = 'dialog[data-dm-confirm-dialog="true"]';
|
|
18
|
+
const DIALOG_CONFIRM_SELECTOR = '[data-dm-confirm-action="true"]';
|
|
19
|
+
const DIALOG_BEHAVIOR_LISTENERS = Symbol.for("phoenix-duskmoon.dialog-behavior-listeners");
|
|
17
20
|
const copyFeedback = new WeakMap();
|
|
18
21
|
|
|
19
22
|
/**
|
|
@@ -359,7 +362,25 @@ export function installClipboardBehavior(root = globalThis.document, options = {
|
|
|
359
362
|
root[COPY_LISTENER] = listener;
|
|
360
363
|
}
|
|
361
364
|
|
|
365
|
+
/** Close the current confirm dialog before submit/reset/custom command default actions. */
|
|
366
|
+
export function handleDialogConfirmClick(event) {
|
|
367
|
+
const path = event.composedPath?.() ?? [];
|
|
368
|
+
const action = path.find((node) => node.matches?.(DIALOG_CONFIRM_SELECTOR));
|
|
369
|
+
const dialog = path.find((node) => node.matches?.(DIALOG_SELECTOR));
|
|
370
|
+
|
|
371
|
+
if (action && dialog?.open) dialog.close();
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/** Install CSP-safe delegated behavior for LiveView-patched confirm dialogs. */
|
|
375
|
+
export function installDialogBehavior(root = globalThis.document) {
|
|
376
|
+
if (!root?.addEventListener || root[DIALOG_BEHAVIOR_LISTENERS]) return;
|
|
377
|
+
|
|
378
|
+
root.addEventListener("click", handleDialogConfirmClick, true);
|
|
379
|
+
root[DIALOG_BEHAVIOR_LISTENERS] = handleDialogConfirmClick;
|
|
380
|
+
}
|
|
381
|
+
|
|
362
382
|
installClipboardBehavior();
|
|
383
|
+
installDialogBehavior();
|
|
363
384
|
|
|
364
385
|
// Export to window for non-module usage
|
|
365
386
|
if (typeof window !== "undefined") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phoenix_duskmoon",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.12.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./priv/static/assets/js/phoenix_duskmoon.js",
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
"registry": "https://registry.npmjs.org/"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@duskmoon-dev/art-elements": "1.
|
|
39
|
-
"@duskmoon-dev/core": "1.
|
|
40
|
-
"@duskmoon-dev/css-art": "1.
|
|
41
|
-
"@duskmoon-dev/elements": "1.
|
|
38
|
+
"@duskmoon-dev/art-elements": "1.7.2",
|
|
39
|
+
"@duskmoon-dev/core": "1.18.1",
|
|
40
|
+
"@duskmoon-dev/css-art": "1.18.1",
|
|
41
|
+
"@duskmoon-dev/elements": "1.7.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@mdi/svg": "7.4.47",
|
|
45
45
|
"bootstrap-icons": "1.13.1",
|
|
46
|
-
"postcss": "8.5.
|
|
46
|
+
"postcss": "8.5.26"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"tailwindcss": "^4.3.2"
|