UNPKG

@flanksource/clicky-ui

Version:

Flanksource Clicky UI — React component library built on shadcn/ui with light/dark and density theming.

147 lines 4.77 kB
import { ResolvedOperation } from '../rpc/types'; import { OperationsApiClient } from '../rpc/useOperations'; import { ParsedStackFrame } from './diagnostics/stacktrace-parse'; export type ClickyStyle = { className?: string; color?: string; backgroundColor?: string; bold?: boolean; faint?: boolean; italic?: boolean; underline?: boolean; strikethrough?: boolean; textTransform?: string; maxWidth?: number; maxLines?: number; truncateMode?: "suffix" | "prefix" | "headtail"; monospace?: boolean; }; export type ClickyField = { name: string; label?: string; value: ClickyNode; }; export type ClickyColumn = { name: string; label?: string; header?: ClickyNode; align?: "left" | "right" | "center"; sortable?: boolean; filterable?: boolean; grow?: boolean; shrink?: boolean; kind?: "timestamp" | "tags" | "status"; }; export type ClickyRow = { cells: Record<string, ClickyNode>; detail?: ClickyNode; }; export type ClickyTreeItem = { id: string; label: ClickyNode; children?: ClickyTreeItem[]; }; export type ClickyNode = { kind: "text" | "link" | "link-command" | "icon" | "list" | "map" | "table" | "tree" | "code" | "collapsed" | "stacktrace" | "button" | "button-group" | "html" | "comment" | "badge"; plain?: string; style?: ClickyStyle; text?: string; children?: ClickyNode[]; tooltip?: ClickyNode; html?: string; inline?: boolean; ordered?: boolean; unstyled?: boolean; bullet?: ClickyNode; items?: ClickyNode[]; fields?: ClickyField[]; columns?: ClickyColumn[]; rows?: ClickyRow[]; autoFilter?: boolean; roots?: ClickyTreeItem[]; label?: ClickyNode; content?: ClickyNode; href?: string; target?: ClickyLinkTarget; command?: string; args?: string[]; flags?: Record<string, string>; autoRun?: boolean; id?: string; payload?: string; variant?: string; iconify?: string; unicode?: string; language?: string; source?: string; highlightedHtml?: string; exceptionClass?: string; message?: string; causedBy?: string[]; frames?: ParsedStackFrame[]; badgeLabel?: string; badgeValue?: string; badgeColor?: string; badgeText?: string; badgeShape?: string; badgeIcon?: string; }; export type ClickyDocument = { version: 1; node: ClickyNode; }; export type ClickyLinkTarget = "Dialog" | "Hover" | "Expand" | "_clicky" | "_self" | "_window" | "_tab"; export type ClickyCommandRequest = { command: string; args?: string[]; flags?: Record<string, string>; target?: ClickyLinkTarget; autoRun?: boolean; }; export type ClickyResolvedCommand = { request: ClickyCommandRequest; operation: ResolvedOperation | undefined; }; export type ClickyCommandRuntime = { client: OperationsApiClient; resolveCommand?: (request: ClickyCommandRequest, operations: ResolvedOperation[]) => ResolvedOperation | undefined; hrefForCommand?: (resolved: ClickyResolvedCommand) => string | undefined; onNavigate?: (resolved: ClickyResolvedCommand) => void; }; export type ClickyTableRowClick = (row: ClickyRow) => void; export type ClickyTableRowHref = (row: ClickyRow) => string | undefined; export type ClickyTableRowPredicate = (row: ClickyRow) => boolean; declare const CLICKY_PRIMARY_VIEW_FORMATS: readonly ["clicky", "json"]; declare const CLICKY_OVERFLOW_VIEW_FORMATS: readonly ["pdf", "html", "markdown", "yaml", "csv", "pretty", "excel", "slack"]; export type ClickyPrimaryViewFormat = (typeof CLICKY_PRIMARY_VIEW_FORMATS)[number]; export type ClickyOverflowViewFormat = (typeof CLICKY_OVERFLOW_VIEW_FORMATS)[number]; export type ClickyRemoteFormat = ClickyPrimaryViewFormat | ClickyOverflowViewFormat; export type ClickyViewOptions = Partial<Record<ClickyRemoteFormat, boolean>>; export type ClickyViewConfig = ClickyViewOptions | ClickyRemoteFormat[]; export type ClickyDownloadOptions = { all?: boolean; label?: string; }; export type ClickyProps = { data?: ClickyDocument | ClickyNode | string; url?: string; view?: ClickyViewConfig; download?: ClickyDownloadOptions; commandRuntime?: ClickyCommandRuntime; onTableRowClick?: ClickyTableRowClick; getTableRowHref?: ClickyTableRowHref; isTableRowClickable?: ClickyTableRowPredicate; className?: string; }; type ParsedClicky = { ok: true; document: ClickyDocument; } | { ok: false; message: string; raw: string; }; export declare function Clicky(props: ClickyProps): import("react/jsx-runtime").JSX.Element; export declare function parseClickyData(data: ClickyProps["data"]): ParsedClicky; export {}; //# sourceMappingURL=Clicky.d.ts.map