@livenetworks/ashlar 2.1.13 → 2.2.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/components/COMPONENTS.md +80 -80
- package/components/ln-api-connector/ln-api-connector.schema.json +105 -105
- package/components/ln-chart/ln-chart-dev.scss +0 -4
- package/components/ln-core/README.md +21 -21
- package/components/ln-core/ln-core.schema.json +120 -120
- package/components/ln-core/query.js +113 -113
- package/components/ln-data-coordinator/README.md +2 -0
- package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
- package/components/ln-data-coordinator/ln-data-coordinator.schema.json +196 -196
- package/components/ln-data-coordinator/src/ln-data-coordinator.js +457 -432
- package/components/ln-data-store/ln-data-store.schema.json +92 -92
- package/components/ln-date/ln-date.js +1 -1
- package/components/ln-date/src/ln-date.js +1 -1
- package/components/ln-debug/ln-debug.js +1 -1
- package/components/ln-debug/ln-debug.schema.json +28 -28
- package/components/ln-debug/src/generated-attributes.js +304 -302
- package/components/ln-dropdown/ln-dropdown.schema.json +90 -90
- package/components/ln-external-links/README.md +19 -19
- package/components/ln-external-links/ln-external-links.js +1 -1
- package/components/ln-external-links/ln-external-links.schema.json +9 -0
- package/components/ln-external-links/ln-external-links.scss +12 -0
- package/components/ln-external-links/src/ln-external-links.js +3 -2
- package/components/ln-filter/README.md +2 -1
- package/components/ln-filter/ln-filter.js +1 -1
- package/components/ln-filter/ln-filter.schema.json +157 -169
- package/components/ln-filter/src/ln-filter.js +1 -3
- package/components/ln-form/ln-form.schema.json +57 -57
- package/components/ln-key/ln-key.js +1 -1
- package/components/ln-key/ln-key.schema.json +8 -0
- package/components/ln-key/src/ln-key.js +8 -5
- package/components/ln-obfuscator/ln-obfuscator.js +1 -1
- package/components/ln-obfuscator/ln-obfuscator.schema.json +6 -0
- package/components/ln-obfuscator/src/ln-obfuscator.js +2 -2
- package/components/ln-options/ln-options.schema.json +47 -47
- package/components/ln-popover/ln-popover.schema.json +82 -82
- package/components/ln-progress/ln-progress.schema.json +0 -13
- package/components/ln-search/ln-search.schema.json +111 -111
- package/components/ln-sort/README.md +1 -0
- package/components/ln-sort/ln-sort.js +1 -1
- package/components/ln-sort/ln-sort.schema.json +100 -112
- package/components/ln-sort/src/sort-model.js +1 -6
- package/components/ln-sortable/ln-sortable.schema.json +38 -38
- package/components/ln-sortable/ln-sortable.scss +25 -25
- package/components/ln-table/README.md +8 -1
- package/components/ln-table/ln-table.js +1 -1
- package/components/ln-table/ln-table.schema.json +195 -195
- package/components/ln-table/src/ln-table.js +43 -7
- package/components/ln-table-coordinator/ln-table-coordinator.js +1 -1
- package/components/ln-table-coordinator/ln-table-coordinator.schema.json +18 -0
- package/components/ln-table-coordinator/src/ln-table-coordinator.js +104 -2
- package/components/ln-toast/README.md +1 -1
- package/components/ln-toast/ln-toast.js +1 -1
- package/components/ln-toast/ln-toast.schema.json +6 -0
- package/components/ln-toast/src/ln-toast.js +1 -1
- package/components/ln-validate/README.md +6 -6
- package/components/ln-validate/ln-validate-dev.scss +0 -5
- package/components/ln-validate/ln-validate.js +1 -1
- package/components/ln-validate/ln-validate.schema.json +0 -6
- package/components/ln-validate/src/ln-validate.js +48 -29
- package/ln-ashlar.html-data.json +1824 -1814
- package/package.json +95 -95
- package/theme/README.md +7 -6
- package/theme/base/_global.scss +2 -2
- package/theme/base/_reset.scss +11 -0
- package/theme/components/_app-shell.scss +0 -8
- package/theme/components/_form.scss +6 -6
- package/theme/components/_ln-table.scss +6 -3
- package/theme/components/_scrollbar.scss +5 -4
- package/theme/components/_sortable.scss +19 -19
- package/theme/components/_stat-card.scss +1 -0
- package/theme/components/_table.scss +10 -33
- package/theme/config/_density.scss +236 -104
- package/theme/config/_palette.scss +71 -49
- package/theme/config/_theme.scss +27 -31
- package/theme/config/_tokens.scss +28 -26
- package/theme/config/mixins/_app-shell.scss +17 -21
- package/theme/config/mixins/_btn.scss +4 -2
- package/theme/config/mixins/_card.scss +87 -67
- package/theme/config/mixins/_colors.scss +2 -1
- package/theme/config/mixins/_display.scss +12 -0
- package/theme/config/mixins/_footer.scss +3 -1
- package/theme/config/mixins/_form.scss +48 -16
- package/theme/config/mixins/_layout.scss +9 -0
- package/theme/config/mixins/_ln-table.scss +22 -15
- package/theme/config/mixins/_modal.scss +3 -0
- package/theme/config/mixins/_nav.scss +27 -4
- package/theme/config/mixins/_sidebar.scss +2 -1
- package/theme/config/mixins/_stat-card.scss +33 -2
- package/theme/config/mixins/_status-badge.scss +1 -0
- package/theme/config/mixins/_table.scss +81 -39
- package/theme/config/mixins/_tabs.scss +31 -0
- package/theme/config/mixins/_toast.scss +0 -1
- package/theme/designs/relaxed/_card.scss +12 -0
- package/theme/designs/relaxed/_layout.scss +24 -0
- package/theme/ln-ashlar-core.scss +1 -0
- package/theme/ln-ashlar-dev.scss +0 -1
- package/theme/ln-ashlar-relaxed.scss +67 -0
- package/theme/tailwind/components.css +561 -24
- package/theme/utilities/_utilities.scss +1 -11
- package/web-types.json +2351 -2337
- package/components/ln-progress/ln-progress-dev.scss +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function R(){if(typeof window>"u")return!1;if(window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink)return!0;if(typeof document<"u"){if(document.documentElement&&document.documentElement.hasAttribute("data-ln-debug"))return!0;if(document.body)return document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null}return!1}function x(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let i=1;i<t.length;i++)if(t[i]&&t[i].nodeType===1){o=t[i];break}if(!x(o))return}e.apply(console,t)}}function $(e,t,r){const o=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function S(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){S(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function re(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function oe(e,t){const r=!!(t&&t.typed),o=t&&t.exclude,i={},c=e.elements,l={};if(r)for(let s=0;s<c.length;s++){const n=c[s];n.name&&n.type==="checkbox"&&!n.disabled&&(l[n.name]=(l[n.name]||0)+1)}for(let s=0;s<c.length;s++){const n=c[s];if(!(!n.name||n.disabled||n.type==="file"||n.type==="submit"||n.type==="button")&&!(o&&n.matches&&n.matches(o)))if(n.type==="checkbox")r&&l[n.name]===1?i[n.name]=n.checked:(i[n.name]||(i[n.name]=[]),n.checked&&i[n.name].push(n.value));else if(n.type==="radio")n.checked&&(i[n.name]=n.value);else if(n.type==="select-multiple"){i[n.name]=[];for(let a=0;a<n.options.length;a++)n.options[a].selected&&i[n.name].push(n.options[a].value)}else if(r&&n.type==="hidden")i[n.name]=n.value;else if(r&&(n.type==="number"||n.type==="range")){const a=Number(n.value);i[n.name]=n.value===""||isNaN(a)?null:a}else i[n.name]=n.value}return i}function ie(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function le(e,t){const r=e.elements,o=[],i={};for(let c=0;c<r.length;c++){const l=r[c];l.name&&l.type==="checkbox"&&(i[l.name]=(i[l.name]||0)+1)}for(let c=0;c<r.length;c++){const l=r[c];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const s=l.getAttribute("data-ln-fill-as")||l.name;if(!s||!(s in t))continue;const n=t[s];if(l.type==="checkbox"){if(Array.isArray(n))l.checked=n.indexOf(l.value)!==-1;else if(i[l.name]>1){const a=String(n).split(",").map(function(d){return d.trim()});l.checked=a.indexOf(l.value)!==-1}else l.checked=ie(n);o.push(l)}else if(l.type==="radio")l.checked=l.value===String(n),o.push(l);else if(l.type==="select-multiple"){if(Array.isArray(n))for(let a=0;a<l.options.length;a++)l.options[a].selected=n.indexOf(l.options[a].value)!==-1;o.push(l)}else l.value=n,l.tagName==="SELECT"&&n!=null&&l.setAttribute("data-ln-value",n),o.push(l)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=le,window.lnCore.serializeForm=oe,window.lnCore.resolveFormMethod=re);const B={};function ce(e,t){B[e]=t}function se(e){return B[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ce,window.lnCore.getDataMapper=se);function ae(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,S(function(){new MutationObserver(function(){$(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const M={};function ue(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];M[r]=t}function de(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return M[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ue,window.lnCore.getLocaleFallback=de,window.lnCore.ensureLocaleObserver=ae);const k={};function fe(e,t){k[e]||(k[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=k[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function j(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let l=0;l<r.length;l++){const s=r[l],n=s.getAttribute("data-ln-field");t[n]!=null&&(s.textContent=t[n])}const o=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<o.length;l++){const s=o[l],n=s.getAttribute("data-ln-attr").split(",");for(let a=0;a<n.length;a++){const d=n[a].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),f=d[1].trim();t[f]!=null&&s.setAttribute(u,t[f])}}const i=e.querySelectorAll("[data-ln-show]");for(let l=0;l<i.length;l++){const s=i[l],n=s.getAttribute("data-ln-show");n in t&&s.classList.toggle("hidden",!t[n])}const c=e.querySelectorAll("[data-ln-class]");for(let l=0;l<c.length;l++){const s=c[l],n=s.getAttribute("data-ln-class").split(",");for(let a=0;a<n.length;a++){const d=n[a].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),f=d[1].trim();f in t&&s.classList.toggle(u,!!t[f])}}return e}function we(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<r.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[o],t??null),r[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)j(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let r=0;r<t.length;r++)t[r].textContent=""}})));function U(e,t){if(!e||!t)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const c=r.currentNode;c.textContent.indexOf("{{")!==-1&&(c.textContent=c.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,s){return t[s]!==void 0?t[s]:""}))}const o=function(c,l){return t[l]!==void 0?t[l]:""},i=Array.from(e.querySelectorAll("*"));e.nodeType===1&&i.push(e);for(let c=0;c<i.length;c++){const l=i[c],s=l.attributes;for(let n=0;n<s.length;n++){const a=s[n];a.value.indexOf("{{")!==-1&&l.setAttribute(a.name,a.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function he(e,t,r,o,i,c){const l={};for(let n=0;n<e.children.length;n++){const a=e.children[n],d=a.getAttribute("data-ln-render-key");d&&(l[d]=a)}const s=document.createDocumentFragment();for(let n=0;n<t.length;n++){const a=t[n],d=String(o(a));let u=l[d];if(u)i(u,a,n);else{const f=fe(r,c);if(!f||(U(f,a),u=f.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",d),i(u,a,n)}s.appendChild(u)}e.textContent="",e.appendChild(s)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=U,window.lnCore.fill=j,window.lnCore.lnFill=we,window.lnCore.renderList=he);function E(e,t,r){const o=e.getAttribute(t);return o===null?r:o}function W(e,t,r){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?r:o}function V(e,t,r=!1){const o=e.getAttribute(t);if(o===null)return!!r;const i=o.trim().toLowerCase();return!(i==="false"||i==="0")}function H(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const q=new Map;function P(e,t){const r=(e?e.join("|"):"")+"::"+t;if(q.has(r))return q.get(r);const o=new Set(e||[]),i=function(c,l){const s=c.getAttribute(l);return s!==null&&o.has(s)?s:t};return q.set(r,i),i}function Q(e,t,r){const o=parseFloat(e.getAttribute(t));return isNaN(o)?r:o}function K(e,t,r){const o=e.getAttribute(t);if(!o)return r;try{return JSON.parse(o)}catch{return r}}function J(e,t,r,o,i){if(!e||t===null)return!0;const c=o||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const s=n=>{i?console.warn(n,i):console.warn(n)};if(l==="boolean"){const n=t.trim().toLowerCase();return n!==""&&n!=="true"&&n!=="false"&&n!=="1"&&n!=="0"?(s(`[${c}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const n=e.values||[];return n.includes(t)?!0:(s(`[${c}] Invalid value "${t}" for attribute "${r}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return s(`[${c}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(s(`[${c}] Value ${n} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(s(`[${c}] Value ${n} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(s(`[${c}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(n){return s(`[${c}] Invalid JSON for attribute "${r}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function be(e,t,r){for(const o in r){const[i,c,l]=r[o];Object.defineProperty(e,o,{get:function(){return i(t,c,l)},enumerable:!0,configurable:!0})}return e}function pe(e){const t={};for(const r in e){const o=e[r];if(!o||!o.prop)continue;let i=o.read;if(!i&&o.type)switch(o.type){case"enum":i=P(o.values,o.fallback);break;case"integer":i=W;break;case"float":i=Q;break;case"boolean":i=V;break;case"list":i=H;break;case"json":i=K;break;case"string":default:i=E;break}i||(i=E),t[o.prop]=[i,r,o.fallback]}return t}function ge(e){const t={};for(const r in e){const o=e[r];o&&o.effect&&(t[r]=o.effect)}return Object.keys(t).length?t:null}function ye(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const r in e.effects)t.add(r);if(e.onAttrChange&&e.declared)for(const r of e.declared)t.add(r);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=be,window.lnCore.attrSpec=pe,window.lnCore.attrStr=E,window.lnCore.attrInt=W,window.lnCore.attrBool=V,window.lnCore.attrList=H,window.lnCore.attrEnum=P,window.lnCore.attrFloat=Q,window.lnCore.attrJson=K);function v(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(r){console.error("["+t.attribute+"] init failed",e,r)}}}function G(e,t,r,o){if(e.nodeType!==1)return;const c=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:r,ComponentFn:o};if(e.matches&&e.matches(c)&&v(e,l),e.querySelectorAll){const s=e.querySelectorAll(c);for(let n=0;n<s.length;n++)v(s[n],l)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function me(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Ce(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function X(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function Ae(e){const t=X(),r=e.observed||[];for(let o=0;o<r.length;o++){const i=r[o];t.byAttr.has(i)||t.byAttr.set(i,[]),t.byAttr.get(i).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const i=t.byDeclaredAttr.get(o);i.some(c=>c.componentTag===e.componentTag)||i.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=ye(e);if(o===null)t.reactiveWildcard.push(e);else for(const i of o)t.byReactive.has(i)||t.byReactive.set(i,[]),t.byReactive.get(i).push(e)}e.persist&&t.persist.push(e)}function z(e,t,r,o){for(let i=0;i<e.length;i++){const c=e[i];if(!t[c.attribute])continue;const l=c.effects&&c.effects[r];l?l(t,r,o):c.onAttrChange&&(!c.declared||c.declared.has(r))&&c.onAttrChange(t,r,o)}}function Se(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,o=X(),i=o.byAttr.get(t),c=R()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(t);if(!r&&!i&&!c)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(c&&x(l)){const s=o.byDeclaredAttr.get(t),n=l.getAttribute(t);for(let a=0;a<s.length;a++)J(s[a].spec,n,t,s[a].componentTag,l)}if(window.lnCore._debugSink&&(r||i)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),r){const s=o.byReactive.get(t);s&&z(s,l,t,e.oldValue),o.reactiveWildcard.length&&z(o.reactiveWildcard,l,t,e.oldValue)}if(i)for(let s=0;s<i.length;s++){const n=i[s];if(n.handler){n.handler(l,t,e.oldValue);continue}n.onAttributeChange&&l[n.attribute]?n.onAttributeChange(l,t):(G(l,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(l))}}}function ve(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,S(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{Se(t[r])}catch(o){console.error("[ln-core] mutation handler failed",t[r].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function L(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function O(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function Y(e,t){if(!document.contains(e))if(t.attribute){const r=e[t.attribute];if(r&&typeof r.destroy=="function")try{r.destroy()}catch(o){console.error("["+t.attribute+"] destroy failed",e,o)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Z(e){const t=L();if(!t.length)return;const r=e.target;if(r){const i=r.nodeType===1?r:r.parentElement;if(i&&(i.isContentEditable||i.closest&&i.closest('[contenteditable]:not([contenteditable="false"])')))return}const o=O();if(e.target&&o.length)for(let i=0;i<o.length;i++){const c=o[i],l=c.query,s=e.target.nodeType===1?e.target.matches&&e.target.matches(l)?e.target:e.target.closest?e.target.closest(l):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(l):null;s&&c.onSubtreeChange(s,e)}for(let i=0;i<e.addedNodes.length;i++){const c=e.addedNodes[i];if(c.nodeType!==1)continue;const l=!!(c.firstElementChild||c.children&&c.children.length);for(let s=0;s<t.length;s++){const n=t[s],a=n.query;if(a&&(c.matches&&c.matches(a)&&(n.ComponentFn&&v(c,n),n.onInit&&n.onInit(c)),l&&c.querySelectorAll)){const d=c.querySelectorAll(a);for(let u=0;u<d.length;u++)n.ComponentFn&&v(d[u],n),n.onInit&&n.onInit(d[u])}}}for(let i=0;i<e.removedNodes.length;i++){const c=e.removedNodes[i];if(c.nodeType!==1||document.contains(c))continue;const l=!!(c.firstElementChild||c.children&&c.children.length);for(let s=0;s<t.length;s++){const n=t[s],a=n.query;if(a&&(c.matches&&c.matches(a)&&Y(c,n),l&&c.querySelectorAll)){const d=c.querySelectorAll(a);for(let u=0;u<d.length;u++)Y(d[u],n)}}}}function ee(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,S(function(){const e=new MutationObserver(function(t){for(let r=0;r<t.length;r++){const o=t[r];if(o.type==="childList")try{Z(o)}catch(i){console.error("[ln-core] lifecycle handler failed",o.target,i)}}});window.lnCore._lifecycleObserver=e,e.observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function _e(e){if(typeof window>"u")return e();window.lnCore=window.lnCore||{};const t=window.lnCore._lifecycleObserver;if(!t)return e();const r=t.takeRecords();for(let o=0;o<r.length;o++){const i=r[o];if(i.type==="childList")try{Z(i)}catch(c){console.error("[ln-core] lifecycle handler failed",i.target,c)}}t.disconnect();try{return e()}finally{t.observe(document.body,{childList:!0,subtree:!0})}}function xe(e){L().push(e),e.onSubtreeChange&&e.query&&O().push(e),ee()}function te(e,t,r,o,i={}){const c=i.extraAttributes||[],l=i.onAttributeChange||null,s=i.onSubtreeChange||null,n=i.onInit||null,a=i.onAttrChange||null,d=i.effects||null,u=i.attributes||null,f=u?ge(u):d,y=u?new Set(Object.keys(u)):null,b=i.persist||null;function w(T){const g=T||document.body;if(G(g,e,t,r),u&&R())for(const A in u){const He=u[A],D=Array.from(g.querySelectorAll("["+A+"]"));g.matches&&g.matches("["+A+"]")&&D.push(g);for(let F=0;F<D.length;F++){const N=D[F];x(N)&&J(He,N.getAttribute(A),A,o,N)}}n&&n(g)}const m=[];if(e.indexOf("[")!==-1){const T=/\[([\w-]+)/g;let g;for(;(g=T.exec(e))!==null;)m.push(g[1])}else m.push(e);Ae({selector:e,attribute:t,componentTag:o,attributes:u,ComponentFn:r,onInit:n,observed:m.concat(c),onAttributeChange:l,onAttrChange:a,effects:f,declared:y,persist:b}),ve();const C=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,h=i.subtreeQuery||(C?e:"["+e+"]"),p={selector:e,attribute:t,ComponentFn:r,onInit:n,onSubtreeChange:s,query:h};L().push(p),s&&h&&O().push(p),ee(),window[t]=w,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=te,window.lnCore.observeLifecycle=xe,window.lnCore.withoutLifecycle=_e);function _(){me()>0?Ce(function(){w(document.body)}):w(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",_):_(),w}function ne(e){return(e||"").replace(/^#/,"")}function I(e){const t=e===void 0?location.hash:e,r={},o=ne(t);if(!o)return r;const i=o.split("&");for(let c=0;c<i.length;c++){const l=i[c];if(!l)continue;const s=l.indexOf(":"),n=s>-1?l.slice(0,s):l,a=s>-1?l.slice(s+1):"";if(n)try{r[n]=decodeURIComponent(a)}catch{r[n]=a}}return r}function ke(e){if(!e)return null;const t=I();return e in t?t[e]:null}function Ee(e,t){if(!e)return;const r=I();t==null?delete r[e]:r[e]=String(t);const i=Object.keys(r).map(function(c){const l=r[c];return l===""?c:c+":"+encodeURIComponent(l)}).join("&");ne(location.hash)!==i&&(location.hash=i)}function qe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Le(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const r=e.getAttribute("data-ln-hash");if(r&&r.trim()!=="")return r.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function Oe(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ie(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function Te(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function De(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const r=e.slice(0,t),o=e.slice(t+1),i=o?o.split(",").map(function(c){try{return decodeURIComponent(c)}catch{return c}}).filter(Boolean):[];return{key:r,values:i}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=I,window.lnCore.hashGet=ke,window.lnCore.hashSet=Ee,window.lnCore.hashLinkClick=qe,window.lnCore.resolveHashNamespace=Le,window.lnCore.hashSortEncode=Oe,window.lnCore.hashSortDecode=Ie,window.lnCore.hashFilterEncode=Te,window.lnCore.hashFilterDecode=De);function Fe(e){return(e||"").replace(/^\?/,"")}function Ne(e){const t=e===void 0?typeof window<"u"?window.location.search:"":e,r={},o=Fe(t);if(!o)return r;const i=new URLSearchParams(o);for(const[c,l]of i.entries())r[c]=l;return r}function Re(e){if(!e||typeof window>"u")return null;const t=new URLSearchParams(window.location.search);return t.has(e)?t.get(e):null}function $e(e,t){if(!e||typeof window>"u")return;const r=new URL(window.location.href);if(t==null||t===""?r.searchParams.delete(e):r.searchParams.set(e,String(t)),r.search===window.location.search)return;const o=r.pathname+r.search+r.hash;window.history.replaceState(window.history.state,"",o)}function Be(e,t){if(!e||!e.hasAttribute("data-ln-query"))return null;const r=e.getAttribute("data-ln-query");if(r&&r.trim()!=="")return r.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"_"+t:o:t||null}function Me(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function je(e,t){if(e&&typeof e=="string"){if(e.endsWith(".asc"))return{fieldOrColumn:e.slice(0,-4),direction:"asc"};if(e.endsWith(".desc"))return{fieldOrColumn:e.slice(0,-5),direction:"desc"}}if(t&&typeof t=="object"){const r=t.sort_field||t.sort_by;if(r){const o=t.sort_dir&&String(t.sort_dir).toLowerCase()==="desc"?"desc":"asc";return{fieldOrColumn:r,direction:o}}}return null}function Ue(e){return!Array.isArray(e)||e.length===0?null:e.map(encodeURIComponent).join(",")}function We(e){return!e||typeof e!="string"?[]:e.split(",").map(function(t){try{return decodeURIComponent(t.trim())}catch{return t.trim()}}).filter(Boolean)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.queryParse=Ne,window.lnCore.queryGet=Re,window.lnCore.querySet=$e,window.lnCore.resolveQueryParam=Be,window.lnCore.querySortEncode=Me,window.lnCore.querySortDecode=je,window.lnCore.queryFilterEncode=Ue,window.lnCore.queryFilterDecode=We);function Ve(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=Ve),(function(){const e="data-ln-table-coordinator",t="lnTableCoordinator";if(window[t]!==void 0)return;const r={"data-ln-table-coordinator":{type:"marker",description:"Mounts table coordinator mediating between table, search, filter, and pagination"}};document.addEventListener("keydown",function(s){if(s.key!=="/"||s.defaultPrevented||document.activeElement&&(document.activeElement.tagName==="INPUT"||document.activeElement.tagName==="TEXTAREA"||document.activeElement.isContentEditable))return;const n=document.querySelector("["+e+"] [data-ln-search-for]")||document.querySelector("[data-ln-search-for]");if(!n)return;const a=n.tagName==="INPUT"||n.tagName==="TEXTAREA"?n:n.querySelector('input[type="search"], input[type="text"], input');a&&(s.preventDefault(),a.focus())});function o(s){return this.dom=s,l(this),this}function i(s,n){const a=n?'[data-ln-search-for="'+n+'"]':"[data-ln-search-for]",d=s.querySelector(a)||document.querySelector(a);return d?d.tagName==="INPUT"||d.tagName==="TEXTAREA"?d:d.querySelector("input, textarea"):null}function c(s,n){if(n){const d=s.querySelectorAll('[data-ln-filter="'+n+'"]');if(d.length>0)return d;const u=document.querySelectorAll('[data-ln-filter="'+n+'"]');if(u.length>0)return u}const a=s.querySelectorAll("[data-ln-filter]");return a.length>0?a:document.querySelectorAll("[data-ln-filter]")}function l(s){const n=s.dom;function a(d){const u=d.target;if(u&&u.hasAttribute&&(u.hasAttribute("data-ln-table")||u.tagName==="TABLE"))return u;const f=d.detail&&d.detail.targetId||u&&u.id;if(!f)return null;const y=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(f):f.replace(/(["\\])/g,"\\$1");return n.querySelector('[data-ln-table-source="'+y+'"]')||n.querySelector('[data-ln-table="'+y+'"]')||(n.id===f?n:null)||document.getElementById(f)}s._handlers={filter:function(d){if(!d.detail)return;const u=a(d);if(!u)return;const f=d.detail.key,y=d.detail.values||[],b=u.querySelectorAll("th");for(let w=0;w<b.length;w++)if((b[w].getAttribute("data-ln-table-filter-col")||b[w].getAttribute("data-ln-filter-col")||b[w].getAttribute("data-ln-filter-key")||b[w].getAttribute("data-ln-field"))===f){const C=b[w].querySelector("[data-ln-table-col-filter], .table-filter");C&&C.classList.toggle("ln-filter-active",y.length>0);break}},clear:function(d){const u=d.target.closest("[data-ln-table-clear], [data-ln-table-clear-all]");if(!u)return;const f=u.closest("[data-ln-table], table")||n.querySelector("[data-ln-table], table");if(!f)return;const y=f.lnTable&&f.lnTable.name||f.id,b=f.querySelectorAll("th");for(let h=0;h<b.length;h++){const p=b[h].querySelector("[data-ln-table-col-filter], .table-filter");p&&p.classList.remove("ln-filter-active")}const w=f.getAttribute("data-ln-table-source")||f.id,m=w?document.getElementById(w):null;if(m&&m.hasAttribute("data-ln-search"))m.setAttribute("data-ln-search","");else{const h=i(n,w);h&&h.value!==""&&(h.value="",h.dispatchEvent(new Event("input",{bubbles:!0})))}const C=c(n,w);for(let h=0;h<C.length;h++){const p=C[h].querySelector("[data-ln-filter-reset]");if(!p)continue;const _=C[h].querySelectorAll("input:not([data-ln-filter-reset]):checked").length>0;(!p.checked||_)&&(p.checked=!0,p.dispatchEvent(new Event("change",{bubbles:!0})))}f.lnTable&&!f.hasAttribute("data-ln-table-source")&&$(f,"ln-table:request-clear-filters",{table:y})}},n.addEventListener("ln-filter:change",s._handlers.filter),n.addEventListener("click",s._handlers.clear)}o.prototype.destroy=function(){this.dom[t]&&(this._handlers&&(this.dom.removeEventListener("ln-filter:change",this._handlers.filter),this.dom.removeEventListener("click",this._handlers.clear),this._handlers=null),delete this.dom[t])},te(e,t,o,"ln-table-coordinator",{attributes:r})})()})();
|
|
1
|
+
(function(){"use strict";function $(){if(typeof window>"u")return!1;if(window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink)return!0;if(typeof document<"u"){if(document.documentElement&&document.documentElement.hasAttribute("data-ln-debug"))return!0;if(document.body)return document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null}return!1}function x(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let i=1;i<t.length;i++)if(t[i]&&t[i].nodeType===1){o=t[i];break}if(!x(o))return}e.apply(console,t)}}function B(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function v(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){v(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function oe(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ie(e,t){const n=!!(t&&t.typed),o=t&&t.exclude,i={},s=e.elements,l={};if(n)for(let a=0;a<s.length;a++){const r=s[a];r.name&&r.type==="checkbox"&&!r.disabled&&(l[r.name]=(l[r.name]||0)+1)}for(let a=0;a<s.length;a++){const r=s[a];if(!(!r.name||r.disabled||r.type==="file"||r.type==="submit"||r.type==="button")&&!(o&&r.matches&&r.matches(o)))if(r.type==="checkbox")n&&l[r.name]===1?i[r.name]=r.checked:(i[r.name]||(i[r.name]=[]),r.checked&&i[r.name].push(r.value));else if(r.type==="radio")r.checked&&(i[r.name]=r.value);else if(r.type==="select-multiple"){i[r.name]=[];for(let u=0;u<r.options.length;u++)r.options[u].selected&&i[r.name].push(r.options[u].value)}else if(n&&r.type==="hidden")i[r.name]=r.value;else if(n&&(r.type==="number"||r.type==="range")){const u=Number(r.value);i[r.name]=r.value===""||isNaN(u)?null:u}else i[r.name]=r.value}return i}function le(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function se(e,t){const n=e.elements,o=[],i={};for(let s=0;s<n.length;s++){const l=n[s];l.name&&l.type==="checkbox"&&(i[l.name]=(i[l.name]||0)+1)}for(let s=0;s<n.length;s++){const l=n[s];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const a=l.getAttribute("data-ln-fill-as")||l.name;if(!a||!(a in t))continue;const r=t[a];if(l.type==="checkbox"){if(Array.isArray(r))l.checked=r.indexOf(l.value)!==-1;else if(i[l.name]>1){const u=String(r).split(",").map(function(h){return h.trim()});l.checked=u.indexOf(l.value)!==-1}else l.checked=le(r);o.push(l)}else if(l.type==="radio")l.checked=l.value===String(r),o.push(l);else if(l.type==="select-multiple"){if(Array.isArray(r))for(let u=0;u<l.options.length;u++)l.options[u].selected=r.indexOf(l.options[u].value)!==-1;o.push(l)}else l.value=r,l.tagName==="SELECT"&&r!=null&&l.setAttribute("data-ln-value",r),o.push(l)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=se,window.lnCore.serializeForm=ie,window.lnCore.resolveFormMethod=oe);const M={};function ae(e,t){M[e]=t}function ce(e){return M[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ae,window.lnCore.getDataMapper=ce);function ue(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,v(function(){new MutationObserver(function(){B(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const j={};function de(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];j[n]=t}function fe(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return j[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=de,window.lnCore.getLocaleFallback=fe,window.lnCore.ensureLocaleObserver=ue);const k={};function we(e,t){k[e]||(k[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=k[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function U(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let l=0;l<n.length;l++){const a=n[l],r=a.getAttribute("data-ln-field");t[r]!=null&&(a.textContent=t[r])}const o=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<o.length;l++){const a=o[l],r=a.getAttribute("data-ln-attr").split(",");for(let u=0;u<r.length;u++){const h=r[u].trim().split(":");if(h.length!==2)continue;const c=h[0].trim(),d=h[1].trim();t[d]!=null&&a.setAttribute(c,t[d])}}const i=e.querySelectorAll("[data-ln-show]");for(let l=0;l<i.length;l++){const a=i[l],r=a.getAttribute("data-ln-show");r in t&&a.classList.toggle("hidden",!t[r])}const s=e.querySelectorAll("[data-ln-class]");for(let l=0;l<s.length;l++){const a=s[l],r=a.getAttribute("data-ln-class").split(",");for(let u=0;u<r.length;u++){const h=r[u].trim().split(":");if(h.length!==2)continue;const c=h[0].trim(),d=h[1].trim();d in t&&a.classList.toggle(c,!!t[d])}}return e}function he(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<n.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[o],t??null),n[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)U(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function W(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const s=n.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,a){return t[a]!==void 0?t[a]:""}))}const o=function(s,l){return t[l]!==void 0?t[l]:""},i=Array.from(e.querySelectorAll("*"));e.nodeType===1&&i.push(e);for(let s=0;s<i.length;s++){const l=i[s],a=l.attributes;for(let r=0;r<a.length;r++){const u=a[r];u.value.indexOf("{{")!==-1&&l.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function be(e,t,n,o,i,s){const l={};for(let r=0;r<e.children.length;r++){const u=e.children[r],h=u.getAttribute("data-ln-render-key");h&&(l[h]=u)}const a=document.createDocumentFragment();for(let r=0;r<t.length;r++){const u=t[r],h=String(o(u));let c=l[h];if(c)i(c,u,r);else{const d=we(n,s);if(!d||(W(d,u),c=d.firstElementChild,!c))continue;c.setAttribute("data-ln-render-key",h),i(c,u,r)}a.appendChild(c)}e.textContent="",e.appendChild(a)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=W,window.lnCore.fill=U,window.lnCore.lnFill=he,window.lnCore.renderList=be);function q(e,t,n){const o=e.getAttribute(t);return o===null?n:o}function V(e,t,n){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?n:o}function H(e,t,n=!1){const o=e.getAttribute(t);if(o===null)return!!n;const i=o.trim().toLowerCase();return!(i==="false"||i==="0")}function P(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const L=new Map;function Q(e,t){const n=(e?e.join("|"):"")+"::"+t;if(L.has(n))return L.get(n);const o=new Set(e||[]),i=function(s,l){const a=s.getAttribute(l);return a!==null&&o.has(a)?a:t};return L.set(n,i),i}function K(e,t,n){const o=parseFloat(e.getAttribute(t));return isNaN(o)?n:o}function J(e,t,n){const o=e.getAttribute(t);if(!o)return n;try{return JSON.parse(o)}catch{return n}}function G(e,t,n,o,i){if(!e||t===null)return!0;const s=o||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const a=r=>{i?console.warn(r,i):console.warn(r)};if(l==="boolean"){const r=t.trim().toLowerCase();return r!==""&&r!=="true"&&r!=="false"&&r!=="1"&&r!=="0"?(a(`[${s}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const r=e.values||[];return r.includes(t)?!0:(a(`[${s}] Invalid value "${t}" for attribute "${n}". Allowed: ${r.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return a(`[${s}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const r=parseInt(t,10);return e.min!==void 0&&r<e.min?(a(`[${s}] Value ${r} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&r>e.max?(a(`[${s}] Value ${r} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(a(`[${s}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(r){return a(`[${s}] Invalid JSON for attribute "${n}": ${r.message}. Fallback: ${e.fallback}.`),!1}return!0}function pe(e,t,n){for(const o in n){const[i,s,l]=n[o];Object.defineProperty(e,o,{get:function(){return i(t,s,l)},enumerable:!0,configurable:!0})}return e}function me(e){const t={};for(const n in e){const o=e[n];if(!o||!o.prop)continue;let i=o.read;if(!i&&o.type)switch(o.type){case"enum":i=Q(o.values,o.fallback);break;case"integer":i=V;break;case"float":i=K;break;case"boolean":i=H;break;case"list":i=P;break;case"json":i=J;break;case"string":default:i=q;break}i||(i=q),t[o.prop]=[i,n,o.fallback]}return t}function ye(e){const t={};for(const n in e){const o=e[n];o&&o.effect&&(t[n]=o.effect)}return Object.keys(t).length?t:null}function ge(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=pe,window.lnCore.attrSpec=me,window.lnCore.attrStr=q,window.lnCore.attrInt=V,window.lnCore.attrBool=H,window.lnCore.attrList=P,window.lnCore.attrEnum=Q,window.lnCore.attrFloat=K,window.lnCore.attrJson=J);function E(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(n){console.error("["+t.attribute+"] init failed",e,n)}}}function X(e,t,n,o){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:n,ComponentFn:o};if(e.matches&&e.matches(s)&&E(e,l),e.querySelectorAll){const a=e.querySelectorAll(s);for(let r=0;r<a.length;r++)E(a[r],l)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Ce(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Ae(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function z(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function Se(e){const t=z(),n=e.observed||[];for(let o=0;o<n.length;o++){const i=n[o];t.byAttr.has(i)||t.byAttr.set(i,[]),t.byAttr.get(i).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const i=t.byDeclaredAttr.get(o);i.some(s=>s.componentTag===e.componentTag)||i.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=ge(e);if(o===null)t.reactiveWildcard.push(e);else for(const i of o)t.byReactive.has(i)||t.byReactive.set(i,[]),t.byReactive.get(i).push(e)}e.persist&&t.persist.push(e)}function Y(e,t,n,o){for(let i=0;i<e.length;i++){const s=e[i];if(!t[s.attribute])continue;const l=s.effects&&s.effects[n];l?l(t,n,o):s.onAttrChange&&(!s.declared||s.declared.has(n))&&s.onAttrChange(t,n,o)}}function _e(e){const t=e.attributeName,n=t.indexOf("data-ln-")===0,o=z(),i=o.byAttr.get(t),s=$()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(t);if(!n&&!i&&!s)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(s&&x(l)){const a=o.byDeclaredAttr.get(t),r=l.getAttribute(t);for(let u=0;u<a.length;u++)G(a[u].spec,r,t,a[u].componentTag,l)}if(window.lnCore._debugSink&&(n||i)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),n){const a=o.byReactive.get(t);a&&Y(a,l,t,e.oldValue),o.reactiveWildcard.length&&Y(o.reactiveWildcard,l,t,e.oldValue)}if(i)for(let a=0;a<i.length;a++){const r=i[a];if(r.handler){r.handler(l,t,e.oldValue);continue}r.onAttributeChange&&l[r.attribute]?r.onAttributeChange(l,t):(X(l,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(l))}}}function ve(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,v(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{_e(t[n])}catch(o){console.error("[ln-core] mutation handler failed",t[n].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function O(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function T(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function Z(e,t){if(!document.contains(e))if(t.attribute){const n=e[t.attribute];if(n&&typeof n.destroy=="function")try{n.destroy()}catch(o){console.error("["+t.attribute+"] destroy failed",e,o)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ee(e){const t=O();if(!t.length)return;const n=e.target;if(n){const i=n.nodeType===1?n:n.parentElement;if(i&&(i.isContentEditable||i.closest&&i.closest('[contenteditable]:not([contenteditable="false"])')))return}const o=T();if(e.target&&o.length)for(let i=0;i<o.length;i++){const s=o[i],l=s.query,a=e.target.nodeType===1?e.target.matches&&e.target.matches(l)?e.target:e.target.closest?e.target.closest(l):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(l):null;a&&s.onSubtreeChange(a,e)}for(let i=0;i<e.addedNodes.length;i++){const s=e.addedNodes[i];if(s.nodeType!==1)continue;const l=!!(s.firstElementChild||s.children&&s.children.length);for(let a=0;a<t.length;a++){const r=t[a],u=r.query;if(u&&(s.matches&&s.matches(u)&&(r.ComponentFn&&E(s,r),r.onInit&&r.onInit(s)),l&&s.querySelectorAll)){const h=s.querySelectorAll(u);for(let c=0;c<h.length;c++)r.ComponentFn&&E(h[c],r),r.onInit&&r.onInit(h[c])}}}for(let i=0;i<e.removedNodes.length;i++){const s=e.removedNodes[i];if(s.nodeType!==1||document.contains(s))continue;const l=!!(s.firstElementChild||s.children&&s.children.length);for(let a=0;a<t.length;a++){const r=t[a],u=r.query;if(u&&(s.matches&&s.matches(u)&&Z(s,r),l&&s.querySelectorAll)){const h=s.querySelectorAll(u);for(let c=0;c<h.length;c++)Z(h[c],r)}}}}function te(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,v(function(){const e=new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{ee(o)}catch(i){console.error("[ln-core] lifecycle handler failed",o.target,i)}}});window.lnCore._lifecycleObserver=e,e.observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ee(e){if(typeof window>"u")return e();window.lnCore=window.lnCore||{};const t=window.lnCore._lifecycleObserver;if(!t)return e();const n=t.takeRecords();for(let o=0;o<n.length;o++){const i=n[o];if(i.type==="childList")try{ee(i)}catch(s){console.error("[ln-core] lifecycle handler failed",i.target,s)}}t.disconnect();try{return e()}finally{t.observe(document.body,{childList:!0,subtree:!0})}}function xe(e){O().push(e),e.onSubtreeChange&&e.query&&T().push(e),te()}function ne(e,t,n,o,i={}){const s=i.extraAttributes||[],l=i.onAttributeChange||null,a=i.onSubtreeChange||null,r=i.onInit||null,u=i.onAttrChange||null,h=i.effects||null,c=i.attributes||null,d=c?ye(c):h,y=c?new Set(Object.keys(c)):null,f=i.persist||null;function w(A){const p=A||document.body;if(X(p,e,t,n),c&&$())for(const C in c){const D=c[C],F=Array.from(p.querySelectorAll("["+C+"]"));p.matches&&p.matches("["+C+"]")&&F.push(p);for(let N=0;N<F.length;N++){const R=F[N];x(R)&&G(D,R.getAttribute(C),C,o,R)}}r&&r(p)}const b=[];if(e.indexOf("[")!==-1){const A=/\[([\w-]+)/g;let p;for(;(p=A.exec(e))!==null;)b.push(p[1])}else b.push(e);Se({selector:e,attribute:t,componentTag:o,attributes:c,ComponentFn:n,onInit:r,observed:b.concat(s),onAttributeChange:l,onAttrChange:u,effects:d,declared:y,persist:f}),ve();const S=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,g=i.subtreeQuery||(S?e:"["+e+"]"),m={selector:e,attribute:t,ComponentFn:n,onInit:r,onSubtreeChange:a,query:g};O().push(m),a&&g&&T().push(m),te(),window[t]=w,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=ne,window.lnCore.observeLifecycle=xe,window.lnCore.withoutLifecycle=Ee);function _(){Ce()>0?Ae(function(){w(document.body)}):w(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",_):_(),w}function re(e){return(e||"").replace(/^#/,"")}function I(e){const t=e===void 0?location.hash:e,n={},o=re(t);if(!o)return n;const i=o.split("&");for(let s=0;s<i.length;s++){const l=i[s];if(!l)continue;const a=l.indexOf(":"),r=a>-1?l.slice(0,a):l,u=a>-1?l.slice(a+1):"";if(r)try{n[r]=decodeURIComponent(u)}catch{n[r]=u}}return n}function ke(e){if(!e)return null;const t=I();return e in t?t[e]:null}function qe(e,t){if(!e)return;const n=I();t==null?delete n[e]:n[e]=String(t);const i=Object.keys(n).map(function(s){const l=n[s];return l===""?s:s+":"+encodeURIComponent(l)}).join("&");re(location.hash)!==i&&(location.hash=i)}function Le(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Oe(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function Te(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ie(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function De(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Fe(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),o=e.slice(t+1),i=o?o.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:n,values:i}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=I,window.lnCore.hashGet=ke,window.lnCore.hashSet=qe,window.lnCore.hashLinkClick=Le,window.lnCore.resolveHashNamespace=Oe,window.lnCore.hashSortEncode=Te,window.lnCore.hashSortDecode=Ie,window.lnCore.hashFilterEncode=De,window.lnCore.hashFilterDecode=Fe);function Ne(e){return(e||"").replace(/^\?/,"")}function Re(e){const t=e===void 0?typeof window<"u"?window.location.search:"":e,n={},o=Ne(t);if(!o)return n;const i=new URLSearchParams(o);for(const[s,l]of i.entries())n[s]=l;return n}function $e(e){if(!e||typeof window>"u")return null;const t=new URLSearchParams(window.location.search);return t.has(e)?t.get(e):null}function Be(e,t){if(!e||typeof window>"u")return;const n=new URL(window.location.href);if(t==null||t===""?n.searchParams.delete(e):n.searchParams.set(e,String(t)),n.search===window.location.search)return;const o=n.pathname+n.search+n.hash;window.history.replaceState(window.history.state,"",o)}function Me(e,t){if(!e||!e.hasAttribute("data-ln-query"))return null;const n=e.getAttribute("data-ln-query");if(n&&n.trim()!=="")return n.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"_"+t:o:t||null}function je(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ue(e,t){if(e&&typeof e=="string"){if(e.endsWith(".asc"))return{fieldOrColumn:e.slice(0,-4),direction:"asc"};if(e.endsWith(".desc"))return{fieldOrColumn:e.slice(0,-5),direction:"desc"}}if(t&&typeof t=="object"){const n=t.sort_field||t.sort_by;if(n){const o=t.sort_dir&&String(t.sort_dir).toLowerCase()==="desc"?"desc":"asc";return{fieldOrColumn:n,direction:o}}}return null}function We(e){return!Array.isArray(e)||e.length===0?null:e.map(encodeURIComponent).join(",")}function Ve(e){return!e||typeof e!="string"?[]:e.split(",").map(function(t){try{return decodeURIComponent(t.trim())}catch{return t.trim()}}).filter(Boolean)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.queryParse=Re,window.lnCore.queryGet=$e,window.lnCore.querySet=Be,window.lnCore.resolveQueryParam=Me,window.lnCore.querySortEncode=je,window.lnCore.querySortDecode=Ue,window.lnCore.queryFilterEncode=We,window.lnCore.queryFilterDecode=Ve);function He(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=He),(function(){const e="data-ln-table-coordinator",t="lnTableCoordinator";if(window[t]!==void 0)return;const n={"data-ln-table-coordinator":{type:"marker",description:"Mounts table coordinator mediating between table, search, filter, and pagination"}};document.addEventListener("keydown",function(c){if(c.key!=="/"||c.defaultPrevented||document.activeElement&&(document.activeElement.tagName==="INPUT"||document.activeElement.tagName==="TEXTAREA"||document.activeElement.isContentEditable))return;const d=document.querySelector("["+e+"] [data-ln-search-for]")||document.querySelector("[data-ln-search-for]");if(!d)return;const y=d.tagName==="INPUT"||d.tagName==="TEXTAREA"?d:d.querySelector('input[type="search"], input[type="text"], input');y&&(c.preventDefault(),y.focus())});function o(c){return!(c.hasAttribute("data-ln-search-hide")||c.hasAttribute("data-ln-filter-hide")||c.hidden||c.classList&&c.classList.contains("hidden")||c.style&&c.style.display==="none")}function i(c){if(c._emptyEl)return c._emptyEl;const d=c.dom.querySelector("template[data-ln-table-empty]");if(!d)return null;const y=d.content.firstElementChild;if(!y)return null;const f=document.importNode(y,!0);f.setAttribute("data-ln-table-empty",""),f.classList.add("hidden"),f.hidden=!0;const w=c.dom.querySelector("table");return w?((w.closest(".table-container")||w).insertAdjacentElement("afterend",f),c._emptyEl=f,f):null}function s(c){const d=c.dom.querySelector("table");if(!d||d.hasAttribute("data-ln-table")||d.parentElement&&d.parentElement.hasAttribute("data-ln-table")||!c.dom.querySelector("template[data-ln-table-empty]"))return;const f=i(c);if(!f)return;const w=d.querySelectorAll("tbody tr");let b=!1;for(let g=0;g<w.length;g++){const m=w[g];if(!m.hasAttribute("data-ln-table-empty")&&o(m)){b=!0;break}}w.length>0&&!b?(f.classList.remove("hidden"),f.hidden=!1):(f.classList.add("hidden"),f.hidden=!0)}function l(c){const d=c.dom.querySelector("table");if(!d||d.hasAttribute("data-ln-table")||d.parentElement&&d.parentElement.hasAttribute("data-ln-table")||!c.dom.querySelector("template[data-ln-table-empty]"))return;const f=d.querySelector("tbody")||d,w=new MutationObserver(function(){s(c)});w.observe(f,{attributes:!0,attributeFilter:["data-ln-search-hide","data-ln-filter-hide","hidden","class","style"],subtree:!0,childList:!0}),c._emptyObserver=w,s(c)}function a(c){return this.dom=c,this._emptyEl=null,this._emptyObserver=null,h(this),l(this),this}function r(c,d){const y=d?'[data-ln-search-for="'+d+'"]':"[data-ln-search-for]",f=c.querySelector(y)||document.querySelector(y);return f?f.tagName==="INPUT"||f.tagName==="TEXTAREA"?f:f.querySelector("input, textarea"):null}function u(c,d){if(d){const f=c.querySelectorAll('[data-ln-filter="'+d+'"]');if(f.length>0)return f;const w=document.querySelectorAll('[data-ln-filter="'+d+'"]');if(w.length>0)return w}const y=c.querySelectorAll("[data-ln-filter]");return y.length>0?y:document.querySelectorAll("[data-ln-filter]")}function h(c){const d=c.dom;function y(f){const w=f.target;if(w&&w.hasAttribute&&(w.hasAttribute("data-ln-table")||w.tagName==="TABLE"))return w;const b=f.detail&&f.detail.targetId||w&&w.id;if(!b)return null;const S=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(b):b.replace(/(["\\])/g,"\\$1");return d.querySelector('[data-ln-table-source="'+S+'"]')||d.querySelector('[data-ln-table="'+S+'"]')||(d.id===b?d:null)||document.getElementById(b)}c._handlers={filter:function(f){if(!f.detail)return;const w=y(f);if(!w)return;const b=f.detail.key,S=f.detail.values||[],g=w.querySelectorAll("th");for(let m=0;m<g.length;m++)if((g[m].getAttribute("data-ln-table-filter-col")||g[m].getAttribute("data-ln-filter-col")||g[m].getAttribute("data-ln-filter-key")||g[m].getAttribute("data-ln-field"))===b){const A=g[m].querySelector("[data-ln-table-col-filter]");A&&A.classList.toggle("ln-filter-active",S.length>0);break}s(c)},clear:function(f){const w=f.target.closest("[data-ln-table-clear], [data-ln-table-clear-all]");if(!w)return;const b=w.closest("[data-ln-table], table")||d.querySelector("[data-ln-table], table");if(!b)return;const S=b.lnTable&&b.lnTable.name||b.id,g=b.querySelectorAll("th");for(let p=0;p<g.length;p++){const C=g[p].querySelector("[data-ln-table-col-filter]");C&&C.classList.remove("ln-filter-active")}const m=b.getAttribute("data-ln-table-source")||b.id,_=m?document.getElementById(m):null;if(_&&_.hasAttribute("data-ln-search"))_.setAttribute("data-ln-search","");else{const p=r(d,m);p&&p.value!==""&&(p.value="",p.dispatchEvent(new Event("input",{bubbles:!0})))}const A=u(d,m);for(let p=0;p<A.length;p++){const C=A[p].querySelector("[data-ln-filter-reset]");if(!C)continue;const D=A[p].querySelectorAll("input:not([data-ln-filter-reset]):checked").length>0;(!C.checked||D)&&(C.checked=!0,C.dispatchEvent(new Event("change",{bubbles:!0})))}b.lnTable&&!b.hasAttribute("data-ln-table-source")&&B(b,"ln-table:request-clear-filters",{table:S}),s(c)}},d.addEventListener("ln-filter:change",c._handlers.filter),d.addEventListener("click",c._handlers.clear)}a.prototype.destroy=function(){this.dom[t]&&(this._emptyObserver&&(this._emptyObserver.disconnect(),this._emptyObserver=null),this._emptyEl&&(this._emptyEl.parentNode&&this._emptyEl.remove(),this._emptyEl=null),this._handlers&&(this.dom.removeEventListener("ln-filter:change",this._handlers.filter),this.dom.removeEventListener("click",this._handlers.clear),this._handlers=null),delete this.dom[t])},ne(e,t,a,"ln-table-coordinator",{attributes:n})})()})();
|
|
@@ -21,6 +21,12 @@
|
|
|
21
21
|
"src/ln-table-coordinator.js"
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
|
+
"data-ln-filter-hide": {
|
|
25
|
+
"direction": "author",
|
|
26
|
+
"sources": [
|
|
27
|
+
"src/ln-table-coordinator.js"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
24
30
|
"data-ln-filter-key": {
|
|
25
31
|
"direction": "author",
|
|
26
32
|
"sources": [
|
|
@@ -45,6 +51,12 @@
|
|
|
45
51
|
"src/ln-table-coordinator.js"
|
|
46
52
|
]
|
|
47
53
|
},
|
|
54
|
+
"data-ln-search-hide": {
|
|
55
|
+
"direction": "author",
|
|
56
|
+
"sources": [
|
|
57
|
+
"src/ln-table-coordinator.js"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
48
60
|
"data-ln-table": {
|
|
49
61
|
"direction": "author",
|
|
50
62
|
"sources": [
|
|
@@ -77,6 +89,12 @@
|
|
|
77
89
|
"type": "marker",
|
|
78
90
|
"description": "Mounts table coordinator mediating between table, search, filter, and pagination"
|
|
79
91
|
},
|
|
92
|
+
"data-ln-table-empty": {
|
|
93
|
+
"direction": "both",
|
|
94
|
+
"sources": [
|
|
95
|
+
"src/ln-table-coordinator.js"
|
|
96
|
+
]
|
|
97
|
+
},
|
|
80
98
|
"data-ln-table-filter-col": {
|
|
81
99
|
"direction": "author",
|
|
82
100
|
"sources": [
|
|
@@ -39,11 +39,99 @@ import { registerComponent, dispatch } from '../../ln-core';
|
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
+
// ─── Empty State Mediation (Plain SSR Tables) ───────────
|
|
43
|
+
|
|
44
|
+
function _isRowVisible(tr) {
|
|
45
|
+
if (tr.hasAttribute('data-ln-search-hide') || tr.hasAttribute('data-ln-filter-hide')) return false;
|
|
46
|
+
if (tr.hidden || (tr.classList && tr.classList.contains('hidden'))) return false;
|
|
47
|
+
if (tr.style && tr.style.display === 'none') return false;
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function _ensureEmptyElement(self) {
|
|
52
|
+
if (self._emptyEl) return self._emptyEl;
|
|
53
|
+
const template = self.dom.querySelector('template[data-ln-table-empty]');
|
|
54
|
+
if (!template) return null;
|
|
55
|
+
const subEl = template.content.firstElementChild;
|
|
56
|
+
if (!subEl) return null;
|
|
57
|
+
|
|
58
|
+
const clone = document.importNode(subEl, true);
|
|
59
|
+
clone.setAttribute('data-ln-table-empty', '');
|
|
60
|
+
clone.classList.add('hidden');
|
|
61
|
+
clone.hidden = true;
|
|
62
|
+
|
|
63
|
+
const table = self.dom.querySelector('table');
|
|
64
|
+
if (!table) return null;
|
|
65
|
+
const mountTarget = table.closest('.table-container') || table;
|
|
66
|
+
mountTarget.insertAdjacentElement('afterend', clone);
|
|
67
|
+
self._emptyEl = clone;
|
|
68
|
+
return clone;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function _syncEmptyState(self) {
|
|
72
|
+
const table = self.dom.querySelector('table');
|
|
73
|
+
if (!table) return;
|
|
74
|
+
if (table.hasAttribute('data-ln-table') || (table.parentElement && table.parentElement.hasAttribute('data-ln-table'))) return;
|
|
75
|
+
|
|
76
|
+
const template = self.dom.querySelector('template[data-ln-table-empty]');
|
|
77
|
+
if (!template) return;
|
|
78
|
+
|
|
79
|
+
const emptyEl = _ensureEmptyElement(self);
|
|
80
|
+
if (!emptyEl) return;
|
|
81
|
+
|
|
82
|
+
const rows = table.querySelectorAll('tbody tr');
|
|
83
|
+
let hasVisible = false;
|
|
84
|
+
for (let i = 0; i < rows.length; i++) {
|
|
85
|
+
const tr = rows[i];
|
|
86
|
+
if (tr.hasAttribute('data-ln-table-empty')) continue;
|
|
87
|
+
if (_isRowVisible(tr)) {
|
|
88
|
+
hasVisible = true;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const shouldShow = rows.length > 0 && !hasVisible;
|
|
94
|
+
if (shouldShow) {
|
|
95
|
+
emptyEl.classList.remove('hidden');
|
|
96
|
+
emptyEl.hidden = false;
|
|
97
|
+
} else {
|
|
98
|
+
emptyEl.classList.add('hidden');
|
|
99
|
+
emptyEl.hidden = true;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function _setupEmptyState(self) {
|
|
104
|
+
const table = self.dom.querySelector('table');
|
|
105
|
+
if (!table) return;
|
|
106
|
+
if (table.hasAttribute('data-ln-table') || (table.parentElement && table.parentElement.hasAttribute('data-ln-table'))) return;
|
|
107
|
+
|
|
108
|
+
const template = self.dom.querySelector('template[data-ln-table-empty]');
|
|
109
|
+
if (!template) return;
|
|
110
|
+
|
|
111
|
+
const tbody = table.querySelector('tbody') || table;
|
|
112
|
+
const observer = new MutationObserver(function () {
|
|
113
|
+
_syncEmptyState(self);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
observer.observe(tbody, {
|
|
117
|
+
attributes: true,
|
|
118
|
+
attributeFilter: ['data-ln-search-hide', 'data-ln-filter-hide', 'hidden', 'class', 'style'],
|
|
119
|
+
subtree: true,
|
|
120
|
+
childList: true
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
self._emptyObserver = observer;
|
|
124
|
+
_syncEmptyState(self);
|
|
125
|
+
}
|
|
126
|
+
|
|
42
127
|
// ─── Component Constructor ─────────────────────────────
|
|
43
128
|
|
|
44
129
|
function _component(dom) {
|
|
45
130
|
this.dom = dom;
|
|
131
|
+
this._emptyEl = null;
|
|
132
|
+
this._emptyObserver = null;
|
|
46
133
|
_bindEvents(this);
|
|
134
|
+
_setupEmptyState(this);
|
|
47
135
|
return this;
|
|
48
136
|
}
|
|
49
137
|
|
|
@@ -110,11 +198,13 @@ import { registerComponent, dispatch } from '../../ln-core';
|
|
|
110
198
|
ths[i].getAttribute('data-ln-filter-key') ||
|
|
111
199
|
ths[i].getAttribute('data-ln-field');
|
|
112
200
|
if (colKey === key) {
|
|
113
|
-
const btn = ths[i].querySelector('[data-ln-table-col-filter]
|
|
201
|
+
const btn = ths[i].querySelector('[data-ln-table-col-filter]');
|
|
114
202
|
if (btn) btn.classList.toggle('ln-filter-active', values.length > 0);
|
|
115
203
|
break;
|
|
116
204
|
}
|
|
117
205
|
}
|
|
206
|
+
|
|
207
|
+
_syncEmptyState(self);
|
|
118
208
|
},
|
|
119
209
|
|
|
120
210
|
// Clear-all has no ID binding of its own — resolve structurally,
|
|
@@ -130,7 +220,7 @@ import { registerComponent, dispatch } from '../../ln-core';
|
|
|
130
220
|
|
|
131
221
|
const ths = table.querySelectorAll('th');
|
|
132
222
|
for (let i = 0; i < ths.length; i++) {
|
|
133
|
-
const filterBtn = ths[i].querySelector('[data-ln-table-col-filter]
|
|
223
|
+
const filterBtn = ths[i].querySelector('[data-ln-table-col-filter]');
|
|
134
224
|
if (filterBtn) filterBtn.classList.remove('ln-filter-active');
|
|
135
225
|
}
|
|
136
226
|
|
|
@@ -166,6 +256,8 @@ import { registerComponent, dispatch } from '../../ln-core';
|
|
|
166
256
|
if (table.lnTable && !table.hasAttribute('data-ln-table-source')) {
|
|
167
257
|
dispatch(table, 'ln-table:request-clear-filters', { table: name });
|
|
168
258
|
}
|
|
259
|
+
|
|
260
|
+
_syncEmptyState(self);
|
|
169
261
|
}
|
|
170
262
|
};
|
|
171
263
|
|
|
@@ -178,6 +270,16 @@ import { registerComponent, dispatch } from '../../ln-core';
|
|
|
178
270
|
_component.prototype.destroy = function () {
|
|
179
271
|
if (!this.dom[DOM_ATTRIBUTE]) return;
|
|
180
272
|
|
|
273
|
+
if (this._emptyObserver) {
|
|
274
|
+
this._emptyObserver.disconnect();
|
|
275
|
+
this._emptyObserver = null;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (this._emptyEl) {
|
|
279
|
+
if (this._emptyEl.parentNode) this._emptyEl.remove();
|
|
280
|
+
this._emptyEl = null;
|
|
281
|
+
}
|
|
282
|
+
|
|
181
283
|
if (this._handlers) {
|
|
182
284
|
this.dom.removeEventListener('ln-filter:change', this._handlers.filter);
|
|
183
285
|
this.dom.removeEventListener('click', this._handlers.clear);
|
|
@@ -144,7 +144,7 @@ root `<li>` carries `data-ln-toast-item` (eviction, clear, and hydration
|
|
|
144
144
|
address items by it; the JS stamps it defensively if omitted) plus
|
|
145
145
|
`data-ln-attr="class:type"` and NO static class (fill
|
|
146
146
|
sets the class via setAttribute, which would clobber an authored one);
|
|
147
|
-
`data-ln-field="title"` / `data-ln-field="message"` for text; a
|
|
147
|
+
`data-ln-field="title"` / `data-ln-field="message"` for text (the message element is addressed by `data-ln-field="message"`; array and error-map messages render as a list inside it); a
|
|
148
148
|
`data-ln-toast-when="{type}"` icon list if you want per-type icons. A missing
|
|
149
149
|
template fails loudly — `console.warn('[ln-toast] Template "ln-toast-item"
|
|
150
150
|
not found')` at clone time, no silent fallback.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function M(){if(typeof window>"u")return!1;if(window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink)return!0;if(typeof document<"u"){if(document.documentElement&&document.documentElement.hasAttribute("data-ln-debug"))return!0;if(document.body)return document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null}return!1}function x(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let r=null;for(let i=1;i<t.length;i++)if(t[i]&&t[i].nodeType===1){r=t[i];break}if(!x(r))return}e.apply(console,t)}}function ie(e,t,n){const r=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,r),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:r}))}function A(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){A(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function le(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function se(e,t){const n=!!(t&&t.typed),r=t&&t.exclude,i={},s=e.elements,l={};if(n)for(let c=0;c<s.length;c++){const o=s[c];o.name&&o.type==="checkbox"&&!o.disabled&&(l[o.name]=(l[o.name]||0)+1)}for(let c=0;c<s.length;c++){const o=s[c];if(!(!o.name||o.disabled||o.type==="file"||o.type==="submit"||o.type==="button")&&!(r&&o.matches&&o.matches(r)))if(o.type==="checkbox")n&&l[o.name]===1?i[o.name]=o.checked:(i[o.name]||(i[o.name]=[]),o.checked&&i[o.name].push(o.value));else if(o.type==="radio")o.checked&&(i[o.name]=o.value);else if(o.type==="select-multiple"){i[o.name]=[];for(let u=0;u<o.options.length;u++)o.options[u].selected&&i[o.name].push(o.options[u].value)}else if(n&&o.type==="hidden")i[o.name]=o.value;else if(n&&(o.type==="number"||o.type==="range")){const u=Number(o.value);i[o.name]=o.value===""||isNaN(u)?null:u}else i[o.name]=o.value}return i}function ce(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ae(e,t){const n=e.elements,r=[],i={};for(let s=0;s<n.length;s++){const l=n[s];l.name&&l.type==="checkbox"&&(i[l.name]=(i[l.name]||0)+1)}for(let s=0;s<n.length;s++){const l=n[s];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const c=l.getAttribute("data-ln-fill-as")||l.name;if(!c||!(c in t))continue;const o=t[c];if(l.type==="checkbox"){if(Array.isArray(o))l.checked=o.indexOf(l.value)!==-1;else if(i[l.name]>1){const u=String(o).split(",").map(function(h){return h.trim()});l.checked=u.indexOf(l.value)!==-1}else l.checked=ce(o);r.push(l)}else if(l.type==="radio")l.checked=l.value===String(o),r.push(l);else if(l.type==="select-multiple"){if(Array.isArray(o))for(let u=0;u<l.options.length;u++)l.options[u].selected=o.indexOf(l.options[u].value)!==-1;r.push(l)}else l.value=o,l.tagName==="SELECT"&&o!=null&&l.setAttribute("data-ln-value",o),r.push(l)}return r}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ae,window.lnCore.serializeForm=se,window.lnCore.resolveFormMethod=le);const B={};function ue(e,t){B[e]=t}function de(e){return B[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ue,window.lnCore.getDataMapper=de);function fe(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,A(function(){new MutationObserver(function(){ie(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const j={};function we(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];j[n]=t}function he(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return j[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=we,window.lnCore.getLocaleFallback=he,window.lnCore.ensureLocaleObserver=fe);const k={};function U(e,t){k[e]||(k[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=k[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function pe(e,t,n){if(e){const r=e.querySelector('[data-ln-template="'+t+'"]');if(r)return r.content.cloneNode(!0)}return U(t,n)}function E(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let l=0;l<n.length;l++){const c=n[l],o=c.getAttribute("data-ln-field");t[o]!=null&&(c.textContent=t[o])}const r=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<r.length;l++){const c=r[l],o=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<o.length;u++){const h=o[u].trim().split(":");if(h.length!==2)continue;const f=h[0].trim(),b=h[1].trim();t[b]!=null&&c.setAttribute(f,t[b])}}const i=e.querySelectorAll("[data-ln-show]");for(let l=0;l<i.length;l++){const c=i[l],o=c.getAttribute("data-ln-show");o in t&&c.classList.toggle("hidden",!t[o])}const s=e.querySelectorAll("[data-ln-class]");for(let l=0;l<s.length;l++){const c=s[l],o=c.getAttribute("data-ln-class").split(",");for(let u=0;u<o.length;u++){const h=o[u].trim().split(":");if(h.length!==2)continue;const f=h[0].trim(),b=h[1].trim();b in t&&c.classList.toggle(f,!!t[b])}}return e}function me(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let r=0;r<n.length;r++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[r],t??null),n[r].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)E(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function W(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const s=n.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,c){return t[c]!==void 0?t[c]:""}))}const r=function(s,l){return t[l]!==void 0?t[l]:""},i=Array.from(e.querySelectorAll("*"));e.nodeType===1&&i.push(e);for(let s=0;s<i.length;s++){const l=i[s],c=l.attributes;for(let o=0;o<c.length;o++){const u=c[o];u.value.indexOf("{{")!==-1&&l.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function be(e,t,n,r,i,s){const l={};for(let o=0;o<e.children.length;o++){const u=e.children[o],h=u.getAttribute("data-ln-render-key");h&&(l[h]=u)}const c=document.createDocumentFragment();for(let o=0;o<t.length;o++){const u=t[o],h=String(r(u));let f=l[h];if(f)i(f,u,o);else{const b=U(n,s);if(!b||(W(b,u),f=b.firstElementChild,!f))continue;f.setAttribute("data-ln-render-key",h),i(f,u,o)}c.appendChild(f)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=W,window.lnCore.fill=E,window.lnCore.lnFill=me,window.lnCore.renderList=be);function L(e,t,n){const r=e.getAttribute(t);return r===null?n:r}function v(e,t,n){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?n:r}function H(e,t,n=!1){const r=e.getAttribute(t);if(r===null)return!!n;const i=r.trim().toLowerCase();return!(i==="false"||i==="0")}function P(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const q=new Map;function V(e,t){const n=(e?e.join("|"):"")+"::"+t;if(q.has(n))return q.get(n);const r=new Set(e||[]),i=function(s,l){const c=s.getAttribute(l);return c!==null&&r.has(c)?c:t};return q.set(n,i),i}function Q(e,t,n){const r=parseFloat(e.getAttribute(t));return isNaN(r)?n:r}function J(e,t,n){const r=e.getAttribute(t);if(!r)return n;try{return JSON.parse(r)}catch{return n}}function K(e,t,n,r,i){if(!e||t===null)return!0;const s=r||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const c=o=>{i?console.warn(o,i):console.warn(o)};if(l==="boolean"){const o=t.trim().toLowerCase();return o!==""&&o!=="true"&&o!=="false"&&o!=="1"&&o!=="0"?(c(`[${s}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const o=e.values||[];return o.includes(t)?!0:(c(`[${s}] Invalid value "${t}" for attribute "${n}". Allowed: ${o.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return c(`[${s}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const o=parseInt(t,10);return e.min!==void 0&&o<e.min?(c(`[${s}] Value ${o} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&o>e.max?(c(`[${s}] Value ${o} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(c(`[${s}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(o){return c(`[${s}] Invalid JSON for attribute "${n}": ${o.message}. Fallback: ${e.fallback}.`),!1}return!0}function G(e,t,n){for(const r in n){const[i,s,l]=n[r];Object.defineProperty(e,r,{get:function(){return i(t,s,l)},enumerable:!0,configurable:!0})}return e}function z(e){const t={};for(const n in e){const r=e[n];if(!r||!r.prop)continue;let i=r.read;if(!i&&r.type)switch(r.type){case"enum":i=V(r.values,r.fallback);break;case"integer":i=v;break;case"float":i=Q;break;case"boolean":i=H;break;case"list":i=P;break;case"json":i=J;break;case"string":default:i=L;break}i||(i=L),t[r.prop]=[i,n,r.fallback]}return t}function ye(e){const t={};for(const n in e){const r=e[n];r&&r.effect&&(t[n]=r.effect)}return Object.keys(t).length?t:null}function ge(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=G,window.lnCore.attrSpec=z,window.lnCore.attrStr=L,window.lnCore.attrInt=v,window.lnCore.attrBool=H,window.lnCore.attrList=P,window.lnCore.attrEnum=V,window.lnCore.attrFloat=Q,window.lnCore.attrJson=J);function S(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(n){console.error("["+t.attribute+"] init failed",e,n)}}}function X(e,t,n,r){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:n,ComponentFn:r};if(e.matches&&e.matches(s)&&S(e,l),e.querySelectorAll){const c=e.querySelectorAll(s);for(let o=0;o<c.length;o++)S(c[o],l)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Ce(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Ae(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function Y(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function _e(e){const t=Y(),n=e.observed||[];for(let r=0;r<n.length;r++){const i=n[r];t.byAttr.has(i)||t.byAttr.set(i,[]),t.byAttr.get(i).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const r in e.attributes){t.byDeclaredAttr.has(r)||t.byDeclaredAttr.set(r,[]);const i=t.byDeclaredAttr.get(r);i.some(s=>s.componentTag===e.componentTag)||i.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=ge(e);if(r===null)t.reactiveWildcard.push(e);else for(const i of r)t.byReactive.has(i)||t.byReactive.set(i,[]),t.byReactive.get(i).push(e)}e.persist&&t.persist.push(e)}function Z(e,t,n,r){for(let i=0;i<e.length;i++){const s=e[i];if(!t[s.attribute])continue;const l=s.effects&&s.effects[n];l?l(t,n,r):s.onAttrChange&&(!s.declared||s.declared.has(n))&&s.onAttrChange(t,n,r)}}function ve(e){const t=e.attributeName,n=t.indexOf("data-ln-")===0,r=Y(),i=r.byAttr.get(t),s=M()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(t);if(!n&&!i&&!s)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(s&&x(l)){const c=r.byDeclaredAttr.get(t),o=l.getAttribute(t);for(let u=0;u<c.length;u++)K(c[u].spec,o,t,c[u].componentTag,l)}if(window.lnCore._debugSink&&(n||i)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),n){const c=r.byReactive.get(t);c&&Z(c,l,t,e.oldValue),r.reactiveWildcard.length&&Z(r.reactiveWildcard,l,t,e.oldValue)}if(i)for(let c=0;c<i.length;c++){const o=i[c];if(o.handler){o.handler(l,t,e.oldValue);continue}o.onAttributeChange&&l[o.attribute]?o.onAttributeChange(l,t):(X(l,o.selector,o.attribute,o.ComponentFn),o.onInit&&o.onInit(l))}}}function Se(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,A(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{ve(t[n])}catch(r){console.error("[ln-core] mutation handler failed",t[n].target,r)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function O(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function T(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function ee(e,t){if(!document.contains(e))if(t.attribute){const n=e[t.attribute];if(n&&typeof n.destroy=="function")try{n.destroy()}catch(r){console.error("["+t.attribute+"] destroy failed",e,r)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function te(e){const t=O();if(!t.length)return;const n=e.target;if(n){const i=n.nodeType===1?n:n.parentElement;if(i&&(i.isContentEditable||i.closest&&i.closest('[contenteditable]:not([contenteditable="false"])')))return}const r=T();if(e.target&&r.length)for(let i=0;i<r.length;i++){const s=r[i],l=s.query,c=e.target.nodeType===1?e.target.matches&&e.target.matches(l)?e.target:e.target.closest?e.target.closest(l):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(l):null;c&&s.onSubtreeChange(c,e)}for(let i=0;i<e.addedNodes.length;i++){const s=e.addedNodes[i];if(s.nodeType!==1)continue;const l=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const o=t[c],u=o.query;if(u&&(s.matches&&s.matches(u)&&(o.ComponentFn&&S(s,o),o.onInit&&o.onInit(s)),l&&s.querySelectorAll)){const h=s.querySelectorAll(u);for(let f=0;f<h.length;f++)o.ComponentFn&&S(h[f],o),o.onInit&&o.onInit(h[f])}}}for(let i=0;i<e.removedNodes.length;i++){const s=e.removedNodes[i];if(s.nodeType!==1||document.contains(s))continue;const l=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const o=t[c],u=o.query;if(u&&(s.matches&&s.matches(u)&&ee(s,o),l&&s.querySelectorAll)){const h=s.querySelectorAll(u);for(let f=0;f<h.length;f++)ee(h[f],o)}}}}function ne(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,A(function(){const e=new MutationObserver(function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.type==="childList")try{te(r)}catch(i){console.error("[ln-core] lifecycle handler failed",r.target,i)}}});window.lnCore._lifecycleObserver=e,e.observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function xe(e){if(typeof window>"u")return e();window.lnCore=window.lnCore||{};const t=window.lnCore._lifecycleObserver;if(!t)return e();const n=t.takeRecords();for(let r=0;r<n.length;r++){const i=n[r];if(i.type==="childList")try{te(i)}catch(s){console.error("[ln-core] lifecycle handler failed",i.target,s)}}t.disconnect();try{return e()}finally{t.observe(document.body,{childList:!0,subtree:!0})}}function ke(e){O().push(e),e.onSubtreeChange&&e.query&&T().push(e),ne()}function oe(e,t,n,r,i={}){const s=i.extraAttributes||[],l=i.onAttributeChange||null,c=i.onSubtreeChange||null,o=i.onInit||null,u=i.onAttrChange||null,h=i.effects||null,f=i.attributes||null,b=f?ye(f):h,I=f?new Set(Object.keys(f)):null,F=i.persist||null;function g(C){const y=C||document.body;if(X(y,e,t,n),f&&M())for(const _ in f){const Ve=f[_],N=Array.from(y.querySelectorAll("["+_+"]"));y.matches&&y.matches("["+_+"]")&&N.push(y);for(let R=0;R<N.length;R++){const $=N[R];x($)&&K(Ve,$.getAttribute(_),_,r,$)}}o&&o(y)}const a=[];if(e.indexOf("[")!==-1){const C=/\[([\w-]+)/g;let y;for(;(y=C.exec(e))!==null;)a.push(y[1])}else a.push(e);_e({selector:e,attribute:t,componentTag:r,attributes:f,ComponentFn:n,onInit:o,observed:a.concat(s),onAttributeChange:l,onAttrChange:u,effects:b,declared:I,persist:F}),Se();const d=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,w=i.subtreeQuery||(d?e:"["+e+"]"),p={selector:e,attribute:t,ComponentFn:n,onInit:o,onSubtreeChange:c,query:w};O().push(p),c&&w&&T().push(p),ne(),window[t]=g,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=oe,window.lnCore.observeLifecycle=ke,window.lnCore.withoutLifecycle=xe);function m(){Ce()>0?Ae(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",m):m(),g}function re(e){return(e||"").replace(/^#/,"")}function D(e){const t=e===void 0?location.hash:e,n={},r=re(t);if(!r)return n;const i=r.split("&");for(let s=0;s<i.length;s++){const l=i[s];if(!l)continue;const c=l.indexOf(":"),o=c>-1?l.slice(0,c):l,u=c>-1?l.slice(c+1):"";if(o)try{n[o]=decodeURIComponent(u)}catch{n[o]=u}}return n}function Ee(e){if(!e)return null;const t=D();return e in t?t[e]:null}function Le(e,t){if(!e)return;const n=D();t==null?delete n[e]:n[e]=String(t);const i=Object.keys(n).map(function(s){const l=n[s];return l===""?s:s+":"+encodeURIComponent(l)}).join("&");re(location.hash)!==i&&(location.hash=i)}function qe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Oe(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const r=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return r?t?r+"-"+t:r:t||null}function Te(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function De(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function Ie(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Fe(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),r=e.slice(t+1),i=r?r.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:n,values:i}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=D,window.lnCore.hashGet=Ee,window.lnCore.hashSet=Le,window.lnCore.hashLinkClick=qe,window.lnCore.resolveHashNamespace=Oe,window.lnCore.hashSortEncode=Te,window.lnCore.hashSortDecode=De,window.lnCore.hashFilterEncode=Ie,window.lnCore.hashFilterDecode=Fe);function Ne(e){return(e||"").replace(/^\?/,"")}function Re(e){const t=e===void 0?typeof window<"u"?window.location.search:"":e,n={},r=Ne(t);if(!r)return n;const i=new URLSearchParams(r);for(const[s,l]of i.entries())n[s]=l;return n}function $e(e){if(!e||typeof window>"u")return null;const t=new URLSearchParams(window.location.search);return t.has(e)?t.get(e):null}function Me(e,t){if(!e||typeof window>"u")return;const n=new URL(window.location.href);if(t==null||t===""?n.searchParams.delete(e):n.searchParams.set(e,String(t)),n.search===window.location.search)return;const r=n.pathname+n.search+n.hash;window.history.replaceState(window.history.state,"",r)}function Be(e,t){if(!e||!e.hasAttribute("data-ln-query"))return null;const n=e.getAttribute("data-ln-query");if(n&&n.trim()!=="")return n.trim();const r=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return r?t?r+"_"+t:r:t||null}function je(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ue(e,t){if(e&&typeof e=="string"){if(e.endsWith(".asc"))return{fieldOrColumn:e.slice(0,-4),direction:"asc"};if(e.endsWith(".desc"))return{fieldOrColumn:e.slice(0,-5),direction:"desc"}}if(t&&typeof t=="object"){const n=t.sort_field||t.sort_by;if(n){const r=t.sort_dir&&String(t.sort_dir).toLowerCase()==="desc"?"desc":"asc";return{fieldOrColumn:n,direction:r}}}return null}function We(e){return!Array.isArray(e)||e.length===0?null:e.map(encodeURIComponent).join(",")}function He(e){return!e||typeof e!="string"?[]:e.split(",").map(function(t){try{return decodeURIComponent(t.trim())}catch{return t.trim()}}).filter(Boolean)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.queryParse=Re,window.lnCore.queryGet=$e,window.lnCore.querySet=Me,window.lnCore.resolveQueryParam=Be,window.lnCore.querySortEncode=je,window.lnCore.querySortDecode=Ue,window.lnCore.queryFilterEncode=We,window.lnCore.queryFilterDecode=He);function Pe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=Pe),(function(){const e="data-ln-toast",t="lnToast",n="ln-toast-item";if(window[t]!==void 0)return;const r={"data-ln-toast":{type:"marker",description:"Initializes the toast notifications container"},"data-ln-toast-timeout":{prop:"timeoutDefault",type:"integer",read:v,fallback:6e3,min:500,description:"Default auto-dismiss timeout in ms"},"data-ln-toast-max":{prop:"max",type:"integer",read:v,fallback:5,min:1,description:"Maximum visible concurrent toast notifications"},"data-ln-toast-close":{type:"trigger",description:"Click dismiss trigger inside a toast item"},"data-ln-toast-item":{type:"marker",description:"Individual toast notification element"}},i=z(r);function s(a){if(!(!a||!(a instanceof HTMLElement))&&(a.hasAttribute("popover")||a.setAttribute("popover","manual"),typeof a.showPopover=="function")){if(a.matches(":popover-open"))try{a.hidePopover()}catch{}try{a.showPopover()}catch{}}}function l(a){if(!a||!(a instanceof HTMLElement))return;if(a.querySelectorAll("[data-ln-toast-item]").length===0&&typeof a.hidePopover=="function"&&a.matches(":popover-open"))try{a.hidePopover()}catch{}}function c(a){this.dom=a,G(this,a,i);const d=Array.from(a.querySelectorAll("[data-ln-toast-item]"));for(;d.length>this.max;)a.removeChild(d.shift());for(const w of d)I(w,this);return d.length>0&&s(a),this}c.prototype.enqueue=function(a){if(!a)return;const d=o(a,this.dom);if(!d)return;const w=Number.isFinite(a.timeout)?a.timeout:this.timeoutDefault;h(this,d),w>0&&(d._timer=setTimeout(()=>f(d),w))},c.prototype.clear=function(){for(const a of Array.from(this.dom.querySelectorAll("[data-ln-toast-item]")))f(a)},c.prototype.destroy=function(){if(this.dom[t]){for(const a of Array.from(this.dom.querySelectorAll("[data-ln-toast-item]")))f(a);l(this.dom),delete this.dom[t]}};function o(a,d){const w=((a.type||"")+"").trim().toLowerCase(),p=pe(d,n,"ln-toast");if(!p)return console.warn('[ln-toast] Template "'+n+'" not found'),null;E(p,{type:w,title:a.title,message:typeof a.message=="string"?a.message:void 0});const m=p.firstElementChild;if(!m)return null;m.hasAttribute("data-ln-toast-item")||m.setAttribute("data-ln-toast-item",""),m.classList.add("ln-enter");const C=m.querySelector(".body");C&&u(C,a);const y=m.querySelector("[data-ln-toast-close]");return y&&y.addEventListener("click",function(){f(m)}),m}function u(a,d){if(Array.isArray(d.message)){const w=document.createElement("ul");for(const p of d.message){const m=document.createElement("li");m.textContent=p,w.appendChild(m)}a.appendChild(w)}if(d.data&&d.data.errors){const w=document.createElement("ul");for(const p of Object.values(d.data.errors).flat()){const m=document.createElement("li");m.textContent=p,w.appendChild(m)}a.appendChild(w)}}function h(a,d){const w=Array.from(a.dom.querySelectorAll("[data-ln-toast-item]"));for(;w.length>=a.max&&w.length>0;)a.dom.removeChild(w.shift());a.dom.appendChild(d),s(a.dom),requestAnimationFrame(()=>d.classList.remove("ln-enter"))}function f(a){if(!a||!a.parentNode)return;const d=a.parentNode;clearTimeout(a._timer),a.classList.remove("ln-enter"),a.classList.add("ln-out"),setTimeout(()=>{a.parentNode&&(a.parentNode.removeChild(a),l(d))},200)}function b(a){let d=a&&a.container;return typeof d=="string"&&(d=document.querySelector(d)),d instanceof HTMLElement||(d=document.querySelector("["+e+"]")||document.getElementById("ln-toast-container")),d||null}function I(a,d){if(a._lnToastHydrated)return;a._lnToastHydrated=!0;const w=a.querySelector("[data-ln-toast-close]");w&&w.addEventListener("click",function(){f(a)});const p=+(a.getAttribute("data-ln-toast-timeout")??d.timeoutDefault);p>0&&(a._timer=setTimeout(function(){f(a)},p))}function F(a){const d=a.detail||{},w=b(d);if(!w){console.warn("[ln-toast] No toast container found");return}(w[t]||(w[t]=new c(w))).enqueue(d)}function g(a){const d=a&&a.detail||{};if(d.container){const w=b(d);w&&(w[t]||(w[t]=new c(w))).clear()}else{const w=document.querySelectorAll("["+e+"]");for(const p of Array.from(w))(p[t]||(p[t]=new c(p))).clear()}}A(function(){window.addEventListener("ln-toast:enqueue",F),window.addEventListener("ln-toast:clear",g),window.addEventListener("ln-modal:open",function(){const a=document.querySelectorAll("["+e+"], #ln-toast-container");for(const d of Array.from(a))d.querySelectorAll("[data-ln-toast-item]").length>0&&s(d)})},"ln-toast"),oe(e,t,c,"ln-toast",{attributes:r})})()})();
|
|
1
|
+
(function(){"use strict";function M(){if(typeof window>"u")return!1;if(window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink)return!0;if(typeof document<"u"){if(document.documentElement&&document.documentElement.hasAttribute("data-ln-debug"))return!0;if(document.body)return document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null}return!1}function x(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let r=null;for(let i=1;i<t.length;i++)if(t[i]&&t[i].nodeType===1){r=t[i];break}if(!x(r))return}e.apply(console,t)}}function ie(e,t,n){const r=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,r),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:r}))}function A(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){A(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function le(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function se(e,t){const n=!!(t&&t.typed),r=t&&t.exclude,i={},s=e.elements,l={};if(n)for(let c=0;c<s.length;c++){const o=s[c];o.name&&o.type==="checkbox"&&!o.disabled&&(l[o.name]=(l[o.name]||0)+1)}for(let c=0;c<s.length;c++){const o=s[c];if(!(!o.name||o.disabled||o.type==="file"||o.type==="submit"||o.type==="button")&&!(r&&o.matches&&o.matches(r)))if(o.type==="checkbox")n&&l[o.name]===1?i[o.name]=o.checked:(i[o.name]||(i[o.name]=[]),o.checked&&i[o.name].push(o.value));else if(o.type==="radio")o.checked&&(i[o.name]=o.value);else if(o.type==="select-multiple"){i[o.name]=[];for(let u=0;u<o.options.length;u++)o.options[u].selected&&i[o.name].push(o.options[u].value)}else if(n&&o.type==="hidden")i[o.name]=o.value;else if(n&&(o.type==="number"||o.type==="range")){const u=Number(o.value);i[o.name]=o.value===""||isNaN(u)?null:u}else i[o.name]=o.value}return i}function ce(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ae(e,t){const n=e.elements,r=[],i={};for(let s=0;s<n.length;s++){const l=n[s];l.name&&l.type==="checkbox"&&(i[l.name]=(i[l.name]||0)+1)}for(let s=0;s<n.length;s++){const l=n[s];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const c=l.getAttribute("data-ln-fill-as")||l.name;if(!c||!(c in t))continue;const o=t[c];if(l.type==="checkbox"){if(Array.isArray(o))l.checked=o.indexOf(l.value)!==-1;else if(i[l.name]>1){const u=String(o).split(",").map(function(h){return h.trim()});l.checked=u.indexOf(l.value)!==-1}else l.checked=ce(o);r.push(l)}else if(l.type==="radio")l.checked=l.value===String(o),r.push(l);else if(l.type==="select-multiple"){if(Array.isArray(o))for(let u=0;u<l.options.length;u++)l.options[u].selected=o.indexOf(l.options[u].value)!==-1;r.push(l)}else l.value=o,l.tagName==="SELECT"&&o!=null&&l.setAttribute("data-ln-value",o),r.push(l)}return r}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ae,window.lnCore.serializeForm=se,window.lnCore.resolveFormMethod=le);const B={};function ue(e,t){B[e]=t}function de(e){return B[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ue,window.lnCore.getDataMapper=de);function fe(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,A(function(){new MutationObserver(function(){ie(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const j={};function we(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];j[n]=t}function he(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return j[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=we,window.lnCore.getLocaleFallback=he,window.lnCore.ensureLocaleObserver=fe);const k={};function U(e,t){k[e]||(k[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=k[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function pe(e,t,n){if(e){const r=e.querySelector('[data-ln-template="'+t+'"]');if(r)return r.content.cloneNode(!0)}return U(t,n)}function E(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let l=0;l<n.length;l++){const c=n[l],o=c.getAttribute("data-ln-field");t[o]!=null&&(c.textContent=t[o])}const r=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<r.length;l++){const c=r[l],o=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<o.length;u++){const h=o[u].trim().split(":");if(h.length!==2)continue;const f=h[0].trim(),b=h[1].trim();t[b]!=null&&c.setAttribute(f,t[b])}}const i=e.querySelectorAll("[data-ln-show]");for(let l=0;l<i.length;l++){const c=i[l],o=c.getAttribute("data-ln-show");o in t&&c.classList.toggle("hidden",!t[o])}const s=e.querySelectorAll("[data-ln-class]");for(let l=0;l<s.length;l++){const c=s[l],o=c.getAttribute("data-ln-class").split(",");for(let u=0;u<o.length;u++){const h=o[u].trim().split(":");if(h.length!==2)continue;const f=h[0].trim(),b=h[1].trim();b in t&&c.classList.toggle(f,!!t[b])}}return e}function me(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let r=0;r<n.length;r++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[r],t??null),n[r].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)E(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function W(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const s=n.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,c){return t[c]!==void 0?t[c]:""}))}const r=function(s,l){return t[l]!==void 0?t[l]:""},i=Array.from(e.querySelectorAll("*"));e.nodeType===1&&i.push(e);for(let s=0;s<i.length;s++){const l=i[s],c=l.attributes;for(let o=0;o<c.length;o++){const u=c[o];u.value.indexOf("{{")!==-1&&l.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function be(e,t,n,r,i,s){const l={};for(let o=0;o<e.children.length;o++){const u=e.children[o],h=u.getAttribute("data-ln-render-key");h&&(l[h]=u)}const c=document.createDocumentFragment();for(let o=0;o<t.length;o++){const u=t[o],h=String(r(u));let f=l[h];if(f)i(f,u,o);else{const b=U(n,s);if(!b||(W(b,u),f=b.firstElementChild,!f))continue;f.setAttribute("data-ln-render-key",h),i(f,u,o)}c.appendChild(f)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=W,window.lnCore.fill=E,window.lnCore.lnFill=me,window.lnCore.renderList=be);function L(e,t,n){const r=e.getAttribute(t);return r===null?n:r}function v(e,t,n){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?n:r}function H(e,t,n=!1){const r=e.getAttribute(t);if(r===null)return!!n;const i=r.trim().toLowerCase();return!(i==="false"||i==="0")}function P(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const q=new Map;function V(e,t){const n=(e?e.join("|"):"")+"::"+t;if(q.has(n))return q.get(n);const r=new Set(e||[]),i=function(s,l){const c=s.getAttribute(l);return c!==null&&r.has(c)?c:t};return q.set(n,i),i}function Q(e,t,n){const r=parseFloat(e.getAttribute(t));return isNaN(r)?n:r}function J(e,t,n){const r=e.getAttribute(t);if(!r)return n;try{return JSON.parse(r)}catch{return n}}function K(e,t,n,r,i){if(!e||t===null)return!0;const s=r||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const c=o=>{i?console.warn(o,i):console.warn(o)};if(l==="boolean"){const o=t.trim().toLowerCase();return o!==""&&o!=="true"&&o!=="false"&&o!=="1"&&o!=="0"?(c(`[${s}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const o=e.values||[];return o.includes(t)?!0:(c(`[${s}] Invalid value "${t}" for attribute "${n}". Allowed: ${o.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return c(`[${s}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const o=parseInt(t,10);return e.min!==void 0&&o<e.min?(c(`[${s}] Value ${o} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&o>e.max?(c(`[${s}] Value ${o} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(c(`[${s}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(o){return c(`[${s}] Invalid JSON for attribute "${n}": ${o.message}. Fallback: ${e.fallback}.`),!1}return!0}function G(e,t,n){for(const r in n){const[i,s,l]=n[r];Object.defineProperty(e,r,{get:function(){return i(t,s,l)},enumerable:!0,configurable:!0})}return e}function z(e){const t={};for(const n in e){const r=e[n];if(!r||!r.prop)continue;let i=r.read;if(!i&&r.type)switch(r.type){case"enum":i=V(r.values,r.fallback);break;case"integer":i=v;break;case"float":i=Q;break;case"boolean":i=H;break;case"list":i=P;break;case"json":i=J;break;case"string":default:i=L;break}i||(i=L),t[r.prop]=[i,n,r.fallback]}return t}function ge(e){const t={};for(const n in e){const r=e[n];r&&r.effect&&(t[n]=r.effect)}return Object.keys(t).length?t:null}function ye(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=G,window.lnCore.attrSpec=z,window.lnCore.attrStr=L,window.lnCore.attrInt=v,window.lnCore.attrBool=H,window.lnCore.attrList=P,window.lnCore.attrEnum=V,window.lnCore.attrFloat=Q,window.lnCore.attrJson=J);function S(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(n){console.error("["+t.attribute+"] init failed",e,n)}}}function X(e,t,n,r){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:n,ComponentFn:r};if(e.matches&&e.matches(s)&&S(e,l),e.querySelectorAll){const c=e.querySelectorAll(s);for(let o=0;o<c.length;o++)S(c[o],l)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Ce(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Ae(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function Y(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function _e(e){const t=Y(),n=e.observed||[];for(let r=0;r<n.length;r++){const i=n[r];t.byAttr.has(i)||t.byAttr.set(i,[]),t.byAttr.get(i).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const r in e.attributes){t.byDeclaredAttr.has(r)||t.byDeclaredAttr.set(r,[]);const i=t.byDeclaredAttr.get(r);i.some(s=>s.componentTag===e.componentTag)||i.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=ye(e);if(r===null)t.reactiveWildcard.push(e);else for(const i of r)t.byReactive.has(i)||t.byReactive.set(i,[]),t.byReactive.get(i).push(e)}e.persist&&t.persist.push(e)}function Z(e,t,n,r){for(let i=0;i<e.length;i++){const s=e[i];if(!t[s.attribute])continue;const l=s.effects&&s.effects[n];l?l(t,n,r):s.onAttrChange&&(!s.declared||s.declared.has(n))&&s.onAttrChange(t,n,r)}}function ve(e){const t=e.attributeName,n=t.indexOf("data-ln-")===0,r=Y(),i=r.byAttr.get(t),s=M()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(t);if(!n&&!i&&!s)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(s&&x(l)){const c=r.byDeclaredAttr.get(t),o=l.getAttribute(t);for(let u=0;u<c.length;u++)K(c[u].spec,o,t,c[u].componentTag,l)}if(window.lnCore._debugSink&&(n||i)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),n){const c=r.byReactive.get(t);c&&Z(c,l,t,e.oldValue),r.reactiveWildcard.length&&Z(r.reactiveWildcard,l,t,e.oldValue)}if(i)for(let c=0;c<i.length;c++){const o=i[c];if(o.handler){o.handler(l,t,e.oldValue);continue}o.onAttributeChange&&l[o.attribute]?o.onAttributeChange(l,t):(X(l,o.selector,o.attribute,o.ComponentFn),o.onInit&&o.onInit(l))}}}function Se(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,A(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{ve(t[n])}catch(r){console.error("[ln-core] mutation handler failed",t[n].target,r)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function O(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function T(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function ee(e,t){if(!document.contains(e))if(t.attribute){const n=e[t.attribute];if(n&&typeof n.destroy=="function")try{n.destroy()}catch(r){console.error("["+t.attribute+"] destroy failed",e,r)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function te(e){const t=O();if(!t.length)return;const n=e.target;if(n){const i=n.nodeType===1?n:n.parentElement;if(i&&(i.isContentEditable||i.closest&&i.closest('[contenteditable]:not([contenteditable="false"])')))return}const r=T();if(e.target&&r.length)for(let i=0;i<r.length;i++){const s=r[i],l=s.query,c=e.target.nodeType===1?e.target.matches&&e.target.matches(l)?e.target:e.target.closest?e.target.closest(l):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(l):null;c&&s.onSubtreeChange(c,e)}for(let i=0;i<e.addedNodes.length;i++){const s=e.addedNodes[i];if(s.nodeType!==1)continue;const l=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const o=t[c],u=o.query;if(u&&(s.matches&&s.matches(u)&&(o.ComponentFn&&S(s,o),o.onInit&&o.onInit(s)),l&&s.querySelectorAll)){const h=s.querySelectorAll(u);for(let f=0;f<h.length;f++)o.ComponentFn&&S(h[f],o),o.onInit&&o.onInit(h[f])}}}for(let i=0;i<e.removedNodes.length;i++){const s=e.removedNodes[i];if(s.nodeType!==1||document.contains(s))continue;const l=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const o=t[c],u=o.query;if(u&&(s.matches&&s.matches(u)&&ee(s,o),l&&s.querySelectorAll)){const h=s.querySelectorAll(u);for(let f=0;f<h.length;f++)ee(h[f],o)}}}}function ne(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,A(function(){const e=new MutationObserver(function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.type==="childList")try{te(r)}catch(i){console.error("[ln-core] lifecycle handler failed",r.target,i)}}});window.lnCore._lifecycleObserver=e,e.observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function xe(e){if(typeof window>"u")return e();window.lnCore=window.lnCore||{};const t=window.lnCore._lifecycleObserver;if(!t)return e();const n=t.takeRecords();for(let r=0;r<n.length;r++){const i=n[r];if(i.type==="childList")try{te(i)}catch(s){console.error("[ln-core] lifecycle handler failed",i.target,s)}}t.disconnect();try{return e()}finally{t.observe(document.body,{childList:!0,subtree:!0})}}function ke(e){O().push(e),e.onSubtreeChange&&e.query&&T().push(e),ne()}function oe(e,t,n,r,i={}){const s=i.extraAttributes||[],l=i.onAttributeChange||null,c=i.onSubtreeChange||null,o=i.onInit||null,u=i.onAttrChange||null,h=i.effects||null,f=i.attributes||null,b=f?ge(f):h,I=f?new Set(Object.keys(f)):null,F=i.persist||null;function y(C){const g=C||document.body;if(X(g,e,t,n),f&&M())for(const _ in f){const Ve=f[_],N=Array.from(g.querySelectorAll("["+_+"]"));g.matches&&g.matches("["+_+"]")&&N.push(g);for(let R=0;R<N.length;R++){const $=N[R];x($)&&K(Ve,$.getAttribute(_),_,r,$)}}o&&o(g)}const a=[];if(e.indexOf("[")!==-1){const C=/\[([\w-]+)/g;let g;for(;(g=C.exec(e))!==null;)a.push(g[1])}else a.push(e);_e({selector:e,attribute:t,componentTag:r,attributes:f,ComponentFn:n,onInit:o,observed:a.concat(s),onAttributeChange:l,onAttrChange:u,effects:b,declared:I,persist:F}),Se();const d=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,w=i.subtreeQuery||(d?e:"["+e+"]"),p={selector:e,attribute:t,ComponentFn:n,onInit:o,onSubtreeChange:c,query:w};O().push(p),c&&w&&T().push(p),ne(),window[t]=y,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=oe,window.lnCore.observeLifecycle=ke,window.lnCore.withoutLifecycle=xe);function m(){Ce()>0?Ae(function(){y(document.body)}):y(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",m):m(),y}function re(e){return(e||"").replace(/^#/,"")}function D(e){const t=e===void 0?location.hash:e,n={},r=re(t);if(!r)return n;const i=r.split("&");for(let s=0;s<i.length;s++){const l=i[s];if(!l)continue;const c=l.indexOf(":"),o=c>-1?l.slice(0,c):l,u=c>-1?l.slice(c+1):"";if(o)try{n[o]=decodeURIComponent(u)}catch{n[o]=u}}return n}function Ee(e){if(!e)return null;const t=D();return e in t?t[e]:null}function Le(e,t){if(!e)return;const n=D();t==null?delete n[e]:n[e]=String(t);const i=Object.keys(n).map(function(s){const l=n[s];return l===""?s:s+":"+encodeURIComponent(l)}).join("&");re(location.hash)!==i&&(location.hash=i)}function qe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Oe(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const r=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return r?t?r+"-"+t:r:t||null}function Te(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function De(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function Ie(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Fe(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),r=e.slice(t+1),i=r?r.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:n,values:i}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=D,window.lnCore.hashGet=Ee,window.lnCore.hashSet=Le,window.lnCore.hashLinkClick=qe,window.lnCore.resolveHashNamespace=Oe,window.lnCore.hashSortEncode=Te,window.lnCore.hashSortDecode=De,window.lnCore.hashFilterEncode=Ie,window.lnCore.hashFilterDecode=Fe);function Ne(e){return(e||"").replace(/^\?/,"")}function Re(e){const t=e===void 0?typeof window<"u"?window.location.search:"":e,n={},r=Ne(t);if(!r)return n;const i=new URLSearchParams(r);for(const[s,l]of i.entries())n[s]=l;return n}function $e(e){if(!e||typeof window>"u")return null;const t=new URLSearchParams(window.location.search);return t.has(e)?t.get(e):null}function Me(e,t){if(!e||typeof window>"u")return;const n=new URL(window.location.href);if(t==null||t===""?n.searchParams.delete(e):n.searchParams.set(e,String(t)),n.search===window.location.search)return;const r=n.pathname+n.search+n.hash;window.history.replaceState(window.history.state,"",r)}function Be(e,t){if(!e||!e.hasAttribute("data-ln-query"))return null;const n=e.getAttribute("data-ln-query");if(n&&n.trim()!=="")return n.trim();const r=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return r?t?r+"_"+t:r:t||null}function je(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ue(e,t){if(e&&typeof e=="string"){if(e.endsWith(".asc"))return{fieldOrColumn:e.slice(0,-4),direction:"asc"};if(e.endsWith(".desc"))return{fieldOrColumn:e.slice(0,-5),direction:"desc"}}if(t&&typeof t=="object"){const n=t.sort_field||t.sort_by;if(n){const r=t.sort_dir&&String(t.sort_dir).toLowerCase()==="desc"?"desc":"asc";return{fieldOrColumn:n,direction:r}}}return null}function We(e){return!Array.isArray(e)||e.length===0?null:e.map(encodeURIComponent).join(",")}function He(e){return!e||typeof e!="string"?[]:e.split(",").map(function(t){try{return decodeURIComponent(t.trim())}catch{return t.trim()}}).filter(Boolean)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.queryParse=Re,window.lnCore.queryGet=$e,window.lnCore.querySet=Me,window.lnCore.resolveQueryParam=Be,window.lnCore.querySortEncode=je,window.lnCore.querySortDecode=Ue,window.lnCore.queryFilterEncode=We,window.lnCore.queryFilterDecode=He);function Pe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=Pe),(function(){const e="data-ln-toast",t="lnToast",n="ln-toast-item";if(window[t]!==void 0)return;const r={"data-ln-toast":{type:"marker",description:"Initializes the toast notifications container"},"data-ln-toast-timeout":{prop:"timeoutDefault",type:"integer",read:v,fallback:6e3,min:500,description:"Default auto-dismiss timeout in ms"},"data-ln-toast-max":{prop:"max",type:"integer",read:v,fallback:5,min:1,description:"Maximum visible concurrent toast notifications"},"data-ln-toast-close":{type:"trigger",description:"Click dismiss trigger inside a toast item"},"data-ln-toast-item":{type:"marker",description:"Individual toast notification element"}},i=z(r);function s(a){if(!(!a||!(a instanceof HTMLElement))&&(a.hasAttribute("popover")||a.setAttribute("popover","manual"),typeof a.showPopover=="function")){if(a.matches(":popover-open"))try{a.hidePopover()}catch{}try{a.showPopover()}catch{}}}function l(a){if(!a||!(a instanceof HTMLElement))return;if(a.querySelectorAll("[data-ln-toast-item]").length===0&&typeof a.hidePopover=="function"&&a.matches(":popover-open"))try{a.hidePopover()}catch{}}function c(a){this.dom=a,G(this,a,i);const d=Array.from(a.querySelectorAll("[data-ln-toast-item]"));for(;d.length>this.max;)a.removeChild(d.shift());for(const w of d)I(w,this);return d.length>0&&s(a),this}c.prototype.enqueue=function(a){if(!a)return;const d=o(a,this.dom);if(!d)return;const w=Number.isFinite(a.timeout)?a.timeout:this.timeoutDefault;h(this,d),w>0&&(d._timer=setTimeout(()=>f(d),w))},c.prototype.clear=function(){for(const a of Array.from(this.dom.querySelectorAll("[data-ln-toast-item]")))f(a)},c.prototype.destroy=function(){if(this.dom[t]){for(const a of Array.from(this.dom.querySelectorAll("[data-ln-toast-item]")))f(a);l(this.dom),delete this.dom[t]}};function o(a,d){const w=((a.type||"")+"").trim().toLowerCase(),p=pe(d,n,"ln-toast");if(!p)return console.warn('[ln-toast] Template "'+n+'" not found'),null;E(p,{type:w,title:a.title,message:typeof a.message=="string"?a.message:void 0});const m=p.firstElementChild;if(!m)return null;m.hasAttribute("data-ln-toast-item")||m.setAttribute("data-ln-toast-item",""),m.classList.add("ln-enter");const C=m.querySelector('[data-ln-field="message"]');C&&u(C,a);const g=m.querySelector("[data-ln-toast-close]");return g&&g.addEventListener("click",function(){f(m)}),m}function u(a,d){if(Array.isArray(d.message)){const w=document.createElement("ul");for(const p of d.message){const m=document.createElement("li");m.textContent=p,w.appendChild(m)}a.appendChild(w)}if(d.data&&d.data.errors){const w=document.createElement("ul");for(const p of Object.values(d.data.errors).flat()){const m=document.createElement("li");m.textContent=p,w.appendChild(m)}a.appendChild(w)}}function h(a,d){const w=Array.from(a.dom.querySelectorAll("[data-ln-toast-item]"));for(;w.length>=a.max&&w.length>0;)a.dom.removeChild(w.shift());a.dom.appendChild(d),s(a.dom),requestAnimationFrame(()=>d.classList.remove("ln-enter"))}function f(a){if(!a||!a.parentNode)return;const d=a.parentNode;clearTimeout(a._timer),a.classList.remove("ln-enter"),a.classList.add("ln-out"),setTimeout(()=>{a.parentNode&&(a.parentNode.removeChild(a),l(d))},200)}function b(a){let d=a&&a.container;return typeof d=="string"&&(d=document.querySelector(d)),d instanceof HTMLElement||(d=document.querySelector("["+e+"]")||document.getElementById("ln-toast-container")),d||null}function I(a,d){if(a._lnToastHydrated)return;a._lnToastHydrated=!0;const w=a.querySelector("[data-ln-toast-close]");w&&w.addEventListener("click",function(){f(a)});const p=+(a.getAttribute("data-ln-toast-timeout")??d.timeoutDefault);p>0&&(a._timer=setTimeout(function(){f(a)},p))}function F(a){const d=a.detail||{},w=b(d);if(!w){console.warn("[ln-toast] No toast container found");return}(w[t]||(w[t]=new c(w))).enqueue(d)}function y(a){const d=a&&a.detail||{};if(d.container){const w=b(d);w&&(w[t]||(w[t]=new c(w))).clear()}else{const w=document.querySelectorAll("["+e+"]");for(const p of Array.from(w))(p[t]||(p[t]=new c(p))).clear()}}A(function(){window.addEventListener("ln-toast:enqueue",F),window.addEventListener("ln-toast:clear",y),window.addEventListener("ln-modal:open",function(){const a=document.querySelectorAll("["+e+"], #ln-toast-container");for(const d of Array.from(a))d.querySelectorAll("[data-ln-toast-item]").length>0&&s(d)})},"ln-toast"),oe(e,t,c,"ln-toast",{attributes:r})})()})();
|
|
@@ -111,7 +111,7 @@ import { guardBody, cloneTemplateScoped, fill, registerComponent, defineAttrs, a
|
|
|
111
111
|
// pre-added .ln-enter would be wiped. Add the transient enter flag now.
|
|
112
112
|
li.classList.add('ln-enter');
|
|
113
113
|
|
|
114
|
-
const bodyEl = li.querySelector('
|
|
114
|
+
const bodyEl = li.querySelector('[data-ln-field="message"]');
|
|
115
115
|
if (bodyEl) _renderBody(bodyEl, opts);
|
|
116
116
|
|
|
117
117
|
const closeBtn = li.querySelector('[data-ln-toast-close]');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ln-validate
|
|
2
2
|
|
|
3
|
-
> Applied to form controls (`<input data-ln-validate>`, `<select>`, `<textarea>`)
|
|
3
|
+
> Applied to form controls (`<input data-ln-validate>`, `<select>`, `<textarea>`); messages are read from the nearest ancestor that directly contains `[data-ln-validate-errors]`, and the list is optional.
|
|
4
4
|
> On initialization, it injects `novalidate` on the parent `<form>` and intercepts the form `submit` event.
|
|
5
5
|
> On field `blur` or `input` (after touched), it checks native `input.validity`, toggles the `.hidden` class on matching
|
|
6
6
|
> `[data-ln-validate-error="rule"]` elements, and sets `aria-invalid`; on submit with errors, it calls `e.preventDefault()` and focuses the first invalid field.
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
> [!IMPORTANT]
|
|
52
|
-
> The surrounding wrapper
|
|
52
|
+
> The surrounding wrapper does not require any specific CSS class — `ln-validate` reads from the nearest ancestor that directly contains `[data-ln-validate-errors]`.
|
|
53
53
|
|
|
54
54
|
---
|
|
55
55
|
|
|
@@ -120,7 +120,7 @@ input.lnValidate.destroy();
|
|
|
120
120
|
|
|
121
121
|
## ⚠️ Common Pitfalls
|
|
122
122
|
|
|
123
|
-
- **
|
|
123
|
+
- **Error list placement:** `ln-validate` locates sibling error elements relative to the nearest ancestor that directly contains `[data-ln-validate-errors]`. If you place `[data-ln-validate-errors]` outside that ancestor, no error lists will be toggled.
|
|
124
124
|
- **Relying on Native browser CSS (`:invalid`):** The browser applies `:invalid` to empty required fields on page load. **Always** use our custom classes `.ln-validate-valid` and `.ln-validate-invalid` for visual borders and focus states.
|
|
125
125
|
- **Injecting custom errors without validating:** Dispatching `ln-validate:set-custom` updates visual classes, but it **does not** bubble an `:invalid` event. If you need form-level coordinators (`ln-form`) to react immediately, call `input.lnValidate.validate()` right after injecting.
|
|
126
126
|
- **Expecting `novalidate` in your own markup:** Don't write it by hand
|
|
@@ -136,7 +136,7 @@ Source: `components/ln-validate/ln-validate.js` (~160 lines). Imports only `disp
|
|
|
136
136
|
|
|
137
137
|
### State & Constructor Initialization
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
Internal instance state (`dom.lnValidate`): `dom`, `_touched` (bool), `_customErrors` (Set), and lazily cached `_errorItems`. No debounce — every `validate()` call checks `dom.validity` and updates matching error elements. Scoped to the field's wrapper and validity checks are microsecond-fast.
|
|
140
140
|
|
|
141
141
|
**Initial Value Instantiation Check:** Upon component construction, if an input field already contains a non-empty value (`dom.value` is non-empty or `dom.checked`), `ln-validate` immediately marks `_touched = true` and invokes `this.validate()` to synchronize its visual state and error elements in the DOM without requiring initial user interaction. Pristine empty fields remain `_touched = false`.
|
|
142
142
|
|
|
@@ -147,9 +147,9 @@ Three fields per instance (`dom.lnValidate`): `dom`, `_touched` (bool), `_custom
|
|
|
147
147
|
### `validate()` flow
|
|
148
148
|
|
|
149
149
|
1. `nativeValid = dom.checkValidity()`; `isValid = nativeValid && _customErrors.size === 0`.
|
|
150
|
-
2. Walks the field
|
|
150
|
+
2. Walks the field ancestor's `[data-ln-validate-error]` `<li>`s; keys present in `ERROR_MAP` (`required`/`typeMismatch`/`tooShort`/`tooLong`/`patternMismatch`/`rangeUnderflow`/`rangeOverflow`) toggle `hidden` off `validity[prop]`; keys NOT in the map are skipped — that's the mechanism that lets native and custom errors share one `<ul>` without conflict.
|
|
151
151
|
3. Toggles `.ln-validate-valid`/`.ln-validate-invalid`, dispatches `:valid`/`:invalid` `{ target, field: dom.name }`.
|
|
152
|
-
4. If the field has no
|
|
152
|
+
4. If the field has no ancestor containing `[data-ln-validate-errors]`, error rendering is skipped but the class toggle and dispatch still run.
|
|
153
153
|
|
|
154
154
|
`validate()` never reads `_touched` — it always renders. `_touched` instead gates whether the *listener handlers* call it, so the submit gate can force-validate an untouched field on demand.
|
|
155
155
|
|
|
@@ -7,9 +7,4 @@
|
|
|
7
7
|
textarea[data-ln-validate]:not([id]) {
|
|
8
8
|
@include dev-inline-error("data-ln-validate element is missing required 'id' attribute");
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
// 2. Validation Nesting check: data-ln-validate must be wrapped inside .form-element or data-ln-form
|
|
12
|
-
[data-ln-validate]:not(.form-element [data-ln-validate]):not([data-ln-form] [data-ln-validate]) {
|
|
13
|
-
@include dev-dom-error("data-ln-validate must be a child of .form-element or data-ln-form wrapper");
|
|
14
|
-
}
|
|
15
10
|
}
|