Skip to content

Properties

PropertyTypeDefaultDescription
storeAnnotationStorecreateLocalStorageStore()Where annotations are persisted/sent
onError(error, context) => void | nullnull (falls back to console.warn)Error reporter for failed store operations — detects incomplete backends early
labelsAnnotationLabelsdefaultLabels (Chinese)UI text overrides
themeNamestring'blue'Preset theme name (attribute: theme)
themeAnnotationTheme{}Fine-grained accent overrides, applied on top of the preset
visiblebooleanfalseWhether the launcher is shown on the page (attribute: visible)
requireAuthbooleanfalseLock the tool behind an access token (attribute: require-auth)
positionstring'right-center'Dock position of the launcher/panel: right-center / right-top / right-bottom / left-center / left-top / left-bottom (attribute: position)

onError

Failed store operations (list / create / resolve / reorder) report through onError with a PatchMarkErrorContext:

ts
type PatchMarkErrorContext = {
  operation: 'list' | 'create' | 'resolve' | 'reorder';
  annotationId?: string;
};

When unset, failures fall back to a console.warn. When a backend rejects a request with 401 (access control), the component throws PatchMarkAuthError and shows the lock panel automatically — onError still fires for it, so you can route it to monitoring.

Programmatic API

ts
import {
  createLocalStorageStore,
  createFetchStore,
  createLocalAnnotation,
  setAuthToken, getAuthToken, clearAuthToken,
  formatAnnotationAsPrompt, formatAnnotationsAsPrompt,
  defaultLabels,
  PatchMarkAuthError,
  VERSION,
} from 'patch-mark';

MIT Licensed