Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WRFJmmhPi4exAzHgPZHMT
32 lines
1.3 KiB
TypeScript
32 lines
1.3 KiB
TypeScript
/* =============================================================================
|
|
* M01_MasterData_UI_Logic_Wizard_Ui.ts
|
|
* 「새로 만들기」 걸음 화면이 같이 쓰는 작은 부품 — 걸음 모양 · 쪽 · 안내 글 · 오류 알림
|
|
* ========================================================================== */
|
|
|
|
import { el, showToast } from "@ui/ui_template_elements";
|
|
import type { Draft } from "./M01_MasterData_UI_Logic_Wizard_Model";
|
|
import { tw, type WizardTextKey } from "./M01_MasterData_UI_Logic_Wizard_Text";
|
|
|
|
export interface Ctx {
|
|
d: Draft;
|
|
/** 값이 바뀜 — 미리보기·다음 단추 다시 셈 */
|
|
changed: () => void;
|
|
/** 본떠 만들기가 끝남 — 모달이 닫고 새 키를 넘김 */
|
|
onCopied: (key: string) => void;
|
|
}
|
|
export interface Step {
|
|
key: WizardTextKey;
|
|
question: WizardTextKey;
|
|
render: (ctx: Ctx) => HTMLElement;
|
|
ready: (d: Draft) => boolean;
|
|
}
|
|
|
|
export const page = (question: WizardTextKey, ...body: (HTMLElement | string)[]): HTMLElement =>
|
|
el("div", {
|
|
className: "m01w__page",
|
|
children: [el("h3", { text: tw(question) }), ...body],
|
|
});
|
|
export const note = (text: string): HTMLElement => el("p", { className: "m01w__muted", text });
|
|
export const fail = (e: unknown): void =>
|
|
showToast(e instanceof Error ? e.message : tw("Failed"), "error");
|