1import { ApplicationController, useTransition, useClickOutside } from 'stimulus-use'; 2 3export default class extends ApplicationController { 4 static targets = ['wrapper', 'backdrop', 'panel']; 5 6 static values = { url: String }; 7 8 connect() { 9 window.addEventListener('turbo:morph', () => { 10 this.enable(); 11 }); 12 this.enable(); 13 } 14 15 enable() { 16 useTransition(this, { element: this.backdropTarget }); 17 useClickOutside(this, { element: this.panelTarget }); 18 this.wrapperTarget.classList.add('hidden'); 19 } 20 21 open(event) { 22 event.preventDefault(); 23 this.urlValue = event.currentTarget.href; 24 this.wrapperTarget.classList.remove('hidden'); 25 this.enter(); 26 } 27 28 close() { 29 this.dismiss(); 30 } 31 32 continue() { 33 window.location = this.urlValue; 34 } 35 36 clickOutside() { 37 this.dismiss(); 38 } 39 40 dismiss() { 41 Promise.all([ 42 this.leave(), 43 ]).then(() => this.wrapperTarget.classList.add('hidden')); 44 } 45}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.