1// Comportamento comum do formulário guiado (ax_guided_header / ax_guided_step / ax_guided_review). 2// O controller da tela calcula o estado e chama estas funções; o markup é o dos helpers ax_guided_*. 3 4export function focusStep(root, event) { 5 const section = event.target.closest?.("[data-guided-step]") 6 if (!section) return 7 8 root.querySelectorAll("[data-guided-step]").forEach((item) => item.classList.toggle("is-active", item === section)) 9 root.querySelectorAll(".ax-guided-steps-nav__item").forEach((item) => item.classList.toggle("is-active", item.dataset.step === section.dataset.guidedStep)) 10} 11 12export function goToStep(root, event) { 13 const section = root.querySelector(`[data-guided-step='${event.currentTarget.dataset.step}']`) 14 if (!section) return 15 16 if (section.matches(".is-collapsible:not(.is-open)")) section.querySelector("[data-ax-disclosure-target~='trigger']")?.click() 17 const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches 18 section.scrollIntoView({ behavior: reduce ? "auto" : "smooth", block: "start" }) 19 section.querySelector("input:not([type='hidden']):not([type='checkbox']):not([type='radio']), select:not([hidden]), button[type='submit']")?.focus({ preventScroll: true }) 20} 21 22// states: { "1": true, ... } por etapa; checks: { chave: [feito, texto] }; count: [feitos, total] 23export function renderProgress(root, { states, checks, count, label, ready }) { 24 const guided = (name) => root.querySelector(`[data-guided='${name}']`) 25 if (!guided("progressBar")) return 26 27 root.querySelectorAll("[data-guided-step]").forEach((section) => { section.dataset.state = states[section.dataset.guidedStep] ? "done" : "todo" }) 28 root.querySelectorAll(".ax-guided-steps-nav__item").forEach((item) => { item.dataset.state = states[item.dataset.step] ? "done" : "todo" }) 29 30 Object.entries(checks).forEach(([key, [done, text]]) => { 31 const item = root.querySelector(`[data-check='${key}']`) 32 if (!item) return 33 item.dataset.state = done ? "done" : "todo" 34 item.querySelector("span").textContent = text 35 }) 36 37 guided("progressBar").style.width = `${Math.round((count[0] / count[1]) * 100)}%` 38 guided("progressCount").textContent = `${count[0]} de ${count[1]}` 39 guided("progressLabel").textContent = label 40 root.classList.toggle("is-ready", ready) 41};
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.