feat(m02-df): 검증 칸에서 다른 로직 받는 알약 예시값(logic.examples)을 고침

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EauA2ATmqNRbeV48s9CcBr
This commit is contained in:
2026-10-01 19:55:42 +09:00
co-authored by Claude Sonnet 5.5
parent 46f9c57fa0
commit df735e99a8
+38 -17
View File
@@ -29,7 +29,7 @@ const TEXT = {
Vars: ["변수 예시값", "Variable samples"],
Slots: ["재료 선택 자리", "Material choice"],
Rules: ["재료 조건 자리", "Material by condition"],
Logics: ["이어지지 않은 다른 로직 값", "Unlinked values of other logics"],
Logics: ["이어지지 않은 다른 로직 값(예시값)", "Unlinked values of other logics (samples)"],
Choose: ["고르기", "Choose"],
Close: ["닫기", "Close"],
Find: ["찾기", "Find"],
@@ -51,6 +51,7 @@ const TEXT = {
Bad: ["숫자를 넣어 주세요", "Enter a number"],
Range: ["{a} ∼ {b} 사이", "between {a} and {b}"],
Cant: ["지금은 바꿀 수 없어요", "Cannot change this now"],
OwnSample: ["비우면 그 로직 예시값", "Empty = the logic's own sample"],
OtherLogic: [
"이어 주지 않아서 그 로직의 예시값을 써요",
"Not linked — the logic's own sample is used",
@@ -394,23 +395,43 @@ export function renderVerify(
.filter((e) => e.mode === "rule" && e.rule)
.map((e) => ruleRow(e, lg, result)),
);
const logics = designs.flatMap((d) =>
d.kind === "다른 로직"
? [
el("li", {
children: [
createButton({
label: `${boxOf(d.box)?.name ?? ""} · ${d.port}${d.unit && d.unit !== "-" ? ` (${d.unit})` : ""} — ${tv("OtherLogic")}`,
variant: "ghost",
size: "sm",
disabled: !on.select,
onClick: () => on.select?.({ box: d.box, port: d.port }),
}),
],
/** 다른 로직의 받는 알약 — 예시값을 적으면 logic.examples · 비우면 그 로직 자기 예시값 */
const putLogicExample = (box: string, port: string, raw: string): CfLogic => ({
...lg,
boxes: lg.boxes.map((x) => {
if (x.id !== box || !x.input?.logic) return x;
const examples = { ...x.input.logic.examples };
const text = raw.trim();
if (text === "") delete examples[port];
else examples[port] = Number.isNaN(Number(text)) ? text : Number(text);
return { ...x, input: { ...x.input, logic: { ...x.input.logic, examples } } };
}),
});
const logics = designs.flatMap((d) => {
if (d.kind !== "다른 로직") return [];
const input = el("input", {
className: "m02-dfver__input",
attrs: { type: "text", placeholder: tv("OwnSample"), "aria-label": d.port },
});
input.value = d.example === null || d.example === undefined ? "" : String(d.example);
input.addEventListener("change", () => safe(() => putLogicExample(d.box, d.port, input.value)));
const unit = d.unit && d.unit !== "-" ? ` (${d.unit})` : "";
return [
el("li", {
className: "m02-dfver__line",
children: [
createButton({
label: `${boxOf(d.box)?.name ?? ""} · ${d.port}${unit}`,
variant: "ghost",
size: "sm",
disabled: !on.select,
onClick: () => on.select?.({ box: d.box, port: d.port }),
}),
]
: [],
);
input,
],
}),
];
});
const group = (title: TextKey, body: HTMLElement[]): HTMLElement[] =>
body.length
? [