API reference

petty.quips

petty.quips.suggest

suggest(text: string, options?: QuipSuggestOptions): string

Returns the canonical id (either options.id or a generated UUID).

petty.quips.retract

retract(id: string): void

petty.quips.clear

clear(): void

Types referenced

QuipSuggestOptions

interface QuipSuggestOptions {
  /** 0..100. >= 80 fires immediately, preempting the cadence tick. Default 10. */
  urgency?: number;
  /** Free-form tag used for per-category cooldowns. */
  category?: string;
  /** Seconds until the suggestion is pruned from the queue. Default 300. */
  expiresIn?: number;
  /** Stable id scoped to this plugin. Re-submitting the same id replaces. */
  id?: string;
  /** Seconds the bubble stays on screen. Default 3. */
  duration?: number;
  /** Bubble style override. */
  style?: BubbleStyle;
}

BubbleStyle

interface BubbleStyle {
  background?: string;       // hex with or without '#'
  color?: string;
  borderColor?: string;
  borderWidth?: number;      // 0 hides border
  fontSize?: number;
  fontWeight?:
    | "ultralight" | "thin" | "light" | "regular"
    | "medium" | "semibold" | "bold" | "heavy" | "black";
  textAlign?: "left" | "center" | "right";
  cornerRadius?: number;
  padding?: number;
  maxWidth?: number;
  tail?: boolean;
  tailWidth?: number;
  tailHeight?: number;
  shadow?: boolean;
  shadowOffsetX?: number;
  shadowOffsetY?: number;
  shadowBlur?: number;
  shadowOpacity?: number;
  fadeDuration?: number;
}