1import { Controller } from "@hotwired/stimulus" 2 3// Toggles field visibility based on the selected step kind. 4export default class extends Controller { 5 static targets = ["kindSelect", "imageFields", "videoFields", "codeFields", "embedFields", "aiPromptFields", "narrationFields", "assemblyFields"] 6 7 connect() { 8 this.toggle() 9 } 10 11 toggle() { 12 const kind = this.kindSelectTarget.value 13 14 this.hideAll() 15 16 if (["video", "assembly", "cast"].includes(kind)) this.showTarget("narrationFields") 17 18 if (kind === "assembly") this.showTarget("assemblyFields") 19 20 switch (kind) { 21 case "image": 22 this.showTarget("imageFields") 23 break 24 case "video": 25 this.showTarget("videoFields") 26 break 27 case "code": 28 this.showTarget("codeFields") 29 break 30 case "asciinema": 31 case "makecode": 32 case "code_asset": 33 case "circuit": 34 case "assembly": 35 case "english": 36 case "cast": 37 // All four reuse `embed_url`. asciinema/makecode take a full URL; 38 // code_asset takes a /code/:public_id reference and circuit a 39 // /circuits/:public_id one (see model docs). 40 this.showTarget("embedFields") 41 break 42 case "ai_prompt": 43 this.showTarget("aiPromptFields") 44 break 45 case "html": 46 // No media fields â the rich content lives in the Description textarea. 47 break 48 } 49 } 50 51 hideAll() { 52 const groups = ["imageFields", "videoFields", "codeFields", "embedFields", "aiPromptFields", "narrationFields", "assemblyFields"] 53 groups.forEach(name => { 54 if (this[`has${name.charAt(0).toUpperCase() + name.slice(1)}Target`]) { 55 this[`${name}Target`].classList.add("hidden") 56 } 57 }) 58 } 59 60 showTarget(name) { 61 const capitalised = name.charAt(0).toUpperCase() + name.slice(1) 62 if (this[`has${capitalised}Target`]) { 63 this[`${capitalised}Target`].classList.remove("hidden") 64 } 65 } 66}
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.