@livenetworks/ashlar 2.0.4 → 2.0.6
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/ln-debug/ln-debug.js +1 -1
- package/components/ln-debug/src/generated-attributes.js +0 -1
- package/components/ln-fill/README.md +14 -11
- package/components/ln-fill/ln-fill.js +1 -1
- package/components/ln-fill/src/ln-fill.js +0 -6
- package/components/ln-modal/README.md +33 -12
- package/components/ln-modal/ln-modal.js +1 -1
- package/components/ln-modal/ln-modal.schema.json +17 -6
- package/components/ln-modal/src/ln-modal.js +57 -2
- package/components/ln-ui-coordinator/README.md +62 -101
- package/components/ln-ui-coordinator/ln-ui-coordinator.js +1 -1
- package/components/ln-ui-coordinator/ln-ui-coordinator.schema.json +1 -33
- package/components/ln-ui-coordinator/src/ln-ui-coordinator.js +140 -403
- package/ln-ashlar.html-data.json +10 -6
- package/package.json +1 -1
- package/web-types.json +8 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
var LnAshlarComponent=(function(y){"use strict";function L(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function A(t){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return t?window.lnCore._debugIsContained(t):window.lnCore._debugSink!==null;if(t&&t.closest){const e=t.closest("[data-ln-debug]");return!(!e||typeof document<"u"&&e===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 t=console.warn;console.warn=function(...e){if(typeof e[0]=="string"&&(e[0].startsWith("[ln-")||e[0].startsWith("[lnCore"))){let a=null;for(let r=1;r<e.length;r++)if(e[r]&&e[r].nodeType===1){a=e[r];break}if(!A(a))return}t.apply(console,e)}}function Y(t,e){window.lnCore=window.lnCore||{},window.lnCore._debugSink=t,window.lnCore._debugIsContained=e||null}function Z(t,e,n){const a=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",e,t,a),t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:a}))}function p(t,e){if(!document.body){document.addEventListener("DOMContentLoaded",function(){p(t,e)}),console.warn("["+e+'] Script loaded before <body> — add "defer" to your <script> tag');return}t()}const M={};function tt(t,e){M[t]=e}function et(t){return M[t]||{ingress:e=>e,egress:e=>e}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=tt,window.lnCore.getDataMapper=et);function nt(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,p(function(){new MutationObserver(function(){Z(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const R={};function at(t,e){if(!t||typeof e!="object")return;const n=t.toLowerCase().split("-")[0];R[n]=e}function lt(t){if(!t)return null;const e=t.toLowerCase().split("-")[0];return R[e]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=at,window.lnCore.getLocaleFallback=lt,window.lnCore.ensureLocaleObserver=nt);const S={};function ot(t,e){S[t]||(S[t]=document.querySelector('[data-ln-template="'+t+'"]'));const n=S[t];return n?n.content.cloneNode(!0):(console.warn("["+(e||"ln-core")+'] Template "'+t+'" not found'),null)}function W(t,e){if(!t||!e)return t;const n=t.querySelectorAll("[data-ln-field]");for(let o=0;o<n.length;o++){const d=n[o],i=d.getAttribute("data-ln-field");e[i]!=null&&(d.textContent=e[i])}const a=t.querySelectorAll("[data-ln-attr]");for(let o=0;o<a.length;o++){const d=a[o],i=d.getAttribute("data-ln-attr").split(",");for(let s=0;s<i.length;s++){const c=i[s].trim().split(":");if(c.length!==2)continue;const u=c[0].trim(),f=c[1].trim();e[f]!=null&&d.setAttribute(u,e[f])}}const r=t.querySelectorAll("[data-ln-show]");for(let o=0;o<r.length;o++){const d=r[o],i=d.getAttribute("data-ln-show");i in e&&d.classList.toggle("hidden",!e[i])}const l=t.querySelectorAll("[data-ln-class]");for(let o=0;o<l.length;o++){const d=l[o],i=d.getAttribute("data-ln-class").split(",");for(let s=0;s<i.length;s++){const c=i[s].trim().split(":");if(c.length!==2)continue;const u=c[0].trim(),f=c[1].trim();f in e&&d.classList.toggle(u,!!e[f])}}return t}function rt(t,e){t.matches&&t.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",t,e??null),t.dispatchEvent(new CustomEvent("ln-fill",{detail:e??null,bubbles:!0})));const n=t.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let a=0;a<n.length;a++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[a],e??null),n[a].dispatchEvent(new CustomEvent("ln-fill",{detail:e??null,bubbles:!0}));return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(t){if(!(!t.target.matches||!t.target.matches("[data-ln-fillable]")))if(t.detail)W(t.target,t.detail);else{const e=t.target.querySelectorAll("[data-ln-field]");for(let n=0;n<e.length;n++)e[n].textContent=""}})));function j(t,e){if(!t||!e)return t;const n=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const l=n.currentNode;l.textContent.indexOf("{{")!==-1&&(l.textContent=l.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(o,d){return e[d]!==void 0?e[d]:""}))}const a=function(l,o){return e[o]!==void 0?e[o]:""},r=Array.from(t.querySelectorAll("*"));t.nodeType===1&&r.push(t);for(let l=0;l<r.length;l++){const o=r[l],d=o.attributes;for(let i=0;i<d.length;i++){const s=d[i];s.value.indexOf("{{")!==-1&&o.setAttribute(s.name,s.value.replace(/\{\{\s*(\w+)\s*\}\}/g,a))}}return t}function it(t,e,n,a,r,l){const o={};for(let i=0;i<t.children.length;i++){const s=t.children[i],c=s.getAttribute("data-ln-render-key");c&&(o[c]=s)}const d=document.createDocumentFragment();for(let i=0;i<e.length;i++){const s=e[i],c=String(a(s));let u=o[c];if(u)r(u,s,i);else{const f=ot(n,l);if(!f||(j(f,s),u=f.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",c),r(u,s,i)}d.appendChild(u)}t.textContent="",t.appendChild(d)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=j,window.lnCore.fill=W,window.lnCore.lnFill=rt,window.lnCore.renderList=it);function B(t,e,n,a,r){if(!t||e===null)return!0;const l=a||"ln-component",o=t.type;if(o==="trigger"||o==="marker"||o==="string"||o==="list"||!o||e===""&&t.fallback!==void 0)return!0;const d=i=>{r?console.warn(i,r):console.warn(i)};if(o==="boolean"){const i=e.trim().toLowerCase();return i!==""&&i!=="true"&&i!=="false"&&i!=="1"&&i!=="0"?(d(`[${l}] Invalid value "${e}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(o==="enum"){const i=t.values||[];return i.includes(e)?!0:(d(`[${l}] Invalid value "${e}" for attribute "${n}". Allowed: ${i.join(", ")}. Fallback: "${t.fallback}".`),!1)}if(o==="integer"){if(!/^-?\d+$/.test(e))return d(`[${l}] Invalid integer "${e}" for attribute "${n}". Fallback: ${t.fallback}.`),!1;const i=parseInt(e,10);return t.min!==void 0&&i<t.min?(d(`[${l}] Value ${i} for attribute "${n}" is less than min (${t.min}).`),!1):t.max!==void 0&&i>t.max?(d(`[${l}] Value ${i} for attribute "${n}" is greater than max (${t.max}).`),!1):!0}if(o==="float")return isNaN(Number(e))?(d(`[${l}] Invalid float "${e}" for attribute "${n}". Fallback: ${t.fallback}.`),!1):!0;if(o==="json")try{return JSON.parse(e),!0}catch(i){return d(`[${l}] Invalid JSON for attribute "${n}": ${i.message}. Fallback: ${t.fallback}.`),!1}return!0}function dt(t){const e={};for(const n in t){const a=t[n];a&&a.effect&&(e[n]=a.effect)}return Object.keys(e).length?e:null}function st(t){if(t.onAttrChange&&!t.declared)return null;const e=new Set;if(t.effects)for(const n in t.effects)e.add(n);if(t.onAttrChange&&t.declared)for(const n of t.declared)e.add(n);return e}function _(t,e,n,a){if(t.nodeType!==1)return;const l=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]",o=Array.from(t.querySelectorAll(l));t.matches&&t.matches(l)&&o.push(t);for(const d of o)if(!d[n]){window.lnCore._persistSink&&d.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(d,e);try{d[n]=new a(d)}catch(i){console.error("["+n+"] init failed",d,i)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function N(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function F(t){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(t):setTimeout(t,0)):t()}function V(){window.lnCore=window.lnCore||{};const t=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return t.byReactive=t.byReactive||new Map,t.reactiveWildcard=t.reactiveWildcard||[],t}function H(t){const e=V(),n=t.observed||[];for(let a=0;a<n.length;a++){const r=n[a];e.byAttr.has(r)||e.byAttr.set(r,[]),e.byAttr.get(r).push(t)}if(e.byDeclaredAttr=e.byDeclaredAttr||new Map,t.attributes)for(const a in t.attributes){e.byDeclaredAttr.has(a)||e.byDeclaredAttr.set(a,[]);const r=e.byDeclaredAttr.get(a);r.some(l=>l.componentTag===t.componentTag)||r.push({spec:t.attributes[a],componentTag:t.componentTag})}if(t.onAttrChange||t.effects){e.reactive.push(t);const a=st(t);if(a===null)e.reactiveWildcard.push(t);else for(const r of a)e.byReactive.has(r)||e.byReactive.set(r,[]),e.byReactive.get(r).push(t)}t.persist&&e.persist.push(t)}function U(t,e,n,a){for(let r=0;r<t.length;r++){const l=t[r];if(!e[l.attribute])continue;const o=l.effects&&l.effects[n];o?o(e,n,a):l.onAttrChange&&(!l.declared||l.declared.has(n))&&l.onAttrChange(e,n,a)}}function ct(t){const e=t.target,n=t.attributeName;if(t.oldValue===e.getAttribute(n))return;const a=V(),r=a.byAttr.get(n);if(L()&&a.byDeclaredAttr&&a.byDeclaredAttr.has(n)&&A(e)){const l=a.byDeclaredAttr.get(n),o=e.getAttribute(n);for(let d=0;d<l.length;d++)B(l[d].spec,o,n,l[d].componentTag,e)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||r)&&window.lnCore._debugSink("attr",n,e,{oldValue:t.oldValue,newValue:e.getAttribute(n)}),n.indexOf("data-ln-")===0){const l=a.byReactive.get(n);l&&U(l,e,n,t.oldValue),a.reactiveWildcard.length&&U(a.reactiveWildcard,e,n,t.oldValue)}if(r)for(let l=0;l<r.length;l++){const o=r[l];if(o.handler){o.handler(e,n,t.oldValue);continue}o.onAttributeChange&&e[o.attribute]?o.onAttributeChange(e,n):(_(e,o.selector,o.attribute,o.ComponentFn),o.onInit&&o.onInit(e))}}function z(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,p(function(){new MutationObserver(function(e){for(let n=0;n<e.length;n++)try{ct(e[n])}catch(a){console.error("[ln-core] mutation handler failed",e[n].target,a)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function G(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function ut(t){const e=G();if(e.length){if(t.target)for(let n=0;n<e.length;n++){const a=e[n];if(a.onSubtreeChange){const r=a.query,l=t.target.nodeType===1?t.target.matches(r)?t.target:t.target.closest(r):t.target.parentElement?t.target.parentElement.closest(r):null;l&&a.onSubtreeChange(l,t)}}for(let n=0;n<t.addedNodes.length;n++){const a=t.addedNodes[n];if(a.nodeType===1)for(let r=0;r<e.length;r++){const l=e[r];_(a,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(a)}}for(let n=0;n<t.removedNodes.length;n++){const a=t.removedNodes[n];if(a.nodeType===1)for(let r=0;r<e.length;r++){const l=e[r],o=l.query,d=Array.from(a.querySelectorAll(o));a.matches&&a.matches(o)&&d.push(a);for(let i=0;i<d.length;i++){const s=d[i];if(!document.contains(s)){const c=s[l.attribute];if(c&&typeof c.destroy=="function")try{c.destroy()}catch(u){console.error("["+l.attribute+"] destroy failed",s,u)}delete s[l.attribute]}}}}}}function ft(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,p(function(){new MutationObserver(function(e){for(let n=0;n<e.length;n++){const a=e[n];if(a.type==="childList")try{ut(a)}catch(r){console.error("[ln-core] lifecycle handler failed",a.target,r)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function wt(t,e){H({observed:t,handler:e}),z()}function bt(t,e,n,a,r={}){const l=r.extraAttributes||[],o=r.onAttributeChange||null,d=r.onSubtreeChange||null,i=r.onInit||null,s=r.onAttrChange||null,c=r.effects||null,u=r.attributes||null,f=u?dt(u):c,D=u?new Set(Object.keys(u)):null,qt=r.persist||null;function v(E){const w=E||document.body;if(_(w,t,e,n),u&&L())for(const g in u){const Mt=u[g],O=Array.from(w.querySelectorAll("["+g+"]"));w.matches&&w.matches("["+g+"]")&&O.push(w);for(let T=0;T<O.length;T++){const q=O[T];A(q)&&B(Mt,q.getAttribute(g),g,a,q)}}i&&i(w)}const I=[];if(t.indexOf("[")!==-1){const E=/\[([\w-]+)/g;let w;for(;(w=E.exec(t))!==null;)I.push(w[1])}else I.push(t);H({selector:t,attribute:e,componentTag:a,attributes:u,ComponentFn:n,onInit:i,observed:I.concat(l),onAttributeChange:o,onAttrChange:s,effects:f,declared:D,persist:qt}),z();const Lt=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]";G().push({selector:t,attribute:e,ComponentFn:n,onInit:i,onSubtreeChange:d,query:Lt}),ft(),window[e]=v;function X(){N()>0?F(function(){v(document.body)}):v(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",X):X(),v}function Q(t){return(t||"").replace(/^#/,"")}function k(t){const e=t===void 0?location.hash:t,n={},a=Q(e);if(!a)return n;const r=a.split("&");for(let l=0;l<r.length;l++){const o=r[l];if(!o)continue;const d=o.indexOf(":"),i=d>-1?o.slice(0,d):o,s=d>-1?o.slice(d+1):"";if(i)try{n[i]=decodeURIComponent(s)}catch{n[i]=s}}return n}function pt(t){if(!t)return null;const e=k();return t in e?e[t]:null}function ht(t,e){if(!t)return;const n=k();e==null?delete n[t]:n[t]=String(e);const r=Object.keys(n).map(function(l){const o=n[l];return o===""?l:l+":"+encodeURIComponent(o)}).join("&");Q(location.hash)!==r&&(location.hash=r)}function mt(t){return t.button===1||t.ctrlKey||t.metaKey||t.shiftKey?!1:(t.preventDefault(),!0)}function gt(t,e){if(!t||!t.hasAttribute("data-ln-hash"))return null;const n=t.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const a=t.getAttribute("data-ln-sort")||t.getAttribute("data-ln-search-for")||t.getAttribute("data-ln-search")||t.getAttribute("data-ln-filter")||t.id;return a?e?a+"-"+e:a:e||null}function yt(t,e){return!e||e==="none"||t===null||t===void 0?null:String(t)+"."+e}function Ct(t){return!t||typeof t!="string"?null:t.endsWith(".asc")?{fieldOrColumn:t.slice(0,-4),direction:"asc"}:t.endsWith(".desc")?{fieldOrColumn:t.slice(0,-5),direction:"desc"}:null}function vt(t,e){return!t||!Array.isArray(e)||e.length===0?null:t+":"+e.map(encodeURIComponent).join(",")}function At(t){if(!t||typeof t!="string")return null;const e=t.indexOf(":");if(e===-1)return null;const n=t.slice(0,e),a=t.slice(e+1),r=a?a.split(",").map(function(l){try{return decodeURIComponent(l)}catch{return l}}).filter(Boolean):[];return{key:n,values:r}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=k,window.lnCore.hashGet=pt,window.lnCore.hashSet=ht,window.lnCore.hashLinkClick=mt,window.lnCore.resolveHashNamespace=gt,window.lnCore.hashSortEncode=yt,window.lnCore.hashSortDecode=Ct,window.lnCore.hashFilterEncode=vt,window.lnCore.hashFilterDecode=At);const x=new Set(["data-ln-accordion","data-ln-ajax","data-ln-api-base-url","data-ln-api-connector","data-ln-api-connector-query-debounce","data-ln-api-headers","data-ln-api-param-limit","data-ln-api-param-offset","data-ln-api-param-search","data-ln-api-param-sort-dir","data-ln-api-param-sort-field","data-ln-api-path","data-ln-api-queue","data-ln-api-queue-online","data-ln-attr","data-ln-autoresize","data-ln-autosave","data-ln-autosave-clear","data-ln-autosave-debounce-input","data-ln-autosave-exclude","data-ln-chart","data-ln-chart-area","data-ln-chart-count","data-ln-chart-empty","data-ln-chart-labels","data-ln-chart-line","data-ln-chart-max","data-ln-chart-min","data-ln-chart-padding","data-ln-chart-plot","data-ln-chart-sort","data-ln-chart-source","data-ln-chart-type","data-ln-chart-x","data-ln-chart-y","data-ln-chart-zero","data-ln-circular-progress","data-ln-circular-progress-label","data-ln-circular-progress-max","data-ln-class","data-ln-col","data-ln-confirm","data-ln-confirm-active","data-ln-confirm-announcer","data-ln-confirm-idle","data-ln-confirm-state","data-ln-confirm-timeout","data-ln-couchdb-auth","data-ln-couchdb-connector","data-ln-couchdb-db","data-ln-couchdb-headers","data-ln-couchdb-url","data-ln-data-coordinator","data-ln-data-coordinator-dict","data-ln-data-coordinator-filters","data-ln-data-coordinator-mapper","data-ln-data-coordinator-no-autosync","data-ln-data-coordinator-scope","data-ln-data-coordinator-search","data-ln-data-coordinator-sort-direction","data-ln-data-coordinator-sort-field","data-ln-data-coordinator-stale","data-ln-data-store","data-ln-data-store-frozen","data-ln-data-store-indexes","data-ln-data-store-no-autosync","data-ln-data-store-no-local-query","data-ln-data-store-search-fields","data-ln-data-store-stale","data-ln-data-store-window","data-ln-data-store-window-page","data-ln-date","data-ln-date-dict","data-ln-date-dict-key","data-ln-date-field","data-ln-date-format","data-ln-date-label","data-ln-date-locale","data-ln-debug","data-ln-dropdown","data-ln-dropdown-menu","data-ln-dropdown-placement","data-ln-dropdown-position","data-ln-editor","data-ln-editor-action","data-ln-editor-source","data-ln-empty","data-ln-empty-state","data-ln-empty-when","data-ln-error","data-ln-external-link","data-ln-field","data-ln-fill-as","data-ln-fill-form","data-ln-fill-id","data-ln-fillable","data-ln-filter","data-ln-filter-col","data-ln-filter-hide","data-ln-filter-key","data-ln-filter-options","data-ln-filter-reset","data-ln-filter-search","data-ln-filter-value","data-ln-filter-values","data-ln-form","data-ln-form-action-edit","data-ln-form-action-method","data-ln-hash","data-ln-include","data-ln-item","data-ln-item-action","data-ln-item-id","data-ln-item-select","data-ln-key","data-ln-key-allow-input","data-ln-key-for","data-ln-key-modifier","data-ln-key-target","data-ln-link","data-ln-list","data-ln-list-body","data-ln-list-count","data-ln-list-empty","data-ln-list-field","data-ln-list-filtered","data-ln-list-select-all","data-ln-list-selectable","data-ln-list-selected","data-ln-list-source","data-ln-list-total","data-ln-list-window","data-ln-list-window-page","data-ln-list-window-threshold","data-ln-mapper","data-ln-modal","data-ln-modal-close","data-ln-modal-for","data-ln-modal-mode","data-ln-modal-when","data-ln-nav","data-ln-nav-exact","data-ln-number","data-ln-number-decimals","data-ln-number-max","data-ln-number-min","data-ln-obfuscator","data-ln-obfuscator-codec","data-ln-obfuscator-key","data-ln-options","data-ln-options-label","data-ln-options-value","data-ln-outlet","data-ln-panel","data-ln-persist","data-ln-persist-scope","data-ln-picklist","data-ln-picklist-list","data-ln-picklist-max","data-ln-popover","data-ln-popover-for","data-ln-popover-placement","data-ln-popover-position","data-ln-progress","data-ln-progress-max","data-ln-render-key","data-ln-route","data-ln-route-keep","data-ln-route-target","data-ln-route-title","data-ln-router-base","data-ln-router-hydrate","data-ln-scroll","data-ln-scroll-behavior","data-ln-scroll-block","data-ln-scroll-delay","data-ln-scroll-focus","data-ln-scroll-set","data-ln-scroll-update-hash","data-ln-search","data-ln-search-clear","data-ln-search-clear-for","data-ln-search-exclude","data-ln-search-fields","data-ln-search-for","data-ln-search-hide","data-ln-search-items","data-ln-show","data-ln-slug-from","data-ln-sort","data-ln-sort-dir","data-ln-sort-exclude","data-ln-sort-field","data-ln-sort-icon","data-ln-sort-items","data-ln-sort-state","data-ln-sortable","data-ln-sortable-handle","data-ln-stat","data-ln-stat-card","data-ln-stat-filter","data-ln-stat-label","data-ln-stat-trend","data-ln-stat-value","data-ln-step","data-ln-step-label","data-ln-stepper","data-ln-store","data-ln-tab","data-ln-table","data-ln-table-body","data-ln-table-cell-attr","data-ln-table-clear","data-ln-table-clear-all","data-ln-table-col","data-ln-table-col-filter","data-ln-table-col-select","data-ln-table-col-sort","data-ln-table-coordinator","data-ln-table-count","data-ln-table-dict","data-ln-table-empty","data-ln-table-empty-when","data-ln-table-filter-col","data-ln-table-filtered","data-ln-table-row","data-ln-table-row-action","data-ln-table-row-id","data-ln-table-row-select","data-ln-table-select-all-label","data-ln-table-selectable","data-ln-table-selected","data-ln-table-sort","data-ln-table-source","data-ln-table-total","data-ln-table-window","data-ln-table-window-page","data-ln-table-window-threshold","data-ln-tabs","data-ln-tabs-active","data-ln-tabs-default","data-ln-tabs-focus","data-ln-tabs-key","data-ln-template","data-ln-time","data-ln-time-locale","data-ln-toast","data-ln-toast-close","data-ln-toast-item","data-ln-toast-max","data-ln-toast-timeout","data-ln-toast-when","data-ln-toggle","data-ln-toggle-action","data-ln-toggle-for","data-ln-tooltip","data-ln-tooltip-enhance","data-ln-tooltip-enhanced","data-ln-tooltip-placement","data-ln-tooltip-position","data-ln-translatable","data-ln-translatable-lang","data-ln-translations","data-ln-translations-active","data-ln-translations-add","data-ln-translations-default","data-ln-translations-lang","data-ln-translations-locales","data-ln-translations-placeholder","data-ln-translations-prefix","data-ln-translations-remove-label","data-ln-ui-coordinator","data-ln-ui-coordinator-dict","data-ln-upload","data-ln-upload-accept","data-ln-upload-action","data-ln-upload-delete","data-ln-upload-dict","data-ln-upload-ext","data-ln-upload-file-field","data-ln-upload-id","data-ln-upload-ids-field","data-ln-upload-item","data-ln-upload-list","data-ln-upload-local-id","data-ln-upload-max-files","data-ln-upload-max-size","data-ln-upload-progress","data-ln-upload-size","data-ln-upload-state","data-ln-upload-zone","data-ln-validate","data-ln-validate-error","data-ln-validate-errors","data-ln-value","data-ln-websocket-connector","data-ln-websocket-connector-url"]);function St(t,e){if(t===e)return 0;if(!t.length)return e.length;if(!e.length)return t.length;const n=[];for(let a=0;a<=e.length;a++)n[a]=[a];for(let a=0;a<=t.length;a++)n[0][a]=a;for(let a=1;a<=e.length;a++)for(let r=1;r<=t.length;r++)e.charAt(a-1)===t.charAt(r-1)?n[a][r]=n[a-1][r-1]:n[a][r]=Math.min(n[a-1][r-1]+1,n[a][r-1]+1,n[a-1][r]+1);return n[e.length][t.length]}function _t(t,e=x){if(e.has(t))return null;let n=null,a=1/0;for(const l of e){const o=St(t,l);o<a&&(a=o,n=l)}const r=Math.max(3,Math.floor(t.length*.4));return a<=r?n:null}function K(t){return typeof CSS<"u"&&CSS.escape?CSS.escape(t):t.replace(/([!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~])/g,"\\$1")}function kt(t=document){const e=t.ownerDocument||t,n=t.nodeType===9?t.body||t.documentElement:t;if(!n)return[];const a=[],r=[n,...n.querySelectorAll("*")];for(let l=0;l<r.length;l++){const o=r[l];if(o.attributes)for(let d=0;d<o.attributes.length;d++){const i=o.attributes[d];if(i.name.startsWith("data-ln-")&&i.name.endsWith("-for")){const s=(i.value||"").trim();if(!s){a.push({type:"id-empty",element:o,attribute:i.name,targetId:"",message:`[ln-debug] Empty ID reference in <${o.tagName.toLowerCase()} ${i.name}="">.`});continue}e.getElementById(s)||e.querySelector("#"+K(s))||a.push({type:"id-unresolved",element:o,attribute:i.name,targetId:s,message:`[ln-debug] Unresolved ID reference: <${o.tagName.toLowerCase()} ${i.name}="${s}"> targets "#${s}", but no element with id="${s}" exists in the document.`})}}}return a}function xt(t=document){const e=t.ownerDocument||t,n=t.nodeType===9?t.body||t.documentElement:t;if(!n)return[];const a=[],r=[n,...n.querySelectorAll("*")];for(let l=0;l<r.length;l++){const o=r[l];if(o.attributes)for(let d=0;d<o.attributes.length;d++){const i=o.attributes[d];if(i.name.startsWith("data-ln-")&&(i.name.endsWith("-source")||i.name.endsWith("-store"))&&i.name!=="data-ln-data-store"){const c=(i.value||"").trim();if(!c){a.push({type:"store-empty",element:o,attribute:i.name,storeName:"",message:`[ln-debug] Empty store reference in <${o.tagName.toLowerCase()} ${i.name}="">.`});continue}const u=K(c),f=e.querySelector(`[data-ln-data-store="${u}"], [data-ln-store="${u}"]`),D=typeof window<"u"&&window.lnDataStore&&typeof window.lnDataStore.getStore=="function"&&window.lnDataStore.getStore(c);!f&&!D&&a.push({type:"store-unresolved",element:o,attribute:i.name,storeName:c,message:`[ln-debug] Unresolved store reference: <${o.tagName.toLowerCase()} ${i.name}="${c}"> targets store "${c}", but no [data-ln-data-store="${c}"] exists in the document.`})}}}return a}function $t(t=document){t.ownerDocument;const e=t.nodeType===9?t.body||t.documentElement:t;if(!e)return[];const n=[],a=Array.from(e.querySelectorAll("[data-ln-data-store]"));e.hasAttribute&&e.hasAttribute("data-ln-data-store")&&a.unshift(e);const r=new Map;for(let l=0;l<a.length;l++){const o=a[l],d=(o.getAttribute("data-ln-data-store")||"").trim();d&&(r.has(d)||r.set(d,[]),r.get(d).push(o))}for(const[l,o]of r.entries())o.length>1&&n.push({type:"store-duplicate",storeName:l,elements:o,message:`[ln-debug] Duplicate store name: Multiple elements declare data-ln-data-store="${l}". Store names must be unique across the document.`});return n}function Dt(t=document,e=x){const n=t.nodeType===9?t.body||t.documentElement:t;if(!n)return[];const a=[],r=[n,...n.querySelectorAll("*")];for(let l=0;l<r.length;l++){const o=r[l];if(o.attributes)for(let d=0;d<o.attributes.length;d++){const i=o.attributes[d];if(i.name.startsWith("data-ln-")&&!e.has(i.name)){const s=_t(i.name,e),c=s?` Did you mean "${s}"?`:"";a.push({type:"attribute-unknown",element:o,attribute:i.name,suggestion:s,message:`[ln-debug] Unknown attribute "${i.name}" on <${o.tagName.toLowerCase()}>.${c}`})}}}return a}function C(t=typeof document<"u"?document:null,e={}){if(!t)return{idIssues:[],storeIssues:[],uniquenessIssues:[],spellingIssues:[],total:0};const n=e.validAttributes||x,a=kt(t),r=xt(t),l=$t(t),o=Dt(t,n),d=[...a,...r,...l,...o];if(!e.silent)for(let i=0;i<d.length;i++)console.warn(d[i].message);return{idIssues:a,storeIssues:r,uniquenessIssues:l,spellingIssues:o,total:d.length}}let h=null;function m(t=typeof document<"u"?document:null,e=50,n=null){if(!t)return;h&&(clearTimeout(h),h=null);function a(){h=setTimeout(()=>{h=null;const r=C(t);n&&n(r)},e)}N()>0?F(a):a()}function It(t,e,n,a){t==="event"?(console.groupCollapsed("[ln-debug] event",e),console.log("target",n),console.log("detail",a),console.groupEnd()):t==="attr"&&(console.groupCollapsed("[ln-debug] attr",e),console.log("target",n),console.log("old → new",a.oldValue,"→",a.newValue),console.groupEnd())}let b=[];function Et(){b=Array.from(document.body.querySelectorAll("[data-ln-debug]")),document.body.hasAttribute("data-ln-debug")&&b.push(document.body)}function J(t){if(t===window||t===document)return b.indexOf(document.body)!==-1;for(let e=0;e<b.length;e++)if(b[e].contains(t))return!0;return!1}function Ot(t,e,n,a){J(n)&&It(t,e,n,a)}function $(){Et(),Y(b.length>0?Ot:null,b.length>0?J:null)}function P(){$()}function Tt(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._debugGateBound&&(window.lnCore._debugGateBound=!0,p(function(){$(),wt(["data-ln-debug"],$)},"ln-debug")))}return(function(){const t="data-ln-debug",e="lnDebug";if(typeof window<"u"&&window[e]!==void 0)return;const n={"data-ln-debug":{type:"marker",description:"Enables developer diagnostics overlay, live validation badges, and inspection logging"}};Tt();function a(l){return this.dom=l,m(l.ownerDocument||document),P(),this}a.prototype.verify=function(l,o){return C(l||(this.dom?this.dom.ownerDocument||this.dom:document),o)},a.prototype.destroy=function(){delete this.dom[e],P()};const r=bt(t,e,a,"ln-debug",{attributes:n,onInit:function(l){typeof document<"u"&&m(l&&l.ownerDocument?l.ownerDocument:document)},onSubtreeChange:function(l){typeof document<"u"&&m(l&&l.ownerDocument?l.ownerDocument:document)}});r.verify=function(l,o){return C(l||document,o)},r.schedule=function(l,o,d){return m(l||document,o,d)}})(),y.scheduleVerification=m,y.verifyDOM=C,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"}),y})({});
|
|
1
|
+
var LnAshlarComponent=(function(y){"use strict";function L(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function A(t){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return t?window.lnCore._debugIsContained(t):window.lnCore._debugSink!==null;if(t&&t.closest){const e=t.closest("[data-ln-debug]");return!(!e||typeof document<"u"&&e===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 t=console.warn;console.warn=function(...e){if(typeof e[0]=="string"&&(e[0].startsWith("[ln-")||e[0].startsWith("[lnCore"))){let a=null;for(let r=1;r<e.length;r++)if(e[r]&&e[r].nodeType===1){a=e[r];break}if(!A(a))return}t.apply(console,e)}}function Y(t,e){window.lnCore=window.lnCore||{},window.lnCore._debugSink=t,window.lnCore._debugIsContained=e||null}function Z(t,e,n){const a=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",e,t,a),t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:a}))}function p(t,e){if(!document.body){document.addEventListener("DOMContentLoaded",function(){p(t,e)}),console.warn("["+e+'] Script loaded before <body> — add "defer" to your <script> tag');return}t()}const M={};function tt(t,e){M[t]=e}function et(t){return M[t]||{ingress:e=>e,egress:e=>e}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=tt,window.lnCore.getDataMapper=et);function nt(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,p(function(){new MutationObserver(function(){Z(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const R={};function at(t,e){if(!t||typeof e!="object")return;const n=t.toLowerCase().split("-")[0];R[n]=e}function lt(t){if(!t)return null;const e=t.toLowerCase().split("-")[0];return R[e]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=at,window.lnCore.getLocaleFallback=lt,window.lnCore.ensureLocaleObserver=nt);const S={};function ot(t,e){S[t]||(S[t]=document.querySelector('[data-ln-template="'+t+'"]'));const n=S[t];return n?n.content.cloneNode(!0):(console.warn("["+(e||"ln-core")+'] Template "'+t+'" not found'),null)}function W(t,e){if(!t||!e)return t;const n=t.querySelectorAll("[data-ln-field]");for(let o=0;o<n.length;o++){const d=n[o],i=d.getAttribute("data-ln-field");e[i]!=null&&(d.textContent=e[i])}const a=t.querySelectorAll("[data-ln-attr]");for(let o=0;o<a.length;o++){const d=a[o],i=d.getAttribute("data-ln-attr").split(",");for(let s=0;s<i.length;s++){const c=i[s].trim().split(":");if(c.length!==2)continue;const u=c[0].trim(),f=c[1].trim();e[f]!=null&&d.setAttribute(u,e[f])}}const r=t.querySelectorAll("[data-ln-show]");for(let o=0;o<r.length;o++){const d=r[o],i=d.getAttribute("data-ln-show");i in e&&d.classList.toggle("hidden",!e[i])}const l=t.querySelectorAll("[data-ln-class]");for(let o=0;o<l.length;o++){const d=l[o],i=d.getAttribute("data-ln-class").split(",");for(let s=0;s<i.length;s++){const c=i[s].trim().split(":");if(c.length!==2)continue;const u=c[0].trim(),f=c[1].trim();f in e&&d.classList.toggle(u,!!e[f])}}return t}function rt(t,e){t.matches&&t.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",t,e??null),t.dispatchEvent(new CustomEvent("ln-fill",{detail:e??null,bubbles:!0})));const n=t.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let a=0;a<n.length;a++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[a],e??null),n[a].dispatchEvent(new CustomEvent("ln-fill",{detail:e??null,bubbles:!0}));return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(t){if(!(!t.target.matches||!t.target.matches("[data-ln-fillable]")))if(t.detail)W(t.target,t.detail);else{const e=t.target.querySelectorAll("[data-ln-field]");for(let n=0;n<e.length;n++)e[n].textContent=""}})));function j(t,e){if(!t||!e)return t;const n=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const l=n.currentNode;l.textContent.indexOf("{{")!==-1&&(l.textContent=l.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(o,d){return e[d]!==void 0?e[d]:""}))}const a=function(l,o){return e[o]!==void 0?e[o]:""},r=Array.from(t.querySelectorAll("*"));t.nodeType===1&&r.push(t);for(let l=0;l<r.length;l++){const o=r[l],d=o.attributes;for(let i=0;i<d.length;i++){const s=d[i];s.value.indexOf("{{")!==-1&&o.setAttribute(s.name,s.value.replace(/\{\{\s*(\w+)\s*\}\}/g,a))}}return t}function it(t,e,n,a,r,l){const o={};for(let i=0;i<t.children.length;i++){const s=t.children[i],c=s.getAttribute("data-ln-render-key");c&&(o[c]=s)}const d=document.createDocumentFragment();for(let i=0;i<e.length;i++){const s=e[i],c=String(a(s));let u=o[c];if(u)r(u,s,i);else{const f=ot(n,l);if(!f||(j(f,s),u=f.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",c),r(u,s,i)}d.appendChild(u)}t.textContent="",t.appendChild(d)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=j,window.lnCore.fill=W,window.lnCore.lnFill=rt,window.lnCore.renderList=it);function B(t,e,n,a,r){if(!t||e===null)return!0;const l=a||"ln-component",o=t.type;if(o==="trigger"||o==="marker"||o==="string"||o==="list"||!o||e===""&&t.fallback!==void 0)return!0;const d=i=>{r?console.warn(i,r):console.warn(i)};if(o==="boolean"){const i=e.trim().toLowerCase();return i!==""&&i!=="true"&&i!=="false"&&i!=="1"&&i!=="0"?(d(`[${l}] Invalid value "${e}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(o==="enum"){const i=t.values||[];return i.includes(e)?!0:(d(`[${l}] Invalid value "${e}" for attribute "${n}". Allowed: ${i.join(", ")}. Fallback: "${t.fallback}".`),!1)}if(o==="integer"){if(!/^-?\d+$/.test(e))return d(`[${l}] Invalid integer "${e}" for attribute "${n}". Fallback: ${t.fallback}.`),!1;const i=parseInt(e,10);return t.min!==void 0&&i<t.min?(d(`[${l}] Value ${i} for attribute "${n}" is less than min (${t.min}).`),!1):t.max!==void 0&&i>t.max?(d(`[${l}] Value ${i} for attribute "${n}" is greater than max (${t.max}).`),!1):!0}if(o==="float")return isNaN(Number(e))?(d(`[${l}] Invalid float "${e}" for attribute "${n}". Fallback: ${t.fallback}.`),!1):!0;if(o==="json")try{return JSON.parse(e),!0}catch(i){return d(`[${l}] Invalid JSON for attribute "${n}": ${i.message}. Fallback: ${t.fallback}.`),!1}return!0}function dt(t){const e={};for(const n in t){const a=t[n];a&&a.effect&&(e[n]=a.effect)}return Object.keys(e).length?e:null}function st(t){if(t.onAttrChange&&!t.declared)return null;const e=new Set;if(t.effects)for(const n in t.effects)e.add(n);if(t.onAttrChange&&t.declared)for(const n of t.declared)e.add(n);return e}function _(t,e,n,a){if(t.nodeType!==1)return;const l=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]",o=Array.from(t.querySelectorAll(l));t.matches&&t.matches(l)&&o.push(t);for(const d of o)if(!d[n]){window.lnCore._persistSink&&d.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(d,e);try{d[n]=new a(d)}catch(i){console.error("["+n+"] init failed",d,i)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function N(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function F(t){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(t):setTimeout(t,0)):t()}function V(){window.lnCore=window.lnCore||{};const t=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return t.byReactive=t.byReactive||new Map,t.reactiveWildcard=t.reactiveWildcard||[],t}function H(t){const e=V(),n=t.observed||[];for(let a=0;a<n.length;a++){const r=n[a];e.byAttr.has(r)||e.byAttr.set(r,[]),e.byAttr.get(r).push(t)}if(e.byDeclaredAttr=e.byDeclaredAttr||new Map,t.attributes)for(const a in t.attributes){e.byDeclaredAttr.has(a)||e.byDeclaredAttr.set(a,[]);const r=e.byDeclaredAttr.get(a);r.some(l=>l.componentTag===t.componentTag)||r.push({spec:t.attributes[a],componentTag:t.componentTag})}if(t.onAttrChange||t.effects){e.reactive.push(t);const a=st(t);if(a===null)e.reactiveWildcard.push(t);else for(const r of a)e.byReactive.has(r)||e.byReactive.set(r,[]),e.byReactive.get(r).push(t)}t.persist&&e.persist.push(t)}function U(t,e,n,a){for(let r=0;r<t.length;r++){const l=t[r];if(!e[l.attribute])continue;const o=l.effects&&l.effects[n];o?o(e,n,a):l.onAttrChange&&(!l.declared||l.declared.has(n))&&l.onAttrChange(e,n,a)}}function ct(t){const e=t.target,n=t.attributeName;if(t.oldValue===e.getAttribute(n))return;const a=V(),r=a.byAttr.get(n);if(L()&&a.byDeclaredAttr&&a.byDeclaredAttr.has(n)&&A(e)){const l=a.byDeclaredAttr.get(n),o=e.getAttribute(n);for(let d=0;d<l.length;d++)B(l[d].spec,o,n,l[d].componentTag,e)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||r)&&window.lnCore._debugSink("attr",n,e,{oldValue:t.oldValue,newValue:e.getAttribute(n)}),n.indexOf("data-ln-")===0){const l=a.byReactive.get(n);l&&U(l,e,n,t.oldValue),a.reactiveWildcard.length&&U(a.reactiveWildcard,e,n,t.oldValue)}if(r)for(let l=0;l<r.length;l++){const o=r[l];if(o.handler){o.handler(e,n,t.oldValue);continue}o.onAttributeChange&&e[o.attribute]?o.onAttributeChange(e,n):(_(e,o.selector,o.attribute,o.ComponentFn),o.onInit&&o.onInit(e))}}function z(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,p(function(){new MutationObserver(function(e){for(let n=0;n<e.length;n++)try{ct(e[n])}catch(a){console.error("[ln-core] mutation handler failed",e[n].target,a)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function G(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function ut(t){const e=G();if(e.length){if(t.target)for(let n=0;n<e.length;n++){const a=e[n];if(a.onSubtreeChange){const r=a.query,l=t.target.nodeType===1?t.target.matches(r)?t.target:t.target.closest(r):t.target.parentElement?t.target.parentElement.closest(r):null;l&&a.onSubtreeChange(l,t)}}for(let n=0;n<t.addedNodes.length;n++){const a=t.addedNodes[n];if(a.nodeType===1)for(let r=0;r<e.length;r++){const l=e[r];_(a,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(a)}}for(let n=0;n<t.removedNodes.length;n++){const a=t.removedNodes[n];if(a.nodeType===1)for(let r=0;r<e.length;r++){const l=e[r],o=l.query,d=Array.from(a.querySelectorAll(o));a.matches&&a.matches(o)&&d.push(a);for(let i=0;i<d.length;i++){const s=d[i];if(!document.contains(s)){const c=s[l.attribute];if(c&&typeof c.destroy=="function")try{c.destroy()}catch(u){console.error("["+l.attribute+"] destroy failed",s,u)}delete s[l.attribute]}}}}}}function ft(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,p(function(){new MutationObserver(function(e){for(let n=0;n<e.length;n++){const a=e[n];if(a.type==="childList")try{ut(a)}catch(r){console.error("[ln-core] lifecycle handler failed",a.target,r)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function wt(t,e){H({observed:t,handler:e}),z()}function bt(t,e,n,a,r={}){const l=r.extraAttributes||[],o=r.onAttributeChange||null,d=r.onSubtreeChange||null,i=r.onInit||null,s=r.onAttrChange||null,c=r.effects||null,u=r.attributes||null,f=u?dt(u):c,D=u?new Set(Object.keys(u)):null,qt=r.persist||null;function v(E){const w=E||document.body;if(_(w,t,e,n),u&&L())for(const g in u){const Mt=u[g],O=Array.from(w.querySelectorAll("["+g+"]"));w.matches&&w.matches("["+g+"]")&&O.push(w);for(let T=0;T<O.length;T++){const q=O[T];A(q)&&B(Mt,q.getAttribute(g),g,a,q)}}i&&i(w)}const I=[];if(t.indexOf("[")!==-1){const E=/\[([\w-]+)/g;let w;for(;(w=E.exec(t))!==null;)I.push(w[1])}else I.push(t);H({selector:t,attribute:e,componentTag:a,attributes:u,ComponentFn:n,onInit:i,observed:I.concat(l),onAttributeChange:o,onAttrChange:s,effects:f,declared:D,persist:qt}),z();const Lt=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]";G().push({selector:t,attribute:e,ComponentFn:n,onInit:i,onSubtreeChange:d,query:Lt}),ft(),window[e]=v;function X(){N()>0?F(function(){v(document.body)}):v(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",X):X(),v}function Q(t){return(t||"").replace(/^#/,"")}function k(t){const e=t===void 0?location.hash:t,n={},a=Q(e);if(!a)return n;const r=a.split("&");for(let l=0;l<r.length;l++){const o=r[l];if(!o)continue;const d=o.indexOf(":"),i=d>-1?o.slice(0,d):o,s=d>-1?o.slice(d+1):"";if(i)try{n[i]=decodeURIComponent(s)}catch{n[i]=s}}return n}function pt(t){if(!t)return null;const e=k();return t in e?e[t]:null}function ht(t,e){if(!t)return;const n=k();e==null?delete n[t]:n[t]=String(e);const r=Object.keys(n).map(function(l){const o=n[l];return o===""?l:l+":"+encodeURIComponent(o)}).join("&");Q(location.hash)!==r&&(location.hash=r)}function mt(t){return t.button===1||t.ctrlKey||t.metaKey||t.shiftKey?!1:(t.preventDefault(),!0)}function gt(t,e){if(!t||!t.hasAttribute("data-ln-hash"))return null;const n=t.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const a=t.getAttribute("data-ln-sort")||t.getAttribute("data-ln-search-for")||t.getAttribute("data-ln-search")||t.getAttribute("data-ln-filter")||t.id;return a?e?a+"-"+e:a:e||null}function yt(t,e){return!e||e==="none"||t===null||t===void 0?null:String(t)+"."+e}function Ct(t){return!t||typeof t!="string"?null:t.endsWith(".asc")?{fieldOrColumn:t.slice(0,-4),direction:"asc"}:t.endsWith(".desc")?{fieldOrColumn:t.slice(0,-5),direction:"desc"}:null}function vt(t,e){return!t||!Array.isArray(e)||e.length===0?null:t+":"+e.map(encodeURIComponent).join(",")}function At(t){if(!t||typeof t!="string")return null;const e=t.indexOf(":");if(e===-1)return null;const n=t.slice(0,e),a=t.slice(e+1),r=a?a.split(",").map(function(l){try{return decodeURIComponent(l)}catch{return l}}).filter(Boolean):[];return{key:n,values:r}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=k,window.lnCore.hashGet=pt,window.lnCore.hashSet=ht,window.lnCore.hashLinkClick=mt,window.lnCore.resolveHashNamespace=gt,window.lnCore.hashSortEncode=yt,window.lnCore.hashSortDecode=Ct,window.lnCore.hashFilterEncode=vt,window.lnCore.hashFilterDecode=At);const x=new Set(["data-ln-accordion","data-ln-ajax","data-ln-api-base-url","data-ln-api-connector","data-ln-api-connector-query-debounce","data-ln-api-headers","data-ln-api-param-limit","data-ln-api-param-offset","data-ln-api-param-search","data-ln-api-param-sort-dir","data-ln-api-param-sort-field","data-ln-api-path","data-ln-api-queue","data-ln-api-queue-online","data-ln-attr","data-ln-autoresize","data-ln-autosave","data-ln-autosave-clear","data-ln-autosave-debounce-input","data-ln-autosave-exclude","data-ln-chart","data-ln-chart-area","data-ln-chart-count","data-ln-chart-empty","data-ln-chart-labels","data-ln-chart-line","data-ln-chart-max","data-ln-chart-min","data-ln-chart-padding","data-ln-chart-plot","data-ln-chart-sort","data-ln-chart-source","data-ln-chart-type","data-ln-chart-x","data-ln-chart-y","data-ln-chart-zero","data-ln-circular-progress","data-ln-circular-progress-label","data-ln-circular-progress-max","data-ln-class","data-ln-col","data-ln-confirm","data-ln-confirm-active","data-ln-confirm-announcer","data-ln-confirm-idle","data-ln-confirm-state","data-ln-confirm-timeout","data-ln-couchdb-auth","data-ln-couchdb-connector","data-ln-couchdb-db","data-ln-couchdb-headers","data-ln-couchdb-url","data-ln-data-coordinator","data-ln-data-coordinator-dict","data-ln-data-coordinator-filters","data-ln-data-coordinator-mapper","data-ln-data-coordinator-no-autosync","data-ln-data-coordinator-scope","data-ln-data-coordinator-search","data-ln-data-coordinator-sort-direction","data-ln-data-coordinator-sort-field","data-ln-data-coordinator-stale","data-ln-data-store","data-ln-data-store-frozen","data-ln-data-store-indexes","data-ln-data-store-no-autosync","data-ln-data-store-no-local-query","data-ln-data-store-search-fields","data-ln-data-store-stale","data-ln-data-store-window","data-ln-data-store-window-page","data-ln-date","data-ln-date-dict","data-ln-date-dict-key","data-ln-date-field","data-ln-date-format","data-ln-date-label","data-ln-date-locale","data-ln-debug","data-ln-dropdown","data-ln-dropdown-menu","data-ln-dropdown-placement","data-ln-dropdown-position","data-ln-editor","data-ln-editor-action","data-ln-editor-source","data-ln-empty","data-ln-empty-state","data-ln-empty-when","data-ln-error","data-ln-external-link","data-ln-field","data-ln-fill-as","data-ln-fill-form","data-ln-fill-id","data-ln-fillable","data-ln-filter","data-ln-filter-col","data-ln-filter-hide","data-ln-filter-key","data-ln-filter-options","data-ln-filter-reset","data-ln-filter-search","data-ln-filter-value","data-ln-filter-values","data-ln-form","data-ln-form-action-edit","data-ln-form-action-method","data-ln-hash","data-ln-include","data-ln-item","data-ln-item-action","data-ln-item-id","data-ln-item-select","data-ln-key","data-ln-key-allow-input","data-ln-key-for","data-ln-key-modifier","data-ln-key-target","data-ln-link","data-ln-list","data-ln-list-body","data-ln-list-count","data-ln-list-empty","data-ln-list-field","data-ln-list-filtered","data-ln-list-select-all","data-ln-list-selectable","data-ln-list-selected","data-ln-list-source","data-ln-list-total","data-ln-list-window","data-ln-list-window-page","data-ln-list-window-threshold","data-ln-mapper","data-ln-modal","data-ln-modal-close","data-ln-modal-for","data-ln-modal-mode","data-ln-modal-when","data-ln-nav","data-ln-nav-exact","data-ln-number","data-ln-number-decimals","data-ln-number-max","data-ln-number-min","data-ln-obfuscator","data-ln-obfuscator-codec","data-ln-obfuscator-key","data-ln-options","data-ln-options-label","data-ln-options-value","data-ln-outlet","data-ln-panel","data-ln-persist","data-ln-persist-scope","data-ln-picklist","data-ln-picklist-list","data-ln-picklist-max","data-ln-popover","data-ln-popover-for","data-ln-popover-placement","data-ln-popover-position","data-ln-progress","data-ln-progress-max","data-ln-render-key","data-ln-route","data-ln-route-keep","data-ln-route-target","data-ln-route-title","data-ln-router-base","data-ln-router-hydrate","data-ln-scroll","data-ln-scroll-behavior","data-ln-scroll-block","data-ln-scroll-delay","data-ln-scroll-focus","data-ln-scroll-set","data-ln-scroll-update-hash","data-ln-search","data-ln-search-clear","data-ln-search-clear-for","data-ln-search-exclude","data-ln-search-fields","data-ln-search-for","data-ln-search-hide","data-ln-search-items","data-ln-show","data-ln-slug-from","data-ln-sort","data-ln-sort-dir","data-ln-sort-exclude","data-ln-sort-field","data-ln-sort-icon","data-ln-sort-items","data-ln-sort-state","data-ln-sortable","data-ln-sortable-handle","data-ln-stat","data-ln-stat-card","data-ln-stat-filter","data-ln-stat-label","data-ln-stat-trend","data-ln-stat-value","data-ln-step","data-ln-step-label","data-ln-stepper","data-ln-store","data-ln-tab","data-ln-table","data-ln-table-body","data-ln-table-cell-attr","data-ln-table-clear","data-ln-table-clear-all","data-ln-table-col","data-ln-table-col-filter","data-ln-table-col-select","data-ln-table-col-sort","data-ln-table-coordinator","data-ln-table-count","data-ln-table-dict","data-ln-table-empty","data-ln-table-empty-when","data-ln-table-filter-col","data-ln-table-filtered","data-ln-table-row","data-ln-table-row-action","data-ln-table-row-id","data-ln-table-row-select","data-ln-table-select-all-label","data-ln-table-selectable","data-ln-table-selected","data-ln-table-sort","data-ln-table-source","data-ln-table-total","data-ln-table-window","data-ln-table-window-page","data-ln-table-window-threshold","data-ln-tabs","data-ln-tabs-active","data-ln-tabs-default","data-ln-tabs-focus","data-ln-tabs-key","data-ln-template","data-ln-time","data-ln-time-locale","data-ln-toast","data-ln-toast-close","data-ln-toast-item","data-ln-toast-max","data-ln-toast-timeout","data-ln-toast-when","data-ln-toggle","data-ln-toggle-action","data-ln-toggle-for","data-ln-tooltip","data-ln-tooltip-enhance","data-ln-tooltip-enhanced","data-ln-tooltip-placement","data-ln-tooltip-position","data-ln-translatable","data-ln-translatable-lang","data-ln-translations","data-ln-translations-active","data-ln-translations-add","data-ln-translations-default","data-ln-translations-lang","data-ln-translations-locales","data-ln-translations-placeholder","data-ln-translations-prefix","data-ln-translations-remove-label","data-ln-ui-coordinator","data-ln-upload","data-ln-upload-accept","data-ln-upload-action","data-ln-upload-delete","data-ln-upload-dict","data-ln-upload-ext","data-ln-upload-file-field","data-ln-upload-id","data-ln-upload-ids-field","data-ln-upload-item","data-ln-upload-list","data-ln-upload-local-id","data-ln-upload-max-files","data-ln-upload-max-size","data-ln-upload-progress","data-ln-upload-size","data-ln-upload-state","data-ln-upload-zone","data-ln-validate","data-ln-validate-error","data-ln-validate-errors","data-ln-value","data-ln-websocket-connector","data-ln-websocket-connector-url"]);function St(t,e){if(t===e)return 0;if(!t.length)return e.length;if(!e.length)return t.length;const n=[];for(let a=0;a<=e.length;a++)n[a]=[a];for(let a=0;a<=t.length;a++)n[0][a]=a;for(let a=1;a<=e.length;a++)for(let r=1;r<=t.length;r++)e.charAt(a-1)===t.charAt(r-1)?n[a][r]=n[a-1][r-1]:n[a][r]=Math.min(n[a-1][r-1]+1,n[a][r-1]+1,n[a-1][r]+1);return n[e.length][t.length]}function _t(t,e=x){if(e.has(t))return null;let n=null,a=1/0;for(const l of e){const o=St(t,l);o<a&&(a=o,n=l)}const r=Math.max(3,Math.floor(t.length*.4));return a<=r?n:null}function K(t){return typeof CSS<"u"&&CSS.escape?CSS.escape(t):t.replace(/([!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~])/g,"\\$1")}function kt(t=document){const e=t.ownerDocument||t,n=t.nodeType===9?t.body||t.documentElement:t;if(!n)return[];const a=[],r=[n,...n.querySelectorAll("*")];for(let l=0;l<r.length;l++){const o=r[l];if(o.attributes)for(let d=0;d<o.attributes.length;d++){const i=o.attributes[d];if(i.name.startsWith("data-ln-")&&i.name.endsWith("-for")){const s=(i.value||"").trim();if(!s){a.push({type:"id-empty",element:o,attribute:i.name,targetId:"",message:`[ln-debug] Empty ID reference in <${o.tagName.toLowerCase()} ${i.name}="">.`});continue}e.getElementById(s)||e.querySelector("#"+K(s))||a.push({type:"id-unresolved",element:o,attribute:i.name,targetId:s,message:`[ln-debug] Unresolved ID reference: <${o.tagName.toLowerCase()} ${i.name}="${s}"> targets "#${s}", but no element with id="${s}" exists in the document.`})}}}return a}function xt(t=document){const e=t.ownerDocument||t,n=t.nodeType===9?t.body||t.documentElement:t;if(!n)return[];const a=[],r=[n,...n.querySelectorAll("*")];for(let l=0;l<r.length;l++){const o=r[l];if(o.attributes)for(let d=0;d<o.attributes.length;d++){const i=o.attributes[d];if(i.name.startsWith("data-ln-")&&(i.name.endsWith("-source")||i.name.endsWith("-store"))&&i.name!=="data-ln-data-store"){const c=(i.value||"").trim();if(!c){a.push({type:"store-empty",element:o,attribute:i.name,storeName:"",message:`[ln-debug] Empty store reference in <${o.tagName.toLowerCase()} ${i.name}="">.`});continue}const u=K(c),f=e.querySelector(`[data-ln-data-store="${u}"], [data-ln-store="${u}"]`),D=typeof window<"u"&&window.lnDataStore&&typeof window.lnDataStore.getStore=="function"&&window.lnDataStore.getStore(c);!f&&!D&&a.push({type:"store-unresolved",element:o,attribute:i.name,storeName:c,message:`[ln-debug] Unresolved store reference: <${o.tagName.toLowerCase()} ${i.name}="${c}"> targets store "${c}", but no [data-ln-data-store="${c}"] exists in the document.`})}}}return a}function $t(t=document){t.ownerDocument;const e=t.nodeType===9?t.body||t.documentElement:t;if(!e)return[];const n=[],a=Array.from(e.querySelectorAll("[data-ln-data-store]"));e.hasAttribute&&e.hasAttribute("data-ln-data-store")&&a.unshift(e);const r=new Map;for(let l=0;l<a.length;l++){const o=a[l],d=(o.getAttribute("data-ln-data-store")||"").trim();d&&(r.has(d)||r.set(d,[]),r.get(d).push(o))}for(const[l,o]of r.entries())o.length>1&&n.push({type:"store-duplicate",storeName:l,elements:o,message:`[ln-debug] Duplicate store name: Multiple elements declare data-ln-data-store="${l}". Store names must be unique across the document.`});return n}function Dt(t=document,e=x){const n=t.nodeType===9?t.body||t.documentElement:t;if(!n)return[];const a=[],r=[n,...n.querySelectorAll("*")];for(let l=0;l<r.length;l++){const o=r[l];if(o.attributes)for(let d=0;d<o.attributes.length;d++){const i=o.attributes[d];if(i.name.startsWith("data-ln-")&&!e.has(i.name)){const s=_t(i.name,e),c=s?` Did you mean "${s}"?`:"";a.push({type:"attribute-unknown",element:o,attribute:i.name,suggestion:s,message:`[ln-debug] Unknown attribute "${i.name}" on <${o.tagName.toLowerCase()}>.${c}`})}}}return a}function C(t=typeof document<"u"?document:null,e={}){if(!t)return{idIssues:[],storeIssues:[],uniquenessIssues:[],spellingIssues:[],total:0};const n=e.validAttributes||x,a=kt(t),r=xt(t),l=$t(t),o=Dt(t,n),d=[...a,...r,...l,...o];if(!e.silent)for(let i=0;i<d.length;i++)console.warn(d[i].message);return{idIssues:a,storeIssues:r,uniquenessIssues:l,spellingIssues:o,total:d.length}}let h=null;function m(t=typeof document<"u"?document:null,e=50,n=null){if(!t)return;h&&(clearTimeout(h),h=null);function a(){h=setTimeout(()=>{h=null;const r=C(t);n&&n(r)},e)}N()>0?F(a):a()}function It(t,e,n,a){t==="event"?(console.groupCollapsed("[ln-debug] event",e),console.log("target",n),console.log("detail",a),console.groupEnd()):t==="attr"&&(console.groupCollapsed("[ln-debug] attr",e),console.log("target",n),console.log("old → new",a.oldValue,"→",a.newValue),console.groupEnd())}let b=[];function Et(){b=Array.from(document.body.querySelectorAll("[data-ln-debug]")),document.body.hasAttribute("data-ln-debug")&&b.push(document.body)}function J(t){if(t===window||t===document)return b.indexOf(document.body)!==-1;for(let e=0;e<b.length;e++)if(b[e].contains(t))return!0;return!1}function Ot(t,e,n,a){J(n)&&It(t,e,n,a)}function $(){Et(),Y(b.length>0?Ot:null,b.length>0?J:null)}function P(){$()}function Tt(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._debugGateBound&&(window.lnCore._debugGateBound=!0,p(function(){$(),wt(["data-ln-debug"],$)},"ln-debug")))}return(function(){const t="data-ln-debug",e="lnDebug";if(typeof window<"u"&&window[e]!==void 0)return;const n={"data-ln-debug":{type:"marker",description:"Enables developer diagnostics overlay, live validation badges, and inspection logging"}};Tt();function a(l){return this.dom=l,m(l.ownerDocument||document),P(),this}a.prototype.verify=function(l,o){return C(l||(this.dom?this.dom.ownerDocument||this.dom:document),o)},a.prototype.destroy=function(){delete this.dom[e],P()};const r=bt(t,e,a,"ln-debug",{attributes:n,onInit:function(l){typeof document<"u"&&m(l&&l.ownerDocument?l.ownerDocument:document)},onSubtreeChange:function(l){typeof document<"u"&&m(l&&l.ownerDocument?l.ownerDocument:document)}});r.verify=function(l,o){return C(l||document,o)},r.schedule=function(l,o,d){return m(l||document,o,d)}})(),y.scheduleVerification=m,y.verifyDOM=C,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"}),y})({});
|
|
@@ -272,7 +272,6 @@ export const VALID_ATTRIBUTES = new Set([
|
|
|
272
272
|
'data-ln-translations-prefix',
|
|
273
273
|
'data-ln-translations-remove-label',
|
|
274
274
|
'data-ln-ui-coordinator',
|
|
275
|
-
'data-ln-ui-coordinator-dict',
|
|
276
275
|
'data-ln-upload',
|
|
277
276
|
'data-ln-upload-accept',
|
|
278
277
|
'data-ln-upload-action',
|
|
@@ -89,28 +89,31 @@ No payload attributes → `lnFill(form, null)` → form resets (calls `this.rese
|
|
|
89
89
|
|
|
90
90
|
---
|
|
91
91
|
|
|
92
|
-
## 4. Composing with `data-ln-modal-for`
|
|
92
|
+
## 4. Composing with `data-ln-modal-for` and `data-ln-modal-mode`
|
|
93
93
|
|
|
94
|
-
`ln-fill` intentionally does NOT call `e.preventDefault()`. A trigger may
|
|
95
|
-
carry both `data-ln-fill-form` and `data-ln-modal-for` — both document
|
|
96
|
-
listeners fire on the same click independently.
|
|
94
|
+
`ln-fill` intentionally does NOT call `e.preventDefault()`. A trigger may carry both `data-ln-fill-form` and `data-ln-modal-for` (as well as `data-ln-modal-mode="new|edit"`) — both document listeners fire on the same click independently. Triggers can be authored on `<button>` elements or `<a href="#...">` anchor links.
|
|
97
95
|
|
|
98
96
|
```html
|
|
99
|
-
<!-- One button
|
|
100
|
-
<button
|
|
97
|
+
<!-- One button opens the modal in "edit" mode AND fills the form -->
|
|
98
|
+
<button type="button"
|
|
101
99
|
data-ln-modal-for="event-modal"
|
|
100
|
+
data-ln-modal-mode="edit"
|
|
102
101
|
data-ln-fill-form="event-form"
|
|
103
102
|
data-ln-fill-event-id="42"
|
|
104
103
|
data-ln-fill-title="Annual Conference"
|
|
105
104
|
>Edit</button>
|
|
105
|
+
|
|
106
|
+
<!-- New button opens the modal in "new" mode AND resets the form -->
|
|
107
|
+
<button type="button"
|
|
108
|
+
data-ln-modal-for="event-modal"
|
|
109
|
+
data-ln-modal-mode="new"
|
|
110
|
+
data-ln-fill-form="event-form"
|
|
111
|
+
>New Event</button>
|
|
106
112
|
```
|
|
107
113
|
|
|
108
114
|
Order of side-effects per click (both listeners are on `document`):
|
|
109
|
-
1. `ln-modal` click listener → opens modal
|
|
110
|
-
2. `ln-fill` click listener →
|
|
111
|
-
|
|
112
|
-
### Double-Fill Prevention for Hash-Bound triggers
|
|
113
|
-
If a clickable trigger is an anchor link that points to a hash segment (i.e., its `href` attribute contains `#`, such as `<a href="#event-modal:42" ...>`), `ln-fill`'s click listener will **ignore** the click. The fill process is instead delegated entirely to the `ln-ui-coordinator`, which will map the resulting hash change and `ln-modal:open` event to an `ln-fill:request` event. This prevents redundant, parallel form-filling operations.
|
|
115
|
+
1. `ln-modal` click listener → transfers `data-ln-modal-mode` and opens modal (`data-ln-modal="open"`).
|
|
116
|
+
2. `ln-fill` click listener → extracts attributes and calls `lnCore.lnFill(form, record)` (or `lnFill(form, null)` when no attributes are present, resetting the form for "new" mode).
|
|
114
117
|
|
|
115
118
|
---
|
|
116
119
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function S(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 n=e.closest("[data-ln-debug]");return!(!n||typeof document<"u"&&n===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(...n){if(typeof n[0]=="string"&&(n[0].startsWith("[ln-")||n[0].startsWith("[lnCore"))){let u=null;for(let s=1;s<n.length;s++)if(n[s]&&n[s].nodeType===1){u=n[s];break}if(!S(u))return}e.apply(console,n)}}function A(e,n,r){const u=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",n,e,u),e.dispatchEvent(new CustomEvent(n,{bubbles:!0,detail:u}))}function p(e,n){if(!document.body){document.addEventListener("DOMContentLoaded",function(){p(e,n)}),console.warn("["+n+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}const C={};function _(e,n){C[e]=n}function k(e){return C[e]||{ingress:n=>n,egress:n=>n}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=_,window.lnCore.getDataMapper=k);function E(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,p(function(){new MutationObserver(function(){A(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const g={};function L(e,n){if(!e||typeof n!="object")return;const r=e.toLowerCase().split("-")[0];g[r]=n}function F(e){if(!e)return null;const n=e.toLowerCase().split("-")[0];return g[n]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=L,window.lnCore.getLocaleFallback=F,window.lnCore.ensureLocaleObserver=E);const w={};function v(e,n){w[e]||(w[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=w[e];return r?r.content.cloneNode(!0):(console.warn("["+(n||"ln-core")+'] Template "'+e+'" not found'),null)}function b(e,n){if(!e||!n)return e;const r=e.querySelectorAll("[data-ln-field]");for(let t=0;t<r.length;t++){const i=r[t],o=i.getAttribute("data-ln-field");n[o]!=null&&(i.textContent=n[o])}const u=e.querySelectorAll("[data-ln-attr]");for(let t=0;t<u.length;t++){const i=u[t],o=i.getAttribute("data-ln-attr").split(",");for(let c=0;c<o.length;c++){const d=o[c].trim().split(":");if(d.length!==2)continue;const f=d[0].trim(),a=d[1].trim();n[a]!=null&&i.setAttribute(f,n[a])}}const s=e.querySelectorAll("[data-ln-show]");for(let t=0;t<s.length;t++){const i=s[t],o=i.getAttribute("data-ln-show");o in n&&i.classList.toggle("hidden",!n[o])}const l=e.querySelectorAll("[data-ln-class]");for(let t=0;t<l.length;t++){const i=l[t],o=i.getAttribute("data-ln-class").split(",");for(let c=0;c<o.length;c++){const d=o[c].trim().split(":");if(d.length!==2)continue;const f=d[0].trim(),a=d[1].trim();a in n&&i.classList.toggle(f,!!n[a])}}return e}function
|
|
1
|
+
(function(){"use strict";function S(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 n=e.closest("[data-ln-debug]");return!(!n||typeof document<"u"&&n===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(...n){if(typeof n[0]=="string"&&(n[0].startsWith("[ln-")||n[0].startsWith("[lnCore"))){let u=null;for(let s=1;s<n.length;s++)if(n[s]&&n[s].nodeType===1){u=n[s];break}if(!S(u))return}e.apply(console,n)}}function A(e,n,r){const u=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",n,e,u),e.dispatchEvent(new CustomEvent(n,{bubbles:!0,detail:u}))}function p(e,n){if(!document.body){document.addEventListener("DOMContentLoaded",function(){p(e,n)}),console.warn("["+n+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}const C={};function _(e,n){C[e]=n}function k(e){return C[e]||{ingress:n=>n,egress:n=>n}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=_,window.lnCore.getDataMapper=k);function E(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,p(function(){new MutationObserver(function(){A(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const g={};function L(e,n){if(!e||typeof n!="object")return;const r=e.toLowerCase().split("-")[0];g[r]=n}function F(e){if(!e)return null;const n=e.toLowerCase().split("-")[0];return g[n]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=L,window.lnCore.getLocaleFallback=F,window.lnCore.ensureLocaleObserver=E);const w={};function v(e,n){w[e]||(w[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=w[e];return r?r.content.cloneNode(!0):(console.warn("["+(n||"ln-core")+'] Template "'+e+'" not found'),null)}function b(e,n){if(!e||!n)return e;const r=e.querySelectorAll("[data-ln-field]");for(let t=0;t<r.length;t++){const i=r[t],o=i.getAttribute("data-ln-field");n[o]!=null&&(i.textContent=n[o])}const u=e.querySelectorAll("[data-ln-attr]");for(let t=0;t<u.length;t++){const i=u[t],o=i.getAttribute("data-ln-attr").split(",");for(let c=0;c<o.length;c++){const d=o[c].trim().split(":");if(d.length!==2)continue;const f=d[0].trim(),a=d[1].trim();n[a]!=null&&i.setAttribute(f,n[a])}}const s=e.querySelectorAll("[data-ln-show]");for(let t=0;t<s.length;t++){const i=s[t],o=i.getAttribute("data-ln-show");o in n&&i.classList.toggle("hidden",!n[o])}const l=e.querySelectorAll("[data-ln-class]");for(let t=0;t<l.length;t++){const i=l[t],o=i.getAttribute("data-ln-class").split(",");for(let c=0;c<o.length;c++){const d=o[c].trim().split(":");if(d.length!==2)continue;const f=d[0].trim(),a=d[1].trim();a in n&&i.classList.toggle(f,!!n[a])}}return e}function D(e,n){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,n??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:n??null,bubbles:!0})));const r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let u=0;u<r.length;u++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[u],n??null),r[u].dispatchEvent(new CustomEvent("ln-fill",{detail:n??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)b(e.target,e.detail);else{const n=e.target.querySelectorAll("[data-ln-field]");for(let r=0;r<n.length;r++)n[r].textContent=""}})));function m(e,n){if(!e||!n)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const l=r.currentNode;l.textContent.indexOf("{{")!==-1&&(l.textContent=l.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(t,i){return n[i]!==void 0?n[i]:""}))}const u=function(l,t){return n[t]!==void 0?n[t]:""},s=Array.from(e.querySelectorAll("*"));e.nodeType===1&&s.push(e);for(let l=0;l<s.length;l++){const t=s[l],i=t.attributes;for(let o=0;o<i.length;o++){const c=i[o];c.value.indexOf("{{")!==-1&&t.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,u))}}return e}function x(e,n,r,u,s,l){const t={};for(let o=0;o<e.children.length;o++){const c=e.children[o],d=c.getAttribute("data-ln-render-key");d&&(t[d]=c)}const i=document.createDocumentFragment();for(let o=0;o<n.length;o++){const c=n[o],d=String(u(c));let f=t[d];if(f)s(f,c,o);else{const a=v(r,l);if(!a||(m(a,c),f=a.firstElementChild,!f))continue;f.setAttribute("data-ln-render-key",d),s(f,c,o)}i.appendChild(f)}e.textContent="",e.appendChild(i)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=m,window.lnCore.fill=b,window.lnCore.lnFill=D,window.lnCore.renderList=x),typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function y(e){return(e||"").replace(/^#/,"")}function h(e){const n=e===void 0?location.hash:e,r={},u=y(n);if(!u)return r;const s=u.split("&");for(let l=0;l<s.length;l++){const t=s[l];if(!t)continue;const i=t.indexOf(":"),o=i>-1?t.slice(0,i):t,c=i>-1?t.slice(i+1):"";if(o)try{r[o]=decodeURIComponent(c)}catch{r[o]=c}}return r}function O(e){if(!e)return null;const n=h();return e in n?n[e]:null}function B(e,n){if(!e)return;const r=h();n==null?delete r[e]:r[e]=String(n);const s=Object.keys(r).map(function(l){const t=r[l];return t===""?l:l+":"+encodeURIComponent(t)}).join("&");y(location.hash)!==s&&(location.hash=s)}function I(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function T(e,n){if(!e||!e.hasAttribute("data-ln-hash"))return null;const r=e.getAttribute("data-ln-hash");if(r&&r.trim()!=="")return r.trim();const u=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return u?n?u+"-"+n:u:n||null}function q(e,n){return!n||n==="none"||e===null||e===void 0?null:String(e)+"."+n}function W(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 M(e,n){return!e||!Array.isArray(n)||n.length===0?null:e+":"+n.map(encodeURIComponent).join(",")}function j(e){if(!e||typeof e!="string")return null;const n=e.indexOf(":");if(n===-1)return null;const r=e.slice(0,n),u=e.slice(n+1),s=u?u.split(",").map(function(l){try{return decodeURIComponent(l)}catch{return l}}).filter(Boolean):[];return{key:r,values:s}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=h,window.lnCore.hashGet=O,window.lnCore.hashSet=B,window.lnCore.hashLinkClick=I,window.lnCore.resolveHashNamespace=T,window.lnCore.hashSortEncode=q,window.lnCore.hashSortDecode=W,window.lnCore.hashFilterEncode=M,window.lnCore.hashFilterDecode=j),(function(){const e="lnFill";if(window[e]!==void 0)return;const n={lnFillForm:!0,lnFillStore:!0};function r(s){const l={},t=s.dataset;for(const i in t){if(!i.startsWith("lnFill")||n[i])continue;const o=i.slice(6);o&&(l[o.charAt(0).toLowerCase()+o.slice(1)]=t[i])}return l}function u(s,l){const t=window.CSS&&CSS.escape?CSS.escape(l):l,i=document.querySelectorAll('[data-ln-fill-id="'+t+'"]');if(i.length===0)return null;for(let o=0;o<i.length;o++){const c=i[o].getAttribute("data-ln-fill-form");if(c){const d=document.getElementById(c);if(d&&s.contains(d))return i[o]}}return i[0]}document.addEventListener("click",function(s){if(s.ctrlKey||s.metaKey||s.button===1)return;const l=s.target.closest("[data-ln-fill-form]");if(!l)return;const t=l.getAttribute("data-ln-fill-form"),i=document.getElementById(t);if(!i)return;const o=r(l),c=Object.keys(o).length>0;window.lnCore.lnFill(i,c?o:null)}),document.addEventListener("ln-fill:request",function(s){const l=s.detail;if(!l)return;const t=s.target,i=l.id;if(i==null){window.lnCore.lnFill(t,null);return}const o=u(t,i);if(!o)return;const c=r(o);window.lnCore.lnFill(t,c)}),window[e]=!0})()})();
|
|
@@ -50,12 +50,6 @@ import { } from '../../ln-core';
|
|
|
50
50
|
const trigger = e.target.closest('[data-ln-fill-form]');
|
|
51
51
|
if (!trigger) return;
|
|
52
52
|
|
|
53
|
-
// Prevent double fill: if this trigger is a hash-bound anchor (e.g. href="#user-modal:142"),
|
|
54
|
-
// we skip the click-based fill. The resulting hash change will trigger ln-modal:open,
|
|
55
|
-
// and the ln-ui-coordinator will request the fill via ln-fill:request.
|
|
56
|
-
const href = trigger.getAttribute('href');
|
|
57
|
-
if (href && href.indexOf('#') !== -1) return;
|
|
58
|
-
|
|
59
53
|
// No e.preventDefault() — the same click may also be handled by
|
|
60
54
|
// [data-ln-modal-for] listener in ln-modal. Leave it alone.
|
|
61
55
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Applied to a `<dialog data-ln-modal id="...">`, paired with a `<button data-ln-modal-for="...">` and dismiss buttons (`data-ln-modal-close`).
|
|
4
4
|
> On trigger `click`, it sets `data-ln-modal="open"`, calls `dialog.showModal()`, and adds `.ln-modal-open` to `document.body`.
|
|
5
|
-
> On dismiss `click
|
|
5
|
+
> On dismiss `click` or native `Escape`, it sets `data-ln-modal="close"`, calls `dialog.close()`, and removes `.ln-modal-open`.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -24,15 +24,33 @@ In `ln-ashlar`, the core design principle is **Three-Layer Architecture** and **
|
|
|
24
24
|
Triggers and modals are paired by ID. The overlay has `class="ln-modal"` and `data-ln-modal`.
|
|
25
25
|
|
|
26
26
|
```html
|
|
27
|
-
<!-- Trigger
|
|
28
|
-
<button
|
|
27
|
+
<!-- Trigger: New (opens modal in "new" mode and resets form) -->
|
|
28
|
+
<button type="button"
|
|
29
|
+
data-ln-modal-for="user-modal"
|
|
30
|
+
data-ln-modal-mode="new"
|
|
31
|
+
data-ln-fill-form="user-form">
|
|
32
|
+
Add User
|
|
33
|
+
</button>
|
|
34
|
+
|
|
35
|
+
<!-- Trigger: Edit (opens modal in "edit" mode and fills form) -->
|
|
36
|
+
<button type="button"
|
|
37
|
+
data-ln-modal-for="user-modal"
|
|
38
|
+
data-ln-modal-mode="edit"
|
|
39
|
+
data-ln-fill-form="user-form"
|
|
40
|
+
data-ln-fill-id="42"
|
|
41
|
+
data-ln-fill-name="Ada Lovelace">
|
|
42
|
+
Edit User
|
|
43
|
+
</button>
|
|
29
44
|
|
|
30
45
|
<!-- Modal overlay -->
|
|
31
|
-
<dialog class="ln-modal" data-ln-modal id="user-modal">
|
|
32
|
-
<form>
|
|
33
|
-
<!-- Header -->
|
|
46
|
+
<dialog class="ln-modal" data-ln-modal data-ln-modal-mode="new" id="user-modal">
|
|
47
|
+
<form id="user-form" data-ln-form>
|
|
48
|
+
<!-- Header with mode-conditional title -->
|
|
34
49
|
<header>
|
|
35
|
-
<h3
|
|
50
|
+
<h3 data-ln-fillable>
|
|
51
|
+
<span data-ln-modal-when="new">Add User</span>
|
|
52
|
+
<span data-ln-modal-when="edit">Edit User — <span data-ln-field="name"></span></span>
|
|
53
|
+
</h3>
|
|
36
54
|
<button type="button" data-ln-modal-close aria-label="Close">
|
|
37
55
|
<svg class="ln-icon" aria-hidden="true"><use href="#ln-icon-x"></use></svg>
|
|
38
56
|
</button>
|
|
@@ -40,6 +58,7 @@ Triggers and modals are paired by ID. The overlay has `class="ln-modal"` and `da
|
|
|
40
58
|
|
|
41
59
|
<!-- Scrollable content -->
|
|
42
60
|
<main>
|
|
61
|
+
<input type="hidden" name="id">
|
|
43
62
|
<label>Name <input type="text" name="name" autofocus></label>
|
|
44
63
|
</main>
|
|
45
64
|
|
|
@@ -54,7 +73,8 @@ Triggers and modals are paired by ID. The overlay has `class="ln-modal"` and `da
|
|
|
54
73
|
|
|
55
74
|
### Key Anatomy Rules
|
|
56
75
|
- **The Overlay (`data-ln-modal`)**: Driven by the value `"open"` (open) and `"close"` (closed).
|
|
57
|
-
- **The Trigger (`data-ln-modal-for="id"`)**: Placed on buttons/links to
|
|
76
|
+
- **The Trigger (`data-ln-modal-for="id"`)**: Placed on buttons/links to open target modal directly.
|
|
77
|
+
- **The Mode Switch (`data-ln-modal-mode="new|edit"`)**: Transferred from trigger to modal on click. Displays child elements with matching `[data-ln-modal-when="new|edit"]`. Automatically resets to `"new"` upon closing.
|
|
58
78
|
- **The Dismiss button (`data-ln-modal-close`)**: Placed on cancel or close buttons to request close.
|
|
59
79
|
- **Focus Override (`autofocus`)**: Place on any form field to override default focus placement on open.
|
|
60
80
|
|
|
@@ -87,6 +107,7 @@ const isOpen = modal.lnModal.isOpen; // Returns true/false
|
|
|
87
107
|
### Attributes
|
|
88
108
|
- `data-ln-modal`: Placed on the overlay element. Value `"open"` = open; `"close"` = closed.
|
|
89
109
|
- `data-ln-modal-for="id"`: Placed on trigger elements referencing the modal ID.
|
|
110
|
+
- `data-ln-modal-mode="new|edit"`: Placed on trigger elements or modal dialog to specify mode (toggles `[data-ln-modal-when="new|edit"]` child elements).
|
|
90
111
|
- `data-ln-modal-close`: Placed on any close trigger inside the modal.
|
|
91
112
|
|
|
92
113
|
---
|
|
@@ -163,11 +184,11 @@ Coordinators (such as `ln-ui-coordinator`) intercept hash changes and coordinate
|
|
|
163
184
|
|
|
164
185
|
## 🔧 Internals
|
|
165
186
|
|
|
166
|
-
Source: `components/ln-modal/src/ln-modal.js` (
|
|
187
|
+
Source: `components/ln-modal/src/ln-modal.js` (native `<dialog>`-backed). `ln-modal` operates autonomously: trigger buttons (`data-ln-modal-for`), dismiss buttons (`data-ln-modal-close`), and native ESC cancellation are handled directly by the component without requiring external coordinators. Mode switching (`data-ln-modal-mode="new|edit"`) is synchronized declaratively from triggers to modal dialogs.
|
|
167
188
|
|
|
168
189
|
### Single source of truth
|
|
169
190
|
|
|
170
|
-
`data-ln-modal` is the only state. `_syncAttribute(el)` (wired via `registerComponent`'s `onAttributeChange`) is the sole place open/close side effects happen —
|
|
191
|
+
`data-ln-modal` is the only state. `_syncAttribute(el)` (wired via `registerComponent`'s `onAttributeChange`) is the sole place open/close side effects happen — instance methods like `open()`, `close()`, and `toggle()` set the attribute directly. Cancellation is attribute-revert: if `ln-modal:before-open`/`before-close` is prevented, the handler writes the attribute back to its prior value, which the same no-op guard (`shouldBeOpen === instance.isOpen`) swallows on the resulting mutation.
|
|
171
192
|
|
|
172
193
|
### Open / close
|
|
173
194
|
|
|
@@ -181,8 +202,8 @@ Not a custom keydown listener — the native `<dialog>` fires its own `cancel` e
|
|
|
181
202
|
|
|
182
203
|
### Trigger/close wiring
|
|
183
204
|
|
|
184
|
-
|
|
205
|
+
`ln-modal` registers delegated document click handling for `[data-ln-modal-for="id"]` triggers, opening the target modal autonomously. Inside the modal, dismiss clicks (`[data-ln-modal-close]`) set `data-ln-modal="close"`. The instance also listens for `ln-modal:request-open`/`request-close` on the modal element itself.
|
|
185
206
|
|
|
186
207
|
### Destroy
|
|
187
208
|
|
|
188
|
-
Removes
|
|
209
|
+
Removes command listeners (`request-open`, `request-close`, `cancel`, `click`), unregisters the global trigger listener when all instances are removed, releases the body scroll-lock class if this was the last open modal, and deletes the instance.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function x(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function C(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 l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){r=t[l];break}if(!C(r))return}e.apply(console,t)}}function b(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 I(e,t,n){const r=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,r);const l=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});return e.dispatchEvent(l),l}function p(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){p(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function y(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}const $={};function V(e,t){$[e]=t}function H(e){return $[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=V,window.lnCore.getDataMapper=H);function U(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,p(function(){new MutationObserver(function(){b(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const D={};function Q(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];D[n]=t}function K(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return D[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=Q,window.lnCore.getLocaleFallback=K,window.lnCore.ensureLocaleObserver=U);const A={};function P(e,t){A[e]||(A[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=A[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function R(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let i=0;i<n.length;i++){const d=n[i],s=d.getAttribute("data-ln-field");t[s]!=null&&(d.textContent=t[s])}const r=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<r.length;i++){const d=r[i],s=d.getAttribute("data-ln-attr").split(",");for(let c=0;c<s.length;c++){const u=s[c].trim().split(":");if(u.length!==2)continue;const a=u[0].trim(),f=u[1].trim();t[f]!=null&&d.setAttribute(a,t[f])}}const l=e.querySelectorAll("[data-ln-show]");for(let i=0;i<l.length;i++){const d=l[i],s=d.getAttribute("data-ln-show");s in t&&d.classList.toggle("hidden",!t[s])}const o=e.querySelectorAll("[data-ln-class]");for(let i=0;i<o.length;i++){const d=o[i],s=d.getAttribute("data-ln-class").split(",");for(let c=0;c<s.length;c++){const u=s[c].trim().split(":");if(u.length!==2)continue;const a=u[0].trim(),f=u[1].trim();f in t&&d.classList.toggle(a,!!t[f])}}return e}function G(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)R(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 T(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const o=n.currentNode;o.textContent.indexOf("{{")!==-1&&(o.textContent=o.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(i,d){return t[d]!==void 0?t[d]:""}))}const r=function(o,i){return t[i]!==void 0?t[i]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let o=0;o<l.length;o++){const i=l[o],d=i.attributes;for(let s=0;s<d.length;s++){const c=d[s];c.value.indexOf("{{")!==-1&&i.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function J(e,t,n,r,l,o){const i={};for(let s=0;s<e.children.length;s++){const c=e.children[s],u=c.getAttribute("data-ln-render-key");u&&(i[u]=c)}const d=document.createDocumentFragment();for(let s=0;s<t.length;s++){const c=t[s],u=String(r(c));let a=i[u];if(a)l(a,c,s);else{const f=P(n,o);if(!f||(T(f,c),a=f.firstElementChild,!a))continue;a.setAttribute("data-ln-render-key",u),l(a,c,s)}d.appendChild(a)}e.textContent="",e.appendChild(d)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=T,window.lnCore.fill=R,window.lnCore.lnFill=G,window.lnCore.renderList=J);function M(e,t,n,r,l){if(!e||t===null)return!0;const o=r||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const d=s=>{l?console.warn(s,l):console.warn(s)};if(i==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(d(`[${o}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(i==="enum"){const s=e.values||[];return s.includes(t)?!0:(d(`[${o}] Invalid value "${t}" for attribute "${n}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(i==="integer"){if(!/^-?\d+$/.test(t))return d(`[${o}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(d(`[${o}] Value ${s} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(d(`[${o}] Value ${s} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(i==="float")return isNaN(Number(t))?(d(`[${o}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(i==="json")try{return JSON.parse(t),!0}catch(s){return d(`[${o}] Invalid JSON for attribute "${n}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function X(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 z(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}function v(e,t,n,r){if(e.nodeType!==1)return;const o=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i=Array.from(e.querySelectorAll(o));e.matches&&e.matches(o)&&i.push(e);for(const d of i)if(!d[n]){window.lnCore._persistSink&&d.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(d,t);try{d[n]=new r(d)}catch(s){console.error("["+n+"] init failed",d,s)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Y(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Z(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 F(){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 ee(e){const t=F(),n=e.observed||[];for(let r=0;r<n.length;r++){const l=n[r];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).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 l=t.byDeclaredAttr.get(r);l.some(o=>o.componentTag===e.componentTag)||l.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=z(e);if(r===null)t.reactiveWildcard.push(e);else for(const l of r)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function B(e,t,n,r){for(let l=0;l<e.length;l++){const o=e[l];if(!t[o.attribute])continue;const i=o.effects&&o.effects[n];i?i(t,n,r):o.onAttrChange&&(!o.declared||o.declared.has(n))&&o.onAttrChange(t,n,r)}}function te(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const r=F(),l=r.byAttr.get(n);if(x()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(n)&&C(t)){const o=r.byDeclaredAttr.get(n),i=t.getAttribute(n);for(let d=0;d<o.length;d++)M(o[d].spec,i,n,o[d].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||l)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const o=r.byReactive.get(n);o&&B(o,t,n,e.oldValue),r.reactiveWildcard.length&&B(r.reactiveWildcard,t,n,e.oldValue)}if(l)for(let o=0;o<l.length;o++){const i=l[o];if(i.handler){i.handler(t,n,e.oldValue);continue}i.onAttributeChange&&t[i.attribute]?i.onAttributeChange(t,n):(v(t,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(t))}}function ne(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,p(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{te(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 W(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function oe(e){const t=W();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const r=t[n];if(r.onSubtreeChange){const l=r.query,o=e.target.nodeType===1?e.target.matches(l)?e.target:e.target.closest(l):e.target.parentElement?e.target.parentElement.closest(l):null;o&&r.onSubtreeChange(o,e)}}for(let n=0;n<e.addedNodes.length;n++){const r=e.addedNodes[n];if(r.nodeType===1)for(let l=0;l<t.length;l++){const o=t[l];v(r,o.selector,o.attribute,o.ComponentFn),o.onInit&&o.onInit(r)}}for(let n=0;n<e.removedNodes.length;n++){const r=e.removedNodes[n];if(r.nodeType===1)for(let l=0;l<t.length;l++){const o=t[l],i=o.query,d=Array.from(r.querySelectorAll(i));r.matches&&r.matches(i)&&d.push(r);for(let s=0;s<d.length;s++){const c=d[s];if(!document.contains(c)){const u=c[o.attribute];if(u&&typeof u.destroy=="function")try{u.destroy()}catch(a){console.error("["+o.attribute+"] destroy failed",c,a)}delete c[o.attribute]}}}}}}function re(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,p(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.type==="childList")try{oe(r)}catch(l){console.error("[ln-core] lifecycle handler failed",r.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function ie(e,t,n,r,l={}){const o=l.extraAttributes||[],i=l.onAttributeChange||null,d=l.onSubtreeChange||null,s=l.onInit||null,c=l.onAttrChange||null,u=l.effects||null,a=l.attributes||null,f=a?X(a):u,S=a?new Set(Object.keys(a)):null,g=l.persist||null;function m(O){const w=O||document.body;if(v(w,e,t,n),a&&x())for(const h in a){const be=a[h],L=Array.from(w.querySelectorAll("["+h+"]"));w.matches&&w.matches("["+h+"]")&&L.push(w);for(let E=0;E<L.length;E++){const q=L[E];C(q)&&M(be,q.getAttribute(h),h,r,q)}}s&&s(w)}const k=[];if(e.indexOf("[")!==-1){const O=/\[([\w-]+)/g;let w;for(;(w=O.exec(e))!==null;)k.push(w[1])}else k.push(e);ee({selector:e,attribute:t,componentTag:r,attributes:a,ComponentFn:n,onInit:s,observed:k.concat(o),onAttributeChange:i,onAttrChange:c,effects:f,declared:S,persist:g}),ne();const he=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";W().push({selector:e,attribute:t,ComponentFn:n,onInit:s,onSubtreeChange:d,query:he}),re(),window[t]=m;function N(){Y()>0?Z(function(){m(document.body)}):m(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",N):N(),m}function j(e){return(e||"").replace(/^#/,"")}function _(e){const t=e===void 0?location.hash:e,n={},r=j(t);if(!r)return n;const l=r.split("&");for(let o=0;o<l.length;o++){const i=l[o];if(!i)continue;const d=i.indexOf(":"),s=d>-1?i.slice(0,d):i,c=d>-1?i.slice(d+1):"";if(s)try{n[s]=decodeURIComponent(c)}catch{n[s]=c}}return n}function le(e){if(!e)return null;const t=_();return e in t?t[e]:null}function se(e,t){if(!e)return;const n=_();t==null?delete n[e]:n[e]=String(t);const l=Object.keys(n).map(function(o){const i=n[o];return i===""?o:o+":"+encodeURIComponent(i)}).join("&");j(location.hash)!==l&&(location.hash=l)}function de(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function ce(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 ue(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function ae(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 fe(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function we(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),l=r?r.split(",").map(function(o){try{return decodeURIComponent(o)}catch{return o}}).filter(Boolean):[];return{key:n,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=_,window.lnCore.hashGet=le,window.lnCore.hashSet=se,window.lnCore.hashLinkClick=de,window.lnCore.resolveHashNamespace=ce,window.lnCore.hashSortEncode=ue,window.lnCore.hashSortDecode=ae,window.lnCore.hashFilterEncode=fe,window.lnCore.hashFilterDecode=we),(function(){const e="data-ln-modal",t="lnModal";if(window[t]!==void 0)return;const n={"data-ln-modal":{type:"enum",values:["open","close"],fallback:"close",effect:l,description:"Control state of the modal dialog"},"data-ln-modal-close":{type:"trigger",description:"Click dismiss trigger inside the modal"}};function r(o){this.dom=o,this.isOpen=o.getAttribute(e)==="open";const i=this;return this._onRequestOpen=function(){i.dom.setAttribute(e,"open")},this._onRequestClose=function(){i.dom.setAttribute(e,"close")},this._onCancel=function(d){d.preventDefault(),i.dom.setAttribute(e,"close")},this._onClickClose=function(d){const s=d.target.closest("[data-ln-modal-close]");s&&i.dom.contains(s)&&(d.preventDefault(),i.dom.setAttribute(e,"close"))},this.dom.addEventListener("ln-modal:request-open",this._onRequestOpen),this.dom.addEventListener("ln-modal:request-close",this._onRequestClose),this.dom.addEventListener("cancel",this._onCancel),this.dom.addEventListener("click",this._onClickClose),this.isOpen&&(typeof this.dom.showModal=="function"&&this.dom.showModal(),document.body.classList.add("ln-modal-open"),b(this.dom,"ln-modal:open",{modalId:this.dom.id,target:this.dom})),this}r.prototype.open=function(){this.dom.setAttribute(e,"open")},r.prototype.close=function(){this.dom.setAttribute(e,"close")},r.prototype.toggle=function(){const o=this.dom.getAttribute(e);this.dom.setAttribute(e,o==="open"?"close":"open")},r.prototype.destroy=function(){if(this.dom[t]){if(this.dom.removeEventListener("ln-modal:request-open",this._onRequestOpen),this.dom.removeEventListener("ln-modal:request-close",this._onRequestClose),this.dom.removeEventListener("cancel",this._onCancel),this.dom.removeEventListener("click",this._onClickClose),this.isOpen){const o=this.dom;Array.prototype.some.call(document.querySelectorAll("["+e+'="open"]'),function(d){return d!==o})||document.body.classList.remove("ln-modal-open")}delete this.dom[t]}};function l(o){const i=o[t];if(!i)return;const s=o.getAttribute(e)==="open";if(s!==i.isOpen)if(s){if(I(o,"ln-modal:before-open",{modalId:o.id,target:o}).defaultPrevented){o.setAttribute(e,"close");return}i.isOpen=!0,document.body.classList.add("ln-modal-open"),typeof o.showModal=="function"&&o.showModal();const u=o.querySelector("[autofocus]");if(u&&y(u))u.focus();else{const a=o.querySelectorAll('input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), select:not([disabled])'),f=Array.prototype.find.call(a,y);if(f)f.focus();else{const S=o.querySelectorAll("a[href], button:not([disabled])"),g=Array.prototype.find.call(S,y);g&&g.focus()}}b(o,"ln-modal:open",{modalId:o.id,target:o})}else{if(I(o,"ln-modal:before-close",{modalId:o.id,target:o}).defaultPrevented){o.setAttribute(e,"open");return}i.isOpen=!1,b(o,"ln-modal:close",{modalId:o.id,target:o}),typeof o.close=="function"&&o.close(),document.querySelector("["+e+'="open"]')||document.body.classList.remove("ln-modal-open")}}ie(e,t,r,"ln-modal",{attributes:n})})()})();
|
|
1
|
+
(function(){"use strict";function x(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function k(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 l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){o=t[l];break}if(!k(o))return}e.apply(console,t)}}function y(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 R(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o);const l=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:o});return e.dispatchEvent(l),l}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 S(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}function K(e){return!!(!e||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||typeof e.button=="number"&&e.button!==0)}function U(e){return!!(!e||e.disabled||typeof e.getAttribute=="function"&&e.getAttribute("aria-disabled")==="true"||typeof e.closest=="function"&&e.closest("[inert]"))}const D={};function G(e,t){D[e]=t}function Q(e){return D[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=G,window.lnCore.getDataMapper=Q);function P(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,A(function(){new MutationObserver(function(){y(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const $={};function J(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];$[n]=t}function z(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return $[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=J,window.lnCore.getLocaleFallback=z,window.lnCore.ensureLocaleObserver=P);const O={};function X(e,t){O[e]||(O[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=O[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function M(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let r=0;r<n.length;r++){const c=n[r],s=c.getAttribute("data-ln-field");t[s]!=null&&(c.textContent=t[s])}const o=e.querySelectorAll("[data-ln-attr]");for(let r=0;r<o.length;r++){const c=o[r],s=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<s.length;u++){const f=s[u].trim().split(":");if(f.length!==2)continue;const d=f[0].trim(),a=f[1].trim();t[a]!=null&&c.setAttribute(d,t[a])}}const l=e.querySelectorAll("[data-ln-show]");for(let r=0;r<l.length;r++){const c=l[r],s=c.getAttribute("data-ln-show");s in t&&c.classList.toggle("hidden",!t[s])}const i=e.querySelectorAll("[data-ln-class]");for(let r=0;r<i.length;r++){const c=i[r],s=c.getAttribute("data-ln-class").split(",");for(let u=0;u<s.length;u++){const f=s[u].trim().split(":");if(f.length!==2)continue;const d=f[0].trim(),a=f[1].trim();a in t&&c.classList.toggle(d,!!t[a])}}return e}function Y(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)M(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 B(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const i=n.currentNode;i.textContent.indexOf("{{")!==-1&&(i.textContent=i.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(r,c){return t[c]!==void 0?t[c]:""}))}const o=function(i,r){return t[r]!==void 0?t[r]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let i=0;i<l.length;i++){const r=l[i],c=r.attributes;for(let s=0;s<c.length;s++){const u=c[s];u.value.indexOf("{{")!==-1&&r.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function Z(e,t,n,o,l,i){const r={};for(let s=0;s<e.children.length;s++){const u=e.children[s],f=u.getAttribute("data-ln-render-key");f&&(r[f]=u)}const c=document.createDocumentFragment();for(let s=0;s<t.length;s++){const u=t[s],f=String(o(u));let d=r[f];if(d)l(d,u,s);else{const a=X(n,i);if(!a||(B(a,u),d=a.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",f),l(d,u,s)}c.appendChild(d)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=B,window.lnCore.fill=M,window.lnCore.lnFill=Y,window.lnCore.renderList=Z);function F(e,t,n,o,l){if(!e||t===null)return!0;const i=o||"ln-component",r=e.type;if(r==="trigger"||r==="marker"||r==="string"||r==="list"||!r||t===""&&e.fallback!==void 0)return!0;const c=s=>{l?console.warn(s,l):console.warn(s)};if(r==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(c(`[${i}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(r==="enum"){const s=e.values||[];return s.includes(t)?!0:(c(`[${i}] Invalid value "${t}" for attribute "${n}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(r==="integer"){if(!/^-?\d+$/.test(t))return c(`[${i}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(c(`[${i}] Value ${s} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(c(`[${i}] Value ${s} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(r==="float")return isNaN(Number(t))?(c(`[${i}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(r==="json")try{return JSON.parse(t),!0}catch(s){return c(`[${i}] Invalid JSON for attribute "${n}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function ee(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 te(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}function E(e,t,n,o){if(e.nodeType!==1)return;const i=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",r=Array.from(e.querySelectorAll(i));e.matches&&e.matches(i)&&r.push(e);for(const c of r)if(!c[n]){window.lnCore._persistSink&&c.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(c,t);try{c[n]=new o(c)}catch(s){console.error("["+n+"] init failed",c,s)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ne(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function oe(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 W(){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 re(e){const t=W(),n=e.observed||[];for(let o=0;o<n.length;o++){const l=n[o];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).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 l=t.byDeclaredAttr.get(o);l.some(i=>i.componentTag===e.componentTag)||l.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=te(e);if(o===null)t.reactiveWildcard.push(e);else for(const l of o)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function j(e,t,n,o){for(let l=0;l<e.length;l++){const i=e[l];if(!t[i.attribute])continue;const r=i.effects&&i.effects[n];r?r(t,n,o):i.onAttrChange&&(!i.declared||i.declared.has(n))&&i.onAttrChange(t,n,o)}}function ie(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const o=W(),l=o.byAttr.get(n);if(x()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(n)&&k(t)){const i=o.byDeclaredAttr.get(n),r=t.getAttribute(n);for(let c=0;c<i.length;c++)F(i[c].spec,r,n,i[c].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||l)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const i=o.byReactive.get(n);i&&j(i,t,n,e.oldValue),o.reactiveWildcard.length&&j(o.reactiveWildcard,t,n,e.oldValue)}if(l)for(let i=0;i<l.length;i++){const r=l[i];if(r.handler){r.handler(t,n,e.oldValue);continue}r.onAttributeChange&&t[r.attribute]?r.onAttributeChange(t,n):(E(t,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(t))}}function le(){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{ie(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 N(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function se(e){const t=N();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const o=t[n];if(o.onSubtreeChange){const l=o.query,i=e.target.nodeType===1?e.target.matches(l)?e.target:e.target.closest(l):e.target.parentElement?e.target.parentElement.closest(l):null;i&&o.onSubtreeChange(i,e)}}for(let n=0;n<e.addedNodes.length;n++){const o=e.addedNodes[n];if(o.nodeType===1)for(let l=0;l<t.length;l++){const i=t[l];E(o,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(o)}}for(let n=0;n<e.removedNodes.length;n++){const o=e.removedNodes[n];if(o.nodeType===1)for(let l=0;l<t.length;l++){const i=t[l],r=i.query,c=Array.from(o.querySelectorAll(r));o.matches&&o.matches(r)&&c.push(o);for(let s=0;s<c.length;s++){const u=c[s];if(!document.contains(u)){const f=u[i.attribute];if(f&&typeof f.destroy=="function")try{f.destroy()}catch(d){console.error("["+i.attribute+"] destroy failed",u,d)}delete u[i.attribute]}}}}}}function de(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,A(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{se(o)}catch(l){console.error("[ln-core] lifecycle handler failed",o.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function ce(e,t,n,o,l={}){const i=l.extraAttributes||[],r=l.onAttributeChange||null,c=l.onSubtreeChange||null,s=l.onInit||null,u=l.onAttrChange||null,f=l.effects||null,d=l.attributes||null,a=d?ee(d):f,b=d?new Set(Object.keys(d)):null,w=l.persist||null;function m(g){const h=g||document.body;if(E(h,e,t,n),d&&x())for(const C in d){const ge=d[C],I=Array.from(h.querySelectorAll("["+C+"]"));h.matches&&h.matches("["+C+"]")&&I.push(h);for(let q=0;q<I.length;q++){const T=I[q];k(T)&&F(ge,T.getAttribute(C),C,o,T)}}s&&s(h)}const p=[];if(e.indexOf("[")!==-1){const g=/\[([\w-]+)/g;let h;for(;(h=g.exec(e))!==null;)p.push(h[1])}else p.push(e);re({selector:e,attribute:t,componentTag:o,attributes:d,ComponentFn:n,onInit:s,observed:p.concat(i),onAttributeChange:r,onAttrChange:u,effects:a,declared:b,persist:w}),le();const _=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";N().push({selector:e,attribute:t,ComponentFn:n,onInit:s,onSubtreeChange:c,query:_}),de(),window[t]=m;function v(){ne()>0?oe(function(){m(document.body)}):m(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",v):v(),m}function V(e){return(e||"").replace(/^#/,"")}function L(e){const t=e===void 0?location.hash:e,n={},o=V(t);if(!o)return n;const l=o.split("&");for(let i=0;i<l.length;i++){const r=l[i];if(!r)continue;const c=r.indexOf(":"),s=c>-1?r.slice(0,c):r,u=c>-1?r.slice(c+1):"";if(s)try{n[s]=decodeURIComponent(u)}catch{n[s]=u}}return n}function ue(e){if(!e)return null;const t=L();return e in t?t[e]:null}function ae(e,t){if(!e)return;const n=L();t==null?delete n[e]:n[e]=String(t);const l=Object.keys(n).map(function(i){const r=n[i];return r===""?i:i+":"+encodeURIComponent(r)}).join("&");V(location.hash)!==l&&(location.hash=l)}function fe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function we(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 be(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function he(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 pe(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function me(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),l=o?o.split(",").map(function(i){try{return decodeURIComponent(i)}catch{return i}}).filter(Boolean):[];return{key:n,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=L,window.lnCore.hashGet=ue,window.lnCore.hashSet=ae,window.lnCore.hashLinkClick=fe,window.lnCore.resolveHashNamespace=we,window.lnCore.hashSortEncode=be,window.lnCore.hashSortDecode=he,window.lnCore.hashFilterEncode=pe,window.lnCore.hashFilterDecode=me),(function(){const e="data-ln-modal",t="lnModal",n="data-ln-modal-for",o="data-ln-modal-close";if(window[t]!==void 0)return;const l={"data-ln-modal":{type:"enum",values:["open","close"],fallback:"close",effect:f,description:"Control state of the modal dialog"},"data-ln-modal-for":{type:"string",description:"Target modal ID to open on trigger click"},"data-ln-modal-mode":{type:"enum",values:["new","edit"],fallback:"new",description:"Operational mode of the modal (new vs edit)"},"data-ln-modal-close":{type:"trigger",description:"Click dismiss trigger inside the modal"}},i=new Set;let r=null;function c(){r||(r=function(d){if(K(d))return;const a=d.target.closest("["+n+"]");if(!a||U(a))return;const b=a.getAttribute(n);if(!b)return;const w=document.getElementById(b)||document.querySelector("["+e+'="'+b+'"]');!w||!w[t]||(d.preventDefault(),a.hasAttribute("data-ln-modal-mode")?w.setAttribute("data-ln-modal-mode",a.getAttribute("data-ln-modal-mode")):w.hasAttribute("data-ln-modal-mode")&&w.setAttribute("data-ln-modal-mode","new"),w.setAttribute(e,"open"))},document.addEventListener("click",r))}function s(){i.size>0||!r||(document.removeEventListener("click",r),r=null)}function u(d){this.dom=d,this.isOpen=d.getAttribute(e)==="open";const a=this;return this._onRequestOpen=function(){a.dom.setAttribute(e,"open")},this._onRequestClose=function(){a.dom.setAttribute(e,"close")},this._onCancel=function(b){b.preventDefault(),a.dom.setAttribute(e,"close")},this._onClickClose=function(b){const w=b.target.closest("["+o+"]");w&&a.dom.contains(w)&&(b.preventDefault(),a.dom.setAttribute(e,"close"))},this.dom.addEventListener("ln-modal:request-open",this._onRequestOpen),this.dom.addEventListener("ln-modal:request-close",this._onRequestClose),this.dom.addEventListener("cancel",this._onCancel),this.dom.addEventListener("click",this._onClickClose),i.add(this),c(),this.isOpen&&(typeof this.dom.showModal=="function"&&this.dom.showModal(),document.body.classList.add("ln-modal-open"),y(this.dom,"ln-modal:open",{modalId:this.dom.id,target:this.dom})),this}u.prototype.open=function(){this.dom.setAttribute(e,"open")},u.prototype.close=function(){this.dom.setAttribute(e,"close")},u.prototype.toggle=function(){const d=this.dom.getAttribute(e);this.dom.setAttribute(e,d==="open"?"close":"open")},u.prototype.destroy=function(){if(this.dom[t]){if(this.dom.removeEventListener("ln-modal:request-open",this._onRequestOpen),this.dom.removeEventListener("ln-modal:request-close",this._onRequestClose),this.dom.removeEventListener("cancel",this._onCancel),this.dom.removeEventListener("click",this._onClickClose),i.delete(this),s(),this.isOpen){const d=this.dom;Array.prototype.some.call(document.querySelectorAll("["+e+'="open"]'),function(b){return b!==d})||document.body.classList.remove("ln-modal-open")}delete this.dom[t]}};function f(d){const a=d[t];if(!a)return;const w=d.getAttribute(e)==="open";if(w!==a.isOpen)if(w){if(R(d,"ln-modal:before-open",{modalId:d.id,target:d}).defaultPrevented){d.setAttribute(e,"close");return}a.isOpen=!0,document.body.classList.add("ln-modal-open"),typeof d.showModal=="function"&&d.showModal();const p=d.querySelector("[autofocus]");if(p&&S(p))p.focus();else{const H=d.querySelectorAll('input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), select:not([disabled])'),_=Array.prototype.find.call(H,S);if(_)_.focus();else{const v=d.querySelectorAll("a[href], button:not([disabled])"),g=Array.prototype.find.call(v,S);g&&g.focus()}}y(d,"ln-modal:open",{modalId:d.id,target:d})}else{if(R(d,"ln-modal:before-close",{modalId:d.id,target:d}).defaultPrevented){d.setAttribute(e,"open");return}a.isOpen=!1,d.hasAttribute("data-ln-modal-mode")&&d.setAttribute("data-ln-modal-mode","new"),y(d,"ln-modal:close",{modalId:d.id,target:d}),typeof d.close=="function"&&d.close(),document.querySelector("["+e+'="open"]')||document.body.classList.remove("ln-modal-open")}}ce(e,t,u,"ln-modal",{attributes:l})})()})();
|
|
@@ -33,16 +33,27 @@
|
|
|
33
33
|
"description": "Click dismiss trigger inside the modal"
|
|
34
34
|
},
|
|
35
35
|
"data-ln-modal-for": {
|
|
36
|
-
"direction":
|
|
36
|
+
"direction": "author",
|
|
37
37
|
"sources": [
|
|
38
|
-
"ln-modal-dev.scss"
|
|
39
|
-
|
|
38
|
+
"ln-modal-dev.scss",
|
|
39
|
+
"src/ln-modal.js"
|
|
40
|
+
],
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "Target modal ID to open on trigger click"
|
|
40
43
|
},
|
|
41
44
|
"data-ln-modal-mode": {
|
|
42
|
-
"direction":
|
|
45
|
+
"direction": "both",
|
|
43
46
|
"sources": [
|
|
44
|
-
"ln-modal.scss"
|
|
45
|
-
|
|
47
|
+
"ln-modal.scss",
|
|
48
|
+
"src/ln-modal.js"
|
|
49
|
+
],
|
|
50
|
+
"type": "enum",
|
|
51
|
+
"values": [
|
|
52
|
+
"new",
|
|
53
|
+
"edit"
|
|
54
|
+
],
|
|
55
|
+
"fallback": "new",
|
|
56
|
+
"description": "Operational mode of the modal (new vs edit)"
|
|
46
57
|
},
|
|
47
58
|
"data-ln-modal-when": {
|
|
48
59
|
"direction": null,
|