1import { Controller } from "@hotwired/stimulus"; 2 3// Auto-dismiss des flash toasts après 4s. 4// Utilise messageTargetConnected pour gérer aussi les toasts injectés 5// dynamiquement via turbo_stream.append (en plus du rendu serveur initial). 6export default class extends Controller { 7 static targets = ["message"]; 8 9 messageTargetConnected(message) { 10 if (message.dataset.timerSet) return; 11 message.dataset.timerSet = "true"; 12 setTimeout(() => this.fadeOut(message), 4000); 13 } 14 15 dismiss(event) { 16 this.fadeOut(event.currentTarget.closest("[data-flash-target='message']")); 17 } 18 19 fadeOut(el) { 20 if (!el || el.dataset.dismissed) return; 21 el.dataset.dismissed = "true"; 22 el.classList.add("animate-flash-out"); 23 el.addEventListener("animationend", () => el.remove(), { once: true }); 24 } 25}
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.