1import { Controller } from "@hotwired/stimulus" 2 3export default class extends Controller { 4 static targets = [ "item", "hiddenOnFilter" ] 5 static values = { 6 currentQuery: String 7 } 8 9 itemTargetConnected(item) { 10 this.#setItemVisibility(item) 11 } 12 13 filter({ currentTarget }) { 14 this.currentQueryValue = currentTarget?.value?.toLowerCase() || '' 15 this.#runFilter() 16 } 17 clear() { 18 this.currentQueryValue = '' 19 this.#runFilter() 20 } 21 refresh() { 22 this.#runFilter() 23 } 24 25 #runFilter() { 26 this.itemTargets.forEach((item) => this.#setItemVisibility(item)) 27 this.hiddenOnFilterTargets.forEach(item => item.hidden = !!this.currentQueryValue) 28 } 29 #setItemVisibility(item) { 30 item.hidden = !item.textContent.toLowerCase().includes(this.currentQueryValue) 31 } 32}
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.