abledom 0.0.2 → 0.0.4
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 +279 -74
- package/dist/esm/index.js.map +1 -1
- package/dist/index.js +279 -74
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/esm/index.js
CHANGED
|
@@ -60,38 +60,198 @@ 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
|
+
builder(buildDOM) {
|
|
111
|
+
buildDOM(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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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";
|
|
@@ -122,65 +282,90 @@ var _NotificationUI = class _NotificationUI {
|
|
|
122
282
|
return instance._wrapper;
|
|
123
283
|
}
|
|
124
284
|
update(notification) {
|
|
125
|
-
var _a;
|
|
126
285
|
const win = this._win;
|
|
127
286
|
const rule = this._rule;
|
|
128
287
|
const wrapper = this._wrapper;
|
|
129
288
|
const element = notification.element;
|
|
130
289
|
wrapper.__abledomui = true;
|
|
131
|
-
wrapper.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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
|
+
).builder(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
|
+
});
|
|
164
344
|
}
|
|
165
|
-
}
|
|
345
|
+
};
|
|
346
|
+
} else {
|
|
347
|
+
revealButton.style.display = "none";
|
|
166
348
|
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
349
|
+
}
|
|
350
|
+
).builder(reveal_default).closeTag().text(notification.message).openTag("a", {
|
|
351
|
+
class: "button close",
|
|
352
|
+
href: "/",
|
|
353
|
+
title: "Open help",
|
|
354
|
+
target: "_blank"
|
|
355
|
+
}).builder(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
|
+
).builder(close_default).closeTag().closeTag().closeTag();
|
|
184
369
|
}
|
|
185
370
|
toggle(show, initial = false) {
|
|
186
371
|
var _a;
|
|
@@ -220,21 +405,40 @@ var NotificationsUI = class {
|
|
|
220
405
|
const container = this._container = win.document.createElement("div");
|
|
221
406
|
container.__abledomui = true;
|
|
222
407
|
container.id = "abledom-report";
|
|
223
|
-
|
|
408
|
+
const style = document.createElement("style");
|
|
409
|
+
style.type = "text/css";
|
|
410
|
+
style.appendChild(document.createTextNode(ui_default));
|
|
411
|
+
container.appendChild(style);
|
|
224
412
|
const notificationsContainer = this._notificationsContainer = win.document.createElement("div");
|
|
225
413
|
notificationsContainer.className = "abledom-notifications-container";
|
|
226
414
|
container.appendChild(notificationsContainer);
|
|
227
415
|
const menuElement = this._menuElement = win.document.createElement("div");
|
|
228
416
|
menuElement.className = "abledom-menu-container";
|
|
229
|
-
menuElement.
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
417
|
+
new DOMBuilder(menuElement).openTag("div", { class: "abledom-menu" }).openTag("span", {
|
|
418
|
+
class: "notifications-count",
|
|
419
|
+
title: "Number of notifications"
|
|
420
|
+
}).closeTag().openTag("button", {
|
|
421
|
+
class: "button",
|
|
422
|
+
title: "Show all notifications"
|
|
423
|
+
}).builder(showall_default).closeTag().openTag("button", {
|
|
424
|
+
class: "button",
|
|
425
|
+
title: "Hide all notifications"
|
|
426
|
+
}).builder(hideall_default).closeTag().openTag("button", {
|
|
427
|
+
class: "button",
|
|
428
|
+
title: "Mute newly appearing notifications"
|
|
429
|
+
}).builder(muteall_default).closeTag().openTag("button", {
|
|
430
|
+
class: "button align-button align-button-first pressed",
|
|
431
|
+
title: "Attach notifications to bottom left"
|
|
432
|
+
}).builder(alignbottomleft_default).closeTag().openTag("button", {
|
|
433
|
+
class: "button align-button",
|
|
434
|
+
title: "Attach notifications to top left"
|
|
435
|
+
}).builder(aligntopleft_default).closeTag().openTag("button", {
|
|
436
|
+
class: "button align-button",
|
|
437
|
+
title: "Attach notifications to top right"
|
|
438
|
+
}).builder(aligntopright_default).closeTag().openTag("button", {
|
|
439
|
+
class: "button align-button align-button-last",
|
|
440
|
+
title: "Attach notifications to bottom right"
|
|
441
|
+
}).builder(alignbottomright_default).closeTag().closeTag();
|
|
238
442
|
const [
|
|
239
443
|
notificationCountElement,
|
|
240
444
|
showAllButton,
|
|
@@ -332,7 +536,8 @@ var NotificationsUI = class {
|
|
|
332
536
|
_setNotificationsCount(count) {
|
|
333
537
|
const countElement = this._notificationCountElement;
|
|
334
538
|
if (countElement && count > 0) {
|
|
335
|
-
countElement.
|
|
539
|
+
countElement.textContent = "";
|
|
540
|
+
new DOMBuilder(countElement).openTag("strong").text(`${count}`).closeTag().text(` notification${count > 1 ? "s" : ""}`);
|
|
336
541
|
this._menuElement.style.display = "block";
|
|
337
542
|
} else {
|
|
338
543
|
this._menuElement.style.display = "none";
|