diff --git a/.eslintrc.json b/.eslintrc.json index 957dfcb..dbe3e0a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,7 +5,8 @@ }, "extends": [ "eslint:recommended", - "plugin:@typescript-eslint/recommended" + "plugin:@typescript-eslint/recommended", + "plugin:json/recommended" ], "parser": "@typescript-eslint/parser", "parserOptions": { @@ -13,7 +14,8 @@ "sourceType": "module" }, "plugins": [ - "@typescript-eslint" + "@typescript-eslint", + "json" ], "rules": { "indent": [ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8272408..7bcc648 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,10 +25,11 @@ jobs: - name: Create release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.ref_name }} # tag="${GITHUB_REF#refs/tags/}" run: | - tag="${GITHUB_REF#refs/tags/}" - gh release create "$tag" \ --title="$tag" \ + --notes="${git tag -l --format='%(contents:subject)' $tag}" \ + --verify-tag \ --draft \ main.js manifest.json styles.css diff --git a/.stylelintrc.json b/.stylelintrc.json index 22b564e..6876af1 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -3,10 +3,19 @@ "plugins": [ "stylelint-order", "stylelint-use-logical-spec", - "stylelint-declaration-block-no-ignored-properties" + "stylelint-declaration-block-no-ignored-properties", + "stylelint-no-nested-media", + "stylelint-plugin-defensive-css", + "stylelint-high-performance-animation", + "stylelint-gamut", + "stylelint-stylistic" ], "rules": { "liberty/use-logical-spec": "ignore", - "plugin/declaration-block-no-ignored-properties": true + "plugin/declaration-block-no-ignored-properties": true, + "pitcher/no-nested-media": true, + "plugin/use-defensive-css": [true, {"accidental-hover": true, "background-repeat": true, "custom-property-fallbacks": true, "flex-wrapping": true, "scroll-chaining": true, "vendor-prefix-grouping": true}], + "plugin/no-low-performance-animation-properties": true, + "gamut/color-no-out-gamut-range": true } } diff --git a/CHANGELOG.md b/CHANGELOG.md index 3279ded..47264b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,10 +26,13 @@ See this project's [releases](/../../../releases). ### Changed - Replaced deprecated `MarkdownRenderer.renderMarkdown` to `MarkdownRenderer.render` +- Changed parsing of HTML tags ### Fixed - Parsing error for codeblock delimiters +- Readded scrollbar after css bug caused it to disappear +- Fixed `wrap` parameter actually applying class `.unwrapped` ## [1.0.5] - 2023-08-11 diff --git a/main.js b/main.js index 4295e3a..74fe899 100644 --- a/main.js +++ b/main.js @@ -12,15 +12,15 @@ var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; -var __export = (target, all2) => { - for (var name in all2) - __defProp(target, name, { get: all2[name], enumerable: true }); +var __export = (target, all3) => { + for (var name in all3) + __defProp(target, name, { get: all3[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + for (let key2 of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key2) && key2 !== except) + __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable }); } return to; }; @@ -52,13 +52,13 @@ var require_pickr_min = __commonJS({ var o2 = {}; function n2(t3, e3, o3, n3, i3 = {}) { e3 instanceof HTMLCollection || e3 instanceof NodeList ? e3 = Array.from(e3) : Array.isArray(e3) || (e3 = [e3]), Array.isArray(o3) || (o3 = [o3]); - for (const s3 of e3) + for (const s4 of e3) for (const e4 of o3) - s3[t3](e4, n3, { capture: false, ...i3 }); + s4[t3](e4, n3, { capture: false, ...i3 }); return Array.prototype.slice.call(arguments, 1); } - t2.r(o2), t2.d(o2, { adjustableInputNumbers: () => p2, createElementFromString: () => r2, createFromTemplate: () => a2, eventPath: () => l2, off: () => s2, on: () => i2, resolveElement: () => c2 }); - const i2 = n2.bind(null, "addEventListener"), s2 = n2.bind(null, "removeEventListener"); + t2.r(o2), t2.d(o2, { adjustableInputNumbers: () => p3, createElementFromString: () => r2, createFromTemplate: () => a2, eventPath: () => l2, off: () => s3, on: () => i2, resolveElement: () => c2 }); + const i2 = n2.bind(null, "addEventListener"), s3 = n2.bind(null, "removeEventListener"); function r2(t3) { const e3 = document.createElement("div"); return e3.innerHTML = t3.trim(), e3.firstElementChild; @@ -68,8 +68,8 @@ var require_pickr_min = __commonJS({ const o4 = t4.getAttribute(e4); return t4.removeAttribute(e4), o4; }, o3 = (t4, n3 = {}) => { - const i3 = e3(t4, ":obj"), s3 = e3(t4, ":ref"), r3 = i3 ? n3[i3] = {} : n3; - s3 && (n3[s3] = t4); + const i3 = e3(t4, ":obj"), s4 = e3(t4, ":ref"), r3 = i3 ? n3[i3] = {} : n3; + s4 && (n3[s4] = t4); for (const n4 of Array.from(t4.children)) { const t5 = e3(n4, ":arr"), i4 = o3(n4, t5 ? {} : r3); t5 && (r3[t5] || (r3[t5] = [])).push(Object.keys(i4).length ? i4 : n4); @@ -90,32 +90,32 @@ var require_pickr_min = __commonJS({ function c2(t3) { return t3 instanceof Element ? t3 : "string" == typeof t3 ? t3.split(/>>/g).reduce((t4, e3, o3, n3) => (t4 = t4.querySelector(e3), o3 < n3.length - 1 ? t4.shadowRoot : t4), document) : null; } - function p2(t3, e3 = (t4) => t4) { + function p3(t3, e3 = (t4) => t4) { function o3(o4) { const n3 = [1e-3, 0.01, 0.1][Number(o4.shiftKey || 2 * o4.ctrlKey)] * (o4.deltaY < 0 ? 1 : -1); - let i3 = 0, s3 = t3.selectionStart; - t3.value = t3.value.replace(/[\d.]+/g, (t4, o5) => o5 <= s3 && o5 + t4.length >= s3 ? (s3 = o5, e3(Number(t4), n3, i3)) : (i3++, t4)), t3.focus(), t3.setSelectionRange(s3, s3), o4.preventDefault(), t3.dispatchEvent(new Event("input")); + let i3 = 0, s4 = t3.selectionStart; + t3.value = t3.value.replace(/[\d.]+/g, (t4, o5) => o5 <= s4 && o5 + t4.length >= s4 ? (s4 = o5, e3(Number(t4), n3, i3)) : (i3++, t4)), t3.focus(), t3.setSelectionRange(s4, s4), o4.preventDefault(), t3.dispatchEvent(new Event("input")); } - i2(t3, "focus", () => i2(window, "wheel", o3, { passive: false })), i2(t3, "blur", () => s2(window, "wheel", o3)); + i2(t3, "focus", () => i2(window, "wheel", o3, { passive: false })), i2(t3, "blur", () => s3(window, "wheel", o3)); } - const { min: u2, max: h2, floor: d2, round: m2 } = Math; + const { min: u2, max: h3, floor: d2, round: m2 } = Math; function f2(t3, e3, o3) { e3 /= 100, o3 /= 100; - const n3 = d2(t3 = t3 / 360 * 6), i3 = t3 - n3, s3 = o3 * (1 - e3), r3 = o3 * (1 - i3 * e3), a3 = o3 * (1 - (1 - i3) * e3), l3 = n3 % 6; - return [255 * [o3, r3, s3, s3, a3, o3][l3], 255 * [a3, o3, o3, r3, s3, s3][l3], 255 * [s3, s3, a3, o3, o3, r3][l3]]; + const n3 = d2(t3 = t3 / 360 * 6), i3 = t3 - n3, s4 = o3 * (1 - e3), r3 = o3 * (1 - i3 * e3), a3 = o3 * (1 - (1 - i3) * e3), l3 = n3 % 6; + return [255 * [o3, r3, s4, s4, a3, o3][l3], 255 * [a3, o3, o3, r3, s4, s4][l3], 255 * [s4, s4, a3, o3, o3, r3][l3]]; } function v2(t3, e3, o3) { const n3 = (2 - (e3 /= 100)) * (o3 /= 100) / 2; return 0 !== n3 && (e3 = 1 === n3 ? 0 : n3 < 0.5 ? e3 * o3 / (2 * n3) : e3 * o3 / (2 - 2 * n3)), [t3, 100 * e3, 100 * n3]; } function b2(t3, e3, o3) { - const n3 = u2(t3 /= 255, e3 /= 255, o3 /= 255), i3 = h2(t3, e3, o3), s3 = i3 - n3; + const n3 = u2(t3 /= 255, e3 /= 255, o3 /= 255), i3 = h3(t3, e3, o3), s4 = i3 - n3; let r3, a3; - if (0 === s3) + if (0 === s4) r3 = a3 = 0; else { - a3 = s3 / i3; - const n4 = ((i3 - t3) / 6 + s3 / 2) / s3, l3 = ((i3 - e3) / 6 + s3 / 2) / s3, c3 = ((i3 - o3) / 6 + s3 / 2) / s3; + a3 = s4 / i3; + const n4 = ((i3 - t3) / 6 + s4 / 2) / s4, l3 = ((i3 - e3) / 6 + s4 / 2) / s4, c3 = ((i3 - o3) / 6 + s4 / 2) / s4; t3 === i3 ? r3 = c3 - l3 : e3 === i3 ? r3 = 1 / 3 + n4 - c3 : o3 === i3 && (r3 = 2 / 3 + l3 - n4), r3 < 0 ? r3 += 1 : r3 > 1 && (r3 -= 1); } return [360 * r3, 100 * a3, 100 * i3]; @@ -145,17 +145,17 @@ var require_pickr_min = __commonJS({ for (const i3 in e3) { if (!(n3 = e3[i3].exec(t3))) continue; - const s3 = (t4) => !!n3[2] == ("number" == typeof t4); + const s4 = (t4) => !!n3[2] == ("number" == typeof t4); switch (i3) { case "cmyk": { - const [, t4, e4, s4, r3] = o3(n3); - if (t4 > 100 || e4 > 100 || s4 > 100 || r3 > 100) + const [, t4, e4, s5, r3] = o3(n3); + if (t4 > 100 || e4 > 100 || s5 > 100 || r3 > 100) break t; - return { values: y2(t4, e4, s4, r3), type: i3 }; + return { values: y2(t4, e4, s5, r3), type: i3 }; } case "rgba": { const [, , , t4, e4, r3, a3] = o3(n3); - if (t4 > 255 || e4 > 255 || r3 > 255 || a3 < 0 || a3 > 1 || !s3(a3)) + if (t4 > 255 || e4 > 255 || r3 > 255 || a3 < 0 || a3 > 1 || !s4(a3)) break t; return { values: [...b2(t4, e4, r3), a3], a: a3, type: i3 }; } @@ -168,13 +168,13 @@ var require_pickr_min = __commonJS({ } case "hsla": { const [, , , t4, e4, r3, a3] = o3(n3); - if (t4 > 360 || e4 > 100 || r3 > 100 || a3 < 0 || a3 > 1 || !s3(a3)) + if (t4 > 360 || e4 > 100 || r3 > 100 || a3 < 0 || a3 > 1 || !s4(a3)) break t; return { values: [...g2(t4, e4, r3), a3], a: a3, type: i3 }; } case "hsva": { const [, , , t4, e4, r3, a3] = o3(n3); - if (t4 > 360 || e4 > 100 || r3 > 100 || a3 < 0 || a3 > 1 || !s3(a3)) + if (t4 > 360 || e4 > 100 || r3 > 100 || a3 < 0 || a3 > 1 || !s4(a3)) break t; return { values: [t4, e4, r3, a3], a: a3, type: i3 }; } @@ -183,71 +183,71 @@ var require_pickr_min = __commonJS({ return { values: null, type: null }; } function A2(t3 = 0, e3 = 0, o3 = 0, n3 = 1) { - const i3 = (t4, e4) => (o4 = -1) => e4(~o4 ? t4.map((t5) => Number(t5.toFixed(o4))) : t4), s3 = { h: t3, s: e3, v: o3, a: n3, toHSVA() { - const t4 = [s3.h, s3.s, s3.v, s3.a]; - return t4.toString = i3(t4, (t5) => `hsva(${t5[0]}, ${t5[1]}%, ${t5[2]}%, ${s3.a})`), t4; + const i3 = (t4, e4) => (o4 = -1) => e4(~o4 ? t4.map((t5) => Number(t5.toFixed(o4))) : t4), s4 = { h: t3, s: e3, v: o3, a: n3, toHSVA() { + const t4 = [s4.h, s4.s, s4.v, s4.a]; + return t4.toString = i3(t4, (t5) => `hsva(${t5[0]}, ${t5[1]}%, ${t5[2]}%, ${s4.a})`), t4; }, toHSLA() { - const t4 = [...v2(s3.h, s3.s, s3.v), s3.a]; - return t4.toString = i3(t4, (t5) => `hsla(${t5[0]}, ${t5[1]}%, ${t5[2]}%, ${s3.a})`), t4; + const t4 = [...v2(s4.h, s4.s, s4.v), s4.a]; + return t4.toString = i3(t4, (t5) => `hsla(${t5[0]}, ${t5[1]}%, ${t5[2]}%, ${s4.a})`), t4; }, toRGBA() { - const t4 = [...f2(s3.h, s3.s, s3.v), s3.a]; - return t4.toString = i3(t4, (t5) => `rgba(${t5[0]}, ${t5[1]}, ${t5[2]}, ${s3.a})`), t4; + const t4 = [...f2(s4.h, s4.s, s4.v), s4.a]; + return t4.toString = i3(t4, (t5) => `rgba(${t5[0]}, ${t5[1]}, ${t5[2]}, ${s4.a})`), t4; }, toCMYK() { const t4 = function(t5, e4, o4) { - const n4 = f2(t5, e4, o4), i4 = n4[0] / 255, s4 = n4[1] / 255, r3 = n4[2] / 255, a3 = u2(1 - i4, 1 - s4, 1 - r3); - return [100 * (1 === a3 ? 0 : (1 - i4 - a3) / (1 - a3)), 100 * (1 === a3 ? 0 : (1 - s4 - a3) / (1 - a3)), 100 * (1 === a3 ? 0 : (1 - r3 - a3) / (1 - a3)), 100 * a3]; - }(s3.h, s3.s, s3.v); + const n4 = f2(t5, e4, o4), i4 = n4[0] / 255, s5 = n4[1] / 255, r3 = n4[2] / 255, a3 = u2(1 - i4, 1 - s5, 1 - r3); + return [100 * (1 === a3 ? 0 : (1 - i4 - a3) / (1 - a3)), 100 * (1 === a3 ? 0 : (1 - s5 - a3) / (1 - a3)), 100 * (1 === a3 ? 0 : (1 - r3 - a3) / (1 - a3)), 100 * a3]; + }(s4.h, s4.s, s4.v); return t4.toString = i3(t4, (t5) => `cmyk(${t5[0]}%, ${t5[1]}%, ${t5[2]}%, ${t5[3]}%)`), t4; }, toHEXA() { const t4 = function(t5, e5, o4) { return f2(t5, e5, o4).map((t6) => m2(t6).toString(16).padStart(2, "0")); - }(s3.h, s3.s, s3.v), e4 = s3.a >= 1 ? "" : Number((255 * s3.a).toFixed(0)).toString(16).toUpperCase().padStart(2, "0"); + }(s4.h, s4.s, s4.v), e4 = s4.a >= 1 ? "" : Number((255 * s4.a).toFixed(0)).toString(16).toUpperCase().padStart(2, "0"); return e4 && t4.push(e4), t4.toString = () => `#${t4.join("").toUpperCase()}`, t4; - }, clone: () => A2(s3.h, s3.s, s3.v, s3.a) }; - return s3; + }, clone: () => A2(s4.h, s4.s, s4.v, s4.a) }; + return s4; } const C2 = (t3) => Math.max(Math.min(t3, 1), 0); - function $2(t3) { + function $3(t3) { const e3 = { options: Object.assign({ lock: null, onchange: () => 0, onstop: () => 0 }, t3), _keyboard(t4) { const { options: o4 } = e3, { type: n4, key: i3 } = t4; if (document.activeElement === o4.wrapper) { - const { lock: o5 } = e3.options, s3 = "ArrowUp" === i3, r4 = "ArrowRight" === i3, a3 = "ArrowDown" === i3, l3 = "ArrowLeft" === i3; - if ("keydown" === n4 && (s3 || r4 || a3 || l3)) { + const { lock: o5 } = e3.options, s4 = "ArrowUp" === i3, r4 = "ArrowRight" === i3, a3 = "ArrowDown" === i3, l3 = "ArrowLeft" === i3; + if ("keydown" === n4 && (s4 || r4 || a3 || l3)) { let n5 = 0, i4 = 0; - "v" === o5 ? n5 = s3 || r4 ? 1 : -1 : "h" === o5 ? n5 = s3 || r4 ? -1 : 1 : (i4 = s3 ? -1 : a3 ? 1 : 0, n5 = l3 ? -1 : r4 ? 1 : 0), e3.update(C2(e3.cache.x + 0.01 * n5), C2(e3.cache.y + 0.01 * i4)), t4.preventDefault(); + "v" === o5 ? n5 = s4 || r4 ? 1 : -1 : "h" === o5 ? n5 = s4 || r4 ? -1 : 1 : (i4 = s4 ? -1 : a3 ? 1 : 0, n5 = l3 ? -1 : r4 ? 1 : 0), e3.update(C2(e3.cache.x + 0.01 * n5), C2(e3.cache.y + 0.01 * i4)), t4.preventDefault(); } else i3.startsWith("Arrow") && (e3.options.onstop(), t4.preventDefault()); } }, _tapstart(t4) { i2(document, ["mouseup", "touchend", "touchcancel"], e3._tapstop), i2(document, ["mousemove", "touchmove"], e3._tapmove), t4.cancelable && t4.preventDefault(), e3._tapmove(t4); }, _tapmove(t4) { - const { options: o4, cache: n4 } = e3, { lock: i3, element: s3, wrapper: r4 } = o4, a3 = r4.getBoundingClientRect(); + const { options: o4, cache: n4 } = e3, { lock: i3, element: s4, wrapper: r4 } = o4, a3 = r4.getBoundingClientRect(); let l3 = 0, c3 = 0; if (t4) { const e4 = t4 && t4.touches && t4.touches[0]; l3 = t4 ? (e4 || t4).clientX : 0, c3 = t4 ? (e4 || t4).clientY : 0, l3 < a3.left ? l3 = a3.left : l3 > a3.left + a3.width && (l3 = a3.left + a3.width), c3 < a3.top ? c3 = a3.top : c3 > a3.top + a3.height && (c3 = a3.top + a3.height), l3 -= a3.left, c3 -= a3.top; } else n4 && (l3 = n4.x * a3.width, c3 = n4.y * a3.height); - "h" !== i3 && (s3.style.left = `calc(${l3 / a3.width * 100}% - ${s3.offsetWidth / 2}px)`), "v" !== i3 && (s3.style.top = `calc(${c3 / a3.height * 100}% - ${s3.offsetHeight / 2}px)`), e3.cache = { x: l3 / a3.width, y: c3 / a3.height }; - const p3 = C2(l3 / a3.width), u3 = C2(c3 / a3.height); + "h" !== i3 && (s4.style.left = `calc(${l3 / a3.width * 100}% - ${s4.offsetWidth / 2}px)`), "v" !== i3 && (s4.style.top = `calc(${c3 / a3.height * 100}% - ${s4.offsetHeight / 2}px)`), e3.cache = { x: l3 / a3.width, y: c3 / a3.height }; + const p4 = C2(l3 / a3.width), u3 = C2(c3 / a3.height); switch (i3) { case "v": - return o4.onchange(p3); + return o4.onchange(p4); case "h": return o4.onchange(u3); default: - return o4.onchange(p3, u3); + return o4.onchange(p4, u3); } }, _tapstop() { - e3.options.onstop(), s2(document, ["mouseup", "touchend", "touchcancel"], e3._tapstop), s2(document, ["mousemove", "touchmove"], e3._tapmove); + e3.options.onstop(), s3(document, ["mouseup", "touchend", "touchcancel"], e3._tapstop), s3(document, ["mousemove", "touchmove"], e3._tapmove); }, trigger() { e3._tapmove(); }, update(t4 = 0, o4 = 0) { - const { left: n4, top: i3, width: s3, height: r4 } = e3.options.wrapper.getBoundingClientRect(); - "h" === e3.options.lock && (o4 = t4), e3._tapmove({ clientX: n4 + s3 * t4, clientY: i3 + r4 * o4 }); + const { left: n4, top: i3, width: s4, height: r4 } = e3.options.wrapper.getBoundingClientRect(); + "h" === e3.options.lock && (o4 = t4), e3._tapmove({ clientX: n4 + s4 * t4, clientY: i3 + r4 * o4 }); }, destroy() { const { options: t4, _tapstart: o4, _keyboard: n4 } = e3; - s2(document, ["keydown", "keyup"], n4), s2([t4.wrapper, t4.element], "mousedown", o4), s2([t4.wrapper, t4.element], "touchstart", o4, { passive: false }); + s3(document, ["keydown", "keyup"], n4), s3([t4.wrapper, t4.element], "mousedown", o4), s3([t4.wrapper, t4.element], "touchstart", o4, { passive: false }); } }, { options: o3, _tapstart: n3, _keyboard: r3 } = e3; return i2([o3.wrapper, o3.element], "mousedown", n3), i2([o3.wrapper, o3.element], "touchstart", n3, { passive: false }), i2(document, ["keydown", "keyup"], r3), e3; } @@ -256,19 +256,19 @@ var require_pickr_min = __commonJS({ const e3 = i2(t3.elements, "click", (e4) => { t3.elements.forEach((o3) => o3.classList[e4.target === o3 ? "add" : "remove"](t3.className)), t3.onchange(e4), e4.stopPropagation(); }); - return { destroy: () => s2(...e3) }; + return { destroy: () => s3(...e3) }; } const S2 = { variantFlipOrder: { start: "sme", middle: "mse", end: "ems" }, positionFlipOrder: { top: "tbrl", right: "rltb", bottom: "btrl", left: "lrbt" }, position: "bottom", margin: 8 }, O2 = (t3, e3, o3) => { - const { container: n3, margin: i3, position: s3, variantFlipOrder: r3, positionFlipOrder: a3 } = { container: document.documentElement.getBoundingClientRect(), ...S2, ...o3 }, { left: l3, top: c3 } = e3.style; + const { container: n3, margin: i3, position: s4, variantFlipOrder: r3, positionFlipOrder: a3 } = { container: document.documentElement.getBoundingClientRect(), ...S2, ...o3 }, { left: l3, top: c3 } = e3.style; e3.style.left = "0", e3.style.top = "0"; - const p3 = t3.getBoundingClientRect(), u3 = e3.getBoundingClientRect(), h3 = { t: p3.top - u3.height - i3, b: p3.bottom + i3, r: p3.right + i3, l: p3.left - u3.width - i3 }, d3 = { vs: p3.left, vm: p3.left + p3.width / 2 + -u3.width / 2, ve: p3.left + p3.width - u3.width, hs: p3.top, hm: p3.bottom - p3.height / 2 - u3.height / 2, he: p3.bottom - u3.height }, [m3, f3 = "middle"] = s3.split("-"), v3 = a3[m3], b3 = r3[f3], { top: y3, left: g3, bottom: _3, right: w3 } = n3; + const p4 = t3.getBoundingClientRect(), u3 = e3.getBoundingClientRect(), h4 = { t: p4.top - u3.height - i3, b: p4.bottom + i3, r: p4.right + i3, l: p4.left - u3.width - i3 }, d3 = { vs: p4.left, vm: p4.left + p4.width / 2 + -u3.width / 2, ve: p4.left + p4.width - u3.width, hs: p4.top, hm: p4.bottom - p4.height / 2 - u3.height / 2, he: p4.bottom - u3.height }, [m3, f3 = "middle"] = s4.split("-"), v3 = a3[m3], b3 = r3[f3], { top: y3, left: g3, bottom: _3, right: w3 } = n3; for (const t4 of v3) { - const o4 = "t" === t4 || "b" === t4, n4 = h3[t4], [i4, s4] = o4 ? ["top", "left"] : ["left", "top"], [r4, a4] = o4 ? [u3.height, u3.width] : [u3.width, u3.height], [l4, c4] = o4 ? [_3, w3] : [w3, _3], [p4, m4] = o4 ? [y3, g3] : [g3, y3]; - if (!(n4 < p4 || n4 + r4 > l4)) + const o4 = "t" === t4 || "b" === t4, n4 = h4[t4], [i4, s5] = o4 ? ["top", "left"] : ["left", "top"], [r4, a4] = o4 ? [u3.height, u3.width] : [u3.width, u3.height], [l4, c4] = o4 ? [_3, w3] : [w3, _3], [p5, m4] = o4 ? [y3, g3] : [g3, y3]; + if (!(n4 < p5 || n4 + r4 > l4)) for (const r5 of b3) { const l5 = d3[(o4 ? "v" : "h") + r5]; if (!(l5 < m4 || l5 + a4 > c4)) - return e3.style[s4] = l5 - u3[s4] + "px", e3.style[i4] = n4 - u3[i4] + "px", t4 + r5; + return e3.style[s5] = l5 - u3[s5] + "px", e3.style[i4] = n4 - u3[i4] + "px", t4 + r5; } } return e3.style.left = l3, e3.style.top = c3, null; @@ -279,11 +279,11 @@ var require_pickr_min = __commonJS({ class L2 { constructor(t3) { E2(this, "_initializingActive", true), E2(this, "_recalc", true), E2(this, "_nanopop", null), E2(this, "_root", null), E2(this, "_color", A2()), E2(this, "_lastColor", A2()), E2(this, "_swatchColors", []), E2(this, "_setupAnimationFrame", null), E2(this, "_eventListener", { init: [], save: [], hide: [], show: [], clear: [], change: [], changestop: [], cancel: [], swatchselect: [] }), this.options = t3 = Object.assign({ ...L2.DEFAULT_OPTIONS }, t3); - const { swatches: e3, components: o3, theme: n3, sliders: i3, lockOpacity: s3, padding: r3 } = t3; + const { swatches: e3, components: o3, theme: n3, sliders: i3, lockOpacity: s4, padding: r3 } = t3; ["nano", "monolith"].includes(n3) && !i3 && (t3.sliders = "h"), o3.interaction || (o3.interaction = {}); - const { preview: a3, opacity: l3, hue: c3, palette: p3 } = o3; - o3.opacity = !s3 && l3, o3.palette = p3 || a3 || l3 || c3, this._preBuild(), this._buildComponents(), this._bindEvents(), this._finalBuild(), e3 && e3.length && e3.forEach((t4) => this.addSwatch(t4)); - const { button: u3, app: h3 } = this._root; + const { preview: a3, opacity: l3, hue: c3, palette: p4 } = o3; + o3.opacity = !s4 && l3, o3.palette = p4 || a3 || l3 || c3, this._preBuild(), this._buildComponents(), this._bindEvents(), this._finalBuild(), e3 && e3.length && e3.forEach((t4) => this.addSwatch(t4)); + const { button: u3, app: h4 } = this._root; this._nanopop = ((t4, e4, o4) => { const n4 = "object" != typeof t4 || t4 instanceof HTMLElement ? { reference: t4, popper: e4, ...o4 } : t4; return { update(t5 = n4) { @@ -292,10 +292,10 @@ var require_pickr_min = __commonJS({ throw new Error("Popper- or reference-element missing."); return O2(e5, o5, n4); } }; - })(u3, h3, { margin: r3 }), u3.setAttribute("role", "button"), u3.setAttribute("aria-label", this._t("btn:toggle")); + })(u3, h4, { margin: r3 }), u3.setAttribute("role", "button"), u3.setAttribute("aria-label", this._t("btn:toggle")); const d3 = this; this._setupAnimationFrame = requestAnimationFrame(function e4() { - if (!h3.offsetWidth) + if (!h4.offsetWidth) return requestAnimationFrame(e4); d3.setColor(t3.default), d3._rePositioningPicker(), t3.defaultRepresentation && (d3._representation = t3.defaultRepresentation, d3.setColorRepresentation(d3._representation)), t3.showAlways && d3.show(), d3._initializingActive = false, d3._emit("init"); }); @@ -305,12 +305,12 @@ var require_pickr_min = __commonJS({ for (const e3 of ["el", "container"]) t3[e3] = c2(t3[e3]); this._root = ((t4) => { - const { components: e3, useAsButton: o3, inline: n3, appClass: i3, theme: s3, lockOpacity: r3 } = t4.options, l3 = (t5) => t5 ? "" : 'style="display:none" hidden', c3 = (e4) => t4._t(e4), p3 = a2(` + const { components: e3, useAsButton: o3, inline: n3, appClass: i3, theme: s4, lockOpacity: r3 } = t4.options, l3 = (t5) => t5 ? "" : 'style="display:none" hidden', c3 = (e4) => t4._t(e4), p4 = a2(`
${o3 ? "" : ''} -
+
@@ -350,8 +350,8 @@ var require_pickr_min = __commonJS({
- `), u3 = p3.interaction; - return u3.options.find((t5) => !t5.hidden && !t5.classList.add("active")), u3.type = () => u3.options.find((t5) => t5.classList.contains("active")), p3; + `), u3 = p4.interaction; + return u3.options.find((t5) => !t5.hidden && !t5.classList.add("active")), u3.type = () => u3.options.find((t5) => t5.classList.contains("active")), p4; })(this), t3.useAsButton && (this._root.button = t3.el), t3.container.appendChild(this._root.root); } _finalBuild() { @@ -364,29 +364,29 @@ var require_pickr_min = __commonJS({ t3.useAsButton ? t3.inline && t3.el.remove() : t3.el.parentNode.replaceChild(e3.root, t3.el), t3.disabled && this.disable(), t3.comparison || (e3.button.style.transition = "none", t3.useAsButton || (e3.preview.lastColor.style.transition = "none")), this.hide(); } _buildComponents() { - const t3 = this, e3 = this.options.components, o3 = (t3.options.sliders || "v").repeat(2), [n3, i3] = o3.match(/^[vh]+$/g) ? o3 : [], s3 = () => this._color || (this._color = this._lastColor.clone()), r3 = { palette: $2({ element: t3._root.palette.picker, wrapper: t3._root.palette.palette, onstop: () => t3._emit("changestop", "slider", t3), onchange(o4, n4) { + const t3 = this, e3 = this.options.components, o3 = (t3.options.sliders || "v").repeat(2), [n3, i3] = o3.match(/^[vh]+$/g) ? o3 : [], s4 = () => this._color || (this._color = this._lastColor.clone()), r3 = { palette: $3({ element: t3._root.palette.picker, wrapper: t3._root.palette.palette, onstop: () => t3._emit("changestop", "slider", t3), onchange(o4, n4) { if (!e3.palette) return; - const i4 = s3(), { _root: r4, options: a3 } = t3, { lastColor: l3, currentColor: c3 } = r4.preview; + const i4 = s4(), { _root: r4, options: a3 } = t3, { lastColor: l3, currentColor: c3 } = r4.preview; t3._recalc && (i4.s = 100 * o4, i4.v = 100 - 100 * n4, i4.v < 0 && (i4.v = 0), t3._updateOutput("slider")); - const p3 = i4.toRGBA().toString(0); - this.element.style.background = p3, this.wrapper.style.background = ` + const p4 = i4.toRGBA().toString(0); + this.element.style.background = p4, this.wrapper.style.background = ` linear-gradient(to top, rgba(0, 0, 0, ${i4.a}), transparent), linear-gradient(to left, hsla(${i4.h}, 100%, 50%, ${i4.a}), rgba(255, 255, 255, ${i4.a})) - `, a3.comparison ? a3.useAsButton || t3._lastColor || l3.style.setProperty("--pcr-color", p3) : (r4.button.style.setProperty("--pcr-color", p3), r4.button.classList.remove("clear")); + `, a3.comparison ? a3.useAsButton || t3._lastColor || l3.style.setProperty("--pcr-color", p4) : (r4.button.style.setProperty("--pcr-color", p4), r4.button.classList.remove("clear")); const u3 = i4.toHEXA().toString(); for (const { el: e4, color: o5 } of t3._swatchColors) e4.classList[u3 === o5.toHEXA().toString() ? "add" : "remove"]("pcr-active"); - c3.style.setProperty("--pcr-color", p3); - } }), hue: $2({ lock: "v" === i3 ? "h" : "v", element: t3._root.hue.picker, wrapper: t3._root.hue.slider, onstop: () => t3._emit("changestop", "slider", t3), onchange(o4) { + c3.style.setProperty("--pcr-color", p4); + } }), hue: $3({ lock: "v" === i3 ? "h" : "v", element: t3._root.hue.picker, wrapper: t3._root.hue.slider, onstop: () => t3._emit("changestop", "slider", t3), onchange(o4) { if (!e3.hue || !e3.palette) return; - const n4 = s3(); + const n4 = s4(); t3._recalc && (n4.h = 360 * o4), this.element.style.backgroundColor = `hsl(${n4.h}, 100%, 50%)`, r3.palette.trigger(); - } }), opacity: $2({ lock: "v" === n3 ? "h" : "v", element: t3._root.opacity.picker, wrapper: t3._root.opacity.slider, onstop: () => t3._emit("changestop", "slider", t3), onchange(o4) { + } }), opacity: $3({ lock: "v" === n3 ? "h" : "v", element: t3._root.opacity.picker, wrapper: t3._root.opacity.slider, onstop: () => t3._emit("changestop", "slider", t3), onchange(o4) { if (!e3.opacity || !e3.palette) return; - const n4 = s3(); + const n4 = s4(); t3._recalc && (n4.a = Math.round(100 * o4) / 100), this.element.style.background = `rgba(0, 0, 0, ${n4.a})`, r3.palette.trigger(); } }), selectable: k2({ elements: t3._root.interaction.options, className: "active", onchange(e4) { t3._representation = e4.target.getAttribute("data-type").toUpperCase(), t3._recalc && t3._updateOutput("swatch"); @@ -411,11 +411,11 @@ var require_pickr_min = __commonJS({ } if (e3.adjustableNumbers) { const e4 = { rgba: [255, 255, 255, 1], hsva: [360, 100, 100, 1], hsla: [360, 100, 100, 1], cmyk: [100, 100, 100, 100] }; - p2(t3.interaction.result, (t4, o4, n3) => { + p3(t3.interaction.result, (t4, o4, n3) => { const i3 = e4[this.getColorRepresentation().toLowerCase()]; if (i3) { - const e5 = i3[n3], s3 = t4 + (e5 >= 100 ? 1e3 * o4 : o4); - return s3 <= 0 ? 0 : Number((s3 < e5 ? s3 : e5).toPrecision(3)); + const e5 = i3[n3], s4 = t4 + (e5 >= 100 ? 1e3 * o4 : o4); + return s4 <= 0 ? 0 : Number((s4 < e5 ? s4 : e5).toPrecision(3)); } return t4; }); @@ -453,8 +453,8 @@ var require_pickr_min = __commonJS({ o3.useAsButton || e3.button.style.setProperty("--pcr-color", "rgba(0, 0, 0, 0.15)"), e3.button.classList.add("clear"), o3.showAlways || this.hide(), this._lastColor = null, this._initializingActive || t3 || (this._emit("save", null), this._emit("clear")); } _parseLocalColor(t3) { - const { values: e3, type: o3, a: n3 } = w2(t3), { lockOpacity: i3 } = this.options, s3 = void 0 !== n3 && 1 !== n3; - return e3 && 3 === e3.length && (e3[3] = void 0), { values: !e3 || i3 && s3 ? null : e3, type: o3 }; + const { values: e3, type: o3, a: n3 } = w2(t3), { lockOpacity: i3 } = this.options, s4 = void 0 !== n3 && 1 !== n3; + return e3 && 3 === e3.length && (e3[3] = void 0), { values: !e3 || i3 && s4 ? null : e3, type: o3 }; } _t(t3) { return this.options.i18n[t3] || L2.I18N_DEFAULTS[t3]; @@ -472,8 +472,8 @@ var require_pickr_min = __commonJS({ addSwatch(t3) { const { values: e3 } = this._parseLocalColor(t3); if (e3) { - const { _swatchColors: t4, _root: o3 } = this, n3 = A2(...e3), s3 = r2(`