diff --git a/Gemfile.lock b/Gemfile.lock index 3698ab175607..de682718dfa3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -56,16 +56,16 @@ GEM ffi (1.17.0-x86_64-linux-gnu) forwardable-extended (2.6.0) gemoji (4.1.0) - google-protobuf (4.27.3-aarch64-linux) + google-protobuf (4.27.5-aarch64-linux) bigdecimal rake (>= 13) - google-protobuf (4.27.3-arm64-darwin) + google-protobuf (4.27.5-arm64-darwin) bigdecimal rake (>= 13) - google-protobuf (4.27.3-x86_64-darwin) + google-protobuf (4.27.5-x86_64-darwin) bigdecimal rake (>= 13) - google-protobuf (4.27.3-x86_64-linux) + google-protobuf (4.27.5-x86_64-linux) bigdecimal rake (>= 13) html-pipeline (2.14.3) diff --git a/README.md b/README.md index 967ae3df8790..e8b3ccac3904 100644 --- a/README.md +++ b/README.md @@ -154,6 +154,7 @@ Feel free to add your own page(s) by sending a PR. + diff --git a/assets/js/search/ninja-action.min.js b/assets/js/search/ninja-action.min.js index 8f5538706308..cf779a69d403 100644 --- a/assets/js/search/ninja-action.min.js +++ b/assets/js/search/ninja-action.min.js @@ -4,7 +4,7 @@ * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ -var __decorate=this&&this.__decorate||function(t,e,i,n){var o,a=arguments.length,s=a<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(a<3?o(s):a>3?o(e,i,s):o(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};import{LitElement,html,css}from"./lit/index.min.js";import{customElement,property}from"./lit/decorators.min.js";import{classMap}from"./lit/directives/class-map.min.js";import{unsafeHTML}from"./lit/directives/unsafe-html.min.js";import{join}from"./lit/directives/join.min.js";let NinjaAction=class extends LitElement{constructor(){super(),this.selected=!1,this.hotKeysJoinedView=!0,this.addEventListener("click",this.click)}ensureInView(){this.scrollIntoView({block:"nearest"})}click(){this.dispatchEvent(new CustomEvent("actionsSelected",{detail:this.action,bubbles:!0,composed:!0}))}updated(t){t.has("selected")&&this.selected&&this.ensureInView()}highlightMatch(t,e){let i="",n=0;for(let o=0;o${t[o]}`,n++):i+=t[o];return unsafeHTML(i)}render(){let t,e;this.action.mdIcon?t=html`
${this.action.mdIcon}
`:this.action.icon&&(t=this.action.icon?unsafeHTML(`
${this.action.icon}
`):""),this.action.hotkey&&(e=this.hotKeysJoinedView?this.action.hotkey.split(",").map((t=>{const e=t.split("+"),i=html`${join(e.map((t=>html`${t}`)),"+")}`;return html`
${i}
`})):this.action.hotkey.split(",").map((t=>{const e=t.split("+").map((t=>html`${t}`));return html`${e}`})));const i={selected:this.selected,"ninja-action":!0};return html` +var __decorate=this&&this.__decorate||function(t,e,i,n){var o,a=arguments.length,s=a<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(a<3?o(s):a>3?o(e,i,s):o(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};import{LitElement,html,css}from"./lit/index.min.js";import{customElement,property}from"./lit/decorators.min.js";import{classMap}from"./lit/directives/class-map.min.js";import{unsafeHTML}from"./lit/directives/unsafe-html.min.js";import{join}from"./lit/directives/join.min.js";let NinjaAction=class extends LitElement{constructor(){super(),this.selected=!1,this.hotKeysJoinedView=!0,this.addEventListener("click",this.click)}ensureInView(){this.scrollIntoView({block:"nearest"})}click(){this.dispatchEvent(new CustomEvent("actionsSelected",{detail:this.action,bubbles:!0,composed:!0}))}updated(t){t.has("selected")&&this.selected&&this.ensureInView()}highlightMatch(t,e){const tt=new DOMParser().parseFromString(t,'text/html').body.textContent||"";let i="",n=0,o=0;for(o=0;o${t[o]}`,n++):i+=t[o];if(o${this.action.mdIcon}`:this.action.icon&&(t=this.action.icon?unsafeHTML(`
${this.action.icon}
`):""),this.action.hotkey&&(e=this.hotKeysJoinedView?this.action.hotkey.split(",").map((t=>{const e=t.split("+"),i=html`${join(e.map((t=>html`${t}`)),"+")}`;return html`
${i}
`})):this.action.hotkey.split(",").map((t=>{const e=t.split("+").map((t=>html`${t}`));return html`${e}`})));const i={selected:this.selected,"ninja-action":!0};return html`
${t} ${this.action.type?html`
diff --git a/assets/js/search/ninja-keys.min.js b/assets/js/search/ninja-keys.min.js index 407bd8fbf1a7..60b697017c23 100644 --- a/assets/js/search/ninja-keys.min.js +++ b/assets/js/search/ninja-keys.min.js @@ -4,7 +4,7 @@ * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ -var __decorate=this&&this.__decorate||function(e,t,i,s){var o,a=arguments.length,n=a<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var r=e.length-1;r>=0;r--)(o=e[r])&&(n=(a<3?o(n):a>3?o(t,i,n):o(t,i))||n);return a>3&&n&&Object.defineProperty(t,i,n),n};import{LitElement,html}from"./lit/index.min.js";import{customElement,property,state}from"./lit/decorators.min.js";import{repeat}from"./lit/directives/repeat.min.js";import{live}from"./lit/directives/live.min.js";import{createRef,ref}from"./lit-html/directives/ref.min.js";import{classMap}from"./lit/directives/class-map.min.js";import hotkeys from"./hotkeys-js/hotkeys.esm.min.js";import"./ninja-header.min.js";import"./ninja-action.min.js";import{footerHtml}from"./ninja-footer.min.js";import{baseStyles}from"./base-styles.min.js";import{commandScore}from"./command-score.min.js";let NinjaKeys=class extends LitElement{constructor(){super(...arguments),this._ignorePrefixesSplit=null,this.placeholder="Type a command or search...",this.disableHotkeys=!1,this.hideBreadcrumbs=!1,this.ignorePrefixes="",this.openHotkey="cmd+k,ctrl+k",this.navigationUpHotkey="up,shift+tab",this.navigationDownHotkey="down,tab",this.closeHotkey="esc",this.goBackHotkey="backspace",this.selectHotkey="enter",this.hotKeysJoinedView=!1,this.noAutoLoadMdIcons=!1,this.numRecentActions=0,this.data=[],this.visible=!1,this._bump=!0,this._actionMatches=[],this._search="",this._headerRef=createRef(),this._wrapperRef=createRef()}open(e={}){var t,i,s;this._bump=!0,this.visible=!0,this._headerRef.value.focusSearch(),this._actionMatches.length>0&&(this._selected=this._actionMatches[0]),this.setParent(e.parent),null===(t=this._headerRef.value)||void 0===t||t.setSearch(null!==(i=e.search)&&void 0!==i?i:""),this._search=null!==(s=e.search)&&void 0!==s?s:"",setTimeout((()=>{var e,t;null===(t=null===(e=this._wrapperRef.value)||void 0===e?void 0:e.querySelector(".actions-list"))||void 0===t||t.scrollTo({top:0})}),0)}close(){this._bump=!1,this.visible=!1}setParent(e){this._currentRoot=e||void 0,this._selected=void 0,this._search="",this._headerRef.value.setSearch("")}get breadcrumbs(){var e;const t=[];let i=null===(e=this._selected)||void 0===e?void 0:e.parent;if(i)for(t.push(i);i;){const e=[].find((e=>e.id===i));(null==e?void 0:e.parent)&&t.push(e.parent),i=e?e.parent:void 0}return t.reverse()}connectedCallback(){super.connectedCallback(),this.noAutoLoadMdIcons||document.fonts.load("24px Material Icons","apps").then((()=>{})),this._registerInternalHotkeys()}disconnectedCallback(){super.disconnectedCallback(),this._unregisterInternalHotkeys()}_registerInternalHotkeys(){this.openHotkey&&hotkeys(this.openHotkey,(e=>{e.preventDefault(),this.visible?this.close():this.open()})),this.selectHotkey&&hotkeys(this.selectHotkey,(e=>{this.visible&&(e.preventDefault(),this._actionSelected(this._actionMatches[this._selectedIndex]))})),this.goBackHotkey&&hotkeys(this.goBackHotkey,(e=>{this.visible&&(this._search||(e.preventDefault(),this._goBack()))})),this.navigationDownHotkey&&hotkeys(this.navigationDownHotkey,(e=>{this.visible&&(e.preventDefault(),this._selectedIndex>=this._actionMatches.length-1?this._selected=this._actionMatches[0]:this._selected=this._actionMatches[this._selectedIndex+1])})),this.navigationUpHotkey&&hotkeys(this.navigationUpHotkey,(e=>{this.visible&&(e.preventDefault(),0===this._selectedIndex?this._selected=this._actionMatches[this._actionMatches.length-1]:this._selected=this._actionMatches[this._selectedIndex-1])})),this.closeHotkey&&hotkeys(this.closeHotkey,(()=>{this.visible&&this.close()}))}_unregisterInternalHotkeys(){this.openHotkey&&hotkeys.unbind(this.openHotkey),this.selectHotkey&&hotkeys.unbind(this.selectHotkey),this.goBackHotkey&&hotkeys.unbind(this.goBackHotkey),this.navigationDownHotkey&&hotkeys.unbind(this.navigationDownHotkey),this.navigationUpHotkey&&hotkeys.unbind(this.navigationUpHotkey),this.closeHotkey&&hotkeys.unbind(this.closeHotkey)}_actionFocused(e,t){this._selected=e,t.target.ensureInView()}_onTransitionEnd(){this._bump=!1}_goBack(){const e=this.breadcrumbs.length>1?this.breadcrumbs[this.breadcrumbs.length-2]:void 0;this.setParent(e)}render(){var e,t,i,s;const o={bump:this._bump,"modal-content":!0},a={visible:this.visible,modal:!0,isLoadingItems:!1};let n=this._search;null!==(e=this._ignorePrefixesSplit)&&void 0!==e||(this._ignorePrefixesSplit=""!==this.ignorePrefixes?this.ignorePrefixes.split(","):[]),null===(t=this._ignorePrefixesSplit)||void 0===t||t.some((e=>!!n.startsWith(e)&&(n=n.substring(e.length),!0))),n=n.trim();const r={},c=[];(this._currentRoot?null!==(s=null===(i=this.data.find((e=>e.id===this._currentRoot)))||void 0===i?void 0:i.children)&&void 0!==s?s:[]:this.data).forEach(((e,t)=>{var i;if("loading"===e)return void(a.isLoadingItems=!0);if("function"==typeof e){const s=this.data.find((e=>e.id===this._currentRoot));return null===(i=s.children)||void 0===i||i.splice(t,1,"loading"),a.isLoadingItems=!0,void e().then((e=>{var i;null===(i=s.children)||void 0===i||i.splice(t,1,...e),this.render()}))}const s=commandScore(e.title+" "+e.description,n);(!this._currentRoot&&n||e.parent===this._currentRoot)&&(r[e.title]=s.indices,s.score>0&&c.push({score:s.score,item:e}))}));const h=(n?c.sort(((e,t)=>e.score===t.score?e.item.title.localeCompare(t.item.title):t.score-e.score)):c).map((e=>e.item)).reduce(((e,t)=>e.set(t.section,[...e.get(t.section)||[],t])),new Map);this._actionMatches=[...h.values()].flat(),this._actionMatches.length>0&&-1===this._selectedIndex&&(this._selected=this._actionMatches[0]),0===this._actionMatches.length&&(this._selected=void 0);const d=!this._currentRoot&&0!==this.numRecentActions&&!n,l=e=>html` ${repeat(e,(e=>e.id),((e,t)=>{var i;const s=d?0===t?html`
Recently Used
`:this.numRecentActions===t?html`
Other Commands
`:"":"";return html`${s}=0;r--)(o=e[r])&&(n=(a<3?o(n):a>3?o(t,i,n):o(t,i))||n);return a>3&&n&&Object.defineProperty(t,i,n),n};import{LitElement,html}from"./lit/index.min.js";import{customElement,property,state}from"./lit/decorators.min.js";import{repeat}from"./lit/directives/repeat.min.js";import{live}from"./lit/directives/live.min.js";import{createRef,ref}from"./lit-html/directives/ref.min.js";import{classMap}from"./lit/directives/class-map.min.js";import hotkeys from"./hotkeys-js/hotkeys.esm.min.js";import"./ninja-header.min.js";import"./ninja-action.min.js";import{footerHtml}from"./ninja-footer.min.js";import{baseStyles}from"./base-styles.min.js";import{commandScore}from"./command-score.min.js";let NinjaKeys=class extends LitElement{constructor(){super(...arguments),this._ignorePrefixesSplit=null,this.placeholder="Type a command or search...",this.disableHotkeys=!1,this.hideBreadcrumbs=!1,this.ignorePrefixes="",this.openHotkey="cmd+k,ctrl+k",this.navigationUpHotkey="up,shift+tab",this.navigationDownHotkey="down,tab",this.closeHotkey="esc",this.goBackHotkey="backspace",this.selectHotkey="enter",this.hotKeysJoinedView=!1,this.noAutoLoadMdIcons=!1,this.numRecentActions=0,this.data=[],this.visible=!1,this._bump=!0,this._actionMatches=[],this._search="",this._headerRef=createRef(),this._wrapperRef=createRef()}open(e={}){var t,i,s;this._bump=!0,this.visible=!0,this._headerRef.value.focusSearch(),this._actionMatches.length>0&&(this._selected=this._actionMatches[0]),this.setParent(e.parent),null===(t=this._headerRef.value)||void 0===t||t.setSearch(null!==(i=e.search)&&void 0!==i?i:""),this._search=null!==(s=e.search)&&void 0!==s?s:"",setTimeout((()=>{var e,t;null===(t=null===(e=this._wrapperRef.value)||void 0===e?void 0:e.querySelector(".actions-list"))||void 0===t||t.scrollTo({top:0})}),0)}close(){this._bump=!1,this.visible=!1}setParent(e){this._currentRoot=e||void 0,this._selected=void 0,this._search="",this._headerRef.value.setSearch("")}get breadcrumbs(){var e;const t=[];let i=null===(e=this._selected)||void 0===e?void 0:e.parent;if(i)for(t.push(i);i;){const e=[].find((e=>e.id===i));(null==e?void 0:e.parent)&&t.push(e.parent),i=e?e.parent:void 0}return t.reverse()}connectedCallback(){super.connectedCallback(),this.noAutoLoadMdIcons||document.fonts.load("24px Material Icons","apps").then((()=>{})),this._registerInternalHotkeys()}disconnectedCallback(){super.disconnectedCallback(),this._unregisterInternalHotkeys()}_registerInternalHotkeys(){this.openHotkey&&hotkeys(this.openHotkey,(e=>{e.preventDefault(),this.visible?this.close():this.open()})),this.selectHotkey&&hotkeys(this.selectHotkey,(e=>{this.visible&&(e.preventDefault(),this._actionSelected(this._actionMatches[this._selectedIndex]))})),this.goBackHotkey&&hotkeys(this.goBackHotkey,(e=>{this.visible&&(this._search||(e.preventDefault(),this._goBack()))})),this.navigationDownHotkey&&hotkeys(this.navigationDownHotkey,(e=>{this.visible&&(e.preventDefault(),this._selectedIndex>=this._actionMatches.length-1?this._selected=this._actionMatches[0]:this._selected=this._actionMatches[this._selectedIndex+1])})),this.navigationUpHotkey&&hotkeys(this.navigationUpHotkey,(e=>{this.visible&&(e.preventDefault(),0===this._selectedIndex?this._selected=this._actionMatches[this._actionMatches.length-1]:this._selected=this._actionMatches[this._selectedIndex-1])})),this.closeHotkey&&hotkeys(this.closeHotkey,(()=>{this.visible&&this.close()}))}_unregisterInternalHotkeys(){this.openHotkey&&hotkeys.unbind(this.openHotkey),this.selectHotkey&&hotkeys.unbind(this.selectHotkey),this.goBackHotkey&&hotkeys.unbind(this.goBackHotkey),this.navigationDownHotkey&&hotkeys.unbind(this.navigationDownHotkey),this.navigationUpHotkey&&hotkeys.unbind(this.navigationUpHotkey),this.closeHotkey&&hotkeys.unbind(this.closeHotkey)}_actionFocused(e,t){this._selected=e,t.target.ensureInView()}_onTransitionEnd(){this._bump=!1}_goBack(){const e=this.breadcrumbs.length>1?this.breadcrumbs[this.breadcrumbs.length-2]:void 0;this.setParent(e)}render(){var e,t,i,s;const o={bump:this._bump,"modal-content":!0},a={visible:this.visible,modal:!0,isLoadingItems:!1};let n=this._search;null!==(e=this._ignorePrefixesSplit)&&void 0!==e||(this._ignorePrefixesSplit=""!==this.ignorePrefixes?this.ignorePrefixes.split(","):[]),null===(t=this._ignorePrefixesSplit)||void 0===t||t.some((e=>!!n.startsWith(e)&&(n=n.substring(e.length),!0))),n=n.trim();const r={},c=[];let ps=new DOMParser();(this._currentRoot?null!==(s=null===(i=this.data.find((e=>e.id===this._currentRoot)))||void 0===i?void 0:i.children)&&void 0!==s?s:[]:this.data).forEach(((e,t)=>{var i;if("loading"===e)return void(a.isLoadingItems=!0);if("function"==typeof e){const s=this.data.find((e=>e.id===this._currentRoot));return null===(i=s.children)||void 0===i||i.splice(t,1,"loading"),a.isLoadingItems=!0,void e().then((e=>{var i;null===(i=s.children)||void 0===i||i.splice(t,1,...e),this.render()}))}const rr=ps.parseFromString(e.title,'text/html');const rs=rr.body.textContent.trim()||"";const s=commandScore(rs+" "+e.description,n);(!this._currentRoot&&n||e.parent===this._currentRoot)&&(r[e.title]=s.indices,s.score>0&&c.push({score:s.score,item:e}))}));const h=(n?c.sort(((e,t)=>e.score===t.score?e.item.title.localeCompare(t.item.title):t.score-e.score)):c).map((e=>e.item)).reduce(((e,t)=>e.set(t.section,[...e.get(t.section)||[],t])),new Map);this._actionMatches=[...h.values()].flat(),this._actionMatches.length>0&&-1===this._selectedIndex&&(this._selected=this._actionMatches[0]),0===this._actionMatches.length&&(this._selected=void 0);const d=!this._currentRoot&&0!==this.numRecentActions&&!n,l=e=>html` ${repeat(e,(e=>e.id),((e,t)=>{var i;const s=d?0===t?html`
Recently Used
`:this.numRecentActions===t?html`
Other Commands
`:"":"";return html`${s}