From e4c5806974757a347e025354e89dce799791e349 Mon Sep 17 00:00:00 2001 From: Jakob Moser Date: Thu, 13 Nov 2025 00:12:21 +0100 Subject: [PATCH] Add mithril.js dependency --- .../ui/static/lib/LICENSE.mithril.txt | 21 +++++++++++++++++++ karaokatalog/ui/static/lib/mithril.min.js | 1 + 2 files changed, 22 insertions(+) create mode 100644 karaokatalog/ui/static/lib/LICENSE.mithril.txt create mode 100644 karaokatalog/ui/static/lib/mithril.min.js diff --git a/karaokatalog/ui/static/lib/LICENSE.mithril.txt b/karaokatalog/ui/static/lib/LICENSE.mithril.txt new file mode 100644 index 0000000..2aae0f1 --- /dev/null +++ b/karaokatalog/ui/static/lib/LICENSE.mithril.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 Leo Horie + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/karaokatalog/ui/static/lib/mithril.min.js b/karaokatalog/ui/static/lib/mithril.min.js new file mode 100644 index 0000000..92e68a4 --- /dev/null +++ b/karaokatalog/ui/static/lib/mithril.min.js @@ -0,0 +1 @@ +!function(){"use strict";function e(e,t,n,r,i,o){return{tag:e,key:t,attrs:n,children:r,text:i,dom:o,is:void 0,domSize:void 0,state:void 0,events:void 0,instance:void 0}}e.normalize=function(t){if(Array.isArray(t))return e("[",void 0,void 0,e.normalizeChildren(t),void 0,void 0);if(null==t||"boolean"==typeof t)return null;if("object"==typeof t)return t;else return e("#",void 0,void 0,String(t),void 0,void 0)},e.normalizeChildren=function(t){for(var n=new Array(t.length),r=0,i=0;i0)u.className=s.join(" ");if(a(u))u=r;else i.set(u,c);return l[e]={tag:f,attrs:u,is:u.is}}function s(e,t){t.tag=e.tag;var i=t.attrs;if(null==i)return t.attrs=e.attrs,t.is=e.is,t;if(n.call(i,"class")){if(null!=i.class)i.className=i.class;i.class=null}if(e.attrs!==r){var o=i.className;if(i=Object.assign({},e.attrs,i),null!=e.attrs.className)i.className=null!=o?String(e.attrs.className)+" "+String(o):e.attrs.className}if("input"===e.tag&&n.call(i,"type"))i=Object.assign({type:i.type},i);return t.is=i.is,t.attrs=i,t}function u(n,r,...i){if(null==n||"string"!=typeof n&&"function"!=typeof n&&"function"!=typeof n.view)throw Error("The selector must be either a string or a component.");var o=t(r,i);if("string"==typeof n)if(o.children=e.normalizeChildren(o.children),"["!==n)return s(l[n]||f(n),o);if(null==o.attrs)o.attrs={};return o.tag=n,o}u.trust=function(t){if(null==t)t="";return e("<",void 0,void 0,t,void 0,void 0)},u.fragment=function(n,...r){var i=t(n,r);if(null==i.attrs)i.attrs={};return i.tag="[",i.children=e.normalizeChildren(i.children),i};var c=new WeakMap;function*d(e){var t=e.dom,n=e.domSize,r=c.get(t);if(null!=t)do{var i=t.nextSibling;if(c.get(t)===r)yield t,n--;t=i}while(n)}var v=function(){var t,n,r={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"};function o(e){return e.ownerDocument}function l(e){return e.attrs&&e.attrs.xmlns||r[e.tag]}function a(e,t){if(e.state!==t)throw new Error("'vnode.state' must not be modified.")}function f(e){var t=e.state;try{return this.apply(t,arguments)}finally{a(e,t)}}function s(e){try{return o(e).activeElement}catch(e){return null}}function u(e,t,n,r,i,o,l){for(var a=n;a'+t.children+"",l=l.firstChild;else l.innerHTML=t.children;t.dom=l.firstChild,t.domSize=l.childNodes.length;for(var a,f=o(e).createDocumentFragment();a=l.firstChild;)f.appendChild(a);P(e,f,r)}function g(e,t,n,r,i){var l=o(e).createDocumentFragment();if(null!=t.children){var a=t.children;u(l,a,0,a.length,n,null,r)}t.dom=l.firstChild,t.domSize=l.childNodes.length,P(e,l,i)}function y(e,t,n,r,i){var a=t.tag,f=t.attrs,s=t.is,c=(r=l(t)||r)?s?o(e).createElementNS(r,a,{is:s}):o(e).createElementNS(r,a):s?o(e).createElement(a,{is:s}):o(e).createElement(a);if(t.dom=c,null!=f)U(t,f,r);if(P(e,c,i),!I(t))if(null!=t.children){var d=t.children;if(u(c,d,0,d.length,n,null,r),"select"===t.tag&&null!=f)J(t,f)}}function w(t,n){var r;if("function"==typeof t.tag.view){if(t.state=Object.create(t.tag),null!=(r=t.state.view).$$reentrantLock$$)return;r.$$reentrantLock$$=!0}else{if(t.state=void 0,null!=(r=t.tag).$$reentrantLock$$)return;r.$$reentrantLock$$=!0,t.state=null!=t.tag.prototype&&"function"==typeof t.tag.prototype.view?new t.tag(t):t.tag(t)}if(Z(t.state,t,n),null!=t.attrs)Z(t.attrs,t,n);if(t.instance=e.normalize(f.call(t.state.view,t)),t.instance===t)throw Error("A view cannot return the vnode it received as argument");r.$$reentrantLock$$=null}function b(e,t,n,r,i){if(w(t,n),null!=t.instance)v(e,t.instance,n,r,i),t.dom=t.instance.dom,t.domSize=t.instance.domSize;else t.domSize=0}function k(e,t,n,r,i,o){if(t!==n&&(null!=t||null!=n))if(null==t||0===t.length)u(e,n,0,n.length,r,i,o);else if(null==n||0===n.length)R(e,t,0,t.length);else{var l=null!=t[0]&&null!=t[0].key,a=null!=n[0]&&null!=n[0].key,f=0,s=0;if(!l)for(;sc)R(e,t,f,t.length);if(n.length>c)u(e,n,f,n.length,r,i,o)}else{for(var d,p,m,h,g,y=t.length-1,w=n.length-1;y>=s&&w>=f&&(m=t[y],h=n[w],m.key===h.key);){if(m!==h)x(e,m,h,r,i,o);if(null!=h.dom)i=h.dom;y--,w--}for(;y>=s&&w>=f&&(d=t[s],p=n[f],d.key===p.key);)if(s++,f++,d!==p)x(e,d,p,r,N(t,s,i),o);for(;y>=s&&w>=f&&f!==w&&d.key===h.key&&m.key===p.key;){if(L(e,m,g=N(t,s,i)),m!==p)x(e,m,p,r,g,o);if(++f<=--w)L(e,d,i);if(d!==h)x(e,d,h,r,i,o);if(null!=h.dom)i=h.dom;s++,m=t[--y],h=n[w],d=t[s],p=n[f]}for(;y>=s&&w>=f&&m.key===h.key;){if(m!==h)x(e,m,h,r,i,o);if(null!=h.dom)i=h.dom;w--,m=t[--y],h=n[w]}if(f>w)R(e,t,s,y+1);else if(s>y)u(e,n,f,w+1,r,i,o);else{var b,k,S=i,z=w-f+1,E=new Array(z),j=0,O=0,C=2147483647,T=0;for(O=0;O=f;O--){if(null==b)b=A(t,s,y+1);var P=b[(h=n[O]).key];if(null!=P){if(C=P=f;O--){if(p=n[O],-1===E[O-f])v(e,p,r,o,i);else if(k[j]===O-f)j--;else L(e,p,i);if(null!=p.dom)i=n[O].dom}else for(O=w;O>=f;O--){if(p=n[O],-1===E[O-f])v(e,p,r,o,i);if(null!=p.dom)i=n[O].dom}}}}}function x(e,t,n,r,i,o){var l=t.tag;if(l===n.tag&&t.is===n.is){if(n.state=t.state,n.events=t.events,te(n,t))return;if("string"==typeof l){if(null!=n.attrs)ee(n.attrs,n,r);switch(l){case"#":S(t,n);break;case"<":z(e,t,n,o,i);break;case"[":E(e,t,n,r,i,o);break;default:j(t,n,r,o)}}else O(e,t,n,r,i,o)}else M(e,t),v(e,n,r,o,i)}function S(e,t){if(e.children.toString()!==t.children.toString())e.dom.nodeValue=t.children;t.dom=e.dom}function z(e,t,n,r,i){if(t.children!==n.children)q(e,t),h(e,n,r,i);else n.dom=t.dom,n.domSize=t.domSize}function E(e,t,n,r,i,o){k(e,t.children,n.children,r,i,o);var l=0,a=n.children;if(n.dom=null,null!=a)for(var f=0;f>>1)+(r>>>1)+(n&r&1);if(e[t[a]]0)T[i]=t[n-1];t[n]=i}}else T[i]=l,t.push(i)}for(r=t[(n=t.length)-1];n-- >0;)t[n]=r,r=T[r];return T.length=0,t}function N(e,t,n){for(;t-1||e.is||"href"!==t&&"list"!==t&&"form"!==t&&"width"!==t&&"height"!==t)&&t in e.dom}function W(e,t,n){if(t===n);else if(null==n)e.style="";else if("object"!=typeof n)e.style=n;else if(null==t||"object"!=typeof t)for(var r in e.style="",n){if(null!=(i=n[r]))if(r.includes("-"))e.style.setProperty(r,String(i));else e.style[r]=String(i)}else{for(var r in t)if(null!=t[r]&&null==n[r])if(r.includes("-"))e.style.removeProperty(r);else e.style[r]="";for(var r in n){var i;if(null!=(i=n[r])&&(i=String(i))!==String(t[r]))if(r.includes("-"))e.style.setProperty(r,i);else e.style[r]=i}}}function X(){this._=t}function Y(e,n,r){if(null!=e.events){if(e.events._=t,e.events[n]===r)return;if(null!=r&&("function"==typeof r||"object"==typeof r)){if(null==e.events[n])e.dom.addEventListener(n.slice(2),e.events,!1);e.events[n]=r}else{if(null!=e.events[n])e.dom.removeEventListener(n.slice(2),e.events,!1);e.events[n]=void 0}}else if(null!=r&&("function"==typeof r||"object"==typeof r))e.events=new X,e.dom.addEventListener(n.slice(2),e.events,!1),e.events[n]=r}function Z(e,t,n){if("function"==typeof e.oninit)f.call(e.oninit,t);if("function"==typeof e.oncreate)n.push(f.bind(e.oncreate,t))}function ee(e,t,n){if("function"==typeof e.onupdate)n.push(f.bind(e.onupdate,t))}function te(e,t){do{if(null!=e.attrs&&"function"==typeof e.attrs.onbeforeupdate){if(void 0!==(n=f.call(e.attrs.onbeforeupdate,e,t))&&!n)break}if("string"!=typeof e.tag&&"function"==typeof e.state.onbeforeupdate){var n;if(void 0!==(n=f.call(e.state.onbeforeupdate,e,t))&&!n)break}return!1}while(0);return e.dom=t.dom,e.domSize=t.domSize,e.instance=t.instance,e.attrs=t.attrs,e.children=t.children,e.text=t.text,!0}return X.prototype=Object.create(null),X.prototype.handleEvent=function(e){var t,n=this["on"+e.type];if("function"==typeof n)t=n.call(e.currentTarget,e);else if("function"==typeof n.handleEvent)n.handleEvent(e);var r=this;if(null!=r._){if(!1!==e.redraw)(0,r._)();if(null!=t&&"function"==typeof t.then)Promise.resolve(t).then((function(){if(null!=r._&&!1!==e.redraw)(0,r._)()}))}if(!1===t)e.preventDefault(),e.stopPropagation()},function(r,i,o){if(!r)throw new TypeError("DOM element being rendered to does not exist.");if(null!=C&&r.contains(C))throw new TypeError("Node is currently being rendered to and thus is locked.");var l=t,a=C,f=[],u=s(r),c=r.namespaceURI;C=r,t="function"==typeof o?o:void 0,n={};try{if(null==r.vnodes)r.textContent="";if(i=e.normalizeChildren(Array.isArray(i)?i:[i]),k(r,r.vnodes,i,f,null,"http://www.w3.org/1999/xhtml"===c?void 0:c),r.vnodes=i,null!=u&&s(r)!==u&&"function"==typeof u.focus)u.focus();for(var d=0;d=0){if(i.splice(o,2),o<=l)l-=2;t(n,[])}if(null!=r)i.push(n,r),t(n,e(r),f)},redraw:f}}(v,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:null,"undefined"!=typeof console?console:null),m=function(e){if("[object Object]"!==Object.prototype.toString.call(e))return"";var t=[];for(var n in e)r(n,e[n]);return t.join("&");function r(e,n){if(Array.isArray(n))for(var i=0;i=0)v+=e.slice(n,i);if(s>=0)v+=(n<0?"?":"&")+f.slice(s,c);var p=m(a);if(p)v+=(n<0&&s<0?"?":"&")+p;if(r>=0)v+=e.slice(r);if(u>=0)v+=(r<0?"":"&")+f.slice(u);return v},g=function(e,t){function r(e){return new Promise(e)}function i(t,r){return new Promise((function(i,l){t=h(t,r.params);var a,f=null!=r.method?r.method.toUpperCase():"GET",s=r.body,u=(null==r.serialize||r.serialize===JSON.serialize)&&!(s instanceof e.FormData||s instanceof e.URLSearchParams),c=r.responseType||("function"==typeof r.extract?"":"json"),d=new e.XMLHttpRequest,v=!1,p=!1,m=d,g=d.abort;if(d.abort=function(){v=!0,g.call(this)},d.open(f,t,!1!==r.async,"string"==typeof r.user?r.user:void 0,"string"==typeof r.password?r.password:void 0),u&&null!=s&&!o(r,"content-type"))d.setRequestHeader("Content-Type","application/json; charset=utf-8");if("function"!=typeof r.deserialize&&!o(r,"accept"))d.setRequestHeader("Accept","application/json, text/*");if(r.withCredentials)d.withCredentials=r.withCredentials;if(r.timeout)d.timeout=r.timeout;for(var y in d.responseType=c,r.headers)if(n.call(r.headers,y))d.setRequestHeader(y,r.headers[y]);if(d.onreadystatechange=function(e){if(!v)if(4===e.target.readyState)try{var n,o=e.target.status>=200&&e.target.status<300||304===e.target.status||/^file:\/\//i.test(t),a=e.target.response;if("json"===c){if(!e.target.responseType&&"function"!=typeof r.extract)try{a=JSON.parse(e.target.responseText)}catch(e){a=null}}else if(!c||"text"===c)if(null==a)a=e.target.responseText;if("function"==typeof r.extract)a=r.extract(e.target,r),o=!0;else if("function"==typeof r.deserialize)a=r.deserialize(a);if(o){if("function"==typeof r.type)if(Array.isArray(a))for(var f=0;f-1)f.pop();for(var u=0;u