UNPKG

askeroo

Version:

A modern CLI prompt library with flow control, history navigation, and conditional prompts

26 lines 1.15 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { useEffect } from "react"; import { createPrompt } from "../../core/registry.js"; import { parseMarkdown, isMarkdownString, } from "../../utils/markdown.js"; import { Box } from "ink"; // Internal plugin implementation const noteInternal = createPrompt({ type: "note", component: ({ node, options, events }) => { const msg = options.message; const isMarkdown = isMarkdownString(msg); // Auto-submit when component becomes active useEffect(() => { if (node.state === "active" && events.onSubmit) { // setTimeout is now baked into onSubmit for auto submissions events.onSubmit({ type: "auto" }); } }, [node.state, events.onSubmit]); return (_jsx(Box, { flexDirection: "column", children: parseMarkdown(isMarkdown ? msg.content : msg || "", isMarkdown ? msg.theme : undefined) })); }, }); // Public API function - supports both simple string and options export function note(message, options) { return noteInternal({ message, ...options }); } //# sourceMappingURL=index.js.map