@livenetworks/ashlar 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/ln-accordion/ln-accordion.js +1 -1
- package/js/ln-api-connector/ln-api-connector.js +1 -1
- package/js/ln-autoresize/ln-autoresize.js +1 -1
- package/js/ln-autosave/ln-autosave.js +1 -1
- package/js/ln-circular-progress/ln-circular-progress.js +1 -1
- package/js/ln-confirm/ln-confirm.js +1 -1
- package/js/ln-core/helpers.js +6 -3
- package/js/ln-couchdb-connector/ln-couchdb-connector.js +1 -1
- package/js/ln-data-coordinator/ln-data-coordinator.js +1 -1
- package/js/ln-data-store/ln-data-store.js +1 -1
- package/js/ln-data-table/ln-data-table.js +1 -1
- package/js/ln-date/ln-date.js +1 -1
- package/js/ln-dropdown/ln-dropdown.js +1 -1
- package/js/ln-filter/ln-filter.js +1 -1
- package/js/ln-form/ln-form.js +1 -1
- package/js/ln-modal/ln-modal.js +1 -1
- package/js/ln-number/ln-number.js +1 -1
- package/js/ln-popover/ln-popover.js +1 -1
- package/js/ln-search/ln-search.js +1 -1
- package/js/ln-sortable/ln-sortable.js +1 -1
- package/js/ln-table/ln-table.js +1 -1
- package/js/ln-tabs/ln-tabs.js +1 -1
- package/js/ln-time/ln-time.js +1 -1
- package/js/ln-toggle/ln-toggle.js +1 -1
- package/js/ln-tooltip/ln-tooltip.js +1 -1
- package/js/ln-translations/ln-translations.js +1 -1
- package/js/ln-validate/ln-validate.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function v(t,e,n){t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:n||{}}))}function k(t,e){if(!document.body){document.addEventListener("DOMContentLoaded",function(){k(t,e)}),console.warn("["+e+'] Script loaded before <body> — add "defer" to your <script> tag');return}t()}function L(t,e,n,i){if(t.nodeType!==1)return;const s=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]",d=Array.from(t.querySelectorAll(s));t.matches&&t.matches(s)&&d.push(t);for(const r of d)r[n]||(r[n]=new i(r))}function O(t,e,n,i,o={}){const s=o.extraAttributes||[],d=o.onAttributeChange||null,r=o.onInit||null;function f(
|
|
1
|
+
(function(){"use strict";function v(t,e,n){t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:n||{}}))}function k(t,e){if(!document.body){document.addEventListener("DOMContentLoaded",function(){k(t,e)}),console.warn("["+e+'] Script loaded before <body> — add "defer" to your <script> tag');return}t()}function L(t,e,n,i){if(t.nodeType!==1)return;const s=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]",d=Array.from(t.querySelectorAll(s));t.matches&&t.matches(s)&&d.push(t);for(const r of d)r[n]||(r[n]=new i(r))}function O(t,e,n,i,o={}){const s=o.extraAttributes||[],d=o.onAttributeChange||null,r=o.onInit||null;function f(_){const E=_||document.body;L(E,t,e,n),r&&r(E)}return k(function(){const _=new MutationObserver(function(m){for(let b=0;b<m.length;b++){const u=m[b];if(u.type==="childList"){for(let c=0;c<u.addedNodes.length;c++){const p=u.addedNodes[c];p.nodeType===1&&(L(p,t,e,n),r&&r(p))}for(let c=0;c<u.removedNodes.length;c++){const p=u.removedNodes[c];if(p.nodeType===1){const y=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",h=Array.from(p.querySelectorAll(y));p.matches&&p.matches(y)&&h.push(p);for(let l=0;l<h.length;l++){const g=h[l];if(!document.contains(g)){const a=g[e];a&&typeof a.destroy=="function"&&a.destroy()}}}}}else u.type==="attributes"&&(d&&u.target[e]?d(u.target,u.attributeName):(L(u.target,t,e,n),r&&r(u.target)))}});let E=[];if(t.indexOf("[")!==-1){const m=/\[([\w-]+)/g;let b;for(;(b=m.exec(t))!==null;)E.push(b[1])}else E.push(t);_.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:E.concat(s)})},i),window[e]=f,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){f(document.body)}):f(document.body),f}const x={};function R(t,e){x[t]=e}function A(t){return x[t]||{ingress:e=>e,egress:e=>e}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=R,window.lnCore.getDataMapper=A);function T(t,e,n,i){const o=typeof i=="number"?i:4,s=window.innerWidth,d=window.innerHeight,r=e.width,f=e.height,_=n.split("-"),E=_[0],m=_[1]==="start"||_[1]==="end"?_[1]:"center",b={top:["top","bottom","right","left"],bottom:["bottom","top","right","left"],left:["left","right","top","bottom"],right:["right","left","top","bottom"]},u=b[E]||b.bottom;function c(l){return l==="top"||l==="bottom"?m==="start"?t.left:m==="end"?t.right-r:t.left+(t.width-r)/2:m==="start"?t.top:m==="end"?t.bottom-f:t.top+(t.height-f)/2}function p(l){let g,a,w=!0;return l==="top"?(g=t.top-o-f,a=c(l),g<0&&(w=!1)):l==="bottom"?(g=t.bottom+o,a=c(l),g+f>d&&(w=!1)):l==="left"?(g=c(l),a=t.left-o-r,a<0&&(w=!1)):(g=c(l),a=t.right+o,a+r>s&&(w=!1)),{top:g,left:a,side:l,fits:w}}let C=null;for(let l=0;l<u.length;l++){const g=p(u[l]);if(g.fits){C=g;break}}C||(C=p(u[0]));let y=C.top,h=C.left;return r>=s?h=0:(h<0&&(h=0),h+r>s&&(h=s-r)),f>=d?y=0:(y<0&&(y=0),y+f>d&&(y=d-f)),{top:y,left:h,placement:C.side}}function S(t){if(!t||t.parentNode===document.body)return function(){};const e=t.parentNode,n=document.createComment("ln-teleport");return e.insertBefore(n,t),document.body.appendChild(t),function(){n.parentNode&&(n.parentNode.insertBefore(t,n),n.parentNode.removeChild(n))}}function D(t){if(!t)return{width:0,height:0};const e=t.style,n=e.visibility,i=e.display,o=e.position;e.visibility="hidden",e.display="block",e.position="fixed";const s=t.offsetWidth,d=t.offsetHeight;return e.visibility=n,e.display=i,e.position=o,{width:s,height:d}}(function(){const t="data-ln-dropdown",e="lnDropdown";if(window[e]!==void 0)return;function n(i){if(this.dom=i,this.toggleEl=i.querySelector("[data-ln-toggle]"),this._teleportRestore=null,this._boundDocClick=null,this._docClickTimeout=null,this._boundScrollReposition=null,this._boundResizeClose=null,this.toggleEl&&(this.toggleEl.setAttribute("data-ln-dropdown-menu",""),this.toggleEl.setAttribute("role","menu")),this.triggerBtn=i.querySelector("[data-ln-toggle-for]"),this.triggerBtn&&(this.triggerBtn.setAttribute("aria-haspopup","menu"),this.triggerBtn.setAttribute("aria-expanded","false")),this.toggleEl)for(const s of this.toggleEl.children)s.setAttribute("role","menuitem");const o=this;return this._onToggleOpen=function(s){s.detail.target===o.toggleEl&&(o.triggerBtn&&o.triggerBtn.setAttribute("aria-expanded","true"),o._teleportRestore=S(o.toggleEl),o.toggleEl.style.position="fixed",o.toggleEl.style.right="auto",o._reposition(),o._addOutsideClickListener(),o._addScrollRepositionListener(),o._addResizeCloseListener(),v(i,"ln-dropdown:open",{target:s.detail.target}))},this._onToggleClose=function(s){s.detail.target===o.toggleEl&&(o.triggerBtn&&o.triggerBtn.setAttribute("aria-expanded","false"),o._removeOutsideClickListener(),o._removeScrollRepositionListener(),o._removeResizeCloseListener(),o.toggleEl.style.position="",o.toggleEl.style.top="",o.toggleEl.style.left="",o.toggleEl.style.right="",o.toggleEl.style.transform="",o.toggleEl.style.margin="",o._teleportRestore&&(o._teleportRestore(),o._teleportRestore=null),v(i,"ln-dropdown:close",{target:s.detail.target}))},this.toggleEl&&(this.toggleEl.addEventListener("ln-toggle:open",this._onToggleOpen),this.toggleEl.addEventListener("ln-toggle:close",this._onToggleClose)),this}n.prototype._reposition=function(){if(!this.triggerBtn||!this.toggleEl)return;const i=this.triggerBtn.getBoundingClientRect(),o=D(this.toggleEl),s=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--size-xs"))*16||4,d=T(i,o,"bottom-end",s);this.toggleEl.style.top=d.top+"px",this.toggleEl.style.left=d.left+"px"},n.prototype._addOutsideClickListener=function(){if(this._boundDocClick)return;const i=this;this._boundDocClick=function(o){i.dom.contains(o.target)||i.toggleEl&&i.toggleEl.contains(o.target)||i.toggleEl&&i.toggleEl.getAttribute("data-ln-toggle")==="open"&&i.toggleEl.setAttribute("data-ln-toggle","close")},i._docClickTimeout=setTimeout(function(){i._docClickTimeout=null,document.addEventListener("click",i._boundDocClick)},0)},n.prototype._removeOutsideClickListener=function(){this._docClickTimeout&&(clearTimeout(this._docClickTimeout),this._docClickTimeout=null),this._boundDocClick&&(document.removeEventListener("click",this._boundDocClick),this._boundDocClick=null)},n.prototype._addScrollRepositionListener=function(){const i=this;this._boundScrollReposition=function(){i._reposition()},window.addEventListener("scroll",this._boundScrollReposition,{passive:!0,capture:!0})},n.prototype._removeScrollRepositionListener=function(){this._boundScrollReposition&&(window.removeEventListener("scroll",this._boundScrollReposition,{capture:!0}),this._boundScrollReposition=null)},n.prototype._addResizeCloseListener=function(){const i=this;this._boundResizeClose=function(){i.toggleEl&&i.toggleEl.getAttribute("data-ln-toggle")==="open"&&i.toggleEl.setAttribute("data-ln-toggle","close")},window.addEventListener("resize",this._boundResizeClose)},n.prototype._removeResizeCloseListener=function(){this._boundResizeClose&&(window.removeEventListener("resize",this._boundResizeClose),this._boundResizeClose=null)},n.prototype.destroy=function(){this.dom[e]&&(this._removeOutsideClickListener(),this._removeScrollRepositionListener(),this._removeResizeCloseListener(),this._teleportRestore&&(this._teleportRestore(),this._teleportRestore=null),this.toggleEl&&(this.toggleEl.removeEventListener("ln-toggle:open",this._onToggleOpen),this.toggleEl.removeEventListener("ln-toggle:close",this._onToggleClose)),v(this.dom,"ln-dropdown:destroyed",{target:this.dom}),delete this.dom[e])},O(t,e,n,"ln-dropdown")})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function R(
|
|
1
|
+
(function(){"use strict";function R(s,n,u){s.dispatchEvent(new CustomEvent(n,{bubbles:!0,detail:u||{}}))}function D(s,n){if(!s||!n)return s;const u=document.createTreeWalker(s,NodeFilter.SHOW_TEXT);for(;u.nextNode();){const c=u.currentNode;c.textContent.indexOf("{{")!==-1&&(c.textContent=c.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(m,h){return n[h]!==void 0?n[h]:""}))}return s}function B(s,n){if(!document.body){document.addEventListener("DOMContentLoaded",function(){B(s,n)}),console.warn("["+n+'] Script loaded before <body> — add "defer" to your <script> tag');return}s()}function S(s,n,u,c){if(s.nodeType!==1)return;const h=n.indexOf("[")!==-1||n.indexOf(".")!==-1||n.indexOf("#")!==-1?n:"["+n+"]",T=Array.from(s.querySelectorAll(h));s.matches&&s.matches(h)&&T.push(s);for(const y of T)y[u]||(y[u]=new c(y))}function F(s,n,u,c,m={}){const h=m.extraAttributes||[],T=m.onAttributeChange||null,y=m.onInit||null;function A(b){const _=b||document.body;S(_,s,n,u),y&&y(_)}return B(function(){const b=new MutationObserver(function(I){for(let w=0;w<I.length;w++){const f=I[w];if(f.type==="childList"){for(let t=0;t<f.addedNodes.length;t++){const e=f.addedNodes[t];e.nodeType===1&&(S(e,s,n,u),y&&y(e))}for(let t=0;t<f.removedNodes.length;t++){const e=f.removedNodes[t];if(e.nodeType===1){const r=s.indexOf("[")!==-1||s.indexOf(".")!==-1||s.indexOf("#")!==-1?s:"["+s+"]",o=Array.from(e.querySelectorAll(r));e.matches&&e.matches(r)&&o.push(e);for(let l=0;l<o.length;l++){const d=o[l];if(!document.contains(d)){const a=d[n];a&&typeof a.destroy=="function"&&a.destroy()}}}}}else f.type==="attributes"&&(T&&f.target[n]?T(f.target,f.attributeName):(S(f.target,s,n,u),y&&y(f.target)))}});let _=[];if(s.indexOf("[")!==-1){const I=/\[([\w-]+)/g;let w;for(;(w=I.exec(s))!==null;)_.push(w[1])}else _.push(s);b.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:_.concat(h)})},c),window[n]=A,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){A(document.body)}):A(document.body),A}const L={};function K(s,n){L[s]=n}function j(s){return L[s]||{ingress:n=>n,egress:n=>n}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=K,window.lnCore.getDataMapper=j);function H(s,n){let u=!1;return function(){u||(u=!0,queueMicrotask(function(){u=!1,s(),n&&n()}))}}const W="ln:";function J(){return location.pathname.replace(/\/+$/,"").toLowerCase()||"/"}function q(s,n){const u=n.getAttribute("data-ln-persist"),c=u!==null&&u!==""?u:n.id;return c?W+s+":"+J()+":"+c:(console.warn('[ln-persist] Element requires id or data-ln-persist="key"',n),null)}function U(s,n){const u=q(s,n);if(!u)return null;try{const c=localStorage.getItem(u);return c!==null?JSON.parse(c):null}catch{return null}}function N(s,n,u){const c=q(s,n);if(c)try{localStorage.setItem(c,JSON.stringify(u))}catch{}}(function(){const s="data-ln-filter",n="lnFilter",u="data-ln-filter-initialized",c="data-ln-filter-key",m="data-ln-filter-value",h="data-ln-filter-hide",T="data-ln-filter-reset",y="data-ln-filter-col",A=new WeakMap;if(window[n]!==void 0)return;function b(t){return t.hasAttribute(T)||t.getAttribute(m)===""}function _(t){let e=null;const i=[];for(let r=0;r<t.inputs.length;r++){const o=t.inputs[r];if(o.checked&&!b(o)){e===null&&(e=o.getAttribute(c));const l=o.getAttribute(m);l&&i.push(l)}}return{key:e,values:i}}function I(t,e){if(t.length!==e.length)return!0;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!0;return!1}function w(t){const e=t.dom,i=t.colIndex,r=e.querySelector("template");if(!r||i===null)return;const o=document.getElementById(t.targetId);if(!o)return;const l=o.tagName==="TABLE"?o:o.querySelector("table");if(!l||o.hasAttribute("data-ln-table"))return;const d={},a=[],x=l.tBodies;for(let g=0;g<x.length;g++){const p=x[g].rows;for(let v=0;v<p.length;v++){const O=p[v].cells[i],E=O?O.textContent.trim():"";E&&!d[E]&&(d[E]=!0,a.push(E))}}a.sort(function(g,p){return g.localeCompare(p)});const k=e.querySelector("["+c+"]"),C=k?k.getAttribute(c):e.getAttribute("data-ln-filter-key")||"col"+i;for(let g=0;g<a.length;g++){const p=r.content.cloneNode(!0),v=p.querySelector("input");v&&(v.setAttribute(c,C),v.setAttribute(m,a[g]),D(p,{text:a[g]}),e.appendChild(p))}}function f(t){if(t.hasAttribute(u))return this;this.dom=t,this.targetId=t.getAttribute(s);const e=t.getAttribute(y);this.colIndex=e!==null?parseInt(e,10):null,w(this),this.inputs=Array.from(t.querySelectorAll("["+c+"]")),this._filterKey=this.inputs.length>0?this.inputs[0].getAttribute(c):null,this._lastSnapshot=null;const i=this,r=H(function(){i._render()},function(){i._afterRender()});this._queueRender=r,this._attachHandlers();let o=!1;if(t.hasAttribute("data-ln-persist")){const l=U("filter",t);if(l&&l.key&&Array.isArray(l.values)&&l.values.length>0){for(let d=0;d<this.inputs.length;d++){const a=this.inputs[d];b(a)?a.checked=!1:a.getAttribute(c)===l.key&&l.values.indexOf(a.getAttribute(m))!==-1?a.checked=!0:a.checked=!1}r(),o=!0}}if(!o){for(let l=0;l<this.inputs.length;l++)if(this.inputs[l].checked&&!b(this.inputs[l])){r();break}}return t.setAttribute(u,""),this}f.prototype._attachHandlers=function(){const t=this;this.inputs.forEach(function(e){e[n+"Bound"]||(e[n+"Bound"]=!0,e._lnFilterChange=function(){if(b(e)){for(let i=0;i<t.inputs.length;i++)b(t.inputs[i])||(t.inputs[i].checked=!1);e.checked=!0,t._queueRender();return}if(e.checked)for(let i=0;i<t.inputs.length;i++)b(t.inputs[i])&&(t.inputs[i].checked=!1);else{let i=!1;for(let r=0;r<t.inputs.length;r++)if(!b(t.inputs[r])&&t.inputs[r].checked){i=!0;break}if(!i)for(let r=0;r<t.inputs.length;r++)b(t.inputs[r])&&(t.inputs[r].checked=!0)}t._queueRender()},e.addEventListener("change",e._lnFilterChange))})},f.prototype._render=function(){const t=this,e=_(this),i=e.key===null||e.values.length===0,r=[];for(let o=0;o<e.values.length;o++)r.push(e.values[o].toLowerCase());if(t.colIndex!==null)t._filterTableRows(e);else{const o=document.getElementById(t.targetId);if(!o)return;const l=o.children;for(let d=0;d<l.length;d++){const a=l[d];if(i){a.removeAttribute(h);continue}const x=a.getAttribute("data-"+e.key);a.removeAttribute(h),x!==null&&r.indexOf(x.toLowerCase())===-1&&a.setAttribute(h,"true")}}},f.prototype._afterRender=function(){const t=_(this),e=this._lastSnapshot;if(!e||e.key!==t.key||I(e.values,t.values)){this._dispatchOnBoth("ln-filter:changed",{key:t.key,values:t.values.slice()});const r=e&&e.values.length>0,o=t.values.length===0;r&&o&&this._dispatchOnBoth("ln-filter:reset",{}),this._lastSnapshot={key:t.key,values:t.values.slice()}}this.dom.hasAttribute("data-ln-persist")&&(t.key&&t.values.length>0?N("filter",this.dom,{key:t.key,values:t.values.slice()}):N("filter",this.dom,null))},f.prototype._dispatchOnBoth=function(t,e){R(this.dom,t,e);const i=document.getElementById(this.targetId);i&&i!==this.dom&&R(i,t,e)},f.prototype._filterTableRows=function(t){const e=document.getElementById(this.targetId);if(!e)return;const i=e.tagName==="TABLE"?e:e.querySelector("table");if(!i||e.hasAttribute("data-ln-table"))return;const r=t.key||this._filterKey,o=t.values;A.has(i)||A.set(i,{});const l=A.get(i);if(r&&o.length>0){const k=[];for(let C=0;C<o.length;C++)k.push(o[C].toLowerCase());l[r]={col:this.colIndex,values:k}}else r&&delete l[r];const d=Object.keys(l),a=d.length>0,x=i.tBodies;for(let k=0;k<x.length;k++){const C=x[k].rows;for(let g=0;g<C.length;g++){const p=C[g];if(!a){p.removeAttribute(h);continue}let v=!0;for(let O=0;O<d.length;O++){const E=l[d[O]],M=p.cells[E.col],V=M?M.textContent.trim().toLowerCase():"";if(E.values.indexOf(V)===-1){v=!1;break}}v?p.removeAttribute(h):p.setAttribute(h,"true")}}},f.prototype.destroy=function(){if(this.dom[n]){if(this.colIndex!==null){const t=document.getElementById(this.targetId);if(t){const e=t.tagName==="TABLE"?t:t.querySelector("table");if(e&&A.has(e)){const i=A.get(e),r=this._filterKey;r&&i[r]&&delete i[r],Object.keys(i).length===0&&A.delete(e)}}}this.inputs.forEach(function(t){t._lnFilterChange&&(t.removeEventListener("change",t._lnFilterChange),delete t._lnFilterChange),delete t[n+"Bound"]}),this.dom.removeAttribute(u),delete this.dom[n]}},F(s,n,f,"ln-filter")})()})();
|
package/js/ln-form/ln-form.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function y(s,t,u){s.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:u||{}}))}function E(s,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){E(s,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}s()}function v(s,t,u,a){if(s.nodeType!==1)return;const o=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",r=Array.from(s.querySelectorAll(o));s.matches&&s.matches(o)&&r.push(s);for(const e of r)e[u]||(e[u]=new a(e))}function
|
|
1
|
+
(function(){"use strict";function y(s,t,u){s.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:u||{}}))}function E(s,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){E(s,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}s()}function v(s,t,u,a){if(s.nodeType!==1)return;const o=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",r=Array.from(s.querySelectorAll(o));s.matches&&s.matches(o)&&r.push(s);for(const e of r)e[u]||(e[u]=new a(e))}function S(s){const t={},u=s.elements;for(let a=0;a<u.length;a++){const i=u[a];if(!(!i.name||i.disabled||i.type==="file"||i.type==="submit"||i.type==="button"))if(i.type==="checkbox")t[i.name]||(t[i.name]=[]),i.checked&&t[i.name].push(i.value);else if(i.type==="radio")i.checked&&(t[i.name]=i.value);else if(i.type==="select-multiple"){t[i.name]=[];for(let o=0;o<i.options.length;o++)i.options[o].selected&&t[i.name].push(i.options[o].value)}else t[i.name]=i.value}return t}function w(s,t){const u=s.elements,a=[];for(let i=0;i<u.length;i++){const o=u[i];if(!o.name||!(o.name in t)||o.type==="file"||o.type==="submit"||o.type==="button")continue;const r=t[o.name];if(o.type==="checkbox")o.checked=Array.isArray(r)?r.indexOf(o.value)!==-1:!!r,a.push(o);else if(o.type==="radio")o.checked=o.value===String(r),a.push(o);else if(o.type==="select-multiple"){if(Array.isArray(r))for(let e=0;e<o.options.length;e++)o.options[e].selected=r.indexOf(o.options[e].value)!==-1;a.push(o)}else o.value=r,a.push(o)}return a}function x(s,t,u,a,i={}){const o=i.extraAttributes||[],r=i.onAttributeChange||null,e=i.onInit||null;function n(l){const d=l||document.body;v(d,s,t,u),e&&e(d)}return E(function(){const l=new MutationObserver(function(f){for(let h=0;h<f.length;h++){const c=f[h];if(c.type==="childList"){for(let p=0;p<c.addedNodes.length;p++){const m=c.addedNodes[p];m.nodeType===1&&(v(m,s,t,u),e&&e(m))}for(let p=0;p<c.removedNodes.length;p++){const m=c.removedNodes[p];if(m.nodeType===1){const L=s.indexOf("[")!==-1||s.indexOf(".")!==-1||s.indexOf("#")!==-1?s:"["+s+"]",b=Array.from(m.querySelectorAll(L));m.matches&&m.matches(L)&&b.push(m);for(let g=0;g<b.length;g++){const T=b[g];if(!document.contains(T)){const _=T[t];_&&typeof _.destroy=="function"&&_.destroy()}}}}}else c.type==="attributes"&&(r&&c.target[t]?r(c.target,c.attributeName):(v(c.target,s,t,u),e&&e(c.target)))}});let d=[];if(s.indexOf("[")!==-1){const f=/\[([\w-]+)/g;let h;for(;(h=f.exec(s))!==null;)d.push(h[1])}else d.push(s);l.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:d.concat(o)})},a),window[t]=n,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){n(document.body)}):n(document.body),n}const A={};function C(s,t){A[s]=t}function O(s){return A[s]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=C,window.lnCore.getDataMapper=O),(function(){const s="data-ln-form",t="lnForm",u="data-ln-form-auto",a="data-ln-form-debounce",i="data-ln-validate",o="lnValidate";if(window[t]!==void 0)return;function r(e){this.dom=e,this._debounceTimer=null;const n=this;if(this._onValid=function(){n._updateSubmitButton()},this._onInvalid=function(){n._updateSubmitButton()},this._onSubmit=function(l){l.preventDefault(),n.submit()},this._onFill=function(l){l.detail&&n.fill(l.detail)},this._onFormReset=function(){n.reset()},this._onNativeReset=function(){setTimeout(function(){n._resetValidation()},0)},e.addEventListener("ln-validate:valid",this._onValid),e.addEventListener("ln-validate:invalid",this._onInvalid),e.addEventListener("submit",this._onSubmit),e.addEventListener("ln-form:fill",this._onFill),e.addEventListener("ln-form:reset",this._onFormReset),e.addEventListener("reset",this._onNativeReset),this._onAutoInput=null,e.hasAttribute(u)){const l=parseInt(e.getAttribute(a))||0;this._onAutoInput=function(){l>0?(clearTimeout(n._debounceTimer),n._debounceTimer=setTimeout(function(){n.submit()},l)):n.submit()},e.addEventListener("input",this._onAutoInput),e.addEventListener("change",this._onAutoInput)}return this._updateSubmitButton(),this}r.prototype._updateSubmitButton=function(){const e=this.dom.querySelectorAll('button[type="submit"], input[type="submit"]');if(!e.length)return;const n=this.dom.querySelectorAll("["+i+"]");let l=!1;if(n.length>0){let d=!1,f=!1;for(let h=0;h<n.length;h++){const c=n[h][o];c&&c._touched&&(d=!0),n[h].checkValidity()||(f=!0)}l=f||!d}for(let d=0;d<e.length;d++)e[d].disabled=l},r.prototype.fill=function(e){const n=w(this.dom,e);for(let l=0;l<n.length;l++){const d=n[l],f=d.tagName==="SELECT"||d.type==="checkbox"||d.type==="radio";d.dispatchEvent(new Event(f?"change":"input",{bubbles:!0}))}},r.prototype.submit=function(){const e=this.dom.querySelectorAll("["+i+"]");let n=!0;for(let d=0;d<e.length;d++){const f=e[d][o];f&&(f.validate()||(n=!1))}if(!n)return;const l=S(this.dom);y(this.dom,"ln-form:submit",{data:l})},r.prototype.reset=function(){this.dom.reset();const e=this.dom.querySelectorAll("input, textarea, select");for(let n=0;n<e.length;n++){const l=e[n],d=l.tagName==="SELECT"||l.type==="checkbox"||l.type==="radio";l.dispatchEvent(new Event(d?"change":"input",{bubbles:!0}))}this._resetValidation(),y(this.dom,"ln-form:reset-complete",{target:this.dom})},r.prototype._resetValidation=function(){const e=this.dom.querySelectorAll("["+i+"]");for(let n=0;n<e.length;n++){const l=e[n][o];l&&l.reset()}this._updateSubmitButton()},Object.defineProperty(r.prototype,"isValid",{get:function(){const e=this.dom.querySelectorAll("["+i+"]");for(let n=0;n<e.length;n++)if(!e[n].checkValidity())return!1;return!0}}),r.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-validate:valid",this._onValid),this.dom.removeEventListener("ln-validate:invalid",this._onInvalid),this.dom.removeEventListener("submit",this._onSubmit),this.dom.removeEventListener("ln-form:fill",this._onFill),this.dom.removeEventListener("ln-form:reset",this._onFormReset),this.dom.removeEventListener("reset",this._onNativeReset),this._onAutoInput&&(this.dom.removeEventListener("input",this._onAutoInput),this.dom.removeEventListener("change",this._onAutoInput)),clearTimeout(this._debounceTimer),y(this.dom,"ln-form:destroyed",{target:this.dom}),delete this.dom[t])},x(s,t,r,"ln-form")})()})();
|
package/js/ln-modal/ln-modal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function h(e,
|
|
1
|
+
(function(){"use strict";function h(t,e,c){t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:c||{}}))}function _(t,e,c){const m=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:c||{}});return t.dispatchEvent(m),m}function C(t,e){if(!document.body){document.addEventListener("DOMContentLoaded",function(){C(t,e)}),console.warn("["+e+'] Script loaded before <body> — add "defer" to your <script> tag');return}t()}function g(t,e,c,m){if(t.nodeType!==1)return;const b=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]",n=Array.from(t.querySelectorAll(b));t.matches&&t.matches(b)&&n.push(t);for(const o of n)o[c]||(o[c]=new m(o))}function y(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}function T(t,e,c,m,p={}){const b=p.extraAttributes||[],n=p.onAttributeChange||null,o=p.onInit||null;function r(u){const i=u||document.body;g(i,t,e,c),o&&o(i)}return C(function(){const u=new MutationObserver(function(a){for(let s=0;s<a.length;s++){const d=a[s];if(d.type==="childList"){for(let f=0;f<d.addedNodes.length;f++){const l=d.addedNodes[f];l.nodeType===1&&(g(l,t,e,c),o&&o(l))}for(let f=0;f<d.removedNodes.length;f++){const l=d.removedNodes[f];if(l.nodeType===1){const O=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",A=Array.from(l.querySelectorAll(O));l.matches&&l.matches(O)&&A.push(l);for(let E=0;E<A.length;E++){const x=A[E];if(!document.contains(x)){const w=x[e];w&&typeof w.destroy=="function"&&w.destroy()}}}}}else d.type==="attributes"&&(n&&d.target[e]?n(d.target,d.attributeName):(g(d.target,t,e,c),o&&o(d.target)))}});let i=[];if(t.indexOf("[")!==-1){const a=/\[([\w-]+)/g;let s;for(;(s=a.exec(t))!==null;)i.push(s[1])}else i.push(t);u.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:i.concat(b)})},m),window[e]=r,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){r(document.body)}):r(document.body),r}const L={};function k(t,e){L[t]=e}function S(t){return L[t]||{ingress:e=>e,egress:e=>e}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=k,window.lnCore.getDataMapper=S),(function(){const t="data-ln-modal",e="lnModal";if(window[e]!==void 0)return;function c(n){const o=Array.from(n.querySelectorAll("[data-ln-modal-for]"));n.hasAttribute&&n.hasAttribute("data-ln-modal-for")&&o.push(n);for(const r of o){if(r[e+"Trigger"])continue;const u=function(i){if(i.ctrlKey||i.metaKey||i.button===1)return;i.preventDefault();const a=r.getAttribute("data-ln-modal-for"),s=document.getElementById(a);if(!s){console.warn('[ln-modal] No modal found for data-ln-modal-for="'+a+'"');return}if(!s[e])return;const d=s.getAttribute(t);s.setAttribute(t,d==="open"?"close":"open")};r.addEventListener("click",u),r[e+"Trigger"]=u}}function m(n){this.dom=n,this.isOpen=n.getAttribute(t)==="open";const o=this;return this._onEscape=function(r){r.key==="Escape"&&o.dom.setAttribute(t,"close")},this._onFocusTrap=function(r){if(r.key!=="Tab")return;const u=Array.prototype.filter.call(o.dom.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'),y);if(u.length===0)return;const i=u[0],a=u[u.length-1];r.shiftKey?document.activeElement===i&&(r.preventDefault(),a.focus()):document.activeElement===a&&(r.preventDefault(),i.focus())},this._onClose=function(r){r.preventDefault(),o.dom.setAttribute(t,"close")},b(this),this.isOpen&&(this.dom.setAttribute("aria-modal","true"),this.dom.setAttribute("role","dialog"),document.body.classList.add("ln-modal-open"),document.addEventListener("keydown",this._onEscape),document.addEventListener("keydown",this._onFocusTrap)),this}m.prototype.destroy=function(){if(!this.dom[e])return;this.isOpen&&(this.dom.removeAttribute("aria-modal"),document.removeEventListener("keydown",this._onEscape),document.removeEventListener("keydown",this._onFocusTrap),this._returnFocusEl=null,document.querySelector("["+t+'="open"]')||document.body.classList.remove("ln-modal-open"));const n=this.dom.querySelectorAll("[data-ln-modal-close]");for(const r of n)r[e+"Close"]&&(r.removeEventListener("click",r[e+"Close"]),delete r[e+"Close"]);const o=document.querySelectorAll('[data-ln-modal-for="'+this.dom.id+'"]');for(const r of o)r[e+"Trigger"]&&(r.removeEventListener("click",r[e+"Trigger"]),delete r[e+"Trigger"]);h(this.dom,"ln-modal:destroyed",{modalId:this.dom.id,target:this.dom}),delete this.dom[e]};function p(n){const o=n[e];if(!o)return;const u=n.getAttribute(t)==="open";if(u!==o.isOpen)if(u){if(_(n,"ln-modal:before-open",{modalId:n.id,target:n}).defaultPrevented){n.setAttribute(t,"close");return}o.isOpen=!0,n.setAttribute("aria-modal","true"),n.setAttribute("role","dialog"),document.body.classList.add("ln-modal-open"),document.addEventListener("keydown",o._onEscape),document.addEventListener("keydown",o._onFocusTrap);const a=document.activeElement;o._returnFocusEl=a&&a!==document.body?a:null;const s=n.querySelector("[autofocus]");if(s&&y(s))s.focus();else{const d=n.querySelectorAll('input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), select:not([disabled])'),f=Array.prototype.find.call(d,y);if(f)f.focus();else{const l=n.querySelectorAll("a[href], button:not([disabled])"),v=Array.prototype.find.call(l,y);v&&v.focus()}}h(n,"ln-modal:open",{modalId:n.id,target:n})}else{if(_(n,"ln-modal:before-close",{modalId:n.id,target:n}).defaultPrevented){n.setAttribute(t,"open");return}o.isOpen=!1,n.removeAttribute("aria-modal"),document.removeEventListener("keydown",o._onEscape),document.removeEventListener("keydown",o._onFocusTrap),h(n,"ln-modal:close",{modalId:n.id,target:n}),o._returnFocusEl&&document.contains(o._returnFocusEl)&&typeof o._returnFocusEl.focus=="function"&&o._returnFocusEl.focus(),o._returnFocusEl=null,document.querySelector("["+t+'="open"]')||document.body.classList.remove("ln-modal-open")}}function b(n){const o=n.dom.querySelectorAll("[data-ln-modal-close]");for(const r of o)r[e+"Close"]||(r.addEventListener("click",n._onClose),r[e+"Close"]=n._onClose)}T(t,e,m,"ln-modal",{extraAttributes:["data-ln-modal-for"],onAttributeChange:p,onInit:c})})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function v(s,i,u){s.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:u||{}}))}function S(s,i){if(!document.body){document.addEventListener("DOMContentLoaded",function(){S(s,i)}),console.warn("["+i+'] Script loaded before <body> — add "defer" to your <script> tag');return}s()}function x(s,i,u,p){if(s.nodeType!==1)return;const y=i.indexOf("[")!==-1||i.indexOf(".")!==-1||i.indexOf("#")!==-1?i:"["+i+"]",m=Array.from(s.querySelectorAll(y));s.matches&&s.matches(y)&&m.push(s);for(const h of m)h[u]||(h[u]=new p(h))}function
|
|
1
|
+
(function(){"use strict";function v(s,i,u){s.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:u||{}}))}function S(s,i){if(!document.body){document.addEventListener("DOMContentLoaded",function(){S(s,i)}),console.warn("["+i+'] Script loaded before <body> — add "defer" to your <script> tag');return}s()}function x(s,i,u,p){if(s.nodeType!==1)return;const y=i.indexOf("[")!==-1||i.indexOf(".")!==-1||i.indexOf("#")!==-1?i:"["+i+"]",m=Array.from(s.querySelectorAll(y));s.matches&&s.matches(y)&&m.push(s);for(const h of m)h[u]||(h[u]=new p(h))}function E(s){const i=s.closest("[lang]");return(i?i.lang:null)||navigator.language}function O(s,i,{get:u,set:p}){Object.defineProperty(s,"value",{get:function(){return u?u.call(this):i.get.call(this)},set:function(g){p?p.call(this,g,y=>i.set.call(this,y)):i.set.call(this,g)},configurable:!0})}function I(s,i,u,p,g={}){const y=g.extraAttributes||[],m=g.onAttributeChange||null,h=g.onInit||null;function t(a){const e=a||document.body;x(e,s,i,u),h&&h(e)}return S(function(){const a=new MutationObserver(function(c){for(let r=0;r<c.length;r++){const n=c[r];if(n.type==="childList"){for(let o=0;o<n.addedNodes.length;o++){const l=n.addedNodes[o];l.nodeType===1&&(x(l,s,i,u),h&&h(l))}for(let o=0;o<n.removedNodes.length;o++){const l=n.removedNodes[o];if(l.nodeType===1){const _=s.indexOf("[")!==-1||s.indexOf(".")!==-1||s.indexOf("#")!==-1?s:"["+s+"]",F=Array.from(l.querySelectorAll(_));l.matches&&l.matches(_)&&F.push(l);for(let b=0;b<F.length;b++){const D=F[b];if(!document.contains(D)){const N=D[i];N&&typeof N.destroy=="function"&&N.destroy()}}}}}else n.type==="attributes"&&(m&&n.target[i]?m(n.target,n.attributeName):(x(n.target,s,i,u),h&&h(n.target)))}});let e=[];if(s.indexOf("[")!==-1){const c=/\[([\w-]+)/g;let r;for(;(r=c.exec(s))!==null;)e.push(r[1])}else e.push(s);a.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:e.concat(y)})},p),window[i]=t,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){t(document.body)}):t(document.body),t}const A={};function C(s,i){A[s]=i}function L(s){return A[s]||{ingress:i=>i,egress:i=>i}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=C,window.lnCore.getDataMapper=L),(function(){const s="data-ln-number",i="lnNumber";if(window[i]!==void 0)return;const u={},p=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");function g(t){if(!u[t]){const a=new Intl.NumberFormat(t,{useGrouping:!0}),e=a.formatToParts(1234.5);let c="",r=".";for(let n=0;n<e.length;n++)e[n].type==="group"&&(c=e[n].value),e[n].type==="decimal"&&(r=e[n].value);u[t]={fmt:a,groupSep:c,decimalSep:r}}return u[t]}function y(t,a,e){if(e!==null){const c=parseInt(e,10),r=t+"|d"+c;return u[r]||(u[r]=new Intl.NumberFormat(t,{useGrouping:!0,minimumFractionDigits:0,maximumFractionDigits:c})),u[r].format(a)}return g(t).fmt.format(a)}function m(t){if(t.tagName!=="INPUT")return console.warn("[ln-number] Can only be applied to <input>, got:",t.tagName),this;if(t[i])return t[i];t[i]=this,this.dom=t;const a=document.createElement("input");a.type="hidden",a.name=t.name,t.removeAttribute("name"),t.type="text",t.setAttribute("inputmode","decimal"),t.insertAdjacentElement("afterend",a),this._hidden=a;const e=this;Object.defineProperty(a,"value",{get:function(){return p.get.call(a)},set:function(r){if(p.set.call(a,r),r!==""&&!isNaN(parseFloat(r))){const n=parseFloat(r);e._displayFormatted(n),v(e.dom,"ln-number:input",{value:n,formatted:e.dom.value}),e.dom.dispatchEvent(new Event("input",{bubbles:!0}))}else r===""&&(e.dom.value="",v(e.dom,"ln-number:input",{value:NaN,formatted:""}),e.dom.dispatchEvent(new Event("input",{bubbles:!0})))}}),O(t,p,{get:function(){return p.get.call(t)},set:function(r,n){if(e._isFormatting){n(r);return}if(r===""){n(""),e._setHiddenRaw(""),v(t,"ln-number:input",{value:NaN,formatted:""}),t.dispatchEvent(new Event("input",{bubbles:!0}));return}let o=typeof r=="number"?r:parseFloat(String(r).replace(/[^\d.-]/g,""));if(isNaN(o))n(String(r)),e._setHiddenRaw(""),v(t,"ln-number:input",{value:NaN,formatted:String(r)}),t.dispatchEvent(new Event("input",{bubbles:!0}));else{e._setHiddenRaw(o);const l=y(E(t),o,t.getAttribute("data-ln-number-decimals"));n(l),v(t,"ln-number:input",{value:o,formatted:l}),t.dispatchEvent(new Event("input",{bubbles:!0}))}}}),this._onInput=function(){e._handleInput()},t.addEventListener("input",this._onInput),this._onPaste=function(r){r.preventDefault();const n=(r.clipboardData||window.clipboardData).getData("text"),o=g(E(t)),l=o.decimalSep.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");let f=n.replace(new RegExp("[^0-9\\-"+l+".]","g"),"");o.groupSep&&(f=f.split(o.groupSep).join("")),o.decimalSep!=="."&&(f=f.replace(o.decimalSep,"."));const _=parseFloat(f);isNaN(_)?(t.value="",e._hidden.value=""):e.value=_},t.addEventListener("paste",this._onPaste);const c=t.value;if(c!==""){const r=parseFloat(c);isNaN(r)||(this._displayFormatted(r),p.set.call(a,String(r)),v(t,"ln-number:input",{value:r,formatted:t.value}),t.dispatchEvent(new Event("input",{bubbles:!0})))}return this}m.prototype._handleInput=function(){const t=this.dom,a=g(E(t)),e=t.value;if(e===""){this._hidden.value="",v(t,"ln-number:input",{value:NaN,formatted:""});return}if(e==="-"){this._hidden.value="";return}const c=t.selectionStart;let r=0;for(let d=0;d<c;d++)/[0-9]/.test(e[d])&&r++;let n=e;if(a.groupSep&&(n=n.split(a.groupSep).join("")),n=n.replace(a.decimalSep,"."),e.endsWith(a.decimalSep)||e.endsWith(".")){const d=n.replace(/\.$/,""),w=parseFloat(d);isNaN(w)||this._setHiddenRaw(w);return}const o=n.indexOf(".");if(o!==-1&&n.slice(o+1).endsWith("0")){const w=parseFloat(n);isNaN(w)||this._setHiddenRaw(w);return}const l=t.getAttribute("data-ln-number-decimals");if(l!==null&&o!==-1){const d=parseInt(l,10);n.slice(o+1).length>d&&(n=n.slice(0,o+1+d))}const f=parseFloat(n);if(isNaN(f))return;const _=t.getAttribute("data-ln-number-min"),F=t.getAttribute("data-ln-number-max");if(_!==null&&f<parseFloat(_)||F!==null&&f>parseFloat(F))return;let b;if(l!==null)b=y(E(t),f,l);else{const d=o!==-1?n.slice(o+1).length:0;if(d>0){const w=E(t)+"|u"+d;u[w]||(u[w]=new Intl.NumberFormat(E(t),{useGrouping:!0,minimumFractionDigits:d,maximumFractionDigits:d})),b=u[w].format(f)}else b=a.fmt.format(f)}t.value=b;let D=r,N=0;for(let d=0;d<b.length&&D>0;d++)N=d+1,/[0-9]/.test(b[d])&&D--;D>0&&(N=b.length),t.setSelectionRange(N,N),this._setHiddenRaw(f),v(t,"ln-number:input",{value:f,formatted:b})},m.prototype._setHiddenRaw=function(t){p.set.call(this._hidden,String(t))},m.prototype._displayFormatted=function(t){this._isFormatting=!0,this.dom.value=y(E(this.dom),t,this.dom.getAttribute("data-ln-number-decimals")),this._isFormatting=!1},Object.defineProperty(m.prototype,"value",{get:function(){const t=this._hidden.value;return t===""?NaN:parseFloat(t)},set:function(t){if(typeof t!="number"||isNaN(t)){this.dom.value="",this._setHiddenRaw(""),this.dom.dispatchEvent(new Event("input",{bubbles:!0}));return}this._displayFormatted(t),this._setHiddenRaw(t),v(this.dom,"ln-number:input",{value:t,formatted:this.dom.value}),this.dom.dispatchEvent(new Event("input",{bubbles:!0}))}}),Object.defineProperty(m.prototype,"formatted",{get:function(){return this.dom.value}}),m.prototype.destroy=function(){this.dom[i]&&(this.dom.removeEventListener("input",this._onInput),this.dom.removeEventListener("paste",this._onPaste),this.dom.name=this._hidden.name,this.dom.type="number",this.dom.removeAttribute("inputmode"),this._hidden.remove(),v(this.dom,"ln-number:destroyed",{target:this.dom}),delete this.dom[i])};function h(){new MutationObserver(function(){const t=document.querySelectorAll("["+s+"]");for(let a=0;a<t.length;a++){const e=t[a][i];e&&!isNaN(e.value)&&e._displayFormatted(e.value)}}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"]})}I(s,i,m,"ln-number"),h()})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function A(t,e,r){t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:r||{}}))}function E(t,e,r){const g=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r||{}});return t.dispatchEvent(g),g}function x(t,e){if(!document.body){document.addEventListener("DOMContentLoaded",function(){x(t,e)}),console.warn("["+e+'] Script loaded before <body> — add "defer" to your <script> tag');return}t()}function O(t,e,r,g){if(t.nodeType!==1)return;const f=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]",m=Array.from(t.querySelectorAll(f));t.matches&&t.matches(f)&&m.push(t);for(const d of m)d[r]||(d[r]=new g(d))}function I(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}function k(t,e,r,g,u={}){const f=u.extraAttributes||[],m=u.onAttributeChange||null,d=u.onInit||null;function l(y){const i=y||document.body;O(i,t,e,r),d&&d(i)}return x(function(){const y=new MutationObserver(function(s){for(let a=0;a<s.length;a++){const n=s[a];if(n.type==="childList"){for(let o=0;o<n.addedNodes.length;o++){const p=n.addedNodes[o];p.nodeType===1&&(O(p,t,e,r),d&&d(p))}for(let o=0;o<n.removedNodes.length;o++){const p=n.removedNodes[o];if(p.nodeType===1){const h=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",b=Array.from(p.querySelectorAll(h));p.matches&&p.matches(h)&&b.push(p);for(let c=0;c<b.length;c++){const v=b[c][e];
|
|
1
|
+
(function(){"use strict";function A(t,e,r){t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:r||{}}))}function E(t,e,r){const g=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r||{}});return t.dispatchEvent(g),g}function x(t,e){if(!document.body){document.addEventListener("DOMContentLoaded",function(){x(t,e)}),console.warn("["+e+'] Script loaded before <body> — add "defer" to your <script> tag');return}t()}function O(t,e,r,g){if(t.nodeType!==1)return;const f=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]",m=Array.from(t.querySelectorAll(f));t.matches&&t.matches(f)&&m.push(t);for(const d of m)d[r]||(d[r]=new g(d))}function I(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}function k(t,e,r,g,u={}){const f=u.extraAttributes||[],m=u.onAttributeChange||null,d=u.onInit||null;function l(y){const i=y||document.body;O(i,t,e,r),d&&d(i)}return x(function(){const y=new MutationObserver(function(s){for(let a=0;a<s.length;a++){const n=s[a];if(n.type==="childList"){for(let o=0;o<n.addedNodes.length;o++){const p=n.addedNodes[o];p.nodeType===1&&(O(p,t,e,r),d&&d(p))}for(let o=0;o<n.removedNodes.length;o++){const p=n.removedNodes[o];if(p.nodeType===1){const h=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",b=Array.from(p.querySelectorAll(h));p.matches&&p.matches(h)&&b.push(p);for(let c=0;c<b.length;c++){const v=b[c];if(!document.contains(v)){const C=v[e];C&&typeof C.destroy=="function"&&C.destroy()}}}}}else n.type==="attributes"&&(m&&n.target[e]?m(n.target,n.attributeName):(O(n.target,t,e,r),d&&d(n.target)))}});let i=[];if(t.indexOf("[")!==-1){const s=/\[([\w-]+)/g;let a;for(;(a=s.exec(t))!==null;)i.push(a[1])}else i.push(t);y.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:i.concat(f)})},g||(t.indexOf("[")===-1?t.replace("data-",""):"component")),window[e]=l,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){l(document.body)}):l(document.body),l}const L={};function R(t,e){L[t]=e}function N(t){return L[t]||{ingress:e=>e,egress:e=>e}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=R,window.lnCore.getDataMapper=N);function T(t,e,r,g){const u=g,f=window.innerWidth,m=window.innerHeight,d=e.width,l=e.height,y=(r||"bottom").split("-"),i=y[0],s=y[1]==="start"||y[1]==="end"?y[1]:"center",a={top:["top","bottom","right","left"],bottom:["bottom","top","right","left"],left:["left","right","top","bottom"],right:["right","left","top","bottom"]},n=a[i]||a.bottom;function o(c){return c==="top"||c==="bottom"?s==="start"?t.left:s==="end"?t.right-d:t.left+(t.width-d)/2:s==="start"?t.top:s==="end"?t.bottom-l:t.top+(t.height-l)/2}function p(c){let v,C,w=!0;return c==="top"?(v=t.top-u-l,C=o(c),v<0&&(w=!1)):c==="bottom"?(v=t.bottom+u,C=o(c),v+l>m&&(w=!1)):c==="left"?(v=o(c),C=t.left-u-d,C<0&&(w=!1)):(v=o(c),C=t.right+u,C+d>f&&(w=!1)),{top:v,left:C,side:c,fits:w}}let _=null;for(let c=0;c<n.length;c++){const v=p(n[c]);if(v.fits){_=v;break}}_||(_=p(n[0]));let h=_.top,b=_.left;return d>=f?b=0:(b<0&&(b=0),b+d>f&&(b=f-d)),l>=m?h=0:(h<0&&(h=0),h+l>m&&(h=m-l)),{top:h,left:b,placement:_.side}}function M(t){if(!t||t.parentNode===document.body)return function(){};const e=t.parentNode,r=document.createComment("ln-teleport");return e.insertBefore(r,t),document.body.appendChild(t),function(){r.parentNode&&(r.parentNode.insertBefore(t,r),r.parentNode.removeChild(r))}}function D(t){if(!t)return{width:0,height:0};const e=t.style,r=e.visibility,g=e.display,u=e.position;e.visibility="hidden",e.display="block",e.position="fixed";const f=t.offsetWidth,m=t.offsetHeight;return e.visibility=r,e.display=g,e.position=u,{width:f,height:m}}(function(){const t="data-ln-popover",e="lnPopover",r="data-ln-popover-for",g="data-ln-popover-position";if(window[e]!==void 0)return;const u=[];let f=null;function m(){f||(f=function(i){if(i.key!=="Escape"||u.length===0)return;u[u.length-1].close()},document.addEventListener("keydown",f))}function d(){u.length>0||f&&(document.removeEventListener("keydown",f),f=null)}function l(i){return this.dom=i,this.isOpen=i.getAttribute(t)==="open",this.trigger=null,this._teleportRestore=null,this._previousFocus=null,this._boundDocClick=null,this._docClickTimeout=null,this._boundReposition=null,i.hasAttribute("tabindex")||i.setAttribute("tabindex","-1"),i.hasAttribute("role")||i.setAttribute("role","dialog"),this.isOpen&&this._applyOpen(null),this}l.prototype.open=function(i){this.isOpen||(this.trigger=i||null,this.dom.setAttribute(t,"open"))},l.prototype.close=function(){this.isOpen&&this.dom.setAttribute(t,"closed")},l.prototype.toggle=function(i){this.isOpen?this.close():this.open(i)},l.prototype._applyOpen=function(i){this.isOpen=!0,i&&(this.trigger=i),this._previousFocus=document.activeElement,this._teleportRestore=M(this.dom);const s=D(this.dom);if(this.trigger){const p=this.trigger.getBoundingClientRect(),_=this.dom.getAttribute(g)||"bottom",h=T(p,s,_,8);this.dom.style.top=h.top+"px",this.dom.style.left=h.left+"px",this.dom.setAttribute("data-ln-popover-placement",h.placement),this.trigger.setAttribute("aria-expanded","true")}const a=this.dom.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'),n=Array.prototype.find.call(a,I);n?n.focus():this.dom.focus();const o=this;this._boundDocClick=function(p){o.dom.contains(p.target)||o.trigger&&o.trigger.contains(p.target)||o.close()},o._docClickTimeout=setTimeout(function(){o._docClickTimeout=null,document.addEventListener("click",o._boundDocClick)},0),this._boundReposition=function(){if(!o.trigger)return;const p=o.trigger.getBoundingClientRect(),_=D(o.dom),h=o.dom.getAttribute(g)||"bottom",b=T(p,_,h,8);o.dom.style.top=b.top+"px",o.dom.style.left=b.left+"px",o.dom.setAttribute("data-ln-popover-placement",b.placement)},window.addEventListener("scroll",this._boundReposition,{passive:!0,capture:!0}),window.addEventListener("resize",this._boundReposition),u.push(this),m(),A(this.dom,"ln-popover:open",{popoverId:this.dom.id,target:this.dom,trigger:this.trigger})},l.prototype._applyClose=function(){this.isOpen=!1,this._docClickTimeout&&(clearTimeout(this._docClickTimeout),this._docClickTimeout=null),this._boundDocClick&&(document.removeEventListener("click",this._boundDocClick),this._boundDocClick=null),this._boundReposition&&(window.removeEventListener("scroll",this._boundReposition,{capture:!0}),window.removeEventListener("resize",this._boundReposition),this._boundReposition=null),this.dom.style.top="",this.dom.style.left="",this.dom.removeAttribute("data-ln-popover-placement"),this.trigger&&this.trigger.setAttribute("aria-expanded","false"),this._teleportRestore&&(this._teleportRestore(),this._teleportRestore=null);const i=u.indexOf(this);i!==-1&&u.splice(i,1),d(),this._previousFocus&&this.trigger&&this._previousFocus===this.trigger?this.trigger.focus():this.trigger&&document.activeElement===document.body&&this.trigger.focus(),this._previousFocus=null,A(this.dom,"ln-popover:close",{popoverId:this.dom.id,target:this.dom,trigger:this.trigger}),this.trigger=null},l.prototype.destroy=function(){this.dom[e]&&(this.isOpen&&this._applyClose(),delete this.dom[e],A(this.dom,"ln-popover:destroyed",{popoverId:this.dom.id,target:this.dom}))};function y(i){this.dom=i;const s=i.getAttribute(r);return i.setAttribute("aria-haspopup","dialog"),i.setAttribute("aria-expanded","false"),i.setAttribute("aria-controls",s),this._onClick=function(a){if(a.ctrlKey||a.metaKey||a.button===1)return;a.preventDefault();const n=document.getElementById(s);!n||!n[e]||n[e].toggle(i)},i.addEventListener("click",this._onClick),this}y.prototype.destroy=function(){this.dom.removeEventListener("click",this._onClick),delete this.dom[e+"Trigger"]},k(t,e,l,"ln-popover",{onAttributeChange:function(i){const s=i[e];if(!s)return;const n=i.getAttribute(t)==="open";if(n!==s.isOpen)if(n){if(E(i,"ln-popover:before-open",{popoverId:i.id,target:i,trigger:s.trigger}).defaultPrevented){i.setAttribute(t,"closed");return}s._applyOpen(s.trigger)}else{if(E(i,"ln-popover:before-close",{popoverId:i.id,target:i,trigger:s.trigger}).defaultPrevented){i.setAttribute(t,"open");return}s._applyClose()}}}),k(r,e+"Trigger",y,"ln-popover-trigger")})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function
|
|
1
|
+
(function(){"use strict";function T(t,e,r){const u=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r||{}});return t.dispatchEvent(u),u}function v(t,e){if(!document.body){document.addEventListener("DOMContentLoaded",function(){v(t,e)}),console.warn("["+e+'] Script loaded before <body> — add "defer" to your <script> tag');return}t()}function y(t,e,r,u){if(t.nodeType!==1)return;const c=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]",n=Array.from(t.querySelectorAll(c));t.matches&&t.matches(c)&&n.push(t);for(const i of n)i[r]||(i[r]=new u(i))}function E(t,e,r,u,m={}){const c=m.extraAttributes||[],n=m.onAttributeChange||null,i=m.onInit||null;function d(f){const s=f||document.body;y(s,t,e,r),i&&i(s)}return v(function(){const f=new MutationObserver(function(l){for(let p=0;p<l.length;p++){const o=l[p];if(o.type==="childList"){for(let h=0;h<o.addedNodes.length;h++){const a=o.addedNodes[h];a.nodeType===1&&(y(a,t,e,r),i&&i(a))}for(let h=0;h<o.removedNodes.length;h++){const a=o.removedNodes[h];if(a.nodeType===1){const w=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",g=Array.from(a.querySelectorAll(w));a.matches&&a.matches(w)&&g.push(a);for(let b=0;b<g.length;b++){const A=g[b];if(!document.contains(A)){const _=A[e];_&&typeof _.destroy=="function"&&_.destroy()}}}}}else o.type==="attributes"&&(n&&o.target[e]?n(o.target,o.attributeName):(y(o.target,t,e,r),i&&i(o.target)))}});let s=[];if(t.indexOf("[")!==-1){const l=/\[([\w-]+)/g;let p;for(;(p=l.exec(t))!==null;)s.push(p[1])}else s.push(t);f.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:s.concat(c)})},u),window[e]=d,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){d(document.body)}):d(document.body),d}const C={};function x(t,e){C[t]=e}function I(t){return C[t]||{ingress:e=>e,egress:e=>e}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=x,window.lnCore.getDataMapper=I),(function(){const t="data-ln-search",e="lnSearch",r="data-ln-search-initialized",u="data-ln-search-hide";if(window[e]!==void 0)return;function c(n){if(n.hasAttribute(r))return this;this.dom=n,this.targetId=n.getAttribute(t);const i=n.tagName;if(this.input=i==="INPUT"||i==="TEXTAREA"?n:n.querySelector('[name="search"]')||n.querySelector('input[type="search"]')||n.querySelector('input[type="text"]'),this.itemsSelector=n.getAttribute("data-ln-search-items")||null,this._debounceTimer=null,this._attachHandler(),this.input&&this.input.value.trim()){const d=this;queueMicrotask(function(){d._search(d.input.value.trim().toLowerCase())})}return n.setAttribute(r,""),this}c.prototype._attachHandler=function(){if(!this.input)return;const n=this;this._clearBtn=this.dom.querySelector("[data-ln-search-clear]"),this._clearBtn&&(this._onClear=function(){n.input.value="",n._search(""),n.input.focus()},this._clearBtn.addEventListener("click",this._onClear)),this._onInput=function(){clearTimeout(n._debounceTimer),n._debounceTimer=setTimeout(function(){n._search(n.input.value.trim().toLowerCase())},150)},this.input.addEventListener("input",this._onInput)},c.prototype._search=function(n){const i=document.getElementById(this.targetId);if(!i||T(i,"ln-search:change",{term:n,targetId:this.targetId}).defaultPrevented)return;const f=this.itemsSelector?i.querySelectorAll(this.itemsSelector):i.children;for(let s=0;s<f.length;s++){const l=f[s];l.removeAttribute(u),n&&!l.textContent.replace(/\s+/g," ").toLowerCase().includes(n)&&l.setAttribute(u,"true")}},c.prototype.destroy=function(){this.dom[e]&&(clearTimeout(this._debounceTimer),this.input&&this._onInput&&this.input.removeEventListener("input",this._onInput),this._clearBtn&&this._onClear&&this._clearBtn.removeEventListener("click",this._onClear),this.dom.removeAttribute(r),delete this.dom[e])},E(t,e,c,"ln-search")})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function p(n,o,f){n.dispatchEvent(new CustomEvent(o,{bubbles:!0,detail:f||{}}))}function
|
|
1
|
+
(function(){"use strict";function p(n,o,f){n.dispatchEvent(new CustomEvent(o,{bubbles:!0,detail:f||{}}))}function _(n,o,f){const a=new CustomEvent(o,{bubbles:!0,cancelable:!0,detail:f||{}});return n.dispatchEvent(a),a}function w(n,o){if(!document.body){document.addEventListener("DOMContentLoaded",function(){w(n,o)}),console.warn("["+o+'] Script loaded before <body> — add "defer" to your <script> tag');return}n()}function g(n,o,f,a){if(n.nodeType!==1)return;const i=o.indexOf("[")!==-1||o.indexOf(".")!==-1||o.indexOf("#")!==-1?o:"["+o+"]",t=Array.from(n.querySelectorAll(i));n.matches&&n.matches(i)&&t.push(n);for(const e of t)e[f]||(e[f]=new a(e))}function C(n,o,f,a,m={}){const i=m.extraAttributes||[],t=m.onAttributeChange||null,e=m.onInit||null;function l(r){const c=r||document.body;g(c,n,o,f),e&&e(c)}return w(function(){const r=new MutationObserver(function(d){for(let u=0;u<d.length;u++){const s=d[u];if(s.type==="childList"){for(let h=0;h<s.addedNodes.length;h++){const b=s.addedNodes[h];b.nodeType===1&&(g(b,n,o,f),e&&e(b))}for(let h=0;h<s.removedNodes.length;h++){const b=s.removedNodes[h];if(b.nodeType===1){const x=n.indexOf("[")!==-1||n.indexOf(".")!==-1||n.indexOf("#")!==-1?n:"["+n+"]",v=Array.from(b.querySelectorAll(x));b.matches&&b.matches(x)&&v.push(b);for(let y=0;y<v.length;y++){const A=v[y];if(!document.contains(A)){const E=A[o];E&&typeof E.destroy=="function"&&E.destroy()}}}}}else s.type==="attributes"&&(t&&s.target[o]?t(s.target,s.attributeName):(g(s.target,n,o,f),e&&e(s.target)))}});let c=[];if(n.indexOf("[")!==-1){const d=/\[([\w-]+)/g;let u;for(;(u=d.exec(n))!==null;)c.push(u[1])}else c.push(n);r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:c.concat(i)})},a),window[o]=l,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){l(document.body)}):l(document.body),l}const L={};function O(n,o){L[n]=o}function D(n){return L[n]||{ingress:o=>o,egress:o=>o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=O,window.lnCore.getDataMapper=D),(function(){const n="data-ln-sortable",o="lnSortable",f="data-ln-sortable-handle";if(window[o]!==void 0)return;function a(i){this.dom=i,this.isEnabled=i.getAttribute(n)!=="disabled",this._dragging=null,i.setAttribute("aria-roledescription","sortable list");const t=this;return this._onPointerDown=function(e){t.isEnabled&&t._handlePointerDown(e)},i.addEventListener("pointerdown",this._onPointerDown),this}a.prototype.enable=function(){this.isEnabled||this.dom.setAttribute(n,"")},a.prototype.disable=function(){this.isEnabled&&this.dom.setAttribute(n,"disabled")},a.prototype.destroy=function(){this.dom[o]&&(this.dom.removeEventListener("pointerdown",this._onPointerDown),p(this.dom,"ln-sortable:destroyed",{target:this.dom}),delete this.dom[o])},a.prototype._handlePointerDown=function(i){let t=i.target.closest("["+f+"]"),e;if(t){for(e=t;e&&e.parentElement!==this.dom;)e=e.parentElement;if(!e||e.parentElement!==this.dom)return}else{if(this.dom.querySelector("["+f+"]"))return;for(e=i.target;e&&e.parentElement!==this.dom;)e=e.parentElement;if(!e||e.parentElement!==this.dom)return;t=e}const r=Array.from(this.dom.children).indexOf(e);if(_(this.dom,"ln-sortable:before-drag",{item:e,index:r}).defaultPrevented)return;i.preventDefault(),t.setPointerCapture(i.pointerId),this._dragging=e,e.classList.add("ln-sortable--dragging"),e.setAttribute("aria-grabbed","true"),this.dom.classList.add("ln-sortable--active"),p(this.dom,"ln-sortable:drag-start",{item:e,index:r});const d=this,u=function(h){d._handlePointerMove(h)},s=function(h){d._handlePointerEnd(h),t.removeEventListener("pointermove",u),t.removeEventListener("pointerup",s),t.removeEventListener("pointercancel",s)};t.addEventListener("pointermove",u),t.addEventListener("pointerup",s),t.addEventListener("pointercancel",s)},a.prototype._handlePointerMove=function(i){if(!this._dragging)return;const t=Array.from(this.dom.children),e=this._dragging;for(const l of t)l.classList.remove("ln-sortable--drop-before","ln-sortable--drop-after");for(const l of t){if(l===e)continue;const r=l.getBoundingClientRect(),c=r.top+r.height/2;if(i.clientY>=r.top&&i.clientY<c){l.classList.add("ln-sortable--drop-before");break}else if(i.clientY>=c&&i.clientY<=r.bottom){l.classList.add("ln-sortable--drop-after");break}}},a.prototype._handlePointerEnd=function(i){if(!this._dragging)return;const t=this._dragging,e=Array.from(this.dom.children),l=e.indexOf(t);let r=null,c=null;for(const d of e){if(d.classList.contains("ln-sortable--drop-before")){r=d,c="before";break}if(d.classList.contains("ln-sortable--drop-after")){r=d,c="after";break}}for(const d of e)d.classList.remove("ln-sortable--drop-before","ln-sortable--drop-after");if(t.classList.remove("ln-sortable--dragging"),t.removeAttribute("aria-grabbed"),this.dom.classList.remove("ln-sortable--active"),r&&r!==t){c==="before"?this.dom.insertBefore(t,r):this.dom.insertBefore(t,r.nextElementSibling);const u=Array.from(this.dom.children).indexOf(t);p(this.dom,"ln-sortable:reordered",{item:t,oldIndex:l,newIndex:u})}this._dragging=null};function m(i){const t=i[o];if(!t)return;const e=i.getAttribute(n)!=="disabled";e!==t.isEnabled&&(t.isEnabled=e,p(i,e?"ln-sortable:enabled":"ln-sortable:disabled",{target:i}))}C(n,o,a,"ln-sortable",{onAttributeChange:m})})()})();
|
package/js/ln-table/ln-table.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function b(o,l,y){o.dispatchEvent(new CustomEvent(l,{bubbles:!0,detail:y||{}}))}function C(o,l){if(!document.body){document.addEventListener("DOMContentLoaded",function(){C(o,l)}),console.warn("["+l+'] Script loaded before <body> — add "defer" to your <script> tag');return}o()}function T(o,l,y,g){if(o.nodeType!==1)return;const w=l.indexOf("[")!==-1||l.indexOf(".")!==-1||l.indexOf("#")!==-1?l:"["+l+"]",m=Array.from(o.querySelectorAll(w));o.matches&&o.matches(w)&&m.push(o);for(const h of m)h[y]||(h[y]=new g(h))}function L(o,l,y,g,v={}){const w=v.extraAttributes||[],m=v.onAttributeChange||null,h=v.onInit||null;function e(d){const t=d||document.body;T(t,o,l,y),h&&h(t)}return C(function(){const d=new MutationObserver(function(n){for(let u=0;u<n.length;u++){const i=n[u];if(i.type==="childList"){for(let c=0;c<i.addedNodes.length;c++){const r=i.addedNodes[c];r.nodeType===1&&(T(r,o,l,y),h&&h(r))}for(let c=0;c<i.removedNodes.length;c++){const r=i.removedNodes[c];if(r.nodeType===1){const a=o.indexOf("[")!==-1||o.indexOf(".")!==-1||o.indexOf("#")!==-1?o:"["+o+"]",f=Array.from(r.querySelectorAll(a));r.matches&&r.matches(a)&&f.push(r);for(let _=0;_<f.length;_++){const p=f[_][l];p&&typeof p.destroy=="function"&&p.destroy()}}}}else i.type==="attributes"&&(m&&i.target[l]?m(i.target,i.attributeName):(T(i.target,o,l,y),h&&h(i.target)))}});let t=[];if(o.indexOf("[")!==-1){const n=/\[([\w-]+)/g;let u;for(;(u=n.exec(o))!==null;)t.push(u[1])}else t.push(o);d.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:t.concat(w)})},g),window[l]=e,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){e(document.body)}):e(document.body),e}const A={};function O(o,l){A[o]=l}function x(o){return A[o]||{ingress:l=>l,egress:l=>l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=O,window.lnCore.getDataMapper=x),(function(){const o="data-ln-table",l="lnTable",y="data-ln-sort",g="data-ln-table-empty";if(window[l]!==void 0)return;const m=typeof Intl<"u"?new Intl.Collator(document.documentElement.lang||void 0,{sensitivity:"base"}):null;function h(e){this.dom=e,this.table=e.querySelector("table"),this.tbody=e.querySelector("tbody"),this.thead=e.querySelector("thead");const d=this.thead?this.thead.querySelector("tr:last-child"):null;this.ths=d?Array.from(d.querySelectorAll("th")):[],this._data=[],this._filteredData=[],this._searchTerm="",this._sortCol=-1,this._sortDir=null,this._sortType=null,this._columnFilters={},this._virtual=!1,this._rowHeight=0,this._vStart=-1,this._vEnd=-1,this._rafId=null,this._scrollHandler=null,this._colgroup=null;const t=this;return this._emptyTbodyObserver=null,this.tbody&&this.tbody.rows.length>0?this._parseRows():this.tbody&&(this._emptyTbodyObserver=new MutationObserver(function(){t.tbody.rows.length>0&&(t._emptyTbodyObserver.disconnect(),t._emptyTbodyObserver=null,t._parseRows())}),this._emptyTbodyObserver.observe(this.tbody,{childList:!0})),this._onSearch=function(n){n.preventDefault(),t._searchTerm=n.detail.term,t._applyFilterAndSort(),t._vStart=-1,t._vEnd=-1,t._render(),b(e,"ln-table:filter",{term:t._searchTerm,matched:t._filteredData.length,total:t._data.length})},e.addEventListener("ln-search:change",this._onSearch),this._onSort=function(n){t._sortCol=n.detail.direction===null?-1:n.detail.column,t._sortDir=n.detail.direction,t._sortType=n.detail.sortType,t._applyFilterAndSort(),t._vStart=-1,t._vEnd=-1,t._render(),b(e,"ln-table:sorted",{column:n.detail.column,direction:n.detail.direction,matched:t._filteredData.length,total:t._data.length})},e.addEventListener("ln-table:sort",this._onSort),this._onColumnFilter=function(n){const u=n.detail.key;let i=!1;for(let s=0;s<t.ths.length;s++)if(t.ths[s].getAttribute("data-ln-filter-col")===u){i=!0;break}if(!i)return;const c=n.detail.values;if(!c||c.length===0)delete t._columnFilters[u];else{const s=[];for(let a=0;a<c.length;a++)s.push(c[a].toLowerCase());t._columnFilters[u]=s}const r=t.dom.querySelector('th[data-ln-filter-col="'+u+'"]');r&&(c&&c.length>0?r.setAttribute("data-ln-filter-active",""):r.removeAttribute("data-ln-filter-active")),t._applyFilterAndSort(),t._vStart=-1,t._vEnd=-1,t._render(),b(e,"ln-table:filter",{term:t._searchTerm,matched:t._filteredData.length,total:t._data.length})},e.addEventListener("ln-filter:changed",this._onColumnFilter),this._onClear=function(n){if(!n.target.closest("[data-ln-table-clear]"))return;t._searchTerm="";const i=document.querySelector('[data-ln-search="'+e.id+'"]');if(i){const r=i.tagName==="INPUT"?i:i.querySelector("input");r&&(r.value="")}t._columnFilters={};for(let r=0;r<t.ths.length;r++)t.ths[r].removeAttribute("data-ln-filter-active");const c=document.querySelectorAll('[data-ln-filter="'+e.id+'"]');for(let r=0;r<c.length;r++){const s=c[r].querySelector("[data-ln-filter-reset]");s&&(s.checked=!0,s.dispatchEvent(new Event("change",{bubbles:!0})))}t._applyFilterAndSort(),t._vStart=-1,t._vEnd=-1,t._render(),b(e,"ln-table:filter",{term:"",matched:t._filteredData.length,total:t._data.length})},e.addEventListener("click",this._onClear),this}h.prototype._parseRows=function(){const e=this.tbody.rows,d=this.ths;this._data=[];const t=[];for(let n=0;n<d.length;n++)t[n]=d[n].getAttribute(y);e.length>0&&(this._rowHeight=e[0].offsetHeight||40),this._lockColumnWidths();for(let n=0;n<e.length;n++){const u=e[n],i=[],c=[],r=[];for(let s=0;s<u.cells.length;s++){const a=u.cells[s],f=a.textContent.trim(),_=a.hasAttribute("data-ln-value")?a.getAttribute("data-ln-value"):f,p=t[s];c[s]=f.toLowerCase(),p==="number"||p==="date"?i[s]=parseFloat(_)||0:p==="string"?i[s]=String(_):i[s]=null,s<u.cells.length-1&&r.push(f.toLowerCase())}this._data.push({sortKeys:i,rawTexts:c,html:u.outerHTML,searchText:r.join(" ")})}this._filteredData=this._data.slice(),this._render(),b(this.dom,"ln-table:ready",{total:this._data.length})},h.prototype._applyFilterAndSort=function(){const e=this._searchTerm,d=this._columnFilters,t=Object.keys(d).length>0,n=this.ths,u={};if(t)for(let a=0;a<n.length;a++){const f=n[a].getAttribute("data-ln-filter-col");f&&(u[f]=a)}if(!e&&!t?this._filteredData=this._data.slice():this._filteredData=this._data.filter(function(a){if(e&&a.searchText.indexOf(e)===-1)return!1;if(t)for(const f in d){const _=u[f];if(_!==void 0&&d[f].indexOf(a.rawTexts[_])===-1)return!1}return!0}),this._sortCol<0||!this._sortDir)return;const i=this._sortCol,c=this._sortDir==="desc"?-1:1,r=this._sortType==="number"||this._sortType==="date",s=m?m.compare:function(a,f){return a<f?-1:a>f?1:0};this._filteredData.sort(function(a,f){const _=a.sortKeys[i],p=f.sortKeys[i];return r?(_-p)*c:s(_,p)*c})},h.prototype._lockColumnWidths=function(){if(!this.table||!this.thead||this._colgroup)return;const e=document.createElement("colgroup");this.ths.forEach(function(d){const t=document.createElement("col");t.style.width=d.offsetWidth+"px",e.appendChild(t)}),this.table.insertBefore(e,this.table.firstChild),this.table.style.tableLayout="fixed",this._colgroup=e},h.prototype._render=function(){if(!this.tbody)return;const e=this._filteredData.length;e===0&&(this._searchTerm||Object.keys(this._columnFilters).length>0)?(this._disableVirtualScroll(),this._showEmptyState()):e>200?(this._enableVirtualScroll(),this._renderVirtual()):(this._disableVirtualScroll(),this._renderAll())},h.prototype._renderAll=function(){const e=[],d=this._filteredData;for(let t=0;t<d.length;t++)e.push(d[t].html);this.tbody.innerHTML=e.join("")},h.prototype._enableVirtualScroll=function(){if(this._virtual)return;this._virtual=!0;const e=this;this._scrollHandler=function(){e._rafId||(e._rafId=requestAnimationFrame(function(){e._rafId=null,e._renderVirtual()}))},window.addEventListener("scroll",this._scrollHandler,{passive:!0}),window.addEventListener("resize",this._scrollHandler,{passive:!0})},h.prototype._disableVirtualScroll=function(){this._virtual&&(this._virtual=!1,this._scrollHandler&&(window.removeEventListener("scroll",this._scrollHandler),window.removeEventListener("resize",this._scrollHandler),this._scrollHandler=null),this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._vStart=-1,this._vEnd=-1)},h.prototype._renderVirtual=function(){const e=this._filteredData,d=e.length,t=this._rowHeight;if(!t||!d)return;const u=this.table.getBoundingClientRect().top+window.scrollY,i=this.thead?this.thead.offsetHeight:0,c=u+i,r=window.scrollY-c,s=Math.max(0,Math.floor(r/t)-15),a=Math.min(s+Math.ceil(window.innerHeight/t)+30,d);if(s===this._vStart&&a===this._vEnd)return;this._vStart=s,this._vEnd=a;const f=this.ths.length||1,_=s*t,p=(d-a)*t;let S="";_>0&&(S+='<tr class="ln-table__spacer" aria-hidden="true"><td colspan="'+f+'" style="height:'+_+'px;padding:0;border:none"></td></tr>');for(let E=s;E<a;E++)S+=e[E].html;p>0&&(S+='<tr class="ln-table__spacer" aria-hidden="true"><td colspan="'+f+'" style="height:'+p+'px;padding:0;border:none"></td></tr>'),this.tbody.innerHTML=S},h.prototype._showEmptyState=function(){const e=this.ths.length||1,d=this.dom.querySelector("template["+g+"]"),t=document.createElement("td");t.setAttribute("colspan",String(e)),d&&t.appendChild(document.importNode(d.content,!0));const n=document.createElement("tr");n.className="ln-table__empty",n.appendChild(t),this.tbody.innerHTML="",this.tbody.appendChild(n),b(this.dom,"ln-table:empty",{term:this._searchTerm,total:this._data.length})},h.prototype.destroy=function(){this.dom[l]&&(this._disableVirtualScroll(),this._emptyTbodyObserver&&(this._emptyTbodyObserver.disconnect(),this._emptyTbodyObserver=null),this.dom.removeEventListener("ln-search:change",this._onSearch),this.dom.removeEventListener("ln-table:sort",this._onSort),this.dom.removeEventListener("ln-filter:changed",this._onColumnFilter),this.dom.removeEventListener("click",this._onClear),this._colgroup&&(this._colgroup.remove(),this._colgroup=null),this.table&&(this.table.style.tableLayout=""),this._data=[],this._filteredData=[],delete this.dom[l])},L(o,l,h,"ln-table")})()})();
|
|
1
|
+
(function(){"use strict";function g(o,l,m){o.dispatchEvent(new CustomEvent(l,{bubbles:!0,detail:m||{}}))}function C(o,l){if(!document.body){document.addEventListener("DOMContentLoaded",function(){C(o,l)}),console.warn("["+l+'] Script loaded before <body> — add "defer" to your <script> tag');return}o()}function T(o,l,m,v){if(o.nodeType!==1)return;const S=l.indexOf("[")!==-1||l.indexOf(".")!==-1||l.indexOf("#")!==-1?l:"["+l+"]",y=Array.from(o.querySelectorAll(S));o.matches&&o.matches(S)&&y.push(o);for(const h of y)h[m]||(h[m]=new v(h))}function L(o,l,m,v,w={}){const S=w.extraAttributes||[],y=w.onAttributeChange||null,h=w.onInit||null;function e(d){const t=d||document.body;T(t,o,l,m),h&&h(t)}return C(function(){const d=new MutationObserver(function(n){for(let u=0;u<n.length;u++){const i=n[u];if(i.type==="childList"){for(let c=0;c<i.addedNodes.length;c++){const r=i.addedNodes[c];r.nodeType===1&&(T(r,o,l,m),h&&h(r))}for(let c=0;c<i.removedNodes.length;c++){const r=i.removedNodes[c];if(r.nodeType===1){const a=o.indexOf("[")!==-1||o.indexOf(".")!==-1||o.indexOf("#")!==-1?o:"["+o+"]",f=Array.from(r.querySelectorAll(a));r.matches&&r.matches(a)&&f.push(r);for(let _=0;_<f.length;_++){const p=f[_];if(!document.contains(p)){const b=p[l];b&&typeof b.destroy=="function"&&b.destroy()}}}}}else i.type==="attributes"&&(y&&i.target[l]?y(i.target,i.attributeName):(T(i.target,o,l,m),h&&h(i.target)))}});let t=[];if(o.indexOf("[")!==-1){const n=/\[([\w-]+)/g;let u;for(;(u=n.exec(o))!==null;)t.push(u[1])}else t.push(o);d.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:t.concat(S)})},v),window[l]=e,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){e(document.body)}):e(document.body),e}const A={};function O(o,l){A[o]=l}function x(o){return A[o]||{ingress:l=>l,egress:l=>l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=O,window.lnCore.getDataMapper=x),(function(){const o="data-ln-table",l="lnTable",m="data-ln-sort",v="data-ln-table-empty";if(window[l]!==void 0)return;const y=typeof Intl<"u"?new Intl.Collator(document.documentElement.lang||void 0,{sensitivity:"base"}):null;function h(e){this.dom=e,this.table=e.querySelector("table"),this.tbody=e.querySelector("tbody"),this.thead=e.querySelector("thead");const d=this.thead?this.thead.querySelector("tr:last-child"):null;this.ths=d?Array.from(d.querySelectorAll("th")):[],this._data=[],this._filteredData=[],this._searchTerm="",this._sortCol=-1,this._sortDir=null,this._sortType=null,this._columnFilters={},this._virtual=!1,this._rowHeight=0,this._vStart=-1,this._vEnd=-1,this._rafId=null,this._scrollHandler=null,this._colgroup=null;const t=this;return this._emptyTbodyObserver=null,this.tbody&&this.tbody.rows.length>0?this._parseRows():this.tbody&&(this._emptyTbodyObserver=new MutationObserver(function(){t.tbody.rows.length>0&&(t._emptyTbodyObserver.disconnect(),t._emptyTbodyObserver=null,t._parseRows())}),this._emptyTbodyObserver.observe(this.tbody,{childList:!0})),this._onSearch=function(n){n.preventDefault(),t._searchTerm=n.detail.term,t._applyFilterAndSort(),t._vStart=-1,t._vEnd=-1,t._render(),g(e,"ln-table:filter",{term:t._searchTerm,matched:t._filteredData.length,total:t._data.length})},e.addEventListener("ln-search:change",this._onSearch),this._onSort=function(n){t._sortCol=n.detail.direction===null?-1:n.detail.column,t._sortDir=n.detail.direction,t._sortType=n.detail.sortType,t._applyFilterAndSort(),t._vStart=-1,t._vEnd=-1,t._render(),g(e,"ln-table:sorted",{column:n.detail.column,direction:n.detail.direction,matched:t._filteredData.length,total:t._data.length})},e.addEventListener("ln-table:sort",this._onSort),this._onColumnFilter=function(n){const u=n.detail.key;let i=!1;for(let s=0;s<t.ths.length;s++)if(t.ths[s].getAttribute("data-ln-filter-col")===u){i=!0;break}if(!i)return;const c=n.detail.values;if(!c||c.length===0)delete t._columnFilters[u];else{const s=[];for(let a=0;a<c.length;a++)s.push(c[a].toLowerCase());t._columnFilters[u]=s}const r=t.dom.querySelector('th[data-ln-filter-col="'+u+'"]');r&&(c&&c.length>0?r.setAttribute("data-ln-filter-active",""):r.removeAttribute("data-ln-filter-active")),t._applyFilterAndSort(),t._vStart=-1,t._vEnd=-1,t._render(),g(e,"ln-table:filter",{term:t._searchTerm,matched:t._filteredData.length,total:t._data.length})},e.addEventListener("ln-filter:changed",this._onColumnFilter),this._onClear=function(n){if(!n.target.closest("[data-ln-table-clear]"))return;t._searchTerm="";const i=document.querySelector('[data-ln-search="'+e.id+'"]');if(i){const r=i.tagName==="INPUT"?i:i.querySelector("input");r&&(r.value="")}t._columnFilters={};for(let r=0;r<t.ths.length;r++)t.ths[r].removeAttribute("data-ln-filter-active");const c=document.querySelectorAll('[data-ln-filter="'+e.id+'"]');for(let r=0;r<c.length;r++){const s=c[r].querySelector("[data-ln-filter-reset]");s&&(s.checked=!0,s.dispatchEvent(new Event("change",{bubbles:!0})))}t._applyFilterAndSort(),t._vStart=-1,t._vEnd=-1,t._render(),g(e,"ln-table:filter",{term:"",matched:t._filteredData.length,total:t._data.length})},e.addEventListener("click",this._onClear),this}h.prototype._parseRows=function(){const e=this.tbody.rows,d=this.ths;this._data=[];const t=[];for(let n=0;n<d.length;n++)t[n]=d[n].getAttribute(m);e.length>0&&(this._rowHeight=e[0].offsetHeight||40),this._lockColumnWidths();for(let n=0;n<e.length;n++){const u=e[n],i=[],c=[],r=[];for(let s=0;s<u.cells.length;s++){const a=u.cells[s],f=a.textContent.trim(),_=a.hasAttribute("data-ln-value")?a.getAttribute("data-ln-value"):f,p=t[s];c[s]=f.toLowerCase(),p==="number"||p==="date"?i[s]=parseFloat(_)||0:p==="string"?i[s]=String(_):i[s]=null,s<u.cells.length-1&&r.push(f.toLowerCase())}this._data.push({sortKeys:i,rawTexts:c,html:u.outerHTML,searchText:r.join(" ")})}this._filteredData=this._data.slice(),this._render(),g(this.dom,"ln-table:ready",{total:this._data.length})},h.prototype._applyFilterAndSort=function(){const e=this._searchTerm,d=this._columnFilters,t=Object.keys(d).length>0,n=this.ths,u={};if(t)for(let a=0;a<n.length;a++){const f=n[a].getAttribute("data-ln-filter-col");f&&(u[f]=a)}if(!e&&!t?this._filteredData=this._data.slice():this._filteredData=this._data.filter(function(a){if(e&&a.searchText.indexOf(e)===-1)return!1;if(t)for(const f in d){const _=u[f];if(_!==void 0&&d[f].indexOf(a.rawTexts[_])===-1)return!1}return!0}),this._sortCol<0||!this._sortDir)return;const i=this._sortCol,c=this._sortDir==="desc"?-1:1,r=this._sortType==="number"||this._sortType==="date",s=y?y.compare:function(a,f){return a<f?-1:a>f?1:0};this._filteredData.sort(function(a,f){const _=a.sortKeys[i],p=f.sortKeys[i];return r?(_-p)*c:s(_,p)*c})},h.prototype._lockColumnWidths=function(){if(!this.table||!this.thead||this._colgroup)return;const e=document.createElement("colgroup");this.ths.forEach(function(d){const t=document.createElement("col");t.style.width=d.offsetWidth+"px",e.appendChild(t)}),this.table.insertBefore(e,this.table.firstChild),this.table.style.tableLayout="fixed",this._colgroup=e},h.prototype._render=function(){if(!this.tbody)return;const e=this._filteredData.length;e===0&&(this._searchTerm||Object.keys(this._columnFilters).length>0)?(this._disableVirtualScroll(),this._showEmptyState()):e>200?(this._enableVirtualScroll(),this._renderVirtual()):(this._disableVirtualScroll(),this._renderAll())},h.prototype._renderAll=function(){const e=[],d=this._filteredData;for(let t=0;t<d.length;t++)e.push(d[t].html);this.tbody.innerHTML=e.join("")},h.prototype._enableVirtualScroll=function(){if(this._virtual)return;this._virtual=!0;const e=this;this._scrollHandler=function(){e._rafId||(e._rafId=requestAnimationFrame(function(){e._rafId=null,e._renderVirtual()}))},window.addEventListener("scroll",this._scrollHandler,{passive:!0}),window.addEventListener("resize",this._scrollHandler,{passive:!0})},h.prototype._disableVirtualScroll=function(){this._virtual&&(this._virtual=!1,this._scrollHandler&&(window.removeEventListener("scroll",this._scrollHandler),window.removeEventListener("resize",this._scrollHandler),this._scrollHandler=null),this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._vStart=-1,this._vEnd=-1)},h.prototype._renderVirtual=function(){const e=this._filteredData,d=e.length,t=this._rowHeight;if(!t||!d)return;const u=this.table.getBoundingClientRect().top+window.scrollY,i=this.thead?this.thead.offsetHeight:0,c=u+i,r=window.scrollY-c,s=Math.max(0,Math.floor(r/t)-15),a=Math.min(s+Math.ceil(window.innerHeight/t)+30,d);if(s===this._vStart&&a===this._vEnd)return;this._vStart=s,this._vEnd=a;const f=this.ths.length||1,_=s*t,p=(d-a)*t;let b="";_>0&&(b+='<tr class="ln-table__spacer" aria-hidden="true"><td colspan="'+f+'" style="height:'+_+'px;padding:0;border:none"></td></tr>');for(let E=s;E<a;E++)b+=e[E].html;p>0&&(b+='<tr class="ln-table__spacer" aria-hidden="true"><td colspan="'+f+'" style="height:'+p+'px;padding:0;border:none"></td></tr>'),this.tbody.innerHTML=b},h.prototype._showEmptyState=function(){const e=this.ths.length||1,d=this.dom.querySelector("template["+v+"]"),t=document.createElement("td");t.setAttribute("colspan",String(e)),d&&t.appendChild(document.importNode(d.content,!0));const n=document.createElement("tr");n.className="ln-table__empty",n.appendChild(t),this.tbody.innerHTML="",this.tbody.appendChild(n),g(this.dom,"ln-table:empty",{term:this._searchTerm,total:this._data.length})},h.prototype.destroy=function(){this.dom[l]&&(this._disableVirtualScroll(),this._emptyTbodyObserver&&(this._emptyTbodyObserver.disconnect(),this._emptyTbodyObserver=null),this.dom.removeEventListener("ln-search:change",this._onSearch),this.dom.removeEventListener("ln-table:sort",this._onSort),this.dom.removeEventListener("ln-filter:changed",this._onColumnFilter),this.dom.removeEventListener("click",this._onClear),this._colgroup&&(this._colgroup.remove(),this._colgroup=null),this.table&&(this.table.style.tableLayout=""),this._data=[],this._filteredData=[],delete this.dom[l])},L(o,l,h,"ln-table")})()})();
|
package/js/ln-tabs/ln-tabs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function A(s,n,o){s.dispatchEvent(new CustomEvent(n,{bubbles:!0,detail:o||{}}))}function v(s,n){if(!document.body){document.addEventListener("DOMContentLoaded",function(){v(s,n)}),console.warn("["+n+'] Script loaded before <body> — add "defer" to your <script> tag');return}s()}function b(s,n,o,d){if(s.nodeType!==1)return;const p=n.indexOf("[")!==-1||n.indexOf(".")!==-1||n.indexOf("#")!==-1?n:"["+n+"]",e=Array.from(s.querySelectorAll(p));s.matches&&s.matches(p)&&e.push(s);for(const t of e)t[o]||(t[o]=new d(t))}function
|
|
1
|
+
(function(){"use strict";function A(s,n,o){s.dispatchEvent(new CustomEvent(n,{bubbles:!0,detail:o||{}}))}function v(s,n){if(!document.body){document.addEventListener("DOMContentLoaded",function(){v(s,n)}),console.warn("["+n+'] Script loaded before <body> — add "defer" to your <script> tag');return}s()}function b(s,n,o,d){if(s.nodeType!==1)return;const p=n.indexOf("[")!==-1||n.indexOf(".")!==-1||n.indexOf("#")!==-1?n:"["+n+"]",e=Array.from(s.querySelectorAll(p));s.matches&&s.matches(p)&&e.push(s);for(const t of e)t[o]||(t[o]=new d(t))}function O(s,n,o,d,m={}){const p=m.extraAttributes||[],e=m.onAttributeChange||null,t=m.onInit||null;function i(a){const r=a||document.body;b(r,s,n,o),t&&t(r)}return v(function(){const a=new MutationObserver(function(f){for(let c=0;c<f.length;c++){const l=f[c];if(l.type==="childList"){for(let h=0;h<l.addedNodes.length;h++){const u=l.addedNodes[h];u.nodeType===1&&(b(u,s,n,o),t&&t(u))}for(let h=0;h<l.removedNodes.length;h++){const u=l.removedNodes[h];if(u.nodeType===1){const E=s.indexOf("[")!==-1||s.indexOf(".")!==-1||s.indexOf("#")!==-1?s:"["+s+"]",y=Array.from(u.querySelectorAll(E));u.matches&&u.matches(E)&&y.push(u);for(let g=0;g<y.length;g++){const L=y[g];if(!document.contains(L)){const w=L[n];w&&typeof w.destroy=="function"&&w.destroy()}}}}}else l.type==="attributes"&&(e&&l.target[n]?e(l.target,l.attributeName):(b(l.target,s,n,o),t&&t(l.target)))}});let r=[];if(s.indexOf("[")!==-1){const f=/\[([\w-]+)/g;let c;for(;(c=f.exec(s))!==null;)r.push(c[1])}else r.push(s);a.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:r.concat(p)})},d),window[n]=i,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){i(document.body)}):i(document.body),i}const C={};function T(s,n){C[s]=n}function _(s){return C[s]||{ingress:n=>n,egress:n=>n}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=T,window.lnCore.getDataMapper=_);const K="ln:";function S(){return location.pathname.replace(/\/+$/,"").toLowerCase()||"/"}function x(s,n){const o=n.getAttribute("data-ln-persist"),d=o!==null&&o!==""?o:n.id;return d?K+s+":"+S()+":"+d:(console.warn('[ln-persist] Element requires id or data-ln-persist="key"',n),null)}function k(s,n){const o=x(s,n);if(!o)return null;try{const d=localStorage.getItem(o);return d!==null?JSON.parse(d):null}catch{return null}}function M(s,n,o){const d=x(s,n);if(d)try{localStorage.setItem(d,JSON.stringify(o))}catch{}}(function(){const s="data-ln-tabs",n="lnTabs";if(window[n]!==void 0&&window[n]!==null)return;function o(){const e=(location.hash||"").replace("#",""),t={};if(!e)return t;for(const i of e.split("&")){const a=i.indexOf(":");a>0&&(t[i.slice(0,a)]=i.slice(a+1))}return t}function d(e,t){const i=(e.getAttribute("data-ln-tab")||"").toLowerCase().trim();if(i)return i;if(e.tagName!=="A")return"";const a=e.getAttribute("href")||"";if(!a.startsWith("#"))return"";const r=a.slice(1);if(!r)return"";const f=r.split("&");if(t)for(const h of f){const u=h.indexOf(":");if(u>0&&h.slice(0,u).toLowerCase().trim()===t)return h.slice(u+1).toLowerCase().trim()}const c=f[f.length-1]||"",l=c.indexOf(":");return(l>0?c.slice(l+1):c).toLowerCase().trim()}function m(e){return this.dom=e,p.call(this),this}function p(){this.tabs=Array.from(this.dom.querySelectorAll("[data-ln-tab]")),this.panels=Array.from(this.dom.querySelectorAll("[data-ln-panel]")),this.nsKey=(this.dom.getAttribute("data-ln-tabs-key")||this.dom.id||"").toLowerCase().trim(),this.hashEnabled=!!this.nsKey,this.mapTabs={},this.mapPanels={};for(const t of this.tabs){const i=d(t,this.nsKey);i?this.mapTabs[i]=t:console.warn('[ln-tabs] Trigger has no resolvable key — needs `data-ln-tab="key"` or `<a href="#…">`.',t)}for(const t of this.panels){const i=(t.getAttribute("data-ln-panel")||"").toLowerCase().trim();i&&(this.mapPanels[i]=t)}this.defaultKey=(this.dom.getAttribute("data-ln-tabs-default")||"").toLowerCase().trim()||Object.keys(this.mapTabs)[0]||"",this.autoFocus=(this.dom.getAttribute("data-ln-tabs-focus")||"true").toLowerCase()!=="false";const e=this;this._clickHandlers=[];for(const t of this.tabs){if(t[n+"Trigger"])continue;const i=function(a){if(a.ctrlKey||a.metaKey||a.button===1)return;const r=d(t,e.nsKey);if(r)if(t.tagName==="A"&&a.preventDefault(),e.hashEnabled){const f=o();f[e.nsKey]=r;const c=Object.keys(f).map(function(l){return l+":"+f[l]}).join("&");location.hash==="#"+c?e.dom.setAttribute("data-ln-tabs-active",r):location.hash=c}else e.dom.setAttribute("data-ln-tabs-active",r)};t.addEventListener("click",i),t[n+"Trigger"]=i,e._clickHandlers.push({el:t,handler:i})}if(this._hashHandler=function(){if(!e.hashEnabled)return;const t=o();e.dom.setAttribute("data-ln-tabs-active",e.nsKey in t?t[e.nsKey]:e.defaultKey)},this.hashEnabled)window.addEventListener("hashchange",this._hashHandler),this._hashHandler();else{let t=this.defaultKey;if(this.dom.hasAttribute("data-ln-persist")&&!this.hashEnabled){const i=k("tabs",this.dom);i!==null&&i in this.mapPanels&&(t=i)}this.dom.setAttribute("data-ln-tabs-active",t)}}m.prototype._applyActive=function(e){var t;(!e||!(e in this.mapPanels))&&(e=this.defaultKey);for(const i in this.mapTabs){const a=this.mapTabs[i];i===e?(a.setAttribute("data-active",""),a.setAttribute("aria-selected","true")):(a.removeAttribute("data-active"),a.setAttribute("aria-selected","false"))}for(const i in this.mapPanels){const a=this.mapPanels[i],r=i===e;a.classList.toggle("hidden",!r),a.setAttribute("aria-hidden",r?"false":"true")}if(this.autoFocus){const i=(t=this.mapPanels[e])==null?void 0:t.querySelector('input,button,select,textarea,[tabindex]:not([tabindex="-1"])');i&&setTimeout(()=>i.focus({preventScroll:!0}),0)}A(this.dom,"ln-tabs:change",{key:e,tab:this.mapTabs[e],panel:this.mapPanels[e]}),this.dom.hasAttribute("data-ln-persist")&&!this.hashEnabled&&M("tabs",this.dom,e)},m.prototype.destroy=function(){if(this.dom[n]){for(const{el:e,handler:t}of this._clickHandlers)e.removeEventListener("click",t),delete e[n+"Trigger"];this.hashEnabled&&window.removeEventListener("hashchange",this._hashHandler),A(this.dom,"ln-tabs:destroyed",{target:this.dom}),delete this.dom[n]}},O(s,n,m,"ln-tabs",{extraAttributes:["data-ln-tabs-active"],onAttributeChange:function(e){const t=e.getAttribute("data-ln-tabs-active");e[n]._applyActive(t)}})})()})();
|
package/js/ln-time/ln-time.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function I(e,n){if(!document.body){document.addEventListener("DOMContentLoaded",function(){I(e,n)}),console.warn("["+n+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function O(e,n,d,v){if(e.nodeType!==1)return;const h=n.indexOf("[")!==-1||n.indexOf(".")!==-1||n.indexOf("#")!==-1?n:"["+n+"]",w=Array.from(e.querySelectorAll(h));e.matches&&e.matches(h)&&w.push(e);for(const
|
|
1
|
+
(function(){"use strict";function I(e,n){if(!document.body){document.addEventListener("DOMContentLoaded",function(){I(e,n)}),console.warn("["+n+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function O(e,n,d,v){if(e.nodeType!==1)return;const h=n.indexOf("[")!==-1||n.indexOf(".")!==-1||n.indexOf("#")!==-1?n:"["+n+"]",w=Array.from(e.querySelectorAll(h));e.matches&&e.matches(h)&&w.push(e);for(const i of w)i[d]||(i[d]=new v(i))}function N(e,n,d,v,A={}){const h=A.extraAttributes||[],w=A.onAttributeChange||null,i=A.onInit||null;function c(x){const l=x||document.body;O(l,e,n,d),i&&i(l)}return I(function(){const x=new MutationObserver(function(M){for(let y=0;y<M.length;y++){const r=M[y];if(r.type==="childList"){for(let g=0;g<r.addedNodes.length;g++){const f=r.addedNodes[g];f.nodeType===1&&(O(f,e,n,d),i&&i(f))}for(let g=0;g<r.removedNodes.length;g++){const f=r.removedNodes[g];if(f.nodeType===1){const p=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]",_=Array.from(f.querySelectorAll(p));f.matches&&f.matches(p)&&_.push(f);for(let S=0;S<_.length;S++){const D=_[S];if(!document.contains(D)){const t=D[n];t&&typeof t.destroy=="function"&&t.destroy()}}}}}else r.type==="attributes"&&(w&&r.target[n]?w(r.target,r.attributeName):(O(r.target,e,n,d),i&&i(r.target)))}});let l=[];if(e.indexOf("[")!==-1){const M=/\[([\w-]+)/g;let y;for(;(y=M.exec(e))!==null;)l.push(y[1])}else l.push(e);x.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:l.concat(h)})},v),window[n]=c,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){c(document.body)}):c(document.body),c}const T={};function E(e,n){T[e]=n}function L(e){return T[e]||{ingress:n=>n,egress:n=>n}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=E,window.lnCore.getDataMapper=L),(function(){const e="data-ln-time",n="lnTime";if(window[n]!==void 0)return;const d={},v={};function A(t){return t.getAttribute("data-ln-time-locale")||document.documentElement.lang||void 0}function h(t,o){const s=(t||"")+"|"+JSON.stringify(o);return d[s]||(d[s]=new Intl.DateTimeFormat(t,o)),d[s]}function w(t){const o=t||"";return v[o]||(v[o]=new Intl.RelativeTimeFormat(t,{numeric:"auto",style:"narrow"})),v[o]}const i=new Set;let c=null;function x(){c||(c=setInterval(M,6e4))}function l(){c&&(clearInterval(c),c=null)}function M(){for(const t of i){if(!document.body.contains(t.dom)){i.delete(t);continue}p(t)}i.size===0&&l()}function y(t,o){return h(o,{dateStyle:"long",timeStyle:"short"}).format(t)}function r(t,o){const s=new Date,m={month:"short",day:"numeric"};return t.getFullYear()!==s.getFullYear()&&(m.year="numeric"),h(o,m).format(t)}function g(t,o){return h(o,{dateStyle:"medium"}).format(t)}function f(t,o){return h(o,{timeStyle:"short"}).format(t)}function k(t,o){const s=Math.floor(Date.now()/1e3),b=Math.floor(t.getTime()/1e3)-s,a=Math.abs(b);if(a<10)return w(o).format(0,"second");let u,C;if(a<60)u="second",C=b;else if(a<3600)u="minute",C=Math.round(b/60);else if(a<86400)u="hour",C=Math.round(b/3600);else if(a<604800)u="day",C=Math.round(b/86400);else if(a<2592e3)u="week",C=Math.round(b/604800);else return r(t,o);return w(o).format(C,u)}function p(t){const o=t.dom.getAttribute("datetime");if(!o)return;const s=Number(o);if(isNaN(s))return;const m=new Date(s*1e3),b=t.dom.getAttribute(e)||"short",a=A(t.dom);let u;switch(b){case"relative":u=k(m,a);break;case"full":u=y(m,a);break;case"date":u=g(m,a);break;case"time":u=f(m,a);break;default:u=r(m,a);break}t.dom.textContent=u,b!=="full"&&(t.dom.title=y(m,a))}function _(t){return this.dom=t,p(this),t.getAttribute(e)==="relative"&&(i.add(this),x()),this}_.prototype.render=function(){p(this)},_.prototype.destroy=function(){i.delete(this),i.size===0&&l(),delete this.dom[n]};function S(t){const o=t[n];if(!o)return;t.getAttribute(e)==="relative"?(i.add(o),x()):(i.delete(o),i.size===0&&l()),p(o)}function D(t){t.nodeType===1&&t.hasAttribute&&t.hasAttribute(e)&&t[n]&&p(t[n])}N(e,n,_,"ln-time",{extraAttributes:["datetime"],onAttributeChange:S,onInit:D})})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function h(e,t,o){e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o||{}}))}function w(e,t,o){const i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:o||{}});return e.dispatchEvent(i),i}function O(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){O(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function y(e,t,o,i){if(e.nodeType!==1)return;const b=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",n=Array.from(e.querySelectorAll(b));e.matches&&e.matches(b)&&n.push(e);for(const r of n)r[o]||(r[o]=new i(r))}function
|
|
1
|
+
(function(){"use strict";function h(e,t,o){e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o||{}}))}function w(e,t,o){const i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:o||{}});return e.dispatchEvent(i),i}function O(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){O(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function y(e,t,o,i){if(e.nodeType!==1)return;const b=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",n=Array.from(e.querySelectorAll(b));e.matches&&e.matches(b)&&n.push(e);for(const r of n)r[o]||(r[o]=new i(r))}function I(e,t,o,i,g={}){const b=g.extraAttributes||[],n=g.onAttributeChange||null,r=g.onInit||null;function s(d){const f=d||document.body;y(f,e,t,o),r&&r(f)}return O(function(){const d=new MutationObserver(function(p){for(let l=0;l<p.length;l++){const u=p[l];if(u.type==="childList"){for(let a=0;a<u.addedNodes.length;a++){const c=u.addedNodes[a];c.nodeType===1&&(y(c,e,t,o),r&&r(c))}for(let a=0;a<u.removedNodes.length;a++){const c=u.removedNodes[a];if(c.nodeType===1){const L=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]",m=Array.from(c.querySelectorAll(L));c.matches&&c.matches(L)&&m.push(c);for(let A=0;A<m.length;A++){const S=m[A];if(!document.contains(S)){const v=S[t];v&&typeof v.destroy=="function"&&v.destroy()}}}}}else u.type==="attributes"&&(n&&u.target[t]?n(u.target,u.attributeName):(y(u.target,e,t,o),r&&r(u.target)))}});let f=[];if(e.indexOf("[")!==-1){const p=/\[([\w-]+)/g;let l;for(;(l=p.exec(e))!==null;)f.push(l[1])}else f.push(e);d.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:f.concat(b)})},i),window[t]=s,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){s(document.body)}):s(document.body),s}const x={};function M(e,t){x[e]=t}function D(e){return x[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=M,window.lnCore.getDataMapper=D);const _="ln:";function q(){return location.pathname.replace(/\/+$/,"").toLowerCase()||"/"}function C(e,t){const o=t.getAttribute("data-ln-persist"),i=o!==null&&o!==""?o:t.id;return i?_+e+":"+q()+":"+i:(console.warn('[ln-persist] Element requires id or data-ln-persist="key"',t),null)}function N(e,t){const o=C(e,t);if(!o)return null;try{const i=localStorage.getItem(o);return i!==null?JSON.parse(i):null}catch{return null}}function E(e,t,o){const i=C(e,t);if(i)try{localStorage.setItem(i,JSON.stringify(o))}catch{}}(function(){const e="data-ln-toggle",t="lnToggle";if(window[t]!==void 0)return;function o(n){const r=Array.from(n.querySelectorAll("[data-ln-toggle-for]"));n.hasAttribute&&n.hasAttribute("data-ln-toggle-for")&&r.push(n);for(const s of r){if(s[t+"Trigger"])continue;const d=function(l){if(l.ctrlKey||l.metaKey||l.button===1)return;l.preventDefault();const u=s.getAttribute("data-ln-toggle-for"),a=document.getElementById(u);if(!a||!a[t])return;const c=s.getAttribute("data-ln-toggle-action")||"toggle";if(c==="open")a.setAttribute(e,"open");else if(c==="close")a.setAttribute(e,"close");else if(c==="toggle"){const T=a.getAttribute(e);a.setAttribute(e,T==="open"?"close":"open")}};s.addEventListener("click",d),s[t+"Trigger"]=d;const f=s.getAttribute("data-ln-toggle-for"),p=document.getElementById(f);p&&p[t]&&s.setAttribute("aria-expanded",p[t].isOpen?"true":"false")}}function i(n,r){const s=document.querySelectorAll('[data-ln-toggle-for="'+n.id+'"]');for(const d of s)d.setAttribute("aria-expanded",r?"true":"false")}function g(n){if(this.dom=n,n.hasAttribute("data-ln-persist")){const r=N("toggle",n);r!==null&&n.setAttribute(e,r)}return this.isOpen=n.getAttribute(e)==="open",this.isOpen&&n.classList.add("open"),i(n,this.isOpen),this}g.prototype.destroy=function(){if(!this.dom[t])return;h(this.dom,"ln-toggle:destroyed",{target:this.dom});const n=document.querySelectorAll('[data-ln-toggle-for="'+this.dom.id+'"]');for(const r of n)r[t+"Trigger"]&&(r.removeEventListener("click",r[t+"Trigger"]),delete r[t+"Trigger"]);delete this.dom[t]};function b(n){const r=n[t];if(!r)return;const d=n.getAttribute(e)==="open";if(d!==r.isOpen)if(d){if(w(n,"ln-toggle:before-open",{target:n}).defaultPrevented){n.setAttribute(e,"close");return}r.isOpen=!0,n.classList.add("open"),i(n,!0),h(n,"ln-toggle:open",{target:n}),n.hasAttribute("data-ln-persist")&&E("toggle",n,"open")}else{if(w(n,"ln-toggle:before-close",{target:n}).defaultPrevented){n.setAttribute(e,"open");return}r.isOpen=!1,n.classList.remove("open"),i(n,!1),h(n,"ln-toggle:close",{target:n}),n.hasAttribute("data-ln-persist")&&E("toggle",n,"close")}}I(e,t,g,"ln-toggle",{extraAttributes:["data-ln-toggle-for"],onAttributeChange:b,onInit:o})})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function x(e,o,
|
|
1
|
+
(function(){"use strict";function x(e,o,b){e.dispatchEvent(new CustomEvent(o,{bubbles:!0,detail:b||{}}))}function C(e,o){if(!document.body){document.addEventListener("DOMContentLoaded",function(){C(e,o)}),console.warn("["+o+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function L(e,o,b,c){if(e.nodeType!==1)return;const y=o.indexOf("[")!==-1||o.indexOf(".")!==-1||o.indexOf("#")!==-1?o:"["+o+"]",r=Array.from(e.querySelectorAll(y));e.matches&&e.matches(y)&&r.push(e);for(const i of r)i[b]||(i[b]=new c(i))}function O(e,o,b,c,v={}){const y=v.extraAttributes||[],r=v.onAttributeChange||null,i=v.onInit||null;function s(p){const f=p||document.body;L(f,e,o,b),i&&i(f)}return C(function(){const p=new MutationObserver(function(w){for(let E=0;E<w.length;E++){const d=w[E];if(d.type==="childList"){for(let u=0;u<d.addedNodes.length;u++){const l=d.addedNodes[u];l.nodeType===1&&(L(l,e,o,b),i&&i(l))}for(let u=0;u<d.removedNodes.length;u++){const l=d.removedNodes[u];if(l.nodeType===1){const t=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]",m=Array.from(l.querySelectorAll(t));l.matches&&l.matches(t)&&m.push(l);for(let n=0;n<m.length;n++){const a=m[n];if(!document.contains(a)){const h=a[o];h&&typeof h.destroy=="function"&&h.destroy()}}}}}else d.type==="attributes"&&(r&&d.target[o]?r(d.target,d.attributeName):(L(d.target,e,o,b),i&&i(d.target)))}});let f=[];if(e.indexOf("[")!==-1){const w=/\[([\w-]+)/g;let E;for(;(E=w.exec(e))!==null;)f.push(E[1])}else f.push(e);p.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:f.concat(y)})},c),window[o]=s,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){s(document.body)}):s(document.body),s}const T={};function N(e,o){T[e]=o}function M(e){return T[e]||{ingress:o=>o,egress:o=>o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=N,window.lnCore.getDataMapper=M);function D(e,o,b,c){const v=c,y=window.innerWidth,r=window.innerHeight,i=o.width,s=o.height,p=b.split("-"),f=p[0],w=p[1]==="start"||p[1]==="end"?p[1]:"center",E={top:["top","bottom","right","left"],bottom:["bottom","top","right","left"],left:["left","right","top","bottom"],right:["right","left","top","bottom"]},d=E[f]||E.bottom;function u(n){return n==="top"||n==="bottom"?w==="start"?e.left:w==="end"?e.right-i:e.left+(e.width-i)/2:w==="start"?e.top:w==="end"?e.bottom-s:e.top+(e.height-s)/2}function l(n){let a,h,_=!0;return n==="top"?(a=e.top-v-s,h=u(n),a<0&&(_=!1)):n==="bottom"?(a=e.bottom+v,h=u(n),a+s>r&&(_=!1)):n==="left"?(a=u(n),h=e.left-v-i,h<0&&(_=!1)):(a=u(n),h=e.right+v,h+i>y&&(_=!1)),{top:a,left:h,side:n,fits:_}}let A=null;for(let n=0;n<d.length;n++){const a=l(d[n]);if(a.fits){A=a;break}}A||(A=l(d[0]));let t=A.top,m=A.left;return i>=y?m=0:(m<0&&(m=0),m+i>y&&(m=y-i)),s>=r?t=0:(t<0&&(t=0),t+s>r&&(t=r-s)),{top:t,left:m,placement:A.side}}(function(){const e="data-ln-tooltip-enhance",o="data-ln-tooltip",b="data-ln-tooltip-position",c="lnTooltipEnhance",v="ln-tooltip-portal";if(window[c]!==void 0)return;let y=0,r=null,i=null,s=null,p=null,f=null;function w(){return r&&r.parentNode||(r=document.getElementById(v),r||(r=document.createElement("div"),r.id=v,document.body.appendChild(r))),r}function E(){f||(f=function(t){t.key==="Escape"&&l()},document.addEventListener("keydown",f))}function d(){f&&(document.removeEventListener("keydown",f),f=null)}function u(t){if(s===t)return;l();const m=t.getAttribute(o)||t.getAttribute("title");if(!m)return;w(),t.hasAttribute("title")&&(p=t.getAttribute("title"),t.removeAttribute("title"));const n=document.createElement("div");n.className="ln-tooltip",n.textContent=m,t[c+"Uid"]||(y+=1,t[c+"Uid"]="ln-tooltip-"+y),n.id=t[c+"Uid"],r.appendChild(n);const a=n.offsetWidth,h=n.offsetHeight,_=t.getBoundingClientRect(),I=t.getAttribute(b)||"top",g=D(_,{width:a,height:h},I,6);n.style.top=g.top+"px",n.style.left=g.left+"px",n.setAttribute("data-ln-tooltip-placement",g.placement),t.setAttribute("aria-describedby",n.id),i=n,s=t,E()}function l(){if(!i){d();return}s&&(s.removeAttribute("aria-describedby"),p!==null&&s.setAttribute("title",p)),p=null,i.parentNode&&i.parentNode.removeChild(i),i=null,s=null,d()}function A(t){return this.dom=t,t.hasAttribute("data-ln-tooltip-enhanced")||(t.setAttribute("data-ln-tooltip-enhanced",""),this._addedEnhancedAttr=!0),this._onEnter=function(){u(t)},this._onLeave=function(){s===t&&l()},this._onFocus=function(){u(t)},this._onBlur=function(){s===t&&l()},t.addEventListener("mouseenter",this._onEnter),t.addEventListener("mouseleave",this._onLeave),t.addEventListener("focus",this._onFocus,!0),t.addEventListener("blur",this._onBlur,!0),this}A.prototype.destroy=function(){const t=this.dom;t.removeEventListener("mouseenter",this._onEnter),t.removeEventListener("mouseleave",this._onLeave),t.removeEventListener("focus",this._onFocus,!0),t.removeEventListener("blur",this._onBlur,!0),s===t&&l(),this._addedEnhancedAttr&&t.removeAttribute("data-ln-tooltip-enhanced"),delete t[c],delete t[c+"Uid"],x(t,"ln-tooltip:destroyed",{trigger:t})},O("["+e+"], ["+o+"][title]",c,A,"ln-tooltip")})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const b={};function A(e,a){b[e]||(b[e]=document.querySelector('[data-ln-template="'+e+'"]'));const d=b[e];return d?d.content.cloneNode(!0):(console.warn("["+a+'] Template "'+e+'" not found'),null)}function w(e,a,d){e.dispatchEvent(new CustomEvent(a,{bubbles:!0,detail:d||{}}))}function q(e,a,d){const r=new CustomEvent(a,{bubbles:!0,cancelable:!0,detail:d||{}});return e.dispatchEvent(r),r}function E(e,a){if(!document.body){document.addEventListener("DOMContentLoaded",function(){E(e,a)}),console.warn("["+a+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function m(e,a,d,r){if(e.nodeType!==1)return;const s=a.indexOf("[")!==-1||a.indexOf(".")!==-1||a.indexOf("#")!==-1?a:"["+a+"]",o=Array.from(e.querySelectorAll(s));e.matches&&e.matches(s)&&o.push(e);for(const n of o)n[d]||(n[d]=new r(n))}function
|
|
1
|
+
(function(){"use strict";const b={};function A(e,a){b[e]||(b[e]=document.querySelector('[data-ln-template="'+e+'"]'));const d=b[e];return d?d.content.cloneNode(!0):(console.warn("["+a+'] Template "'+e+'" not found'),null)}function w(e,a,d){e.dispatchEvent(new CustomEvent(a,{bubbles:!0,detail:d||{}}))}function q(e,a,d){const r=new CustomEvent(a,{bubbles:!0,cancelable:!0,detail:d||{}});return e.dispatchEvent(r),r}function E(e,a){if(!document.body){document.addEventListener("DOMContentLoaded",function(){E(e,a)}),console.warn("["+a+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function m(e,a,d,r){if(e.nodeType!==1)return;const s=a.indexOf("[")!==-1||a.indexOf(".")!==-1||a.indexOf("#")!==-1?a:"["+a+"]",o=Array.from(e.querySelectorAll(s));e.matches&&e.matches(s)&&o.push(e);for(const n of o)n[d]||(n[d]=new r(n))}function _(e,a,d,r,t={}){const s=t.extraAttributes||[],o=t.onAttributeChange||null,n=t.onInit||null;function c(u){const l=u||document.body;m(l,e,a,d),n&&n(l)}return E(function(){const u=new MutationObserver(function(p){for(let h=0;h<p.length;h++){const i=p[h];if(i.type==="childList"){for(let g=0;g<i.addedNodes.length;g++){const f=i.addedNodes[g];f.nodeType===1&&(m(f,e,a,d),n&&n(f))}for(let g=0;g<i.removedNodes.length;g++){const f=i.removedNodes[g];if(f.nodeType===1){const C=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]",y=Array.from(f.querySelectorAll(C));f.matches&&f.matches(C)&&y.push(f);for(let v=0;v<y.length;v++){const x=y[v];if(!document.contains(x)){const L=x[a];L&&typeof L.destroy=="function"&&L.destroy()}}}}}else i.type==="attributes"&&(o&&i.target[a]?o(i.target,i.attributeName):(m(i.target,e,a,d),n&&n(i.target)))}});let l=[];if(e.indexOf("[")!==-1){const p=/\[([\w-]+)/g;let h;for(;(h=p.exec(e))!==null;)l.push(h[1])}else l.push(e);u.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:l.concat(s)})},r),window[a]=c,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){c(document.body)}):c(document.body),c}const S={};function D(e,a){S[e]=a}function O(e){return S[e]||{ingress:a=>a,egress:a=>a}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=D,window.lnCore.getDataMapper=O),(function(){const e="data-ln-translations",a="lnTranslations";if(window[a]!==void 0)return;const d={en:"English",sq:"Shqip",sr:"Srpski"};function r(t){this.dom=t,this.activeLanguages=new Set,this.defaultLang=t.getAttribute(e+"-default")||"",this.badgesEl=t.querySelector("["+e+"-active]"),this.menuEl=t.querySelector("[data-ln-dropdown] > [data-ln-toggle]");const s=t.getAttribute(e+"-locales");if(this.locales=d,s)try{this.locales=JSON.parse(s)}catch{console.warn("[ln-translations] Invalid JSON in data-ln-translations-locales")}this._applyDefaultLang(),this._updateDropdown();const o=this;return this._onRequestAdd=function(n){n.detail&&n.detail.lang&&o.addLanguage(n.detail.lang)},this._onRequestRemove=function(n){n.detail&&n.detail.lang&&o.removeLanguage(n.detail.lang)},t.addEventListener("ln-translations:request-add",this._onRequestAdd),t.addEventListener("ln-translations:request-remove",this._onRequestRemove),this._detectExisting(),this}r.prototype._applyDefaultLang=function(){if(!this.defaultLang)return;const t=this.dom.querySelectorAll("[data-ln-translatable]");for(const s of t){const o=s.querySelectorAll("input:not([data-ln-translatable-lang]), textarea:not([data-ln-translatable-lang]), select:not([data-ln-translatable-lang])");for(const n of o)n.setAttribute("data-ln-translatable-lang",this.defaultLang)}},r.prototype._detectExisting=function(){const t=this.dom.querySelectorAll("[data-ln-translatable-lang]");for(const s of t){const o=s.getAttribute("data-ln-translatable-lang");o&&o!==this.defaultLang&&this.activeLanguages.add(o)}this.activeLanguages.size>0&&(this._updateBadges(),this._updateDropdown())},r.prototype._updateDropdown=function(){if(!this.menuEl)return;this.menuEl.textContent="";const t=this;let s=0;for(const n in this.locales){if(!this.locales.hasOwnProperty(n)||this.activeLanguages.has(n))continue;s++;const c=A("ln-translations-menu-item","ln-translations");if(!c)return;const u=c.querySelector("[data-ln-translations-lang]");u.setAttribute("data-ln-translations-lang",n),u.textContent=this.locales[n],u.addEventListener("click",function(l){l.ctrlKey||l.metaKey||l.button===1||(l.preventDefault(),l.stopPropagation(),t.menuEl.getAttribute("data-ln-toggle")==="open"&&t.menuEl.setAttribute("data-ln-toggle","close"),t.addLanguage(n))}),this.menuEl.appendChild(c)}const o=this.dom.querySelector("["+e+"-add]");o&&(o.style.display=s===0?"none":"")},r.prototype._updateBadges=function(){if(!this.badgesEl)return;this.badgesEl.textContent="";const t=this;this.activeLanguages.forEach(function(s){const o=A("ln-translations-badge","ln-translations");if(!o)return;const n=o.querySelector("[data-ln-translations-lang]");n.setAttribute("data-ln-translations-lang",s);const c=n.querySelector("span");c.textContent=t.locales[s]||s.toUpperCase();const u=n.querySelector("button");u.setAttribute("aria-label","Remove "+(t.locales[s]||s.toUpperCase())),u.addEventListener("click",function(l){l.ctrlKey||l.metaKey||l.button===1||(l.preventDefault(),l.stopPropagation(),t.removeLanguage(s))}),t.badgesEl.appendChild(o)})},r.prototype.addLanguage=function(t,s){if(this.activeLanguages.has(t))return;const o=this.locales[t]||t;if(q(this.dom,"ln-translations:before-add",{target:this.dom,lang:t,langName:o}).defaultPrevented)return;this.activeLanguages.add(t),s=s||{};const c=this.dom.querySelectorAll("[data-ln-translatable]");for(const u of c){const l=u.getAttribute("data-ln-translatable"),p=u.getAttribute("data-ln-translations-prefix")||"",h=u.querySelector(this.defaultLang?'[data-ln-translatable-lang="'+this.defaultLang+'"]':"input:not([data-ln-translatable-lang]), textarea:not([data-ln-translatable-lang]), select:not([data-ln-translatable-lang])");if(!h)continue;const i=h.cloneNode(!1);p?i.name=p+"[trans]["+t+"]["+l+"]":i.name="trans["+t+"]["+l+"]",i.value=s[l]!==void 0?s[l]:"",i.removeAttribute("id"),i.placeholder=o+" translation",i.setAttribute("data-ln-translatable-lang",t);const g=u.querySelectorAll('[data-ln-translatable-lang]:not([data-ln-translatable-lang="'+this.defaultLang+'"])'),f=g.length>0?g[g.length-1]:h;f.parentNode.insertBefore(i,f.nextSibling)}this._updateDropdown(),this._updateBadges(),w(this.dom,"ln-translations:added",{target:this.dom,lang:t,langName:o})},r.prototype.removeLanguage=function(t){if(!this.activeLanguages.has(t)||q(this.dom,"ln-translations:before-remove",{target:this.dom,lang:t}).defaultPrevented)return;const o=this.dom.querySelectorAll('[data-ln-translatable-lang="'+t+'"]');for(const n of o)n.parentNode.removeChild(n);this.activeLanguages.delete(t),this._updateDropdown(),this._updateBadges(),w(this.dom,"ln-translations:removed",{target:this.dom,lang:t})},r.prototype.getActiveLanguages=function(){return new Set(this.activeLanguages)},r.prototype.hasLanguage=function(t){return this.activeLanguages.has(t)},r.prototype.destroy=function(){if(!this.dom[a])return;const t=this.defaultLang,s=this.dom.querySelectorAll("[data-ln-translatable-lang]");for(const o of s)o.getAttribute("data-ln-translatable-lang")!==t&&o.parentNode.removeChild(o);this.dom.removeEventListener("ln-translations:request-add",this._onRequestAdd),this.dom.removeEventListener("ln-translations:request-remove",this._onRequestRemove),delete this.dom[a]},_(e,a,r,"ln-translations")})()})();
|