@papyrus-sdk/types 0.2.6 → 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 +44 -13
- package/dist/index.d.ts +44 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
type ViewMode =
|
|
2
|
-
type UITheme =
|
|
3
|
-
type PageTheme =
|
|
4
|
-
type Locale =
|
|
5
|
-
type RenderTargetType =
|
|
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 =
|
|
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:
|
|
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:
|
|
118
|
+
kind: "pageIndex";
|
|
88
119
|
value: number;
|
|
89
120
|
} | {
|
|
90
|
-
kind:
|
|
121
|
+
kind: "pageNumber";
|
|
91
122
|
value: number;
|
|
92
123
|
} | {
|
|
93
|
-
kind:
|
|
124
|
+
kind: "named";
|
|
94
125
|
value: string;
|
|
95
126
|
} | {
|
|
96
|
-
kind:
|
|
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:
|
|
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 =
|
|
2
|
-
type UITheme =
|
|
3
|
-
type PageTheme =
|
|
4
|
-
type Locale =
|
|
5
|
-
type RenderTargetType =
|
|
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 =
|
|
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:
|
|
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:
|
|
118
|
+
kind: "pageIndex";
|
|
88
119
|
value: number;
|
|
89
120
|
} | {
|
|
90
|
-
kind:
|
|
121
|
+
kind: "pageNumber";
|
|
91
122
|
value: number;
|
|
92
123
|
} | {
|
|
93
|
-
kind:
|
|
124
|
+
kind: "named";
|
|
94
125
|
value: string;
|
|
95
126
|
} | {
|
|
96
|
-
kind:
|
|
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:
|
|
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":["
|
|
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"]}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../index.ts"],"sourcesContent":["
|
|
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"]}
|