@livenetworks/ashlar 1.3.2 → 1.4.0
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 +45 -0
- package/js/ln-core/index.js +1 -1
- 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/README.md +11 -1
- package/js/ln-date/ln-date.js +1 -1
- package/js/ln-date/src/ln-date.js +104 -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-number/src/ln-number.js +50 -2
- 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 +55 -55
- package/scss/components/_date.scss +21 -0
- package/scss/config/mixins/_form.scss +101 -54
- package/scss/config/mixins/_layout.scss +7 -9
- package/scss/config/mixins/_toast.scss +4 -0
- package/scss/ln-ashlar.scss +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function A(t,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][e];v&&typeof v.destroy=="function"&&v.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 A(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 T(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 _=g[b][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 E(t,e){C[t]=e}function x(t){return C[t]||{ingress:e=>e,egress:e=>e}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=E,window.lnCore.getDataMapper=x),(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||A(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])},T(t,e,c,"ln-search")})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function
|
|
1
|
+
(function(){"use strict";function p(n,o,f){n.dispatchEvent(new CustomEvent(o,{bubbles:!0,detail:f||{}}))}function A(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 _(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 E=v[y][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 C(n,o){L[n]=o}function O(n){return L[n]||{ingress:o=>o,egress:o=>o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=C,window.lnCore.getDataMapper=O),(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(A(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}))}_(n,o,a,"ln-sortable",{onAttributeChange:m})})()})();
|
package/js/ln-table/ln-table.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function m(d,i,p){d.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:p||{}}))}function C(d,i){if(!document.body){document.addEventListener("DOMContentLoaded",function(){C(d,i)}),console.warn("["+i+'] Script loaded before <body> — add "defer" to your <script> tag');return}d()}function T(d,i,p,g){if(d.nodeType!==1)return;const w=i.indexOf("[")!==-1||i.indexOf(".")!==-1||i.indexOf("#")!==-1?i:"["+i+"]",b=Array.from(d.querySelectorAll(w));d.matches&&d.matches(w)&&b.push(d);for(const c of b)c[p]||(c[p]=new g(c))}function A(d,i,p,g,v={}){const w=v.extraAttributes||[],b=v.onAttributeChange||null,c=v.onInit||null;function e(l){const t=l||document.body;T(t,d,i,p),c&&c(t)}return C(function(){const l=new MutationObserver(function(n){for(let h=0;h<n.length;h++){const s=n[h];if(s.type==="childList")for(let u=0;u<s.addedNodes.length;u++){const o=s.addedNodes[u];o.nodeType===1&&(T(o,d,i,p),c&&c(o))}else s.type==="attributes"&&(b&&s.target[i]?b(s.target,s.attributeName):(T(s.target,d,i,p),c&&c(s.target)))}});let t=[];if(d.indexOf("[")!==-1){const n=/\[([\w-]+)/g;let h;for(;(h=n.exec(d))!==null;)t.push(h[1])}else t.push(d);l.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:t.concat(w)})},g),window[i]=e,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){e(document.body)}):e(document.body),e}const L={};function D(d,i){L[d]=i}function O(d){return L[d]||{ingress:i=>i,egress:i=>i}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=D,window.lnCore.getDataMapper=O),(function(){const d="data-ln-table",i="lnTable",p="data-ln-sort",g="data-ln-table-empty";if(window[i]!==void 0)return;const b=typeof Intl<"u"?new Intl.Collator(document.documentElement.lang||void 0,{sensitivity:"base"}):null;function c(e){this.dom=e,this.table=e.querySelector("table"),this.tbody=e.querySelector("tbody"),this.thead=e.querySelector("thead");const l=this.thead?this.thead.querySelector("tr:last-child"):null;this.ths=l?Array.from(l.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(),m(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(),m(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 h=n.detail.key;let s=!1;for(let r=0;r<t.ths.length;r++)if(t.ths[r].getAttribute("data-ln-filter-col")===h){s=!0;break}if(!s)return;const u=n.detail.values;if(!u||u.length===0)delete t._columnFilters[h];else{const r=[];for(let a=0;a<u.length;a++)r.push(u[a].toLowerCase());t._columnFilters[h]=r}const o=t.dom.querySelector('th[data-ln-filter-col="'+h+'"]');o&&(u&&u.length>0?o.setAttribute("data-ln-filter-active",""):o.removeAttribute("data-ln-filter-active")),t._applyFilterAndSort(),t._vStart=-1,t._vEnd=-1,t._render(),m(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 s=document.querySelector('[data-ln-search="'+e.id+'"]');if(s){const o=s.tagName==="INPUT"?s:s.querySelector("input");o&&(o.value="")}t._columnFilters={};for(let o=0;o<t.ths.length;o++)t.ths[o].removeAttribute("data-ln-filter-active");const u=document.querySelectorAll('[data-ln-filter="'+e.id+'"]');for(let o=0;o<u.length;o++){const r=u[o].querySelector("[data-ln-filter-reset]");r&&(r.checked=!0,r.dispatchEvent(new Event("change",{bubbles:!0})))}t._applyFilterAndSort(),t._vStart=-1,t._vEnd=-1,t._render(),m(e,"ln-table:filter",{term:"",matched:t._filteredData.length,total:t._data.length})},e.addEventListener("click",this._onClear),this}c.prototype._parseRows=function(){const e=this.tbody.rows,l=this.ths;this._data=[];const t=[];for(let n=0;n<l.length;n++)t[n]=l[n].getAttribute(p);e.length>0&&(this._rowHeight=e[0].offsetHeight||40),this._lockColumnWidths();for(let n=0;n<e.length;n++){const h=e[n],s=[],u=[],o=[];for(let r=0;r<h.cells.length;r++){const a=h.cells[r],f=a.textContent.trim(),_=a.hasAttribute("data-ln-value")?a.getAttribute("data-ln-value"):f,y=t[r];u[r]=f.toLowerCase(),y==="number"||y==="date"?s[r]=parseFloat(_)||0:y==="string"?s[r]=String(_):s[r]=null,r<h.cells.length-1&&o.push(f.toLowerCase())}this._data.push({sortKeys:s,rawTexts:u,html:h.outerHTML,searchText:o.join(" ")})}this._filteredData=this._data.slice(),this._render(),m(this.dom,"ln-table:ready",{total:this._data.length})},c.prototype._applyFilterAndSort=function(){const e=this._searchTerm,l=this._columnFilters,t=Object.keys(l).length>0,n=this.ths,h={};if(t)for(let a=0;a<n.length;a++){const f=n[a].getAttribute("data-ln-filter-col");f&&(h[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 l){const _=h[f];if(_!==void 0&&l[f].indexOf(a.rawTexts[_])===-1)return!1}return!0}),this._sortCol<0||!this._sortDir)return;const s=this._sortCol,u=this._sortDir==="desc"?-1:1,o=this._sortType==="number"||this._sortType==="date",r=b?b.compare:function(a,f){return a<f?-1:a>f?1:0};this._filteredData.sort(function(a,f){const _=a.sortKeys[s],y=f.sortKeys[s];return o?(_-y)*u:r(_,y)*u})},c.prototype._lockColumnWidths=function(){if(!this.table||!this.thead||this._colgroup)return;const e=document.createElement("colgroup");this.ths.forEach(function(l){const t=document.createElement("col");t.style.width=l.offsetWidth+"px",e.appendChild(t)}),this.table.insertBefore(e,this.table.firstChild),this.table.style.tableLayout="fixed",this._colgroup=e},c.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())},c.prototype._renderAll=function(){const e=[],l=this._filteredData;for(let t=0;t<l.length;t++)e.push(l[t].html);this.tbody.innerHTML=e.join("")},c.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})},c.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)},c.prototype._renderVirtual=function(){const e=this._filteredData,l=e.length,t=this._rowHeight;if(!t||!l)return;const h=this.table.getBoundingClientRect().top+window.scrollY,s=this.thead?this.thead.offsetHeight:0,u=h+s,o=window.scrollY-u,r=Math.max(0,Math.floor(o/t)-15),a=Math.min(r+Math.ceil(window.innerHeight/t)+30,l);if(r===this._vStart&&a===this._vEnd)return;this._vStart=r,this._vEnd=a;const f=this.ths.length||1,_=r*t,y=(l-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=r;E<a;E++)S+=e[E].html;y>0&&(S+='<tr class="ln-table__spacer" aria-hidden="true"><td colspan="'+f+'" style="height:'+y+'px;padding:0;border:none"></td></tr>'),this.tbody.innerHTML=S},c.prototype._showEmptyState=function(){const e=this.ths.length||1,l=this.dom.querySelector("template["+g+"]"),t=document.createElement("td");t.setAttribute("colspan",String(e)),l&&t.appendChild(document.importNode(l.content,!0));const n=document.createElement("tr");n.className="ln-table__empty",n.appendChild(t),this.tbody.innerHTML="",this.tbody.appendChild(n),m(this.dom,"ln-table:empty",{term:this._searchTerm,total:this._data.length})},c.prototype.destroy=function(){this.dom[i]&&(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[i])},A(d,i,c,"ln-table")})()})();
|
|
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")})()})();
|
package/js/ln-tabs/ln-tabs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";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 L(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(h){for(let c=0;c<h.length;c++){const l=h[c];if(l.type==="childList"){for(let f=0;f<l.addedNodes.length;f++){const u=l.addedNodes[f];u.nodeType===1&&(b(u,s,n,o),t&&t(u))}for(let f=0;f<l.removedNodes.length;f++){const u=l.removedNodes[f];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 w=y[g][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 h=/\[([\w-]+)/g;let c;for(;(c=h.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 O(s,n){C[s]=n}function T(s){return C[s]||{ingress:n=>n,egress:n=>n}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=O,window.lnCore.getDataMapper=T);const _="ln:";function K(){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?_+s+":"+K()+":"+d:(console.warn('[ln-persist] Element requires id or data-ln-persist="key"',n),null)}function S(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 k(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 h=r.split("&");if(t)for(const f of h){const u=f.indexOf(":");if(u>0&&f.slice(0,u).toLowerCase().trim()===t)return f.slice(u+1).toLowerCase().trim()}const c=h[h.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 h=o();h[e.nsKey]=r;const c=Object.keys(h).map(function(l){return l+":"+h[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=S("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&&k("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]}},L(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
|
|
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 r of w)r[d]||(r[d]=new v(r))}function N(e,n,d,v,A={}){const h=A.extraAttributes||[],w=A.onAttributeChange||null,r=A.onInit||null;function c(x){const l=x||document.body;O(l,e,n,d),r&&r(l)}return I(function(){const x=new MutationObserver(function(M){for(let y=0;y<M.length;y++){const i=M[y];if(i.type==="childList"){for(let g=0;g<i.addedNodes.length;g++){const f=i.addedNodes[g];f.nodeType===1&&(O(f,e,n,d),r&&r(f))}for(let g=0;g<i.removedNodes.length;g++){const f=i.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][n];D&&typeof D.destroy=="function"&&D.destroy()}}}}else i.type==="attributes"&&(w&&i.target[n]?w(i.target,i.attributeName):(O(i.target,e,n,d),r&&r(i.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 r=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 r){if(!document.body.contains(t.dom)){r.delete(t);continue}p(t)}r.size===0&&l()}function y(t,o){return h(o,{dateStyle:"long",timeStyle:"short"}).format(t)}function i(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 i(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=i(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"&&(r.add(this),x()),this}_.prototype.render=function(){p(this)},_.prototype.destroy=function(){r.delete(this),r.size===0&&l(),delete this.dom[n]};function S(t){const o=t[n];if(!o)return;t.getAttribute(e)==="relative"?(r.add(o),x()):(r.delete(o),r.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(
|
|
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 S(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 v=m[A][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 I(e,t){x[e]=t}function M(e){return x[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=I,window.lnCore.getDataMapper=M);const D="ln:";function _(){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?D+e+":"+_()+":"+i:(console.warn('[ln-persist] Element requires id or data-ln-persist="key"',t),null)}function q(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=q("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")}}S(e,t,g,"ln-toggle",{extraAttributes:["data-ln-toggle-for"],onAttributeChange:b,onInit:o})})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function x(e,
|
|
1
|
+
(function(){"use strict";function x(e,o,m){e.dispatchEvent(new CustomEvent(o,{bubbles:!0,detail:m||{}}))}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,m,c){if(e.nodeType!==1)return;const v=o.indexOf("[")!==-1||o.indexOf(".")!==-1||o.indexOf("#")!==-1?o:"["+o+"]",r=Array.from(e.querySelectorAll(v));e.matches&&e.matches(v)&&r.push(e);for(const i of r)i[m]||(i[m]=new c(i))}function O(e,o,m,c,b={}){const v=b.extraAttributes||[],r=b.onAttributeChange||null,i=b.onInit||null;function s(p){const u=p||document.body;L(u,e,o,m),i&&i(u)}return C(function(){const p=new MutationObserver(function(y){for(let w=0;w<y.length;w++){const d=y[w];if(d.type==="childList"){for(let a=0;a<d.addedNodes.length;a++){const l=d.addedNodes[a];l.nodeType===1&&(L(l,e,o,m),i&&i(l))}for(let a=0;a<d.removedNodes.length;a++){const l=d.removedNodes[a];if(l.nodeType===1){const t=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]",h=Array.from(l.querySelectorAll(t));l.matches&&l.matches(t)&&h.push(l);for(let n=0;n<h.length;n++){const f=h[n][o];f&&typeof f.destroy=="function"&&f.destroy()}}}}else d.type==="attributes"&&(r&&d.target[o]?r(d.target,d.attributeName):(L(d.target,e,o,m),i&&i(d.target)))}});let u=[];if(e.indexOf("[")!==-1){const y=/\[([\w-]+)/g;let w;for(;(w=y.exec(e))!==null;)u.push(w[1])}else u.push(e);p.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:u.concat(v)})},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,m,c){const b=c,v=window.innerWidth,r=window.innerHeight,i=o.width,s=o.height,p=m.split("-"),u=p[0],y=p[1]==="start"||p[1]==="end"?p[1]:"center",w={top:["top","bottom","right","left"],bottom:["bottom","top","right","left"],left:["left","right","top","bottom"],right:["right","left","top","bottom"]},d=w[u]||w.bottom;function a(n){return n==="top"||n==="bottom"?y==="start"?e.left:y==="end"?e.right-i:e.left+(e.width-i)/2:y==="start"?e.top:y==="end"?e.bottom-s:e.top+(e.height-s)/2}function l(n){let f,A,_=!0;return n==="top"?(f=e.top-b-s,A=a(n),f<0&&(_=!1)):n==="bottom"?(f=e.bottom+b,A=a(n),f+s>r&&(_=!1)):n==="left"?(f=a(n),A=e.left-b-i,A<0&&(_=!1)):(f=a(n),A=e.right+b,A+i>v&&(_=!1)),{top:f,left:A,side:n,fits:_}}let E=null;for(let n=0;n<d.length;n++){const f=l(d[n]);if(f.fits){E=f;break}}E||(E=l(d[0]));let t=E.top,h=E.left;return i>=v?h=0:(h<0&&(h=0),h+i>v&&(h=v-i)),s>=r?t=0:(t<0&&(t=0),t+s>r&&(t=r-s)),{top:t,left:h,placement:E.side}}(function(){const e="data-ln-tooltip-enhance",o="data-ln-tooltip",m="data-ln-tooltip-position",c="lnTooltipEnhance",b="ln-tooltip-portal";if(window[c]!==void 0)return;let v=0,r=null,i=null,s=null,p=null,u=null;function y(){return r&&r.parentNode||(r=document.getElementById(b),r||(r=document.createElement("div"),r.id=b,document.body.appendChild(r))),r}function w(){u||(u=function(t){t.key==="Escape"&&l()},document.addEventListener("keydown",u))}function d(){u&&(document.removeEventListener("keydown",u),u=null)}function a(t){if(s===t)return;l();const h=t.getAttribute(o)||t.getAttribute("title");if(!h)return;y(),t.hasAttribute("title")&&(p=t.getAttribute("title"),t.removeAttribute("title"));const n=document.createElement("div");n.className="ln-tooltip",n.textContent=h,t[c+"Uid"]||(v+=1,t[c+"Uid"]="ln-tooltip-"+v),n.id=t[c+"Uid"],r.appendChild(n);const f=n.offsetWidth,A=n.offsetHeight,_=t.getBoundingClientRect(),I=t.getAttribute(m)||"top",g=D(_,{width:f,height:A},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,w()}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 E(t){return this.dom=t,t.hasAttribute("data-ln-tooltip-enhanced")||(t.setAttribute("data-ln-tooltip-enhanced",""),this._addedEnhancedAttr=!0),this._onEnter=function(){a(t)},this._onLeave=function(){s===t&&l()},this._onFocus=function(){a(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}E.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,E,"ln-tooltip")})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const b={};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 x(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 L=y[v][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 _(e,a){S[e]=a}function D(e){return S[e]||{ingress:a=>a,egress:a=>a}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=_,window.lnCore.getDataMapper=D),(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]},x(e,a,r,"ln-translations")})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function
|
|
1
|
+
(function(){"use strict";function C(t,e,f){t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:f||{}}))}function w(t,e){if(!document.body){document.addEventListener("DOMContentLoaded",function(){w(t,e)}),console.warn("["+e+'] Script loaded before <body> — add "defer" to your <script> tag');return}t()}function L(t,e,f,h){if(t.nodeType!==1)return;const v=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]",p=Array.from(t.querySelectorAll(v));t.matches&&t.matches(v)&&p.push(t);for(const a of p)a[f]||(a[f]=new h(a))}function b(t,e,f,h,m={}){const v=m.extraAttributes||[],p=m.onAttributeChange||null,a=m.onInit||null;function n(i){const c=i||document.body;L(c,t,e,f),a&&a(c)}return w(function(){const i=new MutationObserver(function(l){for(let u=0;u<l.length;u++){const s=l[u];if(s.type==="childList"){for(let r=0;r<s.addedNodes.length;r++){const o=s.addedNodes[r];o.nodeType===1&&(L(o,t,e,f),a&&a(o))}for(let r=0;r<s.removedNodes.length;r++){const o=s.removedNodes[r];if(o.nodeType===1){const y=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",g=Array.from(o.querySelectorAll(y));o.matches&&o.matches(y)&&g.push(o);for(let _=0;_<g.length;_++){const E=g[_][e];E&&typeof E.destroy=="function"&&E.destroy()}}}}else s.type==="attributes"&&(p&&s.target[e]?p(s.target,s.attributeName):(L(s.target,t,e,f),a&&a(s.target)))}});let c=[];if(t.indexOf("[")!==-1){const l=/\[([\w-]+)/g;let u;for(;(u=l.exec(t))!==null;)c.push(u[1])}else c.push(t);i.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:c.concat(v)})},h),window[e]=n,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){n(document.body)}):n(document.body),n}const S={};function O(t,e){S[t]=e}function A(t){return S[t]||{ingress:e=>e,egress:e=>e}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=O,window.lnCore.getDataMapper=A),(function(){const t="data-ln-validate",e="lnValidate",f="data-ln-validate-errors",h="data-ln-validate-error",m="ln-validate-valid",v="ln-validate-invalid",p={required:"valueMissing",typeMismatch:"typeMismatch",tooShort:"tooShort",tooLong:"tooLong",patternMismatch:"patternMismatch",rangeUnderflow:"rangeUnderflow",rangeOverflow:"rangeOverflow"};if(window[e]!==void 0)return;function a(n){this.dom=n,this._touched=!1,this._customErrors=new Set;const i=this,c=n.tagName,l=n.type,u=c==="SELECT"||l==="checkbox"||l==="radio";return this._onInput=function(){i._touched=!0,i.validate()},this._onChange=function(){i._touched=!0,i.validate()},this._onSetCustom=function(s){const r=s.detail&&s.detail.error;if(!r)return;i._customErrors.add(r),i._touched=!0;const o=n.closest(".form-element");if(o){const d=o.querySelector("["+h+'="'+r+'"]');d&&d.classList.remove("hidden")}n.classList.remove(m),n.classList.add(v)},this._onClearCustom=function(s){const r=s.detail&&s.detail.error,o=n.closest(".form-element");if(r){if(i._customErrors.delete(r),o){const d=o.querySelector("["+h+'="'+r+'"]');d&&d.classList.add("hidden")}}else i._customErrors.forEach(function(d){if(o){const y=o.querySelector("["+h+'="'+d+'"]');y&&y.classList.add("hidden")}}),i._customErrors.clear();i._touched&&i.validate()},u||n.addEventListener("input",this._onInput),n.addEventListener("change",this._onChange),n.addEventListener("ln-validate:set-custom",this._onSetCustom),n.addEventListener("ln-validate:clear-custom",this._onClearCustom),this}a.prototype.validate=function(){const n=this.dom,i=n.validity,l=n.checkValidity()&&this._customErrors.size===0,u=n.closest(".form-element");if(u){const r=u.querySelector("["+f+"]");if(r){const o=r.querySelectorAll("["+h+"]");for(let d=0;d<o.length;d++){const y=o[d].getAttribute(h),g=p[y];g&&(i[g]?o[d].classList.remove("hidden"):o[d].classList.add("hidden"))}}}return n.classList.toggle(m,l),n.classList.toggle(v,!l),C(n,l?"ln-validate:valid":"ln-validate:invalid",{target:n,field:n.name}),l},a.prototype.reset=function(){this._touched=!1,this._customErrors.clear(),this.dom.classList.remove(m,v);const n=this.dom.closest(".form-element");if(n){const i=n.querySelectorAll("["+h+"]");for(let c=0;c<i.length;c++)i[c].classList.add("hidden")}},Object.defineProperty(a.prototype,"isValid",{get:function(){return this.dom.checkValidity()&&this._customErrors.size===0}}),a.prototype.destroy=function(){this.dom[e]&&(this.dom.removeEventListener("input",this._onInput),this.dom.removeEventListener("change",this._onChange),this.dom.removeEventListener("ln-validate:set-custom",this._onSetCustom),this.dom.removeEventListener("ln-validate:clear-custom",this._onClearCustom),this.dom.classList.remove(m,v),C(this.dom,"ln-validate:destroyed",{target:this.dom}),delete this.dom[e])},b(t,e,a,"ln-validate")})()})();
|
package/package.json
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@livenetworks/ashlar",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "LiveNetworks unified frontend library - CSS framework and vanilla JS components",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"author": "Live Networks",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"publishConfig": {
|
|
9
|
-
"access": "public"
|
|
10
|
-
},
|
|
11
|
-
"repository": {
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "git+https://github.com/livenetworks/ln-ashlar.git"
|
|
14
|
-
},
|
|
15
|
-
"homepage": "https://github.com/livenetworks/ln-ashlar#readme",
|
|
16
|
-
"bugs": "https://github.com/livenetworks/ln-ashlar/issues",
|
|
17
|
-
"keywords": [
|
|
18
|
-
"css",
|
|
19
|
-
"scss",
|
|
20
|
-
"design-system",
|
|
21
|
-
"frontend",
|
|
22
|
-
"components",
|
|
23
|
-
"vanilla-js"
|
|
24
|
-
],
|
|
25
|
-
"files": [
|
|
26
|
-
"scss/",
|
|
27
|
-
"js/"
|
|
28
|
-
],
|
|
29
|
-
"exports": {
|
|
30
|
-
"./scss/*": "./scss/*",
|
|
31
|
-
"./js/*": "./js/*"
|
|
32
|
-
},
|
|
33
|
-
"scripts": {
|
|
34
|
-
"dev": "node scripts/build.mjs --watch",
|
|
35
|
-
"build": "node scripts/build.mjs && npm run build:demos",
|
|
36
|
-
"build:demos": "npm run build:demo-index && npm run build:demo-admin && npm run build:demo-docuflow",
|
|
37
|
-
"build:demo-index": "sass demo/index.scss demo/index.css --no-source-map --style=compressed",
|
|
38
|
-
"build:demo-admin": "sass demo/admin/src/admin.scss demo/admin/dist/admin.css --no-source-map --style=compressed && cp demo/admin/src/demo.js demo/admin/dist/demo.js && node demo/admin/src/build-pages.mjs",
|
|
39
|
-
"build:demo-docuflow": "sass demo/docuflow/docuflow.scss demo/docuflow/dist/docuflow.css --no-source-map --style=compressed"
|
|
40
|
-
},
|
|
41
|
-
"devDependencies": {
|
|
42
|
-
"@tabler/icons": "^3.41.1",
|
|
43
|
-
"flag-icons": "^7.5.0",
|
|
44
|
-
"sass-embedded": "^1.83.0",
|
|
45
|
-
"vite": "^6.0.0"
|
|
46
|
-
},
|
|
47
|
-
"peerDependencies": {
|
|
48
|
-
"tom-select": "^2.0.0"
|
|
49
|
-
},
|
|
50
|
-
"peerDependenciesMeta": {
|
|
51
|
-
"tom-select": {
|
|
52
|
-
"optional": true
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@livenetworks/ashlar",
|
|
3
|
+
"version": "1.4.0",
|
|
4
|
+
"description": "LiveNetworks unified frontend library - CSS framework and vanilla JS components",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Live Networks",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/livenetworks/ln-ashlar.git"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/livenetworks/ln-ashlar#readme",
|
|
16
|
+
"bugs": "https://github.com/livenetworks/ln-ashlar/issues",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"css",
|
|
19
|
+
"scss",
|
|
20
|
+
"design-system",
|
|
21
|
+
"frontend",
|
|
22
|
+
"components",
|
|
23
|
+
"vanilla-js"
|
|
24
|
+
],
|
|
25
|
+
"files": [
|
|
26
|
+
"scss/",
|
|
27
|
+
"js/"
|
|
28
|
+
],
|
|
29
|
+
"exports": {
|
|
30
|
+
"./scss/*": "./scss/*",
|
|
31
|
+
"./js/*": "./js/*"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"dev": "node scripts/build.mjs --watch",
|
|
35
|
+
"build": "node scripts/build.mjs && npm run build:demos",
|
|
36
|
+
"build:demos": "npm run build:demo-index && npm run build:demo-admin && npm run build:demo-docuflow",
|
|
37
|
+
"build:demo-index": "sass demo/index.scss demo/index.css --no-source-map --style=compressed",
|
|
38
|
+
"build:demo-admin": "sass demo/admin/src/admin.scss demo/admin/dist/admin.css --no-source-map --style=compressed && cp demo/admin/src/demo.js demo/admin/dist/demo.js && node demo/admin/src/build-pages.mjs",
|
|
39
|
+
"build:demo-docuflow": "sass demo/docuflow/docuflow.scss demo/docuflow/dist/docuflow.css --no-source-map --style=compressed"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@tabler/icons": "^3.41.1",
|
|
43
|
+
"flag-icons": "^7.5.0",
|
|
44
|
+
"sass-embedded": "^1.83.0",
|
|
45
|
+
"vite": "^6.0.0"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"tom-select": "^2.0.0"
|
|
49
|
+
},
|
|
50
|
+
"peerDependenciesMeta": {
|
|
51
|
+
"tom-select": {
|
|
52
|
+
"optional": true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@use '../config/mixins' as *;
|
|
2
|
+
|
|
3
|
+
// ─── Date field — ln-date merged input ──────────────────────────
|
|
4
|
+
// Applied to the wrapper <span> that ln-date generates around the
|
|
5
|
+
// visible input, hidden submit input, native picker, and calendar button.
|
|
6
|
+
// Uses the generic form-field-group mixin (bordered flex shell).
|
|
7
|
+
|
|
8
|
+
[data-ln-date-field] {
|
|
9
|
+
@include form-field-group;
|
|
10
|
+
// The submit value input has no visual role — hide it entirely.
|
|
11
|
+
> input[type="hidden"] {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// The native date picker stays rendered (position:absolute via inline style)
|
|
16
|
+
// so showPicker() can anchor the calendar popup to this element's position.
|
|
17
|
+
> input[type="date"] {
|
|
18
|
+
position: absolute;
|
|
19
|
+
pointer-events: none;
|
|
20
|
+
}
|
|
21
|
+
}
|