abledom 0.0.4 → 0.1.0
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/dist/esm/index.js +125 -92
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +125 -92
- package/dist/index.js.map +1 -1
- package/dist/ts3.9/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -100,9 +100,6 @@ var ui_default = "#abledom-report {\n bottom: 20px;\n display: flex;\n flex-d
|
|
|
100
100
|
|
|
101
101
|
// src/ui/domBuilder.ts
|
|
102
102
|
var DOMBuilder = class {
|
|
103
|
-
// static fromString(parent: HTMLElement | DocumentFragment, html: string): void {
|
|
104
|
-
// // const builder = new DOMBuilder(parent);
|
|
105
|
-
// }
|
|
106
103
|
constructor(parent) {
|
|
107
104
|
__publicField(this, "_doc");
|
|
108
105
|
__publicField(this, "_stack");
|
|
@@ -145,8 +142,8 @@ var DOMBuilder = class {
|
|
|
145
142
|
(_a = this._stack[0]) == null ? void 0 : _a.appendChild(document.createTextNode(text));
|
|
146
143
|
return this;
|
|
147
144
|
}
|
|
148
|
-
|
|
149
|
-
|
|
145
|
+
element(callback) {
|
|
146
|
+
callback(this._stack[0]);
|
|
150
147
|
return this;
|
|
151
148
|
}
|
|
152
149
|
};
|
|
@@ -361,7 +358,7 @@ var _NotificationUI = class _NotificationUI {
|
|
|
361
358
|
);
|
|
362
359
|
};
|
|
363
360
|
}
|
|
364
|
-
).
|
|
361
|
+
).element(log_default).closeTag().openTag(
|
|
365
362
|
"button",
|
|
366
363
|
{
|
|
367
364
|
class: "button",
|
|
@@ -385,12 +382,20 @@ var _NotificationUI = class _NotificationUI {
|
|
|
385
382
|
revealButton.style.display = "none";
|
|
386
383
|
}
|
|
387
384
|
}
|
|
388
|
-
).
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
385
|
+
).element(reveal_default).closeTag().text(notification.message).openTag(
|
|
386
|
+
"a",
|
|
387
|
+
{
|
|
388
|
+
class: "button close",
|
|
389
|
+
href: notification.help || "/",
|
|
390
|
+
title: "Open help",
|
|
391
|
+
target: "_blank"
|
|
392
|
+
},
|
|
393
|
+
(help) => {
|
|
394
|
+
if (!notification.help) {
|
|
395
|
+
help.style.display = "none";
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
).element(help_default).closeTag().openTag(
|
|
394
399
|
"button",
|
|
395
400
|
{
|
|
396
401
|
class: "button close",
|
|
@@ -403,7 +408,7 @@ var _NotificationUI = class _NotificationUI {
|
|
|
403
408
|
(_a = _NotificationUI._highlight) == null ? void 0 : _a.hide();
|
|
404
409
|
};
|
|
405
410
|
}
|
|
406
|
-
).
|
|
411
|
+
).element(close_default).closeTag().closeTag().closeTag();
|
|
407
412
|
}
|
|
408
413
|
toggle(show, initial = false) {
|
|
409
414
|
var _a;
|
|
@@ -439,7 +444,6 @@ var NotificationsUI = class {
|
|
|
439
444
|
__publicField(this, "_alignBottomRightButton");
|
|
440
445
|
__publicField(this, "_isMuted", false);
|
|
441
446
|
__publicField(this, "_notifications", /* @__PURE__ */ new Set());
|
|
442
|
-
var _a;
|
|
443
447
|
const container = this._container = win.document.createElement("div");
|
|
444
448
|
container.__abledomui = true;
|
|
445
449
|
container.id = "abledom-report";
|
|
@@ -452,83 +456,111 @@ var NotificationsUI = class {
|
|
|
452
456
|
container.appendChild(notificationsContainer);
|
|
453
457
|
const menuElement = this._menuElement = win.document.createElement("div");
|
|
454
458
|
menuElement.className = "abledom-menu-container";
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
hideAllButton
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
459
|
+
container.appendChild(menuElement);
|
|
460
|
+
new DOMBuilder(menuElement).openTag("div", { class: "abledom-menu" }).openTag(
|
|
461
|
+
"span",
|
|
462
|
+
{
|
|
463
|
+
class: "notifications-count",
|
|
464
|
+
title: "Number of notifications"
|
|
465
|
+
},
|
|
466
|
+
(notificationCountElement) => {
|
|
467
|
+
this._notificationCountElement = notificationCountElement;
|
|
468
|
+
}
|
|
469
|
+
).closeTag().openTag(
|
|
470
|
+
"button",
|
|
471
|
+
{
|
|
472
|
+
class: "button",
|
|
473
|
+
title: "Show all notifications"
|
|
474
|
+
},
|
|
475
|
+
(showAllButton) => {
|
|
476
|
+
this._showAllButton = showAllButton;
|
|
477
|
+
showAllButton.onclick = () => {
|
|
478
|
+
this.showAll();
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
).element(showall_default).closeTag().openTag(
|
|
482
|
+
"button",
|
|
483
|
+
{
|
|
484
|
+
class: "button",
|
|
485
|
+
title: "Hide all notifications"
|
|
486
|
+
},
|
|
487
|
+
(hideAllButton) => {
|
|
488
|
+
this._hideAllButton = hideAllButton;
|
|
489
|
+
hideAllButton.onclick = () => {
|
|
490
|
+
this.hideAll();
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
).element(hideall_default).closeTag().openTag(
|
|
494
|
+
"button",
|
|
495
|
+
{
|
|
496
|
+
class: "button",
|
|
497
|
+
title: "Mute newly appearing notifications"
|
|
498
|
+
},
|
|
499
|
+
(muteButton) => {
|
|
500
|
+
muteButton.onclick = () => {
|
|
501
|
+
const isMuted = this._isMuted = muteButton.classList.toggle(pressedClass);
|
|
502
|
+
if (isMuted) {
|
|
503
|
+
muteButton.setAttribute(
|
|
504
|
+
"title",
|
|
505
|
+
"Unmute newly appearing notifications"
|
|
506
|
+
);
|
|
507
|
+
} else {
|
|
508
|
+
muteButton.setAttribute(
|
|
509
|
+
"title",
|
|
510
|
+
"Mute newly appearing notifications"
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
).element(muteall_default).closeTag().openTag(
|
|
516
|
+
"button",
|
|
517
|
+
{
|
|
518
|
+
class: "button align-button align-button-first pressed",
|
|
519
|
+
title: "Attach notifications to bottom left"
|
|
520
|
+
},
|
|
521
|
+
(alignBottomLeftButton) => {
|
|
522
|
+
this._alignBottomLeftButton = alignBottomLeftButton;
|
|
523
|
+
alignBottomLeftButton.onclick = () => {
|
|
524
|
+
this.setUIAlignment("bottom-left" /* BottomLeft */);
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
).element(alignbottomleft_default).closeTag().openTag(
|
|
528
|
+
"button",
|
|
529
|
+
{
|
|
530
|
+
class: "button align-button",
|
|
531
|
+
title: "Attach notifications to top left"
|
|
532
|
+
},
|
|
533
|
+
(alignTopLeftButton) => {
|
|
534
|
+
this._alignTopLeftButton = alignTopLeftButton;
|
|
535
|
+
alignTopLeftButton.onclick = () => {
|
|
536
|
+
this.setUIAlignment("top-left" /* TopLeft */);
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
).element(aligntopleft_default).closeTag().openTag(
|
|
540
|
+
"button",
|
|
541
|
+
{
|
|
542
|
+
class: "button align-button",
|
|
543
|
+
title: "Attach notifications to top right"
|
|
544
|
+
},
|
|
545
|
+
(alignTopRightButton) => {
|
|
546
|
+
this._alignTopRightButton = alignTopRightButton;
|
|
547
|
+
alignTopRightButton.onclick = () => {
|
|
548
|
+
this.setUIAlignment("top-right" /* TopRight */);
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
).element(aligntopright_default).closeTag().openTag(
|
|
552
|
+
"button",
|
|
553
|
+
{
|
|
554
|
+
class: "button align-button align-button-last",
|
|
555
|
+
title: "Attach notifications to bottom right"
|
|
556
|
+
},
|
|
557
|
+
(alignBottomRightButton) => {
|
|
558
|
+
this._alignBottomRightButton = alignBottomRightButton;
|
|
559
|
+
alignBottomRightButton.onclick = () => {
|
|
560
|
+
this.setUIAlignment("bottom-right" /* BottomRight */);
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
).element(alignbottomright_default).closeTag().closeTag();
|
|
532
564
|
win.document.body.appendChild(container);
|
|
533
565
|
}
|
|
534
566
|
setUIAlignment(alignment) {
|
|
@@ -1384,7 +1416,8 @@ var FocusableElementLabelRule = class extends ValidationRule {
|
|
|
1384
1416
|
notification: isElementVisible(element) ? {
|
|
1385
1417
|
id: "focusable-element-label",
|
|
1386
1418
|
message: "Focusable element must have a non-empty text label.",
|
|
1387
|
-
element
|
|
1419
|
+
element,
|
|
1420
|
+
help: "https://www.w3.org/WAI/tutorials/forms/labels/"
|
|
1388
1421
|
} : void 0,
|
|
1389
1422
|
dependsOnIds: new Set(labelledByValues)
|
|
1390
1423
|
};
|