blue-web 1.17.5 → 1.17.7
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/js/auto-theme.bundle.js +1 -0
- package/dist/js/auto-theme.d.ts +26 -0
- package/dist/js/auto-theme.js +169 -0
- package/dist/js/color-mode.bundle.js +1 -1
- package/dist/js/dialog.bundle.js +1 -1
- package/dist/js/dialog.js +6 -50
- package/dist/js/edit-view.bundle.js +1 -1
- package/dist/js/input-splitted.bundle.js +1 -1
- package/dist/js/input-splitted.js +161 -154
- package/dist/js/progress.bundle.js +1 -1
- package/dist/js/progress.js +11 -6
- package/dist/js/read-view.bundle.js +1 -1
- package/dist/js/read-view.js +9 -47
- package/dist/js/select-list.bundle.js +1 -1
- package/dist/js/select-list.js +3 -3
- package/dist/js/side-layout.bundle.js +1 -1
- package/dist/js/side-layout.js +1 -140
- package/dist/js/utils.js +3 -3
- package/dist/merged.scss +429 -398
- package/dist/style.css +189 -41
- package/dist/style.css.map +1 -1
- package/dist/style.min.css +4 -4
- package/dist/style.scss +1 -1
- package/dist/styles/_layout.scss +22 -1
- package/dist/styles/_menu-item.scss +179 -193
- package/dist/styles/_tabs.scss +88 -80
- package/dist/styles/_variables.scss +3 -3
- package/dist/styles/mixins/_menu-item.scss +136 -120
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var e={};function t(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.d=(t,r)=>{for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);class r extends HTMLElement{constructor(){super(...arguments),t(this,"ancestorObservers",[]),t(this,"rafId",null)}static get observedAttributes(){return["dark-threshold"]}connectedCallback(){this.init()}disconnectedCallback(){this.cleanupObservers(),null!=this.rafId&&cancelAnimationFrame(this.rafId)}attributeChangedCallback(){this.scheduleUpdate()}init(){this.cleanupObservers(),this.observeAncestors(),this.updateTheme()}observeAncestors(){let e=this.parentElement;for(;e&&e!==document.documentElement;){const t=new MutationObserver(()=>this.scheduleUpdate());t.observe(e,{attributes:!0,attributeFilter:["class","style"]}),this.ancestorObservers.push(t),e=e.parentElement}[document.body,document.documentElement].forEach(e=>{if(!e)return;const t=new MutationObserver(()=>this.scheduleUpdate());t.observe(e,{attributes:!0,attributeFilter:["class","style"]}),this.ancestorObservers.push(t)})}cleanupObservers(){this.ancestorObservers.forEach(e=>e.disconnect()),this.ancestorObservers=[]}scheduleUpdate(){null==this.rafId&&(this.rafId=requestAnimationFrame(()=>{this.rafId=null,this.updateTheme()}))}getThreshold(){const e=parseFloat(this.getAttribute("dark-threshold")||"");return isNaN(e)?.5:Math.min(1,Math.max(0,e))}updateTheme(){const e=this.computeEffectiveBackground();e&&this.relativeLuminance(e.r,e.g,e.b)<this.getThreshold()?this.setAttribute("data-bs-theme","dark"):this.removeAttribute("data-bs-theme")}computeEffectiveBackground(){let e={r:0,g:0,b:0,a:0},t=this.parentElement;for(;t&&e.a<.999;){const r=getComputedStyle(t),s=this.parseColor(r.backgroundColor);s&&s.a>0&&(e=this.composite(s,e)),t=t.parentElement}if(e.a<.999){const t=this.parseColor(getComputedStyle(document.documentElement).backgroundColor)||this.parseColor(getComputedStyle(document.body).backgroundColor)||{r:255,g:255,b:255,a:1};e=this.composite(t,e)}return e}composite(e,t){const r=e.a+t.a*(1-e.a);return{r:(e.r*e.a+t.r*t.a*(1-e.a))/(r||1),g:(e.g*e.a+t.g*t.a*(1-e.a))/(r||1),b:(e.b*e.a+t.b*t.a*(1-e.a))/(r||1),a:r}}parseColor(e){if(!e)return null;const t=e.trim().match(/^rgba?\(\s*([\d.]+)[ ,]+([\d.]+)[ ,]+([\d.]+)(?:[ ,/]+([\d.]+))?\s*\)$/i);if(t)return{r:Number(t[1]),g:Number(t[2]),b:Number(t[3]),a:void 0!==t[4]?Number(t[4]):1};if("#"===e[0]){let t=e.slice(1);if(3===t.length&&(t=t.split("").map(e=>e+e).join("")),6===t.length||8===t.length)return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16),a:8===t.length?parseInt(t.slice(6,8),16)/255:1}}return null}relativeLuminance(e,t,r){const s=e=>{const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)};return.2126*s(e)+.7152*s(t)+.0722*s(r)}}customElements.define("bl-auto-theme",r)})();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <bl-auto-theme>
|
|
3
|
+
* Determines the effective (composed through transparent layers) background color
|
|
4
|
+
* behind the element and sets data-bs-theme="dark" if that color is dark.
|
|
5
|
+
*
|
|
6
|
+
* Attribute:
|
|
7
|
+
* - dark-threshold (0..1, default 0.5)
|
|
8
|
+
*/
|
|
9
|
+
export declare class AutoTheme extends HTMLElement {
|
|
10
|
+
private ancestorObservers;
|
|
11
|
+
private rafId;
|
|
12
|
+
static get observedAttributes(): string[];
|
|
13
|
+
connectedCallback(): void;
|
|
14
|
+
disconnectedCallback(): void;
|
|
15
|
+
attributeChangedCallback(): void;
|
|
16
|
+
private init;
|
|
17
|
+
private observeAncestors;
|
|
18
|
+
private cleanupObservers;
|
|
19
|
+
private scheduleUpdate;
|
|
20
|
+
private getThreshold;
|
|
21
|
+
private updateTheme;
|
|
22
|
+
private computeEffectiveBackground;
|
|
23
|
+
private composite;
|
|
24
|
+
private parseColor;
|
|
25
|
+
private relativeLuminance;
|
|
26
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
|
+
/**
|
|
5
|
+
* <bl-auto-theme>
|
|
6
|
+
* Determines the effective (composed through transparent layers) background color
|
|
7
|
+
* behind the element and sets data-bs-theme="dark" if that color is dark.
|
|
8
|
+
*
|
|
9
|
+
* Attribute:
|
|
10
|
+
* - dark-threshold (0..1, default 0.5)
|
|
11
|
+
*/
|
|
12
|
+
export class AutoTheme extends HTMLElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
_defineProperty(this, "ancestorObservers", []);
|
|
16
|
+
_defineProperty(this, "rafId", null);
|
|
17
|
+
}
|
|
18
|
+
static get observedAttributes() {
|
|
19
|
+
return ["dark-threshold"];
|
|
20
|
+
}
|
|
21
|
+
connectedCallback() {
|
|
22
|
+
this.init();
|
|
23
|
+
}
|
|
24
|
+
disconnectedCallback() {
|
|
25
|
+
this.cleanupObservers();
|
|
26
|
+
if (this.rafId != null) cancelAnimationFrame(this.rafId);
|
|
27
|
+
}
|
|
28
|
+
attributeChangedCallback() {
|
|
29
|
+
this.scheduleUpdate();
|
|
30
|
+
}
|
|
31
|
+
init() {
|
|
32
|
+
this.cleanupObservers();
|
|
33
|
+
this.observeAncestors();
|
|
34
|
+
this.updateTheme();
|
|
35
|
+
}
|
|
36
|
+
observeAncestors() {
|
|
37
|
+
// Observe style/class changes of all ancestors
|
|
38
|
+
let el = this.parentElement;
|
|
39
|
+
while (el && el !== document.documentElement) {
|
|
40
|
+
const mo = new MutationObserver(() => this.scheduleUpdate());
|
|
41
|
+
mo.observe(el, {
|
|
42
|
+
attributes: true,
|
|
43
|
+
attributeFilter: ["class", "style"]
|
|
44
|
+
});
|
|
45
|
+
this.ancestorObservers.push(mo);
|
|
46
|
+
el = el.parentElement;
|
|
47
|
+
}
|
|
48
|
+
// Also observe body / documentElement
|
|
49
|
+
;
|
|
50
|
+
[document.body, document.documentElement].forEach(root => {
|
|
51
|
+
if (!root) return;
|
|
52
|
+
const mo = new MutationObserver(() => this.scheduleUpdate());
|
|
53
|
+
mo.observe(root, {
|
|
54
|
+
attributes: true,
|
|
55
|
+
attributeFilter: ["class", "style"]
|
|
56
|
+
});
|
|
57
|
+
this.ancestorObservers.push(mo);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
cleanupObservers() {
|
|
61
|
+
this.ancestorObservers.forEach(o => o.disconnect());
|
|
62
|
+
this.ancestorObservers = [];
|
|
63
|
+
}
|
|
64
|
+
scheduleUpdate() {
|
|
65
|
+
if (this.rafId != null) return;
|
|
66
|
+
this.rafId = requestAnimationFrame(() => {
|
|
67
|
+
this.rafId = null;
|
|
68
|
+
this.updateTheme();
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
getThreshold() {
|
|
72
|
+
const v = parseFloat(this.getAttribute("dark-threshold") || "");
|
|
73
|
+
return isNaN(v) ? 0.5 : Math.min(1, Math.max(0, v));
|
|
74
|
+
}
|
|
75
|
+
updateTheme() {
|
|
76
|
+
const color = this.computeEffectiveBackground();
|
|
77
|
+
if (!color) {
|
|
78
|
+
this.removeAttribute("data-bs-theme");
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const luminance = this.relativeLuminance(color.r, color.g, color.b);
|
|
82
|
+
if (luminance < this.getThreshold()) {
|
|
83
|
+
this.setAttribute("data-bs-theme", "dark");
|
|
84
|
+
} else {
|
|
85
|
+
this.removeAttribute("data-bs-theme");
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Accumulates transparent layers (background-color only) of ancestors
|
|
90
|
+
computeEffectiveBackground() {
|
|
91
|
+
let accum = {
|
|
92
|
+
r: 0,
|
|
93
|
+
g: 0,
|
|
94
|
+
b: 0,
|
|
95
|
+
a: 0
|
|
96
|
+
};
|
|
97
|
+
let current = this.parentElement;
|
|
98
|
+
while (current && accum.a < 0.999) {
|
|
99
|
+
const cs = getComputedStyle(current);
|
|
100
|
+
const col = this.parseColor(cs.backgroundColor);
|
|
101
|
+
if (col && col.a > 0) {
|
|
102
|
+
accum = this.composite(col, accum);
|
|
103
|
+
}
|
|
104
|
+
current = current.parentElement;
|
|
105
|
+
}
|
|
106
|
+
if (accum.a < 0.999) {
|
|
107
|
+
const rootColor = this.parseColor(getComputedStyle(document.documentElement).backgroundColor) || this.parseColor(getComputedStyle(document.body).backgroundColor) || {
|
|
108
|
+
r: 255,
|
|
109
|
+
g: 255,
|
|
110
|
+
b: 255,
|
|
111
|
+
a: 1
|
|
112
|
+
};
|
|
113
|
+
accum = this.composite(rootColor, accum);
|
|
114
|
+
}
|
|
115
|
+
return accum;
|
|
116
|
+
}
|
|
117
|
+
composite(top, bottom) {
|
|
118
|
+
const a = top.a + bottom.a * (1 - top.a);
|
|
119
|
+
const r = (top.r * top.a + bottom.r * bottom.a * (1 - top.a)) / (a || 1);
|
|
120
|
+
const g = (top.g * top.a + bottom.g * bottom.a * (1 - top.a)) / (a || 1);
|
|
121
|
+
const b = (top.b * top.a + bottom.b * bottom.a * (1 - top.a)) / (a || 1);
|
|
122
|
+
return {
|
|
123
|
+
r,
|
|
124
|
+
g,
|
|
125
|
+
b,
|
|
126
|
+
a
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
parseColor(input) {
|
|
130
|
+
if (!input) return null;
|
|
131
|
+
const m = input.trim().match(/^rgba?\(\s*([\d.]+)[ ,]+([\d.]+)[ ,]+([\d.]+)(?:[ ,/]+([\d.]+))?\s*\)$/i);
|
|
132
|
+
if (m) {
|
|
133
|
+
return {
|
|
134
|
+
r: Number(m[1]),
|
|
135
|
+
g: Number(m[2]),
|
|
136
|
+
b: Number(m[3]),
|
|
137
|
+
a: m[4] !== undefined ? Number(m[4]) : 1
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
if (input[0] === "#") {
|
|
141
|
+
let hex = input.slice(1);
|
|
142
|
+
if (hex.length === 3) hex = hex.split("").map(c => c + c).join("");
|
|
143
|
+
if (hex.length === 6 || hex.length === 8) {
|
|
144
|
+
const r = parseInt(hex.slice(0, 2), 16);
|
|
145
|
+
const g = parseInt(hex.slice(2, 4), 16);
|
|
146
|
+
const b = parseInt(hex.slice(4, 6), 16);
|
|
147
|
+
const a = hex.length === 8 ? parseInt(hex.slice(6, 8), 16) / 255 : 1;
|
|
148
|
+
return {
|
|
149
|
+
r,
|
|
150
|
+
g,
|
|
151
|
+
b,
|
|
152
|
+
a
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
relativeLuminance(r, g, b) {
|
|
159
|
+
const toLin = c => {
|
|
160
|
+
const v = c / 255;
|
|
161
|
+
return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
|
|
162
|
+
};
|
|
163
|
+
const R = toLin(r);
|
|
164
|
+
const G = toLin(g);
|
|
165
|
+
const B = toLin(b);
|
|
166
|
+
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
customElements.define("bl-auto-theme", AutoTheme);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";const e=()=>localStorage.getItem("blue-web-color-mode"),t=()=>e()||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),o=()=>{const e=t();"auto"===e&&window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.setAttribute("data-bs-theme","dark"):document.documentElement.setAttribute("data-bs-theme",e)};window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",(
|
|
1
|
+
(()=>{"use strict";const e=()=>localStorage.getItem("blue-web-color-mode"),t=()=>e()||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),o=()=>{const e=t();"auto"===e&&window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.setAttribute("data-bs-theme","dark"):document.documentElement.setAttribute("data-bs-theme",e)};window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{localStorage.removeItem("blue-web-color-mode"),o()}),o(),window.blueWeb=window.blueWeb||{},window.blueWeb.colorMode={getStored:e,getPreferred:t,set:e=>{"auto"===e?localStorage.removeItem("blue-web-color-mode"):localStorage.setItem("blue-web-color-mode",e),o()},init:o}})();
|
package/dist/js/dialog.bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var
|
|
1
|
+
(()=>{"use strict";var n={762:(n,e,t)=>{function o(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}t.d(e,{Os:()=>a});const a=()=>o()+o()+"-"+o()+"-"+o()+"-"+o()+"-"+o()+o()+o()},786:(n,e,t)=>{t.d(e,{k:()=>a});const o={Cancel:["Cancel","Abbrechen"],Yes:["Yes","Ja"],No:["No","Nein"],Message:["Message","Nachricht"],"Toggle menu":["Toggle menu","Menü umschalten"],"Close all":["Close all","Alle schließen"],Error:["Error","Fehler"],Information:["Information","Information"]};function a(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return e=e||navigator.language.toLowerCase().indexOf("de")>-1?"de-DE":"en-US",t=t||o,t[n]?e.indexOf("de-")>-1?t[n][1]:t[n][0]:n}}},e={};function t(o){var a=e[o];if(void 0!==a)return a.exports;var l=e[o]={exports:{}};return n[o](l,l.exports,t),l.exports}t.d=(n,e)=>{for(var o in e)t.o(e,o)&&!t.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:e[o]})},t.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e);var o=t(762),a=t(786);async function l(n,e){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{title:l=(0,a.k)("Message"),icon:c,switchPrimaryBtn:i=!1,acceptBtnText:r=("verify"===n?(0,a.k)("Yes"):"OK"),cancelBtnText:s=("verify"===n?(0,a.k)("No"):(0,a.k)("Cancel")),inputType:d="text",defaultValue:u}="string"==typeof t?JSON.parse(t):t;const m=(0,o.Os)();return document.getElementById(m)||document.body.insertAdjacentHTML("beforeend",'<dialog class="blue-modal modal" id="'.concat(m,'" aria-labelledby="').concat(m,'-label">\n <div class="modal-dialog">\n <div class="modal-content">\n <form>\n <div class="modal-header">\n ').concat(c?'<div class="me-2">'.concat(c,"</div>"):"",'\n <h1 class="modal-title fs-5" id="').concat(m,'-label">').concat(l,'</h1>\n <button\n type="button"\n class="btn-close"\n aria-label="').concat(s,'"\n onclick="document.getElementById(\'').concat(m,'\').close()"\n ></button>\n </div>\n <div class="modal-body">\n ').concat("ask"===n?'<label for="'.concat(m,'-input">').concat(e,'</label>\n <input\n type="').concat(d,'"\n ').concat(void 0!==u?' value="'.concat(u,'"'):"",'\n id="').concat(m,'-input"\n class="form-control mt-3"\n />'):e,'\n </div>\n <div class="modal-footer">\n ').concat("verify"===n||"ask"===n?'<button\n type="button"\n class="btn '.concat(i?"btn-primary":"blue-btn-plain-primary",'"\n onclick="document.getElementById(\'').concat(m,"').close()\"\n >\n ").concat(s,"\n </button>"):"",'\n <button\n type="submit"\n class="btn ').concat(i?"blue-btn-plain-primary":"btn-primary",'"\n >\n ').concat(r,'\n </button>\n </div>\n </form>\n </div>\n </div>\n\n <form method="dialog" class="blue-modal-backdrop">\n <button>').concat(s,"</button>\n </form>\n </dialog>")),new Promise(e=>{var t;const o=document.getElementById(m),a=()=>{const n=document.getElementById(m);n&&n.remove()};null==o||o.showModal(),null==o||o.addEventListener("close",()=>{a(),e(!1)}),null==o||null===(t=o.querySelector(".modal-content > form"))||void 0===t||t.addEventListener("submit",t=>{t.preventDefault(),"ask"===n&&(o.close(),a(),e((null==o?void 0:o.querySelector("input")).value||"")),o.close(),a(),e(!0)})})}window.blueWeb=window.blueWeb||{},window.blueWeb.dialog={ask:async function(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return await l("ask",n,e)},tell:async function(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};await l("tell",n,e)},verify:async function(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!0===await l("verify",n,e)}}})();
|
package/dist/js/dialog.js
CHANGED
|
@@ -25,57 +25,13 @@ async function dialog(dialogType, text) {
|
|
|
25
25
|
} = typeof options === "string" ? JSON.parse(options) : options;
|
|
26
26
|
const id = guid();
|
|
27
27
|
const addToDom = () => {
|
|
28
|
-
document.body.insertAdjacentHTML("beforeend", /* HTML
|
|
29
|
-
<div class="modal-dialog">
|
|
30
|
-
<div class="modal-content">
|
|
31
|
-
<form>
|
|
32
|
-
<div class="modal-header">
|
|
33
|
-
${icon ? /* html */`<div class="me-2">${icon}</div>` : ""}
|
|
34
|
-
<h1 class="modal-title fs-5" id="${id}-label">${title}</h1>
|
|
35
|
-
<button
|
|
36
|
-
type="button"
|
|
37
|
-
class="btn-close"
|
|
38
|
-
aria-label="${cancelBtnText}"
|
|
39
|
-
onclick="document.getElementById('${id}').close()"
|
|
40
|
-
></button>
|
|
41
|
-
</div>
|
|
42
|
-
<div class="modal-body">
|
|
43
|
-
${dialogType === "ask" ? /* HTML */`<label for="${id}-input">${text}</label>
|
|
44
|
-
<input
|
|
45
|
-
type="${inputType}"
|
|
46
|
-
${defaultValue !== undefined ? ` value="${defaultValue}"` : ""}
|
|
47
|
-
id="${id}-input"
|
|
48
|
-
class="form-control mt-3"
|
|
49
|
-
/>` : text}
|
|
50
|
-
</div>
|
|
51
|
-
<div class="modal-footer">
|
|
52
|
-
${dialogType === "verify" || dialogType === "ask" ? /* HTML */`<button
|
|
53
|
-
type="button"
|
|
54
|
-
class="btn ${switchPrimaryBtn ? "btn-primary" : "blue-btn-plain-primary"}"
|
|
55
|
-
onclick="document.getElementById('${id}').close()"
|
|
56
|
-
>
|
|
57
|
-
${cancelBtnText}
|
|
58
|
-
</button>` : ""}
|
|
59
|
-
<button
|
|
60
|
-
type="submit"
|
|
61
|
-
class="btn ${switchPrimaryBtn ? "blue-btn-plain-primary" : "btn-primary"}"
|
|
62
|
-
>
|
|
63
|
-
${acceptBtnText}
|
|
64
|
-
</button>
|
|
65
|
-
</div>
|
|
66
|
-
</form>
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
<form method="dialog" class="blue-modal-backdrop">
|
|
71
|
-
<button>${cancelBtnText}</button>
|
|
72
|
-
</form>
|
|
73
|
-
</dialog>`);
|
|
28
|
+
document.body.insertAdjacentHTML("beforeend", /* HTML */"<dialog class=\"blue-modal modal\" id=\"".concat(id, "\" aria-labelledby=\"").concat(id, "-label\">\n <div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <form>\n <div class=\"modal-header\">\n ").concat(icon ? /* html */"<div class=\"me-2\">".concat(icon, "</div>") : "", "\n <h1 class=\"modal-title fs-5\" id=\"").concat(id, "-label\">").concat(title, "</h1>\n <button\n type=\"button\"\n class=\"btn-close\"\n aria-label=\"").concat(cancelBtnText, "\"\n onclick=\"document.getElementById('").concat(id, "').close()\"\n ></button>\n </div>\n <div class=\"modal-body\">\n ").concat(dialogType === "ask" ? /* HTML */"<label for=\"".concat(id, "-input\">").concat(text, "</label>\n <input\n type=\"").concat(inputType, "\"\n ").concat(defaultValue !== undefined ? " value=\"".concat(defaultValue, "\"") : "", "\n id=\"").concat(id, "-input\"\n class=\"form-control mt-3\"\n />") : text, "\n </div>\n <div class=\"modal-footer\">\n ").concat(dialogType === "verify" || dialogType === "ask" ? /* HTML */"<button\n type=\"button\"\n class=\"btn ".concat(switchPrimaryBtn ? "btn-primary" : "blue-btn-plain-primary", "\"\n onclick=\"document.getElementById('").concat(id, "').close()\"\n >\n ").concat(cancelBtnText, "\n </button>") : "", "\n <button\n type=\"submit\"\n class=\"btn ").concat(switchPrimaryBtn ? "blue-btn-plain-primary" : "btn-primary", "\"\n >\n ").concat(acceptBtnText, "\n </button>\n </div>\n </form>\n </div>\n </div>\n\n <form method=\"dialog\" class=\"blue-modal-backdrop\">\n <button>").concat(cancelBtnText, "</button>\n </form>\n </dialog>"));
|
|
74
29
|
};
|
|
75
30
|
if (!document.getElementById(id)) {
|
|
76
31
|
addToDom();
|
|
77
32
|
}
|
|
78
33
|
return new Promise(resolve => {
|
|
34
|
+
var _modalEl$querySelecto;
|
|
79
35
|
const modalEl = document.getElementById(id);
|
|
80
36
|
const removeFromDom = () => {
|
|
81
37
|
const modalEl = document.getElementById(id);
|
|
@@ -87,14 +43,14 @@ async function dialog(dialogType, text) {
|
|
|
87
43
|
removeFromDom();
|
|
88
44
|
resolve(false);
|
|
89
45
|
};
|
|
90
|
-
modalEl
|
|
91
|
-
modalEl
|
|
92
|
-
modalEl
|
|
46
|
+
modalEl === null || modalEl === void 0 || modalEl.showModal();
|
|
47
|
+
modalEl === null || modalEl === void 0 || modalEl.addEventListener("close", onHidden);
|
|
48
|
+
modalEl === null || modalEl === void 0 || (_modalEl$querySelecto = modalEl.querySelector(".modal-content > form")) === null || _modalEl$querySelecto === void 0 || _modalEl$querySelecto.addEventListener("submit", e => {
|
|
93
49
|
e.preventDefault();
|
|
94
50
|
if (dialogType === "ask") {
|
|
95
51
|
modalEl.close();
|
|
96
52
|
removeFromDom();
|
|
97
|
-
resolve((modalEl
|
|
53
|
+
resolve((modalEl === null || modalEl === void 0 ? void 0 : modalEl.querySelector("input")).value || "");
|
|
98
54
|
}
|
|
99
55
|
modalEl.close();
|
|
100
56
|
removeFromDom();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";class e extends HTMLElement{connectedCallback(){this.render()}disconnectedCallback(){this.confirmTimeout&&clearTimeout(this.confirmTimeout)}render(){const e=document.createElement("form");e.style.position="relative";const t=Array.from(this.childNodes);this.appendChild(e),t.forEach(
|
|
1
|
+
(()=>{"use strict";class e extends HTMLElement{connectedCallback(){this.render()}disconnectedCallback(){this.confirmTimeout&&clearTimeout(this.confirmTimeout)}render(){const e=document.createElement("form");e.style.position="relative";const t=Array.from(this.childNodes);this.appendChild(e),t.forEach(t=>e.appendChild(t)),e.addEventListener("submit",this.onSubmit.bind(this)),e.addEventListener("keydown",this.onKeydown.bind(this)),e.addEventListener("focusout",this.onFocusout.bind(this))}onSubmit(e){e.preventDefault(),this.confirm()}onKeydown(e){"Esc"!==e.key&&"Escape"!==e.key||this.dismiss()}onFocusout(e){this.contains(e.relatedTarget)||(this.confirmTimeout&&clearTimeout(this.confirmTimeout),this.confirmTimeout=setTimeout(()=>{this.confirm(),this.confirmTimeout=null},500))}confirm(){this.dispatchEvent(new CustomEvent("Confirm",{bubbles:!0,composed:!0}))}dismiss(){this.dispatchEvent(new CustomEvent("Dismiss",{bubbles:!0,composed:!0}))}}customElements.define("edit-view",e)})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";
|
|
1
|
+
(()=>{"use strict";var t={};function e(t,e,s){i(t,e),e.set(t,s)}function i(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function s(t,e,i){return t.set(h(t,e),i),i}function n(t,e){return t.get(h(t,e))}function h(t,e,i){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:i;throw new TypeError("Private element is not present on this object")}t.d=(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},t.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var o=new WeakMap,r=new WeakMap,l=new WeakMap,a=new WeakMap,u=new WeakMap,c=new WeakMap,d=new WeakMap,p=new WeakMap,v=new WeakMap,g=new WeakSet;class b extends HTMLElement{get lightDom(){return n(a,this)}set lightDom(t){s(a,this,t),!0===this.lightDom?this.innerHTML=n(v,this):(this.shadowRoot||this.attachShadow({mode:"open",delegatesFocus:!0}),this.shadowRoot.innerHTML=n(v,this)),h(g,this,m).call(this)}get value(){return n(u,this)}set value(t){const e=n(u,this);s(u,this,t),s(r,this,this.value.split(""));for(let t=0;t<this.length;t++)n(l,this)[t]&&(n(l,this)[t].value=n(r,this)[t]||"");e!==t&&this.dispatchEvent(new CustomEvent("changeValue",{bubbles:!0,detail:t}))}get length(){return n(c,this)}set length(t){if(s(c,this,t),this.length>n(l,this).length)for(let t=0;t<this.length;t++)!n(l,this)[t]&&this.didInit&&h(g,this,f).call(this,n(l,this).length);else if(this.length<n(l,this).length){const t=Math.abs(n(l,this).length-this.length);for(let e=0;e<t;e++){const t=n(l,this).pop();null==t||t.remove()}}s(l,this,[...n(l,this)])}get controlClass(){return n(d,this)}set controlClass(t){s(d,this,t);for(const t of n(l,this))t.className=this.controlClass}get control1Id(){return n(p,this)}set control1Id(t){s(p,this,t),n(l,this)[0]&&(n(l,this)[0].id=this.control1Id)}constructor(){var t;super(),i(this,t=g),t.add(this),e(this,o,void 0),e(this,r,[]),e(this,l,[]),e(this,a,!1),e(this,u,""),e(this,c,0),e(this,d,""),e(this,p,""),e(this,v,"<style>\n input {\n display: var(--blue-input-splitted-display, revert);\n background-color: var(--blue-input-splitted-background-color, revert);\n border: var(--blue-input-splitted-border, revert);\n border-radius: var(--blue-input-splitted-border-radius, revert);\n box-shadow: var(--blue-input-splitted-box-shadow, revert);\n color: var(--blue-input-splitted-color, revert);\n margin: var(--blue-input-splitted-margin, revert);\n padding: var(--blue-input-splitted-padding, revert);\n text-align: var(--blue-input-splitted-text-align, revert);\n width: var(--blue-input-splitted-width, revert);\n }\n</style>"),function(t,e,i){(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i}(this,"didInit",!1),this.onFocus=this.onFocus.bind(this)}connectedCallback(){this.didInit=!0,this.lightDom=null!==this.getAttribute("light-dom"),h(g,this,m).call(this),this.value=this.getAttribute("value")||this.value,this.length=k(this),this.controlClass=this.getAttribute("control-class")||this.controlClass,this.control1Id=this.getAttribute("control-1-id")||this.control1Id,h(g,this,w).call(this)}onFocus(){n(l,this)[0]&&n(l,this)[0].focus()}disconnectedCallback(){h(g,this,y).call(this)}static get formAssociated(){return!0}}function f(t){const e=document.createElement("input");n(l,this).push(e),e.type="text",e.className=this.controlClass,0===t&&(e.id=this.control1Id),e.maxLength=1,e.value=n(r,this)[t]||"",e.addEventListener("input",e=>{let{target:i}=e;const s=i;""!==s.value&&n(l,this)[t+1]&&n(l,this)[t+1].focus(),n(r,this)[t]=s.value,this.value=n(r,this).join("")}),e.addEventListener("keydown",e=>{let{key:i,target:s}=e;"Backspace"===i&&""===s.value&&void 0!==n(l,this)[t-1]&&n(l,this)[t-1].focus()}),e.addEventListener("paste",e=>{let{clipboardData:i}=e;const s=i.getData("Text");let h=0;for(let e=t;e<this.length;e++)n(r,this)[e]=s.split("")[h],n(l,this)[e].focus(),h+=1;this.value=n(r,this).join("")}),this.lightDom?this.appendChild(e):this.shadowRoot.appendChild(e)}function m(){this.value=this.getAttribute("value")||"",this.length=k(this),this.lightDom?(this.innerHTML=n(v,this),this.addEventListener("focus",this.onFocus)):(this.shadowRoot.innerHTML=n(v,this),this.shadowRoot.addEventListener("focus",this.onFocus)),s(r,this,this.value.split("")),s(l,this,[]);for(let t=0;t<this.length;t++)h(g,this,f).call(this,t)}function w(){s(o,this,n(o,this)||new MutationObserver(t=>{t.forEach(t=>{"value"===t.attributeName&&(this.value=this.getAttribute("value")||this.value),"length"===t.attributeName&&(this.length=k(this)),"control-class"===t.attributeName&&(this.controlClass=this.getAttribute("control-class")||this.controlClass),"control-1-id"===t.attributeName&&(this.control1Id=this.getAttribute("control-1-id")||this.control1Id),"light-dom"===t.attributeName&&(this.lightDom=null!==this.getAttribute("light-dom"))})})),n(o,this).observe(this,{attributeFilter:["value","length","control-class","control-1-id","light-dom"],attributeOldValue:!0,childList:!0,subtree:!0})}function y(){n(o,this)&&(n(o,this).takeRecords(),n(o,this).disconnect())}function k(t){const e=t.getAttribute("length");if(e)return parseInt(e)}customElements.define("bl-input-splitted",b)})();
|