fernwell 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +13 -5
- package/dist/_position.d.ts +73 -0
- package/dist/fernwell.cjs +3 -3
- package/dist/fernwell.cjs.map +4 -4
- package/dist/fernwell.css +456 -6
- package/dist/fernwell.esm.js +3 -3
- package/dist/fernwell.esm.js.map +4 -4
- package/dist/fernwell.iife.js +3 -3
- package/dist/fernwell.iife.js.map +4 -4
- package/dist/fernwell.min.css +2 -2
- package/dist/fernwell.tokens.css +7 -1
- package/dist/icon.d.ts +16 -0
- package/dist/index.d.ts +13 -1
- package/dist/popover.d.ts +48 -0
- package/dist/tabs.d.ts +43 -0
- package/dist/theme.d.ts +0 -13
- package/dist/tokens.json +12 -0
- package/dist/tooltip.d.ts +51 -0
- package/package.json +2 -2
package/dist/fernwell.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! fernwell v0.
|
|
2
|
-
var
|
|
3
|
-
`)}function et(e,t={}){var r,s;let n=(r=t.scope)!=null?r:":root",o=(s=b.get(n))!=null?s:{light:{},dark:{}};Ze(e)?(Object.assign(o.light,e.light),Object.assign(o.dark,e.dark)):(Object.assign(o.light,e),Object.assign(o.dark,e)),b.set(n,o),Ae()}function tt(e){e?b.delete(e):b.clear(),Ae()}function nt(e,t=document.documentElement){return getComputedStyle(t).getPropertyValue(ke(e)).trim()}var K={};T(K,{combobox:()=>Se,init:()=>j});var ot=0;function x(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t])}function Se(e,t={}){var we,ve,he,be;let n=(we=t.filter)!=null?we:((i,c)=>i.toLowerCase().includes(c)),o=(ve=t.emptyText)!=null?ve:"No matches",r=(he=t.options)!=null?he:rt(e),s=[],l=-1,d=!1,f=e.getAttribute("list");f&&(e.dataset.fwList=f,e.removeAttribute("list"));let u=(be=e.closest(".fw-combobox"))!=null?be:st(e),a=document.createElement("ul"),B=`fw-combobox-${++ot}`;a.className="fw-combobox-list",a.id=B,a.setAttribute("role","listbox"),u.appendChild(a),e.setAttribute("role","combobox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-controls",B),e.autocomplete="off";function ze(i){s=i,l=-1;let c=e.value.trim().toLowerCase();if(i.length===0){a.innerHTML=`<li class="fw-combobox-empty">${x(o)}</li>`;return}a.innerHTML=i.map((E,H)=>{let y=c?E.toLowerCase().indexOf(c):-1,Ye=y>-1?`${x(E.slice(0,y))}<b>${x(E.slice(y,y+c.length))}</b>${x(E.slice(y+c.length))}`:x(E);return`<li class="fw-combobox-option" role="option" id="${B}-${H}" data-index="${H}" aria-selected="false">${Ye}</li>`}).join("")}function M(){let i=e.value.trim().toLowerCase();ze(i?r.filter(c=>n(c,i)):r),a.classList.add("is-open"),e.setAttribute("aria-expanded","true")}function A(){a.classList.remove("is-open"),e.setAttribute("aria-expanded","false"),e.removeAttribute("aria-activedescendant"),l=-1}function ue(i){let c=a.querySelectorAll(".fw-combobox-option");c.forEach(H=>{H.classList.remove("is-active"),H.setAttribute("aria-selected","false")});let E=c[i];E&&(E.classList.add("is-active"),E.setAttribute("aria-selected","true"),E.scrollIntoView({block:"nearest"}),e.setAttribute("aria-activedescendant",E.id)),l=i}function fe(i){var c;e.value=i,A(),d=!0,e.focus(),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),d=!1,(c=t.onSelect)==null||c.call(t,i)}let me=()=>{d||M()},Ee=()=>{d||M()},pe=i=>{i.key==="ArrowDown"?(i.preventDefault(),a.classList.contains("is-open")||M(),ue(Math.min(l+1,s.length-1))):i.key==="ArrowUp"?(i.preventDefault(),ue(Math.max(l-1,0))):i.key==="Enter"?l>-1&&s[l]!==void 0&&(i.preventDefault(),fe(s[l])):i.key==="Escape"&&A()},Te=i=>{let c=i.target.closest(".fw-combobox-option");c&&(i.preventDefault(),fe(s[Number(c.dataset.index)]))},Le=i=>{u.contains(i.target)||A()};return e.addEventListener("input",me),e.addEventListener("focus",Ee),e.addEventListener("keydown",pe),a.addEventListener("mousedown",Te),document.addEventListener("click",Le),{open:M,close:A,setOptions(i){r=i,a.classList.contains("is-open")&&M()},destroy(){e.removeEventListener("input",me),e.removeEventListener("focus",Ee),e.removeEventListener("keydown",pe),a.removeEventListener("mousedown",Te),document.removeEventListener("click",Le),a.remove(),e.dataset.fwList&&e.setAttribute("list",e.dataset.fwList),delete e.dataset.fwBound}}}function rt(e){var o;let t=(o=e.getAttribute("list"))!=null?o:e.dataset.fwList,n=t?document.getElementById(t):null;return n?Array.from(n.querySelectorAll("option")).map(r=>r.value||r.textContent||""):[]}function st(e){var n;let t=document.createElement("div");return t.className="fw-combobox",(n=e.parentNode)==null||n.insertBefore(t,e),t.appendChild(e),t}function j(e=document){e.querySelectorAll("input[data-fw-combobox]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",Se(t))})}var z={};T(z,{bindOutsideClickToClose:()=>V,close:()=>L,init:()=>_,open:()=>W,toggle:()=>lt});var w="is-open",Ce="fw-scroll-lock",v=[],F=new WeakMap,it='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function G(e){return typeof e=="string"?document.getElementById(e):e}function U(e){if(e.classList.contains("fw-modal-overlay"))return e;let t=e.id?document.querySelector(`[data-fw-drawer-overlay="${e.id}"]`):null;if(t)return t;let n=e.previousElementSibling;return n instanceof HTMLElement&&n.classList.contains("fw-drawer-overlay")?n:null}function W(e,t=(n=>(n=document.activeElement)!=null?n:null)()){var s;let o=G(e);if(!o||o.classList.contains(w))return;o.classList.add(w),(s=U(o))==null||s.classList.add(w),F.set(o,t),v.push(o),document.body.classList.add(Ce),o.dispatchEvent(new CustomEvent("fw:open",{bubbles:!0}));let r=o.querySelector(it);r?r.focus({preventScroll:!0}):(o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1"),o.focus({preventScroll:!0}))}function L(e){var o,r,s;let t=G(e);if(!t||!t.classList.contains(w))return;t.classList.remove(w),(o=U(t))==null||o.classList.remove(w);let n=v.indexOf(t);n>-1&&v.splice(n,1),v.length===0&&document.body.classList.remove(Ce),t.dispatchEvent(new CustomEvent("fw:close",{bubbles:!0})),(s=(r=F.get(t))==null?void 0:r.focus)==null||s.call(r,{preventScroll:!0}),F.delete(t)}function lt(e){let t=G(e);t&&(t.classList.contains(w)?L:W)(t)}function V(e,t){let n=!1;e.addEventListener("mousedown",o=>{n=o.target===e}),e.addEventListener("click",o=>{o.target===e&&n&&t()})}var Oe=!1;function _(e=document){e.querySelectorAll("[data-fw-open-modal], [data-fw-open-drawer]").forEach(t=>{var o,r;if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=(r=(o=t.dataset.fwOpenModal)!=null?o:t.dataset.fwOpenDrawer)!=null?r:"";t.addEventListener("click",()=>W(n,t))}),e.querySelectorAll(".fw-modal-overlay").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",V(t,()=>L(t)),t.querySelectorAll("[data-fw-close-modal]").forEach(n=>n.addEventListener("click",()=>L(t))))}),e.querySelectorAll(".fw-drawer").forEach(t=>{if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=U(t);n&&V(n,()=>L(t)),t.querySelectorAll("[data-fw-close-drawer]").forEach(o=>o.addEventListener("click",()=>L(t)))}),Oe||(Oe=!0,document.addEventListener("keydown",t=>{t.key==="Escape"&&v.length&&L(v[v.length-1])}))}var Q={};T(Q,{close:()=>O,init:()=>J,open:()=>De});var Y="is-open";function De(e){let t=X(e);t&&(t.classList.add(Y),e.setAttribute("aria-expanded","true"))}function O(e){let t=X(e);t&&(t.classList.remove(Y),e.setAttribute("aria-expanded","false"))}function X(e){let t=e.getAttribute("aria-controls");return t?document.getElementById(t):null}function J(e=document){e.querySelectorAll("[data-fw-nav-toggle]").forEach(t=>{var r,s;if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=X(t);if(!n)return;let o=(s=(r=t.closest(".fw-nav"))!=null?r:t.parentElement)!=null?s:t;t.addEventListener("click",l=>{l.stopPropagation(),(n.classList.contains(Y)?O:De)(t)}),document.addEventListener("click",l=>{!o.contains(l.target)&&!n.contains(l.target)&&O(t)}),document.addEventListener("keydown",l=>{l.key==="Escape"&&O(t)})})}var ee={};T(ee,{init:()=>Z,resetAll:()=>Ie,resetButtonLoading:()=>Ne,setButtonLoading:()=>Be});var k="fw-btn-loading";function Be(e,t){var o,r;if(!e||e.classList.contains(k))return;e.dataset.fwOriginalHtml=e.innerHTML,e.disabled=!0,e.setAttribute("aria-busy","true"),e.classList.add(k);let n=(r=(o=t!=null?t:e.dataset.fwLoadingText)!=null?o:e.textContent)!=null?r:"";e.innerHTML='<span class="fw-spinner fw-spinner-sm" aria-hidden="true"></span>',e.appendChild(document.createTextNode(n))}function Ne(e){!e||!e.classList.contains(k)||(e.disabled=!1,e.removeAttribute("aria-busy"),e.classList.remove(k),e.dataset.fwOriginalHtml!==void 0&&(e.innerHTML=e.dataset.fwOriginalHtml,delete e.dataset.fwOriginalHtml))}function Ie(e=document){e.querySelectorAll(`.${k}`).forEach(Ne)}var qe=!1;function Z(e=document){e.querySelectorAll("form[data-fw-loading]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",t.addEventListener("submit",()=>{let n=t.querySelector('button[type="submit"], button:not([type])');Be(n)}))}),qe||(qe=!0,window.addEventListener("pageshow",t=>{t.persisted&&Ie()}))}var te={};T(te,{hide:()=>$e,show:()=>ct});var m=null,g=null;function at(){return m&&m.isConnected||(m=document.createElement("div"),m.className="fw-toast",m.setAttribute("role","status"),m.setAttribute("aria-live","polite"),m.innerHTML='<span class="fw-toast-dot" aria-hidden="true"></span><span class="fw-toast-text"></span>',document.body.appendChild(m)),m}function ct(e,{variant:t="success",duration:n=4e3}={}){let o=at();return o.className=`fw-toast${t==="success"?"":` fw-toast-${t}`}`,o.querySelector(".fw-toast-text").textContent=e,g&&clearTimeout(g),o.classList.remove("is-show"),o.offsetWidth,o.classList.add("is-show"),n>0&&(g=setTimeout($e,n)),o}function $e(){m==null||m.classList.remove("is-show"),g&&clearTimeout(g),g=null}var ae={};T(ae,{getSelected:()=>ie,init:()=>le,selectAll:()=>Fe,setRowSelected:()=>Ke,sort:()=>ne});var dt="is-selected";function oe(e,t,n){e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))}function Re(e,t){var o,r,s;let n=e.cells[t];return(s=(r=n==null?void 0:n.dataset.fwSortValue)!=null?r:(o=n==null?void 0:n.textContent)==null?void 0:o.trim())!=null?s:""}function ut(e,t){let n=Number(e),o=Number(t);return e!==""&&t!==""&&Number.isFinite(n)&&Number.isFinite(o)?n-o:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function je(e){var t,n;return Array.from((n=(t=e.tHead)==null?void 0:t.querySelectorAll("th[data-fw-sort]"))!=null?n:[])}function Pe(e){return e.getAttribute("aria-sort")==="ascending"?"descending":"ascending"}function ne(e,t,n){let o=e.tBodies[0];if(!o)return;let r=Array.from(o.rows),s=r.filter(u=>u.cells.length>t),l=r.filter(u=>u.cells.length<=t),d=n==="ascending"?1:-1;s.sort((u,a)=>d*ut(Re(u,t),Re(a,t))),[...s,...l].forEach(u=>o.appendChild(u));let f=null;je(e).forEach(u=>{let a=u.cellIndex===t;u.setAttribute("aria-sort",a?n:"none"),a&&(f=u)}),f&&oe(e,"fw:sort",{column:t,direction:n,th:f})}function C(e){return Array.from(e.querySelectorAll("tbody input[data-fw-select-row]"))}function re(e,t){e.classList.toggle(dt,t),e.setAttribute("aria-selected",t?"true":"false")}function se(e){let t=e.querySelector("[data-fw-select-all]");if(!t)return;let n=C(e),o=n.filter(r=>r.checked).length;t.checked=o>0&&o===n.length,t.indeterminate=o>0&&o<n.length}function ie(e){return C(e).filter(t=>t.checked).map(t=>t.closest("tr")).filter(t=>t!==null)}function Ke(e,t){let n=e.querySelector("input[data-fw-select-row]");n&&(n.checked=t),re(e,t);let o=e.closest("table");o&&(se(o),oe(o,"fw:select",{rows:ie(o),all:!1}))}function Fe(e,t){C(e).forEach(n=>{n.checked=t;let o=n.closest("tr");o&&re(o,t)}),se(e),oe(e,"fw:select",{rows:ie(e),all:!0})}function le(e=document){e.querySelectorAll("table[data-fw-table]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",je(t).forEach(n=>{n.hasAttribute("aria-sort")||n.setAttribute("aria-sort","none")}),t.addEventListener("click",n=>{let o=n.target.closest("th[data-fw-sort]");o&&t.contains(o)&&ne(t,o.cellIndex,Pe(o))}),t.addEventListener("keydown",n=>{if(n.key!=="Enter"&&n.key!==" ")return;let o=n.target;if(!o.matches("th[data-fw-sort], th[data-fw-sort] .fw-table-sort"))return;let r=o.closest("th[data-fw-sort]");r&&(n.preventDefault(),ne(t,r.cellIndex,Pe(r)))}),t.addEventListener("change",n=>{let o=n.target;if(o.matches("[data-fw-select-all]"))Fe(t,o.checked);else if(o.matches("[data-fw-select-row]")){let r=o.closest("tr");r&&Ke(r,o.checked)}}),C(t).forEach(n=>{let o=n.closest("tr");o&&n.checked&&re(o,!0)}),se(t))})}var de={};T(de,{close:()=>q,collapseAll:()=>Tt,expandAll:()=>pt,init:()=>ce,open:()=>D,reveal:()=>Ue,toggle:()=>Et});var p=".fw-menu-group",Ge=".fw-menu-link, .fw-menu-summary",ft="is-current";function mt(e,t){e.dispatchEvent(new CustomEvent("fw:toggle",{bubbles:!0,detail:t}))}function D(e){e.open=!0}function q(e){e.open=!1}function Et(e,t){e.open=t!=null?t:!e.open}function pt(e){e.querySelectorAll(p).forEach(D)}function Tt(e){e.querySelectorAll(p).forEach(q)}function Ue(e){var n,o,r,s;let t=(o=(n=e.parentElement)==null?void 0:n.closest(p))!=null?o:null;for(;t;)D(t),t=(s=(r=t.parentElement)==null?void 0:r.closest(p))!=null?s:null}function Ve(e){e.querySelectorAll(p).forEach(t=>{let n=t.querySelector(":scope > .fw-menu-summary");if(!n)return;let o=!t.open&&t.querySelector("[aria-current]")!==null;n.classList.toggle(ft,o)})}function We(e){return e.matches(".fw-menu-summary")?e.closest(p):null}function _e(e){var n,o,r;return(r=(o=((n=We(e))!=null?n:e).parentElement)==null?void 0:o.closest(p))!=null?r:null}function Lt(e){var t,n;for(let o=_e(e);o;o=(n=(t=o.parentElement)==null?void 0:t.closest(p))!=null?n:null)if(!o.open)return!1;return!0}function wt(e){return Array.from(e.querySelectorAll(Ge)).filter(Lt)}function h(e){return e?(e.focus(),!0):!1}function vt(e){var n;let t=e.closest(".fw-menu-split");return(n=t==null?void 0:t.querySelector(":scope > .fw-menu-group > .fw-menu-summary"))!=null?n:null}function ht(e,t){var d;if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return;let n=t.target instanceof HTMLElement&&t.target.matches(Ge)?t.target:null;if(!n||!e.contains(n))return;let o=wt(e),r=o.indexOf(n),s=We(n),l=!0;switch(t.key){case"ArrowDown":h(o[r+1]);break;case"ArrowUp":h(o[r-1]);break;case"Home":h(o[0]);break;case"End":h(o[o.length-1]);break;case"ArrowRight":s?s.open?s.contains((d=o[r+1])!=null?d:e)&&h(o[r+1]):D(s):h(vt(n));break;case"ArrowLeft":if(s!=null&&s.open)q(s);else{let f=_e(n);h(f==null?void 0:f.querySelector(":scope > .fw-menu-summary"))}break;default:l=!1}l&&t.preventDefault()}function ce(e=document){e.querySelectorAll("[data-fw-menu]").forEach(t=>{if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=t.hasAttribute("data-fw-menu-exclusive");t.addEventListener("toggle",o=>{let r=o.target;!(r instanceof HTMLDetailsElement)||!r.matches(p)||(n&&r.open&&r.parentElement&&Array.from(r.parentElement.children).forEach(s=>{s!==r&&s instanceof HTMLDetailsElement&&s.matches(p)&&q(s)}),Ve(t),mt(r,{group:r,open:r.open}))},!0),t.addEventListener("keydown",o=>ht(t,o)),t.querySelectorAll("[aria-current]").forEach(Ue),Ve(t)})}var bt="0.3.0";function gt(e=document){R(e),j(e),_(e),J(e),Z(e),le(e),ce(e)}var Mt={version:bt,init:gt,theme:P,combobox:K,modal:z,nav:Q,loading:ee,toast:te,table:ae,menu:de},yt=Mt;export{K as combobox,yt as default,gt as init,ee as loading,de as menu,z as modal,Q as nav,ae as table,P as theme,te as toast,bt as version};
|
|
1
|
+
/*! fernwell v0.4.0 | MIT | https://github.com/JacobKnaack/fernwell */
|
|
2
|
+
var Nt=Object.defineProperty;var b=(e,t)=>{for(var n in t)Nt(e,n,{get:t[n],enumerable:!0})};var de={};b(de,{get:()=>ae,getToken:()=>jt,init:()=>ce,resetTokens:()=>Kt,set:()=>z,setTokens:()=>Vt,toggle:()=>Xe});var ie={};b(ie,{init:()=>re,render:()=>G});var Bt={add:'<line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>',close:'<line x1="6" y1="6" x2="18" y2="18"/><line x1="18" y1="6" x2="6" y2="18"/>',check:'<polyline points="5,13 10,18 19,7"/>',edit:'<path d="M16.8 3.5a2.1 2.1 0 0 1 3 3L8.5 17.8 4 19l1.2-4.5Z"/><line x1="14.5" y1="5.8" x2="17.7" y2="9"/>',trash:'<path d="M4 7h16"/><path d="M9 7V4.6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1V7"/><path d="M6.5 7l.8 12.4A2 2 0 0 0 9.3 21h5.4a2 2 0 0 0 2-1.6L18 7"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/>',save:'<path d="M5 4a1 1 0 0 1 1-1h9.2a1 1 0 0 1 .7.3l2.8 2.8a1 1 0 0 1 .3.7V20a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V4Z"/><path d="M8 3v5h7V3"/><path d="M8 21v-6h8v6"/>',search:'<circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.6" y2="16.6"/>',settings:'<circle cx="12" cy="12" r="3"/><path d="M12 2v3M12 19v3M4.2 4.2l2.1 2.1M17.7 17.7l2.1 2.1M2 12h3M19 12h3M4.2 19.8l2.1-2.1M17.7 6.3l2.1-2.1"/>',download:'<line x1="12" y1="3" x2="12" y2="15"/><polyline points="7,10 12,15 17,10"/><line x1="5" y1="21" x2="19" y2="21"/>',upload:'<line x1="12" y1="15" x2="12" y2="3"/><polyline points="7,8 12,3 17,8"/><line x1="5" y1="21" x2="19" y2="21"/>',share:'<circle cx="6" cy="12" r="2.3"/><circle cx="18" cy="6" r="2.3"/><circle cx="18" cy="18" r="2.3"/><line x1="8.1" y1="10.8" x2="15.9" y2="7.2"/><line x1="8.1" y1="13.2" x2="15.9" y2="16.8"/>',copy:'<rect x="9" y="9" width="12" height="12" rx="2"/><path d="M5 15H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1"/>',menu:'<line x1="4" y1="6" x2="20" y2="6"/><line x1="4" y1="12" x2="20" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/>',more:'<circle cx="5" cy="12" r="1.4" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.4" fill="currentColor" stroke="none"/><circle cx="19" cy="12" r="1.4" fill="currentColor" stroke="none"/>',user:'<circle cx="12" cy="8" r="4"/><path d="M4 21c0-4.4 3.6-8 8-8s8 3.6 8 8"/>',bell:'<path d="M6 8a6 6 0 0 1 12 0c0 5 2 6 2 6H4s2-1 2-6"/><path d="M10 20a2 2 0 0 0 4 0"/>',heart:'<path d="M12 20s-7-4.4-9.5-8.5C.8 8 2 4.5 5.5 4.5c2 0 3.5 1 6.5 4 3-3 4.5-4 6.5-4 3.5 0 4.7 3.5 3 7-2.5 4.1-9.5 8.5-9.5 8.5Z"/>',star:'<polygon points="12,3 14.6,9.1 21.2,9.3 16,13.4 17.8,19.8 12,16.3 6.2,19.8 8,13.4 2.8,9.3 9.4,9.1"/>',calendar:'<rect x="3" y="5" width="18" height="16" rx="2"/><line x1="8" y1="3" x2="8" y2="7"/><line x1="16" y1="3" x2="16" y2="7"/><line x1="3" y1="10" x2="21" y2="10"/>',refresh:'<path d="M20 11A8 8 0 0 0 6.3 6.3L4 8.6"/><path d="M4 4v5h5"/><path d="M4 13a8 8 0 0 0 13.7 4.7L20 15.4"/><path d="M20 20v-5h-5"/>',filter:'<polygon points="4,4 20,4 14,12 14,19 10,21 10,12"/>',info:'<circle cx="12" cy="12" r="9"/><line x1="12" y1="11" x2="12" y2="16"/><circle cx="12" cy="8" r="1" fill="currentColor" stroke="none"/>',warning:'<path d="M12 3 22 20H2Z"/><line x1="12" y1="9.5" x2="12" y2="14.5"/><circle cx="12" cy="17.3" r="1" fill="currentColor" stroke="none"/>',lock:'<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/>',eye:'<path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/>',"chevron-down":'<polyline points="6,9 12,15 18,9"/>',"arrow-left":'<line x1="19" y1="12" x2="5" y2="12"/><polyline points="12,5 5,12 12,19"/>',"arrow-right":'<line x1="5" y1="12" x2="19" y2="12"/><polyline points="12,5 19,12 12,19"/>',folder:'<path d="M3.5 6.5a1 1 0 0 1 1-1H10l2 2.2h7.5a1 1 0 0 1 1 1V18a1 1 0 0 1-1 1H4.5a1 1 0 0 1-1-1Z"/>',bookmark:'<path d="M6 3h12a1 1 0 0 1 1 1v17l-7-4-7 4V4a1 1 0 0 1 1-1Z"/>',home:'<path d="M4 11.5 12 4l8 7.5"/><path d="M6 10v10a1 1 0 0 0 1 1h3.5v-6h2.8v6H17a1 1 0 0 0 1-1V10"/>',logout:'<path d="M9 4H5.5a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1H9"/><line x1="14" y1="12" x2="21" y2="12"/><polyline points="17.5,8.5 21,12 17.5,15.5"/>',paperclip:'<path d="M21 11.5 12.4 20a4.3 4.3 0 0 1-6-6.1L15 5.3a2.9 2.9 0 0 1 4.1 4.1l-8.6 8.6a1.4 1.4 0 0 1-2-2l7.9-7.9"/>',envelope:'<rect x="3" y="5" width="18" height="14" rx="2"/><path d="M4 6.5 12 13l8-6.5"/>',"chevron-up":'<polyline points="6,15 12,9 18,15"/>',"chevron-left":'<polyline points="15,6 9,12 15,18"/>',"chevron-right":'<polyline points="9,6 15,12 9,18"/>',"arrow-up":'<line x1="12" y1="19" x2="12" y2="5"/><polyline points="5,12 12,5 19,12"/>',"arrow-down":'<line x1="12" y1="5" x2="12" y2="19"/><polyline points="5,12 12,19 19,12"/>',unlock:'<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 7.8-1.3"/>',"thumbs-up":'<path d="M7 11v9H4.5a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1H7Z"/><path d="M7 11l4.3-7.3a1.4 1.4 0 0 1 2.6.8L13 9h5.6a2 2 0 0 1 1.9 2.6l-2 6.5A2 2 0 0 1 16.6 19.5H10a3 3 0 0 1-3-3"/>',"thumbs-down":'<path d="M7 13V4h2.5a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H7Z"/><path d="M7 13l4.3 7.3a1.4 1.4 0 0 0 2.6-.8L13 15h5.6a2 2 0 0 0 1.9-2.6l-2-6.5A2 2 0 0 0 16.6 4.5H10a3 3 0 0 0-3 3"/>',"eye-closed":'<path d="M3.5 12S7 6 12 6s8.5 6 8.5 6-3.5 6-8.5 6-8.5-6-8.5-6Z"/><line x1="4" y1="19" x2="20" y2="5"/>',"help-circle":'<circle cx="12" cy="12" r="9"/><path d="M9.2 9.2a2.8 2.8 0 1 1 4.3 2.4c-.9.6-1.5 1.1-1.5 2.2"/><circle cx="12" cy="17" r="1" fill="currentColor" stroke="none"/>',chat:'<path d="M4 5.5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H9.5L5 20.5V16.5H5a1 1 0 0 1-1-1Z"/>',kebab:'<circle cx="12" cy="5" r="1.4" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.4" fill="currentColor" stroke="none"/><circle cx="12" cy="19" r="1.4" fill="currentColor" stroke="none"/>',sun:'<circle cx="12" cy="12" r="4"/><line x1="12" y1="2" x2="12" y2="4.5"/><line x1="12" y1="19.5" x2="12" y2="22"/><line x1="2" y1="12" x2="4.5" y2="12"/><line x1="19.5" y1="12" x2="22" y2="12"/><line x1="4.9" y1="4.9" x2="6.6" y2="6.6"/><line x1="17.4" y1="17.4" x2="19.1" y2="19.1"/><line x1="4.9" y1="19.1" x2="6.6" y2="17.4"/><line x1="17.4" y1="6.6" x2="19.1" y2="4.9"/>',moon:'<path d="M20.5 14.2A8.5 8.5 0 1 1 9.8 3.5a7 7 0 0 0 10.7 10.7Z"/>'};function G(e){let t=Bt[e];return t?`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${t}</svg>`:""}function re(e=document){e.querySelectorAll("[data-fw-icon]").forEach(t=>{var r;if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=(r=t.dataset.fwIcon)!=null?r:"",o=G(n);o||console.warn(`fernwell: unknown icon "${n}"`),t.innerHTML=o,t.classList.add("fw-icon")})}var se="fw-theme",qt="fw:themechange",Rt="--fw-",Ue="data-fw-tokens",Ge="data-fw-theme-init";function le(){try{return window.localStorage}catch{return null}}function ae(){var t;let e=document.documentElement.getAttribute("data-theme");return e==="dark"||e==="light"?e:(t=window.matchMedia)!=null&&t.call(window,"(prefers-color-scheme: dark)").matches?"dark":"light"}function z(e,{persist:t=!0}={}){var n;document.documentElement.setAttribute("data-theme",e),t&&((n=le())==null||n.setItem(se,e)),document.querySelectorAll("[data-fw-theme-toggle]").forEach(o=>Je(o,e)),document.dispatchEvent(new CustomEvent(qt,{detail:e}))}function Xe(){let e=ae()==="dark"?"light":"dark";return z(e),e}function Je(e,t){e.setAttribute("aria-pressed",String(t==="dark"));let n=t==="dark"?e.dataset.fwThemeIconDark:e.dataset.fwThemeIconLight,o=t==="dark"?e.dataset.fwThemeLabelDark:e.dataset.fwThemeLabelLight;if(n!==void 0){let r=`<span class="fw-icon" aria-hidden="true">${G(n)}</span>`;e.innerHTML=o!==void 0?`${r} ${o}`:r}else o!==void 0&&(e.textContent=o)}function $t(e){let t=typeof requestAnimationFrame=="function"?requestAnimationFrame:n=>setTimeout(n,16);t(()=>t(e))}function ce(e=document){var r,i,l,a;let t=(r=le())==null?void 0:r.getItem(se),n=t==="dark"||t==="light"?t:ae(),o=document.documentElement;o.setAttribute(Ge,""),z(n,{persist:!1}),$t(()=>o.removeAttribute(Ge)),e.querySelectorAll("[data-fw-theme-toggle]").forEach(c=>{c.dataset.fwBound||(c.dataset.fwBound="1",Je(c,n),c.addEventListener("click",()=>Xe()))}),(a=(i=window.matchMedia)==null?void 0:(l=i.call(window,"(prefers-color-scheme: dark)")).addEventListener)==null||a.call(l,"change",c=>{var d;(d=le())!=null&&d.getItem(se)||z(c.matches?"dark":"light",{persist:!1})})}var B=new Map;function Qe(e){return e.startsWith("--")?e:`${Rt}${e}`}function Ft(e){return Object.values(e).some(t=>t!==null&&typeof t=="object")}function ze(e){return Object.entries(e).map(([t,n])=>`${Qe(t)}:${n};`).join("")}function Ye(e){let t=document.head.querySelector(`style[${Ue}]`);if(t||!e)return t;let n=document.createElement("style");return n.setAttribute(Ue,""),document.head.appendChild(n),n}function et(){var t;if(B.size===0){(t=Ye(!1))==null||t.remove();return}let e=[];B.forEach(({light:n,dark:o},r)=>{if(Object.keys(n).length&&e.push(`${r}{${ze(n)}}`),Object.keys(o).length){let i=r===":root"?'[data-theme="dark"]':`[data-theme="dark"] ${r}, ${r}[data-theme="dark"]`;e.push(`${i}{${ze(o)}}`)}}),Ye(!0).textContent=e.join(`
|
|
3
|
+
`)}function Vt(e,t={}){var r,i;let n=(r=t.scope)!=null?r:":root",o=(i=B.get(n))!=null?i:{light:{},dark:{}};Ft(e)?(Object.assign(o.light,e.light),Object.assign(o.dark,e.dark)):(Object.assign(o.light,e),Object.assign(o.dark,e)),B.set(n,o),et()}function Kt(e){e?B.delete(e):B.clear(),et()}function jt(e,t=document.documentElement){return getComputedStyle(t).getPropertyValue(Qe(e)).trim()}var fe={};b(fe,{combobox:()=>tt,init:()=>ue});var _t=0;function K(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t])}function tt(e,t={}){var h,N,O,We;let n=(h=t.filter)!=null?h:((f,w)=>f.toLowerCase().includes(w)),o=(N=t.emptyText)!=null?N:"No matches",r=(O=t.options)!=null?O:Zt(e),i=[],l=-1,a=!1,c=e.getAttribute("list");c&&(e.dataset.fwList=c,e.removeAttribute("list"));let d=(We=e.closest(".fw-combobox"))!=null?We:Wt(e),s=document.createElement("ul"),u=`fw-combobox-${++_t}`;s.className="fw-combobox-list",s.id=u,s.setAttribute("role","listbox"),d.appendChild(s),e.setAttribute("role","combobox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-controls",u),e.autocomplete="off";function E(f){i=f,l=-1;let w=e.value.trim().toLowerCase();if(f.length===0){s.innerHTML=`<li class="fw-combobox-empty">${K(o)}</li>`;return}s.innerHTML=f.map((H,F)=>{let V=w?H.toLowerCase().indexOf(w):-1,It=V>-1?`${K(H.slice(0,V))}<b>${K(H.slice(V,V+w.length))}</b>${K(H.slice(V+w.length))}`:K(H);return`<li class="fw-combobox-option" role="option" id="${u}-${F}" data-index="${F}" aria-selected="false">${It}</li>`}).join("")}function m(){let f=e.value.trim().toLowerCase();E(f?r.filter(w=>n(w,f)):r),s.classList.add("is-open"),e.setAttribute("aria-expanded","true")}function p(){s.classList.remove("is-open"),e.setAttribute("aria-expanded","false"),e.removeAttribute("aria-activedescendant"),l=-1}function v(f){let w=s.querySelectorAll(".fw-combobox-option");w.forEach(F=>{F.classList.remove("is-active"),F.setAttribute("aria-selected","false")});let H=w[f];H&&(H.classList.add("is-active"),H.setAttribute("aria-selected","true"),H.scrollIntoView({block:"nearest"}),e.setAttribute("aria-activedescendant",H.id)),l=f}function L(f){var w;e.value=f,p(),a=!0,e.focus(),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),a=!1,(w=t.onSelect)==null||w.call(t,f)}let M=()=>{a||m()},T=()=>{a||m()},g=f=>{f.key==="ArrowDown"?(f.preventDefault(),s.classList.contains("is-open")||m(),v(Math.min(l+1,i.length-1))):f.key==="ArrowUp"?(f.preventDefault(),v(Math.max(l-1,0))):f.key==="Enter"?l>-1&&i[l]!==void 0&&(f.preventDefault(),L(i[l])):f.key==="Escape"&&p()},S=f=>{let w=f.target.closest(".fw-combobox-option");w&&(f.preventDefault(),L(i[Number(w.dataset.index)]))},$=f=>{d.contains(f.target)||p()};return e.addEventListener("input",M),e.addEventListener("focus",T),e.addEventListener("keydown",g),s.addEventListener("mousedown",S),document.addEventListener("click",$),{open:m,close:p,setOptions(f){r=f,s.classList.contains("is-open")&&m()},destroy(){e.removeEventListener("input",M),e.removeEventListener("focus",T),e.removeEventListener("keydown",g),s.removeEventListener("mousedown",S),document.removeEventListener("click",$),s.remove(),e.dataset.fwList&&e.setAttribute("list",e.dataset.fwList),delete e.dataset.fwBound}}}function Zt(e){var o;let t=(o=e.getAttribute("list"))!=null?o:e.dataset.fwList,n=t?document.getElementById(t):null;return n?Array.from(n.querySelectorAll("option")).map(r=>r.value||r.textContent||""):[]}function Wt(e){var n;let t=document.createElement("div");return t.className="fw-combobox",(n=e.parentNode)==null||n.insertBefore(t,e),t.appendChild(e),t}function ue(e=document){e.querySelectorAll("input[data-fw-combobox]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",tt(t))})}var Te={};b(Te,{bindOutsideClickToClose:()=>pe,close:()=>C,init:()=>we,open:()=>he,toggle:()=>Gt});var D="is-open",ot="fw-scroll-lock",P=[],me=new WeakMap,Ut='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function ve(e){return typeof e=="string"?document.getElementById(e):e}function Ee(e){if(e.classList.contains("fw-modal-overlay"))return e;let t=e.id?document.querySelector(`[data-fw-drawer-overlay="${e.id}"]`):null;if(t)return t;let n=e.previousElementSibling;return n instanceof HTMLElement&&n.classList.contains("fw-drawer-overlay")?n:null}function he(e,t=(n=>(n=document.activeElement)!=null?n:null)()){var i;let o=ve(e);if(!o||o.classList.contains(D))return;o.classList.add(D),(i=Ee(o))==null||i.classList.add(D),me.set(o,t),P.push(o),document.body.classList.add(ot),o.dispatchEvent(new CustomEvent("fw:open",{bubbles:!0}));let r=o.querySelector(Ut);r?r.focus({preventScroll:!0}):(o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1"),o.focus({preventScroll:!0}))}function C(e){var o,r,i;let t=ve(e);if(!t||!t.classList.contains(D))return;t.classList.remove(D),(o=Ee(t))==null||o.classList.remove(D);let n=P.indexOf(t);n>-1&&P.splice(n,1),P.length===0&&document.body.classList.remove(ot),t.dispatchEvent(new CustomEvent("fw:close",{bubbles:!0})),(i=(r=me.get(t))==null?void 0:r.focus)==null||i.call(r,{preventScroll:!0}),me.delete(t)}function Gt(e){let t=ve(e);t&&(t.classList.contains(D)?C:he)(t)}function pe(e,t){let n=!1;e.addEventListener("mousedown",o=>{n=o.target===e}),e.addEventListener("click",o=>{o.target===e&&n&&t()})}var nt=!1;function we(e=document){e.querySelectorAll("[data-fw-open-modal], [data-fw-open-drawer]").forEach(t=>{var o,r;if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=(r=(o=t.dataset.fwOpenModal)!=null?o:t.dataset.fwOpenDrawer)!=null?r:"";t.addEventListener("click",()=>he(n,t))}),e.querySelectorAll(".fw-modal-overlay").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",pe(t,()=>C(t)),t.querySelectorAll("[data-fw-close-modal]").forEach(n=>n.addEventListener("click",()=>C(t))))}),e.querySelectorAll(".fw-drawer").forEach(t=>{if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=Ee(t);n&&pe(n,()=>C(t)),t.querySelectorAll("[data-fw-close-drawer]").forEach(o=>o.addEventListener("click",()=>C(t)))}),nt||(nt=!0,document.addEventListener("keydown",t=>{t.key==="Escape"&&P.length&&C(P[P.length-1])}))}var xe={};b(xe,{close:()=>Y,init:()=>be,open:()=>rt});var ye="is-open";function rt(e){let t=Le(e);t&&(t.classList.add(ye),e.setAttribute("aria-expanded","true"))}function Y(e){let t=Le(e);t&&(t.classList.remove(ye),e.setAttribute("aria-expanded","false"))}function Le(e){let t=e.getAttribute("aria-controls");return t?document.getElementById(t):null}function be(e=document){e.querySelectorAll("[data-fw-nav-toggle]").forEach(t=>{var r,i;if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=Le(t);if(!n)return;let o=(i=(r=t.closest(".fw-nav"))!=null?r:t.parentElement)!=null?i:t;t.addEventListener("click",l=>{l.stopPropagation(),(n.classList.contains(ye)?Y:rt)(t)}),document.addEventListener("click",l=>{!o.contains(l.target)&&!n.contains(l.target)&&Y(t)}),document.addEventListener("keydown",l=>{l.key==="Escape"&&Y(t)})})}var He={};b(He,{init:()=>Me,resetAll:()=>at,resetButtonLoading:()=>lt,setButtonLoading:()=>st});var j="fw-btn-loading";function st(e,t){var o,r;if(!e||e.classList.contains(j))return;e.dataset.fwOriginalHtml=e.innerHTML,e.disabled=!0,e.setAttribute("aria-busy","true"),e.classList.add(j);let n=(r=(o=t!=null?t:e.dataset.fwLoadingText)!=null?o:e.textContent)!=null?r:"";e.innerHTML='<span class="fw-spinner fw-spinner-sm" aria-hidden="true"></span>',e.appendChild(document.createTextNode(n))}function lt(e){!e||!e.classList.contains(j)||(e.disabled=!1,e.removeAttribute("aria-busy"),e.classList.remove(j),e.dataset.fwOriginalHtml!==void 0&&(e.innerHTML=e.dataset.fwOriginalHtml,delete e.dataset.fwOriginalHtml))}function at(e=document){e.querySelectorAll(`.${j}`).forEach(lt)}var it=!1;function Me(e=document){e.querySelectorAll("form[data-fw-loading]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",t.addEventListener("submit",()=>{let n=t.querySelector('button[type="submit"], button:not([type])');st(n)}))}),it||(it=!0,window.addEventListener("pageshow",t=>{t.persisted&&at()}))}var Ae={};b(Ae,{hide:()=>ct,show:()=>Yt});var y=null,q=null;function zt(){return y&&y.isConnected||(y=document.createElement("div"),y.className="fw-toast",y.setAttribute("role","status"),y.setAttribute("aria-live","polite"),y.innerHTML='<span class="fw-toast-dot" aria-hidden="true"></span><span class="fw-toast-text"></span>',document.body.appendChild(y)),y}function Yt(e,{variant:t="success",duration:n=4e3}={}){let o=zt();return o.className=`fw-toast${t==="success"?"":` fw-toast-${t}`}`,o.querySelector(".fw-toast-text").textContent=e,q&&clearTimeout(q),o.classList.remove("is-show"),o.offsetWidth,o.classList.add("is-show"),n>0&&(q=setTimeout(ct,n)),o}function ct(){y==null||y.classList.remove("is-show"),q&&clearTimeout(q),q=null}var Pe={};b(Pe,{getSelected:()=>Ce,init:()=>De,selectAll:()=>pt,setRowSelected:()=>mt,sort:()=>ke});var Xt="is-selected";function ge(e,t,n){e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))}function dt(e,t){var o,r,i;let n=e.cells[t];return(i=(r=n==null?void 0:n.dataset.fwSortValue)!=null?r:(o=n==null?void 0:n.textContent)==null?void 0:o.trim())!=null?i:""}function Jt(e,t){let n=Number(e),o=Number(t);return e!==""&&t!==""&&Number.isFinite(n)&&Number.isFinite(o)?n-o:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function ft(e){var t,n;return Array.from((n=(t=e.tHead)==null?void 0:t.querySelectorAll("th[data-fw-sort]"))!=null?n:[])}function ut(e){return e.getAttribute("aria-sort")==="ascending"?"descending":"ascending"}function ke(e,t,n){let o=e.tBodies[0];if(!o)return;let r=Array.from(o.rows),i=r.filter(d=>d.cells.length>t),l=r.filter(d=>d.cells.length<=t),a=n==="ascending"?1:-1;i.sort((d,s)=>a*Jt(dt(d,t),dt(s,t))),[...i,...l].forEach(d=>o.appendChild(d));let c=null;ft(e).forEach(d=>{let s=d.cellIndex===t;d.setAttribute("aria-sort",s?n:"none"),s&&(c=d)}),c&&ge(e,"fw:sort",{column:t,direction:n,th:c})}function X(e){return Array.from(e.querySelectorAll("tbody input[data-fw-select-row]"))}function Se(e,t){e.classList.toggle(Xt,t),e.setAttribute("aria-selected",t?"true":"false")}function Oe(e){let t=e.querySelector("[data-fw-select-all]");if(!t)return;let n=X(e),o=n.filter(r=>r.checked).length;t.checked=o>0&&o===n.length,t.indeterminate=o>0&&o<n.length}function Ce(e){return X(e).filter(t=>t.checked).map(t=>t.closest("tr")).filter(t=>t!==null)}function mt(e,t){let n=e.querySelector("input[data-fw-select-row]");n&&(n.checked=t),Se(e,t);let o=e.closest("table");o&&(Oe(o),ge(o,"fw:select",{rows:Ce(o),all:!1}))}function pt(e,t){X(e).forEach(n=>{n.checked=t;let o=n.closest("tr");o&&Se(o,t)}),Oe(e),ge(e,"fw:select",{rows:Ce(e),all:!0})}function De(e=document){e.querySelectorAll("table[data-fw-table]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",ft(t).forEach(n=>{n.hasAttribute("aria-sort")||n.setAttribute("aria-sort","none")}),t.addEventListener("click",n=>{let o=n.target.closest("th[data-fw-sort]");o&&t.contains(o)&&ke(t,o.cellIndex,ut(o))}),t.addEventListener("keydown",n=>{if(n.key!=="Enter"&&n.key!==" ")return;let o=n.target;if(!o.matches("th[data-fw-sort], th[data-fw-sort] .fw-table-sort"))return;let r=o.closest("th[data-fw-sort]");r&&(n.preventDefault(),ke(t,r.cellIndex,ut(r)))}),t.addEventListener("change",n=>{let o=n.target;if(o.matches("[data-fw-select-all]"))pt(t,o.checked);else if(o.matches("[data-fw-select-row]")){let r=o.closest("tr");r&&mt(r,o.checked)}}),X(t).forEach(n=>{let o=n.closest("tr");o&&n.checked&&Se(o,!0)}),Oe(t))})}var Ne={};b(Ne,{close:()=>Q,collapseAll:()=>on,expandAll:()=>nn,init:()=>Ie,open:()=>J,reveal:()=>ht,toggle:()=>tn});var A=".fw-menu-group",Et=".fw-menu-link, .fw-menu-summary",Qt="is-current";function en(e,t){e.dispatchEvent(new CustomEvent("fw:toggle",{bubbles:!0,detail:t}))}function J(e){e.open=!0}function Q(e){e.open=!1}function tn(e,t){e.open=t!=null?t:!e.open}function nn(e){e.querySelectorAll(A).forEach(J)}function on(e){e.querySelectorAll(A).forEach(Q)}function ht(e){var n,o,r,i;let t=(o=(n=e.parentElement)==null?void 0:n.closest(A))!=null?o:null;for(;t;)J(t),t=(i=(r=t.parentElement)==null?void 0:r.closest(A))!=null?i:null}function vt(e){e.querySelectorAll(A).forEach(t=>{let n=t.querySelector(":scope > .fw-menu-summary");if(!n)return;let o=!t.open&&t.querySelector("[aria-current]")!==null;n.classList.toggle(Qt,o)})}function wt(e){return e.matches(".fw-menu-summary")?e.closest(A):null}function Tt(e){var n,o,r;return(r=(o=((n=wt(e))!=null?n:e).parentElement)==null?void 0:o.closest(A))!=null?r:null}function rn(e){var t,n;for(let o=Tt(e);o;o=(n=(t=o.parentElement)==null?void 0:t.closest(A))!=null?n:null)if(!o.open)return!1;return!0}function sn(e){return Array.from(e.querySelectorAll(Et)).filter(rn)}function I(e){return e?(e.focus(),!0):!1}function ln(e){var n;let t=e.closest(".fw-menu-split");return(n=t==null?void 0:t.querySelector(":scope > .fw-menu-group > .fw-menu-summary"))!=null?n:null}function an(e,t){var a;if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return;let n=t.target instanceof HTMLElement&&t.target.matches(Et)?t.target:null;if(!n||!e.contains(n))return;let o=sn(e),r=o.indexOf(n),i=wt(n),l=!0;switch(t.key){case"ArrowDown":I(o[r+1]);break;case"ArrowUp":I(o[r-1]);break;case"Home":I(o[0]);break;case"End":I(o[o.length-1]);break;case"ArrowRight":i?i.open?i.contains((a=o[r+1])!=null?a:e)&&I(o[r+1]):J(i):I(ln(n));break;case"ArrowLeft":if(i!=null&&i.open)Q(i);else{let c=Tt(n);I(c==null?void 0:c.querySelector(":scope > .fw-menu-summary"))}break;default:l=!1}l&&t.preventDefault()}function Ie(e=document){e.querySelectorAll("[data-fw-menu]").forEach(t=>{if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=t.hasAttribute("data-fw-menu-exclusive");t.addEventListener("toggle",o=>{let r=o.target;!(r instanceof HTMLDetailsElement)||!r.matches(A)||(n&&r.open&&r.parentElement&&Array.from(r.parentElement.children).forEach(i=>{i!==r&&i instanceof HTMLDetailsElement&&i.matches(A)&&Q(i)}),vt(t),en(r,{group:r,open:r.open}))},!0),t.addEventListener("keydown",o=>an(t,o)),t.querySelectorAll("[aria-current]").forEach(ht),vt(t)})}var Re={};b(Re,{init:()=>qe,popover:()=>xt});var cn={top:"bottom",bottom:"top",left:"right",right:"left"},R=10;function dn(e){switch(e){case"top-left":return{side:"top",align:"end"};case"top-right":return{side:"top",align:"start"};case"bottom-left":return{side:"bottom",align:"end"};case"bottom-right":return{side:"bottom",align:"start"};default:return{side:e,align:"center"}}}var un={start:"right",end:"left"};function fn(e,t){return t==="center"?e:`${e}-${un[t]}`}function Be(e,t,n,o){switch(e){case"top":return t.top;case"bottom":return o-t.bottom;case"left":return t.left;case"right":return n-t.right}}function yt(e,t,n,o){switch(e){case"top":return t.top-o-n.height;case"bottom":return t.bottom+o;case"left":return t.left-o-n.width;case"right":return t.right+o}}function Lt(e,t,n,o){switch(e){case"start":return t;case"end":return t+n-o;case"center":return t+n/2-o/2}}function ee(e,t,n){return Math.min(Math.max(e,t),n>t?n:t)}function te(e,t,n={}){var T,g,S;let o=(T=n.placement)!=null?T:"bottom",r=(g=n.offset)!=null?g:8,i=(S=n.padding)!=null?S:8,l=e.getBoundingClientRect(),a=t.getBoundingClientRect(),c=window.innerWidth,d=window.innerHeight,{side:s,align:u}=dn(o),E=cn[s],m=s==="top"||s==="bottom"?a.height:a.width,p=Be(s,l,c,d)-r<m&&Be(E,l,c,d)-r>Be(s,l,c,d)-r?E:s,v,L,M;return p==="top"||p==="bottom"?(v=yt(p,l,a,r),L=ee(Lt(u,l.left,l.width,a.width),i,c-a.width-i),M=ee(l.left+l.width/2-L,R,Math.max(a.width-R,R))):(L=yt(p,l,a,r),v=ee(Lt("center",l.top,l.height,a.height),i,d-a.height-i),M=ee(l.top+l.height/2-v,R,Math.max(a.height-R,R))),{placement:fn(p,u),top:v,left:L,arrowOffset:M}}function bt(e,t){let n=l=>!e.some(a=>a.contains(l)),o=!1,r=l=>{o=n(l.target)},i=l=>{o&&n(l.target)&&t()};return document.addEventListener("mousedown",r,!0),document.addEventListener("click",i,!0),()=>{document.removeEventListener("mousedown",r,!0),document.removeEventListener("click",i,!0)}}var mn='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function xt(e,t,n={}){var S,$;let o=(S=n.placement)!=null?S:"bottom",r=($=n.offset)!=null?$:8;e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-controls",t.id),e.setAttribute("aria-expanded","false"),t.setAttribute("role","dialog"),t.setAttribute("aria-modal","false"),t.classList.add("fw-popover");let i=t.parentNode,l=t.nextSibling,a=!1,c=null,d=0;function s(){let h=te(e,t,{placement:o,offset:r});t.style.top=`${h.top}px`,t.style.left=`${h.left}px`,t.setAttribute("data-placement",h.placement)}function u(){cancelAnimationFrame(d),d=requestAnimationFrame(s)}function E(h){h.key==="Escape"&&(h.stopPropagation(),v())}function m(h){let N=h.relatedTarget;N&&(t.contains(N)||e.contains(N))||setTimeout(()=>{if(!a)return;let O=document.activeElement;O===document.body||O===null||t.contains(O)||e.contains(O)||v()},0)}function p(){if(a)return;a=!0,t.parentNode!==document.body&&document.body.appendChild(t),s(),t.classList.add("is-open"),e.setAttribute("aria-expanded","true");let h=t.querySelector(mn);h?h.focus({preventScroll:!0}):(t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0})),c=bt([e,t],v),window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),t.addEventListener("keydown",E),t.addEventListener("focusout",m),t.dispatchEvent(new CustomEvent("fw:open",{bubbles:!0}))}function v(){if(!a)return;a=!1,t.classList.remove("is-open"),e.setAttribute("aria-expanded","false"),c==null||c(),c=null,window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u),t.removeEventListener("keydown",E),t.removeEventListener("focusout",m),cancelAnimationFrame(d),l===null||l.parentNode===i?i.insertBefore(t,l):i.appendChild(t),t.dispatchEvent(new CustomEvent("fw:close",{bubbles:!0})),e.focus({preventScroll:!0})}function L(){(a?v:p)()}let M=()=>L(),T=Array.from(t.querySelectorAll("[data-fw-popover-close]")),g=()=>v();return e.addEventListener("click",M),T.forEach(h=>h.addEventListener("click",g)),{open:p,close:v,toggle:L,destroy(){a&&v(),e.removeEventListener("click",M),T.forEach(h=>h.removeEventListener("click",g)),delete e.dataset.fwBound}}}function qe(e=document){e.querySelectorAll("[data-fw-popover-trigger]").forEach(t=>{var r;if(t.dataset.fwBound)return;let n=(r=t.dataset.fwPopoverTrigger)!=null?r:"",o=document.getElementById(n);if(!o){console.warn(`fernwell: popover trigger references missing panel #${n}`);return}t.dataset.fwBound="1",xt(t,o,{placement:t.dataset.fwPopoverPlacement||void 0,offset:t.dataset.fwPopoverOffset?Number(t.dataset.fwPopoverOffset):void 0})})}var Ke={};b(Ke,{init:()=>Ve,tooltip:()=>St});var pn=400,vn=300,En=100,Z=new WeakMap,x=null,k=null,W=0,U=0,Fe=0,Ht=0;function hn(){if(x&&x.isConnected)return x;let e=document.createElement("div");return e.className="fw-tooltip",e.id="fw-tooltip",e.setAttribute("role","tooltip"),document.body.appendChild(e),e.addEventListener("mouseenter",At),e.addEventListener("mouseleave",()=>gt()),x=e,e}function At(){clearTimeout(U)}function kt(){if(!k||!x)return;let e=Z.get(k);if(!e)return;let t=te(k,x,{placement:e.placement,offset:e.offset});x.style.top=`${t.top}px`,x.style.left=`${t.left}px`,x.style.setProperty("--fw-tooltip-arrow-pos",`${t.arrowOffset}px`),x.setAttribute("data-placement",t.placement)}function ne(){cancelAnimationFrame(Fe),Fe=requestAnimationFrame(kt)}function Mt(e){var o;if(clearTimeout(W),At(),!Z.get(e))return;k=e;let n=hn();n.textContent=(o=e.dataset.fwTooltipText)!=null?o:"",kt(),n.classList.add("is-open"),window.addEventListener("scroll",ne,!0),window.addEventListener("resize",ne)}function _(){clearTimeout(W),clearTimeout(U),x&&x.classList.remove("is-open"),window.removeEventListener("scroll",ne,!0),window.removeEventListener("resize",ne),cancelAnimationFrame(Fe),k&&(Ht=performance.now()),k=null}function $e(e,t){clearTimeout(U),clearTimeout(W);let n=Z.get(e);n&&(t||performance.now()-Ht<vn?Mt(e):W=window.setTimeout(()=>Mt(e),n.delay))}function gt(){clearTimeout(W),clearTimeout(U),U=window.setTimeout(_,En)}function St(e,t={}){var d,s,u;let n={placement:(d=t.placement)!=null?d:"top",offset:(s=t.offset)!=null?s:6,delay:(u=t.delay)!=null?u:pn};Z.set(e,n);let o=e.getAttribute("title");o!==null&&(e.dataset.fwTooltipText=o,e.removeAttribute("title")),e.setAttribute("aria-describedby","fw-tooltip");let r=()=>$e(e,!1),i=()=>gt(),l=()=>$e(e,!0),a=()=>{k===e&&_()},c=E=>{E.key==="Escape"&&k===e&&_()};return e.addEventListener("mouseenter",r),e.addEventListener("mouseleave",i),e.addEventListener("focus",l),e.addEventListener("blur",a),e.addEventListener("keydown",c),{show:()=>$e(e,!0),hide:()=>{k===e&&_()},destroy(){k===e&&_(),e.removeEventListener("mouseenter",r),e.removeEventListener("mouseleave",i),e.removeEventListener("focus",l),e.removeEventListener("blur",a),e.removeEventListener("keydown",c),e.removeAttribute("aria-describedby"),e.dataset.fwTooltipText!==void 0&&(e.setAttribute("title",e.dataset.fwTooltipText),delete e.dataset.fwTooltipText),Z.delete(e),delete e.dataset.fwBound}}}function Ve(e=document){e.querySelectorAll("[data-fw-tooltip]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",St(t,{placement:t.dataset.fwTooltipPlacement||void 0,offset:t.dataset.fwTooltipOffset?Number(t.dataset.fwTooltipOffset):void 0,delay:t.dataset.fwTooltipDelay?Number(t.dataset.fwTooltipDelay):void 0}))})}var Ze={};b(Ze,{init:()=>_e,tabs:()=>Pt});function wn(e,t){e.dispatchEvent(new CustomEvent("fw:tabs-change",{bubbles:!0,detail:t}))}function oe(e){return e.getAttribute("aria-disabled")==="true"}function je(e){let t=e.getAttribute("aria-controls");return t?document.getElementById(t):null}function Ot(e){return e instanceof Element?e.closest('[role="tab"]'):null}function Ct(e,t,n){for(let o=1;o<=e.length;o++){let r=((t+n*o)%e.length+e.length)%e.length;if(!oe(e[r]))return e[r]}}function Dt(e){return e.find(t=>!oe(t))}function Tn(e){for(let t=e.length-1;t>=0;t--)if(!oe(e[t]))return e[t]}function Pt(e,t={}){var d;let n=(d=t.activation)!=null?d:"automatic";function o(){return Array.from(e.querySelectorAll('[role="tab"]'))}function r(s,u=!1){if(oe(s))return;o().forEach(m=>{let p=m===s;m.setAttribute("aria-selected",String(p)),m.tabIndex=p?0:-1;let v=je(m);v&&(v.hidden=!p)}),u&&s.focus();let E=je(s);E&&wn(e,{tab:s,panel:E})}function i(s){o().forEach(u=>{u.tabIndex=u===s?0:-1}),s.focus()}function l(){var E;let s=o(),u=(E=s.find(m=>m.getAttribute("aria-selected")==="true"))!=null?E:Dt(s);s.forEach(m=>{let p=m===u;m.setAttribute("aria-selected",String(p)),m.tabIndex=p?0:-1;let v=je(m);v&&(v.hidden=!p)})}function a(s){let u=Ot(s.target);u&&e.contains(u)&&r(u,!1)}function c(s){let u=Ot(s.target);if(!u)return;let E=o(),m=E.indexOf(u);if(m===-1)return;if(s.key===" "||s.key==="Enter"){n==="manual"&&(s.preventDefault(),r(u,!1));return}let p=e.getAttribute("aria-orientation")==="vertical",v=getComputedStyle(e).direction==="rtl",L=p?"ArrowDown":v?"ArrowLeft":"ArrowRight",M=p?"ArrowUp":v?"ArrowRight":"ArrowLeft",T;if(s.key===L)T=Ct(E,m,1);else if(s.key===M)T=Ct(E,m,-1);else if(s.key==="Home")T=Dt(E);else if(s.key==="End")T=Tn(E);else return;T&&(s.preventDefault(),n==="manual"?i(T):r(T,!0))}return e.addEventListener("click",a),e.addEventListener("keydown",c),l(),{activate:r,destroy(){e.removeEventListener("click",a),e.removeEventListener("keydown",c),delete e.dataset.fwBound}}}function _e(e=document){e.querySelectorAll('[role="tablist"][data-fw-tabs]').forEach(t=>{if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=t.dataset.fwTabsActivation==="manual"?"manual":"automatic";Pt(t,{activation:n})})}var yn="0.4.0";function Ln(e=document){ce(e),ue(e),we(e),be(e),Me(e),De(e),Ie(e),re(e),qe(e),Ve(e),_e(e)}var bn={version:yn,init:Ln,theme:de,combobox:fe,modal:Te,nav:xe,loading:He,toast:Ae,table:Pe,menu:Ne,icon:ie,popover:Re,tooltip:Ke,tabs:Ze},gn=bn;export{fe as combobox,gn as default,ie as icon,Ln as init,He as loading,Ne as menu,Te as modal,xe as nav,Re as popover,Pe as table,Ze as tabs,de as theme,Ae as toast,Ke as tooltip,yn as version};
|
|
4
4
|
//# sourceMappingURL=fernwell.esm.js.map
|