Merge pull request #230 from poli0981/feat/rig-lut

feat(rig): add a LUT field under the video editor
This commit is contained in:
poli0981 authored and GitHub committed 2026-11-06 22:23:13 +07:00
commit b7d357ce4c
23 files changed
+285 -33

No files matched your search

+8 -1
View File
@@ -142,7 +142,7 @@ is now "X (Twitter)" (same `twitter` id, so saved links still load).
Bank, Cake by VPBank and Timo; a profile saved with OceanBank, CBBank or
DongA Bank is offered the new name in one click.
## 💻 Rig Fields (10 fields)
## 💻 Rig Fields (11 fields)
Printed in this order, with labels in the output language.
@@ -158,6 +158,13 @@ Printed in this order, with labels in the output language.
| `capture` | Capture Software | Text | OBS Studio 31 |
| `controller` | Controller | Text | DualSense / Xbox Wireless Controller |
| `video_editor` | Video Editor | Dropdown + version | DaVinci Resolve Studio 19.1 |
| `lut` | LUT | Text with suggestions (DaVinci Resolve's own LUTs) — v1.4.0 | Arri Alexa LogC to Rec709 |
**LUT (v1.4.0)** — the LUT you grade with, on its own line right under the
video editor. The suggestions are LUTs that come with DaVinci Resolve, named
the way its LUT menu shows them; any other name is printed as typed. A pasted
file name or path (Explorer's _Copy as path_) is cut down to the LUT's name:
`"C:\…\Arri\Arri Alexa LogC to Rec709.dat"` → `Arri Alexa LogC to Rec709`.
**GPU catalog (v1.0.0)** — 198 models in 29 groups: NVIDIA GeForce (desktop
and laptop), AMD Radeon (including integrated), Intel Arc and integrated,
+1 -1
View File
@@ -419,7 +419,7 @@ export interface TitleFormatConfig {
**Empty channel name** (`channel-phrase.ts`, used by the description, pinned comment and playlist builders): templates render with `CHANNEL_SLOT` (`@@CHANNEL@@`) in place of an empty channel name. `withoutEmptyChannel(text, language)` then removes the words that go with the channel name in that language ("trên kênh", "による", "en", "no", "di", …) and the English "on" (for English, and for locales that still carry English sentences for newer video types), replaces any slot left over with a neutral fallback ("this channel", "kênh", …) and tidies the spacing before punctuation. "…of Hades on ." no longer happens in any of the eight languages.
**Rig block** (`rig-block.ts`): `buildRigLines(rig, t)` returns `Label: value` lines, shared by the description and the social captions. Labels come from `description.rigLabels.<field>` in the output language, the order is `RIG_FIELDS` (CPU, GPU, RAM, motherboard, storage, OS, monitor, capture, controller, video editor), and values go through `formatRigValue` (`gpu:nvidia-rtx-5080` → "NVIDIA GeForce RTX 5080"). Keys that are no longer rig fields are still printed, after the known ones.
**Rig block** (`rig-block.ts`): `buildRigLines(rig, t)` returns `Label: value` lines, shared by the description and the social captions. Labels come from `description.rigLabels.<field>` in the output language, the order is `RIG_FIELDS` (CPU, GPU, RAM, motherboard, storage, OS, monitor, capture, controller, video editor, LUT), and values go through `formatRigValue` (`gpu:nvidia-rtx-5080` → "NVIDIA GeForce RTX 5080"; a text field's `clean` — `cleanCpuName`, and since v1.4.0 `cleanLutName`, which cuts a pasted path or `.cube` / `.dat` file name down to the LUT's name — runs there as well as when the editor field loses focus). Keys that are no longer rig fields are still printed, after the known ones.
**Chapters** (`timeline-parser.ts`):
+15 -10
View File
@@ -9,7 +9,6 @@ import { PopoverContent, PopoverRoot, PopoverTrigger } from "@components/ui/Popo
import { Spinner } from "@components/icons/animated";
import {
RIG_FIELDS,
cleanCpuName,
parseCompositeValue,
resolveCompositeOptions,
resolveCompositeLabelKey,
@@ -117,7 +116,7 @@ function GpuPicker({
);
}
/** CPU (and any other suggested text field): type freely or pick a suggestion. */
/** CPU, LUT (any suggested text field): type freely or pick a suggestion. */
function SuggestedTextField({
field,
value,
@@ -139,10 +138,11 @@ function SuggestedTextField({
list={listId}
autoComplete="off"
onChange={(e) => onChange(e.target.value)}
// "Intel(R) Core(TM) i7-12700K CPU @ 3.60GHz", as Windows shows it,
// becomes "Intel Core i7-12700K" once the user leaves the field.
// The field's own tidy-up once the user leaves it: Windows' "Intel(R)
// Core(TM) i7-12700K CPU @ 3.60GHz" becomes "Intel Core i7-12700K",
// a pasted "Rec709 Kodak 2383 D65.cube" loses its extension.
onBlur={(e) => {
const cleaned = field.id === "cpu" ? cleanCpuName(e.target.value) : e.target.value.trim();
const cleaned = field.clean ? field.clean(e.target.value) : e.target.value.trim();
if (cleaned !== e.target.value) onChange(cleaned);
}}
/>
@@ -293,12 +293,10 @@ export function RigEditor() {
}
if (field.type === "composite_dropdown") return renderComposite(field);
if (field.type === "dropdown_with_version") return renderDropdownWithVersion(field);
if (field.suggestions) {
return <SuggestedTextField key={field.id} field={field} value={value} onChange={set} />;
}
return (
const input = field.suggestions ? (
<SuggestedTextField field={field} value={value} onChange={set} />
) : (
<Input
key={field.id}
label={t(field.labelKey)}
maxLength={FIELD_LIMITS.SHORT_NAME}
placeholder={field.placeholder}
@@ -306,6 +304,13 @@ export function RigEditor() {
onChange={(e) => set(e.target.value)}
/>
);
// A wide field (the LUT) takes the whole row, right under the
// Video Editor row it belongs to.
return (
<div key={field.id} className={clsx("min-w-0", field.wide && "sm:col-span-2")}>
{input}
</div>
);
})}
</div>
</div>
+84 -2
View File
@@ -102,6 +102,15 @@ export interface RigField {
readonly composite?: CompositeFieldSpec;
/** `text` fields: values offered while typing (the user may type anything). */
readonly suggestions?: readonly string[];
/**
* `text` fields: tidies the typed or pasted text. Runs when the user
* leaves the field and again in {@link formatRigValue}, so a shortcut
* pressed while the cursor is still in the field prints the tidy form
* too. Must be idempotent.
*/
readonly clean?: (raw: string) => string;
/** Takes both columns of the editor's grid (long values, such as a LUT name). */
readonly wide?: boolean;
}
/**
@@ -477,6 +486,66 @@ export function cleanCpuName(raw: string): string {
);
}
/**
* LUTs that come with DaVinci Resolve, named the way its LUT menu shows
* them (from Resolve 21's own LUT folder), offered while typing in the
* LUT field. Any other LUT's name is accepted as typed.
*/
export const LUT_SUGGESTIONS: readonly string[] = [
"Arri Alexa LogC to Rec709",
"Rec709 Kodak 2383 D65",
"Rec709 Kodak 2383 D60",
"Rec709 Kodak 2383 D55",
"Rec709 Fujifilm 3513DI D65",
"Rec709 Fujifilm 3513DI D60",
"Rec709 Fujifilm 3513DI D55",
"HDR 1000 nits to Gamma 2.4",
"Blackmagic Gen 6 DaVinci to Rec709 BT1886 Film Look",
"SLog3SGamut3.CineToLC-709",
"SLog3SGamut3.CineToLC-709TypeA",
"V-Log to V-709",
"Leica Pure L-Log to Rec.709 Gamma 2.4",
"Samsung Log to Rec709",
];
/** The file extensions LUTs come in. Anchored at the end: linear. */
const LUT_FILE_EXTENSION = /\.(?:cube|3dl|dat|csp|ilut|olut|look)$/i;
/** One pass of {@link cleanLutName}. */
function tidyLutNameOnce(text: string): string {
let name = text.trim();
// Explorer's "Copy as path" wraps the path in double quotes.
if (name.length >= 2 && name.startsWith('"') && name.endsWith('"')) {
name = name.slice(1, -1).trim();
}
// A path (a backslash, a drive letter, or a leading / or ~/) keeps only
// its file name. A slash in an ordinary name ("Teal/Orange") stays.
const isPath =
name.includes("\\") || /^[a-z]:\//i.test(name) || name.startsWith("/") || name.startsWith("~/");
if (isPath) {
name = name.slice(Math.max(name.lastIndexOf("\\"), name.lastIndexOf("/")) + 1).trim();
}
return name.replace(LUT_FILE_EXTENSION, "").trim();
}
/**
* Tidy a LUT name pasted from a file manager:
* `"Rec709 Kodak 2383 D65.cube"` → `"Rec709 Kodak 2383 D65"`, and
* Explorer's `"C:\…\Arri\Arri Alexa LogC to Rec709.dat"` (or a macOS
* path) → `"Arri Alexa LogC to Rec709"`. Dots inside a name
* ("SLog3SGamut3.CineToLC-709", "Rec.709 Gamma 2.4") stay. Idempotent:
* passes repeat until nothing changes.
*/
export function cleanLutName(raw: string): string {
let name = raw;
let previous: string;
do {
previous = name;
name = tidyLutNameOnce(name);
} while (name !== previous);
return name;
}
/**
* The rig fields, in the order both the editor and the description show
* them: the parts a viewer compares first (CPU, GPU, RAM), then the rest.
@@ -488,6 +557,7 @@ export const RIG_FIELDS: readonly RigField[] = [
type: "text",
placeholder: "AMD Ryzen 7 9800X3D",
suggestions: CPU_SUGGESTIONS,
clean: cleanCpuName,
},
{ id: "gpu", labelKey: "rig.gpu", type: "gpu" },
{ id: "ram", labelKey: "rig.ram", type: "composite_dropdown", composite: RAM_COMPOSITE },
@@ -514,6 +584,16 @@ export const RIG_FIELDS: readonly RigField[] = [
options: VIDEO_EDITOR_OPTIONS,
versionPlaceholder: "20 / 2026 / v25",
},
// The LUT graded in that editor — its own line, right under it.
{
id: "lut",
labelKey: "rig.lut",
type: "text",
placeholder: "Arri Alexa LogC to Rec709",
suggestions: LUT_SUGGESTIONS,
clean: cleanLutName,
wide: true,
},
];
/**
@@ -567,7 +647,9 @@ function withSuffix(text: string, suffix: string): string {
* - `composite_dropdown` ("32|DDR5|6000", "custom:48|DDR5|") →
* "32 GB DDR5-6000" / "48 GB DDR5" via the field's
* {@link CompositeFieldSpec.format}.
* - All other field types pass the raw value through.
* - `text` fields with a {@link RigField.clean} go through it (a pasted
* "Rec709 Kodak 2383 D65.cube" → "Rec709 Kodak 2383 D65"); other text
* passes through as typed.
*/
export function formatRigValue(fieldId: string, raw: string): string {
const field = RIG_FIELDS.find((f) => f.id === fieldId);
@@ -619,5 +701,5 @@ export function formatRigValue(fieldId: string, raw: string): string {
return field.composite.format(resolved);
}
return raw;
return field.clean ? field.clean(raw) : raw;
}
+4 -2
View File
@@ -826,7 +826,8 @@
"capture",
"motherboard",
"controller",
"video_editor"
"video_editor",
"lut"
],
"social": [
"kofi",
@@ -1717,7 +1718,8 @@
"monitor",
"capture",
"controller",
"video_editor"
"video_editor",
"lut"
]
}
}
+2 -1
View File
@@ -592,7 +592,8 @@
"monitor": "Monitor",
"capture": "Capture Software",
"controller": "Controller",
"video_editor": "Video Editor"
"video_editor": "Video Editor",
"lut": "LUT"
}
},
"pinnedComment": {
+2 -1
View File
@@ -1001,7 +1001,8 @@
"capture": "Capture Software",
"motherboard": "Motherboard",
"controller": "Controller",
"video_editor": "Video Editor"
"video_editor": "Video Editor",
"lut": "LUT"
},
"social": {
"kofi": "Ko-fi",
+2 -1
View File
@@ -592,7 +592,8 @@
"monitor": "Monitor",
"capture": "Software de Captura",
"controller": "Mando",
"video_editor": "Editor de Video"
"video_editor": "Editor de Video",
"lut": "LUT"
}
},
"pinnedComment": {
+2 -1
View File
@@ -1001,7 +1001,8 @@
"capture": "Software de Captura",
"motherboard": "Placa Base",
"controller": "Mando",
"video_editor": "Editor de Video"
"video_editor": "Editor de Video",
"lut": "LUT"
},
"social": {
"kofi": "Ko-fi",
+2 -1
View File
@@ -592,7 +592,8 @@
"monitor": "Monitor",
"capture": "Software Perekam",
"controller": "Kontroler",
"video_editor": "Editor Video"
"video_editor": "Editor Video",
"lut": "LUT"
}
},
"pinnedComment": {
+2 -1
View File
@@ -1001,7 +1001,8 @@
"capture": "Software Perekam",
"motherboard": "Motherboard",
"controller": "Kontroler",
"video_editor": "Editor Video"
"video_editor": "Editor Video",
"lut": "LUT"
},
"social": {
"kofi": "Ko-fi",
+2 -1
View File
@@ -592,7 +592,8 @@
"monitor": "モニター",
"capture": "キャプチャソフト",
"controller": "コントローラー",
"video_editor": "動画編集ソフト"
"video_editor": "動画編集ソフト",
"lut": "LUT"
}
},
"pinnedComment": {
+2 -1
View File
@@ -1001,7 +1001,8 @@
"capture": "キャプチャソフト",
"motherboard": "マザーボード",
"controller": "コントローラー",
"video_editor": "動画編集ソフト"
"video_editor": "動画編集ソフト",
"lut": "LUT"
},
"social": {
"kofi": "Ko-fi",
+2 -1
View File
@@ -592,7 +592,8 @@
"monitor": "모니터",
"capture": "캡처 소프트웨어",
"controller": "컨트롤러",
"video_editor": "영상 편집 프로그램"
"video_editor": "영상 편집 프로그램",
"lut": "LUT"
}
},
"pinnedComment": {
+2 -1
View File
@@ -1001,7 +1001,8 @@
"capture": "캡처 소프트웨어",
"motherboard": "메인보드",
"controller": "컨트롤러",
"video_editor": "영상 편집 프로그램"
"video_editor": "영상 편집 프로그램",
"lut": "LUT"
},
"social": {
"kofi": "Ko-fi",
+2 -1
View File
@@ -592,7 +592,8 @@
"monitor": "Monitor",
"capture": "Software de captura",
"controller": "Controle",
"video_editor": "Editor de vídeo"
"video_editor": "Editor de vídeo",
"lut": "LUT"
}
},
"pinnedComment": {
+2 -1
View File
@@ -1001,7 +1001,8 @@
"capture": "Software de captura",
"motherboard": "Placa-mãe",
"controller": "Controle",
"video_editor": "Editor de vídeo"
"video_editor": "Editor de vídeo",
"lut": "LUT"
},
"social": {
"kofi": "Ko-fi",
+2 -1
View File
@@ -592,7 +592,8 @@
"monitor": "Màn hình",
"capture": "Phần mềm quay",
"controller": "Tay cầm",
"video_editor": "Phần mềm dựng video"
"video_editor": "Phần mềm dựng video",
"lut": "LUT"
}
},
"pinnedComment": {
+2 -1
View File
@@ -1001,7 +1001,8 @@
"capture": "Phần mềm quay",
"motherboard": "Bo mạch chủ",
"controller": "Tay cầm",
"video_editor": "Phần mềm dựng video"
"video_editor": "Phần mềm dựng video",
"lut": "LUT"
},
"social": {
"kofi": "Ko-fi",
+2 -1
View File
@@ -592,7 +592,8 @@
"monitor": "显示器",
"capture": "录制软件",
"controller": "手柄",
"video_editor": "视频编辑软件"
"video_editor": "视频编辑软件",
"lut": "LUT"
}
},
"pinnedComment": {
+2 -1
View File
@@ -1001,7 +1001,8 @@
"capture": "录制软件",
"motherboard": "主板",
"controller": "手柄",
"video_editor": "视频编辑软件"
"video_editor": "视频编辑软件",
"lut": "LUT"
},
"social": {
"kofi": "Ko-fi",
+29
View File
@@ -722,6 +722,35 @@ describe("buildDescription", () => {
expect(vi).toContain("Ổ cứng: 2TB NVMe");
});
it("prints the LUT on its own line right under the video editor (v1.4.0)", () => {
const rig = {
lut: "Arri Alexa LogC to Rec709.dat",
capture: "OBS Studio 31",
video_editor: "davinci_resolve_studio|21.2",
};
const lineAfter = (text: string, line: string) => {
const lines = text.split("\n");
const at = lines.indexOf(line);
return at >= 0 ? lines[at + 1] : undefined;
};
const en = buildDescription(makeInput({ rig }), createMockT("en"));
expect(lineAfter(en, "Video Editor: DaVinci Resolve Studio 21.2")).toBe(
"LUT: Arri Alexa LogC to Rec709",
);
const vi = buildDescription(makeInput({ language: "vi", rig }), createMockT("vi"));
expect(lineAfter(vi, "Phần mềm dựng video: DaVinci Resolve Studio 21.2")).toBe(
"LUT: Arri Alexa LogC to Rec709",
);
const noLut = buildDescription(
makeInput({ rig: { video_editor: "capcut|", lut: " " } }),
createMockT("en"),
);
expect(noLut).toContain("Video Editor: CapCut");
expect(noLut).not.toContain("LUT:");
});
it("prints rig lines in a fixed order, whatever order they were filled in", () => {
const t = createMockT("en");
const result = buildDescription(
+112 -1
View File
@@ -1,5 +1,15 @@
import { describe, it, expect } from "vitest";
import { cleanCpuName, formatRigValue, migrateRig, RIG_FIELDS } from "@config/rig-fields";
import {
cleanCpuName,
cleanLutName,
CPU_SUGGESTIONS,
formatRigValue,
LUT_SUGGESTIONS,
migrateRig,
RIG_FIELDS,
} from "@config/rig-fields";
import { compareCodeUnits } from "@utils/sort";
import { schemaKeys } from "../helpers/locale-schema";
describe("formatRigValue", () => {
it("passes text fields through unchanged", () => {
@@ -176,6 +186,107 @@ describe("formatRigValue", () => {
});
});
describe("LUT (v1.4.0)", () => {
it("sits right after the video editor, across both columns", () => {
const ids = RIG_FIELDS.map((f) => f.id);
expect(ids.indexOf("lut")).toBe(ids.indexOf("video_editor") + 1);
const field = RIG_FIELDS.find((f) => f.id === "lut");
expect(field).toMatchObject({ type: "text", wide: true, labelKey: "rig.lut" });
expect(field?.suggestions).toBe(LUT_SUGGESTIONS);
});
it("prints the name as typed", () => {
expect(formatRigValue("lut", "Arri Alexa LogC to Rec709")).toBe("Arri Alexa LogC to Rec709");
expect(formatRigValue("lut", "")).toBe("");
});
it("drops a pasted file extension even before the field is left", () => {
// Ctrl/⌘+Shift+C or Ctrl/⌘+S can run while the cursor is still in the
// field, before the on-blur tidy-up.
expect(formatRigValue("lut", "Arri Alexa LogC to Rec709.dat")).toBe(
"Arri Alexa LogC to Rec709",
);
});
});
describe("cleanLutName", () => {
it("drops the LUT's file extension, whatever its case", () => {
expect(cleanLutName("Rec709 Kodak 2383 D65.cube")).toBe("Rec709 Kodak 2383 D65");
expect(cleanLutName("Rec709 Kodak 2383 D65.CUBE")).toBe("Rec709 Kodak 2383 D65");
expect(cleanLutName("Arri Alexa LogC to Rec709.dat")).toBe("Arri Alexa LogC to Rec709");
expect(cleanLutName("Horror Look.3dl")).toBe("Horror Look");
});
it("keeps only the file name of a pasted path", () => {
// Explorer's "Copy as path", quotes included.
expect(
cleanLutName(
'"C:\\ProgramData\\Blackmagic Design\\DaVinci Resolve\\Support\\LUT\\Arri\\Arri Alexa LogC to Rec709.dat"',
),
).toBe("Arri Alexa LogC to Rec709");
expect(
cleanLutName(
"/Library/Application Support/Blackmagic Design/DaVinci Resolve/LUT/Film Looks/Rec709 Kodak 2383 D65.cube",
),
).toBe("Rec709 Kodak 2383 D65");
expect(cleanLutName("C:/LUTs/Teal Orange.cube")).toBe("Teal Orange");
});
it("keeps dots and slashes that belong to the name", () => {
expect(cleanLutName("SLog3SGamut3.CineToLC-709")).toBe("SLog3SGamut3.CineToLC-709");
expect(cleanLutName("SLog3SGamut3.CineToLC-709.cube")).toBe("SLog3SGamut3.CineToLC-709");
expect(cleanLutName("Leica Pure L-Log to Rec.709 Gamma 2.4")).toBe(
"Leica Pure L-Log to Rec.709 Gamma 2.4",
);
expect(cleanLutName("Teal/Orange")).toBe("Teal/Orange");
});
it("trims, and a second pass changes nothing", () => {
expect(cleanLutName(" Horror Look ")).toBe("Horror Look");
for (const raw of ['""Look.cube""', "Look.cube.dat", '" x.CUBE "', "/", '"', ""]) {
const once = cleanLutName(raw);
expect(cleanLutName(once)).toBe(once);
}
expect(cleanLutName("Look.cube.dat")).toBe("Look");
});
});
describe("suggestions", () => {
it("offers each CPU and LUT once, already in the form its cleaner gives", () => {
const lists = [
[CPU_SUGGESTIONS, cleanCpuName],
[LUT_SUGGESTIONS, cleanLutName],
] as const;
for (const [list, clean] of lists) {
expect(new Set(list).size).toBe(list.length);
for (const suggestion of list) expect(clean(suggestion)).toBe(suggestion);
}
});
it("tidies a CPU name pasted from Windows in the output too", () => {
expect(formatRigValue("cpu", "Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz")).toBe(
"Intel Core i9-9900K",
);
});
});
/**
* The mock `t` returns a missing key as-is, so a rig field without labels
* would print "description.rigLabels.x: …" in tests without failing.
* `_schema.json` covers all eight locales (`validate:locales`).
*/
describe("rig field labels", () => {
const ids = RIG_FIELDS.map((f) => f.id).sort(compareCodeUnits);
it("has an editor label for every rig field, and none for unknown ids", () => {
expect(schemaKeys("ui", "rig")).toEqual(ids);
});
it("has a description label for every rig field, and none for unknown ids", () => {
expect(schemaKeys("templates", "description.rigLabels")).toEqual(ids);
});
});
describe("cleanCpuName", () => {
it("strips Windows' trademark marks and clock suffix", () => {
expect(cleanCpuName("Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz")).toBe("Intel Core i9-9900K");