@papyrus-sdk/types 0.2.7 → 0.2.8-beta.0

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.
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- type ViewMode = 'single' | 'double' | 'continuous';
2
- type UITheme = 'light' | 'dark';
3
- type PageTheme = 'normal' | 'sepia' | 'dark' | 'high-contrast';
4
- type Locale = 'en' | 'pt-BR';
5
- type RenderTargetType = 'canvas' | 'element' | 'webview';
1
+ type ViewMode = "single" | "double" | "continuous";
2
+ type UITheme = "light" | "dark";
3
+ type PageTheme = "normal" | "sepia" | "dark" | "high-contrast";
4
+ type Locale = "en" | "pt-BR";
5
+ type RenderTargetType = "canvas" | "element" | "webview";
6
6
  interface FileLike {
7
7
  arrayBuffer(): Promise<ArrayBuffer>;
8
8
  }
@@ -11,7 +11,36 @@ type DocumentSource = ArrayBuffer | Uint8Array | string | {
11
11
  } | {
12
12
  data: ArrayBuffer | Uint8Array;
13
13
  } | FileLike;
14
- type DocumentType = 'pdf' | 'epub' | 'text';
14
+ type DocumentType = "pdf" | "epub" | "text";
15
+ type ReadingMode = "focus" | "controlsVisible" | "readingDimmed" | "modalSurfaceOpen" | "annotate";
16
+ type ActiveSurface = "none" | "search" | "jump" | "outline" | "thumbnails" | "comments" | "info" | "documentActions" | "theme";
17
+ type MobilePrimaryDestination = "none" | "pages" | "contents" | "progress" | "search" | "notes" | "display" | "info" | "documentActions" | "annotate";
18
+ interface MobileShellState {
19
+ activeMobileDestination: MobilePrimaryDestination;
20
+ mobileKeyboardOpen: boolean;
21
+ mobileDockVisible: boolean;
22
+ mobileProgressPillVisible: boolean;
23
+ }
24
+ interface DocumentLocation {
25
+ kind: "page" | "section" | "progress" | "range";
26
+ label: string;
27
+ primaryValue: number | string;
28
+ secondaryValue?: number | string;
29
+ engineTarget?: unknown;
30
+ }
31
+ type NavigationTarget = DocumentLocation;
32
+ interface ReaderCapabilities {
33
+ "search.text"?: boolean;
34
+ "navigation.page"?: boolean;
35
+ "navigation.section"?: boolean;
36
+ "documentActions.share"?: boolean;
37
+ "documentActions.export"?: boolean;
38
+ }
39
+ interface CapabilityState {
40
+ status: "unknown" | "ready" | "partial";
41
+ values: ReaderCapabilities;
42
+ errors: string[];
43
+ }
15
44
  interface DocumentLoadRequest {
16
45
  type: DocumentType;
17
46
  source: DocumentSource;
@@ -53,7 +82,7 @@ interface AnnotationReply {
53
82
  }
54
83
  interface Annotation {
55
84
  id: string;
56
- type: 'highlight' | 'underline' | 'squiggly' | 'strikeout' | 'text' | 'comment' | 'ink';
85
+ type: "highlight" | "underline" | "squiggly" | "strikeout" | "text" | "comment" | "ink";
57
86
  pageIndex: number;
58
87
  content?: string;
59
88
  rect: {
@@ -73,6 +102,8 @@ interface Annotation {
73
102
  y: number;
74
103
  }[];
75
104
  color: string;
105
+ opacity?: number;
106
+ strokeWidth?: number;
76
107
  createdAt: number;
77
108
  updatedAt?: number;
78
109
  replies?: AnnotationReply[];
@@ -84,16 +115,16 @@ interface OutlineItem {
84
115
  children?: OutlineItem[];
85
116
  }
86
117
  type PageDestination = string | {
87
- kind: 'pageIndex';
118
+ kind: "pageIndex";
88
119
  value: number;
89
120
  } | {
90
- kind: 'pageNumber';
121
+ kind: "pageNumber";
91
122
  value: number;
92
123
  } | {
93
- kind: 'named';
124
+ kind: "named";
94
125
  value: string;
95
126
  } | {
96
- kind: 'href';
127
+ kind: "href";
97
128
  value: string;
98
129
  };
99
130
  interface PapyrusConfig {
@@ -165,7 +196,7 @@ interface DocumentEngine {
165
196
  goToPage(page: number): void;
166
197
  setZoom(zoom: number): void;
167
198
  getZoom(): number;
168
- rotate(direction: 'clockwise' | 'counterclockwise'): void;
199
+ rotate(direction: "clockwise" | "counterclockwise"): void;
169
200
  getRotation(): number;
170
201
  /**
171
202
  * Renderiza o conteúdo visual da página.
@@ -195,4 +226,4 @@ interface DocumentEngine {
195
226
  destroy(): void;
196
227
  }
197
228
 
198
- export { type Annotation, type AnnotationReply, type DocumentEngine, type DocumentLoadInput, type DocumentLoadRequest, type DocumentSource, type DocumentType, type EventPayloads, type FileLike, type Locale, type OutlineItem, type PageDestination, type PageTheme, type PapyrusConfig, type PapyrusEventListener, PapyrusEventType, type RenderTargetType, type SearchResult, type TextItem, type TextSelection, type UITheme, type ViewMode };
229
+ export { type ActiveSurface, type Annotation, type AnnotationReply, type CapabilityState, type DocumentEngine, type DocumentLoadInput, type DocumentLoadRequest, type DocumentLocation, type DocumentSource, type DocumentType, type EventPayloads, type FileLike, type Locale, type MobilePrimaryDestination, type MobileShellState, type NavigationTarget, type OutlineItem, type PageDestination, type PageTheme, type PapyrusConfig, type PapyrusEventListener, PapyrusEventType, type ReaderCapabilities, type ReadingMode, type RenderTargetType, type SearchResult, type TextItem, type TextSelection, type UITheme, type ViewMode };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- type ViewMode = 'single' | 'double' | 'continuous';
2
- type UITheme = 'light' | 'dark';
3
- type PageTheme = 'normal' | 'sepia' | 'dark' | 'high-contrast';
4
- type Locale = 'en' | 'pt-BR';
5
- type RenderTargetType = 'canvas' | 'element' | 'webview';
1
+ type ViewMode = "single" | "double" | "continuous";
2
+ type UITheme = "light" | "dark";
3
+ type PageTheme = "normal" | "sepia" | "dark" | "high-contrast";
4
+ type Locale = "en" | "pt-BR";
5
+ type RenderTargetType = "canvas" | "element" | "webview";
6
6
  interface FileLike {
7
7
  arrayBuffer(): Promise<ArrayBuffer>;
8
8
  }
@@ -11,7 +11,36 @@ type DocumentSource = ArrayBuffer | Uint8Array | string | {
11
11
  } | {
12
12
  data: ArrayBuffer | Uint8Array;
13
13
  } | FileLike;
14
- type DocumentType = 'pdf' | 'epub' | 'text';
14
+ type DocumentType = "pdf" | "epub" | "text";
15
+ type ReadingMode = "focus" | "controlsVisible" | "readingDimmed" | "modalSurfaceOpen" | "annotate";
16
+ type ActiveSurface = "none" | "search" | "jump" | "outline" | "thumbnails" | "comments" | "info" | "documentActions" | "theme";
17
+ type MobilePrimaryDestination = "none" | "pages" | "contents" | "progress" | "search" | "notes" | "display" | "info" | "documentActions" | "annotate";
18
+ interface MobileShellState {
19
+ activeMobileDestination: MobilePrimaryDestination;
20
+ mobileKeyboardOpen: boolean;
21
+ mobileDockVisible: boolean;
22
+ mobileProgressPillVisible: boolean;
23
+ }
24
+ interface DocumentLocation {
25
+ kind: "page" | "section" | "progress" | "range";
26
+ label: string;
27
+ primaryValue: number | string;
28
+ secondaryValue?: number | string;
29
+ engineTarget?: unknown;
30
+ }
31
+ type NavigationTarget = DocumentLocation;
32
+ interface ReaderCapabilities {
33
+ "search.text"?: boolean;
34
+ "navigation.page"?: boolean;
35
+ "navigation.section"?: boolean;
36
+ "documentActions.share"?: boolean;
37
+ "documentActions.export"?: boolean;
38
+ }
39
+ interface CapabilityState {
40
+ status: "unknown" | "ready" | "partial";
41
+ values: ReaderCapabilities;
42
+ errors: string[];
43
+ }
15
44
  interface DocumentLoadRequest {
16
45
  type: DocumentType;
17
46
  source: DocumentSource;
@@ -53,7 +82,7 @@ interface AnnotationReply {
53
82
  }
54
83
  interface Annotation {
55
84
  id: string;
56
- type: 'highlight' | 'underline' | 'squiggly' | 'strikeout' | 'text' | 'comment' | 'ink';
85
+ type: "highlight" | "underline" | "squiggly" | "strikeout" | "text" | "comment" | "ink";
57
86
  pageIndex: number;
58
87
  content?: string;
59
88
  rect: {
@@ -73,6 +102,8 @@ interface Annotation {
73
102
  y: number;
74
103
  }[];
75
104
  color: string;
105
+ opacity?: number;
106
+ strokeWidth?: number;
76
107
  createdAt: number;
77
108
  updatedAt?: number;
78
109
  replies?: AnnotationReply[];
@@ -84,16 +115,16 @@ interface OutlineItem {
84
115
  children?: OutlineItem[];
85
116
  }
86
117
  type PageDestination = string | {
87
- kind: 'pageIndex';
118
+ kind: "pageIndex";
88
119
  value: number;
89
120
  } | {
90
- kind: 'pageNumber';
121
+ kind: "pageNumber";
91
122
  value: number;
92
123
  } | {
93
- kind: 'named';
124
+ kind: "named";
94
125
  value: string;
95
126
  } | {
96
- kind: 'href';
127
+ kind: "href";
97
128
  value: string;
98
129
  };
99
130
  interface PapyrusConfig {
@@ -165,7 +196,7 @@ interface DocumentEngine {
165
196
  goToPage(page: number): void;
166
197
  setZoom(zoom: number): void;
167
198
  getZoom(): number;
168
- rotate(direction: 'clockwise' | 'counterclockwise'): void;
199
+ rotate(direction: "clockwise" | "counterclockwise"): void;
169
200
  getRotation(): number;
170
201
  /**
171
202
  * Renderiza o conteúdo visual da página.
@@ -195,4 +226,4 @@ interface DocumentEngine {
195
226
  destroy(): void;
196
227
  }
197
228
 
198
- export { type Annotation, type AnnotationReply, type DocumentEngine, type DocumentLoadInput, type DocumentLoadRequest, type DocumentSource, type DocumentType, type EventPayloads, type FileLike, type Locale, type OutlineItem, type PageDestination, type PageTheme, type PapyrusConfig, type PapyrusEventListener, PapyrusEventType, type RenderTargetType, type SearchResult, type TextItem, type TextSelection, type UITheme, type ViewMode };
229
+ export { type ActiveSurface, type Annotation, type AnnotationReply, type CapabilityState, type DocumentEngine, type DocumentLoadInput, type DocumentLoadRequest, type DocumentLocation, type DocumentSource, type DocumentType, type EventPayloads, type FileLike, type Locale, type MobilePrimaryDestination, type MobileShellState, type NavigationTarget, type OutlineItem, type PageDestination, type PageTheme, type PapyrusConfig, type PapyrusEventListener, PapyrusEventType, type ReaderCapabilities, type ReadingMode, type RenderTargetType, type SearchResult, type TextItem, type TextSelection, type UITheme, type ViewMode };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../index.ts"],"sourcesContent":["\r\nexport type ViewMode = 'single' | 'double' | 'continuous';\r\nexport type UITheme = 'light' | 'dark';\r\nexport type PageTheme = 'normal' | 'sepia' | 'dark' | 'high-contrast';\r\nexport type Locale = 'en' | 'pt-BR';\r\nexport type RenderTargetType = 'canvas' | 'element' | 'webview';\r\n\r\nexport interface FileLike {\r\n arrayBuffer(): Promise<ArrayBuffer>;\r\n}\r\n\r\nexport type DocumentSource =\r\n | ArrayBuffer\r\n | Uint8Array\r\n | string\r\n | { uri: string }\r\n | { data: ArrayBuffer | Uint8Array }\r\n | FileLike;\r\n\r\nexport type DocumentType = 'pdf' | 'epub' | 'text';\r\n\r\nexport interface DocumentLoadRequest {\r\n type: DocumentType;\r\n source: DocumentSource;\r\n}\r\n\r\nexport type DocumentLoadInput = DocumentSource | DocumentLoadRequest;\r\n\r\nexport interface TextItem {\r\n str: string;\r\n dir: string;\r\n width: number;\r\n height: number;\r\n transform: number[];\r\n fontName: string;\r\n}\r\n\r\nexport interface SearchResult {\r\n pageIndex: number;\r\n text: string;\r\n matchIndex: number;\r\n rects?: { x: number; y: number; width: number; height: number }[];\r\n}\r\n\r\nexport interface TextSelection {\r\n text: string;\r\n rects: { x: number; y: number; width: number; height: number }[];\r\n}\r\n\r\nexport interface AnnotationReply {\r\n id: string;\r\n annotationId: string;\r\n content: string;\r\n createdAt: number;\r\n}\r\n\r\nexport interface Annotation {\r\n id: string;\r\n type: 'highlight' | 'underline' | 'squiggly' | 'strikeout' | 'text' | 'comment' | 'ink';\r\n pageIndex: number;\r\n content?: string;\r\n rect: { x: number; y: number; width: number; height: number };\r\n rects?: { x: number; y: number; width: number; height: number }[];\r\n path?: { x: number; y: number }[];\r\n color: string;\r\n createdAt: number;\r\n updatedAt?: number;\r\n replies?: AnnotationReply[];\r\n}\r\n\r\nexport interface OutlineItem {\r\n title: string;\r\n pageIndex: number;\r\n dest?: PageDestination;\r\n children?: OutlineItem[];\r\n}\r\n\r\nexport type PageDestination =\r\n | string\r\n | { kind: 'pageIndex'; value: number }\r\n | { kind: 'pageNumber'; value: number }\r\n | { kind: 'named'; value: string }\r\n | { kind: 'href'; value: string };\r\n\r\nexport interface PapyrusConfig {\r\n initialPage?: number;\r\n initialZoom?: number;\r\n initialRotation?: number;\r\n initialViewMode?: ViewMode;\r\n initialUITheme?: UITheme;\r\n initialPageTheme?: PageTheme;\r\n initialAccentColor?: string;\r\n initialLocale?: Locale;\r\n initialAnnotations?: Annotation[];\r\n sidebarLeftOpen?: boolean;\r\n sidebarRightOpen?: boolean;\r\n}\r\n\r\nexport enum PapyrusEventType {\r\n DOCUMENT_LOADED = 'DOCUMENT_LOADED',\r\n PAGE_CHANGED = 'PAGE_CHANGED',\r\n ZOOM_CHANGED = 'ZOOM_CHANGED',\r\n ANNOTATION_CREATED = 'ANNOTATION_CREATED',\r\n ANNOTATION_UPDATED = 'ANNOTATION_UPDATED',\r\n ANNOTATION_DELETED = 'ANNOTATION_DELETED',\r\n ANNOTATION_REPLY_ADDED = 'ANNOTATION_REPLY_ADDED',\r\n SEARCH_TRIGGERED = 'SEARCH_TRIGGERED',\r\n TEXT_SELECTED = 'TEXT_SELECTED',\r\n}\r\n\r\nexport interface EventPayloads {\r\n [PapyrusEventType.DOCUMENT_LOADED]: { pageCount: number };\r\n [PapyrusEventType.PAGE_CHANGED]: { pageNumber: number };\r\n [PapyrusEventType.ZOOM_CHANGED]: { zoom: number };\r\n [PapyrusEventType.ANNOTATION_CREATED]: { annotation: Annotation };\r\n [PapyrusEventType.ANNOTATION_UPDATED]: { annotation: Annotation };\r\n [PapyrusEventType.ANNOTATION_DELETED]: { annotationId: string };\r\n [PapyrusEventType.ANNOTATION_REPLY_ADDED]: {\r\n annotationId: string;\r\n reply: AnnotationReply;\r\n annotation: Annotation;\r\n };\r\n [PapyrusEventType.SEARCH_TRIGGERED]: { query: string };\r\n [PapyrusEventType.TEXT_SELECTED]: { text: string, pageIndex: number };\r\n}\r\n\r\nexport type PapyrusEventListener<T extends PapyrusEventType> = (payload: EventPayloads[T]) => void;\r\n\r\n/**\r\n * Interface agnóstica do Motor.\r\n * A UI interage apenas com estes métodos.\r\n */\r\nexport interface DocumentEngine {\r\n load(source: DocumentSource): Promise<void>;\r\n load(request: DocumentLoadRequest): Promise<void>;\r\n getPageCount(): number;\r\n getCurrentPage(): number;\r\n goToPage(page: number): void;\r\n setZoom(zoom: number): void;\r\n getZoom(): number;\r\n rotate(direction: 'clockwise' | 'counterclockwise'): void;\r\n getRotation(): number;\r\n\r\n /**\r\n * Renderiza o conteúdo visual da página.\r\n * target: HTMLCanvasElement no Web ou NativeHandle no RN.\r\n */\r\n renderPage(pageIndex: number, target: any, scale: number): Promise<void>;\r\n\r\n /**\r\n * Renderiza a camada de texto para seleção.\r\n * container: HTMLElement no Web ou GhostView no RN.\r\n */\r\n renderTextLayer(pageIndex: number, container: any, scale: number): Promise<void>;\r\n\r\n getTextContent(pageIndex: number): Promise<TextItem[]>;\r\n getPageDimensions(pageIndex: number): Promise<{ width: number, height: number }>;\r\n searchText?(query: string): Promise<SearchResult[]>;\r\n selectText?(pageIndex: number, rect: { x: number; y: number; width: number; height: number }): Promise<TextSelection | null>;\r\n getOutline(): Promise<OutlineItem[]>;\r\n getPageIndex(dest: PageDestination): Promise<number | null>;\r\n getRenderTargetType?(): RenderTargetType;\r\n destroy(): void;\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkGO,IAAK,mBAAL,kBAAKA,sBAAL;AACL,EAAAA,kBAAA,qBAAkB;AAClB,EAAAA,kBAAA,kBAAe;AACf,EAAAA,kBAAA,kBAAe;AACf,EAAAA,kBAAA,wBAAqB;AACrB,EAAAA,kBAAA,wBAAqB;AACrB,EAAAA,kBAAA,wBAAqB;AACrB,EAAAA,kBAAA,4BAAyB;AACzB,EAAAA,kBAAA,sBAAmB;AACnB,EAAAA,kBAAA,mBAAgB;AATN,SAAAA;AAAA,GAAA;","names":["PapyrusEventType"]}
1
+ {"version":3,"sources":["../index.ts"],"sourcesContent":["export type ViewMode = \"single\" | \"double\" | \"continuous\";\nexport type UITheme = \"light\" | \"dark\";\nexport type PageTheme = \"normal\" | \"sepia\" | \"dark\" | \"high-contrast\";\nexport type Locale = \"en\" | \"pt-BR\";\nexport type RenderTargetType = \"canvas\" | \"element\" | \"webview\";\n\nexport interface FileLike {\n arrayBuffer(): Promise<ArrayBuffer>;\n}\n\nexport type DocumentSource =\n | ArrayBuffer\n | Uint8Array\n | string\n | { uri: string }\n | { data: ArrayBuffer | Uint8Array }\n | FileLike;\n\nexport type DocumentType = \"pdf\" | \"epub\" | \"text\";\n\nexport type ReadingMode =\n | \"focus\"\n | \"controlsVisible\"\n | \"readingDimmed\"\n | \"modalSurfaceOpen\"\n | \"annotate\";\n\nexport type ActiveSurface =\n | \"none\"\n | \"search\"\n | \"jump\"\n | \"outline\"\n | \"thumbnails\"\n | \"comments\"\n | \"info\"\n | \"documentActions\"\n | \"theme\";\n\nexport type MobilePrimaryDestination =\n | \"none\"\n | \"pages\"\n | \"contents\"\n | \"progress\"\n | \"search\"\n | \"notes\"\n | \"display\"\n | \"info\"\n | \"documentActions\"\n | \"annotate\";\n\nexport interface MobileShellState {\n activeMobileDestination: MobilePrimaryDestination;\n mobileKeyboardOpen: boolean;\n mobileDockVisible: boolean;\n mobileProgressPillVisible: boolean;\n}\n\nexport interface DocumentLocation {\n kind: \"page\" | \"section\" | \"progress\" | \"range\";\n label: string;\n primaryValue: number | string;\n secondaryValue?: number | string;\n engineTarget?: unknown;\n}\n\nexport type NavigationTarget = DocumentLocation;\n\nexport interface ReaderCapabilities {\n \"search.text\"?: boolean;\n \"navigation.page\"?: boolean;\n \"navigation.section\"?: boolean;\n \"documentActions.share\"?: boolean;\n \"documentActions.export\"?: boolean;\n}\n\nexport interface CapabilityState {\n status: \"unknown\" | \"ready\" | \"partial\";\n values: ReaderCapabilities;\n errors: string[];\n}\n\nexport interface DocumentLoadRequest {\n type: DocumentType;\n source: DocumentSource;\n}\n\nexport type DocumentLoadInput = DocumentSource | DocumentLoadRequest;\n\nexport interface TextItem {\n str: string;\n dir: string;\n width: number;\n height: number;\n transform: number[];\n fontName: string;\n}\n\nexport interface SearchResult {\n pageIndex: number;\n text: string;\n matchIndex: number;\n rects?: { x: number; y: number; width: number; height: number }[];\n}\n\nexport interface TextSelection {\n text: string;\n rects: { x: number; y: number; width: number; height: number }[];\n}\n\nexport interface AnnotationReply {\n id: string;\n annotationId: string;\n content: string;\n createdAt: number;\n}\n\nexport interface Annotation {\n id: string;\n type:\n | \"highlight\"\n | \"underline\"\n | \"squiggly\"\n | \"strikeout\"\n | \"text\"\n | \"comment\"\n | \"ink\";\n pageIndex: number;\n content?: string;\n rect: { x: number; y: number; width: number; height: number };\n rects?: { x: number; y: number; width: number; height: number }[];\n path?: { x: number; y: number }[];\n color: string;\n opacity?: number;\n strokeWidth?: number;\n createdAt: number;\n updatedAt?: number;\n replies?: AnnotationReply[];\n}\n\nexport interface OutlineItem {\n title: string;\n pageIndex: number;\n dest?: PageDestination;\n children?: OutlineItem[];\n}\n\nexport type PageDestination =\n | string\n | { kind: \"pageIndex\"; value: number }\n | { kind: \"pageNumber\"; value: number }\n | { kind: \"named\"; value: string }\n | { kind: \"href\"; value: string };\n\nexport interface PapyrusConfig {\n initialPage?: number;\n initialZoom?: number;\n initialRotation?: number;\n initialViewMode?: ViewMode;\n initialUITheme?: UITheme;\n initialPageTheme?: PageTheme;\n initialAccentColor?: string;\n initialLocale?: Locale;\n initialAnnotations?: Annotation[];\n sidebarLeftOpen?: boolean;\n sidebarRightOpen?: boolean;\n}\n\nexport enum PapyrusEventType {\n DOCUMENT_LOADED = \"DOCUMENT_LOADED\",\n PAGE_CHANGED = \"PAGE_CHANGED\",\n ZOOM_CHANGED = \"ZOOM_CHANGED\",\n ANNOTATION_CREATED = \"ANNOTATION_CREATED\",\n ANNOTATION_UPDATED = \"ANNOTATION_UPDATED\",\n ANNOTATION_DELETED = \"ANNOTATION_DELETED\",\n ANNOTATION_REPLY_ADDED = \"ANNOTATION_REPLY_ADDED\",\n SEARCH_TRIGGERED = \"SEARCH_TRIGGERED\",\n TEXT_SELECTED = \"TEXT_SELECTED\",\n}\n\nexport interface EventPayloads {\n [PapyrusEventType.DOCUMENT_LOADED]: { pageCount: number };\n [PapyrusEventType.PAGE_CHANGED]: { pageNumber: number };\n [PapyrusEventType.ZOOM_CHANGED]: { zoom: number };\n [PapyrusEventType.ANNOTATION_CREATED]: { annotation: Annotation };\n [PapyrusEventType.ANNOTATION_UPDATED]: { annotation: Annotation };\n [PapyrusEventType.ANNOTATION_DELETED]: { annotationId: string };\n [PapyrusEventType.ANNOTATION_REPLY_ADDED]: {\n annotationId: string;\n reply: AnnotationReply;\n annotation: Annotation;\n };\n [PapyrusEventType.SEARCH_TRIGGERED]: { query: string };\n [PapyrusEventType.TEXT_SELECTED]: { text: string; pageIndex: number };\n}\n\nexport type PapyrusEventListener<T extends PapyrusEventType> = (\n payload: EventPayloads[T]\n) => void;\n\n/**\n * Interface agnóstica do Motor.\n * A UI interage apenas com estes métodos.\n */\nexport interface DocumentEngine {\n load(source: DocumentSource): Promise<void>;\n load(request: DocumentLoadRequest): Promise<void>;\n getPageCount(): number;\n getCurrentPage(): number;\n goToPage(page: number): void;\n setZoom(zoom: number): void;\n getZoom(): number;\n rotate(direction: \"clockwise\" | \"counterclockwise\"): void;\n getRotation(): number;\n\n /**\n * Renderiza o conteúdo visual da página.\n * target: HTMLCanvasElement no Web ou NativeHandle no RN.\n */\n renderPage(pageIndex: number, target: any, scale: number): Promise<void>;\n\n /**\n * Renderiza a camada de texto para seleção.\n * container: HTMLElement no Web ou GhostView no RN.\n */\n renderTextLayer(\n pageIndex: number,\n container: any,\n scale: number\n ): Promise<void>;\n\n getTextContent(pageIndex: number): Promise<TextItem[]>;\n getPageDimensions(\n pageIndex: number\n ): Promise<{ width: number; height: number }>;\n searchText?(query: string): Promise<SearchResult[]>;\n selectText?(\n pageIndex: number,\n rect: { x: number; y: number; width: number; height: number }\n ): Promise<TextSelection | null>;\n getOutline(): Promise<OutlineItem[]>;\n getPageIndex(dest: PageDestination): Promise<number | null>;\n getRenderTargetType?(): RenderTargetType;\n destroy(): void;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuKO,IAAK,mBAAL,kBAAKA,sBAAL;AACL,EAAAA,kBAAA,qBAAkB;AAClB,EAAAA,kBAAA,kBAAe;AACf,EAAAA,kBAAA,kBAAe;AACf,EAAAA,kBAAA,wBAAqB;AACrB,EAAAA,kBAAA,wBAAqB;AACrB,EAAAA,kBAAA,wBAAqB;AACrB,EAAAA,kBAAA,4BAAyB;AACzB,EAAAA,kBAAA,sBAAmB;AACnB,EAAAA,kBAAA,mBAAgB;AATN,SAAAA;AAAA,GAAA;","names":["PapyrusEventType"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../index.ts"],"sourcesContent":["\r\nexport type ViewMode = 'single' | 'double' | 'continuous';\r\nexport type UITheme = 'light' | 'dark';\r\nexport type PageTheme = 'normal' | 'sepia' | 'dark' | 'high-contrast';\r\nexport type Locale = 'en' | 'pt-BR';\r\nexport type RenderTargetType = 'canvas' | 'element' | 'webview';\r\n\r\nexport interface FileLike {\r\n arrayBuffer(): Promise<ArrayBuffer>;\r\n}\r\n\r\nexport type DocumentSource =\r\n | ArrayBuffer\r\n | Uint8Array\r\n | string\r\n | { uri: string }\r\n | { data: ArrayBuffer | Uint8Array }\r\n | FileLike;\r\n\r\nexport type DocumentType = 'pdf' | 'epub' | 'text';\r\n\r\nexport interface DocumentLoadRequest {\r\n type: DocumentType;\r\n source: DocumentSource;\r\n}\r\n\r\nexport type DocumentLoadInput = DocumentSource | DocumentLoadRequest;\r\n\r\nexport interface TextItem {\r\n str: string;\r\n dir: string;\r\n width: number;\r\n height: number;\r\n transform: number[];\r\n fontName: string;\r\n}\r\n\r\nexport interface SearchResult {\r\n pageIndex: number;\r\n text: string;\r\n matchIndex: number;\r\n rects?: { x: number; y: number; width: number; height: number }[];\r\n}\r\n\r\nexport interface TextSelection {\r\n text: string;\r\n rects: { x: number; y: number; width: number; height: number }[];\r\n}\r\n\r\nexport interface AnnotationReply {\r\n id: string;\r\n annotationId: string;\r\n content: string;\r\n createdAt: number;\r\n}\r\n\r\nexport interface Annotation {\r\n id: string;\r\n type: 'highlight' | 'underline' | 'squiggly' | 'strikeout' | 'text' | 'comment' | 'ink';\r\n pageIndex: number;\r\n content?: string;\r\n rect: { x: number; y: number; width: number; height: number };\r\n rects?: { x: number; y: number; width: number; height: number }[];\r\n path?: { x: number; y: number }[];\r\n color: string;\r\n createdAt: number;\r\n updatedAt?: number;\r\n replies?: AnnotationReply[];\r\n}\r\n\r\nexport interface OutlineItem {\r\n title: string;\r\n pageIndex: number;\r\n dest?: PageDestination;\r\n children?: OutlineItem[];\r\n}\r\n\r\nexport type PageDestination =\r\n | string\r\n | { kind: 'pageIndex'; value: number }\r\n | { kind: 'pageNumber'; value: number }\r\n | { kind: 'named'; value: string }\r\n | { kind: 'href'; value: string };\r\n\r\nexport interface PapyrusConfig {\r\n initialPage?: number;\r\n initialZoom?: number;\r\n initialRotation?: number;\r\n initialViewMode?: ViewMode;\r\n initialUITheme?: UITheme;\r\n initialPageTheme?: PageTheme;\r\n initialAccentColor?: string;\r\n initialLocale?: Locale;\r\n initialAnnotations?: Annotation[];\r\n sidebarLeftOpen?: boolean;\r\n sidebarRightOpen?: boolean;\r\n}\r\n\r\nexport enum PapyrusEventType {\r\n DOCUMENT_LOADED = 'DOCUMENT_LOADED',\r\n PAGE_CHANGED = 'PAGE_CHANGED',\r\n ZOOM_CHANGED = 'ZOOM_CHANGED',\r\n ANNOTATION_CREATED = 'ANNOTATION_CREATED',\r\n ANNOTATION_UPDATED = 'ANNOTATION_UPDATED',\r\n ANNOTATION_DELETED = 'ANNOTATION_DELETED',\r\n ANNOTATION_REPLY_ADDED = 'ANNOTATION_REPLY_ADDED',\r\n SEARCH_TRIGGERED = 'SEARCH_TRIGGERED',\r\n TEXT_SELECTED = 'TEXT_SELECTED',\r\n}\r\n\r\nexport interface EventPayloads {\r\n [PapyrusEventType.DOCUMENT_LOADED]: { pageCount: number };\r\n [PapyrusEventType.PAGE_CHANGED]: { pageNumber: number };\r\n [PapyrusEventType.ZOOM_CHANGED]: { zoom: number };\r\n [PapyrusEventType.ANNOTATION_CREATED]: { annotation: Annotation };\r\n [PapyrusEventType.ANNOTATION_UPDATED]: { annotation: Annotation };\r\n [PapyrusEventType.ANNOTATION_DELETED]: { annotationId: string };\r\n [PapyrusEventType.ANNOTATION_REPLY_ADDED]: {\r\n annotationId: string;\r\n reply: AnnotationReply;\r\n annotation: Annotation;\r\n };\r\n [PapyrusEventType.SEARCH_TRIGGERED]: { query: string };\r\n [PapyrusEventType.TEXT_SELECTED]: { text: string, pageIndex: number };\r\n}\r\n\r\nexport type PapyrusEventListener<T extends PapyrusEventType> = (payload: EventPayloads[T]) => void;\r\n\r\n/**\r\n * Interface agnóstica do Motor.\r\n * A UI interage apenas com estes métodos.\r\n */\r\nexport interface DocumentEngine {\r\n load(source: DocumentSource): Promise<void>;\r\n load(request: DocumentLoadRequest): Promise<void>;\r\n getPageCount(): number;\r\n getCurrentPage(): number;\r\n goToPage(page: number): void;\r\n setZoom(zoom: number): void;\r\n getZoom(): number;\r\n rotate(direction: 'clockwise' | 'counterclockwise'): void;\r\n getRotation(): number;\r\n\r\n /**\r\n * Renderiza o conteúdo visual da página.\r\n * target: HTMLCanvasElement no Web ou NativeHandle no RN.\r\n */\r\n renderPage(pageIndex: number, target: any, scale: number): Promise<void>;\r\n\r\n /**\r\n * Renderiza a camada de texto para seleção.\r\n * container: HTMLElement no Web ou GhostView no RN.\r\n */\r\n renderTextLayer(pageIndex: number, container: any, scale: number): Promise<void>;\r\n\r\n getTextContent(pageIndex: number): Promise<TextItem[]>;\r\n getPageDimensions(pageIndex: number): Promise<{ width: number, height: number }>;\r\n searchText?(query: string): Promise<SearchResult[]>;\r\n selectText?(pageIndex: number, rect: { x: number; y: number; width: number; height: number }): Promise<TextSelection | null>;\r\n getOutline(): Promise<OutlineItem[]>;\r\n getPageIndex(dest: PageDestination): Promise<number | null>;\r\n getRenderTargetType?(): RenderTargetType;\r\n destroy(): void;\r\n}\r\n"],"mappings":";AAkGO,IAAK,mBAAL,kBAAKA,sBAAL;AACL,EAAAA,kBAAA,qBAAkB;AAClB,EAAAA,kBAAA,kBAAe;AACf,EAAAA,kBAAA,kBAAe;AACf,EAAAA,kBAAA,wBAAqB;AACrB,EAAAA,kBAAA,wBAAqB;AACrB,EAAAA,kBAAA,wBAAqB;AACrB,EAAAA,kBAAA,4BAAyB;AACzB,EAAAA,kBAAA,sBAAmB;AACnB,EAAAA,kBAAA,mBAAgB;AATN,SAAAA;AAAA,GAAA;","names":["PapyrusEventType"]}
1
+ {"version":3,"sources":["../index.ts"],"sourcesContent":["export type ViewMode = \"single\" | \"double\" | \"continuous\";\nexport type UITheme = \"light\" | \"dark\";\nexport type PageTheme = \"normal\" | \"sepia\" | \"dark\" | \"high-contrast\";\nexport type Locale = \"en\" | \"pt-BR\";\nexport type RenderTargetType = \"canvas\" | \"element\" | \"webview\";\n\nexport interface FileLike {\n arrayBuffer(): Promise<ArrayBuffer>;\n}\n\nexport type DocumentSource =\n | ArrayBuffer\n | Uint8Array\n | string\n | { uri: string }\n | { data: ArrayBuffer | Uint8Array }\n | FileLike;\n\nexport type DocumentType = \"pdf\" | \"epub\" | \"text\";\n\nexport type ReadingMode =\n | \"focus\"\n | \"controlsVisible\"\n | \"readingDimmed\"\n | \"modalSurfaceOpen\"\n | \"annotate\";\n\nexport type ActiveSurface =\n | \"none\"\n | \"search\"\n | \"jump\"\n | \"outline\"\n | \"thumbnails\"\n | \"comments\"\n | \"info\"\n | \"documentActions\"\n | \"theme\";\n\nexport type MobilePrimaryDestination =\n | \"none\"\n | \"pages\"\n | \"contents\"\n | \"progress\"\n | \"search\"\n | \"notes\"\n | \"display\"\n | \"info\"\n | \"documentActions\"\n | \"annotate\";\n\nexport interface MobileShellState {\n activeMobileDestination: MobilePrimaryDestination;\n mobileKeyboardOpen: boolean;\n mobileDockVisible: boolean;\n mobileProgressPillVisible: boolean;\n}\n\nexport interface DocumentLocation {\n kind: \"page\" | \"section\" | \"progress\" | \"range\";\n label: string;\n primaryValue: number | string;\n secondaryValue?: number | string;\n engineTarget?: unknown;\n}\n\nexport type NavigationTarget = DocumentLocation;\n\nexport interface ReaderCapabilities {\n \"search.text\"?: boolean;\n \"navigation.page\"?: boolean;\n \"navigation.section\"?: boolean;\n \"documentActions.share\"?: boolean;\n \"documentActions.export\"?: boolean;\n}\n\nexport interface CapabilityState {\n status: \"unknown\" | \"ready\" | \"partial\";\n values: ReaderCapabilities;\n errors: string[];\n}\n\nexport interface DocumentLoadRequest {\n type: DocumentType;\n source: DocumentSource;\n}\n\nexport type DocumentLoadInput = DocumentSource | DocumentLoadRequest;\n\nexport interface TextItem {\n str: string;\n dir: string;\n width: number;\n height: number;\n transform: number[];\n fontName: string;\n}\n\nexport interface SearchResult {\n pageIndex: number;\n text: string;\n matchIndex: number;\n rects?: { x: number; y: number; width: number; height: number }[];\n}\n\nexport interface TextSelection {\n text: string;\n rects: { x: number; y: number; width: number; height: number }[];\n}\n\nexport interface AnnotationReply {\n id: string;\n annotationId: string;\n content: string;\n createdAt: number;\n}\n\nexport interface Annotation {\n id: string;\n type:\n | \"highlight\"\n | \"underline\"\n | \"squiggly\"\n | \"strikeout\"\n | \"text\"\n | \"comment\"\n | \"ink\";\n pageIndex: number;\n content?: string;\n rect: { x: number; y: number; width: number; height: number };\n rects?: { x: number; y: number; width: number; height: number }[];\n path?: { x: number; y: number }[];\n color: string;\n opacity?: number;\n strokeWidth?: number;\n createdAt: number;\n updatedAt?: number;\n replies?: AnnotationReply[];\n}\n\nexport interface OutlineItem {\n title: string;\n pageIndex: number;\n dest?: PageDestination;\n children?: OutlineItem[];\n}\n\nexport type PageDestination =\n | string\n | { kind: \"pageIndex\"; value: number }\n | { kind: \"pageNumber\"; value: number }\n | { kind: \"named\"; value: string }\n | { kind: \"href\"; value: string };\n\nexport interface PapyrusConfig {\n initialPage?: number;\n initialZoom?: number;\n initialRotation?: number;\n initialViewMode?: ViewMode;\n initialUITheme?: UITheme;\n initialPageTheme?: PageTheme;\n initialAccentColor?: string;\n initialLocale?: Locale;\n initialAnnotations?: Annotation[];\n sidebarLeftOpen?: boolean;\n sidebarRightOpen?: boolean;\n}\n\nexport enum PapyrusEventType {\n DOCUMENT_LOADED = \"DOCUMENT_LOADED\",\n PAGE_CHANGED = \"PAGE_CHANGED\",\n ZOOM_CHANGED = \"ZOOM_CHANGED\",\n ANNOTATION_CREATED = \"ANNOTATION_CREATED\",\n ANNOTATION_UPDATED = \"ANNOTATION_UPDATED\",\n ANNOTATION_DELETED = \"ANNOTATION_DELETED\",\n ANNOTATION_REPLY_ADDED = \"ANNOTATION_REPLY_ADDED\",\n SEARCH_TRIGGERED = \"SEARCH_TRIGGERED\",\n TEXT_SELECTED = \"TEXT_SELECTED\",\n}\n\nexport interface EventPayloads {\n [PapyrusEventType.DOCUMENT_LOADED]: { pageCount: number };\n [PapyrusEventType.PAGE_CHANGED]: { pageNumber: number };\n [PapyrusEventType.ZOOM_CHANGED]: { zoom: number };\n [PapyrusEventType.ANNOTATION_CREATED]: { annotation: Annotation };\n [PapyrusEventType.ANNOTATION_UPDATED]: { annotation: Annotation };\n [PapyrusEventType.ANNOTATION_DELETED]: { annotationId: string };\n [PapyrusEventType.ANNOTATION_REPLY_ADDED]: {\n annotationId: string;\n reply: AnnotationReply;\n annotation: Annotation;\n };\n [PapyrusEventType.SEARCH_TRIGGERED]: { query: string };\n [PapyrusEventType.TEXT_SELECTED]: { text: string; pageIndex: number };\n}\n\nexport type PapyrusEventListener<T extends PapyrusEventType> = (\n payload: EventPayloads[T]\n) => void;\n\n/**\n * Interface agnóstica do Motor.\n * A UI interage apenas com estes métodos.\n */\nexport interface DocumentEngine {\n load(source: DocumentSource): Promise<void>;\n load(request: DocumentLoadRequest): Promise<void>;\n getPageCount(): number;\n getCurrentPage(): number;\n goToPage(page: number): void;\n setZoom(zoom: number): void;\n getZoom(): number;\n rotate(direction: \"clockwise\" | \"counterclockwise\"): void;\n getRotation(): number;\n\n /**\n * Renderiza o conteúdo visual da página.\n * target: HTMLCanvasElement no Web ou NativeHandle no RN.\n */\n renderPage(pageIndex: number, target: any, scale: number): Promise<void>;\n\n /**\n * Renderiza a camada de texto para seleção.\n * container: HTMLElement no Web ou GhostView no RN.\n */\n renderTextLayer(\n pageIndex: number,\n container: any,\n scale: number\n ): Promise<void>;\n\n getTextContent(pageIndex: number): Promise<TextItem[]>;\n getPageDimensions(\n pageIndex: number\n ): Promise<{ width: number; height: number }>;\n searchText?(query: string): Promise<SearchResult[]>;\n selectText?(\n pageIndex: number,\n rect: { x: number; y: number; width: number; height: number }\n ): Promise<TextSelection | null>;\n getOutline(): Promise<OutlineItem[]>;\n getPageIndex(dest: PageDestination): Promise<number | null>;\n getRenderTargetType?(): RenderTargetType;\n destroy(): void;\n}\n"],"mappings":";AAuKO,IAAK,mBAAL,kBAAKA,sBAAL;AACL,EAAAA,kBAAA,qBAAkB;AAClB,EAAAA,kBAAA,kBAAe;AACf,EAAAA,kBAAA,kBAAe;AACf,EAAAA,kBAAA,wBAAqB;AACrB,EAAAA,kBAAA,wBAAqB;AACrB,EAAAA,kBAAA,wBAAqB;AACrB,EAAAA,kBAAA,4BAAyB;AACzB,EAAAA,kBAAA,sBAAmB;AACnB,EAAAA,kBAAA,mBAAgB;AATN,SAAAA;AAAA,GAAA;","names":["PapyrusEventType"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@papyrus-sdk/types",
3
- "version": "0.2.7",
3
+ "version": "0.2.8-beta.0",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "papyrus",
@@ -39,4 +39,4 @@
39
39
  "scripts": {
40
40
  "build": "tsup index.ts --dts --format cjs,esm --out-dir dist --clean --sourcemap"
41
41
  }
42
- }
42
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Papyrus Contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.