@nebularstreams/libmui 2.5.21 → 2.5.23

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nebularstreams/libmui",
3
3
  "description": "Micro UI based on Mithril",
4
- "version": "2.5.21",
4
+ "version": "2.5.23",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "scripts": {
@@ -1,6 +1,7 @@
1
1
  /*! colorjoe - v4.1.1 - Juho Vepsalainen <bebraw@gmail.com> - MIT
2
2
  https://bebraw.github.com/colorjoe - 2020-01-27 */
3
- const factory = (function () {
3
+ const
4
+ factory = (function () {
4
5
  "use strict";
5
6
 
6
7
  var commonjsGlobal = typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
@@ -1366,4 +1367,4 @@ const factory = (function () {
1366
1367
  }),
1367
1368
  colorjoe = factory();
1368
1369
 
1369
- export default factory;
1370
+ export default colorjoe;
@@ -1,72 +1,75 @@
1
1
  import m from "mithril";
2
2
 
3
3
  let
4
- mCurrentCancelable;
4
+ mCurrentCancelable;
5
5
 
6
6
  function runCancelable(container) {
7
- if (typeof mCurrentCancelable === "function") {
8
- mCurrentCancelable();
9
- mCurrentCancelable = undefined;
10
- }
11
- container.style.display = "none";
12
- delete popupMessage.redraw;
7
+ if (typeof mCurrentCancelable === "function") {
8
+ mCurrentCancelable();
9
+ mCurrentCancelable = undefined;
10
+ }
11
+ popupMessage.redraw(true);
12
+ container.style.display = "none";
13
+ delete popupMessage.redraw;
13
14
  }
14
15
 
16
+
15
17
  // There are ways of doing this inside m.route but it is probably
16
18
  // cleaner and faster when kept outside of the main auto
17
19
  // rendering system
18
20
 
19
21
  function popupMessage(message, cancelable = false, contentClass = ".modal-content") {
20
22
 
21
- const container = document.getElementById("modal-container");
22
- container.classList.toggle("iscustom", contentClass !== ".modal-content");
23
-
24
- if (cancelable) {
25
-
26
- mCurrentCancelable = cancelable;
27
-
28
- container.onclick = (event) => {
29
- if (event.target.id === "modal-container") {
30
- runCancelable(container);
31
- }
32
- };
33
- }
34
-
35
- if (!message) {
36
- delete popupMessage.redraw;
37
- if (message === null)
38
- container.style.display = "none";
39
- else
40
- runCancelable(container);
41
-
42
- return;
43
- }
44
-
45
- container.style.display = "flex";
46
-
47
- popupMessage.redraw = () => {
48
- m.render(
49
- container,
50
- m(contentClass, {
51
- role: "alertdialog",
52
- "aria-labelledby": "modaltitle",
53
- "aria-modal": true
54
- }, [
55
- typeof message === "function" ? message() : message
56
- ])
57
- );
58
- };
59
-
60
- popupMessage.redraw();
23
+ const container = document.getElementById("modal-container");
24
+ container.classList.toggle("iscustom", contentClass !== ".modal-content");
25
+
26
+ if (cancelable) {
27
+
28
+ mCurrentCancelable = cancelable;
29
+
30
+ container.onclick = (event) => {
31
+ if (event.target.id === "modal-container") {
32
+ runCancelable(container);
33
+ }
34
+ };
35
+ }
36
+
37
+ if (!message) {
38
+
39
+ popupMessage.redraw(true);
40
+ delete popupMessage.redraw;
41
+ if (message === null)
42
+ container.style.display = "none";
43
+ else
44
+ runCancelable(container);
45
+
46
+ return;
47
+ }
48
+
49
+ container.style.display = "flex";
50
+
51
+ popupMessage.redraw = (remove) => {
52
+ m.render(
53
+ container,
54
+ m(contentClass, {
55
+ role: "alertdialog",
56
+ "aria-labelledby": "modaltitle",
57
+ "aria-modal": true
58
+ }, remove || !message ? [] : [
59
+ typeof message === "function" ? message() : message
60
+ ])
61
+ );
62
+ };
63
+ popupMessage.redraw();
61
64
  }
62
65
 
63
66
  function clearModal() {
64
- const container = document.getElementById("modal-container");
65
- if (container.style.display !== "none") {
66
- runCancelable(container);
67
- return true;
68
- }
69
- return false;
67
+ const container = document.getElementById("modal-container");
68
+ if (container.style.display !== "none") {
69
+ runCancelable(container);
70
+ return true;
71
+ }
72
+ return false;
70
73
  }
71
74
 
72
- export { popupMessage, clearModal };
75
+ export {popupMessage, clearModal};