@ntix/components-scorad 2.0.0 → 2.0.1
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/@ntix/components-scorad.es.js +351 -169
- package/dist/@ntix/components-scorad.umd.js +40 -33
- package/dist/index.d.ts +517 -20
- package/docs/HTMLScoradValueElement.md +4 -4
- package/docs/ScoradResources.md +1 -1
- package/docs/getScoradScore.md +5 -5
- package/package.json +1 -1
- package/dist/HTMLScoradValueElement.d.ts +0 -37
- package/dist/ScoradData.d.ts +0 -12
- package/dist/ScoradExtentData.d.ts +0 -21
- package/dist/ScoradExtentWeights.d.ts +0 -5
- package/dist/ScoradIntensityData.d.ts +0 -22
- package/dist/ScoradResources.d.ts +0 -20
- package/dist/ScoradScore.d.ts +0 -20
- package/dist/ScoradSubjectiveData.d.ts +0 -14
- package/dist/component.d.ts +0 -43
- package/dist/componentsScoradLogger.d.ts +0 -6
- package/dist/constants.d.ts +0 -37
- package/dist/extent/component.d.ts +0 -61
- package/dist/extent/index.d.ts +0 -1
- package/dist/getScoradScore.d.ts +0 -10
- package/dist/intensity/component.d.ts +0 -50
- package/dist/intensity/index.d.ts +0 -1
- package/dist/label/component.d.ts +0 -11
- package/dist/label/index.d.ts +0 -1
- package/dist/options/component.d.ts +0 -22
- package/dist/options/index.d.ts +0 -1
- package/dist/selectScoradWeights.d.ts +0 -9
- package/dist/subjective/component.d.ts +0 -50
- package/dist/subjective/index.d.ts +0 -1
- package/dist/validateScoradData.d.ts +0 -15
- package/dist/weightings/component.d.ts +0 -36
- package/dist/weightings/index.d.ts +0 -1
|
@@ -9,16 +9,176 @@ var cache = /* @__PURE__ */ new Map(), asCachedStyle = (t) => t == null ? [] : (
|
|
|
9
9
|
watches: [],
|
|
10
10
|
events: []
|
|
11
11
|
}, t;
|
|
12
|
-
}
|
|
13
|
-
(()
|
|
12
|
+
}, isNumberType = (e) => (typeof e == "number" || e instanceof Number) && !isNaN(e.valueOf()), parseNumberOrNull = (e) => {
|
|
13
|
+
if (isNumberType(e)) return e;
|
|
14
|
+
let t = Number.parseFloat(e);
|
|
15
|
+
return isNaN(t) ? null : t;
|
|
16
|
+
}, parseNumber = (e) => {
|
|
17
|
+
let t = parseNumberOrNull(e);
|
|
18
|
+
if (t === null) throw Error(`Could not parse '${e}' as Number`);
|
|
19
|
+
return t;
|
|
20
|
+
}, isStringType = (e) => typeof e == "string" || e instanceof String, padNumber = (e, t) => e.toString().padStart(t, "0").slice(-t), toKebabCase = (e) => e == null ? e : e?.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (e, t) => (t ? "-" : "") + e).toLowerCase(), DATES = {
|
|
21
|
+
get MS_PER_DAY() {
|
|
22
|
+
return 864e5;
|
|
23
|
+
},
|
|
24
|
+
WEEK_START_DAY: (() => {
|
|
25
|
+
try {
|
|
26
|
+
let e = new Intl.DateTimeFormat().resolvedOptions().locale, t = new Intl.Locale(e);
|
|
27
|
+
if (typeof t.getWeekInfo == "function") {
|
|
28
|
+
let e = t.getWeekInfo().firstDay;
|
|
29
|
+
return e === 7 ? 0 : e;
|
|
30
|
+
}
|
|
31
|
+
} catch {}
|
|
32
|
+
return 1;
|
|
33
|
+
})()
|
|
34
|
+
}, getWeekNumber = (e, t, n, r = 1) => {
|
|
35
|
+
let i = new Date(e, t - 1, n, 0, 0, 0, 0), a = (i.getDay() - r + 7) % 7;
|
|
36
|
+
i.setDate(i.getDate() + 3 - a);
|
|
37
|
+
let o = new Date(i.getFullYear(), 0, 4), s = (o.getDay() - r + 7) % 7, c = (i.getTime() - o.getTime()) / DATES.MS_PER_DAY;
|
|
38
|
+
return 1 + Math.round((c - 3 + s) / 7);
|
|
39
|
+
}, isDateType = (e) => e instanceof Date && !isNaN(e.getTime());
|
|
40
|
+
(class e {
|
|
41
|
+
constructor(e, t, n) {
|
|
42
|
+
let r = Math.trunc(parseNumber(e)), i = Math.trunc(parseNumber(t)), o = Math.trunc(parseNumber(n)), s = new Date(r, i - 1, o, 0, 0, 0, 0);
|
|
43
|
+
if (s.getFullYear() !== r || s.getMonth() + 1 !== i || s.getDate() !== o) throw Error(`DateOnly 'Year:${r}, Month:${i}, Day:${o}' is not valid`);
|
|
44
|
+
this.year = r, this.month = i, this.day = o, this.dayOfWeek = s.getDay(), this.weekNumber = getWeekNumber(r, i, o, DATES.WEEK_START_DAY), this.timeMs = s.getTime(), Object.freeze(this);
|
|
45
|
+
}
|
|
46
|
+
day;
|
|
47
|
+
month;
|
|
48
|
+
year;
|
|
49
|
+
dayOfWeek;
|
|
50
|
+
weekNumber;
|
|
51
|
+
timeMs;
|
|
52
|
+
addDays(t) {
|
|
53
|
+
let n = this.toDate();
|
|
54
|
+
return n.setDate(n.getDate() + t), e.fromDate(n);
|
|
55
|
+
}
|
|
56
|
+
addMonths(t, n = {}) {
|
|
57
|
+
let { keepEndOfMonth: r = !0, preventOverflow: i = !0 } = n, a = r && this.equals(this.endOfMonth()), o = a ? this.startOfMonth().toDate() : this.toDate(), s = o.getDate();
|
|
58
|
+
if (o.setMonth(o.getMonth() + t), s !== o.getDate()) {
|
|
59
|
+
if (!i) throw Error(`addMonths overflow: ${s} does not exist in target month.`);
|
|
60
|
+
o.setDate(0);
|
|
61
|
+
}
|
|
62
|
+
return a ? e.fromDate(o).endOfMonth() : e.fromDate(o);
|
|
63
|
+
}
|
|
64
|
+
with(t) {
|
|
65
|
+
return new e(t.year ?? this.year, t.month ?? this.month, t.day ?? this.day);
|
|
66
|
+
}
|
|
67
|
+
startOfWeek() {
|
|
68
|
+
let e = (this.dayOfWeek - DATES.WEEK_START_DAY + 7) % 7;
|
|
69
|
+
return this.addDays(-e);
|
|
70
|
+
}
|
|
71
|
+
endOfWeek() {
|
|
72
|
+
return this.startOfWeek().addDays(6);
|
|
73
|
+
}
|
|
74
|
+
getWeekDates(e = (e) => e) {
|
|
75
|
+
let t = this.startOfWeek(), n = /* @__PURE__ */ new Set();
|
|
76
|
+
for (let r = 0; r < 7; r++) n.add(e(t.addDays(r)));
|
|
77
|
+
return n;
|
|
78
|
+
}
|
|
79
|
+
startOfMonth() {
|
|
80
|
+
return this.with({ day: 1 });
|
|
81
|
+
}
|
|
82
|
+
endOfMonth() {
|
|
83
|
+
let e = new Date(this.year, this.month, 0).getDate();
|
|
84
|
+
return this.with({ day: e });
|
|
85
|
+
}
|
|
86
|
+
getMonthDates(e) {
|
|
87
|
+
let t = this.startOfMonth(), n = /* @__PURE__ */ new Set(), r = this.endOfMonth().day;
|
|
88
|
+
for (let i = 0; i < r; i++) n.add(e(t.addDays(i)));
|
|
89
|
+
return n;
|
|
90
|
+
}
|
|
91
|
+
startOfYear() {
|
|
92
|
+
return this.with({
|
|
93
|
+
month: 1,
|
|
94
|
+
day: 1
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
endOfYear() {
|
|
98
|
+
return this.with({
|
|
99
|
+
month: 12,
|
|
100
|
+
day: 31
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
equals(t) {
|
|
104
|
+
return this.timeMs === e.parseOrNull(t)?.timeMs;
|
|
105
|
+
}
|
|
106
|
+
toString() {
|
|
107
|
+
return `${String(this.year).padStart(4, "0")}-${String(this.month).padStart(2, "0")}-${String(this.day).padStart(2, "0")}`;
|
|
108
|
+
}
|
|
109
|
+
toJSON() {
|
|
110
|
+
return this.toString();
|
|
111
|
+
}
|
|
112
|
+
toDate() {
|
|
113
|
+
return new Date(this.year, this.month - 1, this.day);
|
|
114
|
+
}
|
|
115
|
+
static equals = (t, n) => e.parseOrNull(t)?.equals(n) ?? !1;
|
|
116
|
+
static today = () => e.fromDate(/* @__PURE__ */ new Date());
|
|
117
|
+
static parseOrNull = (t) => {
|
|
118
|
+
if (t instanceof e) return t;
|
|
119
|
+
if (isDateType(t)) return e.fromDate(t);
|
|
120
|
+
if (isNumberType(t)) return e.fromDate(new Date(t));
|
|
121
|
+
if (isStringType(t)) try {
|
|
122
|
+
if (t.indexOf("-") === -1) return e.fromDate(new Date(t));
|
|
123
|
+
let n = t.split("-");
|
|
124
|
+
if (n.length === 3) return new e(n[0], n[1], n[2]);
|
|
125
|
+
} catch {}
|
|
126
|
+
return null;
|
|
127
|
+
};
|
|
128
|
+
static parse = (t) => {
|
|
129
|
+
let n = e.parseOrNull(t);
|
|
130
|
+
if (n === null) throw Error(`Could not parse '${t}' as DateOnly`);
|
|
131
|
+
return n;
|
|
132
|
+
};
|
|
133
|
+
static parseToSet = (t) => t == null ? t : new Set(Array.from(t, (t) => e.parse(t)));
|
|
134
|
+
static parseToStringSet = (t) => t == null ? t : new Set(Array.from(t, (t) => e.parse(t).toString()));
|
|
135
|
+
static addDays(t, n) {
|
|
136
|
+
let r = e.parse(t).toDate();
|
|
137
|
+
return r.setDate(r.getDate() + n), e.fromDate(r).toString();
|
|
138
|
+
}
|
|
139
|
+
static fromDate = (t) => new e(t.getFullYear(), t.getMonth() + 1, t.getDate());
|
|
140
|
+
static fromUTCDate = (t) => new e(t.getUTCFullYear(), t.getUTCMonth() + 1, t.getUTCDate());
|
|
141
|
+
static #e;
|
|
142
|
+
static #t;
|
|
143
|
+
static #n;
|
|
144
|
+
static #r;
|
|
145
|
+
static #i;
|
|
146
|
+
static setLocale(t, n) {
|
|
147
|
+
n = {
|
|
148
|
+
date: {
|
|
149
|
+
day: "numeric",
|
|
150
|
+
month: "short",
|
|
151
|
+
year: "2-digit"
|
|
152
|
+
},
|
|
153
|
+
dateLong: {
|
|
154
|
+
day: "numeric",
|
|
155
|
+
month: "long",
|
|
156
|
+
year: "numeric"
|
|
157
|
+
},
|
|
158
|
+
monthYear: {
|
|
159
|
+
month: "long",
|
|
160
|
+
year: "2-digit"
|
|
161
|
+
},
|
|
162
|
+
weekday: "narrow",
|
|
163
|
+
weekdayLong: "long",
|
|
164
|
+
...n ?? {}
|
|
165
|
+
}, e.#e = new Intl.DateTimeFormat(t, n.date), e.#t = new Intl.DateTimeFormat(t, n.dateLong), e.#n = new Intl.DateTimeFormat(t, n.monthYear), e.#r = new Intl.DateTimeFormat(t, { weekday: n.weekday }), e.#i = new Intl.DateTimeFormat(t, { weekday: n.weekdayLong });
|
|
166
|
+
}
|
|
167
|
+
static #a = e.setLocale("en-GB");
|
|
168
|
+
static formatDate = (t) => e.#e.format(t instanceof e ? t.toDate() : t);
|
|
169
|
+
static formatDateLong = (t) => e.#t.format(t instanceof e ? t.toDate() : t);
|
|
170
|
+
static formatMonthYear = (t) => e.#n.format(t instanceof e ? t.toDate() : t);
|
|
171
|
+
static formatWeekday = (t) => e.#r.format(new Date(1970, 0, 4 + t));
|
|
172
|
+
static formatWeekdayLong = (t) => e.#i.format(new Date(1970, 0, 4 + t));
|
|
173
|
+
}), (() => {
|
|
14
174
|
let e = "__drag_attached";
|
|
15
175
|
return { list: (t, n, r) => {
|
|
16
176
|
if (t.dataset[e]) return;
|
|
17
177
|
t.dataset[e] = "true";
|
|
18
|
-
let i = (e, n) => e.find((e) => e instanceof HTMLElement && t.contains(e) && n(e)), a = (e, n, r = () => !0) => !(e instanceof Node) || !t.contains(e) ? null : e == null || e instanceof HTMLElement && r(e) ? e : a(n(e), n, r), o = (e) => a(e?.nextSibling, (e) => e?.nextSibling), s = (e, t) => (n) => n instanceof HTMLElement && (e ?? ((e) => e.classList.contains(t)))(n), c = () => Array.from(t.children).filter(u).reduce((e, t) => e.set(t, t.getBoundingClientRect()), /* @__PURE__ */ new Map()), l = s(r?.gripSelector, "drag-grip"), u = s(r?.itemSelector, "drag-item"), d, f, p, m = 0, h, g,
|
|
178
|
+
let i = (e, n) => e.find((e) => e instanceof HTMLElement && t.contains(e) && n(e)), a = (e, n, r = () => !0) => !(e instanceof Node) || !t.contains(e) ? null : e == null || e instanceof HTMLElement && r(e) ? e : a(n(e), n, r), o = (e) => a(e?.nextSibling, (e) => e?.nextSibling), s = (e, t) => (n) => n instanceof HTMLElement && (e ?? ((e) => e.classList.contains(t)))(n), c = () => Array.from(t.children).filter(u).reduce((e, t) => e.set(t, t.getBoundingClientRect()), /* @__PURE__ */ new Map()), l = s(r?.gripSelector, "drag-grip"), u = s(r?.itemSelector, "drag-item"), d, f, p, m = 0, h, g, ze = (e) => {
|
|
19
179
|
let n = e.composedPath();
|
|
20
|
-
d = i(n, l), d && (e.preventDefault(), e.stopPropagation(), window.getSelection()?.removeAllRanges(), f = c(), p = i(n, u), m = e.clientY, h = p.dataset.id, p.classList.add("dragging"), p.style.pointerEvents = "none", p.style.zIndex = "2", t.style.touchAction = "none", t.style.userSelect = "none", document.addEventListener("pointermove",
|
|
21
|
-
},
|
|
180
|
+
d = i(n, l), d && (e.preventDefault(), e.stopPropagation(), window.getSelection()?.removeAllRanges(), f = c(), p = i(n, u), m = e.clientY, h = p.dataset.id, p.classList.add("dragging"), p.style.pointerEvents = "none", p.style.zIndex = "2", t.style.touchAction = "none", t.style.userSelect = "none", document.addEventListener("pointermove", Be), document.addEventListener("pointerup", _));
|
|
181
|
+
}, Be = (e) => {
|
|
22
182
|
if (!p || !f) throw Error("drag item is undefined");
|
|
23
183
|
let n = f.get(p), r = null;
|
|
24
184
|
for (let [t, i] of f.entries()) {
|
|
@@ -34,10 +194,10 @@ var cache = /* @__PURE__ */ new Map(), asCachedStyle = (t) => t == null ? [] : (
|
|
|
34
194
|
f = c(), m += f.get(p).top - i, d?.focus();
|
|
35
195
|
}
|
|
36
196
|
p.style.transform = `translateY(${e.clientY - m}px)`;
|
|
37
|
-
},
|
|
197
|
+
}, _ = (e) => {
|
|
38
198
|
if (!p) throw Error("drag item is undefined");
|
|
39
|
-
e.stopPropagation(), document.removeEventListener("pointermove",
|
|
40
|
-
},
|
|
199
|
+
e.stopPropagation(), document.removeEventListener("pointermove", Be), document.removeEventListener("pointerup", _), p.classList.remove("dragging"), p.style.transform = "", p.style.pointerEvents = "", p.style.zIndex = "", p = void 0, t.style.touchAction = "", t.style.userSelect = "", h && g && (n(h, g), h = void 0, g = void 0);
|
|
200
|
+
}, v = (e) => {
|
|
41
201
|
if (!e.altKey) return;
|
|
42
202
|
let r = (e, r) => {
|
|
43
203
|
let i = document.activeElement;
|
|
@@ -62,8 +222,8 @@ var cache = /* @__PURE__ */ new Map(), asCachedStyle = (t) => t == null ? [] : (
|
|
|
62
222
|
}
|
|
63
223
|
}
|
|
64
224
|
};
|
|
65
|
-
return t.addEventListener("pointerdown",
|
|
66
|
-
t.removeEventListener("pointerdown",
|
|
225
|
+
return t.addEventListener("pointerdown", ze), t.addEventListener("keydown", v), () => {
|
|
226
|
+
t.removeEventListener("pointerdown", ze), t.removeEventListener("keydown", v);
|
|
67
227
|
};
|
|
68
228
|
} };
|
|
69
229
|
})();
|
|
@@ -76,12 +236,12 @@ var FOCUSABLE = "\n button:not([disabled]), \n [href], \n input:not([di
|
|
|
76
236
|
error: 5
|
|
77
237
|
};
|
|
78
238
|
function createLogger(e, t, n) {
|
|
79
|
-
let r = () => {},
|
|
239
|
+
let r = () => {}, i = { provide: (r) => createLogger(`${e}.${r}`, t, n) };
|
|
80
240
|
for (let a of Object.keys(LogLevel)) {
|
|
81
|
-
let
|
|
82
|
-
t >
|
|
241
|
+
let o = a, s = LogLevel[o], c = n[o];
|
|
242
|
+
t > s ? i[o] = r : i[o] = ((t, ...n) => c(`[${e}]`, t, ...n));
|
|
83
243
|
}
|
|
84
|
-
return
|
|
244
|
+
return i;
|
|
85
245
|
}
|
|
86
246
|
var provideLogger = (() => {
|
|
87
247
|
let e = (e, t) => (t ??= provideLogger.defaultLevel, createLogger(e, t, provideLogger.adapter));
|
|
@@ -185,7 +345,7 @@ var Success = class {
|
|
|
185
345
|
Fail: (e) => new Failure(e),
|
|
186
346
|
isSuccess: (e) => e instanceof Success,
|
|
187
347
|
isFailure: (e) => e instanceof Failure
|
|
188
|
-
}
|
|
348
|
+
};
|
|
189
349
|
function Att(e = {}) {
|
|
190
350
|
return function(t, r) {
|
|
191
351
|
let i = e?.name ?? r, a = e?.read ?? ((e) => e), o = e?.write ?? ((e) => e);
|
|
@@ -293,34 +453,34 @@ function Component(e = { tag: void 0 }) {
|
|
|
293
453
|
o.prototype.resizeCallback && (s = new ResizeObserver((e) => {
|
|
294
454
|
o.prototype.resizeCallback?.call(e[0].target);
|
|
295
455
|
}));
|
|
296
|
-
let
|
|
456
|
+
let c = o.prototype.attributeChangedCallback ?? n;
|
|
297
457
|
o.prototype.attributeChangedCallback = function(e, t, n) {
|
|
298
|
-
if (
|
|
458
|
+
if (c(e, t, n), n !== t) {
|
|
299
459
|
var r = o.__metadata?.attributes.find((t) => t.name === e);
|
|
300
460
|
r?.read && (this[r.propertyName] = r.read(n));
|
|
301
461
|
}
|
|
302
462
|
};
|
|
303
|
-
let
|
|
463
|
+
let l = o.prototype.connectedCallback ?? n;
|
|
304
464
|
o.prototype.connectedCallback = function() {
|
|
305
|
-
a.forEach((e) => e()), (i.shadowRoot === "open" || i.shadowRoot === "closed") && !this.__shadowRoot && (this.__shadowRoot = this.attachShadow({
|
|
465
|
+
this.style.setProperty("--hem", getComputedStyle(this).fontSize), a.forEach((e) => e()), (i.shadowRoot === "open" || i.shadowRoot === "closed") && !this.__shadowRoot && (this.__shadowRoot = this.attachShadow({
|
|
306
466
|
delegatesFocus: i.delegatesFocus,
|
|
307
467
|
mode: i.shadowRoot,
|
|
308
468
|
slotAssignment: "named"
|
|
309
|
-
}), this.__shadowRoot.adoptedStyleSheets = i.css),
|
|
469
|
+
}), this.__shadowRoot.adoptedStyleSheets = i.css), l.call(this), s && s.observe(this);
|
|
310
470
|
};
|
|
311
|
-
let
|
|
471
|
+
let u = o.prototype.disconnectedCallback ?? n;
|
|
312
472
|
o.prototype.disconnectedCallback = function() {
|
|
313
|
-
|
|
473
|
+
u.call(this), s && s.unobserve(this);
|
|
314
474
|
};
|
|
315
|
-
let
|
|
475
|
+
let d = o.prototype.beforeRender ?? n, f = o.prototype.render ?? n, p = o.prototype.afterRender ?? n;
|
|
316
476
|
return o.prototype.render = async function() {
|
|
317
477
|
r.debug("render", this.tagName);
|
|
318
|
-
let e =
|
|
478
|
+
let e = d.call(this);
|
|
319
479
|
if (isPromise(e) && await e, this.__shadowRoot) {
|
|
320
|
-
let e = this.__shadowRoot, t =
|
|
480
|
+
let e = this.__shadowRoot, t = f.call(this);
|
|
321
481
|
isComponentRender(t) ? await t.render(e) : e.innerHTML = t;
|
|
322
482
|
}
|
|
323
|
-
|
|
483
|
+
p.call(this);
|
|
324
484
|
}, r.debug("define", e.tag), window.customElements.define(e.tag, o), o;
|
|
325
485
|
};
|
|
326
486
|
}
|
|
@@ -343,6 +503,11 @@ var HTMLComponentElement = class extends HTMLElement {
|
|
|
343
503
|
removeEventListener(e, t, n) {
|
|
344
504
|
super.removeEventListener(e, t, n);
|
|
345
505
|
}
|
|
506
|
+
ref(e) {
|
|
507
|
+
return (t) => {
|
|
508
|
+
this[e] = t;
|
|
509
|
+
};
|
|
510
|
+
}
|
|
346
511
|
};
|
|
347
512
|
function Watch(...e) {
|
|
348
513
|
return function(t, r) {
|
|
@@ -569,25 +734,25 @@ var html$1 = freeze(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.a
|
|
|
569
734
|
function createDOMPurify() {
|
|
570
735
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal(), t = (e) => createDOMPurify(e);
|
|
571
736
|
if (t.version = "3.3.1", t.removed = [], !e || !e.document || e.document.nodeType !== NODE_TYPE.document || !e.Element) return t.isSupported = !1, t;
|
|
572
|
-
let { document: n } = e, r = n, i = r.currentScript, { DocumentFragment: a, HTMLTemplateElement: o, Node: s, Element: c, NodeFilter: l, NamedNodeMap: u = e.NamedNodeMap || e.MozNamedAttrMap, HTMLFormElement: d, DOMParser: f, trustedTypes: p } = e, m = c.prototype, h = lookupGetter(m, "cloneNode"), g = lookupGetter(m, "remove"),
|
|
737
|
+
let { document: n } = e, r = n, i = r.currentScript, { DocumentFragment: a, HTMLTemplateElement: o, Node: s, Element: c, NodeFilter: l, NamedNodeMap: u = e.NamedNodeMap || e.MozNamedAttrMap, HTMLFormElement: d, DOMParser: f, trustedTypes: p } = e, m = c.prototype, h = lookupGetter(m, "cloneNode"), g = lookupGetter(m, "remove"), ze = lookupGetter(m, "nextSibling"), Be = lookupGetter(m, "childNodes"), _ = lookupGetter(m, "parentNode");
|
|
573
738
|
if (typeof o == "function") {
|
|
574
739
|
let e = n.createElement("template");
|
|
575
740
|
e.content && e.content.ownerDocument && (n = e.content.ownerDocument);
|
|
576
741
|
}
|
|
577
|
-
let
|
|
578
|
-
t.isSupported = typeof entries == "function" && typeof
|
|
579
|
-
let { MUSTACHE_EXPR:
|
|
742
|
+
let v, y = "", { implementation: Ve, createNodeIterator: He, createDocumentFragment: Ue, getElementsByTagName: We } = n, { importNode: Ge } = r, b = _createHooksMap();
|
|
743
|
+
t.isSupported = typeof entries == "function" && typeof _ == "function" && Ve && Ve.createHTMLDocument !== void 0;
|
|
744
|
+
let { MUSTACHE_EXPR: x, ERB_EXPR: S, TMPLIT_EXPR: C, DATA_ATTR: Ke, ARIA_ATTR: qe, IS_SCRIPT_OR_DATA: Je, ATTR_WHITESPACE: Ye, CUSTOM_ELEMENT: Xe } = EXPRESSIONS, { IS_ALLOWED_URI: Ze } = EXPRESSIONS, w = null, Qe = addToSet({}, [
|
|
580
745
|
...html$1,
|
|
581
746
|
...svg$1,
|
|
582
747
|
...svgFilters,
|
|
583
748
|
...mathMl$1,
|
|
584
749
|
...text
|
|
585
|
-
]),
|
|
750
|
+
]), T = null, $e = addToSet({}, [
|
|
586
751
|
...html$2,
|
|
587
752
|
...svg,
|
|
588
753
|
...mathMl,
|
|
589
754
|
...xml
|
|
590
|
-
]),
|
|
755
|
+
]), E = Object.seal(create(null, {
|
|
591
756
|
tagNameCheck: {
|
|
592
757
|
writable: !0,
|
|
593
758
|
configurable: !1,
|
|
@@ -606,7 +771,7 @@ function createDOMPurify() {
|
|
|
606
771
|
enumerable: !0,
|
|
607
772
|
value: !1
|
|
608
773
|
}
|
|
609
|
-
})),
|
|
774
|
+
})), D = null, et = null, O = Object.seal(create(null, {
|
|
610
775
|
tagCheck: {
|
|
611
776
|
writable: !0,
|
|
612
777
|
configurable: !1,
|
|
@@ -619,7 +784,7 @@ function createDOMPurify() {
|
|
|
619
784
|
enumerable: !0,
|
|
620
785
|
value: null
|
|
621
786
|
}
|
|
622
|
-
})),
|
|
787
|
+
})), tt = !0, k = !0, nt = !1, rt = !0, A = !1, j = !0, M = !1, N = !1, P = !1, F = !1, I = !1, L = !1, it = !0, at = !1, ot = !0, R = !1, z = {}, B = null, st = addToSet({}, [
|
|
623
788
|
"annotation-xml",
|
|
624
789
|
"audio",
|
|
625
790
|
"colgroup",
|
|
@@ -688,15 +853,15 @@ function createDOMPurify() {
|
|
|
688
853
|
}, yt = function() {
|
|
689
854
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
690
855
|
if (!(Y && Y === e)) {
|
|
691
|
-
if ((!e || typeof e != "object") && (e = {}), e = clone(e), q = gt.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, J = q === "application/xhtml+xml" ? stringToString : stringToLowerCase,
|
|
856
|
+
if ((!e || typeof e != "object") && (e = {}), e = clone(e), q = gt.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, J = q === "application/xhtml+xml" ? stringToString : stringToLowerCase, w = objectHasOwnProperty(e, "ALLOWED_TAGS") ? addToSet({}, e.ALLOWED_TAGS, J) : Qe, T = objectHasOwnProperty(e, "ALLOWED_ATTR") ? addToSet({}, e.ALLOWED_ATTR, J) : $e, pt = objectHasOwnProperty(e, "ALLOWED_NAMESPACES") ? addToSet({}, e.ALLOWED_NAMESPACES, stringToString) : mt, ut = objectHasOwnProperty(e, "ADD_URI_SAFE_ATTR") ? addToSet(clone(dt), e.ADD_URI_SAFE_ATTR, J) : dt, ct = objectHasOwnProperty(e, "ADD_DATA_URI_TAGS") ? addToSet(clone(lt), e.ADD_DATA_URI_TAGS, J) : lt, B = objectHasOwnProperty(e, "FORBID_CONTENTS") ? addToSet({}, e.FORBID_CONTENTS, J) : st, D = objectHasOwnProperty(e, "FORBID_TAGS") ? addToSet({}, e.FORBID_TAGS, J) : clone({}), et = objectHasOwnProperty(e, "FORBID_ATTR") ? addToSet({}, e.FORBID_ATTR, J) : clone({}), z = objectHasOwnProperty(e, "USE_PROFILES") ? e.USE_PROFILES : !1, tt = e.ALLOW_ARIA_ATTR !== !1, k = e.ALLOW_DATA_ATTR !== !1, nt = e.ALLOW_UNKNOWN_PROTOCOLS || !1, rt = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, A = e.SAFE_FOR_TEMPLATES || !1, j = e.SAFE_FOR_XML !== !1, M = e.WHOLE_DOCUMENT || !1, F = e.RETURN_DOM || !1, I = e.RETURN_DOM_FRAGMENT || !1, L = e.RETURN_TRUSTED_TYPE || !1, P = e.FORCE_BODY || !1, it = e.SANITIZE_DOM !== !1, at = e.SANITIZE_NAMED_PROPS || !1, ot = e.KEEP_CONTENT !== !1, R = e.IN_PLACE || !1, Ze = e.ALLOWED_URI_REGEXP || IS_ALLOWED_URI, W = e.NAMESPACE || U, G = e.MATHML_TEXT_INTEGRATION_POINTS || G, K = e.HTML_INTEGRATION_POINTS || K, E = e.CUSTOM_ELEMENT_HANDLING || {}, e.CUSTOM_ELEMENT_HANDLING && vt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (E.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && vt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (E.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (E.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), A && (k = !1), I && (F = !0), z && (w = addToSet({}, text), T = [], z.html === !0 && (addToSet(w, html$1), addToSet(T, html$2)), z.svg === !0 && (addToSet(w, svg$1), addToSet(T, svg), addToSet(T, xml)), z.svgFilters === !0 && (addToSet(w, svgFilters), addToSet(T, svg), addToSet(T, xml)), z.mathMl === !0 && (addToSet(w, mathMl$1), addToSet(T, mathMl), addToSet(T, xml))), e.ADD_TAGS && (typeof e.ADD_TAGS == "function" ? O.tagCheck = e.ADD_TAGS : (w === Qe && (w = clone(w)), addToSet(w, e.ADD_TAGS, J))), e.ADD_ATTR && (typeof e.ADD_ATTR == "function" ? O.attributeCheck = e.ADD_ATTR : (T === $e && (T = clone(T)), addToSet(T, e.ADD_ATTR, J))), e.ADD_URI_SAFE_ATTR && addToSet(ut, e.ADD_URI_SAFE_ATTR, J), e.FORBID_CONTENTS && (B === st && (B = clone(B)), addToSet(B, e.FORBID_CONTENTS, J)), e.ADD_FORBID_CONTENTS && (B === st && (B = clone(B)), addToSet(B, e.ADD_FORBID_CONTENTS, J)), ot && (w["#text"] = !0), M && addToSet(w, [
|
|
692
857
|
"html",
|
|
693
858
|
"head",
|
|
694
859
|
"body"
|
|
695
|
-
]),
|
|
860
|
+
]), w.table && (addToSet(w, ["tbody"]), delete D.tbody), e.TRUSTED_TYPES_POLICY) {
|
|
696
861
|
if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
|
|
697
862
|
if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
|
|
698
|
-
|
|
699
|
-
} else
|
|
863
|
+
v = e.TRUSTED_TYPES_POLICY, y = v.createHTML("");
|
|
864
|
+
} else v === void 0 && (v = _createTrustedTypesPolicy(p, i)), v !== null && typeof y == "string" && (y = v.createHTML(""));
|
|
700
865
|
freeze && freeze(e), Y = e;
|
|
701
866
|
}
|
|
702
867
|
}, bt = addToSet({}, [
|
|
@@ -704,7 +869,7 @@ function createDOMPurify() {
|
|
|
704
869
|
...svgFilters,
|
|
705
870
|
...svgDisallowed
|
|
706
871
|
]), xt = addToSet({}, [...mathMl$1, ...mathMlDisallowed]), St = function(e) {
|
|
707
|
-
let t =
|
|
872
|
+
let t = _(e);
|
|
708
873
|
(!t || !t.tagName) && (t = {
|
|
709
874
|
namespaceURI: W,
|
|
710
875
|
tagName: "template"
|
|
@@ -714,7 +879,7 @@ function createDOMPurify() {
|
|
|
714
879
|
}, X = function(e) {
|
|
715
880
|
arrayPush(t.removed, { element: e });
|
|
716
881
|
try {
|
|
717
|
-
|
|
882
|
+
_(e).removeChild(e);
|
|
718
883
|
} catch {
|
|
719
884
|
g(e);
|
|
720
885
|
}
|
|
@@ -738,26 +903,26 @@ function createDOMPurify() {
|
|
|
738
903
|
} catch {}
|
|
739
904
|
}, Ct = function(e) {
|
|
740
905
|
let t = null, r = null;
|
|
741
|
-
if (
|
|
906
|
+
if (P) e = "<remove></remove>" + e;
|
|
742
907
|
else {
|
|
743
908
|
let t = stringMatch(e, /^[\r\n\t ]+/);
|
|
744
909
|
r = t && t[0];
|
|
745
910
|
}
|
|
746
911
|
q === "application/xhtml+xml" && W === U && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
|
|
747
|
-
let i =
|
|
912
|
+
let i = v ? v.createHTML(e) : e;
|
|
748
913
|
if (W === U) try {
|
|
749
914
|
t = new f().parseFromString(i, q);
|
|
750
915
|
} catch {}
|
|
751
916
|
if (!t || !t.documentElement) {
|
|
752
|
-
t =
|
|
917
|
+
t = Ve.createDocument(W, "template", null);
|
|
753
918
|
try {
|
|
754
|
-
t.documentElement.innerHTML = ft ?
|
|
919
|
+
t.documentElement.innerHTML = ft ? y : i;
|
|
755
920
|
} catch {}
|
|
756
921
|
}
|
|
757
922
|
let a = t.body || t.documentElement;
|
|
758
|
-
return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), W === U ?
|
|
923
|
+
return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), W === U ? We.call(t, M ? "html" : "body")[0] : M ? t.documentElement : a;
|
|
759
924
|
}, wt = function(e) {
|
|
760
|
-
return
|
|
925
|
+
return He.call(e.ownerDocument || e, e, l.SHOW_ELEMENT | l.SHOW_COMMENT | l.SHOW_TEXT | l.SHOW_PROCESSING_INSTRUCTION | l.SHOW_CDATA_SECTION, null);
|
|
761
926
|
}, Q = function(e) {
|
|
762
927
|
return e instanceof d && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof u) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
|
|
763
928
|
}, Tt = function(e) {
|
|
@@ -770,57 +935,57 @@ function createDOMPurify() {
|
|
|
770
935
|
}
|
|
771
936
|
let Et = function(e) {
|
|
772
937
|
let n = null;
|
|
773
|
-
if ($(
|
|
938
|
+
if ($(b.beforeSanitizeElements, e, null), Q(e)) return X(e), !0;
|
|
774
939
|
let r = J(e.nodeName);
|
|
775
|
-
if ($(
|
|
940
|
+
if ($(b.uponSanitizeElement, e, {
|
|
776
941
|
tagName: r,
|
|
777
|
-
allowedTags:
|
|
778
|
-
}),
|
|
779
|
-
if (!(
|
|
780
|
-
if (!
|
|
942
|
+
allowedTags: w
|
|
943
|
+
}), j && e.hasChildNodes() && !Tt(e.firstElementChild) && regExpTest(/<[/\w!]/g, e.innerHTML) && regExpTest(/<[/\w!]/g, e.textContent) || e.nodeType === NODE_TYPE.progressingInstruction || j && e.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, e.data)) return X(e), !0;
|
|
944
|
+
if (!(O.tagCheck instanceof Function && O.tagCheck(r)) && (!w[r] || D[r])) {
|
|
945
|
+
if (!D[r] && Ot(r) && (E.tagNameCheck instanceof RegExp && regExpTest(E.tagNameCheck, r) || E.tagNameCheck instanceof Function && E.tagNameCheck(r))) return !1;
|
|
781
946
|
if (ot && !B[r]) {
|
|
782
|
-
let t =
|
|
947
|
+
let t = _(e) || e.parentNode, n = Be(e) || e.childNodes;
|
|
783
948
|
if (n && t) {
|
|
784
949
|
let r = n.length;
|
|
785
950
|
for (let i = r - 1; i >= 0; --i) {
|
|
786
951
|
let r = h(n[i], !0);
|
|
787
|
-
r.__removalCount = (e.__removalCount || 0) + 1, t.insertBefore(r,
|
|
952
|
+
r.__removalCount = (e.__removalCount || 0) + 1, t.insertBefore(r, ze(e));
|
|
788
953
|
}
|
|
789
954
|
}
|
|
790
955
|
}
|
|
791
956
|
return X(e), !0;
|
|
792
957
|
}
|
|
793
|
-
return e instanceof c && !St(e) || (r === "noscript" || r === "noembed" || r === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, e.innerHTML) ? (X(e), !0) : (
|
|
958
|
+
return e instanceof c && !St(e) || (r === "noscript" || r === "noembed" || r === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, e.innerHTML) ? (X(e), !0) : (A && e.nodeType === NODE_TYPE.text && (n = e.textContent, arrayForEach([
|
|
959
|
+
x,
|
|
794
960
|
S,
|
|
795
|
-
C
|
|
796
|
-
w
|
|
961
|
+
C
|
|
797
962
|
], (e) => {
|
|
798
963
|
n = stringReplace(n, e, " ");
|
|
799
|
-
}), e.textContent !== n && (arrayPush(t.removed, { element: e.cloneNode() }), e.textContent = n)), $(
|
|
964
|
+
}), e.textContent !== n && (arrayPush(t.removed, { element: e.cloneNode() }), e.textContent = n)), $(b.afterSanitizeElements, e, null), !1);
|
|
800
965
|
}, Dt = function(e, t, r) {
|
|
801
966
|
if (it && (t === "id" || t === "name") && (r in n || r in _t)) return !1;
|
|
802
|
-
if (!(
|
|
803
|
-
if (!
|
|
804
|
-
if (!(Ot(e) && (
|
|
805
|
-
} else if (!ut[t] && !regExpTest(
|
|
967
|
+
if (!(k && !et[t] && regExpTest(Ke, t)) && !(tt && regExpTest(qe, t)) && !(O.attributeCheck instanceof Function && O.attributeCheck(t, e))) {
|
|
968
|
+
if (!T[t] || et[t]) {
|
|
969
|
+
if (!(Ot(e) && (E.tagNameCheck instanceof RegExp && regExpTest(E.tagNameCheck, e) || E.tagNameCheck instanceof Function && E.tagNameCheck(e)) && (E.attributeNameCheck instanceof RegExp && regExpTest(E.attributeNameCheck, t) || E.attributeNameCheck instanceof Function && E.attributeNameCheck(t, e)) || t === "is" && E.allowCustomizedBuiltInElements && (E.tagNameCheck instanceof RegExp && regExpTest(E.tagNameCheck, r) || E.tagNameCheck instanceof Function && E.tagNameCheck(r)))) return !1;
|
|
970
|
+
} else if (!ut[t] && !regExpTest(Ze, stringReplace(r, Ye, "")) && !((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && stringIndexOf(r, "data:") === 0 && ct[e]) && !(nt && !regExpTest(Je, stringReplace(r, Ye, ""))) && r) return !1;
|
|
806
971
|
}
|
|
807
972
|
return !0;
|
|
808
973
|
}, Ot = function(e) {
|
|
809
|
-
return e !== "annotation-xml" && stringMatch(e,
|
|
974
|
+
return e !== "annotation-xml" && stringMatch(e, Xe);
|
|
810
975
|
}, kt = function(e) {
|
|
811
|
-
$(
|
|
976
|
+
$(b.beforeSanitizeAttributes, e, null);
|
|
812
977
|
let { attributes: n } = e;
|
|
813
978
|
if (!n || Q(e)) return;
|
|
814
979
|
let r = {
|
|
815
980
|
attrName: "",
|
|
816
981
|
attrValue: "",
|
|
817
982
|
keepAttr: !0,
|
|
818
|
-
allowedAttributes:
|
|
983
|
+
allowedAttributes: T,
|
|
819
984
|
forceKeepAttr: void 0
|
|
820
985
|
}, i = n.length;
|
|
821
986
|
for (; i--;) {
|
|
822
987
|
let { name: a, namespaceURI: o, value: s } = n[i], c = J(a), l = s, u = a === "value" ? l : stringTrim(l);
|
|
823
|
-
if (r.attrName = c, r.attrValue = u, r.keepAttr = !0, r.forceKeepAttr = void 0, $(
|
|
988
|
+
if (r.attrName = c, r.attrValue = u, r.keepAttr = !0, r.forceKeepAttr = void 0, $(b.uponSanitizeAttribute, e, r), u = r.attrValue, at && (c === "id" || c === "name") && (Z(a, e), u = "user-content-" + u), j && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, u)) {
|
|
824
989
|
Z(a, e);
|
|
825
990
|
continue;
|
|
826
991
|
}
|
|
@@ -833,14 +998,14 @@ function createDOMPurify() {
|
|
|
833
998
|
Z(a, e);
|
|
834
999
|
continue;
|
|
835
1000
|
}
|
|
836
|
-
if (!
|
|
1001
|
+
if (!rt && regExpTest(/\/>/i, u)) {
|
|
837
1002
|
Z(a, e);
|
|
838
1003
|
continue;
|
|
839
1004
|
}
|
|
840
|
-
|
|
1005
|
+
A && arrayForEach([
|
|
1006
|
+
x,
|
|
841
1007
|
S,
|
|
842
|
-
C
|
|
843
|
-
w
|
|
1008
|
+
C
|
|
844
1009
|
], (e) => {
|
|
845
1010
|
u = stringReplace(u, e, " ");
|
|
846
1011
|
});
|
|
@@ -849,12 +1014,12 @@ function createDOMPurify() {
|
|
|
849
1014
|
Z(a, e);
|
|
850
1015
|
continue;
|
|
851
1016
|
}
|
|
852
|
-
if (
|
|
1017
|
+
if (v && typeof p == "object" && typeof p.getAttributeType == "function" && !o) switch (p.getAttributeType(d, c)) {
|
|
853
1018
|
case "TrustedHTML":
|
|
854
|
-
u =
|
|
1019
|
+
u = v.createHTML(u);
|
|
855
1020
|
break;
|
|
856
1021
|
case "TrustedScriptURL":
|
|
857
|
-
u =
|
|
1022
|
+
u = v.createScriptURL(u);
|
|
858
1023
|
break;
|
|
859
1024
|
}
|
|
860
1025
|
if (u !== l) try {
|
|
@@ -863,11 +1028,11 @@ function createDOMPurify() {
|
|
|
863
1028
|
Z(a, e);
|
|
864
1029
|
}
|
|
865
1030
|
}
|
|
866
|
-
$(
|
|
1031
|
+
$(b.afterSanitizeAttributes, e, null);
|
|
867
1032
|
}, At = function e(t) {
|
|
868
1033
|
let n = null, r = wt(t);
|
|
869
|
-
for ($(
|
|
870
|
-
$(
|
|
1034
|
+
for ($(b.beforeSanitizeShadowDOM, t, null); n = r.nextNode();) $(b.uponSanitizeShadowNode, n, null), Et(n), kt(n), n.content instanceof a && e(n.content);
|
|
1035
|
+
$(b.afterSanitizeShadowDOM, t, null);
|
|
871
1036
|
};
|
|
872
1037
|
return t.sanitize = function(e) {
|
|
873
1038
|
let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, o = null, c = null, l = null;
|
|
@@ -875,51 +1040,51 @@ function createDOMPurify() {
|
|
|
875
1040
|
if (e = e.toString(), typeof e != "string") throw typeErrorCreate("dirty is not a string, aborting");
|
|
876
1041
|
} else throw typeErrorCreate("toString is not a function");
|
|
877
1042
|
if (!t.isSupported) return e;
|
|
878
|
-
if (
|
|
1043
|
+
if (N || yt(n), t.removed = [], typeof e == "string" && (R = !1), R) {
|
|
879
1044
|
if (e.nodeName) {
|
|
880
1045
|
let t = J(e.nodeName);
|
|
881
|
-
if (!
|
|
1046
|
+
if (!w[t] || D[t]) throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
|
|
882
1047
|
}
|
|
883
1048
|
} else if (e instanceof s) i = Ct("<!---->"), o = i.ownerDocument.importNode(e, !0), o.nodeType === NODE_TYPE.element && o.nodeName === "BODY" || o.nodeName === "HTML" ? i = o : i.appendChild(o);
|
|
884
1049
|
else {
|
|
885
|
-
if (!F && !
|
|
886
|
-
if (i = Ct(e), !i) return F ? null : L ?
|
|
1050
|
+
if (!F && !A && !M && e.indexOf("<") === -1) return v && L ? v.createHTML(e) : e;
|
|
1051
|
+
if (i = Ct(e), !i) return F ? null : L ? y : "";
|
|
887
1052
|
}
|
|
888
|
-
i &&
|
|
1053
|
+
i && P && X(i.firstChild);
|
|
889
1054
|
let u = wt(R ? e : i);
|
|
890
1055
|
for (; c = u.nextNode();) Et(c), kt(c), c.content instanceof a && At(c.content);
|
|
891
1056
|
if (R) return e;
|
|
892
1057
|
if (F) {
|
|
893
|
-
if (I) for (l =
|
|
1058
|
+
if (I) for (l = Ue.call(i.ownerDocument); i.firstChild;) l.appendChild(i.firstChild);
|
|
894
1059
|
else l = i;
|
|
895
|
-
return (
|
|
1060
|
+
return (T.shadowroot || T.shadowrootmode) && (l = Ge.call(r, l, !0)), l;
|
|
896
1061
|
}
|
|
897
|
-
let d =
|
|
898
|
-
return
|
|
1062
|
+
let d = M ? i.outerHTML : i.innerHTML;
|
|
1063
|
+
return M && w["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, i.ownerDocument.doctype.name) && (d = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + d), A && arrayForEach([
|
|
1064
|
+
x,
|
|
899
1065
|
S,
|
|
900
|
-
C
|
|
901
|
-
w
|
|
1066
|
+
C
|
|
902
1067
|
], (e) => {
|
|
903
1068
|
d = stringReplace(d, e, " ");
|
|
904
|
-
}),
|
|
1069
|
+
}), v && L ? v.createHTML(d) : d;
|
|
905
1070
|
}, t.setConfig = function() {
|
|
906
|
-
yt(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}),
|
|
1071
|
+
yt(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), N = !0;
|
|
907
1072
|
}, t.clearConfig = function() {
|
|
908
|
-
Y = null,
|
|
1073
|
+
Y = null, N = !1;
|
|
909
1074
|
}, t.isValidAttribute = function(e, t, n) {
|
|
910
1075
|
return Y || yt({}), Dt(J(e), J(t), n);
|
|
911
1076
|
}, t.addHook = function(e, t) {
|
|
912
|
-
typeof t == "function" && arrayPush(
|
|
1077
|
+
typeof t == "function" && arrayPush(b[e], t);
|
|
913
1078
|
}, t.removeHook = function(e, t) {
|
|
914
1079
|
if (t !== void 0) {
|
|
915
|
-
let n = arrayLastIndexOf(
|
|
916
|
-
return n === -1 ? void 0 : arraySplice(
|
|
1080
|
+
let n = arrayLastIndexOf(b[e], t);
|
|
1081
|
+
return n === -1 ? void 0 : arraySplice(b[e], n, 1)[0];
|
|
917
1082
|
}
|
|
918
|
-
return arrayPop(
|
|
1083
|
+
return arrayPop(b[e]);
|
|
919
1084
|
}, t.removeHooks = function(e) {
|
|
920
|
-
|
|
1085
|
+
b[e] = [];
|
|
921
1086
|
}, t.removeAllHooks = function() {
|
|
922
|
-
|
|
1087
|
+
b = _createHooksMap();
|
|
923
1088
|
}, t;
|
|
924
1089
|
}
|
|
925
1090
|
var purify = createDOMPurify(), HTMLConfig = { sanitize: (e) => purify.sanitize(e) }, html = (e, ...t) => new HTMLLiteralResult(e.reduce((e, n, r) => {
|
|
@@ -944,7 +1109,7 @@ function __decorate(e, t, n, r) {
|
|
|
944
1109
|
else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
|
|
945
1110
|
return i > 3 && a && Object.defineProperty(t, n, a), a;
|
|
946
1111
|
}
|
|
947
|
-
var component_default = ":host{--host-display:flex;--host-heading-border:var(--scorad-heading-border,solid 1px var(--host-color));--host-score-color:var(--scorad-score-color,var(--host-color));--host-score-background:var(--scorad-score-background,var(--host-background-color));--host-score-border:var(--scorad-score-border,solid 1px var(--host-color));gap:var(--host-spacing-unit);flex-wrap:wrap;width:fit-content}h3{aspect-ratio:1;border:var(--host-heading-border);padding:var(--host-padding-unit);margin:0 0 0 calc(-1*var(--host-padding-unit));border-radius:50%;justify-content:center;align-items:center;line-height:0;display:inline-flex}p{padding:var(--host-padding-unit)0 0;margin:0;font-size:.9em}scorad-label{break-inside:avoid;outline:none;flex:5 19rem}#extent-label{flex-basis:100%}#intensity-label{flex-grow:1}#score-label{background:linear-gradient(to bottom,transparent,var(--background-color)75%);flex-basis:100%;font-size:1.2rem;position:sticky;bottom:0}@media print{#score-label{position:relative}}#score
|
|
1112
|
+
var component_default$1 = ":host{--host-display:flex;--host-heading-border:var(--scorad-heading-border,solid 1px var(--host-color));--host-score-color:var(--scorad-score-color,var(--host-color));--host-score-background:var(--scorad-score-background,var(--host-background-color));--host-score-border:var(--scorad-score-border,solid 1px var(--host-color));gap:var(--host-spacing-unit);flex-wrap:wrap;width:fit-content}h3{aspect-ratio:1;border:var(--host-heading-border);padding:var(--host-padding-unit);margin:0 0 0 calc(-1*var(--host-padding-unit));border-radius:50%;justify-content:center;align-items:center;line-height:0;display:inline-flex}p{padding:var(--host-padding-unit)0 0;margin:0;font-size:.9em}scorad-label{break-inside:avoid;outline:none;flex:5 19rem}#extent-label{flex-basis:100%}#intensity-label{flex-grow:1}#score-label{background:linear-gradient(to bottom,transparent,var(--background-color)75%);flex-basis:100%;font-size:1.2rem;position:sticky;bottom:0}@media print{#score-label{position:relative}}#score{padding:var(--host-padding-unit);border-radius:var(--host-border-radius);outline:var(--host-score-border);color:var(--host-score-color);background:var(--host-score-background);font-size:1.2rem}#score:focus{outline:var(--host-outline-selected)}scorad-extent,scorad-intensity,scorad-subjective{margin:.6rem calc(-1*var(--host-padding-unit));flex:100%}", host_default = "*{box-sizing:border-box}:host{--host-color-l:var(--color-l,50%);--host-error-color-h:var(--error-color-h,0);--host-color:var(--color,#444);--host-background-color:var(--background-color,#eee);--host-primary-color:var(--primary-color,var(--host-color));--host-error-color:var(--error-color,hsl(var(--host-error-color-h),66.7%,var(--host-color-l)));--host-spacing-unit:var(--scorad-spacing-unit,.25rem);--host-padding-unit:var(--scorad-padding-unit,.333rem);--host-border-radius:var(--scorad-border-radius,3px);--host-border-radius-outer:var(--scorad-border-radius-outer,calc(var(--host-border-radius) + var(--host-padding-unit)));--host-outline-hover:var(--scorad-outline-hover,dashed 2px var(--host-primary-color));--host-outline-focus:var(--scorad-outline-focus,solid 2px var(--host-primary-color));--host-outline-selected:var(--scorad-outline-selected,solid 2px var(--host-color));display:var(--host-display,inline-flex);line-height:1.2}@media (prefers-color-scheme:dark){:host{--host-color-l:var(--color-l,70%)}}";
|
|
948
1113
|
const SCORAD_EXTENT_MAX_VALUE = 100, SCORAD_INTENSITY_MAX_VALUE = 3, SCORAD_SUBJECTIVE_MAX_VALUE = 10, SCORAD_EXTENT_DEFAULT = {
|
|
949
1114
|
headNeck: null,
|
|
950
1115
|
anteriorTrunk: null,
|
|
@@ -993,10 +1158,11 @@ const selectScoradWeights = (e) => e?.child ? SCORAD_CHILD_WEIGHTS : SCORAD_ADUL
|
|
|
993
1158
|
validateScoradData.formatError = (e, t, n, r) => `${e}.${t}: must be between 0 and ${n}, but received ${r}.`, validateScoradData.isValid = (e, t) => typeof e == "number" && Number.isFinite(e) && e >= 0 && e <= t;
|
|
994
1159
|
const ScoradResources = {
|
|
995
1160
|
child: {
|
|
996
|
-
text: "
|
|
1161
|
+
text: "weightings",
|
|
997
1162
|
description: "use weightings for a child"
|
|
998
1163
|
},
|
|
999
1164
|
extent: {
|
|
1165
|
+
text: "A. Extent",
|
|
1000
1166
|
headNeck: {
|
|
1001
1167
|
text: "head",
|
|
1002
1168
|
description: "percentage of the head and neck area affected"
|
|
@@ -1023,6 +1189,13 @@ const ScoradResources = {
|
|
|
1023
1189
|
}
|
|
1024
1190
|
},
|
|
1025
1191
|
intensity: {
|
|
1192
|
+
text: "B. Intensity",
|
|
1193
|
+
levels: [
|
|
1194
|
+
"none",
|
|
1195
|
+
"mild",
|
|
1196
|
+
"moderate",
|
|
1197
|
+
"severe"
|
|
1198
|
+
],
|
|
1026
1199
|
erythema: {
|
|
1027
1200
|
text: "Erythema",
|
|
1028
1201
|
description: "redness of the skin"
|
|
@@ -1049,6 +1222,20 @@ const ScoradResources = {
|
|
|
1049
1222
|
}
|
|
1050
1223
|
},
|
|
1051
1224
|
subjective: {
|
|
1225
|
+
text: "C. Subjective",
|
|
1226
|
+
levels: [
|
|
1227
|
+
"0",
|
|
1228
|
+
"1",
|
|
1229
|
+
"2",
|
|
1230
|
+
"3",
|
|
1231
|
+
"4",
|
|
1232
|
+
"5",
|
|
1233
|
+
"6",
|
|
1234
|
+
"7",
|
|
1235
|
+
"8",
|
|
1236
|
+
"9",
|
|
1237
|
+
"10"
|
|
1238
|
+
],
|
|
1052
1239
|
pruritus: {
|
|
1053
1240
|
text: "Pruritus",
|
|
1054
1241
|
description: "itching"
|
|
@@ -1103,6 +1290,7 @@ var tag$6 = "scorad-extent", HTMLScoradExtentElement = class extends HTMLCompone
|
|
|
1103
1290
|
this.style.setProperty("--host-font-size", `${t}rem`);
|
|
1104
1291
|
}
|
|
1105
1292
|
render() {
|
|
1293
|
+
this.setAttribute("role", "group"), this.setAttribute("aria-label", ScoradResources.extent.text);
|
|
1106
1294
|
let e = (e) => {
|
|
1107
1295
|
let t = (t) => {
|
|
1108
1296
|
if (this.readonly) return;
|
|
@@ -1165,6 +1353,7 @@ var tag$6 = "scorad-extent", HTMLScoradExtentElement = class extends HTMLCompone
|
|
|
1165
1353
|
return html`
|
|
1166
1354
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 190 240">
|
|
1167
1355
|
<g ${e("headNeck")}
|
|
1356
|
+
aria-label="${ScoradResources.extent.headNeck.text}"
|
|
1168
1357
|
class="head-neck" tabindex="0">
|
|
1169
1358
|
<text x="40" y="20" ${t("headNeck")}>--</text>
|
|
1170
1359
|
<line x1="45" y1="16" x2="68" y2="17"></line>
|
|
@@ -1172,6 +1361,7 @@ var tag$6 = "scorad-extent", HTMLScoradExtentElement = class extends HTMLCompone
|
|
|
1172
1361
|
</g>
|
|
1173
1362
|
${this.child ? html`
|
|
1174
1363
|
<g ${e("anteriorTrunk")}
|
|
1364
|
+
aria-label="${ScoradResources.extent.anteriorTrunk.text}"
|
|
1175
1365
|
class="anterior-trunk" tabindex="0">
|
|
1176
1366
|
<text x="40" y="50" ${t("anteriorTrunk")}>--</text>
|
|
1177
1367
|
<line x1="45" y1="46" x2="77" y2="52"></line>
|
|
@@ -1179,6 +1369,7 @@ var tag$6 = "scorad-extent", HTMLScoradExtentElement = class extends HTMLCompone
|
|
|
1179
1369
|
</g>
|
|
1180
1370
|
` : html`
|
|
1181
1371
|
<g ${e("anteriorTrunk")}
|
|
1372
|
+
aria-label="${ScoradResources.extent.anteriorTrunk.text}"
|
|
1182
1373
|
class="anterior-trunk" tabindex="0">
|
|
1183
1374
|
<text x="40" y="50" ${t("anteriorTrunk")}>--</text>
|
|
1184
1375
|
<line x1="45" y1="46" x2="75" y2="52"></line>
|
|
@@ -1186,6 +1377,7 @@ var tag$6 = "scorad-extent", HTMLScoradExtentElement = class extends HTMLCompone
|
|
|
1186
1377
|
</g>
|
|
1187
1378
|
`}
|
|
1188
1379
|
<g ${e("upperLimbs")}
|
|
1380
|
+
aria-label="${ScoradResources.extent.upperLimbs.text}"
|
|
1189
1381
|
class="upper-limbs" tabindex="0">
|
|
1190
1382
|
<text x="40" y="80" ${t("upperLimbs")}>--</text>
|
|
1191
1383
|
<line x1="45" y1="76" x2="50" y2="78"></line>
|
|
@@ -1194,6 +1386,7 @@ var tag$6 = "scorad-extent", HTMLScoradExtentElement = class extends HTMLCompone
|
|
|
1194
1386
|
</g>
|
|
1195
1387
|
${this.child ? "" : html`
|
|
1196
1388
|
<g ${e("genitals")}
|
|
1389
|
+
aria-label="${ScoradResources.extent.genitals.text}"
|
|
1197
1390
|
class="genitals" tabindex="0">
|
|
1198
1391
|
<text x="40" y="170" ${t("genitals")}>--</text>
|
|
1199
1392
|
<line x1="45" y1="164" x2="63" y2="138"></line>
|
|
@@ -1201,6 +1394,7 @@ var tag$6 = "scorad-extent", HTMLScoradExtentElement = class extends HTMLCompone
|
|
|
1201
1394
|
</g>
|
|
1202
1395
|
`}
|
|
1203
1396
|
<g ${e("lowerLimbs")}
|
|
1397
|
+
aria-label="${ScoradResources.extent.lowerLimbs.text}"
|
|
1204
1398
|
class="lower-limbs" tabindex="">
|
|
1205
1399
|
<text x="40" y="200" ${t("lowerLimbs")}>--</text>
|
|
1206
1400
|
<line x1="45" y1="195" x2="63" y2="195"></line>
|
|
@@ -1217,6 +1411,7 @@ var tag$6 = "scorad-extent", HTMLScoradExtentElement = class extends HTMLCompone
|
|
|
1217
1411
|
<path d="M116,61 120,85 150,135 A1,1 0,0,0 165,130Z"></path>
|
|
1218
1412
|
</g>
|
|
1219
1413
|
<g ${e("posteriorTrunk")}
|
|
1414
|
+
aria-label="${ScoradResources.extent.posteriorTrunk.text}"
|
|
1220
1415
|
class="posterior-trunk" tabindex="0">
|
|
1221
1416
|
<text x="150" y="50" ${t("posteriorTrunk")}>--</text>
|
|
1222
1417
|
<line x1="145" y1="46" x2="115" y2="52"></line>
|
|
@@ -1232,10 +1427,7 @@ var tag$6 = "scorad-extent", HTMLScoradExtentElement = class extends HTMLCompone
|
|
|
1232
1427
|
valueInput;
|
|
1233
1428
|
valueChange;
|
|
1234
1429
|
};
|
|
1235
|
-
__decorate([Att(AttBoolean)], HTMLScoradExtentElement.prototype, "child", void 0), __decorate([Att({
|
|
1236
|
-
name: "aria-readonly",
|
|
1237
|
-
...AttTrueFalse
|
|
1238
|
-
})], HTMLScoradExtentElement.prototype, "readonly", void 0), __decorate([Att({
|
|
1430
|
+
__decorate([Att(AttBoolean)], HTMLScoradExtentElement.prototype, "child", void 0), __decorate([Att(AttBoolean)], HTMLScoradExtentElement.prototype, "readonly", void 0), __decorate([Att({
|
|
1239
1431
|
name: "has-errors",
|
|
1240
1432
|
write: (e) => e == null ? void 0 : "",
|
|
1241
1433
|
read: !1
|
|
@@ -1244,7 +1436,7 @@ __decorate([Att(AttBoolean)], HTMLScoradExtentElement.prototype, "child", void 0
|
|
|
1244
1436
|
css: [host_default, component_default$6],
|
|
1245
1437
|
delegatesFocus: !0
|
|
1246
1438
|
})], HTMLScoradExtentElement);
|
|
1247
|
-
var component_default$4 = ":host{--host-display:inline-flex;flex-direction:column;position:relative}scorad-options{align-self:center;margin-left:auto}", component_default$5 = ":host{--host-display:inline-flex;--host-option-width:var(--scorad-option-width,1.5em);--host-option-height:var(--scorad-option-height,1.5em);--host-option-border:var(--scorad-option-border,solid 1px var(--host-color));--host-option-border-selected:var(--scorad-option-border-selected,solid 2px var(--host-color));--host-option-color:var(--scorad-option-color,var(--host-color));--host-option-background:var(--scorad-option-background,transparent);--host-option-color-selected:var(--scorad-option-color-selected,var(--host-background-color));--host-option-background-selected:var(--scorad-option-background-selected,var(--host-color));gap:var(--host-spacing-unit);margin:var(--host-padding-unit)0;outline:none;width:max-content;position:relative}span{height:var(--host-option-height);width:var(--host-option-width);outline:var(--host-option-border);border-radius:var(--host-border-radius);padding:calc(.5*var(--host-padding-unit))var(--host-padding-unit);color:var(--host-option-color);background:var(--host-option-background)}:host(:not([aria-readonly=true])) span{cursor:pointer}span:before{content:\"\";touch-action:none;pointer-events:none}span[aria-
|
|
1439
|
+
var component_default$4 = ":host{--host-display:inline-flex;flex-direction:column;position:relative}scorad-options{align-self:center;margin-left:auto}", component_default$5 = ":host{--host-display:inline-flex;--host-option-width:var(--scorad-option-width,1.5em);--host-option-height:var(--scorad-option-height,1.5em);--host-option-border:var(--scorad-option-border,solid 1px var(--host-color));--host-option-border-selected:var(--scorad-option-border-selected,solid 2px var(--host-color));--host-option-color:var(--scorad-option-color,var(--host-color));--host-option-background:var(--scorad-option-background,transparent);--host-option-color-selected:var(--scorad-option-color-selected,var(--host-background-color));--host-option-background-selected:var(--scorad-option-background-selected,var(--host-color));gap:var(--host-spacing-unit);margin:var(--host-padding-unit)0;outline:none;width:max-content;position:relative}span{height:var(--host-option-height);width:var(--host-option-width);outline:var(--host-option-border);border-radius:var(--host-border-radius);padding:calc(.5*var(--host-padding-unit))var(--host-padding-unit);color:var(--host-option-color);background:var(--host-option-background)}:host(:not([aria-readonly=true])) span{cursor:pointer}span:before{content:\"\";touch-action:none;pointer-events:none}span[aria-checked=true]{outline:var(--host-option-border-selected);color:var(--host-option-color-selected);background:var(--host-option-background-selected)}", tag$5 = "scorad-options", HTMLScoradOptionsElement = class extends HTMLComponentElement {
|
|
1248
1440
|
connectedCallback() {
|
|
1249
1441
|
this.render(), this.addEventListener("focusin", this.handleFocusIn, { once: !0 }), this.addEventListener("click", this.handleClick);
|
|
1250
1442
|
}
|
|
@@ -1283,6 +1475,7 @@ var component_default$4 = ":host{--host-display:inline-flex;flex-direction:colum
|
|
|
1283
1475
|
};
|
|
1284
1476
|
min = 0;
|
|
1285
1477
|
max = 5;
|
|
1478
|
+
hideText = !1;
|
|
1286
1479
|
showHue = !1;
|
|
1287
1480
|
committedValue = 0;
|
|
1288
1481
|
value = 0;
|
|
@@ -1292,22 +1485,23 @@ var component_default$4 = ":host{--host-display:inline-flex;flex-direction:colum
|
|
|
1292
1485
|
readonly = !1;
|
|
1293
1486
|
text = [];
|
|
1294
1487
|
render() {
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1488
|
+
let e = Array.from({ length: this.max - this.min + 1 }, (e, t) => this.min + t);
|
|
1489
|
+
return this.setAttribute("role", "radiogroup"), html`
|
|
1490
|
+
${e.map((e) => html`
|
|
1491
|
+
<span role="radio" data-value="${e}">${this.hideText ? "" : this.text[e]}</span>
|
|
1298
1492
|
`)}
|
|
1299
1493
|
`;
|
|
1300
1494
|
}
|
|
1301
1495
|
afterRender() {
|
|
1302
|
-
this.shadowRoot && this.shadowRoot.querySelectorAll("span").forEach((e) => {
|
|
1303
|
-
let
|
|
1304
|
-
if (e.setAttribute("aria-
|
|
1305
|
-
if (
|
|
1496
|
+
this.shadowRoot && this.shadowRoot.querySelectorAll("span").forEach((e, t) => {
|
|
1497
|
+
let n = Number.parseInt(e.dataset.value);
|
|
1498
|
+
if (e.setAttribute("aria-checked", n === this.value ? "true" : "false"), this.hideText && e.setAttribute("aria-label", this.text[t] ?? `option ${t}`), !this.showHue) return;
|
|
1499
|
+
if (n > this.value) {
|
|
1306
1500
|
e.style.backgroundColor = "";
|
|
1307
1501
|
return;
|
|
1308
1502
|
}
|
|
1309
|
-
let
|
|
1310
|
-
e.style.backgroundColor = `hsl(var(--scorad-h, 0), ${
|
|
1503
|
+
let r = Math.round(100 * n / (this.max - this.min));
|
|
1504
|
+
e.style.backgroundColor = `hsl(var(--scorad-h, 0), ${r}%, 50%, ${r}%)`;
|
|
1311
1505
|
});
|
|
1312
1506
|
}
|
|
1313
1507
|
valueInput;
|
|
@@ -1319,10 +1513,10 @@ __decorate([Att({
|
|
|
1319
1513
|
})], HTMLScoradOptionsElement.prototype, "min", void 0), __decorate([Att({
|
|
1320
1514
|
read: Number,
|
|
1321
1515
|
write: !1
|
|
1322
|
-
})], HTMLScoradOptionsElement.prototype, "max", void 0), __decorate([Att(AttBoolean)], HTMLScoradOptionsElement.prototype, "showHue", void 0), __decorate([Att({
|
|
1516
|
+
})], HTMLScoradOptionsElement.prototype, "max", void 0), __decorate([Att(AttBoolean)], HTMLScoradOptionsElement.prototype, "hideText", void 0), __decorate([Att(AttBoolean)], HTMLScoradOptionsElement.prototype, "showHue", void 0), __decorate([Att({
|
|
1323
1517
|
name: "aria-readonly",
|
|
1324
1518
|
...AttTrueFalse
|
|
1325
|
-
})], HTMLScoradOptionsElement.prototype, "readonly", void 0), __decorate([Att({ write: !1 })], HTMLScoradOptionsElement.prototype, "text", void 0), __decorate([Watch("min", "max", "text")], HTMLScoradOptionsElement.prototype, "render", null), __decorate([Watch("value", "readonly")], HTMLScoradOptionsElement.prototype, "afterRender", null), __decorate([Event()], HTMLScoradOptionsElement.prototype, "valueInput", void 0), __decorate([Event()], HTMLScoradOptionsElement.prototype, "valueChange", void 0), HTMLScoradOptionsElement = __decorate([Component({
|
|
1519
|
+
})], HTMLScoradOptionsElement.prototype, "readonly", void 0), __decorate([Att({ write: !1 })], HTMLScoradOptionsElement.prototype, "text", void 0), __decorate([Watch("min", "max", "text", "hideText")], HTMLScoradOptionsElement.prototype, "render", null), __decorate([Watch("value", "readonly")], HTMLScoradOptionsElement.prototype, "afterRender", null), __decorate([Event()], HTMLScoradOptionsElement.prototype, "valueInput", void 0), __decorate([Event()], HTMLScoradOptionsElement.prototype, "valueChange", void 0), HTMLScoradOptionsElement = __decorate([Component({
|
|
1326
1520
|
tag: tag$5,
|
|
1327
1521
|
css: [host_default, component_default$5]
|
|
1328
1522
|
})], HTMLScoradOptionsElement);
|
|
@@ -1345,11 +1539,11 @@ var tag$4 = "scorad-intensity", HTMLScoradIntensityElement = class extends HTMLC
|
|
|
1345
1539
|
n.dataset.value = `${t}`;
|
|
1346
1540
|
let r = n.querySelector("scorad-options");
|
|
1347
1541
|
if (!r) return;
|
|
1348
|
-
r.value = t, r.readonly = this.readonly, r.style.setProperty("--host-option-border", this.errors?.[e] == null ? null : "solid 1px var(--host-error-color)");
|
|
1542
|
+
r.value = t, r.readonly = this.readonly, r.text = ScoradResources.intensity.levels, r.hideText = !0, r.style.setProperty("--host-option-border", this.errors?.[e] == null ? null : "solid 1px var(--host-error-color)");
|
|
1349
1543
|
}
|
|
1350
1544
|
}
|
|
1351
1545
|
render() {
|
|
1352
|
-
return html`
|
|
1546
|
+
return this.setAttribute("role", "group"), this.setAttribute("aria-label", ScoradResources.intensity.text), html`
|
|
1353
1547
|
${objectKeys(this.value).map((e) => this.renderLevel(e))}
|
|
1354
1548
|
`;
|
|
1355
1549
|
}
|
|
@@ -1380,10 +1574,7 @@ var tag$4 = "scorad-intensity", HTMLScoradIntensityElement = class extends HTMLC
|
|
|
1380
1574
|
valueInput;
|
|
1381
1575
|
valueChange;
|
|
1382
1576
|
};
|
|
1383
|
-
__decorate([Att({
|
|
1384
|
-
name: "aria-readonly",
|
|
1385
|
-
...AttTrueFalse
|
|
1386
|
-
})], HTMLScoradIntensityElement.prototype, "readonly", void 0), __decorate([Att({
|
|
1577
|
+
__decorate([Att(AttBoolean)], HTMLScoradIntensityElement.prototype, "readonly", void 0), __decorate([Att({
|
|
1387
1578
|
name: "has-errors",
|
|
1388
1579
|
write: (e) => e == null ? void 0 : "",
|
|
1389
1580
|
read: !1
|
|
@@ -1411,11 +1602,11 @@ var component_default$3 = ":host{--host-display:inline-flex;--scorad-label-text-
|
|
|
1411
1602
|
n.dataset.value = `${t}`;
|
|
1412
1603
|
let r = n.querySelector("scorad-options");
|
|
1413
1604
|
if (!r) return;
|
|
1414
|
-
r.value = t, r.readonly = this.readonly, r.style.setProperty("--host-option-border", this.errors?.[e] == null ? null : "solid 1px var(--host-error-color)");
|
|
1605
|
+
r.value = t, r.readonly = this.readonly, r.text = ScoradResources.subjective.levels, r.hideText = !0, r.style.setProperty("--host-option-border", this.errors?.[e] == null ? null : "solid 1px var(--host-error-color)");
|
|
1415
1606
|
}
|
|
1416
1607
|
}
|
|
1417
1608
|
render() {
|
|
1418
|
-
return html`
|
|
1609
|
+
return this.setAttribute("role", "group"), this.setAttribute("aria-label", ScoradResources.subjective.text), html`
|
|
1419
1610
|
${objectKeys(this.value).map((e) => this.renderLevel(e))}
|
|
1420
1611
|
`;
|
|
1421
1612
|
}
|
|
@@ -1445,10 +1636,7 @@ var component_default$3 = ":host{--host-display:inline-flex;--scorad-label-text-
|
|
|
1445
1636
|
valueInput;
|
|
1446
1637
|
valueChange;
|
|
1447
1638
|
};
|
|
1448
|
-
__decorate([Att({
|
|
1449
|
-
name: "aria-readonly",
|
|
1450
|
-
...AttTrueFalse
|
|
1451
|
-
})], HTMLScoradSubjectiveElement.prototype, "readonly", void 0), __decorate([Att({
|
|
1639
|
+
__decorate([Att(AttBoolean)], HTMLScoradSubjectiveElement.prototype, "readonly", void 0), __decorate([Att({
|
|
1452
1640
|
name: "has-errors",
|
|
1453
1641
|
write: (e) => e == null ? void 0 : "",
|
|
1454
1642
|
read: !1
|
|
@@ -1473,7 +1661,7 @@ var component_default$2 = ":host{--host-display:inline-flex;padding:0 var(--host
|
|
|
1473
1661
|
e && (e.value = this.value ? 1 : 0, e.text = ["Adult", "Child"], e.readonly = this.readonly);
|
|
1474
1662
|
}
|
|
1475
1663
|
render() {
|
|
1476
|
-
return html`
|
|
1664
|
+
return this.setAttribute("role", "group"), this.setAttribute("aria-label", ScoradResources.child.text), html`
|
|
1477
1665
|
<scorad-options ${(e) => {
|
|
1478
1666
|
e.addEventListener("value-input", (e) => {
|
|
1479
1667
|
this.value = e.detail === 1, this.valueInput(this.value);
|
|
@@ -1486,10 +1674,7 @@ var component_default$2 = ":host{--host-display:inline-flex;padding:0 var(--host
|
|
|
1486
1674
|
valueInput;
|
|
1487
1675
|
valueChange;
|
|
1488
1676
|
};
|
|
1489
|
-
__decorate([Att({
|
|
1490
|
-
name: "aria-readonly",
|
|
1491
|
-
...AttTrueFalse
|
|
1492
|
-
})], HTMLScoradWeightingsElement.prototype, "readonly", void 0), __decorate([Watch("value", "readonly")], HTMLScoradWeightingsElement.prototype, "afterRender", null), __decorate([Event()], HTMLScoradWeightingsElement.prototype, "valueInput", void 0), __decorate([Event()], HTMLScoradWeightingsElement.prototype, "valueChange", void 0), HTMLScoradWeightingsElement = __decorate([Component({
|
|
1677
|
+
__decorate([Att(AttBoolean)], HTMLScoradWeightingsElement.prototype, "readonly", void 0), __decorate([Watch("value", "readonly")], HTMLScoradWeightingsElement.prototype, "afterRender", null), __decorate([Event()], HTMLScoradWeightingsElement.prototype, "valueInput", void 0), __decorate([Event()], HTMLScoradWeightingsElement.prototype, "valueChange", void 0), HTMLScoradWeightingsElement = __decorate([Component({
|
|
1493
1678
|
tag: tag$2,
|
|
1494
1679
|
css: [host_default, component_default$2],
|
|
1495
1680
|
delegatesFocus: !0
|
|
@@ -1506,33 +1691,7 @@ const getScoradScore = (e) => {
|
|
|
1506
1691
|
total: s
|
|
1507
1692
|
});
|
|
1508
1693
|
};
|
|
1509
|
-
var
|
|
1510
|
-
connectedCallback() {
|
|
1511
|
-
this.render(), this.addEventListener("click", this.handleClick);
|
|
1512
|
-
}
|
|
1513
|
-
diconnectedCallback() {
|
|
1514
|
-
this.removeEventListener("click", this.handleClick);
|
|
1515
|
-
}
|
|
1516
|
-
handleClick = (e) => {
|
|
1517
|
-
this.querySelector(FOCUSABLE)?.focus();
|
|
1518
|
-
};
|
|
1519
|
-
text = "(label)";
|
|
1520
|
-
description;
|
|
1521
|
-
render() {
|
|
1522
|
-
return html`
|
|
1523
|
-
<label>
|
|
1524
|
-
<slot name="text"><span>${this.text}</span></slot>
|
|
1525
|
-
<slot name="description"><small>${this.description}</small></slot>
|
|
1526
|
-
</label>
|
|
1527
|
-
<slot></slot>
|
|
1528
|
-
`;
|
|
1529
|
-
}
|
|
1530
|
-
};
|
|
1531
|
-
__decorate([Att({ write: !1 })], HTMLScoradLabelElement.prototype, "text", void 0), __decorate([Att({ write: !1 })], HTMLScoradLabelElement.prototype, "description", void 0), HTMLScoradLabelElement = __decorate([Component({
|
|
1532
|
-
tag: tag$1,
|
|
1533
|
-
css: [host_default, component_default$1]
|
|
1534
|
-
})], HTMLScoradLabelElement);
|
|
1535
|
-
var tag = "scorad-component", HTMLScoradElement = class extends HTMLComponentElement {
|
|
1694
|
+
var tag$1 = "scorad-component", HTMLScoradElement = class extends HTMLComponentElement {
|
|
1536
1695
|
connectedCallback() {
|
|
1537
1696
|
this.render();
|
|
1538
1697
|
}
|
|
@@ -1562,7 +1721,7 @@ var tag = "scorad-component", HTMLScoradElement = class extends HTMLComponentEle
|
|
|
1562
1721
|
s && (s.value = this.value?.child ?? !1, s.readonly = this.readonly);
|
|
1563
1722
|
}
|
|
1564
1723
|
render() {
|
|
1565
|
-
return html`
|
|
1724
|
+
return this.setAttribute("role", "region"), this.setAttribute("aria-label", "SCORAD component"), html`
|
|
1566
1725
|
<scorad-label id="extent-label">
|
|
1567
1726
|
<h3 slot="text">A</h3>
|
|
1568
1727
|
<p slot="description">extent - effected surface area</p>
|
|
@@ -1633,8 +1792,9 @@ var tag = "scorad-component", HTMLScoradElement = class extends HTMLComponentEle
|
|
|
1633
1792
|
<scorad-label id="score-label"
|
|
1634
1793
|
text="SCORAD"
|
|
1635
1794
|
description="(A / 5) + (7 × B / 2) + C"
|
|
1636
|
-
|
|
1637
|
-
|
|
1795
|
+
>
|
|
1796
|
+
<button id="score" ${(e) => {
|
|
1797
|
+
e instanceof HTMLButtonElement && e.addEventListener("click", () => {
|
|
1638
1798
|
if (!this.shadowRoot) return;
|
|
1639
1799
|
this.showErrors = !0;
|
|
1640
1800
|
let e = this.shadowRoot.querySelector("[has-errors]");
|
|
@@ -1644,21 +1804,43 @@ var tag = "scorad-component", HTMLScoradElement = class extends HTMLComponentEle
|
|
|
1644
1804
|
}));
|
|
1645
1805
|
});
|
|
1646
1806
|
}}
|
|
1647
|
-
|
|
1648
|
-
<span id="score" tabindex="0"></span>
|
|
1807
|
+
tabindex="0"></button>
|
|
1649
1808
|
</scorad-label>
|
|
1650
1809
|
`;
|
|
1651
1810
|
}
|
|
1652
1811
|
valueInput;
|
|
1653
1812
|
valueChange;
|
|
1654
1813
|
};
|
|
1655
|
-
__decorate([Att({
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
})], HTMLScoradElement.prototype, "readonly", void 0), __decorate([Watch("value", "showErrors", "readonly")], HTMLScoradElement.prototype, "afterRender", null), __decorate([Event()], HTMLScoradElement.prototype, "valueInput", void 0), __decorate([Event()], HTMLScoradElement.prototype, "valueChange", void 0), HTMLScoradElement = __decorate([Component({
|
|
1659
|
-
tag,
|
|
1660
|
-
css: [host_default, component_default],
|
|
1814
|
+
__decorate([Att(AttBoolean)], HTMLScoradElement.prototype, "readonly", void 0), __decorate([Watch("value", "showErrors", "readonly")], HTMLScoradElement.prototype, "afterRender", null), __decorate([Event()], HTMLScoradElement.prototype, "valueInput", void 0), __decorate([Event()], HTMLScoradElement.prototype, "valueChange", void 0), HTMLScoradElement = __decorate([Component({
|
|
1815
|
+
tag: tag$1,
|
|
1816
|
+
css: [host_default, component_default$1],
|
|
1661
1817
|
delegatesFocus: !0
|
|
1662
1818
|
})], HTMLScoradElement);
|
|
1663
1819
|
const componentsScoradLogger = provideLogger("@ntix/components-scorad", typeof ANTIX_COMPONENTS_SCORAD_LOG_LEVEL > "u" ? LogLevel.warn : ANTIX_COMPONENTS_SCORAD_LOG_LEVEL);
|
|
1820
|
+
var component_default = ":host{--host-display:var(--scorad-label-display,inline-flex);--host-options:var(--scorad-label-options,solid 1px var(--host-color));--host-text-min-width:var(--scorad-label-text-min-width,none);--host-text-max-width:var(--scorad-label-text-max-width,none);grid-column:1/3;grid-template-columns:subgrid;padding:var(--host-padding-unit);border-radius:var(--host-border-radius-outer);flex-wrap:wrap;align-content:baseline;align-items:baseline;position:relative}:host(:hover){outline:var(--host-outline-hover)}:host(:focus-within){outline:var(--host-outline-focus)}:host>label{min-width:var(--host-text-min-width);max-width:var(--host-text-max-width)}:host>label>slot[name=text]{transition:all .2s ease-in-out;display:block}:host>label>slot[name=description]{opacity:0;margin-bottom:-1.1em;transition:all .4s ease-in-out;display:block}:host(:hover)>label>slot[name=text],:host(:focus-within)>label>slot[name=text]{transform:translateY(-.5em)}:host(:hover)>label>slot[name=description],:host(:focus-within)>label>slot[name=description]{opacity:.667;transform:translateY(-.6em)}@media print{:host>label>slot[name=text]{transform:translateY(-.5em)}:host>label>slot[name=description]{opacity:.667;transform:translateY(-.6em)}}:host>label{padding:var(--host-padding-unit);flex:1;padding-left:0}", tag = "scorad-label", HTMLScoradLabelElement = class extends HTMLComponentElement {
|
|
1821
|
+
connectedCallback() {
|
|
1822
|
+
this.render(), this.addEventListener("click", this.handleClick);
|
|
1823
|
+
}
|
|
1824
|
+
diconnectedCallback() {
|
|
1825
|
+
this.removeEventListener("click", this.handleClick);
|
|
1826
|
+
}
|
|
1827
|
+
handleClick = (e) => {
|
|
1828
|
+
this.querySelector(FOCUSABLE)?.focus();
|
|
1829
|
+
};
|
|
1830
|
+
text = "(label)";
|
|
1831
|
+
description;
|
|
1832
|
+
render() {
|
|
1833
|
+
return html`
|
|
1834
|
+
<label>
|
|
1835
|
+
<slot name="text"><span>${this.text}</span></slot>
|
|
1836
|
+
<slot name="description"><small>${this.description}</small></slot>
|
|
1837
|
+
</label>
|
|
1838
|
+
<slot></slot>
|
|
1839
|
+
`;
|
|
1840
|
+
}
|
|
1841
|
+
};
|
|
1842
|
+
__decorate([Att({ write: !1 })], HTMLScoradLabelElement.prototype, "text", void 0), __decorate([Att({ write: !1 })], HTMLScoradLabelElement.prototype, "description", void 0), HTMLScoradLabelElement = __decorate([Component({
|
|
1843
|
+
tag,
|
|
1844
|
+
css: [host_default, component_default]
|
|
1845
|
+
})], HTMLScoradLabelElement);
|
|
1664
1846
|
export { Failure, HTMLScoradElement, HTMLScoradExtentElement, HTMLScoradIntensityElement, HTMLScoradLabelElement, HTMLScoradOptionsElement, HTMLScoradSubjectiveElement, HTMLScoradWeightingsElement, LogLevel, Result, SCORAD_ADULT_WEIGHTS, SCORAD_CHILD_WEIGHTS, SCORAD_DEFAULT, SCORAD_EXTENT_DEFAULT, SCORAD_EXTENT_MAX_VALUE, SCORAD_INTENSITY_DEFAULT, SCORAD_INTENSITY_MAX_VALUE, SCORAD_SUBJECTIVE_DEFAULT, SCORAD_SUBJECTIVE_MAX_VALUE, ScoradResources, Success, componentsScoradLogger, getScoradScore, selectScoradWeights, validateScoradData };
|