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/index.js CHANGED
@@ -98,48 +98,201 @@ var ValidationRule = class {
98
98
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/ui.css
99
99
  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";
100
100
 
101
+ // src/ui/domBuilder.ts
102
+ var DOMBuilder = class {
103
+ // static fromString(parent: HTMLElement | DocumentFragment, html: string): void {
104
+ // // const builder = new DOMBuilder(parent);
105
+ // }
106
+ constructor(parent) {
107
+ __publicField(this, "_doc");
108
+ __publicField(this, "_stack");
109
+ this._doc = parent.ownerDocument;
110
+ this._stack = [parent];
111
+ }
112
+ openTag(tagName, attributes, callback, namespace) {
113
+ var _a, _b;
114
+ const parent = this._stack[0];
115
+ const element = namespace ? (_a = this._doc) == null ? void 0 : _a.createElementNS(namespace, tagName) : (_b = this._doc) == null ? void 0 : _b.createElement(tagName);
116
+ if (parent && element) {
117
+ if (attributes) {
118
+ for (const [key, value] of Object.entries(attributes)) {
119
+ if (key === "class") {
120
+ element.className = value;
121
+ } else if (key === "style") {
122
+ element.style.cssText = value;
123
+ } else {
124
+ element.setAttribute(key, value);
125
+ }
126
+ }
127
+ }
128
+ if (callback) {
129
+ callback(element);
130
+ }
131
+ parent.appendChild(element);
132
+ this._stack.unshift(element);
133
+ }
134
+ return this;
135
+ }
136
+ closeTag() {
137
+ if (this._stack.length <= 1) {
138
+ throw new Error("Nothing to close");
139
+ }
140
+ this._stack.shift();
141
+ return this;
142
+ }
143
+ text(text) {
144
+ var _a;
145
+ (_a = this._stack[0]) == null ? void 0 : _a.appendChild(document.createTextNode(text));
146
+ return this;
147
+ }
148
+ element(callback) {
149
+ callback(this._stack[0]);
150
+ return this;
151
+ }
152
+ };
153
+
101
154
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/close.svg
102
- 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';
155
+ var close_default = function buildSVG(parent) {
156
+ const builder = new DOMBuilder(parent);
157
+ 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");
158
+ builder.openTag("circle", { "cx": "12", "cy": "12", "r": "10" }, void 0, "http://www.w3.org/2000/svg");
159
+ builder.closeTag();
160
+ builder.openTag("line", { "x1": "15", "y1": "9", "x2": "9", "y2": "15" }, void 0, "http://www.w3.org/2000/svg");
161
+ builder.closeTag();
162
+ builder.openTag("line", { "x1": "9", "y1": "9", "x2": "15", "y2": "15" }, void 0, "http://www.w3.org/2000/svg");
163
+ builder.closeTag();
164
+ builder.closeTag();
165
+ return parent.firstElementChild;
166
+ };
103
167
 
104
168
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/help.svg
105
- 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>';
169
+ var help_default = function buildSVG2(parent) {
170
+ const builder = new DOMBuilder(parent);
171
+ 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");
172
+ builder.openTag("circle", { "cx": "12", "cy": "12", "r": "10" }, void 0, "http://www.w3.org/2000/svg");
173
+ builder.closeTag();
174
+ 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");
175
+ builder.closeTag();
176
+ builder.openTag("circle", { "cx": "12", "cy": "17", "r": "0.5" }, void 0, "http://www.w3.org/2000/svg");
177
+ builder.closeTag();
178
+ builder.closeTag();
179
+ return parent.firstElementChild;
180
+ };
106
181
 
107
182
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/log.svg
108
- 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>';
183
+ var log_default = function buildSVG3(parent) {
184
+ const builder = new DOMBuilder(parent);
185
+ 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");
186
+ builder.openTag("polyline", { "points": "4 7 9 12 4 17" }, void 0, "http://www.w3.org/2000/svg");
187
+ builder.closeTag();
188
+ builder.openTag("line", { "x1": "11", "y1": "19", "x2": "20", "y2": "19" }, void 0, "http://www.w3.org/2000/svg");
189
+ builder.closeTag();
190
+ builder.closeTag();
191
+ return parent.firstElementChild;
192
+ };
109
193
 
110
194
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/reveal.svg
111
- 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>';
195
+ var reveal_default = function buildSVG4(parent) {
196
+ const builder = new DOMBuilder(parent);
197
+ 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");
198
+ builder.openTag("circle", { "cx": "12", "cy": "12", "r": "10" }, void 0, "http://www.w3.org/2000/svg");
199
+ builder.closeTag();
200
+ builder.openTag("line", { "x1": "12", "y1": "2", "x2": "12", "y2": "6" }, void 0, "http://www.w3.org/2000/svg");
201
+ builder.closeTag();
202
+ builder.openTag("line", { "x1": "12", "y1": "18", "x2": "12", "y2": "22" }, void 0, "http://www.w3.org/2000/svg");
203
+ builder.closeTag();
204
+ builder.openTag("line", { "x1": "2", "y1": "12", "x2": "6", "y2": "12" }, void 0, "http://www.w3.org/2000/svg");
205
+ builder.closeTag();
206
+ builder.openTag("line", { "x1": "18", "y1": "12", "x2": "22", "y2": "12" }, void 0, "http://www.w3.org/2000/svg");
207
+ builder.closeTag();
208
+ builder.closeTag();
209
+ return parent.firstElementChild;
210
+ };
112
211
 
113
212
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/hideall.svg
114
- 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';
213
+ var hideall_default = function buildSVG5(parent) {
214
+ const builder = new DOMBuilder(parent);
215
+ builder.openTag("svg", { "width": "20", "height": "20", "viewBox": "0 0 20 20", "fill": "none", "stroke": "currentColor" }, void 0, "http://www.w3.org/2000/svg");
216
+ 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");
217
+ builder.closeTag();
218
+ 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");
219
+ builder.closeTag();
220
+ 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");
221
+ builder.closeTag();
222
+ builder.closeTag();
223
+ return parent.firstElementChild;
224
+ };
115
225
 
116
226
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/muteall.svg
117
- 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';
227
+ var muteall_default = function buildSVG6(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("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");
231
+ builder.closeTag();
232
+ 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");
233
+ builder.closeTag();
234
+ 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");
235
+ builder.closeTag();
236
+ 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");
237
+ builder.closeTag();
238
+ builder.closeTag();
239
+ return parent.firstElementChild;
240
+ };
118
241
 
119
242
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/showall.svg
120
- 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';
243
+ var showall_default = function buildSVG7(parent) {
244
+ const builder = new DOMBuilder(parent);
245
+ builder.openTag("svg", { "width": "20", "height": "20", "viewBox": "0 0 20 20", "fill": "none", "stroke": "currentColor" }, void 0, "http://www.w3.org/2000/svg");
246
+ 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");
247
+ builder.closeTag();
248
+ 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");
249
+ builder.closeTag();
250
+ builder.closeTag();
251
+ return parent.firstElementChild;
252
+ };
121
253
 
122
254
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/aligntopleft.svg
123
- 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';
255
+ var aligntopleft_default = function buildSVG8(parent) {
256
+ const builder = new DOMBuilder(parent);
257
+ builder.openTag("svg", { "width": "20", "height": "20", "viewBox": "0 0 20 20", "fill": "none", "stroke": "currentColor" }, void 0, "http://www.w3.org/2000/svg");
258
+ builder.openTag("rect", { "x": "3", "y": "3", "width": "6", "height": "6", "stroke-width": "2" }, void 0, "http://www.w3.org/2000/svg");
259
+ builder.closeTag();
260
+ builder.closeTag();
261
+ return parent.firstElementChild;
262
+ };
124
263
 
125
264
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/aligntopright.svg
126
- 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';
265
+ var aligntopright_default = function buildSVG9(parent) {
266
+ const builder = new DOMBuilder(parent);
267
+ builder.openTag("svg", { "width": "20", "height": "20", "viewBox": "0 0 20 20", "fill": "none", "stroke": "currentColor" }, void 0, "http://www.w3.org/2000/svg");
268
+ builder.openTag("rect", { "x": "11", "y": "3", "width": "6", "height": "6", "stroke-width": "2" }, void 0, "http://www.w3.org/2000/svg");
269
+ builder.closeTag();
270
+ builder.closeTag();
271
+ return parent.firstElementChild;
272
+ };
127
273
 
128
274
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/alignbottomright.svg
129
- 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';
275
+ var alignbottomright_default = function buildSVG10(parent) {
276
+ const builder = new DOMBuilder(parent);
277
+ builder.openTag("svg", { "width": "20", "height": "20", "viewBox": "0 0 20 20", "fill": "none", "stroke": "currentColor" }, void 0, "http://www.w3.org/2000/svg");
278
+ builder.openTag("rect", { "x": "11", "y": "11", "width": "6", "height": "6", "stroke-width": "2" }, void 0, "http://www.w3.org/2000/svg");
279
+ builder.closeTag();
280
+ builder.closeTag();
281
+ return parent.firstElementChild;
282
+ };
130
283
 
131
284
  // inline-file:/Users/marata/Documents/Work/abledom/src/ui/alignbottomleft.svg
132
- 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';
285
+ var alignbottomleft_default = function buildSVG11(parent) {
286
+ const builder = new DOMBuilder(parent);
287
+ builder.openTag("svg", { "width": "20", "height": "20", "viewBox": "0 0 20 20", "fill": "none", "stroke": "currentColor" }, void 0, "http://www.w3.org/2000/svg");
288
+ builder.openTag("rect", { "x": "3", "y": "11", "width": "6", "height": "6", "stroke-width": "2" }, void 0, "http://www.w3.org/2000/svg");
289
+ builder.closeTag();
290
+ builder.closeTag();
291
+ return parent.firstElementChild;
292
+ };
133
293
 
134
294
  // src/ui/ui.ts
135
295
  var pressedClass = "pressed";
136
- function createTrustedHTML(win, html) {
137
- var _a, _b;
138
- const escapeHTMLPolicy = (_b = (_a = win.trustedTypes) == null ? void 0 : _a.createPolicy) == null ? void 0 : _b.call(_a, "forceInner", {
139
- createHTML: (html2) => html2
140
- });
141
- return escapeHTMLPolicy ? escapeHTMLPolicy.createHTML(html) : html;
142
- }
143
296
  var _NotificationUI = class _NotificationUI {
144
297
  constructor(win, rule) {
145
298
  __publicField(this, "_win");
@@ -167,68 +320,90 @@ var _NotificationUI = class _NotificationUI {
167
320
  return instance._wrapper;
168
321
  }
169
322
  update(notification) {
170
- var _a;
171
323
  const win = this._win;
172
324
  const rule = this._rule;
173
325
  const wrapper = this._wrapper;
174
326
  const element = notification.element;
175
327
  wrapper.__abledomui = true;
176
- wrapper.innerHTML = createTrustedHTML(
177
- win,
178
- `
179
- <div class="abledom-notification-container"><div class="abledom-notification${rule.type === 2 /* Warning */ ? " abledom-notification_warning" : rule.type === 3 /* Info */ ? " abledom-notification_info" : ""}">
180
- <button class="button" title="Log to Console">${log_default}</button>
181
- <button class="button" title="Reveal in Elements panel">${reveal_default}</button>
182
- ${notification.message}
183
- <a href class="button close" href="/" title="Open help" target="_blank">${help_default}</a>
184
- <button class="button close" class="close" title="Hide">${close_default}</button>
185
- </div></div>`
186
- );
187
- const container = wrapper.firstElementChild;
188
- const buttons = wrapper.querySelectorAll("button");
189
- const logButton = buttons[0];
190
- const revealButton = buttons[1];
191
- const closeButton = buttons[2];
192
- logButton.onclick = () => {
193
- console.error(
194
- "AbleDOM: ",
195
- "\nmessage:",
196
- notification.message,
197
- "\nelement:",
198
- element,
199
- ...notification.rel ? ["\nrelative:", notification.rel] : [],
200
- "\nnotification:",
201
- notification
202
- );
203
- };
204
- const hasDevTools = !!((_a = win.__ableDOMDevtools) == null ? void 0 : _a.revealElement) && false;
205
- if (hasDevTools && element && win.document.body.contains(element)) {
206
- revealButton.onclick = () => {
207
- var _a2;
208
- const revealElement = (_a2 = win.__ableDOMDevtools) == null ? void 0 : _a2.revealElement;
209
- if (revealElement && win.document.body.contains(element)) {
210
- revealElement(element).then((revealed) => {
211
- if (!revealed) {
328
+ wrapper.textContent = "";
329
+ new DOMBuilder(wrapper).openTag(
330
+ "div",
331
+ { class: "abledom-notification-container" },
332
+ (container) => {
333
+ container.onmouseover = () => {
334
+ var _a;
335
+ element && ((_a = _NotificationUI._highlight) == null ? void 0 : _a.highlight(element));
336
+ };
337
+ container.onmouseout = () => {
338
+ var _a;
339
+ (_a = _NotificationUI._highlight) == null ? void 0 : _a.hide();
340
+ };
341
+ }
342
+ ).openTag("div", {
343
+ class: `abledom-notification${rule.type === 2 /* Warning */ ? " abledom-notification_warning" : rule.type === 3 /* Info */ ? " abledom-notification_info" : ""}`
344
+ }).openTag(
345
+ "button",
346
+ {
347
+ class: "button",
348
+ title: "Log to Console"
349
+ },
350
+ (logButton) => {
351
+ logButton.onclick = () => {
352
+ console.error(
353
+ "AbleDOM: ",
354
+ "\nmessage:",
355
+ notification.message,
356
+ "\nelement:",
357
+ element,
358
+ ...notification.rel ? ["\nrelative:", notification.rel] : [],
359
+ "\nnotification:",
360
+ notification
361
+ );
362
+ };
363
+ }
364
+ ).element(log_default).closeTag().openTag(
365
+ "button",
366
+ {
367
+ class: "button",
368
+ title: "Reveal in Elements panel"
369
+ },
370
+ (revealButton) => {
371
+ var _a;
372
+ const hasDevTools = !!((_a = win.__ableDOMDevtools) == null ? void 0 : _a.revealElement) && false;
373
+ if (hasDevTools && element && win.document.body.contains(element)) {
374
+ revealButton.onclick = () => {
375
+ var _a2;
376
+ const revealElement = (_a2 = win.__ableDOMDevtools) == null ? void 0 : _a2.revealElement;
377
+ if (revealElement && win.document.body.contains(element)) {
378
+ revealElement(element).then((revealed) => {
379
+ if (!revealed) {
380
+ }
381
+ });
212
382
  }
213
- });
383
+ };
384
+ } else {
385
+ revealButton.style.display = "none";
214
386
  }
215
- };
216
- } else {
217
- revealButton.style.display = "none";
218
- }
219
- closeButton.onclick = () => {
220
- var _a2;
221
- this.toggle(false);
222
- (_a2 = _NotificationUI._highlight) == null ? void 0 : _a2.hide();
223
- };
224
- container.onmouseover = () => {
225
- var _a2;
226
- element && ((_a2 = _NotificationUI._highlight) == null ? void 0 : _a2.highlight(element));
227
- };
228
- container.onmouseout = () => {
229
- var _a2;
230
- (_a2 = _NotificationUI._highlight) == null ? void 0 : _a2.hide();
231
- };
387
+ }
388
+ ).element(reveal_default).closeTag().text(notification.message).openTag("a", {
389
+ class: "button close",
390
+ href: "/",
391
+ title: "Open help",
392
+ target: "_blank"
393
+ }).element(help_default).closeTag().openTag(
394
+ "button",
395
+ {
396
+ class: "button close",
397
+ title: "Hide"
398
+ },
399
+ (closeButton) => {
400
+ closeButton.onclick = () => {
401
+ var _a;
402
+ this.toggle(false);
403
+ (_a = _NotificationUI._highlight) == null ? void 0 : _a.hide();
404
+ };
405
+ }
406
+ ).element(close_default).closeTag().closeTag().closeTag();
232
407
  }
233
408
  toggle(show, initial = false) {
234
409
  var _a;
@@ -252,7 +427,6 @@ __publicField(_NotificationUI, "_highlight");
252
427
  var NotificationUI = _NotificationUI;
253
428
  var NotificationsUI = class {
254
429
  constructor(win) {
255
- __publicField(this, "_win");
256
430
  __publicField(this, "_container");
257
431
  __publicField(this, "_notificationsContainer");
258
432
  __publicField(this, "_menuElement");
@@ -265,81 +439,123 @@ var NotificationsUI = class {
265
439
  __publicField(this, "_alignBottomRightButton");
266
440
  __publicField(this, "_isMuted", false);
267
441
  __publicField(this, "_notifications", /* @__PURE__ */ new Set());
268
- var _a;
269
- this._win = win;
270
442
  const container = this._container = win.document.createElement("div");
271
443
  container.__abledomui = true;
272
444
  container.id = "abledom-report";
273
- container.innerHTML = createTrustedHTML(win, `<style>${ui_default}</style>`);
445
+ const style = document.createElement("style");
446
+ style.type = "text/css";
447
+ style.appendChild(document.createTextNode(ui_default));
448
+ container.appendChild(style);
274
449
  const notificationsContainer = this._notificationsContainer = win.document.createElement("div");
275
450
  notificationsContainer.className = "abledom-notifications-container";
276
451
  container.appendChild(notificationsContainer);
277
452
  const menuElement = this._menuElement = win.document.createElement("div");
278
453
  menuElement.className = "abledom-menu-container";
279
- menuElement.innerHTML = createTrustedHTML(
280
- win,
281
- `<div class="abledom-menu"><span class="notifications-count"></span
282
- ><button class="button" title="Show all notifications">${showall_default}</button
283
- ><button class="button" title="Hide all notifications">${hideall_default}</button
284
- ><button class="button" title="Mute newly appearing notifications">${muteall_default}</button
285
- ><button class="button align-button align-button-first pressed" title="Attach notifications to bottom left">${alignbottomleft_default}</button
286
- ><button class="button align-button" title="Attach notifications to top left">${aligntopleft_default}</button
287
- ><button class="button align-button" title="Attach notifications to top right">${aligntopright_default}</button
288
- ><button class="button align-button align-button-last" title="Attach notifications to bottom right">${alignbottomright_default}</button
289
- ></div>`
290
- );
291
- const [
292
- notificationCountElement,
293
- showAllButton,
294
- hideAllButton,
295
- muteButton,
296
- alignBottomLeftButton,
297
- alignTopLeftButton,
298
- alignTopRightButton,
299
- alignBottomRightButton
300
- ] = ((_a = menuElement.firstElementChild) == null ? void 0 : _a.childNodes) || [];
301
- 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) {
302
- container.appendChild(menuElement);
303
- this._notificationCountElement = notificationCountElement;
304
- this._showAllButton = showAllButton;
305
- this._hideAllButton = hideAllButton;
306
- this._alignBottomLeftButton = alignBottomLeftButton;
307
- this._alignTopLeftButton = alignTopLeftButton;
308
- this._alignTopRightButton = alignTopRightButton;
309
- this._alignBottomRightButton = alignBottomRightButton;
310
- showAllButton.onclick = () => {
311
- this.showAll();
312
- };
313
- hideAllButton.onclick = () => {
314
- this.hideAll();
315
- };
316
- muteButton.onclick = () => {
317
- const isMuted = this._isMuted = muteButton.classList.toggle(pressedClass);
318
- if (isMuted) {
319
- muteButton.setAttribute(
320
- "title",
321
- "Unmute newly appearing notifications"
322
- );
323
- } else {
324
- muteButton.setAttribute(
325
- "title",
326
- "Mute newly appearing notifications"
327
- );
328
- }
329
- };
330
- alignBottomLeftButton.onclick = () => {
331
- this.setUIAlignment("bottom-left" /* BottomLeft */);
332
- };
333
- alignBottomRightButton.onclick = () => {
334
- this.setUIAlignment("bottom-right" /* BottomRight */);
335
- };
336
- alignTopLeftButton.onclick = () => {
337
- this.setUIAlignment("top-left" /* TopLeft */);
338
- };
339
- alignTopRightButton.onclick = () => {
340
- this.setUIAlignment("top-right" /* TopRight */);
341
- };
342
- }
454
+ container.appendChild(menuElement);
455
+ new DOMBuilder(menuElement).openTag("div", { class: "abledom-menu" }).openTag(
456
+ "span",
457
+ {
458
+ class: "notifications-count",
459
+ title: "Number of notifications"
460
+ },
461
+ (notificationCountElement) => {
462
+ this._notificationCountElement = notificationCountElement;
463
+ }
464
+ ).closeTag().openTag(
465
+ "button",
466
+ {
467
+ class: "button",
468
+ title: "Show all notifications"
469
+ },
470
+ (showAllButton) => {
471
+ this._showAllButton = showAllButton;
472
+ showAllButton.onclick = () => {
473
+ this.showAll();
474
+ };
475
+ }
476
+ ).element(showall_default).closeTag().openTag(
477
+ "button",
478
+ {
479
+ class: "button",
480
+ title: "Hide all notifications"
481
+ },
482
+ (hideAllButton) => {
483
+ this._hideAllButton = hideAllButton;
484
+ hideAllButton.onclick = () => {
485
+ this.hideAll();
486
+ };
487
+ }
488
+ ).element(hideall_default).closeTag().openTag(
489
+ "button",
490
+ {
491
+ class: "button",
492
+ title: "Mute newly appearing notifications"
493
+ },
494
+ (muteButton) => {
495
+ muteButton.onclick = () => {
496
+ const isMuted = this._isMuted = muteButton.classList.toggle(pressedClass);
497
+ if (isMuted) {
498
+ muteButton.setAttribute(
499
+ "title",
500
+ "Unmute newly appearing notifications"
501
+ );
502
+ } else {
503
+ muteButton.setAttribute(
504
+ "title",
505
+ "Mute newly appearing notifications"
506
+ );
507
+ }
508
+ };
509
+ }
510
+ ).element(muteall_default).closeTag().openTag(
511
+ "button",
512
+ {
513
+ class: "button align-button align-button-first pressed",
514
+ title: "Attach notifications to bottom left"
515
+ },
516
+ (alignBottomLeftButton) => {
517
+ this._alignBottomLeftButton = alignBottomLeftButton;
518
+ alignBottomLeftButton.onclick = () => {
519
+ this.setUIAlignment("bottom-left" /* BottomLeft */);
520
+ };
521
+ }
522
+ ).element(alignbottomleft_default).closeTag().openTag(
523
+ "button",
524
+ {
525
+ class: "button align-button",
526
+ title: "Attach notifications to top left"
527
+ },
528
+ (alignTopLeftButton) => {
529
+ this._alignTopLeftButton = alignTopLeftButton;
530
+ alignTopLeftButton.onclick = () => {
531
+ this.setUIAlignment("top-left" /* TopLeft */);
532
+ };
533
+ }
534
+ ).element(aligntopleft_default).closeTag().openTag(
535
+ "button",
536
+ {
537
+ class: "button align-button",
538
+ title: "Attach notifications to top right"
539
+ },
540
+ (alignTopRightButton) => {
541
+ this._alignTopRightButton = alignTopRightButton;
542
+ alignTopRightButton.onclick = () => {
543
+ this.setUIAlignment("top-right" /* TopRight */);
544
+ };
545
+ }
546
+ ).element(aligntopright_default).closeTag().openTag(
547
+ "button",
548
+ {
549
+ class: "button align-button align-button-last",
550
+ title: "Attach notifications to bottom right"
551
+ },
552
+ (alignBottomRightButton) => {
553
+ this._alignBottomRightButton = alignBottomRightButton;
554
+ alignBottomRightButton.onclick = () => {
555
+ this.setUIAlignment("bottom-right" /* BottomRight */);
556
+ };
557
+ }
558
+ ).element(alignbottomright_default).closeTag().closeTag();
343
559
  win.document.body.appendChild(container);
344
560
  }
345
561
  setUIAlignment(alignment) {
@@ -385,10 +601,8 @@ var NotificationsUI = class {
385
601
  _setNotificationsCount(count) {
386
602
  const countElement = this._notificationCountElement;
387
603
  if (countElement && count > 0) {
388
- countElement.innerHTML = createTrustedHTML(
389
- this._win,
390
- `<strong>${count}</strong> notification${count > 1 ? "s" : ""}`
391
- );
604
+ countElement.textContent = "";
605
+ new DOMBuilder(countElement).openTag("strong").text(`${count}`).closeTag().text(` notification${count > 1 ? "s" : ""}`);
392
606
  this._menuElement.style.display = "block";
393
607
  } else {
394
608
  this._menuElement.style.display = "none";