v0.3.0 9fdf386

hx-live.min.js RawHistoryFolder

1(()=>{let e,t=new Set,r=!1,n=Symbol(),i=null,l=null,o=null,s=0,a=!1;const u={childList:!0,subtree:!0,attributes:!0,characterData:!0};let f=null;function c(){r||s>0||(r=!0,queueMicrotask(()=>{i?.disconnect();let e=performance.now();t.forEach(e=>e());let n=performance.now()-e;!a&&n>16&&(console.warn(`htmx: hx-live expressions took ${n.toFixed(1)}ms.`),a=!0),0===t.size?i&&(clearTimeout(f),f=null,document.removeEventListener("input",o,!0),o=null,document.removeEventListener("change",l,!0),i.disconnect(),i=null,l=null,a=!1):i.observe(document.documentElement,u),r=!1}))}let d=new Set("disabled required readonly open inert multiple autofocus novalidate default reversed loop muted controls autoplay playsinline formnovalidate async defer ismap typemustmatch allowfullscreen itemscope nomodule alpha headingreset".split(" ")),p=new Set("checked value selected hidden".split(" ")),h=new Set("contenteditable draggable spellcheck writingsuggestions".split(" ")),m=new Set("tabindex colspan rowspan maxlength minlength size span start rows cols width height min max step low high optimum".split(" "));function g(e,t){return e instanceof HTMLElement?t.toLowerCase():t}function v(e,t){if((t=g(e,t)).startsWith("aria-"))return function(e,t){let r=e?.getAttribute("aria-"+t);return null==r?void 0:O.has(t)?r:q.has(t)?r.trim()?r.trim().split(/\s+/):[]:P(r)}(e,t.slice(5));if(t.startsWith("data-"))return function(e,t){let r=e.getAttribute(t);return null===r?void 0:P(r)}(e,t);if("value"===t&&("number"===e.type||"range"===e.type))return""===e.value?null:e.valueAsNumber;if(p.has(t))return e[t];if(d.has(t)||t.startsWith("shadowroot")&&"shadowrootmode"!==t&&"shadowrootslotassignment"!==t)return e.hasAttribute(t);let r=e.getAttribute(t);if(null!=r&&h.has(t))try{return JSON.parse(r.toLowerCase())}catch{}return m.has(t)&&r?.trim()&&isFinite(r)?+r:r}function y(e,t,r){if(t=g(e,t),"function"==typeof r&&(r=r(v(e,t)),"function"==typeof r?.then))throw new TypeError("hx-live: assignment returned a promise");t.startsWith("aria-")?function(e,t,r){let n="aria-"+t;null==r?e.removeAttribute(n):e.setAttribute(n,q.has(t)&&Array.isArray(r)?r.join(" "):String(r))}(e,t.slice(5),r):t.startsWith("data-")?function(e,t,r){void 0===r?e.removeAttribute(t):e.setAttribute(t,"object"==typeof r||P(r)!==r?JSON.stringify(r):r)}(e,t,r):p.has(t)?function(e,t,r){if("checked"===t||"selected"===t){let n=!!r;e[t]=n,e.toggleAttribute(t,n)}else!1===r||null==r?(e[t]="boolean"!=typeof e[t]&&"",e.removeAttribute(t)):!0===r?(e[t]=!0,e.setAttribute(t,"")):(e[t]=r,e.setAttribute(t,String(r)))}(e,t,r):d.has(t)||t.startsWith("shadowroot")&&"shadowrootmode"!==t&&"shadowrootslotassignment"!==t?e.toggleAttribute(t,!!r):null==r?e.removeAttribute(t):e.setAttribute(t,String(r))}function b(e,t){return t?new Set(e.map(t)):e}function x(e,t){let r=e.prefix;return r+("data-"===r?L(t):r?t.toLowerCase():t)}function w(e,t,r){if(!e.cascades)return e.prefix?t.hasAttribute(r)&&t:t;for(;t&&!t.hasAttribute(r);)t=t.parentElement;return t}function A(e,t,r,n){if("string"!=typeof t)return!1;let i=x(e,t);return b(e.elts,e.cascades&&(t=>w(e,t,i)||!n&&t)).forEach(e=>e&&y(e,i,r)),!0}let S={get:(e,t)=>{if(!e.prefix&&"class"===t)return e.scope.class;if("string"!=typeof t)return;let r=x(e,t),n=e.elts[0]&&w(e,e.elts[0],r);return n?v(n,r):void 0},set:(e,t,r)=>A(e,t,r),deleteProperty:(e,t)=>A(e,t,void 0,!0),has:(e,t)=>"data-"===e.prefix&&"string"==typeof t&&!!e.elts[0]&&!!w(e,e.elts[0],x(e,t)),ownKeys:e=>{if("data-"!==e.prefix)return[];let t=[],r=new Set;for(let n=e.elts[0];n;n=e.cascades?n.parentElement:null)for(let e of Object.keys(n.dataset))"htmxPowered"===e||r.has(e)||(r.add(e),t.push(e));return t},getOwnPropertyDescriptor:(e,t)=>{if("data-"===e.prefix&&"string"==typeof t&&"htmxPowered"!==t)return e.elts[0]&&w(e,e.elts[0],x(e,t))?{enumerable:!0,configurable:!0}:void 0}};function E(e,t,r,n=""){return new Proxy({elts:e,cascades:t,scope:r,prefix:n},S)}function L(e){return e.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function P(e){try{return JSON.parse(e)}catch{return e}}let j=/(['"`\/])(?:\\.|(?!\1).)*\1|(?<![.\w$#])class(?=\s*[.?[])/gs;function T(e){return e.replace(j,(e,t)=>t?"`"===t?e.replace(/\$\{((?:[^{}]|\{[^{}]*\})*)\}/g,(e,t)=>"${"+T(t)+"}"):e:"attr.class")}let O=new Set("activedescendant details errormessage keyshortcuts label placeholder roledescription valuetext".split(" ")),q=new Set("controls describedby dropeffect flowto labelledby owns relevant".split(" "));function W(e,t){return!!e?.classList.contains(t)}function _(e,t,r){if("function"==typeof r&&(r=r(W(e,t)),"function"==typeof r?.then))throw new TypeError("hx-live: assignment returned a promise");e.classList.toggle(t,!!r),e.classList.length||e.removeAttribute("class")}function k(e,t){let r,n,i,l,o={get data(){return r||=E(e,t,null,"data-")},get aria(){return n||=E(e,t,null,"aria-")},get class(){return i||=function(e,t=!1){let r=e[0],n=(e,r)=>t?e.closest("."+CSS.escape(r)):e,i=e=>W(r&&n(r,e),e),l=(t,r)=>b(e,e=>n(e,t)||e).forEach(e=>_(e,t,r)),o={assign(t){t&&"object"==typeof t&&!Array.isArray(t)?C(l,t):console.warn("hx-live: class.assign expects an object.",{elts:e})},add:(...e)=>e.forEach(e=>l(e,!0)),remove:(...e)=>e.forEach(e=>l(e,!1)),contains:i,toggle(e,t){let r=t??!i(e);return l(e,e=>t??!e),r},replace(r,n){if(t)return!!i(r)&&(l(r,!1),l(n,!0),!0);let o;for(let t=0;t<e.length;t++){let i=e[t].classList.replace(r,n);0===t&&(o=i)}return o}};return new Proxy({},{get:(e,n)=>{if("string"==typeof n&&o[n])return o[n];let l=!t&&r?.classList;if(l&&n in l){let e=l[n];return"function"==typeof e?e.bind(l):e}return r?"string"==typeof n?i(n):void 0:n===Symbol.iterator?()=>[][Symbol.iterator]():void 0},set:(r,n,i)=>{if("string"!=typeof n)return!1;if(t||"value"!==n)l(n,i);else for(let t of e)t.classList.value=i;return!0},deleteProperty:(e,t)=>"string"==typeof t&&(l(t,!1),!0),has:(e,t)=>"string"==typeof t&&i(t),ownKeys:()=>!t&&r?[...r.classList]:[],getOwnPropertyDescriptor:(e,r)=>!t&&i(r)?{enumerable:!0,configurable:!0}:void 0})}(e,t)},get attr(){return l||=E(e,t,o)}};return o}function M(e){let t;return new Proxy(function(){},{apply:(t,r,[n])=>{let i=new Set;for(let t of e){let e=t.closest?.(n);e&&i.add(e)}return Q([...i])},get:(r,n)=>(t||=k(e,!0))[n]})}function $(t,r,n){"class"===r?function(t,r){let n=e.htmxProp(t),i=n.liveClasses||new Set,l=new Set(C((e,r)=>_(t,e,r),r));for(let e of i)l.has(e)||_(t,e,!1);n.liveClasses=l}(t,n):_(t,r.slice(1),n)}function C(e,t){let r=[];if("string"==typeof t&&(t={[t]:!0}),t&&"object"==typeof t)for(let[n,i]of Object.entries(t))for(let t of n.trim().split(/\s+/).filter(Boolean))r.push(t),e(t,!!i);return r}function R(e,t,r){let n=t.startsWith("."),i=n?t.slice(1):t,l=t.startsWith("aria-"),o=n?"."+i:"["+t+"]",s=null==r?e[0]?.parentElement:r.nodeType?r:null,a=s?[s,...s.querySelectorAll(o)]:e.length?document.querySelectorAll("string"==typeof r?r:r?.from||o):[],u=new Set(e);for(let e of a)u.has(e)||(n?(e.classList?.remove(i),0===e.classList?.length&&e.removeAttribute("class")):l?e.setAttribute(t,"false"):e.removeAttribute(t));for(let r of e)n?r.classList?.add(i):l?r.setAttribute(t,"true"):r.setAttribute(t,"")}function D(e,...t){let r=e||document;for(let e of t)e?.addEventListener&&(r=e);return new Promise(e=>{let n=[],i=!1,l=t=>{if(!i){i=!0;for(let e of n)e();e(t)}};for(let e of t){if(null==e||e?.addEventListener)continue;let t="number"==typeof e?e:"string"==typeof e?htmx.parseInterval(e):void 0;if(t>0){let r=setTimeout(()=>l(e),t);n.push(()=>clearTimeout(r))}else"string"==typeof e&&(r.addEventListener(e,l,{once:!0}),n.push(()=>r.removeEventListener(e,l)))}})}function H(e,t,...r){let n=t.startsWith("."),i=n?t.slice(1):t,l=t.startsWith("aria-"),o=r.length>1?r:r[0];if("string"==typeof o&&(o=o.split("|").map(e=>e.trim())),o)if(n){let t=o.findIndex(t=>t&&e.classList.contains(t));t>=0&&e.classList.remove(o[t]);let r=o[(t+1)%o.length];r&&e.classList.add(r)}else{let r=o.indexOf(v(e,t)??""),n=o[(r+1)%o.length];y(e,t,""===n?void 0:n)}else if(n)e.classList.toggle(i);else if(l){let r=e.getAttribute(t);e.setAttribute(t,"true"===r?"false":"true")}else e.toggleAttribute(t)}function F(){let e=new Map;return(t,r)=>{let i=(l=r?r.toString():null,e.get(l)||(e.set(l,{last:0,reject:null}),e.get(l)));var l;i.reject?.(n),i.reject=null;let o=++i.last;if(!r)return new Promise((e,r)=>{i.reject=r,setTimeout(()=>{o===i.last&&(i.reject=null,e())},t)});setTimeout(()=>o===i.last&&r(),t)}}function I(t){let r=e.htmxProp(t);return r.debounce||(r.debounce=F())}function N(e,t=document){return r=>{if("string"!=typeof r)return Q(r?.nodeType?[r]:[...r||[]]);let n=r,i=n.match(/^(.+)\s+in\s+(.+)$/),l=[t];if(i&&(n=i[1],l="this"===i[2]||"me"===i[2]?[e]:[...document.querySelectorAll(i[2])]),!l.length)return Q([]);let o,s=e=>{if(1===l.length)return[...l[0].querySelectorAll(e)];let t=[],r=new Set;for(let n of l)for(let i of n.querySelectorAll(e))r.has(i)||(r.add(i),t.push(i));return t.sort((e,t)=>4&e.compareDocumentPosition(t)?-1:1)},a=n.match(/^(next|previous|closest|first|last)\s+(.+)$/);if(a){let[,t,r]=a,n=t=>e.compareDocumentPosition(t);if("closest"===t){let t=e.closest?.(r);o=t?[t]:[]}else{let e=s(r);if("first"===t)o=e.slice(0,1);else if("last"===t)o=e.slice(-1);else if("next"===t){let t=e.find(e=>4&n(e));o=t?[t]:[]}else{let t=e.reverse().find(e=>2&n(e));o=t?[t]:[]}}}else o=s(n);return Q(o)}}let J="map filter reduce reduceRight forEach some every find findIndex findLast findLastIndex flatMap flat slice indexOf lastIndexOf includes join at".split(" "),z={before:"beforebegin",after:"afterend",start:"afterbegin",end:"beforeend"};function K(e,t,r){let n=e.parentElement;"into"===t?e.innerHTML=r:"replace"===t?e.outerHTML=r:e.insertAdjacentHTML(z[t],r),htmx.process(n)}let B,X,Z,G=()=>{};function Q(e){let t,r,n=new Proxy({},{get:(i,l)=>{if("count"===l)return e.length;if("arr"===l)return()=>e.slice();if(l===Symbol.iterator)return()=>e.values();if("q"===l)return t=>{let r=new Set;for(let n of e)for(let e of N(n,n)(t).arr())r.add(e);return Q([...r])};if("trigger"===l)return(t,r,i)=>(e.forEach(e=>htmx.trigger(e,t,r,i)),n);if("insert"===l)return(t,r)=>(e.forEach(e=>K(e,t,r)),n);if("take"===l)return(t,r)=>(R(e,t,r),n);if("toggle"===l)return(t,...r)=>(e.forEach(e=>H(e,t,...r)),n);if("attr"===l||"class"===l||"aria"===l)return(t||=k(e,!1))[l];if("data"===l)return(r||=M(e)).data;if("local"===l)return t||=k(e,!1);if("closest"===l)return r||=M(e);if(J.includes(l))return e[l].bind(e);if(!e.length)return"function"==typeof function(e){for(let t=HTMLElement.prototype;t;t=Object.getPrototypeOf(t)){let r=Object.getOwnPropertyDescriptor(t,e);if(r)return r}}(l)?.value?G:void 0;let o=e[0]?.[l];return"function"==typeof o?(...t)=>e.map(e=>e[l](...t))[0]:o&&"object"==typeof o?Q(e.map(e=>e[l])):o},set:(t,r,n)=>(e.forEach(e=>{let t=e[r];if(null==t||"function"==typeof t)e[r]=n;else if("function"==typeof n){let i=n(t);if("function"==typeof i?.then)throw new TypeError("hx-live: assignment returned a promise");e[r]=i}else e[r]=n}),c(),!0)});return n}function U(){let e=htmx.config.metaCharacter||":",t=htmx.config.prefix;X=["hx-live"+e],t&&X.push(t+"live"+e);let r=htmx.config.live?.bindPrefix;void 0===r&&(window.Alpine?(r="",console.warn("hx-live: Alpine detected; set config.live.bindPrefix.")):r=":"),r&&X.push(r),Z=["hx-live"],t&&Z.push(t+"live");let n=X.map(e=>`starts-with(name(), "${e}")`).join(" or "),i=Z.map(e=>`@${e}`).join(" or ");B=(new XPathEvaluator).createExpression(`.//*[@*[${n}] or ${i}]`)}function V(e){for(let t of X)if(e.startsWith(t)&&e.length>t.length)return e.slice(t.length)}function Y(e){let r=e._htmx;if(r?.liveRuns){for(let e of r.liveRuns)t.delete(e);delete r.liveRuns,delete r.effectRegistered,delete r.bindings}}function ee(t){if(t.closest("[hx-ignore]"))return;let r=e.htmxProp(t);if(!r.effectRegistered){let e=Z.find(e=>t.hasAttribute(e));e&&(r.effectRegistered=!0,te(t,t.getAttribute(e)))}r.bindings||=new Set;for(let e of t.attributes){let n=V(e.name);n&&!r.bindings.has(n)&&(r.bindings.add(n),te(t,e.value,n))}}function te(r,s,a){!function(){if(i)return;l=()=>c();let e=htmx.parseInterval(htmx.config.live?.inputDebounce??100)??100;o=()=>{clearTimeout(f),f=setTimeout(c,e)},document.addEventListener("input",o,!0),document.addEventListener("change",l,!0),i=new MutationObserver(l),i.observe(document.documentElement,u)}();let d,p=void 0!==a,h=I(r),m=/\bawait\b/.test(s),g=!p&&m,b=!p||m,x=!1,w=async()=>{if(r.isConnected){if(!g||!x){x=g;try{d||=e.executeJavaScript(r,{debounce:h},s,p,b,!0);let t=b?await d():d();p&&(!function(t,r,n){if("function"==typeof n)throw new TypeError("hx-live: binding returned a function");if("text"===r){let e=null==n?"":String(n);return void(t.textContent!==e&&(t.textContent=e))}if("html"===r){let e=null==n?"":String(n);return void(t.innerHTML!==e&&(t.innerHTML=e))}if("style"===r)return void function(t,r){let n=e.htmxProp(t),i=n.liveStyles||new Set,l=[];if("string"==typeof r)for(let e of r.split(";")){let t=e.indexOf(":");if(t<0)continue;let r=e.slice(0,t).trim(),n=e.slice(t+1).trim();r&&l.push([r,n])}else if(r&&"object"==typeof r)for(let[e,t]of Object.entries(r))l.push([L(e),null==t||""===t?null:String(t)]);let o=new Set(l.map(([e])=>e));for(let e of i)o.has(e)||t.style.removeProperty(e);for(let[e,r]of l)null==r?t.style.removeProperty(e):t.style.setProperty(e,r);0===t.style.length&&t.removeAttribute("style"),n.liveStyles=o}(t,n);if("class"===r||r.startsWith("."))return void $(t,r,n);if(v(t,r)===n)return;y(t,r,n)}(r,a,t),b&&i?.takeRecords())}catch(e){e!==n&&console.error("hx-live expression failed",e,p?{elt:r,attr:a}:{elt:r})}finally{g&&queueMicrotask(()=>x=!1)}}}else t.delete(w)};t.add(w);let A=e.htmxProp(r);A.liveRuns=A.liveRuns||new Set,A.liveRuns.add(w),w()}htmx.live={q:e=>N(document.documentElement)(e),debounce:F(),refresh:()=>c(),take:(e,t,r)=>R(htmx.live.q(e).arr(),t,r),toggle:(e,t,...r)=>htmx.live.q(e).forEach(e=>H(e,t,...r)),forEvent:(...e)=>D(null,...e),nextFrame:()=>new Promise(e=>requestAnimationFrame(e))},htmx.live.$=htmx.live.q,htmx.registerExtension("hx-live",{init:t=>{e=t},htmx_before_cleanup:e=>{Y(e)},htmx_before_morph_attr:(e,t)=>{B||U(),X.some(e=>t.attrName.startsWith(e))&&Y(e)},htmx_after_process:e=>{!function(e){B||U(),1===e.nodeType&&ee(e);let t,r=B.evaluate(e),n=[];for(;t=r.iterateNext();)n.push(t);for(t of n)ee(t)}(e)},htmx_before_swap:()=>{s++},htmx_finally_swap:()=>{0===--s&&t.size>0&&c()},htmx_scope:(t,r)=>{let n=e.htmxProp(t);Object.assign(r.scope,n.liveScope||=function(e){let t=k([e],!1),r=M([e]);return{q:N(e),forEvent:(...t)=>D(e,...t),nextFrame:()=>new Promise(e=>requestAnimationFrame(e)),trigger:(t,r,n)=>htmx.trigger(e,t,r,n),debounce:I(e),take:(t,r)=>R([e],t,r),toggle:(t,...r)=>H(e,t,...r),attr:t.attr,insert:(t,r)=>K(e,t,r),matches:t=>e.matches(t),style:e.style,data:r.data,aria:t.aria,local:t,closest:r}}(t)),r.code=T(r.code),htmx.config.live?.useDollar&&(r.scope.$=r.scope.q)}})})();

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 4

Tags 45

↑↓ moveenter openesc close