π The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
feat(console): focus Theme Studio editors beside responsive live previews
rUvbeb40deafca2
diff --git a/plugins/ruflo-console/README.md b/plugins/ruflo-console/README.mdindex d9f29bcc13..2f7d1bd5f4 100644--- a/plugins/ruflo-console/README.md+++ b/plugins/ruflo-console/README.md@@ -109,3 +109,5 @@ The terminal color picker provides swatches and exact `#RRGGBB` entry for headin**Generate with Claude** or **Generate with Codex** runs the bundled `generate-console-theme` skill through AI Terminal with its existing confirmation and model controls. Enter the design brief first, generate a preset, then paste the returned JSON into **Import theme JSON** and review before saving. The generator produces palette and motion variations of the existing Orbital renderer, not executable animation code. No additional API credentials are requested. Installed Claude plugins discover the bundled skill; Codex can read `plugins/ruflo-console/skills/generate-console-theme/SKILL.md` directly in this checkout.Imports are limited to 4096 characters and a strict version 1 data schema. Status labels and actual check results remain unchanged. Saving requires at least 3:1 foreground/background contrast; the generator aims for 4.5:1.++Theme Studio uses focused Colors, Motion and AI tabs. At 100 content columns it places the editor beside a persistent globe and routing preview; narrower panes stack both panels with a compact routing strip. A single color role picker replaces the repeated swatch lists. Minimum contrast is shown before saving, and Discard draft changes restores the active palette without deleting saved themes.diff --git a/plugins/ruflo-console/hooks/gfx/orbital.ts b/plugins/ruflo-console/hooks/gfx/orbital.tsindex 1cedabbf80..a1fa66f58a 100644--- a/plugins/ruflo-console/hooks/gfx/orbital.ts+++ b/plugins/ruflo-console/hooks/gfx/orbital.ts@@ -65,7 +65,7 @@ export function orbitalGlobe(columns: number, rows: number, timeMs: number, themconst ringX = nx * 0.966 + ny * 0.259const ringY = -nx * 0.259 + ny * 0.966const ring = ringX * ringX / 3.24 + ringY * ringY / 0.16- if (Math.abs(ring - 1) < 0.09) grid.set(x, y, '.', 0x543b32, BLACK)+ if (Math.abs(ring - 1) < 0.09) grid.set(x, y, '.', mix(BLACK, RED, 0.32), BLACK)// Stable positions, slow brightness changes, and clear space around the limb.const seed = ((x + 17) * 73856093 ^ (y + 11) * 19349663) >>> 0if (theme.motion.stars && r2 > 1.2 && seed % 113 === 0) {@@ -146,7 +146,7 @@ export function orbitalHeader(label: string, columns: number, timeMs: number, maconst beat = ((ms % 4800) + 4800) % 4800const stage = Math.floor(beat / 1200)// Sparse graph mesh and moving edge packets, all illustrative rather than reported traffic.- for (let y = 1; y <= 9; y += 2) for (let x = 3; x < grid.columns - 3; x += 6) grid.set(x, y, 'Β·', 0x18241f)+ for (let y = 1; y <= 9; y += 2) for (let x = 3; x < grid.columns - 3; x += 6) grid.set(x, y, 'Β·', mix(BLACK, GREEN, 0.14))nodes.forEach(node => {const next = nodes.find(other => other.index === (node.index + 1) % nodes.length)!const dx = next.x - node.x@@ -156,7 +156,7 @@ export function orbitalHeader(label: string, columns: number, timeMs: number, mafor (let step = 1; step < steps; step++) {const f = step / stepsconst lit = Math.abs(packet - f) < 0.045- grid.set(Math.round(node.x + dx * f), Math.round(node.y + dy * f), lit ? 'β’' : 'Β·', lit ? INK : 0x344138)+ grid.set(Math.round(node.x + dx * f), Math.round(node.y + dy * f), lit ? 'β’' : 'Β·', lit ? INK : mix(BLACK, GREEN, 0.28))}})// Projected direction vectors extend from the hub, rotating independently of the graph.@@ -165,11 +165,11 @@ export function orbitalHeader(label: string, columns: number, timeMs: number, mafor (let step = 2; step <= 8; step++) {const x = center.x + Math.round(Math.cos(angle) * step * Math.min(1.7, grid.columns / 36))const y = center.y + Math.round(Math.sin(angle) * step * 0.36)- grid.set(x, y, step === 8 ? (Math.cos(angle) < 0 ? 'β' : 'βΆ') : 'Β·', step === 8 ? RED : 0x6c4335)+ grid.set(x, y, step === 8 ? (Math.cos(angle) < 0 ? 'β' : 'βΆ') : 'Β·', step === 8 ? RED : mix(BLACK, RED, 0.40))}}const drawHub = () => {- grid.text(center.x - 2, center.y + 1, ' βββ ', 0x4b2924)+ grid.text(center.x - 2, center.y + 1, ' βββ ', mix(BLACK, RED, 0.25))grid.text(center.x - 2, center.y, '[ β ]', stage === 2 ? GREEN : INK)}let hubDrawn = false@@ -185,10 +185,10 @@ export function orbitalHeader(label: string, columns: number, timeMs: number, maconst x = Math.round(center.x + dx * f)const y = Math.round(center.y + dy * f)const lit = pulse - f >= 0 && pulse - f < 0.14- grid.set(x, y, lit ? 'β’' : 'Β·', lit ? GREEN : node.z < 0 ? 0x29342f : 0x58675e)+ grid.set(x, y, lit ? 'β’' : 'Β·', lit ? GREEN : node.z < 0 ? mix(BLACK, GREEN, 0.23) : mix(BLACK, GREEN, 0.48))}if (node.z > 0) {- grid.text(node.x, node.y + 1, 'ββ', 0x4b2924)+ grid.text(node.x, node.y + 1, 'ββ', mix(BLACK, RED, 0.25))grid.text(node.x - 1, node.y, `[${node.icon}]`, pulse > 0.8 ? INK : RED)} else grid.set(node.x, node.y, node.icon, DIM)})@@ -202,10 +202,10 @@ export function orbitalHeader(label: string, columns: number, timeMs: number, maconst cells = Math.max(1, lane - 2)for (let i = 0; i < cells; i++) {const lit = index === stage && i === Math.floor((beat % 1200) / 1200 * cells)- grid.set(x + i, 13, lit ? 'βͺ' : 'Β·', lit ? GREEN : 0x35413c)+ grid.set(x + i, 13, lit ? 'βͺ' : 'Β·', lit ? GREEN : mix(BLACK, GREEN, 0.28))}})- grid.text(1, 15, ' Illustrative orchestration / live graph below', DIM)+ grid.text(1, 15, /preview/i.test(label) ? ' Illustrative routing / palette preview' : ' Illustrative orchestration / live graph below', DIM)} else if (swarm) {const stages = ['DISPATCH', 'PARALLEL', 'SYNC', 'RETURN']const stage = Math.floor(Math.max(0, Number.isFinite(timeMs) ? timeMs : 0) / 1200) % 4@@ -277,7 +277,7 @@ export function orbitalBoot(project: string, columns: number, timeMs: number, ch}const loaderWidth = Math.max(1, grid.columns - 4)const loader = Math.floor((Math.sin(intro / 450) + 1) / 2 * (loaderWidth - 1))- for (let x = 0; x < loaderWidth; x++) grid.set(x + 2, 2, Math.abs(x - loader) < 3 ? '=' : '.', Math.abs(x - loader) < 3 ? GREEN : 0x303c37)+ for (let x = 0; x < loaderWidth; x++) grid.set(x + 2, 2, Math.abs(x - loader) < 3 ? '=' : '.', Math.abs(x - loader) < 3 ? GREEN : mix(BLACK, GREEN, 0.25))grid.text(0, 20, ' LOADING CONSOLE / decorative orbit', RED)const passed = checks?.filter(c => c.ok).length ?? 0const failed = checks?.filter(c => !c.ok).length ?? 0diff --git a/plugins/ruflo-console/hooks/themes.ts b/plugins/ruflo-console/hooks/themes.tsindex 79a0c3cd8c..a90b1b3df4 100644--- a/plugins/ruflo-console/hooks/themes.ts+++ b/plugins/ruflo-console/hooks/themes.ts@@ -43,12 +43,17 @@ export function contrast(a: string, b: string): number {return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05)}export const lowContrast = (theme: ConsoleTheme): ColorKey[] => COLOR_KEYS.filter(key => key !== 'background' && contrast(theme.palette[key], theme.palette.background) < 3)-export type ThemeStudio = { saved: ConsoleTheme[]; active: ConsoleTheme | null; draft: ConsoleTheme; selected: string | null; brief: string; message: string; loaded: boolean; revision: number; saving: boolean; initialLook: State['options']['look'] }+export const themeLayout = (columns: number) => {+ const width = Math.max(1, Math.min(200, Math.floor(columns) || 1))+ return { width, wide: width >= 100, controls: width >= 100 ? 38 : width, preview: width >= 100 ? width - 40 : width }+}+export type StudioTab = 'colors' | 'motion' | 'generate'+export type ThemeStudio = { tab: StudioTab; role: ColorKey; saved: ConsoleTheme[]; active: ConsoleTheme | null; draft: ConsoleTheme; selected: string | null; brief: string; message: string; loaded: boolean; revision: number; saving: boolean; initialLook: State['options']['look'] }const studios = new WeakMap<State, ThemeStudio>()export function themesOf(state: State): ThemeStudio {let studio = studios.get(state)if (!studio) {- studio = { saved: [], active: null, draft: clone(ORBITAL_THEME), selected: null, brief: 'A calm cyberpunk theme with readable colors and slow orbital motion', message: '', loaded: false, revision: 0, saving: false, initialLook: state.options.look }+ studio = { tab: 'colors', role: 'head', saved: [], active: null, draft: clone(ORBITAL_THEME), selected: null, brief: 'A calm cyberpunk theme with readable colors and slow orbital motion', message: '', loaded: false, revision: 0, saving: false, initialLook: state.options.look }studios.set(state, studio)}return studio@@ -71,6 +76,9 @@ export async function loadThemes(state: State, host: Host): Promise<void> {} catch { studio.message = 'Saved themes could not be read; using the configured look.'; host.invalidate() }}export type ThemeActions = {+ tab: (tab: StudioTab) => void+ role: (role: ColorKey) => void+ discard: () => voidselect: (id: string) => voidcolor: (key: ColorKey, value: string) => voidname: (value: string) => void@@ -97,6 +105,9 @@ export function themeActions(state: State, host: Host, ask: (agent: 'claude' | 'finally { studio.saving = false; host.invalidate() }}return {+ tab: tab => { if (['colors', 'motion', 'generate'].includes(tab)) { studio.tab = tab; host.invalidate() } },+ role: role => { if (COLOR_KEYS.includes(role)) { studio.role = role; host.invalidate() } },+ discard: () => { studio.draft = clone(studio.active ?? ORBITAL_THEME); tell('Draft restored to the active palette.') },select: id => {if (id === 'bbs' || id === 'plain' || id === 'orbital') { void persist(id, studio.saved, null, id); return }const theme = studio.saved.find(t => `custom:${t.name}` === id)diff --git a/plugins/ruflo-console/hooks/views/frames.ts b/plugins/ruflo-console/hooks/views/frames.tsindex a0811a8792..d45b1a58ef 100644--- a/plugins/ruflo-console/hooks/views/frames.ts+++ b/plugins/ruflo-console/hooks/views/frames.ts@@ -1,4 +1,4 @@-import { activeTheme, themesOf } from '../themes'+import { activeTheme, themesOf, themeLayout } from '../themes'/*** The pictures of the view in front, by Raster key, for one instant. The render mounts them and the animation loop* blits them, both through `picturesOf`, so a frame is always the mounted size. Each picture's model is read from the@@ -224,8 +224,10 @@ export function picturesOf(state: State, columns: number, nowMs: number, t: numbif (state.view === 'themes') {const draft = themesOf(state).draft- if (draft.motion.globe) pictures.set('theme-globe', orbitalGlobe(Math.max(1, Math.min(columns, width, 72)), 9, state.options.fps > 0 ? t * draft.motion.speed : 0, draft))- pictures.set('theme-preview', orbitalHeader('swarm preview', Math.max(1, Math.min(columns, width, 90)), state.options.fps > 0 ? t * draft.motion.speed : 0, state.pane.rows > 0 ? Math.max(1, Math.min(16, state.pane.rows - 12)) : 16, draft))+ const layout = themeLayout(Math.min(columns, width))+ const previewWidth = Math.max(1, layout.preview - 2)+ if (draft.motion.globe) pictures.set('theme-globe', orbitalGlobe(previewWidth, layout.wide ? 14 : 9, state.options.fps > 0 ? t * draft.motion.speed : 0, draft))+ pictures.set('theme-preview', orbitalHeader('swarm preview', previewWidth, state.options.fps > 0 ? t * draft.motion.speed : 0, layout.wide ? 16 : 4, draft))}switch (state.view) {diff --git a/plugins/ruflo-console/hooks/views/themes.ts b/plugins/ruflo-console/hooks/views/themes.tsindex cfe886068a..924729808b 100644--- a/plugins/ruflo-console/hooks/views/themes.ts+++ b/plugins/ruflo-console/hooks/views/themes.ts@@ -1,49 +1,65 @@import type { RenderElement } from 'claude-code'-import { activeTheme, COLOR_KEYS, lowContrast, themesOf } from '../themes'+import { activeTheme, COLOR_KEYS, contrast, lowContrast, themeLayout, themesOf } from '../themes'import { button, clip, col, picture, row, text, THEME, type Ctx } from './common'-/** A terminal color picker: visible swatches and exact hex input, stacked at every width. */+/** One focused editor beside its live preview. Narrow panes stack without shrinking text. */export function themesView(ctx: Ctx): RenderElement {- const pick = (key: string, label: string, run: () => void) => button(ctx, key, clip(label, Math.max(1, ctx.columns - 2)), run)- const studio = themesOf(ctx.state), act = ctx.act.themes+ const studio = themesOf(ctx.state), act = ctx.act.themes, layout = themeLayout(ctx.columns)+ const edit: Ctx = { ...ctx, columns: Math.max(1, layout.controls - 2) }+ const preview: Ctx = { ...ctx, columns: Math.max(1, layout.preview - 2) }+ const pick = (key: string, label: string, run: () => void) => button(edit, key, clip(label, Math.max(1, edit.columns - 3)), run)const input = (key: string, label: string, placeholder: string, submit: (value: string) => void) => ctx.kit.Input- ? ctx.kit.Input({ key, label, placeholder, submitLabel: 'preview', onSubmit: submit })- : text(ctx, `${label}: text input is unavailable on this surface`, { dimColor: true })+ ? ctx.kit.Input({ key, label: clip(label, edit.columns), placeholder, submitLabel: 'set', onSubmit: submit })+ : text(edit, `${label}: text input unavailable`, { dimColor: true })+ const panel = (key: string, width: number, rows: RenderElement[]) => ctx.kit.Box({ key, width, flexDirection: 'column', borderStyle: 'single', borderColor: THEME.head, children: rows })const selected = studio.selected ?? ctx.state.options.look- const swatches = ['#f06449', '#72c79b', '#78c8ff', '#ca9bff', '#ffcf73', '#f2f4f3', '#000000', '#101820']- const rows: RenderElement[] = [- text(ctx, 'THEME STUDIO', { bold: true, color: THEME.head }),- text(ctx, 'Choose a look. Custom themes use Orbital animation.'),- ...(['bbs', 'plain', 'orbital'] as const).map(id => pick(`theme-${id}`, `${selected === id ? 'β' : 'β'} ${id === 'bbs' ? 'Classic BBS' : id === 'plain' ? 'Terminal plain' : 'Orbital'}`, () => act.select(id))),- ...studio.saved.map(theme => pick(`theme-custom-${theme.name}`, `${selected === `custom:${theme.name}` ? 'β' : 'β'} ${theme.name}`, () => act.select(`custom:${theme.name}`))),- pick('theme-reset', 'Use configured look', act.reset),- text(ctx, `Active: ${studio.active ? activeTheme(ctx.state).name : ctx.state.options.look}`, { color: THEME.ok }),- text(ctx, 'PREVIEW', { bold: true, color: THEME.head }),- picture(ctx, 'theme-preview', `Preview: ${studio.draft.name}`),- ...(studio.draft.motion.globe ? [picture(ctx, 'theme-globe', 'Globe preview')] : []),- input('theme-name', 'Theme name', studio.draft.name, act.name),- ]- for (const key of COLOR_KEYS) {- rows.push(text(ctx, `${key} ${studio.draft.palette[key]}`, { color: THEME.info }))- // Four swatches per row at normal widths, two on a narrow pane.- const count = ctx.columns < 36 ? 2 : 4- for (let i = 0; i < swatches.length; i += count) rows.push(row(ctx, swatches.slice(i, i + count).map((color, j) => col(ctx, [ctx.kit.Text({ color, backgroundColor: studio.draft.palette.background, children: ' ββ ' }), pick(`theme-${key}-${i + j}`, String(i + j + 1), () => act.color(key, color))]))))- rows.push(input(`theme-color-${key}`, `${key} hex`, studio.draft.palette[key], value => act.color(key, value)))+ const choices: RenderElement[] = [text(edit, '01 LOOK', { bold: true, color: THEME.head })]+ for (const id of ['bbs', 'plain', 'orbital'] as const) choices.push(pick(`theme-${id}`, `${selected === id ? 'β' : 'β'} ${id === 'bbs' ? 'Classic BBS' : id === 'plain' ? 'Terminal plain' : 'Orbital'}`, () => act.select(id)))+ for (const theme of studio.saved) choices.push(pick(`theme-custom-${theme.name}`, `${selected === `custom:${theme.name}` ? 'β' : 'β'} ${theme.name}`, () => act.select(`custom:${theme.name}`)))+ choices.push(text(edit, '02 CUSTOMIZE', { bold: true, color: THEME.head }))+ const tabs = (['colors', 'motion', 'generate'] as const).map(tab => pick(`theme-tab-${tab}`, `${studio.tab === tab ? 'βΈ' : 'Β·'} ${tab === 'generate' ? 'AI' : tab}`, () => act.tab(tab)))+ choices.push(edit.columns >= 31 ? row(edit, tabs) : col(edit, tabs))+ if (studio.tab === 'colors') {+ choices.push(input('theme-name', 'Name', studio.draft.name, act.name))+ // Each color role is its own labelled swatch. Only the selected role opens an editor.+ for (const key of COLOR_KEYS) choices.push(row(edit, [ctx.kit.Text({ color: studio.draft.palette[key], backgroundColor: studio.draft.palette.background, children: ' ββ ' }), pick(`theme-role-${key}`, clip(`${studio.role === key ? 'βΈ' : 'Β·'} ${key.padEnd(10)} ${studio.draft.palette[key]}`, Math.max(1, edit.columns - 7)), () => act.role(key))]))+ choices.push(text(edit, `Editing ${studio.role}`, { color: THEME.head }))+ const colors = ['#f06449', '#72c79b', '#78c8ff', '#ca9bff', '#ffcf73', '#f2f4f3', '#000000', '#101820']+ const perRow = edit.columns >= 24 ? 4 : 2+ for (let i = 0; i < colors.length; i += perRow) choices.push(row(edit, colors.slice(i, i + perRow).map((color, j) => col(edit, [ctx.kit.Text({ color, backgroundColor: studio.draft.palette.background, children: ' βββ ' }), pick(`theme-swatch-${i + j}`, String(i + j + 1), () => act.color(studio.role, color))]))))+ choices.push(input('theme-color', 'Hex color', studio.draft.palette[studio.role], value => act.color(studio.role, value)))+ const ratio = Math.min(...COLOR_KEYS.filter(key => key !== 'background').map(key => contrast(studio.draft.palette[key], studio.draft.palette.background)))+ choices.push(text(edit, `Minimum contrast ${ratio.toFixed(1)}:1`, { color: ratio >= 3 ? THEME.ok : THEME.warn }))+ } else if (studio.tab === 'motion') {+ choices.push(text(edit, 'DECORATIVE LAYERS', { color: THEME.info }))+ for (const key of ['stars', 'globe', 'topology'] as const) choices.push(pick(`theme-motion-${key}`, `${studio.draft.motion[key] ? 'β ON ' : 'β OFF'} ${key}`, () => act.motion(key, !studio.draft.motion[key])))+ choices.push(text(edit, 'PLAYBACK SPEED', { color: THEME.info }))+ for (const speed of [0.25, 0.5, 1, 2]) choices.push(pick(`theme-speed-${speed}`, `${studio.draft.motion.speed === speed ? 'β' : 'β'} ${speed}x ${speed === 0.25 ? 'ambient' : speed === 0.5 ? 'calm' : speed === 1 ? 'standard' : 'fast'}`, () => act.motion('speed', speed)))+ choices.push(text(edit, ctx.state.options.fps === 0 ? 'Reduced motion: still preview' : 'Set fps to 0 for reduced motion.', { dimColor: true }))+ } else {+ choices.push(text(edit, 'DESCRIBE YOUR THEME', { color: THEME.info }))+ choices.push(input('theme-brief', 'Design brief', studio.brief, act.brief))+ choices.push(pick('theme-generate-claude', 'Generate with Claude', () => act.generate('claude')))+ choices.push(pick('theme-generate-codex', 'Generate with Codex', () => act.generate('codex')))+ choices.push(text(edit, '1. Generate in AI Terminal', { dimColor: true }))+ choices.push(text(edit, '2. Import returned JSON', { dimColor: true }))+ choices.push(text(edit, '3. Preview and save', { dimColor: true }))+ choices.push(input('theme-import', 'Import theme JSON', '{"version":1,...}', act.import))}- rows.push(text(ctx, 'MOTION', { bold: true, color: THEME.head }))- for (const key of ['stars', 'globe', 'topology'] as const) rows.push(pick(`theme-motion-${key}`, `${studio.draft.motion[key] ? 'β' : 'β'} ${key}`, () => act.motion(key, !studio.draft.motion[key])))- for (const speed of [0.25, 0.5, 1, 2]) rows.push(pick(`theme-speed-${speed}`, `${studio.draft.motion.speed === speed ? 'β' : 'β'} ${speed}x motion`, () => act.motion('speed', speed)))- rows.push(text(ctx, ctx.state.options.fps === 0 ? 'Reduced motion is on. Previews are still.' : 'Settings > fps = 0 stops all motion.', { dimColor: true }))const low = lowContrast(studio.draft)- if (low.length) rows.push(text(ctx, `Low contrast: ${low.join(', ')}. Adjust before saving.`, { color: THEME.warn }))- rows.push(pick('theme-save', studio.saving ? 'Savingβ¦' : 'Save preview and apply', act.save))- rows.push(text(ctx, 'GENERATE WITH AI', { bold: true, color: THEME.head }))- rows.push(input('theme-brief', 'Design brief', studio.brief, act.brief))- rows.push(text(ctx, studio.brief, { dimColor: true }))- rows.push(pick('theme-generate-claude', 'Generate with Claude', () => act.generate('claude')))- rows.push(pick('theme-generate-codex', 'Generate with Codex', () => act.generate('codex')))- rows.push(text(ctx, 'Uses the bundled skill in AI Terminal. Paste its JSON below.'))- rows.push(input('theme-import', 'Import theme JSON', '{"version":1,...}', act.import))- rows.push(text(ctx, studio.message || 'Preview changes stay here until you save.', { color: THEME.info }))- return col(ctx, rows, 'themes')+ if (low.length) choices.push(text(edit, `Low contrast: ${low.join(', ')}`, { color: THEME.warn }))+ choices.push(text(edit, '03 APPLY', { bold: true, color: THEME.head }))+ choices.push(pick('theme-save', studio.saving ? 'Savingβ¦' : 'Save and apply', act.save))+ choices.push(pick('theme-discard', 'Discard draft changes', act.discard))+ choices.push(pick('theme-reset', 'Use configured look', act.reset))+ choices.push(text(edit, studio.message || 'Draft only until saved.', { dimColor: true }))+ const stage = [text(preview, `LIVE PREVIEW / ${studio.draft.name}`, { bold: true, color: studio.draft.palette.head }),+ ...(studio.draft.motion.globe ? [picture(preview, 'theme-globe', 'Globe preview')] : [text(preview, 'Globe layer off', { dimColor: true })]),+ picture(preview, 'theme-preview', 'Swarm preview'),+ text(preview, `${studio.draft.motion.speed}x motion / ${ctx.state.options.fps === 0 ? 'paused' : 'animated'} / illustrative`, { dimColor: true }),+ (preview.columns >= 18 ? row : col)(preview, [text(preview, ' PASS ', { color: studio.draft.palette.ok }), text(preview, ' WARN ', { color: studio.draft.palette.warn }), text(preview, ' FAIL ', { color: studio.draft.palette.bad })]),+ ]+ return col(ctx, [text(ctx, `THEME STUDIO / active: ${studio.active ? activeTheme(ctx.state).name : ctx.state.options.look}`, { bold: true, color: THEME.head }),+ ctx.kit.Box({ key: 'theme-layout', flexDirection: layout.wide ? 'row' : 'column', gap: layout.wide ? 2 : 1, children: layout.wide ? [panel('theme-editor', layout.controls, choices), panel('theme-stage', layout.preview, stage)] : [panel('theme-stage', layout.preview, stage), panel('theme-editor', layout.controls, choices)] }),+ ], 'themes')}diff --git a/plugins/ruflo-console/tests/themes.spec.ts b/plugins/ruflo-console/tests/themes.spec.tsindex 2cae680f3f..e1d55b2cef 100644--- a/plugins/ruflo-console/tests/themes.spec.ts+++ b/plugins/ruflo-console/tests/themes.spec.ts@@ -1,5 +1,5 @@import { describe, expect, it, vi } from 'vitest'-import { activeTheme, COLOR_KEYS, loadThemes, lowContrast, ORBITAL_THEME, parseTheme, themeActions, themeFromText, themesOf } from '../hooks/themes'+import { activeTheme, COLOR_KEYS, loadThemes, lowContrast, ORBITAL_THEME, parseTheme, themeActions, themeFromText, themesOf, themeLayout } from '../hooks/themes'import { newState } from '../hooks/state'import type { Host } from '../hooks/host'import { orbitalBoot, orbitalGlobe, orbitalHeader } from '../hooks/gfx/orbital'@@ -16,6 +16,22 @@ describe('Theme Studio', () => {expect(findPages('color')).toContain('themes')expect(GROUPS.find(g => g.title === 'TOOLS')!.sections.flatMap(s => s.items).some(i => i.go === 'themes')).toBe(true)})+ it('keeps editor and preview within one width at the breakpoint', () => {+ for (const width of [12, 20, 44, 72, 99, 100, 120, 160, 240]) {+ const layout = themeLayout(width)+ expect(layout.wide ? layout.controls + 2 + layout.preview : layout.preview).toBeLessThanOrEqual(width)+ expect(layout.wide).toBe(width >= 100)+ }+ })+ it('switches focused editors and discards only unsaved changes', async () => {+ const state = newState({ look: 'orbital' }), host = hostOf(), act = themeActions(state, host, vi.fn())+ act.tab('motion'); act.role('warn'); act.name('Saved'); act.save(); await flush()+ act.color('head', '#ffffff'); act.discard()+ expect(themesOf(state).tab).toBe('motion')+ expect(themesOf(state).role).toBe('warn')+ expect(themesOf(state).draft).toEqual(activeTheme(state))+ expect(themesOf(state).saved).toHaveLength(1)+ })it('accepts only bounded data and clones it', () => {const raw = copy(), parsed = parseTheme(raw)!expect(parsed).toEqual(raw)