@anaralabs/lector 3.5.2 → 3.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,10 +31,11 @@ declare interface Annotation {
31
31
  width: number;
32
32
  pageNumber: number;
33
33
  }>;
34
- comment?: string;
35
- color?: string;
34
+ color: string;
36
35
  createdAt: Date;
37
36
  updatedAt: Date;
37
+ comment?: string;
38
+ metadata?: Record<string, unknown>;
38
39
  }
39
40
  export { Annotation }
40
41
  export { Annotation as Annotation_alias_1 }
@@ -84,7 +85,7 @@ declare interface AnnotationLayerParams {
84
85
 
85
86
  declare interface AnnotationState {
86
87
  annotations: Annotation[];
87
- addAnnotation: (annotation: Omit<Annotation, "id" | "createdAt" | "updatedAt">) => void;
88
+ addAnnotation: (annotation: Annotation) => void;
88
89
  updateAnnotation: (id: string, updates: Partial<Annotation>) => void;
89
90
  deleteAnnotation: (id: string) => void;
90
91
  setAnnotations: (annotations: Annotation[]) => void;
package/dist/index.js CHANGED
@@ -6,9 +6,9 @@ import { useFloating, autoUpdate, offset, shift, useDismiss, useInteractions, in
6
6
  import { useVirtualizer, elementScroll, debounce } from '@tanstack/react-virtual';
7
7
  import { create, useStore, createStore } from 'zustand';
8
8
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
9
- import { v4 } from 'uuid';
10
9
  import { AnnotationLayer, TextLayer, getDocument } from 'pdfjs-dist';
11
10
  import { useDebounce } from 'use-debounce';
11
+ import { v4 } from 'uuid';
12
12
  import { Slot } from '@radix-ui/react-slot';
13
13
 
14
14
  // src/components/annotation-tooltip.tsx
@@ -317,20 +317,14 @@ var useAnnotations = create((set) => ({
317
317
  addAnnotation: (annotation) => set((state) => ({
318
318
  annotations: [
319
319
  ...state.annotations,
320
- {
321
- ...annotation,
322
- id: v4(),
323
- createdAt: /* @__PURE__ */ new Date(),
324
- updatedAt: /* @__PURE__ */ new Date()
325
- }
320
+ annotation
326
321
  ]
327
322
  })),
328
323
  updateAnnotation: (id, updates) => set((state) => ({
329
324
  annotations: state.annotations.map(
330
325
  (annotation) => annotation.id === id ? {
331
326
  ...annotation,
332
- ...updates,
333
- updatedAt: /* @__PURE__ */ new Date()
327
+ ...updates
334
328
  } : annotation
335
329
  )
336
330
  })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anaralabs/lector",
3
- "version": "3.5.2",
3
+ "version": "3.5.3",
4
4
  "description": "Headless PDF viewer for React",
5
5
  "author": "andrewdr (https://github.com/andrewdoro)",
6
6
  "license": "MIT",