diff --git a/tsconfig.json b/tsconfig.json index 4a48983e6..7ff5a9de0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,7 +16,7 @@ "display-node_utils": ["./src/display/node_utils"], "fluent-bundle": ["./node_modules/@fluent/bundle/esm/index.js"], "fluent-dom": ["./node_modules/@fluent/dom/esm/index.js"], - "web-null_l10n": ["../web/genericl10n.js"] + "web-null_l10n": ["./web/genericl10n"] } }, "files": ["src/pdf.js", "web/pdf_viewer.component.js"] diff --git a/web/annotation_editor_params.js b/web/annotation_editor_params.js index f3362de20..22f453a1b 100644 --- a/web/annotation_editor_params.js +++ b/web/annotation_editor_params.js @@ -13,8 +13,22 @@ * limitations under the License. */ +/** @typedef {import("./event_utils.js").EventBus} EventBus */ + import { AnnotationEditorParamsType } from "pdfjs-lib"; +/** + * @typedef {Object} AnnotationEditorParamsOptions + * @property {HTMLInputElement} editorFreeTextFontSize + * @property {HTMLInputElement} editorFreeTextColor + * @property {HTMLInputElement} editorInkColor + * @property {HTMLInputElement} editorInkThickness + * @property {HTMLInputElement} editorInkOpacity + * @property {HTMLButtonElement} editorStampAddImage + * @property {HTMLInputElement} editorFreeHighlightThickness + * @property {HTMLButtonElement} editorHighlightShowAll + */ + class AnnotationEditorParams { /** * @param {AnnotationEditorParamsOptions} options @@ -25,6 +39,9 @@ class AnnotationEditorParams { this.#bindListeners(options); } + /** + * @param {AnnotationEditorParamsOptions} options + */ #bindListeners({ editorFreeTextFontSize, editorFreeTextColor, diff --git a/web/app.js b/web/app.js index b0f6226df..3c6457459 100644 --- a/web/app.js +++ b/web/app.js @@ -13,6 +13,12 @@ * limitations under the License. */ +/** @typedef {import("./interfaces.js").IL10n} IL10n */ +// eslint-disable-next-line max-len +/** @typedef {import("../src/display/api.js").PDFDocumentProxy} PDFDocumentProxy */ +// eslint-disable-next-line max-len +/** @typedef {import("../src/display/api.js").PDFDocumentLoadingTask} PDFDocumentLoadingTask */ + import { animationStarted, apiPageLayoutToViewerModes, @@ -96,7 +102,9 @@ const PDFViewerApplication = { settled: false, }, appConfig: null, + /** @type {PDFDocumentProxy} */ pdfDocument: null, + /** @type {PDFDocumentLoadingTask} */ pdfLoadingTask: null, printService: null, /** @type {PDFViewer} */ diff --git a/web/base_tree_viewer.js b/web/base_tree_viewer.js index 5d91f7487..b5875e14d 100644 --- a/web/base_tree_viewer.js +++ b/web/base_tree_viewer.js @@ -43,14 +43,14 @@ class BaseTreeViewer { } /** - * @private + * @protected */ _dispatchEvent(count) { throw new Error("Not implemented: _dispatchEvent"); } /** - * @private + * @protected */ _bindLink(element, params) { throw new Error("Not implemented: _bindLink"); @@ -71,7 +71,9 @@ class BaseTreeViewer { /** * Prepend a button before a tree item which allows the user to collapse or * expand all tree items at that level; see `_toggleTreeItem`. - * @private + * @param {HTMLDivElement} div + * @param {boolean|object} [hidden] + * @protected */ _addToggleButton(div, hidden = false) { const toggler = document.createElement("div"); diff --git a/web/external_services.js b/web/external_services.js index 509e08470..fa1f086b4 100644 --- a/web/external_services.js +++ b/web/external_services.js @@ -13,6 +13,8 @@ * limitations under the License. */ +/** @typedef {import("./interfaces.js").IL10n} IL10n */ + class BaseExternalServices { constructor() { if (this.constructor === BaseExternalServices) { @@ -28,6 +30,9 @@ class BaseExternalServices { reportTelemetry(data) {} + /** + * @returns {Promise} + */ async createL10n() { throw new Error("Not implemented: createL10n"); } diff --git a/web/grab_to_pan.js b/web/grab_to_pan.js index c564802b2..cdec601c7 100644 --- a/web/grab_to_pan.js +++ b/web/grab_to_pan.js @@ -17,10 +17,15 @@ // Class name of element which can be grabbed. const CSS_CLASS_GRAB = "grab-to-pan-grab"; +/** + * @typedef {Object} GrabToPanOptions + * @property {HTMLElement} element + */ + class GrabToPan { /** * Construct a GrabToPan instance for a given HTML element. - * @param {Element} options.element + * @param {GrabToPanOptions} options */ constructor({ element }) { this.element = element; diff --git a/web/password_prompt.js b/web/password_prompt.js index f48912329..a1f84cdc1 100644 --- a/web/password_prompt.js +++ b/web/password_prompt.js @@ -13,6 +13,8 @@ * limitations under the License. */ +/** @typedef {import("./overlay_manager.js").OverlayManager} OverlayManager */ + import { PasswordResponses } from "pdfjs-lib"; /** diff --git a/web/pdf_attachment_viewer.js b/web/pdf_attachment_viewer.js index f1106176e..53aef16db 100644 --- a/web/pdf_attachment_viewer.js +++ b/web/pdf_attachment_viewer.js @@ -13,6 +13,10 @@ * limitations under the License. */ +/** @typedef {import("./event_utils.js").EventBus} EventBus */ +// eslint-disable-next-line max-len +/** @typedef {import("./download_manager.js").DownloadManager} DownloadManager */ + import { BaseTreeViewer } from "./base_tree_viewer.js"; import { getFilenameFromUrl } from "pdfjs-lib"; import { waitOnEventOrTimeout } from "./event_utils.js"; @@ -27,6 +31,7 @@ import { waitOnEventOrTimeout } from "./event_utils.js"; /** * @typedef {Object} PDFAttachmentViewerRenderParameters * @property {Object|null} attachments - A lookup table of attachment objects. + * @property {boolean} [keepRenderedCapability] */ class PDFAttachmentViewer extends BaseTreeViewer { @@ -56,7 +61,7 @@ class PDFAttachmentViewer extends BaseTreeViewer { } /** - * @private + * @protected */ async _dispatchEvent(attachmentsCount) { this._renderedCapability.resolve(); @@ -87,7 +92,7 @@ class PDFAttachmentViewer extends BaseTreeViewer { } /** - * @private + * @protected */ _bindLink(element, { content, filename }) { element.onclick = () => { diff --git a/web/pdf_cursor_tools.js b/web/pdf_cursor_tools.js index 94c545353..ff94f1238 100644 --- a/web/pdf_cursor_tools.js +++ b/web/pdf_cursor_tools.js @@ -13,6 +13,8 @@ * limitations under the License. */ +/** @typedef {import("./event_utils.js").EventBus} EventBus */ + import { AnnotationEditorType, shadow } from "pdfjs-lib"; import { CursorTool, PresentationModeState } from "./ui_utils.js"; import { GrabToPan } from "./grab_to_pan.js"; diff --git a/web/pdf_document_properties.js b/web/pdf_document_properties.js index 0b029b7cb..625c12575 100644 --- a/web/pdf_document_properties.js +++ b/web/pdf_document_properties.js @@ -13,6 +13,12 @@ * limitations under the License. */ +/** @typedef {import("./event_utils.js").EventBus} EventBus */ +/** @typedef {import("./interfaces.js").IL10n} IL10n */ +/** @typedef {import("./overlay_manager.js").OverlayManager} OverlayManager */ +// eslint-disable-next-line max-len +/** @typedef {import("../src/display/api.js").PDFDocumentProxy} PDFDocumentProxy */ + import { getPageSizeInches, isPortraitOrientation } from "./ui_utils.js"; import { PDFDateString } from "pdfjs-lib"; diff --git a/web/pdf_layer_viewer.js b/web/pdf_layer_viewer.js index e9c1150fc..207d6d65b 100644 --- a/web/pdf_layer_viewer.js +++ b/web/pdf_layer_viewer.js @@ -13,6 +13,12 @@ * limitations under the License. */ +/** @typedef {import("./event_utils.js").EventBus} EventBus */ +// eslint-disable-next-line max-len +/** @typedef {import("../src/optional_content_config.js").OptionalContentConfig} OptionalContentConfig */ +// eslint-disable-next-line max-len +/** @typedef {import("../src/display/api.js").PDFDocumentProxy} PDFDocumentProxy */ + import { BaseTreeViewer } from "./base_tree_viewer.js"; /** @@ -25,7 +31,7 @@ import { BaseTreeViewer } from "./base_tree_viewer.js"; * @typedef {Object} PDFLayerViewerRenderParameters * @property {OptionalContentConfig|null} optionalContentConfig - An * {OptionalContentConfig} instance. - * @property {PDFDocument} pdfDocument - A {PDFDocument} instance. + * @property {PDFDocumentProxy} pdfDocument - A {PDFDocument} instance. */ class PDFLayerViewer extends BaseTreeViewer { @@ -48,7 +54,7 @@ class PDFLayerViewer extends BaseTreeViewer { } /** - * @private + * @protected */ _dispatchEvent(layersCount) { this.eventBus.dispatch("layersloaded", { @@ -58,7 +64,7 @@ class PDFLayerViewer extends BaseTreeViewer { } /** - * @private + * @protected */ _bindLink(element, { groupId, input }) { const setVisibility = () => { @@ -97,7 +103,7 @@ class PDFLayerViewer extends BaseTreeViewer { } /** - * @private + * @protected */ _addToggleButton(div, { name = null }) { super._addToggleButton(div, /* hidden = */ name === null); diff --git a/web/pdf_outline_viewer.js b/web/pdf_outline_viewer.js index 02e4d5f27..a198767b4 100644 --- a/web/pdf_outline_viewer.js +++ b/web/pdf_outline_viewer.js @@ -13,6 +13,13 @@ * limitations under the License. */ +/** @typedef {import("./event_utils.js").EventBus} EventBus */ +// eslint-disable-next-line max-len +/** @typedef {import("./download_manager.js").DownloadManager} DownloadManager */ +/** @typedef {import("./interfaces.js").IPDFLinkService} IPDFLinkService */ +// eslint-disable-next-line max-len +/** @typedef {import("../src/display/api.js").PDFDocumentProxy} PDFDocumentProxy */ + import { BaseTreeViewer } from "./base_tree_viewer.js"; import { SidebarView } from "./ui_utils.js"; @@ -27,7 +34,7 @@ import { SidebarView } from "./ui_utils.js"; /** * @typedef {Object} PDFOutlineViewerRenderParameters * @property {Array|null} outline - An array of outline objects. - * @property {PDFDocument} pdfDocument - A {PDFDocument} instance. + * @property {PDFDocumentProxy} pdfDocument - A {PDFDocument} instance. */ class PDFOutlineViewer extends BaseTreeViewer { @@ -75,7 +82,7 @@ class PDFOutlineViewer extends BaseTreeViewer { } /** - * @private + * @protected */ _dispatchEvent(outlineCount) { this._currentOutlineItemCapability = Promise.withResolvers(); @@ -98,7 +105,7 @@ class PDFOutlineViewer extends BaseTreeViewer { } /** - * @private + * @protected */ _bindLink( element, @@ -162,7 +169,7 @@ class PDFOutlineViewer extends BaseTreeViewer { } /** - * @private + * @protected */ _addToggleButton(div, { count, items }) { let hidden = false; diff --git a/web/pdf_presentation_mode.js b/web/pdf_presentation_mode.js index e916693a9..cc2be0c2f 100644 --- a/web/pdf_presentation_mode.js +++ b/web/pdf_presentation_mode.js @@ -13,6 +13,9 @@ * limitations under the License. */ +/** @typedef {import("./event_utils.js").EventBus} EventBus */ +/** @typedef {import("./pdf_viewer.js").PDFViewer} PDFViewer */ + import { normalizeWheelEventDelta, PresentationModeState, diff --git a/web/pdf_print_service.js b/web/pdf_print_service.js index 1985aa4ad..78ea670a7 100644 --- a/web/pdf_print_service.js +++ b/web/pdf_print_service.js @@ -13,6 +13,9 @@ * limitations under the License. */ +// eslint-disable-next-line max-len +/** @typedef {import("./interfaces.js").IPDFPrintServiceFactory} IPDFPrintServiceFactory */ + import { AnnotationMode, PixelsPerInch, diff --git a/web/pdf_sidebar.js b/web/pdf_sidebar.js index d61c2bc51..5f3ab9431 100644 --- a/web/pdf_sidebar.js +++ b/web/pdf_sidebar.js @@ -13,6 +13,9 @@ * limitations under the License. */ +/** @typedef {import("./event_utils.js").EventBus} EventBus */ +/** @typedef {import("./interfaces.js").IL10n} IL10n */ + import { docStyle, PresentationModeState, diff --git a/web/secondary_toolbar.js b/web/secondary_toolbar.js index 296249eec..1206e4833 100644 --- a/web/secondary_toolbar.js +++ b/web/secondary_toolbar.js @@ -13,6 +13,8 @@ * limitations under the License. */ +/** @typedef {import("./event_utils.js").EventBus} EventBus */ + import { CursorTool, ScrollMode, diff --git a/web/toolbar.js b/web/toolbar.js index d59f30556..e92b546c4 100644 --- a/web/toolbar.js +++ b/web/toolbar.js @@ -13,6 +13,8 @@ * limitations under the License. */ +/** @typedef {import("./event_utils.js").EventBus} EventBus */ + import { AnnotationEditorType, ColorPicker, noContextMenu } from "pdfjs-lib"; import { DEFAULT_SCALE,