blue-web 1.0.0 → 1.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.
@@ -0,0 +1,12 @@
1
+ export type DialogType = "ask" | "tell" | "verify";
2
+ export interface DialogOptions {
3
+ title?: string;
4
+ icon?: string;
5
+ switchPrimaryBtn?: boolean;
6
+ acceptBtnText?: string;
7
+ cancelBtnText?: string;
8
+ inputType?: string;
9
+ }
10
+ export declare function ask(text: string, options?: DialogOptions): Promise<string | boolean>;
11
+ export declare function tell(text: string, options?: DialogOptions): Promise<void>;
12
+ export declare function verify(text: string, options?: DialogOptions): Promise<boolean>;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ask = ask;
7
+ exports.tell = tell;
8
+ exports.verify = verify;
9
+ var _utils = require("./utils");
10
+ var _shared = require("./shared");
11
+ var bootstrap = _interopRequireWildcard(require("bootstrap"));
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
+ async function ask(text) {
15
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16
+ return await dialog("ask", text, options);
17
+ }
18
+ async function tell(text) {
19
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20
+ await dialog("tell", text, options);
21
+ }
22
+ async function verify(text) {
23
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24
+ return (await dialog("verify", text, options)) === true;
25
+ }
26
+ async function dialog(dialogType, text) {
27
+ let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
28
+ let {
29
+ title = (0, _shared.getPhrase)("Message"),
30
+ icon = undefined,
31
+ switchPrimaryBtn = false,
32
+ acceptBtnText = dialogType === "verify" ? (0, _shared.getPhrase)("Yes") : "OK",
33
+ cancelBtnText = dialogType === "verify" ? (0, _shared.getPhrase)("No") : (0, _shared.getPhrase)("Cancel"),
34
+ inputType = "text"
35
+ } = options;
36
+ const id = (0, _utils.guid)();
37
+ const addToDom = () => {
38
+ document.body.insertAdjacentHTML("beforeend", /* html */" <div\nclass=\"modal fade\"\nid=\"".concat(id, "\"\ntabindex=\"-1\"\naria-labelledby=\"").concat(id, "-label\"\naria-hidden=\"true\"\n>\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\">\n ").concat(title, "\n </h1>\n <button\n type=\"button\"\n class=\"btn-close\"\n data-bs-dismiss=\"modal\"\n aria-label=\"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 type=\"").concat(inputType, "\" id=\"").concat(id, "-input\" class=\"form-control mt-3\" />") : 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 data-bs-dismiss=\"modal\"\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</div>"));
39
+ };
40
+ if (!document.getElementById(id)) {
41
+ addToDom();
42
+ }
43
+ return new Promise(resolve => {
44
+ var _modalEl$querySelecto;
45
+ const modalEl = document.getElementById(id);
46
+ const modal = new bootstrap.Modal(modalEl);
47
+ const removeFromDom = () => {
48
+ const modalEl = document.getElementById(id);
49
+ if (modalEl) {
50
+ modalEl.removeEventListener("hidden.bs.modal", onHidden);
51
+ modalEl.remove();
52
+ }
53
+ };
54
+ const onHidden = () => {
55
+ removeFromDom();
56
+ resolve(false);
57
+ };
58
+ modal.show();
59
+ modalEl === null || modalEl === void 0 || modalEl.addEventListener("hidden.bs.modal", onHidden);
60
+ modalEl === null || modalEl === void 0 || (_modalEl$querySelecto = modalEl.querySelector("form")) === null || _modalEl$querySelecto === void 0 || _modalEl$querySelecto.addEventListener("submit", e => {
61
+ e.preventDefault();
62
+ if (dialogType === "ask") {
63
+ modal.hide();
64
+ removeFromDom();
65
+ resolve((modalEl === null || modalEl === void 0 ? void 0 : modalEl.querySelector("input")).value || "");
66
+ }
67
+ modal.hide();
68
+ removeFromDom();
69
+ resolve(true);
70
+ });
71
+ });
72
+ }
@@ -0,0 +1,2 @@
1
+ /*! For license information please see modal.bundle.js.LICENSE.txt */
2
+ (()=>{var t={11:function(t,e,n){t.exports=function(t,e,n,i){"use strict";return class extends n{constructor(e,n){super(),(e=i.getElement(e))&&(this._element=e,this._config=this._getConfig(n),t.set(this._element,this.constructor.DATA_KEY,this))}dispose(){t.remove(this._element,this.constructor.DATA_KEY),e.off(this._element,this.constructor.EVENT_KEY);for(const t of Object.getOwnPropertyNames(this))this[t]=null}_queueCallback(t,e,n=!0){i.executeAfterTransition(t,e,n)}_getConfig(t){return t=this._mergeConfigObj(t,this._element),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}static getInstance(e){return t.get(i.getElement(e),this.DATA_KEY)}static getOrCreateInstance(t,e={}){return this.getInstance(t)||new this(t,"object"==typeof e?e:null)}static get VERSION(){return"5.3.3"}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(t){return`${t}${this.EVENT_KEY}`}}}(n(269),n(956),n(105),n(35))},269:function(t){t.exports=function(){"use strict";const t=new Map;return{set(e,n,i){t.has(e)||t.set(e,new Map);const s=t.get(e);s.has(n)||0===s.size?s.set(n,i):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(s.keys())[0]}.`)},get:(e,n)=>t.has(e)&&t.get(e).get(n)||null,remove(e,n){if(!t.has(e))return;const i=t.get(e);i.delete(n),0===i.size&&t.delete(e)}}}()},956:function(t,e,n){t.exports=function(t){"use strict";const e=/[^.]*(?=\..*)\.|.*/,n=/\..*/,i=/::\d+$/,s={};let o=1;const r={mouseenter:"mouseover",mouseleave:"mouseout"},l=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function a(t,e){return e&&`${e}::${o++}`||t.uidEvent||o++}function c(t){const e=a(t);return t.uidEvent=e,s[e]=s[e]||{},s[e]}function u(t,e,n=null){return Object.values(t).find((t=>t.callable===e&&t.delegationSelector===n))}function d(t,e,n){const i="string"==typeof e,s=i?n:e||n;let o=g(t);return l.has(o)||(o=t),[i,s,o]}function h(t,n,i,s,o){if("string"!=typeof n||!t)return;let[l,h,f]=d(n,i,s);if(n in r){const t=t=>function(e){if(!e.relatedTarget||e.relatedTarget!==e.delegateTarget&&!e.delegateTarget.contains(e.relatedTarget))return t.call(this,e)};h=t(h)}const m=c(t),g=m[f]||(m[f]={}),b=u(g,h,l?i:null);if(b)return void(b.oneOff=b.oneOff&&o);const y=a(h,n.replace(e,"")),E=l?function(t,e,n){return function i(s){const o=t.querySelectorAll(e);for(let{target:r}=s;r&&r!==this;r=r.parentNode)for(const l of o)if(l===r)return _(s,{delegateTarget:r}),i.oneOff&&p.off(t,s.type,e,n),n.apply(r,[s])}}(t,i,h):function(t,e){return function n(i){return _(i,{delegateTarget:t}),n.oneOff&&p.off(t,i.type,e),e.apply(t,[i])}}(t,h);E.delegationSelector=l?i:null,E.callable=h,E.oneOff=o,E.uidEvent=y,g[y]=E,t.addEventListener(f,E,l)}function f(t,e,n,i,s){const o=u(e[n],i,s);o&&(t.removeEventListener(n,o,Boolean(s)),delete e[n][o.uidEvent])}function m(t,e,n,i){const s=e[n]||{};for(const[o,r]of Object.entries(s))o.includes(i)&&f(t,e,n,r.callable,r.delegationSelector)}function g(t){return t=t.replace(n,""),r[t]||t}const p={on(t,e,n,i){h(t,e,n,i,!1)},one(t,e,n,i){h(t,e,n,i,!0)},off(t,e,n,s){if("string"!=typeof e||!t)return;const[o,r,l]=d(e,n,s),a=l!==e,u=c(t),h=u[l]||{},g=e.startsWith(".");if(void 0===r){if(g)for(const n of Object.keys(u))m(t,u,n,e.slice(1));for(const[n,s]of Object.entries(h)){const o=n.replace(i,"");a&&!e.includes(o)||f(t,u,l,s.callable,s.delegationSelector)}}else{if(!Object.keys(h).length)return;f(t,u,l,r,o?n:null)}},trigger(e,n,i){if("string"!=typeof n||!e)return null;const s=t.getjQuery();let o=null,r=!0,l=!0,a=!1;n!==g(n)&&s&&(o=s.Event(n,i),s(e).trigger(o),r=!o.isPropagationStopped(),l=!o.isImmediatePropagationStopped(),a=o.isDefaultPrevented());const c=_(new Event(n,{bubbles:r,cancelable:!0}),i);return a&&c.preventDefault(),l&&e.dispatchEvent(c),c.defaultPrevented&&o&&o.preventDefault(),c}};function _(t,e={}){for(const[n,i]of Object.entries(e))try{t[n]=i}catch(e){Object.defineProperty(t,n,{configurable:!0,get:()=>i})}return t}return p}(n(35))},333:function(t){t.exports=function(){"use strict";function t(t){if("true"===t)return!0;if("false"===t)return!1;if(t===Number(t).toString())return Number(t);if(""===t||"null"===t)return null;if("string"!=typeof t)return t;try{return JSON.parse(decodeURIComponent(t))}catch(e){return t}}function e(t){return t.replace(/[A-Z]/g,(t=>`-${t.toLowerCase()}`))}return{setDataAttribute(t,n,i){t.setAttribute(`data-bs-${e(n)}`,i)},removeDataAttribute(t,n){t.removeAttribute(`data-bs-${e(n)}`)},getDataAttributes(e){if(!e)return{};const n={},i=Object.keys(e.dataset).filter((t=>t.startsWith("bs")&&!t.startsWith("bsConfig")));for(const s of i){let i=s.replace(/^bs/,"");i=i.charAt(0).toLowerCase()+i.slice(1,i.length),n[i]=t(e.dataset[s])}return n},getDataAttribute:(n,i)=>t(n.getAttribute(`data-bs-${e(i)}`))}}()},411:function(t,e,n){t.exports=function(t){"use strict";const e=e=>{let n=e.getAttribute("data-bs-target");if(!n||"#"===n){let t=e.getAttribute("href");if(!t||!t.includes("#")&&!t.startsWith("."))return null;t.includes("#")&&!t.startsWith("#")&&(t=`#${t.split("#")[1]}`),n=t&&"#"!==t?t.trim():null}return n?n.split(",").map((e=>t.parseSelector(e))).join(","):null},n={find:(t,e=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(e,t)),findOne:(t,e=document.documentElement)=>Element.prototype.querySelector.call(e,t),children:(t,e)=>[].concat(...t.children).filter((t=>t.matches(e))),parents(t,e){const n=[];let i=t.parentNode.closest(e);for(;i;)n.push(i),i=i.parentNode.closest(e);return n},prev(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return[n];n=n.previousElementSibling}return[]},next(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return[n];n=n.nextElementSibling}return[]},focusableChildren(e){const n=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map((t=>`${t}:not([tabindex^="-"])`)).join(",");return this.find(n,e).filter((e=>!t.isDisabled(e)&&t.isVisible(e)))},getSelectorFromElement(t){const i=e(t);return i&&n.findOne(i)?i:null},getElementFromSelector(t){const i=e(t);return i?n.findOne(i):null},getMultipleElementsFromSelector(t){const i=e(t);return i?n.find(i):[]}};return n}(n(35))},635:function(t,e,n){t.exports=function(t,e,n,i,s,o,r,l){"use strict";const a=".bs.modal",c=`hide${a}`,u=`hidePrevented${a}`,d=`hidden${a}`,h=`show${a}`,f=`shown${a}`,m=`resize${a}`,g=`click.dismiss${a}`,p=`mousedown.dismiss${a}`,_=`keydown.dismiss${a}`,b=`click${a}.data-api`,y="modal-open",E="show",v="modal-static",A={backdrop:!0,focus:!0,keyboard:!0},w={backdrop:"(boolean|string)",focus:"boolean",keyboard:"boolean"};class T extends t{constructor(t,e){super(t,e),this._dialog=n.findOne(".modal-dialog",this._element),this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._isShown=!1,this._isTransitioning=!1,this._scrollBar=new l,this._addEventListeners()}static get Default(){return A}static get DefaultType(){return w}static get NAME(){return"modal"}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||this._isTransitioning||e.trigger(this._element,h,{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._isTransitioning=!0,this._scrollBar.hide(),document.body.classList.add(y),this._adjustDialog(),this._backdrop.show((()=>this._showElement(t))))}hide(){this._isShown&&!this._isTransitioning&&(e.trigger(this._element,c).defaultPrevented||(this._isShown=!1,this._isTransitioning=!0,this._focustrap.deactivate(),this._element.classList.remove(E),this._queueCallback((()=>this._hideModal()),this._element,this._isAnimated())))}dispose(){e.off(window,a),e.off(this._dialog,a),this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new i({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new o({trapElement:this._element})}_showElement(t){document.body.contains(this._element)||document.body.append(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0;const i=n.findOne(".modal-body",this._dialog);i&&(i.scrollTop=0),r.reflow(this._element),this._element.classList.add(E);this._queueCallback((()=>{this._config.focus&&this._focustrap.activate(),this._isTransitioning=!1,e.trigger(this._element,f,{relatedTarget:t})}),this._dialog,this._isAnimated())}_addEventListeners(){e.on(this._element,_,(t=>{"Escape"===t.key&&(this._config.keyboard?this.hide():this._triggerBackdropTransition())})),e.on(window,m,(()=>{this._isShown&&!this._isTransitioning&&this._adjustDialog()})),e.on(this._element,p,(t=>{e.one(this._element,g,(e=>{this._element===t.target&&this._element===e.target&&("static"!==this._config.backdrop?this._config.backdrop&&this.hide():this._triggerBackdropTransition())}))}))}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide((()=>{document.body.classList.remove(y),this._resetAdjustments(),this._scrollBar.reset(),e.trigger(this._element,d)}))}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if(e.trigger(this._element,u).defaultPrevented)return;const t=this._element.scrollHeight>document.documentElement.clientHeight,n=this._element.style.overflowY;"hidden"===n||this._element.classList.contains(v)||(t||(this._element.style.overflowY="hidden"),this._element.classList.add(v),this._queueCallback((()=>{this._element.classList.remove(v),this._queueCallback((()=>{this._element.style.overflowY=n}),this._dialog)}),this._dialog),this._element.focus())}_adjustDialog(){const t=this._element.scrollHeight>document.documentElement.clientHeight,e=this._scrollBar.getWidth(),n=e>0;if(n&&!t){const t=r.isRTL()?"paddingLeft":"paddingRight";this._element.style[t]=`${e}px`}if(!n&&t){const t=r.isRTL()?"paddingRight":"paddingLeft";this._element.style[t]=`${e}px`}}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}static jQueryInterface(t,e){return this.each((function(){const n=T.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===n[t])throw new TypeError(`No method named "${t}"`);n[t](e)}}))}}return e.on(document,b,'[data-bs-toggle="modal"]',(function(t){const i=n.getElementFromSelector(this);["A","AREA"].includes(this.tagName)&&t.preventDefault(),e.one(i,h,(t=>{t.defaultPrevented||e.one(i,d,(()=>{r.isVisible(this)&&this.focus()}))}));const s=n.findOne(".modal.show");s&&T.getInstance(s).hide(),T.getOrCreateInstance(i).toggle(this)})),s.enableDismissTrigger(T),r.defineJQueryPlugin(T),T}(n(11),n(956),n(411),n(877),n(248),n(936),n(35),n(673))},877:function(t,e,n){t.exports=function(t,e,n){"use strict";const i="backdrop",s="show",o=`mousedown.bs.${i}`,r={className:"modal-backdrop",clickCallback:null,isAnimated:!1,isVisible:!0,rootElement:"body"},l={className:"string",clickCallback:"(function|null)",isAnimated:"boolean",isVisible:"boolean",rootElement:"(element|string)"};return class extends e{constructor(t){super(),this._config=this._getConfig(t),this._isAppended=!1,this._element=null}static get Default(){return r}static get DefaultType(){return l}static get NAME(){return i}show(t){if(!this._config.isVisible)return void n.execute(t);this._append();const e=this._getElement();this._config.isAnimated&&n.reflow(e),e.classList.add(s),this._emulateAnimation((()=>{n.execute(t)}))}hide(t){this._config.isVisible?(this._getElement().classList.remove(s),this._emulateAnimation((()=>{this.dispose(),n.execute(t)}))):n.execute(t)}dispose(){this._isAppended&&(t.off(this._element,o),this._element.remove(),this._isAppended=!1)}_getElement(){if(!this._element){const t=document.createElement("div");t.className=this._config.className,this._config.isAnimated&&t.classList.add("fade"),this._element=t}return this._element}_configAfterMerge(t){return t.rootElement=n.getElement(t.rootElement),t}_append(){if(this._isAppended)return;const e=this._getElement();this._config.rootElement.append(e),t.on(e,o,(()=>{n.execute(this._config.clickCallback)})),this._isAppended=!0}_emulateAnimation(t){n.executeAfterTransition(t,this._getElement(),this._config.isAnimated)}}}(n(956),n(105),n(35))},248:function(t,e,n){!function(t,e,n,i){"use strict";t.enableDismissTrigger=(t,s="hide")=>{const o=`click.dismiss${t.EVENT_KEY}`,r=t.NAME;e.on(document,o,`[data-bs-dismiss="${r}"]`,(function(e){if(["A","AREA"].includes(this.tagName)&&e.preventDefault(),i.isDisabled(this))return;const o=n.getElementFromSelector(this)||this.closest(`.${r}`);t.getOrCreateInstance(o)[s]()}))},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}(e,n(956),n(411),n(35))},105:function(t,e,n){t.exports=function(t,e){"use strict";return class{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(t){return t=this._mergeConfigObj(t),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}_configAfterMerge(t){return t}_mergeConfigObj(n,i){const s=e.isElement(i)?t.getDataAttribute(i,"config"):{};return{...this.constructor.Default,..."object"==typeof s?s:{},...e.isElement(i)?t.getDataAttributes(i):{},..."object"==typeof n?n:{}}}_typeCheckConfig(t,n=this.constructor.DefaultType){for(const[i,s]of Object.entries(n)){const n=t[i],o=e.isElement(n)?"element":e.toType(n);if(!new RegExp(s).test(o))throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${i}" provided type "${o}" but expected type "${s}".`)}}}}(n(333),n(35))},936:function(t,e,n){t.exports=function(t,e,n){"use strict";const i=".bs.focustrap",s=`focusin${i}`,o=`keydown.tab${i}`,r="backward",l={autofocus:!0,trapElement:null},a={autofocus:"boolean",trapElement:"element"};return class extends n{constructor(t){super(),this._config=this._getConfig(t),this._isActive=!1,this._lastTabNavDirection=null}static get Default(){return l}static get DefaultType(){return a}static get NAME(){return"focustrap"}activate(){this._isActive||(this._config.autofocus&&this._config.trapElement.focus(),t.off(document,i),t.on(document,s,(t=>this._handleFocusin(t))),t.on(document,o,(t=>this._handleKeydown(t))),this._isActive=!0)}deactivate(){this._isActive&&(this._isActive=!1,t.off(document,i))}_handleFocusin(t){const{trapElement:n}=this._config;if(t.target===document||t.target===n||n.contains(t.target))return;const i=e.focusableChildren(n);0===i.length?n.focus():this._lastTabNavDirection===r?i[i.length-1].focus():i[0].focus()}_handleKeydown(t){"Tab"===t.key&&(this._lastTabNavDirection=t.shiftKey?r:"forward")}}}(n(956),n(411),n(105))},35:function(t,e){!function(t){"use strict";const e="transitionend",n=t=>(t&&window.CSS&&window.CSS.escape&&(t=t.replace(/#([^\s"#']+)/g,((t,e)=>`#${CSS.escape(e)}`))),t),i=t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:n}=window.getComputedStyle(t);const i=Number.parseFloat(e),s=Number.parseFloat(n);return i||s?(e=e.split(",")[0],n=n.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(n))):0},s=t=>{t.dispatchEvent(new Event(e))},o=t=>!(!t||"object"!=typeof t)&&(void 0!==t.jquery&&(t=t[0]),void 0!==t.nodeType),r=t=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?r(t.parentNode):null},l=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,a=[],c=t=>{"loading"===document.readyState?(a.length||document.addEventListener("DOMContentLoaded",(()=>{for(const t of a)t()})),a.push(t)):t()},u=(t,e=[],n=t)=>"function"==typeof t?t(...e):n;t.defineJQueryPlugin=t=>{c((()=>{const e=l();if(e){const n=t.NAME,i=e.fn[n];e.fn[n]=t.jQueryInterface,e.fn[n].Constructor=t,e.fn[n].noConflict=()=>(e.fn[n]=i,t.jQueryInterface)}}))},t.execute=u,t.executeAfterTransition=(t,n,o=!0)=>{if(!o)return void u(t);const r=i(n)+5;let l=!1;const a=({target:i})=>{i===n&&(l=!0,n.removeEventListener(e,a),u(t))};n.addEventListener(e,a),setTimeout((()=>{l||s(n)}),r)},t.findShadowRoot=r,t.getElement=t=>o(t)?t.jquery?t[0]:t:"string"==typeof t&&t.length>0?document.querySelector(n(t)):null,t.getNextActiveElement=(t,e,n,i)=>{const s=t.length;let o=t.indexOf(e);return-1===o?!n&&i?t[s-1]:t[0]:(o+=n?1:-1,i&&(o=(o+s)%s),t[Math.max(0,Math.min(o,s-1))])},t.getTransitionDurationFromElement=i,t.getUID=t=>{do{t+=Math.floor(1e6*Math.random())}while(document.getElementById(t));return t},t.getjQuery=l,t.isDisabled=t=>!t||t.nodeType!==Node.ELEMENT_NODE||!!t.classList.contains("disabled")||(void 0!==t.disabled?t.disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")),t.isElement=o,t.isRTL=()=>"rtl"===document.documentElement.dir,t.isVisible=t=>{if(!o(t)||0===t.getClientRects().length)return!1;const e="visible"===getComputedStyle(t).getPropertyValue("visibility"),n=t.closest("details:not([open])");if(!n)return e;if(n!==t){const e=t.closest("summary");if(e&&e.parentNode!==n)return!1;if(null===e)return!1}return e},t.noop=()=>{},t.onDOMContentLoaded=c,t.parseSelector=n,t.reflow=t=>{t.offsetHeight},t.toType=t=>null==t?`${t}`:Object.prototype.toString.call(t).match(/\s([a-z]+)/i)[1].toLowerCase(),t.triggerTransitionEnd=s,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}(e)},673:function(t,e,n){t.exports=function(t,e,n){"use strict";const i=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",s=".sticky-top",o="padding-right",r="margin-right";return class{constructor(){this._element=document.body}getWidth(){const t=document.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}hide(){const t=this.getWidth();this._disableOverFlow(),this._setElementAttributes(this._element,o,(e=>e+t)),this._setElementAttributes(i,o,(e=>e+t)),this._setElementAttributes(s,r,(e=>e-t))}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,o),this._resetElementAttributes(i,o),this._resetElementAttributes(s,r)}isOverflowing(){return this.getWidth()>0}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(t,e,n){const i=this.getWidth();this._applyManipulationCallback(t,(t=>{if(t!==this._element&&window.innerWidth>t.clientWidth+i)return;this._saveInitialAttribute(t,e);const s=window.getComputedStyle(t).getPropertyValue(e);t.style.setProperty(e,`${n(Number.parseFloat(s))}px`)}))}_saveInitialAttribute(e,n){const i=e.style.getPropertyValue(n);i&&t.setDataAttribute(e,n,i)}_resetElementAttributes(e,n){this._applyManipulationCallback(e,(e=>{const i=t.getDataAttribute(e,n);null!==i?(t.removeDataAttribute(e,n),e.style.setProperty(n,i)):e.style.removeProperty(n)}))}_applyManipulationCallback(t,i){if(n.isElement(t))i(t);else for(const n of e.find(t,this._element))i(n)}}}(n(333),n(411),n(35))}},e={};function n(i){var s=e[i];if(void 0!==s)return s.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,n),o.exports}(()=>{"use strict";n(635)})()})();
@@ -0,0 +1,55 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["exports", "./utils", "./shared", "bootstrap"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(exports, require("./utils"), require("./shared"), require("bootstrap"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(mod.exports, global.utils, global.shared, global.bootstrap);
11
+ global.modal = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _utils, _shared, bootstrap) {
14
+ "use strict";
15
+
16
+ Object.defineProperty(_exports, "__esModule", {
17
+ value: true
18
+ });
19
+ _exports.verify = verify;
20
+ bootstrap = _interopRequireWildcard(bootstrap);
21
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
22
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
+ async function verify(text, options) {
24
+ const id = (0, _utils.guid)();
25
+ const addToDom = () => {
26
+ document.body.insertAdjacentHTML("beforeend", /* html */" <div\nclass=\"modal fade\"\nid=\"".concat(id, "\"\ntabindex=\"-1\"\naria-labelledby=\"").concat(id, "-label\"\naria-hidden=\"true\"\n>\n<div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <h1 class=\"modal-title fs-5\" id=\"").concat(id, "-label\">\n ").concat((options === null || options === void 0 ? void 0 : options.title) || (0, _shared.getPhrase)("Message"), "\n </h1>\n <button\n type=\"button\"\n class=\"btn-close\"\n data-bs-dismiss=\"modal\"\n aria-label=\"Close\"\n ></button>\n </div>\n <div class=\"modal-body\">").concat(text, "</div>\n <div class=\"modal-footer\">\n <button\n type=\"button\"\n class=\"btn blue-btn-plain-primary\"\n data-bs-dismiss=\"modal\"\n >\n Cancel\n </button>\n <button\n type=\"button\"\n class=\"btn btn-primary\"\n data-role=\"confirm\"\n >\n Confirm\n </button>\n </div>\n </div>\n</div>\n</div>"));
27
+ };
28
+ if (!document.getElementById(id)) {
29
+ addToDom();
30
+ }
31
+ return new Promise(resolve => {
32
+ var _modalEl$querySelecto;
33
+ const modalEl = document.getElementById(id);
34
+ const modal = new bootstrap.Modal(modalEl);
35
+ const removeFromDom = () => {
36
+ const modalEl = document.getElementById(id);
37
+ if (modalEl) {
38
+ modalEl.removeEventListener("hidden.bs.modal", onHidden);
39
+ modalEl.remove();
40
+ }
41
+ };
42
+ const onHidden = () => {
43
+ removeFromDom();
44
+ resolve(false);
45
+ };
46
+ modal.show();
47
+ modalEl === null || modalEl === void 0 || modalEl.addEventListener("hidden.bs.modal", onHidden);
48
+ modalEl === null || modalEl === void 0 || (_modalEl$querySelecto = modalEl.querySelector("[data-role=confirm]")) === null || _modalEl$querySelecto === void 0 || _modalEl$querySelecto.addEventListener("click", () => {
49
+ modal.hide();
50
+ removeFromDom();
51
+ resolve(true);
52
+ });
53
+ });
54
+ }
55
+ });
@@ -1,5 +1,4 @@
1
1
  export type breakOption = "sm" | "md" | "lg" | "xl";
2
- export type ModalType = "ask" | "tell" | "verify";
3
2
  export type StatusType = null | "loading" | "success" | "info" | "warning" | "danger";
4
3
  export interface StatusAlert {
5
4
  title?: string;
package/dist/js/shared.js CHANGED
@@ -1,3 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPhrase = getPhrase;
1
7
  const phrases = {
2
8
  Cancel: ["Cancel", "Abbrechen"],
3
9
  Yes: ["Yes", "Ja"],
@@ -8,7 +14,7 @@ const phrases = {
8
14
  Error: ["Error", "Fehler"],
9
15
  Information: ["Information", "Information"]
10
16
  };
11
- export function getPhrase(keyword) {
17
+ function getPhrase(keyword) {
12
18
  let countryCode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
13
19
  let _phrases = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
14
20
  countryCode = countryCode || navigator.language.toLowerCase().indexOf("de") > -1 ? "de-DE" : "en-US";
@@ -0,0 +1,18 @@
1
+ import { StatusType } from "./shared";
2
+ export declare function startLoading(): void;
3
+ export declare function finishLoading(): void;
4
+ export declare function showSuccess(): void;
5
+ export declare function hideSuccess(): void;
6
+ /**
7
+ * Resets alert messages that was set with `setAlertMessage`.
8
+ * When using React, you should use `StatusProvider` instead: https://bruegmann.github.io/blue-react/v9/component/StatusProvider
9
+ * @param alertClassName Leave empty to reset messages of any status type
10
+ */
11
+ export declare function resetAlertMessage(alertClassName?: StatusType): void;
12
+ /**
13
+ * When using React, you should use `StatusProvider` instead: https://bruegmann.github.io/blue-react/v9/component/StatusProvider
14
+ */
15
+ export declare function setAlertMessage(message: string, alertClassName?: StatusType, close?: boolean, detailText?: string): void;
16
+ export declare const guid: () => string;
17
+ export declare function scrollToTop(): void;
18
+ export declare function fetchData(input: RequestInfo | URL, init?: RequestInit | undefined, showErrorDetail?: boolean | undefined, onError?: (errorMessage: string, reason: Response) => void): Promise<Response>;
package/dist/js/utils.js CHANGED
@@ -1,16 +1,30 @@
1
- export function startLoading() {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.fetchData = fetchData;
7
+ exports.finishLoading = finishLoading;
8
+ exports.guid = void 0;
9
+ exports.hideSuccess = hideSuccess;
10
+ exports.resetAlertMessage = resetAlertMessage;
11
+ exports.scrollToTop = scrollToTop;
12
+ exports.setAlertMessage = setAlertMessage;
13
+ exports.showSuccess = showSuccess;
14
+ exports.startLoading = startLoading;
15
+ function startLoading() {
2
16
  ;
3
17
  document.querySelector(".blue-loading").style.display = "block";
4
18
  }
5
- export function finishLoading() {
19
+ function finishLoading() {
6
20
  ;
7
21
  document.querySelector(".blue-loading").style.display = "";
8
22
  }
9
- export function showSuccess() {
23
+ function showSuccess() {
10
24
  ;
11
25
  document.querySelector(".blue-status-success").style.display = "flex";
12
26
  }
13
- export function hideSuccess() {
27
+ function hideSuccess() {
14
28
  ;
15
29
  document.querySelector(".blue-status-success").style.display = "";
16
30
  }
@@ -20,7 +34,7 @@ export function hideSuccess() {
20
34
  * When using React, you should use `StatusProvider` instead: https://bruegmann.github.io/blue-react/v9/component/StatusProvider
21
35
  * @param alertClassName Leave empty to reset messages of any status type
22
36
  */
23
- export function resetAlertMessage(alertClassName) {
37
+ function resetAlertMessage(alertClassName) {
24
38
  if (!alertClassName) {
25
39
  ;
26
40
  ["loading", "success", "info", "warning", "danger"].forEach(status => {
@@ -40,7 +54,7 @@ export function resetAlertMessage(alertClassName) {
40
54
  /**
41
55
  * When using React, you should use `StatusProvider` instead: https://bruegmann.github.io/blue-react/v9/component/StatusProvider
42
56
  */
43
- export function setAlertMessage(message) {
57
+ function setAlertMessage(message) {
44
58
  let alertClassName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "info";
45
59
  let close = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
46
60
  let detailText = arguments.length > 3 ? arguments[3] : undefined;
@@ -68,8 +82,9 @@ export function setAlertMessage(message) {
68
82
  function s4() {
69
83
  return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
70
84
  }
71
- export const guid = () => s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
72
- export function scrollToTop() {
85
+ const guid = () => s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
86
+ exports.guid = guid;
87
+ function scrollToTop() {
73
88
  const routerPage = document.querySelector(".router-page.active");
74
89
  routerPage.scroll({
75
90
  behavior: "smooth",
@@ -88,7 +103,7 @@ const httpStatusCodes = {
88
103
  500: "Internal Server Error",
89
104
  502: "Bad Gateway"
90
105
  };
91
- export function fetchData(input, init) {
106
+ function fetchData(input, init) {
92
107
  let showErrorDetail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
93
108
  let onError = arguments.length > 3 ? arguments[3] : undefined;
94
109
  return fetch(input, init).then(response => {