All files / qr-scanner/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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111                                                                                                                                                                                                                             
/**
 * `@usefy/qr-scanner/headless` — the framework-free surface.
 *
 * Zero React in this graph and, deliberately, **no `"use client"` banner**
 * (SPEC decision #1): a server component, a Web Worker, or a plain script can
 * import from here and decode a QR code with no client framework at all.
 * `src/headless.test.ts` asserts the built bundle keeps that promise.
 */
 
/* ── Decoding ── */
export { decode, decodeFile, decodeFirst, type DecodeOptions } from "./engine";
export { decodeImageData, type DecodeImageDataOptions } from "./decodeImage";
export { decodeMatrix, type DecodeMatrixOptions } from "./decode/decodeMatrix";
 
/* ── The pure stages, for anyone building something else on them ── */
export { BitMatrix } from "./image/bitmatrix";
export { toGray, toSourcePoint, type GrayOptions } from "./image/luminance";
export { binarize, globalBinarize, hybridBinarize, otsuThreshold } from "./image/binarize";
export { releaseScratchCanvas, toImageData } from "./image/source";
export {
  detectSymbols,
  type DetectOptions,
  type DetectedSymbol,
  type SampleAttempt,
} from "./detect/detect";
export { distance, findFinderPatterns, type FinderCandidate } from "./detect/finder";
export {
  dimensionCandidates,
  estimateDimension,
  groupFinders,
  type FinderTriple,
} from "./detect/group";
export { moduleSizeBetween } from "./detect/moduleSize";
export { findAlignmentPattern, predictAlignment } from "./detect/alignment";
export { PerspectiveTransform, type Quad4 } from "./detect/perspective";
export { sampleGrid } from "./detect/sample";
export {
  BitReader,
  decodeFormatBits,
  decodeSegmentText,
  decodeVersionBits,
  deinterleave,
  eciLabel,
  isValidUtf8,
  parseSegments,
  readCodewords,
  readFormatInfo,
  readRawCodewords,
  readVersion,
  rsDecode,
  syndromes,
  type CodewordBlock,
  type DecodedCodewords,
  type FormatInfo,
  type ParsedBitStream,
  type RSDecodeResult,
} from "./decode";
 
/* ── Engines ── */
export { decodeWithNative, isNativeSupported, resetNativeSupport } from "./native";
export { createWorkerDecoder, type WorkerDecoder } from "./worker-client";
export type {
  WorkerDecodeRequest,
  WorkerDecodeFailure,
  WorkerDecodeSuccess,
  WorkerResponse,
  WorkerScanOptions,
} from "./worker-protocol";
 
/* ── Helpers ── */
export {
  cornersToPolygon,
  joinStructuredAppend,
  mapCorners,
  mapPointToElement,
  type ElementGeometry,
  type JoinedSequence,
} from "./utils";
 
/* ── Errors ── */
export {
  QRCameraError,
  QRDecodeError,
  QRUnsupportedError,
  type QRCameraErrorReason,
  type QRDecodeStage,
} from "./errors";
 
/* ── Types ── */
export type {
  Binarizer,
  BinarizerMode,
  EnginePreference,
  ErrorCorrectionLevel,
  GrayImage,
  ImageSource,
  InvertMode,
  ModuleGrid,
  Point,
  Quad,
  QRScanEngine,
  QRScanOptions,
  QRScanResult,
  QRScanSegment,
  QRSegmentMode,
  QRSymbolInfo,
  Rect,
  SamplingMode,
  StructuredAppendInfo,
} from "./types";