abledom 0.0.3 → 0.0.5

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 CHANGED
@@ -60,48 +60,201 @@ var ValidationRule = class {
60
60
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/ui.css
61
61
  var ui_default = "#abledom-report {\n bottom: 20px;\n display: flex;\n flex-direction: column;\n left: 10px;\n max-height: 80%;\n max-width: 60%;\n padding: 4px 8px;\n position: absolute;\n z-index: 100500;\n}\n\n#abledom-report :focus-visible {\n outline: 3px solid red;\n mix-blend-mode: difference;\n}\n\n#abledom-report.abledom-align-left {\n left: 10px;\n right: auto;\n}\n\n#abledom-report.abledom-align-right {\n left: auto;\n right: 10px;\n}\n\n#abledom-report.abledom-align-bottom {\n bottom: 20px;\n top: auto;\n}\n\n#abledom-report.abledom-align-top {\n /* flex-direction: column-reverse; */\n bottom: auto;\n top: 10px;\n}\n\n.abledom-menu-container {\n backdrop-filter: blur(3px);\n border-radius: 8px;\n box-shadow: 0px 0px 4px rgba(127, 127, 127, 0.5);\n display: inline-block;\n margin: 2px auto 2px 0;\n}\n\n#abledom-report.abledom-align-right .abledom-menu-container {\n margin: 2px 0 2px auto;\n}\n\n.abledom-menu {\n background-color: rgba(140, 10, 121, 0.7);\n border-radius: 8px;\n color: white;\n display: inline flex;\n font-family: Arial, Helvetica, sans-serif;\n font-size: 16px;\n line-height: 26px;\n padding: 4px;\n}\n\n.abledom-menu .notifications-count {\n margin: 0 8px;\n display: inline-block;\n}\n\n.abledom-menu .button {\n all: unset;\n color: #000;\n cursor: pointer;\n background: linear-gradient(\n 180deg,\n rgba(255, 255, 255, 1) 0%,\n rgba(200, 200, 200, 1) 100%\n );\n border-radius: 6px;\n border: 1px solid rgba(255, 255, 255, 0.4);\n box-sizing: border-box;\n line-height: 0px;\n margin-right: 4px;\n max-height: 26px;\n padding: 2px;\n text-decoration: none;\n}\n\n.abledom-menu .align-button {\n border-right-color: rgba(0, 0, 0, 0.4);\n border-radius: 0;\n margin: 0;\n}\n\n.abledom-menu .align-button:active,\n#abledom-report .pressed {\n background: linear-gradient(\n 180deg,\n rgba(130, 130, 130, 1) 0%,\n rgba(180, 180, 180, 1) 100%\n );\n}\n\n.abledom-menu .align-button-first {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n margin-left: 8px;\n}\n.abledom-menu .align-button-last {\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n border-right-color: rgba(255, 255, 255, 0.4);\n}\n\n.abledom-notifications-container {\n overflow: scroll;\n max-height: calc(100vh - 100px);\n}\n\n#abledom-report.abledom-align-right .abledom-notifications-container {\n text-align: right;\n}\n\n.abledom-notification-container {\n backdrop-filter: blur(3px);\n border-radius: 8px;\n box-shadow: 0px 0px 4px rgba(127, 127, 127, 0.5);\n display: inline-flex;\n margin: 2px 0;\n}\n\n.abledom-notification {\n background-color: rgba(164, 2, 2, 0.7);\n border-radius: 8px;\n color: white;\n display: inline flex;\n font-family: Arial, Helvetica, sans-serif;\n font-size: 16px;\n line-height: 26px;\n padding: 4px;\n}\n.abledom-notification_warning {\n background-color: rgba(163, 82, 1, 0.7);\n}\n.abledom-notification_info {\n background-color: rgba(0, 0, 255, 0.7);\n}\n\n.abledom-notification .button {\n all: unset;\n color: #000;\n cursor: pointer;\n background: linear-gradient(\n 180deg,\n rgba(255, 255, 255, 1) 0%,\n rgba(200, 200, 200, 1) 100%\n );\n border-radius: 6px;\n border: 1px solid rgba(255, 255, 255, 0.4);\n box-sizing: border-box;\n line-height: 0px;\n margin-right: 4px;\n max-height: 26px;\n padding: 2px;\n text-decoration: none;\n}\n\n.abledom-notification .button:hover {\n opacity: 0.7;\n}\n\n.abledom-notification .button.close {\n background: none;\n border-color: transparent;\n color: #fff;\n margin: 0;\n}\n\n.abledom-highlight {\n background-color: yellow;\n border: 1px solid red;\n box-sizing: border-box;\n display: none;\n opacity: 0.6;\n position: absolute;\n z-index: 100499;\n}\n";
62
62
 
63
+ // src/ui/domBuilder.ts
64
+ var DOMBuilder = class {
65
+ // static fromString(parent: HTMLElement | DocumentFragment, html: string): void {
66
+ // // const builder = new DOMBuilder(parent);
67
+ // }
68
+ constructor(parent) {
69
+ __publicField(this, "_doc");
70
+ __publicField(this, "_stack");
71
+ this._doc = parent.ownerDocument;
72
+ this._stack = [parent];
73
+ }
74
+ openTag(tagName, attributes, callback, namespace) {
75
+ var _a, _b;
76
+ const parent = this._stack[0];
77
+ const element = namespace ? (_a = this._doc) == null ? void 0 : _a.createElementNS(namespace, tagName) : (_b = this._doc) == null ? void 0 : _b.createElement(tagName);
78
+ if (parent && element) {
79
+ if (attributes) {
80
+ for (const [key, value] of Object.entries(attributes)) {
81
+ if (key === "class") {
82
+ element.className = value;
83
+ } else if (key === "style") {
84
+ element.style.cssText = value;
85
+ } else {
86
+ element.setAttribute(key, value);
87
+ }
88
+ }
89
+ }
90
+ if (callback) {
91
+ callback(element);
92
+ }
93
+ parent.appendChild(element);
94
+ this._stack.unshift(element);
95
+ }
96
+ return this;
97
+ }
98
+ closeTag() {
99
+ if (this._stack.length <= 1) {
100
+ throw new Error("Nothing to close");
101
+ }
102
+ this._stack.shift();
103
+ return this;
104
+ }
105
+ text(text) {
106
+ var _a;
107
+ (_a = this._stack[0]) == null ? void 0 : _a.appendChild(document.createTextNode(text));
108
+ return this;
109
+ }
110
+ element(callback) {
111
+ callback(this._stack[0]);
112
+ return this;
113
+ }
114
+ };
115
+
63
116
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/close.svg
64
- var close_default = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor"\n stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n xmlns="http://www.w3.org/2000/svg">\n <circle cx="12" cy="12" r="10"/>\n <line x1="15" y1="9" x2="9" y2="15"/>\n <line x1="9" y1="9" x2="15" y2="15"/>\n</svg>\n';
117
+ var close_default = function buildSVG(parent) {
118
+ const builder = new DOMBuilder(parent);
119
+ builder.openTag("svg", { "width": "20", "height": "20", "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "xmlns": "http://www.w3.org/2000/svg" }, void 0, "http://www.w3.org/2000/svg");
120
+ builder.openTag("circle", { "cx": "12", "cy": "12", "r": "10" }, void 0, "http://www.w3.org/2000/svg");
121
+ builder.closeTag();
122
+ builder.openTag("line", { "x1": "15", "y1": "9", "x2": "9", "y2": "15" }, void 0, "http://www.w3.org/2000/svg");
123
+ builder.closeTag();
124
+ builder.openTag("line", { "x1": "9", "y1": "9", "x2": "15", "y2": "15" }, void 0, "http://www.w3.org/2000/svg");
125
+ builder.closeTag();
126
+ builder.closeTag();
127
+ return parent.firstElementChild;
128
+ };
65
129
 
66
130
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/help.svg
67
- var help_default = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none"\n stroke="currentColor" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg">\n <circle cx="12" cy="12" r="10"/>\n <path d="M9.09 9a3 3 0 1 1 5.83 1c-.28 1.02-1.22 1.5-2.01 2.1-.76.58-1 1.1-1 2"/>\n <circle cx="12" cy="17" r="0.5"/>\n</svg>';
131
+ var help_default = function buildSVG2(parent) {
132
+ const builder = new DOMBuilder(parent);
133
+ builder.openTag("svg", { "width": "20", "height": "20", "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "xmlns": "http://www.w3.org/2000/svg" }, void 0, "http://www.w3.org/2000/svg");
134
+ builder.openTag("circle", { "cx": "12", "cy": "12", "r": "10" }, void 0, "http://www.w3.org/2000/svg");
135
+ builder.closeTag();
136
+ builder.openTag("path", { "d": "M9.09 9a3 3 0 1 1 5.83 1c-.28 1.02-1.22 1.5-2.01 2.1-.76.58-1 1.1-1 2" }, void 0, "http://www.w3.org/2000/svg");
137
+ builder.closeTag();
138
+ builder.openTag("circle", { "cx": "12", "cy": "17", "r": "0.5" }, void 0, "http://www.w3.org/2000/svg");
139
+ builder.closeTag();
140
+ builder.closeTag();
141
+ return parent.firstElementChild;
142
+ };
68
143
 
69
144
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/log.svg
70
- var log_default = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor"\n stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n xmlns="http://www.w3.org/2000/svg">\n <polyline points="4 7 9 12 4 17"/>\n <line x1="11" y1="19" x2="20" y2="19"/>\n</svg>';
145
+ var log_default = function buildSVG3(parent) {
146
+ const builder = new DOMBuilder(parent);
147
+ builder.openTag("svg", { "width": "20", "height": "20", "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "xmlns": "http://www.w3.org/2000/svg" }, void 0, "http://www.w3.org/2000/svg");
148
+ builder.openTag("polyline", { "points": "4 7 9 12 4 17" }, void 0, "http://www.w3.org/2000/svg");
149
+ builder.closeTag();
150
+ builder.openTag("line", { "x1": "11", "y1": "19", "x2": "20", "y2": "19" }, void 0, "http://www.w3.org/2000/svg");
151
+ builder.closeTag();
152
+ builder.closeTag();
153
+ return parent.firstElementChild;
154
+ };
71
155
 
72
156
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/reveal.svg
73
- var reveal_default = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor"\n stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n xmlns="http://www.w3.org/2000/svg">\n <circle cx="12" cy="12" r="10"/>\n <line x1="12" y1="2" x2="12" y2="6"/>\n <line x1="12" y1="18" x2="12" y2="22"/>\n <line x1="2" y1="12" x2="6" y2="12"/>\n <line x1="18" y1="12" x2="22" y2="12"/>\n</svg>';
157
+ var reveal_default = function buildSVG4(parent) {
158
+ const builder = new DOMBuilder(parent);
159
+ builder.openTag("svg", { "width": "20", "height": "20", "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "xmlns": "http://www.w3.org/2000/svg" }, void 0, "http://www.w3.org/2000/svg");
160
+ builder.openTag("circle", { "cx": "12", "cy": "12", "r": "10" }, void 0, "http://www.w3.org/2000/svg");
161
+ builder.closeTag();
162
+ builder.openTag("line", { "x1": "12", "y1": "2", "x2": "12", "y2": "6" }, void 0, "http://www.w3.org/2000/svg");
163
+ builder.closeTag();
164
+ builder.openTag("line", { "x1": "12", "y1": "18", "x2": "12", "y2": "22" }, void 0, "http://www.w3.org/2000/svg");
165
+ builder.closeTag();
166
+ builder.openTag("line", { "x1": "2", "y1": "12", "x2": "6", "y2": "12" }, void 0, "http://www.w3.org/2000/svg");
167
+ builder.closeTag();
168
+ builder.openTag("line", { "x1": "18", "y1": "12", "x2": "22", "y2": "12" }, void 0, "http://www.w3.org/2000/svg");
169
+ builder.closeTag();
170
+ builder.closeTag();
171
+ return parent.firstElementChild;
172
+ };
74
173
 
75
174
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/hideall.svg
76
- var hideall_default = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor">\n <path d="M11.44 17.5a1.67 1.67 0 0 1-2.89 0" stroke-width="1.5"/>\n <path d="M15 6.67a5 5 0 0 0-10 0v4.17a1.67 1.67 0 0 1-.83 1.44L3.33 14.17h13.34l-0.83-1.89a1.67 1.67 0 0 1-.83-1.44V6.67z" stroke-width="1.5"/>\n <line x1="1.67" y1="1.67" x2="18.33" y2="18.33" stroke-width="1.5"/>\n</svg>\n';
175
+ var hideall_default = function buildSVG5(parent) {
176
+ const builder = new DOMBuilder(parent);
177
+ builder.openTag("svg", { "width": "20", "height": "20", "viewBox": "0 0 20 20", "fill": "none", "stroke": "currentColor" }, void 0, "http://www.w3.org/2000/svg");
178
+ builder.openTag("path", { "d": "M11.44 17.5a1.67 1.67 0 0 1-2.89 0", "stroke-width": "1.5" }, void 0, "http://www.w3.org/2000/svg");
179
+ builder.closeTag();
180
+ builder.openTag("path", { "d": "M15 6.67a5 5 0 0 0-10 0v4.17a1.67 1.67 0 0 1-.83 1.44L3.33 14.17h13.34l-0.83-1.89a1.67 1.67 0 0 1-.83-1.44V6.67z", "stroke-width": "1.5" }, void 0, "http://www.w3.org/2000/svg");
181
+ builder.closeTag();
182
+ builder.openTag("line", { "x1": "1.67", "y1": "1.67", "x2": "18.33", "y2": "18.33", "stroke-width": "1.5" }, void 0, "http://www.w3.org/2000/svg");
183
+ builder.closeTag();
184
+ builder.closeTag();
185
+ return parent.firstElementChild;
186
+ };
77
187
 
78
188
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/muteall.svg
79
- var muteall_default = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor">\n <path d="M11.44 17.5a1.67 1.67 0 0 1-2.89 0" stroke-width="1.5"/>\n <path d="M15 6.67a5 5 0 0 0-10 0v4.17a1.67 1.67 0 0 1-.83 1.44L3.33 14.17h13.34l-0.83-1.89a1.67 1.67 0 0 1-.83-1.44V6.67z" stroke-width="1.5"/>\n <line x1="1.67" y1="1.67" x2="18.33" y2="18.33" stroke-width="1.5"/>\n <line x1="18.33" y1="1.67" x2="1.67" y2="18.33" stroke-width="1.5"/>\n</svg>\n';
189
+ var muteall_default = function buildSVG6(parent) {
190
+ const builder = new DOMBuilder(parent);
191
+ builder.openTag("svg", { "width": "20", "height": "20", "viewBox": "0 0 20 20", "fill": "none", "stroke": "currentColor" }, void 0, "http://www.w3.org/2000/svg");
192
+ builder.openTag("path", { "d": "M11.44 17.5a1.67 1.67 0 0 1-2.89 0", "stroke-width": "1.5" }, void 0, "http://www.w3.org/2000/svg");
193
+ builder.closeTag();
194
+ builder.openTag("path", { "d": "M15 6.67a5 5 0 0 0-10 0v4.17a1.67 1.67 0 0 1-.83 1.44L3.33 14.17h13.34l-0.83-1.89a1.67 1.67 0 0 1-.83-1.44V6.67z", "stroke-width": "1.5" }, void 0, "http://www.w3.org/2000/svg");
195
+ builder.closeTag();
196
+ builder.openTag("line", { "x1": "1.67", "y1": "1.67", "x2": "18.33", "y2": "18.33", "stroke-width": "1.5" }, void 0, "http://www.w3.org/2000/svg");
197
+ builder.closeTag();
198
+ builder.openTag("line", { "x1": "18.33", "y1": "1.67", "x2": "1.67", "y2": "18.33", "stroke-width": "1.5" }, void 0, "http://www.w3.org/2000/svg");
199
+ builder.closeTag();
200
+ builder.closeTag();
201
+ return parent.firstElementChild;
202
+ };
80
203
 
81
204
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/showall.svg
82
- var showall_default = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor">\n <path d="M11.44 17.5a1.67 1.67 0 0 1-2.89 0" stroke-width="1.5"/>\n <path d="M15 6.67a5 5 0 0 0-10 0v4.17a1.67 1.67 0 0 1-.83 1.44L3.33 14.17h13.34l-0.83-1.89a1.67 1.67 0 0 1-.83-1.44V6.67z" stroke-width="1.5"/>\n</svg>\n';
205
+ var showall_default = function buildSVG7(parent) {
206
+ const builder = new DOMBuilder(parent);
207
+ builder.openTag("svg", { "width": "20", "height": "20", "viewBox": "0 0 20 20", "fill": "none", "stroke": "currentColor" }, void 0, "http://www.w3.org/2000/svg");
208
+ builder.openTag("path", { "d": "M11.44 17.5a1.67 1.67 0 0 1-2.89 0", "stroke-width": "1.5" }, void 0, "http://www.w3.org/2000/svg");
209
+ builder.closeTag();
210
+ builder.openTag("path", { "d": "M15 6.67a5 5 0 0 0-10 0v4.17a1.67 1.67 0 0 1-.83 1.44L3.33 14.17h13.34l-0.83-1.89a1.67 1.67 0 0 1-.83-1.44V6.67z", "stroke-width": "1.5" }, void 0, "http://www.w3.org/2000/svg");
211
+ builder.closeTag();
212
+ builder.closeTag();
213
+ return parent.firstElementChild;
214
+ };
83
215
 
84
216
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/aligntopleft.svg
85
- var aligntopleft_default = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor">\n <rect x="3" y="3" width="6" height="6" stroke-width="2"/>\n</svg>\n';
217
+ var aligntopleft_default = function buildSVG8(parent) {
218
+ const builder = new DOMBuilder(parent);
219
+ builder.openTag("svg", { "width": "20", "height": "20", "viewBox": "0 0 20 20", "fill": "none", "stroke": "currentColor" }, void 0, "http://www.w3.org/2000/svg");
220
+ builder.openTag("rect", { "x": "3", "y": "3", "width": "6", "height": "6", "stroke-width": "2" }, void 0, "http://www.w3.org/2000/svg");
221
+ builder.closeTag();
222
+ builder.closeTag();
223
+ return parent.firstElementChild;
224
+ };
86
225
 
87
226
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/aligntopright.svg
88
- var aligntopright_default = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor">\n <rect x="11" y="3" width="6" height="6" stroke-width="2"/>\n</svg>\n';
227
+ var aligntopright_default = function buildSVG9(parent) {
228
+ const builder = new DOMBuilder(parent);
229
+ builder.openTag("svg", { "width": "20", "height": "20", "viewBox": "0 0 20 20", "fill": "none", "stroke": "currentColor" }, void 0, "http://www.w3.org/2000/svg");
230
+ builder.openTag("rect", { "x": "11", "y": "3", "width": "6", "height": "6", "stroke-width": "2" }, void 0, "http://www.w3.org/2000/svg");
231
+ builder.closeTag();
232
+ builder.closeTag();
233
+ return parent.firstElementChild;
234
+ };
89
235
 
90
236
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/alignbottomright.svg
91
- var alignbottomright_default = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor">\n <rect x="11" y="11" width="6" height="6" stroke-width="2"/>\n</svg>\n';
237
+ var alignbottomright_default = function buildSVG10(parent) {
238
+ const builder = new DOMBuilder(parent);
239
+ builder.openTag("svg", { "width": "20", "height": "20", "viewBox": "0 0 20 20", "fill": "none", "stroke": "currentColor" }, void 0, "http://www.w3.org/2000/svg");
240
+ builder.openTag("rect", { "x": "11", "y": "11", "width": "6", "height": "6", "stroke-width": "2" }, void 0, "http://www.w3.org/2000/svg");
241
+ builder.closeTag();
242
+ builder.closeTag();
243
+ return parent.firstElementChild;
244
+ };
92
245
 
93
246
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/alignbottomleft.svg
94
- var alignbottomleft_default = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor">\n <rect x="3" y="11" width="6" height="6" stroke-width="2"/>\n</svg>\n';
247
+ var alignbottomleft_default = function buildSVG11(parent) {
248
+ const builder = new DOMBuilder(parent);
249
+ builder.openTag("svg", { "width": "20", "height": "20", "viewBox": "0 0 20 20", "fill": "none", "stroke": "currentColor" }, void 0, "http://www.w3.org/2000/svg");
250
+ builder.openTag("rect", { "x": "3", "y": "11", "width": "6", "height": "6", "stroke-width": "2" }, void 0, "http://www.w3.org/2000/svg");
251
+ builder.closeTag();
252
+ builder.closeTag();
253
+ return parent.firstElementChild;
254
+ };
95
255
 
96
256
  // src/ui/ui.ts
97
257
  var pressedClass = "pressed";
98
- function createTrustedHTML(win, html) {
99
- var _a, _b;
100
- const escapeHTMLPolicy = (_b = (_a = win.trustedTypes) == null ? void 0 : _a.createPolicy) == null ? void 0 : _b.call(_a, "forceInner", {
101
- createHTML: (html2) => html2
102
- });
103
- return escapeHTMLPolicy ? escapeHTMLPolicy.createHTML(html) : html;
104
- }
105
258
  var _NotificationUI = class _NotificationUI {
106
259
  constructor(win, rule) {
107
260
  __publicField(this, "_win");
@@ -129,68 +282,90 @@ var _NotificationUI = class _NotificationUI {
129
282
  return instance._wrapper;
130
283
  }
131
284
  update(notification) {
132
- var _a;
133
285
  const win = this._win;
134
286
  const rule = this._rule;
135
287
  const wrapper = this._wrapper;
136
288
  const element = notification.element;
137
289
  wrapper.__abledomui = true;
138
- wrapper.innerHTML = createTrustedHTML(
139
- win,
140
- `
141
- <div class="abledom-notification-container"><div class="abledom-notification${rule.type === 2 /* Warning */ ? " abledom-notification_warning" : rule.type === 3 /* Info */ ? " abledom-notification_info" : ""}">
142
- <button class="button" title="Log to Console">${log_default}</button>
143
- <button class="button" title="Reveal in Elements panel">${reveal_default}</button>
144
- ${notification.message}
145
- <a href class="button close" href="/" title="Open help" target="_blank">${help_default}</a>
146
- <button class="button close" class="close" title="Hide">${close_default}</button>
147
- </div></div>`
148
- );
149
- const container = wrapper.firstElementChild;
150
- const buttons = wrapper.querySelectorAll("button");
151
- const logButton = buttons[0];
152
- const revealButton = buttons[1];
153
- const closeButton = buttons[2];
154
- logButton.onclick = () => {
155
- console.error(
156
- "AbleDOM: ",
157
- "\nmessage:",
158
- notification.message,
159
- "\nelement:",
160
- element,
161
- ...notification.rel ? ["\nrelative:", notification.rel] : [],
162
- "\nnotification:",
163
- notification
164
- );
165
- };
166
- const hasDevTools = !!((_a = win.__ableDOMDevtools) == null ? void 0 : _a.revealElement) && false;
167
- if (hasDevTools && element && win.document.body.contains(element)) {
168
- revealButton.onclick = () => {
169
- var _a2;
170
- const revealElement = (_a2 = win.__ableDOMDevtools) == null ? void 0 : _a2.revealElement;
171
- if (revealElement && win.document.body.contains(element)) {
172
- revealElement(element).then((revealed) => {
173
- if (!revealed) {
290
+ wrapper.textContent = "";
291
+ new DOMBuilder(wrapper).openTag(
292
+ "div",
293
+ { class: "abledom-notification-container" },
294
+ (container) => {
295
+ container.onmouseover = () => {
296
+ var _a;
297
+ element && ((_a = _NotificationUI._highlight) == null ? void 0 : _a.highlight(element));
298
+ };
299
+ container.onmouseout = () => {
300
+ var _a;
301
+ (_a = _NotificationUI._highlight) == null ? void 0 : _a.hide();
302
+ };
303
+ }
304
+ ).openTag("div", {
305
+ class: `abledom-notification${rule.type === 2 /* Warning */ ? " abledom-notification_warning" : rule.type === 3 /* Info */ ? " abledom-notification_info" : ""}`
306
+ }).openTag(
307
+ "button",
308
+ {
309
+ class: "button",
310
+ title: "Log to Console"
311
+ },
312
+ (logButton) => {
313
+ logButton.onclick = () => {
314
+ console.error(
315
+ "AbleDOM: ",
316
+ "\nmessage:",
317
+ notification.message,
318
+ "\nelement:",
319
+ element,
320
+ ...notification.rel ? ["\nrelative:", notification.rel] : [],
321
+ "\nnotification:",
322
+ notification
323
+ );
324
+ };
325
+ }
326
+ ).element(log_default).closeTag().openTag(
327
+ "button",
328
+ {
329
+ class: "button",
330
+ title: "Reveal in Elements panel"
331
+ },
332
+ (revealButton) => {
333
+ var _a;
334
+ const hasDevTools = !!((_a = win.__ableDOMDevtools) == null ? void 0 : _a.revealElement) && false;
335
+ if (hasDevTools && element && win.document.body.contains(element)) {
336
+ revealButton.onclick = () => {
337
+ var _a2;
338
+ const revealElement = (_a2 = win.__ableDOMDevtools) == null ? void 0 : _a2.revealElement;
339
+ if (revealElement && win.document.body.contains(element)) {
340
+ revealElement(element).then((revealed) => {
341
+ if (!revealed) {
342
+ }
343
+ });
174
344
  }
175
- });
345
+ };
346
+ } else {
347
+ revealButton.style.display = "none";
176
348
  }
177
- };
178
- } else {
179
- revealButton.style.display = "none";
180
- }
181
- closeButton.onclick = () => {
182
- var _a2;
183
- this.toggle(false);
184
- (_a2 = _NotificationUI._highlight) == null ? void 0 : _a2.hide();
185
- };
186
- container.onmouseover = () => {
187
- var _a2;
188
- element && ((_a2 = _NotificationUI._highlight) == null ? void 0 : _a2.highlight(element));
189
- };
190
- container.onmouseout = () => {
191
- var _a2;
192
- (_a2 = _NotificationUI._highlight) == null ? void 0 : _a2.hide();
193
- };
349
+ }
350
+ ).element(reveal_default).closeTag().text(notification.message).openTag("a", {
351
+ class: "button close",
352
+ href: "/",
353
+ title: "Open help",
354
+ target: "_blank"
355
+ }).element(help_default).closeTag().openTag(
356
+ "button",
357
+ {
358
+ class: "button close",
359
+ title: "Hide"
360
+ },
361
+ (closeButton) => {
362
+ closeButton.onclick = () => {
363
+ var _a;
364
+ this.toggle(false);
365
+ (_a = _NotificationUI._highlight) == null ? void 0 : _a.hide();
366
+ };
367
+ }
368
+ ).element(close_default).closeTag().closeTag().closeTag();
194
369
  }
195
370
  toggle(show, initial = false) {
196
371
  var _a;
@@ -214,7 +389,6 @@ __publicField(_NotificationUI, "_highlight");
214
389
  var NotificationUI = _NotificationUI;
215
390
  var NotificationsUI = class {
216
391
  constructor(win) {
217
- __publicField(this, "_win");
218
392
  __publicField(this, "_container");
219
393
  __publicField(this, "_notificationsContainer");
220
394
  __publicField(this, "_menuElement");
@@ -227,81 +401,123 @@ var NotificationsUI = class {
227
401
  __publicField(this, "_alignBottomRightButton");
228
402
  __publicField(this, "_isMuted", false);
229
403
  __publicField(this, "_notifications", /* @__PURE__ */ new Set());
230
- var _a;
231
- this._win = win;
232
404
  const container = this._container = win.document.createElement("div");
233
405
  container.__abledomui = true;
234
406
  container.id = "abledom-report";
235
- container.innerHTML = createTrustedHTML(win, `<style>${ui_default}</style>`);
407
+ const style = document.createElement("style");
408
+ style.type = "text/css";
409
+ style.appendChild(document.createTextNode(ui_default));
410
+ container.appendChild(style);
236
411
  const notificationsContainer = this._notificationsContainer = win.document.createElement("div");
237
412
  notificationsContainer.className = "abledom-notifications-container";
238
413
  container.appendChild(notificationsContainer);
239
414
  const menuElement = this._menuElement = win.document.createElement("div");
240
415
  menuElement.className = "abledom-menu-container";
241
- menuElement.innerHTML = createTrustedHTML(
242
- win,
243
- `<div class="abledom-menu"><span class="notifications-count"></span
244
- ><button class="button" title="Show all notifications">${showall_default}</button
245
- ><button class="button" title="Hide all notifications">${hideall_default}</button
246
- ><button class="button" title="Mute newly appearing notifications">${muteall_default}</button
247
- ><button class="button align-button align-button-first pressed" title="Attach notifications to bottom left">${alignbottomleft_default}</button
248
- ><button class="button align-button" title="Attach notifications to top left">${aligntopleft_default}</button
249
- ><button class="button align-button" title="Attach notifications to top right">${aligntopright_default}</button
250
- ><button class="button align-button align-button-last" title="Attach notifications to bottom right">${alignbottomright_default}</button
251
- ></div>`
252
- );
253
- const [
254
- notificationCountElement,
255
- showAllButton,
256
- hideAllButton,
257
- muteButton,
258
- alignBottomLeftButton,
259
- alignTopLeftButton,
260
- alignTopRightButton,
261
- alignBottomRightButton
262
- ] = ((_a = menuElement.firstElementChild) == null ? void 0 : _a.childNodes) || [];
263
- if (notificationCountElement instanceof HTMLSpanElement && showAllButton instanceof HTMLButtonElement && hideAllButton instanceof HTMLButtonElement && muteButton instanceof HTMLButtonElement && alignBottomLeftButton instanceof HTMLButtonElement && alignTopLeftButton instanceof HTMLButtonElement && alignTopRightButton instanceof HTMLButtonElement && alignBottomRightButton instanceof HTMLButtonElement) {
264
- container.appendChild(menuElement);
265
- this._notificationCountElement = notificationCountElement;
266
- this._showAllButton = showAllButton;
267
- this._hideAllButton = hideAllButton;
268
- this._alignBottomLeftButton = alignBottomLeftButton;
269
- this._alignTopLeftButton = alignTopLeftButton;
270
- this._alignTopRightButton = alignTopRightButton;
271
- this._alignBottomRightButton = alignBottomRightButton;
272
- showAllButton.onclick = () => {
273
- this.showAll();
274
- };
275
- hideAllButton.onclick = () => {
276
- this.hideAll();
277
- };
278
- muteButton.onclick = () => {
279
- const isMuted = this._isMuted = muteButton.classList.toggle(pressedClass);
280
- if (isMuted) {
281
- muteButton.setAttribute(
282
- "title",
283
- "Unmute newly appearing notifications"
284
- );
285
- } else {
286
- muteButton.setAttribute(
287
- "title",
288
- "Mute newly appearing notifications"
289
- );
290
- }
291
- };
292
- alignBottomLeftButton.onclick = () => {
293
- this.setUIAlignment("bottom-left" /* BottomLeft */);
294
- };
295
- alignBottomRightButton.onclick = () => {
296
- this.setUIAlignment("bottom-right" /* BottomRight */);
297
- };
298
- alignTopLeftButton.onclick = () => {
299
- this.setUIAlignment("top-left" /* TopLeft */);
300
- };
301
- alignTopRightButton.onclick = () => {
302
- this.setUIAlignment("top-right" /* TopRight */);
303
- };
304
- }
416
+ container.appendChild(menuElement);
417
+ new DOMBuilder(menuElement).openTag("div", { class: "abledom-menu" }).openTag(
418
+ "span",
419
+ {
420
+ class: "notifications-count",
421
+ title: "Number of notifications"
422
+ },
423
+ (notificationCountElement) => {
424
+ this._notificationCountElement = notificationCountElement;
425
+ }
426
+ ).closeTag().openTag(
427
+ "button",
428
+ {
429
+ class: "button",
430
+ title: "Show all notifications"
431
+ },
432
+ (showAllButton) => {
433
+ this._showAllButton = showAllButton;
434
+ showAllButton.onclick = () => {
435
+ this.showAll();
436
+ };
437
+ }
438
+ ).element(showall_default).closeTag().openTag(
439
+ "button",
440
+ {
441
+ class: "button",
442
+ title: "Hide all notifications"
443
+ },
444
+ (hideAllButton) => {
445
+ this._hideAllButton = hideAllButton;
446
+ hideAllButton.onclick = () => {
447
+ this.hideAll();
448
+ };
449
+ }
450
+ ).element(hideall_default).closeTag().openTag(
451
+ "button",
452
+ {
453
+ class: "button",
454
+ title: "Mute newly appearing notifications"
455
+ },
456
+ (muteButton) => {
457
+ muteButton.onclick = () => {
458
+ const isMuted = this._isMuted = muteButton.classList.toggle(pressedClass);
459
+ if (isMuted) {
460
+ muteButton.setAttribute(
461
+ "title",
462
+ "Unmute newly appearing notifications"
463
+ );
464
+ } else {
465
+ muteButton.setAttribute(
466
+ "title",
467
+ "Mute newly appearing notifications"
468
+ );
469
+ }
470
+ };
471
+ }
472
+ ).element(muteall_default).closeTag().openTag(
473
+ "button",
474
+ {
475
+ class: "button align-button align-button-first pressed",
476
+ title: "Attach notifications to bottom left"
477
+ },
478
+ (alignBottomLeftButton) => {
479
+ this._alignBottomLeftButton = alignBottomLeftButton;
480
+ alignBottomLeftButton.onclick = () => {
481
+ this.setUIAlignment("bottom-left" /* BottomLeft */);
482
+ };
483
+ }
484
+ ).element(alignbottomleft_default).closeTag().openTag(
485
+ "button",
486
+ {
487
+ class: "button align-button",
488
+ title: "Attach notifications to top left"
489
+ },
490
+ (alignTopLeftButton) => {
491
+ this._alignTopLeftButton = alignTopLeftButton;
492
+ alignTopLeftButton.onclick = () => {
493
+ this.setUIAlignment("top-left" /* TopLeft */);
494
+ };
495
+ }
496
+ ).element(aligntopleft_default).closeTag().openTag(
497
+ "button",
498
+ {
499
+ class: "button align-button",
500
+ title: "Attach notifications to top right"
501
+ },
502
+ (alignTopRightButton) => {
503
+ this._alignTopRightButton = alignTopRightButton;
504
+ alignTopRightButton.onclick = () => {
505
+ this.setUIAlignment("top-right" /* TopRight */);
506
+ };
507
+ }
508
+ ).element(aligntopright_default).closeTag().openTag(
509
+ "button",
510
+ {
511
+ class: "button align-button align-button-last",
512
+ title: "Attach notifications to bottom right"
513
+ },
514
+ (alignBottomRightButton) => {
515
+ this._alignBottomRightButton = alignBottomRightButton;
516
+ alignBottomRightButton.onclick = () => {
517
+ this.setUIAlignment("bottom-right" /* BottomRight */);
518
+ };
519
+ }
520
+ ).element(alignbottomright_default).closeTag().closeTag();
305
521
  win.document.body.appendChild(container);
306
522
  }
307
523
  setUIAlignment(alignment) {
@@ -347,10 +563,8 @@ var NotificationsUI = class {
347
563
  _setNotificationsCount(count) {
348
564
  const countElement = this._notificationCountElement;
349
565
  if (countElement && count > 0) {
350
- countElement.innerHTML = createTrustedHTML(
351
- this._win,
352
- `<strong>${count}</strong> notification${count > 1 ? "s" : ""}`
353
- );
566
+ countElement.textContent = "";
567
+ new DOMBuilder(countElement).openTag("strong").text(`${count}`).closeTag().text(` notification${count > 1 ? "s" : ""}`);
354
568
  this._menuElement.style.display = "block";
355
569
  } else {
356
570
  this._menuElement.style.display = "none";