@hypericon/mico 0.4.0 → 0.4.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.
@@ -11,6 +11,7 @@ export declare class DialogManager {
11
11
  private currentDialog;
12
12
  get isOpen(): boolean;
13
13
  private debug;
14
+ backdropDismissTimeout: number;
14
15
  constructor(options?: DialogManagerOptions);
15
16
  /**
16
17
  * Open a new dialog with the given contents.
@@ -19,6 +19,7 @@ class DialogManager {
19
19
  get isOpen() { return this.currentDialog !== undefined; }
20
20
  constructor(options) {
21
21
  this.debug = false;
22
+ this.backdropDismissTimeout = 10;
22
23
  if (options === null || options === void 0 ? void 0 : options.debug)
23
24
  this.debug = options.debug;
24
25
  if (options === null || options === void 0 ? void 0 : options.containerEl) {
@@ -51,6 +52,7 @@ class DialogManager {
51
52
  const manager = this;
52
53
  const dialogId = `${Math.random().toString().replace("0.", "")}`;
53
54
  return new Promise((resolve, reject) => {
55
+ const backdropDismissAvailableAt = Date.now() + this.backdropDismissTimeout;
54
56
  mithril_1.default.mount(element, {
55
57
  oninit() {
56
58
  //
@@ -63,6 +65,8 @@ class DialogManager {
63
65
  // Optionally wire up the backdrop to dismiss the dialog
64
66
  if ((opts === null || opts === void 0 ? void 0 : opts.backdropDismiss) === true) {
65
67
  dialog.addEventListener("click", (ev) => {
68
+ if (Date.now() < backdropDismissAvailableAt)
69
+ return;
66
70
  // console.log(ev);
67
71
  if (ev.target !== dom)
68
72
  return;
@@ -11,6 +11,7 @@ export declare class DialogManager {
11
11
  private currentDialog;
12
12
  get isOpen(): boolean;
13
13
  private debug;
14
+ backdropDismissTimeout: number;
14
15
  constructor(options?: DialogManagerOptions);
15
16
  /**
16
17
  * Open a new dialog with the given contents.
@@ -13,6 +13,7 @@ export class DialogManager {
13
13
  get isOpen() { return this.currentDialog !== undefined; }
14
14
  constructor(options) {
15
15
  this.debug = false;
16
+ this.backdropDismissTimeout = 10;
16
17
  if (options === null || options === void 0 ? void 0 : options.debug)
17
18
  this.debug = options.debug;
18
19
  if (options === null || options === void 0 ? void 0 : options.containerEl) {
@@ -45,6 +46,7 @@ export class DialogManager {
45
46
  const manager = this;
46
47
  const dialogId = `${Math.random().toString().replace("0.", "")}`;
47
48
  return new Promise((resolve, reject) => {
49
+ const backdropDismissAvailableAt = Date.now() + this.backdropDismissTimeout;
48
50
  m.mount(element, {
49
51
  oninit() {
50
52
  //
@@ -57,6 +59,8 @@ export class DialogManager {
57
59
  // Optionally wire up the backdrop to dismiss the dialog
58
60
  if ((opts === null || opts === void 0 ? void 0 : opts.backdropDismiss) === true) {
59
61
  dialog.addEventListener("click", (ev) => {
62
+ if (Date.now() < backdropDismissAvailableAt)
63
+ return;
60
64
  // console.log(ev);
61
65
  if (ev.target !== dom)
62
66
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypericon/mico",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "UI components and utilities with Mithril",
5
5
  "author": "Ed Johnson, Hypericon Ltd",
6
6
  "license": "MIT",