@livenetworks/ashlar 2.0.9 → 2.0.10
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-accordion/ln-accordion.js +1 -1
- package/components/ln-api-connector/ln-api-connector.js +1 -1
- package/components/ln-api-queue/ln-api-queue.js +1 -1
- package/components/ln-autoresize/ln-autoresize.js +1 -1
- package/components/ln-autosave/ln-autosave.js +1 -1
- package/components/ln-chart/ln-chart.js +1 -1
- package/components/ln-circular-progress/ln-circular-progress.js +1 -1
- package/components/ln-confirm/ln-confirm.js +1 -1
- package/components/ln-core/lifecycle.js +1 -1
- package/components/ln-couchdb-connector/ln-couchdb-connector.js +1 -1
- package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
- package/components/ln-data-store/ln-data-store.js +1 -1
- package/components/ln-date/ln-date.js +1 -1
- package/components/ln-debug/ln-debug.js +1 -1
- package/components/ln-debug/src/generated-attributes.js +1 -0
- package/components/ln-dropdown/ln-dropdown.js +1 -1
- package/components/ln-editor/ln-editor.js +1 -1
- package/components/ln-filter/ln-filter.js +1 -1
- package/components/ln-filter/ln-filter.schema.json +161 -153
- package/components/ln-filter/src/ln-filter.js +77 -5
- package/components/ln-form/ln-form.js +1 -1
- package/components/ln-include/ln-include.js +1 -1
- package/components/ln-key/ln-key.js +1 -1
- package/components/ln-list/ln-list.js +1 -1
- package/components/ln-modal/ln-modal.js +1 -1
- package/components/ln-nav/ln-nav.js +1 -1
- package/components/ln-number/ln-number.js +1 -1
- package/components/ln-obfuscator/ln-obfuscator.js +1 -1
- package/components/ln-options/ln-options.js +1 -1
- package/components/ln-picklist/ln-picklist.js +1 -1
- package/components/ln-popover/ln-popover.js +1 -1
- package/components/ln-progress/ln-progress.js +1 -1
- package/components/ln-router/ln-router.js +1 -1
- package/components/ln-scroll/ln-scroll.js +1 -1
- package/components/ln-search/ln-search.js +1 -1
- package/components/ln-search/src/ln-search.js +17 -1
- package/components/ln-slug/ln-slug.js +1 -1
- package/components/ln-sort/ln-sort.js +1 -1
- package/components/ln-sortable/ln-sortable.js +1 -1
- package/components/ln-stat/ln-stat.js +1 -1
- package/components/ln-table/ln-table.js +1 -1
- package/components/ln-table-coordinator/ln-table-coordinator.js +1 -1
- package/components/ln-tabs/ln-tabs.js +1 -1
- package/components/ln-time/ln-time.js +1 -1
- package/components/ln-toast/ln-toast.js +1 -1
- package/components/ln-toggle/ln-toggle.js +1 -1
- package/components/ln-tooltip/ln-tooltip.js +1 -1
- package/components/ln-translations/ln-translations.js +1 -1
- package/components/ln-ui-coordinator/ln-ui-coordinator.js +1 -1
- package/components/ln-upload/ln-upload.js +1 -1
- package/components/ln-validate/ln-validate.js +1 -1
- package/components/ln-websocket-connector/ln-websocket-connector.js +1 -1
- package/ln-ashlar.html-data.json +5 -0
- package/package.json +1 -1
- package/web-types.json +8 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function N(){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 x(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let s=1;s<t.length;s++)if(t[s]&&t[s].nodeType===1){o=t[s];break}if(!x(o))return}e.apply(console,t)}}function m(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 k(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){k(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function Z(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ee(e,t){const n=!!(t&&t.typed),o=t&&t.exclude,s={},l=e.elements,i={};if(n)for(let d=0;d<l.length;d++){const r=l[d];r.name&&r.type==="checkbox"&&!r.disabled&&(i[r.name]=(i[r.name]||0)+1)}for(let d=0;d<l.length;d++){const r=l[d];if(!(!r.name||r.disabled||r.type==="file"||r.type==="submit"||r.type==="button")&&!(o&&r.matches&&r.matches(o)))if(r.type==="checkbox")n&&i[r.name]===1?s[r.name]=r.checked:(s[r.name]||(s[r.name]=[]),r.checked&&s[r.name].push(r.value));else if(r.type==="radio")r.checked&&(s[r.name]=r.value);else if(r.type==="select-multiple"){s[r.name]=[];for(let u=0;u<r.options.length;u++)r.options[u].selected&&s[r.name].push(r.options[u].value)}else if(n&&r.type==="hidden")s[r.name]=r.value;else if(n&&(r.type==="number"||r.type==="range")){const u=Number(r.value);s[r.name]=r.value===""||isNaN(u)?null:u}else s[r.name]=r.value}return s}function te(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ne(e,t){const n=e.elements,o=[],s={};for(let l=0;l<n.length;l++){const i=n[l];i.name&&i.type==="checkbox"&&(s[i.name]=(s[i.name]||0)+1)}for(let l=0;l<n.length;l++){const i=n[l];if(i.type==="file"||i.type==="submit"||i.type==="button")continue;const d=i.getAttribute("data-ln-fill-as")||i.name;if(!d||!(d in t))continue;const r=t[d];if(i.type==="checkbox"){if(Array.isArray(r))i.checked=r.indexOf(i.value)!==-1;else if(s[i.name]>1){const u=String(r).split(",").map(function(p){return p.trim()});i.checked=u.indexOf(i.value)!==-1}else i.checked=te(r);o.push(i)}else if(i.type==="radio")i.checked=i.value===String(r),o.push(i);else if(i.type==="select-multiple"){if(Array.isArray(r))for(let u=0;u<i.options.length;u++)i.options[u].selected=r.indexOf(i.options[u].value)!==-1;o.push(i)}else i.value=r,i.tagName==="SELECT"&&r!=null&&i.setAttribute("data-ln-value",r),o.push(i)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ne,window.lnCore.serializeForm=ee,window.lnCore.resolveFormMethod=Z);const M={};function oe(e,t){M[e]=t}function re(e){return M[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=oe,window.lnCore.getDataMapper=re);function ie(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,k(function(){new MutationObserver(function(){m(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const D={};function se(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];D[n]=t}function le(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=se,window.lnCore.getLocaleFallback=le,window.lnCore.ensureLocaleObserver=ie);const S={};function ce(e,t){S[e]||(S[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=S[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function $(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],r=d.getAttribute("data-ln-field");t[r]!=null&&(d.textContent=t[r])}const o=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<o.length;i++){const d=o[i],r=d.getAttribute("data-ln-attr").split(",");for(let u=0;u<r.length;u++){const p=r[u].trim().split(":");if(p.length!==2)continue;const f=p[0].trim(),c=p[1].trim();t[c]!=null&&d.setAttribute(f,t[c])}}const s=e.querySelectorAll("[data-ln-show]");for(let i=0;i<s.length;i++){const d=s[i],r=d.getAttribute("data-ln-show");r in t&&d.classList.toggle("hidden",!t[r])}const l=e.querySelectorAll("[data-ln-class]");for(let i=0;i<l.length;i++){const d=l[i],r=d.getAttribute("data-ln-class").split(",");for(let u=0;u<r.length;u++){const p=r[u].trim().split(":");if(p.length!==2)continue;const f=p[0].trim(),c=p[1].trim();c in t&&d.classList.toggle(f,!!t[c])}}return e}function de(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)$(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 F(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const l=n.currentNode;l.textContent.indexOf("{{")!==-1&&(l.textContent=l.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(i,d){return t[d]!==void 0?t[d]:""}))}const o=function(l,i){return t[i]!==void 0?t[i]:""},s=Array.from(e.querySelectorAll("*"));e.nodeType===1&&s.push(e);for(let l=0;l<s.length;l++){const i=s[l],d=i.attributes;for(let r=0;r<d.length;r++){const u=d[r];u.value.indexOf("{{")!==-1&&i.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function ae(e,t,n,o,s,l){const i={};for(let r=0;r<e.children.length;r++){const u=e.children[r],p=u.getAttribute("data-ln-render-key");p&&(i[p]=u)}const d=document.createDocumentFragment();for(let r=0;r<t.length;r++){const u=t[r],p=String(o(u));let f=i[p];if(f)s(f,u,r);else{const c=ce(n,l);if(!c||(F(c,u),f=c.firstElementChild,!f))continue;f.setAttribute("data-ln-render-key",p),s(f,u,r)}d.appendChild(f)}e.textContent="",e.appendChild(d)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=F,window.lnCore.fill=$,window.lnCore.lnFill=de,window.lnCore.renderList=ae);function A(e,t,n){const o=e.getAttribute(t);return o===null?n:o}function B(e,t,n){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?n:o}function j(e,t,n=!1){const o=e.getAttribute(t);if(o===null)return!!n;const s=o.trim().toLowerCase();return!(s==="false"||s==="0")}function W(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const O=new Map;function U(e,t){const n=(e?e.join("|"):"")+"::"+t;if(O.has(n))return O.get(n);const o=new Set(e||[]),s=function(l,i){const d=l.getAttribute(i);return d!==null&&o.has(d)?d:t};return O.set(n,s),s}function K(e,t,n){const o=parseFloat(e.getAttribute(t));return isNaN(o)?n:o}function V(e,t,n){const o=e.getAttribute(t);if(!o)return n;try{return JSON.parse(o)}catch{return n}}function H(e,t,n,o,s){if(!e||t===null)return!0;const l=o||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const d=r=>{s?console.warn(r,s):console.warn(r)};if(i==="boolean"){const r=t.trim().toLowerCase();return r!==""&&r!=="true"&&r!=="false"&&r!=="1"&&r!=="0"?(d(`[${l}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(i==="enum"){const r=e.values||[];return r.includes(t)?!0:(d(`[${l}] Invalid value "${t}" for attribute "${n}". Allowed: ${r.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(i==="integer"){if(!/^-?\d+$/.test(t))return d(`[${l}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const r=parseInt(t,10);return e.min!==void 0&&r<e.min?(d(`[${l}] Value ${r} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&r>e.max?(d(`[${l}] Value ${r} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(i==="float")return isNaN(Number(t))?(d(`[${l}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(i==="json")try{return JSON.parse(t),!0}catch(r){return d(`[${l}] Invalid JSON for attribute "${n}": ${r.message}. Fallback: ${e.fallback}.`),!1}return!0}function J(e,t,n){for(const o in n){const[s,l,i]=n[o];Object.defineProperty(e,o,{get:function(){return s(t,l,i)},enumerable:!0,configurable:!0})}return e}function P(e){const t={};for(const n in e){const o=e[n];if(!o||!o.prop)continue;let s=o.read;if(!s&&o.type)switch(o.type){case"enum":s=U(o.values,o.fallback);break;case"integer":s=B;break;case"float":s=K;break;case"boolean":s=j;break;case"list":s=W;break;case"json":s=V;break;case"string":default:s=A;break}s||(s=A),t[o.prop]=[s,n,o.fallback]}return t}function ue(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 fe(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=J,window.lnCore.attrSpec=P,window.lnCore.attrStr=A,window.lnCore.attrInt=B,window.lnCore.attrBool=j,window.lnCore.attrList=W,window.lnCore.attrEnum=U,window.lnCore.attrFloat=K,window.lnCore.attrJson=V);function q(e,t,n,o){if(e.nodeType!==1)return;const l=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i=Array.from(e.querySelectorAll(l));e.matches&&e.matches(l)&&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 o(d)}catch(r){console.error("["+n+"] init failed",d,r)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function we(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function he(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 Q(){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 pe(e){const t=Q(),n=e.observed||[];for(let o=0;o<n.length;o++){const s=n[o];t.byAttr.has(s)||t.byAttr.set(s,[]),t.byAttr.get(s).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 s=t.byDeclaredAttr.get(o);s.some(l=>l.componentTag===e.componentTag)||s.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=fe(e);if(o===null)t.reactiveWildcard.push(e);else for(const s of o)t.byReactive.has(s)||t.byReactive.set(s,[]),t.byReactive.get(s).push(e)}e.persist&&t.persist.push(e)}function G(e,t,n,o){for(let s=0;s<e.length;s++){const l=e[s];if(!t[l.attribute])continue;const i=l.effects&&l.effects[n];i?i(t,n,o):l.onAttrChange&&(!l.declared||l.declared.has(n))&&l.onAttrChange(t,n,o)}}function be(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const o=Q(),s=o.byAttr.get(n);if(N()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(n)&&x(t)){const l=o.byDeclaredAttr.get(n),i=t.getAttribute(n);for(let d=0;d<l.length;d++)H(l[d].spec,i,n,l[d].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||s)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const l=o.byReactive.get(n);l&&G(l,t,n,e.oldValue),o.reactiveWildcard.length&&G(o.reactiveWildcard,t,n,e.oldValue)}if(s)for(let l=0;l<s.length;l++){const i=s[l];if(i.handler){i.handler(t,n,e.oldValue);continue}i.onAttributeChange&&t[i.attribute]?i.onAttributeChange(t,n):(q(t,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(t))}}function me(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,k(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{be(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 z(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function ge(e){const t=z();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const o=t[n];if(o.onSubtreeChange){const s=o.query,l=e.target.nodeType===1?e.target.matches(s)?e.target:e.target.closest(s):e.target.parentElement?e.target.parentElement.closest(s):null;l&&o.onSubtreeChange(l,e)}}for(let n=0;n<e.addedNodes.length;n++){const o=e.addedNodes[n];if(o.nodeType===1)for(let s=0;s<t.length;s++){const l=t[s];q(o,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(o)}}for(let n=0;n<e.removedNodes.length;n++){const o=e.removedNodes[n];if(o.nodeType===1)for(let s=0;s<t.length;s++){const l=t[s],i=l.query,d=Array.from(o.querySelectorAll(i));o.matches&&o.matches(i)&&d.push(o);for(let r=0;r<d.length;r++){const u=d[r];if(!document.contains(u)){const p=u[l.attribute];if(p&&typeof p.destroy=="function")try{p.destroy()}catch(f){console.error("["+l.attribute+"] destroy failed",u,f)}delete u[l.attribute]}}}}}}function ye(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,k(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{ge(o)}catch(s){console.error("[ln-core] lifecycle handler failed",o.target,s)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function X(e,t,n,o,s={}){const l=s.extraAttributes||[],i=s.onAttributeChange||null,d=s.onSubtreeChange||null,r=s.onInit||null,u=s.onAttrChange||null,p=s.effects||null,f=s.attributes||null,c=f?ue(f):p,a=f?new Set(Object.keys(f)):null,w=s.persist||null;function h(I){const g=I||document.body;if(q(g,e,t,n),f&&N())for(const _ in f){const Ee=f[_],L=Array.from(g.querySelectorAll("["+_+"]"));g.matches&&g.matches("["+_+"]")&&L.push(g);for(let R=0;R<L.length;R++){const T=L[R];x(T)&&H(Ee,T.getAttribute(_),_,o,T)}}r&&r(g)}const b=[];if(e.indexOf("[")!==-1){const I=/\[([\w-]+)/g;let g;for(;(g=I.exec(e))!==null;)b.push(g[1])}else b.push(e);pe({selector:e,attribute:t,componentTag:o,attributes:f,ComponentFn:n,onInit:r,observed:b.concat(l),onAttributeChange:i,onAttrChange:u,effects:c,declared:a,persist:w}),me();const v=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";z().push({selector:e,attribute:t,ComponentFn:n,onInit:r,onSubtreeChange:d,query:v}),ye(),window[t]=h,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=X);function C(){we()>0?he(function(){h(document.body)}):h(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",C):C(),h}function Y(e){return(e||"").replace(/^#/,"")}function E(e){const t=e===void 0?location.hash:e,n={},o=Y(t);if(!o)return n;const s=o.split("&");for(let l=0;l<s.length;l++){const i=s[l];if(!i)continue;const d=i.indexOf(":"),r=d>-1?i.slice(0,d):i,u=d>-1?i.slice(d+1):"";if(r)try{n[r]=decodeURIComponent(u)}catch{n[r]=u}}return n}function Ce(e){if(!e)return null;const t=E();return e in t?t[e]:null}function _e(e,t){if(!e)return;const n=E();t==null?delete n[e]:n[e]=String(t);const s=Object.keys(n).map(function(l){const i=n[l];return i===""?l:l+":"+encodeURIComponent(i)}).join("&");Y(location.hash)!==s&&(location.hash=s)}function ke(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Ae(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 ve(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function xe(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 Se(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Oe(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),s=o?o.split(",").map(function(l){try{return decodeURIComponent(l)}catch{return l}}).filter(Boolean):[];return{key:n,values:s}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=E,window.lnCore.hashGet=Ce,window.lnCore.hashSet=_e,window.lnCore.hashLinkClick=ke,window.lnCore.resolveHashNamespace=Ae,window.lnCore.hashSortEncode=ve,window.lnCore.hashSortDecode=xe,window.lnCore.hashFilterEncode=Se,window.lnCore.hashFilterDecode=Oe);function qe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=qe),(function(){const e="data-ln-websocket-connector",t="lnWebsocketConnector",n="lnConnector";if(window[t]!==void 0)return;const o=1e3,s=3e4;function l(c){const a=c[t];a&&(a.command==="connect"?a._open():a._disconnect())}function i(c){const a=c[t];!a||a.command!=="connect"||(a._drop("url-changed"),a._open())}const d={"data-ln-websocket-connector":{prop:"command",type:"enum",values:["connect","disconnect"],fallback:"connect",effect:l,description:"Connection command set from outside: connect or disconnect"},"data-ln-websocket-connector-url":{prop:"url",read:A,type:"string",fallback:"",effect:i,description:"WebSocket endpoint URL (ws:// or wss://)"}},r=P(d),u={"ln-websocket-connector:request-sync":"sync","ln-websocket-connector:request-query":"query","ln-websocket-connector:request-create":"create","ln-websocket-connector:request-update":"update","ln-websocket-connector:request-delete":"delete","ln-websocket-connector:request-bulk-delete":"bulk-delete"};function p(c,a){return c==="sync"?{since:a.since}:c==="query"?{query:a.query||{}}:c==="create"?{data:a.data,idempotencyKey:a.idempotencyKey}:c==="update"?{id:a.id,data:a.data,expected_version:a.expected_version,idempotencyKey:a.idempotencyKey}:c==="delete"?{id:a.id,idempotencyKey:a.idempotencyKey}:{ids:a.ids,idempotencyKey:a.idempotencyKey}}function f(c){this.dom=c,J(this,c,r),c[t]=this,c[n]=this,this.namespace="ln-websocket-connector",this._socket=null,this._status="disconnected",this._attempt=0,this._timer=null,this._seq=0,this._pending=new Map,this._held=[];const a=this;this._onRequest=function(w){a._request(u[w.type],w.detail||{})};for(const w in u)c.addEventListener(w,this._onRequest);return this.command==="connect"&&this._open(),this}f.prototype._open=function(){if(this._socket||this._timer)return;const c=this,a=this.url;this._attempt++,this._status="connecting",m(this.dom,"ln-websocket-connector:connecting",{url:a,attempt:this._attempt});let w;try{w=new WebSocket(a)}catch(h){this._status="disconnected",this._attempt=0,this._failAll(this._held,h.message),this._held=[],m(this.dom,"ln-websocket-connector:disconnected",{url:a,code:0,reason:h.message,willReconnect:!1});return}this._socket=w,w.onopen=function(){c._status="connected",c._attempt=0,m(c.dom,"ln-websocket-connector:connected",{url:a});const h=c._held;c._held=[];for(let b=0;b<h.length;b++)c._send(h[b])},w.onmessage=function(h){c._receive(h.data)},w.onclose=function(h){c._socket=null,c._status="disconnected",c._failPending("connection closed");const b=c.command==="connect";m(c.dom,"ln-websocket-connector:disconnected",{url:a,code:h.code,reason:h.reason,willReconnect:b}),b&&c._scheduleReconnect()}},f.prototype._scheduleReconnect=function(){const c=this,a=Math.min(o*Math.pow(2,Math.max(0,this._attempt-1)),s);this._timer=setTimeout(function(){c._timer=null,c._open()},a)},f.prototype._drop=function(c){const a=!!(this._socket||this._timer);clearTimeout(this._timer),this._timer=null,this._attempt=0,this._socket&&(this._socket.onopen=this._socket.onmessage=this._socket.onclose=null,this._socket.close(1e3,c),this._socket=null),a&&(this._status="disconnected",this._failPending("connection closed"),m(this.dom,"ln-websocket-connector:disconnected",{url:this.url,code:1e3,reason:c,willReconnect:!1}))},f.prototype._disconnect=function(){this._drop("disconnect"),this._failAll(this._held,"disconnected"),this._held=[]},f.prototype._request=function(c,a){const w={ref:String(++this._seq),type:c,detail:a};this._status==="connected"?this._send(w):this.command==="connect"?this._held.push(w):this._fail(w,0,"disconnected",null)},f.prototype._send=function(c){this._pending.set(c.ref,c),this._socket.send(JSON.stringify(Object.assign({ref:c.ref,type:c.type},p(c.type,c.detail))))},f.prototype._receive=function(c){let a;try{a=JSON.parse(c)}catch{console.warn("[ln-websocket-connector] Ignored a frame that is not JSON:",c);return}if(a.ref!==void 0){const w=this._pending.get(String(a.ref));if(!w)return;this._pending.delete(w.ref),a.ok?this._resolve(w,a.content,a.message||null):this._fail(w,a.status||0,a.error,a.data);return}a.type==="changes"&&m(this.dom,"ln-websocket-connector:fetched",{data:{data:a.data||[],deleted:a.deleted||[],synced_at:a.synced_at},since:null,meta:null})},f.prototype._resolve=function(c,a,w){const h=c.detail,b=h.meta||null,y=this.dom;if(c.type==="sync")m(y,"ln-websocket-connector:fetched",{data:a,since:h.since,meta:b});else if(c.type==="query"){const v=h.query||{},C=a||{};m(y,"ln-websocket-connector:fetched",{data:C.data||[],total:C.total,filtered:C.filtered,offset:v.offset,queryGen:v.queryGen,meta:b})}else c.type==="create"?m(y,"ln-websocket-connector:created",{record:a,tempId:h.tempId,message:w,meta:b}):c.type==="update"?m(y,"ln-websocket-connector:updated",{record:a,id:h.id,message:w,meta:b}):c.type==="delete"?m(y,"ln-websocket-connector:deleted",{response:a,id:h.id,message:w,meta:b}):m(y,"ln-websocket-connector:bulk-deleted",{response:a,ids:h.ids,message:w,meta:b})},f.prototype._fail=function(c,a,w,h){const b=c.detail;m(this.dom,"ln-websocket-connector:error",{action:c.type,error:w,status:a,data:h||null,conflictData:a===409&&h||null,since:b.since,id:b.id,ids:b.ids,tempId:b.tempId,meta:b.meta||null})},f.prototype._failAll=function(c,a){for(let w=0;w<c.length;w++)this._fail(c[w],0,a,null)},f.prototype._failPending=function(c){const a=Array.from(this._pending.values());this._pending.clear(),this._failAll(a,c)},f.prototype.destroy=function(){if(this.dom[t]){for(const c in u)this.dom.removeEventListener(c,this._onRequest);clearTimeout(this._timer),this._timer=null,this._socket&&(this._socket.onopen=this._socket.onmessage=this._socket.onclose=null,this._socket.close(1e3,"destroy"),this._socket=null),this._pending.clear(),this._held=[],delete this.dom[t],delete this.dom[n]}},X(e,t,f,"ln-websocket-connector",{attributes:d})})()})();
|
|
1
|
+
(function(){"use strict";function N(){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 x(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let s=1;s<t.length;s++)if(t[s]&&t[s].nodeType===1){o=t[s];break}if(!x(o))return}e.apply(console,t)}}function m(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 k(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){k(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function Z(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ee(e,t){const n=!!(t&&t.typed),o=t&&t.exclude,s={},l=e.elements,i={};if(n)for(let d=0;d<l.length;d++){const r=l[d];r.name&&r.type==="checkbox"&&!r.disabled&&(i[r.name]=(i[r.name]||0)+1)}for(let d=0;d<l.length;d++){const r=l[d];if(!(!r.name||r.disabled||r.type==="file"||r.type==="submit"||r.type==="button")&&!(o&&r.matches&&r.matches(o)))if(r.type==="checkbox")n&&i[r.name]===1?s[r.name]=r.checked:(s[r.name]||(s[r.name]=[]),r.checked&&s[r.name].push(r.value));else if(r.type==="radio")r.checked&&(s[r.name]=r.value);else if(r.type==="select-multiple"){s[r.name]=[];for(let u=0;u<r.options.length;u++)r.options[u].selected&&s[r.name].push(r.options[u].value)}else if(n&&r.type==="hidden")s[r.name]=r.value;else if(n&&(r.type==="number"||r.type==="range")){const u=Number(r.value);s[r.name]=r.value===""||isNaN(u)?null:u}else s[r.name]=r.value}return s}function te(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ne(e,t){const n=e.elements,o=[],s={};for(let l=0;l<n.length;l++){const i=n[l];i.name&&i.type==="checkbox"&&(s[i.name]=(s[i.name]||0)+1)}for(let l=0;l<n.length;l++){const i=n[l];if(i.type==="file"||i.type==="submit"||i.type==="button")continue;const d=i.getAttribute("data-ln-fill-as")||i.name;if(!d||!(d in t))continue;const r=t[d];if(i.type==="checkbox"){if(Array.isArray(r))i.checked=r.indexOf(i.value)!==-1;else if(s[i.name]>1){const u=String(r).split(",").map(function(p){return p.trim()});i.checked=u.indexOf(i.value)!==-1}else i.checked=te(r);o.push(i)}else if(i.type==="radio")i.checked=i.value===String(r),o.push(i);else if(i.type==="select-multiple"){if(Array.isArray(r))for(let u=0;u<i.options.length;u++)i.options[u].selected=r.indexOf(i.options[u].value)!==-1;o.push(i)}else i.value=r,i.tagName==="SELECT"&&r!=null&&i.setAttribute("data-ln-value",r),o.push(i)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ne,window.lnCore.serializeForm=ee,window.lnCore.resolveFormMethod=Z);const M={};function oe(e,t){M[e]=t}function re(e){return M[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=oe,window.lnCore.getDataMapper=re);function ie(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,k(function(){new MutationObserver(function(){m(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const D={};function se(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];D[n]=t}function le(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=se,window.lnCore.getLocaleFallback=le,window.lnCore.ensureLocaleObserver=ie);const S={};function ce(e,t){S[e]||(S[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=S[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function $(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],r=d.getAttribute("data-ln-field");t[r]!=null&&(d.textContent=t[r])}const o=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<o.length;i++){const d=o[i],r=d.getAttribute("data-ln-attr").split(",");for(let u=0;u<r.length;u++){const p=r[u].trim().split(":");if(p.length!==2)continue;const f=p[0].trim(),c=p[1].trim();t[c]!=null&&d.setAttribute(f,t[c])}}const s=e.querySelectorAll("[data-ln-show]");for(let i=0;i<s.length;i++){const d=s[i],r=d.getAttribute("data-ln-show");r in t&&d.classList.toggle("hidden",!t[r])}const l=e.querySelectorAll("[data-ln-class]");for(let i=0;i<l.length;i++){const d=l[i],r=d.getAttribute("data-ln-class").split(",");for(let u=0;u<r.length;u++){const p=r[u].trim().split(":");if(p.length!==2)continue;const f=p[0].trim(),c=p[1].trim();c in t&&d.classList.toggle(f,!!t[c])}}return e}function de(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)$(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 F(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const l=n.currentNode;l.textContent.indexOf("{{")!==-1&&(l.textContent=l.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(i,d){return t[d]!==void 0?t[d]:""}))}const o=function(l,i){return t[i]!==void 0?t[i]:""},s=Array.from(e.querySelectorAll("*"));e.nodeType===1&&s.push(e);for(let l=0;l<s.length;l++){const i=s[l],d=i.attributes;for(let r=0;r<d.length;r++){const u=d[r];u.value.indexOf("{{")!==-1&&i.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function ae(e,t,n,o,s,l){const i={};for(let r=0;r<e.children.length;r++){const u=e.children[r],p=u.getAttribute("data-ln-render-key");p&&(i[p]=u)}const d=document.createDocumentFragment();for(let r=0;r<t.length;r++){const u=t[r],p=String(o(u));let f=i[p];if(f)s(f,u,r);else{const c=ce(n,l);if(!c||(F(c,u),f=c.firstElementChild,!f))continue;f.setAttribute("data-ln-render-key",p),s(f,u,r)}d.appendChild(f)}e.textContent="",e.appendChild(d)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=F,window.lnCore.fill=$,window.lnCore.lnFill=de,window.lnCore.renderList=ae);function A(e,t,n){const o=e.getAttribute(t);return o===null?n:o}function B(e,t,n){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?n:o}function j(e,t,n=!1){const o=e.getAttribute(t);if(o===null)return!!n;const s=o.trim().toLowerCase();return!(s==="false"||s==="0")}function W(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const O=new Map;function U(e,t){const n=(e?e.join("|"):"")+"::"+t;if(O.has(n))return O.get(n);const o=new Set(e||[]),s=function(l,i){const d=l.getAttribute(i);return d!==null&&o.has(d)?d:t};return O.set(n,s),s}function K(e,t,n){const o=parseFloat(e.getAttribute(t));return isNaN(o)?n:o}function V(e,t,n){const o=e.getAttribute(t);if(!o)return n;try{return JSON.parse(o)}catch{return n}}function H(e,t,n,o,s){if(!e||t===null)return!0;const l=o||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const d=r=>{s?console.warn(r,s):console.warn(r)};if(i==="boolean"){const r=t.trim().toLowerCase();return r!==""&&r!=="true"&&r!=="false"&&r!=="1"&&r!=="0"?(d(`[${l}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(i==="enum"){const r=e.values||[];return r.includes(t)?!0:(d(`[${l}] Invalid value "${t}" for attribute "${n}". Allowed: ${r.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(i==="integer"){if(!/^-?\d+$/.test(t))return d(`[${l}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const r=parseInt(t,10);return e.min!==void 0&&r<e.min?(d(`[${l}] Value ${r} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&r>e.max?(d(`[${l}] Value ${r} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(i==="float")return isNaN(Number(t))?(d(`[${l}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(i==="json")try{return JSON.parse(t),!0}catch(r){return d(`[${l}] Invalid JSON for attribute "${n}": ${r.message}. Fallback: ${e.fallback}.`),!1}return!0}function J(e,t,n){for(const o in n){const[s,l,i]=n[o];Object.defineProperty(e,o,{get:function(){return s(t,l,i)},enumerable:!0,configurable:!0})}return e}function Q(e){const t={};for(const n in e){const o=e[n];if(!o||!o.prop)continue;let s=o.read;if(!s&&o.type)switch(o.type){case"enum":s=U(o.values,o.fallback);break;case"integer":s=B;break;case"float":s=K;break;case"boolean":s=j;break;case"list":s=W;break;case"json":s=V;break;case"string":default:s=A;break}s||(s=A),t[o.prop]=[s,n,o.fallback]}return t}function ue(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 fe(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=J,window.lnCore.attrSpec=Q,window.lnCore.attrStr=A,window.lnCore.attrInt=B,window.lnCore.attrBool=j,window.lnCore.attrList=W,window.lnCore.attrEnum=U,window.lnCore.attrFloat=K,window.lnCore.attrJson=V);function q(e,t,n,o){if(e.nodeType!==1)return;const l=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i=Array.from(e.querySelectorAll(l));e.matches&&e.matches(l)&&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 o(d)}catch(r){console.error("["+n+"] init failed",d,r)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function we(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function he(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 P(){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 pe(e){const t=P(),n=e.observed||[];for(let o=0;o<n.length;o++){const s=n[o];t.byAttr.has(s)||t.byAttr.set(s,[]),t.byAttr.get(s).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 s=t.byDeclaredAttr.get(o);s.some(l=>l.componentTag===e.componentTag)||s.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=fe(e);if(o===null)t.reactiveWildcard.push(e);else for(const s of o)t.byReactive.has(s)||t.byReactive.set(s,[]),t.byReactive.get(s).push(e)}e.persist&&t.persist.push(e)}function G(e,t,n,o){for(let s=0;s<e.length;s++){const l=e[s];if(!t[l.attribute])continue;const i=l.effects&&l.effects[n];i?i(t,n,o):l.onAttrChange&&(!l.declared||l.declared.has(n))&&l.onAttrChange(t,n,o)}}function be(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const o=P(),s=o.byAttr.get(n);if(N()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(n)&&x(t)){const l=o.byDeclaredAttr.get(n),i=t.getAttribute(n);for(let d=0;d<l.length;d++)H(l[d].spec,i,n,l[d].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||s)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const l=o.byReactive.get(n);l&&G(l,t,n,e.oldValue),o.reactiveWildcard.length&&G(o.reactiveWildcard,t,n,e.oldValue)}if(s)for(let l=0;l<s.length;l++){const i=s[l];if(i.handler){i.handler(t,n,e.oldValue);continue}i.onAttributeChange&&t[i.attribute]?i.onAttributeChange(t,n):(q(t,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(t))}}function me(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,k(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{be(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 z(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function ge(e){const t=z();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const o=t[n];if(o.onSubtreeChange){const s=o.query,l=e.target.nodeType===1?e.target.matches(s)?e.target:e.target.closest(s):e.target.parentElement?e.target.parentElement.closest(s):null;l&&o.onSubtreeChange(l,e)}}for(let n=0;n<e.addedNodes.length;n++){const o=e.addedNodes[n];if(o.nodeType===1)for(let s=0;s<t.length;s++){const l=t[s];q(o,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(o)}}for(let n=0;n<e.removedNodes.length;n++){const o=e.removedNodes[n];if(o.nodeType===1)for(let s=0;s<t.length;s++){const l=t[s],i=l.query,d=Array.from(o.querySelectorAll(i));o.matches&&o.matches(i)&&d.push(o);for(let r=0;r<d.length;r++){const u=d[r];if(!document.contains(u)){const p=u[l.attribute];if(p&&typeof p.destroy=="function")try{p.destroy()}catch(f){console.error("["+l.attribute+"] destroy failed",u,f)}delete u[l.attribute]}}}}}}function ye(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,k(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{ge(o)}catch(s){console.error("[ln-core] lifecycle handler failed",o.target,s)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function X(e,t,n,o,s={}){const l=s.extraAttributes||[],i=s.onAttributeChange||null,d=s.onSubtreeChange||null,r=s.onInit||null,u=s.onAttrChange||null,p=s.effects||null,f=s.attributes||null,c=f?ue(f):p,a=f?new Set(Object.keys(f)):null,w=s.persist||null;function h(I){const g=I||document.body;if(q(g,e,t,n),f&&N())for(const _ in f){const Ee=f[_],L=Array.from(g.querySelectorAll("["+_+"]"));g.matches&&g.matches("["+_+"]")&&L.push(g);for(let R=0;R<L.length;R++){const T=L[R];x(T)&&H(Ee,T.getAttribute(_),_,o,T)}}r&&r(g)}const b=[];if(e.indexOf("[")!==-1){const I=/\[([\w-]+)/g;let g;for(;(g=I.exec(e))!==null;)b.push(g[1])}else b.push(e);pe({selector:e,attribute:t,componentTag:o,attributes:f,ComponentFn:n,onInit:r,observed:b.concat(l),onAttributeChange:i,onAttrChange:u,effects:c,declared:a,persist:w}),me();const y=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,v=s.subtreeQuery||(y?e:"["+e+"]");z().push({selector:e,attribute:t,ComponentFn:n,onInit:r,onSubtreeChange:d,query:v}),ye(),window[t]=h,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=X);function C(){we()>0?he(function(){h(document.body)}):h(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",C):C(),h}function Y(e){return(e||"").replace(/^#/,"")}function E(e){const t=e===void 0?location.hash:e,n={},o=Y(t);if(!o)return n;const s=o.split("&");for(let l=0;l<s.length;l++){const i=s[l];if(!i)continue;const d=i.indexOf(":"),r=d>-1?i.slice(0,d):i,u=d>-1?i.slice(d+1):"";if(r)try{n[r]=decodeURIComponent(u)}catch{n[r]=u}}return n}function Ce(e){if(!e)return null;const t=E();return e in t?t[e]:null}function _e(e,t){if(!e)return;const n=E();t==null?delete n[e]:n[e]=String(t);const s=Object.keys(n).map(function(l){const i=n[l];return i===""?l:l+":"+encodeURIComponent(i)}).join("&");Y(location.hash)!==s&&(location.hash=s)}function ke(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Ae(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 ve(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function xe(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 Se(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Oe(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),s=o?o.split(",").map(function(l){try{return decodeURIComponent(l)}catch{return l}}).filter(Boolean):[];return{key:n,values:s}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=E,window.lnCore.hashGet=Ce,window.lnCore.hashSet=_e,window.lnCore.hashLinkClick=ke,window.lnCore.resolveHashNamespace=Ae,window.lnCore.hashSortEncode=ve,window.lnCore.hashSortDecode=xe,window.lnCore.hashFilterEncode=Se,window.lnCore.hashFilterDecode=Oe);function qe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=qe),(function(){const e="data-ln-websocket-connector",t="lnWebsocketConnector",n="lnConnector";if(window[t]!==void 0)return;const o=1e3,s=3e4;function l(c){const a=c[t];a&&(a.command==="connect"?a._open():a._disconnect())}function i(c){const a=c[t];!a||a.command!=="connect"||(a._drop("url-changed"),a._open())}const d={"data-ln-websocket-connector":{prop:"command",type:"enum",values:["connect","disconnect"],fallback:"connect",effect:l,description:"Connection command set from outside: connect or disconnect"},"data-ln-websocket-connector-url":{prop:"url",read:A,type:"string",fallback:"",effect:i,description:"WebSocket endpoint URL (ws:// or wss://)"}},r=Q(d),u={"ln-websocket-connector:request-sync":"sync","ln-websocket-connector:request-query":"query","ln-websocket-connector:request-create":"create","ln-websocket-connector:request-update":"update","ln-websocket-connector:request-delete":"delete","ln-websocket-connector:request-bulk-delete":"bulk-delete"};function p(c,a){return c==="sync"?{since:a.since}:c==="query"?{query:a.query||{}}:c==="create"?{data:a.data,idempotencyKey:a.idempotencyKey}:c==="update"?{id:a.id,data:a.data,expected_version:a.expected_version,idempotencyKey:a.idempotencyKey}:c==="delete"?{id:a.id,idempotencyKey:a.idempotencyKey}:{ids:a.ids,idempotencyKey:a.idempotencyKey}}function f(c){this.dom=c,J(this,c,r),c[t]=this,c[n]=this,this.namespace="ln-websocket-connector",this._socket=null,this._status="disconnected",this._attempt=0,this._timer=null,this._seq=0,this._pending=new Map,this._held=[];const a=this;this._onRequest=function(w){a._request(u[w.type],w.detail||{})};for(const w in u)c.addEventListener(w,this._onRequest);return this.command==="connect"&&this._open(),this}f.prototype._open=function(){if(this._socket||this._timer)return;const c=this,a=this.url;this._attempt++,this._status="connecting",m(this.dom,"ln-websocket-connector:connecting",{url:a,attempt:this._attempt});let w;try{w=new WebSocket(a)}catch(h){this._status="disconnected",this._attempt=0,this._failAll(this._held,h.message),this._held=[],m(this.dom,"ln-websocket-connector:disconnected",{url:a,code:0,reason:h.message,willReconnect:!1});return}this._socket=w,w.onopen=function(){c._status="connected",c._attempt=0,m(c.dom,"ln-websocket-connector:connected",{url:a});const h=c._held;c._held=[];for(let b=0;b<h.length;b++)c._send(h[b])},w.onmessage=function(h){c._receive(h.data)},w.onclose=function(h){c._socket=null,c._status="disconnected",c._failPending("connection closed");const b=c.command==="connect";m(c.dom,"ln-websocket-connector:disconnected",{url:a,code:h.code,reason:h.reason,willReconnect:b}),b&&c._scheduleReconnect()}},f.prototype._scheduleReconnect=function(){const c=this,a=Math.min(o*Math.pow(2,Math.max(0,this._attempt-1)),s);this._timer=setTimeout(function(){c._timer=null,c._open()},a)},f.prototype._drop=function(c){const a=!!(this._socket||this._timer);clearTimeout(this._timer),this._timer=null,this._attempt=0,this._socket&&(this._socket.onopen=this._socket.onmessage=this._socket.onclose=null,this._socket.close(1e3,c),this._socket=null),a&&(this._status="disconnected",this._failPending("connection closed"),m(this.dom,"ln-websocket-connector:disconnected",{url:this.url,code:1e3,reason:c,willReconnect:!1}))},f.prototype._disconnect=function(){this._drop("disconnect"),this._failAll(this._held,"disconnected"),this._held=[]},f.prototype._request=function(c,a){const w={ref:String(++this._seq),type:c,detail:a};this._status==="connected"?this._send(w):this.command==="connect"?this._held.push(w):this._fail(w,0,"disconnected",null)},f.prototype._send=function(c){this._pending.set(c.ref,c),this._socket.send(JSON.stringify(Object.assign({ref:c.ref,type:c.type},p(c.type,c.detail))))},f.prototype._receive=function(c){let a;try{a=JSON.parse(c)}catch{console.warn("[ln-websocket-connector] Ignored a frame that is not JSON:",c);return}if(a.ref!==void 0){const w=this._pending.get(String(a.ref));if(!w)return;this._pending.delete(w.ref),a.ok?this._resolve(w,a.content,a.message||null):this._fail(w,a.status||0,a.error,a.data);return}a.type==="changes"&&m(this.dom,"ln-websocket-connector:fetched",{data:{data:a.data||[],deleted:a.deleted||[],synced_at:a.synced_at},since:null,meta:null})},f.prototype._resolve=function(c,a,w){const h=c.detail,b=h.meta||null,y=this.dom;if(c.type==="sync")m(y,"ln-websocket-connector:fetched",{data:a,since:h.since,meta:b});else if(c.type==="query"){const v=h.query||{},C=a||{};m(y,"ln-websocket-connector:fetched",{data:C.data||[],total:C.total,filtered:C.filtered,offset:v.offset,queryGen:v.queryGen,meta:b})}else c.type==="create"?m(y,"ln-websocket-connector:created",{record:a,tempId:h.tempId,message:w,meta:b}):c.type==="update"?m(y,"ln-websocket-connector:updated",{record:a,id:h.id,message:w,meta:b}):c.type==="delete"?m(y,"ln-websocket-connector:deleted",{response:a,id:h.id,message:w,meta:b}):m(y,"ln-websocket-connector:bulk-deleted",{response:a,ids:h.ids,message:w,meta:b})},f.prototype._fail=function(c,a,w,h){const b=c.detail;m(this.dom,"ln-websocket-connector:error",{action:c.type,error:w,status:a,data:h||null,conflictData:a===409&&h||null,since:b.since,id:b.id,ids:b.ids,tempId:b.tempId,meta:b.meta||null})},f.prototype._failAll=function(c,a){for(let w=0;w<c.length;w++)this._fail(c[w],0,a,null)},f.prototype._failPending=function(c){const a=Array.from(this._pending.values());this._pending.clear(),this._failAll(a,c)},f.prototype.destroy=function(){if(this.dom[t]){for(const c in u)this.dom.removeEventListener(c,this._onRequest);clearTimeout(this._timer),this._timer=null,this._socket&&(this._socket.onopen=this._socket.onmessage=this._socket.onclose=null,this._socket.close(1e3,"destroy"),this._socket=null),this._pending.clear(),this._held=[],delete this.dom[t],delete this.dom[n]}},X(e,t,f,"ln-websocket-connector",{attributes:d})})()})();
|
package/ln-ashlar.html-data.json
CHANGED
|
@@ -636,6 +636,11 @@
|
|
|
636
636
|
"description": "Visual / CSS styling attribute (theme/config/mixins/_filter.scss)",
|
|
637
637
|
"valueSet": "v"
|
|
638
638
|
},
|
|
639
|
+
{
|
|
640
|
+
"name": "data-ln-filter-target",
|
|
641
|
+
"description": "Marker on target container or table observed by ln-filter",
|
|
642
|
+
"valueSet": "v"
|
|
643
|
+
},
|
|
639
644
|
{
|
|
640
645
|
"name": "data-ln-filter-value",
|
|
641
646
|
"description": "Value to match for this filter input"
|
package/package.json
CHANGED
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@livenetworks/ashlar",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.10",
|
|
5
5
|
"framework": "html",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -819,6 +819,13 @@
|
|
|
819
819
|
"type": "boolean"
|
|
820
820
|
}
|
|
821
821
|
},
|
|
822
|
+
{
|
|
823
|
+
"name": "data-ln-filter-target",
|
|
824
|
+
"description": "Marker on target container or table observed by ln-filter",
|
|
825
|
+
"value": {
|
|
826
|
+
"type": "boolean"
|
|
827
|
+
}
|
|
828
|
+
},
|
|
822
829
|
{
|
|
823
830
|
"name": "data-ln-filter-value",
|
|
824
831
|
"description": "Value to match for this filter input",
|