diff --git a/README.md b/README.md index 881f2ea..a630fa6 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,10 @@ flattened to absolute timeline positions when the node executes, so it can be connected directly to `Sequence Prompt` with `Prompt Format = Timeline` (or `Auto`). +Each slot has CSGlide-style start/end sliders and numeric values. Use the +`@ Add next time slot` button, or type `@` at the start of a new line in a slot +editor, to create the following timed section quickly. + The node keeps the shared visual directive, soundscape, and non-diegetic music outside the clip tabs. The editor state is stored in a serializable JSON widget, making saved workflows portable even when the optional browser panel diff --git a/WORKLOG.md b/WORKLOG.md index 42dfcd1..d19d851 100644 --- a/WORKLOG.md +++ b/WORKLOG.md @@ -1,5 +1,12 @@ # Public development log +## 2026-10-15 — CSGlide-style timeline controls + +- Add per-slot start/end range sliders, a visual duration bar, and numeric + controls to the Sequence Prompt Builder. +- Add `@ Add next time slot` plus a line-start `@` keyboard shortcut for rapid + prompt authoring without changing the emitted Timeline format. + ## 2026-10-15 — Sequence prompt builder - Add `DumasH3SequencePromptBuilder` and its tabbed ComfyUI editor. diff --git a/web/sequence_prompt_builder.js b/web/sequence_prompt_builder.js index 4ed8472..5f26936 100644 --- a/web/sequence_prompt_builder.js +++ b/web/sequence_prompt_builder.js @@ -48,9 +48,21 @@ function configure(node) { }; const input = (type, value, onChange) => { const item = el("input"); item.type = type; item.value = value; - item.style.cssText = "width:100%;box-sizing:border-box;margin:2px 0;color:#111"; + item.style.cssText = type === "range" + ? "width:100%;box-sizing:border-box;margin:2px 0;accent-color:#79c98a" + : "width:100%;box-sizing:border-box;margin:2px 0;color:#111"; item.onchange = () => onChange(item.value); return item; }; + const addSlot = (clip, afterIndex = clip.slots.length - 1) => { + const duration = Number(clip.duration) || 0.1; + const previousEnd = afterIndex >= 0 ? Number(clip.slots[afterIndex]?.end) || 0 : 0; + const remaining = Math.max(0.1, duration - previousEnd); + clip.slots.splice(afterIndex + 1, 0, { + start: previousEnd, + end: Math.min(duration, previousEnd + Math.max(0.1, remaining / 2)), + text: "", + }); + }; const render = () => { const count = Math.max(1, Math.min(MAX_CLIPS, Number(countWidget.value) || 1)); while (state.clips.length < count) state.clips.push({ duration: Number(secondsWidget.value) || 4, slots: [] }); @@ -66,12 +78,34 @@ function configure(node) { clip.slots.forEach((slot, slotIndex) => { const row = el("fieldset"); row.style.cssText = "border:1px solid #4a7255;margin:5px 0;padding:4px"; const legend = el("legend", `Slot ${slotIndex + 1}`); row.append(legend); + const track = el("div"); track.style.cssText = "height:7px;position:relative;margin:4px 0 7px;background:#15251a;border-radius:4px"; + const fill = el("div"); fill.style.cssText = "height:100%;position:absolute;background:#79c98a;border-radius:4px"; + const duration = Number(clip.duration) || 0.1; + const updateTrack = () => { fill.style.left = `${Math.max(0, Number(slot.start) / duration * 100)}%`; fill.style.width = `${Math.max(0, (Number(slot.end) - Number(slot.start)) / duration * 100)}%`; }; + track.append(fill); row.append(track); const times = el("div"); times.style.cssText = "display:flex;gap:4px"; - times.append(el("span", "Start"), input("number", slot.start, (value) => { slot.start = Math.max(0, Number(value) || 0); setState(); }), el("span", "End"), input("number", slot.end, (value) => { slot.end = Math.max(slot.start + 0.1, Number(value) || slot.start + 0.1); setState(); })); row.append(times); - const text = el("textarea"); text.value = slot.text || ""; text.rows = 3; text.style.cssText = "width:100%;box-sizing:border-box;color:#111"; text.onchange = () => { slot.text = text.value; setState(); }; row.append(text); + const startSlider = input("range", slot.start, (value) => { slot.start = Math.min(Math.max(0, Number(value)), Number(slot.end) - 0.1); updateTrack(); setState(); }); + startSlider.min = 0; startSlider.max = Math.max(0.1, duration - 0.1); startSlider.step = 0.1; + const endSlider = input("range", slot.end, (value) => { slot.end = Math.max(Number(slot.start) + 0.1, Math.min(duration, Number(value))); updateTrack(); setState(); }); + endSlider.min = 0.1; endSlider.max = duration; endSlider.step = 0.1; + const startNumber = input("number", slot.start, (value) => { slot.start = Math.min(Math.max(0, Number(value) || 0), Number(slot.end) - 0.1); startSlider.value = slot.start; updateTrack(); setState(); }); + const endNumber = input("number", slot.end, (value) => { slot.end = Math.max(Number(slot.start) + 0.1, Math.min(duration, Number(value) || duration)); endSlider.value = slot.end; updateTrack(); setState(); }); + startNumber.step = endNumber.step = 0.1; startNumber.style.width = endNumber.style.width = "62px"; + const startLabel = el("label", "Start"); startLabel.append(startSlider, startNumber); + const endLabel = el("label", "End"); endLabel.append(endSlider, endNumber); + times.append(startLabel, endLabel); row.append(times); updateTrack(); + const text = el("textarea"); text.value = slot.text || ""; text.rows = 3; text.placeholder = "Describe this timed action. Type @ at the start of a new line to add the next slot."; text.style.cssText = "width:100%;box-sizing:border-box;color:#111"; + text.onchange = () => { slot.text = text.value; setState(); }; + text.onkeydown = (event) => { + if (event.key !== "@") return; + const cursor = text.selectionStart || 0; + if (cursor !== 0 && text.value[cursor - 1] !== "\n") return; + event.preventDefault(); addSlot(clip, slotIndex); setState(); render(); + }; + row.append(text); const remove = el("button", "Remove slot"); remove.type = "button"; remove.onclick = () => { clip.slots.splice(slotIndex, 1); setState(); render(); }; row.append(remove); panel.append(row); }); - const add = el("button", "Add time slot"); add.type = "button"; add.onclick = () => { const start = clip.slots.length ? Number(clip.slots.at(-1).end) : 0; clip.slots.push({ start, end: Math.min(start + 1, Number(clip.duration)), text: "" }); setState(); render(); }; panel.append(add); + const add = el("button", "@ Add next time slot"); add.type = "button"; add.title = "Add a new slot after the last slot"; add.onclick = () => { addSlot(clip); setState(); render(); }; panel.append(add); display.computeSize = (width) => [Math.max(360, Number(width) || 360), Math.min(620, 110 + clip.slots.length * 150)]; node.setSize?.([Math.max(360, Number(node.size?.[0]) || 360), Number(node.computeSize?.()[1]) || 420]); };