/** * @yaebal/preview — render a telegram-style chat from plain objects to an SVG string. * zero runtime, no `` (so it rasterizes and survives github's SVG * sanitizer). media fields use the real `@yaebal/types` shapes, so you can hand it a * `ctx.message` almost verbatim; add `src` to show real pixels (a `file_id` has none). * * import { renderChat } from "@yaebal/preview"; * import { md } from "@yaebal/fmt"; * * renderChat([ * { from: "user", text: "/start", time: "23:33", status: "read" }, * { from: "bot", name: "yaebal", ...md`hello, **unknown** person`, time: "23:33" }, * { from: "bot", name: "yaebal", photo: [], src: "cat.jpg", caption: "a cat" }, * { from: "bot", name: "yaebal", voice: { duration: 7 } }, * { * from: "bot", name: "yaebal", * reply: { name: "unknown person", text: "hello, unknown person" }, * text: "of course. what did you expect?", * reactions: [{ emoji: "🔥", count: 3, chosen: true }], * }, * ], { theme: "light" }); */ import type { ChatMessage, RenderOptions } from "./types.js"; export type { Palette, Theme } from "./theme.js"; export type { ChatMessage, ForwardHeader, Loose, LoosePoll, Reaction, RenderOptions, ReplyQuote, Side, TickStatus, WebpagePreview, } from "./types.js"; /** render a telegram-style chat to an SVG string. */ export declare function renderChat(messages: ChatMessage[], options?: RenderOptions): string; /** a chainable message-list builder over {@link renderChat} — nicer for docs/examples than a raw array literal. */ export interface ChatBuilder { /** append an outgoing ("user") message. */ user(text: string, extra?: Omit): ChatBuilder; /** append an incoming ("bot") message. */ bot(text: string, extra?: Omit): ChatBuilder; /** append a centered system notice (e.g. a date divider). */ system(text: string): ChatBuilder; /** append any raw `ChatMessage` (for media, polls, etc. that don't fit `.user`/`.bot`). */ push(message: ChatMessage): ChatBuilder; /** render the accumulated messages to an SVG string. */ render(): string; } /** `chat({ theme: "dark" }).user("/start").bot("hi", { name: "yaebal" }).render()` */ export declare function chat(options?: RenderOptions): ChatBuilder; //# sourceMappingURL=index.d.ts.map