API reference

petty.pet

petty.pet.showBubble

showBubble(text: string, durationSec: number, style?: BubbleStyle): void

petty.pet.animate

animate(state: string): void

petty.pet.playSequence

playSequence(steps: AnimationStep[], callback?: () => void): void

petty.pet.speak

speak(text: string, options?: SpeakOptions): void

petty.pet.mood

mood(): PetMood

petty.pet.setMood

setMood(mood: PetMood): void

petty.pet.isMuted

isMuted(): boolean

petty.pet.isDoNotDisturb

isDoNotDisturb(): boolean

Types referenced

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;
}

AnimationStep

interface AnimationStep {
  scaleX?: number;
  scaleY?: number;
  rotate?: number;   // degrees, relative
  moveX?: number;    // points, relative
  moveY?: number;    // points, relative
  fade?: number;     // absolute alpha 0..1
  duration?: number; // seconds, default 0.15
}

SpeakOptions

interface SpeakOptions {
  /** "notification" (default), "quip", or "drop". Provider plugins inspect
   *  this to decide whether to synthesize or fall back to the system voice. */
  category?: "notification" | "quip" | "drop";
}

PetMood

type PetMood =
  | "idle" | "excited" | "sleeping" | "yelling" | "thinking"
  | string;