@d-i-t-a/reader 3.0.0-alpha.13 → 3.0.0-alpha.14
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/esm/index.js +25 -16
- package/dist/esm/index.js.map +3 -3
- package/dist/reader.js +46 -46
- package/dist/reader.js.map +3 -3
- package/dist/types/index.d.ts +2 -0
- package/dist/types/navigator/PDFNavigator.d.ts +0 -4
- package/dist/types/navigator/VisualNavigator.d.ts +1 -1
- package/dist/types/types/pdfjs-workarounds.d.ts +1 -13
- package/dist/types/utils/Events.d.ts +10 -0
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -16305,7 +16305,11 @@ var init_Events = __esm({
|
|
|
16305
16305
|
InspectDetected: "inspect.detected",
|
|
16306
16306
|
// Consumption tracking
|
|
16307
16307
|
ActionTracked: "consumption.action",
|
|
16308
|
-
IdleSince: "consumption.idle"
|
|
16308
|
+
IdleSince: "consumption.idle",
|
|
16309
|
+
// PDF page navigation
|
|
16310
|
+
PageChanged: "page.changed",
|
|
16311
|
+
// PDF search matches
|
|
16312
|
+
PdfMatchesUpdated: "pdf.matches.updated"
|
|
16309
16313
|
};
|
|
16310
16314
|
}
|
|
16311
16315
|
});
|
|
@@ -70019,11 +70023,10 @@ var PDFNavigator_exports = {};
|
|
|
70019
70023
|
__export(PDFNavigator_exports, {
|
|
70020
70024
|
AnnotationEditorType: () => AnnotationEditorType,
|
|
70021
70025
|
PDFNavigator: () => PDFNavigator,
|
|
70022
|
-
ScaleType: () => ScaleType,
|
|
70023
70026
|
ScrollMode: () => ScrollMode,
|
|
70024
70027
|
SpreadMode: () => SpreadMode
|
|
70025
70028
|
});
|
|
70026
|
-
var import_loglevel26,
|
|
70029
|
+
var import_loglevel26, PDFNavigator;
|
|
70027
70030
|
var init_PDFNavigator = __esm({
|
|
70028
70031
|
"src/navigator/PDFNavigator.ts"() {
|
|
70029
70032
|
init_polyfills();
|
|
@@ -70039,11 +70042,6 @@ var init_PDFNavigator = __esm({
|
|
|
70039
70042
|
init_pdfjs_workarounds();
|
|
70040
70043
|
init_GrabToPan();
|
|
70041
70044
|
init_HTMLTemplates();
|
|
70042
|
-
ScaleType = /* @__PURE__ */ ((ScaleType2) => {
|
|
70043
|
-
ScaleType2[ScaleType2["Page"] = 0] = "Page";
|
|
70044
|
-
ScaleType2[ScaleType2["Width"] = 1] = "Width";
|
|
70045
|
-
return ScaleType2;
|
|
70046
|
-
})(ScaleType || {});
|
|
70047
70045
|
PDFNavigator = class extends VisualNavigator {
|
|
70048
70046
|
constructor(settings, publication, api, workerSrc, annotator, initialLastReadingPosition, viewStore, rights, modules) {
|
|
70049
70047
|
super();
|
|
@@ -70206,6 +70204,10 @@ var init_PDFNavigator = __esm({
|
|
|
70206
70204
|
({ pageNumber }) => {
|
|
70207
70205
|
this.pageNum = pageNumber;
|
|
70208
70206
|
this.saveLastReadingPosition();
|
|
70207
|
+
this.emit(ReaderEvent.PageChanged, {
|
|
70208
|
+
page: pageNumber,
|
|
70209
|
+
totalPages: this._pdfDoc?.numPages ?? this._numPages
|
|
70210
|
+
});
|
|
70209
70211
|
if (this.atStart()) {
|
|
70210
70212
|
this.api?.resourceAtStart?.();
|
|
70211
70213
|
this.emit(ReaderEvent.ResourceStart, {
|
|
@@ -70596,6 +70598,7 @@ var init_PdfSearchModule = __esm({
|
|
|
70596
70598
|
init_polyfills();
|
|
70597
70599
|
init_ReaderModule();
|
|
70598
70600
|
init_VisualNavigator();
|
|
70601
|
+
init_Events();
|
|
70599
70602
|
PdfSearchModule = class {
|
|
70600
70603
|
constructor() {
|
|
70601
70604
|
this.name = NavigatorFeature.Search;
|
|
@@ -70611,6 +70614,10 @@ var init_PdfSearchModule = __esm({
|
|
|
70611
70614
|
if (evt?.matchesCount) {
|
|
70612
70615
|
this._currentMatch = evt.matchesCount.current ?? 0;
|
|
70613
70616
|
this._matchCount = evt.matchesCount.total ?? 0;
|
|
70617
|
+
this.host.emit(ReaderEvent.PdfMatchesUpdated, {
|
|
70618
|
+
current: this._currentMatch,
|
|
70619
|
+
total: this._matchCount
|
|
70620
|
+
});
|
|
70614
70621
|
}
|
|
70615
70622
|
};
|
|
70616
70623
|
}
|
|
@@ -70788,14 +70795,14 @@ var init_PdfAnnotationModule = __esm({
|
|
|
70788
70795
|
*/
|
|
70789
70796
|
getAll() {
|
|
70790
70797
|
const result = [];
|
|
70791
|
-
|
|
70792
|
-
this.host.pdfDoc
|
|
70793
|
-
|
|
70794
|
-
|
|
70795
|
-
|
|
70796
|
-
|
|
70797
|
-
|
|
70798
|
-
|
|
70798
|
+
if (this.host.pdfDoc) {
|
|
70799
|
+
const { map } = getSerializable(this.host.pdfDoc.annotationStorage);
|
|
70800
|
+
if (map) {
|
|
70801
|
+
for (const value of map.values()) {
|
|
70802
|
+
result.push(
|
|
70803
|
+
_PdfAnnotationModule.toJsonSafe(value)
|
|
70804
|
+
);
|
|
70805
|
+
}
|
|
70799
70806
|
}
|
|
70800
70807
|
}
|
|
70801
70808
|
if (this.pendingAnnotations) {
|
|
@@ -92093,6 +92100,7 @@ init_VisualNavigator();
|
|
|
92093
92100
|
init_ReaderModule();
|
|
92094
92101
|
init_ModuleRegistry();
|
|
92095
92102
|
init_ModuleAccessors();
|
|
92103
|
+
init_v3();
|
|
92096
92104
|
var index_default = D2Reader;
|
|
92097
92105
|
var load = D2Reader.load;
|
|
92098
92106
|
export {
|
|
@@ -92107,6 +92115,7 @@ export {
|
|
|
92107
92115
|
ReaderEvent,
|
|
92108
92116
|
RightsKey,
|
|
92109
92117
|
index_default as default,
|
|
92118
|
+
getPageFromLocations,
|
|
92110
92119
|
load
|
|
92111
92120
|
};
|
|
92112
92121
|
/*! Bundled license information:
|