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/esm/index.js
CHANGED
|
@@ -62,9 +62,6 @@ var ui_default = "#abledom-report {\n bottom: 20px;\n display: flex;\n flex-d
|
|
|
62
62
|
|
|
63
63
|
// src/ui/domBuilder.ts
|
|
64
64
|
var DOMBuilder = class {
|
|
65
|
-
// static fromString(parent: HTMLElement | DocumentFragment, html: string): void {
|
|
66
|
-
// // const builder = new DOMBuilder(parent);
|
|
67
|
-
// }
|
|
68
65
|
constructor(parent) {
|
|
69
66
|
__publicField(this, "_doc");
|
|
70
67
|
__publicField(this, "_stack");
|
|
@@ -107,8 +104,8 @@ var DOMBuilder = class {
|
|
|
107
104
|
(_a = this._stack[0]) == null ? void 0 : _a.appendChild(document.createTextNode(text));
|
|
108
105
|
return this;
|
|
109
106
|
}
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
element(callback) {
|
|
108
|
+
callback(this._stack[0]);
|
|
112
109
|
return this;
|
|
113
110
|
}
|
|
114
111
|
};
|
|
@@ -323,7 +320,7 @@ var _NotificationUI = class _NotificationUI {
|
|
|
323
320
|
);
|
|
324
321
|
};
|
|
325
322
|
}
|
|
326
|
-
).
|
|
323
|
+
).element(log_default).closeTag().openTag(
|
|
327
324
|
"button",
|
|
328
325
|
{
|
|
329
326
|
class: "button",
|
|
@@ -347,12 +344,20 @@ var _NotificationUI = class _NotificationUI {
|
|
|
347
344
|
revealButton.style.display = "none";
|
|
348
345
|
}
|
|
349
346
|
}
|
|
350
|
-
).
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
347
|
+
).element(reveal_default).closeTag().text(notification.message).openTag(
|
|
348
|
+
"a",
|
|
349
|
+
{
|
|
350
|
+
class: "button close",
|
|
351
|
+
href: notification.help || "/",
|
|
352
|
+
title: "Open help",
|
|
353
|
+
target: "_blank"
|
|
354
|
+
},
|
|
355
|
+
(help) => {
|
|
356
|
+
if (!notification.help) {
|
|
357
|
+
help.style.display = "none";
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
).element(help_default).closeTag().openTag(
|
|
356
361
|
"button",
|
|
357
362
|
{
|
|
358
363
|
class: "button close",
|
|
@@ -365,7 +370,7 @@ var _NotificationUI = class _NotificationUI {
|
|
|
365
370
|
(_a = _NotificationUI._highlight) == null ? void 0 : _a.hide();
|
|
366
371
|
};
|
|
367
372
|
}
|
|
368
|
-
).
|
|
373
|
+
).element(close_default).closeTag().closeTag().closeTag();
|
|
369
374
|
}
|
|
370
375
|
toggle(show, initial = false) {
|
|
371
376
|
var _a;
|
|
@@ -401,7 +406,6 @@ var NotificationsUI = class {
|
|
|
401
406
|
__publicField(this, "_alignBottomRightButton");
|
|
402
407
|
__publicField(this, "_isMuted", false);
|
|
403
408
|
__publicField(this, "_notifications", /* @__PURE__ */ new Set());
|
|
404
|
-
var _a;
|
|
405
409
|
const container = this._container = win.document.createElement("div");
|
|
406
410
|
container.__abledomui = true;
|
|
407
411
|
container.id = "abledom-report";
|
|
@@ -414,83 +418,111 @@ var NotificationsUI = class {
|
|
|
414
418
|
container.appendChild(notificationsContainer);
|
|
415
419
|
const menuElement = this._menuElement = win.document.createElement("div");
|
|
416
420
|
menuElement.className = "abledom-menu-container";
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
hideAllButton
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
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
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
421
|
+
container.appendChild(menuElement);
|
|
422
|
+
new DOMBuilder(menuElement).openTag("div", { class: "abledom-menu" }).openTag(
|
|
423
|
+
"span",
|
|
424
|
+
{
|
|
425
|
+
class: "notifications-count",
|
|
426
|
+
title: "Number of notifications"
|
|
427
|
+
},
|
|
428
|
+
(notificationCountElement) => {
|
|
429
|
+
this._notificationCountElement = notificationCountElement;
|
|
430
|
+
}
|
|
431
|
+
).closeTag().openTag(
|
|
432
|
+
"button",
|
|
433
|
+
{
|
|
434
|
+
class: "button",
|
|
435
|
+
title: "Show all notifications"
|
|
436
|
+
},
|
|
437
|
+
(showAllButton) => {
|
|
438
|
+
this._showAllButton = showAllButton;
|
|
439
|
+
showAllButton.onclick = () => {
|
|
440
|
+
this.showAll();
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
).element(showall_default).closeTag().openTag(
|
|
444
|
+
"button",
|
|
445
|
+
{
|
|
446
|
+
class: "button",
|
|
447
|
+
title: "Hide all notifications"
|
|
448
|
+
},
|
|
449
|
+
(hideAllButton) => {
|
|
450
|
+
this._hideAllButton = hideAllButton;
|
|
451
|
+
hideAllButton.onclick = () => {
|
|
452
|
+
this.hideAll();
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
).element(hideall_default).closeTag().openTag(
|
|
456
|
+
"button",
|
|
457
|
+
{
|
|
458
|
+
class: "button",
|
|
459
|
+
title: "Mute newly appearing notifications"
|
|
460
|
+
},
|
|
461
|
+
(muteButton) => {
|
|
462
|
+
muteButton.onclick = () => {
|
|
463
|
+
const isMuted = this._isMuted = muteButton.classList.toggle(pressedClass);
|
|
464
|
+
if (isMuted) {
|
|
465
|
+
muteButton.setAttribute(
|
|
466
|
+
"title",
|
|
467
|
+
"Unmute newly appearing notifications"
|
|
468
|
+
);
|
|
469
|
+
} else {
|
|
470
|
+
muteButton.setAttribute(
|
|
471
|
+
"title",
|
|
472
|
+
"Mute newly appearing notifications"
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
).element(muteall_default).closeTag().openTag(
|
|
478
|
+
"button",
|
|
479
|
+
{
|
|
480
|
+
class: "button align-button align-button-first pressed",
|
|
481
|
+
title: "Attach notifications to bottom left"
|
|
482
|
+
},
|
|
483
|
+
(alignBottomLeftButton) => {
|
|
484
|
+
this._alignBottomLeftButton = alignBottomLeftButton;
|
|
485
|
+
alignBottomLeftButton.onclick = () => {
|
|
486
|
+
this.setUIAlignment("bottom-left" /* BottomLeft */);
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
).element(alignbottomleft_default).closeTag().openTag(
|
|
490
|
+
"button",
|
|
491
|
+
{
|
|
492
|
+
class: "button align-button",
|
|
493
|
+
title: "Attach notifications to top left"
|
|
494
|
+
},
|
|
495
|
+
(alignTopLeftButton) => {
|
|
496
|
+
this._alignTopLeftButton = alignTopLeftButton;
|
|
497
|
+
alignTopLeftButton.onclick = () => {
|
|
498
|
+
this.setUIAlignment("top-left" /* TopLeft */);
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
).element(aligntopleft_default).closeTag().openTag(
|
|
502
|
+
"button",
|
|
503
|
+
{
|
|
504
|
+
class: "button align-button",
|
|
505
|
+
title: "Attach notifications to top right"
|
|
506
|
+
},
|
|
507
|
+
(alignTopRightButton) => {
|
|
508
|
+
this._alignTopRightButton = alignTopRightButton;
|
|
509
|
+
alignTopRightButton.onclick = () => {
|
|
510
|
+
this.setUIAlignment("top-right" /* TopRight */);
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
).element(aligntopright_default).closeTag().openTag(
|
|
514
|
+
"button",
|
|
515
|
+
{
|
|
516
|
+
class: "button align-button align-button-last",
|
|
517
|
+
title: "Attach notifications to bottom right"
|
|
518
|
+
},
|
|
519
|
+
(alignBottomRightButton) => {
|
|
520
|
+
this._alignBottomRightButton = alignBottomRightButton;
|
|
521
|
+
alignBottomRightButton.onclick = () => {
|
|
522
|
+
this.setUIAlignment("bottom-right" /* BottomRight */);
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
).element(alignbottomright_default).closeTag().closeTag();
|
|
494
526
|
win.document.body.appendChild(container);
|
|
495
527
|
}
|
|
496
528
|
setUIAlignment(alignment) {
|
|
@@ -1346,7 +1378,8 @@ var FocusableElementLabelRule = class extends ValidationRule {
|
|
|
1346
1378
|
notification: isElementVisible(element) ? {
|
|
1347
1379
|
id: "focusable-element-label",
|
|
1348
1380
|
message: "Focusable element must have a non-empty text label.",
|
|
1349
|
-
element
|
|
1381
|
+
element,
|
|
1382
|
+
help: "https://www.w3.org/WAI/tutorials/forms/labels/"
|
|
1350
1383
|
} : void 0,
|
|
1351
1384
|
dependsOnIds: new Set(labelledByValues)
|
|
1352
1385
|
};
|