All files / confetti/src headless.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79                                                                                                                                                             
/**
 * `@usefy/confetti/headless` — the framework-free confetti engine.
 *
 * Pure TypeScript, zero dependencies, zero React imports, SSR-safe to
 * import (no `window`/`document`/canvas access at module scope). Usable
 * from any framework or vanilla JS:
 *
 * @example
 * ```ts
 * import { createConfettiEngine } from "@usefy/confetti/headless";
 *
 * const engine = createConfettiEngine(document.querySelector("canvas")!);
 * await engine.fire({ count: 120, spread: 70 });
 * engine.destroy();
 * ```
 */
 
// Engine
export { createConfettiEngine, MAX_FRAME_DT_MS, MAX_DPR } from "./engine/createEngine";
 
// Pure physics (exported for tests and advanced use — SPEC §4.1)
export { spawnParticle, stepParticle } from "./engine/physics";
 
// Option resolution + defaults
export {
  resolveFireOptions,
  DEFAULT_COLORS,
  DEFAULT_SHAPES,
  DEFAULT_PARTICLES_PER_SECOND,
} from "./types";
 
// Built-in shape identifiers
export { BUILTIN_SHAPES } from "./shapes/builtin";
 
// Custom shape helpers
export { textShape } from "./shapes/textShape";
export type { TextShapeOptions } from "./shapes/textShape";
export { imageShape, DEFAULT_IMAGE_HEIGHT } from "./shapes/imageShape";
export type { ImageShapeOptions } from "./shapes/imageShape";
export { pathShape } from "./shapes/pathShape";
export type { PathShapeOptions } from "./shapes/pathShape";
export { DEFAULT_PATH_SHAPE_SIZE } from "./engine/draw";
 
// Presets + runner
export {
  runPreset,
  celebration,
  fireworks,
  sideCannons,
  pride,
  stars,
  snow,
  rain,
} from "./presets";
export type {
  Preset,
  PresetBurst,
  PresetEmitter,
  PresetRun,
  PresetTarget,
} from "./presets";
 
// Types
export type {
  BuiltinShape,
  ConfettiEngine,
  ConfettiEngineOptions,
  ConfettiShape,
  CustomShape,
  EmitHandle,
  EmitOptions,
  FireOptions,
  Particle,
  PathShape,
  ResolvedFireOptions,
  SpriteEntry,
  SpriteShape,
} from "./types";